diff options
106 files changed, 5043 insertions, 901 deletions
diff --git a/sql/updates/world/2011_10_05_00_world_spell_linked_spell.sql b/sql/updates/world/2011_10_05_00_world_spell_linked_spell.sql new file mode 100644 index 00000000000..762a07620f9 --- /dev/null +++ b/sql/updates/world/2011_10_05_00_world_spell_linked_spell.sql @@ -0,0 +1 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` = -58600; diff --git a/sql/updates/world/2011_10_05_01_world_instance_misc.sql b/sql/updates/world/2011_10_05_01_world_instance_misc.sql new file mode 100644 index 00000000000..656cdd575d2 --- /dev/null +++ b/sql/updates/world/2011_10_05_01_world_instance_misc.sql @@ -0,0 +1,201 @@ +DELETE FROM `creature_text` WHERE `entry` IN (36597,38995,38579,36823,39217); +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(36597,0,0,'So the Light''s vaunted justice has finally arrived? Shall I lay down Frostmourne and throw myself at your mercy, Fordring?',14,0,0,0,0,17349,'The Lich King - SAY_LK_INTRO_1'), +(36597,1,0,'You''ll learn of that first hand. When my work is complete, you will beg for mercy -- and I will deny you. Your anguished cries will be testament to my unbridled power...',14,0,0,22,0,17350,'The Lich King - SAY_LK_INTRO_2'), +(36597,2,0,'I''ll keep you alive to witness the end, Fordring. I would not want the Light''s greatest champion to miss seeing this wretched world remade in my image.',14,0,0,0,0,17351,'The Lich King - SAY_LK_INTRO_3'), +(36597,3,0,'Come then champions, feed me your rage!',14,0,0,0,0,0,'The Lich King - SAY_LK_AGGRO'), +(36597,4,0,'I will freeze you from within until all that remains is an icy husk!',14,0,0,0,0,17369,'The Lich King - SAY_LK_REMORSELESS_WINTER'), +(36597,5,0,'Watch as the world around you collapses!',14,0,0,0,0,17370,'The Lich King - SAY_LK_QUAKE'), +(36597,6,0,'Val''kyr, your master calls!',14,0,0,0,0,17373,'The Lich King - SAY_LK_SUMMON_VALKYR'), +(36597,7,0,'Frostmourne hungers...',14,0,0,0,0,17366,'The Lich King - SAY_LK_HARVEST_SOUL'), +(36597,8,0,'Argh... Frostmourne, obey me!',14,0,0,0,0,17367,'The Lich King - SAY_LK_FROSTMOURNE_ESCAPE'), +(36597,9,0,'Frostmourne feeds on the soul of your fallen ally!',14,0,0,0,0,17368,'The Lich King - SAY_LK_FROSTMOURNE_KILL'), +(36597,10,0,'Hope wanes!',14,0,0,0,0,17363,'The Lich King - SAY_LK_KILL'), +(36597,10,1,'The end has come!',14,0,0,0,0,17364,'The Lich King - SAY_LK_KILL'), +(36597,11,0,'Face now your tragic end!',14,0,0,0,0,17365,'The Lich King - SAY_LK_BERSERK'), +(36597,12,0,'%s begins to cast Defile!',41,0,0,0,0,0,'The Lich King - EMOTE_DEFILE_WARNING'), +(36597,13,0,'|TInterface\\Icons\\ability_creature_disease_02.blp:16|tYou have been infected by |cFFCF00FFNecrotic Plague!|r',42,0,0,0,0,0,'The Lich King - EMOTE_NECROTIC_PLAGUE_WARNING'), +(36597,14,0,'No questions remain unanswered. No doubts linger. You ARE Azeroth''s greatest champions. You overcame every challenge I laid before you. My mightiest servants have fallen before your relentless onslaught... your unbridled fury...',14,0,0,0,0,17353,'The Lich King - SAY_LK_OUTRO_1'), +(36597,15,0,'Is it truly the righteousness that drives you? I wonder...',14,0,0,0,0,17354,'The Lich King - SAY_LK_OUTRO_2'), +(36597,16,0,'You trained them well, Fordring. You delivered the greatest fighting force this world has ever known... right into my hands -- exactly as I intended. You shall be rewarded for your unwitting sacrifice.',14,0,0,0,0,17355,'The Lich King - SAY_LK_OUTRO_3'), +(36597,17,0,'Watch now as I raise them from the dead to become masters of the Scourge. They will shroud this world in chaos and destruction. Azeroth''s fall will come at their hands -- and you will be the first to die.',14,0,0,0,0,17356,'The Lich King - SAY_LK_OUTRO_4'), +(36597,18,0,'I delight in the irony...',14,0,0,0,0,17357,'The Lich King - SAY_LK_OUTRO_5'), +(36597,19,0,'Impossible...',14,0,0,0,0,17358,'The Lich King - SAY_LK_OUTRO_6'), +(36597,20,0,'Now I stand, the lion before the lambs... and they do not fear.',14,0,0,0,0,17361,'The Lich King - SAY_LK_OUTRO_7'), +(36597,21,0,'They cannot fear.',14,0,0,0,0,17362,'The Lich King - SAY_LK_OUTRO_8'), +(38995,0,0,'We''ll grant you a swift death, Arthas. More than can be said for the thousands you''ve tortured and slain.',14,0,0,0,0,17390,'Highlord Tirion Fordring - SAY_TIRION_INTRO_1'), +(38995,1,0,'So be it. Champions, attack!',14,0,0,0,0,17391,'Highlord Tirion Fordring - SAY_TIRION_INTRO_2'), +(38995,2,0,'LIGHT, GRANT ME ONE FINAL BLESSING. GIVE ME THE STRENGTH... TO SHATTER THESE BONDS!',14,0,0,0,0,17392,'Highlord Tirion Fordring - SAY_TIRION_OUTRO_1'), +(38995,3,0,'No more, Arthas! No more lives will be consumed by your hatred!',14,0,0,0,0,17393,'Highlord Tirion Fordring - SAY_TIRION_OUTRO_2'), +(38579,0,0,'Free at last! It is over, my son. This is the moment of reckoning.',14,0,0,1,0,17397,'Terenas Menethil - SAY_TERENAS_OUTRO_1'), +(38579,1,0,'Rise up, champions of the Light!',14,0,0,0,0,17398,'Terenas Menethil - SAY_TERENAS_OUTRO_2'), +(36823,0,0,'You have come to bring Arthas to justice? To see the Lich King destroyed?',14,0,0,0,0,17394,'Terenas Menethil - SAY_TERENAS_INTRO_1'), +(36823,1,0,'First, you must escape Frostmourne''s hold, or be damned as I am; trapped within this cursed blade for all eternity.',14,0,0,0,0,17395,'Terenas Menethil - SAY_TERENAS_INTRO_2'), +(36823,2,0,'Aid me in destroying these tortured souls! Together we will loosen Frostmourne''s hold and weaken the Lich King from within!',14,0,0,0,0,17396,'Terenas Menethil - SAY_TERENAS_INTRO_3'), +(39217,0,0,'You have come to bring Arthas to justice? To see the Lich King destroyed?',14,0,0,0,0,17394,'Terenas Menethil - SAY_TERENAS_INTRO_1'), +(39217,1,0,'First, you must escape Frostmourne''s hold, or be damned as I am; trapped within this cursed blade for all eternity.',14,0,0,0,0,17395,'Terenas Menethil - SAY_TERENAS_INTRO_2'); + +-- Text corrections +DELETE FROM `creature_text` WHERE `entry`=36627 AND `groupid` IN (4,9); +DELETE FROM `creature_text` WHERE `entry`=36678 AND `groupid`=9; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(36627,4,0,'|TInterface\\Icons\\spell_shadow_unstableaffliction_2.blp:16|t%s begins to cast |cFFFF0000Unstable Ooze Explosion!|r',41,0,0,0,0,0,'Rotface - EMOTE_UNSTABLE_EXPLOSION'), +(36627,9,0,'|TInterface\\Icons\\ability_creature_disease_02.blp:16|tYou have |cFF00FF00Mutated Infection!|r',42,0,0,0,0,0,'Rotface - EMOTE_MUTATED_INFECTION'), +(36678,9,0,'|TInterface\\Icons\\inv_misc_herb_evergreenmoss.blp:16|t%s cast |cFF00FF00Malleable Goo!|r',41,0,0,0,0,0,'Professor Putricide - EMOTE_MALLEABLE_GOO'); + +UPDATE `creature_template` SET `speed_walk`=2,`speed_run`=1.71429,`exp`=2,`minlevel`=83,`maxlevel`=83,`faction_A`=974,`faction_H`=974,`unit_flags`=768,`dynamicflags`=0,`equipment_id`=2425,`baseattacktime`=1500 WHERE `entry` IN (36597,39166,39167,39168); -- The Lich King +UPDATE `creature_template` SET `exp`=2,`unit_class`=2 WHERE `entry`=38995; -- Highlord Tirion Fordring +UPDATE `creature_template` SET `speed_walk`=1.2,`speed_run`=0.428571,`exp`=2,`minlevel`=80,`maxlevel`=80,`faction_A`=14,`faction_H`=14,`dynamicflags`=0 WHERE `entry` IN (36633,39305,39306,39307); -- Ice Sphere +UPDATE `creature_template` SET `speed_walk`=2,`speed_run`=1.42857,`exp`=2,`minlevel`=83,`maxlevel`=83,`faction_A`=14,`faction_H`=14,`dynamicflags`=0 WHERE `entry`=36701; -- Raging Spirit +UPDATE `creature_template` SET `speed_walk`=1.2,`speed_run`=0.428571,`exp`=2,`minlevel`=80,`maxlevel`=80,`faction_A`=14,`faction_H`=14,`dynamicflags`=0,`unit_flags`=33554944 WHERE `entry`=38757; -- Defile +UPDATE `creature_template` SET `minlevel`=80,`maxlevel`=80,`exp`=2,`faction_A`=14,`faction_H`=14,`speed_walk`=2,`speed_run`=1.71429,`unit_flags`=33554944,`dynamicflags`=0,`VehicleId`=532,`InhabitType`=1|4 WHERE `entry` IN (36609,39120,39121,39122); -- Val'kyr Shadowguard +UPDATE `creature_template` SET `speed_walk`=2,`speed_run`=1.71429,`exp`=2,`minlevel`=83,`maxlevel`=83,`faction_A`=35,`faction_H`=35,`unit_flags`=33554944,`dynamicflags`=0,`VehicleId`=531,`InhabitType`=1|4,`flags_extra`=0 WHERE `entry`=36598; -- Strangulate Vehicle +UPDATE `creature_template` SET `speed_walk`=1.2,`speed_run`=0.428571,`exp`=2,`minlevel`=80,`maxlevel`=80,`faction_A`=14,`faction_H`=14,`unit_flags`=33554944,`dynamicflags`=0,`flags_extra`=128 WHERE `entry`=38584; -- Frostmourne Trigger +UPDATE `creature_template` SET `speed_walk`=2.8,`speed_run`=1,`exp`=2,`minlevel`=80,`maxlevel`=80,`faction_A`=14,`faction_H`=14,`unit_flags`=32832,`dynamicflags`=0,`flags_extra`=256,`InhabitType`=1|4 WHERE `entry` IN (37799,39284,39285,39286); -- Vile Spirit +UPDATE `creature_template` SET `speed_walk`=1,`speed_run`=1,`exp`=2,`minlevel`=80,`maxlevel`=80,`faction_A`=1665,`faction_H`=1665,`unit_flags`=32832,`dynamicflags`=0,`flags_extra`=0,`equipment_id`=2475 WHERE `entry` IN (36823,38579,39217); -- Terenas Menethil +UPDATE `creature_template` SET `flags_extra`=`flags_extra`|128 WHERE `entry`=24648; -- Invisible Stalker (Scale x2) +UPDATE `creature_template` SET `difficulty_entry_1`=39287,`difficulty_entry_2`=39288,`difficulty_entry_3`=39289 WHERE `entry`=39190; -- Wicked Spirit +UPDATE `creature_template` SET `speed_walk`=2.8,`speed_run`=1,`exp`=2,`minlevel`=80,`maxlevel`=80,`faction_A`=14,`faction_H`=14,`unit_flags`=32832,`dynamicflags`=0,`flags_extra`=256,`InhabitType`=1|4 WHERE `entry` IN (39190,39287,39288,39289); -- Wicked Spirit +UPDATE `creature_template` SET `exp`=2,`minlevel`=83,`maxlevel`=83,`faction_A`=14,`faction_H`=14,`dynamicflags`=0,`flags_extra`=256 WHERE `entry`=36824; -- Spirit Warden +UPDATE `creature_template` SET `exp`=2,`minlevel`=83,`maxlevel`=83,`faction_A`=14,`faction_H`=14,`dynamicflags`=0,`flags_extra`=128 WHERE `entry`=39137; -- Shadow Trap +UPDATE `creature_template` SET `exp`=2,`minlevel`=80,`maxlevel`=80,`faction_A`=14,`faction_H`=14,`InhabitType`=1|4,`flags_extra`=`flags_extra`|128 WHERE `entry`=39189; -- Spirit Bomb + +-- HACK, Unit::_IsValidAttackTarget returns false because of UNIT_FLAG_OOC_NOT_ATTACKABLE flag +UPDATE `creature_template` SET `unit_flags`=0x02000000 WHERE `entry`=36171; + +UPDATE `creature_model_info` SET `combat_reach`=5.5 WHERE `modelid`=30721; -- The Lich King +UPDATE `creature_model_info` SET `gender`=0 WHERE `modelid`=31286; -- Highlord Tirion Fordring + +DELETE FROM `creature` WHERE `guid`=202865; +DELETE FROM `creature_addon` WHERE `guid`=150211; +INSERT INTO `creature_addon` (`guid`,`bytes1`,`auras`) VALUES +(150211,1,'72846 73220 73878'); -- The Lich King + +DELETE FROM `creature_template_addon` WHERE `entry` IN (39137,36609,39120,39121,39122,36598,37799,39284,39285,39286,39190,39287,39288,39289,36823,38579,39217,39189); +INSERT INTO `creature_template_addon` (`entry`,`bytes1`,`auras`) VALUES +(39137,0,'73530'), +(36609,50331648,''), -- Val'kyr Shadowguard +(39120,50331648,''), -- Val'kyr Shadowguard +(39121,50331648,''), -- Val'kyr Shadowguard +(39122,50331648,''), -- Val'kyr Shadowguard +(36598,50331648,''), -- Strangulate Vehicle +(37799,50331648,''), -- Vile Spirit +(39284,50331648,''), -- Vile Spirit +(39285,50331648,''), -- Vile Spirit +(39286,50331648,''), -- Vile Spirit +(39190,50331648,''), -- Wicked Spirit +(39287,50331648,''), -- Wicked Spirit +(39288,50331648,''), -- Wicked Spirit +(39289,50331648,''), -- Wicked Spirit +(36823,0,'72372'), -- Terenas Menethil +(38579,0,'72372'), -- Terenas Menethil +(39217,0,'72372'), -- Terenas Menethil +(39189,0,'73572'); -- Spirit Bomb + +UPDATE `gameobject` SET `rotation3`=1,`animprogress`=255,`spawntimesecs`=604800 WHERE `guid` IN (100056,100061,100064); +UPDATE `gameobject` SET `rotation2`=1,`animprogress`=255,`spawntimesecs`=604800 WHERE `guid` IN (100057,100058,100059,100060,100062); +UPDATE `gameobject` SET `rotation3`=1,`animprogress`=255,`spawntimesecs`=-604800 WHERE `guid`=100063; + +UPDATE `gameobject_template` SET `faction`=1375,`flags`=32 WHERE `entry`=202438; -- Lavaman Pillars (Unchained) +UPDATE `gameobject_template` SET `faction`=1375,`flags`=32 WHERE `entry`=202188; -- Doodad_Icecrown_ThroneFrostyWind01 +UPDATE `gameobject_template` SET `faction`=1375,`flags`=32 WHERE `entry`=202189; -- Doodad_Icecrown_ThroneFrostyEdge01 + +DELETE FROM `gameobject` WHERE `id`=202438; +INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`position_x`,`position_y`,`position_z`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES +(100488,202438,631,15,425.0885,-2123.311,858.6748,1,-604800,255,1); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (71614,70338,73785,73786,73787,68981,74270,74271,74272,72262,71440,76379,74086,72595,73650,72679,74318,74319,74320,73028,74321,74322,74323,73582,71809,71811,72431,72405,72429,73159); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,0,71614,0,18,1,38995,0,0, '', 'Ice Lock - target Highlord Tirion Fordring'), +(13,0,70338,0,18,1,0,0,0, '', 'Necrotic Plague - target player'), +(13,0,70338,0,18,1,37698,0,0, '', 'Necrotic Plague - target Shambling Horror'), +(13,0,70338,0,18,1,37695,0,0, '', 'Necrotic Plague - target Drudge Ghoul'), +(13,0,73785,0,18,1,0,0,0, '', 'Necrotic Plague - target player'), +(13,0,73785,0,18,1,37698,0,0, '', 'Necrotic Plague - target Shambling Horror'), +(13,0,73785,0,18,1,37695,0,0, '', 'Necrotic Plague - target Drudge Ghoul'), +(13,0,73786,0,18,1,0,0,0, '', 'Necrotic Plague - target player'), +(13,0,73786,0,18,1,37698,0,0, '', 'Necrotic Plague - target Shambling Horror'), +(13,0,73786,0,18,1,37695,0,0, '', 'Necrotic Plague - target Drudge Ghoul'), +(13,0,73787,0,18,1,0,0,0, '', 'Necrotic Plague - target player'), +(13,0,73787,0,18,1,37698,0,0, '', 'Necrotic Plague - target Shambling Horror'), +(13,0,73787,0,18,1,37695,0,0, '', 'Necrotic Plague - target Drudge Ghoul'), +(13,0,68981,0,18,0,202141,0,0, '', 'Remorseless Winter - target Doodad_IceShard_standing02'), +(13,0,68981,0,18,0,202142,0,0, '', 'Remorseless Winter - target Doodad_IceShard_standing01'), +(13,0,68981,0,18,0,202143,0,0, '', 'Remorseless Winter - target Doodad_IceShard_standing03'), +(13,0,68981,0,18,0,202144,0,0, '', 'Remorseless Winter - target Doodad_IceShard_standing04'), +(13,0,74270,0,18,0,202141,0,0, '', 'Remorseless Winter - target Doodad_IceShard_standing02'), +(13,0,74270,0,18,0,202142,0,0, '', 'Remorseless Winter - target Doodad_IceShard_standing01'), +(13,0,74270,0,18,0,202143,0,0, '', 'Remorseless Winter - target Doodad_IceShard_standing03'), +(13,0,74270,0,18,0,202144,0,0, '', 'Remorseless Winter - target Doodad_IceShard_standing04'), +(13,0,74271,0,18,0,202141,0,0, '', 'Remorseless Winter - target Doodad_IceShard_standing02'), +(13,0,74271,0,18,0,202142,0,0, '', 'Remorseless Winter - target Doodad_IceShard_standing01'), +(13,0,74271,0,18,0,202143,0,0, '', 'Remorseless Winter - target Doodad_IceShard_standing03'), +(13,0,74271,0,18,0,202144,0,0, '', 'Remorseless Winter - target Doodad_IceShard_standing04'), +(13,0,74272,0,18,0,202141,0,0, '', 'Remorseless Winter - target Doodad_IceShard_standing02'), +(13,0,74272,0,18,0,202142,0,0, '', 'Remorseless Winter - target Doodad_IceShard_standing01'), +(13,0,74272,0,18,0,202143,0,0, '', 'Remorseless Winter - target Doodad_IceShard_standing03'), +(13,0,74272,0,18,0,202144,0,0, '', 'Remorseless Winter - target Doodad_IceShard_standing04'), +(13,0,72262,0,18,1,22515,0,0, '', 'Quake - target World Trigger'), +(13,0,71440,0,18,1,36597,0,0, '', 'Harvest Soul - target The Lich King'), +(13,0,76379,0,18,1,36597,0,0, '', 'Harvest Soul - target The Lich King'), +(13,0,74086,0,18,1,0,0,0, '', 'Destroy Soul - target player'), +(13,0,72595,0,18,1,0,0,0, '', 'Restore Soul - target player'), +(13,0,73650,0,18,1,0,0,0, '', 'Restore Soul - target player'), +(13,0,72679,0,18,1,36597,0,0, '', 'Harvested Soul - target The Lich King'), +(13,0,74318,0,18,1,36597,0,0, '', 'Harvested Soul - target The Lich King'), +(13,0,74319,0,18,1,36597,0,0, '', 'Harvested Soul - target The Lich King'), +(13,0,74320,0,18,1,36597,0,0, '', 'Harvested Soul - target The Lich King'), +(13,0,73028,0,18,1,36597,0,0, '', 'Harvested Soul - target The Lich King'), +(13,0,74321,0,18,1,36597,0,0, '', 'Harvested Soul - target The Lich King'), +(13,0,73650,0,18,1,36597,0,0, '', 'Harvested Soul - target The Lich King'), +(13,0,74323,0,18,1,36597,0,0, '', 'Harvested Soul - target The Lich King'), +(13,0,73582,0,18,1,39190,0,0, '', 'Trigger Vile Spirit (Inside, Heroic) - target Wicked Spirit'), +(13,0,71809,0,18,1,36597,0,0, '', 'Jump - target The Lich King'), +(13,0,71811,0,18,1,36597,0,0, '', 'Jump - target The Lich King'), +(13,0,72431,0,18,1,0,0,0, '', 'Jump - target player'), +(13,0,72405,0,18,1,38995,0,0, '', 'Broken Frostmourne - target Highlord Tirion Fordring'), +(13,0,72429,0,18,1,0,0,0, '', 'Mass Resurrection - target player'), +(13,0,73159,0,18,1,0,0,0, '', 'Play Movie - target player'); + +DELETE FROM `spell_target_position` WHERE `id` IN (70860,72546,73655); +INSERT INTO `spell_target_position` (`id`,`target_map`,`target_position_x`,`target_position_y`,`target_position_z`,`target_orientation`) VALUES +(70860,631,529.302,-2124.49, 840.857,3.1765), -- Frozen Throne Teleport +(72546,631,514.000,-2523.00,1050.990,3.1765), -- Harvest Soul (normal mode) +(73655,631,495.708,-2523.76,1050.990,3.1765); -- Harvest Soul (heroic mode) + +DELETE FROM `spell_area` WHERE `spell`=74276; +INSERT INTO `spell_area` (`spell`,`area`,`autocast`) VALUES +(74276,4910,1); -- In Frostmourne Room + +DELETE FROM `disables` WHERE `entry` IN (12825,13246,13247,13244,13245,13342,13309,13362,13311,12823,13163,13164,13243,12764,12909,12826,13103,13136,13137,13138,12818) AND `sourceType`=4; +DELETE FROM `achievement_criteria_data` WHERE `criteria_id` IN (12825,13246,13247,13244,13245,13342,13309,13362,13311,12823,13163,13164,13243,12764,12909,12826,13103,13136,13137,13138,12818); +INSERT INTO `achievement_criteria_data` (`criteria_id`,`type`,`value1`,`value2`,`ScriptName`) VALUES +(12825,12,2,0,''), -- Bane of the Fallen King +(13246,11,0,0,'achievement_been_waiting_long_time'), -- Been Waiting a Long Time for This (10 player) +(13246,12,0,0,''), -- Been Waiting a Long Time for This (10 player) +(13247,11,0,0,'achievement_been_waiting_long_time'), -- Been Waiting a Long Time for This (10 player) Heroic +(13247,12,2,0,''), -- Been Waiting a Long Time for This (10 player) Heroic +(13244,11,0,0,'achievement_been_waiting_long_time'), -- Been Waiting a Long Time for This (25 player) +(13244,12,1,0,''), -- Been Waiting a Long Time for This (25 player) +(13245,11,0,0,'achievement_been_waiting_long_time'), -- Been Waiting a Long Time for This (25 player) Heroic +(13245,12,3,0,''), -- Been Waiting a Long Time for This (25 player) Heroic +(13342,12,0,0,''), -- Lich King 10-player bosses killed +(13309,12,0,0,''), -- Lich King 10-player raids completed (final boss killed) +(13362,12,1,0,''), -- Lich King 25-player bosses killed +(13311,12,1,0,''), -- Lich King 25-player raids completed (final boss killed) +(12823,11,0,0,'achievement_neck_deep_in_vile'), -- Neck-Deep in Vile (10 player) +(12823,12,0,0,''), -- Neck-Deep in Vile (10 player) +(13163,11,0,0,'achievement_neck_deep_in_vile'), -- Neck-Deep in Vile (10 player) Heroic +(13163,12,2,0,''), -- Neck-Deep in Vile (10 player) Heroic +(13164,11,0,0,'achievement_neck_deep_in_vile'), -- Neck-Deep in Vile (25 player) +(13164,12,1,0,''), -- Neck-Deep in Vile (25 player) +(13243,11,0,0,'achievement_neck_deep_in_vile'), -- Neck-Deep in Vile (25 player) Heroic +(13243,12,3,0,''), -- Neck-Deep in Vile (25 player) Heroic +(12764,12,0,0,''), -- The Frozen Throne (10 player) +(12909,12,1,0,''), -- The Frozen Throne (25 player) +(12826,12,3,0,''), -- The Light of Dawn +(13103,12,0,0,''), -- Victories over the Lich King (Icecrown 10 player) +(13136,12,1,0,''), -- Victories over the Lich King (Icecrown 25 player) +(13137,12,2,0,''), -- Victories over the Lich King (Heroic Icecrown 10 player) +(13138,12,3,0,''), -- Victories over the Lich King (Heroic Icecrown 25 player) +(12818,12,3,0,''); -- Realm First! Fall of the Lich King diff --git a/sql/updates/world/2011_10_05_01_world_scriptname.sql b/sql/updates/world/2011_10_05_01_world_scriptname.sql new file mode 100644 index 00000000000..742d74f4029 --- /dev/null +++ b/sql/updates/world/2011_10_05_01_world_scriptname.sql @@ -0,0 +1,10 @@ +UPDATE `creature_template` SET `ScriptName`='boss_the_lich_king' WHERE `entry`=36597; +UPDATE `creature_template` SET `ScriptName`='npc_tirion_fordring_tft' WHERE `entry`=38995; +UPDATE `creature_template` SET `ScriptName`='npc_shambling_horror_icc' WHERE `entry`=37698; +UPDATE `creature_template` SET `ScriptName`='npc_raging_spirit' WHERE `entry`=36701; +UPDATE `creature_template` SET `ScriptName`='npc_valkyr_shadowguard' WHERE `entry`=36609; +UPDATE `creature_template` SET `ScriptName`='npc_strangulate_vehicle' WHERE `entry`=36598; +UPDATE `creature_template` SET `ScriptName`='npc_terenas_menethil' WHERE `entry` IN (36823,38579,39217); -- not difficulty_entries +UPDATE `creature_template` SET `ScriptName`='npc_spirit_warden' WHERE `entry`=36824; +UPDATE `creature_template` SET `ScriptName`='npc_spirit_bomb' WHERE `entry`=39189; +UPDATE `creature_template` SET `ScriptName`='npc_broken_frostmourne' WHERE `entry`=38584; diff --git a/sql/updates/world/2011_10_05_01_world_spell_script_names.sql b/sql/updates/world/2011_10_05_01_world_spell_script_names.sql new file mode 100644 index 00000000000..03d4b649e78 --- /dev/null +++ b/sql/updates/world/2011_10_05_01_world_spell_script_names.sql @@ -0,0 +1,90 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_infest'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_necrotic_plague'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_necrotic_plague_jump'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_shadow_trap_visual'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_shadow_trap_periodic'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_quake'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_ice_burst_target_search'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_raging_spirit'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_defile'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_summon_into_air'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_soul_reaper'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_valkyr_target_search'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_eject_all_passengers'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_cast_back_to_caster'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_life_siphon'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_vile_spirits'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_vile_spirits_visual'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_vile_spirit_move_target_search'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_vile_spirit_damage_target_search'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_harvest_soul'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_lights_favor'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_soul_rip'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_restore_soul'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_in_frostmourne_room'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_summon_spirit_bomb'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_trigger_vile_spirit'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_jump'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_jump_remove_aura'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_mass_resurrection'; +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_the_lich_king_play_movie'; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(70541,'spell_the_lich_king_infest'), +(73779,'spell_the_lich_king_infest'), +(73780,'spell_the_lich_king_infest'), +(73781,'spell_the_lich_king_infest'), +(70337,'spell_the_lich_king_necrotic_plague'), +(73912,'spell_the_lich_king_necrotic_plague'), +(73913,'spell_the_lich_king_necrotic_plague'), +(73914,'spell_the_lich_king_necrotic_plague'), +(70338,'spell_the_lich_king_necrotic_plague_jump'), +(73785,'spell_the_lich_king_necrotic_plague_jump'), +(73786,'spell_the_lich_king_necrotic_plague_jump'), +(73787,'spell_the_lich_king_necrotic_plague_jump'), +(73530,'spell_the_lich_king_shadow_trap_visual'), +(74282,'spell_the_lich_king_shadow_trap_periodic'), +(72262,'spell_the_lich_king_quake'), +(69110,'spell_the_lich_king_ice_burst_target_search'), +(69200,'spell_the_lich_king_raging_spirit'), +(72754,'spell_the_lich_king_defile'), +(73708,'spell_the_lich_king_defile'), +(73709,'spell_the_lich_king_defile'), +(73710,'spell_the_lich_king_defile'), +(69037,'spell_the_lich_king_summon_into_air'), +(70497,'spell_the_lich_king_summon_into_air'), +(73579,'spell_the_lich_king_summon_into_air'), +(74300,'spell_the_lich_king_summon_into_air'), +(69409,'spell_the_lich_king_soul_reaper'), +(73797,'spell_the_lich_king_soul_reaper'), +(73798,'spell_the_lich_king_soul_reaper'), +(73799,'spell_the_lich_king_soul_reaper'), +(69030,'spell_the_lich_king_valkyr_target_search'), +(68576,'spell_the_lich_king_eject_all_passengers'), +(74445,'spell_the_lich_king_cast_back_to_caster'), +(68984,'spell_the_lich_king_cast_back_to_caster'), +(73488,'spell_the_lich_king_life_siphon'), +(73782,'spell_the_lich_king_life_siphon'), +(73783,'spell_the_lich_king_life_siphon'), +(73784,'spell_the_lich_king_life_siphon'), +(70498,'spell_the_lich_king_vile_spirits'), +(70499,'spell_the_lich_king_vile_spirits_visual'), +(70501,'spell_the_lich_king_vile_spirit_move_target_search'), +(70534,'spell_the_lich_king_vile_spirit_damage_target_search'), +(68980,'spell_the_lich_king_harvest_soul'), +(74325,'spell_the_lich_king_harvest_soul'), +(74296,'spell_the_lich_king_harvest_soul'), +(74297,'spell_the_lich_king_harvest_soul'), +(69382,'spell_the_lich_king_lights_favor'), +(69397,'spell_the_lich_king_soul_rip'), +(72595,'spell_the_lich_king_restore_soul'), +(73650,'spell_the_lich_king_restore_soul'), +(74276,'spell_the_lich_king_in_frostmourne_room'), +(74302,'spell_the_lich_king_summon_spirit_bomb'), +(74341,'spell_the_lich_king_summon_spirit_bomb'), +(74342,'spell_the_lich_king_summon_spirit_bomb'), +(74343,'spell_the_lich_king_summon_spirit_bomb'), +(73582,'spell_the_lich_king_trigger_vile_spirit'), +(71811,'spell_the_lich_king_jump'), +(72431,'spell_the_lich_king_jump_remove_aura'), +(72429,'spell_the_lich_king_mass_resurrection'), +(73159,'spell_the_lich_king_play_movie'); diff --git a/sql/updates/world/2011_10_06_00_world_creature_template.sql b/sql/updates/world/2011_10_06_00_world_creature_template.sql new file mode 100644 index 00000000000..a17b7bc3c7c --- /dev/null +++ b/sql/updates/world/2011_10_06_00_world_creature_template.sql @@ -0,0 +1,42 @@ +/* +Approximate damage of NPCs before armor reduction +75k-90k - The Lich King +25k-30k - Shambling Horror +3.5-5k - Drudge Ghoul +30k-40k - Raging Spirit +10k-12k - Spirit Warden +10k-12k - Terenas Menethil + +Multipliers +1.2 = 10H/25N +1.5 = 25H +*/ + +UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=150 WHERE `entry`=36597; -- The Lich King 10N +UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=180 WHERE `entry`=39167; -- The Lich King 25N +UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=180 WHERE `entry`=39168; -- The Lich King 10H +UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=225 WHERE `entry`=39169; -- The Lich King 25H + +UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=50 WHERE `entry`=37698; -- Shambling Horror 10N +UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=60 WHERE `entry`=39299; -- Shambling Horror 25N +UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=60 WHERE `entry`=39300; -- Shambling Horror 10H +UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=75 WHERE `entry`=39301; -- Shambling Horror 25H + +UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=7 WHERE `entry`=37695; -- Drudge Ghoul 10N +UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=8.4 WHERE `entry`=39309; -- Drudge Ghoul 25N +UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=8.4 WHERE `entry`=39310; -- Drudge Ghoul 10H +UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=10.5 WHERE `entry`=39311; -- Drudge Ghoul 25H + +UPDATE `creature_template` SET `difficulty_entry_1`=39302,`difficulty_entry_2`=39303,`difficulty_entry_3`=39304 WHERE `entry`=36701; -- Raging Spirit +UPDATE `creature_template` SET `speed_walk`=2,`speed_run`=1.42857,`exp`=2,`minlevel`=83,`maxlevel`=83,`faction_A`=14,`faction_H`=14,`dynamicflags`=0 WHERE `entry` IN (39302,39303,39304); -- Raging Spirit +UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=60 WHERE `entry`=36701; -- Raging Spirit 10N +UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=72 WHERE `entry`=39302; -- Raging Spirit 25N +UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=72 WHERE `entry`=39303; -- Raging Spirit 10H +UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=90 WHERE `entry`=39304; -- Raging Spirit 25H + +UPDATE `creature_template` SET `difficulty_entry_1`=39296 WHERE `entry`=36824; -- Spirit Warden +UPDATE `creature_template` SET `minlevel`=83,`maxlevel`=83,`exp`=2,`faction_A`=14,`faction_H`=14,`flags_extra`=256 WHERE `entry`=39296; -- Spirit Warden (1) +UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=20 WHERE `entry`=36824; -- Spirit Warden 10N +UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=20 WHERE `entry`=39296; -- Spirit Warden 25N + +UPDATE `creature_template` SET `mindmg`=509,`maxdmg`=683,`attackpower`=805,`dmg_multiplier`=20 WHERE `entry`=36823; -- Terenas Menethil diff --git a/sql/updates/world/2011_10_06_01_world_misc.sql b/sql/updates/world/2011_10_06_01_world_misc.sql new file mode 100644 index 00000000000..3fccce79f7b --- /dev/null +++ b/sql/updates/world/2011_10_06_01_world_misc.sql @@ -0,0 +1,196 @@ +-- Pathing for Conquest Hold Berserker Entry: 27500 +SET @NPC := 105857; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=2721.081,`position_y`=-1832.136,`position_z`=4.838899 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,257,0, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,2710.015,-1832.177,4.838899,0,0,0,100,0), +(@PATH,2,2700.421,-1833.964,4.838899,0,0,0,100,0), +(@PATH,3,2693.419,-1835.334,4.867931,0,0,0,100,0), +(@PATH,4,2700.177,-1834.009,4.838899,0,0,0,100,0), +(@PATH,5,2710.015,-1832.177,4.838899,0,0,0,100,0), +(@PATH,6,2721.081,-1832.136,4.838899,0,0,0,100,0), +(@PATH,7,2732.511,-1831.47,4.838899,0,0,0,100,0), +(@PATH,8,2737.419,-1830.768,4.838899,0,0,0,100,0), +(@PATH,9,2732.511,-1831.47,4.838899,0,0,0,100,0), +(@PATH,10,2721.081,-1832.136,4.838899,0,0,0,100,0); +-- Pathing for Conquest Hold Berserker Entry: 27500 +SET @NPC := 105821; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=2738.191,`position_y`=-1784.905,`position_z`=5.87062 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,257,0, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,2734.5,-1775.514,6.962903,0,0,0,100,0), +(@PATH,2,2738.191,-1784.905,5.87062,0,0,0,100,0), +(@PATH,3,2741.883,-1793.762,5.804742,0,0,0,100,0), +(@PATH,4,2746.422,-1807.012,5.22166,0,0,0,100,0), +(@PATH,5,2748.496,-1816.049,5.223536,0,0,0,100,0), +(@PATH,6,2750.136,-1823.419,5.425339,0,0,0,100,0), +(@PATH,7,2748.496,-1816.049,5.223536,0,0,0,100,0), +(@PATH,8,2746.422,-1807.012,5.22166,0,0,0,100,0), +(@PATH,9,2741.883,-1793.762,5.804742,0,0,0,100,0), +(@PATH,10,2738.191,-1784.905,5.87062,0,0,0,100,0); +-- Pathing for Conquest Hold Berserker Entry: 27500 +SET @NPC := 105859; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=2753.638,`position_y`=-1895.846,`position_z`=5.03679 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,257,0, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,2754.177,-1888.177,5.087607,0,0,0,100,0), +(@PATH,2,2754.56,-1879.827,5.126619,0,0,0,100,0), +(@PATH,3,2754.854,-1867.842,5.131936,0,0,0,100,0), +(@PATH,4,2754.627,-1856.456,5.450566,0,0,0,100,0), +(@PATH,5,2753.946,-1848.716,5.450566,0,0,0,100,0), +(@PATH,6,2751.545,-1837.476,5.39562,0,0,0,100,0), +(@PATH,7,2753.931,-1848.54,5.450566,0,0,0,100,0), +(@PATH,8,2754.627,-1856.456,5.450566,0,0,0,100,0), +(@PATH,9,2754.854,-1867.842,5.131936,0,0,0,100,0), +(@PATH,10,2754.56,-1879.827,5.126619,0,0,0,100,0), +(@PATH,11,2754.177,-1888.177,5.087607,0,0,0,100,0), +(@PATH,12,2753.638,-1895.846,5.03679,0,0,0,100,0); +-- Pathing for Conquest Hold Berserker Entry: 27500 +SET @NPC := 105810; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=2805.754,`position_y`=-1824.487,`position_z`=10.76279 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,257,0, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,2811.704,-1833.185,11.26279,0,0,0,100,0), +(@PATH,2,2825.015,-1839.888,11.25652,0,0,0,100,0), +(@PATH,3,2811.704,-1833.185,11.26279,0,0,0,100,0), +(@PATH,4,2805.754,-1824.487,10.76279,0,0,0,100,0), +(@PATH,5,2806.472,-1815.43,10.76279,0,0,0,100,0), +(@PATH,6,2806.509,-1806.167,10.63779,0,0,0,100,0), +(@PATH,7,2806.472,-1815.43,10.76279,0,0,0,100,0), +(@PATH,8,2805.754,-1824.487,10.76279,0,0,0,100,0); +-- Pathing for Conquest Hold Berserker Entry: 27500 +SET @NPC := 105750; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=2691.886,`position_y`=-1764.669,`position_z`=9.601107 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,257,0, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,2681.84,-1768.02,9.601107,0,0,0,100,0), +(@PATH,2,2691.886,-1764.669,9.601107,0,0,0,100,0), +(@PATH,3,2705.537,-1760.065,9.601107,0,0,0,100,0), +(@PATH,4,2714.329,-1758.981,9.601107,0,0,0,100,0), +(@PATH,5,2705.537,-1760.065,9.601107,0,0,0,100,0), +(@PATH,6,2691.886,-1764.669,9.601107,0,0,0,100,0); +-- Pathing for Conquest Hold Berserker Entry: 27500 +SET @NPC := 105854; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=2683.998,`position_y`=-1873.36,`position_z`=14.20639 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,257,0, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,2681.924,-1863.327,14.19665,0,0,0,100,0), +(@PATH,2,2691.357,-1860.246,13.94065,0,0,0,100,0), +(@PATH,3,2705.164,-1860.508,13.85815,0,0,0,100,0), +(@PATH,4,2706.999,-1867.629,13.94356,0,0,0,100,0), +(@PATH,5,2702.301,-1873.661,13.86975,0,0,0,100,0), +(@PATH,6,2690.931,-1875.133,13.94601,0,0,0,100,0), +(@PATH,7,2683.998,-1873.36,14.20639,0,0,0,100,0); + +-- Pathing for Westfall Brigade Marine Entry: 27501 +SET @NPC := 105933; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=2670.551,`position_y`=-2010.984,`position_z`=18.17214 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,257,0, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,2673.404,-2006.613,18.2068,0,0,0,100,0), +(@PATH,2,2670.639,-2010.848,18.17313,0,0,0,100,0), +(@PATH,3,2667.047,-2016.413,18.20223,0,0,0,100,0), +(@PATH,4,2670.551,-2010.984,18.17214,0,0,0,100,0); +-- Pathing for Westfall Brigade Marine Entry: 27501 +SET @NPC := 105932; +SET @PATH := @NPC * 10; +UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=2633.481,`position_y`=-1987.501,`position_z`=8.764043 WHERE `guid`=@NPC; +DELETE FROM `creature_addon` WHERE `guid`=@NPC; +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,257,0, ''); +DELETE FROM `waypoint_data` WHERE `id`=@PATH; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH,1,2632.814,-1993.635,8.538836,0,0,0,100,0), +(@PATH,2,2638.163,-1998.093,8.282835,0,0,0,100,0), +(@PATH,3,2643.552,-2000.655,8.280496,0,0,0,100,0), +(@PATH,4,2646.837,-1997.753,8.30875,0,0,0,100,0), +(@PATH,5,2649.113,-1994.113,8.310638,0,0,0,100,0), +(@PATH,6,2649.836,-1989.002,8.284628,0,0,0,100,0), +(@PATH,7,2645.433,-1984.703,8.336969,0,0,0,100,0), +(@PATH,8,2638.931,-1981.989,8.592985,0,0,0,100,0), +(@PATH,9,2633.481,-1987.501,8.764043,0,0,0,100,0); + +-- Missing spawn for Purkom "Venture Coin Vendor" Horde +DELETE FROM `creature` WHERE `id`=27730; +DELETE FROM `creature` WHERE `guid`=107018 AND `id`=27511; +INSERT INTO creature (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`) VALUES +(107018,27730,571,1,1,0,0,2492.467,-1839.655,11.72851,5.532694,120,0,0,1,0,0); + +-- Rogue Voidwalkers Shouldn't have weapons +UPDATE `creature_template` SET `equipment_id`=0 WHERE `entry`=16974; + +-- Add Missing Spawn +DELETE FROM `creature` WHERE `guid` IN (13425,13426,13427,13428,14241); +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`) VALUES +-- Bubb Lazarr +(13425,27628,571,1,1,0,0,2404.771,-1823.437,1.99793,5.078908,300,0,0,1,0,0), +-- Rocket Propelled Warhead +(13426,27593,571,1,1,0,0,2394.92358,-1832.18921,-1.69907868,2.687807,300,0,0,1,0,0), +(13427,27593,571,1,1,0,0,2396.13013,-1829.49475,-1.6780616,2.75762,300,0,0,1,0,0), +(13428,27593,571,1,1,0,0,2397.40283,-1826.75,-1.65229559,2.72271371,300,0,0,1,0,0), +(14241,27593,571,1,1,0,0,2398.62329,-1824.14063,-1.66098964,2.740167,300,0,0,1,0,0); + +-- Template updates Rocket Propelled Warhead +UPDATE `creature_template` SET `npcflag`=`npcflag`|16777216,`InhabitType`=4,`unit_flags`=`unit_flags`|16384,`speed_walk`=12,`speed_run`=4.28571 WHERE `entry`=27593; + +UPDATE `creature_model_info` SET `bounding_radius`=0.534723,`combat_reach`=3.5,`gender`=2 WHERE `modelid`=26611; -- Rocket Propelled Warhead + +DELETE FROM `creature_template_addon` WHERE `entry`=27593; +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(27593,0,0,1,0, NULL); -- Rocket Propelled Warhead + +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry`=27593; +INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `quest_start`, `quest_start_active`, `quest_end`, `cast_flags`, `aura_required`, `aura_forbidden`, `user_type`) VALUES +(27593, 49177, 0, 0, 0, 1, 0, 0, 0); -- Ride Rocket Propelled Warhead + +-- Fix requirements for Element 115 from Nayd +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=4 AND `SourceEntry`=37664; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(4, 24095, 37664, 0, 9, 12433, 0, 0, 0, '', 'Element 115 - Seeking Solvent'), +(4, 24095, 37664, 1, 9, 12434, 0, 0, 0, '', 'Element 115 - Always Seeking Solvent'), +(4, 24095, 37664, 2, 9, 12443, 0, 0, 0, '', 'Element 115 - Seeking Solvent'), +(4, 24095, 37664, 3, 9, 12446, 0, 0, 0, '', 'Element 115 - Always Seeking Solvent'), +(4, 24095, 37664, 4, 9, 12437, 0, 0, 0, '', 'Element 115 - Riding the Red Rocket A'), +(4, 24095, 37664, 5, 9, 12432, 0, 0, 0, '', 'Element 115 - Riding the Red Rocket H'); +UPDATE `gameobject_loot_template` SET `ChanceOrQuestChance`=100 WHERE `entry`=24095 AND `item`=37664; + +-- Add some missing Azure Scalebane Spawns to crystalsong Forest +DELETE FROM `creature` WHERE `guid` IN (6499,6627,7630,10504,12599,12954,13423,13424); +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`,`unit_flags`,`dynamicflags`) VALUES +(6499,31402,571,1,1,0,0,5220.886,591.7798,187.861328,4.866286,180,10,0,1,0,1,0,0), +(6627,31402,571,1,1,0,0,5344.32,595.7,183.07399,4.99164152,180,10,0,1,0,1,0,0), +(7630,31402,571,1,1,0,0,5411.67773,623.1622,178.355133,0.87266463,180,10,0,1,0,1,0,0), +(10504,31402,571,1,1,0,0,5434.40332,783.9654,182.770508,0.5726554,180,10,0,1,0,1,0,0), +(12599,31402,571,1,1,0,0,5464.40771,716.290344,171.820313,2.65290046,180,10,0,1,0,1,0,0), +(12954,31402,571,1,1,0,0,5573.34326,862.8543,161.738586,1.48352981,180,10,0,1,0,1,0,0), +(13423,31402,571,1,1,0,0,5659.52734,987.839844,174.5677,0.314159274,180,0,0,1,0,0,570688256,32), +(13424,31402,571,1,1,0,0,5660.18652,1028.454,174.562653,2.79252672,180,0,0,1,0,0,570688256,32); +-- Addons for dead appearance +DELETE FROM `creature_addon` WHERE `guid` IN (13423,13424); +INSERT INTO `creature_addon` (`guid`,`bytes2`,`auras`) VALUES +(13423,1,29266), +(13424,1,29266); +UPDATE `creature_model_info` SET `bounding_radius`=0.465,`combat_reach`=1.5,`gender`=0 WHERE `modelid`=25195; -- Azure Scalebane +DELETE FROM `creature_template_addon` WHERE `entry`=31402; +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(31402,0,0,1,0, NULL); -- Azure Scalebane diff --git a/sql/updates/world/2011_10_07_00_world_spell_script_names.sql b/sql/updates/world/2011_10_07_00_world_spell_script_names.sql new file mode 100644 index 00000000000..94d4f1fd8fc --- /dev/null +++ b/sql/updates/world/2011_10_07_00_world_spell_script_names.sql @@ -0,0 +1,2 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=40121; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES (40121,'spell_dru_swift_flight_passive'); diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index 4fdedea414a..3c16fe493b4 100755 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -56,7 +56,7 @@ struct DefaultTargetSelector : public std::unary_function<Unit*, bool> bool m_playerOnly; int32 m_aura; - // pUnit: the reference unit + // unit: the reference unit // dist: if 0: ignored, if > 0: maximum distance to the reference unit, if < 0: minimum distance to the reference unit // playerOnly: self explaining // aura: if 0: ignored, if > 0: the target shall have the aura, if < 0, the target shall NOT have the aura diff --git a/src/server/game/AI/CreatureAI.cpp b/src/server/game/AI/CreatureAI.cpp index ea229169dda..329a2d004a5 100755 --- a/src/server/game/AI/CreatureAI.cpp +++ b/src/server/game/AI/CreatureAI.cpp @@ -100,7 +100,7 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToN } /* Causes certain things to never leave the threat list (Priest Lightwell, etc): - for (Unit::ControlList::const_iterator itr = pPlayer->m_Controlled.begin(); itr != pPlayer->m_Controlled.end(); ++itr) + for (Unit::ControlList::const_iterator itr = player->m_Controlled.begin(); itr != player->m_Controlled.end(); ++itr) { creature->SetInCombatWith(*itr); (*itr)->SetInCombatWith(creature); diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h index 46060445ee9..848c2561f3f 100755 --- a/src/server/game/AI/CreatureAIImpl.h +++ b/src/server/game/AI/CreatureAIImpl.h @@ -329,7 +329,7 @@ class EventMap : private std::map<uint32, uint32> // Sets event phase, must be in range 1 - 8 void SetPhase(uint32 phase) { - if (phase && phase < 9) + if (phase && phase < 8) _phase = (1 << (phase + 24)); } @@ -340,7 +340,7 @@ class EventMap : private std::map<uint32, uint32> time += _time; if (groupId && groupId < 9) eventId |= (1 << (groupId + 16)); - if (phase && phase < 9) + if (phase && phase < 8) eventId |= (1 << (phase + 24)); const_iterator itr = find(time); while (itr != end()) diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index 305821095fa..2322e88d105 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -52,8 +52,7 @@ void SummonList::DespawnEntry(uint32 entry) else if (summon->GetEntry() == entry) { erase(i++); - summon->setDeathState(JUST_DIED); - summon->RemoveCorpse(); + summon->DespawnOrUnsummon(); } else ++i; @@ -70,13 +69,7 @@ void SummonList::DespawnAll() else { erase(begin()); - if (TempSummon* summ = summon->ToTempSummon()) - { - summon->DestroyForNearbyPlayers(); - summ->UnSummon(); - } - else - summon->DisappearAndDie(); + summon->DespawnOrUnsummon(); } } } diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index b17e2e4736e..54c69080c41 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -1323,7 +1323,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (IsCreature(*itr)) (*itr)->ToCreature()->Respawn(); else if (IsGameObject(*itr)) - (*itr)->ToGameObject()->Respawn(); + (*itr)->ToGameObject()->SetRespawnTime(e.action.RespawnTarget.GoRespawnTime); } delete targets; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index de60737f3b6..327d03d31ff 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -859,6 +859,11 @@ struct SmartAction struct { + uint32 GoRespawnTime; + } RespawnTarget; + + struct + { uint32 param1; uint32 param2; uint32 param3; diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 445c5c26bd6..5ab5aea30c1 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -1527,36 +1527,36 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f if (!map) return NULL; - Creature* pCreature = new Creature; - if (!pCreature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, teamval, x, y, z, o)) + Creature* creature = new Creature; + if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, PHASEMASK_NORMAL, entry, 0, teamval, x, y, z, o)) { sLog->outError("Battleground::AddCreature: cannot create creature (entry: %u) for BG (map: %u, instance id: %u)!", entry, m_MapId, m_InstanceID); - delete pCreature; + delete creature; return NULL; } - pCreature->SetHomePosition(x, y, z, o); + creature->SetHomePosition(x, y, z, o); CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); if (!cinfo) { sLog->outError("Battleground::AddCreature: creature template (entry: %u) does not exist for BG (map: %u, instance id: %u)!", entry, m_MapId, m_InstanceID); - delete pCreature; + delete creature; return NULL; } // Force using DB speeds - pCreature->SetSpeed(MOVE_WALK, cinfo->speed_walk); - pCreature->SetSpeed(MOVE_RUN, cinfo->speed_run); + creature->SetSpeed(MOVE_WALK, cinfo->speed_walk); + creature->SetSpeed(MOVE_RUN, cinfo->speed_run); - map->Add(pCreature); - m_BgCreatures[type] = pCreature->GetGUID(); + map->Add(creature); + m_BgCreatures[type] = creature->GetGUID(); if (respawntime) - pCreature->SetRespawnDelay(respawntime); + creature->SetRespawnDelay(respawntime); - return pCreature; + return creature; } bool Battleground::DelCreature(uint32 type) @@ -1601,18 +1601,18 @@ bool Battleground::AddSpiritGuide(uint32 type, float x, float y, float z, float BG_CREATURE_ENTRY_A_SPIRITGUIDE : BG_CREATURE_ENTRY_H_SPIRITGUIDE; - if (Creature* pCreature = AddCreature(entry, type, team, x, y, z, o)) + if (Creature* creature = AddCreature(entry, type, team, x, y, z, o)) { - pCreature->setDeathState(DEAD); - pCreature->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, pCreature->GetGUID()); + creature->setDeathState(DEAD); + creature->SetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT, creature->GetGUID()); // aura // TODO: Fix display here - // pCreature->SetVisibleAura(0, SPELL_SPIRIT_HEAL_CHANNEL); + // creature->SetVisibleAura(0, SPELL_SPIRIT_HEAL_CHANNEL); // casting visual effect - pCreature->SetUInt32Value(UNIT_CHANNEL_SPELL, SPELL_SPIRIT_HEAL_CHANNEL); + creature->SetUInt32Value(UNIT_CHANNEL_SPELL, SPELL_SPIRIT_HEAL_CHANNEL); // correct cast speed - pCreature->SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); - //pCreature->CastSpell(pCreature, SPELL_SPIRIT_HEAL_CHANNEL, true); + creature->SetFloatValue(UNIT_MOD_CAST_SPEED, 1.0f); + //creature->CastSpell(creature, SPELL_SPIRIT_HEAL_CHANNEL, true); return true; } sLog->outError("Battleground::AddSpiritGuide: cannot create spirit guide (type: %u, entry: %u) for BG (map: %u, instance id: %u)!", @@ -1887,8 +1887,8 @@ bool Battleground::IsTeamScoreInRange(uint32 team, uint32 minScore, uint32 maxSc void Battleground::StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry) { for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) - if (Player* pPlayer = ObjectAccessor::FindPlayer(itr->first)) - pPlayer->GetAchievementMgr().StartTimedAchievement(type, entry); + if (Player* player = ObjectAccessor::FindPlayer(itr->first)) + player->GetAchievementMgr().StartTimedAchievement(type, entry); } void Battleground::SetBracket(PvPDifficultyEntry const* bracketEntry) diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index 78fcd55278d..cc6911e34a5 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -4689,32 +4689,32 @@ bool ChatHandler::HandleGroupRemoveCommand(const char *args) bool ChatHandler::HandlePossessCommand(const char * /*args*/) { - Unit* pUnit = getSelectedUnit(); - if (!pUnit) + Unit* unit = getSelectedUnit(); + if (!unit) return false; - m_session->GetPlayer()->CastSpell(pUnit, 530, true); + m_session->GetPlayer()->CastSpell(unit, 530, true); return true; } bool ChatHandler::HandleUnPossessCommand(const char * /*args*/) { - Unit* pUnit = getSelectedUnit(); - if (!pUnit) - pUnit = m_session->GetPlayer(); + Unit* unit = getSelectedUnit(); + if (!unit) + unit = m_session->GetPlayer(); - pUnit->RemoveCharmAuras(); + unit->RemoveCharmAuras(); return true; } bool ChatHandler::HandleBindSightCommand(const char * /*args*/) { - Unit* pUnit = getSelectedUnit(); - if (!pUnit) + Unit* unit = getSelectedUnit(); + if (!unit) return false; - m_session->GetPlayer()->CastSpell(pUnit, 6277, true); + m_session->GetPlayer()->CastSpell(unit, 6277, true); return true; } diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index d3a0c68a9e7..52b41c0a0f7 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -1308,12 +1308,12 @@ void LFGMgr::UpdateProposal(uint32 proposalId, uint64 guid, bool accept) // Save wait times before redoing groups for (LfgPlayerList::const_iterator it = players.begin(); it != players.end(); ++it) { - LfgProposalPlayer* pPlayer = pProposal->players[(*it)->GetGUID()]; + LfgProposalPlayer* player = pProposal->players[(*it)->GetGUID()]; uint32 lowgroupguid = (*it)->GetGroup() ? (*it)->GetGroup()->GetLowGUID() : 0; - if (pPlayer->groupLowGuid != lowgroupguid) - sLog->outError("LFGMgr::UpdateProposal: [" UI64FMTD "] group mismatch: actual (%u) - queued (%u)", (*it)->GetGUID(), lowgroupguid, pPlayer->groupLowGuid); + if (player->groupLowGuid != lowgroupguid) + sLog->outError("LFGMgr::UpdateProposal: [" UI64FMTD "] group mismatch: actual (%u) - queued (%u)", (*it)->GetGUID(), lowgroupguid, player->groupLowGuid); - uint64 guid = pPlayer->groupLowGuid ? MAKE_NEW_GUID(pPlayer->groupLowGuid, 0, HIGHGUID_GROUP) : (*it)->GetGUID(); + uint64 guid = player->groupLowGuid ? MAKE_NEW_GUID(player->groupLowGuid, 0, HIGHGUID_GROUP) : (*it)->GetGUID(); LfgQueueInfoMap::iterator itQueue = m_QueueInfoMap.find(guid); if (itQueue == m_QueueInfoMap.end()) { diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index d1f8f55e27d..d92f591803e 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -657,14 +657,14 @@ void Creature::DoFleeToGetAssistance() float radius = sWorld->getFloatConfig(CONFIG_CREATURE_FAMILY_FLEE_ASSISTANCE_RADIUS); if (radius >0) { - Creature* pCreature = NULL; + Creature* creature = NULL; CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); Cell cell(p); cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); Trinity::NearestAssistCreatureInCreatureRangeCheck u_check(this, getVictim(), radius); - Trinity::CreatureLastSearcher<Trinity::NearestAssistCreatureInCreatureRangeCheck> searcher(this, pCreature, u_check); + Trinity::CreatureLastSearcher<Trinity::NearestAssistCreatureInCreatureRangeCheck> searcher(this, creature, u_check); TypeContainerVisitor<Trinity::CreatureLastSearcher<Trinity::NearestAssistCreatureInCreatureRangeCheck>, GridTypeMapContainer > grid_creature_searcher(searcher); @@ -673,12 +673,12 @@ void Creature::DoFleeToGetAssistance() SetNoSearchAssistance(true); UpdateSpeed(MOVE_RUN, false); - if (!pCreature) + if (!creature) //SetFeared(true, getVictim()->GetGUID(), 0, sWorld->getIntConfig(CONFIG_CREATURE_FAMILY_FLEE_DELAY)); //TODO: use 31365 SetControlled(true, UNIT_STAT_FLEEING); else - GetMotionMaster()->MoveSeekAssistance(pCreature->GetPositionX(), pCreature->GetPositionY(), pCreature->GetPositionZ()); + GetMotionMaster()->MoveSeekAssistance(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ()); } } @@ -805,7 +805,7 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, return true; } -bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const +bool Creature::isCanTrainingOf(Player* player, bool msg) const { if (!isTrainer()) return false; @@ -822,65 +822,65 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const switch (GetCreatureInfo()->trainer_type) { case TRAINER_TYPE_CLASS: - if (pPlayer->getClass() != GetCreatureInfo()->trainer_class) + if (player->getClass() != GetCreatureInfo()->trainer_class) { if (msg) { - pPlayer->PlayerTalkClass->ClearMenus(); + player->PlayerTalkClass->ClearMenus(); switch (GetCreatureInfo()->trainer_class) { - case CLASS_DRUID: pPlayer->PlayerTalkClass->SendGossipMenu(4913, GetGUID()); break; - case CLASS_HUNTER: pPlayer->PlayerTalkClass->SendGossipMenu(10090, GetGUID()); break; - case CLASS_MAGE: pPlayer->PlayerTalkClass->SendGossipMenu(328, GetGUID()); break; - case CLASS_PALADIN:pPlayer->PlayerTalkClass->SendGossipMenu(1635, GetGUID()); break; - case CLASS_PRIEST: pPlayer->PlayerTalkClass->SendGossipMenu(4436, GetGUID()); break; - case CLASS_ROGUE: pPlayer->PlayerTalkClass->SendGossipMenu(4797, GetGUID()); break; - case CLASS_SHAMAN: pPlayer->PlayerTalkClass->SendGossipMenu(5003, GetGUID()); break; - case CLASS_WARLOCK:pPlayer->PlayerTalkClass->SendGossipMenu(5836, GetGUID()); break; - case CLASS_WARRIOR:pPlayer->PlayerTalkClass->SendGossipMenu(4985, GetGUID()); break; + case CLASS_DRUID: player->PlayerTalkClass->SendGossipMenu(4913, GetGUID()); break; + case CLASS_HUNTER: player->PlayerTalkClass->SendGossipMenu(10090, GetGUID()); break; + case CLASS_MAGE: player->PlayerTalkClass->SendGossipMenu(328, GetGUID()); break; + case CLASS_PALADIN:player->PlayerTalkClass->SendGossipMenu(1635, GetGUID()); break; + case CLASS_PRIEST: player->PlayerTalkClass->SendGossipMenu(4436, GetGUID()); break; + case CLASS_ROGUE: player->PlayerTalkClass->SendGossipMenu(4797, GetGUID()); break; + case CLASS_SHAMAN: player->PlayerTalkClass->SendGossipMenu(5003, GetGUID()); break; + case CLASS_WARLOCK:player->PlayerTalkClass->SendGossipMenu(5836, GetGUID()); break; + case CLASS_WARRIOR:player->PlayerTalkClass->SendGossipMenu(4985, GetGUID()); break; } } return false; } break; case TRAINER_TYPE_PETS: - if (pPlayer->getClass() != CLASS_HUNTER) + if (player->getClass() != CLASS_HUNTER) { - pPlayer->PlayerTalkClass->ClearMenus(); - pPlayer->PlayerTalkClass->SendGossipMenu(3620, GetGUID()); + player->PlayerTalkClass->ClearMenus(); + player->PlayerTalkClass->SendGossipMenu(3620, GetGUID()); return false; } break; case TRAINER_TYPE_MOUNTS: - if (GetCreatureInfo()->trainer_race && pPlayer->getRace() != GetCreatureInfo()->trainer_race) + if (GetCreatureInfo()->trainer_race && player->getRace() != GetCreatureInfo()->trainer_race) { if (msg) { - pPlayer->PlayerTalkClass->ClearMenus(); + player->PlayerTalkClass->ClearMenus(); switch (GetCreatureInfo()->trainer_class) { - case RACE_DWARF: pPlayer->PlayerTalkClass->SendGossipMenu(5865, GetGUID()); break; - case RACE_GNOME: pPlayer->PlayerTalkClass->SendGossipMenu(4881, GetGUID()); break; - case RACE_HUMAN: pPlayer->PlayerTalkClass->SendGossipMenu(5861, GetGUID()); break; - case RACE_NIGHTELF: pPlayer->PlayerTalkClass->SendGossipMenu(5862, GetGUID()); break; - case RACE_ORC: pPlayer->PlayerTalkClass->SendGossipMenu(5863, GetGUID()); break; - case RACE_TAUREN: pPlayer->PlayerTalkClass->SendGossipMenu(5864, GetGUID()); break; - case RACE_TROLL: pPlayer->PlayerTalkClass->SendGossipMenu(5816, GetGUID()); break; - case RACE_UNDEAD_PLAYER:pPlayer->PlayerTalkClass->SendGossipMenu(624, GetGUID()); break; - case RACE_BLOODELF: pPlayer->PlayerTalkClass->SendGossipMenu(5862, GetGUID()); break; - case RACE_DRAENEI: pPlayer->PlayerTalkClass->SendGossipMenu(5864, GetGUID()); break; + case RACE_DWARF: player->PlayerTalkClass->SendGossipMenu(5865, GetGUID()); break; + case RACE_GNOME: player->PlayerTalkClass->SendGossipMenu(4881, GetGUID()); break; + case RACE_HUMAN: player->PlayerTalkClass->SendGossipMenu(5861, GetGUID()); break; + case RACE_NIGHTELF: player->PlayerTalkClass->SendGossipMenu(5862, GetGUID()); break; + case RACE_ORC: player->PlayerTalkClass->SendGossipMenu(5863, GetGUID()); break; + case RACE_TAUREN: player->PlayerTalkClass->SendGossipMenu(5864, GetGUID()); break; + case RACE_TROLL: player->PlayerTalkClass->SendGossipMenu(5816, GetGUID()); break; + case RACE_UNDEAD_PLAYER:player->PlayerTalkClass->SendGossipMenu(624, GetGUID()); break; + case RACE_BLOODELF: player->PlayerTalkClass->SendGossipMenu(5862, GetGUID()); break; + case RACE_DRAENEI: player->PlayerTalkClass->SendGossipMenu(5864, GetGUID()); break; } } return false; } break; case TRAINER_TYPE_TRADESKILLS: - if (GetCreatureInfo()->trainer_spell && !pPlayer->HasSpell(GetCreatureInfo()->trainer_spell)) + if (GetCreatureInfo()->trainer_spell && !player->HasSpell(GetCreatureInfo()->trainer_spell)) { if (msg) { - pPlayer->PlayerTalkClass->ClearMenus(); - pPlayer->PlayerTalkClass->SendGossipMenu(11031, GetGUID()); + player->PlayerTalkClass->ClearMenus(); + player->PlayerTalkClass->SendGossipMenu(11031, GetGUID()); } return false; } @@ -891,23 +891,23 @@ bool Creature::isCanTrainingOf(Player* pPlayer, bool msg) const return true; } -bool Creature::isCanInteractWithBattleMaster(Player* pPlayer, bool msg) const +bool Creature::isCanInteractWithBattleMaster(Player* player, bool msg) const { if (!isBattleMaster()) return false; BattlegroundTypeId bgTypeId = sBattlegroundMgr->GetBattleMasterBG(GetEntry()); if (!msg) - return pPlayer->GetBGAccessByLevel(bgTypeId); + return player->GetBGAccessByLevel(bgTypeId); - if (!pPlayer->GetBGAccessByLevel(bgTypeId)) + if (!player->GetBGAccessByLevel(bgTypeId)) { - pPlayer->PlayerTalkClass->ClearMenus(); + player->PlayerTalkClass->ClearMenus(); switch (bgTypeId) { - case BATTLEGROUND_AV: pPlayer->PlayerTalkClass->SendGossipMenu(7616, GetGUID()); break; - case BATTLEGROUND_WS: pPlayer->PlayerTalkClass->SendGossipMenu(7599, GetGUID()); break; - case BATTLEGROUND_AB: pPlayer->PlayerTalkClass->SendGossipMenu(7642, GetGUID()); break; + case BATTLEGROUND_AV: player->PlayerTalkClass->SendGossipMenu(7616, GetGUID()); break; + case BATTLEGROUND_WS: player->PlayerTalkClass->SendGossipMenu(7599, GetGUID()); break; + case BATTLEGROUND_AB: player->PlayerTalkClass->SendGossipMenu(7642, GetGUID()); break; case BATTLEGROUND_EY: case BATTLEGROUND_NA: case BATTLEGROUND_BE: @@ -915,7 +915,7 @@ bool Creature::isCanInteractWithBattleMaster(Player* pPlayer, bool msg) const case BATTLEGROUND_RL: case BATTLEGROUND_SA: case BATTLEGROUND_DS: - case BATTLEGROUND_RV: pPlayer->PlayerTalkClass->SendGossipMenu(10024, GetGUID()); break; + case BATTLEGROUND_RV: player->PlayerTalkClass->SendGossipMenu(10024, GetGUID()); break; default: break; } return false; @@ -923,11 +923,11 @@ bool Creature::isCanInteractWithBattleMaster(Player* pPlayer, bool msg) const return true; } -bool Creature::isCanTrainingAndResetTalentsOf(Player* pPlayer) const +bool Creature::isCanTrainingAndResetTalentsOf(Player* player) const { - return pPlayer->getLevel() >= 10 + return player->getLevel() >= 10 && GetCreatureInfo()->trainer_type == TRAINER_TYPE_CLASS - && pPlayer->getClass() == GetCreatureInfo()->trainer_class; + && player->getClass() == GetCreatureInfo()->trainer_class; } void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 /*MovementFlags*/, uint8 /*type*/) @@ -2132,16 +2132,16 @@ void Creature::SetInCombatWithZone() for (Map::PlayerList::const_iterator i = PlList.begin(); i != PlList.end(); ++i) { - if (Player* pPlayer = i->getSource()) + if (Player* player = i->getSource()) { - if (pPlayer->isGameMaster()) + if (player->isGameMaster()) continue; - if (pPlayer->isAlive()) + if (player->isAlive()) { - this->SetInCombatWith(pPlayer); - pPlayer->SetInCombatWith(this); - AddThreat(pPlayer, 0.0f); + this->SetInCombatWith(player); + player->SetInCombatWith(this); + AddThreat(player, 0.0f); } } } diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 19938b47bd6..3d5b86a106a 100755 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -456,7 +456,7 @@ class Creature : public Unit, public GridObject<Creature> ///// TODO RENAME THIS!!!!! bool isCanTrainingOf(Player* player, bool msg) const; bool isCanInteractWithBattleMaster(Player* player, bool msg) const; - bool isCanTrainingAndResetTalentsOf(Player* pPlayer) const; + bool isCanTrainingAndResetTalentsOf(Player* player) const; bool canCreatureAttack(Unit const* pVictim, bool force = true) const; bool IsImmunedToSpell(SpellInfo const* spellInfo); // redefine Unit::IsImmunedToSpell diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 6ea9bf92dfe..d3832ad9151 100755 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -778,14 +778,14 @@ bool Item::CanBeTraded(bool mail, bool trade) const return true; } -bool Item::HasEnchantRequiredSkill(const Player* pPlayer) const +bool Item::HasEnchantRequiredSkill(const Player* player) const { // Check all enchants for required skill for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot) if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot))) if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id)) - if (enchantEntry->requiredSkill && pPlayer->GetSkillValue(enchantEntry->requiredSkill) < enchantEntry->requiredSkillValue) + if (enchantEntry->requiredSkill && player->GetSkillValue(enchantEntry->requiredSkill) < enchantEntry->requiredSkillValue) return false; return true; diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h index 534f16042ea..b872b354ea7 100755 --- a/src/server/game/Entities/Item/Item.h +++ b/src/server/game/Entities/Item/Item.h @@ -264,7 +264,7 @@ class Item : public Object void SetInTrade(bool b = true) { mb_in_trade = b; } bool IsInTrade() const { return mb_in_trade; } - bool HasEnchantRequiredSkill(const Player* pPlayer) const; + bool HasEnchantRequiredSkill(const Player* player) const; uint32 GetEnchantRequiredLevel() const; bool IsFitToSpellRequirements(SpellInfo const* spellInfo) const; diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index 25a66206663..4150810a4ab 100755 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -348,13 +348,13 @@ void Pet::SavePetToDB(PetSaveMode mode) if (!IS_PLAYER_GUID(GetOwnerGUID())) return; - Player* pOwner = (Player*)GetOwner(); - if (!pOwner) + Player* owner = (Player*)GetOwner(); + if (!owner) return; // not save pet as current if another pet temporary unsummoned - if (mode == PET_SAVE_AS_CURRENT && pOwner->GetTemporaryUnsummonedPetNumber() && - pOwner->GetTemporaryUnsummonedPetNumber() != m_charmInfo->GetPetNumber()) + if (mode == PET_SAVE_AS_CURRENT && owner->GetTemporaryUnsummonedPetNumber() && + owner->GetTemporaryUnsummonedPetNumber() != m_charmInfo->GetPetNumber()) { // pet will lost anyway at restore temporary unsummoned if (getPetType() == HUNTER_PET) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 579a704bd83..778eb9f3aff 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -4774,8 +4774,8 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC sObjectAccessor->ConvertCorpseForPlayer(playerguid); if (uint32 guildId = GetGuildIdFromDB(playerguid)) - if (Guild* pGuild = sGuildMgr->GetGuildById(guildId)) - pGuild->DeleteMember(guid); + if (Guild* guild = sGuildMgr->GetGuildById(guildId)) + guild->DeleteMember(guid); // remove from arena teams LeaveAllArenaTeams(playerguid); @@ -5462,11 +5462,11 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g return TotalCost; } - Guild* pGuild = sGuildMgr->GetGuildById(GetGuildId()); - if (!pGuild) + Guild* guild = sGuildMgr->GetGuildById(GetGuildId()); + if (!guild) return TotalCost; - if (!pGuild->HandleMemberWithdrawMoney(GetSession(), costs, true)) + if (!guild->HandleMemberWithdrawMoney(GetSession(), costs, true)) return TotalCost; TotalCost = costs; @@ -13291,11 +13291,11 @@ void Player::SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2, uint GetSession()->SendPacket(&data); } -void Player::SendBuyError(BuyResult msg, Creature* pCreature, uint32 item, uint32 param) +void Player::SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 param) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_BUY_FAILED"); WorldPacket data(SMSG_BUY_FAILED, (8+4+4+1)); - data << uint64(pCreature ? pCreature->GetGUID() : 0); + data << uint64(creature ? creature->GetGUID() : 0); data << uint32(item); if (param > 0) data << uint32(param); @@ -13303,11 +13303,11 @@ void Player::SendBuyError(BuyResult msg, Creature* pCreature, uint32 item, uint3 GetSession()->SendPacket(&data); } -void Player::SendSellError(SellResult msg, Creature* pCreature, uint64 guid, uint32 param) +void Player::SendSellError(SellResult msg, Creature* creature, uint64 guid, uint32 param) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_SELL_ITEM"); WorldPacket data(SMSG_SELL_ITEM, (8+8+(param?4:0)+1)); // last check 2.0.10 - data << uint64(pCreature ? pCreature->GetGUID() : 0); + data << uint64(creature ? creature->GetGUID() : 0); data << uint64(guid); if (param > 0) data << uint32(param); @@ -14348,11 +14348,11 @@ void Player::PrepareQuestMenu(uint64 guid) QuestRelationBounds pObjectQIR; // pets also can have quests - Creature* pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid); - if (pCreature) + Creature* creature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid); + if (creature) { - pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(pCreature->GetEntry()); - pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(pCreature->GetEntry()); + pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry()); + pObjectQIR = sObjectMgr->GetCreatureQuestInvolvedRelationBounds(creature->GetEntry()); } else { @@ -14459,10 +14459,10 @@ void Player::SendPreparedQuest(uint64 guid) std::string title = ""; // need pet case for some quests - Creature* pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid); - if (pCreature) + Creature* creature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid); + if (creature) { - uint32 textid = GetGossipTextId(pCreature); + uint32 textid = GetGossipTextId(creature); GossipText const* gossiptext = sObjectMgr->GetGossipText(textid); if (!gossiptext) { @@ -14507,9 +14507,9 @@ Quest const* Player::GetNextQuest(uint64 guid, Quest const* pQuest) { QuestRelationBounds pObjectQR; - Creature* pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid); - if (pCreature) - pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(pCreature->GetEntry()); + Creature* creature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid); + if (creature) + pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(creature->GetEntry()); else { //we should obtain map pointer from GetMap() in 99% of cases. Special case @@ -15668,9 +15668,9 @@ void Player::AreaExploredOrEventHappens(uint32 questId) //not used in Trinityd, function for external script library void Player::GroupEventHappens(uint32 questId, WorldObject const* pEventObject) { - if (Group* pGroup = GetGroup()) + if (Group* group = GetGroup()) { - for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* pGroupGuy = itr->getSource(); @@ -16253,12 +16253,12 @@ void Player::SendQuestConfirmAccept(const Quest* pQuest, Player* pReceiver) } } -void Player::SendPushToPartyResponse(Player* pPlayer, uint32 msg) +void Player::SendPushToPartyResponse(Player* player, uint32 msg) { - if (pPlayer) + if (player) { WorldPacket data(MSG_QUEST_PUSH_RESULT, (8+1)); - data << uint64(pPlayer->GetGUID()); + data << uint64(player->GetGUID()); data << uint8(msg); // valid values: 0-8 GetSession()->SendPacket(&data); sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent MSG_QUEST_PUSH_RESULT"); @@ -20434,24 +20434,24 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 return false; } - Creature* pCreature = GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); - if (!pCreature) + Creature* creature = GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); + if (!creature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: BuyItemFromVendor - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid))); SendBuyError(BUY_ERR_DISTANCE_TOO_FAR, NULL, item, 0); return false; } - VendorItemData const* vItems = pCreature->GetVendorItems(); + VendorItemData const* vItems = creature->GetVendorItems(); if (!vItems || vItems->Empty()) { - SendBuyError(BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0); + SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0); return false; } if (vendorslot >= vItems->GetItemCount()) { - SendBuyError(BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0); + SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0); return false; } @@ -20459,23 +20459,23 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 // store diff item (cheating) if (!crItem || crItem->item != item) { - SendBuyError(BUY_ERR_CANT_FIND_ITEM, pCreature, item, 0); + SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0); return false; } // check current item amount if it limited if (crItem->maxcount != 0) { - if (pCreature->GetVendorItemCurrentCount(crItem) < pProto->BuyCount * count) + if (creature->GetVendorItemCurrentCount(crItem) < pProto->BuyCount * count) { - SendBuyError(BUY_ERR_ITEM_ALREADY_SOLD, pCreature, item, 0); + SendBuyError(BUY_ERR_ITEM_ALREADY_SOLD, creature, item, 0); return false; } } if (pProto->RequiredReputationFaction && (uint32(GetReputationRank(pProto->RequiredReputationFaction)) < pProto->RequiredReputationRank)) { - SendBuyError(BUY_ERR_REPUTATION_REQUIRE, pCreature, item, 0); + SendBuyError(BUY_ERR_REPUTATION_REQUIRE, creature, item, 0); return false; } @@ -20525,17 +20525,17 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 // reputation discount if (price) - price = uint32(floor(price * GetReputationPriceDiscount(pCreature))); + price = uint32(floor(price * GetReputationPriceDiscount(creature))); if (!HasEnoughMoney(price)) { - SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, item, 0); + SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, item, 0); return false; } if ((bag == NULL_BAG && slot == NULL_SLOT) || IsInventoryPos(bag, slot)) { - if (!_StoreOrEquipNewItem(vendorslot, item, count, bag, slot, price, pProto, pCreature, crItem, true)) + if (!_StoreOrEquipNewItem(vendorslot, item, count, bag, slot, price, pProto, creature, crItem, true)) return false; } else if (IsEquipmentPos(bag, slot)) @@ -20545,7 +20545,7 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 SendEquipError(EQUIP_ERR_ITEM_CANT_BE_EQUIPPED, NULL, NULL); return false; } - if (!_StoreOrEquipNewItem(vendorslot, item, count, bag, slot, price, pProto, pCreature, crItem, false)) + if (!_StoreOrEquipNewItem(vendorslot, item, count, bag, slot, price, pProto, creature, crItem, false)) return false; } else @@ -21961,9 +21961,9 @@ bool Player::GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const return true; } -float Player::GetReputationPriceDiscount(Creature const* pCreature) const +float Player::GetReputationPriceDiscount(Creature const* creature) const { - FactionTemplateEntry const* vendor_faction = pCreature->getFactionTemplateEntry(); + FactionTemplateEntry const* vendor_faction = creature->getFactionTemplateEntry(); if (!vendor_faction || !vendor_faction->faction) return 1.0f; @@ -22374,9 +22374,9 @@ void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewar uint64 creature_guid = (pRewardSource->GetTypeId() == TYPEID_UNIT) ? pRewardSource->GetGUID() : uint64(0); // prepare data for near group iteration - if (Group* pGroup = GetGroup()) + if (Group* group = GetGroup()) { - for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* pGroupGuy = itr->getSource(); if (!pGroupGuy) @@ -22390,7 +22390,7 @@ void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewar pGroupGuy->KilledMonsterCredit(creature_id, creature_guid); } } - else // if (!pGroup) + else // if (!group) KilledMonsterCredit(creature_id, creature_guid); } @@ -22609,14 +22609,14 @@ void Player::SendCorpseReclaimDelay(bool load) Player* Player::GetNextRandomRaidMember(float radius) { - Group* pGroup = GetGroup(); - if (!pGroup) + Group* group = GetGroup(); + if (!group) return NULL; std::vector<Player*> nearMembers; - nearMembers.reserve(pGroup->GetMembersCount()); + nearMembers.reserve(group->GetMembersCount()); - for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 59522241d49..f4d1b30b97a 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1317,8 +1317,8 @@ class Player : public Unit, public GridObject<Player> void RemoveItemFromBuyBackSlot(uint32 slot, bool del); uint32 GetMaxKeyringSize() const { return KEYRING_SLOT_END-KEYRING_SLOT_START; } void SendEquipError(InventoryResult msg, Item* pItem, Item* pItem2 = NULL, uint32 itemid = 0); - void SendBuyError(BuyResult msg, Creature* pCreature, uint32 item, uint32 param); - void SendSellError(SellResult msg, Creature* pCreature, uint64 guid, uint32 param); + void SendBuyError(BuyResult msg, Creature* creature, uint32 item, uint32 param); + void SendSellError(SellResult msg, Creature* creature, uint64 guid, uint32 param); void AddWeaponProficiency(uint32 newflag) { m_WeaponProficiency |= newflag; } void AddArmorProficiency(uint32 newflag) { m_ArmorProficiency |= newflag; } uint32 GetWeaponProficiency() const { return m_WeaponProficiency; } @@ -1337,7 +1337,7 @@ class Player : public Unit, public GridObject<Player> bool BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot); bool _StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore); - float GetReputationPriceDiscount(Creature const* pCreature) const; + float GetReputationPriceDiscount(Creature const* creature) const; Player* GetTrader() const { return m_trade ? m_trade->GetTrader() : NULL; } TradeData* GetTradeData() const { return m_trade; } @@ -1485,7 +1485,7 @@ class Player : public Unit, public GridObject<Player> void SendQuestTimerFailed(uint32 quest_id); void SendCanTakeQuestResponse(uint32 msg); void SendQuestConfirmAccept(Quest const* pQuest, Player* pReceiver); - void SendPushToPartyResponse(Player* pPlayer, uint32 msg); + void SendPushToPartyResponse(Player* player, uint32 msg); void SendQuestUpdateAddItem(Quest const* pQuest, uint32 item_idx, uint16 count); void SendQuestUpdateAddCreatureOrGo(Quest const* pQuest, uint64 guid, uint32 creatureOrGO_idx, uint16 old_count, uint16 add_count); void SendQuestUpdateAddPlayer(Quest const* pQuest, uint16 old_count, uint16 add_count); diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 21a3c5ce58d..dbe9697bcaf 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -642,39 +642,39 @@ void Transport::BuildStopMovePacket(Map const* targetMap) uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y, float z, float o, uint32 anim) { Map* map = GetMap(); - Creature* pCreature = new Creature; + Creature* creature = new Creature; - if (!pCreature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, GetPhaseMask(), entry, 0, GetGOInfo()->faction, 0, 0, 0, 0)) + if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, GetPhaseMask(), entry, 0, GetGOInfo()->faction, 0, 0, 0, 0)) { - delete pCreature; + delete creature; return 0; } - pCreature->SetTransport(this); - pCreature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT); - pCreature->m_movementInfo.guid = GetGUID(); - pCreature->m_movementInfo.t_pos.Relocate(x, y, z, o); + creature->SetTransport(this); + creature->AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT); + creature->m_movementInfo.guid = GetGUID(); + creature->m_movementInfo.t_pos.Relocate(x, y, z, o); if (anim) - pCreature->SetUInt32Value(UNIT_NPC_EMOTESTATE, anim); + creature->SetUInt32Value(UNIT_NPC_EMOTESTATE, anim); - pCreature->Relocate( + creature->Relocate( GetPositionX() + (x * cos(GetOrientation()) + y * sin(GetOrientation() + float(M_PI))), GetPositionY() + (y * cos(GetOrientation()) + x * sin(GetOrientation())), z + GetPositionZ(), o + GetOrientation()); - pCreature->SetHomePosition(pCreature->GetPositionX(), pCreature->GetPositionY(), pCreature->GetPositionZ(), pCreature->GetOrientation()); + creature->SetHomePosition(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation()); - if (!pCreature->IsPositionValid()) + if (!creature->IsPositionValid()) { - sLog->outError("Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)", pCreature->GetGUIDLow(), pCreature->GetEntry(), pCreature->GetPositionX(), pCreature->GetPositionY()); - delete pCreature; + sLog->outError("Creature (guidlow %d, entry %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)", creature->GetGUIDLow(), creature->GetEntry(), creature->GetPositionX(), creature->GetPositionY()); + delete creature; return 0; } - map->Add(pCreature); - m_NPCPassengerSet.insert(pCreature); + map->Add(creature); + m_NPCPassengerSet.insert(creature); if (tguid == 0) { @@ -684,8 +684,8 @@ uint32 Transport::AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y, else currenttguid = std::max(tguid, currenttguid); - pCreature->SetGUIDTransport(tguid); - sScriptMgr->OnAddCreaturePassenger(this, pCreature); + creature->SetGUIDTransport(tguid); + sScriptMgr->OnAddCreaturePassenger(this, creature); return tguid; } diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 6f042e7f0c4..eab1a9aae48 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -10081,9 +10081,9 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius) if (!player) return NULL; - Group* pGroup = player->GetGroup(); + Group* group = player->GetGroup(); // When there is no group check pet presence - if (!pGroup) + if (!group) { // We are pet now, return owner if (player != this) @@ -10098,9 +10098,9 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius) std::vector<Unit*> nearMembers; // reserve place for players and pets because resizing vector every unit push is unefficient (vector is reallocated then) - nearMembers.reserve(pGroup->GetMembersCount() * 2); + nearMembers.reserve(group->GetMembersCount() * 2); - for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) if (Player* Target = itr->getSource()) { // IsHostileTo check duel and controlled by enemy @@ -13805,8 +13805,8 @@ CharmInfo::~CharmInfo() void CharmInfo::RestoreState() { if (m_unit->GetTypeId() == TYPEID_UNIT) - if (Creature* pCreature = m_unit->ToCreature()) - pCreature->SetReactState(m_oldReactState); + if (Creature* creature = m_unit->ToCreature()) + creature->SetReactState(m_oldReactState); } void CharmInfo::InitPetActionBar() @@ -15682,8 +15682,8 @@ void Unit::SetStunned(bool apply) SetTarget(getVictim()->GetGUID()); // don't remove UNIT_FLAG_STUNNED for pet when owner is mounted (disabled pet's interface) - Unit* pOwner = GetOwner(); - if (!pOwner || (pOwner->GetTypeId() == TYPEID_PLAYER && !pOwner->ToPlayer()->IsMounted())) + Unit* owner = GetOwner(); + if (!owner || (owner->GetTypeId() == TYPEID_PLAYER && !owner->ToPlayer()->IsMounted())) RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); if (!HasUnitState(UNIT_STAT_ROOT)) // prevent allow move if have also root effect @@ -16183,10 +16183,10 @@ void Unit::GetRaidMember(std::list<Unit*> &nearMembers, float radius) if (!owner) return; - Group* pGroup = owner->GetGroup(); - if (pGroup) + Group* group = owner->GetGroup(); + if (group) { - for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); @@ -16214,15 +16214,15 @@ void Unit::GetRaidMember(std::list<Unit*> &nearMembers, float radius) void Unit::GetPartyMemberInDist(std::list<Unit*> &TagUnitMap, float radius) { Unit* owner = GetCharmerOrOwnerOrSelf(); - Group* pGroup = NULL; + Group* group = NULL; if (owner->GetTypeId() == TYPEID_PLAYER) - pGroup = owner->ToPlayer()->GetGroup(); + group = owner->ToPlayer()->GetGroup(); - if (pGroup) + if (group) { uint8 subgroup = owner->ToPlayer()->GetSubGroup(); - for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); @@ -16251,15 +16251,15 @@ void Unit::GetPartyMemberInDist(std::list<Unit*> &TagUnitMap, float radius) void Unit::GetPartyMembers(std::list<Unit*> &TagUnitMap) { Unit* owner = GetCharmerOrOwnerOrSelf(); - Group* pGroup = NULL; + Group* group = NULL; if (owner->GetTypeId() == TYPEID_PLAYER) - pGroup = owner->ToPlayer()->GetGroup(); + group = owner->ToPlayer()->GetGroup(); - if (pGroup) + if (group) { uint8 subgroup = owner->ToPlayer()->GetSubGroup(); - for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index 8187661f63f..e81cd053003 100755 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -1174,12 +1174,12 @@ void GameEventMgr::GameEventSpawn(int16 event_id) // We use spawn coords to spawn if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY)) { - Creature* pCreature = new Creature; + Creature* creature = new Creature; //sLog->outDebug("Spawning creature %u", *itr); - if (!pCreature->LoadFromDB(*itr, map)) - delete pCreature; + if (!creature->LoadFromDB(*itr, map)) + delete creature; else - map->Add(pCreature); + map->Add(creature); } } } @@ -1248,8 +1248,8 @@ void GameEventMgr::GameEventUnspawn(int16 event_id) { sObjectMgr->RemoveCreatureFromGrid(*itr, data); - if (Creature* pCreature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_UNIT), (Creature*)NULL)) - pCreature->AddObjectToRemoveList(); + if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(*itr, data->id, HIGHGUID_UNIT), (Creature*)NULL)) + creature->AddObjectToRemoveList(); } } @@ -1296,38 +1296,38 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) continue; // Update if spawned - Creature* pCreature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(itr->first, data->id, HIGHGUID_UNIT), (Creature*)NULL); - if (pCreature) + Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(itr->first, data->id, HIGHGUID_UNIT), (Creature*)NULL); + if (creature) { if (activate) { - itr->second.equipement_id_prev = pCreature->GetCurrentEquipmentId(); - itr->second.modelid_prev = pCreature->GetDisplayId(); - pCreature->LoadEquipment(itr->second.equipment_id, true); + itr->second.equipement_id_prev = creature->GetCurrentEquipmentId(); + itr->second.modelid_prev = creature->GetDisplayId(); + creature->LoadEquipment(itr->second.equipment_id, true); if (itr->second.modelid >0 && itr->second.modelid_prev != itr->second.modelid) { CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelInfo(itr->second.modelid); if (minfo) { - pCreature->SetDisplayId(itr->second.modelid); - pCreature->SetNativeDisplayId(itr->second.modelid); - pCreature->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, minfo->bounding_radius); - pCreature->SetFloatValue(UNIT_FIELD_COMBATREACH, minfo->combat_reach); + creature->SetDisplayId(itr->second.modelid); + creature->SetNativeDisplayId(itr->second.modelid); + creature->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, minfo->bounding_radius); + creature->SetFloatValue(UNIT_FIELD_COMBATREACH, minfo->combat_reach); } } } else { - pCreature->LoadEquipment(itr->second.equipement_id_prev, true); + creature->LoadEquipment(itr->second.equipement_id_prev, true); if (itr->second.modelid_prev >0 && itr->second.modelid_prev != itr->second.modelid) { CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelInfo(itr->second.modelid_prev); if (minfo) { - pCreature->SetDisplayId(itr->second.modelid_prev); - pCreature->SetNativeDisplayId(itr->second.modelid_prev); - pCreature->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, minfo->bounding_radius); - pCreature->SetFloatValue(UNIT_FIELD_COMBATREACH, minfo->combat_reach); + creature->SetDisplayId(itr->second.modelid_prev); + creature->SetNativeDisplayId(itr->second.modelid_prev); + creature->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, minfo->bounding_radius); + creature->SetFloatValue(UNIT_FIELD_COMBATREACH, minfo->combat_reach); } } } diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index 0af2c7f82dc..0ea30cabff7 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -1180,16 +1180,16 @@ namespace Trinity class AllFriendlyCreaturesInGrid { public: - AllFriendlyCreaturesInGrid(Unit const* obj) : pUnit(obj) {} + AllFriendlyCreaturesInGrid(Unit const* obj) : unit(obj) {} bool operator() (Unit* u) { - if (u->isAlive() && u->IsVisible() && u->IsFriendlyTo(pUnit)) + if (u->isAlive() && u->IsVisible() && u->IsFriendlyTo(unit)) return true; return false; } private: - Unit const* pUnit; + Unit const* unit; }; class AllGameObjectsWithEntryInRange @@ -1213,9 +1213,9 @@ namespace Trinity { public: AllCreaturesOfEntryInRange(const WorldObject* pObject, uint32 uiEntry, float fMaxRange) : m_pObject(pObject), m_uiEntry(uiEntry), m_fRange(fMaxRange) {} - bool operator() (Unit* pUnit) + bool operator() (Unit* unit) { - if (pUnit->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(pUnit, m_fRange, false)) + if (unit->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(unit, m_fRange, false)) return true; return false; @@ -1230,18 +1230,18 @@ namespace Trinity class PlayerAtMinimumRangeAway { public: - PlayerAtMinimumRangeAway(Unit const* unit, float fMinRange) : pUnit(unit), fRange(fMinRange) {} - bool operator() (Player* pPlayer) + PlayerAtMinimumRangeAway(Unit const* unit, float fMinRange) : unit(unit), fRange(fMinRange) {} + bool operator() (Player* player) { //No threat list check, must be done explicit if expected to be in combat with creature - if (!pPlayer->isGameMaster() && pPlayer->isAlive() && !pUnit->IsWithinDist(pPlayer, fRange, false)) + if (!player->isGameMaster() && player->isAlive() && !unit->IsWithinDist(player, fRange, false)) return true; return false; } private: - Unit const* pUnit; + Unit const* unit; float fRange; }; diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index d0e2852e552..44d7f62305f 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -172,7 +172,6 @@ void Group::LoadGroupFromDB(Field* fields) m_raidDifficulty = RAID_DIFFICULTY_10MAN_NORMAL; else m_raidDifficulty = Difficulty(r_diff); - } void Group::LoadMemberFromDB(uint32 guidLow, uint8 memberFlags, uint8 subgroup, uint8 roles) @@ -720,12 +719,12 @@ void Group::SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r) } // notify group members which player is the allowed looter for the given creature -void Group::SendLooter(Creature* pCreature, Player* pLooter) +void Group::SendLooter(Creature* creature, Player* pLooter) { - ASSERT(pCreature); + ASSERT(creature); WorldPacket data(SMSG_LOOT_LIST, (8+8)); - data << uint64(pCreature->GetGUID()); + data << uint64(creature->GetGUID()); data << uint8(0); // unk1 if (pLooter) @@ -770,7 +769,6 @@ void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject) { if (member->IsWithinDistInMap(pLootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false)) { - r->totalPlayersRolling++; if (member->GetPassOnGroupLoot()) @@ -1255,19 +1253,18 @@ void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot) player->GetSession()->SendPacket(&data); } -void Group::UpdatePlayerOutOfRange(Player* pPlayer) +void Group::UpdatePlayerOutOfRange(Player* player) { - if (!pPlayer || !pPlayer->IsInWorld()) + if (!player || !player->IsInWorld()) return; - Player* player; WorldPacket data; - pPlayer->GetSession()->BuildPartyMemberStatsChangedPacket(pPlayer, &data); + player->GetSession()->BuildPartyMemberStatsChangedPacket(player, &data); for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) { player = itr->getSource(); - if (player && !player->IsWithinDist(pPlayer, player->GetSightRange(), false)) + if (player && !player->IsWithinDist(player, player->GetSightRange(), false)) player->GetSession()->SendPacket(&data); } } @@ -1589,9 +1586,9 @@ bool Group::InCombatToInstance(uint32 instanceId) { for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) { - Player* pPlayer = itr->getSource(); - if (pPlayer && !pPlayer->getAttackers().empty() && pPlayer->GetInstanceId() == instanceId && (pPlayer->GetMap()->IsRaidOrHeroicDungeon())) - for (std::set<Unit*>::const_iterator i = pPlayer->getAttackers().begin(); i != pPlayer->getAttackers().end(); ++i) + Player* player = itr->getSource(); + if (player && !player->getAttackers().empty() && player->GetInstanceId() == instanceId && (player->GetMap()->IsRaidOrHeroicDungeon())) + for (std::set<Unit*>::const_iterator i = player->getAttackers().begin(); i != player->getAttackers().end(); ++i) if ((*i) && (*i)->GetTypeId() == TYPEID_UNIT && (*i)->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND) return true; } @@ -1755,7 +1752,6 @@ void Group::BroadcastGroupUpdate(void) // -- not very efficient but safe for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) { - Player* pp = ObjectAccessor::FindPlayer(citr->guid); if (pp && pp->IsInWorld()) { @@ -2069,4 +2065,4 @@ void Group::ToggleGroupMemberFlag(member_witerator slot, uint8 flag, bool apply) slot->flags |= flag; else slot->flags &= ~flag; -} +}
\ No newline at end of file diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h index 9fcc5f66f58..ed1fc80fd20 100755 --- a/src/server/game/Groups/Group.h +++ b/src/server/game/Groups/Group.h @@ -261,7 +261,7 @@ class Group void SendTargetIconList(WorldSession* session); void SendUpdate(); void SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot = NULL); - void UpdatePlayerOutOfRange(Player* pPlayer); + void UpdatePlayerOutOfRange(Player* player); // ignore: GUID of player that will be ignored void BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group=-1, uint64 ignore=0); void BroadcastReadyCheck(WorldPacket* packet); @@ -276,7 +276,7 @@ class Group void SendLootRoll(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r); void SendLootRollWon(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, uint8 RollType, const Roll &r); void SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r); - void SendLooter(Creature* pCreature, Player* pLooter); + void SendLooter(Creature* creature, Player* pLooter); void GroupLoot(Loot* loot, WorldObject* pLootedObject); void NeedBeforeGreed(Loot* loot, WorldObject* pLootedObject); void MasterLoot(Loot* loot, WorldObject* pLootedObject); diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index f3efde3afa1..0103b164f64 100755 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -489,7 +489,7 @@ bool Guild::BankTab::SetItem(SQLTransaction& trans, uint8 slotId, Item* pItem) return true; } -void Guild::BankTab::SendText(const Guild* pGuild, WorldSession* session) const +void Guild::BankTab::SendText(const Guild* guild, WorldSession* session) const { WorldPacket data(MSG_QUERY_GUILD_BANK_TEXT, 1 + m_text.size() + 1); data << uint8(m_tabId); @@ -498,7 +498,7 @@ void Guild::BankTab::SendText(const Guild* pGuild, WorldSession* session) const if (session) session->SendPacket(&data); else - pGuild->BroadcastPacket(&data); + guild->BroadcastPacket(&data); } /////////////////////////////////////////////////////////////////////////////// @@ -671,7 +671,7 @@ void Guild::Member::DecreaseBankRemainingValue(SQLTransaction& trans, uint8 tabI // If (tabId == GUILD_BANK_MAX_TABS) return money amount. // Otherwise return remaining items amount for specified tab. // If reset time was more than 24 hours ago, renew reset time and reset amount to maximum value. -uint32 Guild::Member::GetBankRemainingValue(uint8 tabId, const Guild* pGuild) const +uint32 Guild::Member::GetBankRemainingValue(uint8 tabId, const Guild* guild) const { // Guild master has unlimited amount. if (IsRank(GR_GUILDMASTER)) @@ -679,7 +679,7 @@ uint32 Guild::Member::GetBankRemainingValue(uint8 tabId, const Guild* pGuild) co // Check rights for non-money tab. if (tabId != GUILD_BANK_MAX_TABS) - if ((pGuild->_GetRankBankTabRights(m_rankId, tabId) & GUILD_BANK_RIGHT_VIEW_TAB) != GUILD_BANK_RIGHT_VIEW_TAB) + if ((guild->_GetRankBankTabRights(m_rankId, tabId) & GUILD_BANK_RIGHT_VIEW_TAB) != GUILD_BANK_RIGHT_VIEW_TAB) return 0; uint32 curTime = uint32(::time(NULL) / MINUTE); // minutes @@ -688,8 +688,8 @@ uint32 Guild::Member::GetBankRemainingValue(uint8 tabId, const Guild* pGuild) co RemainingValue& rv = const_cast <RemainingValue&> (m_bankRemaining[tabId]); rv.resetTime = curTime; rv.value = tabId == GUILD_BANK_MAX_TABS ? - pGuild->_GetRankBankMoneyPerDay(m_rankId) : - pGuild->_GetRankBankTabSlotsPerDay(m_rankId, tabId); + guild->_GetRankBankMoneyPerDay(m_rankId) : + guild->_GetRankBankTabSlotsPerDay(m_rankId, tabId); PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement( tabId == GUILD_BANK_MAX_TABS ? @@ -1293,7 +1293,7 @@ void Guild::HandleSetEmblem(WorldSession* session, const EmblemInfo& emblemInfo) { Player* player = session->GetPlayer(); if (!_IsLeader(player)) - // "Only pGuild leaders can create emblems." + // "Only guild leaders can create emblems." SendSaveEmblemResult(session, ERR_GUILDEMBLEM_NOTGUILDMASTER); else if (!player->HasEnoughMoney(EMBLEM_PRICE)) // "You can't afford to do that." @@ -1634,7 +1634,7 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount) if (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(player->GetSession()->GetAccountId(), - "GM %s (Account: %u) deposit money (Amount: %u) to pGuild bank (Guild ID %u)", + "GM %s (Account: %u) deposit money (Amount: %u) to guild bank (Guild ID %u)", player->GetName(), player->GetSession()->GetAccountId(), amount, m_id); } // Log guild bank event diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h index 51636dc218e..2ea345f2ca1 100755 --- a/src/server/game/Guilds/Guild.h +++ b/src/server/game/Guilds/Guild.h @@ -473,7 +473,7 @@ private: void SetInfo(const std::string& name, const std::string& icon); void SetText(const std::string& text); - void SendText(const Guild* pGuild, WorldSession* session) const; + void SendText(const Guild* guild, WorldSession* session) const; inline Item* GetItem(uint8 slotId) const { return slotId < GUILD_BANK_MAX_SLOTS ? m_items[slotId] : NULL; } bool SetItem(SQLTransaction& trans, uint8 slotId, Item* pItem); @@ -492,7 +492,7 @@ private: class MoveItemData { public: - MoveItemData(Guild* pGuild, Player* player, uint8 container, uint8 slotId) : m_pGuild(pGuild), m_pPlayer(player), + MoveItemData(Guild* guild, Player* player, uint8 container, uint8 slotId) : m_pGuild(guild), m_pPlayer(player), m_container(container), m_slotId(slotId), m_pItem(NULL), m_pClonedItem(NULL) { } virtual ~MoveItemData() { } @@ -538,8 +538,8 @@ private: class PlayerMoveItemData : public MoveItemData { public: - PlayerMoveItemData(Guild* pGuild, Player* player, uint8 container, uint8 slotId) : - MoveItemData(pGuild, player, container, slotId) { } + PlayerMoveItemData(Guild* guild, Player* player, uint8 container, uint8 slotId) : + MoveItemData(guild, player, container, slotId) { } bool IsBank() const { return false; } bool InitItem(); @@ -553,8 +553,8 @@ private: class BankMoveItemData : public MoveItemData { public: - BankMoveItemData(Guild* pGuild, Player* player, uint8 container, uint8 slotId) : - MoveItemData(pGuild, player, container, slotId) { } + BankMoveItemData(Guild* guild, Player* player, uint8 container, uint8 slotId) : + MoveItemData(guild, player, container, slotId) { } bool IsBank() const { return true; } bool InitItem(); diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index fe8bfa6b844..b2c504dfb9f 100755 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -292,8 +292,8 @@ void InstanceScript::DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData) if (!lPlayers.isEmpty()) { for (Map::PlayerList::const_iterator itr = lPlayers.begin(); itr != lPlayers.end(); ++itr) - if (Player* pPlayer = itr->getSource()) - pPlayer->SendUpdateWorldState(uiStateId, uiStateData); + if (Player* player = itr->getSource()) + player->SendUpdateWorldState(uiStateId, uiStateData); } else sLog->outDebug(LOG_FILTER_TSCR, "TSCR: DoUpdateWorldState attempt send data but no players in map."); @@ -311,8 +311,8 @@ void InstanceScript::DoSendNotifyToInstance(const char *format, ...) va_start(ap, format); for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) { - if (Player* pPlayer = i->getSource()) - if (WorldSession* pSession = pPlayer->GetSession()) + if (Player* player = i->getSource()) + if (WorldSession* pSession = player->GetSession()) pSession->SendNotification(format, ap); } va_end(ap); @@ -326,8 +326,8 @@ void InstanceScript::DoUpdateAchievementCriteria(AchievementCriteriaTypes type, if (!PlayerList.isEmpty()) for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (Player* pPlayer = i->getSource()) - pPlayer->UpdateAchievementCriteria(type, miscValue1, miscValue2, unit); + if (Player* player = i->getSource()) + player->UpdateAchievementCriteria(type, miscValue1, miscValue2, unit); } // Start timed achievement for all players in instance @@ -337,8 +337,8 @@ void InstanceScript::DoStartTimedAchievement(AchievementCriteriaTimedTypes type, if (!PlayerList.isEmpty()) for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (Player* pPlayer = i->getSource()) - pPlayer->GetAchievementMgr().StartTimedAchievement(type, entry); + if (Player* player = i->getSource()) + player->GetAchievementMgr().StartTimedAchievement(type, entry); } // Stop timed achievement for all players in instance @@ -348,8 +348,8 @@ void InstanceScript::DoStopTimedAchievement(AchievementCriteriaTimedTypes type, if (!PlayerList.isEmpty()) for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i) - if (Player* pPlayer = i->getSource()) - pPlayer->GetAchievementMgr().RemoveTimedAchievement(type, entry); + if (Player* player = i->getSource()) + player->GetAchievementMgr().RemoveTimedAchievement(type, entry); } // Remove Auras due to Spell on all players in instance diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index c8063ccb818..eff811b14eb 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -430,19 +430,19 @@ bool Loot::FillLoot(uint32 lootId, LootStore const& store, Player* lootOwner, bo tab->Process(*this, store.IsRatesAllowed(), lootMode); // Processing is done there, callback via Loot::AddItem() // Setting access rights for group loot case - Group* pGroup = lootOwner->GetGroup(); - if (!personal && pGroup) + Group* group = lootOwner->GetGroup(); + if (!personal && group) { roundRobinPlayer = lootOwner->GetGUID(); - for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) if (Player* pl = itr->getSource()) // should actually be looted object instead of lootOwner but looter has to be really close so doesnt really matter FillNotNormalLootFor(pl, pl->IsAtGroupRewardDistance(lootOwner)); for (uint8 i = 0; i < items.size(); ++i) { if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(items[i].itemid)) - if (proto->Quality < uint32(pGroup->GetLootThreshold())) + if (proto->Quality < uint32(group->GetLootThreshold())) items[i].is_underthreshold = true; } } diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index e122c5bffae..b283227bb58 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2240,8 +2240,8 @@ bool InstanceMap::CanEnter(Player* player) } // cannot enter while an encounter is in progress on raids - /*Group* pGroup = player->GetGroup(); - if (!player->isGameMaster() && pGroup && pGroup->InCombatToInstance(GetInstanceId()) && player->GetMapId() != GetId())*/ + /*Group* group = player->GetGroup(); + if (!player->isGameMaster() && group && group->InCombatToInstance(GetInstanceId()) && player->GetMapId() != GetId())*/ if (IsRaid() && GetInstanceScript() && GetInstanceScript()->IsEncounterInProgress()) { player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT); diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index 6cab6110741..b925150ef71 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -432,9 +432,9 @@ void OPvPCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid) void OutdoorPvP::HandleKill(Player* killer, Unit* killed) { - if (Group* pGroup = killer->GetGroup()) + if (Group* group = killer->GetGroup()) { - for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* pGroupGuy = itr->getSource(); diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index c5d2deef376..801b95e4c42 100755 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -220,8 +220,8 @@ void PoolGroup<Creature>::Despawn1Object(uint32 guid) { sObjectMgr->RemoveCreatureFromGrid(guid, data); - if (Creature* pCreature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_UNIT), (Creature*)NULL)) - pCreature->AddObjectToRemoveList(); + if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(guid, data->id, HIGHGUID_UNIT), (Creature*)NULL)) + creature->AddObjectToRemoveList(); } } @@ -363,15 +363,15 @@ void PoolGroup<Creature>::Spawn1Object(PoolObject* obj) // We use spawn coords to spawn if (!map->Instanceable() && map->IsLoaded(data->posX, data->posY)) { - Creature* pCreature = new Creature; + Creature* creature = new Creature; //sLog->outDebug(LOG_FILTER_POOLSYS, "Spawning creature %u", guid); - if (!pCreature->LoadFromDB(obj->guid, map)) + if (!creature->LoadFromDB(obj->guid, map)) { - delete pCreature; + delete creature; return; } else - map->Add(pCreature); + map->Add(creature); } } } @@ -506,8 +506,8 @@ template <> void PoolGroup<Creature>::ReSpawn1Object(PoolObject* obj) { if (CreatureData const* data = sObjectMgr->GetCreatureData(obj->guid)) - if (Creature* pCreature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(obj->guid, data->id, HIGHGUID_UNIT), (Creature*)NULL)) - pCreature->GetMap()->Add(pCreature); + if (Creature* creature = ObjectAccessor::GetObjectInWorld(MAKE_NEW_GUID(obj->guid, data->id, HIGHGUID_UNIT), (Creature*)NULL)) + creature->GetMap()->Add(creature); } // Method that does the respawn job on the specified gameobject diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index 22251ac0bd8..a1a1f5d5cac 100755 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -166,16 +166,16 @@ Quest::Quest(Field* questRecord) ++m_rewchoiceitemscount; } -uint32 Quest::XPValue(Player* pPlayer) const +uint32 Quest::XPValue(Player* player) const { - if (pPlayer) + if (player) { - int32 quest_level = (QuestLevel == -1 ? pPlayer->getLevel() : QuestLevel); + int32 quest_level = (QuestLevel == -1 ? player->getLevel() : QuestLevel); const QuestXPEntry* xpentry = sQuestXPStore.LookupEntry(quest_level); if (!xpentry) return 0; - int32 diffFactor = 2 * (quest_level - pPlayer->getLevel()) + 20; + int32 diffFactor = 2 * (quest_level - player->getLevel()) + 20; if (diffFactor < 1) diffFactor = 1; else if (diffFactor > 10) diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h index 8c415749d6b..61d492ce88c 100755 --- a/src/server/game/Quests/QuestDef.h +++ b/src/server/game/Quests/QuestDef.h @@ -183,7 +183,7 @@ class Quest friend class ObjectMgr; public: Quest(Field* questRecord); - uint32 XPValue(Player* pPlayer) const; + uint32 XPValue(Player* player) const; bool HasFlag(uint32 flag) const { return (QuestFlags & flag) != 0; } void SetFlag(uint32 flag) { QuestFlags |= flag; } diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index ec651439bc5..d33d338fe82 100755 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -100,29 +100,29 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou // Helpers for ScriptProcess method. inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* target, const ScriptInfo* scriptInfo) const { - Player* pPlayer = NULL; + Player* player = NULL; if (!source && !target) sLog->outError("%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str()); else { // Check target first, then source. if (target) - pPlayer = target->ToPlayer(); - if (!pPlayer && source) - pPlayer = source->ToPlayer(); + player = target->ToPlayer(); + if (!player && source) + player = source->ToPlayer(); - if (!pPlayer) + if (!player) sLog->outError("%s neither source nor target object is player (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(), source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0, target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0); } - return pPlayer; + return player; } inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* target, const ScriptInfo* scriptInfo, bool bReverse) const { - Creature* pCreature = NULL; + Creature* creature = NULL; if (!source && !target) sLog->outError("%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str()); else @@ -131,31 +131,31 @@ inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* t { // Check target first, then source. if (target) - pCreature = target->ToCreature(); - if (!pCreature && source) - pCreature = source->ToCreature(); + creature = target->ToCreature(); + if (!creature && source) + creature = source->ToCreature(); } else { // Check source first, then target. if (source) - pCreature = source->ToCreature(); - if (!pCreature && target) - pCreature = target->ToCreature(); + creature = source->ToCreature(); + if (!creature && target) + creature = target->ToCreature(); } - if (!pCreature) + if (!creature) sLog->outError("%s neither source nor target are creatures (source: TypeId: %u, Entry: %u, GUID: %u; target: TypeId: %u, Entry: %u, GUID: %u), skipping.", scriptInfo->GetDebugInfo().c_str(), source ? source->GetTypeId() : 0, source ? source->GetEntry() : 0, source ? source->GetGUIDLow() : 0, target ? target->GetTypeId() : 0, target ? target->GetEntry() : 0, target ? target->GetGUIDLow() : 0); } - return pCreature; + return creature; } inline Unit* Map::_GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const { - Unit* pUnit = NULL; + Unit* unit = NULL; if (!obj) sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); else if (!obj->isType(TYPEMASK_UNIT)) @@ -163,42 +163,42 @@ inline Unit* Map::_GetScriptUnit(Object* obj, bool isSource, const ScriptInfo* s scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow()); else { - pUnit = obj->ToUnit(); - if (!pUnit) + unit = obj->ToUnit(); + if (!unit) sLog->outError("%s %s object could not be casted to unit.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); } - return pUnit; + return unit; } inline Player* Map::_GetScriptPlayer(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const { - Player* pPlayer = NULL; + Player* player = NULL; if (!obj) sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); else { - pPlayer = obj->ToPlayer(); - if (!pPlayer) + player = obj->ToPlayer(); + if (!player) sLog->outError("%s %s object is not a player (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow()); } - return pPlayer; + return player; } inline Creature* Map::_GetScriptCreature(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const { - Creature* pCreature = NULL; + Creature* creature = NULL; if (!obj) sLog->outError("%s %s object is NULL.", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target"); else { - pCreature = obj->ToCreature(); - if (!pCreature) + creature = obj->ToCreature(); + if (!creature) sLog->outError("%s %s object is not a creature (TypeId: %u, Entry: %u, GUID: %u).", scriptInfo->GetDebugInfo().c_str(), isSource ? "source" : "target", obj->GetTypeId(), obj->GetEntry(), obj->GetGUIDLow()); } - return pCreature; + return creature; } inline WorldObject* Map::_GetScriptWorldObject(Object* obj, bool isSource, const ScriptInfo* scriptInfo) const diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 64c92470fd7..26d703458ac 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -479,6 +479,7 @@ void AddSC_boss_blood_prince_council(); void AddSC_boss_blood_queen_lana_thel(); void AddSC_boss_valithria_dreamwalker(); void AddSC_boss_sindragosa(); +void AddSC_boss_the_lich_king(); void AddSC_icecrown_citadel_teleport(); void AddSC_instance_icecrown_citadel(); void AddSC_icecrown_citadel(); @@ -1181,6 +1182,7 @@ void AddNorthrendScripts() AddSC_boss_blood_queen_lana_thel(); AddSC_boss_valithria_dreamwalker(); AddSC_boss_sindragosa(); + AddSC_boss_the_lich_king(); AddSC_icecrown_citadel_teleport(); AddSC_instance_icecrown_citadel(); AddSC_icecrown_citadel(); diff --git a/src/server/game/Server/Protocol/Handlers/AuctionHouseHandler.cpp b/src/server/game/Server/Protocol/Handlers/AuctionHouseHandler.cpp index cce89de27a8..a67006382ff 100755 --- a/src/server/game/Server/Protocol/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/AuctionHouseHandler.cpp @@ -130,14 +130,14 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) if (!item || !bid || !etime) return; //check for cheaters - Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); - if (!pCreature) + Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); + if (!creature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionSellItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); return; } - AuctionHouseEntry const* auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(pCreature->getFaction()); + AuctionHouseEntry const* auctionHouseEntry = AuctionHouseMgr::GetAuctionHouseEntry(creature->getFaction()); if (!auctionHouseEntry) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionSellItem - Unit (GUID: %u) has wrong faction.", uint32(GUID_LOPART(auctioneer))); @@ -195,7 +195,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) return; } - AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction()); + AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction()); //we have to take deposit : uint32 deposit = sAuctionMgr->GetAuctionDeposit(auctionHouseEntry, etime, it, count); @@ -262,8 +262,8 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data) if (!auctionId || !price) return; //check for cheaters - Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); - if (!pCreature) + Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); + if (!creature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionPlaceBid - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); return; @@ -273,7 +273,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data) if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction()); + AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction()); AuctionEntry* auction = auctionHouse->GetAuction(auctionId); Player* pl = GetPlayer(); @@ -380,8 +380,8 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data) recv_data >> auctionId; //sLog->outDebug("Cancel AUCTION AuctionID: %u", auctionId); - Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); - if (!pCreature) + Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); + if (!creature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionRemoveItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); return; @@ -391,7 +391,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data) if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction()); + AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction()); AuctionEntry* auction = auctionHouse->GetAuction(auctionId); Player* pl = GetPlayer(); @@ -465,8 +465,8 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data) outbiddedCount = 0; } - Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); - if (!pCreature) + Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); + if (!creature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; @@ -476,7 +476,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data) if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction()); + AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction()); WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4+4+4)); Player* pl = GetPlayer(); @@ -512,8 +512,8 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recv_data) recv_data >> guid; recv_data >> listfrom; // not used in fact (this list not have page control in client) - Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); - if (!pCreature) + Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); + if (!creature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionListOwnerItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; @@ -523,7 +523,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket & recv_data) if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction()); + AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction()); WorldPacket data(SMSG_AUCTION_OWNER_LIST_RESULT, (4+4+4)); data << (uint32) 0; // amount place holder @@ -565,8 +565,8 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recv_data) recv_data.read_skip<uint8>(); } - Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); - if (!pCreature) + Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); + if (!creature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; @@ -576,7 +576,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recv_data) if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction()); + AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(creature->getFaction()); //sLog->outDebug("Auctionhouse search (GUID: %u TypeId: %u)",, list from: %u, searchedname: %s, levelmin: %u, levelmax: %u, auctionSlotID: %u, auctionMainCategory: %u, auctionSubCategory: %u, quality: %u, usable: %u", // GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)), listfrom, searchedname.c_str(), levelmin, levelmax, auctionSlotID, auctionMainCategory, auctionSubCategory, quality, usable); diff --git a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp index dc57baff7fe..13bbacaf878 100755 --- a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp @@ -883,8 +883,8 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) if (pCurrChar->GetGuildId() != 0) { - if (Guild* pGuild = sGuildMgr->GetGuildById(pCurrChar->GetGuildId())) - pGuild->SendLoginInfo(this); + if (Guild* guild = sGuildMgr->GetGuildById(pCurrChar->GetGuildId())) + guild->SendLoginInfo(this); else { // remove wrong guild data diff --git a/src/server/game/Server/Protocol/Handlers/GuildHandler.cpp b/src/server/game/Server/Protocol/Handlers/GuildHandler.cpp index e8f6f05ee67..7e964b4faf6 100755 --- a/src/server/game/Server/Protocol/Handlers/GuildHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/GuildHandler.cpp @@ -33,8 +33,8 @@ inline Guild* _GetPlayerGuild(WorldSession* session, bool sendError = false) { if (uint32 guildId = session->GetPlayer()->GetGuildId()) // If guild id = 0, player is not in guild - if (Guild* pGuild = sGuildMgr->GetGuildById(guildId)) // Find guild by id - return pGuild; + if (Guild* guild = sGuildMgr->GetGuildById(guildId)) // Find guild by id + return guild; if (sendError) Guild::SendCommandResult(session, GUILD_CREATE_S, ERR_GUILD_PLAYER_NOT_IN_GUILD); return NULL; @@ -47,8 +47,8 @@ void WorldSession::HandleGuildQueryOpcode(WorldPacket& recvPacket) uint32 guildId; recvPacket >> guildId; // Use received guild id to access guild method (not player's guild id) - if (Guild* pGuild = sGuildMgr->GetGuildById(guildId)) - pGuild->HandleQuery(this); + if (Guild* guild = sGuildMgr->GetGuildById(guildId)) + guild->HandleQuery(this); else Guild::SendCommandResult(this, GUILD_CREATE_S, ERR_GUILD_PLAYER_NOT_IN_GUILD); } @@ -62,11 +62,11 @@ void WorldSession::HandleGuildCreateOpcode(WorldPacket& recvPacket) if (!GetPlayer()->GetGuildId()) // Player cannot be in guild { - Guild* pGuild = new Guild(); - if (pGuild->Create(GetPlayer(), name)) - sGuildMgr->AddGuild(pGuild); + Guild* guild = new Guild(); + if (guild->Create(GetPlayer(), name)) + sGuildMgr->AddGuild(guild); else - delete pGuild; + delete guild; } } @@ -78,8 +78,8 @@ void WorldSession::HandleGuildInviteOpcode(WorldPacket& recvPacket) recvPacket >> invitedName; if (normalizePlayerName(invitedName)) - if (Guild* pGuild = _GetPlayerGuild(this, true)) - pGuild->HandleInviteMember(this, invitedName); + if (Guild* guild = _GetPlayerGuild(this, true)) + guild->HandleInviteMember(this, invitedName); } void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket) @@ -90,8 +90,8 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket) recvPacket >> playerName; if (normalizePlayerName(playerName)) - if (Guild* pGuild = _GetPlayerGuild(this, true)) - pGuild->HandleRemoveMember(this, playerName); + if (Guild* guild = _GetPlayerGuild(this, true)) + guild->HandleRemoveMember(this, playerName); } void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/) @@ -100,8 +100,8 @@ void WorldSession::HandleGuildAcceptOpcode(WorldPacket& /*recvPacket*/) // Player cannot be in guild if (!GetPlayer()->GetGuildId()) // Guild where player was invited must exist - if (Guild* pGuild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildIdInvited())) - pGuild->HandleAcceptMember(this); + if (Guild* guild = sGuildMgr->GetGuildById(GetPlayer()->GetGuildIdInvited())) + guild->HandleAcceptMember(this); } void WorldSession::HandleGuildDeclineOpcode(WorldPacket& /*recvPacket*/) @@ -116,16 +116,16 @@ void WorldSession::HandleGuildInfoOpcode(WorldPacket& /*recvPacket*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_INFO"); - if (Guild* pGuild = _GetPlayerGuild(this, true)) - pGuild->SendInfo(this); + if (Guild* guild = _GetPlayerGuild(this, true)) + guild->SendInfo(this); } void WorldSession::HandleGuildRosterOpcode(WorldPacket& /*recvPacket*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_ROSTER"); - if (Guild* pGuild = _GetPlayerGuild(this)) - pGuild->HandleRoster(this); + if (Guild* guild = _GetPlayerGuild(this)) + guild->HandleRoster(this); } void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket) @@ -136,8 +136,8 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket) recvPacket >> playerName; if (normalizePlayerName(playerName)) - if (Guild* pGuild = _GetPlayerGuild(this, true)) - pGuild->HandleUpdateMemberRank(this, playerName, false); + if (Guild* guild = _GetPlayerGuild(this, true)) + guild->HandleUpdateMemberRank(this, playerName, false); } void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket) @@ -148,24 +148,24 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket) recvPacket >> playerName; if (normalizePlayerName(playerName)) - if (Guild* pGuild = _GetPlayerGuild(this, true)) - pGuild->HandleUpdateMemberRank(this, playerName, true); + if (Guild* guild = _GetPlayerGuild(this, true)) + guild->HandleUpdateMemberRank(this, playerName, true); } void WorldSession::HandleGuildLeaveOpcode(WorldPacket& /*recvPacket*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_LEAVE"); - if (Guild* pGuild = _GetPlayerGuild(this, true)) - pGuild->HandleLeaveMember(this); + if (Guild* guild = _GetPlayerGuild(this, true)) + guild->HandleLeaveMember(this); } void WorldSession::HandleGuildDisbandOpcode(WorldPacket& /*recvPacket*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_DISBAND"); - if (Guild* pGuild = _GetPlayerGuild(this, true)) - pGuild->HandleDisband(this); + if (Guild* guild = _GetPlayerGuild(this, true)) + guild->HandleDisband(this); } void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket) @@ -176,8 +176,8 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket) recvPacket >> name; if (normalizePlayerName(name)) - if (Guild* pGuild = _GetPlayerGuild(this, true)) - pGuild->HandleSetLeader(this, name); + if (Guild* guild = _GetPlayerGuild(this, true)) + guild->HandleSetLeader(this, name); } void WorldSession::HandleGuildMOTDOpcode(WorldPacket& recvPacket) @@ -188,8 +188,8 @@ void WorldSession::HandleGuildMOTDOpcode(WorldPacket& recvPacket) if (!recvPacket.empty()) recvPacket >> motd; - if (Guild* pGuild = _GetPlayerGuild(this, true)) - pGuild->HandleSetMOTD(this, motd); + if (Guild* guild = _GetPlayerGuild(this, true)) + guild->HandleSetMOTD(this, motd); } void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket) @@ -203,8 +203,8 @@ void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket) recvPacket >> publicNote; if (normalizePlayerName(playerName)) - if (Guild* pGuild = _GetPlayerGuild(this, true)) - pGuild->HandleSetMemberNote(this, playerName, publicNote, false); + if (Guild* guild = _GetPlayerGuild(this, true)) + guild->HandleSetMemberNote(this, playerName, publicNote, false); } void WorldSession::HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket) @@ -218,16 +218,16 @@ void WorldSession::HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket) recvPacket >> officerNote; if (normalizePlayerName(playerName)) - if (Guild* pGuild = _GetPlayerGuild(this, true)) - pGuild->HandleSetMemberNote(this, playerName, officerNote, true); + if (Guild* guild = _GetPlayerGuild(this, true)) + guild->HandleSetMemberNote(this, playerName, officerNote, true); } void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_RANK"); - Guild* pGuild = _GetPlayerGuild(this, true); - if (!pGuild) + Guild* guild = _GetPlayerGuild(this, true); + if (!guild) { recvPacket.rpos(recvPacket.wpos()); return; @@ -257,7 +257,7 @@ void WorldSession::HandleGuildRankOpcode(WorldPacket& recvPacket) rightsAndSlots[tabId] = GuildBankRightsAndSlots(uint8(bankRights), slots); } - pGuild->HandleSetRankInfo(this, rankId, rankName, rights, money, rightsAndSlots); + guild->HandleSetRankInfo(this, rankId, rankName, rights, money, rightsAndSlots); } void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket) @@ -267,16 +267,16 @@ void WorldSession::HandleGuildAddRankOpcode(WorldPacket& recvPacket) std::string rankName; recvPacket >> rankName; - if (Guild* pGuild = _GetPlayerGuild(this, true)) - pGuild->HandleAddNewRank(this, rankName); + if (Guild* guild = _GetPlayerGuild(this, true)) + guild->HandleAddNewRank(this, rankName); } void WorldSession::HandleGuildDelRankOpcode(WorldPacket& /*recvPacket*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GUILD_DEL_RANK"); - if (Guild* pGuild = _GetPlayerGuild(this, true)) - pGuild->HandleRemoveLowestRank(this); + if (Guild* guild = _GetPlayerGuild(this, true)) + guild->HandleRemoveLowestRank(this); } void WorldSession::HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket) @@ -286,8 +286,8 @@ void WorldSession::HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket) std::string info; recvPacket >> info; - if (Guild* pGuild = _GetPlayerGuild(this, true)) - pGuild->HandleSetInfo(this, info); + if (Guild* guild = _GetPlayerGuild(this, true)) + guild->HandleSetInfo(this, info); } void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket) @@ -306,10 +306,10 @@ void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket) if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - if (Guild* pGuild = _GetPlayerGuild(this)) - pGuild->HandleSetEmblem(this, emblemInfo); + if (Guild* guild = _GetPlayerGuild(this)) + guild->HandleSetEmblem(this, emblemInfo); else - // "You are not part of a pGuild!"; + // "You are not part of a guild!"; Guild::SendSaveEmblemResult(this, ERR_GUILDEMBLEM_NOGUILD); } else @@ -324,24 +324,24 @@ void WorldSession::HandleGuildEventLogQueryOpcode(WorldPacket& /* recvPacket */) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (MSG_GUILD_EVENT_LOG_QUERY)"); - if (Guild* pGuild = _GetPlayerGuild(this)) - pGuild->SendEventLog(this); + if (Guild* guild = _GetPlayerGuild(this)) + guild->SendEventLog(this); } void WorldSession::HandleGuildBankMoneyWithdrawn(WorldPacket & /* recv_data */) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (MSG_GUILD_BANK_MONEY_WITHDRAWN)"); - if (Guild* pGuild = _GetPlayerGuild(this)) - pGuild->SendMoneyInfo(this); + if (Guild* guild = _GetPlayerGuild(this)) + guild->SendMoneyInfo(this); } void WorldSession::HandleGuildPermissions(WorldPacket& /* recv_data */) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (MSG_GUILD_PERMISSIONS)"); - if (Guild* pGuild = _GetPlayerGuild(this)) - pGuild->SendPermissions(this); + if (Guild* guild = _GetPlayerGuild(this)) + guild->SendPermissions(this); } // Called when clicking on Guild bank gameobject @@ -357,14 +357,14 @@ void WorldSession::HandleGuildBankerActivate(WorldPacket & recv_data) if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK)) { - if (Guild* pGuild = _GetPlayerGuild(this)) - pGuild->SendBankTabsInfo(this); + if (Guild* guild = _GetPlayerGuild(this)) + guild->SendBankTabsInfo(this); else Guild::SendCommandResult(this, GUILD_UNK1, ERR_GUILD_PLAYER_NOT_IN_GUILD); } } -// Called when opening pGuild bank tab only (first one) +// Called when opening guild bank tab only (first one) void WorldSession::HandleGuildBankQueryTab(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received (CMSG_GUILD_BANK_QUERY_TAB)"); @@ -379,8 +379,8 @@ void WorldSession::HandleGuildBankQueryTab(WorldPacket & recv_data) recv_data >> unk1; if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK)) - if (Guild* pGuild = _GetPlayerGuild(this)) - pGuild->SendBankTabData(this, tabId); + if (Guild* guild = _GetPlayerGuild(this)) + guild->SendBankTabData(this, tabId); } void WorldSession::HandleGuildBankDepositMoney(WorldPacket & recv_data) @@ -395,8 +395,8 @@ void WorldSession::HandleGuildBankDepositMoney(WorldPacket & recv_data) if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK)) if (money && GetPlayer()->HasEnoughMoney(money)) - if (Guild* pGuild = _GetPlayerGuild(this)) - pGuild->HandleMemberDepositMoney(this, money); + if (Guild* guild = _GetPlayerGuild(this)) + guild->HandleMemberDepositMoney(this, money); } void WorldSession::HandleGuildBankWithdrawMoney(WorldPacket & recv_data) @@ -411,8 +411,8 @@ void WorldSession::HandleGuildBankWithdrawMoney(WorldPacket & recv_data) if (money) if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK)) - if (Guild* pGuild = _GetPlayerGuild(this)) - pGuild->HandleMemberWithdrawMoney(this, money); + if (Guild* guild = _GetPlayerGuild(this)) + guild->HandleMemberWithdrawMoney(this, money); } void WorldSession::HandleGuildBankSwapItems(WorldPacket & recv_data) @@ -428,8 +428,8 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket & recv_data) return; } - Guild* pGuild = _GetPlayerGuild(this); - if (!pGuild) + Guild* guild = _GetPlayerGuild(this); + if (!guild) { recv_data.rfinish(); // Prevent additional spam at rejected packet return; @@ -459,7 +459,7 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket & recv_data) recv_data >> splitedAmount; - pGuild->SwapItems(GetPlayer(), tabId, slotId, destTabId, destSlotId, splitedAmount); + guild->SwapItems(GetPlayer(), tabId, slotId, destTabId, destSlotId, splitedAmount); } else { @@ -492,7 +492,7 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket & recv_data) if (!Player::IsInventoryPos(playerBag, playerSlotId) && !(playerBag == NULL_BAG && playerSlotId == NULL_SLOT)) GetPlayer()->SendEquipError(EQUIP_ERR_NONE, NULL); else - pGuild->SwapItemsWithInventory(GetPlayer(), toChar, tabId, slotId, playerBag, playerSlotId, splitedAmount); + guild->SwapItemsWithInventory(GetPlayer(), toChar, tabId, slotId, playerBag, playerSlotId, splitedAmount); } } @@ -507,8 +507,8 @@ void WorldSession::HandleGuildBankBuyTab(WorldPacket & recv_data) recv_data >> tabId; if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK)) - if (Guild* pGuild = _GetPlayerGuild(this)) - pGuild->HandleBuyBankTab(this, tabId); + if (Guild* guild = _GetPlayerGuild(this)) + guild->HandleBuyBankTab(this, tabId); } void WorldSession::HandleGuildBankUpdateTab(WorldPacket & recv_data) @@ -529,8 +529,8 @@ void WorldSession::HandleGuildBankUpdateTab(WorldPacket & recv_data) if (!name.empty() && !icon.empty()) if (GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK)) - if (Guild* pGuild = _GetPlayerGuild(this)) - pGuild->HandleSetBankTabInfo(this, tabId, name, icon); + if (Guild* guild = _GetPlayerGuild(this)) + guild->HandleSetBankTabInfo(this, tabId, name, icon); } void WorldSession::HandleGuildBankLogQuery(WorldPacket & recv_data) @@ -540,8 +540,8 @@ void WorldSession::HandleGuildBankLogQuery(WorldPacket & recv_data) uint8 tabId; recv_data >> tabId; - if (Guild* pGuild = _GetPlayerGuild(this)) - pGuild->SendBankLog(this, tabId); + if (Guild* guild = _GetPlayerGuild(this)) + guild->SendBankLog(this, tabId); } void WorldSession::HandleQueryGuildBankTabText(WorldPacket &recv_data) @@ -551,8 +551,8 @@ void WorldSession::HandleQueryGuildBankTabText(WorldPacket &recv_data) uint8 tabId; recv_data >> tabId; - if (Guild* pGuild = _GetPlayerGuild(this)) - pGuild->SendBankTabText(this, tabId); + if (Guild* guild = _GetPlayerGuild(this)) + guild->SendBankTabText(this, tabId); } void WorldSession::HandleSetGuildBankTabText(WorldPacket &recv_data) @@ -565,6 +565,6 @@ void WorldSession::HandleSetGuildBankTabText(WorldPacket &recv_data) std::string text; recv_data >> text; - if (Guild* pGuild = _GetPlayerGuild(this)) - pGuild->SetBankTabText(tabId, text); + if (Guild* guild = _GetPlayerGuild(this)) + guild->SetBankTabText(tabId, text); } diff --git a/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp b/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp index 9e18e25f8f7..eca466436be 100755 --- a/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp @@ -494,8 +494,8 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data) if (!itemguid) return; - Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); - if (!pCreature) + Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); + if (!creature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleSellItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid))); _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, itemguid, 0); @@ -512,21 +512,21 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data) // prevent sell not owner item if (_player->GetGUID() != pItem->GetOwnerGUID()) { - _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); + _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0); return; } // prevent sell non empty bag by drag-and-drop at vendor's item list if (pItem->IsNotEmptyBag()) { - _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); + _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0); return; } // prevent sell currently looted item if (_player->GetLootGUID() == pItem->GetGUID()) { - _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); + _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0); return; } @@ -546,7 +546,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data) // prevent sell more items that exist in stack (possible only not from client) if (count > pItem->GetCount()) { - _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); + _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0); return; } } @@ -562,7 +562,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data) if (!pNewItem) { sLog->outError("WORLD: HandleSellItemOpcode - could not create clone of item %u; count = %u", pItem->GetEntry(), count); - _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); + _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0); return; } @@ -589,11 +589,11 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data) _player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_MONEY_FROM_VENDORS, money); } else - _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, pCreature, itemguid, 0); + _player->SendSellError(SELL_ERR_CANT_SELL_ITEM, creature, itemguid, 0); return; } } - _player->SendSellError(SELL_ERR_CANT_FIND_ITEM, pCreature, itemguid, 0); + _player->SendSellError(SELL_ERR_CANT_FIND_ITEM, creature, itemguid, 0); return; } @@ -605,8 +605,8 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data) recv_data >> vendorguid >> slot; - Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); - if (!pCreature) + Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); + if (!creature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid))); _player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, NULL, 0, 0); @@ -623,7 +623,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data) uint32 price = _player->GetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + slot - BUYBACK_SLOT_START); if (!_player->HasEnoughMoney(price)) { - _player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, pItem->GetEntry(), 0); + _player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, pItem->GetEntry(), 0); return; } @@ -642,7 +642,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data) return; } else - _player->SendBuyError(BUY_ERR_CANT_FIND_ITEM, pCreature, 0, 0); + _player->SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, 0, 0); } void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket & recv_data) @@ -867,8 +867,8 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket) // cheating protection /* not critical if "cheated", and check skip allow by slots in bank windows open by .bank command. - Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER); - if (!pCreature) + Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER); + if (!creature) { sLog->outDebug("WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; diff --git a/src/server/game/Server/Protocol/Handlers/LootHandler.cpp b/src/server/game/Server/Protocol/Handlers/LootHandler.cpp index 7ace25832f2..83d3fad3b21 100755 --- a/src/server/game/Server/Protocol/Handlers/LootHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/LootHandler.cpp @@ -78,17 +78,17 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket & recv_data) } else { - Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid); + Creature* creature = GetPlayer()->GetMap()->GetCreature(lguid); - bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass() == CLASS_ROGUE && pCreature->lootForPickPocketed); + bool ok_loot = creature && creature->isAlive() == (player->getClass() == CLASS_ROGUE && creature->lootForPickPocketed); - if (!ok_loot || !pCreature->IsWithinDistInMap(_player, INTERACTION_DISTANCE)) + if (!ok_loot || !creature->IsWithinDistInMap(_player, INTERACTION_DISTANCE)) { player->SendLootRelease(lguid); return; } - loot = &pCreature->loot; + loot = &creature->loot; } player->StoreLootItem(lootSlot, loot); @@ -329,9 +329,9 @@ void WorldSession::DoLootRelease(uint64 lguid) // if the round robin player release, reset it. if (player->GetGUID() == loot->roundRobinPlayer) { - if (Group* pGroup = player->GetGroup()) + if (Group* group = player->GetGroup()) { - if (pGroup->GetLootMethod() != MASTER_LOOT) + if (group->GetLootMethod() != MASTER_LOOT) { loot->roundRobinPlayer = 0; } @@ -384,20 +384,20 @@ void WorldSession::DoLootRelease(uint64 lguid) } else { - Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lguid); + Creature* creature = GetPlayer()->GetMap()->GetCreature(lguid); - bool ok_loot = pCreature && pCreature->isAlive() == (player->getClass() == CLASS_ROGUE && pCreature->lootForPickPocketed); - if (!ok_loot || !pCreature->IsWithinDistInMap(_player, INTERACTION_DISTANCE)) + bool ok_loot = creature && creature->isAlive() == (player->getClass() == CLASS_ROGUE && creature->lootForPickPocketed); + if (!ok_loot || !creature->IsWithinDistInMap(_player, INTERACTION_DISTANCE)) return; - loot = &pCreature->loot; + loot = &creature->loot; if (loot->isLooted()) { // skip pickpocketing loot for speed, skinning timer reduction is no-op in fact - if (!pCreature->isAlive()) - pCreature->AllLootRemovedFromCorpse(); + if (!creature->isAlive()) + creature->AllLootRemovedFromCorpse(); - pCreature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + creature->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); loot->clear(); } else @@ -405,15 +405,15 @@ void WorldSession::DoLootRelease(uint64 lguid) // if the round robin player release, reset it. if (player->GetGUID() == loot->roundRobinPlayer) { - if (Group* pGroup = player->GetGroup()) + if (Group* group = player->GetGroup()) { - if (pGroup->GetLootMethod() != MASTER_LOOT) + if (group->GetLootMethod() != MASTER_LOOT) { loot->roundRobinPlayer = 0; - pGroup->SendLooter(pCreature, NULL); + group->SendLooter(creature, NULL); // force update of dynamic flags, otherwise other group's players still not able to loot. - pCreature->ForceValuesUpdateAtIndex(UNIT_DYNAMIC_FLAGS); + creature->ForceValuesUpdateAtIndex(UNIT_DYNAMIC_FLAGS); } } else @@ -452,11 +452,11 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data) if (IS_CRE_OR_VEH_GUID(GetPlayer()->GetLootGUID())) { - Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lootguid); - if (!pCreature) + Creature* creature = GetPlayer()->GetMap()->GetCreature(lootguid); + if (!creature) return; - pLoot = &pCreature->loot; + pLoot = &creature->loot; } else if (IS_GAMEOBJECT_GUID(GetPlayer()->GetLootGUID())) { diff --git a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp index c75c02a723d..1b0cef69c04 100755 --- a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp @@ -1464,13 +1464,13 @@ void WorldSession::HandleTimeSyncResp(WorldPacket & recv_data) void WorldSession::HandleResetInstancesOpcode(WorldPacket & /*recv_data*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_RESET_INSTANCES"); - Group* pGroup = _player->GetGroup(); - if (pGroup) + Group* group = _player->GetGroup(); + if (group) { - if (pGroup->IsLeader(_player->GetGUID())) + if (group->IsLeader(_player->GetGUID())) { - pGroup->ResetInstances(INSTANCE_RESET_ALL, false, _player); - pGroup->ResetInstances(INSTANCE_RESET_ALL, true, _player); + group->ResetInstances(INSTANCE_RESET_ALL, false, _player); + group->ResetInstances(INSTANCE_RESET_ALL, true, _player); } } else @@ -1504,12 +1504,12 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data) return; } - Group* pGroup = _player->GetGroup(); - if (pGroup) + Group* group = _player->GetGroup(); + if (group) { - if (pGroup->IsLeader(_player->GetGUID())) + if (group->IsLeader(_player->GetGUID())) { - for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* pGroupGuy = itr->getSource(); if (!pGroupGuy) @@ -1527,8 +1527,8 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data) } // the difficulty is set even if the instances can't be reset //_player->SendDungeonDifficulty(true); - pGroup->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false, _player); - pGroup->SetDungeonDifficulty(Difficulty(mode)); + group->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, false, _player); + group->SetDungeonDifficulty(Difficulty(mode)); } } else @@ -1562,12 +1562,12 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) if (Difficulty(mode) == _player->GetRaidDifficulty()) return; - Group* pGroup = _player->GetGroup(); - if (pGroup) + Group* group = _player->GetGroup(); + if (group) { - if (pGroup->IsLeader(_player->GetGUID())) + if (group->IsLeader(_player->GetGUID())) { - for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* pGroupGuy = itr->getSource(); if (!pGroupGuy) @@ -1585,8 +1585,8 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) } // the difficulty is set even if the instances can't be reset //_player->SendDungeonDifficulty(true); - pGroup->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true, _player); - pGroup->SetRaidDifficulty(Difficulty(mode)); + group->ResetInstances(INSTANCE_RESET_CHANGE_DIFFICULTY, true, _player); + group->SetRaidDifficulty(Difficulty(mode)); } } else diff --git a/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp b/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp index e021b51c55e..a931d8a5b3d 100755 --- a/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp @@ -90,8 +90,8 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) sLog->outDebug(LOG_FILTER_NETWORKIO, "Petitioner with GUID %u tried sell petition: name %s", GUID_LOPART(guidNPC), name.c_str()); // prevent cheating - Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guidNPC, UNIT_NPC_FLAG_PETITIONER); - if (!pCreature) + Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guidNPC, UNIT_NPC_FLAG_PETITIONER); + if (!creature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandlePetitionBuyOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guidNPC)); return; @@ -104,7 +104,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) uint32 charterid = 0; uint32 cost = 0; uint32 type = 0; - if (pCreature->isTabardDesigner()) + if (creature->isTabardDesigner()) { // if tabard designer, then trying to buy a guild charter. // do not let if already in guild. @@ -189,7 +189,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) if (!_player->HasEnoughMoney(cost)) { //player hasn't got enough money - _player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, pCreature, charterid, 0); + _player->SendBuyError(BUY_ERR_NOT_ENOUGHT_MONEY, creature, charterid, 0); return; } @@ -881,8 +881,8 @@ void WorldSession::HandlePetitionShowListOpcode(WorldPacket & recv_data) void WorldSession::SendPetitionShowList(uint64 guid) { - Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_PETITIONER); - if (!pCreature) + Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_PETITIONER); + if (!creature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandlePetitionShowListOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); return; @@ -891,7 +891,7 @@ void WorldSession::SendPetitionShowList(uint64 guid) WorldPacket data(SMSG_PETITION_SHOWLIST, 8+1+4*6); data << guid; // npc guid - if (pCreature->isTabardDesigner()) + if (creature->isTabardDesigner()) { data << uint8(1); // count data << uint32(1); // index diff --git a/src/server/game/Server/Protocol/Handlers/QuestHandler.cpp b/src/server/game/Server/Protocol/Handlers/QuestHandler.cpp index 64711a41f97..fbd6c23d20f 100755 --- a/src/server/game/Server/Protocol/Handlers/QuestHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/QuestHandler.cpp @@ -86,8 +86,8 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recv_data) sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u", GUID_LOPART(guid)); - Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE); - if (!pCreature) + Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE); + if (!creature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guid)); @@ -98,15 +98,15 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recv_data) if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); // Stop the npc if moving - pCreature->StopMoving(); + creature->StopMoving(); - if (sScriptMgr->OnGossipHello(_player, pCreature)) + if (sScriptMgr->OnGossipHello(_player, creature)) return; - _player->PrepareGossipMenu(pCreature, pCreature->GetCreatureInfo()->GossipMenuId, true); - _player->SendPreparedGossip(pCreature); + _player->PrepareGossipMenu(creature, creature->GetCreatureInfo()->GossipMenuId, true); + _player->SendPreparedGossip(creature); - pCreature->AI()->sGossipHello(_player); + creature->AI()->sGossipHello(_player); } void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data) @@ -146,10 +146,10 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data) if (_player->GetDivider() != 0) { - Player* pPlayer = ObjectAccessor::FindPlayer(_player->GetDivider()); - if (pPlayer) + Player* player = ObjectAccessor::FindPlayer(_player->GetDivider()); + if (player) { - pPlayer->SendPushToPartyResponse(_player, QUEST_PARTY_MSG_ACCEPT_QUEST); + player->SendPushToPartyResponse(_player, QUEST_PARTY_MSG_ACCEPT_QUEST); _player->SetDivider(0); } } @@ -160,23 +160,23 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data) if (qInfo->HasFlag(QUEST_FLAGS_PARTY_ACCEPT)) { - if (Group* pGroup = _player->GetGroup()) + if (Group* group = _player->GetGroup()) { - for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { - Player* pPlayer = itr->getSource(); + Player* player = itr->getSource(); - if (!pPlayer || pPlayer == _player) // not self + if (!player || player == _player) // not self continue; - if (pPlayer->CanTakeQuest(qInfo, true)) + if (player->CanTakeQuest(qInfo, true)) { - pPlayer->SetDivider(_player->GetGUID()); + player->SetDivider(_player->GetGUID()); //need confirmation that any gossip window will close - pPlayer->PlayerTalkClass->SendCloseGossip(); + player->PlayerTalkClass->SendCloseGossip(); - _player->SendQuestConfirmAccept(qInfo, pPlayer); + _player->SendQuestConfirmAccept(qInfo, player); } } } @@ -546,49 +546,49 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) if (Quest const* pQuest = sObjectMgr->GetQuestTemplate(questId)) { - if (Group* pGroup = _player->GetGroup()) + if (Group* group = _player->GetGroup()) { - for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { - Player* pPlayer = itr->getSource(); + Player* player = itr->getSource(); - if (!pPlayer || pPlayer == _player) // skip self + if (!player || player == _player) // skip self continue; - _player->SendPushToPartyResponse(pPlayer, QUEST_PARTY_MSG_SHARING_QUEST); + _player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_SHARING_QUEST); - if (!pPlayer->SatisfyQuestStatus(pQuest, false)) + if (!player->SatisfyQuestStatus(pQuest, false)) { - _player->SendPushToPartyResponse(pPlayer, QUEST_PARTY_MSG_HAVE_QUEST); + _player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_HAVE_QUEST); continue; } - if (pPlayer->GetQuestStatus(questId) == QUEST_STATUS_COMPLETE) + if (player->GetQuestStatus(questId) == QUEST_STATUS_COMPLETE) { - _player->SendPushToPartyResponse(pPlayer, QUEST_PARTY_MSG_FINISH_QUEST); + _player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_FINISH_QUEST); continue; } - if (!pPlayer->CanTakeQuest(pQuest, false)) + if (!player->CanTakeQuest(pQuest, false)) { - _player->SendPushToPartyResponse(pPlayer, QUEST_PARTY_MSG_CANT_TAKE_QUEST); + _player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_CANT_TAKE_QUEST); continue; } - if (!pPlayer->SatisfyQuestLog(false)) + if (!player->SatisfyQuestLog(false)) { - _player->SendPushToPartyResponse(pPlayer, QUEST_PARTY_MSG_LOG_FULL); + _player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_LOG_FULL); continue; } - if (pPlayer->GetDivider() != 0) + if (player->GetDivider() != 0) { - _player->SendPushToPartyResponse(pPlayer, QUEST_PARTY_MSG_BUSY); + _player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_BUSY); continue; } - pPlayer->PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, _player->GetGUID(), true); - pPlayer->SetDivider(_player->GetGUID()); + player->PlayerTalkClass->SendQuestGiverQuestDetails(pQuest, _player->GetGUID(), true); + player->SetDivider(_player->GetGUID()); } } } @@ -604,19 +604,19 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket) if (_player->GetDivider() != 0) { - Player* pPlayer = ObjectAccessor::FindPlayer(_player->GetDivider()); - if (pPlayer) + Player* player = ObjectAccessor::FindPlayer(_player->GetDivider()); + if (player) { WorldPacket data(MSG_QUEST_PUSH_RESULT, (8+1)); data << uint64(guid); data << uint8(msg); // valid values: 0-8 - pPlayer->GetSession()->SendPacket(&data); + player->GetSession()->SendPacket(&data); _player->SetDivider(0); } } } -uint32 WorldSession::getDialogStatus(Player* pPlayer, Object* questgiver, uint32 defstatus) +uint32 WorldSession::getDialogStatus(Player* player, Object* questgiver, uint32 defstatus) { uint32 result = defstatus; @@ -651,12 +651,12 @@ uint32 WorldSession::getDialogStatus(Player* pPlayer, Object* questgiver, uint32 if (!pQuest) continue; ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, pQuest->GetQuestId()); - if (!sConditionMgr->IsPlayerMeetToConditions(pPlayer, conditions)) + if (!sConditionMgr->IsPlayerMeetToConditions(player, conditions)) continue; - QuestStatus status = pPlayer->GetQuestStatus(quest_id); - if ((status == QUEST_STATUS_COMPLETE && !pPlayer->GetQuestRewardStatus(quest_id)) || - (pQuest->IsAutoComplete() && pPlayer->CanTakeQuest(pQuest, false))) + QuestStatus status = player->GetQuestStatus(quest_id); + if ((status == QUEST_STATUS_COMPLETE && !player->GetQuestRewardStatus(quest_id)) || + (pQuest->IsAutoComplete() && player->CanTakeQuest(pQuest, false))) { if (pQuest->IsAutoComplete() && pQuest->IsRepeatable()) result2 = DIALOG_STATUS_REWARD_REP; @@ -679,19 +679,19 @@ uint32 WorldSession::getDialogStatus(Player* pPlayer, Object* questgiver, uint32 continue; ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, pQuest->GetQuestId()); - if (!sConditionMgr->IsPlayerMeetToConditions(pPlayer, conditions)) + if (!sConditionMgr->IsPlayerMeetToConditions(player, conditions)) continue; - QuestStatus status = pPlayer->GetQuestStatus(quest_id); + QuestStatus status = player->GetQuestStatus(quest_id); if (status == QUEST_STATUS_NONE) { - if (pPlayer->CanSeeStartQuest(pQuest)) + if (player->CanSeeStartQuest(pQuest)) { - if (pPlayer->SatisfyQuestLevel(pQuest, false)) + if (player->SatisfyQuestLevel(pQuest, false)) { - if (pQuest->IsAutoComplete() || (pQuest->IsRepeatable() && pPlayer->IsQuestRewarded(quest_id))) + if (pQuest->IsAutoComplete() || (pQuest->IsRepeatable() && player->IsQuestRewarded(quest_id))) result2 = DIALOG_STATUS_REWARD_REP; - else if (pPlayer->getLevel() <= ((pPlayer->GetQuestLevel(pQuest) == -1) ? pPlayer->getLevel() : pPlayer->GetQuestLevel(pQuest) + sWorld->getIntConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF))) + else if (player->getLevel() <= ((player->GetQuestLevel(pQuest) == -1) ? player->getLevel() : player->GetQuestLevel(pQuest) + sWorld->getIntConfig(CONFIG_QUEST_LOW_LEVEL_HIDE_DIFF))) { if (pQuest->HasFlag(QUEST_FLAGS_DAILY) || pQuest->HasFlag(QUEST_FLAGS_WEEKLY)) result2 = DIALOG_STATUS_AVAILABLE_REP; diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index d6004e809df..7c4cd1fec85 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -441,8 +441,8 @@ void WorldSession::LogoutPlayer(bool Save) HandleMoveWorldportAckOpcode(); ///- If the player is in a guild, update the guild roster and broadcast a logout message to other guild members - if (Guild* pGuild = sGuildMgr->GetGuildById(_player->GetGuildId())) - pGuild->HandleMemberLogout(this); + if (Guild* guild = sGuildMgr->GetGuildById(_player->GetGuildId())) + guild->HandleMemberLogout(this); ///- Remove pet _player->RemovePet(NULL, PET_SAVE_AS_CURRENT, true); diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index d7125bfe0f4..cac707773da 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -367,7 +367,7 @@ class WorldSession uint32 GetLatency() const { return m_latency; } void SetLatency(uint32 latency) { m_latency = latency; } - uint32 getDialogStatus(Player* pPlayer, Object* questgiver, uint32 defstatus); + uint32 getDialogStatus(Player* player, Object* questgiver, uint32 defstatus); time_t m_timeOutTime; void UpdateTimeOutTime(uint32 diff) diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index e2690c02b1d..df6ac44f2cc 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1347,8 +1347,9 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b if (removeMode == AURA_REMOVE_BY_ENEMY_SPELL && GetSpellInfo()->SpellFamilyFlags[1] & 0x1) { // Shattered Barrier - if (caster->GetDummyAuraEffect(SPELLFAMILY_MAGE, 2945, 0)) - caster->CastSpell(target, 55080, true, NULL, GetEffect(0)); + if (AuraEffect * dummy = caster->GetDummyAuraEffect(SPELLFAMILY_MAGE, 2945, 0)) + if (roll_chance_i(dummy->GetSpellInfo()->ProcChance)) + caster->CastSpell(target, 55080, true, NULL, GetEffect(0)); } break; case SPELLFAMILY_WARRIOR: diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 2e9f2aabd73..dffdfad17e5 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2665,10 +2665,10 @@ uint32 Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) Player* targetPlayer = m_targets.GetUnitTarget() && m_targets.GetUnitTarget()->GetTypeId() == TYPEID_PLAYER ? (Player*)m_targets.GetUnitTarget() : NULL; - Group* pGroup = targetPlayer ? targetPlayer->GetGroup() : NULL; - if (pGroup) + Group* group = targetPlayer ? targetPlayer->GetGroup() : NULL; + if (group) { - for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index b242e0dcfd2..ee4b771f6fe 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -309,7 +309,7 @@ void Spell::EffectEnvironmentalDMG(SpellEffIndex /*effIndex*/) void Spell::EffectSchoolDMG(SpellEffIndex effIndex) { - if (effectHandleMode == SPELL_EFFECT_HANDLE_LAUNCH_TARGET) + if (effectHandleMode != SPELL_EFFECT_HANDLE_LAUNCH_TARGET) return; bool apply_direct_bonus = true; @@ -3328,9 +3328,9 @@ void Spell::EffectDispel(SpellEffIndex effIndex) int32 heal_amount = m_spellInfo->Effects[EFFECT_1].CalcValue(); m_caster->CastCustomSpell(m_caster, 19658, &heal_amount, NULL, NULL, true); // Glyph of Felhunter - if (Unit* pOwner = m_caster->GetOwner()) - if (pOwner->GetAura(56249)) - pOwner->CastCustomSpell(pOwner, 19658, &heal_amount, NULL, NULL, true); + if (Unit* owner = m_caster->GetOwner()) + if (owner->GetAura(56249)) + owner->CastCustomSpell(owner, 19658, &heal_amount, NULL, NULL, true); } } @@ -6287,7 +6287,7 @@ void Spell::EffectQuestClear(SpellEffIndex effIndex) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - Player* pPlayer = unitTarget->ToPlayer(); + Player* player = unitTarget->ToPlayer(); uint32 quest_id = m_spellInfo->Effects[effIndex].MiscValue; @@ -6297,24 +6297,24 @@ void Spell::EffectQuestClear(SpellEffIndex effIndex) return; // Player has never done this quest - if (pPlayer->GetQuestStatus(quest_id) == QUEST_STATUS_NONE) + if (player->GetQuestStatus(quest_id) == QUEST_STATUS_NONE) return; // remove all quest entries for 'entry' from quest log for (uint8 slot = 0; slot < MAX_QUEST_LOG_SIZE; ++slot) { - uint32 quest = pPlayer->GetQuestSlotQuestId(slot); + uint32 quest = player->GetQuestSlotQuestId(slot); if (quest == quest_id) { - pPlayer->SetQuestSlot(slot, 0); + player->SetQuestSlot(slot, 0); // we ignore unequippable quest items in this case, its' still be equipped - pPlayer->TakeQuestSourceItem(quest, false); + player->TakeQuestSourceItem(quest, false); } } - pPlayer->RemoveActiveQuest(quest_id); - pPlayer->RemoveRewardedQuest(quest_id); + player->RemoveActiveQuest(quest_id); + player->RemoveRewardedQuest(quest_id); } void Spell::EffectSendTaxi(SpellEffIndex effIndex) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index c80a3123739..cfa28080b2b 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -2803,6 +2803,10 @@ void SpellMgr::LoadSpellCustomAttr() case 43140: // Flame Breath case 43215: // Flame Breath case 70461: // Coldflame Trap + case 72133: // Pain and Suffering + case 73788: // Pain and Suffering + case 73789: // Pain and Suffering + case 73790: // Pain and Suffering spellInfo->AttributesCu |= SPELL_ATTR0_CU_CONE_LINE; break; case 24340: // Meteor @@ -2986,7 +2990,6 @@ void SpellMgr::LoadDbcDataCorrections() case 25425: // Shoot case 45761: // Shoot case 42611: // Shoot - case 62374: // Pursued case 61588: // Blazing Harpoon case 52479: // Gift of the Harvester spellInfo->MaxAffectedTargets = 1; @@ -3173,6 +3176,9 @@ void SpellMgr::LoadDbcDataCorrections() break; // ULDUAR SPELLS // + case 62374: // Pursued (Flame Leviathan) + spellInfo->EffectRadiusIndex[0] = 28; // 50000yd + break; case 63342: // Focused Eyebeam Summon Trigger (Kologarn) spellInfo->MaxAffectedTargets = 1; break; @@ -3327,6 +3333,95 @@ void SpellMgr::LoadDbcDataCorrections() spellInfo->EffectImplicitTargetB[0] = TARGET_UNIT_TARGET_ANY; spellInfo->Effect[1] = 0; break; + case 71614: // Ice Lock + spellInfo->Mechanic = MECHANIC_STUN; + break; + case 72762: // Defile + spellInfo->DurationIndex = 559; // 53 seconds + break; + case 72743: // Defile + spellInfo->DurationIndex = 22; // 45 seconds + break; + case 72754: // Defile + case 73708: // Defile + case 73709: // Defile + case 73710: // Defile + spellInfo->EffectRadiusIndex[0] = 22; // 200yd + spellInfo->EffectRadiusIndex[1] = 22; // 200yd + break; + case 69030: // Val'kyr Target Search + spellInfo->EffectRadiusIndex[0] = 22; // 200yd + spellInfo->EffectRadiusIndex[1] = 22; // 200yd + break; + case 69198: // Raging Spirit Visual + spellInfo->rangeIndex = 13; // 50000yd + break; + case 73654: // Harvest Souls + case 74295: // Harvest Souls + case 74296: // Harvest Souls + case 74297: // Harvest Souls + spellInfo->EffectRadiusIndex[0] = 28; // 50000yd + spellInfo->EffectRadiusIndex[1] = 28; // 50000yd + spellInfo->EffectRadiusIndex[2] = 28; // 50000yd + break; + case 73655: // Harvest Soul + spellInfo->AttributesEx3 |= SPELL_ATTR3_NO_DONE_BONUS; + break; + case 73540: // Summon Shadow Trap + spellInfo->DurationIndex = 23; // 90 seconds + break; + case 73530: // Shadow Trap (visual) + spellInfo->DurationIndex = 28; // 5 seconds + break; + case 73529: // Shadow Trap + spellInfo->EffectRadiusIndex[1] = 13; // 10yd + break; + case 74282: // Shadow Trap (searcher) + spellInfo->EffectRadiusIndex[0] = 15; // 3yd + break; + case 72595: // Restore Soul + case 73650: // Restore Soul + spellInfo->EffectRadiusIndex[0] = 22; // 200yd + break; + case 74086: // Destroy Soul + spellInfo->EffectRadiusIndex[0] = 22; // 200yd + break; + case 74302: // Summon Spirit Bomb + case 74342: // Summon Spirit Bomb + spellInfo->EffectRadiusIndex[0] = 22; // 200yd + spellInfo->MaxAffectedTargets = 1; + break; + case 74341: // Summon Spirit Bomb + case 74343: // Summon Spirit Bomb + spellInfo->EffectRadiusIndex[0] = 22; // 200yd + spellInfo->MaxAffectedTargets = 3; + break; + case 73579: // Summon Spirit Bomb + spellInfo->EffectRadiusIndex[0] = 20; // 25yd + break; + case 72350: // Fury of Frostmourne + spellInfo->EffectRadiusIndex[0] = 28; // 50000yd + spellInfo->EffectRadiusIndex[1] = 28; // 50000yd + break; + case 75127: // Kill Frostmourne Players + case 72351: // Fury of Frostmourne + case 72431: // Jump (removes Fury of Frostmourne debuff) + case 72429: // Mass Resurrection + case 73159: // Play Movie + case 73582: // Trigger Vile Spirit (Inside, Heroic) + spellInfo->EffectRadiusIndex[0] = 28; // 50000yd + break; + case 72376: // Raise Dead + spellInfo->MaxAffectedTargets = 3; + spellInfo->EffectRadiusIndex[0] = 28; // 50000yd + break; + case 71809: // Jump + spellInfo->rangeIndex = 3; // 20yd + spellInfo->EffectRadiusIndex[0] = 20; // 25yd + break; + case 72405: // Broken Frostmourne + spellInfo->EffectRadiusIndex[1] = 22; // 200yd + break; default: break; } diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp index d74c075b05a..0a8a4a88191 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/boss_chromaggus.cpp @@ -244,22 +244,22 @@ public: std::list<HostileReference*> threatlist = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i) { - Unit* pUnit; + Unit* unit; if ((*i) && (*i)->getSource()) { - pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit) + unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (unit) { //Cast affliction - DoCast(pUnit, RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK, + DoCast(unit, RAND(SPELL_BROODAF_BLUE, SPELL_BROODAF_BLACK, SPELL_BROODAF_RED, SPELL_BROODAF_BRONZE, SPELL_BROODAF_GREEN), true); //Chromatic mutation if target is effected by all afflictions - if (pUnit->HasAura(SPELL_BROODAF_BLUE) - && pUnit->HasAura(SPELL_BROODAF_BLACK) - && pUnit->HasAura(SPELL_BROODAF_RED) - && pUnit->HasAura(SPELL_BROODAF_BRONZE) - && pUnit->HasAura(SPELL_BROODAF_GREEN)) + if (unit->HasAura(SPELL_BROODAF_BLUE) + && unit->HasAura(SPELL_BROODAF_BLACK) + && unit->HasAura(SPELL_BROODAF_RED) + && unit->HasAura(SPELL_BROODAF_BRONZE) + && unit->HasAura(SPELL_BROODAF_GREEN)) { //pTarget->RemoveAllAuras(); //DoCast(target, SPELL_CHROMATIC_MUT_1); @@ -269,8 +269,8 @@ public: //So instead we instant kill our target //WORKAROUND - if (pUnit->GetTypeId() == TYPEID_PLAYER) - pUnit->CastSpell(pUnit, 5, false); + if (unit->GetTypeId() == TYPEID_PLAYER) + unit->CastSpell(unit, 5, false); } } } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index 596dfa9c25f..e804d2b2b61 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -141,8 +141,8 @@ public: { if (Phase == 2) { - if (Unit* pUnit = Unit::GetUnit(*me, Attumen)) - DoScriptText(SAY_MIDNIGHT_KILL, pUnit); + if (Unit* unit = Unit::GetUnit(*me, Attumen)) + DoScriptText(SAY_MIDNIGHT_KILL, unit); } } diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index 04981669681..98e40acc4e1 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -359,9 +359,9 @@ struct boss_moroes_guestAI : public ScriptedAI uint64 TempGUID = GuestGUID[rand()%4]; if (TempGUID) { - Unit* pUnit = Unit::GetUnit((*me), TempGUID); - if (pUnit && pUnit->isAlive()) - return pUnit; + Unit* unit = Unit::GetUnit((*me), TempGUID); + if (unit && unit->isAlive()) + return unit; } return me; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp index 51085504f99..e13ef8f62e1 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -424,10 +424,10 @@ public: for (uint32 i = 0; i < 4; ++i) { - if (Creature* pUnit = me->SummonCreature(CREATURE_WATER_ELEMENTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 90000)) + if (Creature* unit = me->SummonCreature(CREATURE_WATER_ELEMENTAL, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN, 90000)) { - pUnit->Attack(me->getVictim(), true); - pUnit->setFaction(me->getFaction()); + unit->Attack(me->getVictim(), true); + unit->setFaction(me->getFaction()); } } @@ -438,10 +438,10 @@ public: { for (uint32 i = 0; i < 5; ++i) { - if (Creature* pUnit = me->SummonCreature(CREATURE_SHADOW_OF_ARAN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) + if (Creature* unit = me->SummonCreature(CREATURE_SHADOW_OF_ARAN, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) { - pUnit->Attack(me->getVictim(), true); - pUnit->setFaction(me->getFaction()); + unit->Attack(me->getVictim(), true); + unit->setFaction(me->getFaction()); } } @@ -464,11 +464,11 @@ public: if (!FlameWreathTarget[i]) continue; - Unit* pUnit = Unit::GetUnit(*me, FlameWreathTarget[i]); - if (pUnit && !pUnit->IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3)) + Unit* unit = Unit::GetUnit(*me, FlameWreathTarget[i]); + if (unit && !unit->IsWithinDist2d(FWTargPosX[i], FWTargPosY[i], 3)) { - pUnit->CastSpell(pUnit, 20476, true, 0, 0, me->GetGUID()); - pUnit->CastSpell(pUnit, 11027, true); + unit->CastSpell(unit, 20476, true, 0, 0, me->GetGUID()); + unit->CastSpell(unit, 11027, true); FlameWreathTarget[i] = 0; } } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp index b3f06bdf2c7..6802d1817a3 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_felblood_kaelthas.cpp @@ -193,11 +193,11 @@ public: std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i) { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && pUnit->isAlive()) + Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (unit && unit->isAlive()) { - float threat = me->getThreatManager().getThreat(pUnit); - SummonedUnit->AddThreat(pUnit, threat); + float threat = me->getThreatManager().getThreat(unit); + SummonedUnit->AddThreat(unit, threat); } } } @@ -211,9 +211,9 @@ public: std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) - pUnit->CastSpell(pUnit, SPELL_TELEPORT_CENTER, true); + Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) + unit->CastSpell(unit, SPELL_TELEPORT_CENTER, true); } DoCast(me, SPELL_TELEPORT_CENTER, true); } @@ -223,10 +223,10 @@ public: std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) + Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) // Knockback into the air - pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, me->GetGUID()); + unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_DOT, true, 0, 0, me->GetGUID()); } } @@ -235,17 +235,17 @@ public: std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) + Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) { // Also needs an exception in spell system. - pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, me->GetGUID()); + unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_FLY, true, 0, 0, me->GetGUID()); // Use packet hack WorldPacket data(12); data.SetOpcode(SMSG_MOVE_SET_CAN_FLY); - data.append(pUnit->GetPackGUID()); + data.append(unit->GetPackGUID()); data << uint32(0); - pUnit->SendMessageToSet(&data, true); + unit->SendMessageToSet(&data, true); } } } @@ -255,17 +255,17 @@ public: std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) + Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) { - pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); - pUnit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT); + unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_FLY); + unit->RemoveAurasDueToSpell(SPELL_GRAVITY_LAPSE_DOT); WorldPacket data(12); data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY); - data.append(pUnit->GetPackGUID()); + data.append(unit->GetPackGUID()); data << uint32(0); - pUnit->SendMessageToSet(&data, true); + unit->SendMessageToSet(&data, true); } } } diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp index f54883daf56..ae7d7aba9f1 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_priestess_delrissa.cpp @@ -527,12 +527,12 @@ public: { DoCast(me, SPELL_VANISH); - Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0); + Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0); DoResetThreat(); - if (pUnit) - me->AddThreat(pUnit, 1000.0f); + if (unit) + me->AddThreat(unit, 1000.0f); InVanish = true; Vanish_Timer = 30000; @@ -644,24 +644,24 @@ public: if (Seed_of_Corruption_Timer <= diff) { - if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_SEED_OF_CORRUPTION); + if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0)) + DoCast(unit, SPELL_SEED_OF_CORRUPTION); Seed_of_Corruption_Timer = 10000; } else Seed_of_Corruption_Timer -= diff; if (Curse_of_Agony_Timer <= diff) { - if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_CURSE_OF_AGONY); + if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0)) + DoCast(unit, SPELL_CURSE_OF_AGONY); Curse_of_Agony_Timer = 13000; } else Curse_of_Agony_Timer -= diff; if (Fear_Timer <= diff) { - if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_FEAR); + if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0)) + DoCast(unit, SPELL_FEAR); Fear_Timer = 10000; } else Fear_Timer -= diff; @@ -806,8 +806,8 @@ public: if (Blizzard_Timer <= diff) { - if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_BLIZZARD); + if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0)) + DoCast(unit, SPELL_BLIZZARD); Blizzard_Timer = 8000; } else Blizzard_Timer -= diff; @@ -937,8 +937,8 @@ public: //if nobody is in melee range than try to use Intercept if (!InMeleeRange) { - if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_INTERCEPT_STUN); + if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0)) + DoCast(unit, SPELL_INTERCEPT_STUN); } Intercept_Stun_Timer = 10000; @@ -1168,8 +1168,8 @@ public: if (Purge_Timer <= diff) { - if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_PURGE); + if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0)) + DoCast(unit, SPELL_PURGE); Purge_Timer = 15000; } else Purge_Timer -= diff; diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp index 8b68330717f..35269bb296d 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/boss_selin_fireheart.cpp @@ -103,15 +103,15 @@ public: //for (uint8 i = 0; i < CRYSTALS_NUMBER; ++i) for (std::list<uint64>::const_iterator itr = Crystals.begin(); itr != Crystals.end(); ++itr) { - //Unit* pUnit = Unit::GetUnit(*me, FelCrystals[i]); - Unit* pUnit = Unit::GetUnit(*me, *itr); - if (pUnit) + //Unit* unit = Unit::GetUnit(*me, FelCrystals[i]); + Unit* unit = Unit::GetUnit(*me, *itr); + if (unit) { - if (!pUnit->isAlive()) - CAST_CRE(pUnit)->Respawn(); // Let the core handle setting death state, etc. + if (!unit->isAlive()) + CAST_CRE(unit)->Respawn(); // Let the core handle setting death state, etc. // Only need to set unselectable flag. You can't attack unselectable units so non_attackable flag is not necessary here. - pUnit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + unit->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } } diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index e255cc52871..9a3913cb7dd 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -478,8 +478,8 @@ public: { me->setFaction(FACTION_HOSTILE); - if (Unit* pUnit = Unit::GetUnit(*me, m_uiDuelerGUID)) - AttackStart(pUnit); + if (Unit* unit = Unit::GetUnit(*me, m_uiDuelerGUID)) + AttackStart(unit); } else m_uiDuelTimer -= uiDiff; diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index f321e75caac..9296bd09bbc 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -569,9 +569,9 @@ public: std::list<HostileReference*>::const_iterator itr; for (itr = caster->getThreatManager().getThreatList().begin(); itr != caster->getThreatManager().getThreatList().end(); ++itr) { - Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); - if (pUnit && pUnit->isAlive() && pUnit != caster) - me->AddThreat(pUnit, caster->getThreatManager().getThreat(pUnit)); + Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + if (unit && unit->isAlive() && unit != caster) + me->AddThreat(unit, caster->getThreatManager().getThreat(unit)); } } } diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp index 71b5a42a6b2..2f8d333735f 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp @@ -53,9 +53,9 @@ public: if (pInstance->GetData(TYPE_BARON_RUN) != NOT_STARTED) return false; - if (Group* pGroup = player->GetGroup()) + if (Group* group = player->GetGroup()) { - for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* pGroupie = itr->getSource(); if (!pGroupie) diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index 8f15878f888..df20eab39de 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -760,11 +760,11 @@ public: { for (std::list<HostileReference*>::const_iterator itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr) { - if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) { - if (pUnit->GetPositionZ() > me->GetPositionZ()+5) + if (unit->GetPositionZ() > me->GetPositionZ()+5) { - me->getThreatManager().modifyThreatPercent(pUnit, -100); + me->getThreatManager().modifyThreatPercent(unit, -100); } } } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index 47704b42d5a..e81d4975378 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -994,9 +994,9 @@ public: std::list<HostileReference*>::iterator itr; for (itr = me->getThreatManager().getThreatList().begin(); itr != me->getThreatManager().getThreatList().end(); ++itr) { - Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); - if (pUnit) - pPortal->AddThreat(pUnit, 1.0f); + Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()); + if (unit) + pPortal->AddThreat(unit, 1.0f); } } FelfirePortalTimer = 20000; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index 7f7a85b881f..6135c076920 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -160,23 +160,23 @@ class boss_mandokir : public CreatureScript { if (WatchTarget) //If someone is watched and If the Position of the watched target is different from the one stored, or are attacking, mandokir will charge him { - Unit* pUnit = Unit::GetUnit(*me, WatchTarget); + Unit* unit = Unit::GetUnit(*me, WatchTarget); - if (pUnit && ( - targetX != pUnit->GetPositionX() || - targetY != pUnit->GetPositionY() || - targetZ != pUnit->GetPositionZ() || - pUnit->isInCombat())) + if (unit && ( + targetX != unit->GetPositionX() || + targetY != unit->GetPositionY() || + targetZ != unit->GetPositionZ() || + unit->isInCombat())) { - if (me->IsWithinMeleeRange(pUnit)) + if (me->IsWithinMeleeRange(unit)) { - DoCast(pUnit, 24316); + DoCast(unit, 24316); } else { - DoCast(pUnit, SPELL_CHARGE); - //me->SendMonsterMove(pUnit->GetPositionX(), pUnit->GetPositionY(), pUnit->GetPositionZ(), 0, true, 1); - AttackStart(pUnit); + DoCast(unit, SPELL_CHARGE); + //me->SendMonsterMove(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), 0, true, 1); + AttackStart(unit); } } } @@ -198,12 +198,12 @@ class boss_mandokir : public CreatureScript if ((Watch_Timer < 1000) && endWatch) //1 sec before the debuf expire, store the target position { - Unit* pUnit = Unit::GetUnit(*me, WatchTarget); - if (pUnit) + Unit* unit = Unit::GetUnit(*me, WatchTarget); + if (unit) { - targetX = pUnit->GetPositionX(); - targetY = pUnit->GetPositionY(); - targetZ = pUnit->GetPositionZ(); + targetX = unit->GetPositionX(); + targetY = unit->GetPositionY(); + targetZ = unit->GetPositionZ(); } endWatch = false; } @@ -232,8 +232,8 @@ class boss_mandokir : public CreatureScript std::list<HostileReference*>::const_iterator i = me->getThreatManager().getThreatList().begin(); for (; i != me->getThreatManager().getThreatList().end(); ++i) { - Unit* pUnit = Unit::GetUnit(*me, (*i)->getUnitGuid()); - if (pUnit && me->IsWithinMeleeRange(pUnit)) + Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid()); + if (unit && me->IsWithinMeleeRange(unit)) ++TargetInRange; } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp index a7e5f51da98..da316cb91c7 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_archimonde.cpp @@ -358,9 +358,9 @@ public: std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); for (; itr != m_threatlist.end(); ++itr) { - Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); - if (pUnit && pUnit->isAlive()) - targets.push_back(pUnit); + Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + if (unit && unit->isAlive()) + targets.push_back(unit); } if (targets.empty()) diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp index 0754e4a1554..385e86e5069 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjalAI.cpp @@ -714,9 +714,9 @@ void hyjalAI::DeSpawnVeins() return; if (Faction == 1) { - Creature* pUnit=Unit::GetCreature((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); - if (!pUnit)return; - hyjalAI* ai = CAST_AI(hyjalAI, pUnit->AI()); + Creature* unit=Unit::GetCreature((*me), pInstance->GetData64(DATA_JAINAPROUDMOORE)); + if (!unit)return; + hyjalAI* ai = CAST_AI(hyjalAI, unit->AI()); if (!ai)return; for (uint8 i = 0; i<7; ++i) { @@ -725,9 +725,9 @@ void hyjalAI::DeSpawnVeins() } } else if (Faction) { - Creature* pUnit=Unit::GetCreature((*me), pInstance->GetData64(DATA_THRALL)); - if (!pUnit)return; - hyjalAI* ai = CAST_AI(hyjalAI, pUnit->AI()); + Creature* unit=Unit::GetCreature((*me), pInstance->GetData64(DATA_THRALL)); + if (!unit)return; + hyjalAI* ai = CAST_AI(hyjalAI, unit->AI()); if (!ai)return; for (uint8 i = 7; i<14; ++i) { @@ -853,8 +853,8 @@ void hyjalAI::UpdateAI(const uint32 diff) { if (BossGUID[i]) { - Unit* pUnit = Unit::GetUnit((*me), BossGUID[i]); - if (pUnit && (!pUnit->isAlive())) + Unit* unit = Unit::GetUnit((*me), BossGUID[i]); + if (unit && (!unit->isAlive())) { if (BossGUID[i] == BossGUID[0]) { @@ -1080,37 +1080,37 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) for (uint8 i = 0; i < 25; ++i)//summon 25 ghouls { uint8 r = rand()%4; - Creature* pUnit = me->SummonCreature(GHOUL, AllianceBase[r][0]+irand(-15, 15), AllianceBase[r][1]+irand(-15, 15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); - if (pUnit) + Creature* unit = me->SummonCreature(GHOUL, AllianceBase[r][0]+irand(-15, 15), AllianceBase[r][1]+irand(-15, 15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); + if (unit) { - CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction; - CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true; - CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i; - pUnit->setActive(true); + CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction; + CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true; + CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i; + unit->setActive(true); } } for (uint8 i = 0; i < 3; ++i)//summon 3 abominations { uint8 r = rand()%4; - Creature* pUnit = me->SummonCreature(ABOMINATION, AllianceBase[r][0]+irand(-15, 15), AllianceBase[r][1]+irand(-15, 15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); - if (pUnit) + Creature* unit = me->SummonCreature(ABOMINATION, AllianceBase[r][0]+irand(-15, 15), AllianceBase[r][1]+irand(-15, 15), AllianceBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); + if (unit) { - CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction; - CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true; - CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i; - pUnit->setActive(true); + CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction; + CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true; + CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i; + unit->setActive(true); } } for (uint8 i = 0; i < 5; ++i)//summon 5 gargoyles { - Creature* pUnit = me->SummonCreature(GARGOYLE, AllianceOverrunGargPos[i][0], AllianceOverrunGargPos[i][1], AllianceOverrunGargPos[i][2], AllianceOverrunGargPos[i][3], TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); - if (pUnit) + Creature* unit = me->SummonCreature(GARGOYLE, AllianceOverrunGargPos[i][0], AllianceOverrunGargPos[i][1], AllianceOverrunGargPos[i][2], AllianceOverrunGargPos[i][3], TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); + if (unit) { - pUnit->SetHomePosition(AllianceOverrunGargPos[i][0], AllianceOverrunGargPos[i][1], AllianceOverrunGargPos[i][2], AllianceOverrunGargPos[i][3]); - CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction; - CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true; - CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i; - pUnit->setActive(true); + unit->SetHomePosition(AllianceOverrunGargPos[i][0], AllianceOverrunGargPos[i][1], AllianceOverrunGargPos[i][2], AllianceOverrunGargPos[i][3]); + CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction; + CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true; + CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i; + unit->setActive(true); } } break; @@ -1120,38 +1120,38 @@ void hyjalAI::DoOverrun(uint32 faction, const uint32 diff) for (uint8 i = 0; i < 26; ++i)//summon infernals { - Creature* pUnit = me->SummonCreature(GIANT_INFERNAL, InfernalSPWP[i][0], InfernalSPWP[i][1], InfernalSPWP[i][2], InfernalSPWP[i][3], TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); - if (pUnit) + Creature* unit = me->SummonCreature(GIANT_INFERNAL, InfernalSPWP[i][0], InfernalSPWP[i][1], InfernalSPWP[i][2], InfernalSPWP[i][3], TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); + if (unit) { - pUnit->SetHomePosition(InfernalSPWP[i][0], InfernalSPWP[i][1], InfernalSPWP[i][2], InfernalSPWP[i][3]); - CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction; - CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true; - CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i; - pUnit->setActive(true); + unit->SetHomePosition(InfernalSPWP[i][0], InfernalSPWP[i][1], InfernalSPWP[i][2], InfernalSPWP[i][3]); + CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction; + CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true; + CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i; + unit->setActive(true); } } for (uint8 i = 0; i < 25; ++i)//summon 25 ghouls { uint8 r = rand()%4; - Creature* pUnit = me->SummonCreature(GHOUL, HordeBase[r][0]+irand(-15, 15), HordeBase[r][1]+irand(-15, 15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); - if (pUnit) + Creature* unit = me->SummonCreature(GHOUL, HordeBase[r][0]+irand(-15, 15), HordeBase[r][1]+irand(-15, 15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); + if (unit) { - CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction; - CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true; - CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i; - pUnit->setActive(true); + CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction; + CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true; + CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i; + unit->setActive(true); } } for (uint8 i = 0; i < 5; ++i)//summon 5 abominations { uint8 r = rand()%4; - Creature* pUnit = me->SummonCreature(ABOMINATION, HordeBase[r][0]+irand(-15, 15), HordeBase[r][1]+irand(-15, 15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); - if (pUnit) + Creature* unit = me->SummonCreature(ABOMINATION, HordeBase[r][0]+irand(-15, 15), HordeBase[r][1]+irand(-15, 15), HordeBase[r][2], 0, TEMPSUMMON_MANUAL_DESPAWN, 2*60*1000); + if (unit) { - CAST_AI(hyjal_trashAI, pUnit->AI())->faction = Faction; - CAST_AI(hyjal_trashAI, pUnit->AI())->IsOverrun = true; - CAST_AI(hyjal_trashAI, pUnit->AI())->OverrunType = i; - pUnit->setActive(true); + CAST_AI(hyjal_trashAI, unit->AI())->faction = Faction; + CAST_AI(hyjal_trashAI, unit->AI())->IsOverrun = true; + CAST_AI(hyjal_trashAI, unit->AI())->OverrunType = i; + unit->setActive(true); } } break; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp index fcb7126cb6a..e3d57414b94 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp @@ -191,12 +191,12 @@ public: Creature* creature = instance->GetCreature(Azgalor); if (creature) { - Creature* pUnit = creature->SummonCreature(21987, creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000); + Creature* unit = creature->SummonCreature(21987, creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 10000); Map* pMap = creature->GetMap(); - if (pMap->IsDungeon() && pUnit) + if (pMap->IsDungeon() && unit) { - pUnit->SetVisible(false); + unit->SetVisible(false); Map::PlayerList const &PlayerList = pMap->GetPlayers(); if (PlayerList.isEmpty()) return; @@ -206,7 +206,7 @@ public: if (i->getSource()) { WorldPacket data(SMSG_MESSAGECHAT, 200); - pUnit->BuildMonsterChat(&data, CHAT_MSG_MONSTER_YELL, YELL_EFFORTS, 0, YELL_EFFORTS_NAME, i->getSource()->GetGUID()); + unit->BuildMonsterChat(&data, CHAT_MSG_MONSTER_YELL, YELL_EFFORTS, 0, YELL_EFFORTS_NAME, i->getSource()->GetGUID()); i->getSource()->GetSession()->SendPacket(&data); WorldPacket data2(SMSG_PLAY_SOUND, 4); diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index c73843b7a8c..7244d78e83d 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -576,11 +576,11 @@ public: while (i != Stomach_Map.end()) { //Check for valid player - Unit* pUnit = Unit::GetUnit(*me, i->first); + Unit* unit = Unit::GetUnit(*me, i->first); //Only units out of stomach - if (pUnit && i->second == false) - temp.push_back(pUnit); + if (unit && i->second == false) + temp.push_back(unit); ++i; } @@ -724,19 +724,19 @@ public: while (i != Stomach_Map.end()) { //Check for valid player - Unit* pUnit = Unit::GetUnit(*me, i->first); + Unit* unit = Unit::GetUnit(*me, i->first); //Only move units in stomach - if (pUnit && i->second == true) + if (unit && i->second == true) { //Teleport each player out - DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6)); + DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6)); //Cast knockback on them - DoCast(pUnit, SPELL_EXIT_STOMACH_KNOCKBACK, true); + DoCast(unit, SPELL_EXIT_STOMACH_KNOCKBACK, true); //Remove the acid debuff - pUnit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); + unit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); i->second = false; } @@ -755,25 +755,25 @@ public: while (i != Stomach_Map.end()) { //Check for valid player - Unit* pUnit = Unit::GetUnit(*me, i->first); + Unit* unit = Unit::GetUnit(*me, i->first); //Only apply to units in stomach - if (pUnit && i->second == true) + if (unit && i->second == true) { //Cast digestive acid on them - DoCast(pUnit, SPELL_DIGESTIVE_ACID, true); + DoCast(unit, SPELL_DIGESTIVE_ACID, true); //Check if player should be kicked from stomach - if (pUnit->IsWithinDist3d(&KickPos, 15.0f)) + if (unit->IsWithinDist3d(&KickPos, 15.0f)) { //Teleport each player out - DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6)); + DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+10, float(rand()%6)); //Cast knockback on them - DoCast(pUnit, SPELL_EXIT_STOMACH_KNOCKBACK, true); + DoCast(unit, SPELL_EXIT_STOMACH_KNOCKBACK, true); //Remove the acid debuff - pUnit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); + unit->RemoveAurasDueToSpell(SPELL_DIGESTIVE_ACID); i->second = false; } @@ -805,11 +805,11 @@ public: if (StomachEnterVisTimer <= diff) { //Check for valid player - Unit* pUnit = Unit::GetUnit(*me, StomachEnterTarget); + Unit* unit = Unit::GetUnit(*me, StomachEnterTarget); - if (pUnit) + if (unit) { - DoTeleportPlayer(pUnit, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O); + DoTeleportPlayer(unit, STOMACH_X, STOMACH_Y, STOMACH_Z, STOMACH_O); } StomachEnterTarget = 0; diff --git a/src/server/scripts/Kalimdor/boss_azuregos.cpp b/src/server/scripts/Kalimdor/boss_azuregos.cpp index 8bfefade07e..6bbc29dcc56 100644 --- a/src/server/scripts/Kalimdor/boss_azuregos.cpp +++ b/src/server/scripts/Kalimdor/boss_azuregos.cpp @@ -87,10 +87,10 @@ public: std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) + Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) { - DoTeleportPlayer(pUnit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+3, pUnit->GetOrientation()); + DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+3, unit->GetOrientation()); } } diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp index 244250b8204..fd246ab6020 100644 --- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp @@ -535,8 +535,8 @@ public: SetCombatMovement(true); if (me->isInCombat()) - if (Unit* pUnit = me->getVictim()) - me->GetMotionMaster()->MoveChase(pUnit); + if (Unit* unit = me->getVictim()) + me->GetMotionMaster()->MoveChase(unit); } void MoveToDock() diff --git a/src/server/scripts/Kalimdor/mulgore.cpp b/src/server/scripts/Kalimdor/mulgore.cpp index 6b7197292dd..947c5236e14 100644 --- a/src/server/scripts/Kalimdor/mulgore.cpp +++ b/src/server/scripts/Kalimdor/mulgore.cpp @@ -160,9 +160,9 @@ public: switch (uiEventPhase) { case 1: - if (Unit* pUnit = Unit::GetUnit(*me, uiPlayerGUID)) + if (Unit* unit = Unit::GetUnit(*me, uiPlayerGUID)) { - if (GameObject* pGo = pUnit->GetGameObject(SPELL_LUNCH)) + if (GameObject* pGo = unit->GetGameObject(SPELL_LUNCH)) { m_bIsMovingToLunch = true; me->GetMotionMaster()->MovePoint(POINT_ID, pGo->GetPositionX(), pGo->GetPositionY(), pGo->GetPositionZ()); @@ -174,8 +174,8 @@ public: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_USESTANDING); break; case 3: - if (Player* pUnit = Unit::GetPlayer(*me, uiPlayerGUID)) - pUnit->TalkedToCreature(me->GetEntry(), me->GetGUID()); + if (Player* unit = Unit::GetPlayer(*me, uiPlayerGUID)) + unit->TalkedToCreature(me->GetEntry(), me->GetGUID()); me->UpdateEntry(NPC_KYLE_FRIENDLY); break; diff --git a/src/server/scripts/Northrend/CMakeLists.txt b/src/server/scripts/Northrend/CMakeLists.txt index 3e1f500ebce..63e714d17aa 100644 --- a/src/server/scripts/Northrend/CMakeLists.txt +++ b/src/server/scripts/Northrend/CMakeLists.txt @@ -173,6 +173,7 @@ set(scripts_STAT_SRCS Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp Northrend/IcecrownCitadel/boss_sindragosa.cpp + Northrend/IcecrownCitadel/boss_the_lich_king.cpp Northrend/zuldrak.cpp Northrend/icecrown.cpp Northrend/Gundrak/boss_slad_ran.cpp diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp index 6dc0d0365a0..acbe54d0acd 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.cpp @@ -223,8 +223,8 @@ public: uint64 uiGrandChampionBoss1 = 0; if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle1GUID)) if (Vehicle* pVehicle = pBoss->GetVehicleKit()) - if (Unit* pUnit = pVehicle->GetPassenger(0)) - uiGrandChampionBoss1 = pUnit->GetGUID(); + if (Unit* unit = pVehicle->GetPassenger(0)) + uiGrandChampionBoss1 = unit->GetGUID(); if (pInstance) { pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_1, uiVehicle1GUID); @@ -239,8 +239,8 @@ public: uint64 uiGrandChampionBoss2 = 0; if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle2GUID)) if (Vehicle* pVehicle = pBoss->GetVehicleKit()) - if (Unit* pUnit = pVehicle->GetPassenger(0)) - uiGrandChampionBoss2 = pUnit->GetGUID(); + if (Unit* unit = pVehicle->GetPassenger(0)) + uiGrandChampionBoss2 = unit->GetGUID(); if (pInstance) { pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_2, uiVehicle2GUID); @@ -255,8 +255,8 @@ public: uint64 uiGrandChampionBoss3 = 0; if (Creature* pBoss = Unit::GetCreature(*me, uiVehicle3GUID)) if (Vehicle* pVehicle = pBoss->GetVehicleKit()) - if (Unit* pUnit = pVehicle->GetPassenger(0)) - uiGrandChampionBoss3 = pUnit->GetGUID(); + if (Unit* unit = pVehicle->GetPassenger(0)) + uiGrandChampionBoss3 = unit->GetGUID(); if (pInstance) { pInstance->SetData64(DATA_GRAND_CHAMPION_VEHICLE_3, uiVehicle3GUID); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp index 013f2cd6e98..ff342db5503 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -292,14 +292,14 @@ struct boss_faction_championsAI : public ScriptedAI std::list<HostileReference*> const& tList = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator itr = tList.begin(); itr != tList.end(); ++itr) { - Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); - if (pUnit && me->getThreatManager().getThreat(pUnit)) + Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + if (unit && me->getThreatManager().getThreat(unit)) { - if (pUnit->GetTypeId()==TYPEID_PLAYER) + if (unit->GetTypeId()==TYPEID_PLAYER) { - float threat = CalculateThreat(me->GetDistance2d(pUnit), (float)pUnit->GetArmor(), pUnit->GetHealth()); - me->getThreatManager().modifyThreatPercent(pUnit, -100); - me->AddThreat(pUnit, 1000000.0f * threat); + float threat = CalculateThreat(me->GetDistance2d(unit), (float)unit->GetArmor(), unit->GetHealth()); + me->getThreatManager().modifyThreatPercent(unit, -100); + me->AddThreat(unit, 1000000.0f * threat); } } } diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h index 8381ead167d..6237d7d57b0 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h @@ -114,8 +114,8 @@ struct boss_horAI : ScriptedAI me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_AGGRESSIVE); - if (Unit* pUnit = me->SelectNearestTarget()) - AttackStart(pUnit); + if (Unit* unit = me->SelectNearestTarget()) + AttackStart(unit); DoZoneInCombat(); break; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp index b19042b3669..a52965f925f 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lord_marrowgar.cpp @@ -193,9 +193,9 @@ class boss_lord_marrowgar : public CreatureScript case EVENT_BONE_STORM_MOVE: { events.ScheduleEvent(EVENT_BONE_STORM_MOVE, _boneStormDuration/3); - Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 1); + Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me)); if (!unit) - unit = SelectTarget(SELECT_TARGET_RANDOM, 0); + unit = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true); if (unit) me->GetMotionMaster()->MovePoint(POINT_TARGET_BONESTORM_PLAYER, unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ()); break; @@ -564,14 +564,14 @@ class spell_marrowgar_bone_storm : public SpellScriptLoader { PrepareSpellScript(spell_marrowgar_bone_storm_SpellScript); - void RecalculateDamage(SpellEffIndex /*effIndex*/) + void RecalculateDamage() { - SetHitDamage(int32(GetHitDamage() / sqrtf(logf(GetHitUnit()->GetExactDist2d(GetCaster()))))); + SetHitDamage(int32(GetHitDamage() / std::max(sqrtf(GetHitUnit()->GetExactDist2d(GetCaster())), 1.0f))); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_marrowgar_bone_storm_SpellScript::RecalculateDamage, EFFECT_0, SPELL_EFFECT_SCHOOL_DAMAGE); + OnHit += SpellHitFn(spell_marrowgar_bone_storm_SpellScript::RecalculateDamage); } }; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index 72b5f8f918c..a6e3e78c96a 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -525,7 +525,7 @@ class boss_professor_putricide : public CreatureScript EnterEvadeMode(); break; case EVENT_FESTERGUT_GOO: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true)) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me))) DoCast(target, SPELL_MALLABLE_GOO_H, true); // triggered, to skip LoS check events.ScheduleEvent(EVENT_FESTERGUT_GOO, urand(15000, 20000), 0, PHASE_FESTERGUT); break; @@ -534,7 +534,7 @@ class boss_professor_putricide : public CreatureScript EnterEvadeMode(); break; case EVENT_ROTFACE_VILE_GAS: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true)) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me))) DoCast(target, SPELL_VILE_GAS_H, true); // triggered, to skip LoS check events.ScheduleEvent(EVENT_ROTFACE_VILE_GAS, urand(15000, 20000), 0, PHASE_ROTFACE); break; @@ -601,7 +601,7 @@ class boss_professor_putricide : public CreatureScript events.ScheduleEvent(EVENT_CHOKING_GAS_BOMB, urand(35000, 40000)); break; case EVENT_UNBOUND_PLAGUE: - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true)) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me))) { me->CastCustomSpell(SPELL_UNBOUND_PLAGUE, SPELLVALUE_BASE_POINT0, 775, target); DoCast(target, SPELL_UNBOUND_PLAGUE_SEARCHER); @@ -1341,18 +1341,18 @@ class spell_putricide_mutated_transformation : public SpellScriptLoader if (!summon || !summon->IsVehicle()) return; - caster->CastSpell(summon, SPELL_MUTATED_TRANSFORMATION_NAME, true); summon->CastSpell(summon, SPELL_ABOMINATION_VEHICLE_POWER_DRAIN, true); summon->CastSpell(summon, SPELL_MUTATED_TRANSFORMATION_DAMAGE, true); + caster->CastSpell(summon, SPELL_MUTATED_TRANSFORMATION_NAME, true); - caster->EnterVehicle(summon, 0); + caster->EnterVehicle(summon, 0); // VEHICLE_SPELL_RIDE_HARDCODED is used according to sniff, this is ok summon->SetCreatorGUID(caster->GetGUID()); putricide->AI()->JustSummoned(summon); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_putricide_mutated_transformation_SpellScript::HandleSummon, EFFECT_0, SPELL_EFFECT_SUMMON); + OnEffectHit += SpellEffectFn(spell_putricide_mutated_transformation_SpellScript::HandleSummon, EFFECT_0, SPELL_EFFECT_SUMMON); } }; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp new file mode 100644 index 00000000000..85ab188f336 --- /dev/null +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_the_lich_king.cpp @@ -0,0 +1,3243 @@ +/* + * Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "ObjectMgr.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "SpellAuraEffects.h" +#include "Spell.h" +#include "Vehicle.h" +#include "Cell.h" +#include "CellImpl.h" +#include "GridNotifiers.h" +#include "GridNotifiersImpl.h" +#include "icecrown_citadel.h" + +enum Texts +{ + // The Lich King + SAY_LK_INTRO_1 = 0, + SAY_LK_INTRO_2 = 1, + SAY_LK_INTRO_3 = 2, + SAY_LK_REMORSELESS_WINTER = 4, + SAY_LK_QUAKE = 5, + SAY_LK_SUMMON_VALKYR = 6, + SAY_LK_HARVEST_SOUL = 7, + SAY_LK_FROSTMOURNE_ESCAPE = 8, // not said on heroic + SAY_LK_FROSTMOURNE_KILL = 9, // not said on heroic + SAY_LK_KILL = 10, + SAY_LK_BERSERK = 11, + EMOTE_DEFILE_WARNING = 12, + EMOTE_NECROTIC_PLAGUE_WARNING = 13, + SAY_LK_OUTRO_1 = 14, + SAY_LK_OUTRO_2 = 15, + SAY_LK_OUTRO_3 = 16, + SAY_LK_OUTRO_4 = 17, + SAY_LK_OUTRO_5 = 18, + SAY_LK_OUTRO_6 = 19, + SAY_LK_OUTRO_7 = 20, + SAY_LK_OUTRO_8 = 21, + + // Highlord Tirion Fordring + SAY_TIRION_INTRO_1 = 0, + SAY_TIRION_INTRO_2 = 1, + SAY_TIRION_OUTRO_1 = 2, + SAY_TIRION_OUTRO_2 = 3, + + // Terenas Menethil (outro) + SAY_TERENAS_OUTRO_1 = 0, + SAY_TERENAS_OUTRO_2 = 1, + + // Terenas Menethil (Frostmourne) + SAY_TERENAS_INTRO_1 = 0, + SAY_TERENAS_INTRO_2 = 1, + SAY_TERENAS_INTRO_3 = 2, +}; + +enum Spells +{ + // The Lich King + SPELL_PLAGUE_AVOIDANCE = 72846, // raging spirits also get it + SPELL_EMOTE_SIT_NO_SHEATH = 73220, + SPELL_BOSS_HITTIN_YA = 73878, + SPELL_EMOTE_SHOUT_NO_SHEATH = 73213, + SPELL_ICE_LOCK = 71614, + + // Phase 1 + SPELL_SUMMON_SHAMBLING_HORROR = 70372, + SPELL_RISEN_WITCH_DOCTOR_SPAWN = 69639, + SPELL_SUMMON_DRUDGE_GHOULS = 70358, + SPELL_INFEST = 70541, + SPELL_NECROTIC_PLAGUE = 70337, + SPELL_NECROTIC_PLAGUE_JUMP = 70338, + SPELL_PLAGUE_SIPHON = 74074, + SPELL_SHADOW_TRAP = 73539, + SPELL_SHADOW_TRAP_AURA = 73525, + SPELL_SHADOW_TRAP_KNOCKBACK = 73529, + + // Phase Transition + SPELL_REMORSELESS_WINTER_1 = 68981, + SPELL_REMORSELESS_WINTER_2 = 72259, + SPELL_PAIN_AND_SUFFERING = 72133, + SPELL_SUMMON_ICE_SPHERE = 69104, + SPELL_ICE_SPHERE = 69090, + SPELL_ICE_BURST_TARGET_SEARCH = 69109, + SPELL_ICE_PULSE = 69091, + SPELL_ICE_BURST = 69108, + SPELL_RAGING_SPIRIT = 69200, + SPELL_RAGING_SPIRIT_VISUAL = 69197, + SPELL_RAGING_SPIRIT_VISUAL_CLONE = 69198, + SPELL_SOUL_SHRIEK = 69242, + SPELL_QUAKE = 72262, + + // Phase 2 + SPELL_DEFILE = 72762, + SPELL_DEFILE_AURA = 72743, + SPELL_DEFILE_GROW = 72756, + SPELL_SUMMON_VALKYR = 69037, + SPELL_SUMMON_VALKYR_PERIODIC = 74361, + SPELL_HARVEST_SOUL_VALKYR = 68985, // Val'kyr Shadowguard vehicle aura + SPELL_SOUL_REAPER = 69409, + SPELL_SOUL_REAPER_BUFF = 69410, + SPELL_WINGS_OF_THE_DAMNED = 74352, + SPELL_VALKYR_TARGET_SEARCH = 69030, + SPELL_CHARGE = 74399, // cast on selected target + SPELL_VALKYR_CARRY = 74445, // removes unselectable flag + SPELL_LIFE_SIPHON = 73488, + SPELL_LIFE_SIPHON_HEAL = 73489, + SPELL_EJECT_ALL_PASSENGERS = 68576, + + // Phase 3 + SPELL_VILE_SPIRITS = 70498, + SPELL_VILE_SPIRIT_MOVE_SEARCH = 70501, + SPELL_VILE_SPIRIT_DAMAGE_SEARCH = 70502, + SPELL_SPIRIT_BURST = 70503, + SPELL_HARVEST_SOUL = 68980, + SPELL_HARVEST_SOULS = 73654, // Heroic version, weird because it has all 4 difficulties just like above spell + SPELL_HARVEST_SOUL_VEHICLE = 68984, + SPELL_HARVEST_SOUL_VISUAL = 71372, + SPELL_HARVEST_SOUL_TELEPORT = 72546, + SPELL_HARVEST_SOULS_TELEPORT = 73655, + SPELL_HARVEST_SOUL_TELEPORT_BACK = 72597, + SPELL_IN_FROSTMOURNE_ROOM = 74276, + SPELL_KILL_FROSTMOURNE_PLAYERS = 75127, + SPELL_HARVESTED_SOUL = 72679, + SPELL_TRIGGER_VILE_SPIRIT_HEROIC = 73582, + + // Frostmourne + SPELL_LIGHTS_FAVOR = 69382, + SPELL_RESTORE_SOUL = 72595, + SPELL_RESTORE_SOULS = 73650, // Heroic + SPELL_DARK_HUNGER = 69383, // Passive proc healing + SPELL_DESTROY_SOUL = 74086, // Used when Terenas Menethil dies + SPELL_SOUL_RIP = 69397, // Deals increasing damage + SPELL_SOUL_RIP_DAMAGE = 69398, + SPELL_TERENAS_LOSES_INSIDE = 72572, + SPELL_SUMMON_SPIRIT_BOMB_1 = 73581, // (Heroic) + SPELL_SUMMON_SPIRIT_BOMB_2 = 74299, // (Heroic) + SPELL_EXPLOSION = 73576, // Spirit Bomb (Heroic) + + // Outro + SPELL_FURY_OF_FROSTMOURNE = 72350, + SPELL_FURY_OF_FROSTMOURNE_NO_REZ = 72351, + SPELL_EMOTE_QUESTION_NO_SHEATH = 73330, + SPELL_RAISE_DEAD = 71769, + SPELL_LIGHTS_BLESSING = 71797, + SPELL_JUMP = 71809, + SPELL_JUMP_TRIGGERED = 71811, + SPELL_JUMP_2 = 72431, + SPELL_SUMMON_BROKEN_FROSTMOURNE = 74081, // visual + SPELL_SUMMON_BROKEN_FROSTMOURNE_2 = 72406, // animation + SPELL_SUMMON_BROKEN_FROSTMOURNE_3 = 73017, // real summon + SPELL_BROKEN_FROSTMOURNE = 72398, + SPELL_BROKEN_FROSTMOURNE_KNOCK = 72405, + SPELL_SOUL_BARRAGE = 72305, + SPELL_SUMMON_TERENAS = 72420, + SPELL_MASS_RESURRECTION = 72429, + SPELL_MASS_RESURRECTION_REAL = 72423, + SPELL_PLAY_MOVIE = 73159, + + // Shambling Horror + SPELL_SHOCKWAVE = 72149, + SPELL_ENRAGE = 72143, + SPELL_FRENZY = 28747, +}; + +#define NECROTIC_PLAGUE_LK RAID_MODE<uint32>(70337, 73912, 73913, 73914) +#define NECROTIC_PLAGUE_PLR RAID_MODE<uint32>(70338, 73785, 73786, 73787) +#define REMORSELESS_WINTER_1 RAID_MODE<uint32>(68981, 74270, 74271, 74272) +#define REMORSELESS_WINTER_2 RAID_MODE<uint32>(72259, 74273, 74274, 74275) +#define SUMMON_VALKYR RAID_MODE<uint32>(69037, 74361, 69037, 74361) +#define HARVEST_SOUL RAID_MODE<uint32>(68980, 74325, 74296, 74297) + +enum Events +{ + // The Lich King + // intro events + EVENT_INTRO_MOVE_1 = 1, + EVENT_INTRO_MOVE_2 = 2, + EVENT_INTRO_MOVE_3 = 3, + EVENT_INTRO_TALK_1 = 4, + EVENT_EMOTE_CAST_SHOUT = 5, + EVENT_INTRO_EMOTE_1 = 6, + EVENT_INTRO_CHARGE = 7, + EVENT_INTRO_CAST_FREEZE = 8, + EVENT_FINISH_INTRO = 9, + + // combat events + EVENT_SUMMON_SHAMBLING_HORROR = 10, + EVENT_SUMMON_DRUDGE_GHOUL = 11, + EVENT_INFEST = 12, + EVENT_NECROTIC_PLAGUE = 13, + EVENT_SHADOW_TRAP = 14, // heroic only + EVENT_SOUL_REAPER = 15, + EVENT_DEFILE = 16, + EVENT_HARVEST_SOUL = 17, // normal mode only + EVENT_PAIN_AND_SUFFERING = 18, + EVENT_SUMMON_ICE_SPHERE = 19, + EVENT_SUMMON_RAGING_SPIRIT = 20, + EVENT_QUAKE = 21, + EVENT_SUMMON_VALKYR = 22, + EVENT_GRAB_PLAYER = 23, + EVENT_MOVE_TO_DROP_POS = 24, + EVENT_LIFE_SIPHON = 25, // heroic only + EVENT_START_ATTACK = 26, + EVENT_QUAKE_2 = 27, + EVENT_VILE_SPIRITS = 28, + EVENT_HARVEST_SOULS = 29, // heroic only + EVENT_WICKED_SPIRITS = 30, + EVENT_SOUL_RIP = 31, + EVENT_DESTROY_SOUL = 32, + EVENT_FROSTMOURNE_TALK_1 = 33, + EVENT_FROSTMOURNE_TALK_2 = 34, + EVENT_FROSTMOURNE_TALK_3 = 35, + EVENT_TELEPORT_BACK = 36, + EVENT_FROSTMOURNE_HEROIC = 37, + EVENT_OUTRO_TALK_1 = 38, + EVENT_OUTRO_TALK_2 = 39, + EVENT_OUTRO_EMOTE_TALK = 40, + EVENT_OUTRO_TALK_3 = 41, + EVENT_OUTRO_MOVE_CENTER = 42, + EVENT_OUTRO_TALK_4 = 43, + EVENT_OUTRO_RAISE_DEAD = 44, + EVENT_OUTRO_TALK_5 = 45, + EVENT_OUTRO_BLESS = 46, + EVENT_OUTRO_REMOVE_ICE = 47, + EVENT_OUTRO_MOVE_1 = 48, + EVENT_OUTRO_JUMP = 49, + EVENT_OUTRO_TALK_6 = 50, + EVENT_OUTRO_KNOCK_BACK = 51, + EVENT_OUTRO_SOUL_BARRAGE = 52, + EVENT_OUTRO_SUMMON_TERENAS = 53, + EVENT_OUTRO_TERENAS_TALK_1 = 54, + EVENT_OUTRO_TERENAS_TALK_2 = 55, + EVENT_OUTRO_TALK_7 = 56, + EVENT_OUTRO_TALK_8 = 57, + EVENT_BERSERK = 58, + + // Shambling Horror + EVENT_SHOCKWAVE = 59, + EVENT_ENRAGE = 60, + + // Raging Spirit + EVENT_SOUL_SHRIEK = 61, + + // Strangulate Vehicle (Harvest Soul) + EVENT_TELEPORT = 62, + EVENT_MOVE_TO_LICH_KING = 63, + EVENT_DESPAWN_SELF = 64, +}; + +enum EventGroups +{ + EVENT_GROUP_BERSERK = 1, + EVENT_GROUP_VILE_SPIRITS = 2, +}; + +enum Phases +{ + PHASE_INTRO = 1, + PHASE_ONE = 2, + PHASE_TWO = 3, + PHASE_THREE = 4, + PHASE_TRANSITION = 5, + PHASE_FROSTMOURNE = 6, // only set on heroic mode when all players are sent into frostmourne + PHASE_OUTRO = 7, + + PHASE_MASK_INTRO = 1 << PHASE_INTRO, + PHASE_MASK_ONE = 1 << PHASE_ONE, + PHASE_MASK_TWO = 1 << PHASE_TWO, + PHASE_MASK_THREE = 1 << PHASE_THREE, + PHASE_MASK_TRANSITION = 1 << PHASE_TRANSITION, + PHASE_MASK_NO_CAST_CHECK = (1 << PHASE_TRANSITION) | (1 << PHASE_FROSTMOURNE) | (1 << PHASE_OUTRO), + PHASE_MASK_FROSTMOURNE = 1 << PHASE_FROSTMOURNE, + PHASE_MASK_OUTRO = 1 << PHASE_OUTRO, + PHASE_MASK_NO_VICTIM = (1 << PHASE_INTRO) | (1 << PHASE_OUTRO) | (1 << PHASE_FROSTMOURNE), +}; + +#define PHASE_TWO_THREE (events.GetPhaseMask() & PHASE_MASK_TWO ? PHASE_TWO : PHASE_THREE) + +Position const CenterPosition = {503.6282f, -2124.655f, 840.8569f, 0.0f}; +Position const TirionIntro = {489.2970f, -2124.840f, 840.8569f, 0.0f}; +Position const TirionCharge = {482.9019f, -2124.479f, 840.8570f, 0.0f}; +Position const LichKingIntro[3] = +{ + {432.0851f, -2123.673f, 864.6582f, 0.0f}, + {457.8351f, -2123.423f, 841.1582f, 0.0f}, + {465.0730f, -2123.470f, 840.8569f, 0.0f}, +}; +Position const OutroPosition1 = {493.6286f, -2124.569f, 840.8569f, 0.0f}; +Position const OutroFlying = {508.9897f, -2124.561f, 845.3565f, 0.0f}; +Position const TerenasSpawn = {495.5542f, -2517.012f, 1050.000f, 4.6993f}; +Position const TerenasSpawnHeroic = {495.7080f, -2523.760f, 1050.000f, 0.0f}; +Position const SpiritWardenSpawn = {495.3406f, -2529.983f, 1050.000f, 1.5592f}; + +enum MovePoints +{ + POINT_CENTER_1 = 1, + POINT_CENTER_2 = 2, + POINT_TIRION_INTRO = 3, + POINT_LK_INTRO_1 = 4, + POINT_LK_INTRO_2 = 5, + POINT_LK_INTRO_3 = 6, + POINT_TIRION_CHARGE = 7, + POINT_DROP_PLAYER = 8, + POINT_LK_OUTRO_1 = 9, + POINT_TIRION_OUTRO_1 = 10, + POINT_OUTRO_JUMP = 11, + POINT_LK_OUTRO_2 = 12, + POINT_GROUND = 13, + POINT_CHARGE = 1003, // globally used number for charge spell effects +}; + +enum EncounterActions +{ + ACTION_START_ENCOUNTER = 0, + ACTION_CONTINUE_INTRO = 1, + ACTION_START_ATTACK = 2, + ACTION_OUTRO = 3, + ACTION_PLAY_MUSIC = 4, + ACTION_BREAK_FROSTMOURNE = 5, + ACTION_SUMMON_TERENAS = 6, + ACTION_FINISH_OUTRO = 7, + ACTION_TELEPORT_BACK = 8, +}; + +enum MiscData +{ + LIGHT_SNOWSTORM = 2490, + LIGHT_SOULSTORM = 2508, + + MUSIC_FROZEN_THRONE = 17457, + MUSIC_SPECIAL = 17458, // Summon Shambling Horror, Remorseless Winter, Quake, Summon Val'kyr Periodic, Harvest Soul, Vile Spirits + MUSIC_FURY_OF_FROSTMOURNE = 17459, + MUSIC_FINAL = 17460, // Raise Dead, Light's Blessing + + SOUND_PAIN = 17360, // separate sound, not attached to any text + + EQUIP_ASHBRINGER_GLOWING = 50442, + EQUIP_BROKEN_FROSTMOURNE = 50840, + + MOVIE_FALL_OF_THE_LICH_KING = 16, +}; + +#define DATA_PLAGUE_STACK 70337 +#define DATA_VILE 45814622 + +class NecroticPlagueTargetCheck : public std::unary_function<Unit*, bool> +{ + public: + NecroticPlagueTargetCheck(Unit const* obj, uint32 notAura1 = 0, uint32 notAura2 = 0) + : _sourceObj(obj), _notAura1(notAura1), _notAura2(notAura2) + { + } + + bool operator()(Unit* unit) const + { + if (!unit || unit == _sourceObj || !unit->isTargetableForAttack() || unit->isTotem() || unit->HasAura(SPELL_PLAGUE_AVOIDANCE)) + return false; + if ((_notAura1 && unit->HasAura(_notAura1)) || (_notAura2 && unit->HasAura(_notAura2))) + return false; + return true; + } + + private: + Unit const* _sourceObj; + uint32 _notAura1; + uint32 _notAura2; +}; + +class HeightDifferenceCheck +{ + public: + HeightDifferenceCheck(GameObject* go, float diff, bool reverse) + : _baseObject(go), _difference(diff), _reverse(reverse) + { + } + + bool operator()(Unit* unit) const + { + return (unit->GetPositionZ() - _baseObject->GetPositionZ() > _difference) != _reverse; + } + + private: + GameObject* _baseObject; + float _difference; + bool _reverse; +}; + +class FrozenThroneResetWorker +{ + public: + FrozenThroneResetWorker() { } + + bool operator()(GameObject* go) + { + switch (go->GetEntry()) + { + case GO_ARTHAS_PLATFORM: + go->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING); + break; + case GO_DOODAD_ICECROWN_THRONEFROSTYWIND01: + go->SetGoState(GO_STATE_ACTIVE); + break; + case GO_DOODAD_ICECROWN_THRONEFROSTYEDGE01: + go->SetGoState(GO_STATE_READY); + break; + case GO_DOODAD_ICESHARD_STANDING02: + case GO_DOODAD_ICESHARD_STANDING01: + case GO_DOODAD_ICESHARD_STANDING03: + case GO_DOODAD_ICESHARD_STANDING04: + go->ResetDoorOrButton(); + break; + default: + break; + } + + return false; + } +}; + +class StartMovementEvent : public BasicEvent +{ + public: + StartMovementEvent(Creature* summoner, Creature* owner) + : _summoner(summoner), _owner(owner) + { + } + + bool Execute(uint64 /*time*/, uint32 /*diff*/) + { + _owner->SetReactState(REACT_AGGRESSIVE); + if (Unit* target = _summoner->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(_summoner))) + _owner->AI()->AttackStart(target); + return true; + } + + private: + Creature* _summoner; + Creature* _owner; +}; + +class VileSpiritActivateEvent : public BasicEvent +{ + public: + explicit VileSpiritActivateEvent(Creature* owner) + : _owner(owner) + { + } + + bool Execute(uint64 /*time*/, uint32 /*diff*/) + { + _owner->SetReactState(REACT_AGGRESSIVE); + _owner->CastSpell(_owner, SPELL_VILE_SPIRIT_MOVE_SEARCH, true); + _owner->CastSpell((Unit*)NULL, SPELL_VILE_SPIRIT_DAMAGE_SEARCH, true); + return true; + } + + private: + Creature* _owner; +}; + +class boss_the_lich_king : public CreatureScript +{ + public: + boss_the_lich_king() : CreatureScript("boss_the_lich_king") { } + + struct boss_the_lich_kingAI : public BossAI + { + boss_the_lich_kingAI(Creature* creature) : BossAI(creature, DATA_THE_LICH_KING) + { + } + + void Reset() + { + _Reset(); + me->SetReactState(REACT_PASSIVE); + events.SetPhase(PHASE_INTRO); + _necroticPlagueStack = 0; + _vileSpiritExplosions = 0; + SetEquipmentSlots(true); + } + + void JustDied(Unit* /*killer*/) + { + _JustDied(); + DoCastAOE(SPELL_PLAY_MOVIE, false); + me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, 0x03); + float x, y, z; + me->GetPosition(x, y, z); + // use larger distance for vmap height search than in most other cases + float ground_Z = me->GetMap()->GetHeight(x, y, z, true, MAX_FALL_DISTANCE); + if (fabs(ground_Z - z) < 0.1f) + return; + + me->GetMotionMaster()->MoveFall(ground_Z); + } + + void EnterCombat(Unit* target) + { + if (!instance->CheckRequiredBosses(DATA_THE_LICH_KING, target->ToPlayer())) + { + EnterEvadeMode(); + instance->DoCastSpellOnPlayers(LIGHT_S_HAMMER_TELEPORT); + return; + } + + me->setActive(true); + DoZoneInCombat(); + + events.SetPhase(PHASE_ONE); + events.ScheduleEvent(EVENT_SUMMON_SHAMBLING_HORROR, 20000, 0, PHASE_ONE); + events.ScheduleEvent(EVENT_SUMMON_DRUDGE_GHOUL, 10000, 0, PHASE_ONE); + events.ScheduleEvent(EVENT_INFEST, 5000, 0, PHASE_ONE); + events.ScheduleEvent(EVENT_NECROTIC_PLAGUE, urand(30000, 33000), 0, PHASE_ONE); + events.ScheduleEvent(EVENT_BERSERK, 900000, EVENT_GROUP_BERSERK); + if (IsHeroic()) + events.ScheduleEvent(EVENT_SHADOW_TRAP, 15500, 0, PHASE_ONE); + } + + void JustReachedHome() + { + _JustReachedHome(); + instance->SetBossState(DATA_THE_LICH_KING, NOT_STARTED); + + // Reset The Frozen Throne gameobjects + FrozenThroneResetWorker reset; + Trinity::GameObjectWorker<FrozenThroneResetWorker> worker(me, reset); + me->VisitNearbyGridObject(333.0f, worker); + + // Reset any light override + SendLightOverride(0, 5000); + } + + bool CanAIAttack(Unit const* target) const + { + // The Lich King must not select targets in frostmourne room if he killed everyone outside + return !target->HasAura(SPELL_IN_FROSTMOURNE_ROOM); + } + + void EnterEvadeMode() + { + instance->SetBossState(DATA_THE_LICH_KING, FAIL); + BossAI::EnterEvadeMode(); + if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) + tirion->AI()->EnterEvadeMode(); + DoCastAOE(SPELL_KILL_FROSTMOURNE_PLAYERS); + summons.DoAction(NPC_STRANGULATE_VEHICLE, ACTION_TELEPORT_BACK); + } + + void KilledUnit(Unit* victim) + { + if (victim->GetTypeId() == TYPEID_PLAYER && !me->IsInEvadeMode() && !(events.GetPhaseMask() & PHASE_MASK_OUTRO)) + Talk(SAY_LK_KILL); + } + + void DoAction(int32 const action) + { + switch (action) + { + case ACTION_START_ENCOUNTER: + instance->SetBossState(DATA_THE_LICH_KING, IN_PROGRESS); + Talk(SAY_LK_INTRO_1); + SendMusicToPlayers(MUSIC_FROZEN_THRONE); + // schedule talks + me->SetStandState(UNIT_STAND_STATE_STAND); + events.ScheduleEvent(EVENT_INTRO_MOVE_1, 4000); + break; + case ACTION_START_ATTACK: + events.ScheduleEvent(EVENT_START_ATTACK, 5000); + break; + case ACTION_PLAY_MUSIC: + SendMusicToPlayers(MUSIC_FINAL); + break; + case ACTION_RESTORE_LIGHT: + SendLightOverride(0, 5000); + break; + case ACTION_BREAK_FROSTMOURNE: + DoCastAOE(SPELL_SUMMON_BROKEN_FROSTMOURNE); + DoCastAOE(SPELL_SUMMON_BROKEN_FROSTMOURNE_2); + SetEquipmentSlots(false, EQUIP_BROKEN_FROSTMOURNE); + events.ScheduleEvent(EVENT_OUTRO_TALK_6, 2500, 0, PHASE_OUTRO); + break; + case ACTION_FINISH_OUTRO: + events.ScheduleEvent(EVENT_OUTRO_TALK_7, 7000, 0, PHASE_OUTRO); + events.ScheduleEvent(EVENT_OUTRO_TALK_8, 17000, 0, PHASE_OUTRO); + break; + case ACTION_TELEPORT_BACK: + summons.DoAction(NPC_STRANGULATE_VEHICLE, ACTION_TELEPORT_BACK); + if (!IsHeroic()) + Talk(SAY_LK_FROSTMOURNE_ESCAPE); + else + DoCastAOE(SPELL_TRIGGER_VILE_SPIRIT_HEROIC); + break; + default: + break; + } + } + + uint32 GetData(uint32 type) + { + switch (type) + { + case DATA_PLAGUE_STACK: + return _necroticPlagueStack; + case DATA_VILE: + return _vileSpiritExplosions; + default: + break; + } + + return 0; + } + + void SetData(uint32 type, uint32 value) + { + switch (type) + { + case DATA_PLAGUE_STACK: + _necroticPlagueStack = std::max(value, _necroticPlagueStack); + break; + case DATA_VILE: + _vileSpiritExplosions += value; + break; + default: + break; + } + } + + void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/) + { + if (events.GetPhaseMask() & PHASE_MASK_ONE && !HealthAbovePct(70)) + { + events.SetPhase(PHASE_TRANSITION); + me->GetMotionMaster()->MovePoint(POINT_CENTER_1, CenterPosition); + return; + } + + if (events.GetPhaseMask() & PHASE_MASK_TWO && !HealthAbovePct(40)) + { + events.SetPhase(PHASE_TRANSITION); + me->GetMotionMaster()->MovePoint(POINT_CENTER_2, CenterPosition); + return; + } + + if (events.GetPhaseMask() & PHASE_MASK_THREE && !HealthAbovePct(10)) + { + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); + events.Reset(); + events.SetPhase(PHASE_OUTRO); + summons.DespawnAll(); + SendMusicToPlayers(MUSIC_FURY_OF_FROSTMOURNE); + DoCastAOE(SPELL_FURY_OF_FROSTMOURNE); + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + events.ScheduleEvent(EVENT_OUTRO_TALK_1, 2600, 0, PHASE_OUTRO); + events.ScheduleEvent(EVENT_OUTRO_EMOTE_TALK, 6600, 0, PHASE_OUTRO); + events.ScheduleEvent(EVENT_OUTRO_EMOTE_TALK, 17600, 0, PHASE_OUTRO); + events.ScheduleEvent(EVENT_OUTRO_EMOTE_TALK, 27600, 0, PHASE_OUTRO); + events.ScheduleEvent(EVENT_OUTRO_TALK_2, 34600, 0, PHASE_OUTRO); + events.ScheduleEvent(EVENT_OUTRO_TALK_3, 43600, 0, PHASE_OUTRO); + events.ScheduleEvent(EVENT_EMOTE_CAST_SHOUT, 54600, 0, PHASE_OUTRO); + events.ScheduleEvent(EVENT_OUTRO_EMOTE_TALK, 58600, 0, PHASE_OUTRO); + events.ScheduleEvent(EVENT_OUTRO_MOVE_CENTER, 69600, 0, PHASE_OUTRO); + // stop here. rest will get scheduled from MovementInform + return; + } + } + + void JustSummoned(Creature* summon) + { + switch (summon->GetEntry()) + { + case NPC_SHAMBLING_HORROR: + case NPC_DRUDGE_GHOUL: + summon->CastSpell(summon, SPELL_RISEN_WITCH_DOCTOR_SPAWN, true); + summon->SetReactState(REACT_PASSIVE); + summon->HandleEmoteCommand(EMOTE_ONESHOT_EMERGE); + summon->m_Events.AddEvent(new StartMovementEvent(me, summon), summon->m_Events.CalculateTime(5000)); + break; + case NPC_ICE_SPHERE: + { + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + { + summon->SetReactState(REACT_PASSIVE); + summon->CastSpell(summon, SPELL_ICE_SPHERE, false); + summon->CastSpell(summon, SPELL_ICE_BURST_TARGET_SEARCH, false); + summon->CastSpell(target, SPELL_ICE_PULSE, false); + summon->ClearUnitState(UNIT_STAT_CASTING); + summon->GetMotionMaster()->MoveFollow(target, 0.0f, 0.0f); + } + else + summon->DespawnOrUnsummon(); + break; + } + case NPC_DEFILE: + summon->SetReactState(REACT_PASSIVE); + summon->CastSpell(summon, SPELL_DEFILE_AURA, false); + break; + case NPC_VALKYR_SHADOWGUARD: + summon->CastSpell(summon, SPELL_WINGS_OF_THE_DAMNED, true); + summon->CastSpell(summon, SPELL_VALKYR_TARGET_SEARCH, true); + break; + case NPC_FROSTMOURNE_TRIGGER: + { + summons.Summon(summon); + summon->CastSpell((Unit*)NULL, SPELL_BROKEN_FROSTMOURNE, true); + + SendLightOverride(LIGHT_SOULSTORM, 10000); + SendWeather(WEATHER_STATE_BLACKSNOW); + + events.ScheduleEvent(EVENT_OUTRO_SOUL_BARRAGE, 5000, 0, PHASE_OUTRO); + return; + } + case NPC_VILE_SPIRIT: + { + summons.Summon(summon); + if (events.GetPhaseMask() & PHASE_MASK_FROSTMOURNE) + { + TeleportSpirit(summon); + return; + } + + summon->SetReactState(REACT_PASSIVE); + summon->SetSpeed(MOVE_FLIGHT, 0.5f); + summon->GetMotionMaster()->MoveRandom(10.0f); + summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(15000)); + return; + } + case NPC_STRANGULATE_VEHICLE: + summons.Summon(summon); + return; + default: + break; + } + + BossAI::JustSummoned(summon); + } + + void SummonedCreatureDies(Creature* summon, Unit* /*killer*/) + { + switch (summon->GetEntry()) + { + case NPC_SHAMBLING_HORROR: + case NPC_DRUDGE_GHOUL: + case NPC_ICE_SPHERE: + case NPC_VALKYR_SHADOWGUARD: + case NPC_RAGING_SPIRIT: + case NPC_VILE_SPIRIT: + case NPC_WICKED_SPIRIT: + summon->ToTempSummon()->SetTempSummonType(TEMPSUMMON_CORPSE_DESPAWN); + break; + default: + break; + } + } + + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) + { + if (spell->Id == SPELL_HARVESTED_SOUL && me->isInCombat() && !IsHeroic()) + Talk(SAY_LK_FROSTMOURNE_KILL); + } + + void SpellHitTarget(Unit* /*target*/, SpellInfo const* spell) + { + if (spell->Id == REMORSELESS_WINTER_1 || spell->Id == REMORSELESS_WINTER_2) + { + SendLightOverride(LIGHT_SNOWSTORM, 5000); + SendWeather(WEATHER_STATE_LIGHT_SNOW); + } + } + + void MovementInform(uint32 type, uint32 pointId) + { + if (type != POINT_MOTION_TYPE) + return; + + switch (pointId) + { + case POINT_LK_INTRO_1: + // schedule for next update cycle, current update must finalize movement + events.ScheduleEvent(EVENT_INTRO_MOVE_2, 1, 0, PHASE_INTRO); + break; + case POINT_LK_INTRO_2: + events.ScheduleEvent(EVENT_INTRO_MOVE_3, 1, 0, PHASE_INTRO); + break; + case POINT_LK_INTRO_3: + if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) + tirion->AI()->DoAction(ACTION_CONTINUE_INTRO); + events.ScheduleEvent(EVENT_INTRO_TALK_1, 9000, 0, PHASE_INTRO); + break; + case POINT_CENTER_1: + me->SetFacing(0.0f); + Talk(SAY_LK_REMORSELESS_WINTER); + SendMusicToPlayers(MUSIC_SPECIAL); + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); + DoCast(me, SPELL_REMORSELESS_WINTER_1); + events.DelayEvents(62500, EVENT_GROUP_BERSERK); // delay berserk timer, its not ticking during phase transitions + events.ScheduleEvent(EVENT_QUAKE, 62500, 0, PHASE_TRANSITION); + events.ScheduleEvent(EVENT_PAIN_AND_SUFFERING, 4000, 0, PHASE_TRANSITION); + events.ScheduleEvent(EVENT_SUMMON_ICE_SPHERE, 8000, 0, PHASE_TRANSITION); + events.ScheduleEvent(EVENT_SUMMON_RAGING_SPIRIT, 3000, 0, PHASE_TRANSITION); + events.ScheduleEvent(EVENT_SUMMON_VALKYR, 78000, 0, PHASE_TWO); + events.ScheduleEvent(EVENT_INFEST, 70000, 0, PHASE_TWO); + events.ScheduleEvent(EVENT_DEFILE, 97000, 0, PHASE_TWO); + events.ScheduleEvent(EVENT_SOUL_REAPER, 94000, 0, PHASE_TWO); + break; + case POINT_CENTER_2: + me->SetFacing(0.0f); + Talk(SAY_LK_REMORSELESS_WINTER); + SendMusicToPlayers(MUSIC_SPECIAL); + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); + DoCast(me, SPELL_REMORSELESS_WINTER_2); + summons.DespawnEntry(NPC_VALKYR_SHADOWGUARD); + events.DelayEvents(62500, EVENT_GROUP_BERSERK); // delay berserk timer, its not ticking during phase transitions + events.ScheduleEvent(EVENT_QUAKE_2, 62500, 0, PHASE_TRANSITION); + events.ScheduleEvent(EVENT_PAIN_AND_SUFFERING, 6000, 0, PHASE_TRANSITION); + events.ScheduleEvent(EVENT_SUMMON_ICE_SPHERE, 8000, 0, PHASE_TRANSITION); + events.ScheduleEvent(EVENT_SUMMON_RAGING_SPIRIT, 5000, 0, PHASE_TRANSITION); + events.ScheduleEvent(EVENT_DEFILE, 95500, 0, PHASE_THREE); + events.ScheduleEvent(EVENT_SOUL_REAPER, 99500, 0, PHASE_THREE); + events.ScheduleEvent(EVENT_VILE_SPIRITS, 79500, EVENT_GROUP_VILE_SPIRITS, PHASE_THREE); + events.ScheduleEvent(IsHeroic() ? EVENT_HARVEST_SOULS : EVENT_HARVEST_SOUL, 73500, 0, PHASE_THREE); + break; + case POINT_LK_OUTRO_1: + events.ScheduleEvent(EVENT_OUTRO_TALK_4, 1, 0, PHASE_OUTRO); + events.ScheduleEvent(EVENT_OUTRO_RAISE_DEAD, 1000, 0, PHASE_OUTRO); + events.ScheduleEvent(EVENT_OUTRO_TALK_5, 29000, 0, PHASE_OUTRO); + break; + case POINT_LK_OUTRO_2: + if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) + tirion->AI()->Talk(SAY_TIRION_OUTRO_2); + if (Creature* frostmourne = me->FindNearestCreature(NPC_FROSTMOURNE_TRIGGER, 50.0f)) + frostmourne->AI()->DoAction(ACTION_SUMMON_TERENAS); + break; + default: + break; + } + } + + void UpdateAI(uint32 const diff) + { + // check phase first to prevent updating victim and entering evade mode when not wanted + if (!(events.GetPhaseMask() & PHASE_MASK_NO_VICTIM)) + if (!UpdateVictim()) + return; + + events.Update(diff); + + // during Remorseless Winter phases The Lich King is channeling a spell, but we must continue casting other spells + if (me->HasUnitState(UNIT_STAT_CASTING) && !(events.GetPhaseMask() & PHASE_MASK_NO_CAST_CHECK)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_INTRO_MOVE_1: + me->SetSheath(SHEATH_STATE_MELEE); + me->RemoveAurasDueToSpell(SPELL_EMOTE_SIT_NO_SHEATH); + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->GetMotionMaster()->MovePoint(POINT_LK_INTRO_1, LichKingIntro[0]); + break; + case EVENT_INTRO_MOVE_2: + me->GetMotionMaster()->MovePoint(POINT_LK_INTRO_2, LichKingIntro[1]); + break; + case EVENT_INTRO_MOVE_3: + me->GetMotionMaster()->MovePoint(POINT_LK_INTRO_3, LichKingIntro[2]); + break; + case EVENT_INTRO_TALK_1: + Talk(SAY_LK_INTRO_2); + // for some reason blizz sends 2 emotes in row here so (we handle one in Talk) + me->HandleEmoteCommand(EMOTE_ONESHOT_TALK_NOSHEATHE); + events.ScheduleEvent(EVENT_EMOTE_CAST_SHOUT, 7000, 0, PHASE_INTRO); + events.ScheduleEvent(EVENT_INTRO_EMOTE_1, 13000, 0, PHASE_INTRO); + events.ScheduleEvent(EVENT_EMOTE_CAST_SHOUT, 18000, 0, PHASE_INTRO); + events.ScheduleEvent(EVENT_INTRO_CAST_FREEZE, 31000, 0, PHASE_INTRO); + break; + case EVENT_EMOTE_CAST_SHOUT: + DoCast(me, SPELL_EMOTE_SHOUT_NO_SHEATH, false); + break; + case EVENT_INTRO_EMOTE_1: + me->HandleEmoteCommand(EMOTE_ONESHOT_POINT_NOSHEATHE); + break; + case EVENT_INTRO_CAST_FREEZE: + Talk(SAY_LK_INTRO_3); + DoCastAOE(SPELL_ICE_LOCK, false); + events.ScheduleEvent(EVENT_FINISH_INTRO, 1000, 0, PHASE_INTRO); + break; + case EVENT_FINISH_INTRO: + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + me->SetReactState(REACT_AGGRESSIVE); + events.SetPhase(PHASE_ONE); + break; + case EVENT_SUMMON_SHAMBLING_HORROR: + DoCast(me, SPELL_SUMMON_SHAMBLING_HORROR); + SendMusicToPlayers(MUSIC_SPECIAL); + events.ScheduleEvent(EVENT_SUMMON_SHAMBLING_HORROR, 60000, 0, PHASE_ONE); + break; + case EVENT_SUMMON_DRUDGE_GHOUL: + DoCast(me, SPELL_SUMMON_DRUDGE_GHOULS); + events.ScheduleEvent(EVENT_SUMMON_DRUDGE_GHOUL, 30000, 0, PHASE_ONE); + break; + case EVENT_INFEST: + DoCast(me, SPELL_INFEST); + events.ScheduleEvent(EVENT_INFEST, urand(21000, 24000), 0, (events.GetPhaseMask() & PHASE_MASK_ONE) ? PHASE_ONE : PHASE_TWO); + break; + case EVENT_NECROTIC_PLAGUE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, NecroticPlagueTargetCheck(me, NECROTIC_PLAGUE_LK, NECROTIC_PLAGUE_PLR))) + { + Talk(EMOTE_NECROTIC_PLAGUE_WARNING, target->GetGUID()); + DoCast(target, SPELL_NECROTIC_PLAGUE); + } + events.ScheduleEvent(EVENT_NECROTIC_PLAGUE, urand(30000, 33000), 0, PHASE_ONE); + break; + case EVENT_SHADOW_TRAP: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, NonTankTargetSelector(me))) + DoCast(target, SPELL_SHADOW_TRAP); + events.ScheduleEvent(EVENT_SHADOW_TRAP, 15500, 0, PHASE_ONE); + break; + case EVENT_SOUL_REAPER: + DoCastVictim(SPELL_SOUL_REAPER); + events.ScheduleEvent(EVENT_SOUL_REAPER, urand(33000, 35000), 0, PHASE_TWO_THREE); + break; + case EVENT_DEFILE: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1, 0.0f, true, -SPELL_HARVEST_SOUL_VALKYR)) + { + Talk(EMOTE_DEFILE_WARNING); + DoCast(target, SPELL_DEFILE); + } + events.ScheduleEvent(EVENT_DEFILE, urand(32000, 35000), 0, PHASE_TWO_THREE); + break; + case EVENT_HARVEST_SOUL: + Talk(SAY_LK_HARVEST_SOUL); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, SpellTargetSelector(me, SPELL_HARVEST_SOUL))) + DoCast(target, SPELL_HARVEST_SOUL); + events.ScheduleEvent(EVENT_HARVEST_SOUL, 75000, 0, PHASE_THREE); + break; + case EVENT_PAIN_AND_SUFFERING: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + me->CastSpell(target, SPELL_PAIN_AND_SUFFERING, TRIGGERED_NONE); + events.ScheduleEvent(EVENT_PAIN_AND_SUFFERING, urand(1500, 4000), 0, PHASE_TRANSITION); + break; + case EVENT_SUMMON_ICE_SPHERE: + DoCastAOE(SPELL_SUMMON_ICE_SPHERE); + events.ScheduleEvent(EVENT_SUMMON_ICE_SPHERE, urand(7500, 8500), 0, PHASE_TRANSITION); + break; + case EVENT_SUMMON_RAGING_SPIRIT: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + me->CastSpell(target, SPELL_RAGING_SPIRIT, TRIGGERED_NONE); + events.ScheduleEvent(EVENT_SUMMON_RAGING_SPIRIT, urand(22000, 23000), 0, PHASE_TRANSITION); + break; + case EVENT_QUAKE: + events.SetPhase(PHASE_TWO); + me->ClearUnitState(UNIT_STAT_CASTING); // clear state to ensure check in DoCastAOE passes + DoCastAOE(SPELL_QUAKE); + SendMusicToPlayers(MUSIC_SPECIAL); + Talk(SAY_LK_QUAKE); + break; + case EVENT_QUAKE_2: + events.SetPhase(PHASE_THREE); + me->ClearUnitState(UNIT_STAT_CASTING); // clear state to ensure check in DoCastAOE passes + DoCastAOE(SPELL_QUAKE); + SendMusicToPlayers(MUSIC_SPECIAL); + Talk(SAY_LK_QUAKE); + break; + case EVENT_SUMMON_VALKYR: + SendMusicToPlayers(MUSIC_SPECIAL); + Talk(SAY_LK_SUMMON_VALKYR); + DoCastAOE(SUMMON_VALKYR); + events.ScheduleEvent(EVENT_SUMMON_VALKYR, urand(45000, 50000), 0, PHASE_TWO); + break; + case EVENT_START_ATTACK: + me->SetReactState(REACT_AGGRESSIVE); + if (events.GetPhaseMask() & PHASE_MASK_FROSTMOURNE) + events.SetPhase(PHASE_THREE); + break; + case EVENT_VILE_SPIRITS: + SendMusicToPlayers(MUSIC_SPECIAL); + DoCastAOE(SPELL_VILE_SPIRITS); + events.ScheduleEvent(EVENT_VILE_SPIRITS, urand(35000, 40000), EVENT_GROUP_VILE_SPIRITS, PHASE_THREE); + break; + case EVENT_WICKED_SPIRITS: + DoCastAOE(SPELL_VILE_SPIRITS); + events.ScheduleEvent(EVENT_WICKED_SPIRITS, urand(35000, 40000), 0, PHASE_FROSTMOURNE); + break; + case EVENT_HARVEST_SOULS: + Talk(SAY_LK_HARVEST_SOUL); + DoCastAOE(SPELL_HARVEST_SOULS); + events.ScheduleEvent(EVENT_HARVEST_SOULS, urand(100000, 110000), 0, PHASE_THREE); + events.SetPhase(PHASE_FROSTMOURNE); // will stop running UpdateVictim (no evading) + me->SetReactState(REACT_PASSIVE); + me->AttackStop(); + events.ScheduleEvent(EVENT_WICKED_SPIRITS, events.GetNextEventTime(EVENT_VILE_SPIRITS) - events.GetTimer(), 0, PHASE_FROSTMOURNE); + events.DelayEvents(50000, EVENT_GROUP_VILE_SPIRITS); + events.RescheduleEvent(EVENT_DEFILE, 50000, 0, PHASE_THREE); + events.RescheduleEvent(EVENT_SOUL_REAPER, urand(57000, 62000), 0, PHASE_THREE); + events.ScheduleEvent(EVENT_START_ATTACK, 49000); + events.ScheduleEvent(EVENT_FROSTMOURNE_HEROIC, 6500); + break; + case EVENT_FROSTMOURNE_HEROIC: + if (TempSummon* terenas = me->GetMap()->SummonCreature(NPC_TERENAS_MENETHIL_FROSTMOURNE_H, TerenasSpawnHeroic, NULL, 50000)) + { + terenas->AI()->DoAction(ACTION_FROSTMOURNE_INTRO); + std::list<Creature*> triggers; + GetCreatureListWithEntryInGrid(triggers, terenas, NPC_WORLD_TRIGGER_INFINITE_AOI, 100.0f); + if (!triggers.empty()) + { + triggers.sort(Trinity::ObjectDistanceOrderPred(terenas, true)); + Unit* spawner = triggers.front(); + spawner->CastSpell(spawner, SPELL_SUMMON_SPIRIT_BOMB_1, true); // summons bombs randomly + spawner->CastSpell(spawner, SPELL_SUMMON_SPIRIT_BOMB_2, true); // summons bombs on players + } + + for (SummonList::iterator i = summons.begin(); i != summons.end(); ++i) + { + Creature* summon = ObjectAccessor::GetCreature(*me, *i); + if (summon && summon->GetEntry() == NPC_VILE_SPIRIT) + TeleportSpirit(summon); + } + } + break; + case EVENT_OUTRO_TALK_1: + Talk(SAY_LK_OUTRO_1); + DoCastAOE(SPELL_FURY_OF_FROSTMOURNE_NO_REZ, true); + break; + case EVENT_OUTRO_TALK_2: + Talk(SAY_LK_OUTRO_2); + DoCastAOE(SPELL_EMOTE_QUESTION_NO_SHEATH); + break; + case EVENT_OUTRO_EMOTE_TALK: + me->HandleEmoteCommand(EMOTE_ONESHOT_TALK_NOSHEATHE); + break; + case EVENT_OUTRO_TALK_3: + if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) + me->SetFacing(0.0f, tirion); + Talk(SAY_LK_OUTRO_3); + break; + case EVENT_OUTRO_MOVE_CENTER: + me->GetMotionMaster()->MovePoint(POINT_LK_OUTRO_1, CenterPosition); + break; + case EVENT_OUTRO_TALK_4: + me->SetFacing(0.01745329f); + Talk(SAY_LK_OUTRO_4); + break; + case EVENT_OUTRO_RAISE_DEAD: + DoCastAOE(SPELL_RAISE_DEAD); + me->ClearUnitState(UNIT_STAT_CASTING); + SendMusicToPlayers(MUSIC_FINAL); + break; + case EVENT_OUTRO_TALK_5: + Talk(SAY_LK_OUTRO_5); + if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) + tirion->AI()->DoAction(ACTION_OUTRO); + break; + case EVENT_OUTRO_TALK_6: + Talk(SAY_LK_OUTRO_6); + if (Creature* tirion = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) + tirion->SetFacing(0.0f, me); + me->ClearUnitState(UNIT_STAT_CASTING); + DoCastAOE(SPELL_SUMMON_BROKEN_FROSTMOURNE_3); + SetEquipmentSlots(false, EQUIP_UNEQUIP); + break; + case EVENT_OUTRO_SOUL_BARRAGE: + DoCastAOE(SPELL_SOUL_BARRAGE); + sCreatureTextMgr->SendSound(me, SOUND_PAIN, CHAT_MSG_MONSTER_YELL, 0, TEXT_RANGE_NORMAL, TEAM_OTHER, false); + // set flight + me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); + me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, 0x03); + me->GetMotionMaster()->MovePoint(POINT_LK_OUTRO_2, OutroFlying); + break; + case EVENT_OUTRO_TALK_7: + Talk(SAY_LK_OUTRO_7); + break; + case EVENT_OUTRO_TALK_8: + Talk(SAY_LK_OUTRO_8); + break; + case EVENT_BERSERK: + Talk(SAY_LK_BERSERK); + DoCast(me, SPELL_BERSERK2); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } + + private: + + void TeleportSpirit(Creature* summon) + { + float dist = me->GetObjectSize() + (15.0f - me->GetObjectSize()) * float(rand_norm()); + float angle = float(rand_norm()) * float(2.0f * M_PI); + Position dest = TerenasSpawnHeroic; + me->MovePosition(dest, dist, angle); + dest.m_positionZ += 15.0f; + summon->UpdateEntry(NPC_WICKED_SPIRIT); + summon->SetReactState(REACT_PASSIVE); + summon->NearTeleportTo(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), dest.GetOrientation()); + summon->SetSpeed(MOVE_FLIGHT, 0.5f); + summon->m_Events.KillAllEvents(true); + summon->m_Events.AddEvent(new VileSpiritActivateEvent(summon), summon->m_Events.CalculateTime(1000)); + } + + void SendMusicToPlayers(uint32 musicId) const + { + WorldPacket data(SMSG_PLAY_MUSIC, 4); + data << uint32(musicId); + SendPacketToPlayers(&data); + } + + void SendLightOverride(uint32 overrideId, uint32 fadeInTime) const + { + WorldPacket data(SMSG_OVERRIDE_LIGHT, 12); + data << uint32(2488); // Light.dbc entry (map default) + data << uint32(overrideId); // Light.dbc entry (override) + data << uint32(fadeInTime); + SendPacketToPlayers(&data); + } + + void SendWeather(WeatherState weather) const + { + WorldPacket data(SMSG_WEATHER, 9); + data << uint32(weather); + data << float(0.5f); + data << uint8(0); + SendPacketToPlayers(&data); + } + + // Send packet to all players in The Frozen Throne + void SendPacketToPlayers(WorldPacket const* data) const + { + Map::PlayerList const& players = me->GetMap()->GetPlayers(); + if (!players.isEmpty()) + for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) + if (Player* player = itr->getSource()) + if (player->GetAreaId() == AREA_THE_FROZEN_THRONE) + player->GetSession()->SendPacket(data); + } + + uint32 _necroticPlagueStack; + uint32 _vileSpiritExplosions; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI<boss_the_lich_kingAI>(creature); + } +}; + +class npc_tirion_fordring_tft : public CreatureScript +{ + public: + npc_tirion_fordring_tft() : CreatureScript("npc_tirion_fordring_tft") { } + + struct npc_tirion_fordringAI : public ScriptedAI + { + npc_tirion_fordringAI(Creature* creature) : ScriptedAI(creature), + _instance(creature->GetInstanceScript()) + { + } + + void Reset() + { + _events.Reset(); + if (_instance->GetBossState(DATA_THE_LICH_KING) == DONE) + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; + + switch (id) + { + case POINT_TIRION_INTRO: + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_READY2H); + if (Creature* theLichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + theLichKing->AI()->DoAction(ACTION_START_ENCOUNTER); + break; + case POINT_TIRION_OUTRO_1: + _events.ScheduleEvent(EVENT_OUTRO_JUMP, 1, 0, PHASE_OUTRO); + break; + } + } + + void DoAction(int32 const action) + { + switch (action) + { + case ACTION_CONTINUE_INTRO: + Talk(SAY_TIRION_INTRO_1); + _events.ScheduleEvent(EVENT_INTRO_TALK_1, 34000, 0, PHASE_INTRO); + break; + case ACTION_OUTRO: + _events.SetPhase(PHASE_OUTRO); + _events.ScheduleEvent(EVENT_OUTRO_TALK_1, 7000, 0, PHASE_OUTRO); + _events.ScheduleEvent(EVENT_OUTRO_BLESS, 18000, 0, PHASE_OUTRO); + _events.ScheduleEvent(EVENT_OUTRO_REMOVE_ICE, 23000, 0, PHASE_OUTRO); + _events.ScheduleEvent(EVENT_OUTRO_MOVE_1, 25000, 0, PHASE_OUTRO); + break; + } + } + + void SpellHit(Unit* /*caster*/, SpellInfo const* spell) + { + if (spell->Id == SPELL_ICE_LOCK) + me->SetFacing(3.085098f); + else if (spell->Id == SPELL_BROKEN_FROSTMOURNE_KNOCK) + SetEquipmentSlots(true); // remove glow on ashbringer + } + + void sGossipSelect(Player* player, uint32 sender, uint32 action) + { + if (me->GetCreatureInfo()->GossipMenuId == sender && !action) + { + _events.SetPhase(PHASE_INTRO); + me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->GetMotionMaster()->MovePoint(POINT_TIRION_INTRO, TirionIntro); + } + } + + void JustReachedHome() + { + me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_ONESHOT_NONE); + + if (_instance->GetBossState(DATA_THE_LICH_KING) == DONE) + return; + + me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); + } + + void UpdateAI(uint32 const diff) + { + if (!UpdateVictim() && !(_events.GetPhaseMask() & (PHASE_MASK_INTRO | PHASE_MASK_OUTRO))) + return; + + _events.Update(diff); + + if (me->HasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_INTRO_TALK_1: + Talk(SAY_TIRION_INTRO_2); + _events.ScheduleEvent(EVENT_INTRO_EMOTE_1, 2000, 0, PHASE_INTRO); + _events.ScheduleEvent(EVENT_INTRO_CHARGE, 5000, 0, PHASE_INTRO); + break; + case EVENT_INTRO_EMOTE_1: + me->HandleEmoteCommand(EMOTE_ONESHOT_POINT_NOSHEATHE); + break; + case EVENT_INTRO_CHARGE: + me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + me->GetMotionMaster()->MovePoint(POINT_TIRION_CHARGE, TirionCharge); + break; + case EVENT_OUTRO_TALK_1: + Talk(SAY_TIRION_OUTRO_1); + break; + case EVENT_OUTRO_BLESS: + DoCast(me, SPELL_LIGHTS_BLESSING); + break; + case EVENT_OUTRO_REMOVE_ICE: + me->RemoveAurasDueToSpell(SPELL_ICE_LOCK); + SetEquipmentSlots(false, EQUIP_ASHBRINGER_GLOWING); + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + { + me->SetFacing(0.0f, lichKing); + lichKing->AI()->DoAction(ACTION_PLAY_MUSIC); + } + break; + case EVENT_OUTRO_MOVE_1: + me->GetMotionMaster()->MovePoint(POINT_TIRION_OUTRO_1, OutroPosition1); + break; + case EVENT_OUTRO_JUMP: + DoCastAOE(SPELL_JUMP); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } + + private: + EventMap _events; + InstanceScript* _instance; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI<npc_tirion_fordringAI>(creature); + } +}; + +class npc_shambling_horror_icc : public CreatureScript +{ + public: + npc_shambling_horror_icc() : CreatureScript("npc_shambling_horror_icc") { } + + struct npc_shambling_horror_iccAI : public ScriptedAI + { + npc_shambling_horror_iccAI(Creature* creature) : ScriptedAI(creature) + { + _frenzied = false; + } + + void Reset() + { + _events.Reset(); + _events.ScheduleEvent(EVENT_SHOCKWAVE, urand(20000, 25000)); + _events.ScheduleEvent(EVENT_ENRAGE, urand(11000, 14000)); + } + + void DamageTaken(Unit* /*attacker*/, uint32& damage) + { + if (IsHeroic() && me->HealthBelowPctDamaged(20, damage)) + { + _frenzied = true; + DoCast(me, SPELL_FRENZY, true); + } + } + + void UpdateAI(uint32 const diff) + { + if (!UpdateVictim()) + return; + + _events.Update(diff); + + if (me->HasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_SHOCKWAVE: + DoCast(me, SPELL_SHOCKWAVE); + _events.ScheduleEvent(EVENT_SHOCKWAVE, urand(20000, 25000)); + break; + case EVENT_ENRAGE: + DoCast(me, SPELL_ENRAGE); + _events.ScheduleEvent(EVENT_ENRAGE, urand(20000, 25000)); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } + + private: + EventMap _events; + bool _frenzied; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI<npc_shambling_horror_iccAI>(creature); + } +}; + +class npc_raging_spirit : public CreatureScript +{ + public: + npc_raging_spirit() : CreatureScript("npc_raging_spirit") { } + + struct npc_raging_spiritAI : public ScriptedAI + { + npc_raging_spiritAI(Creature* creature) : ScriptedAI(creature), + _instance(creature->GetInstanceScript()) + { + } + + void Reset() + { + _events.Reset(); + _events.ScheduleEvent(EVENT_SOUL_SHRIEK, urand(12000, 15000)); + DoCast(me, SPELL_PLAGUE_AVOIDANCE, true); + DoCast(me, SPELL_RAGING_SPIRIT_VISUAL, true); + if (TempSummon* summon = me->ToTempSummon()) + if (Unit* summoner = summon->GetSummoner()) + summoner->CastSpell(me, SPELL_RAGING_SPIRIT_VISUAL_CLONE, true); + DoCast(me, SPELL_BOSS_HITTIN_YA, true); + } + + void IsSummonedBy(Unit* summoner) + { + // player is the spellcaster so register summon manually + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + lichKing->AI()->JustSummoned(me); + } + + void JustDied(Unit* killer) + { + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + lichKing->AI()->SummonedCreatureDespawn(me); + if (TempSummon* summon = me->ToTempSummon()) + summon->SetTempSummonType(TEMPSUMMON_CORPSE_DESPAWN); + } + + void UpdateAI(uint32 const diff) + { + if (!UpdateVictim()) + return; + + _events.Update(diff); + + if (me->HasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_SOUL_SHRIEK: + DoCastAOE(SPELL_SOUL_SHRIEK); + _events.ScheduleEvent(EVENT_SOUL_SHRIEK, urand(12000, 15000)); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } + + private: + EventMap _events; + InstanceScript* _instance; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI<npc_raging_spiritAI>(creature); + } +}; + +class npc_valkyr_shadowguard : public CreatureScript +{ + public: + npc_valkyr_shadowguard() : CreatureScript("npc_valkyr_shadowguard") { } + + struct npc_valkyr_shadowguardAI : public ScriptedAI + { + npc_valkyr_shadowguardAI(Creature* creature) : ScriptedAI(creature), + _grabbedPlayer(0), _instance(creature->GetInstanceScript()) + { + } + + void Reset() + { + _events.Reset(); + me->SetReactState(REACT_PASSIVE); + me->SetSpeed(MOVE_FLIGHT, 0.642857f, true); + } + + void IsSummonedBy(Unit* /*summoner*/) + { + _events.Reset(); + _events.ScheduleEvent(EVENT_GRAB_PLAYER, 2500); + } + + void DamageTaken(Unit* /*attacker*/, uint32& damage) + { + if (!IsHeroic()) + return; + + if (!me->HasAuraType(SPELL_AURA_CONTROL_VEHICLE)) + return; + + if (me->HealthBelowPctDamaged(50, damage)) + { + _events.Reset(); + DoCastAOE(SPELL_EJECT_ALL_PASSENGERS); + me->GetMotionMaster()->MoveTargetedHome(); + me->ClearUnitState(UNIT_STAT_EVADE); + } + } + + void JustReachedHome() + { + // schedule siphon life event (heroic only) + DoZoneInCombat(); + _events.Reset(); + _events.ScheduleEvent(EVENT_LIFE_SIPHON, 2000); + } + + void AttackStart(Unit* /*target*/) + { + } + + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE) + return; + + switch (id) + { + case POINT_DROP_PLAYER: + DoCastAOE(SPELL_EJECT_ALL_PASSENGERS); + me->DespawnOrUnsummon(1000); + break; + case POINT_CHARGE: + if (Player* target = ObjectAccessor::GetPlayer(*me, _grabbedPlayer)) + { + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (GameObject* platform = ObjectAccessor::GetGameObject(*me, _instance->GetData64(DATA_ARTHAS_PLATFORM))) + { + std::list<Creature*> triggers; + GetCreatureListWithEntryInGrid(triggers, me, NPC_WORLD_TRIGGER, 150.0f); + triggers.remove_if(HeightDifferenceCheck(platform, 5.0f, true)); + if (triggers.empty()) + return; + + triggers.sort(Trinity::ObjectDistanceOrderPred(me)); + DoCast(target, SPELL_VALKYR_CARRY); + _dropPoint.Relocate(triggers.front()); + _events.ScheduleEvent(EVENT_MOVE_TO_DROP_POS, 1500); + + } + } + else + me->DespawnOrUnsummon(); + break; + default: + break; + } + } + + void SetGUID(uint64 guid, int32 /* = 0*/) + { + _grabbedPlayer = guid; + _events.Reset(); + } + + void UpdateAI(uint32 const diff) + { + if (!UpdateVictim()) + return; + + _events.Update(diff); + + if (me->HasUnitState(UNIT_STAT_CASTING)) + return; + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_GRAB_PLAYER: + DoCastAOE(SPELL_VALKYR_TARGET_SEARCH); + _events.ScheduleEvent(EVENT_GRAB_PLAYER, 2000); + break; + case EVENT_MOVE_TO_DROP_POS: + me->GetMotionMaster()->MovePoint(POINT_DROP_PLAYER, _dropPoint); + break; + case EVENT_LIFE_SIPHON: + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) + DoCast(target, SPELL_LIFE_SIPHON); + _events.ScheduleEvent(EVENT_LIFE_SIPHON, 2500); + break; + default: + break; + } + } + + // no melee attacks + } + + private: + EventMap _events; + Position _dropPoint; + uint64 _grabbedPlayer; + InstanceScript* _instance; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI<npc_valkyr_shadowguardAI>(creature); + } +}; + +class npc_strangulate_vehicle : public CreatureScript +{ + public: + npc_strangulate_vehicle() : CreatureScript("npc_strangulate_vehicle") { } + + struct npc_strangulate_vehicleAI : public ScriptedAI + { + npc_strangulate_vehicleAI(Creature* creature) : ScriptedAI(creature), + _instance(creature->GetInstanceScript()) + { + } + + void IsSummonedBy(Unit* summoner) + { + me->SetFacing(0.0f, summoner); + DoCast(summoner, SPELL_HARVEST_SOUL_VEHICLE); + _events.Reset(); + _events.ScheduleEvent(EVENT_MOVE_TO_LICH_KING, 2000); + _events.ScheduleEvent(EVENT_TELEPORT, 6000); + + // this will let us easily access all creatures of this entry on heroic mode when its time to teleport back + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + lichKing->AI()->JustSummoned(me); + } + + void DoAction(int32 const action) + { + if (action != ACTION_TELEPORT_BACK) + return; + + if (TempSummon* summ = me->ToTempSummon()) + if (Unit* summoner = summ->GetSummoner()) + DoCast(summoner, SPELL_HARVEST_SOUL_TELEPORT_BACK); + + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + lichKing->AI()->SummonedCreatureDespawn(me); + } + + void UpdateAI(uint32 const diff) + { + UpdateVictim(); + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_TELEPORT: + me->GetMotionMaster()->MoveIdle(MOTION_SLOT_ACTIVE); + if (TempSummon* summ = me->ToTempSummon()) + { + if (Unit* summoner = summ->GetSummoner()) + { + summoner->CastSpell((Unit*)NULL, SPELL_HARVEST_SOUL_VISUAL, true); + summoner->ExitVehicle(summoner); + if (!IsHeroic()) + summoner->CastSpell(summoner, SPELL_HARVEST_SOUL_TELEPORT, true); + else + { + summoner->CastSpell(summoner, SPELL_HARVEST_SOULS_TELEPORT, true); + summoner->RemoveAurasDueToSpell(HARVEST_SOUL, 0, 0, AURA_REMOVE_BY_EXPIRE); + } + } + } + + _events.ScheduleEvent(EVENT_DESPAWN_SELF, 65000); + break; + case EVENT_MOVE_TO_LICH_KING: + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + { + if (me->GetExactDist(lichKing) > 10.0f) + { + Position pos; + lichKing->GetNearPosition(pos, float(rand_norm()) * 5.0f + 7.5f, lichKing->GetAngle(me)); + me->GetMotionMaster()->MovePoint(0, pos); + } + } + break; + case EVENT_DESPAWN_SELF: + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + lichKing->AI()->SummonedCreatureDespawn(me); + me->DespawnOrUnsummon(1); + break; + default: + break; + } + } + } + + private: + EventMap _events; + InstanceScript* _instance; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI<npc_strangulate_vehicleAI>(creature); + } +}; + +class npc_terenas_menethil : public CreatureScript +{ + public: + npc_terenas_menethil() : CreatureScript("npc_terenas_menethil") { } + + struct npc_terenas_menethilAI : public ScriptedAI + { + npc_terenas_menethilAI(Creature* creature) : ScriptedAI(creature), + _instance(creature->GetInstanceScript()) + { + } + + bool CanAIAttack(Unit const* target) const + { + return target->GetEntry() != NPC_THE_LICH_KING; + } + + void DoAction(int32 const action) + { + switch (action) + { + case ACTION_FROSTMOURNE_INTRO: + me->setActive(true); + if (!IsHeroic()) + me->SetHealth(me->GetMaxHealth() / 2); + DoCast(me, SPELL_LIGHTS_FAVOR); + _events.Reset(); + _events.ScheduleEvent(EVENT_FROSTMOURNE_TALK_1, 2000, PHASE_FROSTMOURNE); + _events.ScheduleEvent(EVENT_FROSTMOURNE_TALK_2, 11000, PHASE_FROSTMOURNE); + if (!IsHeroic()) + { + _events.ScheduleEvent(EVENT_DESTROY_SOUL, 60000, PHASE_FROSTMOURNE); + _events.ScheduleEvent(EVENT_FROSTMOURNE_TALK_3, 25000); + } + break; + case ACTION_TELEPORT_BACK: + me->CastSpell((Unit*)NULL, SPELL_RESTORE_SOUL, TRIGGERED_NONE); + me->DespawnOrUnsummon(3000); + break; + default: + break; + } + } + + void EnterEvadeMode() + { + // no running back home + if (!me->isAlive()) + return; + + me->DeleteThreatList(); + me->CombatStop(false); + } + + void DamageTaken(Unit* /*attacker*/, uint32& damage) + { + if (damage >= me->GetHealth()) + { + damage = me->GetHealth() - 1; + if (!me->HasAura(SPELL_TERENAS_LOSES_INSIDE) && !IsHeroic()) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + DoCast(SPELL_TERENAS_LOSES_INSIDE); + _events.ScheduleEvent(EVENT_TELEPORT_BACK, 1000); + if (Creature* warden = me->FindNearestCreature(NPC_SPIRIT_WARDEN, 20.0f)) + { + warden->CastSpell((Unit*)NULL, SPELL_DESTROY_SOUL, TRIGGERED_NONE); + warden->DespawnOrUnsummon(2000); + } + + me->DespawnOrUnsummon(2000); + } + } + } + + void IsSummonedBy(Unit* /*summoner*/) + { + _events.Reset(); + _events.SetPhase(PHASE_OUTRO); + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + me->SetFacing(0.0f, lichKing); + + _events.ScheduleEvent(EVENT_OUTRO_TERENAS_TALK_1, 2000, 0, PHASE_OUTRO); + _events.ScheduleEvent(EVENT_OUTRO_TERENAS_TALK_2, 14000, 0, PHASE_OUTRO); + } + + void UpdateAI(uint32 const diff) + { + UpdateVictim(); + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_FROSTMOURNE_TALK_1: + Talk(SAY_TERENAS_INTRO_1); + if (IsHeroic()) + DoCastAOE(SPELL_RESTORE_SOULS); + break; + case EVENT_FROSTMOURNE_TALK_2: + Talk(SAY_TERENAS_INTRO_2); + break; + case EVENT_FROSTMOURNE_TALK_3: + Talk(SAY_TERENAS_INTRO_3); + break; + case EVENT_OUTRO_TERENAS_TALK_1: + Talk(SAY_TERENAS_OUTRO_1); + break; + case EVENT_OUTRO_TERENAS_TALK_2: + Talk(SAY_TERENAS_OUTRO_2); + DoCastAOE(SPELL_MASS_RESURRECTION); + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + { + lichKing->AI()->DoAction(ACTION_FINISH_OUTRO); + lichKing->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE); + if (Creature* tirion = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_HIGHLORD_TIRION_FORDRING))) + tirion->AI()->AttackStart(lichKing); + } + break; + case EVENT_DESTROY_SOUL: + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + if (Creature* warden = me->FindNearestCreature(NPC_SPIRIT_WARDEN, 20.0f)) + warden->CastSpell((Unit*)NULL, SPELL_DESTROY_SOUL, TRIGGERED_NONE); + DoCast(SPELL_TERENAS_LOSES_INSIDE); + _events.ScheduleEvent(EVENT_TELEPORT_BACK, 1000); + break; + case EVENT_TELEPORT_BACK: + if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_THE_LICH_KING))) + lichKing->AI()->DoAction(ACTION_TELEPORT_BACK); + break; + default: + break; + } + } + + // fighting Spirit Warden + if (me->isInCombat()) + DoMeleeAttackIfReady(); + } + + private: + EventMap _events; + InstanceScript* _instance; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI<npc_terenas_menethilAI>(creature); + } +}; + +class npc_spirit_warden : public CreatureScript +{ + public: + npc_spirit_warden() : CreatureScript("npc_spirit_warden") { } + + struct npc_spirit_wardenAI : public ScriptedAI + { + npc_spirit_wardenAI(Creature* creature) : ScriptedAI(creature), + _instance(creature->GetInstanceScript()) + { + } + + void Reset() + { + _events.Reset(); + _events.ScheduleEvent(EVENT_SOUL_RIP, urand(12000, 15000)); + DoCast(SPELL_DARK_HUNGER); + } + + void JustDied(Unit* /*killer*/) + { + if (Creature* terenas = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_TERENAS_MENETHIL))) + terenas->AI()->DoAction(ACTION_TELEPORT_BACK); + } + + void UpdateAI(uint32 const diff) + { + if (!UpdateVictim()) + return; + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_SOUL_RIP: + DoCastVictim(SPELL_SOUL_RIP); + _events.ScheduleEvent(EVENT_SOUL_RIP, urand(23000, 27000)); + break; + default: + break; + } + } + + DoMeleeAttackIfReady(); + } + + private: + EventMap _events; + InstanceScript* _instance; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI<npc_spirit_wardenAI>(creature); + } +}; + +class npc_spirit_bomb : public CreatureScript +{ + public: + npc_spirit_bomb() : CreatureScript("npc_spirit_bomb") { } + + struct npc_spirit_bombAI : public CreatureAI + { + npc_spirit_bombAI(Creature* creature) : CreatureAI(creature) + { + } + + void IsSummonedBy(Unit* summoner) + { + float destX, destY, destZ; + me->GetPosition(destX, destY); + destZ = 1055.0f; // approximation, gets more precise later + me->UpdateGroundPositionZ(destX, destY, destZ); + me->GetMotionMaster()->MovePoint(POINT_GROUND, destX, destY, destZ); + } + + void MovementInform(uint32 type, uint32 point) + { + if (type != POINT_MOTION_TYPE || point != POINT_GROUND) + return; + + me->RemoveAllAuras(); + DoCastAOE(SPELL_EXPLOSION); + me->DespawnOrUnsummon(1000); + } + + void AttackStart(Unit* /*victim*/) + { + } + + void UpdateAI(uint32 const diff) + { + UpdateVictim(); + // no melee attacks + } + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI<npc_spirit_bombAI>(creature); + } +}; + +class npc_broken_frostmourne : public CreatureScript +{ + public: + npc_broken_frostmourne() : CreatureScript("npc_broken_frostmourne") { } + + struct npc_broken_frostmourneAI : public CreatureAI + { + npc_broken_frostmourneAI(Creature* creature) : CreatureAI(creature) + { + } + + void Reset() + { + _events.Reset(); + } + + void IsSummonedBy(Unit* summoner) + { + _events.SetPhase(PHASE_OUTRO); + _events.ScheduleEvent(EVENT_OUTRO_KNOCK_BACK, 3000, 0, PHASE_OUTRO); + } + + void DoAction(int32 const action) + { + if (action == ACTION_SUMMON_TERENAS) + _events.ScheduleEvent(EVENT_OUTRO_SUMMON_TERENAS, 6000, 0, PHASE_OUTRO); + } + + void UpdateAI(uint32 const diff) + { + UpdateVictim(); + + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_OUTRO_KNOCK_BACK: + DoCastAOE(SPELL_BROKEN_FROSTMOURNE_KNOCK); + break; + case EVENT_OUTRO_SUMMON_TERENAS: + DoCastAOE(SPELL_SUMMON_TERENAS); + break; + default: + break; + } + } + + // no melee attacks + } + + private: + EventMap _events; + }; + + CreatureAI* GetAI(Creature* creature) const + { + return GetIcecrownCitadelAI<npc_broken_frostmourneAI>(creature); + } +}; + +class spell_the_lich_king_infest : public SpellScriptLoader +{ + public: + spell_the_lich_king_infest() : SpellScriptLoader("spell_the_lich_king_infest") { } + + class spell_the_lich_king_infest_AuraScript : public AuraScript + { + PrepareAuraScript(spell_the_lich_king_infest_AuraScript); + + void OnPeriodic(AuraEffect const* /*aurEff*/) + { + if (GetUnitOwner()->HealthAbovePct(90)) + { + PreventDefaultAction(); + Remove(AURA_REMOVE_BY_ENEMY_SPELL); + } + } + + void OnUpdate(AuraEffect* aurEff) + { + // multiply, starting from 2nd tick + if (aurEff->GetTickNumber() == 1) + return; + + aurEff->SetAmount(int32(aurEff->GetAmount() * 1.15f)); + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_the_lich_king_infest_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); + OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_the_lich_king_infest_AuraScript::OnUpdate, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_the_lich_king_infest_AuraScript(); + } +}; + +class spell_the_lich_king_necrotic_plague : public SpellScriptLoader +{ + public: + spell_the_lich_king_necrotic_plague() : SpellScriptLoader("spell_the_lich_king_necrotic_plague") { } + + class spell_the_lich_king_necrotic_plague_AuraScript : public AuraScript + { + PrepareAuraScript(spell_the_lich_king_necrotic_plague_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_NECROTIC_PLAGUE_JUMP)) + return false; + return true; + } + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + Unit* newCaster = GetTarget(); + switch (GetTargetApplication()->GetRemoveMode()) + { + case AURA_REMOVE_BY_ENEMY_SPELL: + case AURA_REMOVE_BY_EXPIRE: + case AURA_REMOVE_BY_DEATH: + break; + default: + return; + } + + CustomSpellValues values; + //values.AddSpellMod(SPELLVALUE_AURA_STACK, 2); + values.AddSpellMod(SPELLVALUE_MAX_TARGETS, 1); + GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, true, NULL, NULL, GetCasterGUID()); + if (Unit* caster = GetCaster()) + caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true); + } + + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_the_lich_king_necrotic_plague_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_the_lich_king_necrotic_plague_AuraScript(); + } +}; + +class spell_the_lich_king_necrotic_plague_jump : public SpellScriptLoader +{ + public: + spell_the_lich_king_necrotic_plague_jump() : SpellScriptLoader("spell_the_lich_king_necrotic_plague_jump") { } + + class spell_the_lich_king_necrotic_plague_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_necrotic_plague_SpellScript); + + bool Load() + { + _hadAura = false; + return true; + } + + void SelectTarget(std::list<Unit*>& targets) + { + targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster())); + if (targets.size() < 2) + return; + + targets.resize(1); + } + + void CheckAura() + { + if (GetHitUnit()->HasAura(GetSpellInfo()->Id)) + _hadAura = true; + } + + void AddMissingStack() + { + if (!_hadAura && GetSpellValue()->EffectBasePoints[EFFECT_1] != AURA_REMOVE_BY_ENEMY_SPELL) + GetHitAura()->ModStackAmount(1); + } + + void Register() + { + BeforeHit += SpellHitFn(spell_the_lich_king_necrotic_plague_SpellScript::CheckAura); + OnHit += SpellHitFn(spell_the_lich_king_necrotic_plague_SpellScript::AddMissingStack); + } + + bool _hadAura; + }; + + class spell_the_lich_king_necrotic_plague_AuraScript : public AuraScript + { + PrepareAuraScript(spell_the_lich_king_necrotic_plague_AuraScript); + + bool Load() + { + _lastAmount = 0; + return true; + } + + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + if (Unit* caster = GetCaster()) + caster->GetAI()->SetData(DATA_PLAGUE_STACK, GetStackAmount()); + } + + void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + _lastAmount = aurEff->GetAmount(); + switch (GetTargetApplication()->GetRemoveMode()) + { + case AURA_REMOVE_BY_EXPIRE: + case AURA_REMOVE_BY_DEATH: + break; + default: + return; + } + + CustomSpellValues values; + values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount()); + GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, true, NULL, NULL, GetCasterGUID()); + if (Unit* caster = GetCaster()) + caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true); + } + + void OnDispel(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + _lastAmount = aurEff->GetAmount(); + } + + void AfterDispel(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + { + // this means the stack increased so don't process as if dispelled + if (aurEff->GetAmount() > _lastAmount) + return; + + CustomSpellValues values; + values.AddSpellMod(SPELLVALUE_AURA_STACK, GetStackAmount()); + values.AddSpellMod(SPELLVALUE_BASE_POINT1, AURA_REMOVE_BY_ENEMY_SPELL); // add as marker (spell has no effect 1) + GetTarget()->CastCustomSpell(SPELL_NECROTIC_PLAGUE_JUMP, values, NULL, true, NULL, NULL, GetCasterGUID()); + if (Unit* caster = GetCaster()) + caster->CastSpell(caster, SPELL_PLAGUE_SIPHON, true); + + Remove(AURA_REMOVE_BY_ENEMY_SPELL); + } + + void Register() + { + OnEffectApply += AuraEffectApplyFn(spell_the_lich_king_necrotic_plague_AuraScript::OnApply, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK); + AfterEffectRemove += AuraEffectRemoveFn(spell_the_lich_king_necrotic_plague_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_the_lich_king_necrotic_plague_AuraScript::OnDispel, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAPPLY); + AfterEffectApply += AuraEffectRemoveFn(spell_the_lich_king_necrotic_plague_AuraScript::AfterDispel, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAPPLY); + } + + int32 _lastAmount; + }; + + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_necrotic_plague_SpellScript(); + } + + AuraScript* GetAuraScript() const + { + return new spell_the_lich_king_necrotic_plague_AuraScript(); + } +}; + +class spell_the_lich_king_shadow_trap_visual : public SpellScriptLoader +{ + public: + spell_the_lich_king_shadow_trap_visual() : SpellScriptLoader("spell_the_lich_king_shadow_trap_visual") { } + + class spell_the_lich_king_shadow_trap_visual_AuraScript : public AuraScript + { + PrepareAuraScript(spell_the_lich_king_shadow_trap_visual_AuraScript); + + void OnRemove(AuraEffect const* aurEff, AuraEffectHandleModes mode) + { + if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) + GetTarget()->CastSpell(GetTarget(), SPELL_SHADOW_TRAP_AURA, TRIGGERED_NONE); + } + + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_the_lich_king_shadow_trap_visual_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_the_lich_king_shadow_trap_visual_AuraScript(); + } +}; + +class spell_the_lich_king_shadow_trap_periodic : public SpellScriptLoader +{ + public: + spell_the_lich_king_shadow_trap_periodic() : SpellScriptLoader("spell_the_lich_king_shadow_trap_periodic") { } + + class spell_the_lich_king_shadow_trap_periodic_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_shadow_trap_periodic_SpellScript); + + void CheckTargetCount(std::list<Unit*>& targets) + { + if (targets.empty()) + return; + + GetCaster()->CastSpell((Unit*)NULL, SPELL_SHADOW_TRAP_KNOCKBACK, true); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_shadow_trap_periodic_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_shadow_trap_periodic_SpellScript(); + } +}; + +class spell_the_lich_king_quake : public SpellScriptLoader +{ + public: + spell_the_lich_king_quake() : SpellScriptLoader("spell_the_lich_king_quake") { } + + class spell_the_lich_king_quake_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_quake_SpellScript); + + bool Load() + { + return GetCaster()->GetInstanceScript() != NULL; + } + + void FilterTargets(std::list<Unit*>& unitList) + { + if (GameObject* platform = ObjectAccessor::GetGameObject(*GetCaster(), GetCaster()->GetInstanceScript()->GetData64(DATA_ARTHAS_PLATFORM))) + unitList.remove_if(HeightDifferenceCheck(platform, 5.0f, false)); + } + + void HandleSendEvent(SpellEffIndex /*effIndex*/) + { + if (GetCaster()->IsAIEnabled) + GetCaster()->GetAI()->DoAction(ACTION_START_ATTACK); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_quake_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + OnEffectHit += SpellEffectFn(spell_the_lich_king_quake_SpellScript::HandleSendEvent, EFFECT_1, SPELL_EFFECT_SEND_EVENT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_quake_SpellScript(); + } +}; + +class spell_the_lich_king_ice_burst_target_search : public SpellScriptLoader +{ + public: + spell_the_lich_king_ice_burst_target_search() : SpellScriptLoader("spell_the_lich_king_ice_burst_target_search") { } + + class spell_the_lich_king_ice_burst_target_search_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_ice_burst_target_search_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_ICE_BURST)) + return false; + return true; + } + + void CheckTargetCount(std::list<Unit*>& unitList) + { + if (unitList.empty()) + return; + + // if there is at least one affected target cast the explosion + GetCaster()->CastSpell(GetCaster(), SPELL_ICE_BURST, true); + if (GetCaster()->GetTypeId() == TYPEID_UNIT) + GetCaster()->ToCreature()->DespawnOrUnsummon(500); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_ice_burst_target_search_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_ice_burst_target_search_SpellScript(); + } +}; + +class spell_the_lich_king_raging_spirit : public SpellScriptLoader +{ + public: + spell_the_lich_king_raging_spirit() : SpellScriptLoader("spell_the_lich_king_raging_spirit") { } + + class spell_the_lich_king_raging_spirit_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_raging_spirit_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_LIFE_SIPHON_HEAL)) + return false; + return true; + } + + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetHitUnit()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_raging_spirit_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_raging_spirit_SpellScript(); + } +}; + +class ExactDistanceCheck +{ + public: + ExactDistanceCheck(Unit* source, float dist) : _source(source), _dist(dist) {} + + bool operator()(Unit* unit) + { + return _source->GetExactDist2d(unit) > _dist; + } + + private: + Unit* _source; + float _dist; +}; + +class spell_the_lich_king_defile : public SpellScriptLoader +{ + public: + spell_the_lich_king_defile() : SpellScriptLoader("spell_the_lich_king_defile") { } + + class spell_the_lich_king_defile_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_defile_SpellScript); + + void CorrectRange(std::list<Unit*>& targets) + { + targets.remove_if(ExactDistanceCheck(GetCaster(), 10.0f * GetCaster()->GetFloatValue(OBJECT_FIELD_SCALE_X))); + } + + void ChangeDamageAndGrow() + { + SetHitDamage(int32(GetHitDamage() * GetCaster()->GetFloatValue(OBJECT_FIELD_SCALE_X))); + // HACK: target player should cast this spell on defile + // however with current aura handling auras cast by different units + // cannot stack on the same aura object increasing the stack count + GetCaster()->CastSpell(GetCaster(), SPELL_DEFILE_GROW, true); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_defile_SpellScript::CorrectRange, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_defile_SpellScript::CorrectRange, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnHit += SpellHitFn(spell_the_lich_king_defile_SpellScript::ChangeDamageAndGrow); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_defile_SpellScript(); + } +}; + +class spell_the_lich_king_summon_into_air : public SpellScriptLoader +{ + public: + spell_the_lich_king_summon_into_air() : SpellScriptLoader("spell_the_lich_king_summon_into_air") { } + + class spell_the_lich_king_summon_into_air_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_summon_into_air_SpellScript); + + void ModDestHeight(SpellEffIndex effIndex) + { + static Position const offset = {0.0f, 0.0f, 15.0f, 0.0f}; + WorldLocation* dest = const_cast<WorldLocation*>(GetTargetDest()); + dest->RelocateOffset(offset); + // spirit bombs get higher + if (GetSpellInfo()->Effects[effIndex].MiscValue == NPC_SPIRIT_BOMB) + dest->RelocateOffset(offset); + } + + void Register() + { + OnEffectLaunch += SpellEffectFn(spell_the_lich_king_summon_into_air_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_SUMMON); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_summon_into_air_SpellScript(); + } +}; + +class spell_the_lich_king_soul_reaper : public SpellScriptLoader +{ + public: + spell_the_lich_king_soul_reaper() : SpellScriptLoader("spell_the_lich_king_soul_reaper") { } + + class spell_the_lich_king_soul_reaper_AuraScript : public AuraScript + { + PrepareAuraScript(spell_the_lich_king_soul_reaper_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_SOUL_REAPER_BUFF)) + return false; + return true; + } + + void OnPeriodic(AuraEffect const* /*aurEff*/) + { + if (Unit* caster = GetCaster()) + GetTarget()->CastSpell(caster, SPELL_SOUL_REAPER_BUFF, true); + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_the_lich_king_soul_reaper_AuraScript::OnPeriodic, EFFECT_1, SPELL_AURA_PERIODIC_DAMAGE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_the_lich_king_soul_reaper_AuraScript(); + } +}; + +class spell_the_lich_king_valkyr_target_search : public SpellScriptLoader +{ + public: + spell_the_lich_king_valkyr_target_search() : SpellScriptLoader("spell_the_lich_king_valkyr_target_search") { } + + class spell_the_lich_king_valkyr_target_search_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_valkyr_target_search_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_ICE_BURST)) + return false; + return true; + } + + bool Load() + { + _target = NULL; + return true; + } + + void SelectTarget(std::list<Unit*>& unitList) + { + if (unitList.empty()) + return; + + unitList.remove_if(Trinity::UnitAuraCheck(true, GetSpellInfo()->Id)); + if (unitList.empty()) + return; + + _target = SelectRandomContainerElement(unitList); + unitList.clear(); + unitList.push_back(_target); + GetCaster()->GetAI()->SetGUID(_target->GetGUID()); + } + + void ReplaceTarget(std::list<Unit*>& unitList) + { + unitList.clear(); + if (_target) + unitList.push_back(_target); + } + + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetCaster()->CastSpell(GetHitUnit(), SPELL_CHARGE, true); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_valkyr_target_search_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_valkyr_target_search_SpellScript::ReplaceTarget, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_valkyr_target_search_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + + Unit* _target; + }; + + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_valkyr_target_search_SpellScript(); + } +}; + +class spell_the_lich_king_eject_all_passengers : public SpellScriptLoader +{ + public: + spell_the_lich_king_eject_all_passengers() : SpellScriptLoader("spell_the_lich_king_eject_all_passengers") { } + + class spell_the_lich_king_eject_all_passengers_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_eject_all_passengers_SpellScript); + + bool Load() + { + return GetCaster()->IsVehicle(); + } + + void HandleDummy(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetCaster()->GetVehicleKit()->RemoveAllPassengers(); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_eject_all_passengers_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_eject_all_passengers_SpellScript(); + } +}; + +class spell_the_lich_king_cast_back_to_caster : public SpellScriptLoader +{ + public: + spell_the_lich_king_cast_back_to_caster() : SpellScriptLoader("spell_the_lich_king_cast_back_to_caster") { } + + class spell_the_lich_king_cast_back_to_caster_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_cast_back_to_caster_SpellScript); + + void HandleScript(SpellEffIndex effIndex) + { + GetHitUnit()->CastSpell(GetCaster(), uint32(GetEffectValue()), true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_cast_back_to_caster_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_cast_back_to_caster_SpellScript(); + } +}; + +class spell_the_lich_king_life_siphon : public SpellScriptLoader +{ + public: + spell_the_lich_king_life_siphon() : SpellScriptLoader("spell_the_lich_king_life_siphon") { } + + class spell_the_lich_king_life_siphon_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_life_siphon_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_LIFE_SIPHON_HEAL)) + return false; + return true; + } + + void TriggerHeal() + { + GetHitUnit()->CastCustomSpell(SPELL_LIFE_SIPHON_HEAL, SPELLVALUE_BASE_POINT0, GetHitDamage() * 10, GetCaster(), true); + } + + void Register() + { + AfterHit += SpellHitFn(spell_the_lich_king_life_siphon_SpellScript::TriggerHeal); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_life_siphon_SpellScript(); + } +}; + +class spell_the_lich_king_vile_spirits : public SpellScriptLoader +{ + public: + spell_the_lich_king_vile_spirits() : SpellScriptLoader("spell_the_lich_king_vile_spirits") { } + + class spell_the_lich_king_vile_spirits_AuraScript : public AuraScript + { + PrepareAuraScript(spell_the_lich_king_vile_spirits_AuraScript); + + bool Load() + { + _is25Man = GetUnitOwner()->GetMap()->Is25ManRaid(); + return true; + } + + void OnPeriodic(AuraEffect const* aurEff) + { + if (_is25Man || ((aurEff->GetTickNumber() - 1) % 5)) + GetTarget()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell, true, NULL, aurEff, GetCasterGUID()); + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_the_lich_king_vile_spirits_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + + bool _is25Man; + }; + + AuraScript* GetAuraScript() const + { + return new spell_the_lich_king_vile_spirits_AuraScript(); + } +}; + +class spell_the_lich_king_vile_spirits_visual : public SpellScriptLoader +{ + public: + spell_the_lich_king_vile_spirits_visual() : SpellScriptLoader("spell_the_lich_king_vile_spirits_visual") { } + + class spell_the_lich_king_vile_spirits_visual_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_vile_spirits_visual_SpellScript); + + void ModDestHeight(SpellEffIndex /*effIndex*/) + { + Position offset = {0.0f, 0.0f, 15.0f, 0.0f}; + const_cast<WorldLocation*>(GetTargetDest())->RelocateOffset(offset); + } + + void Register() + { + OnEffectLaunch += SpellEffectFn(spell_the_lich_king_vile_spirits_visual_SpellScript::ModDestHeight, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_vile_spirits_visual_SpellScript(); + } +}; + +class spell_the_lich_king_vile_spirit_move_target_search : public SpellScriptLoader +{ + public: + spell_the_lich_king_vile_spirit_move_target_search() : SpellScriptLoader("spell_the_lich_king_vile_spirit_move_target_search") { } + + class spell_the_lich_king_vile_spirit_move_target_search_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_vile_spirit_move_target_search_SpellScript); + + bool Load() + { + _target = NULL; + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } + + void SelectTarget(std::list<Unit*>& targets) + { + if (targets.empty()) + return; + + _target = SelectRandomContainerElement(targets); + } + + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + // for this spell, all units are in target map, however it should select one to attack + if (GetHitUnit() != _target) + return; + + GetCaster()->ToCreature()->AI()->AttackStart(GetHitUnit()); + GetCaster()->AddThreat(GetHitUnit(), 100000.0f); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_vile_spirit_move_target_search_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_vile_spirit_move_target_search_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + + Unit* _target; + }; + + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_vile_spirit_move_target_search_SpellScript(); + } +}; + +class spell_the_lich_king_vile_spirit_damage_target_search : public SpellScriptLoader +{ + public: + spell_the_lich_king_vile_spirit_damage_target_search() : SpellScriptLoader("spell_the_lich_king_vile_spirit_damage_target_search") { } + + class spell_the_lich_king_vile_spirit_damage_target_search_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_vile_spirit_damage_target_search_SpellScript); + + bool Load() + { + return GetCaster()->GetTypeId() == TYPEID_UNIT; + } + + void CheckTargetCount(std::list<Unit*>& targets) + { + if (targets.empty()) + return; + + // this spell has SPELL_AURA_BLOCK_SPELL_FAMILY so every next cast of this + // searcher spell will be blocked + if (TempSummon* summon = GetCaster()->ToTempSummon()) + if (Unit* summoner = summon->GetSummoner()) + summoner->GetAI()->SetData(DATA_VILE, 1); + GetCaster()->CastSpell((Unit*)NULL, SPELL_SPIRIT_BURST, true); + GetCaster()->ToCreature()->DespawnOrUnsummon(3000); + GetCaster()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); + } + + void Register() + { + OnUnitTargetSelect += SpellUnitTargetFn(spell_the_lich_king_vile_spirit_damage_target_search_SpellScript::CheckTargetCount, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + } + + Unit* _target; + }; + + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_vile_spirit_damage_target_search_SpellScript(); + } +}; + +class spell_the_lich_king_harvest_soul : public SpellScriptLoader +{ + public: + spell_the_lich_king_harvest_soul() : SpellScriptLoader("spell_the_lich_king_harvest_soul") { } + + class spell_the_lich_king_harvest_soul_AuraScript : public AuraScript + { + PrepareAuraScript(spell_the_lich_king_harvest_soul_AuraScript); + + bool Load() + { + return GetOwner()->GetInstanceScript() != NULL; + } + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + // m_originalCaster to allow stacking from different casters, meh + if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH) + GetTarget()->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL, true, NULL, NULL, GetTarget()->GetInstanceScript()->GetData64(DATA_THE_LICH_KING)); + } + + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_the_lich_king_harvest_soul_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_PERIODIC_DAMAGE, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_the_lich_king_harvest_soul_AuraScript(); + } +}; + +class spell_the_lich_king_lights_favor : public SpellScriptLoader +{ + public: + spell_the_lich_king_lights_favor() : SpellScriptLoader("spell_the_lich_king_lights_favor") { } + + class spell_the_lich_king_lights_favor_AuraScript : public AuraScript + { + PrepareAuraScript(spell_the_lich_king_lights_favor_AuraScript); + + void OnPeriodic(AuraEffect const* /*aurEff*/) + { + if (Unit* caster = GetCaster()) + if (AuraEffect* effect = GetAura()->GetEffect(EFFECT_1)) + effect->RecalculateAmount(caster); + } + + void CalculateBonus(AuraEffect const* /*aurEff*/, int32& amount, bool& canBeRecalculated) + { + canBeRecalculated = true; + amount = 0; + if (Unit* caster = GetCaster()) + amount = int32(caster->GetHealthPct()); + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_the_lich_king_lights_favor_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_HEAL); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_the_lich_king_lights_favor_AuraScript::CalculateBonus, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_the_lich_king_lights_favor_AuraScript(); + } +}; + +class spell_the_lich_king_soul_rip : public SpellScriptLoader +{ + public: + spell_the_lich_king_soul_rip() : SpellScriptLoader("spell_the_lich_king_soul_rip") { } + + class spell_the_lich_king_soul_rip_AuraScript : public AuraScript + { + PrepareAuraScript(spell_the_lich_king_soul_rip_AuraScript); + + void OnPeriodic(AuraEffect const* aurEff) + { + PreventDefaultAction(); + // shouldn't be needed, this is channeled + if (Unit* caster = GetCaster()) + caster->CastCustomSpell(SPELL_SOUL_RIP_DAMAGE, SPELLVALUE_BASE_POINT0, 5000 * aurEff->GetTickNumber(), GetTarget(), true, NULL, aurEff, GetCasterGUID()); + } + + void Register() + { + OnEffectPeriodic += AuraEffectPeriodicFn(spell_the_lich_king_soul_rip_AuraScript::OnPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_the_lich_king_soul_rip_AuraScript(); + } +}; + +class spell_the_lich_king_restore_soul : public SpellScriptLoader +{ + public: + spell_the_lich_king_restore_soul() : SpellScriptLoader("spell_the_lich_king_restore_soul") { } + + class spell_the_lich_king_restore_soul_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_restore_soul_SpellScript); + + bool Load() + { + _instance = GetCaster()->GetInstanceScript(); + return _instance != NULL; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + if (Creature* lichKing = ObjectAccessor::GetCreature(*GetCaster(), _instance->GetData64(DATA_THE_LICH_KING))) + lichKing->AI()->DoAction(ACTION_TELEPORT_BACK); + if (Creature* spawner = GetCaster()->FindNearestCreature(NPC_WORLD_TRIGGER_INFINITE_AOI, 50.0f)) + spawner->RemoveAllAuras(); + } + + void RemoveAura() + { + if (Unit* target = GetHitUnit()) + target->RemoveAurasDueToSpell(target->GetMap()->IsHeroic() ? SPELL_HARVEST_SOULS_TELEPORT : SPELL_HARVEST_SOUL_TELEPORT); + } + + void Register() + { + OnEffectHit += SpellEffectFn(spell_the_lich_king_restore_soul_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_APPLY_AURA); + BeforeHit += SpellHitFn(spell_the_lich_king_restore_soul_SpellScript::RemoveAura); + } + + InstanceScript* _instance; + }; + + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_restore_soul_SpellScript(); + } +}; + +class spell_the_lich_king_in_frostmourne_room : public SpellScriptLoader +{ + public: + spell_the_lich_king_in_frostmourne_room() : SpellScriptLoader("spell_the_lich_king_in_frostmourne_room") { } + + class spell_the_lich_king_in_frostmourne_room_AuraScript : public AuraScript + { + PrepareAuraScript(spell_the_lich_king_in_frostmourne_room_AuraScript); + + bool Load() + { + return GetOwner()->GetInstanceScript() != NULL; + } + + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + { + // m_originalCaster to allow stacking from different casters, meh + if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_DEATH) + GetTarget()->CastSpell((Unit*)NULL, SPELL_HARVESTED_SOUL, true, NULL, NULL, GetTarget()->GetInstanceScript()->GetData64(DATA_THE_LICH_KING)); + } + + void Register() + { + AfterEffectRemove += AuraEffectRemoveFn(spell_the_lich_king_in_frostmourne_room_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_the_lich_king_in_frostmourne_room_AuraScript(); + } +}; + +class spell_the_lich_king_summon_spirit_bomb : public SpellScriptLoader +{ + public: + spell_the_lich_king_summon_spirit_bomb() : SpellScriptLoader("spell_the_lich_king_summon_spirit_bomb") { } + + class spell_the_lich_king_summon_spirit_bomb_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_summon_spirit_bomb_SpellScript); + + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetHitUnit()->CastSpell((Unit*)NULL, uint32(GetEffectValue()), true); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_summon_spirit_bomb_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_summon_spirit_bomb_SpellScript(); + } +}; + +class spell_the_lich_king_trigger_vile_spirit : public SpellScriptLoader +{ + public: + spell_the_lich_king_trigger_vile_spirit() : SpellScriptLoader("spell_the_lich_king_trigger_vile_spirit") { } + + class spell_the_lich_king_trigger_vile_spirit_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_trigger_vile_spirit_SpellScript); + + void TeleportOutside() + { + Creature* target = GetHitCreature(); + if (!target) + return; + + Position dest; + Position offset; + TerenasSpawnHeroic.GetPositionOffsetTo(*target, offset); + GetCaster()->GetPosition(&dest); + dest.RelocateOffset(offset); + target->NearTeleportTo(dest.GetPositionX(), dest.GetPositionY(), dest.GetPositionZ(), dest.GetOrientation()); + } + + void Register() + { + OnHit += SpellHitFn(spell_the_lich_king_trigger_vile_spirit_SpellScript::TeleportOutside); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_trigger_vile_spirit_SpellScript(); + } +}; + +class spell_the_lich_king_jump : public SpellScriptLoader +{ + public: + spell_the_lich_king_jump() : SpellScriptLoader("spell_the_lich_king_jump") { } + + class spell_the_lich_king_jump_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_jump_SpellScript); + + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetHitUnit()->RemoveAurasDueToSpell(SPELL_RAISE_DEAD); + GetHitUnit()->CastSpell((Unit*)NULL, SPELL_JUMP_2, true); + if (Creature* creature = GetHitCreature()) + creature->AI()->DoAction(ACTION_BREAK_FROSTMOURNE); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_jump_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_jump_SpellScript(); + } +}; + +class spell_the_lich_king_jump_remove_aura : public SpellScriptLoader +{ + public: + spell_the_lich_king_jump_remove_aura() : SpellScriptLoader("spell_the_lich_king_jump_remove_aura") { } + + class spell_the_lich_king_jump_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_jump_SpellScript); + + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + GetHitUnit()->RemoveAurasDueToSpell(uint32(GetEffectValue())); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_jump_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_jump_SpellScript(); + } +}; + +class spell_the_lich_king_play_movie : public SpellScriptLoader +{ + public: + spell_the_lich_king_play_movie() : SpellScriptLoader("spell_the_lich_king_play_movie") { } + + class spell_the_lich_king_play_movie_SpellScript : public SpellScript + { + PrepareSpellScript(spell_the_lich_king_play_movie_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sMovieStore.LookupEntry(MOVIE_FALL_OF_THE_LICH_KING)) + return false; + return true; + } + + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (Player* player = GetHitPlayer()) + player->SendMovieStart(MOVIE_FALL_OF_THE_LICH_KING); + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_the_lich_king_play_movie_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_the_lich_king_play_movie_SpellScript(); + } +}; + +class achievement_been_waiting_long_time : public AchievementCriteriaScript +{ + public: + achievement_been_waiting_long_time() : AchievementCriteriaScript("achievement_been_waiting_long_time") { } + + bool OnCheck(Player* /*source*/, Unit* target) + { + if (!target) + return false; + + return target->GetAI()->GetData(DATA_PLAGUE_STACK) >= 30; + } +}; + +class achievement_neck_deep_in_vile : public AchievementCriteriaScript +{ + public: + achievement_neck_deep_in_vile() : AchievementCriteriaScript("achievement_neck_deep_in_vile") { } + + bool OnCheck(Player* /*source*/, Unit* target) + { + if (!target) + return false; + + return !target->GetAI()->GetData(DATA_VILE); + } +}; + +void AddSC_boss_the_lich_king() +{ + new boss_the_lich_king(); + new npc_tirion_fordring_tft(); + new npc_shambling_horror_icc(); + new npc_raging_spirit(); + new npc_valkyr_shadowguard(); + new npc_strangulate_vehicle(); + new npc_terenas_menethil(); + new npc_spirit_warden(); + new npc_spirit_bomb(); + new npc_broken_frostmourne(); + new spell_the_lich_king_infest(); + new spell_the_lich_king_necrotic_plague(); + new spell_the_lich_king_necrotic_plague_jump(); + new spell_the_lich_king_shadow_trap_visual(); + new spell_the_lich_king_shadow_trap_periodic(); + new spell_the_lich_king_quake(); + new spell_the_lich_king_ice_burst_target_search(); + new spell_the_lich_king_raging_spirit(); + new spell_the_lich_king_defile(); + new spell_the_lich_king_summon_into_air(); + new spell_the_lich_king_soul_reaper(); + new spell_the_lich_king_valkyr_target_search(); + new spell_the_lich_king_eject_all_passengers(); + new spell_the_lich_king_cast_back_to_caster(); + new spell_the_lich_king_life_siphon(); + new spell_the_lich_king_vile_spirits(); + new spell_the_lich_king_vile_spirits_visual(); + new spell_the_lich_king_vile_spirit_move_target_search(); + new spell_the_lich_king_vile_spirit_damage_target_search(); + new spell_the_lich_king_harvest_soul(); + new spell_the_lich_king_lights_favor(); + new spell_the_lich_king_soul_rip(); + new spell_the_lich_king_restore_soul(); + new spell_the_lich_king_in_frostmourne_room(); + new spell_the_lich_king_summon_spirit_bomb(); + new spell_the_lich_king_trigger_vile_spirit(); + new spell_the_lich_king_jump(); + new spell_the_lich_king_jump_remove_aura(); + new spell_trigger_spell_from_caster("spell_the_lich_king_mass_resurrection", SPELL_MASS_RESURRECTION_REAL); + new spell_the_lich_king_play_movie(); + new achievement_been_waiting_long_time(); + new achievement_neck_deep_in_vile(); +} diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h index 26b2546fc50..ece966fcda5 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h @@ -28,22 +28,30 @@ uint32 const EncounterCount = 13; uint32 const WeeklyNPCs = 9; uint32 const MaxHeroicAttempts = 50; +// Defined in boss_valithria_dreamwalker.cpp extern Position const ValithriaSpawnPos; // Defined in boss_sindragosa.cpp extern Position const SindragosaSpawnPos; +// Defined in boss_the_lich_king.cpp +extern Position const TerenasSpawn; +extern Position const TerenasSpawnHeroic; +extern Position const SpiritWardenSpawn; // Shared spells used by more than one script enum SharedSpells { - SPELL_BERSERK = 26662, - SPELL_BERSERK2 = 47008, + SPELL_BERSERK = 26662, + SPELL_BERSERK2 = 47008, // Deathbound Ward - SPELL_STONEFORM = 70733, + SPELL_STONEFORM = 70733, // Residue Rendezvous - SPELL_ORANGE_BLIGHT_RESIDUE = 72144, - SPELL_GREEN_BLIGHT_RESIDUE = 72145, + SPELL_ORANGE_BLIGHT_RESIDUE = 72144, + SPELL_GREEN_BLIGHT_RESIDUE = 72145, + + // The Lich King + SPELL_FROSTMOURNE_TELEPORT_VISUAL = 73078, }; enum TeleporterSpells @@ -99,6 +107,9 @@ enum DataTypes DATA_CAPTAIN_RUPERT = 34, DATA_VALITHRIA_TRIGGER = 35, DATA_VALITHRIA_LICH_KING = 36, + DATA_HIGHLORD_TIRION_FORDRING = 37, + DATA_ARTHAS_PLATFORM = 38, + DATA_TERENAS_MENETHIL = 39, }; enum CreaturesIds @@ -247,7 +258,23 @@ enum CreaturesIds // The Lich King NPC_THE_LICH_KING = 36597, + NPC_HIGHLORD_TIRION_FORDRING_LK = 38995, + NPC_TERENAS_MENETHIL_FROSTMOURNE = 36823, + NPC_SPIRIT_WARDEN = 36824, + NPC_TERENAS_MENETHIL_FROSTMOURNE_H = 39217, + NPC_SHAMBLING_HORROR = 37698, + NPC_DRUDGE_GHOUL = 37695, + NPC_ICE_SPHERE = 36633, + NPC_RAGING_SPIRIT = 36701, + NPC_DEFILE = 38757, + NPC_VALKYR_SHADOWGUARD = 36609, + NPC_VILE_SPIRIT = 37799, + NPC_WICKED_SPIRIT = 39190, + NPC_STRANGULATE_VEHICLE = 36598, NPC_WORLD_TRIGGER = 22515, + NPC_WORLD_TRIGGER_INFINITE_AOI = 36171, + NPC_SPIRIT_BOMB = 39189, + NPC_FROSTMOURNE_TRIGGER = 38584, }; enum GameObjectsIds @@ -312,6 +339,20 @@ enum GameObjectsIds GO_ICE_WALL = 202396, GO_ICE_BLOCK = 201722, GO_SIGIL_OF_THE_FROSTWING = 202181, + + // The Lich King + GO_ARTHAS_PLATFORM = 202161, + GO_ARTHAS_PRECIPICE = 202078, + GO_DOODAD_ICECROWN_THRONEFROSTYWIND01 = 202188, + GO_DOODAD_ICECROWN_THRONEFROSTYEDGE01 = 202189, + GO_DOODAD_ICESHARD_STANDING02 = 202141, + GO_DOODAD_ICESHARD_STANDING01 = 202142, + GO_DOODAD_ICESHARD_STANDING03 = 202143, + GO_DOODAD_ICESHARD_STANDING04 = 202144, + GO_DOODAD_ICECROWN_SNOWEDGEWARNING01 = 202190, + GO_FROZEN_LAVAMAN = 202436, + GO_LAVAMAN_PILLARS_CHAINED = 202437, + GO_LAVAMAN_PILLARS_UNCHAINED = 202438, }; enum AchievementCriteriaIds @@ -351,9 +392,6 @@ enum AchievementCriteriaIds enum SharedActions { - // Coldflame Traps - ACTION_STOP_TRAPS = -377440, - // Festergut ACTION_FESTERGUT_COMBAT = -366260, ACTION_FESTERGUT_GAS = -366261, @@ -374,6 +412,10 @@ enum SharedActions // Sindragosa ACTION_START_FROSTWYRM = -368530, ACTION_TRIGGER_ASPHYXIATION = -368531, + + // The Lich King + ACTION_RESTORE_LIGHT = -72262, + ACTION_FROSTMOURNE_INTRO = -36823, }; enum WeekliesICC @@ -399,6 +441,11 @@ enum WorldStatesICC WORLDSTATE_ATTEMPTS_MAX = 4942, }; +enum AreaIds +{ + AREA_THE_FROZEN_THRONE = 4859, +}; + class spell_trigger_spell_from_caster : public SpellScriptLoader { public: diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index d38af614bc0..90078e44d10 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -23,6 +23,20 @@ #include "PoolMgr.h" #include "icecrown_citadel.h" +enum EventIds +{ + EVENT_QUAKE = 23437, + EVENT_SECOND_REMORSELESS_WINTER = 23507, + EVENT_TELEPORT_TO_FROSMOURNE = 23617, +}; + +enum TimedEvents +{ + EVENT_UPDATE_EXECUTION_TIME = 1, + EVENT_QUAKE_SHATTER = 2, + EVENT_REBUILD_PLATFORM = 3, +}; + DoorData const doorData[] = { {GO_LORD_MARROWGAR_S_ENTRANCE, DATA_LORD_MARROWGAR, DOOR_TYPE_ROOM, BOUNDARY_N }, @@ -116,6 +130,13 @@ class instance_icecrown_citadel : public InstanceMapScript SpinestalkerGUID = 0; RimefangGUID = 0; TheLichKingGUID = 0; + HighlordTirionFordringGUID = 0; + TerenasMenethilGUID = 0; + ArthasPlatformGUID = 0; + ArthasPrecipiceGUID = 0; + FrozenThroneEdgeGUID = 0; + FrozenThroneWindGUID = 0; + FrozenThroneWarningGUID = 0; FrostwyrmCount = 0; SpinestalkerTrashCount = 0; RimefangTrashCount = 0; @@ -125,7 +146,6 @@ class instance_icecrown_citadel : public InstanceMapScript IsOrbWhispererEligible = true; ColdflameJetsState = NOT_STARTED; BloodQuickeningState = NOT_STARTED; - BloodQuickeningTimer = 0; BloodQuickeningMinutes = 0; } @@ -269,6 +289,13 @@ class instance_icecrown_citadel : public InstanceMapScript case NPC_THE_LICH_KING: TheLichKingGUID = creature->GetGUID(); break; + case NPC_HIGHLORD_TIRION_FORDRING_LK: + HighlordTirionFordringGUID = creature->GetGUID(); + break; + case NPC_TERENAS_MENETHIL_FROSTMOURNE: + case NPC_TERENAS_MENETHIL_FROSTMOURNE_H: + TerenasMenethilGUID = creature->GetGUID(); + break; default: break; } @@ -424,6 +451,40 @@ class instance_icecrown_citadel : public InstanceMapScript case GO_DRINK_ME: PutricideTableGUID = go->GetGUID(); break; + case GO_ARTHAS_PLATFORM: + // this enables movement at The Frozen Throne, when printed this value is 0.000000f + // however, when represented as integer client will accept only this value + go->SetUInt32Value(GAMEOBJECT_PARENTROTATION, 5535469); + ArthasPlatformGUID = go->GetGUID(); + break; + case GO_ARTHAS_PRECIPICE: + go->SetUInt32Value(GAMEOBJECT_PARENTROTATION, 4178312); + ArthasPrecipiceGUID = go->GetGUID(); + break; + case GO_DOODAD_ICECROWN_THRONEFROSTYEDGE01: + FrozenThroneEdgeGUID = go->GetGUID(); + break; + case GO_DOODAD_ICECROWN_THRONEFROSTYWIND01: + FrozenThroneWindGUID = go->GetGUID(); + break; + case GO_DOODAD_ICECROWN_SNOWEDGEWARNING01: + FrozenThroneWarningGUID = go->GetGUID(); + break; + case GO_FROZEN_LAVAMAN: + FrozenBolvarGUID = go->GetGUID(); + if (GetBossState(DATA_THE_LICH_KING) == DONE) + go->SetRespawnTime(7 * DAY); + break; + case GO_LAVAMAN_PILLARS_CHAINED: + PillarsChainedGUID = go->GetGUID(); + if (GetBossState(DATA_THE_LICH_KING) == DONE) + go->SetRespawnTime(7 * DAY); + break; + case GO_LAVAMAN_PILLARS_UNCHAINED: + PillarsUnchainedGUID = go->GetGUID(); + if (GetBossState(DATA_THE_LICH_KING) == DONE) + go->SetRespawnTime(7 * DAY); + break; default: break; } @@ -541,6 +602,12 @@ class instance_icecrown_citadel : public InstanceMapScript return RimefangGUID; case DATA_THE_LICH_KING: return TheLichKingGUID; + case DATA_HIGHLORD_TIRION_FORDRING: + return HighlordTirionFordringGUID; + case DATA_ARTHAS_PLATFORM: + return ArthasPlatformGUID; + case DATA_TERENAS_MENETHIL: + return TerenasMenethilGUID; default: break; } @@ -661,6 +728,14 @@ class instance_icecrown_citadel : public InstanceMapScript } break; case DATA_THE_LICH_KING: + { + // set the platform as active object to dramatically increase visibility range + // note: "active" gameobjects do not block grid unloading + if (GameObject* precipice = instance->GetGameObject(ArthasPrecipiceGUID)) + precipice->setActive(state == IN_PROGRESS); + if (GameObject* platform = instance->GetGameObject(ArthasPlatformGUID)) + platform->setActive(state == IN_PROGRESS); + if (instance->IsHeroic()) { if (state == FAIL && HeroicAttempts) @@ -672,7 +747,18 @@ class instance_icecrown_citadel : public InstanceMapScript theLichKing->DespawnOrUnsummon(); } } + + if (state == DONE) + { + if (GameObject* bolvar = instance->GetGameObject(FrozenBolvarGUID)) + bolvar->SetRespawnTime(7 * DAY); + if (GameObject* pillars = instance->GetGameObject(PillarsChainedGUID)) + pillars->SetRespawnTime(7 * DAY); + if (GameObject* pillars = instance->GetGameObject(PillarsUnchainedGUID)) + pillars->SetRespawnTime(7 * DAY); + } break; + } default: break; } @@ -798,13 +884,13 @@ class instance_icecrown_citadel : public InstanceMapScript switch (data) { case IN_PROGRESS: - BloodQuickeningTimer = 60000; + Events.ScheduleEvent(EVENT_UPDATE_EXECUTION_TIME, 60000); BloodQuickeningMinutes = 30; DoUpdateWorldState(WORLDSTATE_SHOW_TIMER, 1); DoUpdateWorldState(WORLDSTATE_EXECUTION_TIME, BloodQuickeningMinutes); break; case DONE: - BloodQuickeningTimer = 0; + Events.CancelEvent(EVENT_UPDATE_EXECUTION_TIME); BloodQuickeningMinutes = 0; DoUpdateWorldState(WORLDSTATE_SHOW_TIMER, 0); break; @@ -1050,32 +1136,103 @@ class instance_icecrown_citadel : public InstanceMapScript void Update(uint32 diff) { - if (BloodQuickeningState == IN_PROGRESS) + if (BloodQuickeningState != IN_PROGRESS && GetBossState(DATA_THE_LICH_KING) != IN_PROGRESS) + return; + + Events.Update(diff); + + while (uint32 eventId = Events.ExecuteEvent()) { - if (BloodQuickeningTimer <= diff) + switch (eventId) { - --BloodQuickeningMinutes; - BloodQuickeningTimer = 60000; - if (BloodQuickeningMinutes) + case EVENT_UPDATE_EXECUTION_TIME: { - DoUpdateWorldState(WORLDSTATE_SHOW_TIMER, 1); - DoUpdateWorldState(WORLDSTATE_EXECUTION_TIME, BloodQuickeningMinutes); + --BloodQuickeningMinutes; + if (BloodQuickeningMinutes) + { + Events.ScheduleEvent(EVENT_UPDATE_EXECUTION_TIME, 60000); + DoUpdateWorldState(WORLDSTATE_SHOW_TIMER, 1); + DoUpdateWorldState(WORLDSTATE_EXECUTION_TIME, BloodQuickeningMinutes); + } + else + { + BloodQuickeningState = DONE; + DoUpdateWorldState(WORLDSTATE_SHOW_TIMER, 0); + if (Creature* bq = instance->GetCreature(BloodQueenLanaThelGUID)) + bq->AI()->DoAction(ACTION_KILL_MINCHAR); + } + SaveToDB(); + break; } - else + case EVENT_QUAKE_SHATTER: { - BloodQuickeningState = DONE; - DoUpdateWorldState(WORLDSTATE_SHOW_TIMER, 0); - if (Creature* bq = instance->GetCreature(BloodQueenLanaThelGUID)) - bq->AI()->DoAction(ACTION_KILL_MINCHAR); + if (GameObject* platform = instance->GetGameObject(ArthasPlatformGUID)) + platform->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED); + if (GameObject* edge = instance->GetGameObject(FrozenThroneEdgeGUID)) + edge->SetGoState(GO_STATE_ACTIVE); + if (GameObject* wind = instance->GetGameObject(FrozenThroneWindGUID)) + wind->SetGoState(GO_STATE_READY); + if (GameObject* warning = instance->GetGameObject(FrozenThroneWarningGUID)) + warning->SetGoState(GO_STATE_READY); + if (Creature* theLichKing = instance->GetCreature(TheLichKingGUID)) + theLichKing->AI()->DoAction(ACTION_RESTORE_LIGHT); + break; } - SaveToDB(); + case EVENT_REBUILD_PLATFORM: + if (GameObject* platform = instance->GetGameObject(ArthasPlatformGUID)) + platform->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING); + if (GameObject* edge = instance->GetGameObject(FrozenThroneEdgeGUID)) + edge->SetGoState(GO_STATE_READY); + if (GameObject* wind = instance->GetGameObject(FrozenThroneWindGUID)) + wind->SetGoState(GO_STATE_ACTIVE); + break; + default: + break; } - else - BloodQuickeningTimer -= diff; + } + } + + void ProcessEvent(WorldObject* /*source*/, uint32 eventId) + { + switch (eventId) + { + case EVENT_QUAKE: + if (GameObject* warning = instance->GetGameObject(FrozenThroneWarningGUID)) + warning->SetGoState(GO_STATE_ACTIVE); + Events.ScheduleEvent(EVENT_QUAKE_SHATTER, 5000); + break; + case EVENT_SECOND_REMORSELESS_WINTER: + if (GameObject* platform = instance->GetGameObject(ArthasPlatformGUID)) + { + platform->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED); + Events.ScheduleEvent(EVENT_REBUILD_PLATFORM, 1500); + } + break; + case EVENT_TELEPORT_TO_FROSMOURNE: // Harvest Soul (normal mode) + if (Creature* terenas = instance->SummonCreature(NPC_TERENAS_MENETHIL_FROSTMOURNE, TerenasSpawn, NULL, 63000)) + { + terenas->AI()->DoAction(ACTION_FROSTMOURNE_INTRO); + std::list<Creature*> triggers; + GetCreatureListWithEntryInGrid(triggers, terenas, NPC_WORLD_TRIGGER_INFINITE_AOI, 100.0f); + if (!triggers.empty()) + { + triggers.sort(Trinity::ObjectDistanceOrderPred(terenas, false)); + Unit* visual = triggers.front(); + visual->CastSpell(visual, SPELL_FROSTMOURNE_TELEPORT_VISUAL, true); + } + + if (Creature* warden = instance->SummonCreature(NPC_SPIRIT_WARDEN, SpiritWardenSpawn, NULL, 63000)) + { + terenas->AI()->AttackStart(warden); + warden->AddThreat(terenas, 300000.0f); + } + } + break; } } protected: + EventMap Events; uint64 LadyDeathwisperElevatorGUID; uint64 DeathbringerSaurfangGUID; uint64 DeathbringerSaurfangDoorGUID; @@ -1105,8 +1262,17 @@ class instance_icecrown_citadel : public InstanceMapScript uint64 SpinestalkerGUID; uint64 RimefangGUID; uint64 TheLichKingGUID; + uint64 HighlordTirionFordringGUID; + uint64 TerenasMenethilGUID; + uint64 ArthasPlatformGUID; + uint64 ArthasPrecipiceGUID; + uint64 FrozenThroneEdgeGUID; + uint64 FrozenThroneWindGUID; + uint64 FrozenThroneWarningGUID; + uint64 FrozenBolvarGUID; + uint64 PillarsChainedGUID; + uint64 PillarsUnchainedGUID; uint32 TeamInInstance; - uint32 BloodQuickeningTimer; uint32 ColdflameJetsState; uint32 FrostwyrmCount; uint32 SpinestalkerTrashCount; diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp index 22aaa74a174..16c258af756 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_urom.cpp @@ -276,8 +276,8 @@ public: if (timeBombTimer <= uiDiff) { - if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM)) - DoCast(pUnit, SPELL_TIME_BOMB); + if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM)) + DoCast(unit, SPELL_TIME_BOMB); timeBombTimer = urand(20000, 25000); } else timeBombTimer -= uiDiff; diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp index 9272aa03c41..50f866ea920 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp @@ -541,9 +541,6 @@ class boss_flame_leviathan : public CreatureScript //! I also removed the spellInfo check void DoBatteringRamIfReady() { - if (me->HasUnitState(UNIT_STAT_CASTING)) - return; - if (me->isAttackReady()) { Unit* target = ObjectAccessor::GetUnit(*me, _pursueTarget); @@ -1229,7 +1226,7 @@ public: //bool OnGossipSelect(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction) //{ // player->PlayerTalkClass->ClearMenus(); - // switch (uiAction) + // switch(uiAction) // { // case GOSSIP_ACTION_INFO_DEF+1: // if (player) @@ -1660,10 +1657,25 @@ class spell_pursue : public SpellScriptLoader void FilterTargets(std::list<Unit*>& targets) { - targets.remove_if (FlameLeviathanPursuedTargetSelector(GetCaster())); + targets.remove_if(FlameLeviathanPursuedTargetSelector(GetCaster())); if (targets.empty()) + { if (Creature* caster = GetCaster()->ToCreature()) caster->AI()->EnterEvadeMode(); + } + else + { + //! In the end, only one target should be selected + _target = SelectRandomContainerElement(targets); + FilterTargetsSubsequently(targets); + } + } + + void FilterTargetsSubsequently(std::list<Unit*>& targets) + { + ASSERT(_target); + targets.clear(); + targets.push_back(_target); } void HandleScript(SpellEffIndex /*eff*/) @@ -1687,8 +1699,11 @@ class spell_pursue : public SpellScriptLoader void Register() { OnUnitTargetSelect += SpellUnitTargetFn(spell_pursue_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); + OnUnitTargetSelect += SpellUnitTargetFn(spell_pursue_SpellScript::FilterTargetsSubsequently, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); OnEffectHitTarget += SpellEffectFn(spell_pursue_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_APPLY_AURA); } + + Unit* _target; }; SpellScript* GetSpellScript() const diff --git a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp index 1e17103d23d..7ba12847750 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_cyanigosa.cpp @@ -168,6 +168,9 @@ class achievement_defenseless : public AchievementCriteriaScript bool OnCheck(Player* /*player*/, Unit* target) { + if(!target) + return false; + InstanceScript* instance = target->GetInstanceScript(); if (!instance) return false; diff --git a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp index 318876d79e7..b02ea4bfc48 100644 --- a/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp +++ b/src/server/scripts/Northrend/VioletHold/boss_zuramat.cpp @@ -137,8 +137,8 @@ public: if (SpellVoidShiftTimer <= diff) { - if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_VOID_SHIFT); + if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0)) + DoCast(unit, SPELL_VOID_SHIFT); SpellVoidShiftTimer = 20000; } else SpellVoidShiftTimer -=diff; diff --git a/src/server/scripts/Northrend/borean_tundra.cpp b/src/server/scripts/Northrend/borean_tundra.cpp index c0fbbae1980..a0d64e38d49 100644 --- a/src/server/scripts/Northrend/borean_tundra.cpp +++ b/src/server/scripts/Northrend/borean_tundra.cpp @@ -1706,12 +1706,12 @@ public: { } - void SpellHit(Unit* pUnit, const SpellInfo* pSpell) + void SpellHit(Unit* unit, const SpellInfo* pSpell) { - if (pSpell->Id == SPELL_NEURAL_NEEDLE && pUnit->GetTypeId() == TYPEID_PLAYER) + if (pSpell->Id == SPELL_NEURAL_NEEDLE && unit->GetTypeId() == TYPEID_PLAYER) { ++uiPhase; - CasterGUID = pUnit->GetGUID(); + CasterGUID = unit->GetGUID(); } } diff --git a/src/server/scripts/Northrend/icecrown.cpp b/src/server/scripts/Northrend/icecrown.cpp index c84228b99a4..27054b5755a 100644 --- a/src/server/scripts/Northrend/icecrown.cpp +++ b/src/server/scripts/Northrend/icecrown.cpp @@ -399,7 +399,7 @@ public: struct npc_vereth_the_cunningAI : public ScriptedAI { - npc_vereth_the_cunningAI(Creature* pCreature) : ScriptedAI(pCreature) {} + npc_vereth_the_cunningAI(Creature* creature) : ScriptedAI(creature) {} void MoveInLineOfSight(Unit* who) { diff --git a/src/server/scripts/Northrend/zuldrak.cpp b/src/server/scripts/Northrend/zuldrak.cpp index bf742a4602f..193c699f930 100644 --- a/src/server/scripts/Northrend/zuldrak.cpp +++ b/src/server/scripts/Northrend/zuldrak.cpp @@ -839,12 +839,12 @@ public: std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { - if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) { - if (pUnit->GetPositionZ() <= 286.276f) + if (unit->GetPositionZ() <= 286.276f) { me->getThreatManager().resetAllAggro(); - me->AddThreat(pUnit, 5.0f); + me->AddThreat(unit, 5.0f); break; } EnterEvadeMode(); @@ -961,12 +961,12 @@ public: std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { - if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) { - if (pUnit->GetPositionZ() <= 286.276f) + if (unit->GetPositionZ() <= 286.276f) { me->getThreatManager().resetAllAggro(); - me->AddThreat(pUnit, 5.0f); + me->AddThreat(unit, 5.0f); break; } EnterEvadeMode(); @@ -1083,7 +1083,7 @@ public: } - void EnterCombat(Unit* pUnit) + void EnterCombat(Unit* unit) { if (!SummonList.empty()) for (std::list<uint64>::const_iterator itr = SummonList.begin(); itr != SummonList.end(); ++itr) @@ -1091,7 +1091,7 @@ public: if (Creature* pTemp = Unit::GetCreature(*me, *itr)) { pTemp->m_CombatDistance = 100.0f; // ugly hack? we are not in a instance sorry. :( - pTemp->AI()->AttackStart(pUnit); + pTemp->AI()->AttackStart(unit); } } } @@ -1106,12 +1106,12 @@ public: std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { - if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) { - if (pUnit->GetPositionZ() <= 286.276f) + if (unit->GetPositionZ() <= 286.276f) { me->getThreatManager().resetAllAggro(); - me->AddThreat(pUnit, 5.0f); + me->AddThreat(unit, 5.0f); break; } EnterEvadeMode(); diff --git a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp index 66ef35f7400..21ecab02293 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp @@ -185,14 +185,14 @@ public: void RevertThreatOnTarget(uint64 guid) { - Unit* pUnit = NULL; - pUnit = Unit::GetUnit((*me), guid); - if (pUnit) + Unit* unit = NULL; + unit = Unit::GetUnit((*me), guid); + if (unit) { - if (DoGetThreat(pUnit)) - DoModifyThreatPercent(pUnit, -100); + if (DoGetThreat(unit)) + DoModifyThreatPercent(unit, -100); if (TargetThreat) - me->AddThreat(pUnit, TargetThreat); + me->AddThreat(unit, TargetThreat); } } diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 612065d5ee6..d602b4d2aac 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -1474,9 +1474,9 @@ public: std::vector<Unit*> eliteList; for (std::list<HostileReference*>::const_iterator itr = threatList.begin(); itr != threatList.end(); ++itr) { - Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); - if (pUnit && pUnit->GetEntry() == ILLIDARI_ELITE) - eliteList.push_back(pUnit); + Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + if (unit && unit->GetEntry() == ILLIDARI_ELITE) + eliteList.push_back(unit); } for (std::vector<Unit*>::const_iterator itr = eliteList.begin(); itr != eliteList.end(); ++itr) (*itr)->setDeathState(JUST_DIED); diff --git a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp index 4d79098689c..62e33f0913b 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_mother_shahraz.cpp @@ -165,12 +165,12 @@ public: float Z = TeleportPoint[random].z; for (uint8 i = 0; i < 3; ++i) { - Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 1); - if (pUnit && pUnit->isAlive() && (pUnit->GetTypeId() == TYPEID_PLAYER)) + Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 1); + if (unit && unit->isAlive() && (unit->GetTypeId() == TYPEID_PLAYER)) { - TargetGUID[i] = pUnit->GetGUID(); - pUnit->CastSpell(pUnit, SPELL_TELEPORT_VISUAL, true); - DoTeleportPlayer(pUnit, X, Y, Z, pUnit->GetOrientation()); + TargetGUID[i] = unit->GetGUID(); + unit->CastSpell(unit, SPELL_TELEPORT_VISUAL, true); + DoTeleportPlayer(unit, X, Y, Z, unit->GetOrientation()); } } } @@ -247,12 +247,12 @@ public: { for (uint8 i = 0; i < 3; ++i) { - Unit* pUnit = NULL; + Unit* unit = NULL; if (TargetGUID[i]) { - pUnit = Unit::GetUnit((*me), TargetGUID[i]); - if (pUnit) - pUnit->CastSpell(pUnit, SPELL_ATTRACTION, true); + unit = Unit::GetUnit((*me), TargetGUID[i]); + if (unit) + unit->CastSpell(unit, SPELL_ATTRACTION, true); TargetGUID[i] = 0; } } diff --git a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp index 746ad9aa7ff..c3bb4ee3d2b 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp @@ -216,12 +216,12 @@ public: std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); for (; itr != m_threatlist.end(); ++itr) { - Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); - if (pUnit) + Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + if (unit) { - DoModifyThreatPercent(pUnit, -100); - float threat = target->getThreatManager().getThreat(pUnit); - me->AddThreat(pUnit, threat); // This makes it so that the unit has the same amount of threat in Reliquary's threatlist as in the target creature's (One of the Essences). + DoModifyThreatPercent(unit, -100); + float threat = target->getThreatManager().getThreat(unit); + me->AddThreat(unit, threat); // This makes it so that the unit has the same amount of threat in Reliquary's threatlist as in the target creature's (One of the Essences). } } } @@ -438,9 +438,9 @@ public: std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); for (; itr != m_threatlist.end(); ++itr) { - Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); - if (pUnit && pUnit->isAlive() && (pUnit->GetTypeId() == TYPEID_PLAYER)) // Only alive players - targets.push_back(pUnit); + Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + if (unit && unit->isAlive() && (unit->GetTypeId() == TYPEID_PLAYER)) // Only alive players + targets.push_back(unit); } if (targets.empty()) return; // No targets added for some reason. No point continuing. diff --git a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp index 04646fb10bc..cced0207ca1 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_shade_of_akama.cpp @@ -821,14 +821,14 @@ public: { bool Yelled = false; for (std::list<uint64>::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) - if (Creature* pUnit = Unit::GetCreature(*me, *itr)) + if (Creature* unit = Unit::GetCreature(*me, *itr)) { if (!Yelled) { - DoScriptText(SAY_BROKEN_FREE_01, pUnit); + DoScriptText(SAY_BROKEN_FREE_01, unit); Yelled = true; } - pUnit->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL); + unit->HandleEmoteCommand(EMOTE_ONESHOT_KNEEL); } } ++EndingTalkCount; @@ -838,9 +838,9 @@ public: if (!BrokenList.empty()) { for (std::list<uint64>::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) - if (Creature* pUnit = Unit::GetCreature(*me, *itr)) + if (Creature* unit = Unit::GetCreature(*me, *itr)) // This is the incorrect spell, but can't seem to find the right one. - pUnit->CastSpell(pUnit, 39656, true); + unit->CastSpell(unit, 39656, true); } ++EndingTalkCount; SoulRetrieveTimer = 5000; @@ -849,8 +849,8 @@ public: if (!BrokenList.empty()) { for (std::list<uint64>::const_iterator itr = BrokenList.begin(); itr != BrokenList.end(); ++itr) - if (Creature* pUnit = Unit::GetCreature((*me), *itr)) - pUnit->MonsterYell(SAY_BROKEN_FREE_02, LANG_UNIVERSAL, 0); + if (Creature* unit = Unit::GetCreature((*me), *itr)) + unit->MonsterYell(SAY_BROKEN_FREE_02, LANG_UNIVERSAL, 0); } SoulRetrieveTimer = 0; break; diff --git a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp index 4b235906505..6785f7e4e9e 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_supremus.cpp @@ -177,13 +177,13 @@ public: std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); for (i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && me->IsWithinMeleeRange(pUnit)) + Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (unit && me->IsWithinMeleeRange(unit)) { - if (pUnit->GetHealth() > health) + if (unit->GetHealth() > health) { - health = pUnit->GetHealth(); - target = pUnit; + health = unit->GetHealth(); + target = unit; } } } diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp index 0d3301ec29b..53e5fae888e 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp @@ -173,9 +173,9 @@ public: std::list<Unit*> targets; for (; itr != m_threatlist.end(); ++itr) { - Unit* pUnit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); - if (pUnit && pUnit->isAlive()) - targets.push_back(pUnit); + Unit* unit = Unit::GetUnit((*me), (*itr)->getUnitGuid()); + if (unit && unit->isAlive()) + targets.push_back(unit); } targets.sort(Trinity::ObjectDistanceOrderPred(me)); Unit* target = targets.front(); @@ -322,11 +322,11 @@ public: std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); for (i = m_threatlist.begin(); i != m_threatlist.end(); ++i) { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && pUnit->isAlive()) + Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (unit && unit->isAlive()) { - float threat = DoGetThreat(pUnit); - Blossom->AddThreat(pUnit, threat); + float threat = DoGetThreat(unit); + Blossom->AddThreat(unit, threat); } } } @@ -389,9 +389,9 @@ public: Done = true; if (AggroTargetGUID) { - Unit* pUnit = Unit::GetUnit((*me), AggroTargetGUID); - if (pUnit) - AttackStart(pUnit); + Unit* unit = Unit::GetUnit((*me), AggroTargetGUID); + if (unit) + AttackStart(unit); DoZoneInCombat(); } diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp index 7d698559197..71ee7d06f32 100644 --- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp +++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp @@ -419,10 +419,10 @@ struct boss_illidari_councilAI : public ScriptedAI { for (uint8 i = 0; i < 4; ++i) { - if (Unit* pUnit = Unit::GetUnit(*me, Council[i])) - if (pUnit != me && pUnit->getVictim()) + if (Unit* unit = Unit::GetUnit(*me, Council[i])) + if (unit != me && unit->getVictim()) { - AttackStart(pUnit->getVictim()); + AttackStart(unit->getVictim()); return; } } @@ -437,11 +437,11 @@ struct boss_illidari_councilAI : public ScriptedAI damage /= 4; for (uint8 i = 0; i < 4; ++i) { - if (Creature* pUnit = Unit::GetCreature(*me, Council[i])) - if (pUnit != me && damage < pUnit->GetHealth()) + if (Creature* unit = Unit::GetCreature(*me, Council[i])) + if (unit != me && damage < unit->GetHealth()) { - pUnit->ModifyHealth(-int32(damage)); - pUnit->LowerPlayerDamageReq(damage); + unit->ModifyHealth(-int32(damage)); + unit->LowerPlayerDamageReq(damage); } } } @@ -504,15 +504,15 @@ public: Unit* SelectCouncilMember() { - Unit* pUnit = me; + Unit* unit = me; uint32 member = 0; // He chooses Lady Malande most often if (rand()%10 == 0) // But there is a chance he picks someone else. member = urand(1, 3); if (member != 2) // No need to create another pointer to us using Unit::GetUnit - pUnit = Unit::GetUnit((*me), Council[member]); - return pUnit; + unit = Unit::GetUnit((*me), Council[member]); + return unit; } void CastAuraOnCouncil() @@ -525,9 +525,9 @@ public: } for (uint8 i = 0; i < 4; ++i) { - Unit* pUnit = Unit::GetUnit((*me), Council[i]); - if (pUnit) - pUnit->CastSpell(pUnit, spellid, true, 0, 0, me->GetGUID()); + Unit* unit = Unit::GetUnit((*me), Council[i]); + if (unit) + unit->CastSpell(unit, spellid, true, 0, 0, me->GetGUID()); } } @@ -538,12 +538,12 @@ public: if (BlessingTimer <= diff) { - if (Unit* pUnit = SelectCouncilMember()) + if (Unit* unit = SelectCouncilMember()) { switch (urand(0, 1)) { - case 0: DoCast(pUnit, SPELL_BLESS_SPELLWARD); break; - case 1: DoCast(pUnit, SPELL_BLESS_PROTECTION); break; + case 0: DoCast(unit, SPELL_BLESS_SPELLWARD); break; + case 1: DoCast(unit, SPELL_BLESS_PROTECTION); break; } } BlessingTimer = 60000; diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp index 6564972fd46..141e5d1c277 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_fathomlord_karathress.cpp @@ -707,15 +707,15 @@ public: if (Heal_Timer <= diff) { // It can be cast on any of the mobs - Unit* pUnit = NULL; + Unit* unit = NULL; - while (pUnit == NULL || !pUnit->isAlive()) + while (unit == NULL || !unit->isAlive()) { - pUnit = selectAdvisorUnit(); + unit = selectAdvisorUnit(); } - if (pUnit && pUnit->isAlive()) - DoCast(pUnit, SPELL_HEAL); + if (unit && unit->isAlive()) + DoCast(unit, SPELL_HEAL); Heal_Timer = 60000; } else Heal_Timer -= diff; @@ -724,26 +724,26 @@ public: Unit* selectAdvisorUnit() { - Unit* pUnit = NULL; + Unit* unit = NULL; if (pInstance) { switch (rand()%4) { case 0: - pUnit = Unit::GetUnit((*me), pInstance->GetData64(DATA_KARATHRESS)); + unit = Unit::GetUnit((*me), pInstance->GetData64(DATA_KARATHRESS)); break; case 1: - pUnit = Unit::GetUnit((*me), pInstance->GetData64(DATA_SHARKKIS)); + unit = Unit::GetUnit((*me), pInstance->GetData64(DATA_SHARKKIS)); break; case 2: - pUnit = Unit::GetUnit((*me), pInstance->GetData64(DATA_TIDALVESS)); + unit = Unit::GetUnit((*me), pInstance->GetData64(DATA_TIDALVESS)); break; case 3: - pUnit = me; + unit = me; break; } - } else pUnit = me; - return pUnit; + } else unit = me; + return unit; } }; }; diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp index f3da63af38b..e1b3ab1308f 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_leotheras_the_blind.cpp @@ -96,9 +96,9 @@ public: } void JustDied(Unit* /*victim*/) { - Unit* pUnit = Unit::GetUnit((*me), victimGUID); - if (pUnit && pUnit->HasAura(SPELL_INSIDIOUS_WHISPER)) - pUnit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER); + Unit* unit = Unit::GetUnit((*me), victimGUID); + if (unit && unit->HasAura(SPELL_INSIDIOUS_WHISPER)) + unit->RemoveAurasDueToSpell(SPELL_INSIDIOUS_WHISPER); } void DamageTaken(Unit* done_by, uint32 &damage) @@ -353,13 +353,13 @@ public: { if (InnderDemon[i] > 0) { - Creature* pUnit = Unit::GetCreature((*me), InnderDemon[i]); - if (pUnit && pUnit->isAlive()) + Creature* unit = Unit::GetCreature((*me), InnderDemon[i]); + if (unit && unit->isAlive()) { - Unit* unit_target = Unit::GetUnit(*pUnit, CAST_AI(mob_inner_demon::mob_inner_demonAI, pUnit->AI())->victimGUID); + Unit* unit_target = Unit::GetUnit(*unit, CAST_AI(mob_inner_demon::mob_inner_demonAI, unit->AI())->victimGUID); if (unit_target && unit_target->isAlive()) { - pUnit->CastSpell(unit_target, SPELL_CONSUMING_MADNESS, true); + unit->CastSpell(unit_target, SPELL_CONSUMING_MADNESS, true); DoModifyThreatPercent(unit_target, -100); } } diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index 2692d6f12da..12da67f94b5 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -770,8 +770,8 @@ class boss_kaelthas : public CreatureScript if (FlameStrike_Timer <= diff) { - if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_FLAME_STRIKE); + if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0)) + DoCast(unit, SPELL_FLAME_STRIKE); FlameStrike_Timer = 30000; } @@ -784,7 +784,7 @@ class boss_kaelthas : public CreatureScript for (uint32 i = 0; i < 3; ++i) { sLog->outDebug(LOG_FILTER_TSCR, "SD2: Kael'Thas mind control not supported."); - //DoCast(pUnit, SPELL_MIND_CONTROL); + //DoCast(unit, SPELL_MIND_CONTROL); } MindControl_Timer = 60000; @@ -892,11 +892,11 @@ class boss_kaelthas : public CreatureScript // 1) Kael'thas will portal the whole raid right into his body for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); - if (pUnit && (pUnit->GetTypeId() == TYPEID_PLAYER)) + Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + if (unit && (unit->GetTypeId() == TYPEID_PLAYER)) { //Use work around packet to prevent player from being dropped from combat - DoTeleportPlayer(pUnit, afGravityPos[0], afGravityPos[1], afGravityPos[2], pUnit->GetOrientation()); + DoTeleportPlayer(unit, afGravityPos[0], afGravityPos[1], afGravityPos[2], unit->GetOrientation()); } } @@ -913,20 +913,20 @@ class boss_kaelthas : public CreatureScript // 2) At that point he will put a Gravity Lapse debuff on everyone for (i = me->getThreatManager().getThreatList().begin(); i != me->getThreatManager().getThreatList().end(); ++i) { - if (Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid())) + if (Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid())) { - DoCast(pUnit, SPELL_KNOCKBACK, true); + DoCast(unit, SPELL_KNOCKBACK, true); //Gravity lapse - needs an exception in Spell system to work - pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE, true, 0, 0, me->GetGUID()); - pUnit->CastSpell(pUnit, SPELL_GRAVITY_LAPSE_AURA, true, 0, 0, me->GetGUID()); + unit->CastSpell(unit, SPELL_GRAVITY_LAPSE, true, 0, 0, me->GetGUID()); + unit->CastSpell(unit, SPELL_GRAVITY_LAPSE_AURA, true, 0, 0, me->GetGUID()); //Using packet workaround WorldPacket data(12); data.SetOpcode(SMSG_MOVE_SET_CAN_FLY); - data.append(pUnit->GetPackGUID()); + data.append(unit->GetPackGUID()); data << uint32(0); - pUnit->SendMessageToSet(&data, true); + unit->SendMessageToSet(&data, true); } } GravityLapse_Timer = 10000; @@ -946,14 +946,14 @@ class boss_kaelthas : public CreatureScript //Remove flight for (i = me->getThreatManager().getThreatList().begin(); i!= me->getThreatManager().getThreatList().end(); ++i) { - if (Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid())) + if (Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid())) { //Using packet workaround WorldPacket data(12); data.SetOpcode(SMSG_MOVE_UNSET_CAN_FLY); - data.append(pUnit->GetPackGUID()); + data.append(unit->GetPackGUID()); data << uint32(0); - pUnit->SendMessageToSet(&data, true); + unit->SendMessageToSet(&data, true); } } @@ -982,8 +982,8 @@ class boss_kaelthas : public CreatureScript //NetherBeam_Timer if (NetherBeam_Timer <= diff) { - if (Unit* pUnit = SelectTarget(SELECT_TARGET_RANDOM, 0)) - DoCast(pUnit, SPELL_NETHER_BEAM); + if (Unit* unit = SelectTarget(SELECT_TARGET_RANDOM, 0)) + DoCast(unit, SPELL_NETHER_BEAM); NetherBeam_Timer = 4000; } @@ -1286,12 +1286,12 @@ class boss_grand_astromancer_capernian : public CreatureScript std::list<HostileReference*>& m_threatlist = me->getThreatManager().getThreatList(); for (std::list<HostileReference*>::const_iterator i = m_threatlist.begin(); i!= m_threatlist.end(); ++i) { - Unit* pUnit = Unit::GetUnit((*me), (*i)->getUnitGuid()); + Unit* unit = Unit::GetUnit((*me), (*i)->getUnitGuid()); //if in melee range - if (pUnit && pUnit->IsWithinDistInMap(me, 5)) + if (unit && unit->IsWithinDistInMap(me, 5)) { InMeleeRange = true; - target = pUnit; + target = unit; break; } } diff --git a/src/server/scripts/Outland/netherstorm.cpp b/src/server/scripts/Outland/netherstorm.cpp index 5b2350369f0..2ae0cce2ba2 100644 --- a/src/server/scripts/Outland/netherstorm.cpp +++ b/src/server/scripts/Outland/netherstorm.cpp @@ -809,10 +809,10 @@ public: for (std::list<HostileReference*>::const_iterator itr = AggroList.begin(); itr != AggroList.end(); ++itr) { - if (Unit* pUnit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) + if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid())) { - if (pUnit->GetCreateMana() > 0) - UnitsWithMana.push_back(pUnit); + if (unit->GetCreateMana() > 0) + UnitsWithMana.push_back(unit); } } if (!UnitsWithMana.empty()) diff --git a/src/server/scripts/Outland/shadowmoon_valley.cpp b/src/server/scripts/Outland/shadowmoon_valley.cpp index b16166ed904..327964e7b1e 100644 --- a/src/server/scripts/Outland/shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/shadowmoon_valley.cpp @@ -129,9 +129,9 @@ public: { if (bCanEat && !bIsEating) { - if (Unit* pUnit = Unit::GetUnit(*me, uiPlayerGUID)) + if (Unit* unit = Unit::GetUnit(*me, uiPlayerGUID)) { - if (GameObject* pGo = pUnit->FindNearestGameObject(GO_CARCASS, 10)) + if (GameObject* pGo = unit->FindNearestGameObject(GO_CARCASS, 10)) { if (me->GetMotionMaster()->GetCurrentMovementGeneratorType() == WAYPOINT_MOTION_TYPE) me->GetMotionMaster()->MovementExpired(); diff --git a/src/server/scripts/Outland/terokkar_forest.cpp b/src/server/scripts/Outland/terokkar_forest.cpp index ab3cd88ce3a..2dec7ab191d 100644 --- a/src/server/scripts/Outland/terokkar_forest.cpp +++ b/src/server/scripts/Outland/terokkar_forest.cpp @@ -95,9 +95,9 @@ public: if (done_by->GetTypeId() == TYPEID_PLAYER) if (me->HealthBelowPctDamaged(30, damage)) { - if (Group* pGroup = CAST_PLR(done_by)->GetGroup()) + if (Group* group = CAST_PLR(done_by)->GetGroup()) { - for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* pGroupie = itr->getSource(); if (pGroupie && diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 30eb1538010..17849027dd4 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -295,6 +295,38 @@ class spell_dru_starfall_aoe : public SpellScriptLoader } }; +// 40121 - Swift Flight Form (Passive) +class spell_dru_swift_flight_passive : public SpellScriptLoader +{ + public: + spell_dru_swift_flight_passive() : SpellScriptLoader("spell_dru_swift_flight_passive") { } + + class spell_dru_swift_flight_passive_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dru_swift_flight_passive_AuraScript); + + void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) + { + Unit* caster = GetCaster(); + if (!caster || !caster->ToPlayer()) + return; + + if (caster->ToPlayer()->Has310Flyer(false)) + amount = 310; + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_swift_flight_passive_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_MOD_INCREASE_VEHICLE_FLIGHT_SPEED); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_dru_swift_flight_passive_AuraScript(); + } +}; + void AddSC_druid_spell_scripts() { new spell_dru_glyph_of_starfire(); @@ -303,4 +335,5 @@ void AddSC_druid_spell_scripts() new spell_dru_savage_defense(); new spell_dru_t10_restoration_4p_bonus(); new spell_dru_starfall_aoe(); + new spell_dru_swift_flight_passive(); } diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 75020b7e7bd..c894bf8afb7 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2044,7 +2044,7 @@ Rate.Drop.Item.ReferencedAmount = 1 # Description: Experience rates. # Default: 1 - (Rate.XP.Kill) # 1 - (Rate.XP.Quest) -# 1 - ( Rate.XP.Explore) +# 1 - (Rate.XP.Explore) Rate.XP.Kill = 1 Rate.XP.Quest = 1 |