diff options
555 files changed, 6965 insertions, 5156 deletions
diff --git a/sql/base/characters_database.sql b/sql/base/characters_database.sql index 00538f6ad41..6296351f52f 100644 --- a/sql/base/characters_database.sql +++ b/sql/base/characters_database.sql @@ -805,6 +805,7 @@ CREATE TABLE `character_queststatus` ( `itemcount2` smallint(5) unsigned NOT NULL DEFAULT '0', `itemcount3` smallint(5) unsigned NOT NULL DEFAULT '0', `itemcount4` smallint(5) unsigned NOT NULL DEFAULT '0', + `playercount` smallint(5) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`guid`,`quest`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Player System'; /*!40101 SET character_set_client = @saved_cs_client */; diff --git a/sql/updates/characters/2011_09_05_00_characters_character_quest_status.sql b/sql/updates/characters/2011_09_05_00_characters_character_quest_status.sql new file mode 100644 index 00000000000..08ee801c9d1 --- /dev/null +++ b/sql/updates/characters/2011_09_05_00_characters_character_quest_status.sql @@ -0,0 +1 @@ +ALTER TABLE `character_queststatus` ADD `playercount` SMALLINT(5) UNSIGNED NOT NULL DEFAULT '0'; diff --git a/sql/updates/world/2011_09_05_00_world_spell_target_position.sql b/sql/updates/world/2011_09_05_00_world_spell_target_position.sql new file mode 100644 index 00000000000..ae0a69c6e99 --- /dev/null +++ b/sql/updates/world/2011_09_05_00_world_spell_target_position.sql @@ -0,0 +1,6 @@ +DELETE FROM `spell_target_position` WHERE `id` IN (17278,49097,55431); +INSERT INTO `spell_target_position` (`id` ,`target_map` ,`target_position_x` ,`target_position_y` ,`target_position_z` ,`target_orientation`) VALUES +(17278, 329, 3534.3, -2966.74, 125.001, 0.279253), -- Cannon Fire cast by a trap GO Cannonball +(49097, 0, -466.4, 1496.36, 17.43, 2.1), -- Out of Body Experience, quest with the same name (Grizzly Hills -> Silverpine) +(55431, 571, 5787.781250, -1582.446045, 234.830414, 2.14); -- Summon Gymer +-- 53821 Teach:Death Gate - couldn't find enough info diff --git a/sql/updates/world/2011_09_05_01_world_gossip.sql b/sql/updates/world/2011_09_05_01_world_gossip.sql new file mode 100644 index 00000000000..0d7a193eb95 --- /dev/null +++ b/sql/updates/world/2011_09_05_01_world_gossip.sql @@ -0,0 +1,28 @@ +-- Fixing Lord Thorval, Lady Alistra and Amal'thazad in map 609 +UPDATE `creature_template` SET `gossip_menu_id`=9691 WHERE `entry`=28471; -- Lady Alistra +UPDATE `creature_template` SET `gossip_menu_id`=9692 WHERE `entry`=28472; -- Lord Thorval +UPDATE `creature_template` SET `gossip_menu_id`=9693 WHERE `entry`=28474; -- Amal'thazad + +DELETE FROM `gossip_menu` WHERE `entry`=9791 AND `text_id`=13475; +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (9791,13475); + +DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (9691,9692,9693,9791,10371); +INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`) VALUES +(9691,0,3,'I seek training, Lady Alistra.',5,16,0,0,0,0,''), +(9691,1,0,'I wish to unlearn my talents.',1,1,9791,0,0,0,''), +(9691,2,0,'Learn about Dual Talent Specialization.',1,1,10371,0,0,0,''), +(9692,0,3,'I seek training, Lord Thorval.',5,16,0,0,0,0,''), +(9692,1,0,'I wish to unlearn my talents.',1,1,9791,0,0,0,''), +(9692,2,0,'Learn about Dual Talent Specialization.',1,1,10371,0,0,0,''), +(9693,0,3,'I seek training, Amal''thazad.',5,16,0,0,0,0,''), +(9693,1,0,'I wish to unlearn my talents.',1,1,9791,0,0,0,''), +(9693,2,0,'Learn about Dual Talent Specialization.',1,1,10371,0,0,0,''), +(9791,0,0,'Yes. I do.',16,16,0,0,0,0,''), +(10371,0,0,'Purchase a Dual Talent Specialization.',18,16,0,0,0,10000000,'Are you sure you wish to purchase a Dual Talent Specialization?'); -- Fixing this entry because Dual Talent Specialization needs confirmation by players. + +-- Darion Mograine DK trainer (Since the quest 'Taking back Acherus' until go to Stormwind/Orgrimmar) +-- The gossip_menu (`entry` and `text_id`) are already in TDB UP41. Only needs this changes: +UPDATE `creature_template` SET `gossip_menu_id`=10027, `trainer_class`=6 WHERE `entry`=31084; +DELETE FROM `gossip_menu_option` WHERE `menu_id`=10027; +INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`) VALUES +(10027,0,3,'I require training, Highlord.',5,16,0,0,0,0,''); diff --git a/sql/updates/world/2011_09_06_00_world_sai.sql b/sql/updates/world/2011_09_06_00_world_sai.sql new file mode 100644 index 00000000000..fdc77bea6bb --- /dev/null +++ b/sql/updates/world/2011_09_06_00_world_sai.sql @@ -0,0 +1,5 @@ +UPDATE `smart_scripts` SET `action_param1`=1,`event_flags`=1 WHERE `action_type`=25; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND ((`entryorguid`=11360 AND `id`=1) OR (`entryorguid`=27225 AND `id`=20) OR (`entryorguid`=27615 AND `id`=15)); +UPDATE `smart_scripts` SET `id`=20 WHERE `entryorguid`=27225 AND `id`=21; +UPDATE `smart_scripts` SET `id`=21 WHERE `entryorguid`=27225 AND `id`=22; +DELETE FROM `creature_text` WHERE `text`='%s attempts to run away in fear!'; diff --git a/sql/updates/world/2011_09_06_01_world_misc.sql b/sql/updates/world/2011_09_06_01_world_misc.sql new file mode 100644 index 00000000000..45ba8556ddc --- /dev/null +++ b/sql/updates/world/2011_09_06_01_world_misc.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_dbc` WHERE `Id`=24677; +INSERT INTO `spell_dbc` (`Id`,`Dispel`,`Mechanic`,`Attributes`,`AttributesEx`,`AttributesEx2`,`AttributesEx3`,`AttributesEx4`,`AttributesEx5`,`AttributesEx6`,`AttributesEx7`,`Stances`,`StancesNot`,`Targets`,`CastingTimeIndex`,`AuraInterruptFlags`,`ProcFlags`,`ProcChance`,`ProcCharges`,`MaxLevel`,`BaseLevel`,`SpellLevel`,`DurationIndex`,`RangeIndex`,`StackAmount`,`EquippedItemClass`,`EquippedItemSubClassMask`,`EquippedItemInventoryTypeMask`,`Effect1`,`Effect2`,`Effect3`,`EffectDieSides1`,`EffectDieSides2`,`EffectDieSides3`,`EffectRealPointsPerLevel1`,`EffectRealPointsPerLevel2`,`EffectRealPointsPerLevel3`,`EffectBasePoints1`,`EffectBasePoints2`,`EffectBasePoints3`,`EffectMechanic1`,`EffectMechanic2`,`EffectMechanic3`,`EffectImplicitTargetA1`,`EffectImplicitTargetA2`,`EffectImplicitTargetA3`,`EffectImplicitTargetB1`,`EffectImplicitTargetB2`,`EffectImplicitTargetB3`,`EffectRadiusIndex1`,`EffectRadiusIndex2`,`EffectRadiusIndex3`,`EffectApplyAuraName1`,`EffectApplyAuraName2`,`EffectApplyAuraName3`,`EffectAmplitude1`,`EffectAmplitude2`,`EffectAmplitude3`,`EffectMultipleValue1`,`EffectMultipleValue2`,`EffectMultipleValue3`,`EffectMiscValue1`,`EffectMiscValue2`,`EffectMiscValue3`,`EffectMiscValueB1`,`EffectMiscValueB2`,`EffectMiscValueB3`,`EffectTriggerSpell1`,`EffectTriggerSpell2`,`EffectTriggerSpell3`,`EffectSpellClassMaskA1`,`EffectSpellClassMaskA2`,`EffectSpellClassMaskA3`,`EffectSpellClassMaskB1`,`EffectSpellClassMaskB2`,`EffectSpellClassMaskB3`,`EffectSpellClassMaskC1`,`EffectSpellClassMaskC2`,`EffectSpellClassMaskC3`,`MaxTargetLevel`,`SpellFamilyName`,`SpellFamilyFlags1`,`SpellFamilyFlags2`,`SpellFamilyFlags3`,`MaxAffectedTargets`,`DmgClass`,`PreventionType`,`DmgMultiplier1`,`DmgMultiplier2`,`DmgMultiplier3`,`AreaGroupId`,`SchoolMask`,`Comment`) VALUES +(24677,0,0,256,0,4,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,6,0,-1,0,0,77,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,'GY Mid Trigger - 2.0.12 spell - AV Snowfall Graveyard'); + +UPDATE `gameobject_template` SET `data16`=1 WHERE `entry`=180418 AND `WDBVerified`=11723; diff --git a/sql/updates/world/2011_09_07_00_world_spell_linked_spell.sql b/sql/updates/world/2011_09_07_00_world_spell_linked_spell.sql new file mode 100644 index 00000000000..584ef63c4ad --- /dev/null +++ b/sql/updates/world/2011_09_07_00_world_spell_linked_spell.sql @@ -0,0 +1,7 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=44572; +INSERT INTO `spell_linked_spell` VALUES +(44572,71757,0, 'Deep Freeze - Damage Proc'); + +DELETE FROM `spell_bonus_data` WHERE `entry`=71757; +INSERT INTO `spell_bonus_data` (`entry`,`direct_bonus`,`dot_bonus`,`ap_bonus`,`ap_dot_bonus`,`comments`) VALUES +(71757,2.143,0,0,0, 'Mage - Deep Freeze'); diff --git a/sql/updates/world/2011_09_07_01_world_sai.sql b/sql/updates/world/2011_09_07_01_world_sai.sql new file mode 100644 index 00000000000..aba3bdfe578 --- /dev/null +++ b/sql/updates/world/2011_09_07_01_world_sai.sql @@ -0,0 +1,10 @@ +DELETE FROM `gossip_menu` WHERE `entry`=2211 AND `text_id`=2850; +INSERT INTO `gossip_menu` (`entry`, `text_id`) VALUES +(2211, 2850); + +UPDATE `gameobject_template` SET `AIName`='SmartGameObjectAI' WHERE `entry`=160445; + +DELETE FROM `smart_scripts` WHERE `entryorguid`=160445 AND `source_type`=1; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(160445, 1, 0, 0, 64, 0, 100, 0, 0, 0, 0, 0, 12, 9136, 1, 60*1000, 0, 0, 0, 8, 0, 0, 0, -7917.378906, -2610.533936, 221.123123, 5.040257, 'Sha''ni Proudtusk''s Remains - On gossip hello summon Sha''ni Proudtusk'); +-- Need a way to prevent spamming this action. diff --git a/sql/updates/world/2011_09_08_00_world_conditions.sql b/sql/updates/world/2011_09_08_00_world_conditions.sql new file mode 100644 index 00000000000..07eebd56c7e --- /dev/null +++ b/sql/updates/world/2011_09_08_00_world_conditions.sql @@ -0,0 +1,17 @@ +DELETE FROM `conditions` WHERE `sourceEntry` IN (62584,64185); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) +VALUES +(13,0,62584,0,18,1,33202,0,0,'','target for Lifebinder\'s Gift'), +(13,0,62584,0,18,1,32919,0,0,'','target for Lifebinder\'s Gift'), +(13,0,62584,0,18,1,32916,0,0,'','target for Lifebinder\'s Gift'), +(13,0,62584,0,18,1,32906,0,0,'','target for Lifebinder\'s Gift'), +(13,0,62584,0,18,1,33203,0,0,'','target for Lifebinder\'s Gift'), +(13,0,62584,0,18,1,32918,0,0,'','target for Lifebinder\'s Gift'), +(13,0,62584,0,18,1,33215,0,0,'','target for Lifebinder\'s Gift'), +(13,0,64185,0,18,1,33202,0,0,'','target for Lifebinder\'s Gift'), +(13,0,64185,0,18,1,32919,0,0,'','target for Lifebinder\'s Gift'), +(13,0,64185,0,18,1,32916,0,0,'','target for Lifebinder\'s Gift'), +(13,0,64185,0,18,1,32906,0,0,'','target for Lifebinder\'s Gift'), +(13,0,64185,0,18,1,33203,0,0,'','target for Lifebinder\'s Gift'), +(13,0,64185,0,18,1,32918,0,0,'','target for Lifebinder\'s Gift'), +(13,0,64185,0,18,1,33215,0,0,'','target for Lifebinder\'s Gift'); diff --git a/sql/updates/world/2011_09_08_01_world_spell_target_position.sql b/sql/updates/world/2011_09_08_01_world_spell_target_position.sql new file mode 100644 index 00000000000..5b9fb09d14c --- /dev/null +++ b/sql/updates/world/2011_09_08_01_world_spell_target_position.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_target_position` WHERE `id` IN (46233,52462,54963); +INSERT INTO `spell_target_position` (`id` ,`target_map` ,`target_position_x` ,`target_position_y` ,`target_position_z` ,`target_orientation`) VALUES +(46233,571,3202.959961,5274.073730,46.887897,0.015704), -- Call Mammoth Orphan +(52462,609,2387.738525,-5898.617676,108.353539,4.354776), -- Hide In Mine Car +(54963,571,6153.721191,-1075.270142,403.517365,2.232988); -- Teleporter Power Cell diff --git a/sql/updates/world/2011_09_08_02_world_spell_script_names.sql b/sql/updates/world/2011_09_08_02_world_spell_script_names.sql new file mode 100644 index 00000000000..b97a1ef299a --- /dev/null +++ b/sql/updates/world/2011_09_08_02_world_spell_script_names.sql @@ -0,0 +1 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName` = 'spell_baltharus_enervating_brand'; diff --git a/sql/updates/world/2011_09_08_03_world_item_template.sql b/sql/updates/world/2011_09_08_03_world_item_template.sql new file mode 100644 index 00000000000..c5809d798fa --- /dev/null +++ b/sql/updates/world/2011_09_08_03_world_item_template.sql @@ -0,0 +1,9 @@ +UPDATE `item_template` SET `BuyPrice` = 40000, `delay` = 0, `spellcharges_1` = -1, `spellcooldown_1` = 0, `spellcooldown_2` = 0, `spellcooldown_3` = 0, `spellcooldown_4` = 0, `spellcooldown_5` = 0, `spellcategory_1` = 79, `spellcategorycooldown_1` = 3000, `spellcategorycooldown_2` = 0, `spellcategorycooldown_3` = 0, `spellcategorycooldown_4` = 0, `spellcategorycooldown_5` = 0, `WDBVerified`=12340 WHERE `entry` = 45006; -- Jillian's Tonic of Endless Rage +UPDATE `item_template` SET `BuyPrice` = 40000, `delay` = 0, `spellcharges_1` = -1, `spellcooldown_1` = 0, `spellcooldown_2` = 0, `spellcooldown_3` = 0, `spellcooldown_4` = 0, `spellcooldown_5` = 0, `spellcategory_1` = 79, `spellcategorycooldown_1` = 3000, `spellcategorycooldown_2` = 0, `spellcategorycooldown_3` = 0, `spellcategorycooldown_4` = 0, `spellcategorycooldown_5` = 0, `WDBVerified`=12340 WHERE `entry` = 45007; -- Jillian's Tonic of Pure Mojo +UPDATE `item_template` SET `delay` = 0, `spellcooldown_1` = 0, `spellcooldown_2` = 0, `spellcooldown_3` = 0, `spellcooldown_4` = 0, `spellcooldown_5` = 0, `spellcategorycooldown_2` = 0, `spellcategorycooldown_3` = 0, `spellcategorycooldown_4` = 0, `spellcategorycooldown_5` = 0, `WDBVerified`=12340 WHERE `entry` = 45008; -- Jillian's Tonic of Stoneblood +UPDATE `item_template` SET `BuyPrice` = 40000, `delay` = 0, `spellcharges_1` = -1, `spellcooldown_1` = 0, `spellcooldown_2` = 0, `spellcooldown_3` = 0, `spellcooldown_4` = 0, `spellcooldown_5` = 0, `spellcategory_1` = 79, `spellcategorycooldown_1` = 3000, `spellcategorycooldown_2` = 0, `spellcategorycooldown_3` = 0, `spellcategorycooldown_4` = 0, `spellcategorycooldown_5` = 0, `WDBVerified`=12340 WHERE `entry` = 45009; -- Jillian's Tonic of the Frost Wyrm +UPDATE `item_template` SET `BuyPrice` = 200, `stackable` = 20, `delay` = 0, `spellcharges_1` = -1, `spellcooldown_1` = 0, `spellcooldown_2` = 0, `spellcooldown_3` = 0, `spellcooldown_4` = 0, `spellcooldown_5` = 0, `spellcategory_1` = 4, `spellcategorycooldown_1` = 60000, `spellcategorycooldown_2` = 0, `spellcategorycooldown_3` = 0, `spellcategorycooldown_4` = 0, `spellcategorycooldown_5` = 0, `WDBVerified`=12340 WHERE `entry` = 45276; -- Jillian's Genius Juice +UPDATE `item_template` SET `BuyPrice` = 200, `stackable` = 20, `delay` = 0, `spellcharges_1` = -1, `spellcooldown_1` = 0, `spellcooldown_2` = 0, `spellcooldown_3` = 0, `spellcooldown_4` = 0, `spellcooldown_5` = 0, `spellcategory_1` = 4, `spellcategorycooldown_1` = 60000, `spellcategorycooldown_2` = 0, `spellcategorycooldown_3` = 0, `spellcategorycooldown_4` = 0, `spellcategorycooldown_5` = 0, `WDBVerified`=12340 WHERE `entry` = 45277; -- Jillian's Savior Sauce +UPDATE `item_template` SET `BuyPrice` = 6, `delay` = 0, `spellcharges_1` = -1, `spellcooldown_1` = 0, `spellcategory_1` = 11, `spellcategorycooldown_1` = 1000, `WDBVerified`=12340 WHERE `entry` = 45279; -- Jillian's Gourmet Fish Feast +UPDATE `item_template` SET `WDBVerified`=12340 WHERE `entry` =46766; -- Red War Fuel +UPDATE `item_template` SET `Quality`=0,`Flags`=65538,`WDBVerified`=12340 WHERE `entry`=10791; -- Goblin Engineer Membership Card diff --git a/sql/updates/world/2011_09_10_00_world_spell_linked_spell.sql b/sql/updates/world/2011_09_10_00_world_spell_linked_spell.sql new file mode 100644 index 00000000000..93365589b44 --- /dev/null +++ b/sql/updates/world/2011_09_10_00_world_spell_linked_spell.sql @@ -0,0 +1,6 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (57294,57399); +INSERT INTO `spell_linked_spell` VALUES +(57294,59690,2,'Well Fed - Well Fed (DND)'), +(57399,59699,2,'Well Fed - Well Fed (DND)'); + +DELETE FROM `spell_group` WHERE `spell_id` IN (59690,59699); diff --git a/sql/updates/world/2011_09_11_00_world_creature_template.sql b/sql/updates/world/2011_09_11_00_world_creature_template.sql new file mode 100644 index 00000000000..a4bf485350b --- /dev/null +++ b/sql/updates/world/2011_09_11_00_world_creature_template.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `unit_flags` = `unit_flags` &~1 WHERE `unit_flags` & 1;
\ No newline at end of file diff --git a/sql/updates/world/2011_09_11_01_world_sai.sql b/sql/updates/world/2011_09_11_01_world_sai.sql new file mode 100644 index 00000000000..453acf60dd9 --- /dev/null +++ b/sql/updates/world/2011_09_11_01_world_sai.sql @@ -0,0 +1,51 @@ +-- Sets SmartAI for Mechagnomes +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=25814; + +-- Says for Mechagnomes +DELETE FROM `creature_text` WHERE `entry`=25814; +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES +(25814,1,1, 'We are Mechagnome...resistance is futile.',12,0,0,0,0,0, ''), +(25814,1,2, 'The flesh is weak. We will make you better, stronger...faster.',12,0,0,0,0,0, ''), +(25814,1,3, 'We can decurse you, we have the technology.',12,0,0,0,0,0, ''); + +-- Mechagnome SAI +-- NOTE: Mechagnome SAI required for Horde quest Souls of the Decursed +DELETE FROM `smart_scripts` WHERE `entryorguid`=25814 AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(25814,0,0,0,4,0,100,0,0,0,0,0,1,1,10000,0,0,0,0,0,0,0,0,0,0,0,0, 'Fizzcrank Mechagnome - Chance Say on Aggro'), +(25814,0,1,0,8,0,100,0,45980,0,0,0,33,25773,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Fizzcrank Mechagnome - Killcredit on spellhit - Recursive'), +(25814,0,2,0,8,0,100,0,46485,0,0,0,33,26096,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Fizzcrank Mechagnome - Killcredit on spellhit - Souls of the Decursed'); +-- (25814,0,2,0,61,0,100,0,0,0,0,0,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Fizzcrank Mechagnome - On Re-Cursive Transmatter Injection spellhit despawn self'), + +-- Links item spell to spawn spell +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=45980; +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (45980,46022,0, 'Re-Cursive quest'); + +-- Despawn Mechagnome after spellcast (Mechagnome would not despawn using SAI resulting in possibility of multiple uses of item for credit) +DELETE FROM `spell_scripts` WHERE `id`=45980; +INSERT INTO `spell_scripts` (`id`, `effIndex`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) VALUES +(45980,0,1,18,0,0,0,0,0,0,0); + +-- FOR SURVIVOR + +-- Sets smartAI for Fizzcrank Survivor +UPDATE `creature_template` SET `AIName` ='SmartAI' WHERE `entry`=25773; + +-- Says for Fizzcrank Survivor +DELETE FROM `creature_text` WHERE `entry`=25773; +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES +(25773,0,1, 'I survived and I''m flesh again!',12,0,0,0,0,0, ''), +(25773,0,2, 'But... but... I was perfect!',12,0,0,0,0,0, ''), +(25773,0,3, 'Where am I? Who are you? What''s that strange feeling?',12,0,0,0,0,0, ''), +(25773,0,4, 'I''m flesh and blood again! Thank you!',12,0,0,0,0,0, ''); + +-- Random says, Teleport spell effect & despawn +DELETE FROM `smart_scripts` WHERE `entryorguid`=25773 AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(25773,0,0,0,1,0,100,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 'Fizzcrank Survivor - On spawn talk'), +(25773,0,1,0,1,0,100,1,5000,5000,5000,5000,11,41232,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Fizzcrank Survivor - OOC Cast spell'), +(25773,0,2,0,1,0,100,0,5000,5000,5000,5000,41,2000,0,0,0,0,0,0,0,0,0,0,0,0,0, 'Fizzcrank Survivor - OOC Force despawn'); + +-- Remove Eventai and Eventai says +DELETE FROM `creature_ai_scripts` WHERE `creature_id` IN (25814,25773); +DELETE FROM `creature_ai_texts` WHERE `entry` IN (-533,-534,-535); diff --git a/sql/updates/world/2011_09_11_02_world_creature_template.sql b/sql/updates/world/2011_09_11_02_world_creature_template.sql new file mode 100644 index 00000000000..1784e983832 --- /dev/null +++ b/sql/updates/world/2011_09_11_02_world_creature_template.sql @@ -0,0 +1,4 @@ +UPDATE `creature_template` SET `exp`=0,`speed_run`=0.78571 WHERE `entry`=28239; -- Arcane Beam +DELETE FROM `creature_template_addon` WHERE `entry`=28239; +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(28239,0,0,1,0, '51019'); -- Arcane Beam diff --git a/sql/updates/world/2011_09_11_03_world_gameobject.sql b/sql/updates/world/2011_09_11_03_world_gameobject.sql new file mode 100644 index 00000000000..b72898ba8a9 --- /dev/null +++ b/sql/updates/world/2011_09_11_03_world_gameobject.sql @@ -0,0 +1,5 @@ +UPDATE `gameobject_template` SET `WDBVerified`=12340 WHERE `entry`=179545; +DELETE FROM `gameobject` WHERE `id` IN (179545,179485); +INSERT INTO `gameobject` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`) VALUES +(6,179545,429,1,1,116.135,638.836,-48.467,-0.785397,0,0,0,1,7200,255,1), +(159,179485,429,1,1,558.806,550.065,-25.4008,3.14159,0,0,0,1,180,255,1); diff --git a/sql/updates/world/2011_09_11_04_world_spell_linked_spell.sql b/sql/updates/world/2011_09_11_04_world_spell_linked_spell.sql new file mode 100644 index 00000000000..120378bd3e2 --- /dev/null +++ b/sql/updates/world/2011_09_11_04_world_spell_linked_spell.sql @@ -0,0 +1,10 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`IN (65686, 65684, 67222, 67176, 67223, 67177, 67224, 67178); +INSERT INTO `spell_linked_spell` (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES +(65686, -65684, 2, 'Remove Dark Essence 10M'), +(65684, -65686, 2, 'Remove Light Essence 10M'), +(67222, -67176, 2, 'Remove Dark essence 10M H'), +(67176, -67222, 2, 'Remove Light essence 10M H'), +(67223, -67177, 2, 'Remove Dark essence 25M'), +(67177, -67223, 2, 'Remove Light essence 25M'), +(67224, -67178, 2, 'Remove Dark essence 25M H'), +(67178, -67224, 2, 'Remove Light essence 25M H'); diff --git a/sql/updates/world/2011_09_11_05_world_misc.sql b/sql/updates/world/2011_09_11_05_world_misc.sql new file mode 100644 index 00000000000..7357d9acda6 --- /dev/null +++ b/sql/updates/world/2011_09_11_05_world_misc.sql @@ -0,0 +1,32 @@ +-- Orgrimmar: Hidden Enemies (5727) +SET @Gossip=21272; + +DELETE FROM `gossip_menu` WHERE `text_id` IN (4513,4533,4534,4535,4536); +INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES +(3701,4513), -- 1st +(@Gossip+0,4533), -- 2nd +(@Gossip+1,4534), -- 3rd +(@Gossip+2,4535), -- 4th +(@Gossip+3,4536); -- last +DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (3701,@Gossip+0,@Gossip+1,@Gossip+2,@Gossip+3); +INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_icon`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`,`action_poi_id`,`box_coded`,`box_money`,`box_text`) VALUES +(3701,0,0, 'You may speak frankly, Neeru...' ,1,1,@Gossip+0,0,0,0,NULL), +(@Gossip+0,0,0, 'It is good to see the Burning Blade is taking over where the Shadow Council once failed.' ,1,1,@Gossip+1,0,0,0,NULL), +(@Gossip+1,0,0, 'So the Searing Blade is expendable?' ,1,1,@Gossip+2,0,0,0,NULL), +(@Gossip+2,0,0, 'If there is anything you would have of me...' ,1,1,@Gossip+3,0,0,0,NULL); -- Must Link to Final Action Menu as well + +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=3216; -- Neeru Fireblade +DELETE FROM `smart_scripts` WHERE `entryorguid`=3216 AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(3216, 0, 0, 0, 62, 0, 100, 0, @Gossip+2, 0, 0, 0, 15, 5727, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Neeru Fireblade - On gossip select give Hidden Enemies quest completed'); + +UPDATE `quest_template` SET `SpecialFlags`=`SpecialFlags`|2 WHERE `entry`=5727; -- Hidden Enemies (quest completable by external event) +-- Conditions so gossips don't show up if the player doesn't have the item +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=3701; +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup` BETWEEN @Gossip+0 AND @Gossip+3; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(15,3701,0,0,2,14544,1,0,0,'', 'Neeru Fireblade: Quest Hidden Enemies gossip option - requires item Lieutenant''s Insignia'), +(14,@Gossip+0,4533,0,2,14544,1,0,0, '', 'Neeru Fireblade: Quest Hidden Enemies gossip 1 - requires item Lieutenant''s Insignia'), +(14,@Gossip+1,4534,0,2,14544,1,0,0, '', 'Neeru Fireblade: Quest Hidden Enemies gossip 2 - requires item Lieutenant''s Insignia'), +(14,@Gossip+2,4535,0,2,14544,1,0,0, '', 'Neeru Fireblade: Quest Hidden Enemies gossip 3 - requires item Lieutenant''s Insignia'), +(14,@Gossip+3,4536,0,2,14544,1,0,0, '', 'Neeru Fireblade: Quest Hidden Enemies gossip 4 - requires item Lieutenant''s Insignia'); diff --git a/sql/updates/world/2011_09_11_06_world_spell_conditions.sql b/sql/updates/world/2011_09_11_06_world_spell_conditions.sql new file mode 100644 index 00000000000..a4608599452 --- /dev/null +++ b/sql/updates/world/2011_09_11_06_world_spell_conditions.sql @@ -0,0 +1,8 @@ +DELETE FROM `spell_linked_spell` WHERE `spell_trigger`=66512; +INSERT INTO `spell_linked_spell` VALUES +(66512, 66510, 0, 'Summon Deep Jormungar on Pound Drum'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceGroup`=0 AND `SourceEntry`=66512; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 0, 66512, 0, 18, 0, 195308, 0, 0, '', 'Pound Drum: Target Mysterious Snow Mound'), +(13, 0, 66512, 0, 18, 0, 195309, 0, 0, '', 'Pound Drum: Target Mysterious Snow Mound'); diff --git a/sql/updates/world/2011_09_11_07_world_sai.sql b/sql/updates/world/2011_09_11_07_world_sai.sql new file mode 100644 index 00000000000..02a593eb9b4 --- /dev/null +++ b/sql/updates/world/2011_09_11_07_world_sai.sql @@ -0,0 +1,15 @@ +-- Morbent Fel SAI +SET @ENTRY := 1200; +SET @SPELL_SACRED_CLEANSING := 8913; +SET @SPELL_TOUCH_OF_DEATH := 3108; +SET @SPELL_PRESENCE_OF_DEATH := 3109; +SET @SPELL_UNHOLY_SHIELD := 8909; +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=@ENTRY; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@ENTRY; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,1,0,100,1,0,0,0,0,11,@SPELL_UNHOLY_SHIELD,0,0,0,0,0,1,0,0,0,0,0,0,0,"Morbent Fel - Out Of Combat - Cast Unholy Shield"), +(@ENTRY,0,1,0,8,0,100,0,@SPELL_SACRED_CLEANSING,0,0,0,36,24782,0,0,0,0,0,1,0,0,0,0,0,0,0,"Morbent Fel - On Spellhit - Update Template"), +(@ENTRY,0,2,0,0,0,100,0,0,0,24000,24000,11,@SPELL_TOUCH_OF_DEATH,0,0,0,0,0,2,0,0,0,0,0,0,0,"Morbent Fel - In Combat - Cast Touch of Death"), +(@ENTRY,0,3,0,0,0,100,0,0,0,3700,13300,11,@SPELL_PRESENCE_OF_DEATH,0,0,0,0,0,2,0,0,0,0,0,0,0,"Morbent Fel - In Combat - Cast Presence of Death"), +(@ENTRY,0,4,0,2,0,100,1,0,15,0,0,28,@SPELL_UNHOLY_SHIELD,1,0,0,0,0,1,0,0,0,0,0,0,0,"Morbent Fel - At 15% HP - Remove Unholy Shield"); diff --git a/sql/updates/world/2011_09_11_08_world_creature.sql b/sql/updates/world/2011_09_11_08_world_creature.sql new file mode 100644 index 00000000000..de608e7cdff --- /dev/null +++ b/sql/updates/world/2011_09_11_08_world_creature.sql @@ -0,0 +1,6 @@ +DELETE FROM `creature` WHERE `id`=25589; +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 +(2017,25589,571,1,1,0,0,4464.63,5378.07,-15.2737,6.05299,600,0,0,1,0,0); +DELETE FROM `creature_template_addon` WHERE `entry`=25589; +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(25589,0,1,1,0, ''); -- sitting diff --git a/sql/updates/world/2011_09_11_09_world_script_texts.sql b/sql/updates/world/2011_09_11_09_world_script_texts.sql new file mode 100644 index 00000000000..49bbca06877 --- /dev/null +++ b/sql/updates/world/2011_09_11_09_world_script_texts.sql @@ -0,0 +1,14 @@ +DELETE FROM `script_texts` WHERE `npc_entry`=27654 AND `entry` BETWEEN -1578016 AND -1578005; +INSERT INTO `script_texts` (`npc_entry`, `entry`, `content_default`, `sound`, `type`, `comment`) VALUES +(27654, -1578005, 'The prisoners shall not go free! The word of Malygos is law!', 13594, 1, 'SAY_AGGRO'), +(27654, -1578006, 'A fitting punishment!', 13602, 1, 'SAY_KILL_1'), +(27654, -1578007, 'Sentence: executed!', 13603, 1, 'SAY_KILL_2'), +(27654, -1578008, 'Another casualty of war!', 13604, 1, 'SAY_KILL_3'), +(27654, -1578009, 'The war... goes on.', 13605, 1, 'SAY_DEATH'), +(27654, -1578010, 'It is too late to run!', 13598, 1, 'SAY_PULL_1'), +(27654, -1578011, 'Gather ''round....', 13599, 1, 'SAY_PULL_2'), +(27654, -1578012, 'None shall escape!', 13600, 1, 'SAY_PULL_3'), +(27654, -1578013, 'I condemn you to death!', 13601, 1, 'SAY_PULL_4'), +(27654, -1578014, 'Tremble, worms!', 13595, 1, 'SAY_STOMP_1'), +(27654, -1578015, 'I will crush you!', 13596, 1, 'SAY_STOMP_2'), +(27654, -1578016, 'Can you fly?', 13597, 1, 'SAY_STOMP_3'); diff --git a/sql/updates/world/2011_09_12_00_world_misc.sql b/sql/updates/world/2011_09_12_00_world_misc.sql new file mode 100644 index 00000000000..18ead48b821 --- /dev/null +++ b/sql/updates/world/2011_09_12_00_world_misc.sql @@ -0,0 +1,61 @@ +SET @Gossip=21276; +SET @Azuregos=15481; -- Spirit of Azuregos +SET @Item=20949; -- Magical Ledger +UPDATE `creature_template` SET `gossip_menu_id`=@Gossip, `AIName`='SmartAI' WHERE `entry`=@Azuregos; + +DELETE FROM `gossip_menu` WHERE (`entry` BETWEEN @Gossip AND @Gossip+12) AND `text_id` IN (7881,7901,7885,7886,7887,7888,7889,7890,7891,7892,7893,7894,7895,7896,7897); +INSERT INTO `gossip_menu` (`entry`, `text_id`) VALUES +(@Gossip+00, 7881), -- gossip if no quest nor item +(@Gossip+00, 7901), -- gossip if item +(@Gossip+00, 7885), -- 01 +(@Gossip+01, 7886), -- 02 +(@Gossip+02, 7887), -- 03 +(@Gossip+03, 7888), -- 04 +(@Gossip+04, 7889), -- 05 +(@Gossip+05, 7890), -- 06 +(@Gossip+06, 7891), -- 07 +(@Gossip+07, 7892), -- 08 +(@Gossip+08, 7893), -- 09 +(@Gossip+09, 7894), -- 10 +(@Gossip+10, 7895), -- 11 +(@Gossip+11, 7896), -- 12 +(@Gossip+12, 7897); -- 13 + +DELETE FROM `gossip_menu_option` WHERE `menu_id` BETWEEN @Gossip AND @Gossip + 14; +INSERT INTO `gossip_menu_option` (`menu_id`,`id`,`option_text`,`option_id`,`npc_option_npcflag`,`action_menu_id`) VALUES +(@Gossip+00,0,'How did you know? I mean, yes... Yes I am looking for that shard. Do you have it?',1,1,@Gossip+01), +(@Gossip+01,0,'Alright. Where?',1,1,@Gossip+02), +(@Gossip+02,0,'By Bronzebeard''s... um, beard! What are you talking about?',1,1,@Gossip+03), +(@Gossip+03,0,'Fish? You gave a piece of what could be the key to saving all life on Kalimdor to a fish?',1,1,@Gossip+04), +(@Gossip+04,0,'A minnow? The oceans are filled with minnows! There could be a hundred million million minnows out there!',1,1,@Gossip+05), +(@Gossip+05,0,'...',1,1,@Gossip+06), +(@Gossip+06,0,'You put the piece on a minnow and placed the minnow somewhere in the waters of the sea between here and the Eastern Kingdoms? And this minnow has special powers?',1,1,@Gossip+07), +(@Gossip+07,0,'You''re insane.',1,1,@Gossip+08), +(@Gossip+08,0,'I''m all ears.',1,1,@Gossip+09), +(@Gossip+09,0,'Come again.',1,1,@Gossip+10), +(@Gossip+10,0,'Ok, let me get this straight. You put the scepter entrusted to your Flight by Anachronos on a minnow of your own making and now you expect me to build an... an arcanite buoy or something... to force your minnow out of hiding? AND potentially incur the wrath of an Elemental Lord? Did I miss anything? Perhaps I am to do this without any clothes on, during a solar eclipse, on a leap year?',1,1,@Gossip+11), +(@Gossip+11,0,'FINE! And how, dare I ask, am I supposed to acquire an arcanite buoy?',1,1,@Gossip+12), +(@Gossip+12,0,'But...',1,1,0); + +DELETE FROM `creature_text` WHERE `entry`=@Azuregos; +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES +(@Azuregos, 0, 0, 'I SAID GOOD BYE!', 12, 0, 100, 1, 0, 0, 'Spirit of Azuregos'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` IN (14,15) AND `SourceGroup` BETWEEN @Gossip+0 AND @Gossip+2; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`Comment`) VALUES +(14,@Gossip+0,7901,0,2,@Item,1, 'Spirit of Azuregos - show gossip 7901 if player has item Magical Ledger'), +(14,@Gossip+0,7885,0,14,8575,0, 'Spirit of Azuregos - show gossip 7885 if player does not have quest Azuregos''s Magical Ledger'), +(14,@Gossip+0,7885,0,8,8555,0, 'Spirit of Azuregos - show gossip 7885 if player has quest The Charge of the Dragonflights rewarded'), +(14,@Gossip+0,7881,0,14,8555,0, 'Spirit of Azuregos - show gossip 7881 if player does not have quest The Charge of the Dragonflights'), +(15,@Gossip+0,0,0,26,@Item,1, 'Spirit of Azuregos - show gossip option if player does not have item Magical Ledger'), +(15,@Gossip+0,0,0,14,8575,0, 'Spirit of Azuregos - show gossip option if player does not have quest Azuregos''s Magical Ledger'), +(15,@Gossip+0,0,0,8,8555,0, 'Spirit of Azuregos - show gossip option if player has quest The Charge of the Dragonflights rewarded'); + +DELETE FROM `smart_scripts` WHERE `entryorguid`=@Azuregos AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@Azuregos, 0, 0, 0, 62, 0, 100, 0, @Gossip+11, 0, 0, 0, 56, @Item, 1, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Spirit of Azuregos - On gossip select 11 give item'), +(@Azuregos, 0, 1, 2, 62, 0, 100, 0, @Gossip+12, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Spirit of Azuregos - On gossip select 12 close gossip'), +(@Azuregos, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Spirit of Azuregos - Link 2 say'); + +-- Not related +UPDATE `game_event` SET `start_time`='2011-12-04 00:01:00' WHERE `eventEntry`=4; diff --git a/sql/updates/world/2011_09_12_01_world_misc.sql b/sql/updates/world/2011_09_12_01_world_misc.sql new file mode 100644 index 00000000000..f2fa54b1b17 --- /dev/null +++ b/sql/updates/world/2011_09_12_01_world_misc.sql @@ -0,0 +1,31 @@ +SET @GUID = 209102; + +-- add creatures +DELETE FROM `creature` WHERE `id` IN (28601, 28602) AND `map`=1; +INSERT INTO `creature` (`guid`, `id`, `map`, `position_x`, `position_y`, `position_z`, `orientation`) VALUES +(@GUID+00,28601, 1, -6027.13, -1249.12, -146.765, 0.0407544), +(@GUID+01,28602, 1, -6165.74, -1250.34, -162.183, 3.16428), +(@GUID+02,28602, 1, -6118.16, -1258.77, -143.281, 3.17606), +(@GUID+03,28602, 1, -6118.18, -1241.33, -143.281, 3.12169), +(@GUID+04,28602, 1, -6104.87, -1256.41, -143.281, 3.04315), +(@GUID+05,28602, 1, -6104.56, -1243.58, -143.281, 3.07064), +(@GUID+06,28602, 1, -6067.35, -1243.76, -143.481, 3.17274), +(@GUID+07,28602, 1, -6067.17, -1255.45, -143.430, 3.15703), +(@GUID+08,28602, 1, -6038.16, -1243.56, -146.897, 3.15153), +(@GUID+09,28602, 1, -6036.82, -1255.32, -146.901, 3.19238), +(@GUID+10,28602, 1, -6042.26, -1249.25, -146.887, 3.19238); + +-- add weapons to creatures +DELETE FROM `creature_equip_template` WHERE `entry`=2476; +INSERT INTO `creature_equip_template` VALUES +(2476, 7714, 0, 0); + +-- correct creature_template +UPDATE `creature_template` SET `faction_A` = 2080, `faction_H` = 2080, `lootid` = `entry` WHERE `entry` IN (28601, 28602); +UPDATE `creature_template` SET `equipment_id` = 1803 WHERE `entry`=28601; +UPDATE `creature_template` SET `equipment_id` = 2476 WHERE `entry`=28601; + +-- create questloot +DELETE FROM `creature_loot_template` WHERE `entry`=28601; +INSERT INTO `creature_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `lootmode`, `groupid`, `mincountOrRef`, `maxcount`) VALUES +(28601, 38708, -100, 1, 0, 1, 1); diff --git a/sql/updates/world/2011_09_12_02_world_instance_template.sql b/sql/updates/world/2011_09_12_02_world_instance_template.sql new file mode 100644 index 00000000000..2fe38236e28 --- /dev/null +++ b/sql/updates/world/2011_09_12_02_world_instance_template.sql @@ -0,0 +1,2 @@ +UPDATE `instance_template` SET `allowMount`=1 WHERE `map`=531; -- Allow mount in AQ40 +UPDATE `instance_template` SET `allowMount`=1 WHERE `map`=631; -- Allow mount in ICC diff --git a/sql/updates/world/2011_09_12_03_world_conditions.sql b/sql/updates/world/2011_09_12_03_world_conditions.sql new file mode 100644 index 00000000000..757bdbf255e --- /dev/null +++ b/sql/updates/world/2011_09_12_03_world_conditions.sql @@ -0,0 +1,56 @@ +-- Fix to Spell targets for Ignis adds +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=62343; +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=62488; +INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,0,62343,0,18,1,33121,0,0, '', 'Heat to Iron Construct'), +(13,0,62488,0,18,1,33121,0,0, '', 'Activate Construct to iron Construct'); + +-- Burn Secondary Effect from Vehicles +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=65044; +INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,0,65044,1,18,1,34234,0,0, '', 'Flames to Runeforged Sentry'), +(13,0,65044,2,18,1,33236,0,0, '', 'Flames to Steelforged Defender'), +(13,0,65044,3,18,1,33572,0,0, '', 'Flames to Steelforged Defender'), +(13,0,65044,4,18,1,33237,0,0, '', 'Flames to Ulduar Colossus'), +(13,0,65044,5,18,1,33189,0,0, '', 'Flames to Liquid pyrite'), +(13,0,65044,6,18,1,33090,0,0, '', 'Flames to Pool of Tar'), +(13,0,65044,7,18,1,34161,0,0, '', 'Flames to Mechanostriker 54-A'); + +-- Burn Secondary Effect from Vehicles +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=65045; +INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,0,65045,1,18,1,34234,0,0, '', 'Flames to Runeforged Sentry'), +(13,0,65045,2,18,1,33236,0,0, '', 'Flames to Steelforged Defender'), +(13,0,65045,3,18,1,33572,0,0, '', 'Flames to Steelforged Defender'), +(13,0,65045,4,18,1,33237,0,0, '', 'Flames to Ulduar Colossus'), +(13,0,65045,5,18,1,33189,0,0, '', 'Flames to Liquid pyrite'), +(13,0,65045,6,18,1,33090,0,0, '', 'Flames to Pool of Tar'), +(13,0,65045,7,18,1,34161,0,0, '', 'Flames to Mechanostriker 54-A'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=62911; +INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,0,62911,0,18,1,33365,0,0, '', 'Thorim\'s Hammer to Thorim\'s Hammer'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=62906; +INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,0,62906,0,18,1,33367,0,0, '', 'Freya\'s Ward to Freya\'s Ward'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=62705; +INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,0,62705,1,18,1,33060,0,0, '', 'Auto-repair to Salvaged Siege Engine'), +(13,0,62705,2,18,1,33067,0,0, '', 'Auto-repair to Salvaged Siege Turret'), +(13,0,62705,3,18,1,33062,0,0, '', 'Auto-repair to Salvaged Chopper'), +(13,0,62705,4,18,1,33109,0,0, '', 'Auto-repair to Salvaged Demolisher'), +(13,0,62705,5,18,1,33167,0,0, '', 'Auto-repair to Salvaged Demolisher Mechanic Seat'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=63294; +INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,0,63294,0,18,1,33367,0,0, '', 'Freya Dummy Blue to Freya\'s Ward'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=63295; +INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,0,63295,0,18,1,33367,0,0, '', 'Freya Dummy Green to Freya\'s Ward'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=63292; +INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,0,63292,0,18,1,33367,0,0, '', 'Freya Dummy Yellow to Freya\'s Ward'); diff --git a/sql/updates/world/2011_09_12_04_world_creature_template.sql b/sql/updates/world/2011_09_12_04_world_creature_template.sql new file mode 100644 index 00000000000..6b5a124540d --- /dev/null +++ b/sql/updates/world/2011_09_12_04_world_creature_template.sql @@ -0,0 +1,43 @@ +-- Template updates +UPDATE `creature_template` SET `dynamicflags`=`dynamicflags`&~8 WHERE `entry`=33059; -- Wrecked Demolisher +UPDATE `creature_template` SET `exp`=0 WHERE `entry`=33666; -- Demolisher Engineer Blastwrench +UPDATE `creature_template` SET `dynamicflags`=`dynamicflags`&~8 WHERE `entry`=33063; -- Wrecked Siege Engine +UPDATE `creature_template` SET `npcflag`=`npcflag`|16777216 WHERE `entry`=33067; -- Salvaged Siege Turret +UPDATE `creature_template` SET `VehicleId`=387 WHERE `entry`=33113; -- Flame Leviathan +UPDATE `creature_template` SET `exp`=0 WHERE `entry`=33143; -- Overload Control Device +UPDATE `creature_template` SET `exp`=0,`npcflag`=`npcflag`|16777216,`unit_flags`=`unit_flags`|33571584 WHERE `entry`=33139; -- Flame Leviathan Turret +UPDATE `creature_template` SET `dynamicflags`=`dynamicflags`|12 WHERE `entry`=33216; -- Mechagnome Pilot +UPDATE `creature_template` SET `dynamicflags`=`dynamicflags`|12 WHERE `entry`=33572; -- Steelforged Defender +UPDATE `creature_template` SET `unit_flags`=`unit_flags`|33280 WHERE `entry`=33186; -- Razorscale +UPDATE `creature_template` SET `speed_run`=2.14286 WHERE `entry`=34120; -- Brann's Flying Machine +UPDATE `creature_template` SET `speed_walk`=1.6,`speed_run`=1.42857 WHERE `entry`=33118; -- Ignis the Furnace Master +UPDATE `creature_template` SET `unit_flags`=`unit_flags`|33554688 WHERE `entry`=33121; -- Iron Construct + +-- Model data +UPDATE `creature_model_info` SET `bounding_radius`=5,`combat_reach`=1,`gender`=2 WHERE `modelid`=25870; -- Salvaged Chopper +UPDATE `creature_model_info` SET `bounding_radius`=0.6,`combat_reach`=1,`gender`=1 WHERE `modelid`=28787; -- Razorscale +UPDATE `creature_model_info` SET `bounding_radius`=0.62,`combat_reach`=1,`gender`=0 WHERE `modelid`=29185; -- Ignis the Furnace Master + +-- Addon data +DELETE FROM `creature_template_addon` WHERE `entry` IN (33114,33142,33143,33139,33189,33216,33572,33090,33186,33287,33259,34120, +23033,34086,33118,33210,33121,34085,33816); +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(33114,0,0,257,0, NULL), -- Flame Leviathan Seat +(33142,0,0,1,0, NULL), -- Leviathan Defense Turret +(33143,0,0,1,0, NULL), -- Overload Control Device +(33139,0,0,1,0, NULL), -- Flame Leviathan Turret +(33189,0,0,1,0, NULL), -- Liquid Pyrite +(33216,0,0,1,0, NULL), -- Mechagnome Pilot +(33572,0,0,1,0, NULL), -- Steelforged Defender +(33090,0,0,1,0, NULL),-- Pool of Tar +(33186,0,50331648,1,0, NULL), -- Razorscale +(33816,0,0,1,375, NULL), -- Expedition Defender +(33287,0,0,1,0, NULL), -- Expedition Engineer +(33259,0,0,1,375, NULL), -- Expedition Trapper +(34120,0,50331648,1,0, NULL), -- Brann's Flying Machine +(23033,0,0,1,0, NULL), -- Invisible Stalker (Floating) +(34086,0,33554432,1,0, NULL), -- Magma Rager +(33118,0,0,1,0, NULL), -- Ignis the Furnace Master +(33210,0,0,1,0, NULL), -- Expedition Commander +(33121,0,0,1,0, NULL), -- Iron Construct +(34085,0,0,1,0, NULL); -- Forge Construct diff --git a/sql/updates/world/2011_09_12_05_world_misc.sql b/sql/updates/world/2011_09_12_05_world_misc.sql new file mode 100644 index 00000000000..ffb183b31e4 --- /dev/null +++ b/sql/updates/world/2011_09_12_05_world_misc.sql @@ -0,0 +1,12 @@ +DELETE FROM `spell_dbc` WHERE `Id`=37794; +INSERT INTO `spell_dbc` (`Id`,`Dispel`,`Mechanic`,`Attributes`,`AttributesEx`,`AttributesEx2`,`AttributesEx3`,`AttributesEx4`,`AttributesEx5`,`AttributesEx6`,`AttributesEx7`,`Stances`,`StancesNot`,`Targets`,`CastingTimeIndex`,`AuraInterruptFlags`,`ProcFlags`,`ProcChance`,`ProcCharges`,`MaxLevel`,`BaseLevel`,`SpellLevel`,`DurationIndex`,`RangeIndex`,`StackAmount`,`EquippedItemClass`,`EquippedItemSubClassMask`,`EquippedItemInventoryTypeMask`,`Effect1`,`Effect2`,`Effect3`,`EffectDieSides1`,`EffectDieSides2`,`EffectDieSides3`,`EffectRealPointsPerLevel1`,`EffectRealPointsPerLevel2`,`EffectRealPointsPerLevel3`,`EffectBasePoints1`,`EffectBasePoints2`,`EffectBasePoints3`,`EffectMechanic1`,`EffectMechanic2`,`EffectMechanic3`,`EffectImplicitTargetA1`,`EffectImplicitTargetA2`,`EffectImplicitTargetA3`,`EffectImplicitTargetB1`,`EffectImplicitTargetB2`,`EffectImplicitTargetB3`,`EffectRadiusIndex1`,`EffectRadiusIndex2`,`EffectRadiusIndex3`,`EffectApplyAuraName1`,`EffectApplyAuraName2`,`EffectApplyAuraName3`,`EffectAmplitude1`,`EffectAmplitude2`,`EffectAmplitude3`,`EffectMultipleValue1`,`EffectMultipleValue2`,`EffectMultipleValue3`,`EffectMiscValue1`,`EffectMiscValue2`,`EffectMiscValue3`,`EffectMiscValueB1`,`EffectMiscValueB2`,`EffectMiscValueB3`,`EffectTriggerSpell1`,`EffectTriggerSpell2`,`EffectTriggerSpell3`,`EffectSpellClassMaskA1`,`EffectSpellClassMaskA2`,`EffectSpellClassMaskA3`,`EffectSpellClassMaskB1`,`EffectSpellClassMaskB2`,`EffectSpellClassMaskB3`,`EffectSpellClassMaskC1`,`EffectSpellClassMaskC2`,`EffectSpellClassMaskC3`,`MaxTargetLevel`,`SpellFamilyName`,`SpellFamilyFlags1`,`SpellFamilyFlags2`,`SpellFamilyFlags3`,`MaxAffectedTargets`,`DmgClass`,`PreventionType`,`DmgMultiplier1`,`DmgMultiplier2`,`DmgMultiplier3`,`AreaGroupId`,`SchoolMask`,`Comment`)VALUES +(37794,0,0,384,0,0,1048576,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,21,1,0,-1,0,0,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,56,0,0,0,0,0,0,0,0,16963,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,'Transform Infernal'); + +-- Template updates +UPDATE `creature_template` SET `unit_flags`=0,`AIName`='SmartAI' WHERE `entry`=21419; -- Infernal Attacker +UPDATE `creature_model_info` SET `bounding_radius`=1.3545,`combat_reach`=3,`gender`=2 WHERE `modelid`=20577; -- Infernal Attacker +UPDATE `creature_template_addon` SET `bytes1`=0,`bytes2`=1,`mount`=0,`emote`=0,`auras`=NULL WHERE `entry`=21419; -- Infernal Attacker + +DELETE FROM `smart_scripts` WHERE `entryorguid`=21419 AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(21419, 0, 0, 0, 11, 0, 100, 0, 0, 0, 0, 0, 11, 37794, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Infernal Attacker - On spawn cast Transform Infernal on self'); diff --git a/sql/updates/world/2011_09_12_06_world_event_scripts.sql b/sql/updates/world/2011_09_12_06_world_event_scripts.sql new file mode 100644 index 00000000000..eb6b26bc8a0 --- /dev/null +++ b/sql/updates/world/2011_09_12_06_world_event_scripts.sql @@ -0,0 +1,10 @@ +DELETE FROM `event_scripts` WHERE `id` IN (16929,17084); +INSERT INTO `event_scripts` (`id`, `delay`, `command`, `datalong`, `datalong2`, `dataint`, `x`, `y`, `z`, `o`) VALUES +-- H +(16929, 3, 10, 25742, 360000, 0, 3533.64, 4535.52, -12.9953, 3.47514), -- Alluvion +(16929, 10, 8, 25742, 0, 0, 0, 0, 0, 0), -- KC +(16929, 3, 10, 25629, 360000, 0, 3511.96, 4527.18, -12.9949, 0.357893), -- Kryxix +-- A +(17084, 3, 10, 25794, 360000, 0, 3533.64, 4535.52, -12.9953, 3.47514), -- Shake-n-Quake 5000 +(17084, 10, 8, 25794, 0, 0, 0, 0, 0, 0), -- KC +(17084, 3, 10, 25629, 360000, 0, 3511.96, 4527.18, -12.9949, 0.357893); -- Kryxix diff --git a/sql/updates/world/2011_09_12_07_world_creature.sql b/sql/updates/world/2011_09_12_07_world_creature.sql new file mode 100644 index 00000000000..d2496cb1eab --- /dev/null +++ b/sql/updates/world/2011_09_12_07_world_creature.sql @@ -0,0 +1,4 @@ +UPDATE `creature` SET `spawnMask`=1 WHERE `guid` IN (1102,85587) AND `id` IN (22237,17318); +DELETE FROM `game_event_creature` WHERE `eventEntry`=7 AND `guid`=1102; +INSERT INTO `game_event_creature` (`eventEntry`, `guid`) VALUES +(7,1102); -- Loirea Galerunner - Lunar Festival diff --git a/sql/updates/world/2011_09_13_00_world_spells.sql b/sql/updates/world/2011_09_13_00_world_spells.sql new file mode 100644 index 00000000000..63e7b295831 --- /dev/null +++ b/sql/updates/world/2011_09_13_00_world_spells.sql @@ -0,0 +1,35 @@ +-- Fix Startup Errors +UPDATE `creature_template` SET `exp`=0,`npcflag`=`npcflag`|16777216,`unit_flags`=`unit_flags`|33571584 WHERE `entry`=34111; +DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN (33139,34111); +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 +(34111,46598,0,0,0,1,0,0,0), +(33139,46598,0,0,0,1,0,0,0); + +-- Added Burn to Vehicles for Hard mode Mechanics +-- Thanks to horn for the reminder +-- Burn Secondary Effect from Vehicles +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry` IN (65044,65045); +INSERT INTO `conditions`(`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(13,0,65044,1,18,1,34234,0,0, '', 'Flames to Runeforged Sentry'), +(13,0,65044,2,18,1,33236,0,0, '', 'Flames to Steelforged Defender'), +(13,0,65044,3,18,1,33572,0,0, '', 'Flames to Steelforged Defender'), +(13,0,65044,4,18,1,33237,0,0, '', 'Flames to Ulduar Colossus'), +(13,0,65044,5,18,1,33189,0,0, '', 'Flames to Liquid pyrite'), +(13,0,65044,6,18,1,33090,0,0, '', 'Flames to Pool of Tar'), +(13,0,65044,7,18,1,34161,0,0, '', 'Flames to Mechanostriker 54-A'), +(13,0,65044,8,18,1,33062,0,0, '', 'Flames to Salvaged Chopper'), +(13,0,65044,9,18,1,34045,0,0, '', 'Flames to Salvaged Chopper'), +(13,0,65044,10,18,1,33109,0,0, '', 'Flames to Salvaged Demolisher'), +(13,0,65044,11,18,1,33060,0,0, '', 'Flames to Salvaged Salvaged Siege Engine'), +-- Burn Secondary Effect from Vehicles +(13,0,65045,1,18,1,34234,0,0, '', 'Flames to Runeforged Sentry'), +(13,0,65045,2,18,1,33236,0,0, '', 'Flames to Steelforged Defender'), +(13,0,65045,3,18,1,33572,0,0, '', 'Flames to Steelforged Defender'), +(13,0,65045,4,18,1,33237,0,0, '', 'Flames to Ulduar Colossus'), +(13,0,65045,5,18,1,33189,0,0, '', 'Flames to Liquid pyrite'), +(13,0,65045,6,18,1,33090,0,0, '', 'Flames to Pool of Tar'), +(13,0,65045,7,18,1,34161,0,0, '', 'Flames to Mechanostriker 54-A'), +(13,0,65045,8,18,1,33062,0,0, '', 'Flames to Salvaged Chopper'), +(13,0,65045,9,18,1,34045,0,0, '', 'Flames to Salvaged Chopper'), +(13,0,65045,10,18,1,33109,0,0, '', 'Flames to Salvaged Demolisher'), +(13,0,65045,11,18,1,33060,0,0, '', 'Flames to Salvaged Salvaged Siege Engine'); diff --git a/sql/updates/world/2011_09_14_00_world_spawns.sql b/sql/updates/world/2011_09_14_00_world_spawns.sql new file mode 100644 index 00000000000..4933af1b735 --- /dev/null +++ b/sql/updates/world/2011_09_14_00_world_spawns.sql @@ -0,0 +1,63 @@ +SET @GUID = 209113; +DELETE FROM `creature` WHERE `id` IN (30395,30446,30450,30454); +INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`) VALUES +(@GUID+00, 30395, 571, 1, 1, 8348.89, -2509.48, 1147.37, 3.7001, 120, 0), +(@GUID+01, 30446, 571, 1, 1, 8253.4, -2566.37, 1149.7, 0.0698132, 120, 0), +(@GUID+02, 30446, 571, 1, 1, 8281.26, -2612.78, 1150.66, 0.349066, 120, 0), +(@GUID+03, 30446, 571, 1, 1, 8283.91, -2585.09, 1149.51, 5.00909, 120, 0), +(@GUID+04, 30446, 571, 1, 1, 8300.43, -2564.86, 1153.59, 0.261799, 120, 0), +(@GUID+05, 30446, 571, 1, 1, 8310.22, -2550.68, 1153.69, 1.91986, 120, 0), +(@GUID+06, 30446, 571, 1, 1, 8331.42, -2502.39, 1140.05, 4.53786, 120, 0), +(@GUID+07, 30446, 571, 1, 1, 8354.63, -2549.88, 1148.54, 4.95674, 120, 0), +(@GUID+08, 30446, 571, 1, 1, 8361.87, -2526.85, 1141.39, 3.68264, 120, 0), +(@GUID+09, 30446, 571, 1, 1, 8382.5, -2549.35, 1145.97, 3.82227, 120, 0), +(@GUID+10, 30446, 571, 1, 1, 8393.97, -2540.06, 1131.91, 5.07891, 120, 0), +(@GUID+24, 30454, 571, 1, 1, 8289.31, -2602.48, 1151.42, 1.95477, 120, 0), +(@GUID+25, 30454, 571, 1, 1, 8294.61, -2589.08, 1150.63, 1.39626, 120, 0), +(@GUID+26, 30454, 571, 1, 1, 8300.51, -2596.84, 1151.87, 3.9619, 120, 0), +(@GUID+27, 30454, 571, 1, 1, 8303.38, -2521.44, 1154.39, 5.07891, 120, 0), +(@GUID+28, 30454, 571, 1, 1, 8312.52, -2561.31, 1152.03, 4.72984, 120, 0), +(@GUID+29, 30454, 571, 1, 1, 8314.11, -2500.82, 1143.3, 1.6057, 120, 0), +(@GUID+30, 30454, 571, 1, 1, 8317.65, -2573.94, 1151.43, 3.03687, 120, 0), +(@GUID+31, 30454, 571, 1, 1, 8336.79, -2502.89, 1133.36, 5.41052, 120, 0), +(@GUID+32, 30454, 571, 1, 1, 8342.26, -2505.45, 1134.28, 4.01426, 120, 0), +(@GUID+33, 30454, 571, 1, 1, 8351.38, -2508.96, 1135.07, 0.244346, 120, 0), +(@GUID+34, 30454, 571, 1, 1, 8381.3, -2529.69, 1133.36, 4.62512, 120, 0), +(@GUID+35, 30454, 571, 1, 1, 8387.79, -2527.25, 1135.03, 4.53786, 120, 0), +(@GUID+36, 30454, 571, 1, 1, 8393.11, -2548.1, 1143.71, 1.72788, 120, 0), +(@GUID+37, 30454, 571, 1, 1, 8398.62, -2526.46, 1134.62, 3.80482, 120, 0), +(@GUID+38, 30454, 571, 1, 1, 8401.63, -2539.44, 1132.53, 1.39626, 120, 0), +(@GUID+39, 30454, 571, 1, 1, 8406.36, -2532.98, 1131.75, 2.04204, 120, 0); +INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `MovementType`) VALUES +(@GUID+11, 30450, 571, 1, 1, 8259.18, -2570.82, 1149.61, 1.56682, 120, 5, 1), +(@GUID+12, 30450, 571, 1, 1, 8264.03, -2566.79, 1149.61, 2.96147, 120, 5, 1), +(@GUID+13, 30450, 571, 1, 1, 8284.46, -2601.7, 1150.49, 5.66794, 120, 5, 1), +(@GUID+14, 30450, 571, 1, 1, 8292.88, -2572.04, 1146.46, 1.3252, 120, 5, 1), +(@GUID+15, 30450, 571, 1, 1, 8298.51, -2592.29, 1150.48, 0.513648, 120, 5, 1), +(@GUID+16, 30450, 571, 1, 1, 8306.36, -2524.83, 1152.22, 2.29176, 120, 5, 1), +(@GUID+17, 30450, 571, 1, 1, 8313.22, -2565.91, 1150.88, 0.739577, 120, 5, 1), +(@GUID+18, 30450, 571, 1, 1, 8334.5, -2519.78, 1138.3, 5.60389, 120, 5, 1), +(@GUID+19, 30450, 571, 1, 1, 8336.27, -2512.15, 1135.11, 3.55008, 120, 5, 1), +(@GUID+20, 30450, 571, 1, 1, 8350.84, -2544.52, 1147.52, 5.8518, 120, 5, 1), +(@GUID+21, 30450, 571, 1, 1, 8365.42, -2533.72, 1132.69, 5.61117, 120, 5, 1), +(@GUID+22, 30450, 571, 1, 1, 8377.27, -2545.82, 1140.66, 2.91336, 120, 5, 1), +(@GUID+23, 30450, 571, 1, 1, 8396.34, -2529.92, 1131.82, 1.30778, 120, 5, 1); + +UPDATE `creature_template` SET `npcflag`=3,`gossip_menu_id`=9906 WHERE `entry`=30395; -- Chieftain Swiftspear +UPDATE `creature_template` SET `InhabitType`=7 WHERE `entry`=30446; -- Frostfloe Rift +UPDATE `creature_template` SET `MovementType`=1 WHERE `entry`=30450; -- Wailing Winds +UPDATE `creature_template` SET `InhabitType`=7,`flags_extra`=`flags_extra`|128 WHERE `entry`=30454; -- Frostfloe Deep Stalker + +UPDATE `creature_model_info` SET `bounding_radius`=0.6076385,`combat_reach`=2.625,`gender`=0 WHERE `modelid`=27004; -- Chieftain Swiftspear +UPDATE `creature_model_info` SET `bounding_radius`=0.5,`combat_reach`=1,`gender`=2 WHERE `modelid`=27617; -- Wailing Winds + +DELETE FROM `creature_template_addon` WHERE `entry` IN (30395,30446,30450,30454); +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(30395,0,0,1,0, NULL), -- Chieftain Swiftspear +(30446,0,0x3000000,1,0, NULL), -- Frostfloe Rift +(30450,0,0,1,0, NULL), -- Wailing Winds +(30454,0,0x3000000,1,0, NULL); -- Frostfloe Deep Stalker + +DELETE FROM `gossip_menu` WHERE `entry`=9906 AND `text_id`=13776; +INSERT INTO `gossip_menu` (`entry`, `text_id`) VALUES +(9906, 13776); diff --git a/sql/updates/world/2011_09_14_01_world_quest.sql b/sql/updates/world/2011_09_14_01_world_quest.sql new file mode 100644 index 00000000000..1b6c53f7d9d --- /dev/null +++ b/sql/updates/world/2011_09_14_01_world_quest.sql @@ -0,0 +1,82 @@ +-- Quest 12983 "Last of Her Kind" + +-- Add Injured Icemaw Matriarch +DELETE FROM `creature` WHERE `id`=29563; +INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`,`npcflag`,`unit_flags`,`dynamicflags`) VALUES +(152124,29563,571,1,1,0,0,7335.381,-2055.097,764.3585,3.368485,120,0,0,1,0,0,0,0,0); +UPDATE `creature_template` SET `npcflag`=`npcflag`|16777216 WHERE `entry`=29563; -- Injured Icemaw Matriarch +-- SAI for Harnessed Icemaw Matriarch +SET @ENTRY := 30468; +UPDATE `creature_template` SET `AIName`='SmartAI', `faction_A`=35, `faction_H`=35 WHERE `entry`=@ENTRY; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@ENTRY; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@ENTRY,0,0,0,27,0,100,0,0,0,0,0,53,1,@ENTRY,0,12983,0,0,1,0,0,0,0,0,0,0, 'Harnessed Icemaw Matriarch - On Passenger - Start WP movement'), +(@ENTRY,0,1,0,40,0,100,0,1,@ENTRY,0,0,18,130,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Harnessed Icemaw Matriarch - Reach Waypoint - Make Unatackable'), +(@ENTRY,0,2,0,40,0,100,0,50,@ENTRY,0,0,33,29563,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Harnessed Icemaw Matriarch - Reach Waypoint - Quest Credit'), +(@ENTRY,0,3,0,40,0,100,0,51,@ENTRY,0,0,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Harnessed Icemaw Matriarch - Reach Waypoint - Despawn'); +-- Waypoints for Harnessed Icemaw Matriarch +DELETE FROM `waypoints` WHERE `entry`=30468; +INSERT INTO `waypoints` (`entry`,`pointid`,`position_x`,`position_y`,`position_z`,`point_comment`) VALUES +(30468,1,7339.617,-2058.659,764.919,'Harnessed Icemaw Matriarch'), +(30468,2,7338.267,-2064.381,765.3577,'Harnessed Icemaw Matriarch'), +(30468,3,7335.772,-2073.805,767.4077,'Harnessed Icemaw Matriarch'), +(30468,4,7327.591,-2087.35,770.8978,'Harnessed Icemaw Matriarch'), +(30468,5,7319.448,-2095.41,773.6814,'Harnessed Icemaw Matriarch'), +(30468,6,7305.165,-2107.299,774.3261,'Harnessed Icemaw Matriarch'), +(30468,7,7275.178,-2114.627,775.6678,'Harnessed Icemaw Matriarch'), +(30468,8,7258.999,-2116.149,778.5131,'Harnessed Icemaw Matriarch'), +(30468,9,7241.648,-2119.356,777.7652,'Harnessed Icemaw Matriarch'), +(30468,10,7226.729,-2115.936,777.3341,'Harnessed Icemaw Matriarch'), +(30468,11,7208.441,-2115.223,770.9512,'Harnessed Icemaw Matriarch'), +(30468,12,7198.355,-2115.354,767.3314,'Harnessed Icemaw Matriarch'), +(30468,13,7193.219,-2115.251,765.6339,'Harnessed Icemaw Matriarch'), +(30468,14,7188.855,-2117.307,763.8766,'Harnessed Icemaw Matriarch'), +(30468,15,7177.065,-2123.511,762.9337,'Harnessed Icemaw Matriarch'), +(30468,16,7163.708,-2131.039,762.1168,'Harnessed Icemaw Matriarch'), +(30468,17,7146.599,-2130.739,762.0986,'Harnessed Icemaw Matriarch'), +(30468,18,7127.765,-2130.799,760.3064,'Harnessed Icemaw Matriarch'), +(30468,19,7130.188,-2108.955,761.6824,'Harnessed Icemaw Matriarch'), +(30468,20,7122.738,-2087.617,763.7275,'Harnessed Icemaw Matriarch'), +(30468,21,7114.396,-2070.318,765.9775,'Harnessed Icemaw Matriarch'), +(30468,22,7101.815,-2051.608,765.8251,'Harnessed Icemaw Matriarch'), +(30468,23,7091.483,-2031.099,765.8953,'Harnessed Icemaw Matriarch'), +(30468,24,7087.403,-2012.366,767.2703,'Harnessed Icemaw Matriarch'), +(30468,25,7081.406,-1985.07,767.9617,'Harnessed Icemaw Matriarch'), +(30468,26,7073.832,-1961.028,769.3597,'Harnessed Icemaw Matriarch'), +(30468,27,7068.839,-1934.135,775.7347,'Harnessed Icemaw Matriarch'), +(30468,28,7064.366,-1916.702,781.6978,'Harnessed Icemaw Matriarch'), +(30468,29,7070.385,-1906.559,785.4976,'Harnessed Icemaw Matriarch'), +(30468,30,7079.504,-1899.025,787.0339,'Harnessed Icemaw Matriarch'), +(30468,31,7085.339,-1887.627,788.9089,'Harnessed Icemaw Matriarch'), +(30468,32,7067.585,-1884.709,793.0339,'Harnessed Icemaw Matriarch'), +(30468,33,7041.699,-1884.614,797.4276,'Harnessed Icemaw Matriarch'), +(30468,34,7029.2,-1871.599,803.4189,'Harnessed Icemaw Matriarch'), +(30468,35,7025.071,-1858.876,811.2399,'Harnessed Icemaw Matriarch'), +(30468,36,7018.791,-1838.968,820.2399,'Harnessed Icemaw Matriarch'), +(30468,37,7011.697,-1814.383,820.7299,'Harnessed Icemaw Matriarch'), +(30468,38,7009.096,-1791.501,820.7303,'Harnessed Icemaw Matriarch'), +(30468,39,7017.041,-1758.968,819.6544,'Harnessed Icemaw Matriarch'), +(30468,40,7013.258,-1723.917,819.8597,'Harnessed Icemaw Matriarch'), +(30468,41,6995.103,-1720.753,820.1116,'Harnessed Icemaw Matriarch'), +(30468,42,6975.483,-1722.112,820.7366,'Harnessed Icemaw Matriarch'), +(30468,43,6959.883,-1724.389,820.5955,'Harnessed Icemaw Matriarch'), +(30468,44,6941.025,-1720.429,820.5955,'Harnessed Icemaw Matriarch'), +(30468,45,6920.026,-1709.558,820.7527,'Harnessed Icemaw Matriarch'), +(30468,46,6902.995,-1697.53,820.6683,'Harnessed Icemaw Matriarch'), +(30468,47,6886.746,-1682.953,820.2584,'Harnessed Icemaw Matriarch'), +(30468,48,6867.681,-1684.361,819.8834,'Harnessed Icemaw Matriarch'), +(30468,49,6847.065,-1695.642,819.9857,'Harnessed Icemaw Matriarch'), +(30468,50,6824.819,-1701.835,820.6398,'Harnessed Icemaw Matriarch'), +(30468,51,6824.819,-1701.835,820.5497,'Harnessed Icemaw Matriarch'); + +-- Phasing Spell +DELETE FROM `spell_area` WHERE `spell`=55857 AND `area`=4455; +INSERT INTO `spell_area`(`spell`,`area`,`quest_start`,`quest_start_active`,`quest_end`,`aura_spell`,`racemask`,`gender`,`autocast`) VALUES +(55857,4455,12983,1,12983,0,0,2,1); + +-- From Nay: +-- TODO: Respawn the whole cave, lots of shit wrong (phasemasks etc) +UPDATE `creature` SET `phaseMask`=2 WHERE `id`=29563; +DELETE FROM `creature_template_addon` WHERE `entry`=30468; +INSERT INTO `creature_template_addon` (`entry`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(30468,0,0,1,0, NULL); -- Harnessed Icemaw Matriarch diff --git a/sql/updates/world/2011_09_14_02_world_gossip_menu_option.sql b/sql/updates/world/2011_09_14_02_world_gossip_menu_option.sql new file mode 100644 index 00000000000..cb150388ffb --- /dev/null +++ b/sql/updates/world/2011_09_14_02_world_gossip_menu_option.sql @@ -0,0 +1,6 @@ +UPDATE `gossip_menu_option` SET `option_text`='I seem to have misplaced my Zandalar Madcap''s Mantle. Can you help?' WHERE `menu_id`=21270 AND `id`=0; -- It said: "...Zandalar Madcap's Belt." (Wrong name, that item doesn't exist) +UPDATE `gossip_menu_option` SET `option_text`='I seem to have misplaced my Zandalar Predator''s Mantle. Can you help?' WHERE `menu_id`=21271 AND `id`=2; -- It said: "...Zandalar Predator's Tunic." (Wrong name, that item doesn't exist) +UPDATE `gossip_menu_option` SET `option_text`='I seem to have misplaced my Maelstrom''s Tendril. Can you help?' WHERE `menu_id`=21271 AND `id`=4; -- It said: "... Malestrom's Tendril." (Typo) +UPDATE `gossip_menu_option` SET `option_text`='I seem to have misplaced my Maelstrom''s Tendril. Can you help?' WHERE `menu_id`=21271 AND `id`=5; -- It said: "... Malestrom's Tendril." (Typo) +UPDATE `gossip_menu_option` SET `option_text`='I seem to have misplaced my Maelstrom''s Tendril. Can you help?' WHERE `menu_id`=21271 AND `id`=6; -- It said: "... Malestrom's Tendril." (Typo) +UPDATE `smart_scripts` SET `comment`='Falthir the Sightless - On gossip select 2 give item Zandalar Madcap''s Mantle' WHERE `entryorguid`=14905 AND `id`=2; -- It said: "...Zandalar Augur''s Belt" (Wrong name, that item doesn't correspond with rouge class) diff --git a/sql/updates/world/2011_09_14_03_world_script_texts.sql b/sql/updates/world/2011_09_14_03_world_script_texts.sql new file mode 100644 index 00000000000..8640b403a9a --- /dev/null +++ b/sql/updates/world/2011_09_14_03_world_script_texts.sql @@ -0,0 +1,2 @@ +-- Quest: Tomb of the Lightbringer, make Anchorite Truuen speak Common not Draconic +UPDATE `script_texts` SET `language`=7 WHERE `comment` LIKE 'npc_anchorite_truuen%' AND `language`=11; diff --git a/sql/updates/world/2011_09_14_04_world_creature.sql b/sql/updates/world/2011_09_14_04_world_creature.sql new file mode 100644 index 00000000000..10ef4b7dbb3 --- /dev/null +++ b/sql/updates/world/2011_09_14_04_world_creature.sql @@ -0,0 +1,38 @@ +SET @GUID=209153; +DELETE FROM `creature` WHERE `id`=29413; +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 +(@GUID+0, 29413, 571, 1, 1, 0, 0, 6471.48, -1658.6, 432.644, 5.41462, 600, 0, 0, 1, 0, 0), +(@GUID+1, 29413, 571, 1, 1, 0, 0, 6477.3, -1651.6, 430.185, 5.4107, 600, 0, 0, 1, 0, 0), +(@GUID+2, 29413, 571, 1, 1, 0, 0, 6492.54, -1648.41, 429.39, 5.2222, 600, 0, 0, 1, 0, 0), +(@GUID+3, 29413, 571, 1, 1, 0, 0, 6512.8, -1621.17, 428.168, 6.19609, 600, 0, 0, 1, 0, 0), +(@GUID+4, 29413, 571, 1, 1, 0, 0, 6489.6, -1624.66, 428.328, 2.01384, 600, 0, 0, 1, 0, 0), +(@GUID+5, 29413, 571, 1, 1, 0, 0, 6426.13, -1605.26, 422.576, 1.22452, 600, 0, 0, 1, 0, 0), +(@GUID+6, 29413, 571, 1, 1, 0, 0, 6430.89, -1604.5, 423.222, 0.949627, 600, 0, 0, 1, 0, 0), +(@GUID+7, 29413, 571, 1, 1, 0, 0, 6386.45, -1599.39, 420.724, 2.33193, 600, 0, 0, 1, 0, 0), +(@GUID+8, 29413, 571, 1, 1, 0, 0, 6375.45, -1593.56, 425.553, 1.04387, 600, 0, 0, 1, 0, 0), +(@GUID+9, 29413, 571, 1, 1, 0, 0, 6696.47, -998.844, 415.433, 2.83458, 600, 0, 0, 1, 0, 0), +(@GUID+10, 29413, 571, 1, 1, 0, 0, 6630.7, -1004.17, 424.376, 2.72462, 600, 0, 0, 1, 0, 0), +(@GUID+11, 29413, 571, 1, 1, 0, 0, 6612.56, -1017.17, 427.344, 3.38043, 600, 0, 0, 1, 0, 0), +(@GUID+12, 29413, 571, 1, 1, 0, 0, 6594.54, -1017.6, 429.443, 2.02955, 600, 0, 0, 1, 0, 0), +(@GUID+13, 29413, 571, 1, 1, 0, 0, 6578.55, -982.887, 434.147, 5.99973, 600, 0, 0, 1, 0, 0), +(@GUID+14, 29413, 571, 1, 1, 0, 0, 6580.09, -997.177, 434.919, 5.56384, 600, 0, 0, 1, 0, 0), +(@GUID+15, 29413, 571, 1, 1, 0, 0, 6596.23, -1008.78, 429.445, 5.69736, 600, 0, 0, 1, 0, 0), +(@GUID+16, 29413, 571, 1, 1, 0, 0, 6594.65, -1049.05, 430.103, 2.46544, 600, 0, 0, 1, 0, 0), +(@GUID+17, 29413, 571, 1, 1, 0, 0, 6570.9, -1050.44, 432.848, 3.76527, 600, 0, 0, 1, 0, 0), +(@GUID+18, 29413, 571, 1, 1, 0, 0, 6533.12, -1075.28, 432.917, 1.53867, 600, 0, 0, 1, 0, 0), +(@GUID+19, 29413, 571, 1, 1, 0, 0, 6536.16, -1078.86, 433.175, 1.54652, 600, 0, 0, 1, 0, 0), +(@GUID+20, 29413, 571, 1, 1, 0, 0, 6536.22, -1076.53, 433.014, 1.54652, 600, 0, 0, 1, 0, 0), +(@GUID+21, 29413, 571, 1, 1, 0, 0, 6534.27, -1076.49, 432.958, 1.54652, 600, 0, 0, 1, 0, 0), +(@GUID+22, 29413, 571, 1, 1, 0, 0, 6534.71, -1073.77, 432.928, 1.54652, 600, 0, 0, 1, 0, 0), +(@GUID+23, 29413, 571, 1, 1, 0, 0, 6538.16, -1076.95, 433.1, 1.55438, 600, 0, 0, 1, 0, 0), +(@GUID+24, 29413, 571, 1, 1, 0, 0, 6536.77, -1073.94, 432.995, 1.46013, 600, 0, 0, 1, 0, 0), +(@GUID+25, 29413, 571, 1, 1, 0, 0, 6538.6, -1075.64, 433.11, 1.49155, 600, 0, 0, 1, 0, 0), +(@GUID+26, 29413, 571, 1, 1, 0, 0, 6621.56, -1078.08, 415.032, 1.05174, 600, 5, 0, 1, 0, 1), +(@GUID+27, 29413, 571, 1, 1, 0, 0, 6641.11, -1093.62, 402.801, 1.36196, 600, 0, 0, 1, 0, 0), +(@GUID+28, 29413, 571, 1, 1, 0, 0, 6610.29, -1279.72, 394.475, 3.31761, 600, 0, 0, 1, 0, 0), +(@GUID+29, 29413, 571, 1, 1, 0, 0, 6599.47, -1270.63, 394.829, 1.10278, 600, 0, 0, 1, 0, 0); + +-- Nay: +UPDATE `creature_template_addon` SET `bytes1`=0,`bytes2`=1,`mount`=0,`emote`=233,`auras`=NULL WHERE `entry`=29413; +UPDATE `creature_model_info` SET `bounding_radius`=0.31,`combat_reach`=0,`gender`=0 WHERE `modelid`=27173; +-- Not sure if all of them should have the emote, check this later. diff --git a/sql/updates/world/2011_09_14_05_world_creature_text.sql b/sql/updates/world/2011_09_14_05_world_creature_text.sql new file mode 100644 index 00000000000..9d91056d8db --- /dev/null +++ b/sql/updates/world/2011_09_14_05_world_creature_text.sql @@ -0,0 +1 @@ +UPDATE `creature_text` SET `sound`=16825 WHERE `entry`=37129 AND `groupid`=5 AND `id`=0; diff --git a/sql/updates/world/2011_09_14_06_world_creature_template.sql b/sql/updates/world/2011_09_14_06_world_creature_template.sql new file mode 100644 index 00000000000..4c7474895ad --- /dev/null +++ b/sql/updates/world/2011_09_14_06_world_creature_template.sql @@ -0,0 +1,40 @@ +UPDATE `creature_template` SET `mechanic_immune_mask`=`mechanic_immune_mask` +|1 -- CHARM +|2 -- DISORIENTED +|4 -- DISARM +|8 -- DISTRACT +|16 -- FEAR +|32 -- GRIP +|64 -- ROOT +|128 -- PACIFY +|256 -- SILENCE +|512 -- SLEEP +|1024 -- SNARE +|2048 -- STUN +|4096 -- FREEZE +|8192 -- KNOCKOUT +|65536 -- POLYMORPH +|131072 -- BANISH +|524288 -- SHACKLE +|4194304 -- TURN +|8388608 -- HORROR +|67108864 -- DAZE +|536870912 -- SAPPED +WHERE `entry` IN +(36597,39166,39167,39168, -- The Lich King +36612,37957,37958,37959, -- Lord Marrowgar +36626,37504,37505,37506, -- Festergut +36627,38390,38549,38550, -- Rotface +36678,38431,38585,38586, -- Professor Putricide +36853,38265,38266,38267, -- Sindragosa +36855,38106,38296,38297, -- Lady Deathwhisper +37813,38402,38582,38583, -- Deathbringer Saurfang +37955,38434,38435,38436, -- Blood-Queen Lana'thel +37970,38401,38784,38785, -- Prince Valanar +37972,38399,38769,38770, -- Prince Keseleth +37973,38400,38771,38772); -- Prince Taldaram + +UPDATE `creature_template` SET `mechanic_immune_mask`=`mechanic_immune_mask`&~2097152 /* INFECTED */ WHERE `entry` IN +(36626,37504,37505,37506,-- Festergut +36627,38390,38549,38550, -- Rotface +36678,38431,38585,38586); -- Professor Putricide diff --git a/sql/updates/world/2011_09_15_00_world_creature.sql b/sql/updates/world/2011_09_15_00_world_creature.sql new file mode 100644 index 00000000000..12269e4744d --- /dev/null +++ b/sql/updates/world/2011_09_15_00_world_creature.sql @@ -0,0 +1,2 @@ +-- Remove spawns of Perimeter Bunny - they are spawned by spell 54355 used by GO 191502 (Land Mine) +DELETE FROM `creature` WHERE `id`=29397; diff --git a/sql/updates/world/2011_09_15_01_world_creature_template.sql b/sql/updates/world/2011_09_15_01_world_creature_template.sql new file mode 100644 index 00000000000..97303fcbe50 --- /dev/null +++ b/sql/updates/world/2011_09_15_01_world_creature_template.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `scale`=1 WHERE `entry`=22997; diff --git a/sql/updates/world/2011_09_15_02_world_misc.sql b/sql/updates/world/2011_09_15_02_world_misc.sql new file mode 100644 index 00000000000..5d482feba80 --- /dev/null +++ b/sql/updates/world/2011_09_15_02_world_misc.sql @@ -0,0 +1,27 @@ +SET @Gossip = 21289; +SET @NElf = 31111; + +DELETE FROM `gossip_menu` WHERE `entry`=@Gossip AND `text_id` IN (15037,15038); +INSERT INTO `gossip_menu` (`entry`, `text_id`) VALUES +(@Gossip, 15037), +(@Gossip, 15038); + +DELETE FROM `gossip_menu_option` WHERE `menu_id`=@Gossip AND `id`=0; +INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`) VALUES +(@Gossip, 0, 0, 'I believe in you.', 1, 1); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` IN (14,15) AND `SourceGroup`=@Gossip; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(14, @Gossip, 15038, 0, 1, 58493, 0, 0, 0, '', 'Mohawk Grenade - aura'), +(14, @Gossip, 15037, 0, 11, 58493, 0, 0, 0, '', 'Mohawk Grenade - no aura'), +(15, @Gossip, 0, 0, 26, 43489, 1, 0, 0, '', 'Mohawk Grenade - no item'); + +UPDATE `creature_template` SET `gossip_menu_id`=@Gossip,`minlevel`=80,`maxlevel`=80,`npcflag`=`npcflag`|1,`AIName`='SmartAI' WHERE `entry`=@NElf; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@NElf AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(@NElf, 0, 0, 1, 62, 0, 100, 0, @Gossip, 0, 0, 0, 11, 69243, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Night Elf Mohawk - On gossip select cast Create Mohawk Grenade'), +(@NElf, 0, 1, 0, 61, 0, 100, 0, @Gossip, 0, 0, 0, 72, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'Night Elf Mohawk - Link - close gossip'); + +DELETE FROM `creature_template_addon` WHERE `entry`=36778; +INSERT INTO `creature_template_addon` (`entry`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `auras`) VALUES +(36778, 0, 0, 3, 1, 0, NULL); -- sleep diff --git a/sql/updates/world/2011_09_15_03_world_creature_template.sql b/sql/updates/world/2011_09_15_03_world_creature_template.sql new file mode 100644 index 00000000000..82f6138f17a --- /dev/null +++ b/sql/updates/world/2011_09_15_03_world_creature_template.sql @@ -0,0 +1,35 @@ +-- Applied immunities to following mechanics: +-- MECHANIC_CHARM +-- MECHANIC_DISORIENTED +-- MECHANIC_DISARM +-- MECHANIC_DISTRACT +-- MECHANIC_FEAR +-- MECHANIC_GRIP +-- MECHANIC_ROOT +-- MECHANIC_SILENCE +-- MECHANIC_SLEEP +-- MECHANIC_SNARE +-- MECHANIC_STUN +-- MECHANIC_FREEZE +-- MECHANIC_KNOCKOUT +-- MECHANIC_POLYMORPH +-- MECHANIC_BANISH +-- MECHANIC_SHACKLE +-- MECHANIC_TURN +-- MECHANIC_HORROR +-- MECHANIC_DAZE +-- MECHANIC_SAPPED + +UPDATE `creature_template` SET `mechanic_immune_mask`=617299839 WHERE `entry` IN ( +36597,39166,39167,39168, -- The Lich King +36612,37957,37958,37959, -- Lord Marrowgar +36626,37504,37505,37506, -- Festergut +36627,38390,38549,38550, -- Rotface +36678,38431,38585,38586, -- Professor Putricide +36853,38265,38266,38267, -- Sindragosa +36855,38106,38296,38297, -- Lady Deathwhisper +37813,38402,38582,38583, -- Deathbringer Saurfang +37955,38434,38435,38436, -- Blood-Queen Lana'thel +37970,38401,38784,38785, -- Prince Valanar +37972,38399,38769,38770, -- Prince Keseleth +37973,38400,38771,38772); -- Prince Taldaram diff --git a/sql/updates/world/2011_09_15_04_world_misc.sql b/sql/updates/world/2011_09_15_04_world_misc.sql new file mode 100644 index 00000000000..125bd7626f0 --- /dev/null +++ b/sql/updates/world/2011_09_15_04_world_misc.sql @@ -0,0 +1,68 @@ +SET @GUID := 209102; +SET @NPC_HERENN := 28601; +SET @NPC_DEATHS_HAND_ACOLYTE := 28602; +SET @PATH := @NPC_DEATHS_HAND_ACOLYTE * 10; +SET @OMEGA_RUNE := 38708; + +DELETE FROM `creature` WHERE `id` IN (@NPC_HERENN,@NPC_DEATHS_HAND_ACOLYTE); +-- add High Cultist Herenn (28601) +INSERT INTO `creature` (`guid`,`id`,`map`,`position_x`,`position_y`,`position_z`,`orientation`) VALUES +(@GUID+10,@NPC_HERENN,1,-6028.08,-1249.02,-146.7644,3.054326); + +-- add Death's Hand Acolyte (28602), genders are random (25342,25343) +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 +(@GUID, @NPC_DEATHS_HAND_ACOLYTE,1,1,1,0,0,-6163.63,-1249.54,-159.7329,3.11264,120,0,0,1,0,2), -- wandering +(@GUID+1,@NPC_DEATHS_HAND_ACOLYTE,1,1,1,0,0,-6083.673,-1249.462,-143.4821,0.01435,120,0,0,1,0,2), -- wandering +(@GUID+2,@NPC_DEATHS_HAND_ACOLYTE,1,1,1,0,0,-6037.476,-1243.375,-146.8277,5.98647,120,0,0,1,0,0), -- kneeled +(@GUID+3,@NPC_DEATHS_HAND_ACOLYTE,1,1,1,0,0,-6036.1,-1255.38,-146.8277,1.15191,120,0,0,1,0,0), -- kneeled +(@GUID+4,@NPC_DEATHS_HAND_ACOLYTE,1,1,1,0,0,-6065.16,-1256.21,-143.3607,3.10668,120,0,0,1,0,0), +(@GUID+5,@NPC_DEATHS_HAND_ACOLYTE,1,1,1,0,0,-6118.18,-1241.33,-143.281,3.12169,120,0,0,1,0,0), +(@GUID+6,@NPC_DEATHS_HAND_ACOLYTE,1,1,1,0,0,-6104.965,-1243.601,-143.1921,3.12413,120,0,0,1,0,0), +(@GUID+7,@NPC_DEATHS_HAND_ACOLYTE,1,1,1,0,0,-6065.27,-1242.8,-143.3297,3.14159,120,0,0,1,0,0), +(@GUID+8,@NPC_DEATHS_HAND_ACOLYTE,1,1,1,0,0,-6104.698,-1256.314,-143.1921,3.05432,120,0,0,1,0,0), +(@GUID+9,@NPC_DEATHS_HAND_ACOLYTE,1,1,1,0,0,-6121.342,-1258.456,-143.1921,2.9147,120,0,0,1,0,0); + +-- update creature_template Death's Hand Acolyte for equipment +UPDATE `creature_template` SET `equipment_id`=815 WHERE `entry`=@NPC_DEATHS_HAND_ACOLYTE; + +-- set waypoint id's and visual effects +DELETE FROM `creature_addon` WHERE `guid` IN (@GUID,@GUID+1,@GUID+2,@GUID+3); +INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES +(@GUID ,@PATH,0,1,0,''), +(@GUID+1,@PATH+20,0,1,0,''), +(@GUID+2,0,8,0,0,''), -- kneeling +(@GUID+3,0,8,0,0,''); -- kneeling + +-- pathing Death's Hand Acolyte #1 +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,-6167.854,-1249.36,-162.6509,0,0,0,100,0), +(@PATH,2,-6154.54,-1249.757,-155.4785,0,0,0,100,0), +(@PATH,3,-6141.45,-1249.3,-147.7103,0,0,0,100,0), +(@PATH,4,-6140.292,-1249.466,-147.2287,0,0,0,100,0), +(@PATH,5,-6138.544,-1249.176,-145.9789,0,0,0,100,0), +(@PATH,6,-6136.085,-1249.64,-143.2982,0,0,0,100,0), +(@PATH,7,-6120.995,-1250.048,-143.2961,0,0,0,100,0), +(@PATH,8,-6133.946,-1250.144,-143.3480,0,0,0,100,0); + +-- pathing Death's Hand Acolyte #2 +DELETE FROM `waypoint_data` WHERE `id`=@PATH+20; +INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES +(@PATH+20,1,-6063.011,-1249.407,-143.4293,0,0,0,100,0), +(@PATH+20,2,-6067.342,-1249.435,-143.2057,0,0,0,100,0), +(@PATH+20,3,-6081.293,-1249.456,-143.4746,0,0,0,100,0), +(@PATH+20,4,-6083.673,-1249.462,-143.4821,0,0,0,100,0), +(@PATH+20,5,-6091.368,-1249.619,-143.6254,0,0,0,100,0), +(@PATH+20,6,-6100.618,-1249.619,-143.3754,0,0,0,100,0), +(@PATH+20,7,-6105.942,-1249.782,-143.2761,0,0,0,100,0); + +-- SAI for High Cultist Herenn, also add loot and equipment +UPDATE `creature_template` SET `AIName`='SmartAI',`equipment_id`=1803 WHERE `entry`=@NPC_HERENN; +DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid`=@NPC_HERENN; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@NPC_HERENN,0,0,0,0,0,100,1,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'High Cultist Herenn - in Combat - Say Text 0'); + +-- High Cultist Herenn talk text +DELETE FROM `creature_text` WHERE `entry`=@NPC_HERENN; +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@NPC_HERENN,0,0,'Fool! You led us to the only being that could stand up to our armies! You will never bring the Etymidian back to Northrend!',12,0,100,25,0,0,'High Cultist Herenn'); diff --git a/sql/updates/world/2011_09_15_05_world_spell_script_names.sql b/sql/updates/world/2011_09_15_05_world_spell_script_names.sql new file mode 100644 index 00000000000..418c05a4438 --- /dev/null +++ b/sql/updates/world/2011_09_15_05_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_warl_ritual_of_doom_effect'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(18541, 'spell_warl_ritual_of_doom_effect'); diff --git a/sql/updates/world/2011_09_16_00_world_spell_script_names.sql b/sql/updates/world/2011_09_16_00_world_spell_script_names.sql new file mode 100644 index 00000000000..98f268ec74f --- /dev/null +++ b/sql/updates/world/2011_09_16_00_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_dreamwalker_twisted_nightmares'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(71941, 'spell_dreamwalker_twisted_nightmares'); diff --git a/sql/updates/world/2011_09_19_00_world_spell_script_names.sql b/sql/updates/world/2011_09_19_00_world_spell_script_names.sql new file mode 100644 index 00000000000..5360210cef1 --- /dev/null +++ b/sql/updates/world/2011_09_19_00_world_spell_script_names.sql @@ -0,0 +1,3 @@ +DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_dreamwalker_summon_suppresser_effect'; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(70936, 'spell_dreamwalker_summon_suppresser_effect'); diff --git a/sql/updates/world/2011_09_21_00_world_misc.sql b/sql/updates/world/2011_09_21_00_world_misc.sql new file mode 100644 index 00000000000..730e27fb2b2 --- /dev/null +++ b/sql/updates/world/2011_09_21_00_world_misc.sql @@ -0,0 +1,6 @@ +UPDATE `creature_template` SET `scriptname`='mob_bullet_controller' WHERE `entry` = 34743; + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 13 AND `ConditionTypeOrReference` = 18 AND `SourceEntry` IN (66152,66153); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES +(13, 0, 66152, 0, 18, 1, 34720, 1, 0, '', 'Light Bullets Stalker - Light Orb Spawn'), +(13, 0, 66153, 0, 18, 1, 34704, 1, 0, '', 'Dark Bullets Stalker - Dark Orb Spawn'); diff --git a/sql/updates/world/2011_09_21_01_world_spell_script_names.sql b/sql/updates/world/2011_09_21_01_world_spell_script_names.sql new file mode 100644 index 00000000000..d3c16bec947 --- /dev/null +++ b/sql/updates/world/2011_09_21_01_world_spell_script_names.sql @@ -0,0 +1,5 @@ +DELETE FROM `spell_script_names` WHERE `spell_id` IN (53475,53487,54015); +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(53475, 'spell_gen_oracle_wolvar_reputation'), -- Set Oracle Faction Friendly +(53487, 'spell_gen_oracle_wolvar_reputation'), -- Set Wolvar Faction Honored +(54015, 'spell_gen_oracle_wolvar_reputation'); -- Set Oracle Faction Honored
\ No newline at end of file diff --git a/sql/updates/world/2011_09_21_02_world_command.sql b/sql/updates/world/2011_09_21_02_world_command.sql new file mode 100644 index 00000000000..629f0c9ab32 --- /dev/null +++ b/sql/updates/world/2011_09_21_02_world_command.sql @@ -0,0 +1,3 @@ +DELETE FROM command WHERE name = 'dev';
+INSERT INTO command VALUES
+('dev', 3, 'Syntax: .dev [on/off]\r\n\r\nEnable or Disable in game Dev tag or show current state if on/off not provided.');
diff --git a/sql/updates/world/2011_09_21_02_world_trinity_string.sql b/sql/updates/world/2011_09_21_02_world_trinity_string.sql new file mode 100644 index 00000000000..954c4a7eded --- /dev/null +++ b/sql/updates/world/2011_09_21_02_world_trinity_string.sql @@ -0,0 +1,4 @@ +DELETE FROM trinity_string WHERE entry IN (1137, 1138);
+INSERT INTO trinity_string (`entry`,`content_default`) VALUES
+(1137, 'Dev mode is ON'),
+(1138, 'Dev mode is OFF');
diff --git a/src/server/authserver/Main.cpp b/src/server/authserver/Main.cpp index 73b2148a3b7..0696377c0c3 100755 --- a/src/server/authserver/Main.cpp +++ b/src/server/authserver/Main.cpp @@ -73,7 +73,7 @@ extern int main(int argc, char **argv) { sLog->SetLogDB(false); // Command line parsing to get the configuration file name - char const *cfg_file = _TRINITY_REALM_CONFIG; + char const* cfg_file = _TRINITY_REALM_CONFIG; int c = 1; while(c < argc) { diff --git a/src/server/authserver/Realms/RealmList.cpp b/src/server/authserver/Realms/RealmList.cpp index 7fb9aadb14c..c81af80d31d 100755 --- a/src/server/authserver/Realms/RealmList.cpp +++ b/src/server/authserver/Realms/RealmList.cpp @@ -78,7 +78,7 @@ void RealmList::UpdateRealms(bool init) { do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 realmId = fields[0].GetUInt32(); const std::string& name = fields[1].GetString(); const std::string& address = fields[2].GetString(); diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp index 8ec1fcd1fd3..bffe406ddfc 100755 --- a/src/server/authserver/Server/AuthSocket.cpp +++ b/src/server/authserver/Server/AuthSocket.cpp @@ -147,11 +147,11 @@ typedef struct AuthHandler class PatcherRunnable: public ACE_Based::Runnable { public: - PatcherRunnable(class AuthSocket *); + PatcherRunnable(class AuthSocket* ); void run(); private: - AuthSocket * mySocket; + AuthSocket* mySocket; }; typedef struct PATCH_INFO @@ -948,7 +948,7 @@ bool AuthSocket::_HandleXferAccept() return true; } -PatcherRunnable::PatcherRunnable(class AuthSocket * as) +PatcherRunnable::PatcherRunnable(class AuthSocket* as) { mySocket = as; } @@ -1016,7 +1016,7 @@ void Patcher::LoadPatchMD5(char *szFileName) // Try to open the patch file std::string path = "./patches/"; path += szFileName; - FILE *pPatch = fopen(path.c_str(), "rb"); + FILE* pPatch = fopen(path.c_str(), "rb"); sLog->outDebug(LOG_FILTER_NETWORKIO, "Loading patch info from %s\n", path.c_str()); if (!pPatch) diff --git a/src/server/authserver/Server/AuthSocket.h b/src/server/authserver/Server/AuthSocket.h index 018af07a239..75df3d69a05 100755 --- a/src/server/authserver/Server/AuthSocket.h +++ b/src/server/authserver/Server/AuthSocket.h @@ -62,7 +62,7 @@ public: void _SetVSFields(const std::string& rI); - FILE *pPatch; + FILE* pPatch; ACE_Thread_Mutex patcherLock; private: diff --git a/src/server/authserver/Server/RealmAcceptor.h b/src/server/authserver/Server/RealmAcceptor.h index 99817dfddac..fc302adfccb 100755 --- a/src/server/authserver/Server/RealmAcceptor.h +++ b/src/server/authserver/Server/RealmAcceptor.h @@ -36,7 +36,7 @@ public: } protected: - virtual int make_svc_handler(RealmSocket *&sh) + virtual int make_svc_handler(RealmSocket* &sh) { if (sh == 0) ACE_NEW_RETURN(sh, RealmSocket, -1); diff --git a/src/server/authserver/Server/RealmSocket.cpp b/src/server/authserver/Server/RealmSocket.cpp index c80b2c4f08f..4d92747d262 100755 --- a/src/server/authserver/Server/RealmSocket.cpp +++ b/src/server/authserver/Server/RealmSocket.cpp @@ -177,7 +177,7 @@ bool RealmSocket::send(const char *buf, size_t len) message_block.rd_ptr(un); } - ACE_Message_Block *mb = message_block.clone(); + ACE_Message_Block* mb = message_block.clone(); if (msg_queue()->enqueue_tail(mb, (ACE_Time_Value *)(&ACE_Time_Value::zero)) == -1) { @@ -196,7 +196,7 @@ int RealmSocket::handle_output(ACE_HANDLE) if (closing_) return -1; - ACE_Message_Block *mb = 0; + ACE_Message_Block* mb = 0; if (msg_queue()->is_empty()) { diff --git a/src/server/authserver/Server/RealmSocket.h b/src/server/authserver/Server/RealmSocket.h index 685411e236d..12769c07185 100755 --- a/src/server/authserver/Server/RealmSocket.h +++ b/src/server/authserver/Server/RealmSocket.h @@ -69,7 +69,7 @@ private: ssize_t noblk_send(ACE_Message_Block &message_block); ACE_Message_Block input_buffer_; - Session *session_; + Session* session_; std::string remote_address_; }; diff --git a/src/server/collision/BoundingIntervalHierarchy.cpp b/src/server/collision/BoundingIntervalHierarchy.cpp index e411d1c2889..1540d1af667 100755 --- a/src/server/collision/BoundingIntervalHierarchy.cpp +++ b/src/server/collision/BoundingIntervalHierarchy.cpp @@ -238,7 +238,7 @@ void BIH::subdivide(int left, int right, std::vector<uint32> &tempTree, buildDat stats.updateLeaf(depth + 1, 0); } -bool BIH::writeToFile(FILE *wf) const +bool BIH::writeToFile(FILE* wf) const { uint32 treeSize = tree.size(); uint32 check=0, count=0; @@ -252,7 +252,7 @@ bool BIH::writeToFile(FILE *wf) const return check == (3 + 3 + 2 + treeSize + count); } -bool BIH::readFromFile(FILE *rf) +bool BIH::readFromFile(FILE* rf) { uint32 treeSize; Vector3 lo, hi; diff --git a/src/server/collision/BoundingIntervalHierarchy.h b/src/server/collision/BoundingIntervalHierarchy.h index f7bfdf73ccc..f4636b38bac 100755 --- a/src/server/collision/BoundingIntervalHierarchy.h +++ b/src/server/collision/BoundingIntervalHierarchy.h @@ -334,8 +334,8 @@ class BIH } } - bool writeToFile(FILE *wf) const; - bool readFromFile(FILE *rf); + bool writeToFile(FILE* wf) const; + bool readFromFile(FILE* rf); protected: std::vector<uint32> tree; diff --git a/src/server/collision/Management/VMapFactory.cpp b/src/server/collision/Management/VMapFactory.cpp index 93236bbb674..21907fef263 100755 --- a/src/server/collision/Management/VMapFactory.cpp +++ b/src/server/collision/Management/VMapFactory.cpp @@ -53,7 +53,7 @@ namespace VMAP } } - IVMapManager *gVMapManager = 0; + IVMapManager* gVMapManager = 0; Table<unsigned int , bool>* iIgnoreSpellIds=0; //=============================================== diff --git a/src/server/collision/Management/VMapManager2.cpp b/src/server/collision/Management/VMapManager2.cpp index b6dc8c7bac4..7c41a5bed41 100644 --- a/src/server/collision/Management/VMapManager2.cpp +++ b/src/server/collision/Management/VMapManager2.cpp @@ -143,7 +143,7 @@ namespace VMAP bool VMapManager2::isInLineOfSight(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2) { - if (!isLineOfSightCalcEnabled() || sDisableMgr->IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LOS)) + if (!isLineOfSightCalcEnabled() || DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LOS)) return true; InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId); @@ -166,7 +166,7 @@ namespace VMAP */ bool VMapManager2::getObjectHitPos(unsigned int mapId, float x1, float y1, float z1, float x2, float y2, float z2, float& rx, float &ry, float& rz, float modifyDist) { - if (isLineOfSightCalcEnabled() && !sDisableMgr->IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LOS)) + if (isLineOfSightCalcEnabled() && !DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LOS)) { InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId); if (instanceTree != iInstanceMapTrees.end()) @@ -196,7 +196,7 @@ namespace VMAP float VMapManager2::getHeight(unsigned int mapId, float x, float y, float z, float maxSearchDist) { - if (isHeightCalcEnabled() && !sDisableMgr->IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_HEIGHT)) + if (isHeightCalcEnabled() && !DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_HEIGHT)) { InstanceTreeMap::iterator instanceTree = iInstanceMapTrees.find(mapId); if (instanceTree != iInstanceMapTrees.end()) @@ -215,7 +215,7 @@ namespace VMAP bool VMapManager2::getAreaInfo(unsigned int mapId, float x, float y, float& z, uint32& flags, int32& adtId, int32& rootId, int32& groupId) const { - if (!sDisableMgr->IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_AREAFLAG)) + if (!DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_AREAFLAG)) { InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(mapId); if (instanceTree != iInstanceMapTrees.end()) @@ -233,7 +233,7 @@ namespace VMAP bool VMapManager2::GetLiquidLevel(uint32 mapId, float x, float y, float z, uint8 reqLiquidType, float& level, float& floor, uint32& type) const { - if (!sDisableMgr->IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LIQUIDSTATUS)) + if (!DisableMgr::IsDisabledFor(DISABLE_TYPE_VMAP, mapId, NULL, VMAP_DISABLE_LIQUIDSTATUS)) { InstanceTreeMap::const_iterator instanceTree = iInstanceMapTrees.find(mapId); if (instanceTree != iInstanceMapTrees.end()) diff --git a/src/server/collision/Maps/MapTree.cpp b/src/server/collision/Maps/MapTree.cpp index c8a0a19d6e6..6b5c9b5a2c6 100644 --- a/src/server/collision/Maps/MapTree.cpp +++ b/src/server/collision/Maps/MapTree.cpp @@ -41,7 +41,7 @@ namespace VMAP class MapRayCallback { public: - MapRayCallback(ModelInstance *val): prims(val), hit(false) {} + MapRayCallback(ModelInstance* val): prims(val), hit(false) {} bool operator()(const G3D::Ray& ray, uint32 entry, float& distance, bool pStopAtFirstHit=true) { bool result = prims[entry].intersectRay(ray, distance, pStopAtFirstHit); @@ -51,14 +51,14 @@ namespace VMAP } bool didHit() { return hit; } protected: - ModelInstance *prims; + ModelInstance* prims; bool hit; }; class AreaInfoCallback { public: - AreaInfoCallback(ModelInstance *val): prims(val) {} + AreaInfoCallback(ModelInstance* val): prims(val) {} void operator()(const Vector3& point, uint32 entry) { #ifdef VMAP_DEBUG @@ -67,14 +67,14 @@ namespace VMAP prims[entry].intersectPoint(point, aInfo); } - ModelInstance *prims; + ModelInstance* prims; AreaInfo aInfo; }; class LocationInfoCallback { public: - LocationInfoCallback(ModelInstance *val, LocationInfo &info): prims(val), locInfo(info), result(false) {} + LocationInfoCallback(ModelInstance* val, LocationInfo &info): prims(val), locInfo(info), result(false) {} void operator()(const Vector3& point, uint32 entry) { #ifdef VMAP_DEBUG @@ -84,7 +84,7 @@ namespace VMAP result = true; } - ModelInstance *prims; + ModelInstance* prims; LocationInfo &locInfo; bool result; }; @@ -245,7 +245,7 @@ namespace VMAP basePath.push_back('/'); std::string fullname = basePath + VMapManager2::getMapFileName(mapID); bool success = true; - FILE *rf = fopen(fullname.c_str(), "rb"); + FILE* rf = fopen(fullname.c_str(), "rb"); if (!rf) return false; // TODO: check magic number when implemented... @@ -275,12 +275,12 @@ namespace VMAP //========================================================= - bool StaticMapTree::InitMap(const std::string &fname, VMapManager2 *vm) + bool StaticMapTree::InitMap(const std::string &fname, VMapManager2* vm) { sLog->outDebug(LOG_FILTER_MAPS, "StaticMapTree::InitMap() : initializing StaticMapTree '%s'", fname.c_str()); bool success = true; std::string fullname = iBasePath + fname; - FILE *rf = fopen(fullname.c_str(), "rb"); + FILE* rf = fopen(fullname.c_str(), "rb"); if (!rf) return false; else @@ -309,7 +309,7 @@ namespace VMAP #endif if (!iIsTiled && ModelSpawn::readFromFile(rf, spawn)) { - WorldModel *model = vm->acquireModelInstance(iBasePath, spawn.name); + WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name); sLog->outDebug(LOG_FILTER_MAPS, "StaticMapTree::InitMap() : loading %s", spawn.name.c_str()); if (model) { @@ -331,7 +331,7 @@ namespace VMAP //========================================================= - void StaticMapTree::UnloadMap(VMapManager2 *vm) + void StaticMapTree::UnloadMap(VMapManager2* vm) { for (loadedSpawnMap::iterator i = iLoadedSpawns.begin(); i != iLoadedSpawns.end(); ++i) { @@ -345,7 +345,7 @@ namespace VMAP //========================================================= - bool StaticMapTree::LoadMapTile(uint32 tileX, uint32 tileY, VMapManager2 *vm) + bool StaticMapTree::LoadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm) { if (!iIsTiled) { @@ -380,7 +380,7 @@ namespace VMAP if (result) { // acquire model instance - WorldModel *model = vm->acquireModelInstance(iBasePath, spawn.name); + WorldModel* model = vm->acquireModelInstance(iBasePath, spawn.name); if (!model) sLog->outError("StaticMapTree::LoadMapTile() : could not acquire WorldModel pointer [%u, %u]", tileX, tileY); @@ -426,7 +426,7 @@ namespace VMAP //========================================================= - void StaticMapTree::UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager2 *vm) + void StaticMapTree::UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm) { uint32 tileID = packTileID(tileX, tileY); loadedTileMap::iterator tile = iLoadedTiles.find(tileID); diff --git a/src/server/collision/Maps/MapTree.h b/src/server/collision/Maps/MapTree.h index 8b288842a71..47716a925b5 100755 --- a/src/server/collision/Maps/MapTree.h +++ b/src/server/collision/Maps/MapTree.h @@ -32,8 +32,8 @@ namespace VMAP struct LocationInfo { LocationInfo(): hitInstance(0), hitModel(0), ground_Z(-G3D::inf()) {}; - const ModelInstance *hitInstance; - const GroupModel *hitModel; + const ModelInstance* hitInstance; + const GroupModel* hitModel; float ground_Z; }; @@ -45,7 +45,7 @@ namespace VMAP uint32 iMapID; bool iIsTiled; BIH iTree; - ModelInstance *iTreeValues; // the tree entries + ModelInstance* iTreeValues; // the tree entries uint32 iNTreeValues; // Store all the map tile idents that are loaded for that map @@ -74,10 +74,10 @@ namespace VMAP bool getAreaInfo(G3D::Vector3 &pos, uint32 &flags, int32 &adtId, int32 &rootId, int32 &groupId) const; bool GetLocationInfo(const Vector3 &pos, LocationInfo &info) const; - bool InitMap(const std::string &fname, VMapManager2 *vm); - void UnloadMap(VMapManager2 *vm); - bool LoadMapTile(uint32 tileX, uint32 tileY, VMapManager2 *vm); - void UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager2 *vm); + bool InitMap(const std::string &fname, VMapManager2* vm); + void UnloadMap(VMapManager2* vm); + bool LoadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm); + void UnloadMapTile(uint32 tileX, uint32 tileY, VMapManager2* vm); bool isTiled() const { return iIsTiled; } uint32 numLoadedTiles() const { return iLoadedTiles.size(); } }; diff --git a/src/server/collision/Maps/TileAssembler.cpp b/src/server/collision/Maps/TileAssembler.cpp index 4509caa8154..bfbbef3d915 100644 --- a/src/server/collision/Maps/TileAssembler.cpp +++ b/src/server/collision/Maps/TileAssembler.cpp @@ -39,7 +39,7 @@ template<> struct BoundsTrait<VMAP::ModelSpawn*> namespace VMAP { - bool readChunk(FILE *rf, char *dest, const char *compare, uint32 len) + bool readChunk(FILE* rf, char *dest, const char *compare, uint32 len) { if (fread(dest, sizeof(char), len, rf) != len) return false; return memcmp(dest, compare, len) == 0; @@ -113,7 +113,7 @@ namespace VMAP // write map tree file std::stringstream mapfilename; mapfilename << iDestDir << '/' << std::setfill('0') << std::setw(3) << map_iter->first << ".vmtree"; - FILE *mapfile = fopen(mapfilename.str().c_str(), "wb"); + FILE* mapfile = fopen(mapfilename.str().c_str(), "wb"); if (!mapfile) { success = false; @@ -157,7 +157,7 @@ namespace VMAP uint32 x, y; StaticMapTree::unpackTileID(tile->first, x, y); tilefilename << std::setw(2) << x << '_' << std::setw(2) << y << ".vmtile"; - FILE *tilefile = fopen(tilefilename.str().c_str(), "wb"); + FILE* tilefile = fopen(tilefilename.str().c_str(), "wb"); // file header if (success && fwrite(VMAP_MAGIC, 1, 8, tilefile) != 8) success = false; // write number of tile spawns @@ -202,7 +202,7 @@ namespace VMAP bool TileAssembler::readMapSpawns() { std::string fname = iSrcDir + "/dir_bin"; - FILE *dirf = fopen(fname.c_str(), "rb"); + FILE* dirf = fopen(fname.c_str(), "rb"); if (!dirf) { printf("Could not read dir_bin file!\n"); @@ -251,7 +251,7 @@ namespace VMAP modelPosition.iScale = spawn.iScale; modelPosition.init(); - FILE *rf = fopen(modelFilename.c_str(), "rb"); + FILE* rf = fopen(modelFilename.c_str(), "rb"); if (!rf) { printf("ERROR: Can't open model file: %s\n", modelFilename.c_str()); @@ -363,7 +363,7 @@ namespace VMAP if (filename.length() >0) filename.push_back('/'); filename.append(pModelFilename); - FILE *rf = fopen(filename.c_str(), "rb"); + FILE* rf = fopen(filename.c_str(), "rb"); if (!rf) { @@ -466,7 +466,7 @@ namespace VMAP delete[] vectorarray; } // ----- liquid - WmoLiquid *liquid = 0; + WmoLiquid* liquid = 0; if (liquidflags& 1) { WMOLiquidHeader hlq; diff --git a/src/server/collision/Models/ModelInstance.cpp b/src/server/collision/Models/ModelInstance.cpp index 957b15e9282..a86f6cac45a 100644 --- a/src/server/collision/Models/ModelInstance.cpp +++ b/src/server/collision/Models/ModelInstance.cpp @@ -26,7 +26,7 @@ using G3D::Ray; namespace VMAP { - ModelInstance::ModelInstance(const ModelSpawn &spawn, WorldModel *model): ModelSpawn(spawn), iModel(model) + ModelInstance::ModelInstance(const ModelSpawn &spawn, WorldModel* model): ModelSpawn(spawn), iModel(model) { iInvRot = G3D::Matrix3::fromEulerAnglesZYX(G3D::pi()*iRot.y/180.f, G3D::pi()*iRot.x/180.f, G3D::pi()*iRot.z/180.f).inverse(); iInvScale = 1.f/iScale; @@ -151,7 +151,7 @@ namespace VMAP return false; } - bool ModelSpawn::readFromFile(FILE *rf, ModelSpawn &spawn) + bool ModelSpawn::readFromFile(FILE* rf, ModelSpawn &spawn) { uint32 check = 0, nameLen; check += fread(&spawn.flags, sizeof(uint32), 1, rf); @@ -197,7 +197,7 @@ namespace VMAP return true; } - bool ModelSpawn::writeToFile(FILE *wf, const ModelSpawn &spawn) + bool ModelSpawn::writeToFile(FILE* wf, const ModelSpawn &spawn) { uint32 check=0; check += fwrite(&spawn.flags, sizeof(uint32), 1, wf); diff --git a/src/server/collision/Models/ModelInstance.h b/src/server/collision/Models/ModelInstance.h index 289fd5ff3fe..c29f6756654 100755 --- a/src/server/collision/Models/ModelInstance.h +++ b/src/server/collision/Models/ModelInstance.h @@ -56,15 +56,15 @@ namespace VMAP // temp? const G3D::AABox& getBounds() const { return iBound; } - static bool readFromFile(FILE *rf, ModelSpawn &spawn); - static bool writeToFile(FILE *rw, const ModelSpawn &spawn); + static bool readFromFile(FILE* rf, ModelSpawn &spawn); + static bool writeToFile(FILE* rw, const ModelSpawn &spawn); }; class ModelInstance: public ModelSpawn { public: ModelInstance(): iModel(0) {} - ModelInstance(const ModelSpawn &spawn, WorldModel *model); + ModelInstance(const ModelSpawn &spawn, WorldModel* model); void setUnloaded() { iModel = 0; } bool intersectRay(const G3D::Ray& pRay, float& pMaxDist, bool pStopAtFirstHit) const; void intersectPoint(const G3D::Vector3& p, AreaInfo &info) const; @@ -73,7 +73,7 @@ namespace VMAP protected: G3D::Matrix3 iInvRot; float iInvScale; - WorldModel *iModel; + WorldModel* iModel; }; } // namespace VMAP diff --git a/src/server/collision/Models/WorldModel.cpp b/src/server/collision/Models/WorldModel.cpp index 501be416a26..3dad4a10174 100644 --- a/src/server/collision/Models/WorldModel.cpp +++ b/src/server/collision/Models/WorldModel.cpp @@ -202,7 +202,7 @@ namespace VMAP iTilesX * iTilesY; } - bool WmoLiquid::writeToFile(FILE *wf) + bool WmoLiquid::writeToFile(FILE* wf) { bool result = true; if (result && fwrite(&iTilesX, sizeof(uint32), 1, wf) != 1) result = false; @@ -216,10 +216,10 @@ namespace VMAP return result; } - bool WmoLiquid::readFromFile(FILE *rf, WmoLiquid *&out) + bool WmoLiquid::readFromFile(FILE* rf, WmoLiquid* &out) { bool result = true; - WmoLiquid *liquid = new WmoLiquid(); + WmoLiquid* liquid = new WmoLiquid(); if (result && fread(&liquid->iTilesX, sizeof(uint32), 1, rf) != 1) result = false; if (result && fread(&liquid->iTilesY, sizeof(uint32), 1, rf) != 1) result = false; if (result && fread(&liquid->iCorner, sizeof(Vector3), 1, rf) != 1) result = false; @@ -254,7 +254,7 @@ namespace VMAP meshTree.build(triangles, bFunc); } - bool GroupModel::writeToFile(FILE *wf) + bool GroupModel::writeToFile(FILE* wf) { bool result = true; uint32 chunkSize, count; @@ -300,7 +300,7 @@ namespace VMAP return result; } - bool GroupModel::readFromFile(FILE *rf) + bool GroupModel::readFromFile(FILE* rf) { char chunk[8]; bool result = true; @@ -501,7 +501,7 @@ namespace VMAP bool WorldModel::writeFile(const std::string &filename) { - FILE *wf = fopen(filename.c_str(), "wb"); + FILE* wf = fopen(filename.c_str(), "wb"); if (!wf) return false; @@ -535,7 +535,7 @@ namespace VMAP bool WorldModel::readFile(const std::string &filename) { - FILE *rf = fopen(filename.c_str(), "rb"); + FILE* rf = fopen(filename.c_str(), "rb"); if (!rf) return false; diff --git a/src/server/collision/Models/WorldModel.h b/src/server/collision/Models/WorldModel.h index e3b11ccef29..7acd3c80376 100755 --- a/src/server/collision/Models/WorldModel.h +++ b/src/server/collision/Models/WorldModel.h @@ -56,8 +56,8 @@ namespace VMAP float *GetHeightStorage() { return iHeight; } uint8 *GetFlagsStorage() { return iFlags; } uint32 GetFileSize(); - bool writeToFile(FILE *wf); - static bool readFromFile(FILE *rf, WmoLiquid *&liquid); + bool writeToFile(FILE* wf); + static bool readFromFile(FILE* rf, WmoLiquid* &liquid); private: WmoLiquid(): iHeight(0), iFlags(0) {}; uint32 iTilesX; //!< number of tiles in x direction, each @@ -80,13 +80,13 @@ namespace VMAP //! pass mesh data to object and create BIH. Passed vectors get get swapped with old geometry! void setMeshData(std::vector<Vector3> &vert, std::vector<MeshTriangle> &tri); - void setLiquidData(WmoLiquid *liquid) { iLiquid = liquid; } + void setLiquidData(WmoLiquid* liquid) { iLiquid = liquid; } bool IntersectRay(const G3D::Ray &ray, float &distance, bool stopAtFirstHit) const; bool IsInsideObject(const Vector3 &pos, const Vector3 &down, float &z_dist) const; bool GetLiquidLevel(const Vector3 &pos, float &liqHeight) const; uint32 GetLiquidType() const; - bool writeToFile(FILE *wf); - bool readFromFile(FILE *rf); + bool writeToFile(FILE* wf); + bool readFromFile(FILE* rf); const G3D::AABox& GetBound() const { return iBound; } uint32 GetMogpFlags() const { return iMogpFlags; } uint32 GetWmoID() const { return iGroupWMOID; } @@ -97,7 +97,7 @@ namespace VMAP std::vector<Vector3> vertices; std::vector<MeshTriangle> triangles; BIH meshTree; - WmoLiquid *iLiquid; + WmoLiquid* iLiquid; }; /*! Holds a model (converted M2 or WMO) in its original coordinate space */ class WorldModel diff --git a/src/server/collision/VMapDefinitions.h b/src/server/collision/VMapDefinitions.h index 96ceb982d00..74e5a9f1dbb 100644 --- a/src/server/collision/VMapDefinitions.h +++ b/src/server/collision/VMapDefinitions.h @@ -27,6 +27,6 @@ namespace VMAP const char VMAP_MAGIC[] = "VMAP_3.0"; // defined in TileAssembler.cpp currently... - bool readChunk(FILE *rf, char *dest, const char *compare, uint32 len); + bool readChunk(FILE* rf, char *dest, const char *compare, uint32 len); } #endif diff --git a/src/server/game/AI/CoreAI/GameObjectAI.cpp b/src/server/game/AI/CoreAI/GameObjectAI.cpp index e30ead861ce..e47d75fc514 100644 --- a/src/server/game/AI/CoreAI/GameObjectAI.cpp +++ b/src/server/game/AI/CoreAI/GameObjectAI.cpp @@ -18,7 +18,7 @@ #include "GameObjectAI.h" -//GameObjectAI::GameObjectAI(GameObject *g) : go(g) {} +//GameObjectAI::GameObjectAI(GameObject* g) : go(g) {} int GameObjectAI::Permissible(const GameObject* go) { if (go->GetAIName() == "GameObjectAI") diff --git a/src/server/game/AI/CoreAI/GuardAI.cpp b/src/server/game/AI/CoreAI/GuardAI.cpp index 9943a6dde9c..2efe0eebee0 100755 --- a/src/server/game/AI/CoreAI/GuardAI.cpp +++ b/src/server/game/AI/CoreAI/GuardAI.cpp @@ -57,8 +57,8 @@ void GuardAI::MoveInLineOfSight(Unit* unit) if (!me->canFly() && me->GetDistanceZ(unit) > CREATURE_Z_ATTACK_RANGE) return; - if (!me->getVictim() && me->canAttack(unit) && - (unit->IsHostileToPlayers() || me->IsHostileTo(unit) /*|| u->getVictim() && me->IsFriendlyTo(u->getVictim())*/) && + if (!me->getVictim() && me->IsValidAttackTarget(unit) && + (unit->IsHostileToPlayers() || me->IsHostileTo(unit)) && unit->isInAccessiblePlaceFor(me)) { float attackRadius = me->GetAttackDistance(unit); diff --git a/src/server/game/AI/CoreAI/PassiveAI.cpp b/src/server/game/AI/CoreAI/PassiveAI.cpp index 4107179f6f7..1656e3cf181 100755 --- a/src/server/game/AI/CoreAI/PassiveAI.cpp +++ b/src/server/game/AI/CoreAI/PassiveAI.cpp @@ -39,7 +39,7 @@ void PossessedAI::UpdateAI(const uint32 /*diff*/) { if (me->getVictim()) { - if (!me->canAttack(me->getVictim())) + if (!me->IsValidAttackTarget(me->getVictim())) me->AttackStop(); else DoMeleeAttackIfReady(); diff --git a/src/server/game/AI/CoreAI/PetAI.cpp b/src/server/game/AI/CoreAI/PetAI.cpp index 0d8841dafd3..442da862b8a 100755 --- a/src/server/game/AI/CoreAI/PetAI.cpp +++ b/src/server/game/AI/CoreAI/PetAI.cpp @@ -58,7 +58,7 @@ bool PetAI::_needToStop() if (_CheckTargetCC(me->getVictim()) && !targetHasCC) return true; - return !me->canAttack(me->getVictim()); + return !me->IsValidAttackTarget(me->getVictim()); } void PetAI::_stopAttack() @@ -259,7 +259,7 @@ void PetAI::UpdateAllies() m_AllySet.insert(me->GetGUID()); if (group) //add group { - for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); if (!Target || !group->SameSubGroup((Player*)owner, Target)) diff --git a/src/server/game/AI/CoreAI/UnitAI.cpp b/src/server/game/AI/CoreAI/UnitAI.cpp index b6517e3396b..476c4fb9c70 100755 --- a/src/server/game/AI/CoreAI/UnitAI.cpp +++ b/src/server/game/AI/CoreAI/UnitAI.cpp @@ -42,28 +42,18 @@ void UnitAI::DoMeleeAttackIfReady() if (me->HasUnitState(UNIT_STAT_CASTING)) return; - Unit *victim = me->getVictim(); - if (!victim || !victim->IsInWorld()) - return; - + Unit* victim = me->getVictim(); //Make sure our attack is ready and we aren't currently casting before checking distance - if (me->isAttackReady()) + if (me->isAttackReady() && me->IsWithinMeleeRange(victim)) { - //If we are within range melee the target - if (me->IsWithinMeleeRange(victim)) - { - me->AttackerStateUpdate(victim); - me->resetAttackTimer(); - } + me->AttackerStateUpdate(victim); + me->resetAttackTimer(); } - if (me->haveOffhandWeapon() && me->isAttackReady(OFF_ATTACK)) + + if (me->haveOffhandWeapon() && me->isAttackReady(OFF_ATTACK) && me->IsWithinMeleeRange(victim)) { - //If we are within range melee the target - if (me->IsWithinMeleeRange(victim)) - { - me->AttackerStateUpdate(victim, OFF_ATTACK); - me->resetAttackTimer(OFF_ATTACK); - } + me->AttackerStateUpdate(victim, OFF_ATTACK); + me->resetAttackTimer(OFF_ATTACK); } } @@ -252,6 +242,6 @@ void SimpleCharmedAI::UpdateAI(const uint32 /*diff*/) me->GetMotionMaster()->MoveFollow(charmer, PET_FOLLOW_DIST, me->GetFollowAngle()); Unit* target = me->getVictim(); - if (!target || !charmer->canAttack(target)) + if (!target || !charmer->IsValidAttackTarget(target)) AttackStart(charmer->SelectNearestTargetInAttackDistance()); } diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index 3a6240ae2f2..98f0e4bb1a4 100755 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -162,7 +162,7 @@ class UnitAI case SELECT_TARGET_RANDOM: { std::list<Unit*>::iterator itr = targetList.begin(); - std::advance(itr, urand(position, targetList.size()-1)); + std::advance(itr, urand(position, targetList.size() - 1)); return *itr; } default: diff --git a/src/server/game/AI/CreatureAIImpl.h b/src/server/game/AI/CreatureAIImpl.h index 7e57082827c..46060445ee9 100755 --- a/src/server/game/AI/CreatureAIImpl.h +++ b/src/server/game/AI/CreatureAIImpl.h @@ -528,7 +528,7 @@ AISpellInfoType* GetAISpellInfo(uint32 i); inline void CreatureAI::SetGazeOn(Unit* target) { - if (me->canAttack(target)) + if (me->IsValidAttackTarget(target)) { AttackStart(target); me->SetReactState(REACT_PASSIVE); diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp index d09939c3243..27807283edc 100755 --- a/src/server/game/AI/EventAI/CreatureEventAI.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp @@ -1017,7 +1017,7 @@ void CreatureEventAI::AttackStart(Unit* who) } } -void CreatureEventAI::MoveInLineOfSight(Unit *who) +void CreatureEventAI::MoveInLineOfSight(Unit* who) { if (me->getVictim()) return; diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index ebca71df079..8443c4b1bfb 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -269,27 +269,6 @@ SpellInfo const* ScriptedAI::SelectSpell(Unit* target, uint32 school, uint32 mec return apSpell[urand(0, spellCount - 1)]; } -bool ScriptedAI::CanCast(Unit* target, SpellInfo const* spell, bool triggered /*= false*/) -{ - //No target so we can't cast - if (!target || !spell) - return false; - - //Silenced so we can't cast - if (!triggered && me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SILENCED)) - return false; - - //Check for power - if (!triggered && me->GetPower(Powers(spell->PowerType)) < spell->ManaCost) - return false; - - //Unit is out of range of this spell - if (me->IsInRange(target, float(me->GetSpellMinRangeForTarget(target, spell)), float(me->GetSpellMaxRangeForTarget(target, spell)))) - return false; - - return true; -} - void ScriptedAI::DoResetThreat() { if (!me->CanHaveThreatList() || me->getThreatManager().isThreatListEmpty()) diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h index 277edb7a337..92c6565be9f 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -160,9 +160,6 @@ struct ScriptedAI : public CreatureAI //Returns spells that meet the specified criteria from the creatures spell list SpellInfo const* SelectSpell(Unit* target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effect); - //Checks if you can cast the specified spell - bool CanCast(Unit* target, SpellInfo const* spell, bool triggered = false); - void SetEquipmentSlots(bool loadDefault, int32 mainHand = EQUIP_NO_CHANGE, int32 offHand = EQUIP_NO_CHANGE, int32 ranged = EQUIP_NO_CHANGE); //Generally used to control if MoveChase() is to be used or not in AttackStart(). Some creatures does not chase victims diff --git a/src/server/game/AI/SmartScripts/SmartAI.cpp b/src/server/game/AI/SmartScripts/SmartAI.cpp index 470eb54b584..2b3f3dd7305 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.cpp +++ b/src/server/game/AI/SmartScripts/SmartAI.cpp @@ -569,7 +569,7 @@ void SmartAI::JustReachedHome() void SmartAI::EnterCombat(Unit* enemy) { - me->InterruptNonMeleeSpells(false);//msut be before ProcessEvents + me->InterruptNonMeleeSpells(false); // must be before ProcessEvents GetScript()->ProcessEventsFor(SMART_EVENT_AGGRO, enemy); me->GetPosition(&mLastOOCPos); } diff --git a/src/server/game/AI/SmartScripts/SmartAI.h b/src/server/game/AI/SmartScripts/SmartAI.h index ffa52db8f06..8bb3bda8dd6 100644 --- a/src/server/game/AI/SmartScripts/SmartAI.h +++ b/src/server/game/AI/SmartScripts/SmartAI.h @@ -96,7 +96,7 @@ class SmartAI : public CreatureAI // Tell creature to attack and follow the victim void AttackStart(Unit* who); - // Called if IsVisible(Unit *who) is true at each *who move, reaction at visibility zone enter + // Called if IsVisible(Unit* who) is true at each *who move, reaction at visibility zone enter void MoveInLineOfSight(Unit* who); // Called when hit by a spell diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index 680c0815c6b..854e155c148 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -46,7 +46,7 @@ SmartScript::SmartScript() mLastTextID = 0; mTextGUID = 0; mUseTextTimer = false; - talker = NULL; + mTalkerEntry = 0; mTemplate = SMARTAI_TEMPLATE_BASIC; meOrigGUID = 0; goOrigGUID = 0; @@ -138,7 +138,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u return; ObjectList* targets = GetTargets(e, unit); - talker = me; + Creature* talker = me; if (targets) { for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) @@ -152,7 +152,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u delete targets; } - + mTalkerEntry = talker->GetEntry(); mLastTextID = e.action.talk.textGroupID; mTextTimer = e.action.talk.duration; mTextGUID = IsPlayer(GetLastInvoker()) ? GetLastInvoker()->GetGUID() : 0;//invoker, used for $vars in texts @@ -210,10 +210,10 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) { - if (IsCreature(*itr)) + if (IsPlayer(*itr)) { - sCreatureTextMgr->SendSound((*itr)->ToCreature(), e.action.sound.sound, CHAT_MSG_MONSTER_SAY, 0, TextRange(e.action.sound.range), Team(0), false); - sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SOUND: source: %s (GuidLow: %u), sound: %u, range: %u", + (*itr)->SendPlaySound(e.action.sound.sound, e.action.sound.range > 0 ? true : false); + sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SOUND: target: %s (GuidLow: %u), sound: %u, onlyself: %u", (*itr)->GetName(), (*itr)->GetGUIDLow(), e.action.sound.sound, e.action.sound.range); } } @@ -2705,13 +2705,13 @@ void SmartScript::OnUpdate(uint32 const diff) { if (mTextTimer < diff) { - uint32 temp = mLastTextID; + uint32 textID = mLastTextID; mLastTextID = 0; + uint32 entry = mTalkerEntry; + mTalkerEntry = 0; mTextTimer = 0; mUseTextTimer = false; - uint32 tempEntry = talker?talker->GetEntry():0; - talker = NULL; - ProcessEventsFor(SMART_EVENT_TEXT_OVER, NULL, temp, tempEntry); + ProcessEventsFor(SMART_EVENT_TEXT_OVER, NULL, textID, entry); } else mTextTimer -= diff; } } diff --git a/src/server/game/AI/SmartScripts/SmartScript.h b/src/server/game/AI/SmartScripts/SmartScript.h index 62855154c8a..aa4eeb602c0 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.h +++ b/src/server/game/AI/SmartScripts/SmartScript.h @@ -248,7 +248,7 @@ class SmartScript uint32 mTextTimer; uint32 mLastTextID; uint64 mTextGUID; - Creature* talker; + uint32 mTalkerEntry; bool mUseTextTimer; SMARTAI_TEMPLATE mTemplate; diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 475d6e440c1..f03e278a133 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -638,7 +638,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) } case SMART_ACTION_SUMMON_CREATURE: if (!IsCreatureValid(e, e.action.summonCreature.creature)) return false; - if (e.action.summonCreature.type > TEMPSUMMON_MANUAL_DESPAWN) + if (e.action.summonCreature.type < TEMPSUMMON_TIMED_OR_DEAD_DESPAWN || e.action.summonCreature.type > TEMPSUMMON_MANUAL_DESPAWN) { sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses incorrect TempSummonType %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.summonCreature.type); return false; diff --git a/src/server/game/Accounts/AccountMgr.cpp b/src/server/game/Accounts/AccountMgr.cpp index 69c413108ff..ebe9a9af36b 100755 --- a/src/server/game/Accounts/AccountMgr.cpp +++ b/src/server/game/Accounts/AccountMgr.cpp @@ -23,10 +23,10 @@ #include "Util.h" #include "SHA1.h" -AccountMgr::AccountMgr() {} -AccountMgr::~AccountMgr() {} +namespace AccountMgr +{ -AccountOpResult AccountMgr::CreateAccount(std::string username, std::string password) +AccountOpResult CreateAccount(std::string username, std::string password) { if (utf8length(username) > MAX_ACCOUNT_STR) return AOR_NAME_TOO_LONG; // username's too long @@ -43,7 +43,7 @@ AccountOpResult AccountMgr::CreateAccount(std::string username, std::string pass return AOR_OK; // everything's fine } -AccountOpResult AccountMgr::DeleteAccount(uint32 accountId) +AccountOpResult DeleteAccount(uint32 accountId) { QueryResult result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d'", accountId); if (!result) @@ -89,7 +89,7 @@ AccountOpResult AccountMgr::DeleteAccount(uint32 accountId) return AOR_OK; } -AccountOpResult AccountMgr::ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword) +AccountOpResult ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword) { QueryResult result = LoginDatabase.PQuery("SELECT 1 FROM account WHERE id='%d'", accountId); if (!result) @@ -113,7 +113,7 @@ AccountOpResult AccountMgr::ChangeUsername(uint32 accountId, std::string newUser return AOR_OK; } -AccountOpResult AccountMgr::ChangePassword(uint32 accountId, std::string newPassword) +AccountOpResult ChangePassword(uint32 accountId, std::string newPassword) { std::string username; @@ -133,20 +133,20 @@ AccountOpResult AccountMgr::ChangePassword(uint32 accountId, std::string newPass return AOR_OK; } -uint32 AccountMgr::GetId(std::string username) +uint32 GetId(std::string username) { LoginDatabase.EscapeString(username); QueryResult result = LoginDatabase.PQuery("SELECT id FROM account WHERE username = '%s'", username.c_str()); return (result) ? (*result)[0].GetUInt32() : 0; } -uint32 AccountMgr::GetSecurity(uint32 accountId) +uint32 GetSecurity(uint32 accountId) { QueryResult result = LoginDatabase.PQuery("SELECT gmlevel FROM account_access WHERE id = '%u'", accountId); return (result) ? (*result)[0].GetUInt32() : 0; } -uint32 AccountMgr::GetSecurity(uint64 accountId, int32 realmId) +uint32 GetSecurity(uint64 accountId, int32 realmId) { QueryResult result = (realmId == -1) ? LoginDatabase.PQuery("SELECT gmlevel FROM account_access WHERE id = '%u' AND RealmID = '%d'", accountId, realmId) @@ -154,7 +154,7 @@ uint32 AccountMgr::GetSecurity(uint64 accountId, int32 realmId) return (result) ? (*result)[0].GetUInt32() : 0; } -bool AccountMgr::GetName(uint32 accountId, std::string& name) +bool GetName(uint32 accountId, std::string& name) { QueryResult result = LoginDatabase.PQuery("SELECT username FROM account WHERE id = '%u'", accountId); if (result) @@ -166,7 +166,7 @@ bool AccountMgr::GetName(uint32 accountId, std::string& name) return false; } -bool AccountMgr::CheckPassword(uint32 accountId, std::string password) +bool CheckPassword(uint32 accountId, std::string password) { std::string username; @@ -180,14 +180,14 @@ bool AccountMgr::CheckPassword(uint32 accountId, std::string password) return (result) ? true : false; } -uint32 AccountMgr::GetCharactersCount(uint32 accountId) +uint32 GetCharactersCount(uint32 accountId) { // check character count QueryResult result = CharacterDatabase.PQuery("SELECT COUNT(guid) FROM characters WHERE account = '%d'", accountId); return (result) ? (*result)[0].GetUInt32() : 0; } -bool AccountMgr::normalizeString(std::string& utf8String) +bool normalizeString(std::string& utf8String) { wchar_t buffer[MAX_ACCOUNT_STR+1]; @@ -205,7 +205,7 @@ bool AccountMgr::normalizeString(std::string& utf8String) return WStrToUtf8(buffer, maxLength, utf8String); } -std::string AccountMgr::CalculateShaPassHash(std::string& name, std::string& password) +std::string CalculateShaPassHash(std::string& name, std::string& password) { SHA1Hash sha; sha.Initialize(); @@ -220,3 +220,29 @@ std::string AccountMgr::CalculateShaPassHash(std::string& name, std::string& pas return encoded; } +bool IsPlayerAccount(uint32 gmlevel) +{ + return gmlevel == SEC_PLAYER; +} + +bool IsModeratorAccount(uint32 gmlevel) +{ + return gmlevel >= SEC_MODERATOR && gmlevel <= SEC_CONSOLE; +} + +bool IsGMAccount(uint32 gmlevel) +{ + return gmlevel >= SEC_GAMEMASTER && gmlevel <= SEC_CONSOLE; +} + +bool IsAdminAccount(uint32 gmlevel) +{ + return gmlevel >= SEC_ADMINISTRATOR && gmlevel <= SEC_CONSOLE; +} + +bool IsConsoleAccount(uint32 gmlevel) +{ + return gmlevel == SEC_CONSOLE; +} + +} // Namespace AccountMgr diff --git a/src/server/game/Accounts/AccountMgr.h b/src/server/game/Accounts/AccountMgr.h index 3eaa0df93b3..aca24e9522f 100755 --- a/src/server/game/Accounts/AccountMgr.h +++ b/src/server/game/Accounts/AccountMgr.h @@ -19,10 +19,9 @@ #ifndef _ACCMGR_H #define _ACCMGR_H +#include "Define.h" #include <string> -#include "Common.h" - enum AccountOpResult { AOR_OK, @@ -35,12 +34,8 @@ enum AccountOpResult #define MAX_ACCOUNT_STR 16 -class AccountMgr +namespace AccountMgr { - public: - AccountMgr(); - ~AccountMgr(); - AccountOpResult CreateAccount(std::string username, std::string password); AccountOpResult DeleteAccount(uint32 accountId); AccountOpResult ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword); @@ -54,8 +49,12 @@ class AccountMgr uint32 GetCharactersCount(uint32 accountId); std::string CalculateShaPassHash(std::string& name, std::string& password); - static bool normalizeString(std::string& utf8String); + bool normalizeString(std::string& utf8String); + bool IsPlayerAccount(uint32 gmlevel); + bool IsModeratorAccount(uint32 gmlevel); + bool IsGMAccount(uint32 gmlevel); + bool IsAdminAccount(uint32 gmlevel); + bool IsConsoleAccount(uint32 gmlevel); }; -#define sAccountMgr ACE_Singleton<AccountMgr, ACE_Null_Mutex>::instance() #endif diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 3262af05f5f..48b7361f9a5 100755 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -377,7 +377,7 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un } case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_EQUIPED_ITEM: { - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(miscvalue1); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(miscvalue1); if (!pProto) return false; return pProto->ItemLevel >= equipped_item.item_level && pProto->Quality >= equipped_item.item_quality; @@ -443,9 +443,9 @@ void AchievementMgr::ResetAchievementCriteria(AchievementCriteriaTypes type, uin AchievementCriteriaEntryList const& achievementCriteriaList = sAchievementMgr->GetAchievementCriteriaByType(type); for (AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList.begin(); i != achievementCriteriaList.end(); ++i) { - AchievementCriteriaEntry const *achievementCriteria = (*i); + AchievementCriteriaEntry const* achievementCriteria = (*i); - AchievementEntry const *achievement = sAchievementStore.LookupEntry(achievementCriteria->referredAchievement); + AchievementEntry const* achievement = sAchievementStore.LookupEntry(achievementCriteria->referredAchievement); if (!achievement) continue; @@ -744,8 +744,8 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui AchievementCriteriaEntryList const& achievementCriteriaList = sAchievementMgr->GetAchievementCriteriaByType(type); for (AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList.begin(); i != achievementCriteriaList.end(); ++i) { - AchievementCriteriaEntry const *achievementCriteria = (*i); - AchievementEntry const *achievement = sAchievementStore.LookupEntry(achievementCriteria->referredAchievement); + AchievementCriteriaEntry const* achievementCriteria = (*i); + AchievementEntry const* achievement = sAchievementStore.LookupEntry(achievementCriteria->referredAchievement); if (!achievement) continue; @@ -1281,7 +1281,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui if (miscValue2 != achievementCriteria->roll_greed_on_loot.rollValue) continue; - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(miscValue1); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(miscValue1); if (!pProto) continue; @@ -1928,7 +1928,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry, SendCriteriaUpdate(entry, progress, timeElapsed, timedCompleted); } -void AchievementMgr::RemoveCriteriaProgress(const AchievementCriteriaEntry *entry) +void AchievementMgr::RemoveCriteriaProgress(const AchievementCriteriaEntry* entry) { CriteriaProgressMap::iterator criteriaProgress = m_criteriaProgress.find(entry->ID); if (criteriaProgress == m_criteriaProgress.end()) @@ -1950,7 +1950,7 @@ void AchievementMgr::UpdateTimedAchievements(uint32 timeDiff) // Time is up, remove timer and reset progress if (itr->second <= timeDiff) { - AchievementCriteriaEntry const *entry = sAchievementCriteriaStore.LookupEntry(itr->first); + AchievementCriteriaEntry const* entry = sAchievementCriteriaStore.LookupEntry(itr->first); RemoveCriteriaProgress(entry); m_timedAchievements.erase(itr++); } @@ -1971,7 +1971,7 @@ void AchievementMgr::StartTimedAchievement(AchievementCriteriaTimedTypes type, u if ((*i)->timerStartEvent != entry) continue; - AchievementEntry const *achievement = sAchievementStore.LookupEntry((*i)->referredAchievement); + AchievementEntry const* achievement = sAchievementStore.LookupEntry((*i)->referredAchievement); if (m_timedAchievements.find((*i)->ID) == m_timedAchievements.end() && !IsCompletedCriteria(*i, achievement)) { // Start the timer @@ -2097,7 +2097,7 @@ void AchievementMgr::SendRespondInspectAchievements(Player* player) const /** * used by SMSG_RESPOND_INSPECT_ACHIEVEMENT and SMSG_ALL_ACHIEVEMENT_DATA */ -void AchievementMgr::BuildAllDataPacket(WorldPacket *data) const +void AchievementMgr::BuildAllDataPacket(WorldPacket* data) const { AchievementEntry const* achievement = NULL; for (CompletedAchievementMap::const_iterator iter = m_completedAchievements.begin(); iter != m_completedAchievements.end(); ++iter) @@ -2133,7 +2133,7 @@ bool AchievementMgr::HasAchieved(AchievementEntry const* achievement) const bool AchievementMgr::CanUpdateCriteria(AchievementCriteriaEntry const* criteria, AchievementEntry const* achievement) { - if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_ACHIEVEMENT_CRITERIA, criteria->ID, NULL)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_ACHIEVEMENT_CRITERIA, criteria->ID, NULL)) return false; if (achievement->mapID != -1 && GetPlayer()->GetMapId() != uint32(achievement->mapID)) @@ -2247,7 +2247,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 criteria_id = fields[0].GetUInt32(); AchievementCriteriaEntry const* criteria = sAchievementCriteriaStore.LookupEntry(criteria_id); @@ -2366,7 +2366,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() continue; } - if (!GetCriteriaDataSet(criteria) && !sDisableMgr->IsDisabledFor(DISABLE_TYPE_ACHIEVEMENT_CRITERIA, entryId, NULL)) + if (!GetCriteriaDataSet(criteria) && !DisableMgr::IsDisabledFor(DISABLE_TYPE_ACHIEVEMENT_CRITERIA, entryId, NULL)) sLog->outErrorDb("Table `achievement_criteria_data` does not have expected data for criteria (Entry: %u Type: %u) for achievement %u.", criteria->ID, criteria->requiredType, criteria->referredAchievement); } @@ -2389,7 +2389,7 @@ void AchievementGlobalMgr::LoadCompletedAchievements() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 achievement_id = fields[0].GetUInt32(); if (!sAchievementStore.LookupEntry(achievement_id)) @@ -2427,7 +2427,7 @@ void AchievementGlobalMgr::LoadRewards() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); const AchievementEntry* pAchievement = sAchievementStore.LookupEntry(entry); if (!pAchievement) @@ -2533,7 +2533,7 @@ void AchievementGlobalMgr::LoadRewardLocales() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); diff --git a/src/server/game/Achievements/AchievementMgr.h b/src/server/game/Achievements/AchievementMgr.h index 6324c978dd9..df5631c5bc6 100755 --- a/src/server/game/Achievements/AchievementMgr.h +++ b/src/server/game/Achievements/AchievementMgr.h @@ -274,7 +274,7 @@ class AchievementMgr bool IsCompletedCriteria(AchievementCriteriaEntry const* achievementCriteria, AchievementEntry const* achievement); bool IsCompletedAchievement(AchievementEntry const* entry); bool CanUpdateCriteria(AchievementCriteriaEntry const* criteria, AchievementEntry const* achievement); - void BuildAllDataPacket(WorldPacket *data) const; + void BuildAllDataPacket(WorldPacket* data) const; Player* m_player; CriteriaProgressMap m_criteriaProgress; @@ -324,7 +324,7 @@ class AchievementGlobalMgr return iter != m_achievementRewardLocales.end() ? &iter->second : NULL; } - AchievementCriteriaDataSet const* GetCriteriaDataSet(AchievementCriteriaEntry const *achievementCriteria) const + AchievementCriteriaDataSet const* GetCriteriaDataSet(AchievementCriteriaEntry const* achievementCriteria) const { AchievementCriteriaDataMap::const_iterator iter = m_criteriaDataMap.find(achievementCriteria->ID); return iter != m_criteriaDataMap.end() ? &iter->second : NULL; diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp index d892e64b316..9d5bdd159f7 100755 --- a/src/server/game/Addons/AddonMgr.cpp +++ b/src/server/game/Addons/AddonMgr.cpp @@ -16,27 +16,31 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "DatabaseEnv.h" #include "AddonMgr.h" -#include "ObjectAccessor.h" -#include "Player.h" -#include "Util.h" -#include "SHA1.h" +#include "DatabaseEnv.h" +#include "Log.h" +#include "Timer.h" -AddonMgr::AddonMgr() +#include <list> + +namespace AddonMgr { -} -AddonMgr::~AddonMgr() +// Anonymous namespace ensures file scope of all the stuff inside it, even +// if you add something more to this namespace somewhere else. +namespace { + // List of saved addons (in DB). + typedef std::list<SavedAddon> SavedAddonsList; + + SavedAddonsList m_knownAddons; } -void AddonMgr::LoadFromDB() +void LoadFromDB() { uint32 oldMSTime = getMSTime(); QueryResult result = CharacterDatabase.Query("SELECT name, crc FROM addons"); - if (!result) { sLog->outString(">> Loaded 0 known addons. DB table `addons` is empty!"); @@ -48,13 +52,12 @@ void AddonMgr::LoadFromDB() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); std::string name = fields[0].GetString(); uint32 crc = fields[1].GetUInt32(); - SavedAddon addon(name, crc); - m_knownAddons.push_back(addon); + m_knownAddons.push_back(SavedAddon(name, crc)); ++count; } @@ -64,17 +67,16 @@ void AddonMgr::LoadFromDB() sLog->outString(); } -void AddonMgr::SaveAddon(AddonInfo const& addon) +void SaveAddon(AddonInfo const& addon) { std::string name = addon.Name; CharacterDatabase.EscapeString(name); CharacterDatabase.PExecute("INSERT INTO addons (name, crc) VALUES ('%s', %u)", name.c_str(), addon.CRC); - SavedAddon newAddon(addon.Name, addon.CRC); - m_knownAddons.push_back(newAddon); + m_knownAddons.push_back(SavedAddon(addon.Name, addon.CRC)); } -SavedAddon const* AddonMgr::GetAddonInfo(const std::string& name) const +SavedAddon const* GetAddonInfo(const std::string& name) { for (SavedAddonsList::const_iterator it = m_knownAddons.begin(); it != m_knownAddons.end(); ++it) { @@ -85,3 +87,5 @@ SavedAddon const* AddonMgr::GetAddonInfo(const std::string& name) const return NULL; } + +} // Namespace diff --git a/src/server/game/Addons/AddonMgr.h b/src/server/game/Addons/AddonMgr.h index 9d68d2277fb..72edc3d1f6f 100755 --- a/src/server/game/Addons/AddonMgr.h +++ b/src/server/game/Addons/AddonMgr.h @@ -19,13 +19,9 @@ #ifndef _ADDONMGR_H #define _ADDONMGR_H -#include "Common.h" -#include <ace/Singleton.h> - +#include "Define.h" #include <string> -class WorldSession; - struct AddonInfo { AddonInfo(const std::string& name, uint8 enabled, uint32 crc, uint8 state, bool crcOrPubKey) @@ -56,33 +52,14 @@ struct SavedAddon uint32 CRC; }; -// List of client addons (for WorldSession). -typedef std::list<AddonInfo> AddonsList; - -// List of saved addons (in DB). -typedef std::list<SavedAddon> SavedAddonsList; - #define STANDARD_ADDON_CRC 0x4c1c776d -class AddonMgr +namespace AddonMgr { - friend class ACE_Singleton<AddonMgr, ACE_Null_Mutex>; - AddonMgr(); - ~AddonMgr(); - - public: - - void LoadFromDB(); - void SaveAddon(AddonInfo const& addon); - - SavedAddon const* GetAddonInfo(const std::string& name) const; - - private: - - SavedAddonsList m_knownAddons; // Known addons. -}; - -#define sAddonMgr ACE_Singleton<AddonMgr, ACE_Null_Mutex>::instance() + void LoadFromDB(); + void SaveAddon(AddonInfo const& addon); + SavedAddon const* GetAddonInfo(const std::string& name); +} #endif diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 9224f4ad677..0a2ff750a1b 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -47,7 +47,7 @@ AuctionHouseMgr::~AuctionHouseMgr() delete itr->second; } -AuctionHouseObject * AuctionHouseMgr::GetAuctionsMap(uint32 factionTemplateId) +AuctionHouseObject* AuctionHouseMgr::GetAuctionsMap(uint32 factionTemplateId) { if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) return &mNeutralAuctions; @@ -64,7 +64,7 @@ AuctionHouseObject * AuctionHouseMgr::GetAuctionsMap(uint32 factionTemplateId) return &mNeutralAuctions; } -uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item *pItem, uint32 count) +uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* pItem, uint32 count) { uint32 MSV = pItem->GetTemplate()->SellPrice; @@ -87,15 +87,15 @@ uint32 AuctionHouseMgr::GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 } //does not clear ram -void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction, SQLTransaction& trans) +void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction& trans) { - Item *pItem = GetAItem(auction->item_guidlow); + Item* pItem = GetAItem(auction->item_guidlow); if (!pItem) return; uint32 bidder_accId = 0; uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER); - Player *bidder = ObjectAccessor::FindPlayer(bidder_guid); + Player* bidder = ObjectAccessor::FindPlayer(bidder_guid); // data for gm.log if (sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { @@ -110,15 +110,15 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction, SQLTransaction& else { bidder_accId = sObjectMgr->GetPlayerAccountIdByGUID(bidder_guid); - bidder_security = sAccountMgr->GetSecurity(bidder_accId, realmID); + bidder_security = AccountMgr::GetSecurity(bidder_accId, realmID); - if (bidder_security > SEC_PLAYER) // not do redundant DB requests + if (!AccountMgr::IsPlayerAccount(bidder_security)) // not do redundant DB requests { if (!sObjectMgr->GetPlayerNameByGUID(bidder_guid, bidder_name)) bidder_name = sObjectMgr->GetTrinityStringForDBCLocale(LANG_UNKNOWN); } } - if (bidder_security > SEC_PLAYER) + if (!AccountMgr::IsPlayerAccount(bidder_security)) { std::string owner_name; if (!sObjectMgr->GetPlayerNameByGUID(auction->owner, owner_name)) @@ -163,10 +163,10 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction, SQLTransaction& } } -void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry * auction, SQLTransaction& trans) +void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry* auction, SQLTransaction& trans) { uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER); - Player *owner = ObjectAccessor::FindPlayer(owner_guid); + Player* owner = ObjectAccessor::FindPlayer(owner_guid); uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid); // owner exist (online or offline) if (owner || owner_accId) @@ -193,10 +193,10 @@ void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry * auction, SQLTran } //call this method to send mail to auction owner, when auction is successful, it does not clear ram -void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry * auction, SQLTransaction& trans) +void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransaction& trans) { uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER); - Player *owner = ObjectAccessor::FindPlayer(owner_guid); + Player* owner = ObjectAccessor::FindPlayer(owner_guid); uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid); // owner exist if (owner || owner_accId) @@ -231,15 +231,15 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry * auction, SQLTrans } //does not clear ram -void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry * auction, SQLTransaction& trans) +void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransaction& trans) { //return an item in auction to its owner by mail - Item *pItem = GetAItem(auction->item_guidlow); + Item* pItem = GetAItem(auction->item_guidlow); if (!pItem) return; uint64 owner_guid = MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER); - Player *owner = ObjectAccessor::FindPlayer(owner_guid); + Player* owner = ObjectAccessor::FindPlayer(owner_guid); uint32 owner_accId = sObjectMgr->GetPlayerAccountIdByGUID(owner_guid); // owner exist if (owner || owner_accId) @@ -257,10 +257,10 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry * auction, SQLTransact } //this function sends mail to old bidder -void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry *auction, uint32 newPrice, Player* newBidder, SQLTransaction& trans) +void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 newPrice, Player* newBidder, SQLTransaction& trans) { uint64 oldBidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER); - Player *oldBidder = ObjectAccessor::FindPlayer(oldBidder_guid); + Player* oldBidder = ObjectAccessor::FindPlayer(oldBidder_guid); uint32 oldBidder_accId = 0; if (!oldBidder) @@ -285,7 +285,7 @@ void AuctionHouseMgr::SendAuctionOutbiddedMail(AuctionEntry *auction, uint32 new void AuctionHouseMgr::SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQLTransaction& trans) { uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER); - Player *bidder = ObjectAccessor::FindPlayer(bidder_guid); + Player* bidder = ObjectAccessor::FindPlayer(bidder_guid); uint32 bidder_accId = 0; if (!bidder) @@ -328,14 +328,14 @@ void AuctionHouseMgr::LoadAuctionItems() uint32 item_guid = fields[11].GetUInt32(); uint32 item_template = fields[12].GetUInt32(); - ItemTemplate const *proto = sObjectMgr->GetItemTemplate(item_template); + ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item_template); if (!proto) { sLog->outError("AuctionHouseMgr::LoadAuctionItems: Unknown item (GUID: %u id: #%u) in auction, skipped.", item_guid, item_template); continue; } - Item *item = NewItemOrBag(proto); + Item* item = NewItemOrBag(proto); if (!item->LoadFromDB(item_guid, 0, fields, item_template)) { delete item; @@ -372,7 +372,7 @@ void AuctionHouseMgr::LoadAuctions() { Field* fields = result->Fetch(); - AuctionEntry *aItem = new AuctionEntry(); + AuctionEntry* aItem = new AuctionEntry(); if (!aItem->LoadFromDB(fields)) { aItem->DeleteFromDB(trans); @@ -454,7 +454,7 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTem return sAuctionHouseStore.LookupEntry(houseid); } -void AuctionHouseObject::AddAuction(AuctionEntry *auction) +void AuctionHouseObject::AddAuction(AuctionEntry* auction) { ASSERT(auction); @@ -462,7 +462,7 @@ void AuctionHouseObject::AddAuction(AuctionEntry *auction) sScriptMgr->OnAuctionAdd(this, auction); } -bool AuctionHouseObject::RemoveAuction(AuctionEntry *auction, uint32 /*item_template*/) +bool AuctionHouseObject::RemoveAuction(AuctionEntry* auction, uint32 /*item_template*/) { bool wasInMap = AuctionsMap.erase(auction->Id) ? true : false; @@ -530,7 +530,7 @@ void AuctionHouseObject::BuildListBidderItems(WorldPacket& data, Player* player, { for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr) { - AuctionEntry *Aentry = itr->second; + AuctionEntry* Aentry = itr->second; if (Aentry && Aentry->bidder == player->GetGUIDLow()) { if (itr->second->BuildAuctionInfo(data)) @@ -545,7 +545,7 @@ void AuctionHouseObject::BuildListOwnerItems(WorldPacket& data, Player* player, { for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr) { - AuctionEntry *Aentry = itr->second; + AuctionEntry* Aentry = itr->second; if (Aentry && Aentry->owner == player->GetGUIDLow()) { if (Aentry->BuildAuctionInfo(data)) @@ -566,12 +566,12 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr) { - AuctionEntry *Aentry = itr->second; - Item *item = sAuctionMgr->GetAItem(Aentry->item_guidlow); + AuctionEntry* Aentry = itr->second; + Item* item = sAuctionMgr->GetAItem(Aentry->item_guidlow); if (!item) continue; - ItemTemplate const *proto = item->GetTemplate(); + ItemTemplate const* proto = item->GetTemplate(); if (itemClass != 0xffffffff && proto->Class != itemClass) continue; @@ -601,7 +601,7 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player // local name if (loc_idx >= 0) - if (ItemLocale const *il = sObjectMgr->GetItemLocale(proto->ItemId)) + if (ItemLocale const* il = sObjectMgr->GetItemLocale(proto->ItemId)) ObjectMgr::GetLocaleString(il->Name, loc_idx, name); // DO NOT use GetItemEnchantMod(proto->RandomProperty) as it may return a result @@ -614,7 +614,7 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player // Append the suffix to the name (ie: of the Monkey) if one exists // These are found in ItemRandomProperties.dbc, not ItemRandomSuffix.dbc // even though the DBC names seem misleading - const ItemRandomPropertiesEntry *itemRandProp = sItemRandomPropertiesStore.LookupEntry(propRefID); + const ItemRandomPropertiesEntry* itemRandProp = sItemRandomPropertiesStore.LookupEntry(propRefID); if (itemRandProp) { @@ -650,7 +650,7 @@ void AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player //this function inserts to WorldPacket auction's data bool AuctionEntry::BuildAuctionInfo(WorldPacket & data) const { - Item *pItem = sAuctionMgr->GetAItem(item_guidlow); + Item* pItem = sAuctionMgr->GetAItem(item_guidlow); if (!pItem) { sLog->outError("auction to item, that doesn't exist !!!!"); @@ -791,7 +791,7 @@ void AuctionHouseMgr::DeleteExpiredAuctionsAtStartup() { Field* fields = expAuctions->Fetch(); - AuctionEntry *auction = new AuctionEntry(); + AuctionEntry* auction = new AuctionEntry(); // Can't use LoadFromDB() because it assumes the auction map is loaded if (!auction->LoadFromFieldList(fields)) diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.h b/src/server/game/AuctionHouse/AuctionHouseMgr.h index 5e88ae1ff1d..d1fb26cbc80 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.h +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.h @@ -101,9 +101,9 @@ class AuctionHouseObject return itr != AuctionsMap.end() ? itr->second : NULL; } - void AddAuction(AuctionEntry *auction); + void AddAuction(AuctionEntry* auction); - bool RemoveAuction(AuctionEntry *auction, uint32 item_template); + bool RemoveAuction(AuctionEntry* auction, uint32 item_template); void Update(); @@ -124,8 +124,10 @@ class AuctionHouseObject class AuctionHouseMgr { friend class ACE_Singleton<AuctionHouseMgr, ACE_Null_Mutex>; - AuctionHouseMgr(); - ~AuctionHouseMgr(); + + private: + AuctionHouseMgr(); + ~AuctionHouseMgr(); public: @@ -144,14 +146,14 @@ class AuctionHouseMgr } //auction messages - void SendAuctionWonMail(AuctionEntry * auction, SQLTransaction& trans); - void SendAuctionSalePendingMail(AuctionEntry * auction, SQLTransaction& trans); - void SendAuctionSuccessfulMail(AuctionEntry * auction, SQLTransaction& trans); - void SendAuctionExpiredMail(AuctionEntry * auction, SQLTransaction& trans); - void SendAuctionOutbiddedMail(AuctionEntry * auction, uint32 newPrice, Player* newBidder, SQLTransaction& trans); + void SendAuctionWonMail(AuctionEntry* auction, SQLTransaction& trans); + void SendAuctionSalePendingMail(AuctionEntry* auction, SQLTransaction& trans); + void SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransaction& trans); + void SendAuctionExpiredMail(AuctionEntry* auction, SQLTransaction& trans); + void SendAuctionOutbiddedMail(AuctionEntry* auction, uint32 newPrice, Player* newBidder, SQLTransaction& trans); void SendAuctionCancelledToBidderMail(AuctionEntry* auction, SQLTransaction& trans); - static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item *pItem, uint32 count); + static uint32 GetAuctionDeposit(AuctionHouseEntry const* entry, uint32 time, Item* pItem, uint32 count); static AuctionHouseEntry const* GetAuctionHouseEntry(uint32 factionTemplateId); public: diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index 693f8ddae27..45f41eebd26 100755 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -46,7 +46,7 @@ ArenaTeam::~ArenaTeam() { } -bool ArenaTeam::Create(uint32 captainGuid, uint8 type, std::string teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor) +bool ArenaTeam::Create(uint64 captainGuid, uint8 type, std::string teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor) { // Check if captain is present if (!ObjectAccessor::FindPlayer(captainGuid)) @@ -56,7 +56,6 @@ bool ArenaTeam::Create(uint32 captainGuid, uint8 type, std::string teamName, uin if (sArenaTeamMgr->GetArenaTeamByName(TeamName)) return false; - // Generate new arena team id TeamId = sArenaTeamMgr->GenerateArenaTeamId(); @@ -69,14 +68,13 @@ bool ArenaTeam::Create(uint32 captainGuid, uint8 type, std::string teamName, uin EmblemColor = emblemColor; BorderStyle = borderStyle; BorderColor = borderColor; - - + uint32 captainLowGuid = GUID_LOPART(captainGuid); // Save arena team to db PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_ARENA_TEAM); stmt->setUInt32(0, TeamId); stmt->setString(1, TeamName); - stmt->setUInt32(2, GUID_LOPART(CaptainGuid)); + stmt->setUInt32(2, captainLowGuid); stmt->setUInt8(3, Type); stmt->setUInt16(4, Stats.Rating); stmt->setUInt32(5, BackgroundColor); @@ -89,7 +87,7 @@ bool ArenaTeam::Create(uint32 captainGuid, uint8 type, std::string teamName, uin // Add captain as member AddMember(CaptainGuid); - sLog->outArena("New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), GUID_LOPART(CaptainGuid)); + sLog->outArena("New ArenaTeam created [Id: %u] [Type: %u] [Captain low GUID: %u]", GetId(), GetType(), captainLowGuid); return true; } @@ -196,7 +194,7 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult result) if (!result) return false; - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); TeamId = fields[0].GetUInt32(); TeamName = fields[1].GetString(); @@ -226,7 +224,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result) do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); // Prevent crash if db records are broken when all members in result are already processed and current team doesn't have any members if (!fields) @@ -239,13 +237,13 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result) break; ArenaTeamMember newMember; - newMember.Guid = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER); + newMember.Guid = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_PLAYER); newMember.WeekGames = fields[2].GetUInt16(); newMember.WeekWins = fields[3].GetUInt16(); newMember.SeasonGames = fields[4].GetUInt16(); newMember.SeasonWins = fields[5].GetUInt16(); - newMember.Name = fields[6].GetString(); - newMember.Class = fields[7].GetUInt8(); + newMember.Name = fields[6].GetString(); + newMember.Class = fields[7].GetUInt8(); newMember.PersonalRating = fields[8].GetUInt16(); newMember.MatchMakerRating = fields[9].GetUInt16() > 0 ? fields[9].GetUInt16() : 1500; @@ -293,7 +291,7 @@ void ArenaTeam::SetCaptain(uint64 guid) CharacterDatabase.Execute(stmt); // Enable remove/promote buttons - Player *newCaptain = ObjectAccessor::FindPlayer(guid); + Player* newCaptain = ObjectAccessor::FindPlayer(guid); if (newCaptain) { newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0); @@ -366,7 +364,7 @@ void ArenaTeam::Disband(WorldSession* session) void ArenaTeam::Roster(WorldSession* session) { - Player* pl = NULL; + Player* player = NULL; uint8 unk308 = 0; @@ -378,13 +376,13 @@ void ArenaTeam::Roster(WorldSession* session) for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr) { - pl = ObjectAccessor::FindPlayer(itr->Guid); + player = ObjectAccessor::FindPlayer(itr->Guid); data << uint64(itr->Guid); // guid - data << uint8((pl ? 1 : 0)); // online flag + data << uint8((player ? 1 : 0)); // online flag data << itr->Name; // member name data << uint32((itr->Guid == GetCaptain() ? 0 : 1));// captain flag 0 captain 1 member - data << uint8((pl ? pl->getLevel() : 0)); // unknown, level? + data << uint8((player ? player->getLevel() : 0)); // unknown, level? data << uint8(itr->Class); // class data << uint32(itr->WeekGames); // played this week data << uint32(itr->WeekWins); // wins this week @@ -408,11 +406,11 @@ void ArenaTeam::Query(WorldSession* session) data << uint32(GetId()); // team id data << GetName(); // team name data << uint32(GetType()); // arena team type (2=2x2, 3=3x3 or 5=5x5) - data << uint32(BackgroundColor); // background color - data << uint32(EmblemStyle); // emblem style - data << uint32(EmblemColor); // emblem color - data << uint32(BorderStyle); // border style - data << uint32(BorderColor); // border color + data << uint32(BackgroundColor); // background color + data << uint32(EmblemStyle); // emblem style + data << uint32(EmblemColor); // emblem color + data << uint32(BorderStyle); // border style + data << uint32(BorderColor); // border color session->SendPacket(&data); sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_ARENA_TEAM_QUERY_RESPONSE"); } @@ -421,12 +419,12 @@ void ArenaTeam::SendStats(WorldSession* session) { WorldPacket data(SMSG_ARENA_TEAM_STATS, 4*7); data << uint32(GetId()); // team id - data << uint32(Stats.Rating); // rating - data << uint32(Stats.WeekGames); // games this week - data << uint32(Stats.WeekWins); // wins this week - data << uint32(Stats.SeasonGames); // played this season - data << uint32(Stats.SeasonWins); // wins this season - data << uint32(Stats.Rank); // rank + data << uint32(Stats.Rating); // rating + data << uint32(Stats.WeekGames); // games this week + data << uint32(Stats.WeekWins); // wins this week + data << uint32(Stats.SeasonGames); // played this season + data << uint32(Stats.SeasonWins); // wins this season + data << uint32(Stats.Rank); // rank session->SendPacket(&data); } @@ -435,11 +433,8 @@ void ArenaTeam::NotifyStatsChanged() // This is called after a rated match ended // Updates arena team stats for every member of the team (not only the ones who participated!) for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr) - { - Player* plr = ObjectAccessor::FindPlayer(itr->Guid); - if (plr) + if (Player* plr = ObjectAccessor::FindPlayer(itr->Guid)) SendStats(plr->GetSession()); - } } void ArenaTeam::Inspect(WorldSession* session, uint64 guid) @@ -485,11 +480,8 @@ void ArenaTeamMember::ModifyMatchmakerRating(int32 mod, uint32 /*slot*/) void ArenaTeam::BroadcastPacket(WorldPacket* packet) { for (MemberList::const_iterator itr = Members.begin(); itr != Members.end(); ++itr) - { - Player* player = ObjectAccessor::FindPlayer(itr->Guid); - if (player) + if (Player* player = ObjectAccessor::FindPlayer(itr->Guid)) player->GetSession()->SendPacket(packet); - } } void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCount, std::string str1, std::string str2, std::string str3) @@ -525,7 +517,7 @@ void ArenaTeam::BroadcastEvent(ArenaTeamEvents event, uint64 guid, uint8 strCoun uint8 ArenaTeam::GetSlotByType(uint32 type) { - switch(type) + switch (type) { case ARENA_TEAM_2v2: return 0; case ARENA_TEAM_3v3: return 1; diff --git a/src/server/game/Battlegrounds/ArenaTeam.h b/src/server/game/Battlegrounds/ArenaTeam.h index c65226a53aa..4f013f72e5c 100755 --- a/src/server/game/Battlegrounds/ArenaTeam.h +++ b/src/server/game/Battlegrounds/ArenaTeam.h @@ -20,10 +20,14 @@ #define TRINITYCORE_ARENATEAM_H #include "QueryResult.h" -#include "Player.h" -#include "ObjectMgr.h" +#include <ace/Singleton.h> +#include <list> +#include <map> class WorldSession; +class WorldPacket; +class Player; +class Group; enum ArenaTeamCommandTypes { @@ -115,7 +119,7 @@ class ArenaTeam ArenaTeam(); ~ArenaTeam(); - bool Create(uint32 captainGuid, uint8 type, std::string teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor); + bool Create(uint64 captainGuid, uint8 type, std::string teamName, uint32 backgroundColor, uint8 emblemStyle, uint32 emblemColor, uint8 borderStyle, uint32 borderColor); void Disband(WorldSession* session); typedef std::list<ArenaTeamMember> MemberList; diff --git a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp index 59f31e36971..cf335ec1971 100644 --- a/src/server/game/Battlegrounds/ArenaTeamMgr.cpp +++ b/src/server/game/Battlegrounds/ArenaTeamMgr.cpp @@ -15,8 +15,13 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "Common.h" +#include "Define.h" #include "ArenaTeamMgr.h" +#include "World.h" +#include "Log.h" +#include "DatabaseEnv.h" +#include "Language.h" +#include "ObjectAccessor.h" ArenaTeamMgr::ArenaTeamMgr() { @@ -143,7 +148,7 @@ void ArenaTeamMgr::DistributeArenaPoints() // At first update all points for all team members for (ArenaTeamContainer::iterator teamItr = GetArenaTeamMapBegin(); teamItr != GetArenaTeamMapEnd(); ++teamItr) - if (ArenaTeam * at = teamItr->second) + if (ArenaTeam* at = teamItr->second) at->UpdateArenaPointsHelper(PlayerPoints); SQLTransaction trans = CharacterDatabase.BeginTransaction(); @@ -167,7 +172,7 @@ void ArenaTeamMgr::DistributeArenaPoints() sWorld->SendWorldText(LANG_DIST_ARENA_POINTS_TEAM_START); for (ArenaTeamContainer::iterator titr = GetArenaTeamMapBegin(); titr != GetArenaTeamMapEnd(); ++titr) { - if (ArenaTeam * at = titr->second) + if (ArenaTeam* at = titr->second) { at->FinishWeek(); at->SaveToDB(); diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index 0090e910e8a..a7176e3b550 100755 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -124,7 +124,7 @@ template<class Do> void Battleground::BroadcastWorker(Do& _do) { for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) - if (Player *plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER))) + if (Player* plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER))) _do(plr); } @@ -325,10 +325,10 @@ inline void Battleground::_ProcessRessurect(uint32 diff) { for (std::map<uint64, std::vector<uint64> >::iterator itr = m_ReviveQueue.begin(); itr != m_ReviveQueue.end(); ++itr) { - Creature *sh = NULL; + Creature* sh = NULL; for (std::vector<uint64>::const_iterator itr2 = (itr->second).begin(); itr2 != (itr->second).end(); ++itr2) { - Player *plr = ObjectAccessor::FindPlayer(*itr2); + Player* plr = ObjectAccessor::FindPlayer(*itr2); if (!plr) continue; @@ -359,7 +359,7 @@ inline void Battleground::_ProcessRessurect(uint32 diff) { for (std::vector<uint64>::const_iterator itr = m_ResurrectQueue.begin(); itr != m_ResurrectQueue.end(); ++itr) { - Player *plr = ObjectAccessor::FindPlayer(*itr); + Player* plr = ObjectAccessor::FindPlayer(*itr); if (!plr) continue; plr->ResurrectPlayer(1.0f); @@ -424,7 +424,7 @@ inline void Battleground::_ProcessJoin(uint32 diff) { m_ResetStatTimer = 0; for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) - if (Player *plr = ObjectAccessor::FindPlayer(itr->first)) + if (Player* plr = ObjectAccessor::FindPlayer(itr->first)) plr->ResetAllPowers(); } @@ -472,7 +472,7 @@ inline void Battleground::_ProcessJoin(uint32 diff) { // TODO : add arena sound PlaySoundToAll(SOUND_ARENA_START); for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) - if (Player *plr = ObjectAccessor::FindPlayer(itr->first)) + if (Player* plr = ObjectAccessor::FindPlayer(itr->first)) { // BG Status packet WorldPacket status; @@ -488,7 +488,7 @@ inline void Battleground::_ProcessJoin(uint32 diff) for (Unit::AuraApplicationMap::iterator iter = auraMap.begin(); iter != auraMap.end();) { AuraApplication * aurApp = iter->second; - Aura * aura = aurApp->GetBase(); + Aura* aura = aurApp->GetBase(); if (!aura->IsPermanent() && aura->GetDuration() <= 30*IN_MILLISECONDS && aurApp->IsPositive() @@ -594,7 +594,7 @@ void Battleground::SendPacketToAll(WorldPacket* packet) player->GetSession()->SendPacket(packet); } -void Battleground::SendPacketToTeam(uint32 TeamID, WorldPacket* packet, Player *sender, bool self) +void Battleground::SendPacketToTeam(uint32 TeamID, WorldPacket* packet, Player* sender, bool self) { for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) if (Player* player = _GetPlayerForTeam(TeamID, itr, "SendPacketToTeam")) @@ -963,8 +963,8 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac if (isRated() && GetStatus() == STATUS_IN_PROGRESS) { //left a rated match while the encounter was in progress, consider as loser - ArenaTeam * winner_arena_team = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team))); - ArenaTeam * loser_arena_team = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(team)); + ArenaTeam* winner_arena_team = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team))); + ArenaTeam* loser_arena_team = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(team)); if (winner_arena_team && loser_arena_team && winner_arena_team != loser_arena_team) loser_arena_team->MemberLost(plr, GetArenaMatchmakerRating(GetOtherTeam(team))); } @@ -985,8 +985,8 @@ void Battleground::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac if (isRated() && GetStatus() == STATUS_IN_PROGRESS) { //left a rated match while the encounter was in progress, consider as loser - ArenaTeam * others_arena_team = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team))); - ArenaTeam * players_arena_team = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(team)); + ArenaTeam* others_arena_team = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(GetOtherTeam(team))); + ArenaTeam* players_arena_team = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamIdForTeam(team)); if (others_arena_team && players_arena_team) players_arena_team->OfflineMemberLost(guid, GetArenaMatchmakerRating(GetOtherTeam(team))); } @@ -1373,7 +1373,7 @@ void Battleground::AddPlayerToResurrectQueue(uint64 npc_guid, uint64 player_guid { m_ReviveQueue[npc_guid].push_back(player_guid); - Player *plr = ObjectAccessor::FindPlayer(player_guid); + Player* plr = ObjectAccessor::FindPlayer(player_guid); if (!plr) return; @@ -1389,7 +1389,7 @@ void Battleground::RemovePlayerFromResurrectQueue(uint64 player_guid) if (*itr2 == player_guid) { (itr->second).erase(itr2); - if (Player *plr = ObjectAccessor::FindPlayer(player_guid)) + if (Player* plr = ObjectAccessor::FindPlayer(player_guid)) plr->RemoveAurasDueToSpell(SPELL_WAITING_FOR_RESURRECT); return; } @@ -1402,7 +1402,7 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float // If the assert is called, means that m_BgObjects must be resized! ASSERT(type < m_BgObjects.size()); - Map *map = GetBgMap(); + Map* map = GetBgMap(); if (!map) return false; // Must be created this way, adding to godatamap would add it to the base map of the instance @@ -1451,7 +1451,7 @@ bool Battleground::AddObject(uint32 type, uint32 entry, float x, float y, float // It would be nice to correctly implement GO_ACTIVATED state and open/close doors in gameobject code void Battleground::DoorClose(uint32 type) { - if (GameObject *obj = GetBgMap()->GetGameObject(m_BgObjects[type])) + if (GameObject* obj = GetBgMap()->GetGameObject(m_BgObjects[type])) { // If doors are open, close it if (obj->getLootState() == GO_ACTIVATED && obj->GetGoState() != GO_STATE_READY) @@ -1468,7 +1468,7 @@ void Battleground::DoorClose(uint32 type) void Battleground::DoorOpen(uint32 type) { - if (GameObject *obj = GetBgMap()->GetGameObject(m_BgObjects[type])) + if (GameObject* obj = GetBgMap()->GetGameObject(m_BgObjects[type])) { // Change state to be sure they will be opened obj->SetLootState(GO_READY); @@ -1481,7 +1481,7 @@ void Battleground::DoorOpen(uint32 type) GameObject* Battleground::GetBGObject(uint32 type) { - GameObject *obj = GetBgMap()->GetGameObject(m_BgObjects[type]); + GameObject* obj = GetBgMap()->GetGameObject(m_BgObjects[type]); if (!obj) sLog->outError("Battleground::GetBGObject: gameobject (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", type, GUID_LOPART(m_BgObjects[type]), m_MapId, m_InstanceID); @@ -1490,7 +1490,7 @@ GameObject* Battleground::GetBGObject(uint32 type) Creature* Battleground::GetBGCreature(uint32 type) { - Creature *creature = GetBgMap()->GetCreature(m_BgCreatures[type]); + Creature* creature = GetBgMap()->GetCreature(m_BgCreatures[type]); if (!creature) sLog->outError("Battleground::GetBGCreature: creature (type: %u, GUID: %u) not found for BG (map: %u, instance id: %u)!", type, GUID_LOPART(m_BgCreatures[type]), m_MapId, m_InstanceID); @@ -1500,7 +1500,7 @@ Creature* Battleground::GetBGCreature(uint32 type) void Battleground::SpawnBGObject(uint32 type, uint32 respawntime) { if (Map* map = GetBgMap()) - if (GameObject *obj = map->GetGameObject(m_BgObjects[type])) + if (GameObject* obj = map->GetGameObject(m_BgObjects[type])) { if (respawntime) obj->SetLootState(GO_JUST_DEACTIVATED); @@ -1533,7 +1533,7 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, uint32 teamval, f pCreature->SetHomePosition(x, y, z, o); - CreatureTemplate const *cinfo = sObjectMgr->GetCreatureTemplate(entry); + 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)!", @@ -1559,7 +1559,7 @@ bool Battleground::DelCreature(uint32 type) if (!m_BgCreatures[type]) return true; - if (Creature *creature = GetBgMap()->GetCreature(m_BgCreatures[type])) + if (Creature* creature = GetBgMap()->GetCreature(m_BgCreatures[type])) { creature->AddObjectToRemoveList(); m_BgCreatures[type] = 0; @@ -1668,7 +1668,7 @@ void Battleground::SendWarningToAll(int32 entry, ...) data << msg.c_str(); data << (uint8)0; for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr) - if (Player *plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER))) + if (Player* plr = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER))) if (plr->GetSession()) plr->GetSession()->SendPacket(&data); } @@ -1699,7 +1699,7 @@ const char* Battleground::GetTrinityString(int32 entry) // buffs are in their positions when battleground starts void Battleground::HandleTriggerBuff(uint64 go_guid) { - GameObject *obj = GetBgMap()->GetGameObject(go_guid); + GameObject* obj = GetBgMap()->GetGameObject(go_guid); if (!obj || obj->GetGoType() != GAMEOBJECT_TYPE_TRAP || !obj->isSpawned()) return; @@ -1857,7 +1857,7 @@ void Battleground::UpdateArenaWorldState() UpdateWorldState(0xe11, GetAlivePlayersCountByTeam(ALLIANCE)); } -void Battleground::SetBgRaid(uint32 TeamID, Group *bg_raid) +void Battleground::SetBgRaid(uint32 TeamID, Group* bg_raid) { Group*& old_raid = TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE]; if (old_raid) diff --git a/src/server/game/Battlegrounds/Battleground.h b/src/server/game/Battlegrounds/Battleground.h index 4f2f87c14c6..6e791127c33 100755 --- a/src/server/game/Battlegrounds/Battleground.h +++ b/src/server/game/Battlegrounds/Battleground.h @@ -476,10 +476,10 @@ class Battleground void SendMessage2ToAll(int32 entry, ChatMsg type, Player const* source, int32 strId1 = 0, int32 strId2 = 0); // Raid Group - Group *GetBgRaid(uint32 TeamID) const { return TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE]; } - void SetBgRaid(uint32 TeamID, Group *bg_raid); + Group* GetBgRaid(uint32 TeamID) const { return TeamID == ALLIANCE ? m_BgRaids[BG_TEAM_ALLIANCE] : m_BgRaids[BG_TEAM_HORDE]; } + void SetBgRaid(uint32 TeamID, Group* bg_raid); - virtual void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true); + virtual void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true); static BattlegroundTeamId GetTeamIndexByTeamId(uint32 Team) { return Team == ALLIANCE ? BG_TEAM_ALLIANCE : BG_TEAM_HORDE; } uint32 GetPlayersCountByTeam(uint32 Team) const { return m_PlayersCount[GetTeamIndexByTeamId(Team)]; } @@ -630,7 +630,7 @@ class Battleground bool m_IsRated; // is this battle rated? bool m_PrematureCountDown; uint32 m_PrematureCountDownTimer; - char const *m_Name; + char const* m_Name; /* Pre- and post-update hooks */ @@ -673,7 +673,7 @@ class Battleground uint32 m_InvitedHorde; // Raid Group - Group *m_BgRaids[BG_TEAMS_COUNT]; // 0 - alliance, 1 - horde + Group* m_BgRaids[BG_TEAMS_COUNT]; // 0 - alliance, 1 - horde // Players count by team uint32 m_PlayersCount[BG_TEAMS_COUNT]; diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index ce7fa8d81a4..86a9511bcf8 100755 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -134,7 +134,7 @@ void BattlegroundMgr::Update(uint32 diff) BattlegroundQueueTypeId bgQueueTypeId = BattlegroundQueueTypeId(scheduled[i] >> 16 & 255); BattlegroundTypeId bgTypeId = BattlegroundTypeId((scheduled[i] >> 8) & 255); BattlegroundBracketId bracket_id = BattlegroundBracketId(scheduled[i] & 255); - m_BattlegroundQueues[bgQueueTypeId].Update(bgTypeId, bracket_id, arenaType, arenaMMRating > 0, arenaMMRating); + m_BattlegroundQueues[bgQueueTypeId].BattlegroundQueueUpdate(diff, bgTypeId, bracket_id, arenaType, arenaMMRating > 0, arenaMMRating); } } @@ -148,7 +148,7 @@ void BattlegroundMgr::Update(uint32 diff) sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BattlegroundMgr: UPDATING ARENA QUEUES"); for (int qtype = BATTLEGROUND_QUEUE_2v2; qtype <= BATTLEGROUND_QUEUE_5v5; ++qtype) for (int bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket) - m_BattlegroundQueues[qtype].Update( + m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(diff, BATTLEGROUND_AA, BattlegroundBracketId(bracket), BattlegroundMgr::BGArenaType(BattlegroundQueueTypeId(qtype)), true, 0); @@ -174,7 +174,7 @@ void BattlegroundMgr::Update(uint32 diff) } } -void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battleground *bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype, uint8 uiFrame) +void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype, uint8 uiFrame) { // we can be in 2 queues in same time... @@ -227,7 +227,7 @@ void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket *data, Battlegro } } -void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket *data, Battleground *bg) +void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg) { uint8 type = (bg->isArena() ? 1 : 0); // last check on 3.0.3 @@ -291,7 +291,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket *data, Battleground *bg) } else { - Player *plr = ObjectAccessor::FindPlayer(itr2->first); + Player* plr = ObjectAccessor::FindPlayer(itr2->first); uint32 team = bg->GetPlayerTeam(itr2->first); if (!team && plr) team = plr->GetBGTeam(); @@ -396,7 +396,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket *data, Battleground *bg) data->put(wpos, scoreCount); } -void BattlegroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket *data, GroupJoinBattlegroundResult result) +void BattlegroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket* data, GroupJoinBattlegroundResult result) { data->Initialize(SMSG_GROUP_JOINED_BATTLEGROUND, 4); *data << int32(result); @@ -404,26 +404,26 @@ void BattlegroundMgr::BuildGroupJoinedBattlegroundPacket(WorldPacket *data, Grou *data << uint64(0); // player guid } -void BattlegroundMgr::BuildUpdateWorldStatePacket(WorldPacket *data, uint32 field, uint32 value) +void BattlegroundMgr::BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value) { data->Initialize(SMSG_UPDATE_WORLD_STATE, 4+4); *data << uint32(field); *data << uint32(value); } -void BattlegroundMgr::BuildPlaySoundPacket(WorldPacket *data, uint32 soundid) +void BattlegroundMgr::BuildPlaySoundPacket(WorldPacket* data, uint32 soundid) { data->Initialize(SMSG_PLAY_SOUND, 4); *data << uint32(soundid); } -void BattlegroundMgr::BuildPlayerLeftBattlegroundPacket(WorldPacket *data, uint64 guid) +void BattlegroundMgr::BuildPlayerLeftBattlegroundPacket(WorldPacket* data, uint64 guid) { data->Initialize(SMSG_BATTLEGROUND_PLAYER_LEFT, 8); *data << uint64(guid); } -void BattlegroundMgr::BuildPlayerJoinedBattlegroundPacket(WorldPacket *data, Player *plr) +void BattlegroundMgr::BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, Player* plr) { data->Initialize(SMSG_BATTLEGROUND_PLAYER_JOINED, 8); *data << uint64(plr->GetGUID()); @@ -500,8 +500,8 @@ uint32 BattlegroundMgr::CreateClientVisibleInstanceId(BattlegroundTypeId bgTypeI Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 arenaType, bool isRated) { // get the template BG - Battleground *bg_template = GetBattlegroundTemplate(bgTypeId); - BattlegroundSelectionWeightMap *selectionWeights = NULL; + Battleground* bg_template = GetBattlegroundTemplate(bgTypeId); + BattlegroundSelectionWeightMap* selectionWeights = NULL; if (!bg_template) { @@ -552,7 +552,7 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId bgTypeId } } - Battleground *bg = NULL; + Battleground* bg = NULL; // create a copy of the BG template switch(bgTypeId) { @@ -625,7 +625,7 @@ Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId bgTypeId uint32 BattlegroundMgr::CreateBattleground(CreateBattlegroundData& data) { // Create the BG - Battleground *bg = NULL; + Battleground* bg = NULL; switch (data.bgTypeId) { case BATTLEGROUND_AV: bg = new BattlegroundAV; break; @@ -652,8 +652,8 @@ uint32 BattlegroundMgr::CreateBattleground(CreateBattlegroundData& data) bg->SetArenaorBGType(data.IsArena); bg->SetMinPlayersPerTeam(data.MinPlayersPerTeam); bg->SetMaxPlayersPerTeam(data.MaxPlayersPerTeam); - bg->SetMinPlayers(data.MinPlayersPerTeam * 2); - bg->SetMaxPlayers(data.MaxPlayersPerTeam * 2); + bg->SetMinPlayers(data.MinPlayersPerTeam* 2); + bg->SetMaxPlayers(data.MaxPlayersPerTeam* 2); bg->SetName(data.BattlegroundName); bg->SetTeamStartLoc(ALLIANCE, data.Team1StartLocX, data.Team1StartLocY, data.Team1StartLocZ, data.Team1StartLocO); bg->SetTeamStartLoc(HORDE, data.Team2StartLocX, data.Team2StartLocY, data.Team2StartLocZ, data.Team2StartLocO); @@ -672,7 +672,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds() uint32 oldMSTime = getMSTime(); uint8 selectionWeight; - BattlemasterListEntry const *bl; + BattlemasterListEntry const* bl; // 0 1 2 3 4 5 6 7 8 9 10 QueryResult result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, AllianceStartLoc, AllianceStartO, HordeStartLoc, HordeStartO, Weight, ScriptName FROM battleground_template"); @@ -688,10 +688,10 @@ void BattlegroundMgr::CreateInitialBattlegrounds() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 bgTypeID_ = fields[0].GetUInt32(); - if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeID_, NULL)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeID_, NULL)) continue; // can be overwrite by values from DB @@ -805,7 +805,7 @@ void BattlegroundMgr::InitAutomaticArenaPointDistribution() sLog->outDebug(LOG_FILTER_BATTLEGROUND, "Automatic Arena Point Distribution initialized."); } -void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket *data, uint64 guid, Player* plr, BattlegroundTypeId bgTypeId, uint8 fromWhere) +void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* plr, BattlegroundTypeId bgTypeId, uint8 fromWhere) { if (!plr) return; @@ -869,9 +869,9 @@ void BattlegroundMgr::BuildBattlegroundListPacket(WorldPacket *data, uint64 guid } } -void BattlegroundMgr::SendToBattleground(Player *pl, uint32 instanceId, BattlegroundTypeId bgTypeId) +void BattlegroundMgr::SendToBattleground(Player* pl, uint32 instanceId, BattlegroundTypeId bgTypeId) { - Battleground *bg = GetBattleground(instanceId, bgTypeId); + Battleground* bg = GetBattleground(instanceId, bgTypeId); if (bg) { uint32 mapid = bg->GetMapId(); @@ -890,7 +890,7 @@ void BattlegroundMgr::SendToBattleground(Player *pl, uint32 instanceId, Battlegr } } -void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player *pl, Battleground *bg, uint64 guid) +void BattlegroundMgr::SendAreaSpiritHealerQueryOpcode(Player* pl, Battleground* bg, uint64 guid) { WorldPacket data(SMSG_AREA_SPIRIT_HEALER_TIME, 12); uint32 time_ = 30000 - bg->GetLastResurrectTime(); // resurrect every 30 seconds @@ -1080,7 +1080,7 @@ void BattlegroundMgr::LoadBattleMastersEntry() { ++count; - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); uint32 bgTypeId = fields[1].GetUInt32(); diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.h b/src/server/game/Battlegrounds/BattlegroundMgr.h index b453ba59170..7f35e5366a5 100755 --- a/src/server/game/Battlegrounds/BattlegroundMgr.h +++ b/src/server/game/Battlegrounds/BattlegroundMgr.h @@ -65,15 +65,15 @@ class BattlegroundMgr void Update(uint32 diff); /* Packet Building */ - void BuildPlayerJoinedBattlegroundPacket(WorldPacket *data, Player *plr); - void BuildPlayerLeftBattlegroundPacket(WorldPacket *data, uint64 guid); - void BuildBattlegroundListPacket(WorldPacket *data, uint64 guid, Player *plr, BattlegroundTypeId bgTypeId, uint8 fromWhere); - void BuildGroupJoinedBattlegroundPacket(WorldPacket *data, GroupJoinBattlegroundResult result); - void BuildUpdateWorldStatePacket(WorldPacket *data, uint32 field, uint32 value); - void BuildPvpLogDataPacket(WorldPacket *data, Battleground *bg); - void BuildBattlegroundStatusPacket(WorldPacket *data, Battleground *bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype, uint8 uiFrame = 1); - void BuildPlaySoundPacket(WorldPacket *data, uint32 soundid); - void SendAreaSpiritHealerQueryOpcode(Player *pl, Battleground *bg, uint64 guid); + void BuildPlayerJoinedBattlegroundPacket(WorldPacket* data, Player* plr); + void BuildPlayerLeftBattlegroundPacket(WorldPacket* data, uint64 guid); + void BuildBattlegroundListPacket(WorldPacket* data, uint64 guid, Player* plr, BattlegroundTypeId bgTypeId, uint8 fromWhere); + void BuildGroupJoinedBattlegroundPacket(WorldPacket* data, GroupJoinBattlegroundResult result); + void BuildUpdateWorldStatePacket(WorldPacket* data, uint32 field, uint32 value); + void BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg); + void BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype, uint8 uiFrame = 1); + void BuildPlaySoundPacket(WorldPacket* data, uint32 soundid); + void SendAreaSpiritHealerQueryOpcode(Player* pl, Battleground* bg, uint64 guid); /* Battlegrounds */ Battleground* GetBattlegroundThroughClientInstance(uint32 instanceId, BattlegroundTypeId bgTypeId); @@ -91,7 +91,7 @@ class BattlegroundMgr void CreateInitialBattlegrounds(); void DeleteAllBattlegrounds(); - void SendToBattleground(Player *pl, uint32 InstanceID, BattlegroundTypeId bgTypeId); + void SendToBattleground(Player* pl, uint32 InstanceID, BattlegroundTypeId bgTypeId); /* Battleground queues */ //these queues are instantiated when creating BattlegroundMrg diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index 2dbe799150c..9cd87bf4725 100755 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -45,6 +45,8 @@ BattlegroundQueue::BattlegroundQueue() BattlegroundQueue::~BattlegroundQueue() { + m_events.KillAllEvents(false); + m_QueuedPlayers.clear(); for (int i = 0; i < MAX_BATTLEGROUND_BRACKETS; ++i) { @@ -105,7 +107,7 @@ bool BattlegroundQueue::SelectionPool::KickGroup(uint32 size) // used when building selection pools // returns true if we can invite more players, or when we added group to selection pool // returns false when selection pool is full -bool BattlegroundQueue::SelectionPool::AddGroup(GroupQueueInfo *ginfo, uint32 desiredCount) +bool BattlegroundQueue::SelectionPool::AddGroup(GroupQueueInfo* ginfo, uint32 desiredCount) { //if group is larger than desired count - don't allow to add it to pool if (!ginfo->IsInvitedToBGInstanceGUID && desiredCount >= PlayerCount + ginfo->Players.size()) @@ -125,7 +127,7 @@ bool BattlegroundQueue::SelectionPool::AddGroup(GroupQueueInfo *ginfo, uint32 de /*********************************************************/ // add group or player (grp == NULL) to bg queue with the given leader and bg specifications -GroupQueueInfo * BattlegroundQueue::AddGroup(Player *leader, Group* grp, BattlegroundTypeId BgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 MatchmakerRating, uint32 arenateamid) +GroupQueueInfo* BattlegroundQueue::AddGroup(Player* leader, Group* grp, BattlegroundTypeId BgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 MatchmakerRating, uint32 arenateamid) { BattlegroundBracketId bracketId = bracketEntry->GetBracketId(); @@ -159,7 +161,7 @@ GroupQueueInfo * BattlegroundQueue::AddGroup(Player *leader, Group* grp, Battleg //announce world (this don't need mutex) if (isRated && sWorld->getBoolConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE)) { - ArenaTeam *Team = sArenaTeamMgr->GetArenaTeamById(arenateamid); + ArenaTeam* Team = sArenaTeamMgr->GetArenaTeamById(arenateamid); if (Team) sWorld->SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_JOIN, Team->GetName().c_str(), ginfo->ArenaType, ginfo->ArenaType, ginfo->ArenaTeamRating); } @@ -169,9 +171,9 @@ GroupQueueInfo * BattlegroundQueue::AddGroup(Player *leader, Group* grp, Battleg //ACE_Guard<ACE_Recursive_Thread_Mutex> guard(m_Lock); if (grp) { - for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) { - Player *member = itr->getSource(); + Player* member = itr->getSource(); if (!member) continue; // this should never happen PlayerQueueInfo& pl_info = m_QueuedPlayers[member->GetGUID()]; @@ -283,7 +285,7 @@ uint32 BattlegroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, Battleg //remove player from queue and from group info, if group info is empty then remove it too void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) { - //Player *plr = ObjectAccessor::FindPlayer(guid); + //Player* plr = ObjectAccessor::FindPlayer(guid); int32 bracket_id = -1; // signed for proper for-loop finish QueuedPlayersMap::iterator itr; @@ -351,16 +353,16 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) // announce to world if arena team left queue for rated match, show only once if (group->ArenaType && group->IsRated && group->Players.empty() && sWorld->getBoolConfig(CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE)) - if (ArenaTeam *Team = sArenaTeamMgr->GetArenaTeamById(group->ArenaTeamId)) + if (ArenaTeam* Team = sArenaTeamMgr->GetArenaTeamById(group->ArenaTeamId)) sWorld->SendWorldText(LANG_ARENA_QUEUE_ANNOUNCE_WORLD_EXIT, Team->GetName().c_str(), group->ArenaType, group->ArenaType, group->ArenaTeamRating); // if player leaves queue and he is invited to rated arena match, then he have to lose if (group->IsInvitedToBGInstanceGUID && group->IsRated && decreaseInvitedCount) { - if (ArenaTeam * at = sArenaTeamMgr->GetArenaTeamById(group->ArenaTeamId)) + if (ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(group->ArenaTeamId)) { sLog->outDebug(LOG_FILTER_BATTLEGROUND, "UPDATING memberLost's personal arena rating for %u by opponents rating: %u", GUID_LOPART(guid), group->OpponentsTeamRating); - if (Player *plr = ObjectAccessor::FindPlayer(guid)) + if (Player* plr = ObjectAccessor::FindPlayer(guid)) at->MemberLost(plr, group->OpponentsMatchmakerRating); else at->OfflineMemberLost(guid, group->OpponentsMatchmakerRating); @@ -381,7 +383,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) { // remove next player, this is recursive // first send removal information - if (Player *plr2 = ObjectAccessor::FindPlayer(group->Players.begin()->first)) + if (Player* plr2 = ObjectAccessor::FindPlayer(group->Players.begin()->first)) { Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(group->BgTypeId); BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(group->BgTypeId, group->ArenaType); @@ -415,7 +417,7 @@ bool BattlegroundQueue::GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo* ginf return true; } -bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, Battleground* bg, uint32 side) +bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, uint32 side) { // set side if needed if (side) @@ -456,10 +458,10 @@ bool BattlegroundQueue::InviteGroupToBG(GroupQueueInfo * ginfo, Battleground* bg // create remind invite events BGQueueInviteEvent* inviteEvent = new BGQueueInviteEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, ginfo->ArenaType, ginfo->RemoveInviteTime); - plr->m_Events.AddEvent(inviteEvent, plr->m_Events.CalculateTime(INVITATION_REMIND_TIME)); + m_events.AddEvent(inviteEvent, m_events.CalculateTime(INVITATION_REMIND_TIME)); // create automatic remove events BGQueueRemoveEvent* removeEvent = new BGQueueRemoveEvent(plr->GetGUID(), ginfo->IsInvitedToBGInstanceGUID, bgTypeId, bgQueueTypeId, ginfo->RemoveInviteTime); - plr->m_Events.AddEvent(removeEvent, plr->m_Events.CalculateTime(INVITE_ACCEPT_WAIT_TIME)); + m_events.AddEvent(removeEvent, m_events.CalculateTime(INVITE_ACCEPT_WAIT_TIME)); WorldPacket data; @@ -724,8 +726,10 @@ this method is called when group is inserted, or player / group is removed from it must be called after fully adding the members of a group to ensure group joining should be called from Battleground::RemovePlayer function in some cases */ -void BattlegroundQueue::Update(BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id, uint8 arenaType, bool isRated, uint32 arenaRating) +void BattlegroundQueue::BattlegroundQueueUpdate(uint32 diff, BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id, uint8 arenaType, bool isRated, uint32 arenaRating) { + m_events.Update(diff); + //if no players in queue - do nothing if (m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_ALLIANCE].empty() && m_QueuedGroups[bracket_id][BG_QUEUE_PREMADE_HORDE].empty() && diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.h b/src/server/game/Battlegrounds/BattlegroundQueue.h index c2579b7623a..10bff57a251 100755 --- a/src/server/game/Battlegrounds/BattlegroundQueue.h +++ b/src/server/game/Battlegrounds/BattlegroundQueue.h @@ -33,7 +33,7 @@ struct GroupQueueInfo; // type predefinitio struct PlayerQueueInfo // stores information for players in queue { uint32 LastOnlineTime; // for tracking and removing offline players from queue after 5 minutes - GroupQueueInfo * GroupInfo; // pointer to the associated groupqueueinfo + GroupQueueInfo* GroupInfo; // pointer to the associated groupqueueinfo }; struct GroupQueueInfo // stores information about the group in queue (also used when joined as solo!) @@ -69,13 +69,13 @@ class BattlegroundQueue BattlegroundQueue(); ~BattlegroundQueue(); - void Update(BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id, uint8 arenaType = 0, bool isRated = false, uint32 minRating = 0); + void BattlegroundQueueUpdate(uint32 diff, BattlegroundTypeId bgTypeId, BattlegroundBracketId bracket_id, uint8 arenaType = 0, bool isRated = false, uint32 minRating = 0); void FillPlayersToBG(Battleground* bg, BattlegroundBracketId bracket_id); bool CheckPremadeMatch(BattlegroundBracketId bracket_id, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam); bool CheckNormalMatch(Battleground* bg_template, BattlegroundBracketId bracket_id, uint32 minPlayers, uint32 maxPlayers); bool CheckSkirmishForSameFaction(BattlegroundBracketId bracket_id, uint32 minPlayersPerTeam); - GroupQueueInfo * AddGroup(Player* leader, Group* group, BattlegroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 MatchmakerRating, uint32 ArenaTeamId = 0); + GroupQueueInfo* AddGroup(Player* leader, Group* group, BattlegroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 ArenaType, bool isRated, bool isPremade, uint32 ArenaRating, uint32 MatchmakerRating, uint32 ArenaTeamId = 0); void RemovePlayer(uint64 guid, bool decreaseInvitedCount); bool IsPlayerInvited(uint64 pl_guid, const uint32 bgInstanceGuid, const uint32 removeTime); bool GetPlayerGroupInfoData(uint64 guid, GroupQueueInfo* ginfo); @@ -104,7 +104,7 @@ class BattlegroundQueue { public: void Init(); - bool AddGroup(GroupQueueInfo *ginfo, uint32 desiredCount); + bool AddGroup(GroupQueueInfo* ginfo, uint32 desiredCount); bool KickGroup(uint32 size); uint32 GetPlayerCount() const {return PlayerCount;} public: @@ -118,10 +118,13 @@ class BattlegroundQueue private: - bool InviteGroupToBG(GroupQueueInfo * ginfo, Battleground* bg, uint32 side); + bool InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, uint32 side); uint32 m_WaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME]; uint32 m_WaitTimeLastPlayer[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS]; uint32 m_SumOfWaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS]; + + // Event handler + EventProcessor m_events; }; /* diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAA.cpp index 809c214b790..7c7a6262c58 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAA.cpp @@ -47,7 +47,7 @@ void BattlegroundAA::StartingEventOpenDoors() { } -void BattlegroundAA::AddPlayer(Player *plr) +void BattlegroundAA::AddPlayer(Player* plr) { Battleground::AddPlayer(plr); //create score and add it to map, default values are set in constructor diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAA.h b/src/server/game/Battlegrounds/Zones/BattlegroundAA.h index c94d54916e0..33e193bd4ef 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAA.h @@ -35,12 +35,12 @@ class BattlegroundAA : public Battleground ~BattlegroundAA(); /* inherited from BattlegroundClass */ - virtual void AddPlayer(Player *plr); + virtual void AddPlayer(Player* plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr, uint64 guid, uint32 team); - void HandleAreaTrigger(Player *Source, uint32 Trigger); + void RemovePlayer(Player* plr, uint64 guid, uint32 team); + void HandleAreaTrigger(Player* Source, uint32 Trigger); bool SetupBattleground(); void HandleKillPlayer(Player* player, Player* killer); }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp index 8bc64a0f7d8..e2a39ff4666 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.cpp @@ -204,7 +204,7 @@ void BattlegroundAB::StartingEventOpenDoors() DoorOpen(BG_AB_OBJECT_GATE_H); } -void BattlegroundAB::AddPlayer(Player *plr) +void BattlegroundAB::AddPlayer(Player* plr) { Battleground::AddPlayer(plr); //create score and add it to map, default values are set in the constructor @@ -218,7 +218,7 @@ void BattlegroundAB::RemovePlayer(Player* /*plr*/, uint64 /*guid*/, uint32 /*tea } -void BattlegroundAB::HandleAreaTrigger(Player *Source, uint32 Trigger) +void BattlegroundAB::HandleAreaTrigger(Player* Source, uint32 Trigger) { if (GetStatus() != STATUS_IN_PROGRESS) return; @@ -406,7 +406,7 @@ void BattlegroundAB::_NodeDeOccupied(uint8 node) std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[node]]; if (!ghost_list.empty()) { - WorldSafeLocsEntry const *ClosestGrave = NULL; + WorldSafeLocsEntry const* ClosestGrave = NULL; for (std::vector<uint64>::const_iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr) { Player* plr = ObjectAccessor::FindPlayer(*itr); @@ -428,7 +428,7 @@ void BattlegroundAB::_NodeDeOccupied(uint8 node) } /* Invoked if a player used a banner as a gameobject */ -void BattlegroundAB::EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/) +void BattlegroundAB::EventPlayerClickedOnFlag(Player* source, GameObject* /*target_obj*/) { if (GetStatus() != STATUS_IN_PROGRESS) return; @@ -679,7 +679,7 @@ WorldSafeLocsEntry const* BattlegroundAB::GetClosestGraveYard(Player* player) return good_entry; } -void BattlegroundAB::UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor) +void BattlegroundAB::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) { BattlegroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); if (itr == m_PlayerScores.end()) // player not found... diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h index 84398389c10..c848c5f23f8 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h @@ -245,23 +245,23 @@ class BattlegroundAB : public Battleground BattlegroundAB(); ~BattlegroundAB(); - void AddPlayer(Player *plr); + void AddPlayer(Player* plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr, uint64 guid, uint32 team); - void HandleAreaTrigger(Player *Source, uint32 Trigger); + void RemovePlayer(Player* plr, uint64 guid, uint32 team); + void HandleAreaTrigger(Player* Source, uint32 Trigger); virtual bool SetupBattleground(); virtual void Reset(); void EndBattleground(uint32 winner); virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); /* Scorekeeping */ - virtual void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true); + virtual void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true); virtual void FillInitialWorldStates(WorldPacket& data); /* Nodes occupying */ - virtual void EventPlayerClickedOnFlag(Player *source, GameObject* target_obj); + virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj); /* achievement req. */ bool IsAllNodesConrolledByTeam(uint32 team) const; // overwrited diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index d5dbdca976f..efe8075a03e 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -422,7 +422,7 @@ void BattlegroundAV::StartingEventOpenDoors() DoorOpen(BG_AV_OBJECT_DOOR_A); } -void BattlegroundAV::AddPlayer(Player *plr) +void BattlegroundAV::AddPlayer(Player* plr) { Battleground::AddPlayer(plr); //create score and add it to map, default values are set in constructor @@ -486,7 +486,7 @@ void BattlegroundAV::RemovePlayer(Player* plr, uint64 /*guid*/, uint32 /*team*/) plr->RemoveAurasDueToSpell(AV_BUFF_H_CAPTAIN); } -void BattlegroundAV::HandleAreaTrigger(Player *Source, uint32 Trigger) +void BattlegroundAV::HandleAreaTrigger(Player* Source, uint32 Trigger) { // this is wrong way to implement these things. On official it done by gameobject spell cast. if (GetStatus() != STATUS_IN_PROGRESS) @@ -853,7 +853,7 @@ uint32 BattlegroundAV::GetObjectThroughNode(BG_AV_Nodes node) //called when using banner -void BattlegroundAV::EventPlayerClickedOnFlag(Player *source, GameObject* target_obj) +void BattlegroundAV::EventPlayerClickedOnFlag(Player* source, GameObject* target_obj) { if (GetStatus() != STATUS_IN_PROGRESS) return; @@ -1029,8 +1029,8 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object) std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[node]]; if (!ghost_list.empty()) { - Player *plr; - WorldSafeLocsEntry const *ClosestGrave = NULL; + Player* plr; + WorldSafeLocsEntry const* ClosestGrave = NULL; for (std::vector<uint64>::iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr) { plr = ObjectAccessor::FindPlayer(*ghost_list.begin()); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h index 83fd559fdd4..3ae1f52a4f9 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h @@ -1539,21 +1539,21 @@ class BattlegroundAV : public Battleground ~BattlegroundAV(); /* inherited from BattlegroundClass */ - virtual void AddPlayer(Player *plr); + virtual void AddPlayer(Player* plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr, uint64 guid, uint32 team); - void HandleAreaTrigger(Player *Source, uint32 Trigger); + void RemovePlayer(Player* plr, uint64 guid, uint32 team); + void HandleAreaTrigger(Player* Source, uint32 Trigger); bool SetupBattleground(); virtual void ResetBGSubclass(); /*general stuff*/ void UpdateScore(uint16 team, int16 points); - void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true); + void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true); /*handlestuff*/ //these are functions which get called from extern - virtual void EventPlayerClickedOnFlag(Player *source, GameObject* target_obj); + virtual void EventPlayerClickedOnFlag(Player* source, GameObject* target_obj); void HandleKillPlayer(Player* player, Player* killer); void HandleKillUnit(Creature* unit, Player* killer); void HandleQuestComplete(uint32 questid, Player* player); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp index e88103acb25..1db59547d92 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp @@ -62,7 +62,7 @@ void BattlegroundBE::StartingEventOpenDoors() SpawnBGObject(i, 60); } -void BattlegroundBE::AddPlayer(Player *plr) +void BattlegroundBE::AddPlayer(Player* plr) { Battleground::AddPlayer(plr); //create score and add it to map, default values are set in constructor @@ -105,7 +105,7 @@ bool BattlegroundBE::HandlePlayerUnderMap(Player* player) return true; } -void BattlegroundBE::HandleAreaTrigger(Player *Source, uint32 Trigger) +void BattlegroundBE::HandleAreaTrigger(Player* Source, uint32 Trigger) { // this is wrong way to implement these things. On official it done by gameobject spell cast. if (GetStatus() != STATUS_IN_PROGRESS) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h index 65475997b90..13aef8f561b 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h @@ -55,12 +55,12 @@ class BattlegroundBE : public Battleground ~BattlegroundBE(); /* inherited from BattlegroundClass */ - virtual void AddPlayer(Player *plr); + virtual void AddPlayer(Player* plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr, uint64 guid, uint32 team); - void HandleAreaTrigger(Player *Source, uint32 Trigger); + void RemovePlayer(Player* plr, uint64 guid, uint32 team); + void HandleAreaTrigger(Player* Source, uint32 Trigger); bool SetupBattleground(); virtual void Reset(); virtual void FillInitialWorldStates(WorldPacket &d); @@ -68,6 +68,6 @@ class BattlegroundBE : public Battleground bool HandlePlayerUnderMap(Player* plr); /* Scorekeeping */ - void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true); + void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true); }; #endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index 3c1e3612d1a..6fb07ebb678 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -88,7 +88,7 @@ void BattlegroundDS::StartingEventOpenDoors() SpawnBGObject(i, getWaterFallTimer()); } -void BattlegroundDS::AddPlayer(Player *plr) +void BattlegroundDS::AddPlayer(Player* plr) { Battleground::AddPlayer(plr); //create score and add it to map, default values are set in constructor @@ -125,7 +125,7 @@ void BattlegroundDS::HandleKillPlayer(Player* player, Player* killer) CheckArenaWinConditions(); } -void BattlegroundDS::HandleAreaTrigger(Player *Source, uint32 Trigger) +void BattlegroundDS::HandleAreaTrigger(Player* Source, uint32 Trigger) { if (GetStatus() != STATUS_IN_PROGRESS) return; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h index 02da03d6450..e5b2d613810 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h @@ -64,12 +64,12 @@ class BattlegroundDS : public Battleground ~BattlegroundDS(); /* inherited from BattlegroundClass */ - virtual void AddPlayer(Player *plr); + virtual void AddPlayer(Player* plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr, uint64 guid, uint32 team); - void HandleAreaTrigger(Player *Source, uint32 Trigger); + void RemovePlayer(Player* plr, uint64 guid, uint32 team); + void HandleAreaTrigger(Player* Source, uint32 Trigger); bool SetupBattleground(); virtual void Reset(); virtual void FillInitialWorldStates(WorldPacket &d); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp index 77d2c72da32..8c5b0468aca 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.cpp @@ -137,7 +137,7 @@ void BattlegroundEY::AddPoints(uint32 Team, uint32 Points) void BattlegroundEY::CheckSomeoneJoinedPoint() { - GameObject *obj = NULL; + GameObject* obj = NULL; for (uint8 i = 0; i < EY_POINTS_MAX; ++i) { obj = HashMapHolder<GameObject>::Find(m_BgObjects[BG_EY_OBJECT_TOWER_CAP_FEL_REAVER + i]); @@ -146,7 +146,7 @@ void BattlegroundEY::CheckSomeoneJoinedPoint() uint8 j = 0; while (j < m_PlayersNearPoint[EY_POINTS_MAX].size()) { - Player *plr = ObjectAccessor::FindPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]); + Player* plr = ObjectAccessor::FindPlayer(m_PlayersNearPoint[EY_POINTS_MAX][j]); if (!plr) { sLog->outError("BattlegroundEY:CheckSomeoneJoinedPoint: Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[EY_POINTS_MAX][j])); @@ -177,7 +177,7 @@ void BattlegroundEY::CheckSomeoneLeftPoint() //reset current point counts for (uint8 i = 0; i < 2*EY_POINTS_MAX; ++i) m_CurrentPointPlayersCount[i] = 0; - GameObject *obj = NULL; + GameObject* obj = NULL; for (uint8 i = 0; i < EY_POINTS_MAX; ++i) { obj = HashMapHolder<GameObject>::Find(m_BgObjects[BG_EY_OBJECT_TOWER_CAP_FEL_REAVER + i]); @@ -186,7 +186,7 @@ void BattlegroundEY::CheckSomeoneLeftPoint() uint8 j = 0; while (j < m_PlayersNearPoint[i].size()) { - Player *plr = ObjectAccessor::FindPlayer(m_PlayersNearPoint[i][j]); + Player* plr = ObjectAccessor::FindPlayer(m_PlayersNearPoint[i][j]); if (!plr) { sLog->outError("BattlegroundEY:CheckSomeoneLeftPoint Player (GUID: %u) not found!", GUID_LOPART(m_PlayersNearPoint[i][j])); @@ -241,7 +241,7 @@ void BattlegroundEY::UpdatePointStatuses() for (uint8 i = 0; i < m_PlayersNearPoint[point].size(); ++i) { - Player *plr = ObjectAccessor::FindPlayer(m_PlayersNearPoint[point][i]); + Player* plr = ObjectAccessor::FindPlayer(m_PlayersNearPoint[point][i]); if (plr) { this->UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[point], plr); @@ -330,7 +330,7 @@ void BattlegroundEY::UpdatePointsIcons(uint32 Team, uint32 Point) } } -void BattlegroundEY::AddPlayer(Player *plr) +void BattlegroundEY::AddPlayer(Player* plr) { Battleground::AddPlayer(plr); //create score and add it to map @@ -341,7 +341,7 @@ void BattlegroundEY::AddPlayer(Player *plr) m_PlayerScores[plr->GetGUID()] = sc; } -void BattlegroundEY::RemovePlayer(Player *plr, uint64 guid, uint32 /*team*/) +void BattlegroundEY::RemovePlayer(Player* plr, uint64 guid, uint32 /*team*/) { // sometimes flag aura not removed :( for (int j = EY_POINTS_MAX; j >= 0; --j) @@ -365,7 +365,7 @@ void BattlegroundEY::RemovePlayer(Player *plr, uint64 guid, uint32 /*team*/) } } -void BattlegroundEY::HandleAreaTrigger(Player *Source, uint32 Trigger) +void BattlegroundEY::HandleAreaTrigger(Player* Source, uint32 Trigger) { if (GetStatus() != STATUS_IN_PROGRESS) return; @@ -491,7 +491,7 @@ bool BattlegroundEY::SetupBattleground() sLog->outError("BattlegroundEY: Cannot spawn buff"); } - WorldSafeLocsEntry const *sg = NULL; + WorldSafeLocsEntry const* sg = NULL; sg = sWorldSafeLocsStore.LookupEntry(EY_GRAVEYARD_MAIN_ALLIANCE); if (!sg || !AddSpiritGuide(EY_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE)) { @@ -563,7 +563,7 @@ void BattlegroundEY::RespawnFlagAfterDrop() { RespawnFlag(true); - GameObject *obj = HashMapHolder<GameObject>::Find(GetDroppedFlagGUID()); + GameObject* obj = HashMapHolder<GameObject>::Find(GetDroppedFlagGUID()); if (obj) obj->Delete(); else @@ -581,7 +581,7 @@ void BattlegroundEY::HandleKillPlayer(Player* player, Player* killer) EventPlayerDroppedFlag(player); } -void BattlegroundEY::EventPlayerDroppedFlag(Player *Source) +void BattlegroundEY::EventPlayerDroppedFlag(Player* Source) { if (GetStatus() != STATUS_IN_PROGRESS) { @@ -617,7 +617,7 @@ void BattlegroundEY::EventPlayerDroppedFlag(Player *Source) SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL); } -void BattlegroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj) +void BattlegroundEY::EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj) { if (GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10)) return; @@ -649,7 +649,7 @@ void BattlegroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, CHAT_MSG_BG_SYSTEM_HORDE, NULL, Source->GetName()); } -void BattlegroundEY::EventTeamLostPoint(Player *Source, uint32 Point) +void BattlegroundEY::EventTeamLostPoint(Player* Source, uint32 Point) { if (GetStatus() != STATUS_IN_PROGRESS) return; @@ -697,7 +697,7 @@ void BattlegroundEY::EventTeamLostPoint(Player *Source, uint32 Point) DelCreature(Point + 6);//NULL checks are in DelCreature! 0-5 spirit guides } -void BattlegroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point) +void BattlegroundEY::EventTeamCapturedPoint(Player* Source, uint32 Point) { if (GetStatus() != STATUS_IN_PROGRESS) return; @@ -736,7 +736,7 @@ void BattlegroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point) if (m_BgCreatures[Point]) DelCreature(Point); - WorldSafeLocsEntry const *sg = NULL; + WorldSafeLocsEntry const* sg = NULL; sg = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[Point].GraveYardId); if (!sg || !AddSpiritGuide(Point, sg->x, sg->y, sg->z, 3.124139f, Team)) sLog->outError("BatteGroundEY: Failed to spawn spirit guide! point: %u, team: %u, graveyard_id: %u", @@ -764,7 +764,7 @@ void BattlegroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point) } } -void BattlegroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType) +void BattlegroundEY::EventPlayerCapturedFlag(Player* Source, uint32 BgObjectType) { if (GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGUID() != Source->GetGUID()) return; @@ -803,7 +803,7 @@ void BattlegroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType UpdatePlayerScore(Source, SCORE_FLAG_CAPTURES, 1); } -void BattlegroundEY::UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor) +void BattlegroundEY::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) { BattlegroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); if (itr == m_PlayerScores.end()) // player not found @@ -871,7 +871,7 @@ void BattlegroundEY::FillInitialWorldStates(WorldPacket& data) data << uint32(0xc0d) << uint32(0x17b); } -WorldSafeLocsEntry const *BattlegroundEY::GetClosestGraveYard(Player* player) +WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveYard(Player* player) { uint32 g_id = 0; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h index 1418effd6e9..08a34f71ba1 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h @@ -336,7 +336,7 @@ class BattlegroundEY : public Battleground ~BattlegroundEY(); /* inherited from BattlegroundClass */ - virtual void AddPlayer(Player *plr); + virtual void AddPlayer(Player* plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); @@ -348,32 +348,32 @@ class BattlegroundEY : public Battleground void RespawnFlag(bool send_message); void RespawnFlagAfterDrop(); - void RemovePlayer(Player *plr, uint64 guid, uint32 team); + void RemovePlayer(Player* plr, uint64 guid, uint32 team); void HandleBuffUse(uint64 buff_guid); - void HandleAreaTrigger(Player *Source, uint32 Trigger); + void HandleAreaTrigger(Player* Source, uint32 Trigger); void HandleKillPlayer(Player* player, Player* killer); virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); virtual bool SetupBattleground(); virtual void Reset(); void UpdateTeamScore(uint32 Team); void EndBattleground(uint32 winner); - void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true); + void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true); virtual void FillInitialWorldStates(WorldPacket& data); void SetDroppedFlagGUID(uint64 guid) { m_DroppedFlagGUID = guid;} uint64 GetDroppedFlagGUID() const { return m_DroppedFlagGUID;} /* Battleground Events */ - virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj); - virtual void EventPlayerDroppedFlag(Player *Source); + virtual void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj); + virtual void EventPlayerDroppedFlag(Player* Source); /* achievement req. */ bool IsAllNodesConrolledByTeam(uint32 team) const; private: virtual void PostUpdateImpl(uint32 diff); - void EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType); - void EventTeamCapturedPoint(Player *Source, uint32 Point); - void EventTeamLostPoint(Player *Source, uint32 Point); + void EventPlayerCapturedFlag(Player* Source, uint32 BgObjectType); + void EventTeamCapturedPoint(Player* Source, uint32 Point); + void EventTeamLostPoint(Player* Source, uint32 Point); void UpdatePointsCount(uint32 Team); void UpdatePointsIcons(uint32 Team, uint32 Point); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp index 9df7cce05d8..47c13d8f860 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.cpp @@ -292,7 +292,7 @@ bool BattlegroundIC::IsAllNodesConrolledByTeam(uint32 team) const return count == NODE_TYPE_WORKSHOP; } -void BattlegroundIC::AddPlayer(Player *plr) +void BattlegroundIC::AddPlayer(Player* plr) { Battleground::AddPlayer(plr); //create score and add it to map, default values are set in constructor @@ -311,8 +311,11 @@ void BattlegroundIC::AddPlayer(Player *plr) void BattlegroundIC::RemovePlayer(Player* plr, uint64 /*guid*/, uint32 /*team*/) { - plr->RemoveAura(SPELL_QUARRY); - plr->RemoveAura(SPELL_OIL_REFINERY); + if (plr) + { + plr->RemoveAura(SPELL_QUARRY); + plr->RemoveAura(SPELL_OIL_REFINERY); + } } void BattlegroundIC::HandleAreaTrigger(Player* /*Source*/, uint32 /*Trigger*/) @@ -476,7 +479,7 @@ void BattlegroundIC::RealocatePlayers(ICNodePointType nodeType) std::vector<uint64> ghost_list = m_ReviveQueue[m_BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1+nodeType-2]]; if (!ghost_list.empty()) { - WorldSafeLocsEntry const *ClosestGrave = NULL; + WorldSafeLocsEntry const* ClosestGrave = NULL; for (std::vector<uint64>::const_iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr) { Player* plr = ObjectAccessor::FindPlayer(*itr); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h index 700e1d4f0a3..ed8a271921d 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h @@ -862,19 +862,19 @@ class BattlegroundIC : public Battleground ~BattlegroundIC(); /* inherited from BattlegroundClass */ - virtual void AddPlayer(Player *plr); + virtual void AddPlayer(Player* plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); virtual void PostUpdateImpl(uint32 diff); - void RemovePlayer(Player *plr, uint64 guid, uint32 team); - void HandleAreaTrigger(Player *Source, uint32 Trigger); + void RemovePlayer(Player* plr, uint64 guid, uint32 team); + void HandleAreaTrigger(Player* Source, uint32 Trigger); bool SetupBattleground(); void SpawnLeader(uint32 teamid); void HandleKillUnit(Creature* unit, Player* killer); void HandleKillPlayer(Player* player, Player* killer); void EndBattleground(uint32 winner); - void EventPlayerClickedOnFlag(Player *source, GameObject* /*target_obj*/); + void EventPlayerClickedOnFlag(Player* source, GameObject* /*target_obj*/); void EventPlayerDamagedGO(Player* /*plr*/, GameObject* go, uint32 eventType); void DestroyGate(Player* player, GameObject* go); @@ -882,7 +882,7 @@ class BattlegroundIC : public Battleground virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); /* Scorekeeping */ - void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true); + void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true); void FillInitialWorldStates(WorldPacket& data); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp index beb2e617c25..58dc20c30cb 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp @@ -59,7 +59,7 @@ void BattlegroundNA::StartingEventOpenDoors() SpawnBGObject(i, 60); } -void BattlegroundNA::AddPlayer(Player *plr) +void BattlegroundNA::AddPlayer(Player* plr) { Battleground::AddPlayer(plr); //create score and add it to map, default values are set in constructor @@ -102,7 +102,7 @@ bool BattlegroundNA::HandlePlayerUnderMap(Player* player) return true; } -void BattlegroundNA::HandleAreaTrigger(Player *Source, uint32 Trigger) +void BattlegroundNA::HandleAreaTrigger(Player* Source, uint32 Trigger) { if (GetStatus() != STATUS_IN_PROGRESS) return; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h index 8c217459110..beddbaaeedf 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h @@ -56,12 +56,12 @@ class BattlegroundNA : public Battleground ~BattlegroundNA(); /* inherited from BattlegroundClass */ - virtual void AddPlayer(Player *plr); + virtual void AddPlayer(Player* plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr, uint64 guid, uint32 team); - void HandleAreaTrigger(Player *Source, uint32 Trigger); + void RemovePlayer(Player* plr, uint64 guid, uint32 team); + void HandleAreaTrigger(Player* Source, uint32 Trigger); bool SetupBattleground(); virtual void Reset(); virtual void FillInitialWorldStates(WorldPacket &d); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRB.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRB.cpp index c8f3474a172..e2d64aa39f7 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRB.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRB.cpp @@ -43,7 +43,7 @@ void BattlegroundRB::StartingEventOpenDoors() { } -void BattlegroundRB::AddPlayer(Player *plr) +void BattlegroundRB::AddPlayer(Player* plr) { Battleground::AddPlayer(plr); //create score and add it to map, default values are set in constructor diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRB.h b/src/server/game/Battlegrounds/Zones/BattlegroundRB.h index be32bd654ea..0878654d7dd 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRB.h @@ -34,15 +34,15 @@ class BattlegroundRB : public Battleground BattlegroundRB(); ~BattlegroundRB(); - virtual void AddPlayer(Player *plr); + virtual void AddPlayer(Player* plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr, uint64 guid, uint32 team); - void HandleAreaTrigger(Player *Source, uint32 Trigger); + void RemovePlayer(Player* plr, uint64 guid, uint32 team); + void HandleAreaTrigger(Player* Source, uint32 Trigger); /* Scorekeeping */ - void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true); + void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true); private: }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp index 0c64b8ad8d8..8ede4a6329c 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp @@ -59,7 +59,7 @@ void BattlegroundRL::StartingEventOpenDoors() SpawnBGObject(i, 60); } -void BattlegroundRL::AddPlayer(Player *plr) +void BattlegroundRL::AddPlayer(Player* plr) { Battleground::AddPlayer(plr); //create score and add it to map, default values are set in constructor @@ -102,7 +102,7 @@ bool BattlegroundRL::HandlePlayerUnderMap(Player* player) return true; } -void BattlegroundRL::HandleAreaTrigger(Player *Source, uint32 Trigger) +void BattlegroundRL::HandleAreaTrigger(Player* Source, uint32 Trigger) { // this is wrong way to implement these things. On official it done by gameobject spell cast. if (GetStatus() != STATUS_IN_PROGRESS) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h index 87fe34e65d6..52ce7d3ca40 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h @@ -52,14 +52,14 @@ class BattlegroundRL : public Battleground ~BattlegroundRL(); /* inherited from BattlegroundClass */ - virtual void AddPlayer(Player *plr); + virtual void AddPlayer(Player* plr); virtual void Reset(); virtual void FillInitialWorldStates(WorldPacket &d); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); - void RemovePlayer(Player *plr, uint64 guid, uint32 team); - void HandleAreaTrigger(Player *Source, uint32 Trigger); + void RemovePlayer(Player* plr, uint64 guid, uint32 team); + void HandleAreaTrigger(Player* Source, uint32 Trigger); bool SetupBattleground(); void HandleKillPlayer(Player* player, Player* killer); bool HandlePlayerUnderMap(Player* plr); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index aa80be6f6cb..81a75c23cb5 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -102,7 +102,7 @@ void BattlegroundRV::StartingEventOpenDoors() setTimer(BG_RV_FIRST_TIMER); } -void BattlegroundRV::AddPlayer(Player *plr) +void BattlegroundRV::AddPlayer(Player* plr) { Battleground::AddPlayer(plr); //create score and add it to map, default values are set in constructor @@ -150,7 +150,7 @@ bool BattlegroundRV::HandlePlayerUnderMap(Player* player) return true; } -void BattlegroundRV::HandleAreaTrigger(Player *Source, uint32 Trigger) +void BattlegroundRV::HandleAreaTrigger(Player* Source, uint32 Trigger) { if (GetStatus() != STATUS_IN_PROGRESS) return; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h index 6cda12cb79d..9a6efe64524 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h @@ -105,14 +105,14 @@ class BattlegroundRV : public Battleground ~BattlegroundRV(); /* inherited from BattlegroundClass */ - virtual void AddPlayer(Player *plr); + virtual void AddPlayer(Player* plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); virtual void Reset(); virtual void FillInitialWorldStates(WorldPacket &d); - void RemovePlayer(Player *plr, uint64 guid, uint32 team); - void HandleAreaTrigger(Player *Source, uint32 Trigger); + void RemovePlayer(Player* plr, uint64 guid, uint32 team); + void HandleAreaTrigger(Player* Source, uint32 Trigger); bool SetupBattleground(); void HandleKillPlayer(Player* player, Player* killer); bool HandlePlayerUnderMap(Player* plr); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp index d477096e8e6..775467fecde 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.cpp @@ -62,7 +62,7 @@ bool BattlegroundSA::SetupBattleground() bool BattlegroundSA::ResetObjs() { for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) - if (Player *plr = ObjectAccessor::FindPlayer(itr->first)) + if (Player* plr = ObjectAccessor::FindPlayer(itr->first)) SendTransportsRemove(plr); uint32 atF = BG_SA_Factions[Attackers]; @@ -150,7 +150,7 @@ bool BattlegroundSA::ResetObjs() //Graveyards! for (uint8 i = 0;i < BG_SA_MAX_GY; i++) { - WorldSafeLocsEntry const *sg = NULL; + WorldSafeLocsEntry const* sg = NULL; sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]); if (!sg) @@ -245,7 +245,7 @@ bool BattlegroundSA::ResetObjs() for (int i = BG_SA_BOAT_ONE; i <= BG_SA_BOAT_TWO; i++) for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) - if (Player *plr = ObjectAccessor::FindPlayer(itr->first)) + if (Player* plr = ObjectAccessor::FindPlayer(itr->first)) SendTransportInit(plr); TeleportPlayers(); @@ -431,7 +431,7 @@ void BattlegroundSA::FillInitialWorldStates(WorldPacket& data) data << uint32(BG_SA_LEFT_ATT_TOKEN_ALL) << ally_attacks; } -void BattlegroundSA::AddPlayer(Player *plr) +void BattlegroundSA::AddPlayer(Player* plr) { Battleground::AddPlayer(plr); //create score and add it to map, default values are set in constructor @@ -492,7 +492,7 @@ void BattlegroundSA::TeleportPlayers() { for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) { - if (Player *plr = ObjectAccessor::FindPlayer(itr->first)) + if (Player* plr = ObjectAccessor::FindPlayer(itr->first)) { // should remove spirit of redemption if (plr->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) @@ -684,7 +684,7 @@ void BattlegroundSA::SendTime() UpdateWorldState(BG_SA_TIMER_SEC_DECS, ((end_of_round%60000)%10000)/1000); } -void BattlegroundSA::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj) +void BattlegroundSA::EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj) { switch(target_obj->GetEntry()) { @@ -708,14 +708,14 @@ void BattlegroundSA::EventPlayerClickedOnFlag(Player *Source, GameObject* target }; } -void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source) +void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player* Source) { if (GraveyardStatus[i] == Attackers) return; DelCreature(BG_SA_MAXNPC + i); GraveyardStatus[i] = Source->GetTeamId(); - WorldSafeLocsEntry const *sg = NULL; + WorldSafeLocsEntry const* sg = NULL; sg = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]); AddSpiritGuide(i + BG_SA_MAXNPC, sg->x, sg->y, sg->z, BG_SA_GYOrientation[i], (GraveyardStatus[i] == TEAM_ALLIANCE? ALLIANCE : HORDE)); uint32 npc = 0; @@ -798,7 +798,7 @@ void BattlegroundSA::EventPlayerUsedGO(Player* Source, GameObject* object) //Achievement Storm the Beach (1310) for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) { - if (Player *plr = ObjectAccessor::FindPlayer(itr->first)) + if (Player* plr = ObjectAccessor::FindPlayer(itr->first)) if (plr->GetTeamId() == Attackers) plr->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246); } @@ -822,7 +822,7 @@ void BattlegroundSA::EventPlayerUsedGO(Player* Source, GameObject* object) //Achievement Storm the Beach (1310) for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr) { - if (Player *plr = ObjectAccessor::FindPlayer(itr->first)) + if (Player* plr = ObjectAccessor::FindPlayer(itr->first)) if (plr->GetTeamId() == Attackers && RoundScores[1].winner == Attackers) plr->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246); } @@ -865,7 +865,7 @@ void BattlegroundSA::UpdateDemolisherSpawns() { if (m_BgCreatures[i]) { - if (Creature *Demolisher = GetBGCreature(i)) + if (Creature* Demolisher = GetBGCreature(i)) { if (Demolisher->isDead()) { diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index 1bc00459cd5..9d8325f2c6f 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h @@ -423,7 +423,7 @@ class BattlegroundSA : public Battleground /* inherited from BattlegroundClass */ /// Called when a player join battle - virtual void AddPlayer(Player *plr); + virtual void AddPlayer(Player* plr); /// Called when battle start virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); @@ -439,7 +439,7 @@ class BattlegroundSA : public Battleground /// Return the nearest graveyard where player can respawn virtual WorldSafeLocsEntry const* GetClosestGraveYard(Player* player); /// Called when a player click on flag (graveyard flag) - virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj); + virtual void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj); /// Called when a player use a gamobject (relic) virtual void EventPlayerUsedGO(Player* Source, GameObject* object); /// Return gate id, relative to bg data, according to gameobject id @@ -477,12 +477,12 @@ class BattlegroundSA : public Battleground void EndBattleground(uint32 winner); /// CAlled when a player leave battleground - void RemovePlayer(Player *plr, uint64 guid, uint32 team); - void HandleAreaTrigger(Player *Source, uint32 Trigger); + void RemovePlayer(Player* plr, uint64 guid, uint32 team); + void HandleAreaTrigger(Player* Source, uint32 Trigger); /* Scorekeeping */ /// Update score board - void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true); + void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true); // Achievement Defense of the Ancients bool gateDestroyed; @@ -530,7 +530,7 @@ class BattlegroundSA : public Battleground * \param i : id of graveyard * \param Source : Player who capture gy */ - void CaptureGraveyard(BG_SA_Graveyards i, Player *Source); + void CaptureGraveyard(BG_SA_Graveyards i, Player* Source); /// Switch on/off timer worldstate void ToggleTimer(); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index c0c39cae117..a567ecf7e33 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -202,7 +202,7 @@ void BattlegroundWS::StartingEventOpenDoors() StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, WS_EVENT_START_BATTLE); } -void BattlegroundWS::AddPlayer(Player *plr) +void BattlegroundWS::AddPlayer(Player* plr) { Battleground::AddPlayer(plr); //create score and add it to map, default values are set in constructor @@ -254,7 +254,7 @@ void BattlegroundWS::RespawnFlagAfterDrop(uint32 team) PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED); - if (GameObject *obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID(team))) + if (GameObject* obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID(team))) obj->Delete(); else sLog->outError("unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team))); @@ -263,7 +263,7 @@ void BattlegroundWS::RespawnFlagAfterDrop(uint32 team) m_BothFlagsKept = false; } -void BattlegroundWS::EventPlayerCapturedFlag(Player *Source) +void BattlegroundWS::EventPlayerCapturedFlag(Player* Source) { if (GetStatus() != STATUS_IN_PROGRESS) return; @@ -349,7 +349,7 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player *Source) } } -void BattlegroundWS::EventPlayerDroppedFlag(Player *Source) +void BattlegroundWS::EventPlayerDroppedFlag(Player* Source) { if (GetStatus() != STATUS_IN_PROGRESS) { @@ -435,7 +435,7 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player *Source) } } -void BattlegroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj) +void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj) { if (GetStatus() != STATUS_IN_PROGRESS) return; @@ -556,7 +556,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); } -void BattlegroundWS::RemovePlayer(Player *plr, uint64 guid, uint32 /*team*/) +void BattlegroundWS::RemovePlayer(Player* plr, uint64 guid, uint32 /*team*/) { // sometimes flag aura not removed :( if (IsAllianceFlagPickedup() && m_FlagKeepers[BG_TEAM_ALLIANCE] == guid) @@ -599,7 +599,7 @@ void BattlegroundWS::UpdateTeamScore(uint32 team) UpdateWorldState(BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(team)); } -void BattlegroundWS::HandleAreaTrigger(Player *Source, uint32 Trigger) +void BattlegroundWS::HandleAreaTrigger(Player* Source, uint32 Trigger) { // this is wrong way to implement these things. On official it done by gameobject spell cast. if (GetStatus() != STATUS_IN_PROGRESS) @@ -682,7 +682,7 @@ bool BattlegroundWS::SetupBattleground() return false; } - WorldSafeLocsEntry const *sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE); + WorldSafeLocsEntry const* sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_ALLIANCE); if (!sg || !AddSpiritGuide(WS_SPIRIT_MAIN_ALLIANCE, sg->x, sg->y, sg->z, 3.124139f, ALLIANCE)) { sLog->outErrorDb("BatteGroundWS: Failed to spawn Alliance spirit guide! Battleground not created!"); @@ -754,7 +754,7 @@ void BattlegroundWS::HandleKillPlayer(Player* player, Player* killer) Battleground::HandleKillPlayer(player, killer); } -void BattlegroundWS::UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor) +void BattlegroundWS::UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor) { BattlegroundScoreMap::iterator itr = m_PlayerScores.find(Source->GetGUID()); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h index 7b3dee9becb..5360a04a873 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h @@ -163,7 +163,7 @@ class BattlegroundWS : public Battleground ~BattlegroundWS(); /* inherited from BattlegroundClass */ - virtual void AddPlayer(Player *plr); + virtual void AddPlayer(Player* plr); virtual void StartingEventCloseDoors(); virtual void StartingEventOpenDoors(); @@ -183,12 +183,12 @@ class BattlegroundWS : public Battleground bool IsForceTimerDone; /* Battleground Events */ - virtual void EventPlayerDroppedFlag(Player *Source); - virtual void EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj); - virtual void EventPlayerCapturedFlag(Player *Source); + virtual void EventPlayerDroppedFlag(Player* Source); + virtual void EventPlayerClickedOnFlag(Player* Source, GameObject* target_obj); + virtual void EventPlayerCapturedFlag(Player* Source); - void RemovePlayer(Player *plr, uint64 guid, uint32 team); - void HandleAreaTrigger(Player *Source, uint32 Trigger); + void RemovePlayer(Player* plr, uint64 guid, uint32 team); + void HandleAreaTrigger(Player* Source, uint32 Trigger); void HandleKillPlayer(Player* player, Player* killer); bool SetupBattleground(); virtual void Reset(); @@ -198,7 +198,7 @@ class BattlegroundWS : public Battleground void UpdateFlagState(uint32 team, uint32 value); void SetLastFlagCapture(uint32 team) { m_LastFlagCaptureTeam = team; } void UpdateTeamScore(uint32 team); - void UpdatePlayerScore(Player *Source, uint32 type, uint32 value, bool doAddHonor = true); + void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true); void SetDroppedFlagGUID(uint64 guid, uint32 TeamID) { m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)] = guid;} uint64 GetDroppedFlagGUID(uint32 TeamID) { return m_DroppedFlagGUID[GetTeamIndexByTeamId(TeamID)];} virtual void FillInitialWorldStates(WorldPacket& data); diff --git a/src/server/game/Chat/Channels/Channel.cpp b/src/server/game/Chat/Channels/Channel.cpp index d39018e69a4..9cf8ee29b08 100755 --- a/src/server/game/Chat/Channels/Channel.cpp +++ b/src/server/game/Chat/Channels/Channel.cpp @@ -22,6 +22,7 @@ #include "SocialMgr.h" #include "World.h" #include "DatabaseEnv.h" +#include "AccountMgr.h" Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) : m_announce(true), m_ownership(true), m_name(name), m_password(""), m_flags(0), m_channelId(channel_id), m_ownerGUID(0), m_Team(Team) @@ -61,7 +62,7 @@ Channel::Channel(const std::string& name, uint32 channel_id, uint32 Team) if (result) //load { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); m_announce = fields[0].GetBool(); m_ownership = fields[1].GetBool(); m_password = fields[2].GetString(); @@ -168,12 +169,12 @@ void Channel::Join(uint64 p, const char *pass) return; } - Player *plr = ObjectAccessor::FindPlayer(p); + Player* plr = ObjectAccessor::FindPlayer(p); if (plr) { if (HasFlag(CHANNEL_FLAG_LFG) && - sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && plr->GetSession()->GetSecurity() == SEC_PLAYER && plr->GetGroup()) + sWorld->getBoolConfig(CONFIG_RESTRICTED_LFG_CHANNEL) && AccountMgr::IsPlayerAccount(plr->GetSession()->GetSecurity()) && plr->GetGroup()) { MakeNotInLfg(&data); SendToOne(&data, p); @@ -183,7 +184,7 @@ void Channel::Join(uint64 p, const char *pass) plr->JoinedChannel(this); } - if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL))) + if (m_announce && (!plr || !AccountMgr::IsGMAccount(plr->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL))) { MakeJoined(&data, p); SendToAll(&data); @@ -230,7 +231,7 @@ void Channel::Leave(uint64 p, bool send) } else { - Player *plr = ObjectAccessor::FindPlayer(p); + Player* plr = ObjectAccessor::FindPlayer(p); if (send) { @@ -245,7 +246,7 @@ void Channel::Leave(uint64 p, bool send) bool changeowner = players[p].IsOwner(); players.erase(p); - if (m_announce && (!plr || plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL))) + if (m_announce && (!plr || !AccountMgr::IsGMAccount(plr->GetSession()->GetSecurity()) || !sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL))) { WorldPacket data; MakeLeft(&data, p); @@ -273,7 +274,7 @@ void Channel::Leave(uint64 p, bool send) void Channel::KickOrBan(uint64 good, const char *badname, bool ban) { AccountTypes sec = SEC_PLAYER; - Player *gplr = ObjectAccessor::FindPlayer(good); + Player* gplr = ObjectAccessor::FindPlayer(good); if (gplr) sec = gplr->GetSession()->GetSecurity(); @@ -283,7 +284,7 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban) MakeNotMember(&data); SendToOne(&data, good); } - else if (!players[good].IsModerator() && sec < SEC_GAMEMASTER) + else if (!players[good].IsModerator() && !AccountMgr::IsGMAccount(sec)) { WorldPacket data; MakeNotModerator(&data); @@ -291,14 +292,14 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban) } else { - Player *bad = sObjectAccessor->FindPlayerByName(badname); + Player* bad = sObjectAccessor->FindPlayerByName(badname); if (bad == NULL || !IsOn(bad->GetGUID())) { WorldPacket data; MakePlayerNotFound(&data, badname); SendToOne(&data, good); } - else if (sec < SEC_GAMEMASTER && bad->GetGUID() == m_ownerGUID && good != m_ownerGUID) + else if (!AccountMgr::IsGMAccount(sec) && bad->GetGUID() == m_ownerGUID && good != m_ownerGUID) { WorldPacket data; MakeNotOwner(&data); @@ -337,7 +338,7 @@ void Channel::KickOrBan(uint64 good, const char *badname, bool ban) void Channel::UnBan(uint64 good, const char *badname) { uint32 sec = 0; - Player *gplr = ObjectAccessor::FindPlayer(good); + Player* gplr = ObjectAccessor::FindPlayer(good); if (gplr) sec = gplr->GetSession()->GetSecurity(); @@ -347,7 +348,7 @@ void Channel::UnBan(uint64 good, const char *badname) MakeNotMember(&data); SendToOne(&data, good); } - else if (!players[good].IsModerator() && sec < SEC_GAMEMASTER) + else if (!players[good].IsModerator() && !AccountMgr::IsGMAccount(sec)) { WorldPacket data; MakeNotModerator(&data); @@ -355,7 +356,7 @@ void Channel::UnBan(uint64 good, const char *badname) } else { - Player *bad = sObjectAccessor->FindPlayerByName(badname); + Player* bad = sObjectAccessor->FindPlayerByName(badname); if (bad == NULL || !IsBanned(bad->GetGUID())) { WorldPacket data; @@ -378,7 +379,7 @@ void Channel::UnBan(uint64 good, const char *badname) void Channel::Password(uint64 p, const char *pass) { uint32 sec = 0; - Player *plr = ObjectAccessor::FindPlayer(p); + Player* plr = ObjectAccessor::FindPlayer(p); if (plr) sec = plr->GetSession()->GetSecurity(); @@ -390,7 +391,7 @@ void Channel::Password(uint64 p, const char *pass) MakeNotMember(&data); SendToOne(&data, p); } - else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER) + else if (!players[p].IsModerator() && !AccountMgr::IsGMAccount(sec)) { WorldPacket data; MakeNotModerator(&data); @@ -410,7 +411,7 @@ void Channel::Password(uint64 p, const char *pass) void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) { - Player *plr = ObjectAccessor::FindPlayer(p); + Player* plr = ObjectAccessor::FindPlayer(p); if (!plr) return; @@ -422,7 +423,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) MakeNotMember(&data); SendToOne(&data, p); } - else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER) + else if (!players[p].IsModerator() && !AccountMgr::IsGMAccount(sec)) { WorldPacket data; MakeNotModerator(&data); @@ -430,7 +431,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) } else { - Player *newp = sObjectAccessor->FindPlayerByName(p2n); + Player* newp = sObjectAccessor->FindPlayerByName(p2n); if (!newp) { WorldPacket data; @@ -452,7 +453,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) // allow make moderator from another team only if both is GMs // at this moment this only way to show channel post for GM from another team - if ((plr->GetSession()->GetSecurity() < SEC_GAMEMASTER || newp->GetSession()->GetSecurity() < SEC_GAMEMASTER) && + if ((!AccountMgr::IsGMAccount(plr->GetSession()->GetSecurity()) || !AccountMgr::IsGMAccount(newp->GetSession()->GetSecurity())) && plr->GetTeam() != newp->GetTeam() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) { WorldPacket data; @@ -478,7 +479,7 @@ void Channel::SetMode(uint64 p, const char *p2n, bool mod, bool set) void Channel::SetOwner(uint64 p, const char *newname) { - Player *plr = ObjectAccessor::FindPlayer(p); + Player* plr = ObjectAccessor::FindPlayer(p); if (!plr) return; @@ -492,7 +493,7 @@ void Channel::SetOwner(uint64 p, const char *newname) return; } - if (sec < SEC_GAMEMASTER && p != m_ownerGUID) + if (!AccountMgr::IsGMAccount(sec) && p != m_ownerGUID) { WorldPacket data; MakeNotOwner(&data); @@ -500,7 +501,7 @@ void Channel::SetOwner(uint64 p, const char *newname) return; } - Player *newp = sObjectAccessor->FindPlayerByName(newname); + Player* newp = sObjectAccessor->FindPlayerByName(newname); if (newp == NULL || !IsOn(newp->GetGUID())) { WorldPacket data; @@ -562,11 +563,11 @@ void Channel::List(Player* player) uint32 count = 0; for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) { - Player *plr = ObjectAccessor::FindPlayer(i->first); + Player* plr = ObjectAccessor::FindPlayer(i->first); // PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters // MODERATOR, GAME MASTER, ADMINISTRATOR can see all - if (plr && (player->GetSession()->GetSecurity() > SEC_PLAYER || plr->GetSession()->GetSecurity() <= AccountTypes(gmLevelInWhoList)) && + if (plr && (!AccountMgr::IsPlayerAccount(player->GetSession()->GetSecurity()) || plr->GetSession()->GetSecurity() <= AccountTypes(gmLevelInWhoList)) && plr->IsVisibleGloballyFor(player)) { data << uint64(i->first); @@ -584,7 +585,7 @@ void Channel::List(Player* player) void Channel::Announce(uint64 p) { uint32 sec = 0; - Player *plr = ObjectAccessor::FindPlayer(p); + Player* plr = ObjectAccessor::FindPlayer(p); if (plr) sec = plr->GetSession()->GetSecurity(); @@ -594,7 +595,7 @@ void Channel::Announce(uint64 p) MakeNotMember(&data); SendToOne(&data, p); } - else if (!players[p].IsModerator() && sec < SEC_GAMEMASTER) + else if (!players[p].IsModerator() && !AccountMgr::IsGMAccount(sec)) { WorldPacket data; MakeNotModerator(&data); @@ -622,7 +623,7 @@ void Channel::Say(uint64 p, const char *what, uint32 lang) if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)) lang = LANG_UNIVERSAL; - Player *plr = ObjectAccessor::FindPlayer(p); + Player* plr = ObjectAccessor::FindPlayer(p); if (!IsOn(p)) { @@ -665,7 +666,7 @@ void Channel::Invite(uint64 p, const char *newname) return; } - Player *newp = sObjectAccessor->FindPlayerByName(newname); + Player* newp = sObjectAccessor->FindPlayerByName(newname); if (!newp) { WorldPacket data; @@ -682,7 +683,7 @@ void Channel::Invite(uint64 p, const char *newname) return; } - Player *plr = ObjectAccessor::FindPlayer(p); + Player* plr = ObjectAccessor::FindPlayer(p); if (!plr) return; @@ -744,11 +745,11 @@ void Channel::SetOwner(uint64 guid, bool exclaim) } } -void Channel::SendToAll(WorldPacket *data, uint64 p) +void Channel::SendToAll(WorldPacket* data, uint64 p) { for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) { - Player *plr = ObjectAccessor::FindPlayer(i->first); + Player* plr = ObjectAccessor::FindPlayer(i->first); if (plr) { if (!p || !plr->GetSocial()->HasIgnore(GUID_LOPART(p))) @@ -757,22 +758,22 @@ void Channel::SendToAll(WorldPacket *data, uint64 p) } } -void Channel::SendToAllButOne(WorldPacket *data, uint64 who) +void Channel::SendToAllButOne(WorldPacket* data, uint64 who) { for (PlayerList::const_iterator i = players.begin(); i != players.end(); ++i) { if (i->first != who) { - Player *plr = ObjectAccessor::FindPlayer(i->first); + Player* plr = ObjectAccessor::FindPlayer(i->first); if (plr) plr->GetSession()->SendPacket(data); } } } -void Channel::SendToOne(WorldPacket *data, uint64 who) +void Channel::SendToOne(WorldPacket* data, uint64 who) { - Player *plr = ObjectAccessor::FindPlayer(who); + Player* plr = ObjectAccessor::FindPlayer(who); if (plr) plr->GetSession()->SendPacket(data); } @@ -788,7 +789,7 @@ void Channel::DeVoice(uint64 /*guid1*/, uint64 /*guid2*/) } // done -void Channel::MakeNotifyPacket(WorldPacket *data, uint8 notify_type) +void Channel::MakeNotifyPacket(WorldPacket* data, uint8 notify_type) { data->Initialize(SMSG_CHANNEL_NOTIFY, 1+m_name.size()+1); *data << uint8(notify_type); @@ -796,21 +797,21 @@ void Channel::MakeNotifyPacket(WorldPacket *data, uint8 notify_type) } // done 0x00 -void Channel::MakeJoined(WorldPacket *data, uint64 guid) +void Channel::MakeJoined(WorldPacket* data, uint64 guid) { MakeNotifyPacket(data, CHAT_JOINED_NOTICE); *data << uint64(guid); } // done 0x01 -void Channel::MakeLeft(WorldPacket *data, uint64 guid) +void Channel::MakeLeft(WorldPacket* data, uint64 guid) { MakeNotifyPacket(data, CHAT_LEFT_NOTICE); *data << uint64(guid); } // done 0x02 -void Channel::MakeYouJoined(WorldPacket *data) +void Channel::MakeYouJoined(WorldPacket* data) { MakeNotifyPacket(data, CHAT_YOU_JOINED_NOTICE); *data << uint8(GetFlags()); @@ -819,7 +820,7 @@ void Channel::MakeYouJoined(WorldPacket *data) } // done 0x03 -void Channel::MakeYouLeft(WorldPacket *data) +void Channel::MakeYouLeft(WorldPacket* data) { MakeNotifyPacket(data, CHAT_YOU_LEFT_NOTICE); *data << uint32(GetChannelId()); @@ -827,52 +828,52 @@ void Channel::MakeYouLeft(WorldPacket *data) } // done 0x04 -void Channel::MakeWrongPassword(WorldPacket *data) +void Channel::MakeWrongPassword(WorldPacket* data) { MakeNotifyPacket(data, CHAT_WRONG_PASSWORD_NOTICE); } // done 0x05 -void Channel::MakeNotMember(WorldPacket *data) +void Channel::MakeNotMember(WorldPacket* data) { MakeNotifyPacket(data, CHAT_NOT_MEMBER_NOTICE); } // done 0x06 -void Channel::MakeNotModerator(WorldPacket *data) +void Channel::MakeNotModerator(WorldPacket* data) { MakeNotifyPacket(data, CHAT_NOT_MODERATOR_NOTICE); } // done 0x07 -void Channel::MakePasswordChanged(WorldPacket *data, uint64 guid) +void Channel::MakePasswordChanged(WorldPacket* data, uint64 guid) { MakeNotifyPacket(data, CHAT_PASSWORD_CHANGED_NOTICE); *data << uint64(guid); } // done 0x08 -void Channel::MakeOwnerChanged(WorldPacket *data, uint64 guid) +void Channel::MakeOwnerChanged(WorldPacket* data, uint64 guid) { MakeNotifyPacket(data, CHAT_OWNER_CHANGED_NOTICE); *data << uint64(guid); } // done 0x09 -void Channel::MakePlayerNotFound(WorldPacket *data, const std::string& name) +void Channel::MakePlayerNotFound(WorldPacket* data, const std::string& name) { MakeNotifyPacket(data, CHAT_PLAYER_NOT_FOUND_NOTICE); *data << name; } // done 0x0A -void Channel::MakeNotOwner(WorldPacket *data) +void Channel::MakeNotOwner(WorldPacket* data) { MakeNotifyPacket(data, CHAT_NOT_OWNER_NOTICE); } // done 0x0B -void Channel::MakeChannelOwner(WorldPacket *data) +void Channel::MakeChannelOwner(WorldPacket* data) { std::string name = ""; @@ -884,7 +885,7 @@ void Channel::MakeChannelOwner(WorldPacket *data) } // done 0x0C -void Channel::MakeModeChange(WorldPacket *data, uint64 guid, uint8 oldflags) +void Channel::MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags) { MakeNotifyPacket(data, CHAT_MODE_CHANGE_NOTICE); *data << uint64(guid); @@ -893,27 +894,27 @@ void Channel::MakeModeChange(WorldPacket *data, uint64 guid, uint8 oldflags) } // done 0x0D -void Channel::MakeAnnouncementsOn(WorldPacket *data, uint64 guid) +void Channel::MakeAnnouncementsOn(WorldPacket* data, uint64 guid) { MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_ON_NOTICE); *data << uint64(guid); } // done 0x0E -void Channel::MakeAnnouncementsOff(WorldPacket *data, uint64 guid) +void Channel::MakeAnnouncementsOff(WorldPacket* data, uint64 guid) { MakeNotifyPacket(data, CHAT_ANNOUNCEMENTS_OFF_NOTICE); *data << uint64(guid); } // done 0x11 -void Channel::MakeMuted(WorldPacket *data) +void Channel::MakeMuted(WorldPacket* data) { MakeNotifyPacket(data, CHAT_MUTED_NOTICE); } // done 0x12 -void Channel::MakePlayerKicked(WorldPacket *data, uint64 bad, uint64 good) +void Channel::MakePlayerKicked(WorldPacket* data, uint64 bad, uint64 good) { MakeNotifyPacket(data, CHAT_PLAYER_KICKED_NOTICE); *data << uint64(bad); @@ -921,13 +922,13 @@ void Channel::MakePlayerKicked(WorldPacket *data, uint64 bad, uint64 good) } // done 0x13 -void Channel::MakeBanned(WorldPacket *data) +void Channel::MakeBanned(WorldPacket* data) { MakeNotifyPacket(data, CHAT_BANNED_NOTICE); } // done 0x14 -void Channel::MakePlayerBanned(WorldPacket *data, uint64 bad, uint64 good) +void Channel::MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good) { MakeNotifyPacket(data, CHAT_PLAYER_BANNED_NOTICE); *data << uint64(bad); @@ -935,7 +936,7 @@ void Channel::MakePlayerBanned(WorldPacket *data, uint64 bad, uint64 good) } // done 0x15 -void Channel::MakePlayerUnbanned(WorldPacket *data, uint64 bad, uint64 good) +void Channel::MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good) { MakeNotifyPacket(data, CHAT_PLAYER_UNBANNED_NOTICE); *data << uint64(bad); @@ -943,91 +944,91 @@ void Channel::MakePlayerUnbanned(WorldPacket *data, uint64 bad, uint64 good) } // done 0x16 -void Channel::MakePlayerNotBanned(WorldPacket *data, const std::string &name) +void Channel::MakePlayerNotBanned(WorldPacket* data, const std::string &name) { MakeNotifyPacket(data, CHAT_PLAYER_NOT_BANNED_NOTICE); *data << name; } // done 0x17 -void Channel::MakePlayerAlreadyMember(WorldPacket *data, uint64 guid) +void Channel::MakePlayerAlreadyMember(WorldPacket* data, uint64 guid) { MakeNotifyPacket(data, CHAT_PLAYER_ALREADY_MEMBER_NOTICE); *data << uint64(guid); } // done 0x18 -void Channel::MakeInvite(WorldPacket *data, uint64 guid) +void Channel::MakeInvite(WorldPacket* data, uint64 guid) { MakeNotifyPacket(data, CHAT_INVITE_NOTICE); *data << uint64(guid); } // done 0x19 -void Channel::MakeInviteWrongFaction(WorldPacket *data) +void Channel::MakeInviteWrongFaction(WorldPacket* data) { MakeNotifyPacket(data, CHAT_INVITE_WRONG_FACTION_NOTICE); } // done 0x1A -void Channel::MakeWrongFaction(WorldPacket *data) +void Channel::MakeWrongFaction(WorldPacket* data) { MakeNotifyPacket(data, CHAT_WRONG_FACTION_NOTICE); } // done 0x1B -void Channel::MakeInvalidName(WorldPacket *data) +void Channel::MakeInvalidName(WorldPacket* data) { MakeNotifyPacket(data, CHAT_INVALID_NAME_NOTICE); } // done 0x1C -void Channel::MakeNotModerated(WorldPacket *data) +void Channel::MakeNotModerated(WorldPacket* data) { MakeNotifyPacket(data, CHAT_NOT_MODERATED_NOTICE); } // done 0x1D -void Channel::MakePlayerInvited(WorldPacket *data, const std::string& name) +void Channel::MakePlayerInvited(WorldPacket* data, const std::string& name) { MakeNotifyPacket(data, CHAT_PLAYER_INVITED_NOTICE); *data << name; } // done 0x1E -void Channel::MakePlayerInviteBanned(WorldPacket *data, const std::string& name) +void Channel::MakePlayerInviteBanned(WorldPacket* data, const std::string& name) { MakeNotifyPacket(data, CHAT_PLAYER_INVITE_BANNED_NOTICE); *data << name; } // done 0x1F -void Channel::MakeThrottled(WorldPacket *data) +void Channel::MakeThrottled(WorldPacket* data) { MakeNotifyPacket(data, CHAT_THROTTLED_NOTICE); } // done 0x20 -void Channel::MakeNotInArea(WorldPacket *data) +void Channel::MakeNotInArea(WorldPacket* data) { MakeNotifyPacket(data, CHAT_NOT_IN_AREA_NOTICE); } // done 0x21 -void Channel::MakeNotInLfg(WorldPacket *data) +void Channel::MakeNotInLfg(WorldPacket* data) { MakeNotifyPacket(data, CHAT_NOT_IN_LFG_NOTICE); } // done 0x22 -void Channel::MakeVoiceOn(WorldPacket *data, uint64 guid) +void Channel::MakeVoiceOn(WorldPacket* data, uint64 guid) { MakeNotifyPacket(data, CHAT_VOICE_ON_NOTICE); *data << uint64(guid); } // done 0x23 -void Channel::MakeVoiceOff(WorldPacket *data, uint64 guid) +void Channel::MakeVoiceOff(WorldPacket* data, uint64 guid) { MakeNotifyPacket(data, CHAT_VOICE_OFF_NOTICE); *data << uint64(guid); diff --git a/src/server/game/Chat/Channels/Channel.h b/src/server/game/Chat/Channels/Channel.h index c5466d65d3f..8ce13a6afa1 100755 --- a/src/server/game/Chat/Channels/Channel.h +++ b/src/server/game/Chat/Channels/Channel.h @@ -161,46 +161,46 @@ class Channel private: // initial packet data (notify type and channel name) - void MakeNotifyPacket(WorldPacket *data, uint8 notify_type); + void MakeNotifyPacket(WorldPacket* data, uint8 notify_type); // type specific packet data - void MakeJoined(WorldPacket *data, uint64 guid); //+ 0x00 - void MakeLeft(WorldPacket *data, uint64 guid); //+ 0x01 - void MakeYouJoined(WorldPacket *data); //+ 0x02 - void MakeYouLeft(WorldPacket *data); //+ 0x03 - void MakeWrongPassword(WorldPacket *data); //? 0x04 - void MakeNotMember(WorldPacket *data); //? 0x05 - void MakeNotModerator(WorldPacket *data); //? 0x06 - void MakePasswordChanged(WorldPacket *data, uint64 guid); //+ 0x07 - void MakeOwnerChanged(WorldPacket *data, uint64 guid); //? 0x08 - void MakePlayerNotFound(WorldPacket *data, const std::string& name); //+ 0x09 - void MakeNotOwner(WorldPacket *data); //? 0x0A - void MakeChannelOwner(WorldPacket *data); //? 0x0B - void MakeModeChange(WorldPacket *data, uint64 guid, uint8 oldflags); //+ 0x0C - void MakeAnnouncementsOn(WorldPacket *data, uint64 guid); //+ 0x0D - void MakeAnnouncementsOff(WorldPacket *data, uint64 guid); //+ 0x0E - void MakeMuted(WorldPacket *data); //? 0x11 - void MakePlayerKicked(WorldPacket *data, uint64 bad, uint64 good); //? 0x12 - void MakeBanned(WorldPacket *data); //? 0x13 - void MakePlayerBanned(WorldPacket *data, uint64 bad, uint64 good); //? 0x14 - void MakePlayerUnbanned(WorldPacket *data, uint64 bad, uint64 good); //? 0x15 - void MakePlayerNotBanned(WorldPacket *data, const std::string& name); //? 0x16 - void MakePlayerAlreadyMember(WorldPacket *data, uint64 guid); //+ 0x17 - void MakeInvite(WorldPacket *data, uint64 guid); //? 0x18 - void MakeInviteWrongFaction(WorldPacket *data); //? 0x19 - void MakeWrongFaction(WorldPacket *data); //? 0x1A - void MakeInvalidName(WorldPacket *data); //? 0x1B - void MakeNotModerated(WorldPacket *data); //? 0x1C - void MakePlayerInvited(WorldPacket *data, const std::string& name); //+ 0x1D - void MakePlayerInviteBanned(WorldPacket *data, const std::string &name);//? 0x1E - void MakeThrottled(WorldPacket *data); //? 0x1F - void MakeNotInArea(WorldPacket *data); //? 0x20 - void MakeNotInLfg(WorldPacket *data); //? 0x21 - void MakeVoiceOn(WorldPacket *data, uint64 guid); //+ 0x22 - void MakeVoiceOff(WorldPacket *data, uint64 guid); //+ 0x23 + void MakeJoined(WorldPacket* data, uint64 guid); //+ 0x00 + void MakeLeft(WorldPacket* data, uint64 guid); //+ 0x01 + void MakeYouJoined(WorldPacket* data); //+ 0x02 + void MakeYouLeft(WorldPacket* data); //+ 0x03 + void MakeWrongPassword(WorldPacket* data); //? 0x04 + void MakeNotMember(WorldPacket* data); //? 0x05 + void MakeNotModerator(WorldPacket* data); //? 0x06 + void MakePasswordChanged(WorldPacket* data, uint64 guid); //+ 0x07 + void MakeOwnerChanged(WorldPacket* data, uint64 guid); //? 0x08 + void MakePlayerNotFound(WorldPacket* data, const std::string& name); //+ 0x09 + void MakeNotOwner(WorldPacket* data); //? 0x0A + void MakeChannelOwner(WorldPacket* data); //? 0x0B + void MakeModeChange(WorldPacket* data, uint64 guid, uint8 oldflags); //+ 0x0C + void MakeAnnouncementsOn(WorldPacket* data, uint64 guid); //+ 0x0D + void MakeAnnouncementsOff(WorldPacket* data, uint64 guid); //+ 0x0E + void MakeMuted(WorldPacket* data); //? 0x11 + void MakePlayerKicked(WorldPacket* data, uint64 bad, uint64 good); //? 0x12 + void MakeBanned(WorldPacket* data); //? 0x13 + void MakePlayerBanned(WorldPacket* data, uint64 bad, uint64 good); //? 0x14 + void MakePlayerUnbanned(WorldPacket* data, uint64 bad, uint64 good); //? 0x15 + void MakePlayerNotBanned(WorldPacket* data, const std::string& name); //? 0x16 + void MakePlayerAlreadyMember(WorldPacket* data, uint64 guid); //+ 0x17 + void MakeInvite(WorldPacket* data, uint64 guid); //? 0x18 + void MakeInviteWrongFaction(WorldPacket* data); //? 0x19 + void MakeWrongFaction(WorldPacket* data); //? 0x1A + void MakeInvalidName(WorldPacket* data); //? 0x1B + void MakeNotModerated(WorldPacket* data); //? 0x1C + void MakePlayerInvited(WorldPacket* data, const std::string& name); //+ 0x1D + void MakePlayerInviteBanned(WorldPacket* data, const std::string &name);//? 0x1E + void MakeThrottled(WorldPacket* data); //? 0x1F + void MakeNotInArea(WorldPacket* data); //? 0x20 + void MakeNotInLfg(WorldPacket* data); //? 0x21 + void MakeVoiceOn(WorldPacket* data, uint64 guid); //+ 0x22 + void MakeVoiceOff(WorldPacket* data, uint64 guid); //+ 0x23 - void SendToAll(WorldPacket *data, uint64 p = 0); - void SendToAllButOne(WorldPacket *data, uint64 who); - void SendToOne(WorldPacket *data, uint64 who); + void SendToAll(WorldPacket* data, uint64 p = 0); + void SendToAllButOne(WorldPacket* data, uint64 who); + void SendToOne(WorldPacket* data, uint64 who); bool IsOn(uint64 who) const { return players.find(who) != players.end(); } bool IsBanned(uint64 guid) const { return banned.find(guid) != banned.end(); } diff --git a/src/server/game/Chat/Channels/ChannelMgr.cpp b/src/server/game/Chat/Channels/ChannelMgr.cpp index 136cc89aaf3..651e5d15647 100755 --- a/src/server/game/Chat/Channels/ChannelMgr.cpp +++ b/src/server/game/Chat/Channels/ChannelMgr.cpp @@ -41,7 +41,7 @@ ChannelMgr::~ChannelMgr() channels.clear(); } -Channel *ChannelMgr::GetJoinChannel(std::string name, uint32 channel_id) +Channel* ChannelMgr::GetJoinChannel(std::string name, uint32 channel_id) { std::wstring wname; Utf8toWStr(name, wname); @@ -49,7 +49,7 @@ Channel *ChannelMgr::GetJoinChannel(std::string name, uint32 channel_id) if (channels.find(wname) == channels.end()) { - Channel *nchan = new Channel(name, channel_id, team); + Channel* nchan = new Channel(name, channel_id, team); channels[wname] = nchan; return nchan; } @@ -57,7 +57,7 @@ Channel *ChannelMgr::GetJoinChannel(std::string name, uint32 channel_id) return channels[wname]; } -Channel *ChannelMgr::GetChannel(std::string name, Player *p, bool pkt) +Channel* ChannelMgr::GetChannel(std::string name, Player* p, bool pkt) { std::wstring wname; Utf8toWStr(name, wname); @@ -100,7 +100,7 @@ void ChannelMgr::LeftChannel(std::string name) } } -void ChannelMgr::MakeNotOnPacket(WorldPacket *data, std::string name) +void ChannelMgr::MakeNotOnPacket(WorldPacket* data, std::string name) { data->Initialize(SMSG_CHANNEL_NOTIFY, (1+10)); // we guess size (*data) << (uint8)0x05 << name; diff --git a/src/server/game/Chat/Channels/ChannelMgr.h b/src/server/game/Chat/Channels/ChannelMgr.h index 971bcaa196b..f46f8d360c1 100755 --- a/src/server/game/Chat/Channels/ChannelMgr.h +++ b/src/server/game/Chat/Channels/ChannelMgr.h @@ -35,12 +35,12 @@ class ChannelMgr ChannelMgr() {team = 0;} ~ChannelMgr(); - Channel *GetJoinChannel(std::string name, uint32 channel_id); - Channel *GetChannel(std::string name, Player *p, bool pkt = true); + Channel* GetJoinChannel(std::string name, uint32 channel_id); + Channel* GetChannel(std::string name, Player* p, bool pkt = true); void LeftChannel(std::string name); private: ChannelMap channels; - void MakeNotOnPacket(WorldPacket *data, std::string name); + void MakeNotOnPacket(WorldPacket* data, std::string name); }; class AllianceChannelMgr : public ChannelMgr {}; diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index cecbd223ed9..91a9382b2e3 100755 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -65,7 +65,7 @@ static size_t appendCommandTable(ChatCommand* target, const ChatCommand* source) return count; } -ChatCommand * ChatHandler::getCommandTable() +ChatCommand* ChatHandler::getCommandTable() { static ChatCommand banCommandTable[] = { @@ -447,7 +447,7 @@ ChatCommand * ChatHandler::getCommandTable() { do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); std::string name = fields[0].GetString(); SetDataForCommandInTable(commandTableCache, name.c_str(), fields[1].GetUInt16(), fields[2].GetString(), name); @@ -510,13 +510,13 @@ bool ChatHandler::HasLowerSecurityAccount(WorldSession* target, uint32 target_ac return false; // ignore only for non-players for non strong checks (when allow apply command at least to same sec level) - if (m_session->GetSecurity() > SEC_PLAYER && !strong && !sWorld->getBoolConfig(CONFIG_GM_LOWER_SECURITY)) + if (!AccountMgr::IsPlayerAccount(m_session->GetSecurity()) && !strong && !sWorld->getBoolConfig(CONFIG_GM_LOWER_SECURITY)) return false; if (target) target_sec = target->GetSecurity(); else if (target_account) - target_sec = sAccountMgr->GetSecurity(target_account, realmID); + target_sec = AccountMgr::GetSecurity(target_account, realmID); else return true; // caller must report error for (target == NULL && target_account == 0) @@ -634,7 +634,7 @@ void ChatHandler::PSendSysMessage(const char *format, ...) SendSysMessage(str); } -bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, const std::string& fullcmd) +bool ChatHandler::ExecuteCommandInTable(ChatCommand* table, const char* text, const std::string& fullcmd) { char const* oldtext = text; std::string cmd = ""; @@ -696,7 +696,7 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, co // table[i].Name == "" is special case: send original command to handler if ((table[i].Handler)(this, table[i].Name[0] != '\0' ? text : oldtext)) { - if (table[i].SecurityLevel > SEC_PLAYER) + if (!AccountMgr::IsPlayerAccount(table[i].SecurityLevel)) { // chat case if (m_session) @@ -724,7 +724,7 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, co return false; } -bool ChatHandler::SetDataForCommandInTable(ChatCommand *table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand) +bool ChatHandler::SetDataForCommandInTable(ChatCommand* table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand) { std::string cmd = ""; @@ -786,7 +786,7 @@ int ChatHandler::ParseCommands(const char* text) std::string fullcmd = text; - if (m_session && m_session->GetSecurity() <= SEC_PLAYER && sWorld->getBoolConfig(CONFIG_ALLOW_PLAYER_COMMANDS) == 0) + if (m_session && AccountMgr::IsPlayerAccount(m_session->GetSecurity()) && !sWorld->getBoolConfig(CONFIG_ALLOW_PLAYER_COMMANDS)) return 0; /// chat case (.command or !command format) @@ -811,7 +811,7 @@ int ChatHandler::ParseCommands(const char* text) if (!ExecuteCommandInTable(getCommandTable(), text, fullcmd)) { - if (m_session && m_session->GetSecurity() == SEC_PLAYER) + if (m_session && AccountMgr::IsPlayerAccount(m_session->GetSecurity())) return 0; SendSysMessage(LANG_NO_CMD); @@ -879,7 +879,7 @@ Valid examples: return LinkExtractor(message).IsValidMessage(); } -bool ChatHandler::ShowHelpForSubCommands(ChatCommand *table, char const* cmd, char const* subcmd) +bool ChatHandler::ShowHelpForSubCommands(ChatCommand* table, char const* cmd, char const* subcmd) { std::string list; for (uint32 i = 0; table[i].Name != NULL; ++i) @@ -917,7 +917,7 @@ bool ChatHandler::ShowHelpForSubCommands(ChatCommand *table, char const* cmd, ch return true; } -bool ChatHandler::ShowHelpForCommand(ChatCommand *table, const char* cmd) +bool ChatHandler::ShowHelpForCommand(ChatCommand* table, const char* cmd) { if (*cmd) { @@ -975,7 +975,7 @@ bool ChatHandler::ShowHelpForCommand(ChatCommand *table, const char* cmd) } //Note: target_guid used only in CHAT_MSG_WHISPER_INFORM mode (in this case channelName ignored) -void ChatHandler::FillMessageData(WorldPacket *data, WorldSession* session, uint8 type, uint32 language, const char *channelName, uint64 target_guid, const char *message, Unit *speaker) +void ChatHandler::FillMessageData(WorldPacket* data, WorldSession* session, uint8 type, uint32 language, const char *channelName, uint64 target_guid, const char *message, Unit* speaker) { uint32 messageLength = (message ? strlen(message) : 0) + 1; @@ -1081,7 +1081,7 @@ Unit* ChatHandler::getSelectedUnit() return ObjectAccessor::GetUnit(*m_session->GetPlayer(), guid); } -WorldObject *ChatHandler::getSelectedObject() +WorldObject* ChatHandler::getSelectedObject() { if (!m_session) return NULL; diff --git a/src/server/game/Chat/Chat.h b/src/server/game/Chat/Chat.h index b3d9ae1e262..b33a4944e6b 100755 --- a/src/server/game/Chat/Chat.h +++ b/src/server/game/Chat/Chat.h @@ -40,25 +40,25 @@ class ChatCommand bool AllowConsole; bool (*Handler)(ChatHandler*, const char* args); std::string Help; - ChatCommand * ChildCommands; + ChatCommand* ChildCommands; }; class ChatHandler { public: - WorldSession * GetSession() { return m_session; } + WorldSession* GetSession() { return m_session; } explicit ChatHandler(WorldSession* session) : m_session(session) {} explicit ChatHandler(Player* player) : m_session(player->GetSession()) {} virtual ~ChatHandler() {} - static void FillMessageData(WorldPacket *data, WorldSession* session, uint8 type, uint32 language, const char *channelName, uint64 target_guid, const char *message, Unit *speaker); + static void FillMessageData(WorldPacket* data, WorldSession* session, uint8 type, uint32 language, const char *channelName, uint64 target_guid, const char *message, Unit* speaker); - void FillMessageData(WorldPacket *data, uint8 type, uint32 language, uint64 target_guid, const char* message) + void FillMessageData(WorldPacket* data, uint8 type, uint32 language, uint64 target_guid, const char* message) { FillMessageData(data, m_session, type, language, NULL, target_guid, message, NULL); } - void FillSystemMessageData(WorldPacket *data, const char* message) + void FillSystemMessageData(WorldPacket* data, const char* message) { FillMessageData(data, CHAT_MSG_SYSTEM, LANG_UNIVERSAL, 0, message); } @@ -126,10 +126,10 @@ class ChatHandler protected: explicit ChatHandler() : m_session(NULL) {} // for CLI subclass - static bool SetDataForCommandInTable(ChatCommand *table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand); - bool ExecuteCommandInTable(ChatCommand *table, const char* text, const std::string& fullcmd); - bool ShowHelpForCommand(ChatCommand *table, const char* cmd); - bool ShowHelpForSubCommands(ChatCommand *table, char const* cmd, char const* subcmd); + static bool SetDataForCommandInTable(ChatCommand* table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand); + bool ExecuteCommandInTable(ChatCommand* table, const char* text, const std::string& fullcmd); + bool ShowHelpForCommand(ChatCommand* table, const char* cmd); + bool ShowHelpForSubCommands(ChatCommand* table, char const* cmd, char const* subcmd); bool HandleNameAnnounceCommand(const char* args); bool HandleGMNameAnnounceCommand(const char* args); @@ -376,7 +376,7 @@ class ChatHandler private: bool _HandleGMTicketResponseAppendCommand(const char* args, bool newLine); - WorldSession * m_session; // != NULL for chat command call and NULL for CLI command + WorldSession* m_session; // != NULL for chat command call and NULL for CLI command // common global flag static bool load_command_table; diff --git a/src/server/game/Chat/ChatLink.cpp b/src/server/game/Chat/ChatLink.cpp index dde8fdd15c8..26f63aa77ee 100644 --- a/src/server/game/Chat/ChatLink.cpp +++ b/src/server/game/Chat/ChatLink.cpp @@ -165,7 +165,7 @@ bool ItemChatLink::Initialize(std::istringstream& iss) return true; } -inline std::string ItemChatLink::FormatName(uint8 index, ItemLocale const *locale, char* const* suffixStrings) const +inline std::string ItemChatLink::FormatName(uint8 index, ItemLocale const* locale, char* const* suffixStrings) const { std::stringstream ss; if (locale == NULL || index >= locale->Name.size()) @@ -186,7 +186,7 @@ bool ItemChatLink::ValidateName(char* buffer, const char* context) bool res = (FormatName(LOCALE_enUS, NULL, suffixStrings) == buffer); if (!res) { - ItemLocale const *il = sObjectMgr->GetItemLocale(_item->ItemId); + ItemLocale const* il = sObjectMgr->GetItemLocale(_item->ItemId); for (uint8 index = LOCALE_koKR; index < TOTAL_LOCALES; ++index) { if (FormatName(index, il, suffixStrings) == buffer) @@ -243,7 +243,7 @@ bool QuestChatLink::ValidateName(char* buffer, const char* context) bool res = (_quest->GetTitle() == buffer); if (!res) - if (QuestLocale const *ql = sObjectMgr->GetQuestLocale(_quest->GetQuestId())) + if (QuestLocale const* ql = sObjectMgr->GetQuestLocale(_quest->GetQuestId())) for (uint8 i = 0; i < ql->Title.size(); i++) if (ql->Title[i] == buffer) { @@ -291,13 +291,13 @@ bool SpellChatLink::ValidateName(char* buffer, const char* context) sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line not found for spell %u", context, _spell->Id); return false; } - SkillLineAbilityEntry const *skillInfo = bounds.first->second; + SkillLineAbilityEntry const* skillInfo = bounds.first->second; if (!skillInfo) { sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line ability not found for spell %u", context, _spell->Id); return false; } - SkillLineEntry const *skillLine = sSkillLineStore.LookupEntry(skillInfo->skillId); + SkillLineEntry const* skillLine = sSkillLineStore.LookupEntry(skillInfo->skillId); if (!skillLine) { sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): skill line not found for skill %u", context, skillInfo->skillId); @@ -457,7 +457,7 @@ bool TalentChatLink::Initialize(std::istringstream& iss) return false; } // Validate talent - TalentEntry const *talentInfo = sTalentStore.LookupEntry(_talentId); + TalentEntry const* talentInfo = sTalentStore.LookupEntry(_talentId); if (!talentInfo) { sLog->outDebug(LOG_FILTER_CHATSYS, "ChatHandler::isValidChatMessage('%s'): got invalid talent id %u in |talent command", iss.str().c_str(), _talentId); diff --git a/src/server/game/Chat/Commands/Level0.cpp b/src/server/game/Chat/Commands/Level0.cpp index a61ae629666..338ad49463e 100755 --- a/src/server/game/Chat/Commands/Level0.cpp +++ b/src/server/game/Chat/Commands/Level0.cpp @@ -54,7 +54,7 @@ bool ChatHandler::HandleCommandsCommand(const char* /*args*/) bool ChatHandler::HandleStartCommand(const char* /*args*/) { - Player *chr = m_session->GetPlayer(); + Player* chr = m_session->GetPlayer(); if (chr->isInFlight()) { @@ -129,9 +129,9 @@ bool ChatHandler::HandleSaveCommand(const char* /*args*/) Player* player = m_session->GetPlayer(); // save GM account without delay and output message - if (m_session->GetSecurity() > SEC_PLAYER) + if (!AccountMgr::IsPlayerAccount(m_session->GetSecurity())) { - if (Player *target = getSelectedPlayer()) + if (Player* target = getSelectedPlayer()) target->SaveToDB(); else player->SaveToDB(); diff --git a/src/server/game/Chat/Commands/Level1.cpp b/src/server/game/Chat/Commands/Level1.cpp index 7a742765b0f..07b5cadd118 100755 --- a/src/server/game/Chat/Commands/Level1.cpp +++ b/src/server/game/Chat/Commands/Level1.cpp @@ -311,14 +311,14 @@ bool ChatHandler::HandleAppearCommand(const char* args) // if the player or the player's group is bound to another instance // the player will not be bound to another one - InstancePlayerBind *pBind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(cMap->IsRaid())); + InstancePlayerBind* pBind = _player->GetBoundInstance(target->GetMapId(), target->GetDifficulty(cMap->IsRaid())); if (!pBind) { Group* group = _player->GetGroup(); // if no bind exists, create a solo bind - InstanceGroupBind *gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind + InstanceGroupBind* gBind = group ? group->GetBoundInstance(target) : NULL; // if no bind exists, create a solo bind if (!gBind) - if (InstanceSave *save = sInstanceSaveMgr->GetInstanceSave(target->GetInstanceId())) + if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(target->GetInstanceId())) _player->BindToInstance(save, !save->CanReset()); } @@ -421,7 +421,7 @@ bool ChatHandler::HandleTaxiCheatCommand(const char* args) std::string argstr = (char*)args; - Player *chr = getSelectedPlayer(); + Player* chr = getSelectedPlayer(); if (!chr) { chr=m_session->GetPlayer(); @@ -476,7 +476,7 @@ bool ChatHandler::HandleLookupAreaCommand(const char* args) // Search in AreaTable.dbc for (uint32 areaflag = 0; areaflag < sAreaStore.GetNumRows (); ++areaflag) { - AreaTableEntry const *areaEntry = sAreaStore.LookupEntry (areaflag); + AreaTableEntry const* areaEntry = sAreaStore.LookupEntry (areaflag); if (areaEntry) { int loc = GetSessionDbcLocale (); @@ -686,7 +686,7 @@ bool ChatHandler::HandleGroupSummonCommand(const char* args) if (HasLowerSecurity(target, 0)) return false; - Group *grp = target->GetGroup(); + Group* grp = target->GetGroup(); std::string nameLink = GetNameLink(target); @@ -711,9 +711,9 @@ bool ChatHandler::HandleGroupSummonCommand(const char* args) return false; } - for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) { - Player *pl = itr->getSource(); + Player* pl = itr->getSource(); if (!pl || pl == m_session->GetPlayer() || !pl->GetSession()) continue; diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp index c03433e93b2..2055952a233 100755 --- a/src/server/game/Chat/Commands/Level2.cpp +++ b/src/server/game/Chat/Commands/Level2.cpp @@ -298,7 +298,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args) if (!result) return false; - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); total_player_time = fields[0].GetUInt32(); level = fields[1].GetUInt32(); money = fields[2].GetUInt32(); @@ -352,7 +352,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args) if (QueryResult result = LoginDatabase.PQuery("SELECT unbandate, bandate = unbandate, bannedby, banreason FROM account_banned " "WHERE id = '%u' AND active ORDER BY bandate ASC LIMIT 1", accId)) { - Field * fields = result->Fetch(); + Field* fields = result->Fetch(); banTime = fields[1].GetBool() ? 0 : fields[0].GetUInt64(); bannedby = fields[2].GetString(); banreason = fields[3].GetString(); @@ -360,7 +360,7 @@ bool ChatHandler::HandlePInfoCommand(const char* args) else if (QueryResult result = CharacterDatabase.PQuery("SELECT unbandate, bandate = unbandate, bannedby, banreason FROM character_banned " "WHERE guid = '%u' AND active ORDER BY bandate ASC LIMIT 1", GUID_LOPART(target_guid))) { - Field * fields = result->Fetch(); + Field* fields = result->Fetch(); banTime = fields[1].GetBool() ? 0 : fields[0].GetUInt64(); bannedby = fields[2].GetString(); banreason = fields[3].GetString(); @@ -563,7 +563,7 @@ bool ChatHandler::HandleCharacterReputationCommand(const char* args) for (FactionStateList::const_iterator itr = targetFSL.begin(); itr != targetFSL.end(); ++itr) { const FactionState& faction = itr->second; - FactionEntry const *factionEntry = sFactionStore.LookupEntry(faction.ID); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction.ID); char const* factionName = factionEntry ? factionEntry->name[loc] : "#Not found#"; ReputationRank rank = target->GetReputationMgr().GetRank(factionEntry); std::string rankName = GetTrinityString(ReputationRankStrIndex[rank]); @@ -834,7 +834,7 @@ bool ChatHandler::HandleWaterwalkCommand(const char* args) bool ChatHandler::HandleCreatePetCommand(const char* /*args*/) { Player* player = m_session->GetPlayer(); - Creature *creatureTarget = getSelectedCreature(); + Creature* creatureTarget = getSelectedCreature(); if (!creatureTarget || creatureTarget->isPet() || creatureTarget->GetTypeId() == TYPEID_PLAYER) { @@ -912,8 +912,8 @@ bool ChatHandler::HandlePetLearnCommand(const char* args) if (!*args) return false; - Player *plr = m_session->GetPlayer(); - Pet *pet = plr->GetPet(); + Player* plr = m_session->GetPlayer(); + Pet* pet = plr->GetPet(); if (!pet) { @@ -955,8 +955,8 @@ bool ChatHandler::HandlePetUnlearnCommand(const char *args) if (!*args) return false; - Player *plr = m_session->GetPlayer(); - Pet *pet = plr->GetPet(); + Player* plr = m_session->GetPlayer(); + Pet* pet = plr->GetPet(); if (!pet) { @@ -1001,7 +1001,7 @@ bool ChatHandler::HandleLookupTitleCommand(const char* args) // Search in CharTitles.dbc for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++) { - CharTitlesEntry const *titleInfo = sCharTitlesStore.LookupEntry(id); + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); if (titleInfo) { int loc = GetSessionDbcLocale(); @@ -1074,7 +1074,7 @@ bool ChatHandler::HandleCharacterTitlesCommand(const char* args) // Search in CharTitles.dbc for (uint32 id = 0; id < sCharTitlesStore.GetNumRows(); id++) { - CharTitlesEntry const *titleInfo = sCharTitlesStore.LookupEntry(id); + CharTitlesEntry const* titleInfo = sCharTitlesStore.LookupEntry(id); if (titleInfo && target->HasTitle(titleInfo)) { std::string name = titleInfo->name[loc]; diff --git a/src/server/game/Chat/Commands/Level3.cpp b/src/server/game/Chat/Commands/Level3.cpp index 5f2b39fcb4f..f24077efd39 100755 --- a/src/server/game/Chat/Commands/Level3.cpp +++ b/src/server/game/Chat/Commands/Level3.cpp @@ -263,7 +263,7 @@ bool ChatHandler::HandleAddItemCommand(const char *args) sLog->outDetail(GetTrinityString(LANG_ADDITEM), itemId, count); - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(itemId); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(itemId); if (!pProto) { PSendSysMessage(LANG_COMMAND_ITEMIDINVALID, itemId); @@ -435,7 +435,7 @@ bool ChatHandler::HandleListItemCommand(const char *args) { do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 item_guid = fields[0].GetUInt32(); uint32 item_bag = fields[1].GetUInt32(); uint32 item_slot = fields[2].GetUInt32(); @@ -490,7 +490,7 @@ bool ChatHandler::HandleListItemCommand(const char *args) { do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 item_guid = fields[0].GetUInt32(); uint32 item_s = fields[1].GetUInt32(); uint32 item_r = fields[2].GetUInt32(); @@ -535,7 +535,7 @@ bool ChatHandler::HandleListItemCommand(const char *args) { do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 item_guid = fields[0].GetUInt32(); uint32 owner = fields[1].GetUInt32(); uint32 owner_acc = fields[2].GetUInt32(); @@ -566,7 +566,7 @@ bool ChatHandler::HandleListItemCommand(const char *args) { do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 item_guid = fields[0].GetUInt32(); uint32 guild_guid = fields[1].GetUInt32(); std::string guild_name = fields[2].GetString(); @@ -649,7 +649,7 @@ bool ChatHandler::HandleListObjectCommand(const char *args) { do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); float x = fields[1].GetFloat(); float y = fields[2].GetFloat(); @@ -721,7 +721,7 @@ bool ChatHandler::HandleListCreatureCommand(const char *args) { do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); float x = fields[1].GetFloat(); float y = fields[2].GetFloat(); @@ -765,7 +765,7 @@ bool ChatHandler::HandleLookupItemCommand(const char *args) if (loc_idx >= 0) { uint8 uloc_idx = uint8(loc_idx); - if (ItemLocale const *il = sObjectMgr->GetItemLocale(itr->second.ItemId)) + if (ItemLocale const* il = sObjectMgr->GetItemLocale(itr->second.ItemId)) { if (il->Name.size() > uloc_idx && !il->Name[uloc_idx].empty()) { @@ -842,7 +842,7 @@ bool ChatHandler::HandleLookupItemSetCommand(const char *args) // Search in ItemSet.dbc for (uint32 id = 0; id < sItemSetStore.GetNumRows(); id++) { - ItemSetEntry const *set = sItemSetStore.LookupEntry(id); + ItemSetEntry const* set = sItemSetStore.LookupEntry(id); if (set) { int loc = GetSessionDbcLocale(); @@ -915,7 +915,7 @@ bool ChatHandler::HandleLookupSkillCommand(const char *args) // Search in SkillLine.dbc for (uint32 id = 0; id < sSkillLineStore.GetNumRows(); id++) { - SkillLineEntry const *skillInfo = sSkillLineStore.LookupEntry(id); + SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(id); if (skillInfo) { int loc = GetSessionDbcLocale(); @@ -1002,7 +1002,7 @@ bool ChatHandler::HandleLookupSpellCommand(const char *args) // Search in Spell.dbc for (uint32 id = 0; id < sSpellMgr->GetSpellInfoStoreSize(); id++) { - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(id); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(id); if (spellInfo) { int loc = GetSessionDbcLocale(); @@ -1119,7 +1119,7 @@ bool ChatHandler::HandleLookupQuestCommand(const char *args) if (loc_idx >= 0) { uint8 uloc_idx = uint8(loc_idx); - if (QuestLocale const *il = sObjectMgr->GetQuestLocale(qinfo->GetQuestId())) + if (QuestLocale const* il = sObjectMgr->GetQuestLocale(qinfo->GetQuestId())) { if (il->Title.size() > uloc_idx && !il->Title[uloc_idx].empty()) { @@ -1232,7 +1232,7 @@ bool ChatHandler::HandleLookupCreatureCommand(const char *args) { uint32 id = itr->second.Entry; uint8 localeIndex = GetSessionDbLocaleIndex(); - if (CreatureLocale const *cl = sObjectMgr->GetCreatureLocale(id)) + if (CreatureLocale const* cl = sObjectMgr->GetCreatureLocale(id)) { if (cl->Name.size() > localeIndex && !cl->Name[localeIndex].empty ()) { @@ -1309,7 +1309,7 @@ bool ChatHandler::HandleLookupObjectCommand(const char *args) for (GameObjectTemplateContainer::const_iterator itr = gotc->begin(); itr != gotc->end(); ++itr) { uint8 localeIndex = GetSessionDbLocaleIndex(); - if (GameObjectLocale const *gl = sObjectMgr->GetGameObjectLocale(itr->second.entry)) + if (GameObjectLocale const* gl = sObjectMgr->GetGameObjectLocale(itr->second.entry)) { if (gl->Name.size() > localeIndex && !gl->Name[localeIndex].empty()) { @@ -1370,7 +1370,7 @@ bool ChatHandler::HandleLookupFactionCommand(const char *args) return false; // Can be NULL at console call - Player *target = getSelectedPlayer (); + Player* target = getSelectedPlayer (); std::string namepart = args; std::wstring wnamepart; @@ -1387,7 +1387,7 @@ bool ChatHandler::HandleLookupFactionCommand(const char *args) for (uint32 id = 0; id < sFactionStore.GetNumRows(); ++id) { - FactionEntry const *factionEntry = sFactionStore.LookupEntry (id); + FactionEntry const* factionEntry = sFactionStore.LookupEntry (id); if (factionEntry) { FactionState const* repState = target ? target->GetReputationMgr().GetState(factionEntry) : NULL; @@ -1487,7 +1487,7 @@ bool ChatHandler::HandleLookupTaxiNodeCommand(const char * args) // Search in TaxiNodes.dbc for (uint32 id = 0; id < sTaxiNodesStore.GetNumRows(); id++) { - TaxiNodesEntry const *nodeEntry = sTaxiNodesStore.LookupEntry(id); + TaxiNodesEntry const* nodeEntry = sTaxiNodesStore.LookupEntry(id); if (nodeEntry) { int loc = GetSessionDbcLocale(); @@ -1933,7 +1933,7 @@ bool ChatHandler::HandleReviveCommand(const char *args) if (target) { - target->ResurrectPlayer(target->GetSession()->GetSecurity() > SEC_PLAYER ? 1.0f : 0.5f); + target->ResurrectPlayer(!AccountMgr::IsPlayerAccount(target->GetSession()->GetSecurity()) ? 1.0f : 0.5f); target->SpawnCorpseBones(); target->SaveToDB(); } @@ -1957,7 +1957,7 @@ bool ChatHandler::HandleAuraCommand(const char *args) // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form uint32 spellID = extractSpellIdFromLink((char*)args); - if (SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellID)) + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellID)) Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, target, target); return true; @@ -2027,7 +2027,7 @@ bool ChatHandler::HandleLinkGraveCommand(const char *args) uint32 zoneId = player->GetZoneId(); - AreaTableEntry const *areaEntry = GetAreaEntryByAreaID(zoneId); + AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId); if (!areaEntry || areaEntry->zone !=0) { PSendSysMessage(LANG_COMMAND_GRAVEYARDWRONGZONE, g_id, zoneId); @@ -2116,7 +2116,7 @@ bool ChatHandler::HandleExploreCheatCommand(const char *args) int flag = atoi((char*)args); - Player *chr = getSelectedPlayer(); + Player* chr = getSelectedPlayer(); if (chr == NULL) { SendSysMessage(LANG_NO_CHAR_SELECTED); @@ -2282,7 +2282,7 @@ bool ChatHandler::HandleShowAreaCommand(const char *args) if (!*args) return false; - Player *chr = getSelectedPlayer(); + Player* chr = getSelectedPlayer(); if (chr == NULL) { SendSysMessage(LANG_NO_CHAR_SELECTED); @@ -2313,7 +2313,7 @@ bool ChatHandler::HandleHideAreaCommand(const char *args) if (!*args) return false; - Player *chr = getSelectedPlayer(); + Player* chr = getSelectedPlayer(); if (chr == NULL) { SendSysMessage(LANG_NO_CHAR_SELECTED); @@ -2390,7 +2390,7 @@ bool ChatHandler::HandleChangeWeather(const char *args) bool ChatHandler::HandleListAurasCommand (const char * /*args*/) { - Unit *unit = getSelectedUnit(); + Unit* unit = getSelectedUnit(); if (!unit) { SendSysMessage(LANG_SELECT_CHAR_OR_CREATURE); @@ -2415,10 +2415,10 @@ bool ChatHandler::HandleListAurasCommand (const char * /*args*/) ss_name << "|cffffffff|Hspell:" << aura->GetId() << "|h[" << name << "]|h|r"; PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, aura->GetId(), (m_session ? ss_name.str().c_str() : name), - aurApp->GetEffectMask(), aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(), + aurApp->GetEffectMask(), aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(), aura->GetDuration(), aura->GetMaxDuration(), (aura->IsPassive() ? passiveStr : ""), - (talent ? talentStr : ""), IS_PLAYER_GUID(aura->GetCasterGUID()) ? "player" : "creature", - GUID_LOPART(aura->GetCasterGUID())); + (talent ? talentStr : ""), IS_PLAYER_GUID(aura->GetCasterGUID()) ? "player" : "creature", + GUID_LOPART(aura->GetCasterGUID())); } for (uint16 i = 0; i < TOTAL_AURAS; ++i) { @@ -3065,7 +3065,7 @@ bool ChatHandler::HandleBanInfoAccountCommand(const char *args) return false; } - uint32 accountid = sAccountMgr->GetId(account_name); + uint32 accountid = AccountMgr::GetId(account_name); if (!accountid) { PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); @@ -3177,7 +3177,7 @@ bool ChatHandler::HandleBanInfoIPCommand(const char *args) return true; } - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); bool permanent = !fields[6].GetUInt64(); PSendSysMessage(LANG_BANINFO_IPENTRY, fields[0].GetCString(), fields[1].GetCString(), permanent ? GetTrinityString(LANG_BANINFO_NEVER) : fields[2].GetCString(), @@ -3332,7 +3332,7 @@ bool ChatHandler::HandleBanListHelper(QueryResult result) do { SendSysMessage("-------------------------------------------------------------------------------"); - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 account_id = fields[0].GetUInt32 (); std::string account_name; @@ -3342,13 +3342,13 @@ bool ChatHandler::HandleBanListHelper(QueryResult result) account_name = fields[1].GetString(); // "character" case, name need extract from another DB else - sAccountMgr->GetName (account_id, account_name); + AccountMgr::GetName (account_id, account_name); // No SQL injection. id is uint32. QueryResult banInfo = LoginDatabase.PQuery("SELECT bandate, unbandate, bannedby, banreason FROM account_banned WHERE id = %u ORDER BY unbandate", account_id); if (banInfo) { - Field *fields2 = banInfo->Fetch(); + Field* fields2 = banInfo->Fetch(); do { time_t t_ban = fields2[0].GetUInt64(); @@ -3425,7 +3425,7 @@ bool ChatHandler::HandleBanListIPCommand(const char *args) do { SendSysMessage("-------------------------------------------------------------------------------"); - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); time_t t_ban = fields[1].GetUInt64(); tm* aTm_ban = localtime(&t_ban); if (fields[1].GetUInt64() == fields[2].GetUInt64()) @@ -3505,7 +3505,7 @@ bool ChatHandler::HandlePDumpLoadCommand(const char *args) return false; } - uint32 account_id = sAccountMgr->GetId(account_name); + uint32 account_id = AccountMgr::GetId(account_name); if (!account_id) { account_id = atoi(account); // use original string @@ -3517,7 +3517,7 @@ bool ChatHandler::HandlePDumpLoadCommand(const char *args) } } - if (!sAccountMgr->GetName(account_id, account_name)) + if (!AccountMgr::GetName(account_id, account_name)) { PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); SetSentErrorMessage(true); @@ -3860,8 +3860,6 @@ bool ChatHandler::HandleCastBackCommand(const char *args) bool triggered = (trig_str != NULL); - caster->SetFacingToObject(m_session->GetPlayer()); - caster->CastSpell(m_session->GetPlayer(), spell, triggered); return true; @@ -3953,8 +3951,6 @@ bool ChatHandler::HandleCastTargetCommand(const char *args) bool triggered = (trig_str != NULL); - caster->SetFacingToObject(m_session->GetPlayer()); - caster->CastSpell(caster->getVictim(), spell, triggered); return true; @@ -4091,7 +4087,7 @@ bool ChatHandler::HandleInstanceListBindsCommand(const char* /*args*/) Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i)); for (Player::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr) { - InstanceSave *save = itr->second.save; + InstanceSave* save = itr->second.save; std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); PSendSysMessage("map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str()); counter++; @@ -4107,7 +4103,7 @@ bool ChatHandler::HandleInstanceListBindsCommand(const char* /*args*/) Group::BoundInstancesMap &binds = group->GetBoundInstances(Difficulty(i)); for (Group::BoundInstancesMap::const_iterator itr = binds.begin(); itr != binds.end(); ++itr) { - InstanceSave *save = itr->second.save; + InstanceSave* save = itr->second.save; std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); PSendSysMessage("map: %d inst: %d perm: %s diff: %d canReset: %s TTR: %s", itr->first, save->GetInstanceId(), itr->second.perm ? "yes" : "no", save->GetDifficulty(), save->CanReset() ? "yes" : "no", timeleft.c_str()); counter++; @@ -4148,7 +4144,7 @@ bool ChatHandler::HandleInstanceUnbindCommand(const char *args) Player::BoundInstancesMap &binds = player->GetBoundInstances(Difficulty(i)); for (Player::BoundInstancesMap::iterator itr = binds.begin(); itr != binds.end();) { - InstanceSave *save = itr->second.save; + InstanceSave* save = itr->second.save; if (itr->first != player->GetMapId() && (!MapId || MapId == itr->first) && (diff == -1 || diff == save->GetDifficulty())) { std::string timeleft = GetTimeString(save->GetResetTime() - time(NULL)); @@ -4391,7 +4387,7 @@ bool ChatHandler::HandleSendMoneyCommand(const char *args) bool ChatHandler::HandleSendMessageCommand(const char *args) { ///- Find the player - Player *rPlayer; + Player* rPlayer; if (!extractPlayerTarget((char*)args, &rPlayer)) return false; @@ -4435,7 +4431,7 @@ bool ChatHandler::HandleChannelSetOwnership(const char *args) return false; Player* player = m_session->GetPlayer(); - Channel *chn = NULL; + Channel* chn = NULL; if (ChannelMgr* cMgr = channelMgr(player->GetTeam())) chn = cMgr->GetChannel(channel, player); @@ -4540,7 +4536,7 @@ bool ChatHandler::HandleFreezeCommand(const char *args) //if player class = hunter || warlock remove pet if alive if ((player->getClass() == CLASS_HUNTER) || (player->getClass() == CLASS_WARLOCK)) { - if (Pet *pet = player->GetPet()) + if (Pet* pet = player->GetPet()) { pet->SavePetToDB(PET_SAVE_AS_CURRENT); // not let dismiss dead pet @@ -4550,7 +4546,7 @@ bool ChatHandler::HandleFreezeCommand(const char *args) } //m_session->GetPlayer()->CastSpell(player, spellID, false); - if (SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(9454)) + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(9454)) Aura::TryRefreshStackOrCreate(spellInfo, MAX_EFFECT_MASK, player, player); //save player @@ -4606,7 +4602,7 @@ bool ChatHandler::HandleUnFreezeCommand(const char *args) return true; } //if player found: delete his freeze aura - Field *fields=result->Fetch(); + Field* fields=result->Fetch(); uint64 pguid = fields[0].GetUInt64(); CharacterDatabase.PQuery("DELETE FROM character_aura WHERE character_aura.spell = 9454 AND character_aura.guid = '%u'", pguid); @@ -4638,7 +4634,7 @@ bool ChatHandler::HandleListFreezeCommand(const char * /*args*/) //Output of the results do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); std::string fplayers = fields[0].GetString(); PSendSysMessage(LANG_COMMAND_FROZEN_PLAYERS, fplayers.c_str()); } while (result->NextRow()); @@ -4693,7 +4689,7 @@ bool ChatHandler::HandleGroupRemoveCommand(const char *args) bool ChatHandler::HandlePossessCommand(const char * /*args*/) { - Unit *pUnit = getSelectedUnit(); + Unit* pUnit = getSelectedUnit(); if (!pUnit) return false; @@ -4703,7 +4699,7 @@ bool ChatHandler::HandlePossessCommand(const char * /*args*/) bool ChatHandler::HandleUnPossessCommand(const char * /*args*/) { - Unit *pUnit = getSelectedUnit(); + Unit* pUnit = getSelectedUnit(); if (!pUnit) pUnit = m_session->GetPlayer(); @@ -4714,7 +4710,7 @@ bool ChatHandler::HandleUnPossessCommand(const char * /*args*/) bool ChatHandler::HandleBindSightCommand(const char * /*args*/) { - Unit *pUnit = getSelectedUnit(); + Unit* pUnit = getSelectedUnit(); if (!pUnit) return false; diff --git a/src/server/game/Chat/Commands/TicketCommands.cpp b/src/server/game/Chat/Commands/TicketCommands.cpp index a80910ee20a..2ae4632d172 100755 --- a/src/server/game/Chat/Commands/TicketCommands.cpp +++ b/src/server/game/Chat/Commands/TicketCommands.cpp @@ -169,9 +169,9 @@ bool ChatHandler::HandleGMTicketAssignToCommand(const char* args) // Get target information uint64 targetGuid = sObjectMgr->GetPlayerGUIDByName(target.c_str()); uint64 targetAccId = sObjectMgr->GetPlayerAccountIdByGUID(targetGuid); - uint32 targetGmLevel = sAccountMgr->GetSecurity(targetAccId, realmID); + uint32 targetGmLevel = AccountMgr::GetSecurity(targetAccId, realmID); // Target must exist and have administrative rights - if (!targetGuid || targetGmLevel == SEC_PLAYER) + if (!targetGuid || AccountMgr::IsPlayerAccount(targetGmLevel)) { SendSysMessage(LANG_COMMAND_TICKETASSIGNERROR_A); return true; @@ -191,7 +191,7 @@ bool ChatHandler::HandleGMTicketAssignToCommand(const char* args) } // Assign ticket SQLTransaction trans = SQLTransaction(NULL); - ticket->SetAssignedTo(targetGuid, targetGmLevel == SEC_ADMINISTRATOR); + ticket->SetAssignedTo(targetGuid, AccountMgr::IsAdminAccount(targetGmLevel)); ticket->SaveToDB(trans); sTicketMgr->UpdateLastChange(); @@ -227,7 +227,7 @@ bool ChatHandler::HandleGMTicketUnAssignCommand(const char* args) { uint64 guid = ticket->GetAssignedToGUID(); uint32 accountId = sObjectMgr->GetPlayerAccountIdByGUID(guid); - security = sAccountMgr->GetSecurity(accountId, realmID); + security = AccountMgr::GetSecurity(accountId, realmID); } // Check security Player* player = m_session->GetPlayer(); diff --git a/src/server/game/Combat/HostileRefManager.cpp b/src/server/game/Combat/HostileRefManager.cpp index 47e9a1d2508..95ecac414cc 100755 --- a/src/server/game/Combat/HostileRefManager.cpp +++ b/src/server/game/Combat/HostileRefManager.cpp @@ -142,7 +142,7 @@ void HostileRefManager::deleteReferencesForFaction(uint32 faction) //================================================= // delete one reference, defined by Unit -void HostileRefManager::deleteReference(Unit *creature) +void HostileRefManager::deleteReference(Unit* creature) { HostileReference* ref = getFirst(); while (ref) @@ -161,7 +161,7 @@ void HostileRefManager::deleteReference(Unit *creature) //================================================= // set state for one reference, defined by Unit -void HostileRefManager::setOnlineOfflineState(Unit *creature, bool isOnline) +void HostileRefManager::setOnlineOfflineState(Unit* creature, bool isOnline) { HostileReference* ref = getFirst(); while (ref) diff --git a/src/server/game/Combat/ThreatManager.cpp b/src/server/game/Combat/ThreatManager.cpp index 858ef057baf..e5a2460b1a6 100755 --- a/src/server/game/Combat/ThreatManager.cpp +++ b/src/server/game/Combat/ThreatManager.cpp @@ -74,6 +74,10 @@ bool ThreatCalcHelper::isValidProcess(Unit* hatedUnit, Unit* hatingUnit, SpellIn if (!hatedUnit->isAlive() || !hatingUnit->isAlive()) return false; + // not in same map or phase + if (!hatedUnit->IsInMap(hatingUnit)) + return false; + // spell not causing threat if (threatSpell && threatSpell->AttributesEx & SPELL_ATTR1_NO_THREAT) return false; @@ -174,11 +178,13 @@ void HostileReference::updateOnlineStatus() // ref is valid // target is no player or not gamemaster // target is not in flight - if (isValid() && - ((getTarget()->GetTypeId() != TYPEID_PLAYER || !getTarget()->ToPlayer()->isGameMaster()) || - !getTarget()->HasUnitState(UNIT_STAT_IN_FLIGHT))) + if (isValid() + && (getTarget()->GetTypeId() != TYPEID_PLAYER || !getTarget()->ToPlayer()->isGameMaster()) + && !getTarget()->HasUnitState(UNIT_STAT_IN_FLIGHT) + && getTarget()->IsInMap(getSourceUnit()) + ) { - Creature* creature = getSourceUnit()->ToCreature(); + Creature* creature = getSourceUnit()->ToCreature(); online = getTarget()->isInAccessiblePlaceFor(creature); if (!online) { @@ -283,7 +289,7 @@ HostileReference* ThreatContainer::addThreat(Unit* victim, float threat) //============================================================ -void ThreatContainer::modifyThreatPercent(Unit *victim, int32 percent) +void ThreatContainer::modifyThreatPercent(Unit* victim, int32 percent) { if (HostileReference* ref = getReferenceByTarget(victim)) ref->addThreatPercent(percent); @@ -394,7 +400,7 @@ void ThreatManager::clearReferences() //============================================================ -void ThreatManager::addThreat(Unit* victim, float threat, SpellSchoolMask schoolMask, SpellInfo const *threatSpell) +void ThreatManager::addThreat(Unit* victim, float threat, SpellSchoolMask schoolMask, SpellInfo const* threatSpell) { if (!ThreatCalcHelper::isValidProcess(victim, getOwner(), threatSpell)) return; @@ -460,7 +466,7 @@ Unit* ThreatManager::getHostilTarget() //============================================================ -float ThreatManager::getThreat(Unit *victim, bool alsoSearchOfflineList) +float ThreatManager::getThreat(Unit* victim, bool alsoSearchOfflineList) { float threat = 0.0f; HostileReference* ref = iThreatContainer.getReferenceByTarget(victim); @@ -485,7 +491,7 @@ void ThreatManager::tauntApply(Unit* taunter) //============================================================ -void ThreatManager::tauntFadeOut(Unit *taunter) +void ThreatManager::tauntFadeOut(Unit* taunter) { HostileReference* ref = iThreatContainer.getReferenceByTarget(taunter); if (ref) diff --git a/src/server/game/Combat/ThreatManager.h b/src/server/game/Combat/ThreatManager.h index 7b2f51f3aa6..261f9cd93ab 100755 --- a/src/server/game/Combat/ThreatManager.h +++ b/src/server/game/Combat/ThreatManager.h @@ -160,7 +160,7 @@ class ThreatContainer HostileReference* addThreat(Unit* victim, float threat); - void modifyThreatPercent(Unit *victim, int32 percent); + void modifyThreatPercent(Unit* victim, int32 percent); HostileReference* selectNextVictim(Creature* attacker, HostileReference* currentVictim); @@ -184,7 +184,7 @@ class ThreatManager public: friend class HostileReference; - explicit ThreatManager(Unit *owner); + explicit ThreatManager(Unit* owner); ~ThreatManager() { clearReferences(); } @@ -194,9 +194,9 @@ class ThreatManager void doAddThreat(Unit* victim, float threat); - void modifyThreatPercent(Unit *victim, int32 percent); + void modifyThreatPercent(Unit* victim, int32 percent); - float getThreat(Unit *victim, bool alsoSearchOfflineList = false); + float getThreat(Unit* victim, bool alsoSearchOfflineList = false); bool isThreatListEmpty() { return iThreatContainer.empty(); } @@ -211,7 +211,7 @@ class ThreatManager Unit* getHostilTarget(); void tauntApply(Unit* taunter); - void tauntFadeOut(Unit *taunter); + void tauntFadeOut(Unit* taunter); void setCurrentVictim(HostileReference* hostileRef); @@ -246,7 +246,7 @@ class ThreatManager ThreatContainer& getOnlineContainer() { return iThreatContainer; } ThreatContainer& getOfflineContainer() { return iThreatOfflineContainer; } private: - void _addThreat(Unit *victim, float threat); + void _addThreat(Unit* victim, float threat); HostileReference* iCurrentVictim; Unit* iOwner; diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index e72a8cba67b..7e3b19336ee 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -113,7 +113,7 @@ bool Condition::Meets(Player* player, Unit* invoker) break; case CONDITION_INSTANCE_DATA: { - Map *map = player->GetMap(); + Map* map = player->GetMap(); if (map && map->IsDungeon() && ((InstanceMap*)map)->GetInstanceScript()) condMeets = ((InstanceMap*)map)->GetInstanceScript()->GetData(mConditionValue1) == mConditionValue2; break; @@ -392,7 +392,7 @@ void ConditionMgr::LoadConditions(bool isReload) do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); Condition* cond = new Condition(); int32 iSourceTypeOrReferenceId = fields[0].GetInt32(); @@ -933,7 +933,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) return false; } - ItemTemplate const *pItemProto = sObjectMgr->GetItemTemplate(cond->mSourceEntry); + ItemTemplate const* pItemProto = sObjectMgr->GetItemTemplate(cond->mSourceEntry); if (!pItemProto) { sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `item_tamplate`, ignoring.", cond->mSourceEntry); @@ -1041,7 +1041,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) } case CONDITION_ITEM: { - ItemTemplate const *proto = sObjectMgr->GetItemTemplate(cond->mConditionValue1); + ItemTemplate const* proto = sObjectMgr->GetItemTemplate(cond->mConditionValue1); if (!proto) { sLog->outErrorDb("Item condition has non existing item (%u), skipped", cond->mConditionValue1); @@ -1057,7 +1057,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) } case CONDITION_ITEM_EQUIPPED: { - ItemTemplate const *proto = sObjectMgr->GetItemTemplate(cond->mConditionValue1); + ItemTemplate const* proto = sObjectMgr->GetItemTemplate(cond->mConditionValue1); if (!proto) { sLog->outErrorDb("ItemEquipped condition has non existing item (%u), skipped", cond->mConditionValue1); @@ -1111,7 +1111,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) } case CONDITION_SKILL: { - SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(cond->mConditionValue1); + SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(cond->mConditionValue1); if (!pSkill) { sLog->outErrorDb("Skill condition specifies non-existing skill (%u), skipped", cond->mConditionValue1); @@ -1323,7 +1323,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) } case CONDITION_NOITEM: { - ItemTemplate const *proto = sObjectMgr->GetItemTemplate(cond->mConditionValue1); + ItemTemplate const* proto = sObjectMgr->GetItemTemplate(cond->mConditionValue1); if (!proto) { sLog->outErrorDb("NoItem condition has non existing item (%u), skipped", cond->mConditionValue1); diff --git a/src/server/game/Conditions/DisableMgr.cpp b/src/server/game/Conditions/DisableMgr.cpp index e9e7a9f4d2b..dafb0ebc11f 100755 --- a/src/server/game/Conditions/DisableMgr.cpp +++ b/src/server/game/Conditions/DisableMgr.cpp @@ -16,25 +16,34 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ +#include "DisableMgr.h" #include "ObjectMgr.h" #include "OutdoorPvP.h" #include "SpellMgr.h" #include "VMapManager2.h" -#include "DisableMgr.h" -DisableMgr::DisableMgr() +namespace DisableMgr { -} -DisableMgr::~DisableMgr() +namespace { - for (DisableMap::iterator itr = m_DisableMap.begin(); itr != m_DisableMap.end(); ++itr) - itr->second.clear(); + struct DisableData + { + uint8 flags; + std::set<uint32> params[2]; // params0, params1 + }; - m_DisableMap.clear(); + // single disables here with optional data + typedef std::map<uint32, DisableData> DisableTypeMap; + // global disable map by source + typedef std::map<DisableType, DisableTypeMap> DisableMap; + + DisableMap m_DisableMap; + + uint8 MAX_DISABLE_TYPES = 7; } -void DisableMgr::LoadDisables() +void LoadDisables() { uint32 oldMSTime = getMSTime(); @@ -223,7 +232,7 @@ void DisableMgr::LoadDisables() sLog->outString(); } -void DisableMgr::CheckQuestDisables() +void CheckQuestDisables() { uint32 oldMSTime = getMSTime(); @@ -254,7 +263,7 @@ void DisableMgr::CheckQuestDisables() sLog->outString(); } -bool DisableMgr::IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags) +bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags) { ASSERT(type < MAX_DISABLE_TYPES); if (m_DisableMap[type].empty()) @@ -345,3 +354,5 @@ bool DisableMgr::IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, return false; } + +} // Namespace diff --git a/src/server/game/Conditions/DisableMgr.h b/src/server/game/Conditions/DisableMgr.h index 53373bfe58d..2931c5ea4ad 100755 --- a/src/server/game/Conditions/DisableMgr.h +++ b/src/server/game/Conditions/DisableMgr.h @@ -19,7 +19,7 @@ #ifndef TRINITY_DISABLEMGR_H #define TRINITY_DISABLEMGR_H -#include <ace/Singleton.h> +#include "Define.h" class Unit; @@ -54,34 +54,11 @@ enum VmapDisableTypes VMAP_DISABLE_LIQUIDSTATUS = 0x8, }; -#define MAX_DISABLE_TYPES 7 - -struct DisableData -{ - uint8 flags; - std::set<uint32> params[2]; // params0, params1 -}; - -typedef std::map<uint32, DisableData> DisableTypeMap; // single disables here with optional data -typedef std::map<DisableType, DisableTypeMap> DisableMap; // global disable map by source - -class DisableMgr +namespace DisableMgr { - friend class ACE_Singleton<DisableMgr, ACE_Null_Mutex>; - DisableMgr(); - ~DisableMgr(); - - public: - - void LoadDisables(); - bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags = 0); - void CheckQuestDisables(); - - protected: - - DisableMap m_DisableMap; -}; - -#define sDisableMgr ACE_Singleton<DisableMgr, ACE_Null_Mutex>::instance() + void LoadDisables(); + bool IsDisabledFor(DisableType type, uint32 entry, Unit const* unit, uint8 flags = 0); + void CheckQuestDisables(); +} #endif //TRINITY_DISABLEMGR_H diff --git a/src/server/game/DataStores/DBCEnums.h b/src/server/game/DataStores/DBCEnums.h index 0a4c6b70b9f..dcdc2b2ea0a 100755 --- a/src/server/game/DataStores/DBCEnums.h +++ b/src/server/game/DataStores/DBCEnums.h @@ -307,6 +307,7 @@ enum FactionTemplateFlags { FACTION_TEMPLATE_FLAG_PVP = 0x00000800, // flagged for PvP FACTION_TEMPLATE_FLAG_CONTESTED_GUARD = 0x00001000, // faction will attack players that were involved in PvP combats + FACTION_TEMPLATE_FLAG_HOSTILE_BY_DEFAULT= 0x00002000, }; enum FactionMasks diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index fc709599da5..e2506a36f63 100755 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -46,7 +46,7 @@ struct WMOAreaTableTripple int32 adtId; }; -typedef std::map<WMOAreaTableTripple, WMOAreaTableEntry const *> WMOAreaInfoByTripple; +typedef std::map<WMOAreaTableTripple, WMOAreaTableEntry const*> WMOAreaInfoByTripple; DBCStorage <AreaTableEntry> sAreaStore(AreaTableEntryfmt); DBCStorage <AreaGroupEntry> sAreaGroupStore(AreaGroupEntryfmt); @@ -118,7 +118,7 @@ DBCStorage <ItemRandomSuffixEntry> sItemRandomSuffixStore(ItemRandomSuffixfmt); DBCStorage <ItemSetEntry> sItemSetStore(ItemSetEntryfmt); DBCStorage <LFGDungeonEntry> sLFGDungeonStore(LFGDungeonEntryfmt); - +//DBCStorage <LiquidTypeEntry> sLiquidTypeStore(LiquidTypeEntryfmt); DBCStorage <LockEntry> sLockStore(LockEntryfmt); DBCStorage <MailTemplateEntry> sMailTemplateStore(MailTemplateEntryfmt); @@ -397,7 +397,7 @@ void LoadDBCStores(const std::string& dataPath) for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) { - SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j); + SkillLineAbilityEntry const* skillLine = sSkillLineAbilityStore.LookupEntry(j); if (!skillLine) continue; @@ -443,7 +443,7 @@ void LoadDBCStores(const std::string& dataPath) // Create Spelldifficulty searcher for (uint32 i = 0; i < sSpellDifficultyStore.GetNumRows(); ++i) { - SpellDifficultyEntry const *spellDiff = sSpellDifficultyStore.LookupEntry(i); + SpellDifficultyEntry const* spellDiff = sSpellDifficultyStore.LookupEntry(i); if (!spellDiff) continue; @@ -470,7 +470,7 @@ void LoadDBCStores(const std::string& dataPath) // create talent spells set for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i) { - TalentEntry const *talentInfo = sTalentStore.LookupEntry(i); + TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); if (!talentInfo) continue; for (int j = 0; j < MAX_TALENT_RANK; j++) if (talentInfo->RankID[j]) @@ -484,7 +484,7 @@ void LoadDBCStores(const std::string& dataPath) // now have all max ranks (and then bit amount used for store talent ranks in inspect) for (uint32 talentTabId = 1; talentTabId < sTalentTabStore.GetNumRows(); ++talentTabId) { - TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentTabId); + TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentTabId); if (!talentTabInfo) continue; @@ -649,7 +649,7 @@ char* GetPetName(uint32 petfamily, uint32 dbclang) { if (!petfamily) return NULL; - CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(petfamily); + CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(petfamily); if (!pet_family) return NULL; return pet_family->Name[dbclang]?pet_family->Name[dbclang]:NULL; diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index 713bf5cf65c..367746616d1 100755 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -118,6 +118,7 @@ extern DBCStorage <ItemRandomPropertiesEntry> sItemRandomPropertiesStore; extern DBCStorage <ItemRandomSuffixEntry> sItemRandomSuffixStore; extern DBCStorage <ItemSetEntry> sItemSetStore; extern DBCStorage <LFGDungeonEntry> sLFGDungeonStore; +//extern DBCStorage <LiquidTypeEntry> sLiquidTypeStore; extern DBCStorage <LockEntry> sLockStore; extern DBCStorage <MailTemplateEntry> sMailTemplateStore; extern DBCStorage <MapEntry> sMapStore; diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index a45bafe8a2e..431e803fa87 100755 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -870,6 +870,12 @@ struct FactionEntry // 39 string flags //char* description[16]; // 40-55 m_description_lang // 56 string flags + + // helpers + bool CanHaveReputation() const + { + return reputationListID >=0; + } }; #define MAX_FACTION_RELATIONS 4 @@ -889,8 +895,6 @@ struct FactionTemplateEntry // helpers bool IsFriendlyTo(FactionTemplateEntry const& entry) const { - if (ID == entry.ID) - return true; if (entry.faction) { for (int i = 0; i < MAX_FACTION_RELATIONS; ++i) @@ -904,8 +908,6 @@ struct FactionTemplateEntry } bool IsHostileTo(FactionTemplateEntry const& entry) const { - if (ID == entry.ID) - return false; if (entry.faction) { for (int i = 0; i < MAX_FACTION_RELATIONS; ++i) @@ -1186,6 +1188,28 @@ struct LFGDungeonEntry uint32 Entry() const { return ID + (type << 24); } }; +/* +struct LiquidTypeEntry +{ + uint32 ID; // 0 + char* name; // 1 + uint32 flags; // 2 Water: 1|2|4|8, Magma: 8|16|32|64, Slime: 2|64|256, WMO Ocean: 1|2|4|8|512 + uint32 type; // 3 0: Water, 1: Ocean, 2: Magma, 3: Slime + uint32 soundid; // 4 Reference to SoundEntries.dbc + uint32 spellID; // 5 Reference to Spell.dbc + float unk0[4]; // 6-9 + uint32 unk1; // 10 Light? + float particleScale // 11 0: Slime, 1: Water/Ocean, 4: Magma + uint32 particleMovement; // 12 + uint32 unk2 // 13 + uint32 LiquidMaterialID // 14 Reference to LiquidMaterial.dbc + char* texture[6]; // 15-20 + uint32 unk3[2] // 21-22 + float unk4[18]; // 23-40 + uint32 unk5[4] // 41-44 +}; +*/ + #define MAX_LOCK_CASE 8 struct LockEntry diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h index 0728a2f838e..5d33a3011ab 100755 --- a/src/server/game/DataStores/DBCfmt.h +++ b/src/server/game/DataStores/DBCfmt.h @@ -77,6 +77,7 @@ const char ItemRandomPropertiesfmt[]="nxiiixxssssssssssssssssx"; const char ItemRandomSuffixfmt[]="nssssssssssssssssxxiiixxiiixx"; const char ItemSetEntryfmt[]="dssssssssssssssssxiiiiiiiiiixxxxxxxiiiiiiiiiiiiiiiiii"; const char LFGDungeonEntryfmt[]="nxxxxxxxxxxxxxxxxxiiiiiiixixxixixxxxxxxxxxxxxxxxx"; +//const char LiquidTypeEntryfmt[]="nsiiiiffffifiiisssssiiffffffffffffffffffiiii"; const char LockEntryfmt[]="niiiiiiiiiiiiiiiiiiiiiiiixxxxxxxx"; const char MailTemplateEntryfmt[]="nxxxxxxxxxxxxxxxxxssssssssssssssssx"; const char MapEntryfmt[]="nxixxssssssssssssssssxixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxixiffxiix"; diff --git a/src/server/game/DungeonFinding/LFGMgr.cpp b/src/server/game/DungeonFinding/LFGMgr.cpp index c9752c6377b..7d2c02d6b23 100755 --- a/src/server/game/DungeonFinding/LFGMgr.cpp +++ b/src/server/game/DungeonFinding/LFGMgr.cpp @@ -228,7 +228,7 @@ void LFGMgr::Update(uint32 diff) SetState(guid, LFG_STATE_PROPOSAL); if (Player* plr = ObjectAccessor::FindPlayer(itPlayers->first)) { - Group *grp = plr->GetGroup(); + Group* grp = plr->GetGroup(); if (grp) { uint64 gguid = grp->GetGUID(); @@ -379,7 +379,7 @@ void LFGMgr::InitializeLockedDungeons(Player* plr) LfgLockStatusType locktype = LFG_LOCKSTATUS_OK; if (dungeon->expansion > expansion) locktype = LFG_LOCKSTATUS_INSUFFICIENT_EXPANSION; - else if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_MAP, dungeon->map, plr)) + else if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, dungeon->map, plr)) locktype = LFG_LOCKSTATUS_RAID_LOCKED; else if (dungeon->difficulty > DUNGEON_DIFFICULTY_NORMAL && plr->GetBoundInstance(dungeon->map, Difficulty(dungeon->difficulty))) locktype = LFG_LOCKSTATUS_RAID_LOCKED; @@ -934,11 +934,8 @@ bool LFGMgr::CheckCompatibility(LfgGuidList check, LfgProposal*& pProposal) // Select a random dungeon from the compatible list // TODO - Select the dungeon based on group item Level, not just random - LfgDungeonSet::const_iterator itDungeon = compatibleDungeons.begin(); - std::advance(itDungeon, urand(0, compatibleDungeons.size() - 1)); - // Create a new proposal - pProposal = new LfgProposal(*itDungeon); + pProposal = new LfgProposal(SelectRandomContainerElement(compatibleDungeons)); pProposal->cancelTime = time_t(time(NULL)) + LFG_TIME_PROPOSAL; pProposal->state = LFG_PROPOSAL_INITIATING; pProposal->queues = check; diff --git a/src/server/game/DungeonFinding/LFGScripts.cpp b/src/server/game/DungeonFinding/LFGScripts.cpp index 4d62cfbb43d..c3c6cd86548 100644 --- a/src/server/game/DungeonFinding/LFGScripts.cpp +++ b/src/server/game/DungeonFinding/LFGScripts.cpp @@ -37,9 +37,9 @@ void LFGScripts::OnAddMember(Group* group, uint64 guid) sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnAddMember [" UI64FMTD "]: added [" UI64FMTD "]", gguid, guid); LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_CLEAR_LOCK_LIST); - for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { - if (Player *plrg = itr->getSource()) + if (Player* plrg = itr->getSource()) { plrg->GetSession()->SendLfgUpdatePlayer(updateData); plrg->GetSession()->SendLfgUpdateParty(updateData); @@ -51,7 +51,7 @@ void LFGScripts::OnAddMember(Group* group, uint64 guid) sLFGMgr->Leave(NULL, group); if (sLFGMgr->GetState(guid) == LFG_STATE_QUEUED) - if (Player *plr = ObjectAccessor::FindPlayer(guid)) + if (Player* plr = ObjectAccessor::FindPlayer(guid)) sLFGMgr->Leave(plr); } @@ -82,7 +82,7 @@ void LFGScripts::OnRemoveMember(Group* group, uint64 guid, RemoveMethod& method, } sLFGMgr->ClearState(guid); - if (Player *plr = ObjectAccessor::FindPlayer(guid)) + if (Player* plr = ObjectAccessor::FindPlayer(guid)) { /* if (method == GROUP_REMOVEMETHOD_LEAVE) @@ -116,7 +116,7 @@ void LFGScripts::OnChangeLeader(Group* group, uint64 newLeaderGuid, uint64 oldLe return; sLog->outDebug(LOG_FILTER_LFG, "LFGScripts::OnChangeLeader [" UI64FMTD "]: old [" UI64FMTD "] new [" UI64FMTD "]", gguid, newLeaderGuid, oldLeaderGuid); - Player *plr = ObjectAccessor::FindPlayer(newLeaderGuid); + Player* plr = ObjectAccessor::FindPlayer(newLeaderGuid); LfgUpdateData updateData = LfgUpdateData(LFG_UPDATETYPE_LEADER); if (plr) diff --git a/src/server/game/Entities/Corpse/Corpse.cpp b/src/server/game/Entities/Corpse/Corpse.cpp index 5fdf8709852..cdd5d61b1c9 100755 --- a/src/server/game/Entities/Corpse/Corpse.cpp +++ b/src/server/game/Entities/Corpse/Corpse.cpp @@ -66,14 +66,14 @@ void Corpse::RemoveFromWorld() Object::RemoveFromWorld(); } -bool Corpse::Create(uint32 guidlow, Map *map) +bool Corpse::Create(uint32 guidlow, Map* map) { SetMap(map); Object::_Create(guidlow, 0, HIGHGUID_CORPSE); return true; } -bool Corpse::Create(uint32 guidlow, Player *owner) +bool Corpse::Create(uint32 guidlow, Player* owner) { ASSERT(owner); @@ -162,7 +162,7 @@ void Corpse::DeleteFromDB(SQLTransaction& trans) trans->Append(stmt); } -bool Corpse::LoadFromDB(uint32 guid, Field *fields) +bool Corpse::LoadFromDB(uint32 guid, Field* fields) { uint32 ownerGuid = fields[17].GetUInt32(); // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 diff --git a/src/server/game/Entities/Corpse/Corpse.h b/src/server/game/Entities/Corpse/Corpse.h index 2c092e8b207..bd68eb688f5 100755 --- a/src/server/game/Entities/Corpse/Corpse.h +++ b/src/server/game/Entities/Corpse/Corpse.h @@ -55,11 +55,11 @@ class Corpse : public WorldObject, public GridObject<Corpse> void AddToWorld(); void RemoveFromWorld(); - bool Create(uint32 guidlow, Map *map); - bool Create(uint32 guidlow, Player *owner); + bool Create(uint32 guidlow, Map* map); + bool Create(uint32 guidlow, Player* owner); void SaveToDB(); - bool LoadFromDB(uint32 guid, Field *fields); + bool LoadFromDB(uint32 guid, Field* fields); void DeleteBonesFromWorld(); void DeleteFromDB(SQLTransaction& trans); diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index b099fb5faa7..8c49ff06d5a 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -253,9 +253,9 @@ void Creature::RemoveCorpse(bool setSpawnTime) /** * change the entry of creature until respawn */ -bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData *data) +bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data) { - CreatureTemplate const *normalInfo = sObjectMgr->GetCreatureTemplate(Entry); + CreatureTemplate const* normalInfo = sObjectMgr->GetCreatureTemplate(Entry); if (!normalInfo) { sLog->outErrorDb("Creature::InitEntry creature entry %u does not exist.", Entry); @@ -263,7 +263,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData *data } // get difficulty 1 mode entry - CreatureTemplate const *cinfo = normalInfo; + CreatureTemplate const* cinfo = normalInfo; for (uint8 diff = uint8(GetMap()->GetSpawnMode()); diff > 0;) { // we already have valid Map pointer for current creature! @@ -301,7 +301,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData *data } uint32 displayID = sObjectMgr->ChooseDisplayId(0, GetCreatureInfo(), data); - CreatureModelInfo const *minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); + CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); if (!minfo) // Cancel load if no model defined { sLog->outErrorDb("Creature (Entry: %u) has no model defined in table `creature_template`, can't load. ", Entry); @@ -343,7 +343,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData *data return true; } -bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData *data) +bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData* data) { if (!InitEntry(Entry, team, data)) return false; @@ -691,7 +691,7 @@ bool Creature::AIM_Initialize(CreatureAI* ai) return false; } - UnitAI *oldAI = i_AI; + UnitAI* oldAI = i_AI; Motion_Initialize(); @@ -720,13 +720,13 @@ void Creature::Motion_Initialize() i_motionMaster.Initialize(); } -bool Creature::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehId, uint32 team, float x, float y, float z, float ang, const CreatureData *data) +bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 vehId, uint32 team, float x, float y, float z, float ang, const CreatureData* data) { ASSERT(map); SetMap(map); SetPhaseMask(phaseMask, false); - CreatureTemplate const *cinfo = sObjectMgr->GetCreatureTemplate(Entry); + CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(Entry); if (!cinfo) { sLog->outErrorDb("Creature::Create(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry); @@ -766,7 +766,7 @@ bool Creature::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, LoadCreaturesAddon(); uint32 displayID = GetNativeDisplayId(); - CreatureModelInfo const *minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); + CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); if (minfo && !isTotem()) // Cancel load if no model defined or if totem { SetDisplayId(displayID); @@ -953,21 +953,21 @@ void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint3 SendMonsterMove(x, y, z, time); } -Player *Creature::GetLootRecipient() const +Player* Creature::GetLootRecipient() const { if (!m_lootRecipient) return NULL; return ObjectAccessor::FindPlayer(m_lootRecipient); } -Group *Creature::GetLootRecipientGroup() const +Group* Creature::GetLootRecipientGroup() const { if (!m_lootRecipientGroup) return NULL; return sGroupMgr->GetGroupByGUID(m_lootRecipientGroup); } -void Creature::SetLootRecipient(Unit *unit) +void Creature::SetLootRecipient(Unit* unit) { // set the player whose group should receive the right // to loot the creature after it dies @@ -1012,7 +1012,7 @@ void Creature::SaveToDB() { // this should only be used when the creature has already been loaded // preferably after adding to map, because mapid may not be valid otherwise - CreatureData const *data = sObjectMgr->GetCreatureData(m_DBTableGuid); + CreatureData const* data = sObjectMgr->GetCreatureData(m_DBTableGuid); if (!data) { sLog->outError("Creature::SaveToDB failed, cannot get creature data!"); @@ -1035,7 +1035,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) uint32 dynamicflags = GetUInt32Value(UNIT_DYNAMIC_FLAGS); // check if it's a custom model and if not, use 0 for displayId - CreatureTemplate const *cinfo = GetCreatureInfo(); + CreatureTemplate const* cinfo = GetCreatureInfo(); if (cinfo) { if (displayId == cinfo->Modelid1 || displayId == cinfo->Modelid2 || @@ -1109,7 +1109,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) WorldDatabase.CommitTransaction(trans); } -void Creature::SelectLevel(const CreatureTemplate *cinfo) +void Creature::SelectLevel(const CreatureTemplate* cinfo) { uint32 rank = isPet()? 0 : cinfo->rank; @@ -1214,7 +1214,7 @@ float Creature::GetSpellDamageMod(int32 Rank) } } -bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint32 team, const CreatureData *data) +bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint32 team, const CreatureData* data) { SetZoneScript(); if (m_zoneScript && data) @@ -1224,7 +1224,7 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint3 return false; } - CreatureTemplate const *cinfo = sObjectMgr->GetCreatureTemplate(Entry); + CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(Entry); if (!cinfo) { sLog->outErrorDb("Creature::CreateFromProto(): creature template (guidlow: %u, entry: %u) does not exist.", guidlow, Entry); @@ -1247,7 +1247,7 @@ bool Creature::CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint3 return true; } -bool Creature::LoadFromDB(uint32 guid, Map *map) +bool Creature::LoadFromDB(uint32 guid, Map* map) { CreatureData const* data = sObjectMgr->GetCreatureData(guid); @@ -1332,7 +1332,7 @@ void Creature::LoadEquipment(uint32 equip_entry, bool force) return; } - EquipmentInfo const *einfo = sObjectMgr->GetEquipmentInfo(equip_entry); + EquipmentInfo const* einfo = sObjectMgr->GetEquipmentInfo(equip_entry); if (!einfo) return; @@ -1524,7 +1524,7 @@ void Creature::setDeathState(DeathState s) SetFullHealth(); SetLootRecipient(NULL); ResetPlayerDamageReq(); - CreatureTemplate const *cinfo = GetCreatureInfo(); + CreatureTemplate const* cinfo = GetCreatureInfo(); AddUnitMovementFlag(MOVEMENTFLAG_WALKING); if (GetCreatureInfo()->InhabitType & INHABIT_AIR) AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_FLYING); @@ -1586,13 +1586,13 @@ void Creature::Respawn(bool force) if (m_originalEntry != GetEntry()) UpdateEntry(m_originalEntry); - CreatureTemplate const *cinfo = GetCreatureInfo(); + CreatureTemplate const* cinfo = GetCreatureInfo(); SelectLevel(cinfo); setDeathState(JUST_ALIVED); uint32 displayID = GetNativeDisplayId(); - CreatureModelInfo const *minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); + CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID); if (minfo) // Cancel load if no model defined { SetDisplayId(displayID); @@ -1621,7 +1621,7 @@ void Creature::ForcedDespawn(uint32 timeMSToDespawn) { if (timeMSToDespawn) { - ForcedDespawnDelayEvent *pEvent = new ForcedDespawnDelayEvent(*this); + ForcedDespawnDelayEvent* pEvent = new ForcedDespawnDelayEvent(*this); m_Events.AddEvent(pEvent, m_Events.CalculateTime(timeMSToDespawn)); return; @@ -1663,7 +1663,7 @@ bool Creature::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) return Unit::IsImmunedToSpellEffect(spellInfo, index); } -SpellInfo const *Creature::reachWithSpellAttack(Unit *pVictim) +SpellInfo const* Creature::reachWithSpellAttack(Unit* pVictim) { if (!pVictim) return NULL; @@ -1672,7 +1672,7 @@ SpellInfo const *Creature::reachWithSpellAttack(Unit *pVictim) { if (!m_spells[i]) continue; - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]); if (!spellInfo) { sLog->outError("WORLD: unknown spell id %i", m_spells[i]); @@ -1710,7 +1710,7 @@ SpellInfo const *Creature::reachWithSpellAttack(Unit *pVictim) return NULL; } -SpellInfo const *Creature::reachWithSpellCure(Unit *pVictim) +SpellInfo const* Creature::reachWithSpellCure(Unit* pVictim) { if (!pVictim) return NULL; @@ -1719,7 +1719,7 @@ SpellInfo const *Creature::reachWithSpellCure(Unit *pVictim) { if (!m_spells[i]) continue; - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(m_spells[i]); if (!spellInfo) { sLog->outError("WORLD: unknown spell id %i", m_spells[i]); @@ -1864,7 +1864,7 @@ void Creature::CallAssistance() if (!assistList.empty()) { - AssistDelayEvent *e = new AssistDelayEvent(getVictim()->GetGUID(), *this); + AssistDelayEvent* e = new AssistDelayEvent(getVictim()->GetGUID(), *this); while (!assistList.empty()) { // Pushing guids because in delay can happen some creature gets despawned => invalid pointer @@ -1960,7 +1960,7 @@ bool Creature::_IsTargetAcceptable(const Unit* target) const return false; } - const Unit *myVictim = getAttackerForHelper(); + const Unit* myVictim = getAttackerForHelper(); const Unit* targetVictim = target->getAttackerForHelper(); // if I'm already fighting target, or I'm hostile towards the target, the target is acceptable @@ -1984,12 +1984,12 @@ void Creature::SaveRespawnTime() } // this should not be called by petAI or -bool Creature::canCreatureAttack(Unit const *pVictim, bool force) const +bool Creature::canCreatureAttack(Unit const* pVictim, bool /*force*/) const { if (!pVictim->IsInMap(this)) return false; - if (!canAttack(pVictim, force)) + if (!IsValidAttackTarget(pVictim)) return false; if (!pVictim->isInAccessiblePlaceFor(this)) @@ -2004,7 +2004,7 @@ bool Creature::canCreatureAttack(Unit const *pVictim, bool force) const //Use AttackDistance in distance check if threat radius is lower. This prevents creature bounce in and out of combat every update tick. float dist = std::max(GetAttackDistance(pVictim), sWorld->getFloatConfig(CONFIG_THREAT_RADIUS)) + m_CombatDistance; - if (Unit *unit = GetCharmerOrOwner()) + if (Unit* unit = GetCharmerOrOwner()) return pVictim->IsWithinDist(unit, dist); else return pVictim->IsInDist(&m_homePosition, dist); @@ -2025,7 +2025,7 @@ CreatureAddon const* Creature::GetCreatureAddon() const //creature_addon table bool Creature::LoadCreaturesAddon(bool reload) { - CreatureAddon const *cainfo = GetCreatureAddon(); + CreatureAddon const* cainfo = GetCreatureAddon(); if (!cainfo) return false; @@ -2072,7 +2072,7 @@ bool Creature::LoadCreaturesAddon(bool reload) { for (std::vector<uint32>::const_iterator itr = cainfo->auras.begin(); itr != cainfo->auras.end(); ++itr) { - SpellInfo const *AdditionalSpellInfo = sSpellMgr->GetSpellInfo(*itr); + SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(*itr); if (!AdditionalSpellInfo) { sLog->outErrorDb("Creature (GUID: %u Entry: %u) has wrong spell %u defined in `auras` field.", GetGUIDLow(), GetEntry(), *itr); @@ -2155,12 +2155,12 @@ void Creature::_AddCreatureCategoryCooldown(uint32 category, time_t apply_time) void Creature::AddCreatureSpellCooldown(uint32 spellid) { - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellid); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid); if (!spellInfo) return; uint32 cooldown = spellInfo->GetRecoveryTime(); - if (Player *modOwner = GetSpellModOwner()) + if (Player* modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellid, SPELLMOD_COOLDOWN, cooldown); if (cooldown) @@ -2172,7 +2172,7 @@ void Creature::AddCreatureSpellCooldown(uint32 spellid) bool Creature::HasCategoryCooldown(uint32 spell_id) const { - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id); if (!spellInfo) return false; @@ -2240,7 +2240,7 @@ void Creature::AllLootRemovedFromCorpse() return; float decayRate; - CreatureTemplate const *cinfo = GetCreatureInfo(); + CreatureTemplate const* cinfo = GetCreatureInfo(); decayRate = sWorld->getRate(RATE_CORPSE_DECAY_LOOTED); uint32 diff = uint32((m_corpseRemoveTime - now) * decayRate); @@ -2371,7 +2371,7 @@ const char* Creature::GetNameForLocaleIdx(LocaleConstant loc_idx) const if (loc_idx != DEFAULT_LOCALE) { uint8 uloc_idx = uint8(loc_idx); - CreatureLocale const *cl = sObjectMgr->GetCreatureLocale(GetEntry()); + CreatureLocale const* cl = sObjectMgr->GetCreatureLocale(GetEntry()); if (cl) { if (cl->Name.size() > uloc_idx && !cl->Name[uloc_idx].empty()) @@ -2401,6 +2401,6 @@ void Creature::FarTeleportTo(Map* map, float X, float Y, float Z, float O) bool Creature::IsDungeonBoss() const { - CreatureTemplate const *cinfo = sObjectMgr->GetCreatureTemplate(GetEntry()); + CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(GetEntry()); return cinfo && (cinfo->flags_extra & CREATURE_FLAG_EXTRA_DUNGEON_BOSS); } diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 7ad0386dcae..19938b47bd6 100755 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -419,9 +419,9 @@ class Creature : public Unit, public GridObject<Creature> void DisappearAndDie(); - bool Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 vehId, uint32 team, float x, float y, float z, float ang, const CreatureData *data = NULL); + bool Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 vehId, uint32 team, float x, float y, float z, float ang, const CreatureData* data = NULL); bool LoadCreaturesAddon(bool reload = false); - void SelectLevel(const CreatureTemplate *cinfo); + void SelectLevel(const CreatureTemplate* cinfo); void LoadEquipment(uint32 equip_entry, bool force=false); uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; } @@ -457,7 +457,7 @@ class Creature : public Unit, public GridObject<Creature> bool isCanTrainingOf(Player* player, bool msg) const; bool isCanInteractWithBattleMaster(Player* player, bool msg) const; bool isCanTrainingAndResetTalentsOf(Player* pPlayer) const; - bool canCreatureAttack(Unit const *pVictim, bool force = true) const; + bool canCreatureAttack(Unit const* pVictim, bool force = true) const; bool IsImmunedToSpell(SpellInfo const* spellInfo); // redefine Unit::IsImmunedToSpell bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const; @@ -489,7 +489,7 @@ class Creature : public Unit, public GridObject<Creature> void Motion_Initialize(); void AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 MovementFlags, uint8 type); - CreatureAI * AI() const { return (CreatureAI*)i_AI; } + CreatureAI* AI() const { return (CreatureAI*)i_AI; } uint32 GetShieldBlockValue() const //dunno mob block value { @@ -526,8 +526,8 @@ class Creature : public Unit, public GridObject<Creature> TrainerSpellData const* GetTrainerSpells() const; - CreatureTemplate const *GetCreatureInfo() const { return m_creatureInfo; } - CreatureData const *GetCreatureData() const { return m_creatureData; } + CreatureTemplate const* GetCreatureInfo() const { return m_creatureInfo; } + CreatureData const* GetCreatureData() const { return m_creatureData; } CreatureAddon const* GetCreatureAddon() const; std::string GetAIName() const; @@ -546,7 +546,7 @@ class Creature : public Unit, public GridObject<Creature> void setDeathState(DeathState s); // override virtual Unit::setDeathState bool FallGround(); - bool LoadFromDB(uint32 guid, Map *map); + bool LoadFromDB(uint32 guid, Map* map); void SaveToDB(); // overriden in Pet virtual void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask); @@ -570,8 +570,8 @@ class Creature : public Unit, public GridObject<Creature> void RemoveLootMode(uint16 lootMode) { m_LootMode &= ~lootMode; } void ResetLootMode() { m_LootMode = LOOT_MODE_DEFAULT; } - SpellInfo const *reachWithSpellAttack(Unit *pVictim); - SpellInfo const *reachWithSpellCure(Unit *pVictim); + SpellInfo const* reachWithSpellAttack(Unit* pVictim); + SpellInfo const* reachWithSpellCure(Unit* pVictim); uint32 m_spells[CREATURE_MAX_SPELLS]; CreatureSpellCooldowns m_CreatureSpellCooldowns; @@ -651,10 +651,10 @@ class Creature : public Unit, public GridObject<Creature> void UpdateWaypointID(uint32 wpID){m_waypointID = wpID;} void SearchFormation(); - CreatureGroup *GetFormation() {return m_formation;} - void SetFormation(CreatureGroup *formation) {m_formation = formation;} + CreatureGroup* GetFormation() {return m_formation;} + void SetFormation(CreatureGroup* formation) {m_formation = formation;} - Unit *SelectVictim(); + Unit* SelectVictim(); void SetDisableReputationGain(bool disable) { DisableReputationGain = disable; } bool IsReputationGainDisabled() { return DisableReputationGain; } @@ -679,7 +679,7 @@ class Creature : public Unit, public GridObject<Creature> void FarTeleportTo(Map* map, float X, float Y, float Z, float O); protected: - bool CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint32 team, const CreatureData *data = NULL); + bool CreateFromProto(uint32 guidlow, uint32 Entry, uint32 vehId, uint32 team, const CreatureData* data = NULL); bool InitEntry(uint32 entry, uint32 team=ALLIANCE, const CreatureData* data=NULL); // vendor items @@ -733,7 +733,7 @@ class Creature : public Unit, public GridObject<Creature> uint32 m_path_id; //Formation var - CreatureGroup *m_formation; + CreatureGroup* m_formation; bool TriggerJustRespawned; }; diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp index a9a0b6119b3..3fdb996bc5a 100755 --- a/src/server/game/Entities/Creature/CreatureGroups.cpp +++ b/src/server/game/Entities/Creature/CreatureGroups.cpp @@ -28,7 +28,7 @@ CreatureGroupInfoType CreatureGroupMap; void CreatureGroupManager::AddCreatureToGroup(uint32 groupId, Creature* member) { - Map *map = member->FindMap(); + Map* map = member->FindMap(); if (!map) return; @@ -57,7 +57,7 @@ void CreatureGroupManager::RemoveCreatureFromGroup(CreatureGroup* group, Creatur if (group->isEmpty()) { - Map *map = member->FindMap(); + Map* map = member->FindMap(); if (!map) return; @@ -92,7 +92,7 @@ void CreatureGroupManager::LoadCreatureFormations() { do { - Field *fields = guidResult->Fetch(); + Field* fields = guidResult->Fetch(); uint32 guid = fields[0].GetUInt32(); guidSet.insert(guid); @@ -101,8 +101,8 @@ void CreatureGroupManager::LoadCreatureFormations() } uint32 count = 0; - Field *fields; - FormationInfo *group_member; + Field* fields; + FormationInfo* group_member; do { @@ -199,7 +199,7 @@ void CreatureGroup::MemberAttackStart(Creature* member, Unit* target) if (itr->first->getVictim()) continue; - if (itr->first->canAttack(target) && itr->first->AI()) + if (itr->first->IsValidAttackTarget(target) && itr->first->AI()) itr->first->AI()->AttackStart(target); } } diff --git a/src/server/game/Entities/Creature/CreatureGroups.h b/src/server/game/Entities/Creature/CreatureGroups.h index d68d18b788d..5aafe1dc2b3 100755 --- a/src/server/game/Entities/Creature/CreatureGroups.h +++ b/src/server/game/Entities/Creature/CreatureGroups.h @@ -35,8 +35,8 @@ class CreatureGroupManager { friend class ACE_Singleton<CreatureGroupManager, ACE_Null_Mutex>; public: - void AddCreatureToGroup(uint32 group_id, Creature *creature); - void RemoveCreatureFromGroup(CreatureGroup* group, Creature *creature); + void AddCreatureToGroup(uint32 group_id, Creature* creature); + void RemoveCreatureFromGroup(CreatureGroup* group, Creature* creature); void LoadCreatureFormations(); }; @@ -49,7 +49,7 @@ extern CreatureGroupInfoType CreatureGroupMap; class CreatureGroup { private: - Creature *m_leader; //Important do not forget sometimes to work with pointers instead synonims :D:D + Creature* m_leader; //Important do not forget sometimes to work with pointers instead synonims :D:D typedef std::map<Creature*, FormationInfo*> CreatureGroupMemberType; CreatureGroupMemberType m_members; diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index 0d91b476fdd..b5a857d1abc 100755 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -109,7 +109,7 @@ void GossipMenu::ClearMenu() _menuItemData.clear(); } -PlayerMenu::PlayerMenu(WorldSession *session) : _session(session) +PlayerMenu::PlayerMenu(WorldSession* session) : _session(session) { } @@ -187,7 +187,7 @@ void PlayerMenu::SendPointOfInterest(uint32 poiId) const std::string iconText = poi->icon_name; int32 locale = _session->GetSessionDbLocaleIndex(); if (locale >= 0) - if (PointOfInterestLocale const *localeData = sObjectMgr->GetPointOfInterestLocale(poiId)) + if (PointOfInterestLocale const* localeData = sObjectMgr->GetPointOfInterestLocale(poiId)) ObjectMgr::GetLocaleString(localeData->IconName, locale, iconText); WorldPacket data(SMSG_GOSSIP_POI, 4 + 4 + 4 + 4 + 4 + 10); // guess size @@ -261,13 +261,13 @@ void PlayerMenu::SendQuestGiverQuestList(QEmote eEmote, const std::string& Title uint32 questID = qmi.QuestId; - if (Quest const *pQuest = sObjectMgr->GetQuestTemplate(questID)) + if (Quest const* pQuest = sObjectMgr->GetQuestTemplate(questID)) { std::string title = pQuest->GetTitle(); int loc_idx = _session->GetSessionDbLocaleIndex(); if (loc_idx >= 0) - if (QuestLocale const *ql = sObjectMgr->GetQuestLocale(questID)) + if (QuestLocale const* ql = sObjectMgr->GetQuestLocale(questID)) ObjectMgr::GetLocaleString(ql->Title, loc_idx, title); data << uint32(questID); @@ -294,7 +294,7 @@ void PlayerMenu::SendQuestGiverStatus(uint8 questStatus, uint64 npcGUID) const sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC Guid=%u, status=%u", GUID_LOPART(npcGUID), questStatus); } -void PlayerMenu::SendQuestGiverQuestDetails(Quest const *quest, uint64 npcGUID, bool activateAccept) const +void PlayerMenu::SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, bool activateAccept) const { std::string questTitle = quest->GetTitle(); std::string questDetails = quest->GetDetails(); @@ -624,7 +624,7 @@ void PlayerMenu::SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, b sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_OFFER_REWARD NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), quest->GetQuestId()); } -void PlayerMenu::SendQuestGiverRequestItems(Quest const *quest, uint64 npcGUID, bool canComplete, bool closeOnCancel) const +void PlayerMenu::SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, bool canComplete, bool closeOnCancel) const { // We can always call to RequestItems, but this packet only goes out if there are actually // items. Otherwise, we'll skip straight to the OfferReward diff --git a/src/server/game/Entities/Creature/GossipDef.h b/src/server/game/Entities/Creature/GossipDef.h index 16966965b47..517395578cf 100755 --- a/src/server/game/Entities/Creature/GossipDef.h +++ b/src/server/game/Entities/Creature/GossipDef.h @@ -272,10 +272,10 @@ class PlayerMenu void SendQuestGiverQuestList(QEmote eEmote, const std::string& Title, uint64 npcGUID); void SendQuestQueryResponse(Quest const* quest) const; - void SendQuestGiverQuestDetails(Quest const *quest, uint64 npcGUID, bool activateAccept) const; + void SendQuestGiverQuestDetails(Quest const* quest, uint64 npcGUID, bool activateAccept) const; void SendQuestGiverOfferReward(Quest const* quest, uint64 npcGUID, bool enableNext) const; - void SendQuestGiverRequestItems(Quest const *quest, uint64 npcGUID, bool canComplete, bool closeOnCancel) const; + void SendQuestGiverRequestItems(Quest const* quest, uint64 npcGUID, bool canComplete, bool closeOnCancel) const; private: GossipMenu _gossipMenu; diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp index d1ad656ba3d..27b0ba53b3d 100755 --- a/src/server/game/Entities/Creature/TemporarySummon.cpp +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp @@ -22,7 +22,7 @@ #include "ObjectMgr.h" #include "TemporarySummon.h" -TempSummon::TempSummon(SummonPropertiesEntry const *properties, Unit *owner) : +TempSummon::TempSummon(SummonPropertiesEntry const* properties, Unit* owner) : Creature(), m_Properties(properties), m_type(TEMPSUMMON_MANUAL_DESPAWN), m_timer(0), m_lifetime(0) { @@ -174,7 +174,7 @@ void TempSummon::InitStats(uint32 duration) if (m_type == TEMPSUMMON_MANUAL_DESPAWN) m_type = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN; - Unit *owner = GetSummoner(); + Unit* owner = GetSummoner(); if (owner && isTrigger() && m_spells[0]) { @@ -193,7 +193,7 @@ void TempSummon::InitStats(uint32 duration) { if (owner->m_SummonSlot[slot] && owner->m_SummonSlot[slot] != GetGUID()) { - Creature *oldSummon = GetMap()->GetCreature(owner->m_SummonSlot[slot]); + Creature* oldSummon = GetMap()->GetCreature(owner->m_SummonSlot[slot]); if (oldSummon && oldSummon->isSummon()) oldSummon->ToTempSummon()->UnSummon(); } @@ -228,7 +228,7 @@ void TempSummon::UnSummon(uint32 msTime) { if (msTime) { - ForcedUnsummonDelayEvent *pEvent = new ForcedUnsummonDelayEvent(*this); + ForcedUnsummonDelayEvent* pEvent = new ForcedUnsummonDelayEvent(*this); m_Events.AddEvent(pEvent, m_Events.CalculateTime(msTime)); return; @@ -272,7 +272,7 @@ void TempSummon::RemoveFromWorld() Creature::RemoveFromWorld(); } -Minion::Minion(SummonPropertiesEntry const *properties, Unit *owner) : TempSummon(properties, owner) +Minion::Minion(SummonPropertiesEntry const* properties, Unit* owner) : TempSummon(properties, owner) , m_owner(owner) { ASSERT(m_owner); @@ -306,7 +306,7 @@ bool Minion::IsGuardianPet() const return isPet() || (m_Properties && m_Properties->Category == SUMMON_CATEGORY_PET); } -Guardian::Guardian(SummonPropertiesEntry const *properties, Unit *owner) : Minion(properties, owner) +Guardian::Guardian(SummonPropertiesEntry const* properties, Unit* owner) : Minion(properties, owner) , m_bonusSpellDamage(0) { memset(m_statFromOwner, 0, sizeof(float)*MAX_STATS); @@ -340,7 +340,7 @@ void Guardian::InitSummon() m_owner->ToPlayer()->CharmSpellInitialize(); } -Puppet::Puppet(SummonPropertiesEntry const *properties, Unit *owner) : Minion(properties, owner) +Puppet::Puppet(SummonPropertiesEntry const* properties, Unit* owner) : Minion(properties, owner) { ASSERT(owner->GetTypeId() == TYPEID_PLAYER); m_owner = (Player*)owner; diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h index 8cf33ab1cd9..1982dec4bb8 100755 --- a/src/server/game/Entities/Creature/TemporarySummon.h +++ b/src/server/game/Entities/Creature/TemporarySummon.h @@ -24,7 +24,7 @@ class TempSummon : public Creature { public: - explicit TempSummon(SummonPropertiesEntry const *properties, Unit *owner); + explicit TempSummon(SummonPropertiesEntry const* properties, Unit* owner); virtual ~TempSummon() {} void Update(uint32 time); virtual void InitStats(uint32 lifetime); @@ -37,7 +37,7 @@ class TempSummon : public Creature uint64 GetSummonerGUID() { return m_summonerGUID; } TempSummonType const& GetSummonType() { return m_type; } - const SummonPropertiesEntry * const m_Properties; + const SummonPropertiesEntry* const m_Properties; private: TempSummonType m_type; uint32 m_timer; @@ -48,10 +48,10 @@ class TempSummon : public Creature class Minion : public TempSummon { public: - Minion(SummonPropertiesEntry const *properties, Unit *owner); + Minion(SummonPropertiesEntry const* properties, Unit* owner); void InitStats(uint32 duration); void RemoveFromWorld(); - Unit *GetOwner() { return m_owner; } + Unit* GetOwner() { return m_owner; } float GetFollowAngle() const { return m_followAngle; } void SetFollowAngle(float angle) { m_followAngle = angle; } bool IsPetGhoul() const {return GetEntry() == 26125;} // Ghoul may be guardian or pet @@ -64,7 +64,7 @@ class Minion : public TempSummon class Guardian : public Minion { public: - Guardian(SummonPropertiesEntry const *properties, Unit *owner); + Guardian(SummonPropertiesEntry const* properties, Unit* owner); void InitStats(uint32 duration); bool InitStatsForLevel(uint8 level); void InitSummon(); @@ -88,13 +88,13 @@ class Guardian : public Minion class Puppet : public Minion { public: - Puppet(SummonPropertiesEntry const *properties, Unit *owner); + Puppet(SummonPropertiesEntry const* properties, Unit* owner); void InitStats(uint32 duration); void InitSummon(); void Update(uint32 time); void RemoveFromWorld(); protected: - Player *m_owner; + Player* m_owner; }; class ForcedUnsummonDelayEvent : public BasicEvent diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 83ece2eda31..b69478ab0e5 100755 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -154,7 +154,7 @@ void GameObject::RemoveFromWorld() } } -bool GameObject::Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 artKit) +bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 artKit) { ASSERT(map); SetMap(map); @@ -465,7 +465,7 @@ void GameObject::Update(uint32 diff) { //Battleground gameobjects case if (ok->ToPlayer()->InBattleground()) - if (Battleground *bg = ok->ToPlayer()->GetBattleground()) + if (Battleground* bg = ok->ToPlayer()->GetBattleground()) bg->HandleTriggerBuff(GetGUID()); } } @@ -527,13 +527,10 @@ void GameObject::Update(uint32 diff) if (spellId) { - std::set<uint32>::const_iterator it = m_unique_users.begin(); - std::set<uint32>::const_iterator end = m_unique_users.end(); - for (; it != end; ++it) - { - if (Unit* owner = Unit::GetUnit(*this, uint64(*it))) + for (std::set<uint64>::const_iterator it = m_unique_users.begin(); it != m_unique_users.end(); ++it) + // m_unique_users can contain only player GUIDs + if (Player* owner = ObjectAccessor::GetPlayer(*this, *it)) owner->CastSpell(owner, spellId, false); - } m_unique_users.clear(); m_usetimes = 0; @@ -606,7 +603,7 @@ void GameObject::Refresh() void GameObject::AddUniqueUse(Player* player) { AddUse(); - m_unique_users.insert(player->GetGUIDLow()); + m_unique_users.insert(player->GetGUID()); } void GameObject::Delete() @@ -629,7 +626,7 @@ void GameObject::Delete() AddObjectToRemoveList(); } -void GameObject::getFishLoot(Loot *fishloot, Player* loot_owner) +void GameObject::getFishLoot(Loot* fishloot, Player* loot_owner) { fishloot->clear(); @@ -646,7 +643,7 @@ void GameObject::SaveToDB() { // this should only be used when the gameobject has already been loaded // preferably after adding to map, because mapid may not be valid otherwise - GameObjectData const *data = sObjectMgr->GetGOData(m_DBTableGuid); + GameObjectData const* data = sObjectMgr->GetGOData(m_DBTableGuid); if (!data) { sLog->outError("GameObject::SaveToDB failed, cannot get gameobject data!"); @@ -658,7 +655,7 @@ void GameObject::SaveToDB() void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) { - const GameObjectTemplate *goI = GetGOInfo(); + const GameObjectTemplate* goI = GetGOInfo(); if (!goI) return; @@ -712,7 +709,7 @@ void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) WorldDatabase.CommitTransaction(trans); } -bool GameObject::LoadFromDB(uint32 guid, Map *map) +bool GameObject::LoadFromDB(uint32 guid, Map* map) { GameObjectData const* data = sObjectMgr->GetGOData(guid); @@ -878,7 +875,7 @@ void GameObject::Respawn() } } -bool GameObject::ActivateToQuest(Player *pTarget) const +bool GameObject::ActivateToQuest(Player* pTarget) const { if (pTarget->HasQuestForGO(GetEntry())) return true; @@ -896,7 +893,7 @@ bool GameObject::ActivateToQuest(Player *pTarget) const //TODO: fix this hack //look for battlegroundAV for some objects which are only activated after mine gots captured by own team if (GetEntry() == BG_AV_OBJECTID_MINE_N || GetEntry() == BG_AV_OBJECTID_MINE_S) - if (Battleground *bg = pTarget->GetBattleground()) + if (Battleground* bg = pTarget->GetBattleground()) if (bg->GetTypeID(true) == BATTLEGROUND_AV && !(((BattlegroundAV*)bg)->PlayerCanDoMineQuest(GetEntry(), pTarget->GetTeam()))) return false; return true; @@ -997,14 +994,14 @@ void GameObject::UseDoorOrButton(uint32 time_to_restore, bool alternative /* = f void GameObject::SetGoArtKit(uint8 kit) { SetByteValue(GAMEOBJECT_BYTES_1, 2, kit); - GameObjectData *data = const_cast<GameObjectData*>(sObjectMgr->GetGOData(m_DBTableGuid)); + GameObjectData* data = const_cast<GameObjectData*>(sObjectMgr->GetGOData(m_DBTableGuid)); if (data) data->artKit = kit; } -void GameObject::SetGoArtKit(uint8 artkit, GameObject *go, uint32 lowguid) +void GameObject::SetGoArtKit(uint8 artkit, GameObject* go, uint32 lowguid) { - const GameObjectData *data = NULL; + const GameObjectData* data = NULL; if (go) { go->SetGoArtKit(artkit); @@ -1393,6 +1390,15 @@ void GameObject::Use(Unit* user) triggered = true; } + // Cast casterTargetSpell at a random GO user + // on the current DB there is only one gameobject that uses this (Ritual of Doom) + // and its required target number is 1 (outter for loop will run once) + if (info->summoningRitual.casterTargetSpell && info->summoningRitual.casterTargetSpell != 1) // No idea why this field is a bool in some cases + for (uint32 i = 0; i < info->summoningRitual.casterTargetSpellTargets; i++) + // m_unique_users can contain only player GUIDs + if (Player* target = ObjectAccessor::GetPlayer(*this, SelectRandomContainerElement(m_unique_users))) + spellCaster->CastSpell(target, info->summoningRitual.casterTargetSpell, true); + // finish owners spell if (owner) owner->FinishSpell(CURRENT_CHANNELED_SPELL); @@ -1477,7 +1483,7 @@ void GameObject::Use(Unit* user) if (player->CanUseBattlegroundObject()) { // in battleground check - Battleground *bg = player->GetBattleground(); + Battleground* bg = player->GetBattleground(); if (!bg) return; if (player->GetVehicle()) @@ -1685,7 +1691,7 @@ const char* GameObject::GetNameForLocaleIdx(LocaleConstant loc_idx) const if (loc_idx != DEFAULT_LOCALE) { uint8 uloc_idx = uint8(loc_idx); - if (GameObjectLocale const *cl = sObjectMgr->GetGameObjectLocale(GetEntry())) + if (GameObjectLocale const* cl = sObjectMgr->GetGameObjectLocale(GetEntry())) if (cl->Name.size() > uloc_idx && !cl->Name[uloc_idx].empty()) return cl->Name[uloc_idx].c_str(); } diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index a0e6fff173f..ff0cf03c8b8 100755 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -623,7 +623,7 @@ class GameObject : public WorldObject, public GridObject<GameObject> void RemoveFromWorld(); void CleanupsBeforeDelete(bool finalCleanup = true); - bool Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 artKit = 0); + bool Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 artKit = 0); void Update(uint32 p_time); static GameObject* GetGameObject(WorldObject& object, uint64 guid); GameObjectTemplate const* GetGOInfo() const { return m_goInfo; } @@ -648,7 +648,7 @@ class GameObject : public WorldObject, public GridObject<GameObject> void SaveToDB(); void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask); - bool LoadFromDB(uint32 guid, Map *map); + bool LoadFromDB(uint32 guid, Map* map); void DeleteFromDB(); void SetOwnerGUID(uint64 owner) @@ -698,7 +698,7 @@ class GameObject : public WorldObject, public GridObject<GameObject> uint32 GetRespawnDelay() const { return m_respawnDelayTime; } void Refresh(); void Delete(); - void getFishLoot(Loot *loot, Player* loot_owner); + void getFishLoot(Loot* loot, Player* loot_owner); GameobjectTypes GetGoType() const { return GameobjectTypes(GetByteValue(GAMEOBJECT_BYTES_1, 1)); } void SetGoType(GameobjectTypes type) { SetByteValue(GAMEOBJECT_BYTES_1, 1, type); } GOState GetGoState() const { return GOState(GetByteValue(GAMEOBJECT_BYTES_1, 0)); } @@ -707,7 +707,7 @@ class GameObject : public WorldObject, public GridObject<GameObject> void SetGoArtKit(uint8 artkit); uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); } void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); } - static void SetGoArtKit(uint8 artkit, GameObject *go, uint32 lowguid = 0); + static void SetGoArtKit(uint8 artkit, GameObject* go, uint32 lowguid = 0); void Use(Unit* user); @@ -745,7 +745,7 @@ class GameObject : public WorldObject, public GridObject<GameObject> bool hasQuest(uint32 quest_id) const; bool hasInvolvedQuest(uint32 quest_id) const; - bool ActivateToQuest(Player *pTarget) const; + bool ActivateToQuest(Player* pTarget) const; void UseDoorOrButton(uint32 time_to_restore = 0, bool alternative = false); // 0 = use `gameobject`.`spawntimesecs` void ResetDoorOrButton(); @@ -800,7 +800,7 @@ class GameObject : public WorldObject, public GridObject<GameObject> std::list<uint32> m_SkillupList; Player* m_ritualOwner; // used for GAMEOBJECT_TYPE_SUMMONING_RITUAL where GO is not summoned (no owner) - std::set<uint32> m_unique_users; + std::set<uint64> m_unique_users; uint32 m_usetimes; typedef std::map<uint32, uint64> ChairSlotAndUser; diff --git a/src/server/game/Entities/Item/Container/Bag.cpp b/src/server/game/Entities/Item/Container/Bag.cpp index 007e22d5dfa..92abc595e77 100755 --- a/src/server/game/Entities/Item/Container/Bag.cpp +++ b/src/server/game/Entities/Item/Container/Bag.cpp @@ -31,13 +31,13 @@ Bag::Bag(): Item() m_valuesCount = CONTAINER_END; - memset(m_bagslot, 0, sizeof(Item *) * MAX_BAG_SIZE); + memset(m_bagslot, 0, sizeof(Item* ) * MAX_BAG_SIZE); } Bag::~Bag() { for (uint8 i = 0; i < MAX_BAG_SIZE; ++i) - if (Item *item = m_bagslot[i]) + if (Item* item = m_bagslot[i]) { if (item->IsInWorld()) { @@ -153,7 +153,7 @@ void Bag::RemoveItem(uint8 slot, bool /*update*/) SetUInt64Value(CONTAINER_FIELD_SLOT_1 + (slot * 2), 0); } -void Bag::StoreItem(uint8 slot, Item *pItem, bool /*update*/) +void Bag::StoreItem(uint8 slot, Item* pItem, bool /*update*/) { ASSERT(slot < MAX_BAG_SIZE); @@ -168,7 +168,7 @@ void Bag::StoreItem(uint8 slot, Item *pItem, bool /*update*/) } } -void Bag::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const +void Bag::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const { Item::BuildCreateUpdateBlockForPlayer(data, target); @@ -189,7 +189,7 @@ bool Bag::IsEmpty() const uint32 Bag::GetItemCount(uint32 item, Item* eItem) const { - Item *pItem; + Item* pItem; uint32 count = 0; for (uint32 i=0; i < GetBagSize(); ++i) { @@ -215,9 +215,9 @@ uint32 Bag::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipItem) { uint32 count = 0; for (uint32 i = 0; i < GetBagSize(); ++i) - if (Item *pItem = m_bagslot[i]) + if (Item* pItem = m_bagslot[i]) if (pItem != skipItem) - if (ItemTemplate const *pProto = pItem->GetTemplate()) + if (ItemTemplate const* pProto = pItem->GetTemplate()) if (pProto->ItemLimitCategory == limitCategory) count += m_bagslot[i]->GetCount(); diff --git a/src/server/game/Entities/Item/Container/Bag.h b/src/server/game/Entities/Item/Container/Bag.h index df6253caf9e..463425076d4 100755 --- a/src/server/game/Entities/Item/Container/Bag.h +++ b/src/server/game/Entities/Item/Container/Bag.h @@ -38,7 +38,7 @@ class Bag : public Item bool Create(uint32 guidlow, uint32 itemid, Player const* owner); void Clear(); - void StoreItem(uint8 slot, Item *pItem, bool update); + void StoreItem(uint8 slot, Item* pItem, bool update); void RemoveItem(uint8 slot, bool update); Item* GetItemByPos(uint8 slot) const; @@ -58,7 +58,7 @@ class Bag : public Item // overwrite virtual Item::DeleteFromDB void DeleteFromDB(SQLTransaction& trans); - void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const; + void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const; protected: diff --git a/src/server/game/Entities/Item/Item.cpp b/src/server/game/Entities/Item/Item.cpp index 75c810e8494..1394b018df4 100755 --- a/src/server/game/Entities/Item/Item.cpp +++ b/src/server/game/Entities/Item/Item.cpp @@ -110,11 +110,11 @@ void AddItemsSetItem(Player* player, Item* item) } } -void RemoveItemsSetItem(Player*player, ItemTemplate const *proto) +void RemoveItemsSetItem(Player*player, ItemTemplate const* proto) { uint32 setid = proto->ItemSet; - ItemSetEntry const *set = sItemSetStore.LookupEntry(setid); + ItemSetEntry const* set = sItemSetStore.LookupEntry(setid); if (!set) { @@ -122,7 +122,7 @@ void RemoveItemsSetItem(Player*player, ItemTemplate const *proto) return; } - ItemSetEffect *eff = NULL; + ItemSetEffect* eff = NULL; size_t setindex = 0; for (; setindex < player->ItemSetEff.size(); setindex++) { @@ -168,7 +168,7 @@ void RemoveItemsSetItem(Player*player, ItemTemplate const *proto) } } -bool ItemCanGoIntoBag(ItemTemplate const *pProto, ItemTemplate const *pBagProto) +bool ItemCanGoIntoBag(ItemTemplate const* pProto, ItemTemplate const* pBagProto) { if (!pProto || !pBagProto) return false; @@ -264,7 +264,7 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner) SetUInt64Value(ITEM_FIELD_OWNER, owner ? owner->GetGUID() : 0); SetUInt64Value(ITEM_FIELD_CONTAINED, owner ? owner->GetGUID() : 0); - ItemTemplate const *itemProto = sObjectMgr->GetItemTemplate(itemid); + ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(itemid); if (!itemProto) return false; @@ -497,7 +497,7 @@ void Item::DeleteFromInventoryDB(SQLTransaction& trans) DeleteFromInventoryDB(trans, GetGUIDLow()); } -ItemTemplate const *Item::GetTemplate() const +ItemTemplate const* Item::GetTemplate() const { return sObjectMgr->GetItemTemplate(GetEntry()); } @@ -586,7 +586,7 @@ uint32 Item::GetSpell() int32 Item::GenerateItemRandomPropertyId(uint32 item_id) { - ItemTemplate const *itemProto = sObjectMgr->GetItemTemplate(item_id); + ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(item_id); if (!itemProto) return 0; @@ -606,7 +606,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id) if (itemProto->RandomProperty) { uint32 randomPropId = GetItemEnchantMod(itemProto->RandomProperty); - ItemRandomPropertiesEntry const *random_id = sItemRandomPropertiesStore.LookupEntry(randomPropId); + ItemRandomPropertiesEntry const* random_id = sItemRandomPropertiesStore.LookupEntry(randomPropId); if (!random_id) { sLog->outErrorDb("Enchantment id #%u used but it doesn't have records in 'ItemRandomProperties.dbc'", randomPropId); @@ -619,7 +619,7 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id) else { uint32 randomPropId = GetItemEnchantMod(itemProto->RandomSuffix); - ItemRandomSuffixEntry const *random_id = sItemRandomSuffixStore.LookupEntry(randomPropId); + ItemRandomSuffixEntry const* random_id = sItemRandomSuffixStore.LookupEntry(randomPropId); if (!random_id) { sLog->outErrorDb("Enchantment id #%u used but it doesn't have records in sItemRandomSuffixStore.", randomPropId); @@ -637,7 +637,7 @@ void Item::SetItemRandomProperties(int32 randomPropId) if (randomPropId > 0) { - ItemRandomPropertiesEntry const *item_rand = sItemRandomPropertiesStore.LookupEntry(randomPropId); + ItemRandomPropertiesEntry const* item_rand = sItemRandomPropertiesStore.LookupEntry(randomPropId); if (item_rand) { if (GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID) != int32(item_rand->ID)) @@ -651,7 +651,7 @@ void Item::SetItemRandomProperties(int32 randomPropId) } else { - ItemRandomSuffixEntry const *item_rand = sItemRandomSuffixStore.LookupEntry(-randomPropId); + ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(-randomPropId); if (item_rand) { if (GetInt32Value(ITEM_FIELD_RANDOM_PROPERTIES_ID) != -int32(item_rand->ID) || @@ -676,7 +676,7 @@ void Item::UpdateItemSuffixFactor() SetUInt32Value(ITEM_FIELD_PROPERTY_SEED, suffixFactor); } -void Item::SetState(ItemUpdateState state, Player *forplayer) +void Item::SetState(ItemUpdateState state, Player* forplayer) { if (uState == ITEM_NEW && state == ITEM_REMOVED) { @@ -778,7 +778,7 @@ bool Item::CanBeTraded(bool mail, bool trade) const return true; } -bool Item::HasEnchantRequiredSkill(const Player *pPlayer) const +bool Item::HasEnchantRequiredSkill(const Player* pPlayer) const { // Check all enchants for required skill @@ -1036,7 +1036,7 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player) if (count < 1) return NULL; //don't create item at zero count - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(item); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item); if (pProto) { if (count > pProto->GetMaxStackSize()) @@ -1044,7 +1044,7 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player) ASSERT(count !=0 && "pProto->Stackable == 0 but checked at loading already"); - Item *pItem = NewItemOrBag(pProto); + Item* pItem = NewItemOrBag(pProto); if (pItem->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), item, player)) { pItem->SetCount(count); @@ -1116,7 +1116,7 @@ bool ItemRequiredTarget::IsFitToRequirements(Unit* pUnitTarget) const void Item::BuildUpdate(UpdateDataMapType& data_map) { - if (Player *owner = GetOwner()) + if (Player* owner = GetOwner()) BuildFieldsUpdate(owner, data_map); ClearUpdateMask(false); } @@ -1136,7 +1136,7 @@ void Item::DeleteRefundDataFromDB(SQLTransaction* trans) (*trans)->PAppend("DELETE FROM item_refund_instance WHERE item_guid = '%u'", GetGUIDLow()); } -void Item::SetNotRefundable(Player *owner, bool changestate /*=true*/, SQLTransaction* trans /*=NULL*/) +void Item::SetNotRefundable(Player* owner, bool changestate /*=true*/, SQLTransaction* trans /*=NULL*/) { if (!HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE)) return; @@ -1154,7 +1154,7 @@ void Item::SetNotRefundable(Player *owner, bool changestate /*=true*/, SQLTransa owner->DeleteRefundReference(GetGUIDLow()); } -void Item::UpdatePlayedTime(Player *owner) +void Item::UpdatePlayedTime(Player* owner) { /* Here we update our played time We simply add a number to the current played time, diff --git a/src/server/game/Entities/Item/Item.h b/src/server/game/Entities/Item/Item.h index c6f4ef6d60a..534f16042ea 100755 --- a/src/server/game/Entities/Item/Item.h +++ b/src/server/game/Entities/Item/Item.h @@ -33,7 +33,7 @@ struct ItemSetEffect { uint32 setid; uint32 item_count; - SpellInfo const *spells[8]; + SpellInfo const* spells[8]; }; enum InventoryResult @@ -221,7 +221,7 @@ struct ItemRequiredTarget bool IsFitToRequirements(Unit* pUnitTarget) const; }; -bool ItemCanGoIntoBag(ItemTemplate const *proto, ItemTemplate const *pBagProto); +bool ItemCanGoIntoBag(ItemTemplate const* proto, ItemTemplate const* pBagProto); class Item : public Object { @@ -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* pPlayer) const; uint32 GetEnchantRequiredLevel() const; bool IsFitToSpellRequirements(SpellInfo const* spellInfo) const; @@ -280,11 +280,11 @@ class Item : public Object InventoryResult CanBeMergedPartlyWith(ItemTemplate const* proto) const; uint8 GetSlot() const {return m_slot;} - Bag *GetContainer() { return m_container; } + Bag* GetContainer() { return m_container; } uint8 GetBagSlot() const; void SetSlot(uint8 slot) { m_slot = slot; } uint16 GetPos() const { return uint16(GetBagSlot()) << 8 | GetSlot(); } - void SetContainer(Bag *container) { m_container = container; } + void SetContainer(Bag* container) { m_container = container; } bool IsInBag() const { return m_container != NULL; } bool IsEquipped() const; @@ -321,7 +321,7 @@ class Item : public Object // Update States ItemUpdateState GetState() const { return uState; } - void SetState(ItemUpdateState state, Player *forplayer = NULL); + void SetState(ItemUpdateState state, Player* forplayer = NULL); void AddToUpdateQueueOf(Player* player); void RemoveFromUpdateQueueOf(Player* player); bool IsInUpdateQueue() const { return uQueuePos != -1; } @@ -339,7 +339,7 @@ class Item : public Object bool IsConjuredConsumable() const { return GetTemplate()->IsConjuredConsumable(); } // Item Refund system - void SetNotRefundable(Player *owner, bool changestate = true, SQLTransaction* trans = NULL); + void SetNotRefundable(Player* owner, bool changestate = true, SQLTransaction* trans = NULL); void SetRefundRecipient(uint32 pGuidLow) { m_refundRecipient = pGuidLow; } void SetPaidMoney(uint32 money) { m_paidMoney = money; } void SetPaidExtendedCost(uint32 iece) { m_paidExtendedCost = iece; } @@ -347,7 +347,7 @@ class Item : public Object uint32 GetPaidMoney() { return m_paidMoney; } uint32 GetPaidExtendedCost() { return m_paidExtendedCost; } - void UpdatePlayedTime(Player *owner); + void UpdatePlayedTime(Player* owner); uint32 GetPlayedTime(); bool IsRefundExpired(); @@ -361,7 +361,7 @@ class Item : public Object private: std::string m_text; uint8 m_slot; - Bag *m_container; + Bag* m_container; ItemUpdateState uState; int16 uQueuePos; bool mb_in_trade; // true if item is currently in trade-window diff --git a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp index 6dcf16935cc..7f7f1c4ae7f 100755 --- a/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp +++ b/src/server/game/Entities/Item/ItemEnchantmentMgr.cpp @@ -57,7 +57,7 @@ void LoadRandomEnchantmentsTable() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); uint32 ench = fields[1].GetUInt32(); @@ -120,14 +120,14 @@ uint32 GetItemEnchantMod(int32 entry) uint32 GenerateEnchSuffixFactor(uint32 item_id) { - ItemTemplate const *itemProto = sObjectMgr->GetItemTemplate(item_id); + ItemTemplate const* itemProto = sObjectMgr->GetItemTemplate(item_id); if (!itemProto) return 0; if (!itemProto->RandomSuffix) return 0; - RandomPropertiesPointsEntry const *randomProperty = sRandomPropertiesPointsStore.LookupEntry(itemProto->ItemLevel); + RandomPropertiesPointsEntry const* randomProperty = sRandomPropertiesPointsStore.LookupEntry(itemProto->ItemLevel); if (!randomProperty) return 0; diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index aa056e793f0..4305f90d7a3 100755 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -183,7 +183,7 @@ void Object::RemoveFromWorld() ClearUpdateMask(true); } -void Object::BuildMovementUpdateBlock(UpdateData * data, uint32 flags) const +void Object::BuildMovementUpdateBlock(UpdateData* data, uint32 flags) const { ByteBuffer buf(500); @@ -195,7 +195,7 @@ void Object::BuildMovementUpdateBlock(UpdateData * data, uint32 flags) const data->AddUpdateBlock(buf); } -void Object::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const +void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const { if (!target) return; @@ -270,7 +270,7 @@ void Object::SendUpdateToPlayer(Player* player) player->GetSession()->SendPacket(&packet); } -void Object::BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) const +void Object::BuildValuesUpdateBlockForPlayer(UpdateData* data, Player* target) const { ByteBuffer buf(500); @@ -286,12 +286,12 @@ void Object::BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) c data->AddUpdateBlock(buf); } -void Object::BuildOutOfRangeUpdateBlock(UpdateData * data) const +void Object::BuildOutOfRangeUpdateBlock(UpdateData* data) const { data->AddOutOfRangeGUID(GetGUID()); } -void Object::DestroyForPlayer(Player *target, bool anim) const +void Object::DestroyForPlayer(Player* target, bool anim) const { ASSERT(target); @@ -414,14 +414,14 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const *data << (float)0; *data << (float)0; *data << (float)0; - *data << ((WorldObject *)this)->GetOrientation(); + *data << ((WorldObject* )this)->GetOrientation(); } else { - *data << ((WorldObject *)this)->GetPositionX(); - *data << ((WorldObject *)this)->GetPositionY(); - *data << ((WorldObject *)this)->GetPositionZ(); - *data << ((WorldObject *)this)->GetOrientation(); + *data << ((WorldObject* )this)->GetPositionX(); + *data << ((WorldObject* )this)->GetPositionY(); + *data << ((WorldObject* )this)->GetPositionZ(); + *data << ((WorldObject* )this)->GetOrientation(); } } } @@ -491,7 +491,7 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const } } -void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *updateMask, Player *target) const +void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask* updateMask, Player* target) const { if (!target) return; @@ -1251,7 +1251,7 @@ void WorldObject::setActive(bool on) if (!IsInWorld()) return; - Map *map = FindMap(); + Map* map = FindMap(); if (!map) return; @@ -1298,7 +1298,7 @@ void WorldObject::GetZoneAndAreaId(uint32& zoneid, uint32& areaid) const InstanceScript* WorldObject::GetInstanceScript() { - Map *map = GetMap(); + Map* map = GetMap(); return map->IsDungeon() ? ((InstanceMap*)map)->GetInstanceScript() : NULL; } @@ -1354,7 +1354,7 @@ bool WorldObject::IsWithinLOS(float ox, float oy, float oz) const { float x, y, z; GetPosition(x, y, z); - VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager(); + VMAP::IVMapManager* vMapManager = VMAP::VMapFactory::createOrGetVMapManager(); return vMapManager->isInLineOfSight(GetMapId(), x, y, z+2.0f, ox, oy, oz+2.0f); } @@ -1466,7 +1466,7 @@ void Position::GetPositionOffsetTo(const Position & endPos, Position & retOffset retOffset.m_orientation = endPos.GetOrientation() - GetOrientation(); } -float Position::GetAngle(const Position *obj) const +float Position::GetAngle(const Position* obj) const { if (!obj) return 0; return GetAngle(obj->GetPositionX(), obj->GetPositionY()); @@ -1502,7 +1502,7 @@ void Position::GetSinCos(const float x, const float y, float &vsin, float &vcos) } } -bool Position::HasInArc(float arc, const Position *obj) const +bool Position::HasInArc(float arc, const Position* obj) const { // always have self in arc if (obj == this) @@ -1524,7 +1524,7 @@ bool Position::HasInArc(float arc, const Position *obj) const return ((angle >= lborder) && (angle <= rborder)); } -bool WorldObject::IsInBetween(const WorldObject *obj1, const WorldObject *obj2, float size) const +bool WorldObject::IsInBetween(const WorldObject* obj1, const WorldObject* obj2, float size) const { if (GetPositionX() > std::max(obj1->GetPositionX(), obj2->GetPositionX()) || GetPositionX() < std::min(obj1->GetPositionX(), obj2->GetPositionX()) @@ -2002,7 +2002,7 @@ void WorldObject::MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisp player->GetSession()->SendPacket(&data); } -void WorldObject::BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* text, uint32 language, char const* name, uint64 targetGuid) const +void WorldObject::BuildMonsterChat(WorldPacket* data, uint8 msgtype, char const* text, uint32 language, char const* name, uint64 targetGuid) const { *data << (uint8)msgtype; *data << (uint32)language; @@ -2021,26 +2021,26 @@ void WorldObject::BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* *data << (uint8)0; // ChatTag } -void Unit::BuildHeartBeatMsg(WorldPacket *data) const +void Unit::BuildHeartBeatMsg(WorldPacket* data) const { data->Initialize(MSG_MOVE_HEARTBEAT, 32); data->append(GetPackGUID()); BuildMovementPacket(data); } -void WorldObject::SendMessageToSet(WorldPacket *data, bool self) +void WorldObject::SendMessageToSet(WorldPacket* data, bool self) { SendMessageToSetInRange(data, GetVisibilityRange(), self); } -void WorldObject::SendMessageToSetInRange(WorldPacket *data, float dist, bool /*self*/) +void WorldObject::SendMessageToSetInRange(WorldPacket* data, float dist, bool /*self*/) { Trinity::MessageDistDeliverer notifier(this, data, dist); VisitNearbyWorldObject(dist, notifier); } -void WorldObject::SendMessageToSet(WorldPacket *data, Player const* skipped_rcvr) +void WorldObject::SendMessageToSet(WorldPacket* data, Player const* skipped_rcvr) { Trinity::MessageDistDeliverer notifier(this, data, GetVisibilityRange(), false, skipped_rcvr); VisitNearbyWorldObject(GetVisibilityRange(), notifier); @@ -2053,7 +2053,7 @@ void WorldObject::SendObjectDeSpawnAnim(uint64 guid) SendMessageToSet(&data, true); } -void WorldObject::SetMap(Map * map) +void WorldObject::SetMap(Map* map) { ASSERT(map); ASSERT(!IsInWorld() || GetTypeId() == TYPEID_CORPSE); @@ -2204,7 +2204,7 @@ TempSummon* Map::SummonCreature(uint32 entry, Position const& pos, SummonPropert void WorldObject::SetZoneScript() { - if (Map *map = FindMap()) + if (Map* map = FindMap()) { if (map->IsDungeon()) m_zoneScript = (ZoneScript*)((InstanceMap*)map)->GetInstanceScript(); @@ -2215,9 +2215,9 @@ void WorldObject::SetZoneScript() TempSummon* WorldObject::SummonCreature(uint32 entry, const Position &pos, TempSummonType spwtype, uint32 duration, uint32 /*vehId*/) const { - if (Map *map = FindMap()) + if (Map* map = FindMap()) { - if (TempSummon *summon = map->SummonCreature(entry, pos, NULL, duration, isType(TYPEMASK_UNIT) ? (Unit*)this : NULL)) + if (TempSummon* summon = map->SummonCreature(entry, pos, NULL, duration, isType(TYPEMASK_UNIT) ? (Unit*)this : NULL)) { summon->SetTempSummonType(spwtype); return summon; @@ -2267,7 +2267,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy return NULL; } - Map *map = GetMap(); + Map* map = GetMap(); uint32 pet_number = sObjectMgr->GeneratePetNumber(); if (!pet->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PET), map, GetPhaseMask(), entry, pet_number)) { @@ -2351,8 +2351,8 @@ GameObject* WorldObject::SummonGameObject(uint32 entry, float x, float y, float sLog->outErrorDb("Gameobject template %u not found in database!", entry); return NULL; } - Map *map = GetMap(); - GameObject *go = new GameObject(); + Map* map = GetMap(); + GameObject* go = new GameObject(); if (!go->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), entry, map, GetPhaseMask(), x, y, z, ang, rotation0, rotation1, rotation2, rotation3, 100, GO_STATE_READY)) { delete go; @@ -2389,7 +2389,7 @@ Creature* WorldObject::SummonTrigger(float x, float y, float z, float ang, uint3 Creature* WorldObject::FindNearestCreature(uint32 entry, float range, bool alive) const { - Creature *creature = NULL; + Creature* creature = NULL; Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck checker(*this, entry, alive, range); Trinity::CreatureLastSearcher<Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck> searcher(this, creature, checker); VisitNearbyObject(range, searcher); @@ -2398,7 +2398,7 @@ Creature* WorldObject::FindNearestCreature(uint32 entry, float range, bool alive GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range) const { - GameObject *go = NULL; + GameObject* go = NULL; Trinity::NearestGameObjectEntryInObjectRangeCheck checker(*this, entry, range); Trinity::GameObjectLastSearcher<Trinity::NearestGameObjectEntryInObjectRangeCheck> searcher(this, go, checker); VisitNearbyGridObject(range, searcher); @@ -2743,7 +2743,7 @@ void WorldObject::DestroyForNearbyPlayers() VisitNearbyWorldObject(GetVisibilityRange(), searcher); for (std::list<Player*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) { - Player *plr = (*iter); + Player* plr = (*iter); if (plr == this) continue; @@ -2816,7 +2816,7 @@ struct WorldObjectChangeAccumulator if (IS_PLAYER_GUID(guid)) { //Caster may be NULL if DynObj is in removelist - if (Player *caster = ObjectAccessor::FindPlayer(guid)) + if (Player* caster = ObjectAccessor::FindPlayer(guid)) if (caster->GetUInt64Value(PLAYER_FARSIGHT) == source->GetGUID()) BuildPacket(caster); } diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index 3364ae338a9..ec2ec8f6edc 100755 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -140,14 +140,14 @@ class Object TypeID GetTypeId() const { return m_objectTypeId; } bool isType(uint16 mask) const { return (mask & m_objectType); } - virtual void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const; + virtual void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const; void SendUpdateToPlayer(Player* player); - void BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) const; - void BuildOutOfRangeUpdateBlock(UpdateData *data) const; - void BuildMovementUpdateBlock(UpdateData * data, uint32 flags = 0) const; + void BuildValuesUpdateBlockForPlayer(UpdateData* data, Player* target) const; + void BuildOutOfRangeUpdateBlock(UpdateData* data) const; + void BuildMovementUpdateBlock(UpdateData* data, uint32 flags = 0) const; - virtual void DestroyForPlayer(Player *target, bool anim = false) const; + virtual void DestroyForPlayer(Player* target, bool anim = false) const; int32 GetInt32Value(uint16 index) const { @@ -294,7 +294,7 @@ class Object virtual bool hasQuest(uint32 /* quest_id */) const { return false; } virtual bool hasInvolvedQuest(uint32 /* quest_id */) const { return false; } virtual void BuildUpdate(UpdateDataMapType&) {} - void BuildFieldsUpdate(Player *, UpdateDataMapType &) const; + void BuildFieldsUpdate(Player* , UpdateDataMapType &) const; // FG: some hacky helpers void ForceValuesUpdateAtIndex(uint32); @@ -320,11 +320,11 @@ class Object std::string _ConcatFields(uint16 startIndex, uint16 size) const; void _LoadIntoDataField(const char* data, uint32 startOffset, uint32 count); - virtual void _SetUpdateBits(UpdateMask *updateMask, Player *target) const; + virtual void _SetUpdateBits(UpdateMask* updateMask, Player* target) const; - virtual void _SetCreateBits(UpdateMask *updateMask, Player *target) const; + virtual void _SetCreateBits(UpdateMask* updateMask, Player* target) const; void _BuildMovementUpdate(ByteBuffer * data, uint16 flags) const; - void _BuildValuesUpdate(uint8 updatetype, ByteBuffer *data, UpdateMask *updateMask, Player *target) const; + void _BuildValuesUpdate(uint8 updatetype, ByteBuffer *data, UpdateMask* updateMask, Player* target) const; uint16 m_objectType; @@ -382,7 +382,7 @@ struct Position { m_positionX = x; m_positionY = y; m_positionZ = z; m_orientation = orientation; } void Relocate(const Position &pos) { m_positionX = pos.m_positionX; m_positionY = pos.m_positionY; m_positionZ = pos.m_positionZ; m_orientation = pos.m_orientation; } - void Relocate(const Position *pos) + void Relocate(const Position* pos) { m_positionX = pos->m_positionX; m_positionY = pos->m_positionY; m_positionZ = pos->m_positionZ; m_orientation = pos->m_orientation; } void RelocateOffset(const Position &offset); void SetOrientation(float orientation) @@ -399,7 +399,7 @@ struct Position { x = m_positionX; y = m_positionY; z = m_positionZ; } void GetPosition(float &x, float &y, float &z, float &o) const { x = m_positionX; y = m_positionY; z = m_positionZ; o = m_orientation; } - void GetPosition(Position *pos) const + void GetPosition(Position* pos) const { if (pos) pos->Relocate(m_positionX, m_positionY, m_positionZ, m_orientation); @@ -420,37 +420,37 @@ struct Position { float dx = m_positionX - x; float dy = m_positionY - y; return dx*dx + dy*dy; } float GetExactDist2d(const float x, const float y) const { return sqrt(GetExactDist2dSq(x, y)); } - float GetExactDist2dSq(const Position *pos) const + float GetExactDist2dSq(const Position* pos) const { float dx = m_positionX - pos->m_positionX; float dy = m_positionY - pos->m_positionY; return dx*dx + dy*dy; } - float GetExactDist2d(const Position *pos) const + float GetExactDist2d(const Position* pos) const { return sqrt(GetExactDist2dSq(pos)); } float GetExactDistSq(float x, float y, float z) const { float dz = m_positionZ - z; return GetExactDist2dSq(x, y) + dz*dz; } float GetExactDist(float x, float y, float z) const { return sqrt(GetExactDistSq(x, y, z)); } - float GetExactDistSq(const Position *pos) const + float GetExactDistSq(const Position* pos) const { float dx = m_positionX - pos->m_positionX; float dy = m_positionY - pos->m_positionY; float dz = m_positionZ - pos->m_positionZ; return dx*dx + dy*dy + dz*dz; } - float GetExactDist(const Position *pos) const + float GetExactDist(const Position* pos) const { return sqrt(GetExactDistSq(pos)); } void GetPositionOffsetTo(const Position & endPos, Position & retOffset) const; - float GetAngle(const Position *pos) const; + float GetAngle(const Position* pos) const; float GetAngle(float x, float y) const; - float GetRelativeAngle(const Position *pos) const + float GetRelativeAngle(const Position* pos) const { return GetAngle(pos) - m_orientation; } float GetRelativeAngle(float x, float y) const { return GetAngle(x, y) - m_orientation; } void GetSinCos(float x, float y, float &vsin, float &vcos) const; bool IsInDist2d(float x, float y, float dist) const { return GetExactDist2dSq(x, y) < dist * dist; } - bool IsInDist2d(const Position *pos, float dist) const + bool IsInDist2d(const Position* pos, float dist) const { return GetExactDist2dSq(pos) < dist * dist; } bool IsInDist(float x, float y, float z, float dist) const { return GetExactDistSq(x, y, z) < dist * dist; } - bool IsInDist(const Position *pos, float dist) const + bool IsInDist(const Position* pos, float dist) const { return GetExactDistSq(pos) < dist * dist; } - bool HasInArc(float arcangle, const Position *pos) const; + bool HasInArc(float arcangle, const Position* pos) const; bool HasInLine(Unit const* target, float distance, float width) const; std::string ToString() const; }; @@ -640,7 +640,7 @@ class WorldObject : public Object, public WorldLocation virtual const char* GetNameForLocaleIdx(LocaleConstant /*locale_idx*/) const { return GetName(); } - float GetDistance(const WorldObject *obj) const + float GetDistance(const WorldObject* obj) const { float d = GetExactDist(obj) - GetObjectSize() - obj->GetObjectSize(); return d > 0.0f ? d : 0.0f; @@ -676,11 +676,11 @@ class WorldObject : public Object, public WorldLocation } bool IsWithinDist3d(float x, float y, float z, float dist) const { return IsInDist(x, y, z, dist + GetObjectSize()); } - bool IsWithinDist3d(const Position *pos, float dist) const + bool IsWithinDist3d(const Position* pos, float dist) const { return IsInDist(pos, dist + GetObjectSize()); } bool IsWithinDist2d(float x, float y, float dist) const { return IsInDist2d(x, y, dist + GetObjectSize()); } - bool IsWithinDist2d(const Position *pos, float dist) const + bool IsWithinDist2d(const Position* pos, float dist) const { return IsInDist2d(pos, dist + GetObjectSize()); } virtual bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D) const; // use only if you will sure about placing both object at same map @@ -701,13 +701,13 @@ class WorldObject : public Object, public WorldLocation bool isInFront(WorldObject const* target, float distance, float arc = M_PI) const; bool isInBack(WorldObject const* target, float distance, float arc = M_PI) const; - bool IsInBetween(const WorldObject *obj1, const WorldObject *obj2, float size = 0) const; + bool IsInBetween(const WorldObject* obj1, const WorldObject* obj2, float size = 0) const; virtual void CleanupsBeforeDelete(bool finalCleanup = true); // used in destructor or explicitly before mass creature delete to remove cross-references to already deleted units - virtual void SendMessageToSet(WorldPacket *data, bool self); - virtual void SendMessageToSetInRange(WorldPacket *data, float dist, bool self); - virtual void SendMessageToSet(WorldPacket *data, Player const* skipped_rcvr); + virtual void SendMessageToSet(WorldPacket* data, bool self); + virtual void SendMessageToSetInRange(WorldPacket* data, float dist, bool self); + virtual void SendMessageToSet(WorldPacket* data, Player const* skipped_rcvr); virtual uint8 getLevelForTarget(WorldObject const* /*target*/) const { return 1; } @@ -720,7 +720,7 @@ class WorldObject : public Object, public WorldLocation void MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote = false); void MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisper = false); void MonsterYellToZone(int32 textId, uint32 language, uint64 TargetGuid); - void BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* text, uint32 language, char const* name, uint64 TargetGuid) const; + void BuildMonsterChat(WorldPacket* data, uint8 msgtype, char const* text, uint32 language, char const* name, uint64 TargetGuid) const; void PlayDistanceSound(uint32 sound_id, Player* target = NULL); void PlayDirectSound(uint32 sound_id, Player* target = NULL); @@ -760,17 +760,17 @@ class WorldObject : public Object, public WorldLocation // Low Level Packets void SendPlaySound(uint32 Sound, bool OnlySelf); - virtual void SetMap(Map * map); + virtual void SetMap(Map* map); virtual void ResetMap(); - Map * GetMap() const { ASSERT(m_currMap); return m_currMap; } - Map * FindMap() const { return m_currMap; } + Map* GetMap() const { ASSERT(m_currMap); return m_currMap; } + Map* FindMap() const { return m_currMap; } //used to check all object's GetMap() calls when object is not in world! //this function should be removed in nearest time... Map const* GetBaseMap() const; void SetZoneScript(); - ZoneScript * GetZoneScript() const { return m_zoneScript; } + ZoneScript* GetZoneScript() const { return m_zoneScript; } TempSummon* SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0, uint32 vehId = 0) const; TempSummon* SummonCreature(uint32 id, float x, float y, float z, float ang = 0, TempSummonType spwtype = TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime = 0) @@ -823,7 +823,7 @@ class WorldObject : public Object, public WorldLocation uint32 LastUsedScriptID; // Transports - Transport *GetTransport() const { return m_transport; } + Transport* GetTransport() const { return m_transport; } virtual float GetTransOffsetX() const { return 0; } virtual float GetTransOffsetY() const { return 0; } virtual float GetTransOffsetZ() const { return 0; } @@ -831,16 +831,16 @@ class WorldObject : public Object, public WorldLocation virtual uint32 GetTransTime() const { return 0; } virtual int8 GetTransSeat() const { return -1; } virtual uint64 GetTransGUID() const; - void SetTransport(Transport *t) { m_transport = t; } + void SetTransport(Transport* t) { m_transport = t; } MovementInfo m_movementInfo; protected: std::string m_name; bool m_isActive; - ZoneScript *m_zoneScript; + ZoneScript* m_zoneScript; // transports - Transport *m_transport; + Transport* m_transport; //these functions are used mostly for Relocate() and Corpse/Player specific stuff... //use them ONLY in LoadFromDB()/Create() funcs and nowhere else! @@ -849,7 +849,7 @@ class WorldObject : public Object, public WorldLocation void SetLocationInstanceId(uint32 _instanceId) { m_InstanceId = _instanceId; } private: - Map * m_currMap; //current object's Map location + Map* m_currMap; //current object's Map location //uint32 m_mapId; // object at map with map_id uint32 m_InstanceId; // in map copy with instance id @@ -879,13 +879,13 @@ namespace Trinity class ObjectDistanceOrderPred { public: - ObjectDistanceOrderPred(const WorldObject *pRefObj, bool ascending = true) : m_refObj(pRefObj), m_ascending(ascending) {} - bool operator()(const WorldObject *pLeft, const WorldObject *pRight) const + ObjectDistanceOrderPred(const WorldObject* pRefObj, bool ascending = true) : m_refObj(pRefObj), m_ascending(ascending) {} + bool operator()(const WorldObject* pLeft, const WorldObject* pRight) const { return m_ascending ? m_refObj->GetDistanceOrder(pLeft, pRight) : !m_refObj->GetDistanceOrder(pLeft, pRight); } private: - const WorldObject *m_refObj; + const WorldObject* m_refObj; const bool m_ascending; }; } diff --git a/src/server/game/Entities/Pet/Pet.cpp b/src/server/game/Entities/Pet/Pet.cpp index bea3395c860..2a151f50064 100755 --- a/src/server/game/Entities/Pet/Pet.cpp +++ b/src/server/game/Entities/Pet/Pet.cpp @@ -33,7 +33,7 @@ #define PET_XP_FACTOR 0.05f -Pet::Pet(Player *owner, PetType type) : Guardian(NULL, owner), +Pet::Pet(Player* owner, PetType type) : Guardian(NULL, owner), m_usedTalentCount(0), m_removed(false), m_owner(owner), m_happinessTimer(7500), m_petType(type), m_duration(0), m_auraRaidUpdateMask(0), m_loading(false), m_declinedname(NULL) @@ -130,7 +130,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c return false; } - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); // update for case of current pet "slot = 0" petentry = fields[1].GetUInt32(); @@ -162,7 +162,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c return false; } - Map *map = owner->GetMap(); + Map* map = owner->GetMap(); uint32 guid = sObjectMgr->GenerateLowGuid(HIGHGUID_PET); if (!Create(guid, map, owner->GetPhaseMask(), petentry, pet_number)) return false; @@ -182,7 +182,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c setFaction(owner->getFaction()); SetUInt32Value(UNIT_CREATED_BY_SPELL, summon_spell_id); - CreatureTemplate const *cinfo = GetCreatureInfo(); + CreatureTemplate const* cinfo = GetCreatureInfo(); if (cinfo->type == CREATURE_TYPE_CRITTER) { map->Add(this->ToCreature()); @@ -318,7 +318,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c { delete m_declinedname; m_declinedname = new DeclinedName; - Field *fields2 = result->Fetch(); + Field* fields2 = result->Fetch(); for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i) { m_declinedname->name[i] = fields2[i].GetString(); @@ -706,7 +706,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature) return false; } - CreatureTemplate const *cinfo = GetCreatureInfo(); + CreatureTemplate const* cinfo = GetCreatureInfo(); if (!cinfo) { sLog->outError("CreateBaseAtCreature() failed, creatureInfo is missing!"); @@ -736,7 +736,7 @@ bool Pet::CreateBaseAtCreatureInfo(CreatureTemplate const* cinfo, Unit* owner) return true; } -bool Pet::CreateBaseAtTamed(CreatureTemplate const* cinfo, Map * map, uint32 phaseMask) +bool Pet::CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map, uint32 phaseMask) { sLog->outDebug(LOG_FILTER_PETS, "Pet::CreateBaseForTamed"); uint32 guid=sObjectMgr->GenerateLowGuid(HIGHGUID_PET); @@ -765,7 +765,7 @@ bool Pet::CreateBaseAtTamed(CreatureTemplate const* cinfo, Map * map, uint32 pha // TODO: Move stat mods code to pet passive auras bool Guardian::InitStatsForLevel(uint8 petlevel) { - CreatureTemplate const *cinfo = GetCreatureInfo(); + CreatureTemplate const* cinfo = GetCreatureInfo(); ASSERT(cinfo); SetLevel(petlevel); @@ -1044,7 +1044,7 @@ void Pet::_LoadSpellCooldowns() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 spell_id = fields[0].GetUInt32(); time_t db_time = time_t(fields[1].GetUInt32()); @@ -1100,7 +1100,7 @@ void Pet::_LoadSpells() { do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); addSpell(fields[0].GetUInt32(), ActiveStates(fields[1].GetUInt8()), PETSPELL_UNCHANGED); } @@ -1150,7 +1150,7 @@ void Pet::_LoadAuras(uint32 timediff) { int32 damage[3]; int32 baseDamage[3]; - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint64 caster_guid = fields[0].GetUInt64(); uint32 spellid = fields[1].GetUInt32(); uint8 effmask = fields[2].GetUInt8(); @@ -1217,7 +1217,7 @@ void Pet::_SaveAuras(SQLTransaction& trans) if (!itr->second->CanBeSaved() || IsPetAura(itr->second)) continue; - Aura * aura = itr->second; + Aura* aura = itr->second; int32 damage[MAX_SPELL_EFFECTS]; int32 baseDamage[MAX_SPELL_EFFECTS]; @@ -1250,7 +1250,7 @@ void Pet::_SaveAuras(SQLTransaction& trans) bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpellState state /*= PETSPELL_NEW*/, PetSpellType type /*= PETSPELL_NORMAL*/) { - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id); if (!spellInfo) { // do pet spell book cleanup @@ -1306,7 +1306,7 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe // talent: unlearn all other talent ranks (high and low) if (TalentSpellPos const* talentPos = GetTalentSpellPos(spell_id)) { - if (TalentEntry const *talentInfo = sTalentStore.LookupEntry(talentPos->talent_id)) + if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentPos->talent_id)) { for (uint8 i = 0; i < MAX_TALENT_RANK; ++i) { @@ -1395,7 +1395,7 @@ void Pet::InitLevelupSpellsForLevel() { uint8 level = getLevel(); - if (PetLevelupSpellSet const *levelupSpells = GetCreatureInfo()->family ? sSpellMgr->GetPetLevelupSpellList(GetCreatureInfo()->family) : NULL) + if (PetLevelupSpellSet const* levelupSpells = GetCreatureInfo()->family ? sSpellMgr->GetPetLevelupSpellList(GetCreatureInfo()->family) : NULL) { // PetLevelupSpellSet ordered by levels, process in reversed order for (PetLevelupSpellSet::const_reverse_iterator itr = levelupSpells->rbegin(); itr != levelupSpells->rend(); ++itr) @@ -1412,7 +1412,7 @@ void Pet::InitLevelupSpellsForLevel() int32 petSpellsId = GetCreatureInfo()->PetSpellDataId ? -(int32)GetCreatureInfo()->PetSpellDataId : GetEntry(); // default spells (can be not learned if pet level (as owner level decrease result for example) less first possible in normal game) - if (PetDefaultSpellsEntry const *defSpells = sSpellMgr->GetPetDefaultSpellsEntry(petSpellsId)) + if (PetDefaultSpellsEntry const* defSpells = sSpellMgr->GetPetDefaultSpellsEntry(petSpellsId)) { for (uint8 i = 0; i < MAX_CREATURE_SPELL_DATA_SLOT; ++i) { @@ -1525,7 +1525,7 @@ void Pet::InitPetCreateSpells() bool Pet::resetTalents() { - Unit *owner = GetOwner(); + Unit* owner = GetOwner(); if (!owner || owner->GetTypeId() != TYPEID_PLAYER) return false; @@ -1537,7 +1537,7 @@ bool Pet::resetTalents() if (!ci) return false; // Check pet talent type - CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(ci->family); + CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(ci->family); if (!pet_family || pet_family->petTalentType < 0) return false; @@ -1554,12 +1554,12 @@ bool Pet::resetTalents() for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i) { - TalentEntry const *talentInfo = sTalentStore.LookupEntry(i); + TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); if (!talentInfo) continue; - TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; @@ -1635,7 +1635,7 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/) do { - Field *fields = resultPets->Fetch(); + Field* fields = resultPets->Fetch(); uint32 id = fields[0].GetUInt32(); @@ -1653,7 +1653,7 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/) bool need_execute = false; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 spell = fields[0].GetUInt32(); @@ -1687,7 +1687,7 @@ void Pet::InitTalentForLevel() SetFreeTalentPoints(talentPointsForLevel - m_usedTalentCount); - Unit *owner = GetOwner(); + Unit* owner = GetOwner(); if (!owner || owner->GetTypeId() != TYPEID_PLAYER) return; @@ -1699,7 +1699,7 @@ uint8 Pet::GetMaxTalentPointsForLevel(uint8 level) { uint8 points = (level >= 20) ? ((level - 16) / 4) : 0; // Mod points from owner SPELL_AURA_MOD_PET_TALENT_POINTS - if (Unit *owner = GetOwner()) + if (Unit* owner = GetOwner()) points+=owner->GetTotalAuraModifier(SPELL_AURA_MOD_PET_TALENT_POINTS); return points; } @@ -1774,7 +1774,7 @@ bool Pet::IsPermanentPetFor(Player* owner) } } -bool Pet::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 pet_number) +bool Pet::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 pet_number) { ASSERT(map); SetMap(map); diff --git a/src/server/game/Entities/Pet/Pet.h b/src/server/game/Entities/Pet/Pet.h index 1d1d3ea5705..973e5e99bee 100755 --- a/src/server/game/Entities/Pet/Pet.h +++ b/src/server/game/Entities/Pet/Pet.h @@ -121,7 +121,7 @@ class Player; class Pet : public Guardian { public: - explicit Pet(Player *owner, PetType type = MAX_PET_TYPE); + explicit Pet(Player* owner, PetType type = MAX_PET_TYPE); virtual ~Pet(); void AddToWorld(); @@ -134,10 +134,10 @@ class Pet : public Guardian bool IsPermanentPetFor(Player* owner); // pet have tab in character windows and set UNIT_FIELD_PETNUMBER - bool Create (uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry, uint32 pet_number); + bool Create (uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 pet_number); bool CreateBaseAtCreature(Creature* creature); bool CreateBaseAtCreatureInfo(CreatureTemplate const* cinfo, Unit* owner); - bool CreateBaseAtTamed(CreatureTemplate const* cinfo, Map * map, uint32 phaseMask); + bool CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map, uint32 phaseMask); bool LoadPetFromDB(Player* owner, uint32 petentry = 0, uint32 petnumber = 0, bool current = false); bool isBeingLoaded() const { return m_loading;} void SavePetToDB(PetSaveMode mode); @@ -223,9 +223,9 @@ class Pet : public Guardian bool m_removed; // prevent overwrite pet state in DB at next Pet::Update if pet already removed(saved) - Player *GetOwner() { return m_owner; } + Player* GetOwner() { return m_owner; } protected: - Player *m_owner; + Player* m_owner; uint32 m_happinessTimer; PetType m_petType; int32 m_duration; // time until unsummon (used mostly for summoned guardians and not used for controlled pets) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 063127c77a9..8e75ca40f73 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -73,6 +73,7 @@ #include "CharacterDatabaseCleaner.h" #include "InstanceScript.h" #include <cmath> +#include "AccountMgr.h" #define ZONE_UPDATE_INTERVAL (1*IN_MILLISECONDS) @@ -445,7 +446,7 @@ inline void KillRewarder::_InitGroupData() if (_group) { // 2. In case when player is in group, initialize variables necessary for group calculations: - for (GroupReference *itr = _group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = _group->GetFirstMember(); itr != NULL; itr = itr->next()) if (Player* member = itr->getSource()) if (member->isAlive() && member->IsAtGroupRewardDistance(_victim)) { @@ -539,8 +540,13 @@ void KillRewarder::_RewardPlayer(Player* player, bool isDungeon) { // 4. Reward player. if (!_isBattleGround) + { // 4.1. Give honor (player must be alive and not on BG). _RewardHonor(player); + // 4.1.1 Send player killcredit for quests with PlayerSlain + if (_victim->GetTypeId() == TYPEID_PLAYER) + player->KilledPlayerCredit(); + } // Give XP only in PvE or in battlegrounds. // Give reputation and kill credit only in PvE. if (!_isPvP || _isBattleGround) @@ -582,7 +588,7 @@ void KillRewarder::_RewardGroup() } // 3.1.3. Reward each group member (even dead or corpse) within reward distance. - for (GroupReference *itr = _group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = _group->GetFirstMember(); itr != NULL; itr = itr->next()) if (Player* member = itr->getSource()) if (member->IsAtGroupRewardDistance(_victim)) _RewardPlayer(member, isDungeon); @@ -625,7 +631,7 @@ UpdateMask Player::updateVisualBits; #ifdef _MSC_VER #pragma warning(disable:4355) #endif -Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputationMgr(this) +Player::Player (WorldSession* session): Unit(), m_achievementMgr(this), m_reputationMgr(this) { #ifdef _MSC_VER #pragma warning(default:4355) @@ -649,7 +655,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa //m_pad = 0; // players always accept - if (GetSession()->GetSecurity() == SEC_PLAYER) + if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity())) SetAcceptWhispers(true); m_curSelection = 0; @@ -848,7 +854,7 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa isDebugAreaTriggers = false; - SetPendingBind(NULL, 0); + SetPendingBind(0, 0); } Player::~Player () @@ -991,7 +997,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo) ? sWorld->getIntConfig(CONFIG_START_PLAYER_LEVEL) : sWorld->getIntConfig(CONFIG_START_HEROIC_PLAYER_LEVEL); - if (GetSession()->GetSecurity() >= SEC_MODERATOR) + if (!AccountMgr::IsPlayerAccount(GetSession()->GetSecurity())) { uint32 gm_level = sWorld->getIntConfig(CONFIG_START_GM_LEVEL); if (gm_level > start_level) @@ -1542,7 +1548,7 @@ void Player::Update(uint32 p_time) UpdateAfkReport(now); if (isCharmed()) - if (Unit *charmer = GetCharmer()) + if (Unit* charmer = GetCharmer()) if (charmer->GetTypeId() == TYPEID_UNIT && charmer->isAlive()) UpdateCharmedAI(); @@ -1579,7 +1585,7 @@ void Player::Update(uint32 p_time) if (HasUnitState(UNIT_STAT_MELEE_ATTACKING) && !HasUnitState(UNIT_STAT_CASTING)) { - if (Unit *pVictim = getVictim()) + if (Unit* pVictim = getVictim()) { // default combat reach 10 // TODO add weapon, skill check @@ -1638,8 +1644,8 @@ void Player::Update(uint32 p_time) } } - /*Unit *owner = pVictim->GetOwner(); - Unit *u = owner ? owner : pVictim; + /*Unit* owner = pVictim->GetOwner(); + Unit* u = owner ? owner : pVictim; if (u->IsPvP() && (!duel || duel->opponent != u)) { UpdatePvP(true); @@ -1748,16 +1754,16 @@ void Player::Update(uint32 p_time) if (_pendingBindTimer <= p_time) { // Player left the instance - if (_pendingBind->GetInstanceId() == GetInstanceId()) + if (_pendingBindId == GetInstanceId()) BindToInstance(); - SetPendingBind(NULL, 0); + SetPendingBind(0, 0); } else _pendingBindTimer -= p_time; } // not auto-free ghost from body in instances - if (m_deathTimer > 0 && !GetBaseMap()->Instanceable() && !HasAuraType(SPELL_AURA_PREVENT_RESSURECTION)) + if (m_deathTimer > 0 && !GetBaseMap()->Instanceable() && !HasAuraType(SPELL_AURA_PREVENT_RESURRECTION)) { if (p_time >= m_deathTimer) { @@ -1855,14 +1861,14 @@ bool Player::BuildEnumData(QueryResult result, WorldPacket* data) // 15 16 17 18 19 20 21 // "characters.at_login, character_pet.entry, character_pet.modelid, character_pet.level, characters.data, character_banned.guid, character_declinedname.genitive " - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); uint8 plrRace = fields[2].GetUInt8(); uint8 plrClass = fields[3].GetUInt8(); uint8 gender = fields[4].GetUInt8(); - PlayerInfo const *info = sObjectMgr->GetPlayerInfo(plrRace, plrClass); + PlayerInfo const* info = sObjectMgr->GetPlayerInfo(plrRace, plrClass); if (!info) { sLog->outError("Player %u has incorrect race/class pair. Don't build enum.", guid); @@ -1971,7 +1977,7 @@ bool Player::BuildEnumData(QueryResult result, WorldPacket* data) continue; } - SpellItemEnchantmentEntry const *enchant = NULL; + SpellItemEnchantmentEntry const* enchant = NULL; uint32 enchants = GetUInt32ValueFromArray(equipment, visualBase + 1); for (uint8 enchantSlot = PERM_ENCHANTMENT_SLOT; enchantSlot <= TEMP_ENCHANTMENT_SLOT; ++enchantSlot) @@ -2050,7 +2056,7 @@ void Player::SendTeleportAckPacket() } // this is not used anywhere -void Player::TeleportOutOfMap(Map *oldMap) +void Player::TeleportOutOfMap(Map* oldMap) { while (IsBeingTeleportedFar()) GetSession()->HandleMoveWorldportAckOpcode(); @@ -2080,7 +2086,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati return false; } - if ((GetSession()->GetSecurity() < SEC_GAMEMASTER) && sDisableMgr->IsDisabledFor(DISABLE_TYPE_MAP, mapid, this)) + if (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, mapid, this)) { sLog->outError("Player (GUID: %u, name: %s) tried to enter a forbidden map %u", GetGUIDLow(), GetName(), mapid); SendTransferAborted(mapid, TRANSFER_ABORT_MAP_NOT_ALLOWED); @@ -2200,9 +2206,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if (!sMapMgr->CanPlayerEnter(mapid, this, false)) return false; - // If the map is not created, assume it is possible to enter it. - // It will be created in the WorldPortAck. - Map *map = sMapMgr->FindMap(mapid); + Map* map = sMapMgr->CreateMap(mapid, this, 0); if (!map || map->CanEnter(this)) { //lets reset near teleport flag if it wasn't reset during chained teleports @@ -2320,8 +2324,12 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati bool Player::TeleportToBGEntryPoint() { + if (m_bgData.joinPos.m_mapId == MAPID_INVALID) + return false; + ScheduleDelayedOperation(DELAYED_BG_MOUNT_RESTORE); ScheduleDelayedOperation(DELAYED_BG_TAXI_RESTORE); + ScheduleDelayedOperation(DELAYED_BG_GROUP_RESTORE); return TeleportTo(m_bgData.joinPos); } @@ -2376,7 +2384,13 @@ void Player::ProcessDelayedOperations() ContinueTaxiFlight(); } } - + + if (m_DelayedOperations & DELAYED_BG_GROUP_RESTORE) + { + if (Group *g = GetGroup()) + g->SendUpdateToPlayer(GetGUID()); + } + //we have executed ALL delayed ops, so clear the flag m_DelayedOperations = 0; } @@ -2421,7 +2435,7 @@ void Player::RemoveFromWorld() if (m_uint32Values) { - if (WorldObject *viewpoint = GetViewpoint()) + if (WorldObject* viewpoint = GetViewpoint()) { sLog->outCrash("Player %s has viewpoint %u %u when removed from world", GetName(), viewpoint->GetEntry(), viewpoint->GetTypeId()); SetViewpoint(viewpoint, false); @@ -2723,7 +2737,7 @@ Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask) GameObject* Player::GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes type) const { - if (GameObject *go = GetMap()->GetGameObject(guid)) + if (GameObject* go = GetMap()->GetGameObject(guid)) { if (go->GetGoType() == type) { @@ -3111,7 +3125,7 @@ void Player::InitTalentForLevel() // if used more that have then reset if (m_usedTalentCount > talentPointsForLevel) { - if (GetSession()->GetSecurity() < SEC_ADMINISTRATOR) + if (!AccountMgr::IsAdminAccount(GetSession()->GetSecurity())) resetTalents(true); else SetFreeTalentPoints(0); @@ -3319,7 +3333,7 @@ void Player::SendInitialSpells() data << uint16(spellCooldowns); for (SpellCooldowns::const_iterator itr=m_spellCooldowns.begin(); itr != m_spellCooldowns.end(); ++itr) { - SpellInfo const *sEntry = sSpellMgr->GetSpellInfo(itr->first); + SpellInfo const* sEntry = sSpellMgr->GetSpellInfo(itr->first); if (!sEntry) continue; @@ -3427,7 +3441,7 @@ void Player::AddNewMailDeliverTime(time_t deliver_time) bool Player::AddTalent(uint32 spell_id, uint8 spec, bool learning) { - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id); if (!spellInfo) { // do character spell book cleanup (all characters) @@ -3459,9 +3473,9 @@ bool Player::AddTalent(uint32 spell_id, uint8 spec, bool learning) PlayerTalentMap::iterator itr = m_talents[spec]->find(spell_id); if (itr != m_talents[spec]->end()) itr->second->state = PLAYERSPELL_UNCHANGED; - else if (TalentSpellPos const *talentPos = GetTalentSpellPos(spell_id)) + else if (TalentSpellPos const* talentPos = GetTalentSpellPos(spell_id)) { - if (TalentEntry const *talentInfo = sTalentStore.LookupEntry(talentPos->talent_id)) + if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentPos->talent_id)) { for (uint8 rank = 0; rank < MAX_TALENT_RANK; ++rank) { @@ -3477,7 +3491,7 @@ bool Player::AddTalent(uint32 spell_id, uint8 spec, bool learning) } PlayerSpellState state = learning ? PLAYERSPELL_NEW : PLAYERSPELL_UNCHANGED; - PlayerTalent *newtalent = new PlayerTalent(); + PlayerTalent* newtalent = new PlayerTalent(); newtalent->state = state; newtalent->spec = spec; @@ -3490,7 +3504,7 @@ bool Player::AddTalent(uint32 spell_id, uint8 spec, bool learning) bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependent, bool disabled, bool loading /*=false*/) { - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id); if (!spellInfo) { // do character spell book cleanup (all characters) @@ -3638,9 +3652,9 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen if (!disabled_case) // skip new spell adding if spell already known (disabled spells case) { // talent: unlearn all other talent ranks (high and low) - if (TalentSpellPos const *talentPos = GetTalentSpellPos(spell_id)) + if (TalentSpellPos const* talentPos = GetTalentSpellPos(spell_id)) { - if (TalentEntry const *talentInfo = sTalentStore.LookupEntry(talentPos->talent_id)) + if (TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentPos->talent_id)) { for (uint8 rank = 0; rank < MAX_TALENT_RANK; ++rank) { @@ -3662,7 +3676,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen learnSpell(prev_spell, true); } - PlayerSpell *newspell = new PlayerSpell; + PlayerSpell* newspell = new PlayerSpell; newspell->state = state; newspell->active = active; newspell->dependent = dependent; @@ -3674,7 +3688,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen for (PlayerSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2) { if (itr2->second->state == PLAYERSPELL_REMOVED) continue; - SpellInfo const *i_spellInfo = sSpellMgr->GetSpellInfo(itr2->first); + SpellInfo const* i_spellInfo = sSpellMgr->GetSpellInfo(itr2->first); if (!i_spellInfo) continue; if (spellInfo->IsDifferentRankOf(i_spellInfo)) @@ -3782,7 +3796,7 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen // not ranked skills for (SkillLineAbilityMap::const_iterator _spell_idx = skill_bounds.first; _spell_idx != skill_bounds.second; ++_spell_idx) { - SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(_spell_idx->second->skillId); + SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(_spell_idx->second->skillId); if (!pSkill) continue; @@ -3854,7 +3868,7 @@ void Player::AddTemporarySpell(uint32 spellId) // spell already added - do not do anything if (itr != m_spells.end()) return; - PlayerSpell *newspell = new PlayerSpell; + PlayerSpell* newspell = new PlayerSpell; newspell->state = PLAYERSPELL_TEMPORARY; newspell->active = true; newspell->dependent = false; @@ -3976,7 +3990,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) // remove pet auras for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (PetAura const *petSpell = sSpellMgr->GetPetAura(spell_id, i)) + if (PetAura const* petSpell = sSpellMgr->GetPetAura(spell_id, i)) RemovePetAura(petSpell); // free talent points @@ -3999,7 +4013,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) } // remove dependent skill - SpellLearnSkillNode const *spellLearnSkill = sSpellMgr->GetSpellLearnSkill(spell_id); + SpellLearnSkillNode const* spellLearnSkill = sSpellMgr->GetSpellLearnSkill(spell_id); if (spellLearnSkill) { uint32 prev_spell = sSpellMgr->GetPrevSpellInChain(spell_id); @@ -4008,7 +4022,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) else { // search prev. skill setting by spell ranks chain - SpellLearnSkillNode const *prevSkill = sSpellMgr->GetSpellLearnSkill(prev_spell); + SpellLearnSkillNode const* prevSkill = sSpellMgr->GetSpellLearnSkill(prev_spell); while (!prevSkill && prev_spell) { prev_spell = sSpellMgr->GetPrevSpellInChain(prev_spell); @@ -4042,7 +4056,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) for (SkillLineAbilityMap::const_iterator _spell_idx = bounds.first; _spell_idx != bounds.second; ++_spell_idx) { - SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(_spell_idx->second->skillId); + SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(_spell_idx->second->skillId); if (!pSkill) continue; @@ -4062,7 +4076,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) // most likely will never be used, haven't heard of cases where players unlearn a mount if (Has310Flyer(false) && _spell_idx->second->skillId == SKILL_MOUNTS) { - SpellInfo const *pSpellInfo = sSpellMgr->GetSpellInfo(spell_id); + SpellInfo const* pSpellInfo = sSpellMgr->GetSpellInfo(spell_id); for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) if (pSpellInfo->Effects[i].ApplyAuraName == SPELL_AURA_MOD_INCREASE_MOUNTED_FLIGHT_SPEED && pSpellInfo->Effects[i].CalcValue() == 310) @@ -4082,7 +4096,7 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank) if (uint32 prev_id = sSpellMgr->GetPrevSpellInChain(spell_id)) { - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id); // if talent then lesser rank also talent and need learn if (talentCosts) @@ -4146,7 +4160,7 @@ bool Player::Has310Flyer(bool checkAllSpells, uint32 excludeSpellId) else { SetHas310Flyer(false); - SpellInfo const *pSpellInfo; + SpellInfo const* pSpellInfo; for (PlayerSpellMap::iterator itr = m_spells.begin(); itr != m_spells.end(); ++itr) { if (itr->first == excludeSpellId) @@ -4228,7 +4242,7 @@ void Player::RemoveArenaSpellCooldowns(bool removeActivePetCooldowns) // pet cooldowns if (removeActivePetCooldowns) - if (Pet *pet = GetPet()) + if (Pet* pet = GetPet()) { // notify player for (CreatureSpellCooldowns::const_iterator itr = pet->m_CreatureSpellCooldowns.begin(); itr != pet->m_CreatureSpellCooldowns.end(); ++itr) @@ -4254,7 +4268,7 @@ void Player::_LoadSpellCooldowns(PreparedQueryResult result) { // some cooldowns can be already set at aura loading... - //QueryResult *result = CharacterDatabase.PQuery("SELECT spell, item, time FROM character_spell_cooldown WHERE guid = '%u'", GetGUIDLow()); + //QueryResult* result = CharacterDatabase.PQuery("SELECT spell, item, time FROM character_spell_cooldown WHERE guid = '%u'", GetGUIDLow()); if (result) { @@ -4388,12 +4402,12 @@ bool Player::resetTalents(bool no_cost) for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i) { - TalentEntry const *talentInfo = sTalentStore.LookupEntry(i); + TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); if (!talentInfo) continue; - TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; @@ -4410,7 +4424,7 @@ bool Player::resetTalents(bool no_cost) if (talentInfo->RankID[rank] == 0) continue; removeSpell(talentInfo->RankID[rank], true); - if (const SpellInfo *_spellEntry = sSpellMgr->GetSpellInfo(talentInfo->RankID[rank])) + if (const SpellInfo* _spellEntry = sSpellMgr->GetSpellInfo(talentInfo->RankID[rank])) for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) // search through the SpellInfo for valid trigger spells if (_spellEntry->Effects[i].TriggerSpell > 0 && _spellEntry->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL) removeSpell(_spellEntry->Effects[i].TriggerSpell, true); // and remove any spells that the talent teaches @@ -4464,7 +4478,7 @@ Mail* Player::GetMail(uint32 id) return NULL; } -void Player::_SetCreateBits(UpdateMask *updateMask, Player *target) const +void Player::_SetCreateBits(UpdateMask* updateMask, Player* target) const { if (target == this) Object::_SetCreateBits(updateMask, target); @@ -4476,7 +4490,7 @@ void Player::_SetCreateBits(UpdateMask *updateMask, Player *target) const } } -void Player::_SetUpdateBits(UpdateMask *updateMask, Player *target) const +void Player::_SetUpdateBits(UpdateMask* updateMask, Player* target) const { if (target == this) Object::_SetUpdateBits(updateMask, target); @@ -4577,7 +4591,7 @@ void Player::InitVisibleBits() updateVisualBits.SetBit(PLAYER_CHOSEN_TITLE); } -void Player::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const +void Player::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const { for (uint8 i = 0; i < EQUIPMENT_SLOT_END; ++i) { @@ -4608,7 +4622,7 @@ void Player::BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) c Unit::BuildCreateUpdateBlockForPlayer(data, target); } -void Player::DestroyForPlayer(Player *target, bool anim) const +void Player::DestroyForPlayer(Player* target, bool anim) const { Unit::DestroyForPlayer(target, anim); @@ -4787,7 +4801,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC { do { - Field *fields = resultMail->Fetch(); + Field* fields = resultMail->Fetch(); uint32 mail_id = fields[0].GetUInt32(); uint16 mailType = fields[1].GetUInt16(); @@ -4837,7 +4851,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC continue; } - Item *pItem = NewItemOrBag(itemProto); + Item* pItem = NewItemOrBag(itemProto); if (!pItem->LoadFromDB(item_guidlow, MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER), fields, item_template)) { pItem->FSetState(ITEM_REMOVED); @@ -4976,7 +4990,7 @@ void Player::DeleteOldCharacters(uint32 keepDays) sLog->outString("Player::DeleteOldChars: Found " UI64FMTD " character(s) to delete", resultChars->GetRowCount()); do { - Field *charFields = resultChars->Fetch(); + Field* charFields = resultChars->Fetch(); Player::DeleteFromDB(charFields[0].GetUInt64(), charFields[1].GetUInt32(), true, true); } while(resultChars->NextRow()); } @@ -5027,7 +5041,7 @@ void Player::BuildPlayerRepop() // create a corpse and place it at the player's location CreateCorpse(); - Corpse *corpse = GetCorpse(); + Corpse* corpse = GetCorpse(); if (!corpse) { sLog->outError("Error creating corpse for Player %s [%u]", GetName(), GetGUIDLow()); @@ -5128,7 +5142,7 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness) { int32 delta = (int32(getLevel()) - startLevel + 1)*MINUTE; - if (Aura * aur = GetAura(15007, GetGUID())) + if (Aura* aur = GetAura(15007, GetGUID())) { aur->SetDuration(delta*IN_MILLISECONDS); } @@ -5182,7 +5196,7 @@ void Player::KillPlayer() //SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_IN_PVP); SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE); - ApplyModFlag(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTE_RELEASE_TIMER, !sMapStore.LookupEntry(GetMapId())->Instanceable() && !HasAuraType(SPELL_AURA_PREVENT_RESSURECTION)); + ApplyModFlag(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTE_RELEASE_TIMER, !sMapStore.LookupEntry(GetMapId())->Instanceable() && !HasAuraType(SPELL_AURA_PREVENT_RESURRECTION)); // 6 minutes until repop at graveyard m_deathTimer = 6 * MINUTE * IN_MILLISECONDS; @@ -5203,7 +5217,7 @@ void Player::CreateCorpse() uint32 _uf, _pb, _pb2, _cfb1, _cfb2; - Corpse *corpse = new Corpse((m_ExtraFlags & PLAYER_EXTRA_PVP_DEATH) ? CORPSE_RESURRECTABLE_PVP : CORPSE_RESURRECTABLE_PVE); + Corpse* corpse = new Corpse((m_ExtraFlags & PLAYER_EXTRA_PVP_DEATH) ? CORPSE_RESURRECTABLE_PVP : CORPSE_RESURRECTABLE_PVE); SetPvPDeath(false); if (!corpse->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_CORPSE), this)) @@ -5280,7 +5294,7 @@ Corpse* Player::GetCorpse() const void Player::DurabilityLossAll(double percent, bool inventory) { for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++) - if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) DurabilityLoss(pItem, percent); if (inventory) @@ -5289,7 +5303,7 @@ void Player::DurabilityLossAll(double percent, bool inventory) // for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) - if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) DurabilityLoss(pItem, percent); // keys not have durability @@ -5324,7 +5338,7 @@ void Player::DurabilityLoss(Item* item, double percent) void Player::DurabilityPointsLossAll(int32 points, bool inventory) { for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; i++) - if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) DurabilityPointsLoss(pItem, points); if (inventory) @@ -5333,7 +5347,7 @@ void Player::DurabilityPointsLossAll(int32 points, bool inventory) // for (int i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; i++) - if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) DurabilityPointsLoss(pItem, points); // keys not have durability @@ -5376,7 +5390,7 @@ void Player::DurabilityPointsLoss(Item* item, int32 points) void Player::DurabilityPointLossForEquipSlot(EquipmentSlots slot) { - if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, slot)) DurabilityPointsLoss(pItem, 1); } @@ -5415,9 +5429,9 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g uint32 LostDurability = maxDurability - curDurability; if (LostDurability>0) { - ItemTemplate const *ditemProto = item->GetTemplate(); + ItemTemplate const* ditemProto = item->GetTemplate(); - DurabilityCostsEntry const *dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel); + DurabilityCostsEntry const* dcost = sDurabilityCostsStore.LookupEntry(ditemProto->ItemLevel); if (!dcost) { sLog->outError("RepairDurability: Wrong item lvl %u", ditemProto->ItemLevel); @@ -5425,7 +5439,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g } uint32 dQualitymodEntryId = (ditemProto->Quality+1)*2; - DurabilityQualityEntry const *dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId); + DurabilityQualityEntry const* dQualitymodEntry = sDurabilityQualityStore.LookupEntry(dQualitymodEntryId); if (!dQualitymodEntry) { sLog->outError("RepairDurability: Wrong dQualityModEntry %u", dQualitymodEntryId); @@ -5448,7 +5462,7 @@ uint32 Player::DurabilityRepair(uint16 pos, bool cost, float discountMod, bool g return TotalCost; } - Guild *pGuild = sGuildMgr->GetGuildById(GetGuildId()); + Guild* pGuild = sGuildMgr->GetGuildById(GetGuildId()); if (!pGuild) return TotalCost; @@ -5481,7 +5495,7 @@ void Player::RepopAtGraveyard() // note: this can be called also when the player is alive // for example from WorldSession::HandleMovementOpcodes - AreaTableEntry const *zone = GetAreaEntryByAreaID(GetAreaId()); + AreaTableEntry const* zone = GetAreaEntryByAreaID(GetAreaId()); // Such zones are considered unreachable as a ghost and the player must be automatically revived if ((!isAlive() && zone && zone->flags & AREA_FLAG_NEED_FLY) || GetTransport() || GetPositionZ() < -500.0f) @@ -5490,10 +5504,10 @@ void Player::RepopAtGraveyard() SpawnCorpseBones(); } - WorldSafeLocsEntry const *ClosestGrave = NULL; + WorldSafeLocsEntry const* ClosestGrave = NULL; // Special handle for battleground maps - if (Battleground *bg = GetBattleground()) + if (Battleground* bg = GetBattleground()) ClosestGrave = bg->GetClosestGraveYard(this); else ClosestGrave = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam()); @@ -5534,12 +5548,12 @@ bool Player::CanJoinConstantChannelInZone(ChatChannelsEntry const* channel, Area return true; } -void Player::JoinedChannel(Channel *c) +void Player::JoinedChannel(Channel* c) { m_channels.push_back(c); } -void Player::LeftChannel(Channel *c) +void Player::LeftChannel(Channel* c) { m_channels.remove(c); } @@ -5740,8 +5754,8 @@ float Player::GetMeleeCritFromAgility() if (level > GT_MAX_LEVEL) level = GT_MAX_LEVEL; - GtChanceToMeleeCritBaseEntry const *critBase = sGtChanceToMeleeCritBaseStore.LookupEntry(pclass-1); - GtChanceToMeleeCritEntry const *critRatio = sGtChanceToMeleeCritStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); + GtChanceToMeleeCritBaseEntry const* critBase = sGtChanceToMeleeCritBaseStore.LookupEntry(pclass-1); + GtChanceToMeleeCritEntry const* critRatio = sGtChanceToMeleeCritStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); if (critBase == NULL || critRatio == NULL) return 0.0f; @@ -5749,35 +5763,37 @@ float Player::GetMeleeCritFromAgility() return crit*100.0f; } -float Player::GetDodgeFromAgility() +void Player::GetDodgeFromAgility(float &diminishing, float &nondiminishing) { // Table for base dodge values - float dodge_base[MAX_CLASSES] = { - 0.0075f, // Warrior - 0.00652f, // Paladin - -0.0545f, // Hunter - -0.0059f, // Rogue - 0.03183f, // Priest - 0.0114f, // DK - 0.0167f, // Shaman - 0.034575f, // Mage - 0.02011f, // Warlock + const float dodge_base[MAX_CLASSES] = + { + 0.036640f, // Warrior + 0.034943f, // Paladi + -0.040873f, // Hunter + 0.020957f, // Rogue + 0.034178f, // Priest + 0.036640f, // DK + 0.021080f, // Shaman + 0.036587f, // Mage + 0.024211f, // Warlock 0.0f, // ?? - -0.0187f // Druid + 0.056097f // Druid }; - // Crit/agility to dodge/agility coefficient multipliers - float crit_to_dodge[MAX_CLASSES] = { - 1.1f, // Warrior - 1.0f, // Paladin - 1.6f, // Hunter - 2.0f, // Rogue - 1.0f, // Priest - 1.0f, // DK? - 1.0f, // Shaman - 1.0f, // Mage - 1.0f, // Warlock - 0.0f, // ?? - 1.7f // Druid + // Crit/agility to dodge/agility coefficient multipliers; 3.2.0 increased required agility by 15% + const float crit_to_dodge[MAX_CLASSES] = + { + 0.85f/1.15f, // Warrior + 1.00f/1.15f, // Paladin + 1.11f/1.15f, // Hunter + 2.00f/1.15f, // Rogue + 1.00f/1.15f, // Priest + 0.85f/1.15f, // DK + 1.60f/1.15f, // Shaman + 1.00f/1.15f, // Mage + 0.97f/1.15f, // Warlock (?) + 0.0f, // ?? + 2.00f/1.15f // Druid }; uint8 level = getLevel(); @@ -5786,13 +5802,18 @@ float Player::GetDodgeFromAgility() if (level > GT_MAX_LEVEL) level = GT_MAX_LEVEL; - // Dodge per agility for most classes equal crit per agility (but for some classes need apply some multiplier) - GtChanceToMeleeCritEntry const *dodgeRatio = sGtChanceToMeleeCritStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); + // Dodge per agility is proportional to crit per agility, which is available from DBC files + GtChanceToMeleeCritEntry const* dodgeRatio = sGtChanceToMeleeCritStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); if (dodgeRatio == NULL || pclass > MAX_CLASSES) - return 0.0f; + return; - float dodge=dodge_base[pclass-1] + GetStat(STAT_AGILITY) * dodgeRatio->ratio * crit_to_dodge[pclass-1]; - return dodge*100.0f; + // TODO: research if talents/effects that increase total agility by x% should increase non-diminishing part + float base_agility = GetCreateStat(STAT_AGILITY) * m_auraModifiersGroup[UNIT_MOD_STAT_START + STAT_AGILITY][BASE_PCT]; + float bonus_agility = GetStat(STAT_AGILITY) - base_agility; + + // calculate diminishing (green in char screen) and non-diminishing (white) contribution + diminishing = 100.0f * bonus_agility * dodgeRatio->ratio * crit_to_dodge[pclass-1]; + nondiminishing = 100.0f * (dodge_base[pclass-1] + base_agility * dodgeRatio->ratio * crit_to_dodge[pclass-1]); } float Player::GetSpellCritFromIntellect() @@ -5803,8 +5824,8 @@ float Player::GetSpellCritFromIntellect() if (level > GT_MAX_LEVEL) level = GT_MAX_LEVEL; - GtChanceToSpellCritBaseEntry const *critBase = sGtChanceToSpellCritBaseStore.LookupEntry(pclass-1); - GtChanceToSpellCritEntry const *critRatio = sGtChanceToSpellCritStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); + GtChanceToSpellCritBaseEntry const* critBase = sGtChanceToSpellCritBaseStore.LookupEntry(pclass-1); + GtChanceToSpellCritEntry const* critRatio = sGtChanceToSpellCritStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); if (critBase == NULL || critRatio == NULL) return 0.0f; @@ -5819,9 +5840,9 @@ float Player::GetRatingMultiplier(CombatRating cr) const if (level > GT_MAX_LEVEL) level = GT_MAX_LEVEL; - GtCombatRatingsEntry const *Rating = sGtCombatRatingsStore.LookupEntry(cr*GT_MAX_LEVEL+level-1); + GtCombatRatingsEntry const* Rating = sGtCombatRatingsStore.LookupEntry(cr*GT_MAX_LEVEL+level-1); // gtOCTClassCombatRatingScalarStore.dbc starts with 1, CombatRating with zero, so cr+1 - GtOCTClassCombatRatingScalarEntry const *classRating = sGtOCTClassCombatRatingScalarStore.LookupEntry((getClass()-1)*GT_MAX_RATING+cr+1); + GtOCTClassCombatRatingScalarEntry const* classRating = sGtOCTClassCombatRatingScalarStore.LookupEntry((getClass()-1)*GT_MAX_RATING+cr+1); if (!Rating || !classRating) return 1.0f; // By default use minimum coefficient (not must be called) @@ -5855,8 +5876,8 @@ float Player::OCTRegenHPPerSpirit() if (level > GT_MAX_LEVEL) level = GT_MAX_LEVEL; - GtOCTRegenHPEntry const *baseRatio = sGtOCTRegenHPStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); - GtRegenHPPerSptEntry const *moreRatio = sGtRegenHPPerSptStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); + GtOCTRegenHPEntry const* baseRatio = sGtOCTRegenHPStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); + GtRegenHPPerSptEntry const* moreRatio = sGtRegenHPPerSptStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); if (baseRatio == NULL || moreRatio == NULL) return 0.0f; @@ -5878,8 +5899,8 @@ float Player::OCTRegenMPPerSpirit() if (level > GT_MAX_LEVEL) level = GT_MAX_LEVEL; -// GtOCTRegenMPEntry const *baseRatio = sGtOCTRegenMPStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); - GtRegenMPPerSptEntry const *moreRatio = sGtRegenMPPerSptStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); +// GtOCTRegenMPEntry const* baseRatio = sGtOCTRegenMPStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); + GtRegenMPPerSptEntry const* moreRatio = sGtRegenMPPerSptStore.LookupEntry((pclass-1)*GT_MAX_LEVEL + level-1); if (moreRatio == NULL) return 0.0f; @@ -6018,10 +6039,10 @@ void Player::SetRegularAttackTime() { for (uint8 i = 0; i < MAX_ATTACK; ++i) { - Item *tmpitem = GetWeaponForAttack(WeaponAttackType(i), true); + Item* tmpitem = GetWeaponForAttack(WeaponAttackType(i), true); if (tmpitem && !tmpitem->IsBroken()) { - ItemTemplate const *proto = tmpitem->GetTemplate(); + ItemTemplate const* proto = tmpitem->GetTemplate(); if (proto->Delay) SetAttackTime(WeaponAttackType(i), proto->Delay); } @@ -6214,7 +6235,7 @@ bool Player::UpdateSkillPro(uint16 SkillId, int32 Chance, uint32 step) void Player::UpdateWeaponSkill (WeaponAttackType attType) { // no skill gain in pvp - Unit *pVictim = getVictim(); + Unit* pVictim = getVictim(); if (pVictim && pVictim->GetTypeId() == TYPEID_PLAYER) return; @@ -6233,7 +6254,7 @@ void Player::UpdateWeaponSkill (WeaponAttackType attType) { case BASE_ATTACK: { - Item *tmpitem = GetWeaponForAttack(attType, true); + Item* tmpitem = GetWeaponForAttack(attType, true); if (!tmpitem) UpdateSkill(SKILL_UNARMED, weapon_skill_gain); @@ -6244,7 +6265,7 @@ void Player::UpdateWeaponSkill (WeaponAttackType attType) case OFF_ATTACK: case RANGED_ATTACK: { - Item *tmpitem = GetWeaponForAttack(attType, true); + Item* tmpitem = GetWeaponForAttack(attType, true); if (tmpitem) UpdateSkill(tmpitem->GetSkill(), weapon_skill_gain); break; @@ -6255,7 +6276,7 @@ void Player::UpdateWeaponSkill (WeaponAttackType attType) UpdateAllCritPercentages(); } -void Player::UpdateCombatSkills(Unit *pVictim, WeaponAttackType attType, bool defence) +void Player::UpdateCombatSkills(Unit* pVictim, WeaponAttackType attType, bool defence) { uint8 plevel = getLevel(); // if defense than pVictim == attacker uint8 greylevel = Trinity::XP::GetGrayLevel(plevel); @@ -6323,7 +6344,7 @@ void Player::UpdateSkillsForLevel() continue; uint32 pskill = itr->first; - SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(pskill); + SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(pskill); if (!pSkill) continue; @@ -6429,7 +6450,7 @@ void Player::SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal) // remove all spells that related to this skill for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) - if (SkillLineAbilityEntry const *pAbility = sSkillLineAbilityStore.LookupEntry(j)) + if (SkillLineAbilityEntry const* pAbility = sSkillLineAbilityStore.LookupEntry(j)) if (pAbility->skillId == id) removeSpell(sSpellMgr->GetFirstSpellInChain(pAbility->spellId)); } @@ -6440,7 +6461,7 @@ void Player::SetSkill(uint16 id, uint16 step, uint16 newVal, uint16 maxVal) for (int i=0; i < PLAYER_MAX_SKILLS; ++i) if (!GetUInt32Value(PLAYER_SKILL_INDEX(i))) { - SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(id); + SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(id); if (!pSkill) { sLog->outError("Skill not found in SkillLineStore: skill #%u", id); @@ -6747,7 +6768,7 @@ void Player::SaveRecallPosition() m_recallO = GetOrientation(); } -void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self) +void Player::SendMessageToSetInRange(WorldPacket* data, float dist, bool self) { if (self) GetSession()->SendPacket(data); @@ -6756,7 +6777,7 @@ void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self) VisitNearbyWorldObject(dist, notifier); } -void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self, bool own_team_only) +void Player::SendMessageToSetInRange(WorldPacket* data, float dist, bool self, bool own_team_only) { if (self) GetSession()->SendPacket(data); @@ -6765,7 +6786,7 @@ void Player::SendMessageToSetInRange(WorldPacket *data, float dist, bool self, b VisitNearbyWorldObject(dist, notifier); } -void Player::SendMessageToSet(WorldPacket *data, Player const* skipped_rcvr) +void Player::SendMessageToSet(WorldPacket* data, Player const* skipped_rcvr) { if (skipped_rcvr != this) GetSession()->SendPacket(data); @@ -6776,7 +6797,7 @@ void Player::SendMessageToSet(WorldPacket *data, Player const* skipped_rcvr) VisitNearbyWorldObject(GetVisibilityRange(), notifier); } -void Player::SendDirectMessage(WorldPacket *data) +void Player::SendDirectMessage(WorldPacket* data) { m_session->SendPacket(data); } @@ -6828,7 +6849,7 @@ void Player::CheckAreaExploreAndOutdoor() GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA); - AreaTableEntry const *p = GetAreaEntryByAreaFlagAndMap(areaFlag, GetMapId()); + AreaTableEntry const* p = GetAreaEntryByAreaFlagAndMap(areaFlag, GetMapId()); if (!p) { sLog->outError("PLAYER: Player %u discovered unknown area (x: %f y: %f map: %u", GetGUIDLow(), GetPositionX(), GetPositionY(), GetMapId()); @@ -6933,7 +6954,7 @@ int32 Player::CalculateReputationGain(uint32 creatureOrQuestLevel, int32 rep, in } //Calculates how many reputation points player gains in victim's enemy factions -void Player::RewardReputation(Unit *pVictim, float rate) +void Player::RewardReputation(Unit* pVictim, float rate) { if (!pVictim || pVictim->GetTypeId() == TYPEID_PLAYER) return; @@ -6952,13 +6973,13 @@ void Player::RewardReputation(Unit *pVictim, float rate) { // support for: Championing - http://www.wowwiki.com/Championing - Map const *pMap = GetMap(); + Map const* pMap = GetMap(); if (pMap && pMap->IsDungeon()) { - InstanceTemplate const *pInstance = sObjectMgr->GetInstanceTemplate(pMap->GetId()); + InstanceTemplate const* pInstance = sObjectMgr->GetInstanceTemplate(pMap->GetId()); if (pInstance) { - AccessRequirement const *pAccessRequirement = sObjectMgr->GetAccessRequirement(pMap->GetId(), ((InstanceMap*)pMap)->GetDifficulty()); + AccessRequirement const* pAccessRequirement = sObjectMgr->GetAccessRequirement(pMap->GetId(), ((InstanceMap*)pMap)->GetDifficulty()); if (pAccessRequirement) { if (!pMap->IsRaid() && pAccessRequirement->levelMin == 80) @@ -6989,7 +7010,7 @@ void Player::RewardReputation(Unit *pVictim, float rate) if (recruitAFriend) donerep1 = int32(donerep1 * (1 + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS))); - FactionEntry const *factionEntry1 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->repfaction1); + FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->repfaction1); uint32 current_reputation_rank1 = GetReputationMgr().GetRank(factionEntry1); if (factionEntry1 && current_reputation_rank1 <= Rep->reputation_max_cap1) GetReputationMgr().ModifyReputation(factionEntry1, donerep1); @@ -7003,7 +7024,7 @@ void Player::RewardReputation(Unit *pVictim, float rate) if (recruitAFriend) donerep2 = int32(donerep2 * (1 + sWorld->getRate(RATE_REPUTATION_RECRUIT_A_FRIEND_BONUS))); - FactionEntry const *factionEntry2 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->repfaction2); + FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(ChampioningFaction ? ChampioningFaction : Rep->repfaction2); uint32 current_reputation_rank2 = GetReputationMgr().GetRank(factionEntry2); if (factionEntry2 && current_reputation_rank2 <= Rep->reputation_max_cap2) GetReputationMgr().ModifyReputation(factionEntry2, donerep2); @@ -7011,7 +7032,7 @@ void Player::RewardReputation(Unit *pVictim, float rate) } //Calculate how many reputation points player gain with the quest -void Player::RewardReputation(Quest const *pQuest) +void Player::RewardReputation(Quest const* pQuest) { bool recruitAFriend = GetsRecruitAFriendBonus(false); @@ -7035,7 +7056,7 @@ void Player::RewardReputation(Quest const *pQuest) uint32 row = ((pQuest->RewRepValueId[i] < 0) ? 1 : 0) + 1; uint32 field = abs(pQuest->RewRepValueId[i]); - if (const QuestFactionRewEntry *pRow = sQuestFactionRewardStore.LookupEntry(row)) + if (const QuestFactionRewEntry* pRow = sQuestFactionRewardStore.LookupEntry(row)) { int32 repPoints = pRow->QuestRewFactionValue[field]; @@ -7089,7 +7110,7 @@ void Player::UpdateHonorFields() ///Calculate the amount of honor gained based on the victim ///and the size of the group for which the honor is divided ///An exact honor value can also be given (overriding the calcs) -bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, int32 honor, bool pvptoken) +bool Player::RewardHonor(Unit* uVictim, uint32 groupsize, int32 honor, bool pvptoken) { // do not reward honor in arenas, but enable onkill spellproc if (InArena()) @@ -7129,7 +7150,7 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, int32 honor, bool pvpt if (uVictim->GetTypeId() == TYPEID_PLAYER) { - Player *pVictim = uVictim->ToPlayer(); + Player* pVictim = uVictim->ToPlayer(); if (GetTeam() == pVictim->GetTeam() && !sWorld->IsFFAPvPRealm()) return false; @@ -7215,7 +7236,7 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, int32 honor, bool pvpt if (InBattleground() && honor > 0) { - if (Battleground *bg = GetBattleground()) + if (Battleground* bg = GetBattleground()) { bg->UpdatePlayerScore(this, SCORE_BONUS_HONOR, honor, false); //false: prevent looping } @@ -7405,7 +7426,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea) if (sWorld->getBoolConfig(CONFIG_WEATHER)) { - Weather *wth = sWeatherMgr->FindWeather(zone->ID); + Weather* wth = sWeatherMgr->FindWeather(zone->ID); if (wth) wth->SendWeatherUpdateToPlayer(this); else @@ -7645,12 +7666,12 @@ void Player::DuelComplete(DuelCompleteType type) //---------------------------------------------------------// -void Player::_ApplyItemMods(Item *item, uint8 slot, bool apply) +void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply) { if (slot >= INVENTORY_SLOT_BAG_END || !item) return; - ItemTemplate const *proto = item->GetTemplate(); + ItemTemplate const* proto = item->GetTemplate(); if (!proto) return; @@ -7680,12 +7701,12 @@ void Player::_ApplyItemMods(Item *item, uint8 slot, bool apply) sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "_ApplyItemMods complete."); } -void Player::_ApplyItemBonuses(ItemTemplate const *proto, uint8 slot, bool apply, bool only_level_scale /*= false*/) +void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply, bool only_level_scale /*= false*/) { if (slot >= INVENTORY_SLOT_BAG_END || !proto) return; - ScalingStatDistributionEntry const *ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : NULL; + ScalingStatDistributionEntry const* ssd = proto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(proto->ScalingStatDistribution) : NULL; if (only_level_scale && !ssd) return; @@ -7694,7 +7715,7 @@ void Player::_ApplyItemBonuses(ItemTemplate const *proto, uint8 slot, bool apply if (ssd && ssd_level > ssd->MaxLevel) ssd_level = ssd->MaxLevel; - ScalingStatValuesEntry const *ssv = proto->ScalingStatValue ? sScalingStatValuesStore.LookupEntry(ssd_level) : NULL; + ScalingStatValuesEntry const* ssv = proto->ScalingStatValue ? sScalingStatValuesStore.LookupEntry(ssd_level) : NULL; if (only_level_scale && !ssv) return; @@ -7954,7 +7975,7 @@ void Player::_ApplyItemBonuses(ItemTemplate const *proto, uint8 slot, bool apply ApplyFeralAPBonus(feral_bonus, apply); } -void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const *proto, ScalingStatValuesEntry const *ssv, bool apply) +void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingStatValuesEntry const* ssv, bool apply) { WeaponAttackType attType = BASE_ATTACK; float damage = 0.0f; @@ -8015,7 +8036,7 @@ void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const *proto, ScalingSt UpdateDamagePhysical(attType); } -void Player::_ApplyWeaponDependentAuraMods(Item *item, WeaponAttackType attackType, bool apply) +void Player::_ApplyWeaponDependentAuraMods(Item* item, WeaponAttackType attackType, bool apply) { AuraEffectList const& auraCritList = GetAuraEffectsByType(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT); for (AuraEffectList::const_iterator itr = auraCritList.begin(); itr != auraCritList.end(); ++itr) @@ -8030,7 +8051,7 @@ void Player::_ApplyWeaponDependentAuraMods(Item *item, WeaponAttackType attackTy _ApplyWeaponDependentAuraDamageMod(item, attackType, *itr, apply); } -void Player::_ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, AuraEffect const* aura, bool apply) +void Player::_ApplyWeaponDependentAuraCritMod(Item* item, WeaponAttackType attackType, AuraEffect const* aura, bool apply) { // generic not weapon specific case processes in aura code if (aura->GetSpellInfo()->EquippedItemClass == -1) @@ -8049,7 +8070,7 @@ void Player::_ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attac HandleBaseModValue(mod, FLAT_MOD, float (aura->GetAmount()), apply); } -void Player::_ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType attackType, AuraEffect const* aura, bool apply) +void Player::_ApplyWeaponDependentAuraDamageMod(Item* item, WeaponAttackType attackType, AuraEffect const* aura, bool apply) { //don't apply mod if item is broken if (item->IsBroken() || !CanUseAttackType(attackType)) @@ -8085,17 +8106,15 @@ void Player::_ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType att HandleStatModifier(unitMod, unitModType, float(aura->GetAmount()), apply); if (unitModType == TOTAL_VALUE) ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS, aura->GetAmount(), apply); - else - ApplyPercentModFloatValue(PLAYER_FIELD_MOD_DAMAGE_DONE_PCT, float (aura->GetAmount()), apply); } } -void Player::ApplyItemEquipSpell(Item *item, bool apply, bool form_change) +void Player::ApplyItemEquipSpell(Item* item, bool apply, bool form_change) { if (!item) return; - ItemTemplate const *proto = item->GetTemplate(); + ItemTemplate const* proto = item->GetTemplate(); if (!proto) return; @@ -8195,7 +8214,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 // If usable, try to cast item spell if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (!item->IsBroken() && CanUseAttackType(attType)) - if (ItemTemplate const *proto = item->GetTemplate()) + if (ItemTemplate const* proto = item->GetTemplate()) { // Additional check for weapons if (proto->Class == ITEM_CLASS_WEAPON) @@ -8221,7 +8240,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 } } -void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item *item, ItemTemplate const* proto) +void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item* item, ItemTemplate const* proto) { // Can do effect if any damage done to target if (procVictim & PROC_FLAG_TAKEN_DAMAGE) @@ -8239,7 +8258,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 if (spellData.SpellTrigger != ITEM_SPELLTRIGGER_CHANCE_ON_HIT) continue; - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId); if (!spellInfo) { sLog->outError("WORLD: unknown Item spellid %i", spellData.SpellId); @@ -8283,7 +8302,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 for (uint8 e_slot = 0; e_slot < MAX_ENCHANTMENT_SLOT; ++e_slot) { uint32 enchant_id = item->GetEnchantmentId(EnchantmentSlot(e_slot)); - SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) continue; for (uint8 s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s) { @@ -8306,7 +8325,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 continue; } - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]); if (!spellInfo) { sLog->outError("Player::CastItemCombatSpell(GUID: %u, name: %s, enchant: %i): unknown spell %i is casted, ignoring...", @@ -8342,7 +8361,7 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 } } -void Player::CastItemUseSpell(Item *item, SpellCastTargets const& targets, uint8 cast_count, uint32 glyphIndex) +void Player::CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 cast_count, uint32 glyphIndex) { ItemTemplate const* proto = item->GetTemplate(); // special learning case @@ -8351,7 +8370,7 @@ void Player::CastItemUseSpell(Item *item, SpellCastTargets const& targets, uint8 uint32 learn_spell_id = proto->Spells[0].SpellId; uint32 learning_spell_id = proto->Spells[1].SpellId; - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(learn_spell_id); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(learn_spell_id); if (!spellInfo) { sLog->outError("Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring ", proto->ItemId, learn_spell_id); @@ -8383,7 +8402,7 @@ void Player::CastItemUseSpell(Item *item, SpellCastTargets const& targets, uint8 if (spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_USE) continue; - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellData.SpellId); if (!spellInfo) { sLog->outError("Player::CastItemUseSpell: Item (Entry: %u) in have wrong spell id %u, ignoring", proto->ItemId, spellData.SpellId); @@ -8403,7 +8422,7 @@ void Player::CastItemUseSpell(Item *item, SpellCastTargets const& targets, uint8 for (uint8 e_slot = 0; e_slot < MAX_ENCHANTMENT_SLOT; ++e_slot) { uint32 enchant_id = item->GetEnchantmentId(EnchantmentSlot(e_slot)); - SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) continue; for (uint8 s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s) @@ -8411,7 +8430,7 @@ void Player::CastItemUseSpell(Item *item, SpellCastTargets const& targets, uint8 if (pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_USE_SPELL) continue; - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]); if (!spellInfo) { sLog->outError("Player::CastItemUseSpell Enchant %i, cast unknown spell %i", pEnchant->ID, pEnchant->spellid[s]); @@ -8437,7 +8456,7 @@ void Player::_RemoveAllItemMods() { if (m_items[i]) { - ItemTemplate const *proto = m_items[i]->GetTemplate(); + ItemTemplate const* proto = m_items[i]->GetTemplate(); if (!proto) continue; @@ -8459,7 +8478,7 @@ void Player::_RemoveAllItemMods() { if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i))) continue; - ItemTemplate const *proto = m_items[i]->GetTemplate(); + ItemTemplate const* proto = m_items[i]->GetTemplate(); if (!proto) continue; @@ -8488,7 +8507,7 @@ void Player::_ApplyAllItemMods() if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i))) continue; - ItemTemplate const *proto = m_items[i]->GetTemplate(); + ItemTemplate const* proto = m_items[i]->GetTemplate(); if (!proto) continue; @@ -8507,7 +8526,7 @@ void Player::_ApplyAllItemMods() { if (m_items[i]) { - ItemTemplate const *proto = m_items[i]->GetTemplate(); + ItemTemplate const* proto = m_items[i]->GetTemplate(); if (!proto) continue; @@ -8535,7 +8554,7 @@ void Player::_ApplyAllLevelScaleItemMods(bool apply) if (m_items[i]->IsBroken() || !CanUseAttackType(GetAttackBySlot(i))) continue; - ItemTemplate const *proto = m_items[i]->GetTemplate(); + ItemTemplate const* proto = m_items[i]->GetTemplate(); if (!proto) continue; @@ -8553,7 +8572,7 @@ void Player::_ApplyAmmoBonuses() float currentAmmoDPS; - ItemTemplate const *ammo_proto = sObjectMgr->GetItemTemplate(ammo_id); + ItemTemplate const* ammo_proto = sObjectMgr->GetItemTemplate(ammo_id); if (!ammo_proto || ammo_proto->Class != ITEM_CLASS_PROJECTILE || !CheckAmmoCompatibility(ammo_proto)) currentAmmoDPS = 0.0f; else @@ -8568,13 +8587,13 @@ void Player::_ApplyAmmoBonuses() UpdateDamagePhysical(RANGED_ATTACK); } -bool Player::CheckAmmoCompatibility(const ItemTemplate *ammo_proto) const +bool Player::CheckAmmoCompatibility(const ItemTemplate* ammo_proto) const { if (!ammo_proto) return false; // check ranged weapon - Item *weapon = GetWeaponForAttack(RANGED_ATTACK); + Item* weapon = GetWeaponForAttack(RANGED_ATTACK); if (!weapon || weapon->IsBroken()) return false; @@ -8618,7 +8637,7 @@ void Player::RemovedInsignia(Player* looterPlr) // We have to convert player corpse to bones, not to be able to resurrect there // SpawnCorpseBones isn't handy, 'cos it saves player while he in BG - Corpse *bones = sObjectAccessor->ConvertCorpseForPlayer(GetGUID(), true); + Corpse* bones = sObjectAccessor->ConvertCorpseForPlayer(GetGUID(), true); if (!bones) return; @@ -8644,14 +8663,14 @@ void Player::SendLoot(uint64 guid, LootType loot_type) if (uint64 lguid = GetLootGUID()) m_session->DoLootRelease(lguid); - Loot *loot = 0; + Loot* loot = 0; PermissionTypes permission = ALL_PERMISSION; sLog->outDebug(LOG_FILTER_LOOT, "Player::SendLoot"); if (IS_GAMEOBJECT_GUID(guid)) { sLog->outDebug(LOG_FILTER_LOOT, "IS_GAMEOBJECT_GUID(guid)"); - GameObject *go = GetMap()->GetGameObject(guid); + GameObject* go = GetMap()->GetGameObject(guid); // not check distance for GO in case owned GO (fishing bobber case, for example) // And permit out of range GO with no owner in case fishing hole @@ -8669,7 +8688,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) //TODO: fix this big hack if ((go->GetEntry() == BG_AV_OBJECTID_MINE_N || go->GetEntry() == BG_AV_OBJECTID_MINE_S)) - if (Battleground *bg = GetBattleground()) + if (Battleground* bg = GetBattleground()) if (bg->GetTypeID(true) == BATTLEGROUND_AV) if (!(((BattlegroundAV*)bg)->PlayerCanDoMineQuest(go->GetEntry(), GetTeam()))) { @@ -8749,7 +8768,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) } else if (IS_ITEM_GUID(guid)) { - Item *item = GetItemByGuid(guid); + Item* item = GetItemByGuid(guid); if (!item) { @@ -8786,7 +8805,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) } else if (IS_CORPSE_GUID(guid)) // remove insignia { - Corpse *bones = ObjectAccessor::GetCorpse(*this, guid); + Corpse* bones = ObjectAccessor::GetCorpse(*this, guid); if (!bones || !(loot_type == LOOT_CORPSE || loot_type == LOOT_INSIGNIA) || bones->GetType() != CORPSE_BONES) { @@ -8801,7 +8820,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) bones->lootForBody = true; uint32 pLevel = bones->loot.gold; bones->loot.clear(); - if (Battleground *bg = GetBattleground()) + if (Battleground* bg = GetBattleground()) if (bg->GetTypeID(true) == BATTLEGROUND_AV) loot->FillLoot(1, LootTemplates_Creature, this, true); // It may need a better formula @@ -8816,7 +8835,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) } else { - Creature *creature = GetMap()->GetCreature(guid); + Creature* creature = GetMap()->GetCreature(guid); // must be in range and creature must be alive for pickpocket and must be dead for another loot if (!creature || creature->isAlive() != (loot_type == LOOT_PICKPOCKETING) || !creature->IsWithinDistInMap(this, INTERACTION_DISTANCE)) @@ -8853,7 +8872,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type) else { // the player whose group may loot the corpse - Player *recipient = creature->GetLootRecipient(); + Player* recipient = creature->GetLootRecipient(); if (!recipient) return; @@ -8980,7 +8999,7 @@ void Player::SendInitWorldStates(uint32 zoneid, uint32 areaid) Battleground* bg = GetBattleground(); uint16 NumberOfFields = 0; uint32 mapid = GetMapId(); - OutdoorPvP * pvp = sOutdoorPvPMgr->GetOutdoorPvPToZoneId(zoneid); + OutdoorPvP* pvp = sOutdoorPvPMgr->GetOutdoorPvPToZoneId(zoneid); InstanceScript* instance = GetInstanceScript(); sLog->outDebug(LOG_FILTER_NETWORKIO, "Sending SMSG_INIT_WORLD_STATES to Map: %u, Zone: %u", mapid, zoneid); @@ -9666,7 +9685,7 @@ void Player::ResetPetTalents() if (!pet || pet->getPetType() != HUNTER_PET || pet->m_usedTalentCount == 0) return; - CharmInfo *charmInfo = pet->GetCharmInfo(); + CharmInfo* charmInfo = pet->GetCharmInfo(); if (!charmInfo) { sLog->outError("Object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); @@ -9913,7 +9932,7 @@ InventoryResult Player::CanUnequipItems(uint32 item, uint32 count) const InventoryResult res = EQUIP_ERR_OK; for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_BAG_END; ++i) - if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetEntry() == item) { InventoryResult ires = CanUnequipItem(INVENTORY_SLOT_BAG_0 << 8 | i, false); @@ -9928,7 +9947,7 @@ InventoryResult Player::CanUnequipItems(uint32 item, uint32 count) const } for (uint8 i = INVENTORY_SLOT_ITEM_START; i < INVENTORY_SLOT_ITEM_END; ++i) - if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetEntry() == item) { tempcount += pItem->GetCount(); @@ -9937,7 +9956,7 @@ InventoryResult Player::CanUnequipItems(uint32 item, uint32 count) const } for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) - if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetEntry() == item) { tempcount += pItem->GetCount(); @@ -9946,9 +9965,9 @@ InventoryResult Player::CanUnequipItems(uint32 item, uint32 count) const } for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) - if (Bag *pBag = GetBagByPos(i)) + if (Bag* pBag = GetBagByPos(i)) for (uint32 j = 0; j < pBag->GetBagSize(); ++j) - if (Item *pItem = GetItemByPos(i, j)) + if (Item* pItem = GetItemByPos(i, j)) if (pItem->GetEntry() == item) { tempcount += pItem->GetCount(); @@ -9964,12 +9983,12 @@ uint32 Player::GetItemCount(uint32 item, bool inBankAlso, Item* skipItem) const { uint32 count = 0; for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++) - if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem != skipItem && pItem->GetEntry() == item) count += pItem->GetCount(); for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) - if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem != skipItem && pItem->GetEntry() == item) count += pItem->GetCount(); @@ -9979,7 +9998,7 @@ uint32 Player::GetItemCount(uint32 item, bool inBankAlso, Item* skipItem) const if (skipItem && skipItem->GetTemplate()->GemProperties) for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i) - if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem != skipItem && pItem->GetTemplate()->Socket[0].Color) count += pItem->GetGemCountWithID(item); @@ -10008,16 +10027,16 @@ uint32 Player::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipIte { uint32 count = 0; for (int i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i) - if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem != skipItem) - if (ItemTemplate const *pProto = pItem->GetTemplate()) + if (ItemTemplate const* pProto = pItem->GetTemplate()) if (pProto->ItemLimitCategory == limitCategory) count += pItem->GetCount(); for (int i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) - if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem != skipItem) - if (ItemTemplate const *pProto = pItem->GetTemplate()) + if (ItemTemplate const* pProto = pItem->GetTemplate()) if (pProto->ItemLimitCategory == limitCategory) count += pItem->GetCount(); @@ -10026,9 +10045,9 @@ uint32 Player::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipIte count += pBag->GetItemCountWithLimitCategory(limitCategory, skipItem); for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i) - if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem != skipItem) - if (ItemTemplate const *pProto = pItem->GetTemplate()) + if (ItemTemplate const* pProto = pItem->GetTemplate()) if (pProto->ItemLimitCategory == limitCategory) count += pItem->GetCount(); @@ -10042,29 +10061,29 @@ uint32 Player::GetItemCountWithLimitCategory(uint32 limitCategory, Item* skipIte Item* Player::GetItemByGuid(uint64 guid) const { for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i) - if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetGUID() == guid) return pItem; for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) - if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetGUID() == guid) return pItem; for (int i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; ++i) - if (Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) if (pItem->GetGUID() == guid) return pItem; for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) - if (Bag *pBag = GetBagByPos(i)) + if (Bag* pBag = GetBagByPos(i)) for (uint32 j = 0; j < pBag->GetBagSize(); ++j) if (Item* pItem = pBag->GetItemByPos(j)) if (pItem->GetGUID() == guid) return pItem; for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; ++i) - if (Bag *pBag = GetBagByPos(i)) + if (Bag* pBag = GetBagByPos(i)) for (uint32 j = 0; j < pBag->GetBagSize(); ++j) if (Item* pItem = pBag->GetItemByPos(j)) if (pItem->GetGUID() == guid) @@ -10084,7 +10103,7 @@ Item* Player::GetItemByPos(uint8 bag, uint8 slot) const { if (bag == INVENTORY_SLOT_BAG_0 && (slot < BANK_SLOT_BAG_END || (slot >= KEYRING_SLOT_START && slot < CURRENCYTOKEN_SLOT_END))) return m_items[slot]; - else if (Bag *pBag = GetBagByPos(bag)) + else if (Bag* pBag = GetBagByPos(bag)) return pBag->GetItemByPos(slot); return NULL; } @@ -10259,7 +10278,7 @@ bool Player::HasItemCount(uint32 item, uint32 count, bool inBankAlso) const uint32 tempcount = 0; for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; i++) { - Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); + Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (pItem && pItem->GetEntry() == item && !pItem->IsInTrade()) { tempcount += pItem->GetCount(); @@ -10269,7 +10288,7 @@ bool Player::HasItemCount(uint32 item, uint32 count, bool inBankAlso) const } for (uint8 i = KEYRING_SLOT_START; i < CURRENCYTOKEN_SLOT_END; ++i) { - Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); + Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (pItem && pItem->GetEntry() == item && !pItem->IsInTrade()) { tempcount += pItem->GetCount(); @@ -10298,7 +10317,7 @@ bool Player::HasItemCount(uint32 item, uint32 count, bool inBankAlso) const { for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; i++) { - Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); + Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (pItem && pItem->GetEntry() == item && !pItem->IsInTrade()) { tempcount += pItem->GetCount(); @@ -10335,7 +10354,7 @@ bool Player::HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_ if (i == except_slot) continue; - Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); + Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (pItem && pItem->GetEntry() == item) { tempcount += pItem->GetCount(); @@ -10344,7 +10363,7 @@ bool Player::HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_ } } - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(item); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item); if (pProto && pProto->GemProperties) { for (uint8 i = EQUIPMENT_SLOT_START; i < EQUIPMENT_SLOT_END; ++i) @@ -10352,7 +10371,7 @@ bool Player::HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_ if (i == except_slot) continue; - Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); + Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (pItem && pItem->GetTemplate()->Socket[0].Color) { tempcount += pItem->GetGemCountWithID(item); @@ -10373,11 +10392,11 @@ bool Player::HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 if (i == except_slot) continue; - Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); + Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (!pItem) continue; - ItemTemplate const *pProto = pItem->GetTemplate(); + ItemTemplate const* pProto = pItem->GetTemplate(); if (!pProto) continue; @@ -10401,7 +10420,7 @@ bool Player::HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 InventoryResult Player::_CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count) const { - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(entry); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(entry); if (!pProto) { if (no_space_count) @@ -10455,7 +10474,7 @@ InventoryResult Player::_CanTakeMoreSimilarItems(uint32 entry, uint32 count, Ite bool Player::HasItemTotemCategory(uint32 TotemCategory) const { - Item *pItem; + Item* pItem; for (uint8 i = EQUIPMENT_SLOT_START; i < INVENTORY_SLOT_ITEM_END; ++i) { pItem = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, i); @@ -10470,7 +10489,7 @@ bool Player::HasItemTotemCategory(uint32 TotemCategory) const } for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; ++i) { - if (Bag *pBag = GetBagByPos(i)) + if (Bag* pBag = GetBagByPos(i)) { for (uint32 j = 0; j < pBag->GetBagSize(); ++j) { @@ -10483,7 +10502,7 @@ bool Player::HasItemTotemCategory(uint32 TotemCategory) const return false; } -InventoryResult Player::_CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32& count, bool swap, Item* pSrcItem) const +InventoryResult Player::_CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec &dest, ItemTemplate const* pProto, uint32& count, bool swap, Item* pSrcItem) const { Item* pItem2 = GetItemByPos(bag, slot); @@ -10557,7 +10576,7 @@ InventoryResult Player::_CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, Item return EQUIP_ERR_OK; } -InventoryResult Player::_CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32& count, bool merge, bool non_specialized, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const +InventoryResult Player::_CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, ItemTemplate const* pProto, uint32& count, bool merge, bool non_specialized, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const { // skip specific bag already processed in first called _CanStoreItem_InBag if (bag == skip_bag) @@ -10627,7 +10646,7 @@ InventoryResult Player::_CanStoreItem_InBag(uint8 bag, ItemPosCountVec &dest, It return EQUIP_ERR_OK; } -InventoryResult Player::_CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec &dest, ItemTemplate const *pProto, uint32& count, bool merge, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const +InventoryResult Player::_CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec &dest, ItemTemplate const* pProto, uint32& count, bool merge, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const { //this is never called for non-bag slots so we can do this if (pSrcItem && pSrcItem->IsNotEmptyBag()) @@ -10678,11 +10697,11 @@ InventoryResult Player::_CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 s return EQUIP_ERR_OK; } -InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 entry, uint32 count, Item *pItem, bool swap, uint32* no_space_count) const +InventoryResult Player::_CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, uint32 entry, uint32 count, Item* pItem, bool swap, uint32* no_space_count) const { sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanStoreItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, entry, count); - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(entry); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(entry); if (!pProto) { if (no_space_count) @@ -11159,13 +11178,13 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const // check free space for all items for (int k = 0; k < count; ++k) { - Item *pItem = pItems[k]; + Item* pItem = pItems[k]; // no item if (!pItem) continue; sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanStoreItems %i. item = %u, count = %u", k + 1, pItem->GetEntry(), pItem->GetCount()); - ItemTemplate const *pProto = pItem->GetTemplate(); + ItemTemplate const* pProto = pItem->GetTemplate(); // strange item if (!pProto) @@ -11179,7 +11198,7 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const if (pItem->IsBindedNotWith(this)) return EQUIP_ERR_DONT_OWN_THAT_ITEM; - ItemTemplate const *pBagProto; + ItemTemplate const* pBagProto; // item is 'one item only' InventoryResult res = CanTakeMoreSimilarItems(pItem); @@ -11357,7 +11376,7 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const InventoryResult Player::CanEquipNewItem(uint8 slot, uint16 &dest, uint32 item, bool swap) const { dest = 0; - Item *pItem = Item::CreateItem(item, 1, this); + Item* pItem = Item::CreateItem(item, 1, this); if (pItem) { InventoryResult result = CanEquipItem(slot, dest, pItem, swap); @@ -11368,13 +11387,13 @@ InventoryResult Player::CanEquipNewItem(uint8 slot, uint16 &dest, uint32 item, b return EQUIP_ERR_ITEM_NOT_FOUND; } -InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool swap, bool not_loading) const +InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item* pItem, bool swap, bool not_loading) const { dest = 0; if (pItem) { sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanEquipItem slot = %u, item = %u, count = %u", slot, pItem->GetEntry(), pItem->GetCount()); - ItemTemplate const *pProto = pItem->GetTemplate(); + ItemTemplate const* pProto = pItem->GetTemplate(); if (pProto) { // item used @@ -11417,7 +11436,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool return EQUIP_ERR_CANT_DO_RIGHT_NOW; } - ScalingStatDistributionEntry const *ssd = pProto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(pProto->ScalingStatDistribution) : 0; + ScalingStatDistributionEntry const* ssd = pProto->ScalingStatDistribution ? sScalingStatDistributionStore.LookupEntry(pProto->ScalingStatDistribution) : 0; // check allowed level (extend range to upper values if MaxLevel more or equal max player level, this let GM set high level with 1...max range items) if (ssd && ssd->MaxLevel < DEFAULT_MAX_LEVEL && ssd->MaxLevel < getLevel()) return EQUIP_ERR_ITEM_CANT_BE_EQUIPPED; @@ -11482,7 +11501,7 @@ InventoryResult Player::CanEquipItem(uint8 slot, uint16 &dest, Item *pItem, bool if (!CanTitanGrip()) { // offhand item must can be stored in inventory for offhand item and it also must be unequipped - Item *offItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); + Item* offItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); ItemPosCountVec off_dest; if (offItem && (!not_loading || CanUnequipItem(uint16(INVENTORY_SLOT_BAG_0) << 8 | EQUIPMENT_SLOT_OFFHAND, false) != EQUIP_ERR_OK || @@ -11512,7 +11531,7 @@ InventoryResult Player::CanUnequipItem(uint16 pos, bool swap) const sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanUnequipItem slot = %u, item = %u, count = %u", pos, pItem->GetEntry(), pItem->GetCount()); - ItemTemplate const *pProto = pItem->GetTemplate(); + ItemTemplate const* pProto = pItem->GetTemplate(); if (!pProto) return EQUIP_ERR_ITEM_NOT_FOUND; @@ -11539,7 +11558,7 @@ InventoryResult Player::CanUnequipItem(uint16 pos, bool swap) const return EQUIP_ERR_OK; } -InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item *pItem, bool swap, bool not_loading) const +InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest, Item* pItem, bool swap, bool not_loading) const { if (!pItem) return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_ITEM_NOT_FOUND; @@ -11547,7 +11566,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest uint32 count = pItem->GetCount(); sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanBankItem bag = %u, slot = %u, item = %u, count = %u", bag, slot, pItem->GetEntry(), pItem->GetCount()); - ItemTemplate const *pProto = pItem->GetTemplate(); + ItemTemplate const* pProto = pItem->GetTemplate(); if (!pProto) return swap ? EQUIP_ERR_ITEMS_CANT_BE_SWAPPED : EQUIP_ERR_ITEM_NOT_FOUND; @@ -11726,7 +11745,7 @@ InventoryResult Player::CanBankItem(uint8 bag, uint8 slot, ItemPosCountVec &dest return EQUIP_ERR_BANK_FULL; } -InventoryResult Player::CanUseItem(Item *pItem, bool not_loading) const +InventoryResult Player::CanUseItem(Item* pItem, bool not_loading) const { if (pItem) { @@ -11738,7 +11757,7 @@ InventoryResult Player::CanUseItem(Item *pItem, bool not_loading) const //if (isStunned()) // return EQUIP_ERR_YOU_ARE_STUNNED; - ItemTemplate const *pProto = pItem->GetTemplate(); + ItemTemplate const* pProto = pItem->GetTemplate(); if (pProto) { if (pItem->IsBindedNotWith(this)) @@ -11831,7 +11850,7 @@ InventoryResult Player::CanUseAmmo(uint32 item) const return EQUIP_ERR_YOU_ARE_DEAD; //if (isStunned()) // return EQUIP_ERR_YOU_ARE_STUNNED; - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(item); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item); if (pProto) { if (pProto->InventoryType!= INVTYPE_AMMO) @@ -11896,7 +11915,7 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update for (ItemPosCountVec::const_iterator itr = dest.begin(); itr != dest.end(); ++itr) count += itr->count; - Item *pItem = Item::CreateItem(item, count, this); + Item* pItem = Item::CreateItem(item, count, this); if (pItem) { ItemAddedQuestCheck(item, count); @@ -11905,7 +11924,7 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update pItem->SetItemRandomProperties(randomPropertyId); pItem = StoreItem(dest, pItem, update); - const ItemTemplate *proto = pItem->GetTemplate(); + const ItemTemplate* proto = pItem->GetTemplate(); for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger CastSpell(this, proto->Spells[i].SpellId, true, pItem); @@ -11957,7 +11976,7 @@ Item* Player::StoreItem(ItemPosCountVec const& dest, Item* pItem, bool update) } // Return stored item (if stored to stack, it can diff. from pItem). And pItem ca be deleted in this case. -Item* Player::_StoreItem(uint16 pos, Item *pItem, uint32 count, bool clone, bool update) +Item* Player::_StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool update) { if (!pItem) return NULL; @@ -11967,7 +11986,7 @@ Item* Player::_StoreItem(uint16 pos, Item *pItem, uint32 count, bool clone, bool sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: StoreItem bag = %u, slot = %u, item = %u, count = %u, guid = %u", bag, slot, pItem->GetEntry(), count, pItem->GetGUIDLow()); - Item *pItem2 = GetItemByPos(bag, slot); + Item* pItem2 = GetItemByPos(bag, slot); if (!pItem2) { @@ -12057,7 +12076,7 @@ Item* Player::_StoreItem(uint16 pos, Item *pItem, uint32 count, bool clone, bool Item* Player::EquipNewItem(uint16 pos, uint32 item, bool update) { - if (Item *pItem = Item::CreateItem(item, 1, this)) + if (Item* pItem = Item::CreateItem(item, 1, this)) { ItemAddedQuestCheck(item, 1); GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_RECEIVE_EPIC_ITEM, item, 1); @@ -12067,7 +12086,7 @@ Item* Player::EquipNewItem(uint16 pos, uint32 item, bool update) return NULL; } -Item* Player::EquipItem(uint16 pos, Item *pItem, bool update) +Item* Player::EquipItem(uint16 pos, Item* pItem, bool update) { AddEnchantmentDurations(pItem); AddItemDurations(pItem); @@ -12075,7 +12094,7 @@ Item* Player::EquipItem(uint16 pos, Item *pItem, bool update) uint8 bag = pos >> 8; uint8 slot = pos & 255; - Item *pItem2 = GetItemByPos(bag, slot); + Item* pItem2 = GetItemByPos(bag, slot); if (!pItem2) { @@ -12083,7 +12102,7 @@ Item* Player::EquipItem(uint16 pos, Item *pItem, bool update) if (isAlive()) { - ItemTemplate const *pProto = pItem->GetTemplate(); + ItemTemplate const* pProto = pItem->GetTemplate(); // item set bonuses applied only at equip and removed at unequip, and still active for broken items if (pProto && pProto->ItemSet) @@ -12176,7 +12195,7 @@ Item* Player::EquipItem(uint16 pos, Item *pItem, bool update) return pItem; } -void Player::QuickEquipItem(uint16 pos, Item *pItem) +void Player::QuickEquipItem(uint16 pos, Item* pItem) { if (pItem) { @@ -12197,7 +12216,7 @@ void Player::QuickEquipItem(uint16 pos, Item *pItem) } } -void Player::SetVisibleItemSlot(uint8 slot, Item *pItem) +void Player::SetVisibleItemSlot(uint8 slot, Item* pItem) { if (pItem) { @@ -12212,7 +12231,7 @@ void Player::SetVisibleItemSlot(uint8 slot, Item *pItem) } } -void Player::VisualizeItem(uint8 slot, Item *pItem) +void Player::VisualizeItem(uint8 slot, Item* pItem) { if (!pItem) return; @@ -12243,7 +12262,7 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update) // note2: if removeitem is to be used for delinking // the item must be removed from the player's updatequeue - Item *pItem = GetItemByPos(bag, slot); + Item* pItem = GetItemByPos(bag, slot); if (pItem) { sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: RemoveItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); @@ -12256,7 +12275,7 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update) { if (slot < INVENTORY_SLOT_BAG_END) { - ItemTemplate const *pProto = pItem->GetTemplate(); + ItemTemplate const* pProto = pItem->GetTemplate(); // item set bonuses applied only at equip and removed at unequip, and still active for broken items if (pProto && pProto->ItemSet) @@ -12306,7 +12325,7 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update) if (slot < EQUIPMENT_SLOT_END) SetVisibleItemSlot(slot, NULL); } - else if (Bag *pBag = GetBagByPos(bag)) + else if (Bag* pBag = GetBagByPos(bag)) pBag->RemoveItem(slot, update); pItem->SetUInt64Value(ITEM_FIELD_CONTAINED, 0); @@ -12362,7 +12381,7 @@ void Player::MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool void Player::DestroyItem(uint8 bag, uint8 slot, bool update) { - Item *pItem = GetItemByPos(bag, slot); + Item* pItem = GetItemByPos(bag, slot); if (pItem) { sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: DestroyItem bag = %u, slot = %u, item = %u", bag, slot, pItem->GetEntry()); @@ -12382,7 +12401,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) pItem->SetSoulboundTradeable(NULL, this, false); RemoveTradeableItem(pItem); - const ItemTemplate *proto = pItem->GetTemplate(); + const ItemTemplate* proto = pItem->GetTemplate(); for (uint8 i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) if (proto->Spells[i].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE && proto->Spells[i].SpellId > 0) // On obtain trigger RemoveAurasDueToSpell(proto->Spells[i].SpellId); @@ -12396,7 +12415,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) // equipment and equipped bags can have applied bonuses if (slot < INVENTORY_SLOT_BAG_END) { - ItemTemplate const *pProto = pItem->GetTemplate(); + ItemTemplate const* pProto = pItem->GetTemplate(); // item set bonuses applied only at equip and removed at unequip, and still active for broken items if (pProto && pProto->ItemSet) @@ -12432,7 +12451,7 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) m_items[slot] = NULL; } - else if (Bag *pBag = GetBagByPos(bag)) + else if (Bag* pBag = GetBagByPos(bag)) pBag->RemoveItem(slot, update); if (IsInWorld() && update) @@ -12513,7 +12532,7 @@ void Player::DestroyItemCount(uint32 item, uint32 count, bool update, bool unequ // in inventory bags for (uint8 i = INVENTORY_SLOT_BAG_START; i < INVENTORY_SLOT_BAG_END; i++) { - if (Bag *pBag = GetBagByPos(i)) + if (Bag* pBag = GetBagByPos(i)) { for (uint32 j = 0; j < pBag->GetBagSize(); j++) { @@ -12689,7 +12708,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count) uint8 dstbag = dst >> 8; uint8 dstslot = dst & 255; - Item *pSrcItem = GetItemByPos(srcbag, srcslot); + Item* pSrcItem = GetItemByPos(srcbag, srcslot); if (!pSrcItem) { SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pSrcItem, NULL); @@ -12718,7 +12737,7 @@ void Player::SplitItem(uint16 src, uint16 dst, uint32 count) } sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: SplitItem bag = %u, slot = %u, item = %u, count = %u", dstbag, dstslot, pSrcItem->GetEntry(), count); - Item *pNewItem = pSrcItem->CloneItem(count, this); + Item* pNewItem = pSrcItem->CloneItem(count, this); if (!pNewItem) { SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pSrcItem, NULL); @@ -12796,8 +12815,8 @@ void Player::SwapItem(uint16 src, uint16 dst) uint8 dstbag = dst >> 8; uint8 dstslot = dst & 255; - Item *pSrcItem = GetItemByPos(srcbag, srcslot); - Item *pDstItem = GetItemByPos(dstbag, dstslot); + Item* pSrcItem = GetItemByPos(srcbag, srcslot); + Item* pDstItem = GetItemByPos(dstbag, dstslot); if (!pSrcItem) return; @@ -13038,7 +13057,7 @@ void Player::SwapItem(uint16 src, uint16 dst) for (uint32 i=0; i < fullBag->GetBagSize(); ++i) { - Item *bagItem = fullBag->GetItemByPos(i); + Item* bagItem = fullBag->GetItemByPos(i); if (!bagItem) continue; @@ -13064,7 +13083,7 @@ void Player::SwapItem(uint16 src, uint16 dst) count = 0; // will pos in new bag for (uint32 i = 0; i< fullBag->GetBagSize(); ++i) { - Item *bagItem = fullBag->GetItemByPos(i); + Item* bagItem = fullBag->GetItemByPos(i); if (!bagItem) continue; @@ -13108,7 +13127,7 @@ void Player::SwapItem(uint16 src, uint16 dst) Bag* bag = pSrcItem->ToBag(); for (uint32 i = 0; i < bag->GetBagSize(); ++i) { - if (Item *bagItem = bag->GetItemByPos(i)) + if (Item* bagItem = bag->GetItemByPos(i)) { if (bagItem->m_lootGenerated) { @@ -13125,7 +13144,7 @@ void Player::SwapItem(uint16 src, uint16 dst) Bag* bag = pDstItem->ToBag(); for (uint32 i = 0; i < bag->GetBagSize(); ++i) { - if (Item *bagItem = bag->GetItemByPos(i)) + if (Item* bagItem = bag->GetItemByPos(i)) { if (bagItem->m_lootGenerated) { @@ -13141,7 +13160,7 @@ void Player::SwapItem(uint16 src, uint16 dst) AutoUnequipOffhandIfNeed(); } -void Player::AddItemToBuyBackSlot(Item *pItem) +void Player::AddItemToBuyBackSlot(Item* pItem) { if (pItem) { @@ -13183,7 +13202,7 @@ void Player::AddItemToBuyBackSlot(Item *pItem) uint32 eslot = slot - BUYBACK_SLOT_START; SetUInt64Value(PLAYER_FIELD_VENDORBUYBACK_SLOT_1 + (eslot * 2), pItem->GetGUID()); - if (ItemTemplate const *pProto = pItem->GetTemplate()) + if (ItemTemplate const* pProto = pItem->GetTemplate()) SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, pProto->SellPrice * pItem->GetCount()); else SetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + eslot, 0); @@ -13208,7 +13227,7 @@ void Player::RemoveItemFromBuyBackSlot(uint32 slot, bool del) sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: RemoveItemFromBuyBackSlot slot = %u", slot); if (slot >= BUYBACK_SLOT_START && slot < BUYBACK_SLOT_END) { - Item *pItem = m_items[slot]; + Item* pItem = m_items[slot]; if (pItem) { pItem->RemoveFromWorld(); @@ -13396,7 +13415,7 @@ void Player::UpdateEnchantTime(uint32 time) } } -void Player::AddEnchantmentDurations(Item *item) +void Player::AddEnchantmentDurations(Item* item) { for (int x = 0; x < MAX_ENCHANTMENT_SLOT; ++x) { @@ -13409,7 +13428,7 @@ void Player::AddEnchantmentDurations(Item *item) } } -void Player::RemoveEnchantmentDurations(Item *item) +void Player::RemoveEnchantmentDurations(Item* item) { for (EnchantDurationList::iterator itr = m_enchantDuration.begin(); itr != m_enchantDuration.end();) { @@ -13470,7 +13489,7 @@ void Player::RemoveArenaEnchantments(EnchantmentSlot slot) } // duration == 0 will remove item enchant -void Player::AddEnchantmentDuration(Item *item, EnchantmentSlot slot, uint32 duration) +void Player::AddEnchantmentDuration(Item* item, EnchantmentSlot slot, uint32 duration) { if (!item) return; @@ -13494,13 +13513,13 @@ void Player::AddEnchantmentDuration(Item *item, EnchantmentSlot slot, uint32 dur } } -void Player::ApplyEnchantment(Item *item, bool apply) +void Player::ApplyEnchantment(Item* item, bool apply) { for (uint32 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot) ApplyEnchantment(item, EnchantmentSlot(slot), apply); } -void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool apply_dur, bool ignore_condition) +void Player::ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool apply_dur, bool ignore_condition) { if (!item || !item->IsEquipped()) return; @@ -13512,7 +13531,7 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool if (!enchant_id) return; - SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) return; @@ -13531,7 +13550,7 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool && !item->GetTemplate()->Socket[slot-SOCK_ENCHANTMENT_SLOT].Color) { // Check if the requirements for the prismatic socket are met before applying the gem stats - SpellItemEnchantmentEntry const *pPrismaticEnchant = sSpellItemEnchantmentStore.LookupEntry(item->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT)); + SpellItemEnchantmentEntry const* pPrismaticEnchant = sSpellItemEnchantmentStore.LookupEntry(item->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT)); if (!pPrismaticEnchant || (pPrismaticEnchant->requiredSkill > 0 && pPrismaticEnchant->requiredSkillValue > GetSkillValue(pPrismaticEnchant->requiredSkill))) return; } @@ -13568,7 +13587,7 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool // Random Property Exist - try found basepoints for spell (basepoints depends from item suffix factor) if (item->GetItemRandomPropertyId()) { - ItemRandomSuffixEntry const *item_rand = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); + ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); if (item_rand) { // Search enchant_amount @@ -13595,7 +13614,7 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool case ITEM_ENCHANTMENT_TYPE_RESISTANCE: if (!enchant_amount) { - ItemRandomSuffixEntry const *item_rand = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); + ItemRandomSuffixEntry const* item_rand = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); if (item_rand) { for (int k = 0; k < MAX_ITEM_ENCHANTMENT_EFFECTS; ++k) @@ -13615,7 +13634,7 @@ void Player::ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool { if (!enchant_amount) { - ItemRandomSuffixEntry const *item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); + ItemRandomSuffixEntry const* item_rand_suffix = sItemRandomSuffixStore.LookupEntry(abs(item->GetItemRandomPropertyId())); if (item_rand_suffix) { for (int k = 0; k < MAX_ITEM_ENCHANTMENT_EFFECTS; ++k) @@ -13885,7 +13904,7 @@ void Player::UpdateSkillEnchantments(uint16 skill_id, uint16 curr_value, uint16 if (!ench_id) continue; - SpellItemEnchantmentEntry const *Enchant = sSpellItemEnchantmentStore.LookupEntry(ench_id); + SpellItemEnchantmentEntry const* Enchant = sSpellItemEnchantmentStore.LookupEntry(ench_id); if (!Enchant) return; @@ -13903,7 +13922,7 @@ void Player::UpdateSkillEnchantments(uint16 skill_id, uint16 curr_value, uint16 if ((slot == SOCK_ENCHANTMENT_SLOT || slot == SOCK_ENCHANTMENT_SLOT_2 || slot == SOCK_ENCHANTMENT_SLOT_3) && !m_items[i]->GetTemplate()->Socket[slot-SOCK_ENCHANTMENT_SLOT].Color) { - SpellItemEnchantmentEntry const *pPrismaticEnchant = sSpellItemEnchantmentStore.LookupEntry(m_items[i]->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT)); + SpellItemEnchantmentEntry const* pPrismaticEnchant = sSpellItemEnchantmentStore.LookupEntry(m_items[i]->GetEnchantmentId(PRISMATIC_ENCHANTMENT_SLOT)); if (pPrismaticEnchant && pPrismaticEnchant->requiredSkill == skill_id) { @@ -13934,7 +13953,7 @@ void Player::SendItemDurations() } } -void Player::SendNewItem(Item *item, uint32 count, bool received, bool created, bool broadcast) +void Player::SendNewItem(Item* item, uint32 count, bool received, bool created, bool broadcast) { if (!item) // prevent crash return; @@ -14069,7 +14088,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool } else if (source->GetTypeId() == TYPEID_GAMEOBJECT) { - GameObject *go = source->ToGameObject(); + GameObject* go = source->ToGameObject(); switch (itr->second.OptionType) { @@ -14097,7 +14116,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool if (locale >= 0) { uint32 idxEntry = MAKE_PAIR32(menuId, itr->second.OptionIndex); - if (GossipMenuItemsLocale const *no = sObjectMgr->GetGossipMenuItemsLocale(idxEntry)) + if (GossipMenuItemsLocale const* no = sObjectMgr->GetGossipMenuItemsLocale(idxEntry)) { ObjectMgr::GetLocaleString(no->OptionText, locale, strOptionText); ObjectMgr::GetLocaleString(no->BoxText, locale, strBoxText); @@ -14329,7 +14348,7 @@ void Player::PrepareQuestMenu(uint64 guid) QuestRelationBounds pObjectQIR; // pets also can have quests - Creature *pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid); + Creature* pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid); if (pCreature) { pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(pCreature->GetEntry()); @@ -14339,9 +14358,9 @@ void Player::PrepareQuestMenu(uint64 guid) { //we should obtain map pointer from GetMap() in 99% of cases. Special case //only for quests which cast teleport spells on player - Map * _map = IsInWorld() ? GetMap() : sMapMgr->FindMap(GetMapId(), GetInstanceId()); + Map* _map = IsInWorld() ? GetMap() : sMapMgr->FindMap(GetMapId(), GetInstanceId()); ASSERT(_map); - GameObject *pGameObject = _map->GetGameObject(guid); + GameObject* pGameObject = _map->GetGameObject(guid); if (pGameObject) { pObjectQR = sObjectMgr->GetGOQuestRelationBounds(pGameObject->GetEntry()); @@ -14440,7 +14459,7 @@ void Player::SendPreparedQuest(uint64 guid) std::string title = ""; // need pet case for some quests - Creature *pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid); + Creature* pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid); if (pCreature) { uint32 textid = GetGossipTextId(pCreature); @@ -14461,7 +14480,7 @@ void Player::SendPreparedQuest(uint64 guid) int loc_idx = GetSession()->GetSessionDbLocaleIndex(); if (loc_idx >= 0) - if (NpcTextLocale const *nl = sObjectMgr->GetNpcTextLocale(textid)) + if (NpcTextLocale const* nl = sObjectMgr->GetNpcTextLocale(textid)) ObjectMgr::GetLocaleString(nl->Text_0[0], loc_idx, title); } else @@ -14470,7 +14489,7 @@ void Player::SendPreparedQuest(uint64 guid) int loc_idx = GetSession()->GetSessionDbLocaleIndex(); if (loc_idx >= 0) - if (NpcTextLocale const *nl = sObjectMgr->GetNpcTextLocale(textid)) + if (NpcTextLocale const* nl = sObjectMgr->GetNpcTextLocale(textid)) ObjectMgr::GetLocaleString(nl->Text_1[0], loc_idx, title); } } @@ -14484,20 +14503,20 @@ bool Player::IsActiveQuest(uint32 quest_id) const return m_QuestStatus.find(quest_id) != m_QuestStatus.end(); } -Quest const* Player::GetNextQuest(uint64 guid, Quest const *pQuest) +Quest const* Player::GetNextQuest(uint64 guid, Quest const* pQuest) { QuestRelationBounds pObjectQR; - Creature *pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid); + Creature* pCreature = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, guid); if (pCreature) pObjectQR = sObjectMgr->GetCreatureQuestRelationBounds(pCreature->GetEntry()); else { //we should obtain map pointer from GetMap() in 99% of cases. Special case //only for quests which cast teleport spells on player - Map * _map = IsInWorld() ? GetMap() : sMapMgr->FindMap(GetMapId(), GetInstanceId()); + Map* _map = IsInWorld() ? GetMap() : sMapMgr->FindMap(GetMapId(), GetInstanceId()); ASSERT(_map); - GameObject *pGameObject = _map->GetGameObject(guid); + GameObject* pGameObject = _map->GetGameObject(guid); if (pGameObject) pObjectQR = sObjectMgr->GetGOQuestRelationBounds(pGameObject->GetEntry()); else @@ -14514,13 +14533,13 @@ Quest const* Player::GetNextQuest(uint64 guid, Quest const *pQuest) return NULL; } -bool Player::CanSeeStartQuest(Quest const *pQuest) +bool Player::CanSeeStartQuest(Quest const* pQuest) { if (SatisfyQuestRace(pQuest, false) && SatisfyQuestSkillOrClass(pQuest, false) && SatisfyQuestExclusiveGroup(pQuest, false) && SatisfyQuestReputation(pQuest, false) && SatisfyQuestPreviousQuest(pQuest, false) && SatisfyQuestNextChain(pQuest, false) && SatisfyQuestPrevChain(pQuest, false) && SatisfyQuestDay(pQuest, false) && SatisfyQuestWeek(pQuest, false) && - !sDisableMgr->IsDisabledFor(DISABLE_TYPE_QUEST, pQuest->GetQuestId(), this)) + !DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, pQuest->GetQuestId(), this)) { return getLevel() + sWorld->getIntConfig(CONFIG_QUEST_HIGH_LEVEL_HIDE_DIFF) >= pQuest->GetMinLevel(); } @@ -14528,7 +14547,7 @@ bool Player::CanSeeStartQuest(Quest const *pQuest) return false; } -bool Player::CanTakeQuest(Quest const *pQuest, bool msg) +bool Player::CanTakeQuest(Quest const* pQuest, bool msg) { return SatisfyQuestStatus(pQuest, msg) && SatisfyQuestExclusiveGroup(pQuest, msg) && SatisfyQuestRace(pQuest, msg) && SatisfyQuestLevel(pQuest, msg) @@ -14536,11 +14555,11 @@ bool Player::CanTakeQuest(Quest const *pQuest, bool msg) && SatisfyQuestPreviousQuest(pQuest, msg) && SatisfyQuestTimed(pQuest, msg) && SatisfyQuestNextChain(pQuest, msg) && SatisfyQuestPrevChain(pQuest, msg) && SatisfyQuestDay(pQuest, msg) && SatisfyQuestWeek(pQuest, msg) - && !sDisableMgr->IsDisabledFor(DISABLE_TYPE_QUEST, pQuest->GetQuestId(), this) + && !DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, pQuest->GetQuestId(), this) && SatisfyQuestConditions(pQuest, msg); } -bool Player::CanAddQuest(Quest const *pQuest, bool msg) +bool Player::CanAddQuest(Quest const* pQuest, bool msg) { if (!SatisfyQuestLog(msg)) return false; @@ -14610,6 +14629,10 @@ bool Player::CanCompleteQuest(uint32 quest_id) } } + if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_PLAYER_KILL)) + if (qInfo->GetPlayersSlain() != 0 && q_status.m_playercount < qInfo->GetPlayersSlain()) + return false; + if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT) && !q_status.m_explored) return false; @@ -14632,7 +14655,7 @@ bool Player::CanCompleteQuest(uint32 quest_id) return false; } -bool Player::CanCompleteRepeatableQuest(Quest const *pQuest) +bool Player::CanCompleteRepeatableQuest(Quest const* pQuest) { // Solve problem that player don't have the quest and try complete it. // if repeatable she must be able to complete event if player don't have it. @@ -14651,7 +14674,7 @@ bool Player::CanCompleteRepeatableQuest(Quest const *pQuest) return true; } -bool Player::CanRewardQuest(Quest const *pQuest, bool msg) +bool Player::CanRewardQuest(Quest const* pQuest, bool msg) { // not auto complete quest and not completed quest (only cheating case, then ignore without message) if (!pQuest->IsDFQuest() && !pQuest->IsAutoComplete() && !(pQuest->GetFlags() & QUEST_FLAGS_AUTOCOMPLETE) && GetQuestStatus(pQuest->GetQuestId()) != QUEST_STATUS_COMPLETE) @@ -14687,7 +14710,7 @@ bool Player::CanRewardQuest(Quest const *pQuest, bool msg) return true; } -bool Player::CanRewardQuest(Quest const *pQuest, uint32 reward, bool msg) +bool Player::CanRewardQuest(Quest const* pQuest, uint32 reward, bool msg) { // prevent receive reward with quest items in bank or for not completed quest if (!CanRewardQuest(pQuest, msg)) @@ -14727,7 +14750,7 @@ bool Player::CanRewardQuest(Quest const *pQuest, uint32 reward, bool msg) return true; } -void Player::AddQuest(Quest const *pQuest, Object *questGiver) +void Player::AddQuest(Quest const* pQuest, Object* questGiver) { uint16 log_slot = FindQuestSlot(0); ASSERT(log_slot < MAX_QUEST_LOG_SIZE); @@ -14753,6 +14776,9 @@ void Player::AddQuest(Quest const *pQuest, Object *questGiver) questStatusData.m_creatureOrGOcount[i] = 0; } + if (pQuest->HasFlag(QUEST_TRINITY_FLAGS_PLAYER_KILL)) + questStatusData.m_playercount = 0; + GiveQuestSourceItem(pQuest); AdjustQuestReqItemCount(pQuest, questStatusData); @@ -14838,7 +14864,7 @@ void Player::IncompleteQuest(uint32 quest_id) } } -void Player::RewardQuest(Quest const *pQuest, uint32 reward, Object* questGiver, bool announce) +void Player::RewardQuest(Quest const* pQuest, uint32 reward, Object* questGiver, bool announce) { //this THING should be here to protect code from quest, which cast on player far teleport as a reward //should work fine, cause far teleport will be executed in Player::Update() @@ -15438,7 +15464,7 @@ bool Player::SatisfyQuestWeek(Quest const* qInfo, bool /*msg*/) return m_weeklyquests.find(qInfo->GetQuestId()) == m_weeklyquests.end(); } -bool Player::GiveQuestSourceItem(Quest const *pQuest) +bool Player::GiveQuestSourceItem(Quest const* pQuest) { uint32 srcitem = pQuest->GetSrcItemId(); if (srcitem > 0) @@ -15642,11 +15668,11 @@ 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* pGroup = GetGroup()) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { - Player *pGroupGuy = itr->getSource(); + Player* pGroupGuy = itr->getSource(); // for any leave or dead (with not released body) group member at appropriate distance if (pGroupGuy && pGroupGuy->IsAtGroupRewardDistance(pEventObject) && !pGroupGuy->GetCorpse()) @@ -15816,6 +15842,46 @@ void Player::KilledMonsterCredit(uint32 entry, uint64 guid) } } +void Player::KilledPlayerCredit() +{ + uint16 addkillcount = 1; + + for (uint8 i = 0; i < MAX_QUEST_LOG_SIZE; ++i) + { + uint32 questid = GetQuestSlotQuestId(i); + if (!questid) + continue; + + Quest const* qInfo = sObjectMgr->GetQuestTemplate(questid); + if (!qInfo) + continue; + // just if !ingroup || !noraidgroup || raidgroup + QuestStatusData& q_status = m_QuestStatus[questid]; + if (q_status.m_status == QUEST_STATUS_INCOMPLETE && (!GetGroup() || !GetGroup()->isRaidGroup() || qInfo->IsAllowedInRaid())) + { + if (qInfo->HasFlag(QUEST_TRINITY_FLAGS_PLAYER_KILL)) + { + uint32 reqkill = qInfo->GetPlayersSlain(); + uint16 curkill = q_status.m_playercount; + + if (curkill < reqkill) + { + q_status.m_playercount = curkill + addkillcount; + + m_QuestStatusSave[questid] = true; + + SendQuestUpdateAddPlayer(qInfo, curkill, addkillcount); + } + + if (CanCompleteQuest(questid)) + CompleteQuest(questid); + + break; + } + } + } +} + void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id) { bool isCreature = IS_CRE_OR_VEH_GUID(guid); @@ -15854,7 +15920,7 @@ void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id) reqTarget = qInfo->ReqCreatureOrGOId[j]; if (reqTarget != entry) // if entry doesn't match, check for killcredits referenced in template { - CreatureTemplate const *cinfo = sObjectMgr->GetCreatureTemplate(entry); + CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); for (uint8 i = 0; i < MAX_KILL_CREDIT; ++i) if (cinfo->KillCredit[i] == reqTarget) entry = cinfo->KillCredit[i]; @@ -16076,7 +16142,7 @@ bool Player::HasQuestForItem(uint32 itemid) const // examined item is a source item if (qinfo->ReqSourceId[j] == itemid) { - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(itemid); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(itemid); // 'unique' item if (pProto->MaxCount && int32(GetItemCount(itemid, true)) < pProto->MaxCount) @@ -16107,7 +16173,7 @@ void Player::SendQuestComplete(uint32 quest_id) } } -void Player::SendQuestReward(Quest const *pQuest, uint32 XP, Object * questGiver) +void Player::SendQuestReward(Quest const* pQuest, uint32 XP, Object* questGiver) { uint32 questid = pQuest->GetQuestId(); sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTGIVER_QUEST_COMPLETE quest = %u", questid); @@ -16187,7 +16253,7 @@ void Player::SendQuestConfirmAccept(const Quest* pQuest, Player* pReceiver) } } -void Player::SendPushToPartyResponse(Player *pPlayer, uint32 msg) +void Player::SendPushToPartyResponse(Player* pPlayer, uint32 msg) { if (pPlayer) { @@ -16231,6 +16297,22 @@ void Player::SendQuestUpdateAddCreatureOrGo(Quest const* pQuest, uint64 guid, ui SetQuestSlotCounter(log_slot, creatureOrGO_idx, GetQuestSlotCounter(log_slot, creatureOrGO_idx)+add_count); } +void Player::SendQuestUpdateAddPlayer(Quest const* pQuest, uint16 old_count, uint16 add_count) +{ + ASSERT(old_count + add_count < 65536 && "player count store in 16 bits"); + + WorldPacket data(SMSG_QUESTUPDATE_ADD_PVP_KILL, (3*4)); + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_QUESTUPDATE_ADD_PVP_KILL"); + data << uint32(pQuest->GetQuestId()); + data << uint32(old_count + add_count); + data << uint32(pQuest->GetPlayersSlain()); + GetSession()->SendPacket(&data); + + uint16 log_slot = FindQuestSlot(pQuest->GetQuestId()); + if (log_slot < MAX_QUEST_LOG_SIZE) + SetQuestSlotCounter(log_slot, QUEST_PVP_KILL_SLOT, GetQuestSlotCounter(log_slot, QUEST_PVP_KILL_SLOT) + add_count); +} + /*********************************************************/ /*** LOAD SYSTEM ***/ /*********************************************************/ @@ -16352,7 +16434,7 @@ bool Player::LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, flo if (!result) return false; - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); x = fields[0].GetFloat(); y = fields[1].GetFloat(); @@ -16403,7 +16485,7 @@ float Player::GetFloatValueFromArray(Tokens const& data, uint16 index) bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) { //// 0 1 2 3 4 5 6 7 8 9 10 11 - //QueryResult *result = CharacterDatabase.PQuery("SELECT guid, account, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, " + //QueryResult* result = CharacterDatabase.PQuery("SELECT guid, account, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, " // 12 13 14 15 16 17 18 19 20 21 22 23 24 //"position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, " // 25 26 27 28 29 30 31 32 33 34 35 36 37 38 @@ -16444,7 +16526,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) // check name limitations if (ObjectMgr::CheckPlayerName(m_name) != CHAR_NAME_SUCCESS || - (GetSession()->GetSecurity() == SEC_PLAYER && sObjectMgr->IsReservedName(m_name))) + (AccountMgr::IsPlayerAccount(GetSession()->GetSecurity()) && sObjectMgr->IsReservedName(m_name))) { CharacterDatabase.PExecute("UPDATE characters SET at_login = at_login | '%u' WHERE guid ='%u'", uint32(AT_LOGIN_RENAME), guid); return false; @@ -16555,7 +16637,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) if (!arena_team_id) continue; - if (ArenaTeam * at = sArenaTeamMgr->GetArenaTeamById(arena_team_id)) + if (ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(arena_team_id)) if (at->IsMember(GetGUID())) continue; @@ -16584,7 +16666,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) // Player was saved in Arena or Bg else if (mapEntry && mapEntry->IsBattlegroundOrArena()) { - Battleground *currentBg = NULL; + Battleground* currentBg = NULL; if (m_bgData.bgInstanceID) //saved in Battleground currentBg = sBattlegroundMgr->GetBattleground(m_bgData.bgInstanceID, BATTLEGROUND_TYPE_NONE); @@ -16723,16 +16805,16 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) RelocateToHomebind(); } - // fix crash (because of if (Map *map = _FindMap(instanceId)) in MapInstanced::CreateInstance) + // fix crash (because of if (Map* map = _FindMap(instanceId)) in MapInstanced::CreateInstance) if (instanceId) - if (InstanceSave * save = GetInstanceSave(mapId, mapEntry->IsRaid())) + if (InstanceSave* save = GetInstanceSave(mapId, mapEntry->IsRaid())) if (save->GetInstanceId() != instanceId) instanceId = 0; } // NOW player must have valid map // load the player's map here if it's not already loaded - Map *map = sMapMgr->CreateMap(mapId, this, instanceId); + Map* map = sMapMgr->CreateMap(mapId, this, instanceId); if (!map) { @@ -16753,7 +16835,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) map = sMapMgr->CreateMap(mapId, this, 0); if (!map) { - PlayerInfo const *info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); + PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); mapId = info->mapId; Relocate(info->positionX, info->positionY, info->positionZ, 0.0f); sLog->outError("Player (guidlow %d) have invalid coordinates (X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.", guid, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); @@ -16972,7 +17054,7 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) outDebugValues(); // GM state - if (GetSession()->GetSecurity() > SEC_PLAYER) + if (!AccountMgr::IsPlayerAccount(GetSession()->GetSecurity())) { switch (sWorld->getIntConfig(CONFIG_GM_LOGIN_STATE)) { @@ -17039,7 +17121,10 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) bool Player::isAllowedToLoot(const Creature* creature) { if (!creature->isDead() || !creature->IsDamageEnoughForLootingAndReward()) - return false; + return false; + + if (HasPendingBind()) + return false; const Loot* loot = &creature->loot; if (loot->isLooted()) // nothing to loot or everything looted. @@ -17111,7 +17196,7 @@ void Player::_LoadAuras(PreparedQueryResult result, uint32 timediff) sLog->outDebug(LOG_FILTER_PLAYER_LOADING, "Loading auras for player %u", GetGUIDLow()); /* 0 1 2 3 4 5 6 7 8 9 10 - QueryResult *result = CharacterDatabase.PQuery("SELECT caster_guid, spell, effect_mask, recalculate_mask, stackcount, amount0, amount1, amount2, base_amount0, base_amount1, base_amount2, + QueryResult* result = CharacterDatabase.PQuery("SELECT caster_guid, spell, effect_mask, recalculate_mask, stackcount, amount0, amount1, amount2, base_amount0, base_amount1, base_amount2, 11 12 13 maxduration, remaintime, remaincharges FROM character_aura WHERE guid = '%u'", GetGUIDLow()); */ @@ -17188,9 +17273,9 @@ void Player::_LoadGlyphAuras() { if (uint32 glyph = GetGlyph(i)) { - if (GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph)) + if (GlyphPropertiesEntry const* gp = sGlyphPropertiesStore.LookupEntry(glyph)) { - if (GlyphSlotEntry const *gs = sGlyphSlotStore.LookupEntry(GetGlyphSlot(i))) + if (GlyphSlotEntry const* gs = sGlyphSlotStore.LookupEntry(GetGlyphSlot(i))) { if (gp->TypeFlags == gs->TypeFlags) { @@ -17218,7 +17303,7 @@ void Player::LoadCorpse() sObjectAccessor->ConvertCorpseForPlayer(GetGUID()); else { - if (Corpse *corpse = GetCorpse()) + if (Corpse* corpse = GetCorpse()) ApplyModFlag(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTE_RELEASE_TIMER, corpse && !sMapStore.LookupEntry(corpse->GetMapId())->Instanceable()); else //Prevent Dead Player login without corpse @@ -17228,7 +17313,7 @@ void Player::LoadCorpse() void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) { - //QueryResult *result = CharacterDatabase.PQuery("SELECT data, text, bag, slot, item, item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '%u' ORDER BY bag, slot", GetGUIDLow()); + //QueryResult* result = CharacterDatabase.PQuery("SELECT data, text, bag, slot, item, item_template FROM character_inventory JOIN item_instance ON character_inventory.item = item_instance.guid WHERE character_inventory.guid = '%u' ORDER BY bag, slot", GetGUIDLow()); //NOTE: the "order by `bag`" is important because it makes sure //the bagMap is filled before items in the bags are loaded //NOTE2: the "order by `slot`" is needed because mainhand weapons are (wrongly?) @@ -17451,7 +17536,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F } // load mailed item which should receive current player -void Player::_LoadMailedItems(Mail *mail) +void Player::_LoadMailedItems(Mail* mail) { // data needs to be at first place for Item::LoadFromDB PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_LOAD_PLAYER_MAILITEMS); @@ -17469,7 +17554,7 @@ void Player::_LoadMailedItems(Mail *mail) mail->AddItem(item_guid_low, item_template); - ItemTemplate const *proto = sObjectMgr->GetItemTemplate(item_template); + ItemTemplate const* proto = sObjectMgr->GetItemTemplate(item_template); if (!proto) { @@ -17481,7 +17566,7 @@ void Player::_LoadMailedItems(Mail *mail) continue; } - Item *item = NewItemOrBag(proto); + Item* item = NewItemOrBag(proto); if (!item->LoadFromDB(item_guid_low, MAKE_NEW_GUID(fields[13].GetUInt32(), 0, HIGHGUID_PLAYER), fields, item_template)) { @@ -17502,7 +17587,7 @@ void Player::_LoadMailedItems(Mail *mail) void Player::_LoadMailInit(PreparedQueryResult resultUnread, PreparedQueryResult resultDelivery) { //set a count of unread mails - //QueryResult *resultMails = CharacterDatabase.PQuery("SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" UI64FMTD "'", GUID_LOPART(playerGuid), (uint64)cTime); + //QueryResult* resultMails = CharacterDatabase.PQuery("SELECT COUNT(id) FROM mail WHERE receiver = '%u' AND (checked & 1)=0 AND deliver_time <= '" UI64FMTD "'", GUID_LOPART(playerGuid), (uint64)cTime); if (resultUnread) unReadMails = (*resultUnread)[0].GetUInt8(); @@ -17521,8 +17606,8 @@ void Player::_LoadMail() { do { - Field *fields = result->Fetch(); - Mail *m = new Mail; + Field* fields = result->Fetch(); + Mail* m = new Mail; m->messageID = fields[0].GetUInt32(); m->messageType = fields[1].GetUInt8(); m->sender = fields[2].GetUInt32(); @@ -17562,7 +17647,7 @@ void Player::LoadPet() // just not added to the map if (IsInWorld()) { - Pet *pet = new Pet(this); + Pet* pet = new Pet(this); if (!pet->LoadPetFromDB(this, 0, 0, true)) delete pet; } @@ -17573,9 +17658,9 @@ void Player::_LoadQuestStatus(PreparedQueryResult result) uint16 slot = 0; //// 0 1 2 3 4 5 6 7 8 9 10 - //QueryResult *result = CharacterDatabase.PQuery("SELECT quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, itemcount1, itemcount2, itemcount3, - // 11 - // itemcount4 FROM character_queststatus WHERE guid = '%u'", GetGUIDLow()); + //QueryResult* result = CharacterDatabase.PQuery("SELECT quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, itemcount1, itemcount2, itemcount3, + // 11 12 + // itemcount4, playercount FROM character_queststatus WHERE guid = '%u'", GetGUIDLow()); if (result) { @@ -17624,6 +17709,7 @@ void Player::_LoadQuestStatus(PreparedQueryResult result) questStatusData.m_itemcount[1] = fields[9].GetUInt16(); questStatusData.m_itemcount[2] = fields[10].GetUInt16(); questStatusData.m_itemcount[3] = fields[11].GetUInt16(); + questStatusData.m_playercount = fields[12].GetUInt16(); // add to quest log if (slot < MAX_QUEST_LOG_SIZE && questStatusData.m_status != QUEST_STATUS_NONE) @@ -17639,6 +17725,9 @@ void Player::_LoadQuestStatus(PreparedQueryResult result) if (questStatusData.m_creatureOrGOcount[idx]) SetQuestSlotCounter(slot, idx, questStatusData.m_creatureOrGOcount[idx]); + if (questStatusData.m_playercount) + SetQuestSlotCounter(slot, QUEST_PVP_KILL_SLOT, questStatusData.m_playercount); + ++slot; } @@ -17695,7 +17784,7 @@ void Player::_LoadDailyQuestStatus(PreparedQueryResult result) m_DFQuests.clear(); - //QueryResult *result = CharacterDatabase.PQuery("SELECT quest, time FROM character_queststatus_daily WHERE guid = '%u'", GetGUIDLow()); + //QueryResult* result = CharacterDatabase.PQuery("SELECT quest, time FROM character_queststatus_daily WHERE guid = '%u'", GetGUIDLow()); if (result) { @@ -17764,7 +17853,7 @@ void Player::_LoadWeeklyQuestStatus(PreparedQueryResult result) void Player::_LoadSpells(PreparedQueryResult result) { - //QueryResult *result = CharacterDatabase.PQuery("SELECT spell, active, disabled FROM character_spell WHERE guid = '%u'", GetGUIDLow()); + //QueryResult* result = CharacterDatabase.PQuery("SELECT spell, active, disabled FROM character_spell WHERE guid = '%u'", GetGUIDLow()); if (result) { @@ -17776,7 +17865,7 @@ void Player::_LoadSpells(PreparedQueryResult result) void Player::_LoadGroup(PreparedQueryResult result) { - //QueryResult *result = CharacterDatabase.PQuery("SELECT guid FROM group_member WHERE memberGuid=%u", GetGUIDLow()); + //QueryResult* result = CharacterDatabase.PQuery("SELECT guid FROM group_member WHERE memberGuid=%u", GetGUIDLow()); if (result) { if (Group* group = sGroupMgr->GetGroupByDbStoreId((*result)[0].GetUInt32())) @@ -17800,7 +17889,7 @@ void Player::_LoadBoundInstances(PreparedQueryResult result) Group* group = GetGroup(); - //QueryResult *result = CharacterDatabase.PQuery("SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = '%u'", GUID_LOPART(m_guid)); + //QueryResult* result = CharacterDatabase.PQuery("SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = '%u'", GUID_LOPART(m_guid)); if (result) { do @@ -17848,7 +17937,7 @@ void Player::_LoadBoundInstances(PreparedQueryResult result) } // since non permanent binds are always solo bind, they can always be reset - if (InstanceSave *save = sInstanceSaveMgr->AddInstanceSave(mapId, instanceId, Difficulty(difficulty), resetTime, !perm, true)) + if (InstanceSave* save = sInstanceSaveMgr->AddInstanceSave(mapId, instanceId, Difficulty(difficulty), resetTime, !perm, true)) BindToInstance(save, perm, true); } while (result->NextRow()); @@ -17869,13 +17958,13 @@ InstancePlayerBind* Player::GetBoundInstance(uint32 mapid, Difficulty difficulty return NULL; } -InstanceSave * Player::GetInstanceSave(uint32 mapid, bool raid) +InstanceSave* Player::GetInstanceSave(uint32 mapid, bool raid) { - InstancePlayerBind *pBind = GetBoundInstance(mapid, GetDifficulty(raid)); - InstanceSave *pSave = pBind ? pBind->save : NULL; + InstancePlayerBind* pBind = GetBoundInstance(mapid, GetDifficulty(raid)); + InstanceSave* pSave = pBind ? pBind->save : NULL; if (!pBind || !pBind->perm) if (Group* group = GetGroup()) - if (InstanceGroupBind *groupBind = group->GetBoundInstance(this)) + if (InstanceGroupBind* groupBind = group->GetBoundInstance(this)) pSave = groupBind->save; return pSave; @@ -17898,7 +17987,7 @@ void Player::UnbindInstance(BoundInstancesMap::iterator &itr, Difficulty difficu } } -InstancePlayerBind* Player::BindToInstance(InstanceSave *save, bool permanent, bool load) +InstancePlayerBind* Player::BindToInstance(InstanceSave* save, bool permanent, bool load) { if (save) { @@ -17937,10 +18026,14 @@ InstancePlayerBind* Player::BindToInstance(InstanceSave *save, bool permanent, b void Player::BindToInstance() { + InstanceSave* mapSave = sInstanceSaveMgr->GetInstanceSave(_pendingBindId); + if (!mapSave) //it seems sometimes mapSave is NULL, but I did not check why + return; + WorldPacket data(SMSG_INSTANCE_SAVE_CREATED, 4); data << uint32(0); GetSession()->SendPacket(&data); - BindToInstance(_pendingBind, true); + BindToInstance(mapSave, true); } void Player::SendRaidInfo() @@ -17960,7 +18053,7 @@ void Player::SendRaidInfo() { if (itr->second.perm) { - InstanceSave *save = itr->second.save; + InstanceSave* save = itr->second.save; data << uint32(save->GetMapId()); // map id data << uint32(save->GetDifficulty()); // difficulty data << uint64(save->GetInstanceId()); // instance id @@ -18069,7 +18162,7 @@ bool Player::Satisfy(AccessRequirement const* ar, uint32 target_map, bool report else if (ar->item2 && !HasItemCount(ar->item2, 1)) missingItem = ar->item2; - if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_MAP, target_map, this)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_MAP, target_map, this)) { GetSession()->SendAreaTriggerMessage("%s", GetSession()->GetTrinityString(LANG_INSTANCE_CLOSED)); return false; @@ -18133,7 +18226,7 @@ bool Player::CheckInstanceLoginValid() bool Player::_LoadHomeBind(PreparedQueryResult result) { - PlayerInfo const *info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); + PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); if (!info) { sLog->outError("Player (Name %s) has incorrect race/class pair. Can't be loaded.", GetName()); @@ -18449,7 +18542,7 @@ void Player::_SaveAuras(SQLTransaction& trans) if (!itr->second->CanBeSaved()) continue; - Aura * aura = itr->second; + Aura* aura = itr->second; int32 damage[MAX_SPELL_EFFECTS]; int32 baseDamage[MAX_SPELL_EFFECTS]; @@ -18500,7 +18593,7 @@ void Player::_SaveInventory(SQLTransaction& trans) // and remove those that aren't already for (uint8 i = BUYBACK_SLOT_START; i < BUYBACK_SLOT_END; ++i) { - Item *item = m_items[i]; + Item* item = m_items[i]; if (!item || item->GetState() == ITEM_NEW) continue; trans->PAppend("DELETE FROM character_inventory WHERE item = '%u'", item->GetGUIDLow()); @@ -18545,16 +18638,16 @@ void Player::_SaveInventory(SQLTransaction& trans) uint32 lowGuid = GetGUIDLow(); for (size_t i = 0; i < m_itemUpdateQueue.size(); ++i) { - Item *item = m_itemUpdateQueue[i]; + Item* item = m_itemUpdateQueue[i]; if (!item) continue; - Bag *container = item->GetContainer(); + Bag* container = item->GetContainer(); uint32 bag_guid = container ? container->GetGUIDLow() : 0; if (item->GetState() != ITEM_REMOVED) { - Item *test = GetItemByPos(item->GetBagSlot(), item->GetSlot()); + Item* test = GetItemByPos(item->GetBagSlot(), item->GetSlot()); if (test == NULL) { uint32 bagTestGUID = 0; @@ -18612,7 +18705,7 @@ void Player::_SaveMail(SQLTransaction& trans) for (PlayerMails::iterator itr = m_mail.begin(); itr != m_mail.end(); ++itr) { - Mail *m = (*itr); + Mail* m = (*itr); if (m->state == MAIL_STATE_CHANGED) { trans->PAppend("UPDATE mail SET has_items = '%u', expire_time = '" UI64FMTD "', deliver_time = '" UI64FMTD "', money = '%u', cod = '%u', checked = '%u' WHERE id = '%u'", @@ -18676,11 +18769,9 @@ void Player::_SaveQuestStatus(SQLTransaction& trans) { statusItr = m_QuestStatus.find(saveItr->first); if (statusItr != m_QuestStatus.end() && (keepAbandoned || statusItr->second.m_status != QUEST_STATUS_NONE)) - { - trans->PAppend("REPLACE INTO character_queststatus (guid, quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, itemcount1, itemcount2, itemcount3, itemcount4) " - "VALUES ('%u', '%u', '%u', '%u', '" UI64FMTD "', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')", - GetGUIDLow(), statusItr->first, statusItr->second.m_status, statusItr->second.m_explored, uint64(statusItr->second.m_timer / IN_MILLISECONDS+ sWorld->GetGameTime()), statusItr->second.m_creatureOrGOcount[0], statusItr->second.m_creatureOrGOcount[1], statusItr->second.m_creatureOrGOcount[2], statusItr->second.m_creatureOrGOcount[3], statusItr->second.m_itemcount[0], statusItr->second.m_itemcount[1], statusItr->second.m_itemcount[2], statusItr->second.m_itemcount[3]); - } + trans->PAppend("REPLACE INTO character_queststatus (guid, quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, itemcount1, itemcount2, itemcount3, itemcount4, playercount) " + "VALUES ('%u', '%u', '%u', '%u', '" UI64FMTD "', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u', '%u')", + GetGUIDLow(), statusItr->first, statusItr->second.m_status, statusItr->second.m_explored, uint64(statusItr->second.m_timer / IN_MILLISECONDS+ sWorld->GetGameTime()), statusItr->second.m_creatureOrGOcount[0], statusItr->second.m_creatureOrGOcount[1], statusItr->second.m_creatureOrGOcount[2], statusItr->second.m_creatureOrGOcount[3], statusItr->second.m_itemcount[0], statusItr->second.m_itemcount[1], statusItr->second.m_itemcount[2], statusItr->second.m_itemcount[3], statusItr->second.m_playercount); } else trans->PAppend("DELETE FROM character_queststatus WHERE guid = %u AND quest = %u", GetGUIDLow(), saveItr->first); @@ -18872,7 +18963,7 @@ void Player::outDebugValues() const void Player::UpdateSpeakTime() { // ignore chat spam protection for GMs in any mode - if (GetSession()->GetSecurity() > SEC_PLAYER) + if (!AccountMgr::IsPlayerAccount(GetSession()->GetSecurity())) return; time_t current = time (NULL); @@ -19028,8 +19119,8 @@ void Player::ResetInstances(uint8 method, bool isRaid) for (BoundInstancesMap::iterator itr = m_boundInstances[diff].begin(); itr != m_boundInstances[diff].end();) { - InstanceSave *p = itr->second.save; - const MapEntry *entry = sMapStore.LookupEntry(itr->first); + InstanceSave* p = itr->second.save; + const MapEntry* entry = sMapStore.LookupEntry(itr->first); if (!entry || entry->IsRaid() != isRaid || !p->CanReset()) { ++itr; @@ -19047,7 +19138,7 @@ void Player::ResetInstances(uint8 method, bool isRaid) } // if the map is loaded, reset it - Map *map = sMapMgr->FindMap(p->GetMapId(), p->GetInstanceId()); + Map* map = sMapMgr->FindMap(p->GetMapId(), p->GetInstanceId()); if (map && map->IsDungeon()) if (!((InstanceMap*)map)->Reset(method)) { @@ -19175,7 +19266,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent) { //returning of reagents only for players, so best done here uint32 spellId = pet ? pet->GetUInt32Value(UNIT_CREATED_BY_SPELL) : m_oldpetspell; - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellId); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (spellInfo) { @@ -19264,7 +19355,7 @@ void Player::StopCastingCharm() } } -inline void Player::BuildPlayerChat(WorldPacket *data, uint8 msgtype, const std::string& text, uint32 language) const +inline void Player::BuildPlayerChat(WorldPacket* data, uint8 msgtype, const std::string& text, uint32 language) const { *data << uint8(msgtype); *data << uint32(language); @@ -19313,7 +19404,7 @@ void Player::Whisper(const std::string& text, uint32 language, uint64 receiver) if (!isAddonMessage) // if not addon data language = LANG_UNIVERSAL; // whispers should always be readable - Player *rPlayer = ObjectAccessor::FindPlayer(receiver); + Player* rPlayer = ObjectAccessor::FindPlayer(receiver); std::string _text(text); sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, language, _text, rPlayer); @@ -19365,7 +19456,7 @@ void Player::PetSpellInitialize() sLog->outDebug(LOG_FILTER_PETS, "Pet Spells Groups"); - CharmInfo *charmInfo = pet->GetCharmInfo(); + CharmInfo* charmInfo = pet->GetCharmInfo(); WorldPacket data(SMSG_PET_SPELLS, 8+2+4+4+4*MAX_UNIT_ACTION_BAR_INDEX+1+1); data << uint64(pet->GetGUID()); @@ -19422,8 +19513,6 @@ void Player::PetSpellInitialize() data << uint32(cooldown); // category cooldown } - data.hexlike(); - GetSession()->SendPacket(&data); } @@ -19433,7 +19522,7 @@ void Player::PossessSpellInitialize() if (!charm) return; - CharmInfo *charmInfo = charm->GetCharmInfo(); + CharmInfo* charmInfo = charm->GetCharmInfo(); if (!charmInfo) { @@ -19542,7 +19631,7 @@ void Player::CharmSpellInitialize() if (!charm) return; - CharmInfo *charmInfo = charm->GetCharmInfo(); + CharmInfo* charmInfo = charm->GetCharmInfo(); if (!charmInfo) { sLog->outError("Player::CharmSpellInitialize(): the player's charm ("UI64FMTD") has no charminfo!", charm->GetGUID()); @@ -19552,7 +19641,7 @@ void Player::CharmSpellInitialize() uint8 addlist = 0; if (charm->GetTypeId() != TYPEID_PLAYER) { - //CreatureInfo const *cinfo = charm->ToCreature()->GetCreatureInfo(); + //CreatureInfo const* cinfo = charm->ToCreature()->GetCreatureInfo(); //if (cinfo && cinfo->type == CREATURE_TYPE_DEMON && getClass() == CLASS_WARLOCK) { for (uint32 i = 0; i < MAX_SPELL_CHARM; ++i) @@ -19579,7 +19668,7 @@ void Player::CharmSpellInitialize() { for (uint32 i = 0; i < MAX_SPELL_CHARM; ++i) { - CharmSpellInfo *cspell = charmInfo->GetCharmSpell(i); + CharmSpellInfo* cspell = charmInfo->GetCharmSpell(i); if (cspell->GetAction()) data << uint32(cspell->packedData); } @@ -19597,7 +19686,7 @@ void Player::SendRemoveControlBar() GetSession()->SendPacket(&data); } -bool Player::IsAffectedBySpellmod(SpellInfo const *spellInfo, SpellModifier *mod, Spell* spell) +bool Player::IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier* mod, Spell* spell) { if (!mod || !spellInfo) return false; @@ -19664,7 +19753,7 @@ void Player::RestoreSpellMods(Spell* spell, uint32 ownerAuraId, Aura* aura) { for (SpellModList::iterator itr = m_spellMods[i].begin(); itr != m_spellMods[i].end(); ++itr) { - SpellModifier *mod = *itr; + SpellModifier* mod = *itr; // spellmods without aura set cannot be charged if (!mod->ownerAura || !mod->ownerAura->IsUsingCharges()) @@ -19721,7 +19810,7 @@ void Player::RemoveSpellMods(Spell* spell) { for (SpellModList::iterator itr = m_spellMods[i].begin(); itr != m_spellMods[i].end();) { - SpellModifier *mod = *itr; + SpellModifier* mod = *itr; ++itr; // spellmods without aura set cannot be charged @@ -19789,7 +19878,7 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type) { do // this part effectively does nothing, since the deletion / modification only takes place _after_ the PetitionQuery. Though I don't know if the result remains intact if I execute the delete query beforehand. { // and SendPetitionQueryOpcode reads data from the DB - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint64 ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); uint64 petitionguid = MAKE_NEW_GUID(fields[1].GetUInt32(), 0, HIGHGUID_ITEM); @@ -20166,7 +20255,7 @@ void Player::ProhibitSpellSchool(SpellSchoolMask idSchoolMask, uint32 unTimeMs) if (itr->second->state == PLAYERSPELL_REMOVED) continue; uint32 unSpellId = itr->first; - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(unSpellId); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(unSpellId); if (!spellInfo) { ASSERT(spellInfo); @@ -20239,7 +20328,7 @@ void Player::InitDataForForm(bool reapplyMods) void Player::InitDisplayIds() { - PlayerInfo const *info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); + PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); if (!info) { sLog->outError("Player %u has incorrect race/class pair. Can't init display ids.", GetGUIDLow()); @@ -20263,7 +20352,7 @@ void Player::InitDisplayIds() } } -inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const *pProto, Creature *pVendor, VendorItem const* crItem, bool bStore) +inline bool Player::_StoreOrEquipNewItem(uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot, int32 price, ItemTemplate const* pProto, Creature* pVendor, VendorItem const* crItem, bool bStore) { ItemPosCountVec vDest; uint16 uiDest = 0; @@ -20338,14 +20427,14 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 if (!isAlive()) return false; - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(item); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item); if (!pProto) { SendBuyError(BUY_ERR_CANT_FIND_ITEM, NULL, item, 0); return false; } - Creature *pCreature = GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); + Creature* pCreature = GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); if (!pCreature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: BuyItemFromVendor - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid))); @@ -20476,7 +20565,7 @@ uint32 Player::GetMaxPersonalArenaRatingRequirement(uint32 minarenaslot) const uint32 max_personal_rating = 0; for (uint8 i = minarenaslot; i < MAX_ARENA_SLOT; ++i) { - if (ArenaTeam * at = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamId(i))) + if (ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(GetArenaTeamId(i))) { uint32 p_rating = GetArenaPersonalRating(i); uint32 t_rating = at->GetRating(); @@ -20530,6 +20619,7 @@ void Player::UpdateHomebindTime(uint32 time) void Player::UpdatePvPState(bool onlyFFA) { // TODO: should we always synchronize UNIT_FIELD_BYTES_2, 1 of controller and controlled? + // no, we shouldn't, those are checked for affecting player by client if (!pvpInfo.inNoPvPArea && !isGameMaster() && (pvpInfo.inFFAPvPArea || sWorld->IsFFAPvPRealm())) { @@ -20722,7 +20812,7 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot) if (!enchantmentcondition) return true; - SpellItemEnchantmentConditionEntry const *Condition = sSpellItemEnchantmentConditionStore.LookupEntry(enchantmentcondition); + SpellItemEnchantmentConditionEntry const* Condition = sSpellItemEnchantmentConditionStore.LookupEntry(enchantmentcondition); if (!Condition) return true; @@ -20734,7 +20824,7 @@ bool Player::EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot) { if (i == slot) continue; - Item *pItem2 = GetItemByPos(INVENTORY_SLOT_BAG_0, i); + Item* pItem2 = GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (pItem2 && !pItem2->IsBroken() && pItem2->GetTemplate()->Socket[0].Color) { for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+3; ++enchant_slot) @@ -20852,7 +20942,7 @@ void Player::ToggleMetaGemsActive(uint8 exceptslot, bool apply) if (slot == exceptslot) continue; - Item *pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, slot); + Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, slot); if (!pItem || !pItem->GetTemplate()->Socket[0].Color) //if item has no sockets or no item is equipped go to next item continue; @@ -20887,7 +20977,6 @@ void Player::SetBattlegroundEntryPoint() // On taxi we don't need check for dungeon m_bgData.joinPos = WorldLocation(GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); - return; } else { @@ -20907,28 +20996,22 @@ void Player::SetBattlegroundEntryPoint() if (GetMap()->IsDungeon()) { if (const WorldSafeLocsEntry* entry = sObjectMgr->GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam())) - { m_bgData.joinPos = WorldLocation(entry->map_id, entry->x, entry->y, entry->z, 0.0f); - return; - } else sLog->outError("SetBattlegroundEntryPoint: Dungeon map %u has no linked graveyard, setting home location as entry point.", GetMapId()); } // If new entry point is not BG or arena set it else if (!GetMap()->IsBattlegroundOrArena()) - { m_bgData.joinPos = WorldLocation(GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation()); - return; - } } - // In error cases use homebind position - m_bgData.joinPos = WorldLocation(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, 0.0f); + if (m_bgData.joinPos.m_mapId == MAPID_INVALID) // In error cases use homebind position + m_bgData.joinPos = WorldLocation(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, 0.0f); } void Player::LeaveBattleground(bool teleportToEntryPoint) { - if (Battleground *bg = GetBattleground()) + if (Battleground* bg = GetBattleground()) { bg->RemovePlayerAtLeave(GetGUID(), teleportToEntryPoint, true); @@ -20992,7 +21075,7 @@ void Player::ReportedAfkBy(Player* reporter) WorldLocation Player::GetStartPosition() const { - PlayerInfo const *info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); + PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); uint32 mapId = info->mapId; if (getClass() == CLASS_DEATH_KNIGHT && HasSpell(50977)) mapId = 0; @@ -21052,7 +21135,7 @@ bool Player::IsVisibleGloballyFor(Player* u) const return true; // GMs are visible for higher gms (or players are visible for gms) - if (u->GetSession()->GetSecurity() > SEC_PLAYER) + if (!AccountMgr::IsPlayerAccount(u->GetSession()->GetSecurity())) return GetSession()->GetSecurity() <= u->GetSession()->GetSecurity(); // non faction visibility non-breakable for non-GMs @@ -21155,7 +21238,7 @@ void Player::UpdateTriggerVisibility() { if (IS_CREATURE_GUID(*itr)) { - Creature *obj = GetMap()->GetCreature(*itr); + Creature* obj = GetMap()->GetCreature(*itr); if (!obj || !(obj->isTrigger() || obj->HasAuraType(SPELL_AURA_TRANSFORM))) // can transform into triggers continue; @@ -21281,7 +21364,7 @@ Player* Player::GetSelectedPlayer() const void Player::SendComboPoints() { - Unit *combotarget = ObjectAccessor::GetUnit(*this, m_comboTarget); + Unit* combotarget = ObjectAccessor::GetUnit(*this, m_comboTarget); if (combotarget) { WorldPacket data; @@ -21502,7 +21585,7 @@ void Player::SendUpdateToOutOfRangeGroupMembers() m_groupUpdateMask = GROUP_UPDATE_FLAG_NONE; m_auraRaidUpdateMask = 0; - if (Pet *pet = GetPet()) + if (Pet* pet = GetPet()) pet->ResetAuraUpdateMaskForRaid(); } @@ -21598,7 +21681,7 @@ void Player::resetSpells(bool myClassOnly) for (PlayerSpellMap::const_iterator iter = smap.begin(); iter != smap.end(); ++iter) { - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(iter->first); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(iter->first); if (!spellInfo) continue; @@ -21635,7 +21718,7 @@ void Player::resetSpells(bool myClassOnly) void Player::learnDefaultSpells() { // learn default race/class spells - PlayerInfo const *info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); + PlayerInfo const* info = sObjectMgr->GetPlayerInfo(getRace(), getClass()); for (PlayerCreateInfoSpells::const_iterator itr = info->spell.begin(); itr != info->spell.end(); ++itr) { uint32 tspell = *itr; @@ -21663,7 +21746,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest) return; } - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id); if (!spellInfo) return; @@ -21691,7 +21774,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest) if (!HasSpell(first_spell)) return; - SpellInfo const *learnedInfo = sSpellMgr->GetSpellInfo(learned_0); + SpellInfo const* learnedInfo = sSpellMgr->GetSpellInfo(learned_0); if (!learnedInfo) return; @@ -21709,7 +21792,7 @@ void Player::learnQuestRewardedSpells(Quest const* quest) if (itr->second->state == PLAYERSPELL_REMOVED || itr->first == learned_0) continue; - SpellInfo const *itrInfo = sSpellMgr->GetSpellInfo(itr->first); + SpellInfo const* itrInfo = sSpellMgr->GetSpellInfo(itr->first); if (!itrInfo) return; @@ -21747,7 +21830,7 @@ void Player::learnSkillRewardedSpells(uint32 skill_id, uint32 skill_value) uint32 classMask = getClassMask(); for (uint32 j=0; j<sSkillLineAbilityStore.GetNumRows(); ++j) { - SkillLineAbilityEntry const *pAbility = sSkillLineAbilityStore.LookupEntry(j); + SkillLineAbilityEntry const* pAbility = sSkillLineAbilityStore.LookupEntry(j); if (!pAbility || pAbility->skillId != skill_id || pAbility->learnOnGetSkill != ABILITY_LEARNED_ON_GET_PROFESSION_SKILL) continue; // Check race if set @@ -21779,7 +21862,7 @@ void Player::SendAurasForTarget(Unit* target) WorldPacket data(SMSG_AURA_UPDATE_ALL); data.append(target->GetPackGUID()); - Unit::VisibleAuraMap const *visibleAuras = target->GetVisibleAuras(); + Unit::VisibleAuraMap const* visibleAuras = target->GetVisibleAuras(); for (Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr) { AuraApplication * auraApp = itr->second; @@ -21853,7 +21936,7 @@ Battleground* Player::GetBattleground() const bool Player::InArena() const { - Battleground *bg = GetBattleground(); + Battleground* bg = GetBattleground(); if (!bg || !bg->isArena()) return false; @@ -21863,7 +21946,7 @@ bool Player::InArena() const bool Player::GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const { // get a template bg instead of running one - Battleground *bg = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId); + Battleground* bg = sBattlegroundMgr->GetBattlegroundTemplate(bgTypeId); if (!bg) return false; @@ -21963,12 +22046,12 @@ void Player::UpdateForQuestWorldObjects() { if (IS_GAMEOBJECT_GUID(*itr)) { - if (GameObject *obj = HashMapHolder<GameObject>::Find(*itr)) + if (GameObject* obj = HashMapHolder<GameObject>::Find(*itr)) obj->BuildValuesUpdateBlockForPlayer(&udata, this); } else if (IS_CRE_OR_VEH_GUID(*itr)) { - Creature *obj = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, *itr); + Creature* obj = ObjectAccessor::GetCreatureOrPetOrVehicle(*this, *itr); if (!obj) continue; @@ -22010,7 +22093,7 @@ void Player::SummonIfPossible(bool agree) // drop flag at summon // this code can be reached only when GM is summoning player who carries flag, because player should be immune to summoning spells when he carries flag - if (Battleground *bg = GetBattleground()) + if (Battleground* bg = GetBattleground()) bg->EventPlayerDroppedFlag(this); m_summon_expire = 0; @@ -22020,7 +22103,7 @@ void Player::SummonIfPossible(bool agree) TeleportTo(m_summon_mapid, m_summon_x, m_summon_y, m_summon_z, GetOrientation()); } -void Player::RemoveItemDurations(Item *item) +void Player::RemoveItemDurations(Item* item) { for (ItemDurationList::iterator itr = m_itemDuration.begin(); itr != m_itemDuration.end(); ++itr) { @@ -22032,7 +22115,7 @@ void Player::RemoveItemDurations(Item *item) } } -void Player::AddItemDurations(Item *item) +void Player::AddItemDurations(Item* item) { if (item->GetUInt32Value(ITEM_FIELD_DURATION)) { @@ -22043,7 +22126,7 @@ void Player::AddItemDurations(Item *item) void Player::AutoUnequipOffhandIfNeed(bool force /*= false*/) { - Item *offItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); + Item* offItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); if (!offItem) return; @@ -22076,7 +22159,7 @@ void Player::AutoUnequipOffhandIfNeed(bool force /*= false*/) } } -OutdoorPvP * Player::GetOutdoorPvP() const +OutdoorPvP* Player::GetOutdoorPvP() const { return sOutdoorPvPMgr->GetOutdoorPvPToZoneId(GetZoneId()); } @@ -22093,7 +22176,7 @@ bool Player::HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item cons case ITEM_CLASS_WEAPON: { for (uint8 i= EQUIPMENT_SLOT_MAINHAND; i < EQUIPMENT_SLOT_TABARD; ++i) - if (Item *item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, i)) if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo)) return true; break; @@ -22102,17 +22185,17 @@ bool Player::HasItemFitToSpellRequirements(SpellInfo const* spellInfo, Item cons { // tabard not have dependent spells for (uint8 i= EQUIPMENT_SLOT_START; i< EQUIPMENT_SLOT_MAINHAND; ++i) - if (Item *item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, i)) + if (Item* item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, i)) if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo)) return true; // shields can be equipped to offhand slot - if (Item *item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND)) + if (Item* item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND)) if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo)) return true; // ranged slot can have some armor subclasses - if (Item *item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED)) + if (Item* item = GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_RANGED)) if (item != ignoreItem && item->IsFitToSpellRequirements(spellInfo)) return true; @@ -22148,7 +22231,7 @@ void Player::RemoveItemDependentAurasAndCasts(Item* pItem) { for (AuraMap::iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end();) { - Aura * aura = itr->second; + Aura* aura = itr->second; // skip passive (passive item dependent spells work in another way) and not self applied auras SpellInfo const* spellInfo = aura->GetSpellInfo(); @@ -22245,7 +22328,7 @@ bool Player::GetsRecruitAFriendBonus(bool forXP) { if (Group* group = this->GetGroup()) { - for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* pGroupGuy = itr->getSource(); if (!pGroupGuy) @@ -22291,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* pGroup = GetGroup()) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* pGroupGuy = itr->getSource(); if (!pGroupGuy) @@ -22526,14 +22609,14 @@ void Player::SendCorpseReclaimDelay(bool load) Player* Player::GetNextRandomRaidMember(float radius) { - Group *pGroup = GetGroup(); + Group* pGroup = GetGroup(); if (!pGroup) return NULL; std::vector<Player*> nearMembers; nearMembers.reserve(pGroup->GetMembersCount()); - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); @@ -22810,7 +22893,7 @@ uint32 Player::GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 n if ((hairstyle == newhairstyle) && (haircolor == newhaircolor) && (facialhair == newfacialhair) && (!newSkin || (newSkin->hair_id == skincolor))) return 0; - GtBarberShopCostBaseEntry const *bsc = sGtBarberShopCostBaseStore.LookupEntry(level - 1); + GtBarberShopCostBaseEntry const* bsc = sGtBarberShopCostBaseStore.LookupEntry(level - 1); if (!bsc) // shouldn't happen return 0xFFFFFFFF; @@ -22935,7 +23018,7 @@ bool Player::isTotalImmunity() void Player::UpdateCharmedAI() { //This should only called in Player::Update - Creature *charmer = GetCharmer()->ToCreature(); + Creature* charmer = GetCharmer()->ToCreature(); //kill self if charm aura has infinite duration if (charmer->IsInEvadeMode()) @@ -22953,7 +23036,7 @@ void Player::UpdateCharmedAI() GetMotionMaster()->MoveFollow(charmer, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); Unit* target = getVictim(); - if (!target || !charmer->canAttack(target)) + if (!target || !charmer->IsValidAttackTarget(target)) { target = charmer->SelectNearestTarget(); if (!target) @@ -23106,11 +23189,11 @@ void Player::AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore cons void Player::StoreLootItem(uint8 lootSlot, Loot* loot) { - QuestItem *qitem = NULL; - QuestItem *ffaitem = NULL; - QuestItem *conditem = NULL; + QuestItem* qitem = NULL; + QuestItem* ffaitem = NULL; + QuestItem* conditem = NULL; - LootItem *item = loot->LootItemInSlot(lootSlot, this, &qitem, &ffaitem, &conditem); + LootItem* item = loot->LootItemInSlot(lootSlot, this, &qitem, &ffaitem, &conditem); if (!item) { @@ -23219,7 +23302,7 @@ void Player::_LoadSkills(PreparedQueryResult result) uint16 value = fields[1].GetUInt16(); uint16 max = fields[2].GetUInt16(); - SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(skill); + SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(skill); if (!pSkill) { sLog->outError("Character %u has skill %u that does not exist.", GetGUIDLow(), skill); @@ -23456,12 +23539,12 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) if (talentRank >= MAX_TALENT_RANK) return; - TalentEntry const *talentInfo = sTalentStore.LookupEntry(talentId); + TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId); if (!talentInfo) return; - TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) return; @@ -23492,7 +23575,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) // Check if it requires another talent if (talentInfo->DependsOn > 0) { - if (TalentEntry const *depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn)) + if (TalentEntry const* depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn)) { bool hasEnoughRank = false; for (uint8 rank = talentInfo->DependsOnRank; rank < MAX_TALENT_RANK; rank++) @@ -23516,7 +23599,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) for (uint32 i = 0; i < numRows; i++) // Loop through all talents. { // Someday, someone needs to revamp - const TalentEntry *tmpTalent = sTalentStore.LookupEntry(i); + const TalentEntry* tmpTalent = sTalentStore.LookupEntry(i); if (tmpTalent) // the way talents are tracked { if (tmpTalent->TalentTab == tTab) @@ -23564,7 +23647,7 @@ void Player::LearnTalent(uint32 talentId, uint32 talentRank) void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank) { - Pet *pet = GetPet(); + Pet* pet = GetPet(); if (!pet) return; @@ -23580,22 +23663,22 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank) if (talentRank >= MAX_PET_TALENT_RANK) return; - TalentEntry const *talentInfo = sTalentStore.LookupEntry(talentId); + TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId); if (!talentInfo) return; - TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) return; - CreatureTemplate const *ci = pet->GetCreatureInfo(); + CreatureTemplate const* ci = pet->GetCreatureInfo(); if (!ci) return; - CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(ci->family); + CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(ci->family); if (!pet_family) return; @@ -23629,7 +23712,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank) // Check if it requires another talent if (talentInfo->DependsOn > 0) { - if (TalentEntry const *depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn)) + if (TalentEntry const* depTalentInfo = sTalentStore.LookupEntry(talentInfo->DependsOn)) { bool hasEnoughRank = false; for (uint8 rank = talentInfo->DependsOnRank; rank < MAX_TALENT_RANK; rank++) @@ -23653,7 +23736,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank) for (uint32 i = 0; i < numRows; ++i) // Loop through all talents. { // Someday, someone needs to revamp - const TalentEntry *tmpTalent = sTalentStore.LookupEntry(i); + const TalentEntry* tmpTalent = sTalentStore.LookupEntry(i); if (tmpTalent) // the way talents are tracked { if (tmpTalent->TalentTab == tTab) @@ -23743,7 +23826,7 @@ void Player::ResummonPetTemporaryUnSummonedIfAny() m_temporaryUnsummonedPetNumber = 0; } -bool Player::canSeeSpellClickOn(Creature const *c) const +bool Player::canSeeSpellClickOn(Creature const* c) const { if (!c->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK)) return false; @@ -23759,7 +23842,7 @@ bool Player::canSeeSpellClickOn(Creature const *c) const return false; } -void Player::BuildPlayerTalentsInfoData(WorldPacket *data) +void Player::BuildPlayerTalentsInfoData(WorldPacket* data) { *data << uint32(GetFreeTalentPoints()); // unspentTalentPoints *data << uint8(m_specsCount); // talent group count (0, 1 or 2) @@ -23826,7 +23909,7 @@ void Player::BuildPlayerTalentsInfoData(WorldPacket *data) } } -void Player::BuildPetTalentsInfoData(WorldPacket *data) +void Player::BuildPetTalentsInfoData(WorldPacket* data) { uint32 unspentTalentPoints = 0; size_t pointsPos = data->wpos(); @@ -23836,7 +23919,7 @@ void Player::BuildPetTalentsInfoData(WorldPacket *data) size_t countPos = data->wpos(); *data << uint8(talentIdCount); // [PH], talentIdCount - Pet *pet = GetPet(); + Pet* pet = GetPet(); if (!pet) return; @@ -23844,17 +23927,17 @@ void Player::BuildPetTalentsInfoData(WorldPacket *data) data->put<uint32>(pointsPos, unspentTalentPoints); // put real points - CreatureTemplate const *ci = pet->GetCreatureInfo(); + CreatureTemplate const* ci = pet->GetCreatureInfo(); if (!ci) return; - CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(ci->family); + CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(ci->family); if (!pet_family || pet_family->petTalentType < 0) return; for (uint32 talentTabId = 1; talentTabId < sTalentTabStore.GetNumRows(); ++talentTabId) { - TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentTabId); + TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentTabId); if (!talentTabInfo) continue; @@ -23909,7 +23992,7 @@ void Player::SendTalentsInfoData(bool pet) GetSession()->SendPacket(&data); } -void Player::BuildEnchantmentsInfoData(WorldPacket *data) +void Player::BuildEnchantmentsInfoData(WorldPacket* data) { uint32 slotUsedMask = 0; size_t slotUsedMaskPos = data->wpos(); @@ -23917,7 +24000,7 @@ void Player::BuildEnchantmentsInfoData(WorldPacket *data) for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i) { - Item *item = GetItemByPos(INVENTORY_SLOT_BAG_0, i); + Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (!item) continue; @@ -24070,23 +24153,20 @@ void Player::_SaveBGData(SQLTransaction& trans) PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PLAYER_BGDATA); stmt->setUInt32(0, GetGUIDLow()); trans->Append(stmt); - if (m_bgData.bgInstanceID) - { - /* guid, bgInstanceID, bgTeam, x, y, z, o, map, taxi[0], taxi[1], mountSpell */ - stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_PLAYER_BGDATA); - stmt->setUInt32(0, GetGUIDLow()); - stmt->setUInt32(1, m_bgData.bgInstanceID); - stmt->setUInt16(2, m_bgData.bgTeam); - stmt->setFloat (3, m_bgData.joinPos.GetPositionX()); - stmt->setFloat (4, m_bgData.joinPos.GetPositionY()); - stmt->setFloat (5, m_bgData.joinPos.GetPositionZ()); - stmt->setFloat (6, m_bgData.joinPos.GetOrientation()); - stmt->setUInt16(7, m_bgData.joinPos.GetMapId()); - stmt->setUInt16(8, m_bgData.taxiPath[0]); - stmt->setUInt16(9, m_bgData.taxiPath[1]); - stmt->setUInt16(10, m_bgData.mountSpell); - trans->Append(stmt); - } + /* guid, bgInstanceID, bgTeam, x, y, z, o, map, taxi[0], taxi[1], mountSpell */ + stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_PLAYER_BGDATA); + stmt->setUInt32(0, GetGUIDLow()); + stmt->setUInt32(1, m_bgData.bgInstanceID); + stmt->setUInt16(2, m_bgData.bgTeam); + stmt->setFloat (3, m_bgData.joinPos.GetPositionX()); + stmt->setFloat (4, m_bgData.joinPos.GetPositionY()); + stmt->setFloat (5, m_bgData.joinPos.GetPositionZ()); + stmt->setFloat (6, m_bgData.joinPos.GetOrientation()); + stmt->setUInt16(7, m_bgData.joinPos.GetMapId()); + stmt->setUInt16(8, m_bgData.taxiPath[0]); + stmt->setUInt16(9, m_bgData.taxiPath[1]); + stmt->setUInt16(10, m_bgData.mountSpell); + trans->Append(stmt); } void Player::DeleteEquipmentSet(uint64 setGuid) @@ -24132,7 +24212,7 @@ void Player::ResetMap() GetMapRef().unlink(); } -void Player::SetMap(Map * map) +void Player::SetMap(Map* map) { Unit::SetMap(map); m_mapRef.link(map, this); @@ -24279,12 +24359,12 @@ void Player::ActivateSpec(uint8 spec) // m_actionButtons.clear() is called in the next _LoadActionButtons for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i) { - TalentEntry const *talentInfo = sTalentStore.LookupEntry(i); + TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); if (!talentInfo) continue; - TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; @@ -24301,7 +24381,7 @@ void Player::ActivateSpec(uint8 spec) if (talentInfo->RankID[rank] == 0) continue; removeSpell(talentInfo->RankID[rank], true); // removes the talent, and all dependant, learned, and chained spells.. - if (const SpellInfo *_spellEntry = sSpellMgr->GetSpellInfo(talentInfo->RankID[rank])) + if (const SpellInfo* _spellEntry = sSpellMgr->GetSpellInfo(talentInfo->RankID[rank])) for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) // search through the SpellInfo for valid trigger spells if (_spellEntry->Effects[i].TriggerSpell > 0 && _spellEntry->Effects[i].Effect == SPELL_EFFECT_LEARN_SPELL) removeSpell(_spellEntry->Effects[i].TriggerSpell, true); // and remove any spells that the talent teaches @@ -24316,7 +24396,7 @@ void Player::ActivateSpec(uint8 spec) for (uint8 slot = 0; slot < MAX_GLYPH_SLOT_INDEX; ++slot) // remove secondary glyph if (uint32 oldglyph = m_Glyphs[m_activeSpec][slot]) - if (GlyphPropertiesEntry const *old_gp = sGlyphPropertiesStore.LookupEntry(oldglyph)) + if (GlyphPropertiesEntry const* old_gp = sGlyphPropertiesStore.LookupEntry(oldglyph)) RemoveAurasDueToSpell(old_gp->SpellId); SetActiveSpec(spec); @@ -24324,12 +24404,12 @@ void Player::ActivateSpec(uint8 spec) for (uint32 talentId = 0; talentId < sTalentStore.GetNumRows(); ++talentId) { - TalentEntry const *talentInfo = sTalentStore.LookupEntry(talentId); + TalentEntry const* talentInfo = sTalentStore.LookupEntry(talentId); if (!talentInfo) continue; - TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; @@ -24360,7 +24440,7 @@ void Player::ActivateSpec(uint8 spec) // apply primary glyph if (glyph) - if (GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph)) + if (GlyphPropertiesEntry const* gp = sGlyphPropertiesStore.LookupEntry(glyph)) CastSpell(this, gp->SpellId, true); SetGlyph(slot, glyph); @@ -24440,7 +24520,7 @@ void Player::DeleteRefundReference(uint32 it) } } -void Player::SendRefundInfo(Item *item) +void Player::SendRefundInfo(Item* item) { // This function call unsets ITEM_FLAGS_REFUNDABLE if played time is over 2 hours. item->UpdatePlayedTime(this); @@ -24503,7 +24583,7 @@ bool Player::AddItem(uint32 itemId, uint32 count) return true; } -void Player::RefundItem(Item *item) +void Player::RefundItem(Item* item) { if (!item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_REFUNDABLE)) { diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 9a0f35313f6..65746043894 100755 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -114,14 +114,14 @@ struct PlayerTalent // Spell modifier (used for modify other spells) struct SpellModifier { - SpellModifier(Aura * _ownerAura = NULL) : charges(0), ownerAura(_ownerAura) {} + SpellModifier(Aura* _ownerAura = NULL) : charges(0), ownerAura(_ownerAura) {} SpellModOp op : 8; SpellModType type : 8; int16 charges : 16; int32 value; flag96 mask; uint32 spellId; - Aura * const ownerAura; + Aura* const ownerAura; }; typedef UNORDERED_MAP<uint32, PlayerTalent*> PlayerTalentMap; @@ -276,8 +276,8 @@ struct DuelInfo { DuelInfo() : initiator(NULL), opponent(NULL), startTimer(0), startTime(0), outOfBound(0) {} - Player *initiator; - Player *opponent; + Player* initiator; + Player* opponent; time_t startTimer; time_t startTime; time_t outOfBound; @@ -373,27 +373,32 @@ enum PlayerFlags PLAYER_FLAGS_GM = 0x00000008, PLAYER_FLAGS_GHOST = 0x00000010, PLAYER_FLAGS_RESTING = 0x00000020, - PLAYER_FLAGS_UNK7 = 0x00000040, - PLAYER_FLAGS_UNK8 = 0x00000080, // pre-3.0.3 PLAYER_FLAGS_FFA_PVP flag for FFA PVP state + PLAYER_FLAGS_UNK6 = 0x00000040, + PLAYER_FLAGS_UNK7 = 0x00000080, // pre-3.0.3 PLAYER_FLAGS_FFA_PVP flag for FFA PVP state PLAYER_FLAGS_CONTESTED_PVP = 0x00000100, // Player has been involved in a PvP combat and will be attacked by contested guards PLAYER_FLAGS_IN_PVP = 0x00000200, PLAYER_FLAGS_HIDE_HELM = 0x00000400, PLAYER_FLAGS_HIDE_CLOAK = 0x00000800, - PLAYER_FLAGS_PLAYED_LONG_TIME = 0x00001000, // played long time - PLAYER_FLAGS_PLAYED_TOO_LONG = 0x00002000, // played too long time + PLAYER_FLAGS_PLAYED_LONG_TIME = 0x00001000, // played long time + PLAYER_FLAGS_PLAYED_TOO_LONG = 0x00002000, // played too long time PLAYER_FLAGS_IS_OUT_OF_BOUNDS = 0x00004000, PLAYER_FLAGS_DEVELOPER = 0x00008000, // <Dev> prefix for something? - PLAYER_FLAGS_UNK17 = 0x00010000, // pre-3.0.3 PLAYER_FLAGS_SANCTUARY flag for player entered sanctuary + PLAYER_FLAGS_UNK16 = 0x00010000, // pre-3.0.3 PLAYER_FLAGS_SANCTUARY flag for player entered sanctuary PLAYER_FLAGS_TAXI_BENCHMARK = 0x00020000, // taxi benchmark mode (on/off) (2.0.1) PLAYER_FLAGS_PVP_TIMER = 0x00040000, // 3.0.2, pvp timer active (after you disable pvp manually) - PLAYER_FLAGS_UNK20 = 0x00080000, - PLAYER_FLAGS_UNK21 = 0x00100000, - PLAYER_FLAGS_UNK22 = 0x00200000, + PLAYER_FLAGS_UNK19 = 0x00080000, + PLAYER_FLAGS_UNK20 = 0x00100000, + PLAYER_FLAGS_UNK21 = 0x00200000, PLAYER_FLAGS_COMMENTATOR2 = 0x00400000, - PLAYER_ALLOW_ONLY_ABILITY = 0x00800000, // used by bladestorm and killing spree - PLAYER_FLAGS_UNK25 = 0x01000000, // disabled all melee ability on tab include autoattack - - PLAYER_FLAGS_NO_XP_GAIN = 0x02000000 + PLAYER_ALLOW_ONLY_ABILITY = 0x00800000, // used by bladestorm and killing spree, allowed only spells with SPELL_ATTR0_REQ_AMMO, SPELL_EFFECT_ATTACK, checked only for active player + PLAYER_FLAGS_UNK24 = 0x01000000, // disabled all melee ability on tab include autoattack + PLAYER_FLAGS_NO_XP_GAIN = 0x02000000, + PLAYER_FLAGS_UNK26 = 0x04000000, + PLAYER_FLAGS_UNK27 = 0x08000000, + PLAYER_FLAGS_UNK28 = 0x01000000, + PLAYER_FLAGS_UNK29 = 0x02000000, + PLAYER_FLAGS_UNK30 = 0x04000000, + PLAYER_FLAGS_UNK31 = 0x08000000, }; // used for PLAYER__FIELD_KNOWN_TITLES field (uint64), (1<<bit_index) without (-1) @@ -815,6 +820,7 @@ enum PlayerDelayedOperations DELAYED_SPELL_CAST_DESERTER = 0x04, DELAYED_BG_MOUNT_RESTORE = 0x08, ///< Flag to restore mount state after teleport from BG DELAYED_BG_TAXI_RESTORE = 0x10, ///< Flag to restore taxi state after teleport from BG + DELAYED_BG_GROUP_RESTORE = 0x20, ///< Flag to restore group state after teleport from BG DELAYED_END }; @@ -824,7 +830,7 @@ enum PlayerDelayedOperations struct InstancePlayerBind { - InstanceSave *save; + InstanceSave* save; bool perm; /* permanent PlayerInstanceBinds are created in Raid/Heroic instances for players that aren't already permanently bound when they are inside when a boss is killed @@ -1063,7 +1069,7 @@ class Player : public Unit, public GridObject<Player> friend void Item::AddToUpdateQueueOf(Player* player); friend void Item::RemoveFromUpdateQueueOf(Player* player); public: - explicit Player (WorldSession *session); + explicit Player (WorldSession* session); ~Player (); void CleanupsBeforeDelete(bool finalCleanup = true); @@ -1075,7 +1081,7 @@ class Player : public Unit, public GridObject<Player> void RemoveFromWorld(); bool TeleportTo(uint32 mapid, float x, float y, float z, float orientation, uint32 options = 0); - void TeleportOutOfMap(Map *oldMap); + void TeleportOutOfMap(Map* oldMap); bool TeleportTo(WorldLocation const &loc, uint32 options = 0) { @@ -1138,7 +1144,7 @@ class Player : public Unit, public GridObject<Player> void SetAcceptWhispers(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_ACCEPT_WHISPERS; else m_ExtraFlags &= ~PLAYER_EXTRA_ACCEPT_WHISPERS; } bool isGameMaster() const { return m_ExtraFlags & PLAYER_EXTRA_GM_ON; } void SetGameMaster(bool on); - bool isGMChat() const { return GetSession()->GetSecurity() >= SEC_MODERATOR && (m_ExtraFlags & PLAYER_EXTRA_GM_CHAT); } + bool isGMChat() const { return m_ExtraFlags & PLAYER_EXTRA_GM_CHAT; } void SetGMChat(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_GM_CHAT; else m_ExtraFlags &= ~PLAYER_EXTRA_GM_CHAT; } bool isTaxiCheater() const { return m_ExtraFlags & PLAYER_EXTRA_TAXICHEAT; } void SetTaxiCheater(bool on) { if (on) m_ExtraFlags |= PLAYER_EXTRA_TAXICHEAT; else m_ExtraFlags &= ~PLAYER_EXTRA_TAXICHEAT; } @@ -1194,7 +1200,7 @@ class Player : public Unit, public GridObject<Player> void Yell(const std::string& text, const uint32 language); void TextEmote(const std::string& text); void Whisper(const std::string& text, const uint32 language, uint64 receiver); - void BuildPlayerChat(WorldPacket *data, uint8 msgtype, const std::string& text, uint32 language) const; + void BuildPlayerChat(WorldPacket* data, uint8 msgtype, const std::string& text, uint32 language) const; /*********************************************************/ /*** STORAGE SYSTEM ***/ @@ -1219,7 +1225,7 @@ class Player : public Unit, public GridObject<Player> Item* GetWeaponForAttack(WeaponAttackType attackType, bool useable = false) const; Item* GetShield(bool useable = false) const; static uint8 GetAttackBySlot(uint8 slot); // MAX_ATTACK if not weapon slot - std::vector<Item *> &GetItemUpdateQueue() { return m_itemUpdateQueue; } + std::vector<Item*> &GetItemUpdateQueue() { return m_itemUpdateQueue; } static bool IsInventoryPos(uint16 pos) { return IsInventoryPos(pos >> 8, pos & 255); } static bool IsInventoryPos(uint8 bag, uint8 slot); static bool IsEquipmentPos(uint16 pos) { return IsEquipmentPos(pos >> 8, pos & 255); } @@ -1252,7 +1258,7 @@ class Player : public Unit, public GridObject<Player> } InventoryResult CanStoreItems(Item** pItem, int count) const; InventoryResult CanEquipNewItem(uint8 slot, uint16& dest, uint32 item, bool swap) const; - InventoryResult CanEquipItem(uint8 slot, uint16& dest, Item *pItem, bool swap, bool not_loading = true) const; + InventoryResult CanEquipItem(uint8 slot, uint16& dest, Item* pItem, bool swap, bool not_loading = true) const; InventoryResult CanEquipUniqueItem(Item* pItem, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const; InventoryResult CanEquipUniqueItem(ItemTemplate const* itemProto, uint8 except_slot = NULL_SLOT, uint32 limit_count = 1) const; @@ -1265,9 +1271,9 @@ class Player : public Unit, public GridObject<Player> InventoryResult CanUseAmmo(uint32 item) const; Item* StoreNewItem(ItemPosCountVec const& pos, uint32 item, bool update, int32 randomPropertyId = 0, AllowedLooterSet* allowedLooters = NULL); - Item* StoreItem(ItemPosCountVec const& pos, Item *pItem, bool update); + Item* StoreItem(ItemPosCountVec const& pos, Item* pItem, bool update); Item* EquipNewItem(uint16 pos, uint32 item, bool update); - Item* EquipItem(uint16 pos, Item *pItem, bool update); + Item* EquipItem(uint16 pos, Item* pItem, bool update); void AutoUnequipOffhandIfNeed(bool force = false); bool StoreNewItemInBestSlots(uint32 item_id, uint32 item_count); void AutoStoreLoot(uint8 bag, uint8 slot, uint32 loot_id, LootStore const& store, bool broadcast = false); @@ -1275,7 +1281,7 @@ class Player : public Unit, public GridObject<Player> void StoreLootItem(uint8 lootSlot, Loot* loot); InventoryResult _CanTakeMoreSimilarItems(uint32 entry, uint32 count, Item* pItem, uint32* no_space_count = NULL) const; - InventoryResult _CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item *pItem = NULL, bool swap = false, uint32* no_space_count = NULL) const; + InventoryResult _CanStoreItem(uint8 bag, uint8 slot, ItemPosCountVec& dest, uint32 entry, uint32 count, Item* pItem = NULL, bool swap = false, uint32* no_space_count = NULL) const; void AddRefundReference(uint32 it); void DeleteRefundReference(uint32 it); @@ -1284,15 +1290,15 @@ class Player : public Unit, public GridObject<Player> void SetAmmo(uint32 item); void RemoveAmmo(); float GetAmmoDPS() const { return m_ammoDPS; } - bool CheckAmmoCompatibility(const ItemTemplate *ammo_proto) const; - void QuickEquipItem(uint16 pos, Item *pItem); - void VisualizeItem(uint8 slot, Item *pItem); - void SetVisibleItemSlot(uint8 slot, Item *pItem); - Item* BankItem(ItemPosCountVec const& dest, Item *pItem, bool update) + bool CheckAmmoCompatibility(const ItemTemplate* ammo_proto) const; + void QuickEquipItem(uint16 pos, Item* pItem); + void VisualizeItem(uint8 slot, Item* pItem); + void SetVisibleItemSlot(uint8 slot, Item* pItem); + Item* BankItem(ItemPosCountVec const& dest, Item* pItem, bool update) { return StoreItem(dest, pItem, update); } - Item* BankItem(uint16 pos, Item *pItem, bool update); + Item* BankItem(uint16 pos, Item* pItem, bool update); void RemoveItem(uint8 bag, uint8 slot, bool update); void MoveItemFromInventory(uint8 bag, uint8 slot, bool update); // in trade, auction, guild bank, mail.... @@ -1306,7 +1312,7 @@ class Player : public Unit, public GridObject<Player> void DestroyZoneLimitedItem(bool update, uint32 new_zone); void SplitItem(uint16 src, uint16 dst, uint32 count); void SwapItem(uint16 src, uint16 dst); - void AddItemToBuyBackSlot(Item *pItem); + void AddItemToBuyBackSlot(Item* pItem); Item* GetItemFromBuyBackSlot(uint32 slot); void RemoveItemFromBuyBackSlot(uint32 slot, bool del); uint32 GetMaxKeyringSize() const { return KEYRING_SLOT_END-KEYRING_SLOT_START; } @@ -1327,9 +1333,9 @@ class Player : public Unit, public GridObject<Player> Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); return mainItem && mainItem->GetTemplate()->InventoryType == INVTYPE_2HWEAPON && !CanTitanGrip(); } - void SendNewItem(Item *item, uint32 count, bool received, bool created, bool broadcast = false); + void SendNewItem(Item* item, uint32 count, bool received, bool created, bool broadcast = false); 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); + 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; @@ -1341,17 +1347,17 @@ class Player : public Unit, public GridObject<Player> void UpdateSoulboundTradeItems(); void RemoveTradeableItem(Item* item); void UpdateItemDuration(uint32 time, bool realtimeonly = false); - void AddEnchantmentDurations(Item *item); - void RemoveEnchantmentDurations(Item *item); + void AddEnchantmentDurations(Item* item); + void RemoveEnchantmentDurations(Item* item); void RemoveArenaEnchantments(EnchantmentSlot slot); - void AddEnchantmentDuration(Item *item, EnchantmentSlot slot, uint32 duration); - void ApplyEnchantment(Item *item, EnchantmentSlot slot, bool apply, bool apply_dur = true, bool ignore_condition = false); - void ApplyEnchantment(Item *item, bool apply); + void AddEnchantmentDuration(Item* item, EnchantmentSlot slot, uint32 duration); + void ApplyEnchantment(Item* item, EnchantmentSlot slot, bool apply, bool apply_dur = true, bool ignore_condition = false); + void ApplyEnchantment(Item* item, bool apply); void UpdateSkillEnchantments(uint16 skill_id, uint16 curr_value, uint16 new_value); void SendEnchantmentDurations(); - void BuildEnchantmentsInfoData(WorldPacket *data); - void AddItemDurations(Item *item); - void RemoveItemDurations(Item *item); + void BuildEnchantmentsInfoData(WorldPacket* data); + void AddItemDurations(Item* item); + void RemoveItemDurations(Item* item); void SendItemDurations(); void LoadCorpse(); void LoadPet(); @@ -1381,18 +1387,18 @@ class Player : public Unit, public GridObject<Player> void PrepareQuestMenu(uint64 guid); void SendPreparedQuest(uint64 guid); bool IsActiveQuest(uint32 quest_id) const; - Quest const *GetNextQuest(uint64 guid, Quest const *pQuest); - bool CanSeeStartQuest(Quest const *pQuest); - bool CanTakeQuest(Quest const *pQuest, bool msg); - bool CanAddQuest(Quest const *pQuest, bool msg); + Quest const* GetNextQuest(uint64 guid, Quest const* pQuest); + bool CanSeeStartQuest(Quest const* pQuest); + bool CanTakeQuest(Quest const* pQuest, bool msg); + bool CanAddQuest(Quest const* pQuest, bool msg); bool CanCompleteQuest(uint32 quest_id); - bool CanCompleteRepeatableQuest(Quest const *pQuest); - bool CanRewardQuest(Quest const *pQuest, bool msg); - bool CanRewardQuest(Quest const *pQuest, uint32 reward, bool msg); - void AddQuest(Quest const *pQuest, Object *questGiver); + bool CanCompleteRepeatableQuest(Quest const* pQuest); + bool CanRewardQuest(Quest const* pQuest, bool msg); + bool CanRewardQuest(Quest const* pQuest, uint32 reward, bool msg); + void AddQuest(Quest const* pQuest, Object* questGiver); void CompleteQuest(uint32 quest_id); void IncompleteQuest(uint32 quest_id); - void RewardQuest(Quest const *pQuest, uint32 reward, Object* questGiver, bool announce = true); + void RewardQuest(Quest const* pQuest, uint32 reward, Object* questGiver, bool announce = true); void FailQuest(uint32 quest_id); bool SatisfyQuestSkillOrClass(Quest const* qInfo, bool msg); bool SatisfyQuestLevel(Quest const* qInfo, bool msg); @@ -1408,7 +1414,7 @@ class Player : public Unit, public GridObject<Player> bool SatisfyQuestPrevChain(Quest const* qInfo, bool msg); bool SatisfyQuestDay(Quest const* qInfo, bool msg); bool SatisfyQuestWeek(Quest const* qInfo, bool msg); - bool GiveQuestSourceItem(Quest const *pQuest); + bool GiveQuestSourceItem(Quest const* pQuest); bool TakeQuestSourceItem(uint32 questId, bool msg); bool GetQuestRewardStatus(uint32 quest_id) const; QuestStatus GetQuestStatus(uint32 quest_id) const; @@ -1462,6 +1468,7 @@ class Player : public Unit, public GridObject<Player> void ItemRemovedQuestCheck(uint32 entry, uint32 count); void KilledMonster(CreatureTemplate const* cInfo, uint64 guid); void KilledMonsterCredit(uint32 entry, uint64 guid); + void KilledPlayerCredit(); void CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id); void TalkedToCreature(uint32 entry, uint64 guid); void MoneyChanged(uint32 value); @@ -1473,14 +1480,15 @@ class Player : public Unit, public GridObject<Player> bool CanShareQuest(uint32 quest_id) const; void SendQuestComplete(uint32 quest_id); - void SendQuestReward(Quest const *pQuest, uint32 XP, Object* questGiver); + void SendQuestReward(Quest const* pQuest, uint32 XP, Object* questGiver); void SendQuestFailed(uint32 questId, InventoryResult reason = EQUIP_ERR_OK); 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* pPlayer, 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); uint64 GetDivider() { return m_divider; } void SetDivider(uint64 guid) { m_divider = guid; } @@ -1565,8 +1573,8 @@ class Player : public Unit, public GridObject<Player> } uint64 GetSelection() const { return m_curSelection; } - Unit *GetSelectedUnit() const; - Player *GetSelectedPlayer() const; + Unit* GetSelectedUnit() const; + Player* GetSelectedPlayer() const; void SetSelection(uint64 guid) { m_curSelection = guid; SetUInt64Value(UNIT_FIELD_TARGET, guid); } uint8 GetComboPoints() { return m_comboPoints; } @@ -1652,8 +1660,8 @@ class Player : public Unit, public GridObject<Player> bool resetTalents(bool no_cost = false); uint32 resetTalentsCost() const; void InitTalentForLevel(); - void BuildPlayerTalentsInfoData(WorldPacket *data); - void BuildPetTalentsInfoData(WorldPacket *data); + void BuildPlayerTalentsInfoData(WorldPacket* data); + void BuildPetTalentsInfoData(WorldPacket* data); void SendTalentsInfoData(bool pet); void LearnTalent(uint32 talentId, uint32 talentRank); void LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank); @@ -1691,7 +1699,7 @@ class Player : public Unit, public GridObject<Player> SpellCooldowns const& GetSpellCooldownMap() const { return m_spellCooldowns; } void AddSpellMod(SpellModifier* mod, bool apply); - bool IsAffectedBySpellmod(SpellInfo const *spellInfo, SpellModifier *mod, Spell* spell = NULL); + bool IsAffectedBySpellmod(SpellInfo const* spellInfo, SpellModifier* mod, Spell* spell = NULL); template <class T> T ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell* spell = NULL); void RemoveSpellMods(Spell* spell); void RestoreSpellMods(Spell* spell, uint32 ownerAuraId = 0, Aura* aura = NULL); @@ -1788,7 +1796,7 @@ class Player : public Unit, public GridObject<Player> } /** todo: -maybe move UpdateDuelFlag+DuelComplete to independent DuelHandler.. **/ - DuelInfo *duel; + DuelInfo* duel; void UpdateDuelFlag(time_t currTime); void CheckDuelDistance(time_t currTime); void DuelComplete(DuelCompleteType type); @@ -1847,7 +1855,7 @@ class Player : public Unit, public GridObject<Player> uint32 GetBaseDefenseSkillValue() const { return GetBaseSkillValue(SKILL_DEFENSE); } uint32 GetBaseWeaponSkillValue(WeaponAttackType attType) const; - uint32 GetSpellByProto(ItemTemplate *proto); + uint32 GetSpellByProto(ItemTemplate* proto); float GetHealthBonusFromStamina(); float GetManaBonusFromIntellect(); @@ -1873,7 +1881,8 @@ class Player : public Unit, public GridObject<Player> void UpdateDefenseBonusesMod(); inline void RecalculateRating(CombatRating cr) { ApplyRatingMod(cr, 0, true);} float GetMeleeCritFromAgility(); - float GetDodgeFromAgility(); + void GetDodgeFromAgility(float &diminishing, float &nondiminishing); + float GetMissPercentageFromDefence() const; float GetSpellCritFromIntellect(); float OCTRegenHPPerSpirit(); float OCTRegenMPPerSpirit(); @@ -1908,8 +1917,8 @@ class Player : public Unit, public GridObject<Player> WorldSession* GetSession() const { return m_session; } - void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const; - void DestroyForPlayer(Player *target, bool anim = false) const; + void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const; + void DestroyForPlayer(Player* target, bool anim = false) const; void SendLogXPGain(uint32 GivenXP, Unit* victim, uint32 BonusXP, bool recruitAFriend = false, float group_rate=1.0f); // notifiers @@ -1930,17 +1939,17 @@ class Player : public Unit, public GridObject<Player> virtual bool SetPosition(float x, float y, float z, float orientation, bool teleport = false); bool SetPosition(const Position &pos, bool teleport = false) { return SetPosition(pos.GetPositionX(), pos.GetPositionY(), pos.GetPositionZ(), pos.GetOrientation(), teleport); } - void UpdateUnderwaterState(Map * m, float x, float y, float z); + void UpdateUnderwaterState(Map* m, float x, float y, float z); - void SendMessageToSet(WorldPacket *data, bool self) {SendMessageToSetInRange(data, GetVisibilityRange(), self); };// overwrite Object::SendMessageToSet - void SendMessageToSetInRange(WorldPacket *data, float fist, bool self);// overwrite Object::SendMessageToSetInRange - void SendMessageToSetInRange(WorldPacket *data, float dist, bool self, bool own_team_only); - void SendMessageToSet(WorldPacket *data, Player const* skipped_rcvr); + void SendMessageToSet(WorldPacket* data, bool self) {SendMessageToSetInRange(data, GetVisibilityRange(), self); };// overwrite Object::SendMessageToSet + void SendMessageToSetInRange(WorldPacket* data, float fist, bool self);// overwrite Object::SendMessageToSetInRange + void SendMessageToSetInRange(WorldPacket* data, float dist, bool self, bool own_team_only); + void SendMessageToSet(WorldPacket* data, Player const* skipped_rcvr); void SendTeleportPacket(Position &oldPos); void SendTeleportAckPacket(); - Corpse *GetCorpse() const; + Corpse* GetCorpse() const; void SpawnCorpseBones(); void CreateCorpse(); bool FallGround(uint8 FallMode = 0); @@ -1970,15 +1979,15 @@ class Player : public Unit, public GridObject<Player> bool CanJoinConstantChannelInZone(ChatChannelsEntry const* channel, AreaTableEntry const* zone); - void JoinedChannel(Channel *c); - void LeftChannel(Channel *c); + void JoinedChannel(Channel* c); + void LeftChannel(Channel* c); void CleanupChannels(); void UpdateLocalChannels(uint32 newZone); void LeaveLFGChannel(); void UpdateDefense(); void UpdateWeaponSkill (WeaponAttackType attType); - void UpdateCombatSkills(Unit *pVictim, WeaponAttackType attType, bool defence); + void UpdateCombatSkills(Unit* pVictim, WeaponAttackType attType, bool defence); void SetSkill(uint16 id, uint16 step, uint16 currVal, uint16 maxVal); uint16 GetMaxSkillValue(uint32 skill) const; // max + perm. bonus + temp bonus @@ -2022,8 +2031,8 @@ class Player : public Unit, public GridObject<Player> ReputationMgr& GetReputationMgr() { return m_reputationMgr; } ReputationMgr const& GetReputationMgr() const { return m_reputationMgr; } ReputationRank GetReputationRank(uint32 faction_id) const; - void RewardReputation(Unit *pVictim, float rate); - void RewardReputation(Quest const *pQuest); + void RewardReputation(Unit* pVictim, float rate); + void RewardReputation(Quest const* pQuest); void UpdateSkillsForLevel(); void UpdateSkillsToMaxSkillsForLevel(); // for .levelup @@ -2033,7 +2042,7 @@ class Player : public Unit, public GridObject<Player> /*** PVP SYSTEM ***/ /*********************************************************/ void UpdateHonorFields(); - bool RewardHonor(Unit *pVictim, uint32 groupsize, int32 honor = -1, bool pvptoken = false); + bool RewardHonor(Unit* pVictim, uint32 groupsize, int32 honor = -1, bool pvptoken = false); uint32 GetHonorPoints() const { return GetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY); } uint32 GetArenaPoints() const { return GetUInt32Value(PLAYER_FIELD_ARENA_CURRENCY); } void ModifyHonorPoints(int32 value, SQLTransaction* trans = NULL); //! If trans is specified, honor save query will be added to trans @@ -2075,28 +2084,28 @@ class Player : public Unit, public GridObject<Player> void ResetAllPowers(); - void _ApplyWeaponDependentAuraMods(Item *item, WeaponAttackType attackType, bool apply); - void _ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, AuraEffect const* aura, bool apply); - void _ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType attackType, AuraEffect const* aura, bool apply); + void _ApplyWeaponDependentAuraMods(Item* item, WeaponAttackType attackType, bool apply); + void _ApplyWeaponDependentAuraCritMod(Item* item, WeaponAttackType attackType, AuraEffect const* aura, bool apply); + void _ApplyWeaponDependentAuraDamageMod(Item* item, WeaponAttackType attackType, AuraEffect const* aura, bool apply); - void _ApplyItemMods(Item *item, uint8 slot, bool apply); + void _ApplyItemMods(Item* item, uint8 slot, bool apply); void _RemoveAllItemMods(); void _ApplyAllItemMods(); void _ApplyAllLevelScaleItemMods(bool apply); - void _ApplyItemBonuses(ItemTemplate const *proto, uint8 slot, bool apply, bool only_level_scale = false); - void _ApplyWeaponDamage(uint8 slot, ItemTemplate const *proto, ScalingStatValuesEntry const *ssv, bool apply); + void _ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply, bool only_level_scale = false); + void _ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingStatValuesEntry const* ssv, bool apply); void _ApplyAmmoBonuses(); bool EnchantmentFitsRequirements(uint32 enchantmentcondition, int8 slot); void ToggleMetaGemsActive(uint8 exceptslot, bool apply); void CorrectMetaGemEnchants(uint8 slot, bool apply); void InitDataForForm(bool reapplyMods = false); - void ApplyItemEquipSpell(Item *item, bool apply, bool form_change = false); + void ApplyItemEquipSpell(Item* item, bool apply, bool form_change = false); void ApplyEquipSpell(SpellInfo const* spellInfo, Item* item, bool apply, bool form_change = false); void UpdateEquipSpellsAtFormChange(); void CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 procVictim, uint32 procEx); - void CastItemUseSpell(Item *item, SpellCastTargets const& targets, uint8 cast_count, uint32 glyphIndex); - void CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item *item, ItemTemplate const* proto); + void CastItemUseSpell(Item* item, SpellCastTargets const& targets, uint8 cast_count, uint32 glyphIndex); + void CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32 procVictim, uint32 procEx, Item* item, ItemTemplate const* proto); void SendEquipmentSetList(); void SetEquipmentSet(uint32 index, EquipmentSet eqset); @@ -2104,13 +2113,13 @@ class Player : public Unit, public GridObject<Player> void SendInitWorldStates(uint32 zone, uint32 area); void SendUpdateWorldState(uint32 Field, uint32 Value); - void SendDirectMessage(WorldPacket *data); + void SendDirectMessage(WorldPacket* data); void SendBGWeekendWorldStates(); void SendAurasForTarget(Unit* target); PlayerMenu* PlayerTalkClass; - std::vector<ItemSetEffect *> ItemSetEff; + std::vector<ItemSetEffect*> ItemSetEff; void SendLoot(uint64 guid, LootType loot_type); void SendLootRelease(uint64 guid); @@ -2230,7 +2239,7 @@ class Player : public Unit, public GridObject<Player> /*** OUTDOOR PVP SYSTEM ***/ /*********************************************************/ - OutdoorPvP * GetOutdoorPvP() const; + OutdoorPvP* GetOutdoorPvP() const; // returns true if the player is in active state for outdoor pvp objective capturing, false otherwise bool IsOutdoorPvPActive(); @@ -2262,8 +2271,8 @@ class Player : public Unit, public GridObject<Player> /*** VARIOUS SYSTEMS ***/ /*********************************************************/ void UpdateFallInformationIfNeed(MovementInfo const& minfo, uint16 opcode); - Unit *m_mover; - WorldObject *m_seer; + Unit* m_mover; + WorldObject* m_seer; void SetFallInformation(uint32 time, float z) { m_lastFallTime = time; @@ -2281,8 +2290,8 @@ class Player : public Unit, public GridObject<Player> m_mover = target; m_mover->m_movedPlayer = this; } - void SetSeer(WorldObject *target) { m_seer = target; } - void SetViewpoint(WorldObject *target, bool apply); + void SetSeer(WorldObject* target) { m_seer = target; } + void SetViewpoint(WorldObject* target, bool apply); WorldObject* GetViewpoint() const; void StopCastingCharm(); void StopCastingBindSight(); @@ -2365,13 +2374,13 @@ class Player : public Unit, public GridObject<Player> BoundInstancesMap m_boundInstances[MAX_DIFFICULTY]; InstancePlayerBind* GetBoundInstance(uint32 mapid, Difficulty difficulty); BoundInstancesMap& GetBoundInstances(Difficulty difficulty) { return m_boundInstances[difficulty]; } - InstanceSave * GetInstanceSave(uint32 mapid, bool raid); + InstanceSave* GetInstanceSave(uint32 mapid, bool raid); void UnbindInstance(uint32 mapid, Difficulty difficulty, bool unload = false); void UnbindInstance(BoundInstancesMap::iterator &itr, Difficulty difficulty, bool unload = false); - InstancePlayerBind* BindToInstance(InstanceSave *save, bool permanent, bool load = false); + InstancePlayerBind* BindToInstance(InstanceSave* save, bool permanent, bool load = false); void BindToInstance(); - void SetPendingBind(InstanceSave* save, uint32 bindTimer) { _pendingBind = save; _pendingBindTimer = bindTimer; } - bool HasPendingBind() const { return _pendingBind != NULL; } + void SetPendingBind(uint32 instanceId, uint32 bindTimer) { _pendingBindId = instanceId; _pendingBindTimer = bindTimer; } + bool HasPendingBind() const { return _pendingBindId > 0; } void SendRaidInfo(); void SendSavedInstances(); static void ConvertInstancesToGroup(Player* player, Group* group, bool switchLeader); @@ -2398,10 +2407,10 @@ class Player : public Unit, public GridObject<Player> /*** GROUP SYSTEM ***/ /*********************************************************/ - Group * GetGroupInvite() { return m_groupInvite; } + Group* GetGroupInvite() { return m_groupInvite; } void SetGroupInvite(Group* group) { m_groupInvite = group; } - Group * GetGroup() { return m_group.getTarget(); } - const Group * GetGroup() const { return (const Group*)m_group.getTarget(); } + Group* GetGroup() { return m_group.getTarget(); } + const Group* GetGroup() const { return (const Group*)m_group.getTarget(); } GroupReference& GetGroupRef() { return m_group; } void SetGroup(Group* group, int8 subgroup = -1); uint8 GetSubGroup() const { return m_group.getSubGroup(); } @@ -2414,7 +2423,7 @@ class Player : public Unit, public GridObject<Player> // Battleground Group System void SetBattlegroundRaid(Group* group, int8 subgroup = -1); void RemoveFromBattlegroundRaid(); - Group * GetOriginalGroup() { return m_originalGroup.getTarget(); } + Group* GetOriginalGroup() { return m_originalGroup.getTarget(); } GroupReference& GetOriginalGroupRef() { return m_originalGroup; } uint8 GetOriginalSubGroup() const { return m_originalGroup.getSubGroup(); } void SetOriginalGroup(Group* group, int8 subgroup = -1); @@ -2425,7 +2434,7 @@ class Player : public Unit, public GridObject<Player> MapReference &GetMapRef() { return m_mapRef; } // Set map to player and add reference - void SetMap(Map * map); + void SetMap(Map* map); void ResetMap(); bool isAllowedToLoot(const Creature* creature); @@ -2522,7 +2531,7 @@ class Player : public Unit, public GridObject<Player> void _LoadInventory(PreparedQueryResult result, uint32 timeDiff); void _LoadMailInit(PreparedQueryResult resultUnread, PreparedQueryResult resultDelivery); void _LoadMail(); - void _LoadMailedItems(Mail *mail); + void _LoadMailedItems(Mail* mail); void _LoadQuestStatus(PreparedQueryResult result); void _LoadQuestStatusRewarded(PreparedQueryResult result); void _LoadDailyQuestStatus(PreparedQueryResult result); @@ -2561,8 +2570,8 @@ class Player : public Unit, public GridObject<Player> void _SaveStats(SQLTransaction& trans); void _SaveInstanceTimeRestrictions(SQLTransaction& trans); - void _SetCreateBits(UpdateMask *updateMask, Player *target) const; - void _SetUpdateBits(UpdateMask *updateMask, Player *target) const; + void _SetCreateBits(UpdateMask* updateMask, Player* target) const; + void _SetUpdateBits(UpdateMask* updateMask, Player* target) const; /*********************************************************/ /*** ENVIRONMENTAL SYSTEM ***/ @@ -2616,7 +2625,7 @@ class Player : public Unit, public GridObject<Player> PlayerMails m_mail; PlayerSpellMap m_spells; - PlayerTalentMap *m_talents[MAX_TALENT_SPECS]; + PlayerTalentMap* m_talents[MAX_TALENT_SPECS]; uint32 m_lastPotionId; // last used health/mana potion in combat, that block next potion use GlobalCooldownMgr m_GlobalCooldownMgr; @@ -2652,7 +2661,7 @@ class Player : public Unit, public GridObject<Player> float m_resurrectX, m_resurrectY, m_resurrectZ; uint32 m_resurrectHealth, m_resurrectMana; - WorldSession *m_session; + WorldSession* m_session; typedef std::list<Channel*> JoinedChannelsList; JoinedChannelsList m_channels; @@ -2706,7 +2715,7 @@ class Player : public Unit, public GridObject<Player> // Groups GroupReference m_group; GroupReference m_originalGroup; - Group *m_groupInvite; + Group* m_groupInvite; uint32 m_groupUpdateMask; uint64 m_auraRaidUpdateMask; bool m_bPassOnGroupLoot; @@ -2733,10 +2742,10 @@ class Player : public Unit, public GridObject<Player> private: // internal common parts for CanStore/StoreItem functions - InventoryResult _CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemTemplate const *pProto, uint32& count, bool swap, Item *pSrcItem) const; - InventoryResult _CanStoreItem_InBag(uint8 bag, ItemPosCountVec& dest, ItemTemplate const *pProto, uint32& count, bool merge, bool non_specialized, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const; - InventoryResult _CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec& dest, ItemTemplate const *pProto, uint32& count, bool merge, Item *pSrcItem, uint8 skip_bag, uint8 skip_slot) const; - Item* _StoreItem(uint16 pos, Item *pItem, uint32 count, bool clone, bool update); + InventoryResult _CanStoreItem_InSpecificSlot(uint8 bag, uint8 slot, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool swap, Item* pSrcItem) const; + InventoryResult _CanStoreItem_InBag(uint8 bag, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool merge, bool non_specialized, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const; + InventoryResult _CanStoreItem_InInventorySlots(uint8 slot_begin, uint8 slot_end, ItemPosCountVec& dest, ItemTemplate const* pProto, uint32& count, bool merge, Item* pSrcItem, uint8 skip_bag, uint8 skip_slot) const; + Item* _StoreItem(uint16 pos, Item* pItem, uint32 count, bool clone, bool update); Item* _LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, Field* fields); std::set<uint32> m_refundableItems; @@ -2799,12 +2808,12 @@ class Player : public Unit, public GridObject<Player> uint32 m_timeSyncServer; InstanceTimeMap _instanceResetTimes; - InstanceSave* _pendingBind; + uint32 _pendingBindId; uint32 _pendingBindTimer; }; -void AddItemsSetItem(Player*player, Item *item); -void RemoveItemsSetItem(Player*player, ItemTemplate const *proto); +void AddItemsSetItem(Player*player, Item* item); +void RemoveItemsSetItem(Player*player, ItemTemplate const* proto); // "the bodies of template functions must be made available in a header file" template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &basevalue, Spell* spell) @@ -2821,7 +2830,7 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas for (SpellModList::iterator itr = m_spellMods[op].begin(); itr != m_spellMods[op].end(); ++itr) { - SpellModifier *mod = *itr; + SpellModifier* mod = *itr; // Charges can be set only for mods with auras if (!mod->ownerAura) diff --git a/src/server/game/Entities/Player/SocialMgr.cpp b/src/server/game/Entities/Player/SocialMgr.cpp index 9733d5e80bb..4d343d02146 100755 --- a/src/server/game/Entities/Player/SocialMgr.cpp +++ b/src/server/game/Entities/Player/SocialMgr.cpp @@ -25,6 +25,7 @@ #include "ObjectMgr.h" #include "World.h" #include "Util.h" +#include "AccountMgr.h" PlayerSocial::PlayerSocial() { @@ -181,7 +182,7 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friendGUID, FriendInfo &fri friendInfo.Level = 0; friendInfo.Class = 0; - Player *pFriend = ObjectAccessor::FindPlayer(friendGUID); + Player* pFriend = ObjectAccessor::FindPlayer(friendGUID); if (!pFriend) return; @@ -197,7 +198,7 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friendGUID, FriendInfo &fri // PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters // MODERATOR, GAME MASTER, ADMINISTRATOR can see all if (pFriend && pFriend->GetName() && - (security > SEC_PLAYER || + (!AccountMgr::IsPlayerAccount(security) || ((pFriend->GetTeam() == team || allowTwoSideWhoList) && (pFriend->GetSession()->GetSecurity() <= gmLevelInWhoList))) && pFriend->IsVisibleGloballyFor(player)) { @@ -212,7 +213,7 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friendGUID, FriendInfo &fri } } -void SocialMgr::MakeFriendStatusPacket(FriendsResult result, uint32 guid, WorldPacket *data) +void SocialMgr::MakeFriendStatusPacket(FriendsResult result, uint32 guid, WorldPacket* data) { data->Initialize(SMSG_FRIEND_STATUS, 5); *data << uint8(result); @@ -271,12 +272,12 @@ void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet) PlayerSocialMap::const_iterator itr2 = itr->second.m_playerSocialMap.find(guid); if (itr2 != itr->second.m_playerSocialMap.end() && (itr2->second.Flags & SOCIAL_FLAG_FRIEND)) { - Player *pFriend = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)); + Player* pFriend = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)); // PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters // MODERATOR, GAME MASTER, ADMINISTRATOR can see all if (pFriend && pFriend->IsInWorld() && - (pFriend->GetSession()->GetSecurity() > SEC_PLAYER || + (!AccountMgr::IsPlayerAccount(pFriend->GetSession()->GetSecurity()) || ((pFriend->GetTeam() == team || allowTwoSideWhoList) && security <= gmLevelInWhoList)) && player->IsVisibleGloballyFor(pFriend)) { diff --git a/src/server/game/Entities/Player/SocialMgr.h b/src/server/game/Entities/Player/SocialMgr.h index af1f9c1d43c..ae47f7a24cd 100755 --- a/src/server/game/Entities/Player/SocialMgr.h +++ b/src/server/game/Entities/Player/SocialMgr.h @@ -147,7 +147,7 @@ class SocialMgr void GetFriendInfo(Player* player, uint32 friendGUID, FriendInfo &friendInfo); // Packet management - void MakeFriendStatusPacket(FriendsResult result, uint32 friend_guid, WorldPacket *data); + void MakeFriendStatusPacket(FriendsResult result, uint32 friend_guid, WorldPacket* data); void SendFriendStatus(Player* player, FriendsResult result, uint32 friend_guid, bool broadcast); void BroadcastToFriendListers(Player* player, WorldPacket* packet); // Loading diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 705ce0aac6f..fe1abea0f1d 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -45,14 +45,14 @@ void MapManager::LoadTransports() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 lowguid = fields[0].GetUInt32(); uint32 entry = fields[1].GetUInt32(); std::string name = fields[2].GetString(); uint32 period = fields[3].GetUInt32(); uint32 scriptId = sObjectMgr->GetScriptId(fields[4].GetCString()); - const GameObjectTemplate *goinfo = sObjectMgr->GetGameObjectTemplate(entry); + const GameObjectTemplate* goinfo = sObjectMgr->GetGameObjectTemplate(entry); if (!goinfo) { @@ -70,7 +70,7 @@ void MapManager::LoadTransports() std::set<uint32> mapsUsed; - Transport *t = new Transport(period, scriptId); + Transport* t = new Transport(period, scriptId); if (!t->GenerateWaypoints(goinfo->moTransport.taxiPathId, mapsUsed)) // skip transports with empty waypoints list { @@ -111,7 +111,7 @@ void MapManager::LoadTransports() { do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); uint32 entry = fields[1].GetUInt32(); @@ -143,7 +143,7 @@ void MapManager::LoadTransportNPCs() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); uint32 entry = fields[1].GetUInt32(); uint32 transportEntry = fields[2].GetUInt32(); @@ -489,7 +489,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) for (PlayerSet::const_iterator itr = m_passengers.begin(); itr != m_passengers.end();) { - Player *plr = *itr; + Player* plr = *itr; ++itr; if (plr->isDead() && !plr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) @@ -503,7 +503,7 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) RemoveFromWorld(); ResetMap(); - Map * newMap = sMapMgr->CreateMap(newMapid, this, 0); + Map* newMap = sMapMgr->CreateMap(newMapid, this, 0); SetMap(newMap); ASSERT (GetMap()); AddToWorld(); diff --git a/src/server/game/Entities/Transport/Transport.h b/src/server/game/Entities/Transport/Transport.h index a63b0f5d5f0..8fcecffe239 100755 --- a/src/server/game/Entities/Transport/Transport.h +++ b/src/server/game/Entities/Transport/Transport.h @@ -45,10 +45,10 @@ class Transport : public GameObject typedef std::set<Creature*> CreatureSet; CreatureSet m_NPCPassengerSet; uint32 AddNPCPassenger(uint32 tguid, uint32 entry, float x, float y, float z, float o, uint32 anim=0); - void UpdatePosition(MovementInfo *mi); + void UpdatePosition(MovementInfo* mi); void UpdateNPCPositions(); - void BuildStartMovePacket(Map const *targetMap); - void BuildStopMovePacket(Map const *targetMap); + void BuildStartMovePacket(Map const* targetMap); + void BuildStopMovePacket(Map const* targetMap); uint32 GetScriptId() const { return ScriptId; } private: struct WayPoint diff --git a/src/server/game/Entities/Unit/StatSystem.cpp b/src/server/game/Entities/Unit/StatSystem.cpp index 8da3f35082b..471a8324f90 100755 --- a/src/server/game/Entities/Unit/StatSystem.cpp +++ b/src/server/game/Entities/Unit/StatSystem.cpp @@ -63,7 +63,7 @@ bool Player::UpdateStats(Stats stat) if (stat == STAT_STAMINA || stat == STAT_INTELLECT || stat == STAT_STRENGTH) { - Pet *pet = GetPet(); + Pet* pet = GetPet(); if (pet) pet->UpdateStats(stat); } @@ -190,7 +190,7 @@ void Player::UpdateResistances(uint32 school) float value = GetTotalAuraModValue(UnitMods(UNIT_MOD_RESISTANCE_START + school)); SetResistance(SpellSchools(school), int32(value)); - Pet *pet = GetPet(); + Pet* pet = GetPet(); if (pet) pet->UpdateResistances(school); } @@ -220,7 +220,7 @@ void Player::UpdateArmor() SetArmor(int32(value)); - Pet *pet = GetPet(); + Pet* pet = GetPet(); if (pet) pet->UpdateArmor(); @@ -365,7 +365,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged) if (Item* mainHand = m_items[EQUIPMENT_SLOT_MAINHAND]) { // also gains % attack power from equipped weapon - ItemTemplate const *proto = mainHand->GetTemplate(); + ItemTemplate const* proto = mainHand->GetTemplate(); if (!proto) continue; @@ -442,7 +442,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged) SetInt32Value(index_mod, (uint32)attPowerMod); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MODS field SetFloatValue(index_mult, attPowerMultiplier); //UNIT_FIELD_(RANGED)_ATTACK_POWER_MULTIPLIER field - Pet *pet = GetPet(); //update pet's AP + Pet* pet = GetPet(); //update pet's AP //automatically update weapon damage after attack power modification if (ranged) { @@ -624,20 +624,79 @@ void Player::UpdateAllCritPercentages() UpdateCritPercentage(RANGED_ATTACK); } +const float m_diminishing_k[MAX_CLASSES] = +{ + 0.9560f, // Warrior + 0.9560f, // Paladin + 0.9880f, // Hunter + 0.9880f, // Rogue + 0.9830f, // Priest + 0.9560f, // DK + 0.9880f, // Shaman + 0.9830f, // Mage + 0.9830f, // Warlock + 0.0f, // ?? + 0.9720f // Druid +}; + +float Player::GetMissPercentageFromDefence() const +{ + const float miss_cap[MAX_CLASSES] = + { + 16.00f, // Warrior //correct + 16.00f, // Paladin //correct + 16.00f, // Hunter //? + 16.00f, // Rogue //? + 16.00f, // Priest //? + 16.00f, // DK //correct + 16.00f, // Shaman //? + 16.00f, // Mage //? + 16.00f, // Warlock //? + 0.0f, // ?? + 16.00f // Druid //? + }; + float diminishing = 0.0f, nondiminishing = 0.0f; + // Modify value from defense skill (only bonus from defense rating diminishes) + nondiminishing += (GetSkillValue(SKILL_DEFENSE) - GetMaxSkillValueForLevel()) * 0.04f; + diminishing += (int32(GetRatingBonusValue(CR_DEFENSE_SKILL))) * 0.04f; + + // apply diminishing formula to diminishing miss chance + uint32 pclass = getClass()-1; + return nondiminishing + (diminishing * miss_cap[pclass] / (diminishing + miss_cap[pclass] * m_diminishing_k[pclass])); +} + void Player::UpdateParryPercentage() { + const float parry_cap[MAX_CLASSES] = + { + 47.003525f, // Warrior + 47.003525f, // Paladin + 145.560408f, // Hunter + 145.560408f, // Rogue + 0.0f, // Priest + 47.003525f, // DK + 145.560408f, // Shaman + 0.0f, // Mage + 0.0f, // Warlock + 0.0f, // ?? + 0.0f // Druid + }; + // No parry float value = 0.0f; - if (CanParry()) + uint32 pclass = getClass()-1; + if (CanParry() && parry_cap[pclass] > 0.0f) { - // Base parry - value = 5.0f; - // Modify value from defense skill - value += (int32(GetDefenseSkillValue()) - int32(GetMaxSkillValueForLevel())) * 0.04f; - // Parry from SPELL_AURA_MOD_PARRY_PERCENT aura - value += GetTotalAuraModifier(SPELL_AURA_MOD_PARRY_PERCENT); + float nondiminishing = 5.0f; // Parry from rating - value += GetRatingBonusValue(CR_PARRY); + float diminishing = GetRatingBonusValue(CR_PARRY); + // Modify value from defense skill (only bonus from defense rating diminishes) + nondiminishing += (GetSkillValue(SKILL_DEFENSE) - GetMaxSkillValueForLevel()) * 0.04f; + diminishing += (int32(GetRatingBonusValue(CR_DEFENSE_SKILL))) * 0.04f; + // Parry from SPELL_AURA_MOD_PARRY_PERCENT aura + nondiminishing += GetTotalAuraModifier(SPELL_AURA_MOD_PARRY_PERCENT); + // apply diminishing formula to diminishing parry chance + value = nondiminishing + diminishing * parry_cap[pclass] / (diminishing + parry_cap[pclass] * m_diminishing_k[pclass]); value = value < 0.0f ? 0.0f : value; } SetStatFloatValue(PLAYER_PARRY_PERCENTAGE, value); @@ -645,14 +704,34 @@ void Player::UpdateParryPercentage() void Player::UpdateDodgePercentage() { - // Dodge from agility - float value = GetDodgeFromAgility(); - // Modify value from defense skill - value += (int32(GetDefenseSkillValue()) - int32(GetMaxSkillValueForLevel())) * 0.04f; + const float dodge_cap[MAX_CLASSES] = + { + 88.129021f, // Warrior + 88.129021f, // Paladin + 145.560408f, // Hunter + 145.560408f, // Rogue + 150.375940f, // Priest + 88.129021f, // DK + 145.560408f, // Shaman + 150.375940f, // Mage + 150.375940f, // Warlock + 0.0f, // ?? + 116.890707f // Druid + }; + + float diminishing = 0.0f, nondiminishing = 0.0f; + GetDodgeFromAgility(diminishing, nondiminishing); + // Modify value from defense skill (only bonus from defense rating diminishes) + nondiminishing += (GetSkillValue(SKILL_DEFENSE) - GetMaxSkillValueForLevel()) * 0.04f; + diminishing += (int32(GetRatingBonusValue(CR_DEFENSE_SKILL))) * 0.04f; // Dodge from SPELL_AURA_MOD_DODGE_PERCENT aura - value += GetTotalAuraModifier(SPELL_AURA_MOD_DODGE_PERCENT); + nondiminishing += GetTotalAuraModifier(SPELL_AURA_MOD_DODGE_PERCENT); // Dodge from rating - value += GetRatingBonusValue(CR_DODGE); + diminishing += GetRatingBonusValue(CR_DODGE); + // apply diminishing formula to diminishing dodge chance + uint32 pclass = getClass()-1; + float value = nondiminishing + (diminishing * dodge_cap[pclass] / (diminishing + dodge_cap[pclass] * m_diminishing_k[pclass])); + value = value < 0.0f ? 0.0f : value; SetStatFloatValue(PLAYER_DODGE_PERCENTAGE, value); } @@ -719,7 +798,7 @@ void Player::UpdateExpertise(WeaponAttackType attack) int32 expertise = int32(GetRatingBonusValue(CR_EXPERTISE)); - Item *weapon = GetWeaponForAttack(attack, true); + Item* weapon = GetWeaponForAttack(attack, true); AuraEffectList const& expAuras = GetAuraEffectsByType(SPELL_AURA_MOD_EXPERTISE); for (AuraEffectList::const_iterator itr = expAuras.begin(); itr != expAuras.end(); ++itr) @@ -999,7 +1078,7 @@ bool Guardian::UpdateStats(Stats stat) ApplyStatBuffMod(stat, m_statFromOwner[stat], false); float ownersBonus = 0.0f; - Unit *owner = GetOwner(); + Unit* owner = GetOwner(); // Handle Death Knight Glyphs and Talents float mod = 0.75f; if (IsPetGhoul() && (stat == STAT_STAMINA || stat == STAT_STRENGTH)) @@ -1011,7 +1090,7 @@ bool Guardian::UpdateStats(Stats stat) default: break; } // Ravenous Dead - AuraEffect const *aurEff = NULL; + AuraEffect const* aurEff = NULL; // Check just if owner has Ravenous Dead since it's effect is not an aura aurEff = owner->GetAuraEffect(SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE, SPELLFAMILY_DEATHKNIGHT, 3010, 0); if (aurEff) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 3d2403d833f..d6199cbd910 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -745,7 +745,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam // in bg, count dmg if victim is also a player if (victim->GetTypeId() == TYPEID_PLAYER) - if (Battleground *bg = killer->GetBattleground()) + if (Battleground* bg = killer->GetBattleground()) bg->UpdatePlayerScore(killer, SCORE_DAMAGE_DONE, damage); killer->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_DAMAGE_DONE, damage, 0, victim); @@ -892,7 +892,7 @@ void Unit::CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags CastSpell(victim, spellInfo, triggerFlags, castItem, triggeredByAura, originalCaster); } -void Unit::CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item *castItem/*= NULL*/, AuraEffect const* triggeredByAura /*= NULL*/, uint64 originalCaster /*= 0*/) +void Unit::CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem/*= NULL*/, AuraEffect const* triggeredByAura /*= NULL*/, uint64 originalCaster /*= 0*/) { CastSpell(victim, spellInfo, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster); } @@ -998,7 +998,7 @@ void Unit::CastSpell(float x, float y, float z, uint32 spellId, bool triggered, } // used for scripting -void Unit::CastSpell(GameObject *go, uint32 spellId, bool triggered, Item* castItem, AuraEffect* triggeredByAura, uint64 originalCaster) +void Unit::CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castItem, AuraEffect* triggeredByAura, uint64 originalCaster) { if (!go) return; @@ -1038,7 +1038,7 @@ uint32 Unit::SpellNonMeleeDamageLog(Unit* victim, uint32 spellID, uint32 damage) return damageInfo.damage; } -void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const* spellInfo, WeaponAttackType attackType, bool crit) +void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 damage, SpellInfo const* spellInfo, WeaponAttackType attackType, bool crit) { if (damage < 0) return; @@ -1144,7 +1144,7 @@ void Unit::CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 dama damageInfo->damage = damage; } -void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss) +void Unit::DealSpellDamage(SpellNonMeleeDamage* damageInfo, bool durabilityLoss) { if (damageInfo == 0) return; @@ -1170,7 +1170,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss) } // TODO for melee need create structure as in -void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo *damageInfo, WeaponAttackType attackType) +void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo* damageInfo, WeaponAttackType attackType) { damageInfo->attacker = this; damageInfo->target = victim; @@ -1367,7 +1367,7 @@ void Unit::CalculateMeleeDamage(Unit* victim, uint32 damage, CalcDamageInfo *dam damageInfo->damage = 0; } -void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) +void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) { Unit* victim = damageInfo->target; @@ -1883,7 +1883,7 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe *absorb = dmgInfo.GetAbsorb(); } -void Unit::CalcHealAbsorb(Unit* victim, const SpellInfo *healSpell, uint32 &healAmount, uint32 &absorb) +void Unit::CalcHealAbsorb(Unit* victim, const SpellInfo* healSpell, uint32 &healAmount, uint32 &absorb) { if (!healAmount) return; @@ -2011,7 +2011,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst(const Unit* victim, WeaponAttackTy // Miss chance based on melee //float miss_chance = MeleeMissChanceCalc(victim, attType); - float miss_chance = MeleeSpellMissChance(victim, attType, int32(GetWeaponSkillValue(attType, victim)) - int32(victim->GetDefenseSkillValue(this)), 0); + float miss_chance = MeleeSpellMissChance(victim, attType, int32(GetWeaponSkillValue(attType, victim)) - int32(GetMaxSkillValueForLevel(this)), 0); // Critical hit chance float crit_chance = GetUnitCriticalChance(attType, victim); @@ -2296,7 +2296,7 @@ bool Unit::isBlockCritical() return false; } -int32 Unit::GetMechanicResistChance(const SpellInfo *spell) +int32 Unit::GetMechanicResistChance(const SpellInfo* spell) { if (!spell) return 0; @@ -2340,11 +2340,10 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell) attackerWeaponSkill = int32(GetWeaponSkillValue(attType, victim)); int32 skillDiff = attackerWeaponSkill - int32(victim->GetMaxSkillValueForLevel(this)); - int32 fullSkillDiff = attackerWeaponSkill - int32(victim->GetDefenseSkillValue(this)); uint32 roll = urand (0, 10000); - uint32 missChance = uint32(MeleeSpellMissChance(victim, attType, fullSkillDiff, spell->Id) * 100.0f); + uint32 missChance = uint32(MeleeSpellMissChance(victim, attType, skillDiff, spell->Id) * 100.0f); // Roll miss uint32 tmp = missChance; if (roll < tmp) @@ -2720,6 +2719,21 @@ float Unit::GetUnitParryChance() const return chance > 0.0f ? chance : 0.0f; } +float Unit::GetUnitMissChance(WeaponAttackType attType) const +{ + float miss_chance = 5.00f; + + if (Player const* player = ToPlayer()) + miss_chance += player->GetMissPercentageFromDefence(); + + if (attType == RANGED_ATTACK) + miss_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE); + else + miss_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE); + + return miss_chance; +} + float Unit::GetUnitBlockChance() const { if (IsNonMeleeSpellCasted(false) || HasUnitState(UNIT_STAT_CONTROLLED)) @@ -4599,7 +4613,7 @@ void Unit::_UnregisterDynObject(DynamicObject* dynObj) m_dynObj.remove(dynObj); } -DynamicObject * Unit::GetDynObject(uint32 spellId) +DynamicObject* Unit::GetDynObject(uint32 spellId) { if (m_dynObj.empty()) return NULL; @@ -4735,7 +4749,7 @@ void Unit::RemoveAllGameObjects() } } -void Unit::SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log) +void Unit::SendSpellNonMeleeDamageLog(SpellNonMeleeDamage* log) { WorldPacket data(SMSG_SPELLNONMELEEDAMAGELOG, (16+4+4+4+1+4+4+1+1+4+4+1)); // we guess size data.append(log->target->GetPackGUID()); @@ -4780,7 +4794,7 @@ void Unit::ProcDamageAndSpell(Unit* victim, uint32 procAttacker, uint32 procVict victim->ProcDamageAndSpellFor(true, this, procVictim, procExtra, attType, procSpell, amount, procAura); } -void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo) +void Unit::SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo) { AuraEffect const* aura = pInfo->auraEff; @@ -4860,7 +4874,7 @@ void Unit::SendSpellDamageImmune(Unit* target, uint32 spellId) SendMessageToSet(&data, true); } -void Unit::SendAttackStateUpdate(CalcDamageInfo *damageInfo) +void Unit::SendAttackStateUpdate(CalcDamageInfo* damageInfo) { sLog->outDebug(LOG_FILTER_UNITS, "WORLD: Sending SMSG_ATTACKERSTATEUPDATE"); @@ -9225,6 +9239,125 @@ FactionTemplateEntry const* Unit::getFactionTemplateEntry() const return entry; } +// function based on function Unit::UnitReaction from 13850 client +ReputationRank Unit::GetReactionTo(Unit const* target) const +{ + // always friendly to self + if (this == target) + return REP_FRIENDLY; + + // always friendly to charmer or owner + if (GetCharmerOrOwnerOrSelf() == target->GetCharmerOrOwnerOrSelf()) + return REP_FRIENDLY; + + if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) + { + if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) + { + Player const* selfPlayerOwner = GetAffectingPlayer(); + Player const* targetPlayerOwner = target->GetAffectingPlayer(); + + if (selfPlayerOwner && targetPlayerOwner) + { + // always friendly to other unit controlled by player, or to the player himself + if (selfPlayerOwner == targetPlayerOwner) + return REP_FRIENDLY; + + // duel - always hostile to opponent + if (selfPlayerOwner->duel && selfPlayerOwner->duel->opponent == targetPlayerOwner && selfPlayerOwner->duel->startTime != 0) + return REP_HOSTILE; + + // same group - checks dependant only on our faction - skip FFA_PVP for example + if (selfPlayerOwner->IsInRaidWith(targetPlayerOwner)) + return REP_FRIENDLY; // return true to allow config option AllowTwoSide.Interaction.Group to work + // however client seems to allow mixed group parties, because in 13850 client it works like: + // return GetFactionReactionTo(getFactionTemplateEntry(), target); + } + + // check FFA_PVP + if (GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_FFA_PVP + && target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_FFA_PVP) + return REP_HOSTILE; + + if (selfPlayerOwner) + { + if (FactionTemplateEntry const* targetFactionTemplateEntry = target->getFactionTemplateEntry()) + { + if (ReputationRank const* repRank = selfPlayerOwner->GetReputationMgr().GetForcedRankIfAny(targetFactionTemplateEntry)) + return *repRank; + if (!selfPlayerOwner->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_IGNORE_REPUTATION)) + { + if (FactionEntry const* targetFactionEntry = sFactionStore.LookupEntry(targetFactionTemplateEntry->faction)) + { + if (targetFactionEntry->CanHaveReputation()) + { + // check contested flags + if (targetFactionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_CONTESTED_GUARD + && selfPlayerOwner->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP)) + return REP_HOSTILE; + + // if faction have reputation then hostile state dependent only from at_war state + if (selfPlayerOwner->GetReputationMgr().IsAtWar(targetFactionEntry)) + return REP_HOSTILE; + return REP_FRIENDLY; + } + } + } + } + } + } + } + // do checks dependant only on our faction + return GetFactionReactionTo(getFactionTemplateEntry(), target); +} + +ReputationRank Unit::GetFactionReactionTo(FactionTemplateEntry const* factionTemplateEntry, Unit const* target) +{ + // always neutral when no template entry found + if (!factionTemplateEntry) + return REP_NEUTRAL; + + FactionTemplateEntry const* targetFactionTemplateEntry = target->getFactionTemplateEntry(); + if (!targetFactionTemplateEntry) + return REP_NEUTRAL; + + if (Player const* targetPlayerOwner = target->GetAffectingPlayer()) + { + // check contested flags + if (factionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_CONTESTED_GUARD + && targetPlayerOwner->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_CONTESTED_PVP)) + return REP_HOSTILE; + if (ReputationRank const* repRank = targetPlayerOwner->GetReputationMgr().GetForcedRankIfAny(factionTemplateEntry)) + return *repRank; + if (!target->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_IGNORE_REPUTATION)) + { + if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction)) + { + if (factionEntry->CanHaveReputation()) + { + // CvP case - check reputation, don't allow state higher than neutral when at war + ReputationRank repRank = targetPlayerOwner->GetReputationMgr().GetRank(factionEntry); + if (targetPlayerOwner->GetReputationMgr().IsAtWar(factionEntry)) + repRank = std::min(REP_NEUTRAL, repRank); + return repRank; + } + } + } + } + + // common faction based check + if (factionTemplateEntry->IsHostileTo(*targetFactionTemplateEntry)) + return REP_HOSTILE; + if (factionTemplateEntry->IsFriendlyTo(*targetFactionTemplateEntry)) + return REP_FRIENDLY; + if (targetFactionTemplateEntry->IsFriendlyTo(*factionTemplateEntry)) + return REP_FRIENDLY; + if (factionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_HOSTILE_BY_DEFAULT) + return REP_HOSTILE; + // neutral by default + return REP_NEUTRAL; +} + bool Unit::IsHostileTo(Unit const* unit) const { if (!unit) @@ -9783,6 +9916,16 @@ Player* Unit::GetCharmerOrOwnerPlayerOrPlayerItself() const return GetTypeId() == TYPEID_PLAYER ? (Player*)this : NULL; } +Player* Unit::GetAffectingPlayer() const +{ + if (!GetCharmerOrOwnerGUID()) + return GetTypeId() == TYPEID_PLAYER ? (Player*)this : NULL; + + if (Unit* owner = GetCharmerOrOwner()) + return owner->GetCharmerOrOwnerPlayerOrPlayerItself(); + return NULL; +} + Minion *Unit::GetFirstMinion() const { if (uint64 pet_guid = GetMinionGUID()) @@ -10224,7 +10367,7 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius) // reserve place for players and pets because resizing vector every unit push is unefficient (vector is reallocated then) nearMembers.reserve(pGroup->GetMembersCount() * 2); - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) if (Player* Target = itr->getSource()) { // IsHostileTo check duel and controlled by enemy @@ -10368,7 +10511,11 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i) - if ((*i)->GetMiscValue() & spellProto->GetSchoolMask() && !(spellProto->GetSchoolMask() & SPELL_SCHOOL_MASK_NORMAL)) + { + if (spellProto->EquippedItemClass == -1 && (*i)->GetSpellInfo()->EquippedItemClass != -1) //prevent apply mods from weapon specific case to non weapon specific spells (Example: thunder clap and two-handed weapon specialization) + continue; + + if ((*i)->GetMiscValue() & spellProto->GetSchoolMask()) { if ((*i)->GetSpellInfo()->EquippedItemClass == -1) AddPctN(DoneTotalMod, (*i)->GetAmount()); @@ -10377,6 +10524,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32 else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellInfo())) AddPctN(DoneTotalMod, (*i)->GetAmount()); } + } uint32 creatureTypeMask = victim->GetCreatureTypeMask(); // Add flat bonus from spell damage versus @@ -11935,7 +12083,7 @@ void Unit::ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply) } } -void Unit::ApplySpellDispelImmunity(const SpellInfo * spellProto, DispelType type, bool apply) +void Unit::ApplySpellDispelImmunity(const SpellInfo* spellProto, DispelType type, bool apply) { ApplySpellImmune(spellProto->Id, IMMUNITY_DISPEL, type, apply); @@ -11970,7 +12118,7 @@ float Unit::GetWeaponProcChance() const return 0; } -float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellInfo * spellProto) const +float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellInfo* spellProto) const { // proc per minute chance calculation if (PPM <= 0) return 0.0f; @@ -12016,7 +12164,7 @@ void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry) Pet* pet = plr->GetPet(); if (pet) { - Battleground *bg = ToPlayer()->GetBattleground(); + Battleground* bg = ToPlayer()->GetBattleground(); // don't unsummon pet in arena but SetFlag UNIT_FLAG_STUNNED to disable pet's interface if (bg && bg->isArena()) pet->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED); @@ -12218,50 +12366,190 @@ bool Unit::isTargetableForAttack(bool checkFakeDeath) const return !HasUnitState(UNIT_STAT_UNATTACKABLE) && (!checkFakeDeath || !HasUnitState(UNIT_STAT_DIED)); } -bool Unit::canAttack(Unit const* target, bool force) const +bool Unit::IsValidAttackTarget(Unit const* target) const +{ + return _IsValidAttackTarget(target, NULL); +} + +// function based on function Unit::CanAttack from 13850 client +bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) const { ASSERT(target); - if (force) - { - if (IsFriendlyTo(target)) + // can't attack self + if (this == target) + return false; + + // can't attack unattackable units or GMs + if (target->HasUnitState(UNIT_STAT_UNATTACKABLE) + || target->GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->isGameMaster()) + return false; + + // can't attack own vehicle or passenger + if (m_vehicle) + if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target)) return false; - if (GetTypeId() != TYPEID_PLAYER) - { - if (isPet()) - { - if (Unit* owner = GetOwner()) - if (!(owner->canAttack(target))) - return false; - } - else if (!IsHostileTo(target)) - return false; - } - } - else if (!IsHostileTo(target)) + // can't attack invisible + if ((!bySpell || !(bySpell->AttributesEx6 & SPELL_ATTR6_CAN_TARGET_INVISIBLE)) && !canSeeOrDetect(target)) return false; - if (!target->isTargetableForAttack(false)) + // can't attack dead + if ((!bySpell || !bySpell->IsAllowingDeadTarget()) && !target->isAlive()) + return false; + + // can't attack untargetable + if ((!bySpell || !(bySpell->AttributesEx6 & SPELL_ATTR6_CAN_TARGET_UNTARGETABLE)) + && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) return false; - if (target->HasUnitState(UNIT_STAT_DIED)) + if (Player const* playerAttacker = ToPlayer()) { - if (!ToCreature() || !ToCreature()->isGuard()) + if (playerAttacker->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_UNK19)) return false; + } + // check flags + if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_TAXI_FLIGHT | UNIT_FLAG_NOT_ATTACKABLE_1 | UNIT_FLAG_UNK_16) + || (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)) + || (!target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)) + || (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE)) + || (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE))) + return false; - // guards can detect fake death - if (!target->HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH)) - return false; + // CvC case - can attack each other only when one of them is hostile + if (!HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && !target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) + return GetReactionTo(target) <= REP_HOSTILE || target->GetReactionTo(this) <= REP_HOSTILE; + + // PvP, PvC, CvP case + // can't attack friendly targets + if ( GetReactionTo(target) > REP_NEUTRAL + || target->GetReactionTo(this) > REP_NEUTRAL) + return false; + + Creature const* creatureAttacker = ToCreature(); + if (creatureAttacker && creatureAttacker->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK26) + return false; + + Player const* playerAffectingAttacker = HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) ? GetAffectingPlayer() : NULL; + Player const* playerAffectingTarget = target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) ? target->GetAffectingPlayer() : NULL; + + // check duel - before sanctuary checks + if (playerAffectingAttacker && playerAffectingTarget) + if (playerAffectingAttacker->duel && playerAffectingAttacker->duel->opponent == playerAffectingTarget && playerAffectingAttacker->duel->startTime != 0) + return true; + + // PvP case - can't attack when attacker or target are in sanctuary + // however, 13850 client doesn't allow to attack when one of the unit's has sanctuary flag and is pvp + if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) + && ((target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_SANCTUARY) || (GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_SANCTUARY))) + return false; + + // additional checks - only PvP case + if (playerAffectingAttacker && playerAffectingTarget) + { + if (target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_PVP) + return true; + + if (GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_FFA_PVP + && target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_FFA_PVP) + return true; + + return (GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_UNK1) + || (target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_UNK1); } + return true; +} + +bool Unit::IsValidAssistTarget(Unit const* target) const +{ + return _IsValidAssistTarget(target, NULL); +} + +// function based on function Unit::CanAssist from 13850 client +bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) const +{ + ASSERT(target); + // can assist to self + if (this == target) + return true; + + // can't assist unattackable units or GMs + if (target->HasUnitState(UNIT_STAT_UNATTACKABLE) + || target->GetTypeId() == TYPEID_PLAYER && target->ToPlayer()->isGameMaster()) + return false; + + // can't assist own vehicle or passenger if (m_vehicle) if (IsOnVehicle(target) || m_vehicle->GetBase()->IsOnVehicle(target)) return false; - if (!canSeeOrDetect(target)) + // can't assist invisible + if ((!bySpell || !(bySpell->AttributesEx6 & SPELL_ATTR6_CAN_TARGET_INVISIBLE)) && !canSeeOrDetect(target)) + return false; + + // can't assist dead + if ((!bySpell || !bySpell->IsAllowingDeadTarget()) && !target->isAlive()) + return false; + + // can't assist untargetable + if ((!bySpell || !(bySpell->AttributesEx6 & SPELL_ATTR6_CAN_TARGET_UNTARGETABLE)) + && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) return false; + if (!bySpell || !(bySpell->AttributesEx6 & SPELL_ATTR6_UNK3)) + { + if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) + { + if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE)) + return false; + } + else + { + if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PASSIVE)) + return false; + } + } + + // can't assist non-friendly targets + if (GetReactionTo(target) <= REP_NEUTRAL + && target->GetReactionTo(this) <= REP_NEUTRAL + && (!ToCreature() || !(ToCreature()->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK26))) + return false; + + // PvP case + if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) + { + Player const* targetPlayerOwner = target->GetAffectingPlayer(); + if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE)) + { + Player const* selfPlayerOwner = GetAffectingPlayer(); + if (selfPlayerOwner && targetPlayerOwner) + { + // can't assist player which is dueling someone + if (selfPlayerOwner != targetPlayerOwner + && targetPlayerOwner->duel) + return false; + } + // can't assist player in ffa_pvp zone from outside + if ((target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_FFA_PVP) + && !(GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_FFA_PVP)) + return false; + // can't assist player out of sanctuary from sanctuary if has pvp enabled + if (target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_PVP) + if ((GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_SANCTUARY) && !(target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_SANCTUARY)) + return false; + } + } + // PvC case - player can assist creature only if has specific type flags + // !target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) && + else if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) + && (!bySpell || !(bySpell->AttributesEx6 & SPELL_ATTR6_UNK3)) + && !((target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_PVP))) + { + if (Creature const* creatureTarget = target->ToCreature()) + return creatureTarget->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK26 || creatureTarget->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS; + } return true; } @@ -12847,7 +13135,7 @@ Unit* Creature::SelectVictim() { --aura; caster = (*aura)->GetCaster(); - if (caster && canSeeOrDetect(caster, true) && canAttack(caster) && caster->isInAccessiblePlaceFor(ToCreature())) + if (caster && canSeeOrDetect(caster, true) && IsValidAttackTarget(caster) && caster->isInAccessiblePlaceFor(ToCreature())) { target = caster; break; @@ -14083,7 +14371,7 @@ bool InitTriggerAuraData() return true; } -uint32 createProcExtendMask(SpellNonMeleeDamage *damageInfo, SpellMissInfo missCondition) +uint32 createProcExtendMask(SpellNonMeleeDamage* damageInfo, SpellMissInfo missCondition) { uint32 procEx = PROC_EX_NONE; // Check victim state @@ -14793,9 +15081,7 @@ Unit* Unit::SelectNearbyTarget(float dist) const return NULL; // select random - std::list<Unit*>::const_iterator tcIter = targets.begin(); - std::advance(tcIter, urand(0, targets.size()-1)); - return *tcIter; + return SelectRandomContainerElement(targets); } void Unit::ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply) @@ -14926,7 +15212,7 @@ void Unit::UpdateAuraForGroup(uint8 slot) } else if (GetTypeId() == TYPEID_UNIT && ToCreature()->isPet()) { - Pet *pet = ((Pet*)this); + Pet* pet = ((Pet*)this); if (pet->isControlled()) { Unit* owner = GetOwner(); @@ -15052,7 +15338,7 @@ Pet* Unit::CreateTamedPetFrom(uint32 creatureEntry, uint32 spell_id) return pet; } -bool Unit::InitTamedPet(Pet * pet, uint8 level, uint32 spell_id) +bool Unit::InitTamedPet(Pet* pet, uint8 level, uint32 spell_id) { pet->SetCreatorGUID(GetGUID()); pet->setFaction(getFaction()); @@ -15488,7 +15774,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss) // the reset time is set but not added to the scheduler // until the players leave the instance time_t resettime = creature->GetRespawnTimeEx() + 2 * HOUR; - if (InstanceSave *save = sInstanceSaveMgr->GetInstanceSave(creature->GetInstanceId())) + if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(creature->GetInstanceId())) if (save->GetResetTime() < resettime) save->SetResetTime(resettime); } } @@ -16160,7 +16446,7 @@ void Unit::GetRaidMember(std::list<Unit*> &nearMembers, float radius) Group* pGroup = owner->GetGroup(); if (pGroup) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); @@ -16196,7 +16482,7 @@ void Unit::GetPartyMemberInDist(std::list<Unit*> &TagUnitMap, float radius) { uint8 subgroup = owner->ToPlayer()->GetSubGroup(); - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); @@ -16233,7 +16519,7 @@ void Unit::GetPartyMembers(std::list<Unit*> &TagUnitMap) { uint8 subgroup = owner->ToPlayer()->GetSubGroup(); - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); @@ -16388,51 +16674,43 @@ void Unit::ApplyResilience(Unit const* victim, float* crit, int32* damage, bool // Crit or block - determined on damage calculation phase! (and can be both in some time) float Unit::MeleeSpellMissChance(const Unit* victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const { - // Calculate hit chance (more correct for chance mod) - int32 HitChance; + //calculate miss chance + float missChance = victim->GetUnitMissChance(attType); - // PvP - PvE melee chances - if (spellId || attType == RANGED_ATTACK || !haveOffhandWeapon()) - HitChance = 95; - else - HitChance = 76; + if (!spellId && haveOffhandWeapon()) + missChance += 19; - // Hit chance depends from victim auras - if (attType == RANGED_ATTACK) - HitChance += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_RANGED_HIT_CHANCE); + // bonus from skills is 0.04% + //miss_chance -= skillDiff * 0.04f; + int32 diff = -skillDiff; + if (victim->GetTypeId() == TYPEID_PLAYER) + missChance += diff > 0 ? diff * 0.04f : diff * 0.02f; else - HitChance += victim->GetTotalAuraModifier(SPELL_AURA_MOD_ATTACKER_MELEE_HIT_CHANCE); + missChance += diff > 10 ? 1 + (diff - 10) * 0.4f : diff * 0.1f; + + // Calculate hit chance + float hitChance = 100.0f; // Spellmod from SPELLMOD_RESIST_MISS_CHANCE if (spellId) { if (Player* modOwner = GetSpellModOwner()) - modOwner->ApplySpellMod(spellId, SPELLMOD_RESIST_MISS_CHANCE, HitChance); + modOwner->ApplySpellMod(spellId, SPELLMOD_RESIST_MISS_CHANCE, hitChance); } - // Miss = 100 - hit - float miss_chance = 100.0f - HitChance; + missChance += hitChance - 100.0f; - // Bonuses from attacker aura and ratings if (attType == RANGED_ATTACK) - miss_chance -= m_modRangedHitChance; + missChance -= m_modRangedHitChance; else - miss_chance -= m_modMeleeHitChance; - - // bonus from skills is 0.04% - //miss_chance -= skillDiff * 0.04f; - int32 diff = -skillDiff; - if (victim->GetTypeId() == TYPEID_PLAYER) - miss_chance += diff > 0 ? diff * 0.04f : diff * 0.02f; - else - miss_chance += diff > 10 ? 2 + (diff - 10) * 0.4f : diff * 0.1f; + missChance -= m_modMeleeHitChance; // Limit miss chance from 0 to 60% - if (miss_chance < 0.0f) + if (missChance < 0.0f) return 0.0f; - if (miss_chance > 60.0f) + if (missChance > 60.0f) return 60.0f; - return miss_chance; + return missChance; } void Unit::SetPhaseMask(uint32 newPhaseMask, bool update) @@ -16825,7 +17103,7 @@ void Unit::JumpTo(float speedXY, float speedZ, bool forward) } } -void Unit::JumpTo(WorldObject *obj, float speedZ) +void Unit::JumpTo(WorldObject* obj, float speedZ) { float x, y, z; obj->GetContactPoint(this, x, y, z); @@ -16940,7 +17218,7 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a RemoveAurasByType(SPELL_AURA_MOUNTED); // drop flag at invisible in bg - if (Battleground *bg = plr->GetBattleground()) + if (Battleground* bg = plr->GetBattleground()) bg->EventPlayerDroppedFlag(plr); WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0); @@ -16995,7 +17273,7 @@ void Unit::_ExitVehicle(Position const* exitPosition) m_vehicle->RemovePassenger(this); // This should be done before dismiss, because there may be some aura removal - Vehicle *vehicle = m_vehicle; + Vehicle* vehicle = m_vehicle; m_vehicle = NULL; SetControlled(false, UNIT_STAT_ROOT); // SMSG_MOVE_FORCE_UNROOT, ~MOVEMENTFLAG_ROOT diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index fb41914d6f7..c54a627fa27 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -572,7 +572,7 @@ enum DamageEffectType // Value masks for UNIT_FIELD_FLAGS enum UnitFlags { - UNIT_FLAG_UNK_0 = 0x00000001, + UNIT_FLAG_SERVER_CONTROLLED = 0x00000001, // set only when unit movement is controlled by server - by SPLINE/MONSTER_MOVE packets, together with UNIT_FLAG_STUNNED; only set to units controlled by client; client function CGUnit_C::IsClientControlled returns false when set for owner UNIT_FLAG_NON_ATTACKABLE = 0x00000002, // not attackable UNIT_FLAG_DISABLE_MOVE = 0x00000004, UNIT_FLAG_PVP_ATTACKABLE = 0x00000008, // allow apply pvp rules to attackable state in addition to faction dependent state @@ -611,6 +611,7 @@ enum UnitFlags2 { UNIT_FLAG2_FEIGN_DEATH = 0x00000001, UNIT_FLAG2_UNK1 = 0x00000002, // Hide unit model (show only player equip) + UNIT_FLAG2_IGNORE_REPUTATION = 0x00000004, UNIT_FLAG2_COMPREHEND_LANG = 0x00000008, UNIT_FLAG2_MIRROR_IMAGE = 0x00000010, UNIT_FLAG2_FORCE_MOVE = 0x00000040, @@ -939,7 +940,7 @@ struct CalcDamageInfo // Spell damage info structure based on structure sending in SMSG_SPELLNONMELEEDAMAGELOG opcode struct SpellNonMeleeDamage{ - SpellNonMeleeDamage(Unit *_attacker, Unit *_target, uint32 _SpellID, uint32 _schoolMask) + SpellNonMeleeDamage(Unit* _attacker, Unit* _target, uint32 _SpellID, uint32 _schoolMask) : target(_target), attacker(_attacker), SpellID(_SpellID), damage(0), overkill(0), schoolMask(_schoolMask), absorb(0), resist(0), physicalLog(false), unused(false), blocked(0), HitInfo(0), cleanDamage(0) {} @@ -962,7 +963,7 @@ struct SpellNonMeleeDamage{ struct SpellPeriodicAuraLogInfo { - SpellPeriodicAuraLogInfo(AuraEffect const *_auraEff, uint32 _damage, uint32 _overDamage, uint32 _absorb, uint32 _resist, float _multiplier, bool _critical) + SpellPeriodicAuraLogInfo(AuraEffect const* _auraEff, uint32 _damage, uint32 _overDamage, uint32 _absorb, uint32 _resist, float _multiplier, bool _critical) : auraEff(_auraEff), damage(_damage), overDamage(_overDamage), absorb(_absorb), resist(_resist), multiplier(_multiplier), critical(_critical){} AuraEffect const* auraEff; @@ -974,7 +975,7 @@ struct SpellPeriodicAuraLogInfo bool critical; }; -uint32 createProcExtendMask(SpellNonMeleeDamage *damageInfo, SpellMissInfo missCondition); +uint32 createProcExtendMask(SpellNonMeleeDamage* damageInfo, SpellMissInfo missCondition); enum UnitAnimationState { @@ -1229,8 +1230,8 @@ class Unit : public WorldObject typedef std::multimap<uint32, Aura*> AuraMap; typedef std::multimap<uint32, AuraApplication*> AuraApplicationMap; typedef std::multimap<AuraStateType, AuraApplication*> AuraStateAurasMap; - typedef std::list<AuraEffect *> AuraEffectList; - typedef std::list<Aura *> AuraList; + typedef std::list<AuraEffect*> AuraEffectList; + typedef std::list<Aura*> AuraList; typedef std::list<AuraApplication *> AuraApplicationList; typedef std::list<DiminishingReturn> Diminishing; typedef std::set<uint32> ComboPointHolderSet; @@ -1268,17 +1269,17 @@ class Unit : public WorldObject void SetCanDualWield(bool value) { m_canDualWield = value; } float GetCombatReach() const { return m_floatValues[UNIT_FIELD_COMBATREACH]; } float GetMeleeReach() const { float reach = m_floatValues[UNIT_FIELD_COMBATREACH]; return reach > MIN_MELEE_REACH ? reach : MIN_MELEE_REACH; } - bool IsWithinCombatRange(const Unit *obj, float dist2compare) const; - bool IsWithinMeleeRange(const Unit *obj, float dist = MELEE_RANGE) const; + bool IsWithinCombatRange(const Unit* obj, float dist2compare) const; + bool IsWithinMeleeRange(const Unit* obj, float dist = MELEE_RANGE) const; void GetRandomContactPoint(const Unit* target, float &x, float &y, float &z, float distance2dMin, float distance2dMax) const; uint32 m_extraAttacks; bool m_canDualWield; - void _addAttacker(Unit *pAttacker) // must be called only from Unit::Attack(Unit*) + void _addAttacker(Unit* pAttacker) // must be called only from Unit::Attack(Unit*) { m_attackers.insert(pAttacker); } - void _removeAttacker(Unit *pAttacker) // must be called only from Unit::AttackStop() + void _removeAttacker(Unit* pAttacker) // must be called only from Unit::AttackStop() { m_attackers.erase(pAttacker); } @@ -1386,6 +1387,10 @@ class Unit : public WorldObject uint32 getFaction() const { return GetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE); } void setFaction(uint32 faction) { SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, faction); } FactionTemplateEntry const* getFactionTemplateEntry() const; + + ReputationRank GetReactionTo(Unit const* target) const; + ReputationRank static GetFactionReactionTo(FactionTemplateEntry const* factionTemplateEntry, Unit const* target); + bool IsHostileTo(Unit const* unit) const; bool IsHostileToPlayers() const; bool IsFriendlyTo(Unit const* unit) const; @@ -1432,12 +1437,12 @@ class Unit : public WorldObject void Unmount(); uint16 GetMaxSkillValueForLevel(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; } - void DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb); - uint32 DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage = NULL, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto = NULL, bool durabilityLoss = true); - void Kill(Unit *pVictim, bool durabilityLoss = true); - int32 DealHeal(Unit *pVictim, uint32 addhealth); + void DealDamageMods(Unit* pVictim, uint32 &damage, uint32* absorb); + uint32 DealDamage(Unit* pVictim, uint32 damage, CleanDamage const* cleanDamage = NULL, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* spellProto = NULL, bool durabilityLoss = true); + void Kill(Unit* pVictim, bool durabilityLoss = true); + int32 DealHeal(Unit* pVictim, uint32 addhealth); - void ProcDamageAndSpell(Unit *pVictim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellInfo const *procSpell = NULL, SpellInfo const* procAura = NULL); + void ProcDamageAndSpell(Unit* pVictim, uint32 procAttacker, uint32 procVictim, uint32 procEx, uint32 amount, WeaponAttackType attType = BASE_ATTACK, SpellInfo const* procSpell = NULL, SpellInfo const* procAura = NULL); void ProcDamageAndSpellFor(bool isVictim, Unit* pTarget, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, SpellInfo const* procSpell, uint32 damage , SpellInfo const* procAura = NULL); void GetProcAurasTriggeredOnEvent(std::list<AuraApplication*>& aurasTriggeringProc, std::list<AuraApplication*>* procAuras, ProcEventInfo eventInfo); @@ -1446,13 +1451,13 @@ class Unit : public WorldObject void TriggerAurasProcOnEvent(ProcEventInfo& eventInfo, std::list<AuraApplication*>& procAuras); void HandleEmoteCommand(uint32 anim_id); - void AttackerStateUpdate (Unit *pVictim, WeaponAttackType attType = BASE_ATTACK, bool extra = false); + void AttackerStateUpdate (Unit* pVictim, WeaponAttackType attType = BASE_ATTACK, bool extra = false); - void CalculateMeleeDamage(Unit *pVictim, uint32 damage, CalcDamageInfo *damageInfo, WeaponAttackType attackType = BASE_ATTACK); - void DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss); + void CalculateMeleeDamage(Unit* pVictim, uint32 damage, CalcDamageInfo* damageInfo, WeaponAttackType attackType = BASE_ATTACK); + void DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss); - void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType = BASE_ATTACK, bool crit = false); - void DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss); + void CalculateSpellDamageTaken(SpellNonMeleeDamage* damageInfo, int32 damage, SpellInfo const* spellInfo, WeaponAttackType attackType = BASE_ATTACK, bool crit = false); + void DealSpellDamage(SpellNonMeleeDamage* damageInfo, bool durabilityLoss); // player or player's pet resilience (-1%) float GetMeleeCritChanceReduction() const { return GetCombatRatingReduction(CR_CRIT_TAKEN_MELEE); } @@ -1471,16 +1476,17 @@ class Unit : public WorldObject void ApplyResilience(const Unit* pVictim, float * crit, int32 * damage, bool isCrit, CombatRating type) const; - float MeleeSpellMissChance(const Unit *pVictim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const; - SpellMissInfo MeleeSpellHitResult(Unit *pVictim, SpellInfo const *spell); - SpellMissInfo MagicSpellHitResult(Unit *pVictim, SpellInfo const *spell); - SpellMissInfo SpellHitResult(Unit *pVictim, SpellInfo const *spell, bool canReflect = false); + float MeleeSpellMissChance(const Unit* pVictim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const; + SpellMissInfo MeleeSpellHitResult(Unit* pVictim, SpellInfo const* spell); + SpellMissInfo MagicSpellHitResult(Unit* pVictim, SpellInfo const* spell); + SpellMissInfo SpellHitResult(Unit* pVictim, SpellInfo const* spell, bool canReflect = false); float GetUnitDodgeChance() const; float GetUnitParryChance() const; float GetUnitBlockChance() const; - float GetUnitCriticalChance(WeaponAttackType attackType, const Unit *pVictim) const; - int32 GetMechanicResistChance(const SpellInfo *spell); + float GetUnitMissChance(WeaponAttackType attType) const; + float GetUnitCriticalChance(WeaponAttackType attackType, const Unit* pVictim) const; + int32 GetMechanicResistChance(const SpellInfo* spell); bool CanUseAttackType(uint8 attacktype) const { switch(attacktype) @@ -1497,10 +1503,10 @@ class Unit : public WorldObject uint32 GetDefenseSkillValue(Unit const* target = NULL) const; uint32 GetWeaponSkillValue(WeaponAttackType attType, Unit const* target = NULL) const; float GetWeaponProcChance() const; - float GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellInfo * spellProto) const; + float GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellInfo* spellProto) const; - MeleeHitOutcome RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttackType attType) const; - MeleeHitOutcome RollMeleeOutcomeAgainst (const Unit *pVictim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const; + MeleeHitOutcome RollMeleeOutcomeAgainst (const Unit* pVictim, WeaponAttackType attType) const; + MeleeHitOutcome RollMeleeOutcomeAgainst (const Unit* pVictim, WeaponAttackType attType, int32 crit_chance, int32 miss_chance, int32 dodge_chance, int32 parry_chance, int32 block_chance) const; bool isVendor() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_VENDOR); } bool isTrainer() const { return HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_TRAINER); } @@ -1547,38 +1553,44 @@ class Unit : public WorldObject bool isFrozen() const; bool isTargetableForAttack(bool checkFakeDeath = true) const; - bool canAttack(Unit const* target, bool force = true) const; + + bool IsValidAttackTarget(Unit const* target) const; + bool _IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) const; + + bool IsValidAssistTarget(Unit const* target) const; + bool _IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) const; + virtual bool IsInWater() const; virtual bool IsUnderWater() const; bool isInAccessiblePlaceFor(Creature const* c) const; - void SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, uint32 OverHeal, uint32 Absorb, bool critical = false); + void SendHealSpellLog(Unit* pVictim, uint32 SpellID, uint32 Damage, uint32 OverHeal, uint32 Absorb, bool critical = false); int32 HealBySpell(Unit* pVictim, SpellInfo const* spellInfo, uint32 addHealth, bool critical = false); - void SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers powertype); - void EnergizeBySpell(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers powertype); - uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage); - void CastSpell(Unit* victim, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); + void SendEnergizeSpellLog(Unit* pVictim, uint32 SpellID, uint32 Damage, Powers powertype); + void EnergizeBySpell(Unit* pVictim, uint32 SpellID, uint32 Damage, Powers powertype); + uint32 SpellNonMeleeDamageLog(Unit* pVictim, uint32 spellID, uint32 damage); + void CastSpell(Unit* victim, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); void CastSpell(Unit* victim, uint32 spellId, TriggerCastFlags triggerFlags = TRIGGERED_NONE, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastSpell(Unit* victim, SpellInfo const *spellInfo, bool triggered, Item *castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastSpell(Unit* victim, SpellInfo const *spellInfo, TriggerCastFlags triggerFlags, Item *castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); - void CastSpell(GameObject *go, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); - Aura * AddAura(uint32 spellId, Unit* target); - Aura * AddAura(SpellInfo const *spellInfo, uint8 effMask, Unit* target); + void CastSpell(Unit* victim, SpellInfo const* spellInfo, bool triggered, Item* castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags, Item* castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item* castItem= NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* Victim = NULL, bool triggered = true, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* Victim = NULL, bool triggered = true, Item* castItem = NULL, AuraEffect const* triggeredByAura = NULL, uint64 originalCaster = 0); + void CastSpell(GameObject* go, uint32 spellId, bool triggered, Item* castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0); + Aura* AddAura(uint32 spellId, Unit* target); + Aura* AddAura(SpellInfo const* spellInfo, uint8 effMask, Unit* target); void SetAuraStack(uint32 spellId, Unit* target, uint32 stack); void SendPlaySpellVisual(uint32 id); void SendPlaySpellImpact(uint64 guid, uint32 id); void DeMorph(); - void SendAttackStateUpdate(CalcDamageInfo *damageInfo); + void SendAttackStateUpdate(CalcDamageInfo* damageInfo); void SendAttackStateUpdate(uint32 HitInfo, Unit* target, uint8 SwingType, SpellSchoolMask damageSchoolMask, uint32 Damage, uint32 AbsorbDamage, uint32 Resist, VictimState TargetState, uint32 BlockedAmount); - void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage *log); + void SendSpellNonMeleeDamageLog(SpellNonMeleeDamage* log); void SendSpellNonMeleeDamageLog(Unit* target, uint32 SpellID, uint32 Damage, SpellSchoolMask damageSchoolMask, uint32 AbsorbedDamage, uint32 Resist, bool PhysicalDamage, uint32 Blocked, bool CriticalHit = false); - void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo *pInfo); + void SendPeriodicAuraLog(SpellPeriodicAuraLogInfo* pInfo); void SendSpellMiss(Unit* target, uint32 spellID, SpellMissInfo missInfo); void SendSpellDamageResist(Unit* target, uint32 spellId); void SendSpellDamageImmune(Unit* target, uint32 spellId); @@ -1590,7 +1602,7 @@ class Unit : public WorldObject void KnockbackFrom(float x, float y, float speedXY, float speedZ); void JumpTo(float speedXY, float speedZ, bool forward = true); - void JumpTo(WorldObject *obj, float speedZ); + void JumpTo(WorldObject* obj, float speedZ); void SetFacing(float ori, WorldObject* obj = NULL); void SendMonsterStop(bool on_death = false); @@ -1599,7 +1611,7 @@ class Unit : public WorldObject void SendMonsterMove(MonsterMoveData const& moveData, Player* receiver = NULL); void SendMonsterMoveExitVehicle(Position const* newPos); //void SendMonsterMove(float NewPosX, float NewPosY, float NewPosZ, uint8 type, uint32 MovementFlags, uint32 Time, Player* player = NULL); - void SendMonsterMoveTransport(Unit *vehicleOwner); + void SendMonsterMoveTransport(Unit* vehicleOwner); void SendMonsterMoveWithSpeed(float x, float y, float z, uint32 transitTime = 0, Player* player = NULL); void SendMonsterMoveWithSpeedToCurrentDestination(Player* player = NULL); void SendMovementFlagUpdate(); @@ -1614,7 +1626,7 @@ class Unit : public WorldObject void SendClearTarget(); - void BuildHeartBeatMsg(WorldPacket *data) const; + void BuildHeartBeatMsg(WorldPacket* data) const; bool isAlive() const { return (m_deathState == ALIVE); }; bool isDying() const { return (m_deathState == JUST_DIED); }; @@ -1655,12 +1667,13 @@ class Unit : public WorldObject Unit* GetCharmerOrOwner() const { return GetCharmerGUID() ? GetCharmer() : GetOwner(); } Unit* GetCharmerOrOwnerOrSelf() const { - if (Unit *u = GetCharmerOrOwner()) + if (Unit* u = GetCharmerOrOwner()) return u; return (Unit*)this; } Player* GetCharmerOrOwnerPlayerOrPlayerItself() const; + Player* GetAffectingPlayer() const; void SetMinion(Minion *minion, bool apply); void GetAllMinionsByEntry(std::list<Creature*>& Minions, uint32 entry); @@ -1680,7 +1693,7 @@ class Unit : public WorldObject bool isPossessedByPlayer() const { return HasUnitState(UNIT_STAT_POSSESSED) && IS_PLAYER_GUID(GetCharmerGUID()); } bool isPossessing() const { - if (Unit *u = GetCharm()) + if (Unit* u = GetCharm()) return u->isPossessed(); else return false; @@ -1702,20 +1715,20 @@ class Unit : public WorldObject Pet* CreateTamedPetFrom(Creature* creatureTarget, uint32 spell_id = 0); Pet* CreateTamedPetFrom(uint32 creatureEntry, uint32 spell_id = 0); - bool InitTamedPet(Pet * pet, uint8 level, uint32 spell_id); + bool InitTamedPet(Pet* pet, uint8 level, uint32 spell_id); // aura apply/remove helpers - you should better not use these Aura* _TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0); void _AddAura(UnitAura* aura, Unit* caster); - AuraApplication * _CreateAuraApplication(Aura * aura, uint8 effMask); - void _ApplyAuraEffect(Aura * aura, uint8 effIndex); + AuraApplication * _CreateAuraApplication(Aura* aura, uint8 effMask); + void _ApplyAuraEffect(Aura* aura, uint8 effIndex); void _ApplyAura(AuraApplication * aurApp, uint8 effMask); void _UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode); void _UnapplyAura(AuraApplication * aurApp, AuraRemoveMode removeMode); - void _RemoveNoStackAuraApplicationsDueToAura(Aura * aura); - void _RemoveNoStackAurasDueToAura(Aura * aura); - bool _IsNoStackAuraDueToAura(Aura * appliedAura, Aura * existingAura) const; - void _RegisterAuraEffect(AuraEffect * aurEff, bool apply); + void _RemoveNoStackAuraApplicationsDueToAura(Aura* aura); + void _RemoveNoStackAurasDueToAura(Aura* aura); + bool _IsNoStackAuraDueToAura(Aura* appliedAura, Aura* existingAura) const; + void _RegisterAuraEffect(AuraEffect* aurEff, bool apply); // m_ownedAuras container management AuraMap & GetOwnedAuras() { return m_ownedAuras; } @@ -1723,9 +1736,9 @@ class Unit : public WorldObject void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); void RemoveOwnedAura(uint32 spellId, uint64 caster = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); - void RemoveOwnedAura(Aura * aura, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); + void RemoveOwnedAura(Aura* aura, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); - Aura * GetOwnedAura(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, Aura* except = NULL) const; + Aura* GetOwnedAura(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, Aura* except = NULL) const; // m_appliedAuras container management AuraApplicationMap & GetAppliedAuras() { return m_appliedAuras; } @@ -1734,14 +1747,14 @@ class Unit : public WorldObject void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); void RemoveAura(uint32 spellId, uint64 caster = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); void RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); - void RemoveAura(Aura * aur, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); + void RemoveAura(Aura* aur, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT); void RemoveAurasDueToSpell(uint32 spellId, uint64 caster = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); void RemoveAuraFromStack(uint32 spellId, uint64 caster = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); - void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeller, uint8 chargesRemoved = 1); - void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer); + void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit* dispeller, uint8 chargesRemoved = 1); + void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit* stealer); void RemoveAurasDueToItemSpell(Item* castItem, uint32 spellId); - void RemoveAurasByType(AuraType auraType, uint64 casterGUID = 0, Aura * except = NULL, bool negative = true, bool positive = true); + void RemoveAurasByType(AuraType auraType, uint64 casterGUID = 0, Aura* except = NULL, bool negative = true, bool positive = true); void RemoveNotOwnSingleTargetAuras(uint32 newPhase = 0x0); void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except = 0); void RemoveAurasWithAttribute(uint32 flags); @@ -1764,17 +1777,17 @@ class Unit : public WorldObject AuraList & GetSingleCastAuras() { return m_scAuras; } AuraList const& GetSingleCastAuras() const { return m_scAuras; } - AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 casterGUID = 0) const; - AuraEffect * GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, uint64 casterGUID = 0) const; - AuraEffect * GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const; // spell mustn't have familyflags - AuraEffect * GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1 , uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID =0); + AuraEffect* GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 casterGUID = 0) const; + AuraEffect* GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, uint64 casterGUID = 0) const; + AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const; // spell mustn't have familyflags + AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1 , uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID =0); inline AuraEffect* GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const { return GetAuraEffect(SPELL_AURA_DUMMY, name, iconId, effIndex);} AuraApplication * GetAuraApplication(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, AuraApplication * except = NULL) const; - Aura * GetAura(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0) const; + Aura* GetAura(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0) const; AuraApplication * GetAuraApplicationOfRankedSpell(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0, AuraApplication * except = NULL) const; - Aura * GetAuraOfRankedSpell(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0) const; + Aura* GetAuraOfRankedSpell(uint32 spellId, uint64 casterGUID = 0, uint64 itemCasterGUID = 0, uint8 reqEffMask = 0) const; bool HasAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster = 0) const; uint32 GetAuraCount(uint32 spellId) const; @@ -1788,7 +1801,7 @@ class Unit : public WorldObject bool HasNegativeAuraWithAttribute(uint32 flag, uint64 guid = 0); bool HasAuraWithMechanic(uint32 mechanicMask); - AuraEffect * IsScriptOverriden(SpellInfo const* spell, int32 script) const; + AuraEffect* IsScriptOverriden(SpellInfo const* spell, int32 script) const; uint32 GetDiseasesByCaster(uint64 casterGUID, bool remove = false); uint32 GetDoTsByCaster(uint64 casterGUID) const; @@ -1938,17 +1951,17 @@ class Unit : public WorldObject // Threat related methods bool CanHaveThreatList() const; - void AddThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *threatSpell = NULL); + void AddThreat(Unit* pVictim, float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* threatSpell = NULL); float ApplyTotalThreatModifier(float fThreat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL); void DeleteThreatList(); void TauntApply(Unit* pVictim); - void TauntFadeOut(Unit *taunter); + void TauntFadeOut(Unit* taunter); ThreatManager& getThreatManager() { return m_ThreatManager; } void addHatedBy(HostileReference* pHostileReference) { m_HostileRefManager.insertFirst(pHostileReference); }; void removeHatedBy(HostileReference* /*pHostileReference*/) { /* nothing to do yet */ } HostileRefManager& getHostileRefManager() { return m_HostileRefManager; } - VisibleAuraMap const *GetVisibleAuras() { return &m_visibleAuras; } + VisibleAuraMap const* GetVisibleAuras() { return &m_visibleAuras; } AuraApplication * GetVisibleAura(uint8 slot) { VisibleAuraMap::iterator itr = m_visibleAuras.find(slot); @@ -1988,43 +2001,43 @@ class Unit : public WorldObject float GetAPMultiplier(WeaponAttackType attType, bool normalized); void ModifyAuraState(AuraStateType flag, bool apply); uint32 BuildAuraStateUpdateForTarget(Unit* target) const; - bool HasAuraState(AuraStateType flag, SpellInfo const *spellProto = NULL, Unit const* Caster = NULL) const ; + bool HasAuraState(AuraStateType flag, SpellInfo const* spellProto = NULL, Unit const* Caster = NULL) const ; void UnsummonAllTotems(); - Unit* SelectMagnetTarget(Unit* victim, SpellInfo const *spellInfo = NULL); + Unit* SelectMagnetTarget(Unit* victim, SpellInfo const* spellInfo = NULL); int32 SpellBaseDamageBonus(SpellSchoolMask schoolMask); int32 SpellBaseHealingBonus(SpellSchoolMask schoolMask); - int32 SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit *pVictim); - int32 SpellBaseHealingBonusForVictim(SpellSchoolMask schoolMask, Unit *pVictim); - uint32 SpellDamageBonus(Unit *pVictim, SpellInfo const *spellProto, uint32 damage, DamageEffectType damagetype, uint32 stack = 1); - uint32 SpellHealingBonus(Unit *pVictim, SpellInfo const *spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1); - bool isSpellBlocked(Unit *pVictim, SpellInfo const *spellProto, WeaponAttackType attackType = BASE_ATTACK); + int32 SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit* pVictim); + int32 SpellBaseHealingBonusForVictim(SpellSchoolMask schoolMask, Unit* pVictim); + uint32 SpellDamageBonus(Unit* pVictim, SpellInfo const* spellProto, uint32 damage, DamageEffectType damagetype, uint32 stack = 1); + uint32 SpellHealingBonus(Unit* pVictim, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack = 1); + bool isSpellBlocked(Unit* pVictim, SpellInfo const* spellProto, WeaponAttackType attackType = BASE_ATTACK); bool isBlockCritical(); - bool isSpellCrit(Unit *pVictim, SpellInfo const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK) const; - uint32 SpellCriticalDamageBonus(SpellInfo const *spellProto, uint32 damage, Unit *pVictim); - uint32 SpellCriticalHealingBonus(SpellInfo const *spellProto, uint32 damage, Unit *pVictim); + bool isSpellCrit(Unit* pVictim, SpellInfo const* spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType = BASE_ATTACK) const; + uint32 SpellCriticalDamageBonus(SpellInfo const* spellProto, uint32 damage, Unit* pVictim); + uint32 SpellCriticalHealingBonus(SpellInfo const* spellProto, uint32 damage, Unit* pVictim); void SetLastManaUse(uint32 spellCastTime) { m_lastManaUse = spellCastTime; } bool IsUnderLastManaUseEffect() const; - void SetContestedPvP(Player *attackedPlayer = NULL); + void SetContestedPvP(Player* attackedPlayer = NULL); - void MeleeDamageBonus(Unit *pVictim, uint32 *damage, WeaponAttackType attType, SpellInfo const *spellProto = NULL); - uint32 GetCastingTimeForBonus(SpellInfo const *spellProto, DamageEffectType damagetype, uint32 CastingTime); + void MeleeDamageBonus(Unit* pVictim, uint32 *damage, WeaponAttackType attType, SpellInfo const* spellProto = NULL); + uint32 GetCastingTimeForBonus(SpellInfo const* spellProto, DamageEffectType damagetype, uint32 CastingTime); uint32 GetRemainingPeriodicAmount(uint64 caster, uint32 spellId, AuraType auraType, uint8 effectIndex = 0) const; void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply); - void ApplySpellDispelImmunity(const SpellInfo * spellProto, DispelType type, bool apply); + void ApplySpellDispelImmunity(const SpellInfo* spellProto, DispelType type, bool apply); virtual bool IsImmunedToSpell(SpellInfo const* spellInfo); // redefined in Creature bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask); bool IsImmunedToDamage(SpellInfo const* spellInfo); virtual bool IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const; // redefined in Creature - static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const *spellInfo = NULL, uint8 effIndex = MAX_SPELL_EFFECTS); - uint32 CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellInfo const *spellInfo, WeaponAttackType attackType=MAX_ATTACK); - void CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, SpellInfo const *spellInfo = NULL); - void CalcHealAbsorb(Unit *pVictim, const SpellInfo *spellProto, uint32 &healAmount, uint32 &absorb); + static bool IsDamageReducedByArmor(SpellSchoolMask damageSchoolMask, SpellInfo const* spellInfo = NULL, uint8 effIndex = MAX_SPELL_EFFECTS); + uint32 CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellInfo const* spellInfo, WeaponAttackType attackType=MAX_ATTACK); + void CalcAbsorbResist(Unit* pVictim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, SpellInfo const* spellInfo = NULL); + void CalcHealAbsorb(Unit* pVictim, const SpellInfo* spellProto, uint32 &healAmount, uint32 &absorb); void UpdateSpeed(UnitMoveType mtype, bool forced); float GetSpeed(UnitMoveType mtype) const; @@ -2117,16 +2130,16 @@ class Unit : public WorldObject m_misdirectionTargetGUID = guid; } uint32 GetReducedThreatPercent() { return m_reducedThreatPercent; } - Unit *GetMisdirectionTarget() { return m_misdirectionTargetGUID ? GetUnit(*this, m_misdirectionTargetGUID) : NULL; } + Unit* GetMisdirectionTarget() { return m_misdirectionTargetGUID ? GetUnit(*this, m_misdirectionTargetGUID) : NULL; } bool IsAIEnabled, NeedChangeAI; bool CreateVehicleKit(uint32 id, uint32 creatureEntry); void RemoveVehicleKit(); - Vehicle *GetVehicleKit()const { return m_vehicleKit; } - Vehicle *GetVehicle() const { return m_vehicle; } - bool IsOnVehicle(const Unit *vehicle) const { return m_vehicle && m_vehicle == vehicle->GetVehicleKit(); } - Unit *GetVehicleBase() const; - Creature *GetVehicleCreatureBase() const; + Vehicle* GetVehicleKit()const { return m_vehicleKit; } + Vehicle* GetVehicle() const { return m_vehicle; } + bool IsOnVehicle(const Unit* vehicle) const { return m_vehicle && m_vehicle == vehicle->GetVehicleKit(); } + Unit* GetVehicleBase() const; + Creature* GetVehicleCreatureBase() const; float GetTransOffsetX() const { return m_movementInfo.t_pos.GetPositionX(); } float GetTransOffsetY() const { return m_movementInfo.t_pos.GetPositionY(); } float GetTransOffsetZ() const { return m_movementInfo.t_pos.GetPositionZ(); } @@ -2138,7 +2151,7 @@ class Unit : public WorldObject bool m_ControlledByPlayer; bool HandleSpellClick(Unit* clicker, int8 seatId = -1); - void EnterVehicle(Unit *base, int8 seatId = -1); + void EnterVehicle(Unit* base, int8 seatId = -1); void ExitVehicle(Position const* exitPosition = NULL); void ChangeSeat(int8 seatId, bool next = true); @@ -2201,7 +2214,7 @@ class Unit : public WorldObject protected: explicit Unit (); - UnitAI *i_AI, *i_disabledAI; + UnitAI* i_AI, *i_disabledAI; void _UpdateSpells(uint32 time); void _DeleteRemovedAuras(); @@ -2250,7 +2263,7 @@ class Unit : public WorldObject float m_speed_rate[MAX_MOVE_TYPE]; - CharmInfo *m_charmInfo; + CharmInfo* m_charmInfo; SharedVisionList m_sharedVision; virtual SpellSchoolMask GetMeleeDamageSchoolMask() const; @@ -2262,8 +2275,8 @@ class Unit : public WorldObject ThreatManager m_ThreatManager; - Vehicle *m_vehicle; - Vehicle *m_vehicleKit; + Vehicle* m_vehicle; + Vehicle* m_vehicleKit; uint32 m_unitTypeMask; @@ -2274,15 +2287,15 @@ class Unit : public WorldObject bool isAlwaysDetectableFor(WorldObject const* seer) const; private: - bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura * aura, SpellInfo const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *& spellProcEvent); - bool HandleDummyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - bool HandleHasteAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - bool HandleSpellCritChanceAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - bool HandleObsModEnergyAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - bool HandleModDamagePctTakenAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - bool HandleAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, bool * handled); - bool HandleProcTriggerSpell(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); - bool HandleOverrideClassScriptAuraProc(Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const *procSpell, uint32 cooldown); + bool IsTriggeredAtSpellProcEvent(Unit* pVictim, Aura* aura, SpellInfo const* procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const* & spellProcEvent); + bool HandleDummyAuraProc(Unit* pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + bool HandleHasteAuraProc(Unit* pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + bool HandleSpellCritChanceAuraProc(Unit* pVictim, uint32 damage, AuraEffect* triggredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + bool HandleObsModEnergyAuraProc(Unit* pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + bool HandleModDamagePctTakenAuraProc(Unit* pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + bool HandleAuraProc(Unit* pVictim, uint32 damage, Aura* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown, bool * handled); + bool HandleProcTriggerSpell(Unit* pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown); + bool HandleOverrideClassScriptAuraProc(Unit* pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellInfo const* procSpell, uint32 cooldown); bool HandleAuraRaidProcFromChargeWithValue(AuraEffect* triggeredByAura); bool HandleAuraRaidProcFromCharge(AuraEffect* triggeredByAura); @@ -2326,7 +2339,7 @@ namespace Trinity { public: PowerPctOrderPred(Powers power, bool ascending = true) : m_power(power), m_ascending(ascending) {} - bool operator() (const Unit *a, const Unit *b) const + bool operator() (const Unit* a, const Unit* b) const { float rA = a->GetMaxPower(m_power) ? float(a->GetPower(m_power)) / float(a->GetMaxPower(m_power)) : 0.0f; float rB = b->GetMaxPower(m_power) ? float(b->GetPower(m_power)) / float(b->GetMaxPower(m_power)) : 0.0f; @@ -2342,7 +2355,7 @@ namespace Trinity { public: HealthPctOrderPred(bool ascending = true) : m_ascending(ascending) {} - bool operator() (const Unit *a, const Unit *b) const + bool operator() (const Unit* a, const Unit* b) const { float rA = a->GetMaxHealth() ? float(a->GetHealth()) / float(a->GetMaxHealth()) : 0.0f; float rB = b->GetMaxHealth() ? float(b->GetHealth()) / float(b->GetMaxHealth()) : 0.0f; diff --git a/src/server/game/Entities/Vehicle/Vehicle.h b/src/server/game/Entities/Vehicle/Vehicle.h index b706bf91721..aca6a5c6444 100755 --- a/src/server/game/Entities/Vehicle/Vehicle.h +++ b/src/server/game/Entities/Vehicle/Vehicle.h @@ -48,7 +48,7 @@ class Vehicle bool AddPassenger(Unit* passenger, int8 seatId = -1); void EjectPassenger(Unit* passenger, Unit* controller); - void RemovePassenger(Unit *passenger); + void RemovePassenger(Unit* passenger); void RelocatePassengers(float x, float y, float z, float ang); void RemoveAllPassengers(); void Dismiss(); diff --git a/src/server/game/Entities/Vehicle/VehicleDefines.h b/src/server/game/Entities/Vehicle/VehicleDefines.h index f903cf80eea..4d46ce956de 100644 --- a/src/server/game/Entities/Vehicle/VehicleDefines.h +++ b/src/server/game/Entities/Vehicle/VehicleDefines.h @@ -55,8 +55,8 @@ enum VehicleSpells struct VehicleSeat { - explicit VehicleSeat(VehicleSeatEntry const *seatInfo) : SeatInfo(seatInfo), Passenger(0) {} - VehicleSeatEntry const *SeatInfo; + explicit VehicleSeat(VehicleSeatEntry const* seatInfo) : SeatInfo(seatInfo), Passenger(0) {} + VehicleSeatEntry const* SeatInfo; uint64 Passenger; }; diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index 42a849b92cf..84ad326e445 100755 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -216,7 +216,7 @@ void GameEventMgr::LoadFromDB() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint16 event_id = fields[0].GetUInt16(); if (event_id == 0) @@ -279,7 +279,7 @@ void GameEventMgr::LoadFromDB() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint16 event_id = fields[0].GetUInt16(); @@ -324,7 +324,7 @@ void GameEventMgr::LoadFromDB() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint16 event_id = fields[0].GetUInt16(); @@ -377,7 +377,7 @@ void GameEventMgr::LoadFromDB() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); int16 event_id = fields[1].GetInt16(); @@ -420,7 +420,7 @@ void GameEventMgr::LoadFromDB() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); int16 event_id = fields[1].GetInt16(); @@ -463,7 +463,7 @@ void GameEventMgr::LoadFromDB() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); uint16 event_id = fields[1].GetUInt16(); @@ -519,7 +519,7 @@ void GameEventMgr::LoadFromDB() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 id = fields[0].GetUInt32(); uint32 quest = fields[1].GetUInt32(); @@ -560,7 +560,7 @@ void GameEventMgr::LoadFromDB() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 id = fields[0].GetUInt32(); uint32 quest = fields[1].GetUInt32(); @@ -601,7 +601,7 @@ void GameEventMgr::LoadFromDB() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 quest = fields[0].GetUInt32(); uint16 event_id = fields[1].GetUInt16(); @@ -644,7 +644,7 @@ void GameEventMgr::LoadFromDB() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint16 event_id = fields[0].GetUInt16(); uint32 condition = fields[1].GetUInt32(); @@ -686,7 +686,7 @@ void GameEventMgr::LoadFromDB() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint16 event_id = fields[0].GetUInt16(); uint32 condition = fields[1].GetUInt32(); @@ -734,7 +734,7 @@ void GameEventMgr::LoadFromDB() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); uint16 event_id = fields[1].GetUInt16(); @@ -774,7 +774,7 @@ void GameEventMgr::LoadFromDB() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint16 event_id = fields[0].GetUInt16(); @@ -840,7 +840,7 @@ void GameEventMgr::LoadFromDB() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint16 event_id = fields[0].GetUInt16(); @@ -879,7 +879,7 @@ void GameEventMgr::LoadFromDB() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); int16 event_id = fields[1].GetInt16(); @@ -933,7 +933,7 @@ void GameEventMgr::Initialize() QueryResult result = WorldDatabase.Query("SELECT MAX(eventEntry) FROM game_event"); if (result) { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 maxEventId = fields[0].GetUInt16(); @@ -972,7 +972,7 @@ void GameEventMgr::StartArenaSeason() return; } - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint16 eventId = fields[0].GetUInt16(); if (eventId >= mGameEvent.size()) @@ -1121,7 +1121,7 @@ void GameEventMgr::UpdateEventNPCFlags(uint16 event_id) if (cr) { uint32 npcflag = GetNPCFlag(cr); - if (const CreatureTemplate * ci = cr->GetCreatureInfo()) + if (const CreatureTemplate* ci = cr->GetCreatureInfo()) npcflag |= ci->npcflag; cr->SetUInt32Value(UNIT_NPC_FLAGS, npcflag); // reset gossip options, since the flag change might have added / removed some @@ -1337,7 +1337,7 @@ void GameEventMgr::ChangeEquipOrModel(int16 event_id, bool activate) CreatureData const* data2 = sObjectMgr->GetCreatureData(itr->first); if (data2 && activate) { - CreatureTemplate const *cinfo = sObjectMgr->GetCreatureTemplate(data2->id); + CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(data2->id); uint32 displayID = sObjectMgr->ChooseDisplayId(0, cinfo, data2); sObjectMgr->GetCreatureModelRandomGender(&displayID); diff --git a/src/server/game/Globals/ObjectAccessor.h b/src/server/game/Globals/ObjectAccessor.h index 78f98ed9fca..510e702fac9 100755 --- a/src/server/game/Globals/ObjectAccessor.h +++ b/src/server/game/Globals/ObjectAccessor.h @@ -140,7 +140,7 @@ class ObjectAccessor } // returns object if is in map - template<class T> static T* GetObjectInMap(uint64 guid, Map * map, T* /*typeSpecifier*/) + template<class T> static T* GetObjectInMap(uint64 guid, Map* map, T* /*typeSpecifier*/) { ASSERT(map); if (T * obj = GetObjectInWorld(guid, (T*)NULL)) @@ -192,7 +192,7 @@ class ObjectAccessor // these functions return objects if found in whole world // ACCESS LIKE THAT IS NOT THREAD SAFE - static Pet * FindPet(uint64); + static Pet* FindPet(uint64); static Player* FindPlayer(uint64); static Unit* FindUnit(uint64); Player* FindPlayerByName(const char* name); diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 62b2ce0c440..8d0751ef9ab 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -303,7 +303,7 @@ void ObjectMgr::LoadCreatureLocales() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); @@ -339,7 +339,7 @@ void ObjectMgr::LoadGossipMenuItemsLocales() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint16 menuId = fields[0].GetUInt16(); uint16 id = fields[1].GetUInt16(); @@ -371,7 +371,7 @@ void ObjectMgr::LoadPointOfInterestLocales() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); @@ -417,7 +417,7 @@ void ObjectMgr::LoadCreatureTemplates() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); @@ -543,7 +543,7 @@ void ObjectMgr::LoadCreatureTemplateAddons() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); @@ -566,7 +566,7 @@ void ObjectMgr::LoadCreatureTemplateAddons() creatureAddon.auras.resize(tokens.size()); for (Tokens::iterator itr = tokens.begin(); itr != tokens.end(); ++itr) { - SpellInfo const *AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr))); + SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr))); if (!AdditionalSpellInfo) { sLog->outErrorDb("Creature (GUID: %u) has wrong spell %u defined in `auras` field in `creature_addon`.", entry, uint32(atol(*itr))); @@ -911,7 +911,7 @@ void ObjectMgr::LoadCreatureAddons() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); @@ -934,7 +934,7 @@ void ObjectMgr::LoadCreatureAddons() creatureAddon.auras.resize(tokens.size()); for (Tokens::iterator itr = tokens.begin(); itr != tokens.end(); ++itr) { - SpellInfo const *AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr))); + SpellInfo const* AdditionalSpellInfo = sSpellMgr->GetSpellInfo(uint32(atol(*itr))); if (!AdditionalSpellInfo) { sLog->outErrorDb("Creature (GUID: %u) has wrong spell %u defined in `auras` field in `creature_addon`.", guid, uint32(atol(*itr))); @@ -1021,7 +1021,7 @@ void ObjectMgr::LoadEquipmentTemplates() if (!equipmentInfo.ItemEntry[i]) continue; - ItemEntry const *dbcItem = sItemStore.LookupEntry(equipmentInfo.ItemEntry[i]); + ItemEntry const* dbcItem = sItemStore.LookupEntry(equipmentInfo.ItemEntry[i]); if (!dbcItem) { @@ -1064,7 +1064,7 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelInfo(uint32 modelId) return NULL; } -uint32 ObjectMgr::ChooseDisplayId(uint32 /*team*/, const CreatureTemplate *cinfo, const CreatureData *data /*= NULL*/) +uint32 ObjectMgr::ChooseDisplayId(uint32 /*team*/, const CreatureTemplate* cinfo, const CreatureData* data /*= NULL*/) { // Load creature model (display id) uint32 display_id = 0; @@ -1079,7 +1079,7 @@ uint32 ObjectMgr::ChooseDisplayId(uint32 /*team*/, const CreatureTemplate *cinfo return display_id; } -void ObjectMgr::ChooseCreatureFlags(const CreatureTemplate *cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, const CreatureData *data /*= NULL*/) +void ObjectMgr::ChooseCreatureFlags(const CreatureTemplate* cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, const CreatureData* data /*= NULL*/) { npcflag = cinfo->npcflag; unit_flags = cinfo->unit_flags; @@ -1107,7 +1107,7 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32* display // If a model for another gender exists, 50% chance to use it if (minfo->modelid_other_gender != 0 && urand(0, 1) == 0) { - CreatureModelInfo const *minfo_tmp = GetCreatureModelInfo(minfo->modelid_other_gender); + CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(minfo->modelid_other_gender); if (!minfo_tmp) sLog->outErrorDb("Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, minfo->modelid_other_gender); else @@ -1138,7 +1138,7 @@ void ObjectMgr::LoadCreatureModelInfo() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 modelId = fields[0].GetUInt32(); @@ -1195,7 +1195,7 @@ void ObjectMgr::LoadLinkedRespawn() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 guidLow = fields[0].GetUInt32(); uint32 linkedGuidLow = fields[1].GetUInt32(); @@ -1446,7 +1446,7 @@ void ObjectMgr::LoadCreatures() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 guid = fields[ 0].GetUInt32(); uint32 entry = fields[ 1].GetUInt32(); @@ -1629,7 +1629,7 @@ uint32 ObjectMgr::AddGOData(uint32 entry, uint32 mapId, float x, float y, float // We use spawn coords to spawn if (!map->Instanceable() && map->IsLoaded(x, y)) { - GameObject *go = new GameObject; + GameObject* go = new GameObject; if (!go->LoadFromDB(guid, map)) { sLog->outError("AddGOData: cannot add gameobject entry %u to map", entry); @@ -1665,7 +1665,7 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos) // We use spawn coords to spawn if (!map->Instanceable() && map->IsLoaded(data.posX, data.posY)) { - Creature *creature = new Creature; + Creature* creature = new Creature; if (!creature->LoadFromDB(guid, map)) { sLog->outError("AddCreature: cannot add creature entry %u to map", guid); @@ -1680,7 +1680,7 @@ bool ObjectMgr::MoveCreData(uint32 guid, uint32 mapId, Position pos) uint32 ObjectMgr::AddCreData(uint32 entry, uint32 /*team*/, uint32 mapId, float x, float y, float z, float o, uint32 spawntimedelay) { - CreatureTemplate const *cInfo = GetCreatureTemplate(entry); + CreatureTemplate const* cInfo = GetCreatureTemplate(entry); if (!cInfo) return 0; @@ -1762,7 +1762,7 @@ void ObjectMgr::LoadGameobjects() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 guid = fields[ 0].GetUInt32(); uint32 entry = fields[ 1].GetUInt32(); @@ -1921,7 +1921,7 @@ void ObjectMgr::LoadCreatureRespawnTimes() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 loguid = fields[0].GetUInt32(); uint32 respawn_time = fields[1].GetUInt32(); @@ -1955,7 +1955,7 @@ void ObjectMgr::LoadGameobjectRespawnTimes() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 loguid = fields[0].GetUInt32(); uint32 respawn_time = fields[1].GetUInt32(); @@ -2073,7 +2073,7 @@ void ObjectMgr::LoadItemLocales() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); @@ -2140,7 +2140,7 @@ void ObjectMgr::LoadItemTemplates() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); @@ -2253,7 +2253,7 @@ void ObjectMgr::LoadItemTemplates() // Checks - ItemEntry const *dbcitem = sItemStore.LookupEntry(entry); + ItemEntry const* dbcitem = sItemStore.LookupEntry(entry); if (dbcitem) { @@ -2486,7 +2486,7 @@ void ObjectMgr::LoadItemTemplates() else if (itemTemplate.Spells[1].SpellId != -1) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[1].SpellId); - if (!spellInfo && !sDisableMgr->IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[1].SpellId, NULL)) + if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[1].SpellId, NULL)) { sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, 1+1, itemTemplate.Spells[1].SpellId); itemTemplate.Spells[0].SpellId = 0; @@ -2534,7 +2534,7 @@ void ObjectMgr::LoadItemTemplates() if (itemTemplate.Spells[j].SpellId && itemTemplate.Spells[j].SpellId != -1) { SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itemTemplate.Spells[j].SpellId); - if (!spellInfo && !sDisableMgr->IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[j].SpellId, NULL)) + if (!spellInfo && !DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, itemTemplate.Spells[j].SpellId, NULL)) { sLog->outErrorDb("Item (Entry: %u) has wrong (not existing) spell in spellid_%d (%d)", entry, j+1, itemTemplate.Spells[j].SpellId); itemTemplate.Spells[j].SpellId = 0; @@ -2710,7 +2710,7 @@ void ObjectMgr::LoadItemSetNameLocales() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); @@ -2757,7 +2757,7 @@ void ObjectMgr::LoadItemSetNames() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); if (itemSetItems.find(entry) == itemSetItems.end()) @@ -2825,7 +2825,7 @@ void ObjectMgr::LoadVehicleTemplateAccessories() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 uiEntry = fields[0].GetUInt32(); uint32 uiAccessory = fields[1].GetUInt32(); @@ -2881,7 +2881,7 @@ void ObjectMgr::LoadVehicleAccessories() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 uiGUID = fields[0].GetUInt32(); uint32 uiAccessory = fields[1].GetUInt32(); @@ -3740,7 +3740,7 @@ void ObjectMgr::LoadQuests() // for example set of race quests can lead to single not race specific quest do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); Quest * newQuest = new Quest(fields); mQuestTemplates[newQuest->GetQuestId()] = newQuest; @@ -3752,7 +3752,7 @@ void ObjectMgr::LoadQuests() for (QuestMap::iterator iter = mQuestTemplates.begin(); iter != mQuestTemplates.end(); ++iter) { // skip post-loading checks for disabled quests - if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_QUEST, iter->first, NULL)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_QUEST, iter->first, NULL)) continue; Quest * qinfo = iter->second; @@ -4336,12 +4336,14 @@ void ObjectMgr::LoadQuests() mExclusiveQuestGroups.insert(std::pair<int32, uint32>(qinfo->ExclusiveGroup, qinfo->GetQuestId())); if (qinfo->LimitTime) qinfo->SetFlag(QUEST_TRINITY_FLAGS_TIMED); + if (qinfo->PlayersSlain) + qinfo->SetFlag(QUEST_TRINITY_FLAGS_PLAYER_KILL); } // check QUEST_TRINITY_FLAGS_EXPLORATION_OR_EVENT for spell with SPELL_EFFECT_QUEST_COMPLETE for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i) { - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(i); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(i); if (!spellInfo) continue; @@ -4394,7 +4396,7 @@ void ObjectMgr::LoadQuestLocales() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); @@ -4425,7 +4427,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) { uint32 oldMSTime = getMSTime(); - ScriptMapMap *scripts = GetScriptsMapByType(type); + ScriptMapMap* scripts = GetScriptsMapByType(type); if (!scripts) return; @@ -4457,7 +4459,7 @@ void ObjectMgr::LoadScripts(ScriptsType type) do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); ScriptInfo tmp; tmp.type = type; tmp.id = fields[0].GetUInt32(); @@ -4861,7 +4863,7 @@ void ObjectMgr::LoadWaypointScripts() { do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 action = fields[0].GetUInt32(); actionSet.erase(action); @@ -4893,7 +4895,7 @@ void ObjectMgr::LoadSpellScriptNames() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); int32 spellId = fields[0].GetInt32(); const char *scriptName = fields[1].GetCString(); @@ -4957,8 +4959,8 @@ void ObjectMgr::ValidateSpellScripts() for (std::vector<std::pair<SpellScriptLoader *, SpellScriptsMap::iterator> >::iterator sitr = SpellScriptLoaders.begin(); sitr != SpellScriptLoaders.end(); ++sitr) { - SpellScript * spellScript = sitr->first->GetSpellScript(); - AuraScript * auraScript = sitr->first->GetAuraScript(); + SpellScript* spellScript = sitr->first->GetSpellScript(); + AuraScript* auraScript = sitr->first->GetAuraScript(); bool valid = true; if (!spellScript && !auraScript) { @@ -5057,7 +5059,7 @@ void ObjectMgr::LoadPageTextLocales() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); @@ -5202,7 +5204,7 @@ void ObjectMgr::LoadInstanceEncounters() sLog->outString(); } -GossipText const *ObjectMgr::GetGossipText(uint32 Text_ID) const +GossipText const* ObjectMgr::GetGossipText(uint32 Text_ID) const { GossipTextMap::const_iterator itr = mGossipText.find(Text_ID); if (itr != mGossipText.end()) @@ -5232,7 +5234,7 @@ void ObjectMgr::LoadGossipText() ++count; cic = 0; - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 Text_ID = fields[cic++].GetUInt32(); if (!Text_ID) @@ -5285,7 +5287,7 @@ void ObjectMgr::LoadNpcTextLocales() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); @@ -5354,8 +5356,8 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) do { - Field *fields = result->Fetch(); - Mail *m = new Mail; + Field* fields = result->Fetch(); + Mail* m = new Mail; m->messageID = fields[0].GetUInt32(); m->messageType = fields[1].GetUInt8(); m->sender = fields[2].GetUInt32(); @@ -5367,7 +5369,7 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp) m->checked = fields[7].GetUInt32(); m->mailTemplateId = fields[8].GetInt16(); - Player *pl = NULL; + Player* pl = NULL; if (serverUp) pl = ObjectAccessor::FindPlayer((uint64)m->receiver); @@ -5458,7 +5460,7 @@ void ObjectMgr::LoadQuestAreaTriggers() { ++count; - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 trigger_ID = fields[0].GetUInt32(); uint32 quest_ID = fields[1].GetUInt32(); @@ -5517,7 +5519,7 @@ void ObjectMgr::LoadTavernAreaTriggers() { ++count; - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 Trigger_ID = fields[0].GetUInt32(); @@ -5555,7 +5557,7 @@ void ObjectMgr::LoadAreaTriggerScripts() { ++count; - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 Trigger_ID = fields[0].GetUInt32(); const char *scriptName = fields[1].GetCString(); @@ -5659,7 +5661,7 @@ uint32 ObjectMgr::GetTaxiMountDisplayId(uint32 id, uint32 team, bool allowed_alt mount_entry = team == ALLIANCE ? node->MountCreatureID[0] : node->MountCreatureID[1]; } - CreatureTemplate const *mount_info = GetCreatureTemplate(mount_entry); + CreatureTemplate const* mount_info = GetCreatureTemplate(mount_entry); if (mount_info) { mount_id = mount_info->GetRandomValidModelId(); @@ -5698,7 +5700,7 @@ void ObjectMgr::LoadGraveyardZones() { ++count; - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 safeLocId = fields[0].GetUInt32(); uint32 zoneId = fields[1].GetUInt32(); @@ -5711,7 +5713,7 @@ void ObjectMgr::LoadGraveyardZones() continue; } - AreaTableEntry const *areaEntry = GetAreaEntryByAreaID(zoneId); + AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(zoneId); if (!areaEntry) { sLog->outErrorDb("Table `game_graveyard_zone` has a record for not existing zone id (%u), skipped.", zoneId); @@ -5738,7 +5740,7 @@ void ObjectMgr::LoadGraveyardZones() sLog->outString(); } -WorldSafeLocsEntry const *ObjectMgr::GetDefaultGraveYard(uint32 team) +WorldSafeLocsEntry const* ObjectMgr::GetDefaultGraveYard(uint32 team) { enum DefaultGraveyard { @@ -5753,7 +5755,7 @@ WorldSafeLocsEntry const *ObjectMgr::GetDefaultGraveYard(uint32 team) else return NULL; } -WorldSafeLocsEntry const *ObjectMgr::GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team) +WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team) { // search for zone associated closest graveyard uint32 zoneId = sMapMgr->GetZoneId(MapId, x, y, z); @@ -5980,7 +5982,7 @@ void ObjectMgr::LoadAreaTriggerTeleports() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); ++count; @@ -6041,7 +6043,7 @@ void ObjectMgr::LoadAccessRequirements() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); ++count; @@ -6062,7 +6064,7 @@ void ObjectMgr::LoadAccessRequirements() if (ar.item) { - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(ar.item); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(ar.item); if (!pProto) { sLog->outError("Key item %u does not exist for map %u difficulty %u, removing key requirement.", ar.item, mapid, difficulty); @@ -6072,7 +6074,7 @@ void ObjectMgr::LoadAccessRequirements() if (ar.item2) { - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(ar.item2); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(ar.item2); if (!pProto) { sLog->outError("Second item %u does not exist for map %u difficulty %u, removing key requirement.", ar.item2, mapid, difficulty); @@ -6121,13 +6123,13 @@ AreaTrigger const* ObjectMgr::GetGoBackTrigger(uint32 Map) const { bool useParentDbValue = false; uint32 parentId = 0; - const MapEntry *mapEntry = sMapStore.LookupEntry(Map); + const MapEntry* mapEntry = sMapStore.LookupEntry(Map); if (!mapEntry || mapEntry->entrance_map < 0) return NULL; if (mapEntry->IsDungeon()) { - const InstanceTemplate *iTemplate = sObjectMgr->GetInstanceTemplate(Map); + const InstanceTemplate* iTemplate = sObjectMgr->GetInstanceTemplate(Map); if (!iTemplate) return NULL; @@ -6221,8 +6223,6 @@ void ObjectMgr::SetHighestGuids() sGroupMgr->SetGroupDbStoreSize((*result)[0].GetUInt32()+1); } - - uint32 ObjectMgr::GenerateAuctionID() { if (m_auctionid >= 0xFFFFFFFE) @@ -6344,7 +6344,7 @@ void ObjectMgr::LoadGameObjectLocales() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); @@ -6442,7 +6442,7 @@ void ObjectMgr::LoadGameObjectTemplate() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); @@ -6629,7 +6629,7 @@ void ObjectMgr::LoadExplorationBaseXP() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint8 level = fields[0].GetUInt8(); uint32 basexp = fields[1].GetUInt32(); mBaseXPTable[level] = basexp; @@ -6671,7 +6671,7 @@ void ObjectMgr::LoadPetNames() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); std::string word = fields[0].GetString(); uint32 entry = fields[1].GetUInt32(); bool half = fields[2].GetBool(); @@ -6694,7 +6694,7 @@ void ObjectMgr::LoadPetNumber() QueryResult result = CharacterDatabase.Query("SELECT MAX(id) FROM character_pet"); if (result) { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); m_hiPetNumber = fields[0].GetUInt32()+1; } @@ -6709,7 +6709,7 @@ std::string ObjectMgr::GeneratePetName(uint32 entry) if (list0.empty() || list1.empty()) { - CreatureTemplate const *cinfo = GetCreatureTemplate(entry); + CreatureTemplate const* cinfo = GetCreatureTemplate(entry); char* petname = GetPetName(cinfo->family, sWorld->GetDefaultDbcLocale()); if (!petname) return cinfo->Name; @@ -6740,10 +6740,10 @@ void ObjectMgr::LoadCorpses() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 guid = fields[16].GetUInt32(); - Corpse *corpse = new Corpse(); + Corpse* corpse = new Corpse(); if (!corpse->LoadFromDB(guid, fields)) { delete corpse; @@ -6778,7 +6778,7 @@ void ObjectMgr::LoadReputationRewardRate() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 factionId = fields[0].GetUInt32(); @@ -6788,7 +6788,7 @@ void ObjectMgr::LoadReputationRewardRate() repRate.creature_rate = fields[2].GetFloat(); repRate.spell_rate = fields[3].GetFloat(); - FactionEntry const *factionEntry = sFactionStore.LookupEntry(factionId); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); if (!factionEntry) { sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_reward_rate`", factionId); @@ -6847,7 +6847,7 @@ void ObjectMgr::LoadReputationOnKill() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 creature_id = fields[0].GetUInt32(); @@ -6870,7 +6870,7 @@ void ObjectMgr::LoadReputationOnKill() if (repOnKill.repfaction1) { - FactionEntry const *factionEntry1 = sFactionStore.LookupEntry(repOnKill.repfaction1); + FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repOnKill.repfaction1); if (!factionEntry1) { sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.repfaction1); @@ -6880,7 +6880,7 @@ void ObjectMgr::LoadReputationOnKill() if (repOnKill.repfaction2) { - FactionEntry const *factionEntry2 = sFactionStore.LookupEntry(repOnKill.repfaction2); + FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repOnKill.repfaction2); if (!factionEntry2) { sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `creature_onkill_reputation`", repOnKill.repfaction2); @@ -6916,7 +6916,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 factionId = fields[0].GetUInt32(); @@ -6935,7 +6935,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate() repTemplate.faction_rate[3] = fields[11].GetFloat(); repTemplate.faction_rank[3] = fields[12].GetUInt32(); - FactionEntry const *factionEntry = sFactionStore.LookupEntry(factionId); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); if (!factionEntry) { @@ -6953,7 +6953,7 @@ void ObjectMgr::LoadReputationSpilloverTemplate() { if (repTemplate.faction[i]) { - FactionEntry const *factionSpillover = sFactionStore.LookupEntry(repTemplate.faction[i]); + FactionEntry const* factionSpillover = sFactionStore.LookupEntry(repTemplate.faction[i]); if (!factionSpillover) { @@ -6975,25 +6975,25 @@ void ObjectMgr::LoadReputationSpilloverTemplate() } } - FactionEntry const *factionEntry0 = sFactionStore.LookupEntry(repTemplate.faction[0]); + FactionEntry const* factionEntry0 = sFactionStore.LookupEntry(repTemplate.faction[0]); if (repTemplate.faction[0] && !factionEntry0) { sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[0]); continue; } - FactionEntry const *factionEntry1 = sFactionStore.LookupEntry(repTemplate.faction[1]); + FactionEntry const* factionEntry1 = sFactionStore.LookupEntry(repTemplate.faction[1]); if (repTemplate.faction[1] && !factionEntry1) { sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[1]); continue; } - FactionEntry const *factionEntry2 = sFactionStore.LookupEntry(repTemplate.faction[2]); + FactionEntry const* factionEntry2 = sFactionStore.LookupEntry(repTemplate.faction[2]); if (repTemplate.faction[2] && !factionEntry2) { sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[2]); continue; } - FactionEntry const *factionEntry3 = sFactionStore.LookupEntry(repTemplate.faction[3]); + FactionEntry const* factionEntry3 = sFactionStore.LookupEntry(repTemplate.faction[3]); if (repTemplate.faction[3] && !factionEntry3) { sLog->outErrorDb("Faction (faction.dbc) %u does not exist but is used in `reputation_spillover_template`", repTemplate.faction[3]); @@ -7030,7 +7030,7 @@ void ObjectMgr::LoadPointsOfInterest() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 point_id = fields[0].GetUInt32(); @@ -7083,14 +7083,14 @@ void ObjectMgr::LoadQuestPOI() if (points) { // The first result should have the highest questId - Field *fields = points->Fetch(); + Field* fields = points->Fetch(); uint32 questId = fields[0].GetUInt32(); POIs.resize(questId + 1); do { - Field *fields = points->Fetch(); + Field* fields = points->Fetch(); uint32 questId = fields[0].GetUInt32(); uint32 id = fields[1].GetUInt32(); @@ -7107,7 +7107,7 @@ void ObjectMgr::LoadQuestPOI() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 questId = fields[0].GetUInt32(); uint32 id = fields[1].GetUInt32(); @@ -7149,7 +7149,7 @@ void ObjectMgr::LoadNPCSpellClickSpells() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 npc_entry = fields[0].GetUInt32(); CreatureTemplate const* cInfo = GetCreatureTemplate(npc_entry); @@ -7160,7 +7160,7 @@ void ObjectMgr::LoadNPCSpellClickSpells() } uint32 spellid = fields[1].GetUInt32(); - SpellInfo const *spellinfo = sSpellMgr->GetSpellInfo(spellid); + SpellInfo const* spellinfo = sSpellMgr->GetSpellInfo(spellid); if (!spellinfo) { sLog->outErrorDb("Table npc_spellclick_spells references unknown spellid %u. Skipping entry.", spellid); @@ -7170,7 +7170,7 @@ void ObjectMgr::LoadNPCSpellClickSpells() uint32 auraRequired = fields[6].GetUInt32(); if (auraRequired) { - SpellInfo const *aurReqInfo = sSpellMgr->GetSpellInfo(auraRequired); + SpellInfo const* aurReqInfo = sSpellMgr->GetSpellInfo(auraRequired); if (!aurReqInfo) { sLog->outErrorDb("Table npc_spellclick_spells references unknown aura required %u. Skipping entry.", auraRequired); @@ -7181,7 +7181,7 @@ void ObjectMgr::LoadNPCSpellClickSpells() uint32 auraForbidden = fields[7].GetUInt32(); if (auraForbidden) { - SpellInfo const *aurForInfo = sSpellMgr->GetSpellInfo(auraForbidden); + SpellInfo const* aurForInfo = sSpellMgr->GetSpellInfo(auraForbidden); if (!aurForInfo) { sLog->outErrorDb("Table npc_spellclick_spells references unknown aura forbidden %u. Skipping entry.", auraForbidden); @@ -7798,7 +7798,7 @@ bool ObjectMgr::LoadTrinityStrings(char const* table, int32 min_value, int32 max do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); int32 entry = fields[0].GetInt32(); @@ -7839,7 +7839,7 @@ bool ObjectMgr::LoadTrinityStrings(char const* table, int32 min_value, int32 max const char *ObjectMgr::GetTrinityString(int32 entry, LocaleConstant locale_idx) const { - if (TrinityStringLocale const *msl = GetTrinityStringLocale(entry)) + if (TrinityStringLocale const* msl = GetTrinityStringLocale(entry)) { if (msl->Content.size() > size_t(locale_idx) && !msl->Content[locale_idx].empty()) return msl->Content[locale_idx].c_str(); @@ -7874,7 +7874,7 @@ void ObjectMgr::LoadFishingBaseSkillLevel() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); int32 skill = fields[1].GetInt32(); @@ -7931,7 +7931,7 @@ SpellScriptsBounds ObjectMgr::GetSpellScriptsBounds(uint32 spell_id) return SpellScriptsBounds(mSpellScripts.lower_bound(spell_id), mSpellScripts.upper_bound(spell_id)); } -SkillRangeType GetSkillRangeType(SkillLineEntry const *pSkill, bool racial) +SkillRangeType GetSkillRangeType(SkillLineEntry const* pSkill, bool racial) { switch(pSkill->categoryId) { @@ -7983,7 +7983,7 @@ void ObjectMgr::LoadGameTele() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 id = fields[0].GetUInt32(); @@ -8109,7 +8109,7 @@ void ObjectMgr::LoadMailLevelRewards() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint8 level = fields[0].GetUInt8(); uint32 raceMask = fields[1].GetUInt32(); @@ -8168,7 +8168,7 @@ void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, return; } - SpellInfo const *spellinfo = sSpellMgr->GetSpellInfo(spell); + SpellInfo const* spellinfo = sSpellMgr->GetSpellInfo(spell); if (!spellinfo) { sLog->outErrorDb("Table `npc_trainer` contains an entry (Entry: %u) for a non-existing spell (Spell: %u), ignoring", entry, spell); @@ -8641,7 +8641,7 @@ uint32 ObjectMgr::GetScriptId(const char *name) void ObjectMgr::CheckScripts(ScriptsType type, std::set<int32>& ids) { - ScriptMapMap *scripts = GetScriptsMapByType(type); + ScriptMapMap* scripts = GetScriptsMapByType(type); if (!scripts) return; for (ScriptMapMap::const_iterator itrMM = scripts->begin(); itrMM != scripts->end(); ++itrMM) @@ -8732,7 +8732,7 @@ void ObjectMgr::LoadCreatureClassLevelStats() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint8 Level = fields[0].GetUInt8(); uint8 Class = fields[1].GetUInt8(); @@ -8794,7 +8794,7 @@ void ObjectMgr::LoadFactionChangeAchievements() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 alliance = fields[0].GetUInt32(); uint32 horde = fields[1].GetUInt32(); @@ -8831,7 +8831,7 @@ void ObjectMgr::LoadFactionChangeItems() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 alliance = fields[0].GetUInt32(); uint32 horde = fields[1].GetUInt32(); @@ -8868,7 +8868,7 @@ void ObjectMgr::LoadFactionChangeSpells() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 alliance = fields[0].GetUInt32(); uint32 horde = fields[1].GetUInt32(); @@ -8905,7 +8905,7 @@ void ObjectMgr::LoadFactionChangeReputations() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 alliance = fields[0].GetUInt32(); uint32 horde = fields[1].GetUInt32(); diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 3190bc7af2c..95382b751f3 100755 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -547,7 +547,7 @@ enum SkillRangeType SKILL_RANGE_NONE, // 0..0 always }; -SkillRangeType GetSkillRangeType(SkillLineEntry const *pSkill, bool racial); +SkillRangeType GetSkillRangeType(SkillLineEntry const* pSkill, bool racial); #define MAX_PLAYER_NAME 12 // max allowed by client name length #define MAX_INTERNAL_PLAYER_NAME 15 // max server internal player name length (> MAX_PLAYER_NAME for support declined names) @@ -625,17 +625,17 @@ class ObjectMgr int LoadReferenceVendor(int32 vendor, int32 item_id, std::set<uint32> *skip_vendors); void LoadGameObjectTemplate(); - void AddGameobjectInfo(GameObjectTemplate *goinfo); + void AddGameobjectInfo(GameObjectTemplate* goinfo); CreatureTemplate const* GetCreatureTemplate(uint32 entry); CreatureTemplateContainer const* GetCreatureTemplates() { return &CreatureTemplateStore; } CreatureModelInfo const* GetCreatureModelInfo(uint32 modelId); CreatureModelInfo const* GetCreatureModelRandomGender(uint32* displayID); - static uint32 ChooseDisplayId(uint32 team, const CreatureTemplate *cinfo, const CreatureData *data = NULL); - static void ChooseCreatureFlags(const CreatureTemplate *cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, const CreatureData *data = NULL); - EquipmentInfo const *GetEquipmentInfo(uint32 entry); - CreatureAddon const *GetCreatureAddon(uint32 lowguid); - CreatureAddon const *GetCreatureTemplateAddon(uint32 entry); + static uint32 ChooseDisplayId(uint32 team, const CreatureTemplate* cinfo, const CreatureData* data = NULL); + static void ChooseCreatureFlags(const CreatureTemplate* cinfo, uint32& npcflag, uint32& unit_flags, uint32& dynamicflags, const CreatureData* data = NULL); + EquipmentInfo const* GetEquipmentInfo(uint32 entry); + CreatureAddon const* GetCreatureAddon(uint32 lowguid); + CreatureAddon const* GetCreatureTemplateAddon(uint32 entry); ItemTemplate const* GetItemTemplate(uint32 entry); ItemTemplateContainer const* GetItemTemplateStore() { return &ItemTemplateStore; } @@ -708,8 +708,8 @@ class ObjectMgr GossipText const* GetGossipText(uint32 Text_ID) const; - WorldSafeLocsEntry const *GetDefaultGraveYard(uint32 team); - WorldSafeLocsEntry const *GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team); + WorldSafeLocsEntry const* GetDefaultGraveYard(uint32 team); + WorldSafeLocsEntry const* GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team); bool AddGraveYardLink(uint32 id, uint32 zone, uint32 team, bool inDB = true); void RemoveGraveYardLink(uint32 id, uint32 zone, uint32 team, bool inDB = false); void LoadGraveyardZones(); diff --git a/src/server/game/Grids/GridReference.h b/src/server/game/Grids/GridReference.h index e3c4a6b0f54..601542daa0d 100755 --- a/src/server/game/Grids/GridReference.h +++ b/src/server/game/Grids/GridReference.h @@ -47,7 +47,7 @@ class GridReference : public Reference<GridRefManager<OBJECT>, OBJECT> public: GridReference() : Reference<GridRefManager<OBJECT>, OBJECT>() {} ~GridReference() { this->unlink(); } - GridReference *next() { return (GridReference*)Reference<GridRefManager<OBJECT>, OBJECT>::next(); } + GridReference* next() { return (GridReference*)Reference<GridRefManager<OBJECT>, OBJECT>::next(); } }; #endif diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp index 6ae6d4ed43b..dc938859e92 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp +++ b/src/server/game/Grids/Notifiers/GridNotifiers.cpp @@ -207,7 +207,7 @@ void DelayedUnitRelocation::Visit(PlayerMapType &m) for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { Player* player = iter->getSource(); - WorldObject const *viewPoint = player->m_seer; + WorldObject const* viewPoint = player->m_seer; if (!viewPoint->isNeedNotify(NOTIFY_VISIBILITY_CHANGED)) continue; @@ -234,7 +234,7 @@ void AIRelocationNotifier::Visit(CreatureMapType &m) { for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { - Creature *c = iter->getSource(); + Creature* c = iter->getSource(); CreatureUnitRelocationWorker(c, &i_unit); if (isCreature) CreatureUnitRelocationWorker((Creature*)&i_unit, c); @@ -246,7 +246,7 @@ MessageDistDeliverer::Visit(PlayerMapType &m) { for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { - Player *target = iter->getSource(); + Player* target = iter->getSource(); if (!target->InSamePhase(i_phaseMask)) continue; @@ -293,7 +293,7 @@ void MessageDistDeliverer::Visit(DynamicObjectMapType &m) { for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { - DynamicObject *target = iter->getSource(); + DynamicObject* target = iter->getSource(); if (!target->InSamePhase(i_phaseMask)) continue; diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.h b/src/server/game/Grids/Notifiers/GridNotifiers.h index 32ef215a5ee..2ed74279224 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.h +++ b/src/server/game/Grids/Notifiers/GridNotifiers.h @@ -120,13 +120,13 @@ namespace Trinity struct MessageDistDeliverer { - WorldObject *i_source; - WorldPacket *i_message; + WorldObject* i_source; + WorldPacket* i_message; uint32 i_phaseMask; float i_distSq; uint32 team; Player const* skipped_receiver; - MessageDistDeliverer(WorldObject *src, WorldPacket *msg, float dist, bool own_team_only = false, Player const* skipped = NULL) + MessageDistDeliverer(WorldObject* src, WorldPacket* msg, float dist, bool own_team_only = false, Player const* skipped = NULL) : i_source(src), i_message(msg), i_phaseMask(src->GetPhaseMask()), i_distSq(dist * dist) , team((own_team_only && src->GetTypeId() == TYPEID_PLAYER) ? ((Player*)src)->GetTeam() : 0) , skipped_receiver(skipped) @@ -297,6 +297,26 @@ namespace Trinity template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {} }; + template<class Functor> + struct GameObjectWorker + { + GameObjectWorker(WorldObject const* searcher, Functor& func) + : _func(func), _phaseMask(searcher->GetPhaseMask()) {} + + void Visit(GameObjectMapType& m) + { + for (GameObjectMapType::iterator itr = m.begin(); itr != m.end(); ++itr) + if (itr->getSource()->InSamePhase(_phaseMask)) + _func(itr->getSource()); + } + + template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {} + + private: + Functor& _func; + uint32 _phaseMask; + }; + // Unit searchers // First accepted by Check Unit if any @@ -570,7 +590,7 @@ namespace Trinity class AnyDeadUnitSpellTargetInRangeCheck : public AnyDeadUnitObjectInRangeCheck { public: - AnyDeadUnitSpellTargetInRangeCheck(Unit const* searchObj, float range, SpellInfo const* spellInfo, SpellTargetSelectionCheckTypes check) + AnyDeadUnitSpellTargetInRangeCheck(Unit const* searchObj, float range, SpellInfo const* spellInfo, SpellTargetSelectionCheckTypes check) : AnyDeadUnitObjectInRangeCheck(searchObj, range), i_spellInfo(spellInfo), i_check(check) {} bool operator()(Player* u); bool operator()(Corpse* u); @@ -807,7 +827,7 @@ namespace Trinity return u->isAlive() && i_funit->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u) - && i_funit->canAttack(u) + && i_funit->IsValidAttackTarget(u) && u->GetCreatureType() != CREATURE_TYPE_CRITTER && i_funit->canSeeOrDetect(u); } @@ -902,12 +922,10 @@ namespace Trinity bool operator()(Unit* u) { // Check contains checks for: live, non-selectable, non-attackable flags, flight check and GM check, ignore totems - if (!u->isTargetableForAttack()) - return false; if (u->GetTypeId() == TYPEID_UNIT && ((Creature*)u)->isTotem()) return false; - if ((i_targetForPlayer ? !i_funit->IsFriendlyTo(u) : i_funit->IsHostileTo(u))&& i_obj->IsWithinDistInMap(u, i_range)) + if (i_funit->IsValidAttackTarget(u) && i_obj->IsWithinDistInMap(u, i_range)) return true; return false; @@ -977,7 +995,7 @@ namespace Trinity if (!me->IsWithinDistInMap(u, m_range)) return false; - if (!me->canAttack(u)) + if (!me->IsValidAttackTarget(u)) return false; m_range = me->GetDistance(u); // use found unit range as new range limit for next check @@ -985,7 +1003,7 @@ namespace Trinity } private: - Creature const *me; + Creature const* me; float m_range; NearestHostileUnitCheck(NearestHostileUnitCheck const&); }; @@ -1008,7 +1026,7 @@ namespace Trinity if (m_force) { - if (!me->canAttack(u)) + if (!me->IsValidAttackTarget(u)) return false; } else @@ -1022,7 +1040,7 @@ namespace Trinity } float GetLastRange() const { return m_range; } private: - Creature const *me; + Creature const* me; float m_range; bool m_force; NearestHostileUnitInAttackDistanceCheck(NearestHostileUnitInAttackDistanceCheck const&); diff --git a/src/server/game/Grids/ObjectGridLoader.cpp b/src/server/game/Grids/ObjectGridLoader.cpp index fade98b3ea8..58521b76bff 100755 --- a/src/server/game/Grids/ObjectGridLoader.cpp +++ b/src/server/game/Grids/ObjectGridLoader.cpp @@ -98,7 +98,7 @@ template<class T> void AddUnitState(T* /*obj*/, CellPair const& /*cell_pair*/) { } -template<> void AddUnitState(Creature *obj, CellPair const& cell_pair) +template<> void AddUnitState(Creature* obj, CellPair const& cell_pair) { Cell cell(cell_pair); @@ -147,7 +147,7 @@ void LoadHelper(CellCorpseSet const& cell_corpses, CellPair &cell, CorpseMapType uint32 player_guid = itr->first; - Corpse *obj = sObjectAccessor->GetCorpseForPlayerGUID(player_guid); + Corpse* obj = sObjectAccessor->GetCorpseForPlayerGUID(player_guid); if (!obj) continue; diff --git a/src/server/game/Groups/Group.cpp b/src/server/game/Groups/Group.cpp index b9e00bc7231..df9ed7a4145 100755 --- a/src/server/game/Groups/Group.cpp +++ b/src/server/game/Groups/Group.cpp @@ -45,7 +45,7 @@ Roll::~Roll() { } -void Roll::setLoot(Loot *pLoot) +void Roll::setLoot(Loot* pLoot) { link(pLoot, this); } @@ -93,7 +93,7 @@ Group::~Group() delete[] m_subGroupsCounts; } -bool Group::Create(Player *leader) +bool Group::Create(Player* leader) { uint64 leaderGuid = leader->GetGUID(); uint32 lowguid = sGroupMgr->GenerateGroupId(); @@ -140,7 +140,7 @@ bool Group::Create(Player *leader) return true; } -void Group::LoadGroupFromDB(Field *fields) +void Group::LoadGroupFromDB(Field* fields) { m_dbStoreId = fields[15].GetUInt32(); m_guid = MAKE_NEW_GUID(sGroupMgr->GenerateGroupId(), 0, HIGHGUID_GROUP); @@ -331,7 +331,7 @@ bool Group::AddMember(Player* player) player->SetGroup(this, subGroup); // if the same group invites the player back, cancel the homebind timer - InstanceGroupBind *bind = GetBoundInstance(player); + InstanceGroupBind* bind = GetBoundInstance(player); if (bind && bind->save->GetInstanceId() == player->GetInstanceId()) player->m_InstanceValid = true; } @@ -643,7 +643,7 @@ void Group::SendLootStartRoll(uint32 CountDown, uint32 mapid, const Roll &r) for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr) { - Player *p = ObjectAccessor::FindPlayer(itr->first); + Player* p = ObjectAccessor::FindPlayer(itr->first); if (!p || !p->GetSession()) continue; @@ -667,7 +667,7 @@ void Group::SendLootRoll(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumber, for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr) { - Player *p = ObjectAccessor::FindPlayer(itr->first); + Player* p = ObjectAccessor::FindPlayer(itr->first); if (!p || !p->GetSession()) continue; @@ -690,7 +690,7 @@ void Group::SendLootRollWon(uint64 SourceGuid, uint64 TargetGuid, uint8 RollNumb for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr) { - Player *p = ObjectAccessor::FindPlayer(itr->first); + Player* p = ObjectAccessor::FindPlayer(itr->first); if (!p || !p->GetSession()) continue; @@ -710,7 +710,7 @@ void Group::SendLootAllPassed(uint32 NumberOfPlayers, const Roll &r) for (Roll::PlayerVote::const_iterator itr=r.playerVote.begin(); itr != r.playerVote.end(); ++itr) { - Player *p = ObjectAccessor::FindPlayer(itr->first); + Player* p = ObjectAccessor::FindPlayer(itr->first); if (!p || !p->GetSession()) continue; @@ -720,7 +720,7 @@ 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* pCreature, Player* pLooter) { ASSERT(pCreature); @@ -736,10 +736,10 @@ void Group::SendLooter(Creature *pCreature, Player *pLooter) BroadcastPacket(&data, false); } -void Group::GroupLoot(Loot *loot, WorldObject* pLootedObject) +void Group::GroupLoot(Loot* loot, WorldObject* pLootedObject) { std::vector<LootItem>::iterator i; - ItemTemplate const *item; + ItemTemplate const* item; uint8 itemSlot = 0; for (i = loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot) @@ -761,9 +761,9 @@ void Group::GroupLoot(Loot *loot, WorldObject* pLootedObject) Roll* r = new Roll(newitemGUID, *i); //a vector is filled with only near party members - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) { - Player *member = itr->getSource(); + Player* member = itr->getSource(); if (!member || !member->GetSession()) continue; if (i->AllowedForPlayer(member)) @@ -799,7 +799,7 @@ void Group::GroupLoot(Loot *loot, WorldObject* pLootedObject) { for (Roll::PlayerVote::const_iterator itr=r->playerVote.begin(); itr != r->playerVote.end(); ++itr) { - Player *p = ObjectAccessor::FindPlayer(itr->first); + Player* p = ObjectAccessor::FindPlayer(itr->first); if (!p || !p->GetSession()) continue; @@ -831,9 +831,9 @@ void Group::GroupLoot(Loot *loot, WorldObject* pLootedObject) } } -void Group::NeedBeforeGreed(Loot *loot, WorldObject* pLootedObject) +void Group::NeedBeforeGreed(Loot* loot, WorldObject* pLootedObject) { - ItemTemplate const *item; + ItemTemplate const* item; uint8 itemSlot = 0; for (std::vector<LootItem>::iterator i=loot->items.begin(); i != loot->items.end(); ++i, ++itemSlot) { @@ -848,7 +848,7 @@ void Group::NeedBeforeGreed(Loot *loot, WorldObject* pLootedObject) uint64 newitemGUID = MAKE_NEW_GUID(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), 0, HIGHGUID_ITEM); Roll* r=new Roll(newitemGUID, *i); - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) { Player* playerToRoll = itr->getSource(); if (!playerToRoll || !playerToRoll->GetSession()) @@ -890,7 +890,7 @@ void Group::NeedBeforeGreed(Loot *loot, WorldObject* pLootedObject) { for (Roll::PlayerVote::const_iterator itr=r->playerVote.begin(); itr != r->playerVote.end(); ++itr) { - Player *p = ObjectAccessor::FindPlayer(itr->first); + Player* p = ObjectAccessor::FindPlayer(itr->first); if (!p || !p->GetSession()) continue; @@ -926,9 +926,9 @@ void Group::MasterLoot(Loot* /*loot*/, WorldObject* pLootedObject) WorldPacket data(SMSG_LOOT_MASTER_LIST, 330); data << (uint8)GetMembersCount(); - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) { - Player *looter = itr->getSource(); + Player* looter = itr->getSource(); if (!looter->IsInWorld()) continue; @@ -941,9 +941,9 @@ void Group::MasterLoot(Loot* /*loot*/, WorldObject* pLootedObject) data.put<uint8>(0, real_count); - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) { - Player *looter = itr->getSource(); + Player* looter = itr->getSource(); if (looter->IsWithinDistInMap(pLootedObject, sWorld->getFloatConfig(CONFIG_GROUP_XP_DISTANCE), false)) looter->GetSession()->SendPacket(&data); } @@ -994,7 +994,7 @@ void Group::CountRollVote(uint64 playerGUID, uint64 Guid, uint32 NumberOfPlayers } //called when roll timer expires -void Group::EndRoll(Loot *pLoot) +void Group::EndRoll(Loot* pLoot) { for (Rolls::iterator itr = RollId.begin(); itr != RollId.end();) { @@ -1047,7 +1047,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers) player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_NEED_ON_LOOT, roll->itemid, maxresul); ItemPosCountVec dest; - LootItem *item = &(roll->getLoot()->items[roll->itemSlot]); + LootItem* item = &(roll->getLoot()->items[roll->itemSlot]); InventoryResult msg = player->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, roll->itemid, item->count); if (msg == EQUIP_ERR_OK) { @@ -1096,7 +1096,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers) { player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_ROLL_GREED_ON_LOOT, roll->itemid, maxresul); - LootItem *item = &(roll->getLoot()->items[roll->itemSlot]); + LootItem* item = &(roll->getLoot()->items[roll->itemSlot]); if (rollvote == GREED) { @@ -1121,7 +1121,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers) item->is_looted = true; roll->getLoot()->NotifyItemRemoved(roll->itemSlot); roll->getLoot()->unlootedCount--; - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(roll->itemid); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(roll->itemid); player->AutoStoreLoot(pProto->DisenchantID, LootTemplates_Disenchant, true); } } @@ -1132,7 +1132,7 @@ void Group::CountTheRoll(Rolls::iterator rollI, uint32 NumberOfPlayers) SendLootAllPassed(NumberOfPlayers, *roll); // remove is_blocked so that the item is lootable by all players - LootItem *item = &(roll->getLoot()->items[roll->itemSlot]); + LootItem* item = &(roll->getLoot()->items[roll->itemSlot]); if (item) item->is_blocked = false; } @@ -1162,7 +1162,7 @@ void Group::SetTargetIcon(uint8 id, uint64 whoGuid, uint64 targetGuid) BroadcastPacket(&data, true); } -void Group::SendTargetIconList(WorldSession *session) +void Group::SendTargetIconList(WorldSession* session) { if (!session) return; @@ -1184,59 +1184,75 @@ void Group::SendTargetIconList(WorldSession *session) void Group::SendUpdate() { - Player* player; - for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) + for (member_witerator witr = m_memberSlots.begin(); witr != m_memberSlots.end(); ++witr) { - player = ObjectAccessor::FindPlayer(citr->guid); - if (!player || !player->GetSession() || player->GetGroup() != this) - continue; + SendUpdateToPlayer(witr->guid, &(*witr)); + } +} - WorldPacket data(SMSG_GROUP_LIST, (1+1+1+1+1+4+8+4+4+(GetMembersCount()-1)*(13+8+1+1+1+1)+8+1+8+1+1+1+1)); - data << uint8(m_groupType); // group type (flags in 3.3) - data << uint8(citr->group); - data << uint8(citr->flags); - data << uint8(citr->roles); - if (isLFGGroup()) - { - data << uint8(sLFGMgr->GetState(m_guid) == LFG_STATE_FINISHED_DUNGEON ? 2 : 0); // FIXME - Dungeon save status? 2 = done - data << uint32(sLFGMgr->GetDungeon(m_guid)); - } +void Group::SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot) +{ + Player* player = ObjectAccessor::FindPlayer(playerGUID); - data << uint64(m_guid); - data << uint32(m_counter++); // 3.3, value increases every time this packet gets sent - data << uint32(GetMembersCount()-1); - for (member_citerator citr2 = m_memberSlots.begin(); citr2 != m_memberSlots.end(); ++citr2) - { - if (citr->guid == citr2->guid) - continue; + if (!player || !player->GetSession() || player->GetGroup() != this) + return; - Player* member = ObjectAccessor::FindPlayer(citr2->guid); + // if MemberSlot wasn't provided + if (!slot) + { + member_witerator witr = _getMemberWSlot(playerGUID); - uint8 onlineState = (member) ? MEMBER_STATUS_ONLINE : MEMBER_STATUS_OFFLINE; - onlineState = onlineState | ((isBGGroup()) ? MEMBER_STATUS_PVP : 0); + if (witr == m_memberSlots.end()) // if there is no MemberSlot for such a player + return; - data << citr2->name; - data << uint64(citr2->guid); // guid - data << uint8(onlineState); // online-state - data << uint8(citr2->group); // groupid - data << uint8(citr2->flags); // See enum GroupMemberFlags - data << uint8(citr2->roles); // Lfg Roles - } + slot = &(*witr); + } + + WorldPacket data(SMSG_GROUP_LIST, (1+1+1+1+1+4+8+4+4+(GetMembersCount()-1)*(13+8+1+1+1+1)+8+1+8+1+1+1+1)); + data << uint8(m_groupType); // group type (flags in 3.3) + data << uint8(slot->group); + data << uint8(slot->flags); + data << uint8(slot->roles); + if (isLFGGroup()) + { + data << uint8(sLFGMgr->GetState(m_guid) == LFG_STATE_FINISHED_DUNGEON ? 2 : 0); // FIXME - Dungeon save status? 2 = done + data << uint32(sLFGMgr->GetDungeon(m_guid)); + } - data << uint64(m_leaderGuid); // leader guid + data << uint64(m_guid); + data << uint32(m_counter++); // 3.3, value increases every time this packet gets sent + data << uint32(GetMembersCount()-1); + for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) + { + if (slot->guid == citr->guid) + continue; - if (GetMembersCount() - 1) - { - data << uint8(m_lootMethod); // loot method - data << uint64(m_looterGuid); // looter guid - data << uint8(m_lootThreshold); // loot threshold - data << uint8(m_dungeonDifficulty); // Dungeon Difficulty - data << uint8(m_raidDifficulty); // Raid Difficulty - data << uint8(0); // 3.3 - } + Player* member = ObjectAccessor::FindPlayer(citr->guid); + + uint8 onlineState = (member) ? MEMBER_STATUS_ONLINE : MEMBER_STATUS_OFFLINE; + onlineState = onlineState | ((isBGGroup()) ? MEMBER_STATUS_PVP : 0); - player->GetSession()->SendPacket(&data); + data << citr->name; + data << uint64(citr->guid); // guid + data << uint8(onlineState); // online-state + data << uint8(citr->group); // groupid + data << uint8(citr->flags); // See enum GroupMemberFlags + data << uint8(citr->roles); // Lfg Roles } + + data << uint64(m_leaderGuid); // leader guid + + if (GetMembersCount() - 1) + { + data << uint8(m_lootMethod); // loot method + data << uint64(m_looterGuid); // looter guid + data << uint8(m_lootThreshold); // loot threshold + data << uint8(m_dungeonDifficulty); // Dungeon Difficulty + data << uint8(m_raidDifficulty); // Raid Difficulty + data << uint8(0); // 3.3 + } + + player->GetSession()->SendPacket(&data); } void Group::UpdatePlayerOutOfRange(Player* pPlayer) @@ -1248,7 +1264,7 @@ void Group::UpdatePlayerOutOfRange(Player* pPlayer) WorldPacket data; pPlayer->GetSession()->BuildPartyMemberStatsChangedPacket(pPlayer, &data); - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) { player = itr->getSource(); if (player && !player->IsWithinDist(pPlayer, player->GetSightRange(), false)) @@ -1258,9 +1274,9 @@ void Group::UpdatePlayerOutOfRange(Player* pPlayer) void Group::BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group, uint64 ignore) { - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) { - Player *pl = itr->getSource(); + Player* pl = itr->getSource(); if (!pl || (ignore != 0 && pl->GetGUID() == ignore) || (ignorePlayersInBGRaid && pl->GetGroup() != this)) continue; @@ -1271,9 +1287,9 @@ void Group::BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int void Group::BroadcastReadyCheck(WorldPacket* packet) { - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) { - Player *pl = itr->getSource(); + Player* pl = itr->getSource(); if (pl && pl->GetSession()) if (IsLeader(pl->GetGUID()) || IsAssistant(pl->GetGUID())) pl->GetSession()->SendPacket(packet); @@ -1284,7 +1300,7 @@ void Group::OfflineReadyCheck() { for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) { - Player *pl = ObjectAccessor::FindPlayer(citr->guid); + Player* pl = ObjectAccessor::FindPlayer(citr->guid); if (!pl || !pl->GetSession()) { WorldPacket data(MSG_RAID_READY_CHECK_CONFIRM, 9); @@ -1409,7 +1425,7 @@ void Group::UpdateLooterGuid(WorldObject* pLootedObject, bool ifneed) } // search next after current - Player *pNewLooter = NULL; + Player* pNewLooter = NULL; for (member_citerator itr = guid_itr; itr != m_memberSlots.end(); ++itr) { if (Player* pl = ObjectAccessor::FindPlayer(itr->guid)) @@ -1482,9 +1498,9 @@ GroupJoinBattlegroundResult Group::CanJoinBattlegroundQueue(Battleground const* // check every member of the group to be able to join memberscount = 0; - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next(), ++memberscount) + for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next(), ++memberscount) { - Player *member = itr->getSource(); + Player* member = itr->getSource(); // offline member? don't let join if (!member) return ERR_BATTLEGROUND_JOIN_FAILED; @@ -1541,7 +1557,7 @@ void Group::SetDungeonDifficulty(Difficulty difficulty) if (!isBGGroup()) CharacterDatabase.PExecute("UPDATE groups SET difficulty = %u WHERE guid ='%u'", m_dungeonDifficulty, m_dbStoreId); - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) { Player* player = itr->getSource(); if (!player->GetSession()) @@ -1558,7 +1574,7 @@ void Group::SetRaidDifficulty(Difficulty difficulty) if (!isBGGroup()) CharacterDatabase.PExecute("UPDATE groups SET raiddifficulty = %u WHERE guid ='%u'", m_raidDifficulty, m_dbStoreId); - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) { Player* player = itr->getSource(); if (!player->GetSession()) @@ -1571,9 +1587,9 @@ void Group::SetRaidDifficulty(Difficulty difficulty) bool Group::InCombatToInstance(uint32 instanceId) { - for (GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = GetFirstMember(); itr != NULL; itr = itr->next()) { - Player *pPlayer = itr->getSource(); + 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) if ((*i) && (*i)->GetTypeId() == TYPEID_UNIT && (*i)->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND) @@ -1594,8 +1610,8 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo) for (BoundInstancesMap::iterator itr = m_boundInstances[diff].begin(); itr != m_boundInstances[diff].end();) { - InstanceSave *p = itr->second.save; - const MapEntry *entry = sMapStore.LookupEntry(itr->first); + InstanceSave* p = itr->second.save; + const MapEntry* entry = sMapStore.LookupEntry(itr->first); if (!entry || entry->IsRaid() != isRaid || (!p->CanReset() && method != INSTANCE_RESET_GROUP_DISBAND)) { ++itr; @@ -1614,7 +1630,7 @@ void Group::ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo) bool isEmpty = true; // if the map is loaded, reset it - Map *map = sMapMgr->FindMap(p->GetMapId(), p->GetInstanceId()); + Map* map = sMapMgr->FindMap(p->GetMapId(), p->GetInstanceId()); if (map && map->IsDungeon() && !(method == INSTANCE_RESET_GROUP_DISBAND && !p->CanReset())) { if (p->CanReset()) @@ -1690,7 +1706,7 @@ InstanceGroupBind* Group::GetBoundInstance(MapEntry const* mapEntry) return NULL; } -InstanceGroupBind* Group::BindToInstance(InstanceSave *save, bool permanent, bool load) +InstanceGroupBind* Group::BindToInstance(InstanceSave* save, bool permanent, bool load) { if (!save || isBGGroup()) return NULL; @@ -1740,7 +1756,7 @@ void Group::BroadcastGroupUpdate(void) for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) { - Player *pp = ObjectAccessor::FindPlayer(citr->guid); + Player* pp = ObjectAccessor::FindPlayer(citr->guid); if (pp && pp->IsInWorld()) { pp->ForceValuesUpdateAtIndex(UNIT_FIELD_BYTES_2); @@ -1753,7 +1769,7 @@ void Group::BroadcastGroupUpdate(void) void Group::ResetMaxEnchantingLevel() { m_maxEnchantingLevel = 0; - Player *pMember = NULL; + Player* pMember = NULL; for (member_citerator citr = m_memberSlots.begin(); citr != m_memberSlots.end(); ++citr) { pMember = ObjectAccessor::FindPlayer(citr->guid); @@ -1917,7 +1933,7 @@ uint8 Group::GetMemberGroup(uint64 guid) const return mslot->group; } -void Group::SetBattlegroundGroup(Battleground *bg) +void Group::SetBattlegroundGroup(Battleground* bg) { m_bgGroup = bg; } @@ -1986,7 +2002,7 @@ Group::Rolls::iterator Group::GetRoll(uint64 Guid) return RollId.end(); } -void Group::LinkMember(GroupReference *pRef) +void Group::LinkMember(GroupReference* pRef) { m_memberMgr.insertFirst(pRef); } diff --git a/src/server/game/Groups/Group.h b/src/server/game/Groups/Group.h index a48b33a8624..9fcc5f66f58 100755 --- a/src/server/game/Groups/Group.h +++ b/src/server/game/Groups/Group.h @@ -127,8 +127,8 @@ class Roll : public LootValidatorRef public: Roll(uint64 _guid, LootItem const& li); ~Roll(); - void setLoot(Loot *pLoot); - Loot *getLoot(); + void setLoot(Loot* pLoot); + Loot* getLoot(); void targetObjectBuildLink(); uint64 itemGUID; @@ -148,7 +148,7 @@ class Roll : public LootValidatorRef struct InstanceGroupBind { - InstanceSave *save; + InstanceSave* save; bool perm; /* permanent InstanceGroupBinds exist if the leader has a permanent PlayerInstanceBind for the same instance. */ @@ -183,8 +183,8 @@ class Group ~Group(); // group manipulation methods - bool Create(Player *leader); - void LoadGroupFromDB(Field *field); + bool Create(Player* leader); + void LoadGroupFromDB(Field* field); void LoadMemberFromDB(uint32 guidLow, uint8 memberFlags, uint8 subgroup, uint8 roles); bool AddInvite(Player* player); void RemoveInvite(Player* player); @@ -238,7 +238,7 @@ class Group void ConvertToLFG(); void ConvertToRaid(); - void SetBattlegroundGroup(Battleground *bg); + void SetBattlegroundGroup(Battleground* bg); GroupJoinBattlegroundResult CanJoinBattlegroundQueue(Battleground const* bgOrTemplate, BattlegroundQueueTypeId bgQueueTypeId, uint32 MinPlayerCount, uint32 MaxPlayerCount, bool isRated, uint32 arenaSlot); void ChangeMembersGroup(uint64 guid, uint8 group); @@ -257,9 +257,10 @@ class Group void ResetInstances(uint8 method, bool isRaid, Player* SendMsgTo); // -no description- - //void SendInit(WorldSession *session); - void SendTargetIconList(WorldSession *session); + //void SendInit(WorldSession* session); + void SendTargetIconList(WorldSession* session); void SendUpdate(); + void SendUpdateToPlayer(uint64 playerGUID, MemberSlot* slot = NULL); void UpdatePlayerOutOfRange(Player* pPlayer); // ignore: GUID of player that will be ignored void BroadcastPacket(WorldPacket* packet, bool ignorePlayersInBGRaid, int group=-1, uint64 ignore=0); @@ -275,22 +276,22 @@ 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 GroupLoot(Loot *loot, WorldObject* pLootedObject); - void NeedBeforeGreed(Loot *loot, WorldObject* pLootedObject); - void MasterLoot(Loot *loot, WorldObject* pLootedObject); + void SendLooter(Creature* pCreature, Player* pLooter); + void GroupLoot(Loot* loot, WorldObject* pLootedObject); + void NeedBeforeGreed(Loot* loot, WorldObject* pLootedObject); + void MasterLoot(Loot* loot, WorldObject* pLootedObject); Rolls::iterator GetRoll(uint64 Guid); void CountTheRoll(Rolls::iterator roll, uint32 NumberOfPlayers); void CountRollVote(uint64 playerGUID, uint64 Guid, uint32 NumberOfPlayers, uint8 Choise); - void EndRoll(Loot *loot); + void EndRoll(Loot* loot); // related to disenchant rolls void ResetMaxEnchantingLevel(); - void LinkMember(GroupReference *pRef); + void LinkMember(GroupReference* pRef); void DelinkMember(GroupReference* /*pRef*/) const; - InstanceGroupBind* BindToInstance(InstanceSave *save, bool permanent, bool load = false); + InstanceGroupBind* BindToInstance(InstanceSave* save, bool permanent, bool load = false); void UnbindInstance(uint32 mapid, uint8 difficulty, bool unload = false); InstanceGroupBind* GetBoundInstance(Player* player); InstanceGroupBind* GetBoundInstance(Map* aMap); diff --git a/src/server/game/Groups/GroupMgr.h b/src/server/game/Groups/GroupMgr.h index 5950bb65246..e33d28be7d5 100644 --- a/src/server/game/Groups/GroupMgr.h +++ b/src/server/game/Groups/GroupMgr.h @@ -27,8 +27,8 @@ class GroupMgr ~GroupMgr(); public: - typedef std::map<uint32, Group *> GroupContainer; - typedef std::vector<Group *> GroupDbContainer; + typedef std::map<uint32, Group*> GroupContainer; + typedef std::vector<Group*> GroupDbContainer; Group* GetGroupByGUID(uint32 guid) const; diff --git a/src/server/game/Groups/GroupReference.h b/src/server/game/Groups/GroupReference.h index 005422cb77e..2f5ad755443 100755 --- a/src/server/game/Groups/GroupReference.h +++ b/src/server/game/Groups/GroupReference.h @@ -34,7 +34,7 @@ class GroupReference : public Reference<Group, Player> public: GroupReference() : Reference<Group, Player>(), iSubGroup(0) {} ~GroupReference() { unlink(); } - GroupReference *next() { return (GroupReference*)Reference<Group, Player>::next(); } + GroupReference* next() { return (GroupReference*)Reference<Group, Player>::next(); } uint8 getSubGroup() const { return iSubGroup; } void setSubGroup(uint8 pSubGroup) { iSubGroup = pSubGroup; } }; diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index 63aa0f88b14..5fce91a3289 100755 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -24,6 +24,7 @@ #include "Config.h" #include "SocialMgr.h" #include "Log.h" +#include "AccountMgr.h" #define MAX_GUILD_BANK_TAB_TEXT_LEN 500 #define EMBLEM_PRICE 10 * GOLD @@ -347,7 +348,7 @@ bool Guild::BankTab::LoadItemFromDB(Field* fields) return false; } - Item *pItem = NewItemOrBag(proto); + Item* pItem = NewItemOrBag(proto); if (!pItem->LoadFromDB(itemGuid, 0, fields, itemEntry)) { sLog->outError("Item (GUID %u, id: %u) not found in item_instance, deleting from guild bank!", itemGuid, itemEntry); @@ -391,7 +392,7 @@ inline void Guild::BankTab::WritePacket(WorldPacket& data) const // Writes information about contents of specified slot into packet. void Guild::BankTab::WriteSlotPacket(WorldPacket& data, uint8 slotId) const { - Item *pItem = GetItem(slotId); + Item* pItem = GetItem(slotId); uint32 itemEntry = pItem ? pItem->GetEntry() : 0; data << uint8(slotId); @@ -937,7 +938,7 @@ void Guild::BankMoveItemData::LogBankEvent(SQLTransaction& trans, MoveItemData* void Guild::BankMoveItemData::LogAction(MoveItemData* pFrom) const { MoveItemData::LogAction(pFrom); - if (!pFrom->IsBank() && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE) && m_pPlayer->GetSession()->GetSecurity() > SEC_PLAYER) // TODO: move to scripts + if (!pFrom->IsBank() && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE) && !AccountMgr::IsPlayerAccount(m_pPlayer->GetSession()->GetSecurity())) // TODO: move to scripts sLog->outCommand(m_pPlayer->GetSession()->GetAccountId(), "GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u)", m_pPlayer->GetName(), m_pPlayer->GetSession()->GetAccountId(), @@ -945,7 +946,7 @@ void Guild::BankMoveItemData::LogAction(MoveItemData* pFrom) const m_pGuild->GetId()); } -Item* Guild::BankMoveItemData::_StoreItem(SQLTransaction& trans, BankTab* pTab, Item *pItem, ItemPosCount& pos, bool clone) const +Item* Guild::BankMoveItemData::_StoreItem(SQLTransaction& trans, BankTab* pTab, Item* pItem, ItemPosCount& pos, bool clone) const { uint8 slotId = uint8(pos.pos); uint32 count = pos.count; @@ -1200,7 +1201,7 @@ void Guild::Disband() /////////////////////////////////////////////////////////////////////////////// // HANDLE CLIENT COMMANDS -void Guild::HandleRoster(WorldSession *session /*= NULL*/) +void Guild::HandleRoster(WorldSession* session /*= NULL*/) { // Guess size WorldPacket data(SMSG_GUILD_ROSTER, (4 + m_motd.length() + 1 + m_info.length() + 1 + 4 + _GetRanksSize() * (4 + 4 + GUILD_BANK_MAX_TABS * (4 + 4)) + m_members.size() * 50)); @@ -1222,7 +1223,7 @@ void Guild::HandleRoster(WorldSession *session /*= NULL*/) sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_ROSTER)"); } -void Guild::HandleQuery(WorldSession *session) +void Guild::HandleQuery(WorldSession* session) { WorldPacket data(SMSG_GUILD_QUERY_RESPONSE, 8 * 32 + 200); // Guess size @@ -1630,7 +1631,7 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount) player->ModifyMoney(-int32(amount)); player->SaveGoldToDB(trans); // Log GM action (TODO: move to scripts) - if (player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) + 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)", @@ -1732,7 +1733,7 @@ void Guild::SendInfo(WorldSession* session) const sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_INFO)"); } -void Guild::SendEventLog(WorldSession *session) const +void Guild::SendEventLog(WorldSession* session) const { WorldPacket data(MSG_GUILD_EVENT_LOG_QUERY, 1 + m_eventLog->GetSize() * (1 + 8 + 4)); m_eventLog->WritePacket(data); @@ -1740,7 +1741,7 @@ void Guild::SendEventLog(WorldSession *session) const sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (MSG_GUILD_EVENT_LOG_QUERY)"); } -void Guild::SendBankLog(WorldSession *session, uint8 tabId) const +void Guild::SendBankLog(WorldSession* session, uint8 tabId) const { // GUILD_BANK_MAX_TABS send by client for money log if (tabId < _GetPurchasedTabsSize() || tabId == GUILD_BANK_MAX_TABS) @@ -1763,7 +1764,7 @@ void Guild::SendBankTabData(WorldSession* session, uint8 tabId) const } } -void Guild::SendBankTabsInfo(WorldSession *session) const +void Guild::SendBankTabsInfo(WorldSession* session) const { WorldPacket data(SMSG_GUILD_BANK_LIST, 500); @@ -1782,13 +1783,13 @@ void Guild::SendBankTabsInfo(WorldSession *session) const sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent (SMSG_GUILD_BANK_LIST)"); } -void Guild::SendBankTabText(WorldSession *session, uint8 tabId) const +void Guild::SendBankTabText(WorldSession* session, uint8 tabId) const { if (const BankTab* pTab = GetBankTab(tabId)) pTab->SendText(this, session); } -void Guild::SendPermissions(WorldSession *session) const +void Guild::SendPermissions(WorldSession* session) const { uint64 guid = session->GetPlayer()->GetGUID(); uint8 rankId = session->GetPlayer()->GetRank(); @@ -1808,7 +1809,7 @@ void Guild::SendPermissions(WorldSession *session) const sLog->outDebug(LOG_FILTER_GUILD, "WORLD: Sent (MSG_GUILD_PERMISSIONS)"); } -void Guild::SendMoneyInfo(WorldSession *session) const +void Guild::SendMoneyInfo(WorldSession* session) const { WorldPacket data(MSG_GUILD_BANK_MONEY_WITHDRAWN, 4); data << uint32(_GetMemberRemainingMoney(session->GetPlayer()->GetGUID())); @@ -2032,7 +2033,7 @@ bool Guild::Validate() /////////////////////////////////////////////////////////////////////////////// // Broadcasts -void Guild::BroadcastToGuild(WorldSession *session, bool officerOnly, const std::string& msg, uint32 language) const +void Guild::BroadcastToGuild(WorldSession* session, bool officerOnly, const std::string& msg, uint32 language) const { if (session && session->GetPlayer() && _HasRankRight(session->GetPlayer(), officerOnly ? GR_RIGHT_OFFCHATSPEAK : GR_RIGHT_GCHATSPEAK)) { @@ -2096,7 +2097,7 @@ bool Guild::AddMember(uint64 guid, uint8 rankId) stmt->setUInt32(0, lowguid); if (PreparedQueryResult result = CharacterDatabase.Query(stmt)) { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); pMember->SetStats( fields[0].GetString(), fields[1].GetUInt8(), @@ -2159,7 +2160,7 @@ void Guild::DeleteMember(uint64 guid, bool isDisbanding, bool isKicked) _SetLeaderGUID(newLeader); // If player not online data in data field will be loaded from guild tabs no need to update it !! - if (Player *newLeaderPlayer = newLeader->FindPlayer()) + if (Player* newLeaderPlayer = newLeader->FindPlayer()) newLeaderPlayer->SetRank(GR_GUILDMASTER); // If leader does not exist (at guild loading with deleted leader) do not send broadcasts @@ -2630,7 +2631,7 @@ bool Guild::_DoItemsMove(MoveItemData* pSrc, MoveItemData* pDest, bool sendError return true; } -void Guild::_SendBankContent(WorldSession *session, uint8 tabId) const +void Guild::_SendBankContent(WorldSession* session, uint8 tabId) const { uint64 guid = session->GetPlayer()->GetGUID(); if (_MemberHasTabRights(guid, tabId, GUILD_BANK_RIGHT_VIEW_TAB)) @@ -2651,7 +2652,7 @@ void Guild::_SendBankContent(WorldSession *session, uint8 tabId) const } } -void Guild::_SendBankMoneyUpdate(WorldSession *session) const +void Guild::_SendBankMoneyUpdate(WorldSession* session) const { WorldPacket data(SMSG_GUILD_BANK_LIST, 8 + 1 + 4 + 1 + 1); diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h index 40a281bf122..51636dc218e 100755 --- a/src/server/game/Guilds/Guild.h +++ b/src/server/game/Guilds/Guild.h @@ -527,7 +527,7 @@ private: virtual InventoryResult _CanStore(Item* pItem, bool swap) = 0; Guild* m_pGuild; - Player *m_pPlayer; + Player* m_pPlayer; uint8 m_container; uint8 m_slotId; Item* m_pItem; @@ -569,7 +569,7 @@ private: InventoryResult _CanStore(Item* pItem, bool swap); private: - Item* _StoreItem(SQLTransaction& trans, BankTab* pTab, Item *pItem, ItemPosCount& pos, bool clone) const; + Item* _StoreItem(SQLTransaction& trans, BankTab* pTab, Item* pItem, ItemPosCount& pos, bool clone) const; bool _ReserveSpace(uint8 slotId, Item* pItem, Item* pItemDest, uint32& count); void _CanStoreItemInTab(Item* pItem, uint8 skipSlotId, bool merge, uint32& count); }; @@ -596,8 +596,8 @@ public: const std::string& GetInfo() const { return m_info; } // Handle client commands - void HandleRoster(WorldSession *session = NULL); // NULL = broadcast - void HandleQuery(WorldSession *session); + void HandleRoster(WorldSession* session = NULL); // NULL = broadcast + void HandleQuery(WorldSession* session); void HandleSetMOTD(WorldSession* session, const std::string& motd); void HandleSetInfo(WorldSession* session, const std::string& info); void HandleSetEmblem(WorldSession* session, const EmblemInfo& emblemInfo); @@ -620,13 +620,13 @@ public: // Send info to client void SendInfo(WorldSession* session) const; - void SendEventLog(WorldSession *session) const; - void SendBankLog(WorldSession *session, uint8 tabId) const; - void SendBankTabsInfo(WorldSession *session) const; + void SendEventLog(WorldSession* session) const; + void SendBankLog(WorldSession* session, uint8 tabId) const; + void SendBankTabsInfo(WorldSession* session) const; void SendBankTabData(WorldSession* session, uint8 tabId) const; - void SendBankTabText(WorldSession *session, uint8 tabId) const; - void SendPermissions(WorldSession *session) const; - void SendMoneyInfo(WorldSession *session) const; + void SendBankTabText(WorldSession* session, uint8 tabId) const; + void SendPermissions(WorldSession* session) const; + void SendMoneyInfo(WorldSession* session) const; void SendLoginInfo(WorldSession* session) const; // Load from DB @@ -641,7 +641,7 @@ public: bool Validate(); // Broadcasts - void BroadcastToGuild(WorldSession *session, bool officerOnly, const std::string& msg, uint32 language = LANG_UNIVERSAL) const; + void BroadcastToGuild(WorldSession* session, bool officerOnly, const std::string& msg, uint32 language = LANG_UNIVERSAL) const; void BroadcastPacketToRank(WorldPacket* packet, uint8 rankId) const; void BroadcastPacket(WorldPacket* packet) const; @@ -689,8 +689,8 @@ protected: private: inline uint8 _GetRanksSize() const { return uint8(m_ranks.size()); } - inline const RankInfo *GetRankInfo(uint8 rankId) const { return rankId < _GetRanksSize() ? &m_ranks[rankId] : NULL; } - inline RankInfo *GetRankInfo(uint8 rankId) { return rankId < _GetRanksSize() ? &m_ranks[rankId] : NULL; } + inline const RankInfo* GetRankInfo(uint8 rankId) const { return rankId < _GetRanksSize() ? &m_ranks[rankId] : NULL; } + inline RankInfo* GetRankInfo(uint8 rankId) { return rankId < _GetRanksSize() ? &m_ranks[rankId] : NULL; } inline bool _HasRankRight(Player* player, uint32 right) const { return (_GetRankRights(player->GetRank()) & right) != GR_RIGHT_EMPTY; } inline uint8 _GetLowestRankId() const { return uint8(m_ranks.size() - 1); } @@ -760,8 +760,8 @@ private: void _MoveItems(MoveItemData* pSrc, MoveItemData* pDest, uint32 splitedAmount); bool _DoItemsMove(MoveItemData* pSrc, MoveItemData* pDest, bool sendError, uint32 splitedAmount = 0); - void _SendBankContent(WorldSession *session, uint8 tabId) const; - void _SendBankMoneyUpdate(WorldSession *session) const; + void _SendBankContent(WorldSession* session, uint8 tabId) const; + void _SendBankMoneyUpdate(WorldSession* session) const; void _SendBankContentUpdate(MoveItemData* pSrc, MoveItemData* pDest) const; void _SendBankContentUpdate(uint8 tabId, SlotIds slots) const; diff --git a/src/server/game/Instances/InstanceSaveMgr.cpp b/src/server/game/Instances/InstanceSaveMgr.cpp index e6589a27568..ca946b4a2c0 100755 --- a/src/server/game/Instances/InstanceSaveMgr.cpp +++ b/src/server/game/Instances/InstanceSaveMgr.cpp @@ -44,7 +44,7 @@ InstanceSaveManager::~InstanceSaveManager() lock_instLists = true; for (InstanceSaveHashMap::iterator itr = m_instanceSaveById.begin(); itr != m_instanceSaveById.end(); ++itr) { - InstanceSave *save = itr->second; + InstanceSave* save = itr->second; for (InstanceSave::PlayerListType::iterator itr2 = save->m_playerList.begin(), next = itr2; itr2 != save->m_playerList.end(); itr2 = next) { @@ -69,7 +69,7 @@ InstanceSaveManager::~InstanceSaveManager() */ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instanceId, Difficulty difficulty, time_t resetTime, bool canReset, bool load) { - if (InstanceSave *old_save = GetInstanceSave(instanceId)) + if (InstanceSave* old_save = GetInstanceSave(instanceId)) return old_save; const MapEntry* entry = sMapStore.LookupEntry(mapId); @@ -107,7 +107,7 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance sLog->outDebug(LOG_FILTER_MAPS, "InstanceSaveManager::AddInstanceSave: mapid = %d, instanceid = %d", mapId, instanceId); - InstanceSave *save = new InstanceSave(mapId, instanceId, difficulty, resetTime, canReset); + InstanceSave* save = new InstanceSave(mapId, instanceId, difficulty, resetTime, canReset); if (!load) save->SaveToDB(); @@ -115,7 +115,7 @@ InstanceSave* InstanceSaveManager::AddInstanceSave(uint32 mapId, uint32 instance return save; } -InstanceSave *InstanceSaveManager::GetInstanceSave(uint32 InstanceId) +InstanceSave* InstanceSaveManager::GetInstanceSave(uint32 InstanceId) { InstanceSaveHashMap::iterator itr = m_instanceSaveById.find(InstanceId); return itr != m_instanceSaveById.end() ? itr->second : NULL; @@ -166,11 +166,11 @@ void InstanceSave::SaveToDB() std::string data; uint32 completedEncounters = 0; - Map *map = sMapMgr->FindMap(GetMapId(), m_instanceid); + Map* map = sMapMgr->FindMap(GetMapId(), m_instanceid); if (map) { ASSERT(map->IsDungeon()); - if (InstanceScript *instanceScript = ((InstanceMap*)map)->GetInstanceScript()) + if (InstanceScript* instanceScript = ((InstanceMap*)map)->GetInstanceScript()) { data = instanceScript->GetSaveData(); completedEncounters = instanceScript->GetCompletedEncounterMask(); @@ -190,7 +190,7 @@ void InstanceSave::SaveToDB() time_t InstanceSave::GetResetTimeForDB() { // only save the reset time for normal instances - const MapEntry *entry = sMapStore.LookupEntry(GetMapId()); + const MapEntry* entry = sMapStore.LookupEntry(GetMapId()); if (!entry || entry->map_type == MAP_RAID || GetDifficulty() == DUNGEON_DIFFICULTY_HEROIC) return 0; else @@ -313,7 +313,7 @@ void InstanceSaveManager::LoadResetTimes() { do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 instance = fields[1].GetUInt32(); time_t resettime = time_t(fields[0].GetUInt32() + 2 * HOUR); InstResetTimeMapDiffType::iterator itr = instResetTime.find(instance); @@ -339,7 +339,7 @@ void InstanceSaveManager::LoadResetTimes() { do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 mapid = fields[0].GetUInt16(); Difficulty difficulty = Difficulty(fields[1].GetUInt32()); uint64 oldresettime = fields[2].GetUInt32(); @@ -511,7 +511,7 @@ void InstanceSaveManager::_ResetSave(InstanceSaveHashMap::iterator &itr) void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId) { sLog->outDebug(LOG_FILTER_MAPS, "InstanceSaveMgr::_ResetInstance %u, %u", mapid, instanceId); - Map *map = (MapInstanced*)sMapMgr->CreateBaseMap(mapid); + Map* map = (MapInstanced*)sMapMgr->CreateBaseMap(mapid); if (!map->Instanceable()) return; @@ -535,7 +535,7 @@ void InstanceSaveManager::_ResetInstance(uint32 mapid, uint32 instanceId) void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, bool warn, time_t resetTime) { // global reset for all instances of the given map - MapEntry const *mapEntry = sMapStore.LookupEntry(mapid); + MapEntry const* mapEntry = sMapStore.LookupEntry(mapid); if (!mapEntry->Instanceable()) return; @@ -583,14 +583,14 @@ void InstanceSaveManager::_ResetOrWarnAll(uint32 mapid, Difficulty difficulty, b } // note: this isn't fast but it's meant to be executed very rarely - Map const *map = sMapMgr->CreateBaseMap(mapid); // _not_ include difficulty + Map const* map = sMapMgr->CreateBaseMap(mapid); // _not_ include difficulty MapInstanced::InstancedMaps &instMaps = ((MapInstanced*)map)->GetInstancedMaps(); MapInstanced::InstancedMaps::iterator mitr; uint32 timeLeft; for (mitr = instMaps.begin(); mitr != instMaps.end(); ++mitr) { - Map *map2 = mitr->second; + Map* map2 = mitr->second; if (!map2->IsDungeon()) continue; diff --git a/src/server/game/Instances/InstanceSaveMgr.h b/src/server/game/Instances/InstanceSaveMgr.h index 82a45a6fd03..c79d2b5c3dc 100755 --- a/src/server/game/Instances/InstanceSaveMgr.h +++ b/src/server/game/Instances/InstanceSaveMgr.h @@ -164,7 +164,7 @@ class InstanceSaveManager void RemoveInstanceSave(uint32 InstanceId); static void DeleteInstanceFromDB(uint32 instanceid); - InstanceSave *GetInstanceSave(uint32 InstanceId); + InstanceSave* GetInstanceSave(uint32 InstanceId); /* statistics */ uint32 GetNumInstanceSaves() { return m_instanceSaveById.size(); } diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index 101f0e4ce4d..fe8bfa6b844 100755 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -39,7 +39,7 @@ void InstanceScript::SaveToDB() CharacterDatabase.Execute(stmt); } -void InstanceScript::HandleGameObject(uint64 GUID, bool open, GameObject *go) +void InstanceScript::HandleGameObject(uint64 GUID, bool open, GameObject* go) { if (!go) go = instance->GetGameObject(GUID); @@ -58,7 +58,7 @@ bool InstanceScript::IsEncounterInProgress() const return false; } -void InstanceScript::LoadMinionData(const MinionData *data) +void InstanceScript::LoadMinionData(const MinionData* data) { while (data->entry) { @@ -70,7 +70,7 @@ void InstanceScript::LoadMinionData(const MinionData *data) sLog->outDebug(LOG_FILTER_TSCR, "InstanceScript::LoadMinionData: " UI64FMTD " minions loaded.", uint64(minions.size())); } -void InstanceScript::LoadDoorData(const DoorData *data) +void InstanceScript::LoadDoorData(const DoorData* data) { while (data->entry) { @@ -82,7 +82,7 @@ void InstanceScript::LoadDoorData(const DoorData *data) sLog->outDebug(LOG_FILTER_TSCR, "InstanceScript::LoadDoorData: " UI64FMTD " doors loaded.", uint64(doors.size())); } -void InstanceScript::UpdateMinionState(Creature *minion, EncounterState state) +void InstanceScript::UpdateMinionState(Creature* minion, EncounterState state) { switch (state) { @@ -103,7 +103,7 @@ void InstanceScript::UpdateMinionState(Creature *minion, EncounterState state) } } -void InstanceScript::UpdateDoorState(GameObject *door) +void InstanceScript::UpdateDoorState(GameObject* door) { DoorInfoMap::iterator lower = doors.lower_bound(door->GetEntry()); DoorInfoMap::iterator upper = doors.upper_bound(door->GetEntry()); @@ -132,7 +132,7 @@ void InstanceScript::UpdateDoorState(GameObject *door) door->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY); } -void InstanceScript::AddDoor(GameObject *door, bool add) +void InstanceScript::AddDoor(GameObject* door, bool add) { DoorInfoMap::iterator lower = doors.lower_bound(door->GetEntry()); DoorInfoMap::iterator upper = doors.upper_bound(door->GetEntry()); @@ -175,7 +175,7 @@ void InstanceScript::AddDoor(GameObject *door, bool add) UpdateDoorState(door); } -void InstanceScript::AddMinion(Creature *minion, bool add) +void InstanceScript::AddMinion(Creature* minion, bool add) { MinionInfoMap::iterator itr = minions.find(minion->GetEntry()); if (itr == minions.end()) @@ -191,7 +191,7 @@ bool InstanceScript::SetBossState(uint32 id, EncounterState state) { if (id < bosses.size()) { - BossInfo *bossInfo = &bosses[id]; + BossInfo* bossInfo = &bosses[id]; if (bossInfo->state == TO_BE_DECIDED) // loading { bossInfo->state = state; @@ -292,7 +292,7 @@ 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()) + if (Player* pPlayer = itr->getSource()) pPlayer->SendUpdateWorldState(uiStateId, uiStateData); } else @@ -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* pPlayer = i->getSource()) + if (WorldSession* pSession = pPlayer->GetSession()) pSession->SendNotification(format, ap); } va_end(ap); @@ -326,7 +326,7 @@ 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()) + if (Player* pPlayer = i->getSource()) pPlayer->UpdateAchievementCriteria(type, miscValue1, miscValue2, unit); } @@ -337,7 +337,7 @@ 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()) + if (Player* pPlayer = i->getSource()) pPlayer->GetAchievementMgr().StartTimedAchievement(type, entry); } @@ -348,7 +348,7 @@ 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()) + if (Player* pPlayer = i->getSource()) pPlayer->GetAchievementMgr().RemoveTimedAchievement(type, entry); } diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h index d2c98af0838..1751b7b3106 100755 --- a/src/server/game/Instances/InstanceScript.h +++ b/src/server/game/Instances/InstanceScript.h @@ -106,17 +106,17 @@ struct BossInfo struct DoorInfo { - explicit DoorInfo(BossInfo *_bossInfo, DoorType _type, BoundaryType _boundary) + explicit DoorInfo(BossInfo* _bossInfo, DoorType _type, BoundaryType _boundary) : bossInfo(_bossInfo), type(_type), boundary(_boundary) {} - BossInfo *bossInfo; + BossInfo* bossInfo; DoorType type; BoundaryType boundary; }; struct MinionInfo { - explicit MinionInfo(BossInfo *_bossInfo) : bossInfo(_bossInfo) {} - BossInfo *bossInfo; + explicit MinionInfo(BossInfo* _bossInfo) : bossInfo(_bossInfo) {} + BossInfo* bossInfo; }; typedef std::multimap<uint32 /*entry*/, DoorInfo> DoorInfoMap; @@ -130,7 +130,7 @@ class InstanceScript : public ZoneScript virtual ~InstanceScript() {} - Map *instance; + Map* instance; //On creation, NOT load. virtual void Initialize() {} @@ -217,8 +217,8 @@ class InstanceScript : public ZoneScript void AddDoor(GameObject* door, bool add); void AddMinion(Creature* minion, bool add); - void UpdateDoorState(GameObject *door); - void UpdateMinionState(Creature *minion, EncounterState state); + void UpdateDoorState(GameObject* door); + void UpdateMinionState(Creature* minion, EncounterState state); std::string LoadBossState(char const* data); std::string GetBossSaveData(); diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index b613f794388..c8063ccb818 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -63,8 +63,8 @@ class LootTemplate::LootGroup // A set of loot def void Verify(LootStore const& lootstore, uint32 id, uint8 group_id) const; void CollectLootIds(LootIdSet& set) const; void CheckLootRefs(LootTemplateMap const& store, LootIdSet* ref_set) const; - LootStoreItemList * GetExplicitlyChancedItemList() { return &ExplicitlyChanced; } - LootStoreItemList * GetEqualChancedItemList() { return &EqualChanced; } + LootStoreItemList* GetExplicitlyChancedItemList() { return &ExplicitlyChanced; } + LootStoreItemList* GetEqualChancedItemList() { return &EqualChanced; } void CopyConditions(ConditionList conditions); private: LootStoreItemList ExplicitlyChanced; // Entries with chances defined in DB @@ -110,7 +110,7 @@ uint32 LootStore::LoadLootTable() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); uint32 item = fields[1].GetUInt32(); @@ -249,7 +249,7 @@ bool LootStoreItem::Roll(bool rate) const if (mincountOrRef < 0) // reference case return roll_chance_f(chance* (rate ? sWorld->getRate(RATE_DROP_ITEM_REFERENCED) : 1.0f)); - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(itemid); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(itemid); float qualityModifier = pProto && rate ? sWorld->getRate(qualityToRate[pProto->Quality]) : 1.0f; @@ -273,7 +273,7 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const if (mincountOrRef > 0) // item (quest or non-quest) entry, maybe grouped { - ItemTemplate const *proto = sObjectMgr->GetItemTemplate(itemid); + ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemid); if (!proto) { sLog->outErrorDb("Table '%s' entry %d item %d: item entry not listed in `item_template` - skipped", store.GetName(), entry, itemid); @@ -344,7 +344,7 @@ bool LootItem::AllowedForPlayer(Player const* player) const if (!sConditionMgr->IsPlayerMeetToConditions(const_cast<Player*>(player), conditions)) return false; - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(itemid); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(itemid); if (!pProto) return false; @@ -430,18 +430,18 @@ 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(); + Group* pGroup = lootOwner->GetGroup(); if (!personal && pGroup) { roundRobinPlayer = lootOwner->GetGUID(); - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->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 (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(items[i].itemid)) if (proto->Quality < uint32(pGroup->GetLootThreshold())) items[i].is_underthreshold = true; } @@ -475,7 +475,7 @@ void Loot::FillNotNormalLootFor(Player* pl, bool presentAtLooting) // Process currency items uint32 max_slot = GetMaxSlotInLootFor(pl); - LootItem const *item = NULL; + LootItem const* item = NULL; uint32 itemsSize = uint32(items.size()); for (uint32 i = 0; i < max_slot; ++i) { @@ -493,7 +493,7 @@ void Loot::FillNotNormalLootFor(Player* pl, bool presentAtLooting) QuestItemList* Loot::FillFFALoot(Player* player) { - QuestItemList *ql = new QuestItemList(); + QuestItemList* ql = new QuestItemList(); for (uint8 i = 0; i < items.size(); ++i) { @@ -517,7 +517,7 @@ QuestItemList* Loot::FillFFALoot(Player* player) QuestItemList* Loot::FillQuestLoot(Player* player) { if (items.size() == MAX_NR_LOOT_ITEMS) return NULL; - QuestItemList *ql = new QuestItemList(); + QuestItemList* ql = new QuestItemList(); for (uint8 i = 0; i < quest_items.size(); ++i) { @@ -551,7 +551,7 @@ QuestItemList* Loot::FillQuestLoot(Player* player) QuestItemList* Loot::FillNonQuestNonFFAConditionalLoot(Player* player, bool presentAtLooting) { - QuestItemList *ql = new QuestItemList(); + QuestItemList* ql = new QuestItemList(); for (uint8 i = 0; i < items.size(); ++i) { @@ -661,7 +661,7 @@ void Loot::generateMoneyLoot(uint32 minAmount, uint32 maxAmount) } } -LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem **qitem, QuestItem **ffaitem, QuestItem **conditem) +LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem* *qitem, QuestItem* *ffaitem, QuestItem* *conditem) { LootItem* item = NULL; bool is_looted = true; @@ -671,7 +671,7 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem **qite QuestItemMap::const_iterator itr = PlayerQuestItems.find(player->GetGUIDLow()); if (itr != PlayerQuestItems.end() && questSlot < itr->second->size()) { - QuestItem *qitem2 = &itr->second->at(questSlot); + QuestItem* qitem2 = &itr->second->at(questSlot); if (qitem) *qitem = qitem2; item = &quest_items[qitem2->index]; @@ -690,7 +690,7 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem **qite for (QuestItemList::const_iterator iter=itr->second->begin(); iter!= itr->second->end(); ++iter) if (iter->index == lootSlot) { - QuestItem *ffaitem2 = (QuestItem*)&(*iter); + QuestItem* ffaitem2 = (QuestItem*)&(*iter); if (ffaitem) *ffaitem = ffaitem2; is_looted = ffaitem2->is_looted; @@ -707,7 +707,7 @@ LootItem* Loot::LootItemInSlot(uint32 lootSlot, Player* player, QuestItem **qite { if (iter->index == lootSlot) { - QuestItem *conditem2 = (QuestItem*)&(*iter); + QuestItem* conditem2 = (QuestItem*)&(*iter); if (conditem) *conditem = conditem2; is_looted = conditem2->is_looted; @@ -737,7 +737,7 @@ bool Loot::hasItemFor(Player* player) const QuestItemMap::const_iterator q_itr = lootPlayerQuestItems.find(player->GetGUIDLow()); if (q_itr != lootPlayerQuestItems.end()) { - QuestItemList *q_list = q_itr->second; + QuestItemList* q_list = q_itr->second; for (QuestItemList::const_iterator qi = q_list->begin() ; qi != q_list->end(); ++qi) { const LootItem &item = quest_items[qi->index]; @@ -750,7 +750,7 @@ bool Loot::hasItemFor(Player* player) const QuestItemMap::const_iterator ffa_itr = lootPlayerFFAItems.find(player->GetGUIDLow()); if (ffa_itr != lootPlayerFFAItems.end()) { - QuestItemList *ffa_list = ffa_itr->second; + QuestItemList* ffa_list = ffa_itr->second; for (QuestItemList::const_iterator fi = ffa_list->begin() ; fi != ffa_list->end(); ++fi) { const LootItem &item = items[fi->index]; @@ -763,7 +763,7 @@ bool Loot::hasItemFor(Player* player) const QuestItemMap::const_iterator nn_itr = lootPlayerNonQuestNonFFAConditionalItems.find(player->GetGUIDLow()); if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end()) { - QuestItemList *conditional_list = nn_itr->second; + QuestItemList* conditional_list = nn_itr->second; for (QuestItemList::const_iterator ci = conditional_list->begin() ; ci != conditional_list->end(); ++ci) { const LootItem &item = items[ci->index]; @@ -903,7 +903,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) QuestItemMap::const_iterator q_itr = lootPlayerQuestItems.find(lv.viewer->GetGUIDLow()); if (q_itr != lootPlayerQuestItems.end()) { - QuestItemList *q_list = q_itr->second; + QuestItemList* q_list = q_itr->second; for (QuestItemList::const_iterator qi = q_list->begin() ; qi != q_list->end(); ++qi) { LootItem &item = l.quest_items[qi->index]; @@ -921,7 +921,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) QuestItemMap::const_iterator ffa_itr = lootPlayerFFAItems.find(lv.viewer->GetGUIDLow()); if (ffa_itr != lootPlayerFFAItems.end()) { - QuestItemList *ffa_list = ffa_itr->second; + QuestItemList* ffa_list = ffa_itr->second; for (QuestItemList::const_iterator fi = ffa_list->begin() ; fi != ffa_list->end(); ++fi) { LootItem &item = l.items[fi->index]; @@ -939,7 +939,7 @@ ByteBuffer& operator<<(ByteBuffer& b, LootView const& lv) QuestItemMap::const_iterator nn_itr = lootPlayerNonQuestNonFFAConditionalItems.find(lv.viewer->GetGUIDLow()); if (nn_itr != lootPlayerNonQuestNonFFAConditionalItems.end()) { - QuestItemList *conditional_list = nn_itr->second; + QuestItemList* conditional_list = nn_itr->second; for (QuestItemList::const_iterator ci = conditional_list->begin() ; ci != conditional_list->end(); ++ci) { LootItem &item = l.items[ci->index]; @@ -1046,7 +1046,7 @@ void LootTemplate::LootGroup::Process(Loot& loot, uint16 lootMode) const if (uiAttemptCount == uiMaxAttempts) // already tried rolling too many times, just abort return; - LootStoreItem *item = NULL; + LootStoreItem* item = NULL; // begin rolling (normally called via Roll()) LootStoreItemList::iterator itr; @@ -1086,7 +1086,7 @@ void LootTemplate::LootGroup::Process(Loot& loot, uint16 lootMode) const if (item != NULL && item->lootmode & lootMode) // only add this item if roll succeeds and the mode matches { bool duplicate = false; - if (ItemTemplate const *_proto = sObjectMgr->GetItemTemplate(item->itemid)) + if (ItemTemplate const* _proto = sObjectMgr->GetItemTemplate(item->itemid)) { uint8 _item_counter = 0; for (LootItemList::const_iterator _item = loot.items.begin(); _item != loot.items.end(); ++_item) @@ -1227,7 +1227,7 @@ void LootTemplate::Process(Loot& loot, bool rate, uint16 lootMode, uint8 groupId if (!i->Roll(rate)) continue; // Bad luck for the entry - if (ItemTemplate const *_proto = sObjectMgr->GetItemTemplate(i->itemid)) + if (ItemTemplate const* _proto = sObjectMgr->GetItemTemplate(i->itemid)) { uint8 _item_counter = 0; LootItemList::const_iterator _item = loot.items.begin(); diff --git a/src/server/game/Loot/LootMgr.h b/src/server/game/Loot/LootMgr.h index 28bcf395ebd..b0adeb03784 100755 --- a/src/server/game/Loot/LootMgr.h +++ b/src/server/game/Loot/LootMgr.h @@ -169,7 +169,7 @@ class LootTemplate; typedef std::vector<QuestItem> QuestItemList; typedef std::vector<LootItem> LootItemList; -typedef std::map<uint32, QuestItemList *> QuestItemMap; +typedef std::map<uint32, QuestItemList*> QuestItemMap; typedef std::vector<LootStoreItem> LootStoreItemList; typedef UNORDERED_MAP<uint32, LootTemplate*> LootTemplateMap; @@ -357,9 +357,9 @@ struct Loot struct LootView { Loot &loot; - Player *viewer; + Player* viewer; PermissionTypes permission; - LootView(Loot &_loot, Player *_viewer, PermissionTypes _permission = ALL_PERMISSION) + LootView(Loot &_loot, Player* _viewer, PermissionTypes _permission = ALL_PERMISSION) : loot(_loot), viewer(_viewer), permission(_permission) {} }; diff --git a/src/server/game/Mails/Mail.cpp b/src/server/game/Mails/Mail.cpp index 8e869d473ef..f421c135233 100755 --- a/src/server/game/Mails/Mail.cpp +++ b/src/server/game/Mails/Mail.cpp @@ -230,7 +230,7 @@ void MailDraft::SendMailTo(SQLTransaction& trans, MailReceiver const& receiver, if (pReceiver->IsMailsLoaded()) { - Mail * m = new Mail; + Mail* m = new Mail; m->messageID = mailId; m->mailTemplateId = GetMailTemplateId(); m->subject = GetSubject(); diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 001f22815b5..c076450e98d 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -58,7 +58,7 @@ Map::~Map() while (!i_worldObjects.empty()) { - WorldObject *obj = *i_worldObjects.begin(); + WorldObject* obj = *i_worldObjects.begin(); ASSERT(obj->m_isWorldObject); //ASSERT(obj->GetTypeId() == TYPEID_CORPSE); obj->RemoveFromWorld(); @@ -76,7 +76,7 @@ bool Map::ExistMap(uint32 mapid, int gx, int gy) snprintf(tmp, len, (char *)(sWorld->GetDataPath()+"maps/%03u%02u%02u.map").c_str(), mapid, gx, gy); bool ret = false; - FILE *pf=fopen(tmp, "rb"); + FILE* pf=fopen(tmp, "rb"); if (!pf) sLog->outError("Map file '%s': does not exist!", tmp); @@ -305,8 +305,8 @@ void Map::SwitchGridContainers(T* obj, bool on) obj->m_isWorldObject = on; } -template void Map::SwitchGridContainers(Creature *, bool); -//template void Map::SwitchGridContainers(DynamicObject *, bool); +template void Map::SwitchGridContainers(Creature* , bool); +//template void Map::SwitchGridContainers(DynamicObject* , bool); template<class T> void Map::DeleteFromWorld(T* obj) @@ -524,7 +524,7 @@ void Map::Update(const uint32 t_diff) if (plr && plr->IsInWorld()) { //plr->Update(t_diff); - WorldSession * pSession = plr->GetSession(); + WorldSession* pSession = plr->GetSession(); MapSessionFilter updater(pSession); pSession->Update(t_diff, updater); } @@ -767,7 +767,7 @@ Map::PlayerRelocation(Player* player, float x, float y, float z, float orientati } void -Map::CreatureRelocation(Creature *creature, float x, float y, float z, float ang, bool respawnRelocationOnFail) +Map::CreatureRelocation(Creature* creature, float x, float y, float z, float ang, bool respawnRelocationOnFail) { ASSERT(CheckGridIntegrity(creature, false)); @@ -797,7 +797,7 @@ Map::CreatureRelocation(Creature *creature, float x, float y, float z, float ang ASSERT(CheckGridIntegrity(creature, true)); } -void Map::AddCreatureToMoveList(Creature *c, float x, float y, float z, float ang) +void Map::AddCreatureToMoveList(Creature* c, float x, float y, float z, float ang) { if (!c) return; @@ -832,7 +832,16 @@ void Map::MoveAllCreaturesInMoveList() #ifdef TRINITY_DEBUG sLog->outDebug(LOG_FILTER_MAPS, "Creature (GUID: %u Entry: %u) cannot be move to unloaded respawn grid.", c->GetGUIDLow(), c->GetEntry()); #endif - AddObjectToRemoveList(c); + //AddObjectToRemoveList(Pet*) should only be called in Pet::Remove + //This may happen when a player just logs in and a pet moves to a nearby unloaded cell + //To avoid this, we can load nearby cells when player log in + //But this check is always needed to ensure safety + //TODO: pets will disappear if this is outside CreatureRespawnRelocation + //need to check why pet is frequently relocated to an unloaded cell + if (c->isPet()) + ((Pet*)c)->Remove(PET_SAVE_NOT_IN_SLOT, true); + else + AddObjectToRemoveList(c); } } @@ -840,7 +849,7 @@ void Map::MoveAllCreaturesInMoveList() } } -bool Map::CreatureCellRelocation(Creature *c, Cell new_cell) +bool Map::CreatureCellRelocation(Creature* c, Cell new_cell) { Cell const& old_cell = c->GetCurrentCell(); if (!old_cell.DiffGrid(new_cell)) // in same grid @@ -901,7 +910,7 @@ bool Map::CreatureCellRelocation(Creature *c, Cell new_cell) return false; } -bool Map::CreatureRespawnRelocation(Creature *c) +bool Map::CreatureRespawnRelocation(Creature* c) { float resp_x, resp_y, resp_z, resp_o; c->GetRespawnCoord(resp_x, resp_y, resp_z, &resp_o); @@ -925,8 +934,8 @@ bool Map::CreatureRespawnRelocation(Creature *c) c->UpdateObjectVisibility(false); return true; } - else - return false; + + return false; } bool Map::UnloadGrid(const uint32 x, const uint32 y, bool unloadAll) @@ -1059,7 +1068,7 @@ bool GridMap::loadData(char *filename) map_fileheader header; // Not return error if file not found - FILE *in = fopen(filename, "rb"); + FILE* in = fopen(filename, "rb"); if (!in) return true; @@ -1115,7 +1124,7 @@ void GridMap::unloadData() m_gridGetHeight = &GridMap::getHeightFromFlat; } -bool GridMap::loadAreaData(FILE *in, uint32 offset, uint32 /*size*/) +bool GridMap::loadAreaData(FILE* in, uint32 offset, uint32 /*size*/) { map_areaHeader header; fseek(in, offset, SEEK_SET); @@ -1133,7 +1142,7 @@ bool GridMap::loadAreaData(FILE *in, uint32 offset, uint32 /*size*/) return true; } -bool GridMap::loadHeihgtData(FILE *in, uint32 offset, uint32 /*size*/) +bool GridMap::loadHeihgtData(FILE* in, uint32 offset, uint32 /*size*/) { map_heightHeader header; fseek(in, offset, SEEK_SET); @@ -1179,7 +1188,7 @@ bool GridMap::loadHeihgtData(FILE *in, uint32 offset, uint32 /*size*/) return true; } -bool GridMap::loadLiquidData(FILE *in, uint32 offset, uint32 /*size*/) +bool GridMap::loadLiquidData(FILE* in, uint32 offset, uint32 /*size*/) { map_liquidHeader header; fseek(in, offset, SEEK_SET); @@ -1474,7 +1483,7 @@ uint8 GridMap::getTerrainType(float x, float y) } // Get water state on map -inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData *data) +inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data) { // Check water type (if no water return) if (!m_liquid_type && !m_liquidType) @@ -1536,7 +1545,7 @@ inline ZLiquidStatus GridMap::getLiquidStatus(float x, float y, float z, uint8 R return LIQUID_MAP_ABOVE_WATER; } -inline GridMap *Map::GetGrid(float x, float y) +inline GridMap* Map::GetGrid(float x, float y) { // half opt method int gx=(int)(32-x/SIZE_OF_GRIDS); //grid x @@ -1552,7 +1561,7 @@ float Map::GetHeight(float x, float y, float z, bool pUseVmaps, float maxSearchD { // find raw .map surface under Z coordinates float mapHeight; - if (GridMap *gmap = const_cast<Map*>(this)->GetGrid(x, y)) + if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y)) { float _mapheight = gmap->getHeight(x, y); @@ -1661,7 +1670,7 @@ bool Map::GetAreaInfo(float x, float y, float z, uint32 &flags, int32 &adtId, in if (vmgr->getAreaInfo(GetId(), x, y, vmap_z, flags, adtId, rootId, groupId)) { // check if there's terrain between player height and object height - if (GridMap *gmap = const_cast<Map*>(this)->GetGrid(x, y)) + if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y)) { float _mapheight = gmap->getHeight(x, y); // z + 2.0f condition taken from GetHeight(), not sure if it's such a great choice... @@ -1695,7 +1704,7 @@ uint16 Map::GetAreaFlag(float x, float y, float z, bool *isOutdoors) const areaflag = atEntry->exploreFlag; else { - if (GridMap *gmap = const_cast<Map*>(this)->GetGrid(x, y)) + if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y)) areaflag = gmap->getArea(x, y); // this used while not all *.map files generated (instances) else @@ -1714,13 +1723,13 @@ uint16 Map::GetAreaFlag(float x, float y, float z, bool *isOutdoors) const uint8 Map::GetTerrainType(float x, float y) const { - if (GridMap *gmap = const_cast<Map*>(this)->GetGrid(x, y)) + if (GridMap* gmap = const_cast<Map*>(this)->GetGrid(x, y)) return gmap->getTerrainType(x, y); else return 0; } -ZLiquidStatus Map::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData *data) const +ZLiquidStatus Map::getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data) const { ZLiquidStatus result = LIQUID_MAP_NO_WATER; VMAP::IVMapManager* vmgr = VMAP::VMapFactory::createOrGetVMapManager(); @@ -1779,7 +1788,7 @@ float Map::GetWaterLevel(float x, float y) const uint32 Map::GetAreaIdByAreaFlag(uint16 areaflag, uint32 map_id) { - AreaTableEntry const *entry = GetAreaEntryByAreaFlagAndMap(areaflag, map_id); + AreaTableEntry const* entry = GetAreaEntryByAreaFlagAndMap(areaflag, map_id); if (entry) return entry->ID; @@ -1789,7 +1798,7 @@ uint32 Map::GetAreaIdByAreaFlag(uint16 areaflag, uint32 map_id) uint32 Map::GetZoneIdByAreaFlag(uint16 areaflag, uint32 map_id) { - AreaTableEntry const *entry = GetAreaEntryByAreaFlagAndMap(areaflag, map_id); + AreaTableEntry const* entry = GetAreaEntryByAreaFlagAndMap(areaflag, map_id); if (entry) return (entry->zone != 0) ? entry->zone : entry->ID; @@ -1799,19 +1808,19 @@ uint32 Map::GetZoneIdByAreaFlag(uint16 areaflag, uint32 map_id) void Map::GetZoneAndAreaIdByAreaFlag(uint32& zoneid, uint32& areaid, uint16 areaflag, uint32 map_id) { - AreaTableEntry const *entry = GetAreaEntryByAreaFlagAndMap(areaflag, map_id); + AreaTableEntry const* entry = GetAreaEntryByAreaFlagAndMap(areaflag, map_id); areaid = entry ? entry->ID : 0; zoneid = entry ? ((entry->zone != 0) ? entry->zone : entry->ID) : 0; } -bool Map::IsInWater(float x, float y, float pZ, LiquidData *data) const +bool Map::IsInWater(float x, float y, float pZ, LiquidData* data) const { // Check surface in x, y point for liquid if (const_cast<Map*>(this)->GetGrid(x, y)) { LiquidData liquid_status; - LiquidData *liquid_ptr = data ? data : &liquid_status; + LiquidData* liquid_ptr = data ? data : &liquid_status; if (getLiquidStatus(x, y, pZ, MAP_ALL_LIQUIDS, liquid_ptr)) return true; } @@ -1979,7 +1988,7 @@ void Map::DelayedUpdate(const uint32 t_diff) for (GridRefManager<NGridType>::iterator i = GridRefManager<NGridType>::begin(); i != GridRefManager<NGridType>::end();) { NGridType *grid = i->getSource(); - GridInfo *info = i->getSource()->getGridInfoRef(); + GridInfo* info = i->getSource()->getGridInfoRef(); ++i; // The update might delete the map and we need the next map before the iterator gets invalid ASSERT(grid->GetGridState() >= 0 && grid->GetGridState() < MAX_GRID_STATE); si_GridStates[grid->GetGridState()]->Update(*this, *grid, *info, grid->getX(), grid->getY(), t_diff); @@ -1987,7 +1996,7 @@ void Map::DelayedUpdate(const uint32 t_diff) } } -void Map::AddObjectToRemoveList(WorldObject *obj) +void Map::AddObjectToRemoveList(WorldObject* obj) { ASSERT(obj->GetMapId() == GetId() && obj->GetInstanceId() == GetInstanceId()); @@ -1997,7 +2006,7 @@ void Map::AddObjectToRemoveList(WorldObject *obj) //sLog->outDebug(LOG_FILTER_MAPS, "Object (GUID: %u TypeId: %u) added to removing list.", obj->GetGUIDLow(), obj->GetTypeId()); } -void Map::AddObjectToSwitchList(WorldObject *obj, bool on) +void Map::AddObjectToSwitchList(WorldObject* obj, bool on) { ASSERT(obj->GetMapId() == GetId() && obj->GetInstanceId() == GetInstanceId()); @@ -2015,7 +2024,7 @@ void Map::RemoveAllObjectsInRemoveList() while (!i_objectsToSwitch.empty()) { std::map<WorldObject*, bool>::iterator itr = i_objectsToSwitch.begin(); - WorldObject *obj = itr->first; + WorldObject* obj = itr->first; bool on = itr->second; i_objectsToSwitch.erase(itr); @@ -2167,15 +2176,15 @@ void Map::RemoveFromActive(Creature* c) } } -template void Map::Add(Corpse *); -template void Map::Add(Creature *); -template void Map::Add(GameObject *); -template void Map::Add(DynamicObject *); +template void Map::Add(Corpse* ); +template void Map::Add(Creature* ); +template void Map::Add(GameObject* ); +template void Map::Add(DynamicObject* ); -template void Map::Remove(Corpse *, bool); -template void Map::Remove(Creature *, bool); -template void Map::Remove(GameObject *, bool); -template void Map::Remove(DynamicObject *, bool); +template void Map::Remove(Corpse* , bool); +template void Map::Remove(Creature* , bool); +template void Map::Remove(GameObject* , bool); +template void Map::Remove(DynamicObject* , bool); /* ******* Dungeon Instance Maps ******* */ @@ -2231,7 +2240,7 @@ bool InstanceMap::CanEnter(Player* player) } // cannot enter while an encounter is in progress on raids - /*Group *pGroup = player->GetGroup(); + /*Group* pGroup = player->GetGroup(); if (!player->isGameMaster() && pGroup && pGroup->InCombatToInstance(GetInstanceId()) && player->GetMapId() != GetId())*/ if (IsRaid() && GetInstanceScript() && GetInstanceScript()->IsEncounterInProgress()) { @@ -2246,7 +2255,7 @@ bool InstanceMap::CanEnter(Player* player) if (!playerList.isEmpty()) for (PlayerList::const_iterator i = playerList.begin(); i != playerList.end(); ++i) - if (Player *iPlayer = i->getSource()) + if (Player* iPlayer = i->getSource()) { if (iPlayer->isGameMaster()) // bypass GMs continue; @@ -2292,7 +2301,7 @@ bool InstanceMap::Add(Player* player) player->AddInstanceEnterTime(GetInstanceId(), time(NULL)); // get or create an instance save for the map - InstanceSave *mapSave = sInstanceSaveMgr->GetInstanceSave(GetInstanceId()); + InstanceSave* mapSave = sInstanceSaveMgr->GetInstanceSave(GetInstanceId()); if (!mapSave) { sLog->outDetail("InstanceMap::Add: creating instance save for map %d spawnmode %d with instance id %d", GetId(), GetSpawnMode(), GetInstanceId()); @@ -2300,7 +2309,7 @@ bool InstanceMap::Add(Player* player) } // check for existing instance binds - InstancePlayerBind *playerBind = player->GetBoundInstance(GetId(), Difficulty(GetSpawnMode())); + InstancePlayerBind* playerBind = player->GetBoundInstance(GetId(), Difficulty(GetSpawnMode())); if (playerBind && playerBind->perm) { // cannot enter other instances if bound permanently @@ -2315,7 +2324,7 @@ bool InstanceMap::Add(Player* player) if (group) { // solo saves should be reset when entering a group - InstanceGroupBind *groupBind = group->GetBoundInstance(this); + InstanceGroupBind* groupBind = group->GetBoundInstance(this); if (playerBind) { sLog->outError("InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d, %d, %d, %d but he is in group %d and is bound to instance %d, %d, %d, %d, %d, %d!", player->GetName(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(group->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset()); @@ -2352,7 +2361,7 @@ bool InstanceMap::Add(Player* player) data << uint32(i_data ? i_data->GetCompletedEncounterMask() : 0); data << uint8(0); player->GetSession()->SendPacket(&data); - player->SetPendingBind(mapSave, 60000); + player->SetPendingBind(mapSave->GetInstanceId(), 60000); } } } @@ -2486,7 +2495,7 @@ void InstanceMap::PermBindAllPlayers(Player* player) if (!IsDungeon()) return; - InstanceSave *save = sInstanceSaveMgr->GetInstanceSave(GetInstanceId()); + InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(GetInstanceId()); if (!save) { sLog->outError("Cannot bind player (GUID: %u, Name: %s), because no instance save is available for instance map (Name: %s, Entry: %u, InstanceId: %u)!", player->GetGUIDLow(), player->GetName(), player->GetMap()->GetMapName(), player->GetMapId(), GetInstanceId()); @@ -2500,7 +2509,7 @@ void InstanceMap::PermBindAllPlayers(Player* player) Player* plr = itr->getSource(); // players inside an instance cannot be bound to other instances // some players may already be permanently bound, in this case nothing happens - InstancePlayerBind *bind = plr->GetBoundInstance(save->GetMapId(), save->GetDifficulty()); + InstancePlayerBind* bind = plr->GetBoundInstance(save->GetMapId(), save->GetDifficulty()); if (!bind || !bind->perm) { plr->BindToInstance(save, true); @@ -2538,7 +2547,7 @@ void InstanceMap::SetResetSchedule(bool on) // it is assumed that the reset time will rarely (if ever) change while the reset is scheduled if (IsDungeon() && !HavePlayers() && !IsRaidOrHeroicDungeon()) { - if (InstanceSave *save = sInstanceSaveMgr->GetInstanceSave(GetInstanceId())) + if (InstanceSave* save = sInstanceSaveMgr->GetInstanceSave(GetInstanceId())) sInstanceSaveMgr->ScheduleReset(on, save->GetResetTime(), InstanceSaveManager::InstResetEvent(0, GetId(), Difficulty(GetSpawnMode()), GetInstanceId())); else sLog->outError("InstanceMap::SetResetSchedule: cannot turn schedule %s, there is no save information for instance (map [id: %u, name: %s], instance id: %u, difficulty: %u)", diff --git a/src/server/game/Maps/Map.h b/src/server/game/Maps/Map.h index c778fe6ea5c..385f7abcaa5 100755 --- a/src/server/game/Maps/Map.h +++ b/src/server/game/Maps/Map.h @@ -168,9 +168,9 @@ class GridMap uint8 *m_liquid_type; float *m_liquid_map; - bool loadAreaData(FILE *in, uint32 offset, uint32 size); - bool loadHeihgtData(FILE *in, uint32 offset, uint32 size); - bool loadLiquidData(FILE *in, uint32 offset, uint32 size); + bool loadAreaData(FILE* in, uint32 offset, uint32 size); + bool loadHeihgtData(FILE* in, uint32 offset, uint32 size); + bool loadLiquidData(FILE* in, uint32 offset, uint32 size); // Get height functions and pointers typedef float (GridMap::*pGetHeightPtr) (float x, float y) const; @@ -190,7 +190,7 @@ public: inline float getHeight(float x, float y) {return (this->*m_gridGetHeight)(x, y);} float getLiquidLevel(float x, float y); uint8 getTerrainType(float x, float y); - ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData *data = 0); + ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = 0); }; struct CreatureMover @@ -254,8 +254,8 @@ class Map : public GridRefManager<NGridType> return false; } - virtual bool Add(Player *); - virtual void Remove(Player *, bool); + virtual bool Add(Player* ); + virtual void Remove(Player* , bool); template<class T> void Add(T *); template<class T> void Remove(T *, bool); @@ -266,8 +266,8 @@ class Map : public GridRefManager<NGridType> //function for setting up visibility distance for maps on per-type/per-Id basis virtual void InitVisibilityDistance(); - void PlayerRelocation(Player *, float x, float y, float z, float orientation); - void CreatureRelocation(Creature *creature, float x, float y, float z, float ang, bool respawnRelocationOnFail = true); + void PlayerRelocation(Player* , float x, float y, float z, float orientation); + void CreatureRelocation(Creature* creature, float x, float y, float z, float ang, bool respawnRelocationOnFail = true); template<class T, class CONTAINER> void Visit(const Cell& cell, TypeContainerVisitor<T, CONTAINER> &visitor); @@ -309,7 +309,7 @@ class Map : public GridRefManager<NGridType> // can return INVALID_HEIGHT if under z+2 z coord not found height float GetHeight(float x, float y, float z, bool pCheckVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const; - ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData *data = 0) const; + ZLiquidStatus getLiquidStatus(float x, float y, float z, uint8 ReqLiquidType, LiquidData* data = 0) const; uint16 GetAreaFlag(float x, float y, float z, bool *isOutdoors=0) const; bool GetAreaInfo(float x, float y, float z, uint32 &mogpflags, int32 &adtId, int32 &rootId, int32 &groupId) const; @@ -318,7 +318,7 @@ class Map : public GridRefManager<NGridType> uint8 GetTerrainType(float x, float y) const; float GetWaterLevel(float x, float y) const; - bool IsInWater(float x, float y, float z, LiquidData *data = 0) const; + bool IsInWater(float x, float y, float z, LiquidData* data = 0) const; bool IsUnderWater(float x, float y, float z) const; static uint32 GetAreaIdByAreaFlag(uint16 areaflag, uint32 map_id); @@ -344,7 +344,7 @@ class Map : public GridRefManager<NGridType> void RemoveAllObjectsInRemoveList(); virtual void RemoveAllPlayers(); - bool CreatureRespawnRelocation(Creature *c); // used only in MoveAllCreaturesInMoveList and ObjectGridUnloader + bool CreatureRespawnRelocation(Creature* c); // used only in MoveAllCreaturesInMoveList and ObjectGridUnloader // assert print helper bool CheckGridIntegrity(Creature* c, bool moved) const; @@ -376,8 +376,8 @@ class Map : public GridRefManager<NGridType> return i_mapEntry->GetEntrancePos(mapid, x, y); } - void AddObjectToRemoveList(WorldObject *obj); - void AddObjectToSwitchList(WorldObject *obj, bool on); + void AddObjectToRemoveList(WorldObject* obj); + void AddObjectToSwitchList(WorldObject* obj, bool on); virtual void DelayedUpdate(const uint32 diff); void UpdateObjectVisibility(WorldObject* obj, Cell cell, CellPair cellpair); @@ -391,8 +391,8 @@ class Map : public GridRefManager<NGridType> uint32 GetPlayersCountExceptGMs() const; bool ActiveObjectsNearGrid(uint32 x, uint32 y) const; - void AddWorldObject(WorldObject *obj) { i_worldObjects.insert(obj); } - void RemoveWorldObject(WorldObject *obj) { i_worldObjects.erase(obj); } + void AddWorldObject(WorldObject* obj) { i_worldObjects.insert(obj); } + void RemoveWorldObject(WorldObject* obj) { i_worldObjects.erase(obj); } void SendToPlayers(WorldPacket const* data) const; @@ -438,7 +438,7 @@ class Map : public GridRefManager<NGridType> void LoadMapAndVMap(int gx, int gy); void LoadVMap(int gx, int gy); void LoadMap(int gx, int gy, bool reload = false); - GridMap *GetGrid(float x, float y); + GridMap* GetGrid(float x, float y); void SetTimer(uint32 t) { i_gridExpiry = t < MIN_GRID_DELAY ? MIN_GRID_DELAY : t; } @@ -447,9 +447,9 @@ class Map : public GridRefManager<NGridType> void SendInitTransports(Player* player); void SendRemoveTransports(Player* player); - bool CreatureCellRelocation(Creature *creature, Cell new_cell); + bool CreatureCellRelocation(Creature* creature, Cell new_cell); - void AddCreatureToMoveList(Creature *c, float x, float y, float z, float ang); + void AddCreatureToMoveList(Creature* c, float x, float y, float z, float ang); CreatureMoveList i_creaturesToMove; bool loaded(const GridPair &) const; @@ -513,7 +513,7 @@ class Map : public GridRefManager<NGridType> Map* m_parentMap; NGridType* i_grids[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS]; - GridMap *GridMaps[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS]; + GridMap* GridMaps[MAX_NUMBER_OF_GRIDS][MAX_NUMBER_OF_GRIDS]; std::bitset<TOTAL_NUMBER_OF_CELLS_PER_MAP*TOTAL_NUMBER_OF_CELLS_PER_MAP> marked_cells; //these functions used to process player/mob aggro reactions and @@ -521,7 +521,7 @@ class Map : public GridRefManager<NGridType> void ProcessRelocationNotifies(const uint32 diff); bool i_scriptLock; - std::set<WorldObject *> i_objectsToRemove; + std::set<WorldObject*> i_objectsToRemove; std::map<WorldObject*, bool> i_objectsToSwitch; std::set<WorldObject*> i_worldObjects; @@ -577,8 +577,8 @@ class InstanceMap : public Map public: InstanceMap(uint32 id, time_t, uint32 InstanceId, uint8 SpawnMode, Map* _parent); ~InstanceMap(); - bool Add(Player *); - void Remove(Player *, bool); + bool Add(Player* ); + void Remove(Player* , bool); void Update(const uint32); void CreateInstanceData(bool load); bool Reset(uint8 method); @@ -607,8 +607,8 @@ class BattlegroundMap : public Map BattlegroundMap(uint32 id, time_t, uint32 InstanceId, Map* _parent, uint8 spawnMode); ~BattlegroundMap(); - bool Add(Player *); - void Remove(Player *, bool); + bool Add(Player* ); + void Remove(Player* , bool); bool CanEnter(Player* player); void SetUnload(); //void UnloadAll(bool pForce); diff --git a/src/server/game/Maps/MapInstanced.cpp b/src/server/game/Maps/MapInstanced.cpp index 24b16933000..88bfc9cdb69 100755 --- a/src/server/game/Maps/MapInstanced.cpp +++ b/src/server/game/Maps/MapInstanced.cpp @@ -130,14 +130,14 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player* player) } else { - InstancePlayerBind *pBind = player->GetBoundInstance(GetId(), player->GetDifficulty(IsRaid())); - InstanceSave *pSave = pBind ? pBind->save : NULL; + InstancePlayerBind* pBind = player->GetBoundInstance(GetId(), player->GetDifficulty(IsRaid())); + InstanceSave* pSave = pBind ? pBind->save : NULL; // the player's permanent player bind is taken into consideration first // then the player's group bind and finally the solo bind. if (!pBind || !pBind->perm) { - InstanceGroupBind *groupBind = NULL; + InstanceGroupBind* groupBind = NULL; Group* group = player->GetGroup(); // use the player's difficulty setting (it may not be the same as the group's) if (group) @@ -170,7 +170,7 @@ Map* MapInstanced::CreateInstance(const uint32 mapId, Player* player) return map; } -InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave *save, Difficulty difficulty) +InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave* save, Difficulty difficulty) { // load/create a map ACE_GUARD_RETURN(ACE_Thread_Mutex, Guard, Lock, NULL); @@ -182,7 +182,7 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave *save, sLog->outError("CreateInstance: no entry for map %d", GetId()); ASSERT(false); } - const InstanceTemplate * iTemplate = sObjectMgr->GetInstanceTemplate(GetId()); + const InstanceTemplate* iTemplate = sObjectMgr->GetInstanceTemplate(GetId()); if (!iTemplate) { sLog->outError("CreateInstance: no instance template for map %d", GetId()); @@ -194,7 +194,7 @@ InstanceMap* MapInstanced::CreateInstance(uint32 InstanceId, InstanceSave *save, sLog->outDebug(LOG_FILTER_MAPS, "MapInstanced::CreateInstance: %s map instance %d for %d created with difficulty %s", save?"":"new ", InstanceId, GetId(), difficulty?"heroic":"normal"); - InstanceMap *map = new InstanceMap(GetId(), GetGridExpiry(), InstanceId, difficulty, this); + InstanceMap* map = new InstanceMap(GetId(), GetGridExpiry(), InstanceId, difficulty, this); ASSERT(map->IsDungeon()); bool load_data = save != NULL; @@ -220,7 +220,7 @@ BattlegroundMap* MapInstanced::CreateBattleground(uint32 InstanceId, Battlegroun else spawnMode = REGULAR_DIFFICULTY; - BattlegroundMap *map = new BattlegroundMap(GetId(), GetGridExpiry(), InstanceId, this, spawnMode); + BattlegroundMap* map = new BattlegroundMap(GetId(), GetGridExpiry(), InstanceId, this, spawnMode); ASSERT(map->IsBattlegroundOrArena()); map->SetBG(bg); bg->SetBgMap(map); diff --git a/src/server/game/Maps/MapInstanced.h b/src/server/game/Maps/MapInstanced.h index 74874c99331..1913f0add51 100755 --- a/src/server/game/Maps/MapInstanced.h +++ b/src/server/game/Maps/MapInstanced.h @@ -27,7 +27,7 @@ class MapInstanced : public Map { friend class MapManager; public: - typedef UNORDERED_MAP< uint32, Map* > InstancedMaps; + typedef UNORDERED_MAP< uint32, Map*> InstancedMaps; MapInstanced(uint32 id, time_t expiry); ~MapInstanced() {} @@ -61,7 +61,7 @@ class MapInstanced : public Map private: - InstanceMap* CreateInstance(uint32 InstanceId, InstanceSave *save, Difficulty difficulty); + InstanceMap* CreateInstance(uint32 InstanceId, InstanceSave* save, Difficulty difficulty); BattlegroundMap* CreateBattleground(uint32 InstanceId, Battleground* bg); InstancedMaps m_InstancedMaps; diff --git a/src/server/game/Maps/MapManager.cpp b/src/server/game/Maps/MapManager.cpp index c26454701ed..0b9528e5760 100755 --- a/src/server/game/Maps/MapManager.cpp +++ b/src/server/game/Maps/MapManager.cpp @@ -97,7 +97,7 @@ void MapManager::checkAndCorrectGridStatesArray() Map* MapManager::_createBaseMap(uint32 id) { - Map *m = _findMap(id); + Map* m = _findMap(id); if (m == NULL) { @@ -123,7 +123,7 @@ Map* MapManager::CreateMap(uint32 id, const WorldObject* obj, uint32 /*instanceI { ASSERT(obj); //if (!obj->IsInWorld()) sLog->outError("GetMap: called for map %d with object (typeid %d, guid %d, mapid %d, instanceid %d) who is not in world!", id, obj->GetTypeId(), obj->GetGUIDLow(), obj->GetMapId(), obj->GetInstanceId()); - Map *m = _createBaseMap(id); + Map* m = _createBaseMap(id); if (m && (obj->GetTypeId() == TYPEID_PLAYER) && m->Instanceable()) m = ((MapInstanced*)m)->CreateInstance(id, (Player*)obj); @@ -132,7 +132,7 @@ Map* MapManager::CreateMap(uint32 id, const WorldObject* obj, uint32 /*instanceI Map* MapManager::FindMap(uint32 mapid, uint32 instanceId) const { - Map *map = _findMap(mapid); + Map* map = _findMap(mapid); if (!map) return NULL; @@ -213,6 +213,8 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player, bool loginCheck) return false; } sLog->outDebug(LOG_FILTER_MAPS, "MAP: Player '%s' has corpse in instance '%s' and can enter.", player->GetName(), mapName); + player->ResurrectPlayer(0.5f, false); + player->SpawnCorpseBones(); } else sLog->outDebug(LOG_FILTER_MAPS, "Map::CanPlayerEnter - player '%s' is dead but does not have a corpse!", player->GetName()); @@ -338,10 +340,10 @@ uint32 MapManager::GetNumInstances() uint32 ret = 0; for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr) { - Map *map = itr->second; + Map* map = itr->second; if (!map->Instanceable()) continue; - MapInstanced::InstancedMaps &maps = ((MapInstanced *)map)->GetInstancedMaps(); + MapInstanced::InstancedMaps &maps = ((MapInstanced* )map)->GetInstancedMaps(); for (MapInstanced::InstancedMaps::iterator mitr = maps.begin(); mitr != maps.end(); ++mitr) if (mitr->second->IsDungeon()) ret++; } @@ -355,10 +357,10 @@ uint32 MapManager::GetNumPlayersInInstances() uint32 ret = 0; for (MapMapType::iterator itr = i_maps.begin(); itr != i_maps.end(); ++itr) { - Map *map = itr->second; + Map* map = itr->second; if (!map->Instanceable()) continue; - MapInstanced::InstancedMaps &maps = ((MapInstanced *)map)->GetInstancedMaps(); + MapInstanced::InstancedMaps &maps = ((MapInstanced* )map)->GetInstancedMaps(); for (MapInstanced::InstancedMaps::iterator mitr = maps.begin(); mitr != maps.end(); ++mitr) if (mitr->second->IsDungeon()) ret += ((InstanceMap*)mitr->second)->GetPlayers().getSize(); diff --git a/src/server/game/Maps/MapManager.h b/src/server/game/Maps/MapManager.h index 0392c1f6579..926ff2c8051 100755 --- a/src/server/game/Maps/MapManager.h +++ b/src/server/game/Maps/MapManager.h @@ -124,7 +124,7 @@ class MapManager void LoadTransports(); void LoadTransportNPCs(); - typedef std::set<Transport *> TransportSet; + typedef std::set<Transport*> TransportSet; TransportSet m_Transports; typedef std::map<uint32, TransportSet> TransportMap; diff --git a/src/server/game/Maps/MapReference.h b/src/server/game/Maps/MapReference.h index ccd451bc8e9..1b939c329aa 100755 --- a/src/server/game/Maps/MapReference.h +++ b/src/server/game/Maps/MapReference.h @@ -44,10 +44,10 @@ class MapReference : public Reference<Map, Player> public: MapReference() : Reference<Map, Player>() {} ~MapReference() { unlink(); } - MapReference *next() { return (MapReference*)Reference<Map, Player>::next(); } - MapReference const *next() const { return (MapReference const*)Reference<Map, Player>::next(); } - MapReference *nockeck_prev() { return (MapReference*)Reference<Map, Player>::nocheck_prev(); } - MapReference const *nocheck_prev() const { return (MapReference const*)Reference<Map, Player>::nocheck_prev(); } + MapReference* next() { return (MapReference*)Reference<Map, Player>::next(); } + MapReference const* next() const { return (MapReference const*)Reference<Map, Player>::next(); } + MapReference* nockeck_prev() { return (MapReference*)Reference<Map, Player>::nocheck_prev(); } + MapReference const* nocheck_prev() const { return (MapReference const*)Reference<Map, Player>::nocheck_prev(); } }; #endif diff --git a/src/server/game/Miscellaneous/Formulas.h b/src/server/game/Miscellaneous/Formulas.h index cf59106103f..f562010549b 100755 --- a/src/server/game/Miscellaneous/Formulas.h +++ b/src/server/game/Miscellaneous/Formulas.h @@ -156,7 +156,7 @@ namespace Trinity return baseGain; } - inline uint32 Gain(Player *pl, Unit *u) + inline uint32 Gain(Player* pl, Unit* u) { uint32 gain; diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index 9e8a4b17f84..ce6d66c4026 100755 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -805,7 +805,9 @@ enum TrinityStrings LANG_ALLOW_TICKETS = 1134, LANG_DISALLOW_TICKETS = 1135, LANG_CHAR_NOT_BANNED = 1136, - // Room for more level 3 1137-1199 not used + LANG_DEV_ON = 1137, + LANG_DEV_OFF = 1138, + // Room for more level 3 1139-1199 not used // Debug commands LANG_CINEMATIC_NOT_EXIST = 1200, diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h index ca6315b94ca..f3857c07cee 100755 --- a/src/server/game/Miscellaneous/SharedDefines.h +++ b/src/server/game/Miscellaneous/SharedDefines.h @@ -2265,30 +2265,38 @@ enum CreatureFamily enum CreatureTypeFlags { - CREATURE_TYPEFLAGS_TAMEABLE = 0x000001, // Tameable by any hunter - CREATURE_TYPEFLAGS_GHOST = 0x000002, // Creature are also visible for not alive player. Allow gossip interaction if npcflag allow? - CREATURE_TYPEFLAGS_UNK3 = 0x000004, - CREATURE_TYPEFLAGS_UNK4 = 0x000008, - CREATURE_TYPEFLAGS_UNK5 = 0x000010, - CREATURE_TYPEFLAGS_UNK6 = 0x000020, - CREATURE_TYPEFLAGS_UNK7 = 0x000040, - CREATURE_TYPEFLAGS_DEAD_INTERACT = 0x000080, // Player can interact with the creature if its dead (not player dead) - CREATURE_TYPEFLAGS_HERBLOOT = 0x000100, // Can be looted by herbalist - CREATURE_TYPEFLAGS_MININGLOOT = 0x000200, // Can be looted by miner - CREATURE_TYPEFLAGS_UNK11 = 0x000400, - CREATURE_TYPEFLAGS_MOUNTED_COMBAT = 0x000800, // Creature can remain mounted when entering combat - CREATURE_TYPEFLAGS_AID_PLAYERS = 0x001000, // ? Can aid any player in combat if in range? - CREATURE_TYPEFLAGS_UNK14 = 0x002000, - CREATURE_TYPEFLAGS_UNK15 = 0x004000, // ? Possibly not in use - CREATURE_TYPEFLAGS_ENGINEERLOOT = 0x008000, // Can be looted by engineer - CREATURE_TYPEFLAGS_EXOTIC = 0x010000, // Can be tamed by hunter as exotic pet - CREATURE_TYPEFLAGS_UNK18 = 0x020000, // ? Related to vehicles/pvp? - CREATURE_TYPEFLAGS_UNK19 = 0x040000, // ? Related to vehicle/siege weapons? - CREATURE_TYPEFLAGS_UNK20 = 0x080000, - CREATURE_TYPEFLAGS_UNK21 = 0x100000, - CREATURE_TYPEFLAGS_UNK22 = 0x200000, - CREATURE_TYPEFLAGS_UNK23 = 0x400000, - CREATURE_TYPEFLAGS_UNK24 = 0x800000 // ? First seen in 3.2.2. Related to banner/backpack of creature/companion? + CREATURE_TYPEFLAGS_TAMEABLE = 0x00000001, // Tameable by any hunter + CREATURE_TYPEFLAGS_GHOST = 0x00000002, // Creature are also visible for not alive player. Allow gossip interaction if npcflag allow? + CREATURE_TYPEFLAGS_UNK2 = 0x00000004, + CREATURE_TYPEFLAGS_UNK3 = 0x00000008, + CREATURE_TYPEFLAGS_UNK4 = 0x00000010, + CREATURE_TYPEFLAGS_UNK5 = 0x00000020, + CREATURE_TYPEFLAGS_UNK6 = 0x00000040, + CREATURE_TYPEFLAGS_DEAD_INTERACT = 0x00000080, // Player can interact with the creature if its dead (not player dead) + CREATURE_TYPEFLAGS_HERBLOOT = 0x00000100, // Can be looted by herbalist + CREATURE_TYPEFLAGS_MININGLOOT = 0x00000200, // Can be looted by miner + CREATURE_TYPEFLAGS_UNK10 = 0x00000400, + CREATURE_TYPEFLAGS_MOUNTED_COMBAT = 0x00000800, // Creature can remain mounted when entering combat + CREATURE_TYPEFLAGS_AID_PLAYERS = 0x00001000, // ? Can aid any player in combat if in range? + CREATURE_TYPEFLAGS_UNK13 = 0x00002000, + CREATURE_TYPEFLAGS_UNK14 = 0x00004000, // ? Possibly not in use + CREATURE_TYPEFLAGS_ENGINEERLOOT = 0x00008000, // Can be looted by engineer + CREATURE_TYPEFLAGS_EXOTIC = 0x00010000, // Can be tamed by hunter as exotic pet + CREATURE_TYPEFLAGS_UNK17 = 0x00020000, // ? Related to vehicles/pvp? + CREATURE_TYPEFLAGS_UNK18 = 0x00040000, // ? Related to vehicle/siege weapons? + CREATURE_TYPEFLAGS_UNK19 = 0x00080000, + CREATURE_TYPEFLAGS_UNK20 = 0x00100000, + CREATURE_TYPEFLAGS_UNK21 = 0x00200000, + CREATURE_TYPEFLAGS_UNK22 = 0x00400000, + CREATURE_TYPEFLAGS_UNK23 = 0x00800000, // ? First seen in 3.2.2. Related to banner/backpack of creature/companion? + CREATURE_TYPEFLAGS_UNK24 = 0x01000000, + CREATURE_TYPEFLAGS_UNK25 = 0x02000000, + CREATURE_TYPEFLAGS_UNK26 = 0x04000000, + CREATURE_TYPEFLAGS_UNK27 = 0x08000000, + CREATURE_TYPEFLAGS_UNK28 = 0x10000000, + CREATURE_TYPEFLAGS_UNK29 = 0x20000000, + CREATURE_TYPEFLAGS_UNK30 = 0x40000000, + CREATURE_TYPEFLAGS_UNK31 = 0x80000000, }; enum CreatureEliteType diff --git a/src/server/game/Movement/DestinationHolder.h b/src/server/game/Movement/DestinationHolder.h index 3ef03e1864f..2b36fe471b8 100755 --- a/src/server/game/Movement/DestinationHolder.h +++ b/src/server/game/Movement/DestinationHolder.h @@ -53,7 +53,7 @@ class DestinationHolder bool HasArrived(void) const { return (i_totalTravelTime == 0 || i_timeElapsed >= i_totalTravelTime); } bool UpdateTraveller(TRAVELLER &traveller, uint32 diff, bool micro_movement=false); uint32 StartTravel(TRAVELLER &traveller, bool sendMove = true); - void GetLocationNow(const Map * map, float &x, float &y, float &z, bool is3D = false) const; + void GetLocationNow(const Map* map, float &x, float &y, float &z, bool is3D = false) const; void GetLocationNowNoMicroMovement(float &x, float &y, float &z) const; // For use without micro movement float GetDistance3dFromDestSq(const WorldObject &obj) const; diff --git a/src/server/game/Movement/DestinationHolderImp.h b/src/server/game/Movement/DestinationHolderImp.h index fac415a27a5..f1e815c093e 100755 --- a/src/server/game/Movement/DestinationHolderImp.h +++ b/src/server/game/Movement/DestinationHolderImp.h @@ -143,7 +143,7 @@ DestinationHolder<TRAVELLER>::UpdateTraveller(TRAVELLER &traveller, uint32 diff, template<typename TRAVELLER> void -DestinationHolder<TRAVELLER>::GetLocationNow(const Map * map, float &x, float &y, float &z, bool is3D) const +DestinationHolder<TRAVELLER>::GetLocationNow(const Map* map, float &x, float &y, float &z, bool is3D) const { if (HasArrived()) { diff --git a/src/server/game/Movement/MotionMaster.h b/src/server/game/Movement/MotionMaster.h index 1455493846e..b6fd3a848ac 100755 --- a/src/server/game/Movement/MotionMaster.h +++ b/src/server/game/Movement/MotionMaster.h @@ -94,7 +94,7 @@ class MotionMaster //: private std::stack<MovementGenerator *> void InitTop(); public: - explicit MotionMaster(Unit *unit) : i_top(-1), i_owner(unit), m_expList(NULL), m_cleanFlag(MMCF_NONE) + explicit MotionMaster(Unit* unit) : i_top(-1), i_owner(unit), m_expList(NULL), m_cleanFlag(MMCF_NONE) { for (uint8 i = 0; i < MAX_MOTION_SLOT; ++i) { @@ -185,7 +185,7 @@ class MotionMaster //: private std::stack<MovementGenerator *> void DelayedExpire(); Unit *i_owner; - ExpireList *m_expList; + ExpireList* m_expList; uint8 m_cleanFlag; }; #endif diff --git a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp index 29957785830..00fc3dde11f 100755 --- a/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/FleeingMovementGenerator.cpp @@ -76,7 +76,7 @@ FleeingMovementGenerator<T>::_getPoint(T &owner, float &x, float &y, float &z) z = owner.GetPositionZ(); float temp_x, temp_y, angle = 0; - const Map * _map = owner.GetBaseMap(); + const Map* _map = owner.GetBaseMap(); //primitive path-finding for (uint8 i = 0; i < 18; ++i) { diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index dc3c805d59c..4ad2f0638d0 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -345,7 +345,7 @@ void FlightPathMovementGenerator::InitEndGridInfo() void FlightPathMovementGenerator::PreloadEndGrid() { // used to preload the final grid where the flightmaster is - Map *endMap = sMapMgr->FindMap(m_endMapId); + Map* endMap = sMapMgr->FindMap(m_endMapId); // Load the grid if (endMap) diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h index a1a131f9f6a..ea277eaafc6 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.h @@ -82,7 +82,7 @@ class WaypointMovementGenerator MovementGeneratorType GetMovementGeneratorType() { return WAYPOINT_MOTION_TYPE; } private: - WaypointData *node; + WaypointData* node; uint32 path_id; TimeTrackerSmall i_nextMoveTime; WaypointPath const* waypoints; diff --git a/src/server/game/Movement/Waypoints/WaypointManager.cpp b/src/server/game/Movement/Waypoints/WaypointManager.cpp index 869a594415e..0ce2a097422 100755 --- a/src/server/game/Movement/Waypoints/WaypointManager.cpp +++ b/src/server/game/Movement/Waypoints/WaypointManager.cpp @@ -107,7 +107,7 @@ void WaypointMgr::ReloadPath(uint32 id) do { Field* fields = result->Fetch(); - WaypointData *wp = new WaypointData(); + WaypointData* wp = new WaypointData(); float x = fields[1].GetFloat(); float y = fields[2].GetFloat(); diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index 0bd4344c83b..a4432d7ca19 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -29,7 +29,7 @@ #include "GridNotifiersImpl.h" #include "CellImpl.h" -OPvPCapturePoint::OPvPCapturePoint(OutdoorPvP * pvp): +OPvPCapturePoint::OPvPCapturePoint(OutdoorPvP* pvp): m_capturePointGUID(0), m_capturePoint(NULL), m_maxValue(0), m_maxSpeed(0), m_value(0), m_team(TEAM_NEUTRAL), m_OldState(OBJECTIVESTATE_NEUTRAL), m_State(OBJECTIVESTATE_NEUTRAL), m_neutralValuePct(0), m_PvP(pvp) @@ -71,7 +71,7 @@ void OPvPCapturePoint::AddGO(uint32 type, uint32 guid, uint32 entry) { if (!entry) { - const GameObjectData *data = sObjectMgr->GetGOData(guid); + const GameObjectData* data = sObjectMgr->GetGOData(guid); if (!data) return; entry = data->id; @@ -84,7 +84,7 @@ void OPvPCapturePoint::AddCre(uint32 type, uint32 guid, uint32 entry) { if (!entry) { - const CreatureData *data = sObjectMgr->GetCreatureData(guid); + const CreatureData* data = sObjectMgr->GetCreatureData(guid); if (!data) return; entry = data->id; @@ -148,7 +148,7 @@ bool OPvPCapturePoint::DelCreature(uint32 type) return false; } - Creature *cr = HashMapHolder<Creature>::Find(m_Creatures[type]); + Creature* cr = HashMapHolder<Creature>::Find(m_Creatures[type]); if (!cr) { // can happen when closing the core @@ -163,7 +163,7 @@ bool OPvPCapturePoint::DelCreature(uint32 type) // explicit removal from map // beats me why this is needed, but with the recent removal "cleanup" some creatures stay in the map if "properly" deleted // so this is a big fat workaround, if AddObjectToRemoveList and DoDelayedMovesAndRemoves worked correctly, this wouldn't be needed - //if (Map * map = sMapMgr->FindMap(cr->GetMapId())) + //if (Map* map = sMapMgr->FindMap(cr->GetMapId())) // map->Remove(cr, false); // delete respawn time for this creature PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CREATURE_RESPAWN_BY_GUID); @@ -182,7 +182,7 @@ bool OPvPCapturePoint::DelObject(uint32 type) if (!m_Objects[type]) return false; - GameObject *obj = HashMapHolder<GameObject>::Find(m_Objects[type]); + GameObject* obj = HashMapHolder<GameObject>::Find(m_Objects[type]); if (!obj) { m_Objects[type] = 0; @@ -432,11 +432,11 @@ void OPvPCapturePoint::SendObjectiveComplete(uint32 id, uint64 guid) void OutdoorPvP::HandleKill(Player* killer, Unit* killed) { - if (Group * pGroup = killer->GetGroup()) + if (Group* pGroup = killer->GetGroup()) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { - Player *pGroupGuy = itr->getSource(); + Player* pGroupGuy = itr->getSource(); if (!pGroupGuy) continue; @@ -463,7 +463,7 @@ void OutdoorPvP::HandleKill(Player* killer, Unit* killed) } } -bool OutdoorPvP::IsInsideObjective(Player *plr) const +bool OutdoorPvP::IsInsideObjective(Player* plr) const { for (OPvPCapturePointMap::const_iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) if (itr->second->IsInsideObjective(plr)) @@ -472,12 +472,12 @@ bool OutdoorPvP::IsInsideObjective(Player *plr) const return false; } -bool OPvPCapturePoint::IsInsideObjective(Player *plr) const +bool OPvPCapturePoint::IsInsideObjective(Player* plr) const { return m_activePlayers[plr->GetTeamId()].find(plr) != m_activePlayers[plr->GetTeamId()].end(); } -bool OutdoorPvP::HandleCustomSpell(Player *plr, uint32 spellId, GameObject* go) +bool OutdoorPvP::HandleCustomSpell(Player* plr, uint32 spellId, GameObject* go) { for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) if (itr->second->HandleCustomSpell(plr, spellId, go)) @@ -486,14 +486,14 @@ bool OutdoorPvP::HandleCustomSpell(Player *plr, uint32 spellId, GameObject* go) return false; } -bool OPvPCapturePoint::HandleCustomSpell(Player *plr, uint32 /*spellId*/, GameObject* /*go*/) +bool OPvPCapturePoint::HandleCustomSpell(Player* plr, uint32 /*spellId*/, GameObject* /*go*/) { if (!plr->IsOutdoorPvPActive()) return false; return false; } -bool OutdoorPvP::HandleOpenGo(Player *plr, uint64 guid) +bool OutdoorPvP::HandleOpenGo(Player* plr, uint64 guid) { for (OPvPCapturePointMap::iterator itr = m_capturePoints.begin(); itr != m_capturePoints.end(); ++itr) if (itr->second->HandleOpenGo(plr, guid) >= 0) @@ -572,7 +572,7 @@ void OutdoorPvP::RegisterZone(uint32 zoneId) sOutdoorPvPMgr->AddZone(zoneId, this); } -bool OutdoorPvP::HasPlayer(Player *plr) const +bool OutdoorPvP::HasPlayer(Player* plr) const { return m_players[plr->GetTeamId()].find(plr) != m_players[plr->GetTeamId()].end(); } @@ -593,7 +593,7 @@ void OutdoorPvP::TeamApplyBuff(TeamId team, uint32 spellId, uint32 spellId2) TeamCastSpell(OTHER_TEAM(team), spellId2 ? -(int32)spellId2 : -(int32)spellId); } -void OutdoorPvP::OnGameObjectCreate(GameObject *go) +void OutdoorPvP::OnGameObjectCreate(GameObject* go) { if (go->GetGoType() != GAMEOBJECT_TYPE_CAPTURE_POINT) return; @@ -602,7 +602,7 @@ void OutdoorPvP::OnGameObjectCreate(GameObject *go) cp->m_capturePoint = go; } -void OutdoorPvP::OnGameObjectRemove(GameObject *go) +void OutdoorPvP::OnGameObjectRemove(GameObject* go) { if (go->GetGoType() != GAMEOBJECT_TYPE_CAPTURE_POINT) return; diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.h b/src/server/game/OutdoorPvP/OutdoorPvP.h index e3cb9ee5c17..8924ce8acbb 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvP.h +++ b/src/server/game/OutdoorPvP/OutdoorPvP.h @@ -91,7 +91,7 @@ class OPvPCapturePoint { public: - OPvPCapturePoint(OutdoorPvP * pvp); + OPvPCapturePoint(OutdoorPvP* pvp); virtual ~OPvPCapturePoint() {} @@ -110,9 +110,9 @@ class OPvPCapturePoint // checks if player is in range of a capture credit marker bool IsInsideObjective(Player* plr) const; - virtual bool HandleCustomSpell(Player *plr, uint32 spellId, GameObject* go); + virtual bool HandleCustomSpell(Player* plr, uint32 spellId, GameObject* go); - virtual int32 HandleOpenGo(Player *plr, uint64 guid); + virtual int32 HandleOpenGo(Player* plr, uint64 guid); // returns true if the state of the objective has changed, in this case, the OutdoorPvP must send a world state ui update. virtual bool Update(uint32 diff); @@ -123,7 +123,7 @@ class OPvPCapturePoint virtual void SendChangePhase(); - virtual bool HandleGossipOption(Player *plr, uint64 guid, uint32 gossipid); + virtual bool HandleGossipOption(Player* plr, uint64 guid, uint32 gossipid); virtual bool CanTalkTo(Player* plr, Creature* c, GossipMenuItems const& gso); @@ -133,7 +133,7 @@ class OPvPCapturePoint uint32 m_capturePointGUID; - GameObject *m_capturePoint; + GameObject* m_capturePoint; void AddGO(uint32 type, uint32 guid, uint32 entry = 0); void AddCre(uint32 type, uint32 guid, uint32 entry = 0); @@ -211,17 +211,17 @@ class OutdoorPvP : public ZoneScript virtual bool HandleAreaTrigger(Player* plr, uint32 trigger); // called on custom spell - virtual bool HandleCustomSpell(Player *plr, uint32 spellId, GameObject* go); + virtual bool HandleCustomSpell(Player* plr, uint32 spellId, GameObject* go); // called on go use - virtual bool HandleOpenGo(Player *plr, uint64 guid); + virtual bool HandleOpenGo(Player* plr, uint64 guid); // setup stuff virtual bool SetupOutdoorPvP() {return true;} - void OnGameObjectCreate(GameObject *go); - void OnGameObjectRemove(GameObject *go); - void OnCreatureCreate(Creature *) {} + void OnGameObjectCreate(GameObject* go); + void OnGameObjectRemove(GameObject* go); + void OnCreatureCreate(Creature* ) {} // send world state update to all players present void SendUpdateWorldState(uint32 field, uint32 value); @@ -243,7 +243,7 @@ class OutdoorPvP : public ZoneScript virtual bool HandleDropFlag(Player* plr, uint32 spellId); - virtual bool HandleGossipOption(Player *plr, uint64 guid, uint32 gossipid); + virtual bool HandleGossipOption(Player* plr, uint64 guid, uint32 gossipid); virtual bool CanTalkTo(Player* plr, Creature* c, GossipMenuItems const& gso); @@ -285,7 +285,7 @@ class OutdoorPvP : public ZoneScript void RegisterZone(uint32 zoneid); - bool HasPlayer(Player *plr) const; + bool HasPlayer(Player* plr) const; void TeamCastSpell(TeamId team, int32 spellId); }; diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp index 11675edd3ff..dda0e7bcb61 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.cpp @@ -56,11 +56,11 @@ void OutdoorPvPMgr::InitOutdoorPvP() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); typeId = fields[0].GetUInt32(); - if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_OUTDOORPVP, typeId, NULL)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_OUTDOORPVP, typeId, NULL)) continue; if (typeId >= MAX_OUTDOORPVP_TYPES) @@ -110,12 +110,12 @@ void OutdoorPvPMgr::InitOutdoorPvP() sLog->outString(); } -void OutdoorPvPMgr::AddZone(uint32 zoneid, OutdoorPvP *handle) +void OutdoorPvPMgr::AddZone(uint32 zoneid, OutdoorPvP* handle) { m_OutdoorPvPMap[zoneid] = handle; } -void OutdoorPvPMgr::HandlePlayerEnterZone(Player *plr, uint32 zoneid) +void OutdoorPvPMgr::HandlePlayerEnterZone(Player* plr, uint32 zoneid) { OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid); if (itr == m_OutdoorPvPMap.end()) @@ -128,7 +128,7 @@ void OutdoorPvPMgr::HandlePlayerEnterZone(Player *plr, uint32 zoneid) sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %u entered outdoorpvp id %u", plr->GetGUIDLow(), itr->second->GetTypeId()); } -void OutdoorPvPMgr::HandlePlayerLeaveZone(Player *plr, uint32 zoneid) +void OutdoorPvPMgr::HandlePlayerLeaveZone(Player* plr, uint32 zoneid) { OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid); if (itr == m_OutdoorPvPMap.end()) @@ -142,7 +142,7 @@ void OutdoorPvPMgr::HandlePlayerLeaveZone(Player *plr, uint32 zoneid) sLog->outDebug(LOG_FILTER_OUTDOORPVP, "Player %u left outdoorpvp id %u", plr->GetGUIDLow(), itr->second->GetTypeId()); } -OutdoorPvP * OutdoorPvPMgr::GetOutdoorPvPToZoneId(uint32 zoneid) +OutdoorPvP* OutdoorPvPMgr::GetOutdoorPvPToZoneId(uint32 zoneid) { OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid); if (itr == m_OutdoorPvPMap.end()) @@ -164,7 +164,7 @@ void OutdoorPvPMgr::Update(uint32 diff) } } -bool OutdoorPvPMgr::HandleCustomSpell(Player *plr, uint32 spellId, GameObject* go) +bool OutdoorPvPMgr::HandleCustomSpell(Player* plr, uint32 spellId, GameObject* go) { for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr) { @@ -174,7 +174,7 @@ bool OutdoorPvPMgr::HandleCustomSpell(Player *plr, uint32 spellId, GameObject* g return false; } -ZoneScript * OutdoorPvPMgr::GetZoneScript(uint32 zoneId) +ZoneScript* OutdoorPvPMgr::GetZoneScript(uint32 zoneId) { OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneId); if (itr != m_OutdoorPvPMap.end()) @@ -183,7 +183,7 @@ ZoneScript * OutdoorPvPMgr::GetZoneScript(uint32 zoneId) return NULL; } -bool OutdoorPvPMgr::HandleOpenGo(Player *plr, uint64 guid) +bool OutdoorPvPMgr::HandleOpenGo(Player* plr, uint64 guid) { for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr) { @@ -193,7 +193,7 @@ bool OutdoorPvPMgr::HandleOpenGo(Player *plr, uint64 guid) return false; } -void OutdoorPvPMgr::HandleGossipOption(Player *plr, uint64 guid, uint32 gossipid) +void OutdoorPvPMgr::HandleGossipOption(Player* plr, uint64 guid, uint32 gossipid) { for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr) { @@ -212,7 +212,7 @@ bool OutdoorPvPMgr::CanTalkTo(Player* player, Creature* creature, GossipMenuItem return false; } -void OutdoorPvPMgr::HandleDropFlag(Player *plr, uint32 spellId) +void OutdoorPvPMgr::HandleDropFlag(Player* plr, uint32 spellId) { for (OutdoorPvPSet::iterator itr = m_OutdoorPvPSet.begin(); itr != m_OutdoorPvPSet.end(); ++itr) { @@ -221,7 +221,7 @@ void OutdoorPvPMgr::HandleDropFlag(Player *plr, uint32 spellId) } } -void OutdoorPvPMgr::HandlePlayerResurrects(Player *plr, uint32 zoneid) +void OutdoorPvPMgr::HandlePlayerResurrects(Player* plr, uint32 zoneid) { OutdoorPvPMap::iterator itr = m_OutdoorPvPMap.find(zoneid); if (itr == m_OutdoorPvPMap.end()) diff --git a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h index 00b89527349..85df2c37aa7 100755 --- a/src/server/game/OutdoorPvP/OutdoorPvPMgr.h +++ b/src/server/game/OutdoorPvP/OutdoorPvPMgr.h @@ -59,7 +59,7 @@ class OutdoorPvPMgr void HandlePlayerResurrects(Player* plr, uint32 areaflag); // return assigned outdoor pvp - OutdoorPvP * GetOutdoorPvPToZoneId(uint32 zoneid); + OutdoorPvP* GetOutdoorPvPToZoneId(uint32 zoneid); // handle custom (non-exist in dbc) spell if registered bool HandleCustomSpell(Player* plr, uint32 spellId, GameObject* go); @@ -67,9 +67,9 @@ class OutdoorPvPMgr // handle custom go if registered bool HandleOpenGo(Player* plr, uint64 guid); - ZoneScript * GetZoneScript(uint32 zoneId); + ZoneScript* GetZoneScript(uint32 zoneId); - void AddZone(uint32 zoneid, OutdoorPvP * handle); + void AddZone(uint32 zoneid, OutdoorPvP* handle); void Update(uint32 diff); diff --git a/src/server/game/Pools/PoolMgr.cpp b/src/server/game/Pools/PoolMgr.cpp index e77639060aa..c5d2deef376 100755 --- a/src/server/game/Pools/PoolMgr.cpp +++ b/src/server/game/Pools/PoolMgr.cpp @@ -476,10 +476,9 @@ void PoolGroup<Quest>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint32 { do { - ActivePoolObjects::iterator itr = currentQuests.begin(); - std::advance(itr, urand(0, currentQuests.size()-1)); - newQuests.insert(*itr); - currentQuests.erase(*itr); + uint32 questId = SelectRandomContainerElement(currentQuests); + newQuests.insert(questId); + currentQuests.erase(questId); } while (newQuests.size() < limit && !currentQuests.empty()); // failsafe } @@ -489,12 +488,11 @@ void PoolGroup<Quest>::SpawnObject(ActivePoolData& spawns, uint32 limit, uint32 // activate <limit> random quests do { - ActivePoolObjects::iterator itr = newQuests.begin(); - std::advance(itr, urand(0, newQuests.size()-1)); - spawns.ActivateObject<Quest>(*itr, poolId); - PoolObject tempObj(*itr, 0.0f); + uint32 questId = SelectRandomContainerElement(newQuests); + spawns.ActivateObject<Quest>(questId, poolId); + PoolObject tempObj(questId, 0.0f); Spawn1Object(&tempObj); - newQuests.erase(itr); + newQuests.erase(questId); --limit; } while (limit && !newQuests.empty()); @@ -545,7 +543,7 @@ void PoolMgr::Initialize() QueryResult result = WorldDatabase.Query("SELECT MAX(entry) FROM pool_template"); if (result) { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); max_pool_id = fields[0].GetUInt32(); } @@ -578,7 +576,7 @@ void PoolMgr::LoadFromDB() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 pool_id = fields[0].GetUInt32(); @@ -612,7 +610,7 @@ void PoolMgr::LoadFromDB() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); uint32 pool_id = fields[1].GetUInt32(); @@ -634,7 +632,7 @@ void PoolMgr::LoadFromDB() sLog->outErrorDb("`pool_creature` has an invalid chance (%f) for creature guid (%u) in pool id (%u), skipped.", chance, guid, pool_id); continue; } - PoolTemplateData *pPoolTemplate = &mPoolTemplate[pool_id]; + PoolTemplateData* pPoolTemplate = &mPoolTemplate[pool_id]; PoolObject plObject = PoolObject(guid, chance); PoolGroup<Creature>& cregroup = mPoolCreatureGroups[pool_id]; cregroup.SetPoolId(pool_id); @@ -670,7 +668,7 @@ void PoolMgr::LoadFromDB() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); uint32 pool_id = fields[1].GetUInt32(); @@ -704,7 +702,7 @@ void PoolMgr::LoadFromDB() continue; } - PoolTemplateData *pPoolTemplate = &mPoolTemplate[pool_id]; + PoolTemplateData* pPoolTemplate = &mPoolTemplate[pool_id]; PoolObject plObject = PoolObject(guid, chance); PoolGroup<GameObject>& gogroup = mPoolGameobjectGroups[pool_id]; gogroup.SetPoolId(pool_id); @@ -740,7 +738,7 @@ void PoolMgr::LoadFromDB() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 child_pool_id = fields[0].GetUInt32(); uint32 mother_pool_id = fields[1].GetUInt32(); @@ -766,7 +764,7 @@ void PoolMgr::LoadFromDB() sLog->outErrorDb("`pool_pool` has an invalid chance (%f) for pool id (%u) in mother pool id (%u), skipped.", chance, child_pool_id, mother_pool_id); continue; } - PoolTemplateData *pPoolTemplateMother = &mPoolTemplate[mother_pool_id]; + PoolTemplateData* pPoolTemplateMother = &mPoolTemplate[mother_pool_id]; PoolObject plObject = PoolObject(child_pool_id, chance); PoolGroup<Pool>& plgroup = mPoolPoolGroups[mother_pool_id]; plgroup.SetPoolId(mother_pool_id); @@ -880,7 +878,7 @@ void PoolMgr::LoadFromDB() continue; } - PoolTemplateData *pPoolTemplate = &mPoolTemplate[pool_id]; + PoolTemplateData* pPoolTemplate = &mPoolTemplate[pool_id]; PoolObject plObject = PoolObject(entry, 0.0f); PoolGroup<Quest>& questgroup = mPoolQuestGroups[pool_id]; questgroup.SetPoolId(pool_id); @@ -916,7 +914,7 @@ void PoolMgr::LoadFromDB() uint32 count = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 pool_entry = fields[0].GetUInt32(); uint32 pool_pool_id = fields[1].GetUInt32(); diff --git a/src/server/game/Quests/QuestDef.cpp b/src/server/game/Quests/QuestDef.cpp index 50fb0e452fb..22251ac0bd8 100755 --- a/src/server/game/Quests/QuestDef.cpp +++ b/src/server/game/Quests/QuestDef.cpp @@ -20,7 +20,7 @@ #include "Player.h" #include "World.h" -Quest::Quest(Field * questRecord) +Quest::Quest(Field* questRecord) { QuestId = questRecord[0].GetUInt32(); QuestMethod = questRecord[1].GetUInt32(); @@ -166,12 +166,12 @@ Quest::Quest(Field * questRecord) ++m_rewchoiceitemscount; } -uint32 Quest::XPValue(Player *pPlayer) const +uint32 Quest::XPValue(Player* pPlayer) const { if (pPlayer) { int32 quest_level = (QuestLevel == -1 ? pPlayer->getLevel() : QuestLevel); - const QuestXPEntry *xpentry = sQuestXPStore.LookupEntry(quest_level); + const QuestXPEntry* xpentry = sQuestXPStore.LookupEntry(quest_level); if (!xpentry) return 0; diff --git a/src/server/game/Quests/QuestDef.h b/src/server/game/Quests/QuestDef.h index 9c5e6b54440..8c415749d6b 100755 --- a/src/server/game/Quests/QuestDef.h +++ b/src/server/game/Quests/QuestDef.h @@ -40,6 +40,7 @@ class ObjectMgr; #define QUEST_DEPLINK_COUNT 10 #define QUEST_REPUTATIONS_COUNT 5 #define QUEST_EMOTE_COUNT 4 +#define QUEST_PVP_KILL_SLOT 0 enum QuestFailedReasons { @@ -157,6 +158,7 @@ enum __QuestFlags QUEST_TRINITY_FLAGS_SPEAKTO = 0x08000000, // Internal flag computed only QUEST_TRINITY_FLAGS_KILL_OR_CAST = 0x10000000, // Internal flag computed only QUEST_TRINITY_FLAGS_TIMED = 0x20000000, // Internal flag computed only + QUEST_TRINITY_FLAGS_PLAYER_KILL = 0x40000000, // Internal flag computed only }; struct QuestLocale @@ -180,8 +182,8 @@ class Quest { friend class ObjectMgr; public: - Quest(Field * questRecord); - uint32 XPValue(Player *pPlayer) const; + Quest(Field* questRecord); + uint32 XPValue(Player* pPlayer) const; bool HasFlag(uint32 flag) const { return (QuestFlags & flag) != 0; } void SetFlag(uint32 flag) { QuestFlags |= flag; } @@ -355,7 +357,7 @@ class Quest struct QuestStatusData { - QuestStatusData(): m_status(QUEST_STATUS_NONE), m_explored(false), m_timer(0) + QuestStatusData(): m_status(QUEST_STATUS_NONE), m_explored(false), m_timer(0), m_playercount(0) { memset(m_itemcount, 0, QUEST_ITEM_OBJECTIVES_COUNT * sizeof(uint16)); memset(m_creatureOrGOcount, 0, QUEST_OBJECTIVES_COUNT * sizeof(uint16)); @@ -366,5 +368,6 @@ struct QuestStatusData uint32 m_timer; uint16 m_itemcount[QUEST_ITEM_OBJECTIVES_COUNT]; uint16 m_creatureOrGOcount[QUEST_OBJECTIVES_COUNT]; + uint16 m_playercount; }; #endif diff --git a/src/server/game/Reputation/ReputationMgr.cpp b/src/server/game/Reputation/ReputationMgr.cpp index e285f5e1589..2f849116f81 100755 --- a/src/server/game/Reputation/ReputationMgr.cpp +++ b/src/server/game/Reputation/ReputationMgr.cpp @@ -39,9 +39,32 @@ ReputationRank ReputationMgr::ReputationToRank(int32 standing) return MIN_REPUTATION_RANK; } +bool ReputationMgr::IsAtWar(uint32 faction_id) const +{ + FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id); + + if (!factionEntry) + { + sLog->outError("ReputationMgr::IsAtWar: Can't get AtWar flag of %s for unknown faction (faction id) #%u.", m_player->GetName(), faction_id); + return 0; + } + + return IsAtWar(factionEntry); +} + +bool ReputationMgr::IsAtWar(FactionEntry const* factionEntry) const +{ + if (!factionEntry) + return false; + + if (FactionState const* factionState = GetState(factionEntry)) + return (factionState->Flags & FACTION_FLAG_AT_WAR); + return false; +} + int32 ReputationMgr::GetReputation(uint32 faction_id) const { - FactionEntry const *factionEntry = sFactionStore.LookupEntry(faction_id); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(faction_id); if (!factionEntry) { @@ -233,7 +256,7 @@ void ReputationMgr::Initialize() for (unsigned int i = 1; i < sFactionStore.GetNumRows(); i++) { - FactionEntry const *factionEntry = sFactionStore.LookupEntry(i); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(i); if (factionEntry && (factionEntry->reputationListID >= 0)) { @@ -260,7 +283,7 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi sScriptMgr->OnPlayerReputationChange(m_player, factionEntry->ID, standing, incremental); bool res = false; // if spillover definition exists in DB, override DBC - if (const RepSpilloverTemplate *repTemplate = sObjectMgr->GetRepSpilloverTemplate(factionEntry->ID)) + if (const RepSpilloverTemplate* repTemplate = sObjectMgr->GetRepSpilloverTemplate(factionEntry->ID)) { for (uint32 i = 0; i < MAX_SPILLOVER_FACTIONS; ++i) { @@ -284,7 +307,7 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi if (!flist && factionEntry->team && factionEntry->spilloverRateOut != 0.0f) { spillOverRepOut *= factionEntry->spilloverRateOut; - if (FactionEntry const *parent = sFactionStore.LookupEntry(factionEntry->team)) + if (FactionEntry const* parent = sFactionStore.LookupEntry(factionEntry->team)) { FactionStateList::iterator parentState = m_factions.find(parent->reputationListID); // some team factions have own reputation standing, in this case do not spill to other sub-factions @@ -303,7 +326,7 @@ bool ReputationMgr::SetReputation(FactionEntry const* factionEntry, int32 standi // Spillover to affiliated factions for (SimpleFactionsList::const_iterator itr = flist->begin(); itr != flist->end(); ++itr) { - if (FactionEntry const *factionEntryCalc = sFactionStore.LookupEntry(*itr)) + if (FactionEntry const* factionEntryCalc = sFactionStore.LookupEntry(*itr)) { if (factionEntryCalc == factionEntry || GetRank(factionEntryCalc) > ReputationRank(factionEntryCalc->spilloverMaxRankIn)) continue; @@ -375,13 +398,13 @@ void ReputationMgr::SetVisible(FactionTemplateEntry const*factionTemplateEntry) if (!factionTemplateEntry->faction) return; - if (FactionEntry const *factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction)) + if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction)) // Never show factions of the opposing team if (!(factionEntry->BaseRepRaceMask[1] & m_player->getRaceMask() && factionEntry->BaseRepValue[1] == Reputation_Bottom)) SetVisible(factionEntry); } -void ReputationMgr::SetVisible(FactionEntry const *factionEntry) +void ReputationMgr::SetVisible(FactionEntry const* factionEntry) { if (factionEntry->reputationListID < 0) return; @@ -478,7 +501,7 @@ void ReputationMgr::LoadFromDB(PreparedQueryResult result) // Set initial reputations (so everything is nifty before DB data load) Initialize(); - //QueryResult *result = CharacterDatabase.PQuery("SELECT faction, standing, flags FROM character_reputation WHERE guid = '%u'", GetGUIDLow()); + //QueryResult* result = CharacterDatabase.PQuery("SELECT faction, standing, flags FROM character_reputation WHERE guid = '%u'", GetGUIDLow()); if (result) { @@ -486,7 +509,7 @@ void ReputationMgr::LoadFromDB(PreparedQueryResult result) { Field* fields = result->Fetch(); - FactionEntry const *factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt16()); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(fields[0].GetUInt16()); if (factionEntry && (factionEntry->reputationListID >= 0)) { FactionState* faction = &m_factions[factionEntry->reputationListID]; diff --git a/src/server/game/Reputation/ReputationMgr.h b/src/server/game/Reputation/ReputationMgr.h index bb22f46585a..59ec826f0c5 100755 --- a/src/server/game/Reputation/ReputationMgr.h +++ b/src/server/game/Reputation/ReputationMgr.h @@ -86,7 +86,7 @@ class ReputationMgr FactionState const* GetState(FactionEntry const* factionEntry) const { - return factionEntry->reputationListID >= 0 ? GetState(factionEntry->reputationListID) : NULL; + return factionEntry->CanHaveReputation() ? GetState(factionEntry->reputationListID) : NULL; } FactionState const* GetState(RepListID id) const @@ -95,6 +95,9 @@ class ReputationMgr return repItr != m_factions.end() ? &repItr->second : NULL; } + bool IsAtWar(uint32 faction_id) const; + bool IsAtWar(FactionEntry const* factionEntry) const; + int32 GetReputation(uint32 faction_id) const; int32 GetReputation(FactionEntry const* factionEntry) const; int32 GetBaseReputation(FactionEntry const* factionEntry) const; diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index f5e6f3f320e..ec651439bc5 100755 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -44,7 +44,7 @@ void Map::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source, O uint64 ownerGUID = (source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : (uint64)0; ///- Schedule script execution for all scripts in the script map - ScriptMap const *s2 = &(s->second); + ScriptMap const* s2 = &(s->second); bool immedScript = false; for (ScriptMap::const_iterator iter = s2->begin(); iter != s2->end(); ++iter) { @@ -100,7 +100,7 @@ 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* pPlayer = NULL; if (!source && !target) sLog->outError("%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str()); else @@ -122,7 +122,7 @@ inline Player* Map::_GetScriptPlayerSourceOrTarget(Object* source, Object* targe inline Creature* Map::_GetScriptCreatureSourceOrTarget(Object* source, Object* target, const ScriptInfo* scriptInfo, bool bReverse) const { - Creature *pCreature = NULL; + Creature* pCreature = NULL; if (!source && !target) sLog->outError("%s source and target objects are NULL.", scriptInfo->GetDebugInfo().c_str()); else @@ -245,7 +245,7 @@ inline void Map::_ScriptProcessDoor(Object* source, Object* target, const Script scriptInfo->GetDebugInfo().c_str(), source->GetTypeId(), source->GetEntry(), source->GetGUIDLow()); else { - GameObject *pDoor = _FindGameObject(wSource, guid); + GameObject* pDoor = _FindGameObject(wSource, guid); if (!pDoor) sLog->outError("%s gameobject was not found (guid: %u).", scriptInfo->GetDebugInfo().c_str(), guid); else if (pDoor->GetGoType() != GAMEOBJECT_TYPE_DOOR) @@ -268,7 +268,7 @@ inline void Map::_ScriptProcessDoor(Object* source, Object* target, const Script inline GameObject* Map::_FindGameObject(WorldObject* pSearchObject, uint32 guid) const { - GameObject *pGameObject = NULL; + GameObject* pGameObject = NULL; CellPair p(Trinity::ComputeCellPair(pSearchObject->GetPositionX(), pSearchObject->GetPositionY())); Cell cell(p); @@ -306,6 +306,7 @@ void Map::ScriptsProcess() source = player->GetItemByGuid(step.sourceGUID); break; case HIGHGUID_UNIT: + case HIGHGUID_VEHICLE: source = HashMapHolder<Creature>::Find(step.sourceGUID); break; case HIGHGUID_PET: @@ -375,7 +376,7 @@ void Map::ScriptsProcess() } if (step.script->Talk.Flags & SF_TALK_USE_PLAYER) { - if (Player *pSource = _GetScriptPlayerSourceOrTarget(source, target, step.script)) + if (Player* pSource = _GetScriptPlayerSourceOrTarget(source, target, step.script)) { LocaleConstant loc_idx = pSource->GetSession()->GetSessionDbLocaleIndex(); std::string text(sObjectMgr->GetTrinityString(step.script->Talk.TextID, loc_idx)); @@ -410,7 +411,7 @@ void Map::ScriptsProcess() else { // Source or target must be Creature. - if (Creature *cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script)) + if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script)) { uint64 targetGUID = target ? target->GetGUID() : 0; switch (step.script->Talk.ChatType) @@ -448,7 +449,7 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_EMOTE: // Source or target must be Creature. - if (Creature *cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script)) + if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script)) { if (step.script->Emote.Flags & SF_EMOTE_USE_STATE) cSource->SetUInt32Value(UNIT_NPC_EMOTESTATE, step.script->Emote.EmoteID); @@ -459,7 +460,7 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_FIELD_SET: // Source or target must be Creature. - if (Creature *cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script)) + if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script)) { // Validate field number. if (step.script->FieldSet.FieldID <= OBJECT_FIELD_ENTRY || step.script->FieldSet.FieldID >= cSource->GetValuesCount()) @@ -473,7 +474,7 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_MOVE_TO: // Source or target must be Creature. - if (Creature *cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script)) + if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script)) { cSource->SendMonsterMoveWithSpeed(step.script->MoveTo.DestX, step.script->MoveTo.DestY, step.script->MoveTo.DestZ, step.script->MoveTo.TravelTime); cSource->GetMap()->CreatureRelocation(cSource, step.script->MoveTo.DestX, step.script->MoveTo.DestY, step.script->MoveTo.DestZ, 0); @@ -482,7 +483,7 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_FLAG_SET: // Source or target must be Creature. - if (Creature *cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script)) + if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script)) { // Validate field number. if (step.script->FlagToggle.FieldID <= OBJECT_FIELD_ENTRY || step.script->FlagToggle.FieldID >= cSource->GetValuesCount()) @@ -496,7 +497,7 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_FLAG_REMOVE: // Source or target must be Creature. - if (Creature *cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script)) + if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script)) { // Validate field number. if (step.script->FlagToggle.FieldID <= OBJECT_FIELD_ENTRY || step.script->FlagToggle.FieldID >= cSource->GetValuesCount()) @@ -512,13 +513,13 @@ void Map::ScriptsProcess() if (step.script->TeleportTo.Flags & SF_TELEPORT_USE_CREATURE) { // Source or target must be Creature. - if (Creature *cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script, true)) + if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script, true)) cSource->NearTeleportTo(step.script->TeleportTo.DestX, step.script->TeleportTo.DestY, step.script->TeleportTo.DestZ, step.script->TeleportTo.Orientation); } else { // Source or target must be Player. - if (Player *pSource = _GetScriptPlayerSourceOrTarget(source, target, step.script)) + if (Player* pSource = _GetScriptPlayerSourceOrTarget(source, target, step.script)) pSource->TeleportTo(step.script->TeleportTo.MapID, step.script->TeleportTo.DestX, step.script->TeleportTo.DestY, step.script->TeleportTo.DestZ, step.script->TeleportTo.Orientation); } break; @@ -584,7 +585,7 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_KILL_CREDIT: // Source or target must be Player. - if (Player *pSource = _GetScriptPlayerSourceOrTarget(source, target, step.script)) + if (Player* pSource = _GetScriptPlayerSourceOrTarget(source, target, step.script)) { if (step.script->KillCredit.Flags & SF_KILLCREDIT_REWARD_GROUP) pSource->RewardPlayerAndGroupAtEvent(step.script->KillCredit.CreatureEntry, pSource); @@ -603,7 +604,7 @@ void Map::ScriptsProcess() // Source or target must be WorldObject. if (WorldObject* pSummoner = _GetScriptWorldObject(source, true, step.script)) { - GameObject *pGO = _FindGameObject(pSummoner, step.script->RespawnGameobject.GOGuid); + GameObject* pGO = _FindGameObject(pSummoner, step.script->RespawnGameobject.GOGuid); if (!pGO) { sLog->outError("%s gameobject was not found (guid: %u).", step.script->GetDebugInfo().c_str(), step.script->RespawnGameobject.GOGuid); @@ -660,7 +661,7 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_ACTIVATE_OBJECT: // Source must be Unit. - if (Unit *pSource = _GetScriptUnit(source, true, step.script)) + if (Unit* pSource = _GetScriptUnit(source, true, step.script)) { // Target must be GameObject. if (!target) @@ -676,7 +677,7 @@ void Map::ScriptsProcess() break; } - if (GameObject *pGO = target->ToGameObject()) + if (GameObject* pGO = target->ToGameObject()) pGO->Use(pSource); } break; @@ -685,7 +686,7 @@ void Map::ScriptsProcess() { // Source (datalong2 != 0) or target (datalong2 == 0) must be Unit. bool bReverse = step.script->RemoveAura.Flags & SF_REMOVEAURA_REVERSE; - if (Unit *pTarget = _GetScriptUnit(bReverse ? source : target, bReverse, step.script)) + if (Unit* pTarget = _GetScriptUnit(bReverse ? source : target, bReverse, step.script)) pTarget->RemoveAurasDueToSpell(step.script->RemoveAura.SpellID); break; } @@ -841,7 +842,7 @@ void Map::ScriptsProcess() } //Lets choose our ScriptMap map - ScriptMapMap *datamap = GetScriptsMapByType(ScriptsType(step.script->CallScript.ScriptType)); + ScriptMapMap* datamap = GetScriptsMapByType(ScriptsType(step.script->CallScript.ScriptType)); //if no scriptmap present... if (!datamap) { @@ -856,7 +857,7 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_KILL: // Source or target must be Creature. - if (Creature *cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script)) + if (Creature* cSource = _GetScriptCreatureSourceOrTarget(source, target, step.script)) { if (cSource->isDead()) sLog->outError("%s creature is already dead (Entry: %u, GUID: %u)", @@ -872,7 +873,7 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_ORIENTATION: // Source must be Unit. - if (Unit *pSource = _GetScriptUnit(source, true, step.script)) + if (Unit* pSource = _GetScriptUnit(source, true, step.script)) { if (step.script->Orientation.Flags& SF_ORIENTATION_FACE_TARGET) { @@ -892,25 +893,25 @@ void Map::ScriptsProcess() case SCRIPT_COMMAND_EQUIP: // Source must be Creature. - if (Creature *cSource = _GetScriptCreature(source, true, step.script)) + if (Creature* cSource = _GetScriptCreature(source, true, step.script)) cSource->LoadEquipment(step.script->Equip.EquipmentID); break; case SCRIPT_COMMAND_MODEL: // Source must be Creature. - if (Creature *cSource = _GetScriptCreature(source, true, step.script)) + if (Creature* cSource = _GetScriptCreature(source, true, step.script)) cSource->SetDisplayId(step.script->Model.ModelID); break; case SCRIPT_COMMAND_CLOSE_GOSSIP: // Source must be Player. - if (Player *pSource = _GetScriptPlayer(source, true, step.script)) + if (Player* pSource = _GetScriptPlayer(source, true, step.script)) pSource->PlayerTalkClass->SendCloseGossip(); break; case SCRIPT_COMMAND_PLAYMOVIE: // Source must be Player. - if (Player *pSource = _GetScriptPlayer(source, true, step.script)) + if (Player* pSource = _GetScriptPlayer(source, true, step.script)) pSource->SendMovieStart(step.script->PlayMovie.MovieID); break; diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 5149308f481..64c92470fd7 100755 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -52,6 +52,7 @@ void AddSC_go_commandscript(); void AddSC_gobject_commandscript(); void AddSC_honor_commandscript(); void AddSC_learn_commandscript(); +void AddSC_misc_commandscript(); void AddSC_modify_commandscript(); void AddSC_npc_commandscript(); void AddSC_quest_commandscript(); @@ -652,6 +653,7 @@ void AddCommandScripts() AddSC_gobject_commandscript(); AddSC_honor_commandscript(); AddSC_learn_commandscript(); + AddSC_misc_commandscript(); AddSC_modify_commandscript(); AddSC_npc_commandscript(); AddSC_quest_commandscript(); diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index e5168fbec9c..d37938eba48 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -1218,7 +1218,7 @@ void ScriptMgr::OnPlayerReputationChange(Player* player, uint32 factionID, int32 FOREACH_SCRIPT(PlayerScript)->OnReputationChange(player, factionID, standing, incremental); } -void ScriptMgr::OnPlayerDuelRequest(Player *target, Player *challenger) +void ScriptMgr::OnPlayerDuelRequest(Player* target, Player* challenger) { FOREACH_SCRIPT(PlayerScript)->OnDuelRequest(target, challenger); } @@ -1228,7 +1228,7 @@ void ScriptMgr::OnPlayerDuelStart(Player* player1, Player* player2) FOREACH_SCRIPT(PlayerScript)->OnDuelStart(player1, player2); } -void ScriptMgr::OnPlayerDuelEnd(Player *winner, Player *loser, DuelCompleteType type) +void ScriptMgr::OnPlayerDuelEnd(Player* winner, Player* loser, DuelCompleteType type) { FOREACH_SCRIPT(PlayerScript)->OnDuelEnd(winner, loser, type); } diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 75325b5319b..61d24c949e6 100755 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -69,7 +69,7 @@ struct OutdoorPvPData; #define VISIBLE_RANGE 166.0f //MAX visible range (size of grid) // Generic scripting text function. -void DoScriptText(int32 textEntry, WorldObject* pSource, Unit *pTarget = NULL); +void DoScriptText(int32 textEntry, WorldObject* pSource, Unit* pTarget = NULL); /* TODO: Add more script type classes. diff --git a/src/server/game/Server/Protocol/Handlers/AddonHandler.cpp b/src/server/game/Server/Protocol/Handlers/AddonHandler.cpp index a506218aeb2..9bbf98ce3fc 100755 --- a/src/server/game/Server/Protocol/Handlers/AddonHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/AddonHandler.cpp @@ -30,7 +30,7 @@ AddonHandler::~AddonHandler() { } -bool AddonHandler::BuildAddonPacket(WorldPacket *Source, WorldPacket *Target) +bool AddonHandler::BuildAddonPacket(WorldPacket* Source, WorldPacket* Target) { ByteBuffer AddOnPacked; uLongf AddonRealSize; diff --git a/src/server/game/Server/Protocol/Handlers/AuctionHouseHandler.cpp b/src/server/game/Server/Protocol/Handlers/AuctionHouseHandler.cpp index 589ad0a5c10..23aa4c7a55a 100755 --- a/src/server/game/Server/Protocol/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/AuctionHouseHandler.cpp @@ -27,6 +27,7 @@ #include "Opcodes.h" #include "UpdateMask.h" #include "Util.h" +#include "AccountMgr.h" //please DO NOT use iterator++, because it is slower than ++iterator!!! //post-incrementation is always slower than pre-incrementation ! @@ -124,12 +125,12 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) recv_data >> buyout; recv_data >> etime; - Player *pl = GetPlayer(); + Player* pl = GetPlayer(); if (!item || !bid || !etime) return; //check for cheaters - Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); + Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); if (!pCreature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionSellItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); @@ -161,7 +162,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - Item *it = pl->GetItemByGuid(item); + Item* it = pl->GetItemByGuid(item); //do not allow to sell already auctioned items if (sAuctionMgr->GetAItem(GUID_LOPART(item))) { @@ -204,7 +205,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) return; } - if (GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) + if (AccountMgr::IsGMAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(GetAccountId(), "GM %s (Account: %u) create auction: %s (Entry: %u Count: %u)", GetPlayerName(), GetAccountId(), it->GetTemplate()->Name1.c_str(), it->GetEntry(), count); @@ -214,7 +215,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) uint32 auction_time = uint32(etime * sWorld->getRate(RATE_AUCTION_TIME)); - AuctionEntry *AH = new AuctionEntry; + AuctionEntry* AH = new AuctionEntry; AH->Id = sObjectMgr->GenerateAuctionID(); if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION)) AH->auctioneer = 23442; @@ -261,7 +262,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data) if (!auctionId || !price) return; //check for cheaters - Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); + Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); if (!pCreature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionPlaceBid - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); @@ -272,10 +273,10 @@ 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(pCreature->getFaction()); - AuctionEntry *auction = auctionHouse->GetAuction(auctionId); - Player *pl = GetPlayer(); + AuctionEntry* auction = auctionHouse->GetAuction(auctionId); + Player* pl = GetPlayer(); if (!auction || auction->owner == pl->GetGUIDLow()) { @@ -379,7 +380,7 @@ 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); + Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); if (!pCreature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionRemoveItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer))); @@ -392,13 +393,13 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket & recv_data) AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction()); - AuctionEntry *auction = auctionHouse->GetAuction(auctionId); - Player *pl = GetPlayer(); + AuctionEntry* auction = auctionHouse->GetAuction(auctionId); + Player* pl = GetPlayer(); SQLTransaction trans = CharacterDatabase.BeginTransaction(); if (auction && auction->owner == pl->GetGUIDLow()) { - Item *pItem = sAuctionMgr->GetAItem(auction->item_guidlow); + Item* pItem = sAuctionMgr->GetAItem(auction->item_guidlow); if (pItem) { if (auction->bidder > 0) // If we have a bidder, we have to send him the money he paid @@ -464,7 +465,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data) outbiddedCount = 0; } - Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); + Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); if (!pCreature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); @@ -478,7 +479,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data) AuctionHouseObject* auctionHouse = sAuctionMgr->GetAuctionsMap(pCreature->getFaction()); WorldPacket data(SMSG_AUCTION_BIDDER_LIST_RESULT, (4+4+4)); - Player *pl = GetPlayer(); + Player* pl = GetPlayer(); data << (uint32) 0; //add 0 as count uint32 count = 0; uint32 totalcount = 0; @@ -487,7 +488,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket & recv_data) --outbiddedCount; uint32 outbiddedAuctionId; recv_data >> outbiddedAuctionId; - AuctionEntry * auction = auctionHouse->GetAuction(outbiddedAuctionId); + AuctionEntry* auction = auctionHouse->GetAuction(outbiddedAuctionId); if (auction && auction->BuildAuctionInfo(data)) { ++totalcount; @@ -511,7 +512,7 @@ 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); + Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); if (!pCreature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionListOwnerItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); @@ -564,7 +565,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket & recv_data) recv_data.read_skip<uint8>(); } - Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); + Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER); if (!pCreature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); diff --git a/src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp b/src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp index 5bccf511da3..69c1cc5edfe 100755 --- a/src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/BattleGroundHandler.cpp @@ -78,7 +78,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data) uint32 instanceId; uint8 joinAsGroup; bool isPremade = false; - Group * grp = NULL; + Group* grp = NULL; recv_data >> guid; // battlemaster guid recv_data >> bgTypeId_; // battleground type id (DBC id) @@ -91,7 +91,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data) return; } - if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeId_, NULL)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeId_, NULL)) { ChatHandler(this).PSendSysMessage(LANG_BG_DISABLED); return; @@ -110,7 +110,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data) return; // get bg instance or bg template if instance not found - Battleground *bg = NULL; + Battleground* bg = NULL; if (instanceId) bg = sBattlegroundMgr->GetBattlegroundThroughClientInstance(instanceId, bgTypeId); @@ -181,7 +181,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data) BattlegroundQueue& bgQueue = sBattlegroundMgr->m_BattlegroundQueues[bgQueueTypeId]; - GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, NULL, bgTypeId, bracketEntry, 0, false, isPremade, 0, 0); + GroupQueueInfo* ginfo = bgQueue.AddGroup(_player, NULL, bgTypeId, bracketEntry, 0, false, isPremade, 0, 0); uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId()); // already checked if queueSlot is valid, now just get it uint32 queueSlot = _player->AddBattlegroundQueueId(bgQueueTypeId); @@ -204,7 +204,7 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data) isPremade = (grp->GetMembersCount() >= bg->GetMinPlayersPerTeam()); BattlegroundQueue& bgQueue = sBattlegroundMgr->m_BattlegroundQueues[bgQueueTypeId]; - GroupQueueInfo * ginfo = NULL; + GroupQueueInfo* ginfo = NULL; uint32 avgTime = 0; if (err > 0) @@ -214,9 +214,9 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data) avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId()); } - for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) { - Player *member = itr->getSource(); + Player* member = itr->getSource(); if (!member) continue; // this should never happen WorldPacket data; @@ -246,66 +246,58 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data) void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket & /*recv_data*/) { - // empty opcode sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd MSG_BATTLEGROUND_PLAYER_POSITIONS Message"); - Battleground *bg = _player->GetBattleground(); + Battleground* bg = _player->GetBattleground(); if (!bg) // can't be received if player not in battleground return; switch(bg->GetTypeID(true)) { case BATTLEGROUND_WS: - { - uint32 count1 = 0; //always constant zero? - uint32 count2 = 0; //count of next fields + { + uint32 count = 0; - Player *ali_plr = ObjectAccessor::FindPlayer(((BattlegroundWS*)bg)->GetAllianceFlagPickerGUID()); - if (ali_plr) - ++count2; + Player* aplr = ObjectAccessor::FindPlayer(((BattlegroundWS*)bg)->GetAllianceFlagPickerGUID()); + if (aplr) + ++count; - Player *horde_plr = ObjectAccessor::FindPlayer(((BattlegroundWS*)bg)->GetHordeFlagPickerGUID()); - if (horde_plr) - ++count2; + Player* hplr = ObjectAccessor::FindPlayer(((BattlegroundWS*)bg)->GetHordeFlagPickerGUID()); + if (hplr) + ++count; - WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4+16*count1+16*count2)); - data << count1; // alliance flag holders count - obsolete, now always 0 - /*for (uint8 i = 0; i < count1; ++i) - { - data << uint64(0); // guid - data << (float)0; // x - data << (float)0; // y - }*/ - data << count2; // horde flag holders count - obsolete, now count of next fields - if (ali_plr) - { - data << (uint64)ali_plr->GetGUID(); - data << (float)ali_plr->GetPositionX(); - data << (float)ali_plr->GetPositionY(); - } - if (horde_plr) - { - data << (uint64)horde_plr->GetGUID(); - data << (float)horde_plr->GetPositionX(); - data << (float)horde_plr->GetPositionY(); - } + WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, 4 + 4 + 16 * count); + data << 0; + data << count; + if (aplr) + { + data << uint64(aplr->GetGUID()); + data << float(aplr->GetPositionX()); + data << float(aplr->GetPositionY()); + } - SendPacket(&data); + if (hplr) + { + data << uint64(hplr->GetGUID()); + data << float(hplr->GetPositionX()); + data << float(hplr->GetPositionY()); } + + SendPacket(&data); break; + } case BATTLEGROUND_EY: //TODO : fix me! break; case BATTLEGROUND_AB: case BATTLEGROUND_AV: - { - //for other BG types - send default - WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4)); - data << uint32(0); - data << uint32(0); - SendPacket(&data); - } + { + WorldPacket data(MSG_BATTLEGROUND_PLAYER_POSITIONS, (4+4)); + data << uint32(0); + data << uint32(0); + SendPacket(&data); break; + } default: //maybe it is sent also in arena - do nothing break; @@ -397,7 +389,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data) return; } - Battleground *bg = sBattlegroundMgr->GetBattleground(ginfo.IsInvitedToBGInstanceGUID, bgTypeId); + Battleground* bg = sBattlegroundMgr->GetBattleground(ginfo.IsInvitedToBGInstanceGUID, bgTypeId); // bg template might and must be used in case of leaving queue, when instance is not created yet if (!bg && action == 0) @@ -464,7 +456,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data) bgQueue.RemovePlayer(_player->GetGUID(), false); // this is still needed here if battleground "jumping" shouldn't add deserter debuff // also this is required to prevent stuck at old battleground after SetBattlegroundId set to new - if (Battleground *currentBg = _player->GetBattleground()) + if (Battleground* currentBg = _player->GetBattleground()) currentBg->RemovePlayerAtLeave(_player->GetGUID(), false, true); // set the destination instance id @@ -481,7 +473,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket &recv_data) // if player leaves rated arena match before match start, it is counted as he played but he lost if (ginfo.IsRated && ginfo.IsInvitedToBGInstanceGUID) { - ArenaTeam * at = sArenaTeamMgr->GetArenaTeamById(ginfo.Team); + ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(ginfo.Team); if (at) { sLog->outDebug(LOG_FILTER_BATTLEGROUND, "UPDATING memberLost's personal arena rating for %u by opponents rating: %u, because he has left queue!", GUID_LOPART(_player->GetGUID()), ginfo.OpponentsTeamRating); @@ -529,7 +521,7 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket & /*recv_data*/) WorldPacket data; // we must update all queues here - Battleground *bg = NULL; + Battleground* bg = NULL; for (uint8 i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i) { BattlegroundQueueTypeId bgQueueTypeId = _player->GetBattlegroundQueueTypeId(i); @@ -590,7 +582,7 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUERY"); - Battleground *bg = _player->GetBattleground(); + Battleground* bg = _player->GetBattleground(); uint64 guid; recv_data >> guid; @@ -610,7 +602,7 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_AREA_SPIRIT_HEALER_QUEUE"); - Battleground *bg = _player->GetBattleground(); + Battleground* bg = _player->GetBattleground(); uint64 guid; recv_data >> guid; @@ -629,13 +621,12 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket & recv_data) void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_BATTLEMASTER_JOIN_ARENA"); - //recv_data.hexlike(); uint64 guid; // arena Battlemaster guid uint8 arenaslot; // 2v2, 3v3 or 5v5 uint8 asGroup; // asGroup uint8 isRated; // isRated - Group * grp = NULL; + Group* grp = NULL; recv_data >> guid >> arenaslot >> asGroup >> isRated; @@ -678,7 +669,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data) return; } - if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, BATTLEGROUND_AA, NULL)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, BATTLEGROUND_AA, NULL)) { ChatHandler(this).PSendSysMessage(LANG_ARENA_DISABLED); return; @@ -719,7 +710,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data) { ateamId = _player->GetArenaTeamId(arenaslot); // check real arenateam existence only here (if it was moved to group->CanJoin .. () then we would ahve to get it twice) - ArenaTeam * at = sArenaTeamMgr->GetArenaTeamById(ateamId); + ArenaTeam* at = sArenaTeamMgr->GetArenaTeamById(ateamId); if (!at) { _player->GetSession()->SendNotInArenaTeamPacket(arenatype); @@ -750,13 +741,13 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data) else bg->SetRated(false); - GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, bracketEntry, arenatype, isRated, false, arenaRating, matchmakerRating, ateamId); + GroupQueueInfo* ginfo = bgQueue.AddGroup(_player, grp, bgTypeId, bracketEntry, arenatype, isRated, false, arenaRating, matchmakerRating, ateamId); avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId()); } - for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) { - Player *member = itr->getSource(); + Player* member = itr->getSource(); if (!member) continue; @@ -782,7 +773,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket & recv_data) } else { - GroupQueueInfo * ginfo = bgQueue.AddGroup(_player, NULL, bgTypeId, bracketEntry, arenatype, isRated, false, arenaRating, matchmakerRating, ateamId); + GroupQueueInfo* ginfo = bgQueue.AddGroup(_player, NULL, bgTypeId, bracketEntry, arenatype, isRated, false, arenaRating, matchmakerRating, ateamId); uint32 avgTime = bgQueue.GetAverageQueueWaitTime(ginfo, bracketEntry->GetBracketId()); uint32 queueSlot = _player->AddBattlegroundQueueId(bgQueueTypeId); @@ -799,7 +790,7 @@ void WorldSession::HandleReportPvPAFK(WorldPacket & recv_data) { uint64 playerGuid; recv_data >> playerGuid; - Player *reportedPlayer = ObjectAccessor::FindPlayer(playerGuid); + Player* reportedPlayer = ObjectAccessor::FindPlayer(playerGuid); if (!reportedPlayer) { diff --git a/src/server/game/Server/Protocol/Handlers/CalendarHandler.cpp b/src/server/game/Server/Protocol/Handlers/CalendarHandler.cpp index 2377450c282..8f32ac84cb8 100755 --- a/src/server/game/Server/Protocol/Handlers/CalendarHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/CalendarHandler.cpp @@ -71,7 +71,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket & /*recv_data*/) { if (itr->second.perm) { - InstanceSave *save = itr->second.save; + InstanceSave* save = itr->second.save; data << uint32(save->GetMapId()); data << uint32(save->GetDifficulty()); data << uint32(save->GetResetTime() - cur_time); @@ -127,21 +127,18 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket & /*recv_data*/) */ sLog->outDebug(LOG_FILTER_NETWORKIO, "Sending calendar"); - data.hexlike(); SendPacket(&data); } void WorldSession::HandleCalendarGetEvent(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_GET_EVENT"); - recv_data.hexlike(); recv_data.read_skip<uint64>(); // unk } void WorldSession::HandleCalendarGuildFilter(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_GUILD_FILTER"); - recv_data.hexlike(); recv_data.read_skip<uint32>(); // unk1 recv_data.read_skip<uint32>(); // unk2 recv_data.read_skip<uint32>(); // unk3 @@ -150,14 +147,12 @@ void WorldSession::HandleCalendarGuildFilter(WorldPacket &recv_data) void WorldSession::HandleCalendarArenaTeam(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_ARENA_TEAM"); - recv_data.hexlike(); recv_data.read_skip<uint32>(); // unk } void WorldSession::HandleCalendarAddEvent(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_ADD_EVENT"); - recv_data.hexlike(); recv_data.rfinish(); // set to end to avoid warnings spam //std::string unk1, unk2; @@ -193,7 +188,6 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket &recv_data) void WorldSession::HandleCalendarUpdateEvent(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_UPDATE_EVENT"); - recv_data.hexlike(); recv_data.rfinish(); // set to end to avoid warnings spam //recv_data >> uint64 @@ -212,7 +206,6 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket &recv_data) void WorldSession::HandleCalendarRemoveEvent(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_REMOVE_EVENT"); - recv_data.hexlike(); recv_data.rfinish(); // set to end to avoid warnings spam //recv_data >> uint64 @@ -224,7 +217,6 @@ void WorldSession::HandleCalendarRemoveEvent(WorldPacket &recv_data) void WorldSession::HandleCalendarCopyEvent(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_COPY_EVENT"); - recv_data.hexlike(); recv_data.rfinish(); // set to end to avoid warnings spam //recv_data >> uint64 @@ -236,7 +228,6 @@ void WorldSession::HandleCalendarCopyEvent(WorldPacket &recv_data) void WorldSession::HandleCalendarEventInvite(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_INVITE"); - recv_data.hexlike(); recv_data.rfinish(); // set to end to avoid warnings spam //recv_data >> uint64 @@ -250,7 +241,6 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket &recv_data) void WorldSession::HandleCalendarEventRsvp(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_RSVP"); - recv_data.hexlike(); recv_data.rfinish(); // set to end to avoid warnings spam //recv_data >> uint64 @@ -262,7 +252,6 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket &recv_data) void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_REMOVE_INVITE"); - recv_data.hexlike(); recv_data.rfinish(); // set to end to avoid warnings spam //recv_data.readPackGUID(guid) @@ -274,7 +263,6 @@ void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket &recv_data) void WorldSession::HandleCalendarEventStatus(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_STATUS"); - recv_data.hexlike(); recv_data.rfinish(); // set to end to avoid warnings spam //recv_data.readPackGUID(guid) @@ -287,7 +275,6 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket &recv_data) void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_MODERATOR_STATUS"); - recv_data.hexlike(); recv_data.rfinish(); // set to end to avoid warnings spam //recv_data.readPackGUID(guid) @@ -300,7 +287,6 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket &recv_data) void WorldSession::HandleCalendarComplain(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_COMPLAIN"); - recv_data.hexlike(); recv_data.rfinish(); // set to end to avoid warnings spam //recv_data >> uint64 diff --git a/src/server/game/Server/Protocol/Handlers/ChannelHandler.cpp b/src/server/game/Server/Protocol/Handlers/ChannelHandler.cpp index 841ed7ee331..d08e7d9f930 100755 --- a/src/server/game/Server/Protocol/Handlers/ChannelHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/ChannelHandler.cpp @@ -60,7 +60,6 @@ void WorldSession::HandleJoinChannel(WorldPacket& recvPacket) void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); uint32 unk; std::string channelname; @@ -72,7 +71,7 @@ void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket) if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) { - if (Channel *chn = cMgr->GetChannel(channelname, _player)) + if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->Leave(_player->GetGUID(), true); cMgr->LeftChannel(channelname); } @@ -81,33 +80,30 @@ void WorldSession::HandleLeaveChannel(WorldPacket& recvPacket) void WorldSession::HandleChannelList(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname; recvPacket >> channelname; if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) - if (Channel *chn = cMgr->GetChannel(channelname, _player)) + if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->List(_player); } void WorldSession::HandleChannelPassword(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname, pass; recvPacket >> channelname; recvPacket >> pass; if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) - if (Channel *chn = cMgr->GetChannel(channelname, _player)) + if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->Password(_player->GetGUID(), pass.c_str()); } void WorldSession::HandleChannelSetOwner(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname, newp; recvPacket >> channelname; @@ -117,25 +113,23 @@ void WorldSession::HandleChannelSetOwner(WorldPacket& recvPacket) return; if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) - if (Channel *chn = cMgr->GetChannel(channelname, _player)) + if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->SetOwner(_player->GetGUID(), newp.c_str()); } void WorldSession::HandleChannelOwner(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname; recvPacket >> channelname; if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) - if (Channel *chn = cMgr->GetChannel(channelname, _player)) + if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->SendWhoOwner(_player->GetGUID()); } void WorldSession::HandleChannelModerator(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; @@ -145,14 +139,13 @@ void WorldSession::HandleChannelModerator(WorldPacket& recvPacket) return; if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) - if (Channel *chn = cMgr->GetChannel(channelname, _player)) + if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->SetModerator(_player->GetGUID(), otp.c_str()); } void WorldSession::HandleChannelUnmoderator(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; @@ -162,14 +155,13 @@ void WorldSession::HandleChannelUnmoderator(WorldPacket& recvPacket) return; if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) - if (Channel *chn = cMgr->GetChannel(channelname, _player)) + if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->UnsetModerator(_player->GetGUID(), otp.c_str()); } void WorldSession::HandleChannelMute(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; @@ -179,14 +171,13 @@ void WorldSession::HandleChannelMute(WorldPacket& recvPacket) return; if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) - if (Channel *chn = cMgr->GetChannel(channelname, _player)) + if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->SetMute(_player->GetGUID(), otp.c_str()); } void WorldSession::HandleChannelUnmute(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; @@ -197,14 +188,13 @@ void WorldSession::HandleChannelUnmute(WorldPacket& recvPacket) return; if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) - if (Channel *chn = cMgr->GetChannel(channelname, _player)) + if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->UnsetMute(_player->GetGUID(), otp.c_str()); } void WorldSession::HandleChannelInvite(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; @@ -214,14 +204,13 @@ void WorldSession::HandleChannelInvite(WorldPacket& recvPacket) return; if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) - if (Channel *chn = cMgr->GetChannel(channelname, _player)) + if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->Invite(_player->GetGUID(), otp.c_str()); } void WorldSession::HandleChannelKick(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; @@ -230,14 +219,13 @@ void WorldSession::HandleChannelKick(WorldPacket& recvPacket) return; if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) - if (Channel *chn = cMgr->GetChannel(channelname, _player)) + if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->Kick(_player->GetGUID(), otp.c_str()); } void WorldSession::HandleChannelBan(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; @@ -247,14 +235,13 @@ void WorldSession::HandleChannelBan(WorldPacket& recvPacket) return; if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) - if (Channel *chn = cMgr->GetChannel(channelname, _player)) + if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->Ban(_player->GetGUID(), otp.c_str()); } void WorldSession::HandleChannelUnban(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname, otp; recvPacket >> channelname; @@ -265,18 +252,17 @@ void WorldSession::HandleChannelUnban(WorldPacket& recvPacket) return; if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) - if (Channel *chn = cMgr->GetChannel(channelname, _player)) + if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->UnBan(_player->GetGUID(), otp.c_str()); } void WorldSession::HandleChannelAnnouncements(WorldPacket& recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname; recvPacket >> channelname; if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) - if (Channel *chn = cMgr->GetChannel(channelname, _player)) + if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->Announce(_player->GetGUID()); } @@ -289,12 +275,11 @@ void WorldSession::HandleChannelDisplayListQuery(WorldPacket &recvPacket) void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname; recvPacket >> channelname; if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) { - if (Channel *chn = cMgr->GetChannel(channelname, _player)) + if (Channel* chn = cMgr->GetChannel(channelname, _player)) { WorldPacket data(SMSG_CHANNEL_MEMBER_COUNT, chn->GetName().size()+1+1+4); data << chn->GetName(); @@ -308,11 +293,10 @@ void WorldSession::HandleGetChannelMemberCount(WorldPacket &recvPacket) void WorldSession::HandleSetChannelWatch(WorldPacket &recvPacket) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Opcode %u", recvPacket.GetOpcode()); - //recvPacket.hexlike(); std::string channelname; recvPacket >> channelname; /*if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) - if (Channel *chn = cMgr->GetChannel(channelname, _player)) + if (Channel* chn = cMgr->GetChannel(channelname, _player)) chn->JoinNotify(_player->GetGUID());*/ } diff --git a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp index 69024837d61..8cd2484bfa2 100755 --- a/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/CharacterHandler.cpp @@ -42,6 +42,7 @@ #include "Util.h" #include "ScriptMgr.h" #include "Battleground.h" +#include "AccountMgr.h" class LoginQueryHolder : public SQLQueryHolder { @@ -279,7 +280,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data) WorldPacket data(SMSG_CHAR_CREATE, 1); // returned with diff.values in all cases - if (GetSecurity() == SEC_PLAYER) + if (AccountMgr::IsPlayerAccount(GetSecurity())) { if (uint32 mask = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_DISABLED)) { @@ -337,7 +338,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data) return; } - if (GetSecurity() == SEC_PLAYER) + if (AccountMgr::IsPlayerAccount(GetSecurity())) { uint32 raceMaskDisabled = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_DISABLED_RACEMASK); if ((1 << (race_ - 1)) & raceMaskDisabled) @@ -374,7 +375,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data) return; } - if (GetSecurity() == SEC_PLAYER && sObjectMgr->IsReservedName(name)) + if (AccountMgr::IsPlayerAccount(GetSecurity()) && sObjectMgr->IsReservedName(name)) { data << (uint8)CHAR_NAME_RESERVED; SendPacket(&data); @@ -383,7 +384,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data) // speedup check for heroic class disabled case uint32 heroic_free_slots = sWorld->getIntConfig(CONFIG_HEROIC_CHARACTERS_PER_REALM); - if (heroic_free_slots == 0 && GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT) + if (heroic_free_slots == 0 && AccountMgr::IsPlayerAccount(GetSecurity()) && class_ == CLASS_DEATH_KNIGHT) { data << (uint8)CHAR_CREATE_UNIQUE_CLASS_LIMIT; SendPacket(&data); @@ -392,7 +393,7 @@ void WorldSession::HandleCharCreateOpcode(WorldPacket & recv_data) // speedup check for heroic class disabled case uint32 req_level_for_heroic = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_HEROIC_CHARACTER); - if (GetSecurity() == SEC_PLAYER && class_ == CLASS_DEATH_KNIGHT && req_level_for_heroic > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) + if (AccountMgr::IsPlayerAccount(GetSecurity()) && class_ == CLASS_DEATH_KNIGHT && req_level_for_heroic > sWorld->getIntConfig(CONFIG_MAX_PLAYER_LEVEL)) { data << (uint8)CHAR_CREATE_LEVEL_REQUIREMENT; SendPacket(&data); @@ -443,7 +444,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte uint16 acctCharCount = 0; if (result) { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); // SELECT SUM(x) is MYSQL_TYPE_NEWDECIMAL - needs to be read as string const char* ch = fields[0].GetCString(); if (ch) @@ -477,7 +478,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte { if (result) { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); createInfo->CharCount = fields[0].GetUInt8(); if (createInfo->CharCount >= sWorld->getIntConfig(CONFIG_CHARACTERS_PER_REALM)) @@ -492,7 +493,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte } } - bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || GetSecurity() > SEC_PLAYER; + bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || !AccountMgr::IsPlayerAccount(GetSecurity()); uint32 skipCinematics = sWorld->getIntConfig(CONFIG_SKIP_CINEMATICS); _charCreateCallback.FreeResult(); @@ -516,7 +517,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte bool haveSameRace = false; uint32 heroicReqLevel = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_HEROIC_CHARACTER); bool hasHeroicReqLevel = (heroicReqLevel == 0); - bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || GetSecurity() > SEC_PLAYER; + bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || !AccountMgr::IsPlayerAccount(GetSecurity()); uint32 skipCinematics = sWorld->getIntConfig(CONFIG_SKIP_CINEMATICS); if (result) @@ -527,7 +528,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte Field* field = result->Fetch(); uint8 accRace = field[1].GetUInt8(); - if (GetSecurity() == SEC_PLAYER && createInfo->Class == CLASS_DEATH_KNIGHT) + if (AccountMgr::IsPlayerAccount(GetSecurity()) && createInfo->Class == CLASS_DEATH_KNIGHT) { uint8 accClass = field[2].GetUInt8(); if (accClass == CLASS_DEATH_KNIGHT) @@ -588,7 +589,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte if (!haveSameRace) haveSameRace = createInfo->Race == accRace; - if (GetSecurity() == SEC_PLAYER && createInfo->Class == CLASS_DEATH_KNIGHT) + if (AccountMgr::IsPlayerAccount(GetSecurity()) && createInfo->Class == CLASS_DEATH_KNIGHT) { uint8 acc_class = field[2].GetUInt8(); if (acc_class == CLASS_DEATH_KNIGHT) @@ -618,7 +619,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte } } - if (GetSecurity() == SEC_PLAYER && createInfo->Class == CLASS_DEATH_KNIGHT && !hasHeroicReqLevel) + if (AccountMgr::IsPlayerAccount(GetSecurity()) && createInfo->Class == CLASS_DEATH_KNIGHT && !hasHeroicReqLevel) { WorldPacket data(SMSG_CHAR_CREATE, 1); data << uint8(CHAR_CREATE_LEVEL_REQUIREMENT); @@ -636,12 +637,11 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte sLog->outDebug(LOG_FILTER_NETWORKIO, "Character creation %s (account %u) has unhandled tail data: [%u]", createInfo->Name.c_str(), GetAccountId(), unk); } - Player* pNewChar = new Player(this); - if (!pNewChar->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PLAYER), createInfo)) + Player newChar(this); + if (!newChar.Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PLAYER), createInfo)) { // Player not create (race/class/etc problem?) - pNewChar->CleanupsBeforeDelete(); - delete pNewChar; + newChar.CleanupsBeforeDelete(); WorldPacket data(SMSG_CHAR_CREATE, 1); data << uint8(CHAR_CREATE_ERROR); @@ -653,12 +653,12 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte } if ((haveSameRace && skipCinematics == 1) || skipCinematics == 2) - pNewChar->setCinematic(1); // not show intro + newChar.setCinematic(1); // not show intro - pNewChar->SetAtLoginFlag(AT_LOGIN_FIRST); // First login + newChar.SetAtLoginFlag(AT_LOGIN_FIRST); // First login // Player created, save it now - pNewChar->SaveToDB(); + newChar.SaveToDB(); createInfo->CharCount += 1; SQLTransaction trans = LoginDatabase.BeginTransaction(); @@ -676,18 +676,17 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte LoginDatabase.CommitTransaction(trans); - pNewChar->CleanupsBeforeDelete(); + newChar.CleanupsBeforeDelete(); WorldPacket data(SMSG_CHAR_CREATE, 1); data << uint8(CHAR_CREATE_SUCCESS); SendPacket(&data); std::string IP_str = GetRemoteAddress(); - sLog->outDetail("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), pNewChar->GetGUIDLow()); - sLog->outChar("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), pNewChar->GetGUIDLow()); - sScriptMgr->OnPlayerCreate(pNewChar); + sLog->outDetail("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); + sLog->outChar("Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow()); + sScriptMgr->OnPlayerCreate(&newChar); - delete pNewChar; // created only to call SaveToDB() delete createInfo; _charCreateCallback.SetParam(NULL); _charCreateCallback.FreeResult(); @@ -729,7 +728,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket & recv_data) QueryResult result = CharacterDatabase.PQuery("SELECT account, name FROM characters WHERE guid='%u'", GUID_LOPART(guid)); if (result) { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); accountId = fields[0].GetUInt32(); name = fields[1].GetString(); } @@ -869,7 +868,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) sLog->outStaticDebug("WORLD: Sent server info"); } - //QueryResult *result = CharacterDatabase.PQuery("SELECT guildid, rank FROM guild_member WHERE guid = '%u'", pCurrChar->GetGUIDLow()); + //QueryResult* result = CharacterDatabase.PQuery("SELECT guildid, rank FROM guild_member WHERE guid = '%u'", pCurrChar->GetGUIDLow()); if (PreparedQueryResult resultGuild = holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOADGUILD)) { Field* fields = resultGuild->Fetch(); @@ -1123,7 +1122,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recv_data) } // check name limitations - if (GetSecurity() == SEC_PLAYER && sObjectMgr->IsReservedName(newname)) + if (AccountMgr::IsPlayerAccount(GetSecurity()) && sObjectMgr->IsReservedName(newname)) { WorldPacket data(SMSG_CHAR_RENAME, 1); data << uint8(CHAR_NAME_RESERVED); @@ -1326,7 +1325,7 @@ void WorldSession::HandleRemoveGlyph(WorldPacket & recv_data) if (uint32 glyph = _player->GetGlyph(slot)) { - if (GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph)) + if (GlyphPropertiesEntry const* gp = sGlyphPropertiesStore.LookupEntry(glyph)) { _player->RemoveAurasDueToSpell(gp->SpellId); _player->SetGlyph(slot, 0); @@ -1355,7 +1354,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) return; } - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 at_loginFlags = fields[0].GetUInt16(); if (!(at_loginFlags & AT_LOGIN_CUSTOMIZE)) @@ -1385,7 +1384,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recv_data) } // check name limitations - if (GetSecurity() == SEC_PLAYER && sObjectMgr->IsReservedName(newname)) + if (AccountMgr::IsPlayerAccount(GetSecurity()) && sObjectMgr->IsReservedName(newname)) { WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1); data << uint8(CHAR_NAME_RESERVED); @@ -1459,7 +1458,7 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket &recv_data) uint64 itemGuid; recv_data.readPackGUID(itemGuid); - Item *item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); + Item* item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (!item && itemGuid) // cheating check 1 return; @@ -1489,7 +1488,6 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data) return; sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_EQUIPMENT_SET_USE"); - recv_data.hexlike(); for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i) { @@ -1501,13 +1499,13 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket &recv_data) sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "Item " UI64FMTD ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot); - Item *item = _player->GetItemByGuid(itemGuid); + Item* item = _player->GetItemByGuid(itemGuid); uint16 dstpos = i | (INVENTORY_SLOT_BAG_0 << 8); if (!item) { - Item *uItem = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); + Item* uItem = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (!uItem) continue; @@ -1555,7 +1553,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) return; } - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 playerClass = fields[0].GetUInt32(); uint32 level = fields[1].GetUInt32(); uint32 at_loginFlags = fields[2].GetUInt16(); @@ -1577,7 +1575,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) return; } - if (GetSecurity() == SEC_PLAYER) + if (AccountMgr::IsPlayerAccount(GetSecurity())) { uint32 raceMaskDisabled = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_DISABLED_RACEMASK); if ((1 << (race - 1)) & raceMaskDisabled) @@ -1608,7 +1606,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data) } // check name limitations - if (GetSecurity() == SEC_PLAYER && sObjectMgr->IsReservedName(newname)) + if (AccountMgr::IsPlayerAccount(GetSecurity()) && sObjectMgr->IsReservedName(newname)) { WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1); data << uint8(CHAR_NAME_RESERVED); diff --git a/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp b/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp index becd81022c4..cd80331069c 100755 --- a/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp @@ -39,6 +39,7 @@ #include "SpellAuraEffects.h" #include "Util.h" #include "ScriptMgr.h" +#include "AccountMgr.h" bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg, uint32 lang) { @@ -48,7 +49,7 @@ bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg if (sWorld->getBoolConfig(CONFIG_CHAT_FAKE_MESSAGE_PREVENTING)) stripLineInvisibleChars(msg); - if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) && GetSecurity() < SEC_MODERATOR + if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) && AccountMgr::IsPlayerAccount(GetSecurity()) && !ChatHandler(this).isValidChatMessage(msg.c_str())) { sLog->outError("Player %s (GUID: %u) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName(), @@ -269,24 +270,20 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) } Player* receiver = sObjectAccessor->FindPlayerByName(to.c_str()); - uint32 senderSecurity = GetSecurity(); - uint32 receiverSecurity = receiver ? receiver->GetSession()->GetSecurity() : SEC_PLAYER; - if (!receiver || (senderSecurity == SEC_PLAYER && receiverSecurity > SEC_PLAYER && !receiver->isAcceptWhispers() && !receiver->IsInWhisperWhiteList(sender->GetGUID()))) + bool senderIsPlayer = AccountMgr::IsPlayerAccount(GetSecurity()); + bool receiverIsPlayer = AccountMgr::IsPlayerAccount(receiver ? receiver->GetSession()->GetSecurity() : SEC_PLAYER); + if (!receiver || (senderIsPlayer && !receiverIsPlayer && !receiver->isAcceptWhispers() && !receiver->IsInWhisperWhiteList(sender->GetGUID()))) { SendPlayerNotFoundNotice(to); return; } - if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) && senderSecurity == SEC_PLAYER && receiverSecurity == SEC_PLAYER) - { - uint32 senderFaction = GetPlayer()->GetTeam(); - uint32 receiverFaction = receiver->GetTeam(); - if (senderFaction != receiverFaction) + if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) && senderIsPlayer && receiverIsPlayer) + if (GetPlayer()->GetTeam() != receiver->GetTeam()) { SendWrongFactionNotice(); return; } - } if (GetPlayer()->HasAura(1852) && !receiver->isGameMaster()) { @@ -295,7 +292,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) } // If player is a Gamemaster and doesn't accept whisper, we auto-whitelist every player that the Gamemaster is talking to - if (senderSecurity > SEC_PLAYER && !sender->isAcceptWhispers() && !sender->IsInWhisperWhiteList(receiver->GetGUID())) + if (!senderIsPlayer && !sender->isAcceptWhispers() && !sender->IsInWhisperWhiteList(receiver->GetGUID())) sender->AddWhisperWhiteList(receiver->GetGUID()); GetPlayer()->Whisper(msg, lang, receiver->GetGUID()); @@ -420,10 +417,13 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) } break; case CHAT_MSG_CHANNEL: { - if (_player->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ)) + if (AccountMgr::IsPlayerAccount(GetSecurity())) { - SendNotification(GetTrinityString(LANG_CHANNEL_REQ), sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ)); - return; + if (_player->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ)) + { + SendNotification(GetTrinityString(LANG_CHANNEL_REQ), sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ)); + return; + } } if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) @@ -543,7 +543,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket & recv_data) sScriptMgr->OnPlayerTextEmote(GetPlayer(), text_emote, emoteNum, guid); - EmotesTextEntry const *em = sEmotesTextStore.LookupEntry(text_emote); + EmotesTextEntry const* em = sEmotesTextStore.LookupEntry(text_emote); if (!em) return; diff --git a/src/server/game/Server/Protocol/Handlers/CombatHandler.cpp b/src/server/game/Server/Protocol/Handlers/CombatHandler.cpp index f2840d4c73f..31a09e830ff 100755 --- a/src/server/game/Server/Protocol/Handlers/CombatHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/CombatHandler.cpp @@ -31,21 +31,16 @@ void WorldSession::HandleAttackSwingOpcode(WorldPacket & recv_data) sLog->outStaticDebug("WORLD: Recvd CMSG_ATTACKSWING Message guidlow:%u guidhigh:%u", GUID_LOPART(guid), GUID_HIPART(guid)); - Unit *pEnemy = ObjectAccessor::GetUnit(*_player, guid); + Unit* pEnemy = ObjectAccessor::GetUnit(*_player, guid); if (!pEnemy) { - if (!IS_UNIT_GUID(guid)) - sLog->outError("WORLD: Object %u (TypeID: %u) isn't player, pet or creature", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid))); - else - sLog->outError("WORLD: Enemy %s %u not found", GetLogNameForGuid(guid), GUID_LOPART(guid)); - // stop attack state at client SendAttackStop(NULL); return; } - if (!_player->canAttack(pEnemy)) + if (!_player->IsValidAttackTarget(pEnemy)) { // stop attack state at client SendAttackStop(pEnemy); diff --git a/src/server/game/Server/Protocol/Handlers/DuelHandler.cpp b/src/server/game/Server/Protocol/Handlers/DuelHandler.cpp index fe671565aaf..48bc305ce30 100755 --- a/src/server/game/Server/Protocol/Handlers/DuelHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/DuelHandler.cpp @@ -27,8 +27,8 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket) { uint64 guid; - Player *pl; - Player *plTarget; + Player* pl; + Player* plTarget; recvPacket >> guid; diff --git a/src/server/game/Server/Protocol/Handlers/GroupHandler.cpp b/src/server/game/Server/Protocol/Handlers/GroupHandler.cpp index d7eb9318189..57a54bd440f 100755 --- a/src/server/game/Server/Protocol/Handlers/GroupHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/GroupHandler.cpp @@ -252,7 +252,7 @@ void WorldSession::HandleGroupDeclineOpcode(WorldPacket & /*recv_data*/) if (!group) return; // Remember leader if online (group pointer will be invalid if group gets disbanded) - Player *leader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()); + Player* leader = ObjectAccessor::FindPlayer(group->GetLeaderGUID()); // uninvite, group can be deleted GetPlayer()->UninviteFromGroup(); @@ -384,7 +384,7 @@ void WorldSession::HandleGroupDisbandOpcode(WorldPacket & /*recv_data*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_GROUP_DISBAND"); - Group *grp = GetPlayer()->GetGroup(); + Group* grp = GetPlayer()->GetGroup(); if (!grp) return; @@ -708,7 +708,7 @@ void WorldSession::HandleRaidReadyCheckFinishedOpcode(WorldPacket & /*recv_data* // Is any reaction need? } -void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacket *data) +void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacket* data) { uint32 mask = player->GetGroupUpdateFlag(); @@ -783,7 +783,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke } } - Pet *pet = player->GetPet(); + Pet* pet = player->GetPet(); if (mask & GROUP_UPDATE_FLAG_PET_GUID) { if (pet) @@ -896,7 +896,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recv_data) return; } - Pet *pet = player->GetPet(); + Pet* pet = player->GetPet(); WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 4+2+2+2+1+2*6+8+1+8); data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related diff --git a/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp b/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp index b1afc3d6c97..9e18e25f8f7 100755 --- a/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/ItemHandler.cpp @@ -148,7 +148,7 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPacket & recv_data) recv_data >> srcbag >> srcslot; //sLog->outDebug("STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot); - Item *pSrcItem = _player->GetItemByPos(srcbag, srcslot); + Item* pSrcItem = _player->GetItemByPos(srcbag, srcslot); if (!pSrcItem) return; // only at cheat @@ -164,7 +164,7 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPacket & recv_data) if (dest == src) // prevent equip in same slot, only at cheat return; - Item *pDstItem = _player->GetItemByPos(dest); + Item* pDstItem = _player->GetItemByPos(dest); if (!pDstItem) // empty slot, simple case { _player->RemoveItem(srcbag, srcslot, true); @@ -255,7 +255,7 @@ void WorldSession::HandleDestroyItemOpcode(WorldPacket & recv_data) } } - Item *pItem = _player->GetItemByPos(bag, slot); + Item* pItem = _player->GetItemByPos(bag, slot); if (!pItem) { _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); @@ -286,7 +286,7 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recv_data) sLog->outDetail("STORAGE: Item Query = %u", item); - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(item); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item); if (pProto) { std::string Name = pProto->Name1; @@ -295,7 +295,7 @@ void WorldSession::HandleItemQuerySingleOpcode(WorldPacket & recv_data) int loc_idx = GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - if (ItemLocale const *il = sObjectMgr->GetItemLocale(pProto->ItemId)) + if (ItemLocale const* il = sObjectMgr->GetItemLocale(pProto->ItemId)) { ObjectMgr::GetLocaleString(il->Name, loc_idx, Name); ObjectMgr::GetLocaleString(il->Description, loc_idx, Description); @@ -445,7 +445,7 @@ void WorldSession::HandleReadItem(WorldPacket & recv_data) recv_data >> bag >> slot; //sLog->outDetail("STORAGE: Read bag = %u, slot = %u", bag, slot); - Item *pItem = _player->GetItemByPos(bag, slot); + Item* pItem = _player->GetItemByPos(bag, slot); if (pItem && pItem->GetTemplate()->PageText) { @@ -494,7 +494,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data) if (!itemguid) return; - Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); + Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); if (!pCreature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleSellItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid))); @@ -506,7 +506,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data) if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - Item *pItem = _player->GetItemByGuid(itemguid); + Item* pItem = _player->GetItemByGuid(itemguid); if (pItem) { // prevent sell not owner item @@ -551,14 +551,14 @@ void WorldSession::HandleSellItemOpcode(WorldPacket & recv_data) } } - ItemTemplate const *pProto = pItem->GetTemplate(); + ItemTemplate const* pProto = pItem->GetTemplate(); if (pProto) { if (pProto->SellPrice > 0) { if (count < pItem->GetCount()) // need split items { - Item *pNewItem = pItem->CloneItem(count, _player); + Item* pNewItem = pItem->CloneItem(count, _player); if (!pNewItem) { sLog->outError("WORLD: HandleSellItemOpcode - could not create clone of item %u; count = %u", pItem->GetEntry(), count); @@ -605,7 +605,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data) recv_data >> vendorguid >> slot; - Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); + Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid, UNIT_NPC_FLAG_VENDOR); if (!pCreature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid))); @@ -617,7 +617,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data) if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - Item *pItem = _player->GetItemFromBuyBackSlot(slot); + Item* pItem = _player->GetItemFromBuyBackSlot(slot); if (pItem) { uint32 price = _player->GetUInt32Value(PLAYER_FIELD_BUYBACK_PRICE_1 + slot - BUYBACK_SLOT_START); @@ -815,7 +815,7 @@ void WorldSession::HandleAutoStoreBagItemOpcode(WorldPacket & recv_data) recv_data >> srcbag >> srcslot >> dstbag; //sLog->outDebug("STORAGE: receive srcbag = %u, srcslot = %u, dstbag = %u", srcbag, srcslot, dstbag); - Item *pItem = _player->GetItemByPos(srcbag, srcslot); + Item* pItem = _player->GetItemByPos(srcbag, srcslot); if (!pItem) return; @@ -867,7 +867,7 @@ 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); + Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER); if (!pCreature) { sLog->outDebug("WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); @@ -919,7 +919,7 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket) recvPacket >> srcbag >> srcslot; sLog->outDebug(LOG_FILTER_NETWORKIO, "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot); - Item *pItem = _player->GetItemByPos(srcbag, srcslot); + Item* pItem = _player->GetItemByPos(srcbag, srcslot); if (!pItem) return; @@ -949,7 +949,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket) recvPacket >> srcbag >> srcslot; sLog->outDebug(LOG_FILTER_NETWORKIO, "STORAGE: receive srcbag = %u, srcslot = %u", srcbag, srcslot); - Item *pItem = _player->GetItemByPos(srcbag, srcslot); + Item* pItem = _player->GetItemByPos(srcbag, srcslot); if (!pItem) return; @@ -1029,13 +1029,13 @@ void WorldSession::HandleItemNameQueryOpcode(WorldPacket & recv_data) recv_data.read_skip<uint64>(); // guid sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_ITEM_NAME_QUERY %u", itemid); - ItemSetNameEntry const *pName = sObjectMgr->GetItemSetNameEntry(itemid); + ItemSetNameEntry const* pName = sObjectMgr->GetItemSetNameEntry(itemid); if (pName) { std::string Name = pName->name; int loc_idx = GetSessionDbLocaleIndex(); if (loc_idx >= 0) - if (ItemSetNameLocale const *isnl = sObjectMgr->GetItemSetNameLocale(itemid)) + if (ItemSetNameLocale const* isnl = sObjectMgr->GetItemSetNameLocale(itemid)) ObjectMgr::GetLocaleString(isnl->Name, loc_idx, Name); WorldPacket data(SMSG_ITEM_NAME_QUERY_RESPONSE, (4+Name.size()+1+4)); @@ -1051,14 +1051,13 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data) sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_WRAP_ITEM"); uint8 gift_bag, gift_slot, item_bag, item_slot; - //recv_data.hexlike(); recv_data >> gift_bag >> gift_slot; // paper recv_data >> item_bag >> item_slot; // item sLog->outDebug(LOG_FILTER_NETWORKIO, "WRAP: receive gift_bag = %u, gift_slot = %u, item_bag = %u, item_slot = %u", gift_bag, gift_slot, item_bag, item_slot); - Item *gift = _player->GetItemByPos(gift_bag, gift_slot); + Item* gift = _player->GetItemByPos(gift_bag, gift_slot); if (!gift) { _player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, gift, NULL); @@ -1071,7 +1070,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recv_data) return; } - Item *item = _player->GetItemByPos(item_bag, item_slot); + Item* item = _player->GetItemByPos(item_bag, item_slot); if (!item) { @@ -1170,7 +1169,7 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) (gem_guids[1] && (gem_guids[1] == gem_guids[2]))) return; - Item *itemTarget = _player->GetItemByGuid(item_guid); + Item* itemTarget = _player->GetItemByGuid(item_guid); if (!itemTarget) //missing item to socket return; @@ -1181,11 +1180,11 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data) //this slot is excepted when applying / removing meta gem bonus uint8 slot = itemTarget->IsEquipped() ? itemTarget->GetSlot() : uint8(NULL_SLOT); - Item *Gems[MAX_GEM_SOCKETS]; + Item* Gems[MAX_GEM_SOCKETS]; for (int i = 0; i < MAX_GEM_SOCKETS; ++i) Gems[i] = gem_guids[i] ? _player->GetItemByGuid(gem_guids[i]) : NULL; - GemPropertiesEntry const *GemProps[MAX_GEM_SOCKETS]; + GemPropertiesEntry const* GemProps[MAX_GEM_SOCKETS]; for (int i = 0; i < MAX_GEM_SOCKETS; ++i) //get geminfo from dbc storage GemProps[i] = (Gems[i]) ? sGemPropertiesStore.LookupEntry(Gems[i]->GetTemplate()->GemProperties) : NULL; @@ -1376,7 +1375,7 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recv_data) uint64 guid; recv_data >> guid; // item guid - Item *item = _player->GetItemByGuid(guid); + Item* item = _player->GetItemByGuid(guid); if (!item) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Item refund: item not found!"); @@ -1392,7 +1391,7 @@ void WorldSession::HandleItemRefund(WorldPacket &recv_data) uint64 guid; recv_data >> guid; // item guid - Item *item = _player->GetItemByGuid(guid); + Item* item = _player->GetItemByGuid(guid); if (!item) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Item refund: item not found!"); @@ -1416,7 +1415,7 @@ void WorldSession::HandleItemTextQuery(WorldPacket & recv_data ) WorldPacket data(SMSG_ITEM_TEXT_QUERY_RESPONSE, (4+10)); // guess size - if (Item *item = _player->GetItemByGuid(itemGuid)) + if (Item* item = _player->GetItemByGuid(itemGuid)) { data << uint8(0); // has text data << uint64(itemGuid); // item guid diff --git a/src/server/game/Server/Protocol/Handlers/LootHandler.cpp b/src/server/game/Server/Protocol/Handlers/LootHandler.cpp index 196679a4c73..a3edcd3f827 100755 --- a/src/server/game/Server/Protocol/Handlers/LootHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/LootHandler.cpp @@ -42,7 +42,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket & recv_data) if (IS_GAMEOBJECT_GUID(lguid)) { - GameObject *go = player->GetMap()->GetGameObject(lguid); + GameObject* go = player->GetMap()->GetGameObject(lguid); // not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO if (!go || ((go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player, INTERACTION_DISTANCE))) @@ -55,7 +55,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket & recv_data) } else if (IS_ITEM_GUID(lguid)) { - Item *pItem = player->GetItemByGuid(lguid); + Item* pItem = player->GetItemByGuid(lguid); if (!pItem) { @@ -67,7 +67,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket & recv_data) } else if (IS_CORPSE_GUID(lguid)) { - Corpse *bones = ObjectAccessor::GetCorpse(*player, lguid); + Corpse* bones = ObjectAccessor::GetCorpse(*player, lguid); if (!bones) { player->SendLootRelease(lguid); @@ -158,6 +158,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recv_data*/) if (loot) { + loot->NotifyMoneyRemoved(); if (shareMoney && player->GetGroup()) //item, pickpocket and players can be looted only single player { Group* group = player->GetGroup(); @@ -177,28 +178,27 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket & /*recv_data*/) for (std::vector<Player*>::const_iterator i = playersNear.begin(); i != playersNear.end(); ++i) { + (*i)->ModifyMoney(goldPerPlayer); + (*i)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, goldPerPlayer); + WorldPacket data(SMSG_LOOT_MONEY_NOTIFY, 4 + 1); data << uint32(goldPerPlayer); - data << uint8(0); // Controls the text displayed 0 is "Your share is...", 1 "You loot..." + data << uint8(playersNear.size() > 1 ? 0 : 1); // Controls the text displayed in chat. 0 is "Your share is..." and 1 is "You loot..." (*i)->GetSession()->SendPacket(&data); - - (*i)->ModifyMoney(goldPerPlayer); - (*i)->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, goldPerPlayer); } } else { + player->ModifyMoney(loot->gold); + player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, loot->gold); + WorldPacket data(SMSG_LOOT_MONEY_NOTIFY, 4 + 1); data << uint32(loot->gold); - data << uint8(1); + data << uint8(1); // "You loot..." SendPacket(&data); - - player->ModifyMoney(loot->gold); - player->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_MONEY, loot->gold); } loot->gold = 0; - loot->NotifyMoneyRemoved(); } } @@ -247,7 +247,7 @@ void WorldSession::DoLootRelease(uint64 lguid) if (IS_GAMEOBJECT_GUID(lguid)) { - GameObject *go = GetPlayer()->GetMap()->GetGameObject(lguid); + GameObject* go = GetPlayer()->GetMap()->GetGameObject(lguid); // not check distance for GO in case owned GO (fishing bobber case, for example) or Fishing hole GO if (!go || ((go->GetOwnerGUID() != _player->GetGUID() && go->GetGoType() != GAMEOBJECT_TYPE_FISHINGHOLE) && !go->IsWithinDistInMap(_player, INTERACTION_DISTANCE))) @@ -285,7 +285,7 @@ void WorldSession::DoLootRelease(uint64 lguid) float chance_rate = sWorld->getRate(RATE_MINING_NEXT); int32 ReqValue = 175; - LockEntry const *lockInfo = sLockStore.LookupEntry(go->GetGOInfo()->chest.lockId); + LockEntry const* lockInfo = sLockStore.LookupEntry(go->GetGOInfo()->chest.lockId); if (lockInfo) ReqValue = lockInfo->Skill[0]; float skill = float(player->GetSkillValue(SKILL_MINING))/(ReqValue+25); @@ -343,7 +343,7 @@ void WorldSession::DoLootRelease(uint64 lguid) } else if (IS_CORPSE_GUID(lguid)) // ONLY remove insignia at BG { - Corpse *corpse = ObjectAccessor::GetCorpse(*player, lguid); + Corpse* corpse = ObjectAccessor::GetCorpse(*player, lguid); if (!corpse || !corpse->IsWithinDistInMap(_player, INTERACTION_DISTANCE)) return; @@ -357,7 +357,7 @@ void WorldSession::DoLootRelease(uint64 lguid) } else if (IS_ITEM_GUID(lguid)) { - Item *pItem = player->GetItemByGuid(lguid); + Item* pItem = player->GetItemByGuid(lguid); if (!pItem) return; @@ -439,7 +439,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data) return; } - Player *target = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(target_playerguid, 0, HIGHGUID_PLAYER)); + Player* target = ObjectAccessor::FindPlayer(MAKE_NEW_GUID(target_playerguid, 0, HIGHGUID_PLAYER)); if (!target) return; @@ -448,11 +448,11 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data) if (_player->GetLootGUID() != lootguid) return; - Loot *pLoot = NULL; + Loot* pLoot = NULL; if (IS_CRE_OR_VEH_GUID(GetPlayer()->GetLootGUID())) { - Creature *pCreature = GetPlayer()->GetMap()->GetCreature(lootguid); + Creature* pCreature = GetPlayer()->GetMap()->GetCreature(lootguid); if (!pCreature) return; @@ -460,7 +460,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data) } else if (IS_GAMEOBJECT_GUID(GetPlayer()->GetLootGUID())) { - GameObject *pGO = GetPlayer()->GetMap()->GetGameObject(lootguid); + GameObject* pGO = GetPlayer()->GetMap()->GetGameObject(lootguid); if (!pGO) return; diff --git a/src/server/game/Server/Protocol/Handlers/MailHandler.cpp b/src/server/game/Server/Protocol/Handlers/MailHandler.cpp index 5b601ba15b1..564478e75b9 100755 --- a/src/server/game/Server/Protocol/Handlers/MailHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/MailHandler.cpp @@ -27,6 +27,7 @@ #include "Language.h" #include "DBCStores.h" #include "Item.h" +#include "AccountMgr.h" void WorldSession::HandleSendMail(WorldPacket & recv_data) { @@ -112,7 +113,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data) return; } - Player *receive = ObjectAccessor::FindPlayer(rc); + Player* receive = ObjectAccessor::FindPlayer(rc); uint32 rc_team = 0; uint8 mails_count = 0; //do not allow to send to one player more than 100 mails @@ -129,12 +130,12 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data) rc_team = sObjectMgr->GetPlayerTeamByGUID(rc); if (QueryResult result = CharacterDatabase.PQuery("SELECT COUNT(*) FROM mail WHERE receiver = '%u'", GUID_LOPART(rc))) { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); mails_count = fields[0].GetUInt32(); } if (QueryResult result = CharacterDatabase.PQuery("SELECT level FROM characters WHERE guid = '%u'", GUID_LOPART(rc))) { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); receiveLevel = fields[0].GetUInt8(); } } @@ -160,7 +161,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data) } } - if (!accountBound && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && pl->GetTeam() != rc_team && GetSecurity() == SEC_PLAYER) + if (!accountBound && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && pl->GetTeam() != rc_team && AccountMgr::IsPlayerAccount(GetSecurity())) { pl->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_YOUR_TEAM); return; @@ -246,7 +247,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data) for (uint8 i = 0; i < items_count; ++i) { Item* item = items[i]; - if (GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) + if (!AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail item: %s (Entry: %u Count: %u) to player: %s (Account: %u)", GetPlayerName(), GetAccountId(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetCount(), receiver.c_str(), rc_account); @@ -266,7 +267,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data) needItemDelay = pl->GetSession()->GetAccountId() != rc_account; } - if (money > 0 && GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) + if (money > 0 && !AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(GetAccountId(), "GM %s (Account: %u) mail money: %u to player: %s (Account: %u)", GetPlayerName(), GetAccountId(), money, receiver.c_str(), rc_account); @@ -297,8 +298,8 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket & recv_data) if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX)) return; - Player *pl = _player; - Mail *m = pl->GetMail(mailId); + Player* pl = _player; + Mail* m = pl->GetMail(mailId); if (m) { if (pl->unReadMails) @@ -321,7 +322,7 @@ void WorldSession::HandleMailDelete(WorldPacket & recv_data) if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX)) return; - Mail *m = _player->GetMail(mailId); + Mail* m = _player->GetMail(mailId); Player* pl = _player; pl->m_mailsUpdated = true; if (m) @@ -349,8 +350,8 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data) if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX)) return; - Player *pl = _player; - Mail *m = pl->GetMail(mailId); + Player* pl = _player; + Mail* m = pl->GetMail(mailId); if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL)) { pl->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_ERR_INTERNAL_ERROR); @@ -374,7 +375,7 @@ void WorldSession::HandleMailReturnToSender(WorldPacket & recv_data) { for (MailItemInfoVec::iterator itr2 = m->items.begin(); itr2 != m->items.end(); ++itr2) { - Item *item = pl->GetMItem(itr2->item_guid); + Item* item = pl->GetMItem(itr2->item_guid); if (item) draft.AddItem(item); else @@ -423,7 +424,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data) return; } - Item *it = pl->GetMItem(itemId); + Item* it = pl->GetMItem(itemId); ItemPosCountVec dest; uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, it, false); @@ -436,11 +437,11 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data) if (m->COD > 0) //if there is COD, take COD money from player and send them to sender by mail { uint64 sender_guid = MAKE_NEW_GUID(m->sender, 0, HIGHGUID_PLAYER); - Player *receive = ObjectAccessor::FindPlayer(sender_guid); + Player* receive = ObjectAccessor::FindPlayer(sender_guid); uint32 sender_accId = 0; - if (GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) + if (!AccountMgr::IsPlayerAccount(GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { std::string sender_name; if (receive) @@ -500,7 +501,7 @@ void WorldSession::HandleMailTakeMoney(WorldPacket & recv_data) if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX)) return; - Player *pl = _player; + Player* pl = _player; Mail* m = pl->GetMail(mailId); if (!m || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL)) @@ -604,7 +605,7 @@ void WorldSession::HandleGetMailList(WorldPacket & recv_data) for (uint8 i = 0; i < item_count; ++i) { - Item *item = pl->GetMItem((*itr)->items[i].item_guid); + Item* item = pl->GetMItem((*itr)->items[i].item_guid); // item index (0-6?) data << uint8(i); // item guid low? @@ -657,7 +658,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data) if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX)) return; - Player *pl = _player; + Player* pl = _player; Mail* m = pl->GetMail(mailId); if (!m || (m->body.empty() && !m->mailTemplateId) || m->state == MAIL_STATE_DELETED || m->deliver_time > time(NULL)) @@ -666,7 +667,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data) return; } - Item *bodyItem = new Item; // This is not bag and then can be used new Item. + Item* bodyItem = new Item; // This is not bag and then can be used new Item. if (!bodyItem->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), MAIL_BODY_ITEM_TEMPLATE, pl)) { delete bodyItem; @@ -728,7 +729,7 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket & /*recv_data*/) time_t now = time(NULL); for (PlayerMails::iterator itr = _player->GetMailBegin(); itr != _player->GetMailEnd(); ++itr) { - Mail *m = (*itr); + Mail* m = (*itr); // must be not checked yet if (m->checked & MAIL_CHECK_MASK_READ) continue; diff --git a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp index f5cd293e9ee..f8752d9b167 100755 --- a/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/MiscHandler.cpp @@ -50,6 +50,7 @@ #include "InstanceScript.h" #include "GameObjectAI.h" #include "Group.h" +#include "AccountMgr.h" void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data) { @@ -60,7 +61,7 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket & recv_data) if (GetPlayer()->isAlive() || GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) return; - if (GetPlayer()->HasAuraType(SPELL_AURA_PREVENT_RESSURECTION)) + if (GetPlayer()->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION)) return; // silently return, client should display the error by itself // the world update order is sessions, players, creatures @@ -95,7 +96,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data) recv_data >> code; Creature* unit = NULL; - GameObject *go = NULL; + GameObject* go = NULL; if (IS_CRE_OR_VEH_GUID(guid)) { unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE); @@ -167,7 +168,6 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data) void WorldSession::HandleWhoOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_WHO Message"); - //recv_data.hexlike(); uint32 matchcount = 0; @@ -243,7 +243,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket & recv_data) HashMapHolder<Player>::MapType& m = sObjectAccessor->GetPlayers(); for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { - if (security == SEC_PLAYER) + if (AccountMgr::IsPlayerAccount(security)) { // player can see member of other team only if CONFIG_ALLOW_TWO_SIDE_WHO_LIST if (itr->second->GetTeam() != team && !allowTwoSideWhoList) @@ -474,7 +474,7 @@ void WorldSession::HandleTogglePvP(WorldPacket & recv_data) GetPlayer()->pvpInfo.endTimer = time(NULL); // start toggle-off } - //if (OutdoorPvP * pvp = _player->GetOutdoorPvP()) + //if (OutdoorPvP* pvp = _player->GetOutdoorPvP()) // pvp->HandlePlayerActivityChanged(_player); } @@ -561,13 +561,13 @@ void WorldSession::HandleAddFriendOpcodeCallBack(QueryResult result, std::string team = Player::TeamForRace((*result)[1].GetUInt8()); friendAcctid = (*result)[2].GetUInt32(); - if (GetSecurity() >= SEC_MODERATOR || sWorld->getBoolConfig(CONFIG_ALLOW_GM_FRIEND) || sAccountMgr->GetSecurity(friendAcctid, realmID) < SEC_MODERATOR) + if (!AccountMgr::IsPlayerAccount(GetSecurity()) || sWorld->getBoolConfig(CONFIG_ALLOW_GM_FRIEND) || AccountMgr::IsPlayerAccount(AccountMgr::GetSecurity(friendAcctid, realmID))) { if (friendGuid) { if (friendGuid == GetPlayer()->GetGUID()) friendResult = FRIEND_SELF; - else if (GetPlayer()->GetTeam() != team && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && GetSecurity() < SEC_MODERATOR) + else if (GetPlayer()->GetTeam() != team && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && AccountMgr::IsPlayerAccount(GetSecurity())) friendResult = FRIEND_ENEMY; else if (GetPlayer()->GetSocial()->HasFriend(GUID_LOPART(friendGuid))) friendResult = FRIEND_ALREADY; @@ -729,7 +729,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket &recv_data) if (!GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) return; - Corpse *corpse = GetPlayer()->GetCorpse(); + Corpse* corpse = GetPlayer()->GetCorpse(); if (!corpse) return; @@ -789,47 +789,47 @@ void WorldSession::SendAreaTriggerMessage(const char* Text, ...) SendPacket(&data); } -void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) +void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_AREATRIGGER"); - - uint32 Trigger_ID; + uint32 triggerId; + recv_data >> triggerId; - recv_data >> Trigger_ID; - sLog->outDebug(LOG_FILTER_NETWORKIO, "Trigger ID:%u", Trigger_ID); + sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_AREATRIGGER. Trigger ID: %u", triggerId); - if (GetPlayer()->isInFlight()) + Player* player = GetPlayer(); + if (player->isInFlight()) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) in flight, ignore Area Trigger ID:%u", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), Trigger_ID); + sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) in flight, ignore Area Trigger ID:%u", + player->GetName(), player->GetGUIDLow(), triggerId); return; } - AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(Trigger_ID); + AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(triggerId); if (!atEntry) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID:%u", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow(), Trigger_ID); + sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID:%u", + player->GetName(), player->GetGUIDLow(), triggerId); return; } - if (GetPlayer()->GetMapId() != atEntry->mapid) + if (player->GetMapId() != atEntry->mapid) { - sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u", GetPlayer()->GetName(), atEntry->mapid, GetPlayer()->GetMapId(), GetPlayer()->GetGUIDLow(), Trigger_ID); + sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u", + player->GetName(), atEntry->mapid, player->GetMapId(), player->GetGUIDLow(), triggerId); return; } // delta is safe radius const float delta = 5.0f; - // check if player in the range of areatrigger - Player* pl = GetPlayer(); if (atEntry->radius > 0) { // if we have radius check it - float dist = pl->GetDistance(atEntry->x, atEntry->y, atEntry->z); + float dist = player->GetDistance(atEntry->x, atEntry->y, atEntry->z); if (dist > atEntry->radius + delta) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) too far (radius: %f distance: %f), ignore Area Trigger ID: %u", - pl->GetName(), pl->GetGUIDLow(), atEntry->radius, dist, Trigger_ID); + player->GetName(), player->GetGUIDLow(), atEntry->radius, dist, triggerId); return; } } @@ -841,91 +841,82 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket & recv_data) // is-in-cube check and we have to calculate only one point instead of 4 // 2PI = 360°, keep in mind that ingame orientation is counter-clockwise - double rotation = 2*M_PI-atEntry->box_orientation; + double rotation = 2 * M_PI - atEntry->box_orientation; double sinVal = sin(rotation); double cosVal = cos(rotation); - float playerBoxDistX = pl->GetPositionX() - atEntry->x; - float playerBoxDistY = pl->GetPositionY() - atEntry->y; + float playerBoxDistX = player->GetPositionX() - atEntry->x; + float playerBoxDistY = player->GetPositionY() - atEntry->y; - float rotPlayerX = (float)(atEntry->x + playerBoxDistX * cosVal - playerBoxDistY*sinVal); - float rotPlayerY = (float)(atEntry->y + playerBoxDistY * cosVal + playerBoxDistX*sinVal); + float rotPlayerX = float(atEntry->x + playerBoxDistX * cosVal - playerBoxDistY*sinVal); + float rotPlayerY = float(atEntry->y + playerBoxDistY * cosVal + playerBoxDistX*sinVal); // box edges are parallel to coordiante axis, so we can treat every dimension independently :D - float dz = pl->GetPositionZ() - atEntry->z; + float dz = player->GetPositionZ() - atEntry->z; float dx = rotPlayerX - atEntry->x; float dy = rotPlayerY - atEntry->y; - if ((fabs(dx) > atEntry->box_x/2 + delta) || - (fabs(dy) > atEntry->box_y/2 + delta) || - (fabs(dz) > atEntry->box_z/2 + delta)) + if ((fabs(dx) > atEntry->box_x / 2 + delta) || + (fabs(dy) > atEntry->box_y / 2 + delta) || + (fabs(dz) > atEntry->box_z / 2 + delta)) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) too far (1/2 box X: %f 1/2 box Y: %f 1/2 box Z: %f rotatedPlayerX: %f rotatedPlayerY: %f dZ:%f), ignore Area Trigger ID: %u", - pl->GetName(), pl->GetGUIDLow(), atEntry->box_x/2, atEntry->box_y/2, atEntry->box_z/2, rotPlayerX, rotPlayerY, dz, Trigger_ID); + player->GetName(), player->GetGUIDLow(), atEntry->box_x/2, atEntry->box_y/2, atEntry->box_z/2, rotPlayerX, rotPlayerY, dz, triggerId); return; } } - if (GetPlayer()->isDebugAreaTriggers) - ChatHandler(GetPlayer()).PSendSysMessage(LANG_DEBUG_AREATRIGGER_REACHED, Trigger_ID); + if (player->isDebugAreaTriggers) + ChatHandler(player).PSendSysMessage(LANG_DEBUG_AREATRIGGER_REACHED, triggerId); - if (sScriptMgr->OnAreaTrigger(GetPlayer(), atEntry)) + if (sScriptMgr->OnAreaTrigger(player, atEntry)) return; - uint32 quest_id = sObjectMgr->GetQuestForAreaTrigger(Trigger_ID); - if (quest_id && GetPlayer()->isAlive() && GetPlayer()->IsActiveQuest(quest_id)) - { - Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest_id); - if (pQuest) - { - if (GetPlayer()->GetQuestStatus(quest_id) == QUEST_STATUS_INCOMPLETE) - GetPlayer()->AreaExploredOrEventHappens(quest_id); - } - } + if (player->isAlive()) + if (uint32 questId = sObjectMgr->GetQuestForAreaTrigger(triggerId)) + if (player->GetQuestStatus(questId) == QUEST_STATUS_INCOMPLETE) + player->AreaExploredOrEventHappens(questId); - if (sObjectMgr->IsTavernAreaTrigger(Trigger_ID)) + if (sObjectMgr->IsTavernAreaTrigger(triggerId)) { // set resting flag we are in the inn - GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); - GetPlayer()->InnEnter(time(NULL), atEntry->mapid, atEntry->x, atEntry->y, atEntry->z); - GetPlayer()->SetRestType(REST_TYPE_IN_TAVERN); + player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING); + player->InnEnter(time(NULL), atEntry->mapid, atEntry->x, atEntry->y, atEntry->z); + player->SetRestType(REST_TYPE_IN_TAVERN); if (sWorld->IsFFAPvPRealm()) - GetPlayer()->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); + player->RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP); return; } - if (GetPlayer()->InBattleground()) - { - Battleground* bg = GetPlayer()->GetBattleground(); - if (bg) - if (bg->GetStatus() == STATUS_IN_PROGRESS) - bg->HandleAreaTrigger(GetPlayer(), Trigger_ID); - - return; - } + if (Battleground* bg = player->GetBattleground()) + if (bg->GetStatus() == STATUS_IN_PROGRESS) + { + bg->HandleAreaTrigger(player, triggerId); + return; + } - if (OutdoorPvP * pvp = GetPlayer()->GetOutdoorPvP()) - { - if (pvp->HandleAreaTrigger(_player, Trigger_ID)) + if (OutdoorPvP* pvp = player->GetOutdoorPvP()) + if (pvp->HandleAreaTrigger(_player, triggerId)) return; - } - // NULL if all values default (non teleport trigger) - AreaTrigger const* at = sObjectMgr->GetAreaTrigger(Trigger_ID); + AreaTrigger const* at = sObjectMgr->GetAreaTrigger(triggerId); if (!at) return; - // Check only if target map != current player's map - // check if player can enter instance : instance not full, and raid instance not in encounter fight - if (GetPlayer()->GetMapId() != at->target_mapId && !sMapMgr->CanPlayerEnter(at->target_mapId, GetPlayer(), false)) - return; + bool teleported = false; + if (player->GetMapId() != at->target_mapId) + { + if (!sMapMgr->CanPlayerEnter(at->target_mapId, player, false)) + return; - // Check if we are in LfgGroup and trying to get out the dungeon - if (GetPlayer()->GetGroup() && GetPlayer()->GetGroup()->isLFGGroup() && GetPlayer()->GetMap()->IsDungeon() && at->target_mapId != GetPlayer()->GetMapId()) - GetPlayer()->TeleportToBGEntryPoint(); - else - GetPlayer()->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, at->target_Orientation, TELE_TO_NOT_LEAVE_TRANSPORT); + if (Group* group = player->GetGroup()) + if (group->isLFGGroup() && player->GetMap()->IsDungeon()) + teleported = player->TeleportToBGEntryPoint(); + } + + if (!teleported) + player->TeleportTo(at->target_mapId, at->target_X, at->target_Y, at->target_Z, at->target_Orientation, TELE_TO_NOT_LEAVE_TRANSPORT); } void WorldSession::HandleUpdateAccountData(WorldPacket &recv_data) @@ -995,7 +986,7 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data) if (type > NUM_ACCOUNT_DATA_TYPES) return; - AccountData *adata = GetAccountData(AccountDataType(type)); + AccountData* adata = GetAccountData(AccountDataType(type)); uint32 size = adata->Data.size(); @@ -1199,7 +1190,7 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data) _player->SetSelection(guid); - Player *plr = ObjectAccessor::FindPlayer(guid); + Player* plr = ObjectAccessor::FindPlayer(guid); if (!plr) // wrong player return; @@ -1275,7 +1266,7 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data) sLog->outStaticDebug("Time %u sec, map=%u, x=%f, y=%f, z=%f, orient=%f", time/1000, mapid, PositionX, PositionY, PositionZ, Orientation); - if (GetSecurity() >= SEC_ADMINISTRATOR) + if (AccountMgr::IsAdminAccount(GetSecurity())) GetPlayer()->TeleportTo(mapid, PositionX, PositionY, PositionZ, Orientation); else SendNotification(LANG_YOU_NOT_HAVE_PERMISSION); @@ -1288,7 +1279,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) std::string charname; recv_data >> charname; - if (GetSecurity() < SEC_ADMINISTRATOR) + if (!AccountMgr::IsAdminAccount(GetSecurity())) { SendNotification(LANG_YOU_NOT_HAVE_PERMISSION); return; @@ -1300,7 +1291,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) return; } - Player *plr = sObjectAccessor->FindPlayerByName(charname.c_str()); + Player* plr = sObjectAccessor->FindPlayerByName(charname.c_str()); if (!plr) { @@ -1317,7 +1308,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) return; } - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); std::string acc = fields[0].GetString(); if (acc.empty()) acc = "Unknown"; @@ -1340,7 +1331,6 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data) void WorldSession::HandleComplainOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_COMPLAIN"); - recv_data.hexlike(); uint8 spam_type; // 0 - mail, 1 - chat uint64 spammer_guid; @@ -1401,7 +1391,6 @@ void WorldSession::HandleRealmSplitOpcode(WorldPacket & recv_data) void WorldSession::HandleFarSightOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_FAR_SIGHT"); - //recv_data.hexlike(); uint8 apply; recv_data >> apply; @@ -1414,7 +1403,7 @@ void WorldSession::HandleFarSightOpcode(WorldPacket & recv_data) break; case 1: sLog->outDebug(LOG_FILTER_NETWORKIO, "Added FarSight " UI64FMTD " to player %u", _player->GetUInt64Value(PLAYER_FARSIGHT), _player->GetGUIDLow()); - if (WorldObject *target = _player->GetViewpoint()) + if (WorldObject* target = _player->GetViewpoint()) _player->SetSeer(target); else sLog->outError("Player %s requests non-existing seer " UI64FMTD, _player->GetName(), _player->GetUInt64Value(PLAYER_FARSIGHT)); @@ -1469,7 +1458,7 @@ 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(); + Group* pGroup = _player->GetGroup(); if (pGroup) { if (pGroup->IsLeader(_player->GetGUID())) @@ -1502,19 +1491,19 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data) return; // cannot reset while in an instance - Map *map = _player->GetMap(); + Map* map = _player->GetMap(); if (map && map->IsDungeon()) { sLog->outError("WorldSession::HandleSetDungeonDifficultyOpcode: player (Name: %s, GUID: %u) tried to reset the instance while player is inside!", _player->GetName(), _player->GetGUIDLow()); return; } - Group *pGroup = _player->GetGroup(); + Group* pGroup = _player->GetGroup(); if (pGroup) { if (pGroup->IsLeader(_player->GetGUID())) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* pGroupGuy = itr->getSource(); if (!pGroupGuy) @@ -1557,7 +1546,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) } // cannot reset while in an instance - Map *map = _player->GetMap(); + Map* map = _player->GetMap(); if (map && map->IsDungeon()) { sLog->outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow()); @@ -1567,12 +1556,12 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data) if (Difficulty(mode) == _player->GetRaidDifficulty()) return; - Group *pGroup = _player->GetGroup(); + Group* pGroup = _player->GetGroup(); if (pGroup) { if (pGroup->IsLeader(_player->GetGUID())) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* pGroupGuy = itr->getSource(); if (!pGroupGuy) @@ -1626,7 +1615,6 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket & recv_data) { // fly mode on/off sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_MOVE_SET_CAN_FLY_ACK"); - //recv_data.hexlike(); uint64 guid; // guid - unused recv_data.readPackGUID(guid); @@ -1700,7 +1688,7 @@ void WorldSession::HandleHearthAndResurrect(WorldPacket& /*recv_data*/) if (_player->isInFlight()) return; - AreaTableEntry const *atEntry = GetAreaEntryByAreaID(_player->GetAreaId()); + AreaTableEntry const* atEntry = GetAreaEntryByAreaID(_player->GetAreaId()); if (!atEntry || !(atEntry->flags & AREA_FLAG_WINTERGRASP_2)) return; @@ -1725,5 +1713,5 @@ void WorldSession::HandleInstanceLockResponse(WorldPacket& recvPacket) else _player->RepopAtGraveyard(); - _player->SetPendingBind(NULL, 0); + _player->SetPendingBind(0, 0); } diff --git a/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp b/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp index 050f07e043b..c8c7e882046 100755 --- a/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/MovementHandler.cpp @@ -63,7 +63,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() if (GetPlayer()->m_InstanceValid == false && !mInstance) GetPlayer()->m_InstanceValid = true; - Map * oldMap = GetPlayer()->GetMap(); + Map* oldMap = GetPlayer()->GetMap(); ASSERT(oldMap); if (GetPlayer()->IsInWorld()) { @@ -72,7 +72,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() } // relocate the player to the teleport destination - Map * newMap = sMapMgr->CreateMap(loc.GetMapId(), GetPlayer(), 0); + Map* newMap = sMapMgr->CreateMap(loc.GetMapId(), GetPlayer(), 0); // the CanEnter checks are done in TeleporTo but conditions may change // while the player is in transit, for example the map may get full if (!newMap || !newMap->CanEnter(GetPlayer())) @@ -110,7 +110,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() _player->SetBGTeam(0); } // join to bg case - else if (Battleground *bg = _player->GetBattleground()) + else if (Battleground* bg = _player->GetBattleground()) { if (_player->IsInvitedForBattlegroundInstance(_player->GetBattlegroundId())) bg->AddPlayer(_player); @@ -136,7 +136,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() } // resurrect character at enter into instance where his corpse exist after add to map - Corpse *corpse = GetPlayer()->GetCorpse(); + Corpse* corpse = GetPlayer()->GetCorpse(); if (corpse && corpse->GetType() != CORPSE_BONES && corpse->GetMapId() == GetPlayer()->GetMapId()) { if (mEntry->IsDungeon()) @@ -200,8 +200,8 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data) sLog->outStaticDebug("Guid " UI64FMTD, guid); sLog->outStaticDebug("Flags %u, time %u", flags, time/IN_MILLISECONDS); - Unit *mover = _player->m_mover; - Player *plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL; + Unit* mover = _player->m_mover; + Player* plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL; if (!plMover || !plMover->IsBeingTeleportedNear()) return; @@ -243,13 +243,12 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data) void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) { uint16 opcode = recv_data.GetOpcode(); - recv_data.hexlike(); - Unit *mover = _player->m_mover; + Unit* mover = _player->m_mover; ASSERT(mover != NULL); // there must always be a mover - Player *plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL; + Player* plMover = mover->GetTypeId() == TYPEID_PLAYER ? (Player*)mover : NULL; // ignore, waiting processing in WorldSession::HandleMoveWorldportAckOpcode and WorldSession::HandleMoveTeleportAck if (plMover && plMover->IsBeingTeleported()) @@ -314,7 +313,7 @@ void WorldSession::HandleMovementOpcodes(WorldPacket & recv_data) if (!mover->GetTransport() && !mover->GetVehicle()) { - GameObject *go = mover->GetMap()->GetGameObject(movementInfo.t_guid); + GameObject* go = mover->GetMap()->GetGameObject(movementInfo.t_guid); if (!go || go->GetGoType() != GAMEOBJECT_TYPE_TRANSPORT) movementInfo.flags &= ~MOVEMENTFLAG_ONTRANSPORT; } @@ -479,7 +478,7 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recv_data) if (GetPlayer()->IsInWorld()) { - if (Unit *mover = ObjectAccessor::GetUnit(*GetPlayer(), guid)) + if (Unit* mover = ObjectAccessor::GetUnit(*GetPlayer(), guid)) { GetPlayer()->SetMover(mover); if (mover != GetPlayer() && mover->canFly()) diff --git a/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp b/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp index ef72d8ab5ba..a675214930a 100755 --- a/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/NPCHandler.cpp @@ -135,7 +135,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle) if (!unit->isCanTrainingOf(_player, true)) return; - CreatureTemplate const *ci = unit->GetCreatureInfo(); + CreatureTemplate const* ci = unit->GetCreatureInfo(); if (!ci) { @@ -325,7 +325,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket & recv_data) // If spiritguide, no need for gossip menu, just put player into resurrect queue if (unit->isSpiritGuide()) { - Battleground *bg = _player->GetBattleground(); + Battleground* bg = _player->GetBattleground(); if (bg) { bg->AddPlayerToResurrectQueue(unit->GetGUID(), _player->GetGUID()); @@ -413,8 +413,8 @@ void WorldSession::SendSpiritResurrect() _player->DurabilityLossAll(0.25f, true); // get corpse nearest graveyard - WorldSafeLocsEntry const *corpseGrave = NULL; - Corpse *corpse = _player->GetCorpse(); + WorldSafeLocsEntry const* corpseGrave = NULL; + Corpse* corpse = _player->GetCorpse(); if (corpse) corpseGrave = sObjectMgr->GetClosestGraveYard( corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetMapId(), _player->GetTeam()); @@ -425,7 +425,7 @@ void WorldSession::SendSpiritResurrect() // teleport to nearest from corpse graveyard, if different from nearest to player ghost if (corpseGrave) { - WorldSafeLocsEntry const *ghostGrave = sObjectMgr->GetClosestGraveYard( + WorldSafeLocsEntry const* ghostGrave = sObjectMgr->GetClosestGraveYard( _player->GetPositionX(), _player->GetPositionY(), _player->GetPositionZ(), _player->GetMapId(), _player->GetTeam()); if (corpseGrave != ghostGrave) @@ -461,7 +461,7 @@ void WorldSession::HandleBinderActivateOpcode(WorldPacket & recv_data) SendBindPoint(unit); } -void WorldSession::SendBindPoint(Creature *npc) +void WorldSession::SendBindPoint(Creature* npc) { // prevent set homebind to instances in any case if (GetPlayer()->GetMap()->Instanceable()) @@ -537,7 +537,7 @@ void WorldSession::SendStablePetCallback(QueryResult result, uint64 guid) data << uint64 (guid); - Pet *pet = _player->GetPet(); + Pet* pet = _player->GetPet(); size_t wpos = data.wpos(); data << uint8(0); // place holder for slot show number @@ -561,7 +561,7 @@ void WorldSession::SendStablePetCallback(QueryResult result, uint64 guid) { do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); data << uint32(fields[1].GetUInt32()); // petnumber data << uint32(fields[2].GetUInt32()); // creature entry @@ -609,7 +609,7 @@ void WorldSession::HandleStablePet(WorldPacket & recv_data) if (GetPlayer()->HasUnitState(UNIT_STAT_DIED)) GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH); - Pet *pet = _player->GetPet(); + Pet* pet = _player->GetPet(); // can't place in stable dead pet if (!pet||!pet->isAlive()||pet->getPetType() != HUNTER_PET) @@ -633,7 +633,7 @@ void WorldSession::HandleStablePetCallback(QueryResult result) { do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 slot = fields[1].GetUInt32(); @@ -690,7 +690,7 @@ void WorldSession::HandleUnstablePetCallback(QueryResult result, uint32 petnumbe uint32 creature_id = 0; if (result) { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); creature_id = fields[0].GetUInt32(); } @@ -722,7 +722,7 @@ void WorldSession::HandleUnstablePetCallback(QueryResult result, uint32 petnumbe if (pet) _player->RemovePet(pet, PET_SAVE_AS_DELETED); - Pet *newpet = new Pet(_player, HUNTER_PET); + Pet* newpet = new Pet(_player, HUNTER_PET); if (!newpet->LoadPetFromDB(_player, creature_id, petnumber)) { delete newpet; @@ -753,7 +753,7 @@ void WorldSession::HandleBuyStableSlot(WorldPacket & recv_data) if (GetPlayer()->m_stableSlots < MAX_PET_STABLES) { - StableSlotPricesEntry const *SlotPrice = sStableSlotPricesStore.LookupEntry(GetPlayer()->m_stableSlots+1); + StableSlotPricesEntry const* SlotPrice = sStableSlotPricesStore.LookupEntry(GetPlayer()->m_stableSlots+1); if (_player->HasEnoughMoney(SlotPrice->Price)) { ++GetPlayer()->m_stableSlots; @@ -817,7 +817,7 @@ void WorldSession::HandleStableSwapPetCallback(QueryResult result, uint32 petnum return; } - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 slot = fields[0].GetUInt8(); uint32 creature_id = fields[1].GetUInt32(); @@ -845,7 +845,7 @@ void WorldSession::HandleStableSwapPetCallback(QueryResult result, uint32 petnum _player->RemovePet(pet, pet->isAlive() ? PetSaveMode(slot) : PET_SAVE_AS_DELETED); // summon unstabled pet - Pet *newpet = new Pet(_player); + Pet* newpet = new Pet(_player); if (!newpet->LoadPetFromDB(_player, creature_id, petnumber)) { delete newpet; diff --git a/src/server/game/Server/Protocol/Handlers/PetHandler.cpp b/src/server/game/Server/Protocol/Handlers/PetHandler.cpp index f763d5bc966..3976517152d 100755 --- a/src/server/game/Server/Protocol/Handlers/PetHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/PetHandler.cpp @@ -137,9 +137,9 @@ void WorldSession::HandlePetStopAttack(WorldPacket &recv_data) pet->AttackStop(); } -void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid, uint16 flag, uint64 guid2) +void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid, uint16 flag, uint64 guid2) { - CharmInfo *charmInfo = pet->GetCharmInfo(); + CharmInfo* charmInfo = pet->GetCharmInfo(); if (!charmInfo) { sLog->outError("WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", @@ -186,12 +186,12 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid } // only place where pet can be player - Unit *TargetUnit = ObjectAccessor::GetUnit(*_player, guid2); + Unit* TargetUnit = ObjectAccessor::GetUnit(*_player, guid2); if (!TargetUnit) return; - if (Unit *owner = pet->GetOwner()) - if (!owner->canAttack(TargetUnit)) + if (Unit* owner = pet->GetOwner()) + if (!owner->IsValidAttackTarget(TargetUnit)) return; // Not let attack through obstructions @@ -289,7 +289,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid unit_target = ObjectAccessor::GetUnit(*_player, guid2); // do not cast unknown spells - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellid); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid); if (!spellInfo) { sLog->outError("WORLD: unknown PET spell id %i", spellid); @@ -333,7 +333,7 @@ void WorldSession::HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid if (unit_target->GetTypeId() == TYPEID_PLAYER) pet->SendUpdateToPlayer((Player*)unit_target); } - else if (Unit *unit_target2 = spell->m_targets.GetUnitTarget()) + else if (Unit* unit_target2 = spell->m_targets.GetUnitTarget()) { pet->SetInFront(unit_target2); if (unit_target2->GetTypeId() == TYPEID_PLAYER) @@ -485,7 +485,7 @@ void WorldSession::HandlePetSetAction(WorldPacket & recv_data) return; } - CharmInfo *charmInfo = pet->GetCharmInfo(); + CharmInfo* charmInfo = pet->GetCharmInfo(); if (!charmInfo) { sLog->outError("WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); @@ -620,7 +620,7 @@ void WorldSession::HandlePetRename(WorldPacket & recv_data) pet->SetName(name); - Unit *owner = pet->GetOwner(); + Unit* owner = pet->GetOwner(); if (owner && (owner->GetTypeId() == TYPEID_PLAYER) && owner->ToPlayer()->GetGroup()) owner->ToPlayer()->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_NAME); @@ -714,7 +714,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) if (!pet->HasSpell(spellid) || spellInfo->IsAutocastable()) return; - CharmInfo *charmInfo = pet->GetCharmInfo(); + CharmInfo* charmInfo = pet->GetCharmInfo(); if (!charmInfo) { sLog->outError("WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId()); @@ -754,7 +754,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) return; } - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellId); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { sLog->outError("WORLD: unknown PET spell id %i", spellId); diff --git a/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp b/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp index b0ab7ec6e9f..80cb3eda484 100755 --- a/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/PetitionsHandler.cpp @@ -59,7 +59,6 @@ enum CharterCosts void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_BUY"); - recv_data.hexlike(); uint64 guidNPC; uint32 clientIndex; // 1 for guild and arenaslot+1 for arenas in client @@ -91,7 +90,7 @@ 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); + Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guidNPC, UNIT_NPC_FLAG_PETITIONER); if (!pCreature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandlePetitionBuyOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guidNPC)); @@ -181,7 +180,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) } } - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(charterid); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(charterid); if (!pProto) { _player->SendBuyError(BUY_ERR_CANT_FIND_ITEM, NULL, charterid, 0); @@ -203,7 +202,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) } _player->ModifyMoney(-(int32)cost); - Item *charter = _player->StoreNewItem(dest, charterid, true); + Item* charter = _player->StoreNewItem(dest, charterid, true); if (!charter) return; @@ -224,7 +223,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data) { do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); ssInvalidPetitionGUIDs << '\'' << fields[0].GetUInt32() << "' , "; } while (result->NextRow()); } @@ -246,7 +245,6 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data) { // ok sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_SHOW_SIGNATURES"); - //recv_data.hexlike(); uint8 signs = 0; uint64 petitionguid; @@ -261,7 +259,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data) sLog->outError("Petition %u is not found for player %u %s", GUID_LOPART(petitionguid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName()); return; } - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 type = fields[0].GetUInt8(); // if guild petition and has guild => error, return; @@ -284,7 +282,7 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data) for (uint8 i = 1; i <= signs; ++i) { - Field *fields2 = result->Fetch(); + Field* fields2 = result->Fetch(); uint64 plguid = fields2[0].GetUInt64(); data << uint64(plguid); // Player GUID @@ -298,7 +296,6 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket & recv_data) void WorldSession::HandlePetitionQueryOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_QUERY"); // ok - //recv_data.hexlike(); uint32 guildguid; uint64 petitionguid; @@ -378,7 +375,6 @@ void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid) void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode MSG_PETITION_RENAME"); // ok - //recv_data.hexlike(); uint64 petitionguid; uint32 type; @@ -387,7 +383,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data) recv_data >> petitionguid; // guid recv_data >> newname; // new name - Item *item = _player->GetItemByGuid(petitionguid); + Item* item = _player->GetItemByGuid(petitionguid); if (!item) return; @@ -446,9 +442,8 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket & recv_data) void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_PETITION_SIGN"); // ok - //recv_data.hexlike(); - Field *fields; + Field* fields; uint64 petitionguid; uint8 unk; recv_data >> petitionguid; // petition guid @@ -541,7 +536,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) SendPacket(&data); // update for owner if online - if (Player *owner = ObjectAccessor::FindPlayer(ownerguid)) + if (Player* owner = ObjectAccessor::FindPlayer(ownerguid)) owner->GetSession()->SendPacket(&data); return; } @@ -559,19 +554,18 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recv_data) SendPacket(&data); // update signs count on charter, required testing... - //Item *item = _player->GetItemByGuid(petitionguid)); + //Item* item = _player->GetItemByGuid(petitionguid)); //if (item) // item->SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1+1, signs); // update for owner if online - if (Player *owner = ObjectAccessor::FindPlayer(ownerguid)) + if (Player* owner = ObjectAccessor::FindPlayer(ownerguid)) owner->GetSession()->SendPacket(&data); } void WorldSession::HandlePetitionDeclineOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode MSG_PETITION_DECLINE"); // ok - //recv_data.hexlike(); uint64 petitionguid; uint64 ownerguid; @@ -582,10 +576,10 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket & recv_data) if (!result) return; - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); ownerguid = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER); - Player *owner = ObjectAccessor::FindPlayer(ownerguid); + Player* owner = ObjectAccessor::FindPlayer(ownerguid); if (owner) // petition owner online { WorldPacket data(MSG_PETITION_DECLINE, 8); @@ -597,7 +591,6 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket & recv_data) void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "Received opcode CMSG_OFFER_PETITION"); // ok - //recv_data.hexlike(); uint8 signs = 0; uint64 petitionguid, plguid; @@ -615,7 +608,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data) if (!result) return; - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); type = fields[0].GetUInt8(); sLog->outDebug(LOG_FILTER_NETWORKIO, "OFFER PETITION: type %u, GUID1 %u, to player id: %u", type, GUID_LOPART(petitionguid), GUID_LOPART(plguid)); @@ -683,7 +676,7 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket & recv_data) for (uint8 i = 1; i <= signs; ++i) { - Field *fields2 = result->Fetch(); + Field* fields2 = result->Fetch(); plguid = fields2[0].GetUInt64(); data << uint64(plguid); // Player GUID @@ -723,7 +716,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) if (result) { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); ownerguidlo = fields[0].GetUInt32(); name = fields[1].GetString(); type = fields[2].GetUInt8(); @@ -842,7 +835,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket & recv_data) // Create arena team ArenaTeam* arenaTeam = new ArenaTeam(); - if (!arenaTeam->Create(GUID_LOPART(_player->GetGUID()), type, name, background, icon, iconcolor, border, bordercolor)) + if (!arenaTeam->Create(_player->GetGUID(), type, name, background, icon, iconcolor, border, bordercolor)) { delete arenaTeam; return; @@ -888,7 +881,7 @@ void WorldSession::HandlePetitionShowListOpcode(WorldPacket & recv_data) void WorldSession::SendPetitionShowList(uint64 guid) { - Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_PETITIONER); + Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_PETITIONER); if (!pCreature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandlePetitionShowListOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid))); diff --git a/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp b/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp index 88cff4fc7cf..34dc612cc78 100755 --- a/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/QueryHandler.cpp @@ -31,7 +31,7 @@ #include "Pet.h" #include "MapManager.h" -void WorldSession::SendNameQueryOpcode(Player *p) +void WorldSession::SendNameQueryOpcode(Player* p) { if (!p) return; @@ -85,7 +85,7 @@ void WorldSession::SendNameQueryOpcodeFromDBCallBack(QueryResult result) if (!result) return; - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); std::string name = fields[1].GetString(); uint8 pRace = 0, pGender = 0, pClass = 0; @@ -126,7 +126,7 @@ void WorldSession::HandleNameQueryOpcode(WorldPacket& recv_data) recv_data >> guid; - if (Player *pChar = ObjectAccessor::FindPlayer(guid)) + if (Player* pChar = ObjectAccessor::FindPlayer(guid)) SendNameQueryOpcode(pChar); else SendNameQueryOpcodeFromDB(guid); @@ -153,7 +153,7 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recv_data) uint64 guid; recv_data >> guid; - CreatureTemplate const *ci = sObjectMgr->GetCreatureTemplate(entry); + CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(entry); if (ci) { @@ -164,7 +164,7 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket & recv_data) int loc_idx = GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - if (CreatureLocale const *cl = sObjectMgr->GetCreatureLocale(entry)) + if (CreatureLocale const* cl = sObjectMgr->GetCreatureLocale(entry)) { ObjectMgr::GetLocaleString(cl->Name, loc_idx, Name); ObjectMgr::GetLocaleString(cl->SubName, loc_idx, SubName); @@ -216,7 +216,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recv_data) uint64 guid; recv_data >> guid; - const GameObjectTemplate *info = sObjectMgr->GetGameObjectTemplate(entry); + const GameObjectTemplate* info = sObjectMgr->GetGameObjectTemplate(entry); if (info) { std::string Name; @@ -230,7 +230,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket & recv_data) int loc_idx = GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - if (GameObjectLocale const *gl = sObjectMgr->GetGameObjectLocale(entry)) + if (GameObjectLocale const* gl = sObjectMgr->GetGameObjectLocale(entry)) { ObjectMgr::GetLocaleString(gl->Name, loc_idx, Name); ObjectMgr::GetLocaleString(gl->CastBarCaption, loc_idx, CastBarCaption); @@ -268,7 +268,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket & /*recv_data*/) { sLog->outDetail("WORLD: Received MSG_CORPSE_QUERY"); - Corpse *corpse = GetPlayer()->GetCorpse(); + Corpse* corpse = GetPlayer()->GetCorpse(); if (!corpse) { @@ -359,7 +359,7 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recv_data) int loc_idx = GetSessionDbLocaleIndex(); if (loc_idx >= 0) { - if (NpcTextLocale const *nl = sObjectMgr->GetNpcTextLocale(textID)) + if (NpcTextLocale const* nl = sObjectMgr->GetNpcTextLocale(textID)) { for (int i = 0; i < MAX_LOCALES; ++i) { @@ -402,7 +402,6 @@ void WorldSession::HandleNpcTextQueryOpcode(WorldPacket & recv_data) void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recv_data) { sLog->outDetail("WORLD: Received CMSG_PAGE_TEXT_QUERY"); - recv_data.hexlike(); uint32 pageID; recv_data >> pageID; @@ -427,7 +426,7 @@ void WorldSession::HandlePageTextQueryOpcode(WorldPacket & recv_data) int loc_idx = GetSessionDbLocaleIndex(); if (loc_idx >= 0) - if (PageTextLocale const *pl = sObjectMgr->GetPageTextLocale(pageID)) + if (PageTextLocale const* pl = sObjectMgr->GetPageTextLocale(pageID)) ObjectMgr::GetLocaleString(pl->Text, loc_idx, Text); data << Text; @@ -480,7 +479,7 @@ void WorldSession::HandleQuestPOIQuery(WorldPacket& recv_data) if (questOk) { - QuestPOIVector const *POI = sObjectMgr->GetQuestPOIVector(questId); + QuestPOIVector const* POI = sObjectMgr->GetQuestPOIVector(questId); if (POI) { diff --git a/src/server/game/Server/Protocol/Handlers/QuestHandler.cpp b/src/server/game/Server/Protocol/Handlers/QuestHandler.cpp index 47ccd013f75..97f65865508 100755 --- a/src/server/game/Server/Protocol/Handlers/QuestHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/QuestHandler.cpp @@ -86,7 +86,7 @@ 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); + Creature* pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE); if (!pCreature) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", @@ -146,7 +146,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data) if (_player->GetDivider() != 0) { - Player *pPlayer = ObjectAccessor::FindPlayer(_player->GetDivider()); + Player* pPlayer = ObjectAccessor::FindPlayer(_player->GetDivider()); if (pPlayer) { pPlayer->SendPushToPartyResponse(_player, QUEST_PARTY_MSG_ACCEPT_QUEST); @@ -162,7 +162,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket & recv_data) { if (Group* pGroup = _player->GetGroup()) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* pPlayer = itr->getSource(); @@ -279,7 +279,7 @@ void WorldSession::HandleQuestQueryOpcode(WorldPacket & recv_data) recv_data >> quest; sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_QUEST_QUERY quest = %u", quest); - Quest const *pQuest = sObjectMgr->GetQuestTemplate(quest); + Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest); if (pQuest) { _player->PlayerTalkClass->SendQuestQueryResponse(pQuest); @@ -392,7 +392,7 @@ void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket & recv_data) if (_player->GetQuestStatus(quest) != QUEST_STATUS_COMPLETE) return; - if (Quest const *pQuest = sObjectMgr->GetQuestTemplate(quest)) + if (Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest)) _player->PlayerTalkClass->SendQuestGiverOfferReward(pQuest, guid, true); } @@ -500,7 +500,7 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recv_data) if (!_player->CanInteractWithQuestGiver(pObject)) return; - Quest const *pQuest = sObjectMgr->GetQuestTemplate(quest); + Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest); if (pQuest) { if (!_player->CanSeeStartQuest(pQuest) && _player->GetQuestStatus(quest)==QUEST_STATUS_NONE) @@ -544,13 +544,13 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket) sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_PUSHQUESTTOPARTY quest = %u", questId); - if (Quest const *pQuest = sObjectMgr->GetQuestTemplate(questId)) + if (Quest const* pQuest = sObjectMgr->GetQuestTemplate(questId)) { if (Group* pGroup = _player->GetGroup()) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { - Player *pPlayer = itr->getSource(); + Player* pPlayer = itr->getSource(); if (!pPlayer || pPlayer == _player) // skip self continue; @@ -604,7 +604,7 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket) if (_player->GetDivider() != 0) { - Player *pPlayer = ObjectAccessor::FindPlayer(_player->GetDivider()); + Player* pPlayer = ObjectAccessor::FindPlayer(_player->GetDivider()); if (pPlayer) { WorldPacket data(MSG_QUEST_PUSH_RESULT, (8+1)); @@ -616,7 +616,7 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket) } } -uint32 WorldSession::getDialogStatus(Player *pPlayer, Object* questgiver, uint32 defstatus) +uint32 WorldSession::getDialogStatus(Player* pPlayer, Object* questgiver, uint32 defstatus) { uint32 result = defstatus; @@ -647,7 +647,7 @@ uint32 WorldSession::getDialogStatus(Player *pPlayer, Object* questgiver, uint32 { uint32 result2 = 0; uint32 quest_id = i->second; - Quest const *pQuest = sObjectMgr->GetQuestTemplate(quest_id); + Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest_id); if (!pQuest) continue; ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, pQuest->GetQuestId()); @@ -674,7 +674,7 @@ uint32 WorldSession::getDialogStatus(Player *pPlayer, Object* questgiver, uint32 { uint32 result2 = 0; uint32 quest_id = i->second; - Quest const *pQuest = sObjectMgr->GetQuestTemplate(quest_id); + Quest const* pQuest = sObjectMgr->GetQuestTemplate(quest_id); if (!pQuest) continue; @@ -730,7 +730,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket if (IS_CRE_OR_VEH_OR_PET_GUID(*itr)) { // need also pet quests case support - Creature *questgiver = ObjectAccessor::GetCreatureOrPetOrVehicle(*GetPlayer(), *itr); + Creature* questgiver = ObjectAccessor::GetCreatureOrPetOrVehicle(*GetPlayer(), *itr); if (!questgiver || questgiver->IsHostileTo(_player)) continue; if (!questgiver->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) @@ -745,7 +745,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket } else if (IS_GAMEOBJECT_GUID(*itr)) { - GameObject *questgiver = GetPlayer()->GetMap()->GetGameObject(*itr); + GameObject* questgiver = GetPlayer()->GetMap()->GetGameObject(*itr); if (!questgiver) continue; if (questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER) diff --git a/src/server/game/Server/Protocol/Handlers/ReferAFriendHandler.cpp b/src/server/game/Server/Protocol/Handlers/ReferAFriendHandler.cpp index 678e7a96d07..58d425ddf98 100644 --- a/src/server/game/Server/Protocol/Handlers/ReferAFriendHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/ReferAFriendHandler.cpp @@ -28,7 +28,7 @@ void WorldSession::HandleGrantLevel(WorldPacket& recv_data) uint64 guid; recv_data.readPackGUID(guid); - Player *target = ObjectAccessor::GetObjectInWorld(guid, _player); + Player* target = ObjectAccessor::GetObjectInWorld(guid, _player); // check cheating uint8 levels = _player->GetGrantableLevels(); @@ -70,7 +70,7 @@ void WorldSession::HandleAcceptGrantLevel(WorldPacket& recv_data) uint64 guid; recv_data.readPackGUID(guid); - Player *other = ObjectAccessor::GetObjectInWorld(guid, _player); + Player* other = ObjectAccessor::GetObjectInWorld(guid, _player); if (!(other && other->GetSession())) return; diff --git a/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp b/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp index 3978d582e84..269576a5696 100755 --- a/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/SpellHandler.cpp @@ -86,7 +86,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) return; } - Item *pItem = pUser->GetUseableItemByPos(bagIndex, slot); + Item* pItem = pUser->GetUseableItemByPos(bagIndex, slot); if (!pItem) { pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); @@ -101,7 +101,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) sLog->outDetail("WORLD: CMSG_USE_ITEM packet, bagIndex: %u, slot: %u, castCount: %u, spellId: %u, Item: %u, glyphIndex: %u, data length = %i", bagIndex, slot, castCount, spellId, pItem->GetEntry(), glyphIndex, (uint32)recvPacket.size()); - ItemTemplate const *proto = pItem->GetTemplate(); + ItemTemplate const* proto = pItem->GetTemplate(); if (!proto) { pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL); @@ -140,7 +140,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket) { for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) { - if (SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(proto->Spells[i].SpellId)) + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(proto->Spells[i].SpellId)) { if (!spellInfo->CanBeUsedInCombat()) { @@ -213,14 +213,14 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) sLog->outDetail("bagIndex: %u, slot: %u", bagIndex, slot); - Item *pItem = pUser->GetItemByPos(bagIndex, slot); + Item* pItem = pUser->GetItemByPos(bagIndex, slot); if (!pItem) { pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); return; } - ItemTemplate const *proto = pItem->GetTemplate(); + ItemTemplate const* proto = pItem->GetTemplate(); if (!proto) { pUser->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, pItem, NULL); @@ -240,7 +240,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) uint32 lockId = proto->LockID; if (lockId) { - LockEntry const *lockInfo = sLockStore.LookupEntry(lockId); + LockEntry const* lockInfo = sLockStore.LookupEntry(lockId); if (!lockInfo) { @@ -262,7 +262,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) QueryResult result = CharacterDatabase.PQuery("SELECT entry, flags FROM character_gifts WHERE item_guid = '%u'", pItem->GetGUIDLow()); if (result) { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); uint32 flags = fields[1].GetUInt32(); @@ -295,7 +295,7 @@ void WorldSession::HandleGameObjectUseOpcode(WorldPacket & recv_data) if (_player->m_mover != _player) return; - if (GameObject *obj = GetPlayer()->GetMap()->GetGameObject(guid)) + if (GameObject* obj = GetPlayer()->GetMap()->GetGameObject(guid)) obj->Use(_player); } @@ -338,7 +338,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) return; } - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellId); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { @@ -392,7 +392,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket) // auto-selection buff level base at target level (in spellInfo) if (targets.GetUnitTarget()) { - SpellInfo const *actualSpellInfo = spellInfo->GetAuraRankForLevel(targets.GetUnitTarget()->getLevel()); + SpellInfo const* actualSpellInfo = spellInfo->GetAuraRankForLevel(targets.GetUnitTarget()->getLevel()); // if rank not found then function return NULL but in explicit cast case original spell can be casted and later failed with appropriate error message if (actualSpellInfo) @@ -420,7 +420,7 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket) uint32 spellId; recvPacket >> spellId; - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellId); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) return; @@ -455,7 +455,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket) recvPacket >> guid; recvPacket >> spellId; - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spellId); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); if (!spellInfo) { sLog->outError("WORLD: unknown PET spell id %u", spellId); @@ -537,12 +537,12 @@ void WorldSession::HandleSelfResOpcode(WorldPacket & /*recv_data*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SELF_RES"); // empty opcode - if (_player->HasAuraType(SPELL_AURA_PREVENT_RESSURECTION)) + if (_player->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION)) return; // silent return, client should display error by itself and not send this opcode if (_player->GetUInt32Value(PLAYER_SELF_RES_SPELL)) { - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(_player->GetUInt32Value(PLAYER_SELF_RES_SPELL)); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(_player->GetUInt32Value(PLAYER_SELF_RES_SPELL)); if (spellInfo) _player->CastSpell(_player, spellInfo, false, 0); @@ -627,7 +627,7 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPacket & recv_data) data << uint32(0); else if (*itr == EQUIPMENT_SLOT_BACK && player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_HIDE_CLOAK)) data << uint32(0); - else if (Item const *item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, *itr)) + else if (Item const* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, *itr)) data << uint32(item->GetTemplate()->DisplayInfoID); else data << uint32(0); diff --git a/src/server/game/Server/Protocol/Handlers/TaxiHandler.cpp b/src/server/game/Server/Protocol/Handlers/TaxiHandler.cpp index c6a693515b3..08b2d181cd4 100755 --- a/src/server/game/Server/Protocol/Handlers/TaxiHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/TaxiHandler.cpp @@ -173,7 +173,7 @@ void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket & recv_data) recv_data >> guid >> node_count; - Creature *npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER); + Creature* npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER); if (!npc) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleActivateTaxiExpressOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid))); @@ -284,7 +284,7 @@ void WorldSession::HandleActivateTaxiOpcode(WorldPacket & recv_data) recv_data >> guid >> nodes[0] >> nodes[1]; sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Received CMSG_ACTIVATETAXI from %d to %d" , nodes[0], nodes[1]); - Creature *npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER); + Creature* npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER); if (!npc) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleActivateTaxiOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid))); diff --git a/src/server/game/Server/Protocol/Handlers/TradeHandler.cpp b/src/server/game/Server/Protocol/Handlers/TradeHandler.cpp index 9dce42d6202..b8289bfada3 100755 --- a/src/server/game/Server/Protocol/Handlers/TradeHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/TradeHandler.cpp @@ -28,6 +28,7 @@ #include "Spell.h" #include "SocialMgr.h" #include "Language.h" +#include "AccountMgr.h" void WorldSession::SendTradeStatus(TradeStatus status) { @@ -151,7 +152,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) { // logging sLog->outDebug(LOG_FILTER_NETWORKIO, "partner storing: %u", myItems[i]->GetGUIDLow()); - if (_player->GetSession()->GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) + if (!AccountMgr::IsPlayerAccount(_player->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(_player->GetSession()->GetAccountId(), "GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)", _player->GetName(), _player->GetSession()->GetAccountId(), @@ -169,7 +170,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) { // logging sLog->outDebug(LOG_FILTER_NETWORKIO, "player storing: %u", hisItems[i]->GetGUIDLow()); - if (trader->GetSession()->GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) + if (!AccountMgr::IsPlayerAccount(trader->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(trader->GetSession()->GetAccountId(), "GM %s (Account: %u) trade: %s (Entry: %d Count: %u) to player: %s (Account: %u)", trader->GetName(), trader->GetSession()->GetAccountId(), @@ -213,7 +214,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[]) //============================================================== -static void setAcceptTradeMode(TradeData* myTrade, TradeData* hisTrade, Item **myItems, Item **hisItems) +static void setAcceptTradeMode(TradeData* myTrade, TradeData* hisTrade, Item* *myItems, Item* *hisItems) { myTrade->SetInAcceptProcess(true); hisTrade->SetInAcceptProcess(true); @@ -244,7 +245,7 @@ static void clearAcceptTradeMode(TradeData* myTrade, TradeData* hisTrade) hisTrade->SetInAcceptProcess(false); } -static void clearAcceptTradeMode(Item **myItems, Item **hisItems) +static void clearAcceptTradeMode(Item* *myItems, Item* *hisItems) { // clear 'in-trade' flag for (uint8 i = 0; i < TRADE_SLOT_TRADED_COUNT; ++i) @@ -268,8 +269,8 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) if (!his_trade) return; - Item *myItems[TRADE_SLOT_TRADED_COUNT] = { NULL, NULL, NULL, NULL, NULL, NULL }; - Item *hisItems[TRADE_SLOT_TRADED_COUNT] = { NULL, NULL, NULL, NULL, NULL, NULL }; + Item* myItems[TRADE_SLOT_TRADED_COUNT] = { NULL, NULL, NULL, NULL, NULL, NULL }; + Item* hisItems[TRADE_SLOT_TRADED_COUNT] = { NULL, NULL, NULL, NULL, NULL, NULL }; bool myCanCompleteTrade = true, hisCanCompleteTrade = true; // set before checks for propertly undo at problems (it already set in to client) @@ -459,14 +460,14 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/) // logging money if (sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { - if (_player->GetSession()->GetSecurity() > SEC_PLAYER && my_trade->GetMoney() > 0) + if (!AccountMgr::IsPlayerAccount(_player->GetSession()->GetSecurity()) && my_trade->GetMoney() > 0) { sLog->outCommand(_player->GetSession()->GetAccountId(), "GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)", _player->GetName(), _player->GetSession()->GetAccountId(), my_trade->GetMoney(), trader->GetName(), trader->GetSession()->GetAccountId()); } - if (trader->GetSession()->GetSecurity() > SEC_PLAYER && his_trade->GetMoney() > 0) + if (!AccountMgr::IsPlayerAccount(trader->GetSession()->GetSecurity()) && his_trade->GetMoney() > 0) { sLog->outCommand(trader->GetSession()->GetAccountId(), "GM %s (Account: %u) give money (Amount: %u) to player: %s (Account: %u)", trader->GetName(), trader->GetSession()->GetAccountId(), diff --git a/src/server/game/Server/Protocol/Handlers/VehicleHandler.cpp b/src/server/game/Server/Protocol/Handlers/VehicleHandler.cpp index 2fcfcc25672..7187241cc3a 100644 --- a/src/server/game/Server/Protocol/Handlers/VehicleHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/VehicleHandler.cpp @@ -26,7 +26,6 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_DISMISS_CONTROLLED_VEHICLE"); - recv_data.hexlike(); uint64 vehicleGUID = _player->GetCharmGUID(); @@ -52,7 +51,6 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data) void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE"); - recv_data.hexlike(); Unit* vehicle_base = GetPlayer()->GetVehicleBase(); if (!vehicle_base) @@ -96,9 +94,9 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data) if (!accessory) GetPlayer()->ChangeSeat(-1, seatId > 0); // prev/next - else if (Unit *vehUnit = Unit::GetUnit(*GetPlayer(), accessory)) + else if (Unit* vehUnit = Unit::GetUnit(*GetPlayer(), accessory)) { - if (Vehicle *vehicle = vehUnit->GetVehicleKit()) + if (Vehicle* vehicle = vehUnit->GetVehicleKit()) if (vehicle->HasEmptySeat(seatId)) vehUnit->HandleSpellClick(GetPlayer(), seatId); } @@ -114,8 +112,8 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket &recv_data) if (vehicle_base->GetGUID() == guid) GetPlayer()->ChangeSeat(seatId); - else if (Unit *vehUnit = Unit::GetUnit(*GetPlayer(), guid)) - if (Vehicle *vehicle = vehUnit->GetVehicleKit()) + else if (Unit* vehUnit = Unit::GetUnit(*GetPlayer(), guid)) + if (Vehicle* vehicle = vehUnit->GetVehicleKit()) if (vehicle->HasEmptySeat(seatId)) vehUnit->HandleSpellClick(GetPlayer(), seatId); break; @@ -159,7 +157,7 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data) if (IS_PLAYER_GUID(guid)) { - Player *plr = ObjectAccessor::FindPlayer(guid); + Player* plr = ObjectAccessor::FindPlayer(guid); if (!plr) { sLog->outError("Player %u tried to eject player %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); @@ -182,7 +180,7 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data) else if (IS_CREATURE_GUID(guid)) { - Unit *unit = ObjectAccessor::GetUnit(*_player, guid); + Unit* unit = ObjectAccessor::GetUnit(*_player, guid); if (!unit) // creatures can be ejected too from player mounts { sLog->outError("Player %u tried to eject creature guid %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid)); @@ -209,10 +207,9 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data) sLog->outError("HandleEjectPassenger: Player %u tried to eject invalid GUID "UI64FMTD, GetPlayer()->GetGUIDLow(), guid); } -void WorldSession::HandleRequestVehicleExit(WorldPacket &recv_data) +void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recv_data*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_REQUEST_VEHICLE_EXIT"); - recv_data.hexlike(); if (Vehicle* vehicle = GetPlayer()->GetVehicle()) { diff --git a/src/server/game/Server/Protocol/Handlers/VoiceChatHandler.cpp b/src/server/game/Server/Protocol/Handlers/VoiceChatHandler.cpp index e2b5fe96ae1..be8307b29b1 100755 --- a/src/server/game/Server/Protocol/Handlers/VoiceChatHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/VoiceChatHandler.cpp @@ -22,27 +22,24 @@ #include "Opcodes.h" #include "Log.h" -void WorldSession::HandleVoiceSessionEnableOpcode(WorldPacket & recv_data) +void WorldSession::HandleVoiceSessionEnableOpcode(WorldPacket& recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_VOICE_SESSION_ENABLE"); // uint8 isVoiceEnabled, uint8 isMicrophoneEnabled recv_data.read_skip<uint8>(); recv_data.read_skip<uint8>(); - recv_data.hexlike(); } -void WorldSession::HandleChannelVoiceOnOpcode(WorldPacket & recv_data) +void WorldSession::HandleChannelVoiceOnOpcode(WorldPacket& /*recv_data*/) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CHANNEL_VOICE_ON"); // Enable Voice button in channel context menu - recv_data.hexlike(); } -void WorldSession::HandleSetActiveVoiceChannel(WorldPacket & recv_data) +void WorldSession::HandleSetActiveVoiceChannel(WorldPacket& recv_data) { sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_SET_ACTIVE_VOICE_CHANNEL"); recv_data.read_skip<uint32>(); recv_data.read_skip<char*>(); - recv_data.hexlike(); } diff --git a/src/server/game/Server/Protocol/Opcodes.cpp b/src/server/game/Server/Protocol/Opcodes.cpp index 629df10abf7..cbaf789faf6 100755 --- a/src/server/game/Server/Protocol/Opcodes.cpp +++ b/src/server/game/Server/Protocol/Opcodes.cpp @@ -1256,10 +1256,10 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x4CB*/ { "CMSG_START_BATTLEFIELD_CHEAT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x4CC*/ { "CMSG_END_BATTLEFIELD_CHEAT", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x4CD*/ { "SMSG_MULTIPLE_PACKETS", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, - /*0x4CE*/ { "SMSG_FORCE_UNK1_SPEED_CHANGE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, - /*0x4CF*/ { "CMSG_FORCE_UNK1_SPEED_CHANGE_ACK", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, - /*0x4D0*/ { "SMSG_FORCE_UNK2_SPEED_CHANGE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, - /*0x4D1*/ { "CMSG_FORCE_UNK2_SPEED_CHANGE_ACK", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, + /*0x4CE*/ { "SMSG_MOVE_GRAVITY_DISABLE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, + /*0x4CF*/ { "CMSG_MOVE_GRAVITY_DISABLE_ACK", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, + /*0x4D0*/ { "SMSG_MOVE_GRAVITY_ENABLE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, + /*0x4D1*/ { "CMSG_MOVE_GRAVITY_ENABLE_ACK", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_NULL }, /*0x4D2*/ { "MSG_MOVE_GRAVITY_CHNG", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x4D3*/ { "SMSG_SPLINE_MOVE_GRAVITY_DISABLE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, /*0x4D4*/ { "SMSG_SPLINE_MOVE_GRAVITY_ENABLE", STATUS_NEVER, PROCESS_INPLACE, &WorldSession::Handle_ServerSide }, diff --git a/src/server/game/Server/Protocol/Opcodes.h b/src/server/game/Server/Protocol/Opcodes.h index 5f88aa3c01f..c02b52bfb5a 100755 --- a/src/server/game/Server/Protocol/Opcodes.h +++ b/src/server/game/Server/Protocol/Opcodes.h @@ -1264,10 +1264,10 @@ enum Opcodes CMSG_START_BATTLEFIELD_CHEAT = 0x4CB, CMSG_END_BATTLEFIELD_CHEAT = 0x4CC, SMSG_MULTIPLE_PACKETS = 0x4CD, - SMSG_FORCE_UNK1_SPEED_CHANGE = 0x4CE, - CMSG_FORCE_UNK1_SPEED_CHANGE_ACK = 0x4CF, - SMSG_FORCE_UNK2_SPEED_CHANGE = 0x4D0, - CMSG_FORCE_UNK2_SPEED_CHANGE_ACK = 0x4D1, + SMSG_MOVE_GRAVITY_DISABLE = 0x4CE, + CMSG_MOVE_GRAVITY_DISABLE_ACK = 0x4CF, + SMSG_MOVE_GRAVITY_ENABLE = 0x4D0, + CMSG_MOVE_GRAVITY_ENABLE_ACK = 0x4D1, MSG_MOVE_GRAVITY_CHNG = 0x4D2, SMSG_SPLINE_MOVE_GRAVITY_DISABLE = 0x4D3, SMSG_SPLINE_MOVE_GRAVITY_ENABLE = 0x4D4, diff --git a/src/server/game/Server/Protocol/WorldLog.cpp b/src/server/game/Server/Protocol/WorldLog.cpp index 5c7026797ed..54986b2b158 100755 --- a/src/server/game/Server/Protocol/WorldLog.cpp +++ b/src/server/game/Server/Protocol/WorldLog.cpp @@ -57,7 +57,7 @@ void WorldLog::Initialize() m_dbWorld = sConfig->GetBoolDefault("LogDB.World", false); // can be VERY heavy if enabled } -void WorldLog::outTimestampLog(char const *fmt, ...) +void WorldLog::outTimestampLog(char const* fmt, ...) { if (LogWorld()) { @@ -85,7 +85,7 @@ void WorldLog::outTimestampLog(char const *fmt, ...) } } -void WorldLog::outLog(char const *fmt, ...) +void WorldLog::outLog(char const* fmt, ...) { if (LogWorld()) { diff --git a/src/server/game/Server/Protocol/WorldLog.h b/src/server/game/Server/Protocol/WorldLog.h index c5ff188c522..46d12ec1aff 100755 --- a/src/server/game/Server/Protocol/WorldLog.h +++ b/src/server/game/Server/Protocol/WorldLog.h @@ -46,11 +46,11 @@ class WorldLog /// Is the world logger active? bool LogWorld(void) const { return (i_file != NULL); } /// %Log to the file - void outLog(char const *fmt, ...); - void outTimestampLog(char const *fmt, ...); + void outLog(char const* fmt, ...); + void outTimestampLog(char const* fmt, ...); private: - FILE *i_file; + FILE* i_file; bool m_dbWorld; }; diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 025fbeb9c90..80af3961caf 100755 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -55,7 +55,7 @@ bool MapSessionFilter::Process(WorldPacket* packet) if (opHandle.packetProcessing == PROCESS_THREADUNSAFE) return false; - Player *plr = m_pSession->GetPlayer(); + Player* plr = m_pSession->GetPlayer(); if (!plr) return false; @@ -77,7 +77,7 @@ bool WorldSessionFilter::Process(WorldPacket* packet) return true; //no player attached? -> our client! ^^ - Player *plr = m_pSession->GetPlayer(); + Player* plr = m_pSession->GetPlayer(); if (!plr) return true; @@ -86,7 +86,7 @@ bool WorldSessionFilter::Process(WorldPacket* packet) } /// WorldSession constructor -WorldSession::WorldSession(uint32 id, WorldSocket *sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale, uint32 recruiter, bool isARecruiter): +WorldSession::WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale, uint32 recruiter, bool isARecruiter): m_muteTime(mute_time), m_timeOutTime(0), _player(NULL), m_Socket(sock), _security(sec), _accountId(id), m_expansion(expansion), _logoutTime(0), m_inQueue(false), m_playerLoading(false), m_playerLogout(false), @@ -137,13 +137,13 @@ void WorldSession::SizeError(WorldPacket const &packet, uint32 size) const } /// Get the player name -char const *WorldSession::GetPlayerName() const +char const* WorldSession::GetPlayerName() const { return GetPlayer() ? GetPlayer()->GetName() : "<none>"; } /// Send a packet to the client -void WorldSession::SendPacket(WorldPacket const *packet) +void WorldSession::SendPacket(WorldPacket const* packet) { if (!m_Socket) return; @@ -187,7 +187,7 @@ void WorldSession::SendPacket(WorldPacket const *packet) } /// Add an incoming packet to the queue -void WorldSession::QueuePacket(WorldPacket *new_packet) +void WorldSession::QueuePacket(WorldPacket* new_packet) { _recvQueue.add(new_packet); } @@ -377,10 +377,10 @@ void WorldSession::LogoutPlayer(bool Save) _player->RemoveAllAurasOnDeath(); // build set of player who attack _player or who have pet attacking of _player - std::set<Player *> aset; + std::set<Player*> aset; for (Unit::AttackerSet::const_iterator itr = _player->getAttackers().begin(); itr != _player->getAttackers().end(); ++itr) { - Unit *owner = (*itr)->GetOwner(); // including player controlled case + Unit* owner = (*itr)->GetOwner(); // including player controlled case if (owner && owner->GetTypeId() == TYPEID_PLAYER) aset.insert(owner->ToPlayer()); else if ((*itr)->GetTypeId() == TYPEID_PLAYER) @@ -393,13 +393,13 @@ void WorldSession::LogoutPlayer(bool Save) _player->RepopAtGraveyard(); // give honor to all attackers from set like group case - for (std::set<Player *>::const_iterator itr = aset.begin(); itr != aset.end(); ++itr) + for (std::set<Player*>::const_iterator itr = aset.begin(); itr != aset.end(); ++itr) (*itr)->RewardHonor(_player, aset.size()); // give bg rewards and update counters like kill by first from attackers // this can't be called for all attackers. if (!aset.empty()) - if (Battleground *bg = _player->GetBattleground()) + if (Battleground* bg = _player->GetBattleground()) bg->HandleKillPlayer(_player, *aset.begin()); } else if (_player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION)) @@ -413,11 +413,11 @@ void WorldSession::LogoutPlayer(bool Save) else if (_player->HasPendingBind()) { _player->RepopAtGraveyard(); - _player->SetPendingBind(NULL, 0); + _player->SetPendingBind(0, 0); } //drop a flag if player is carrying it - if (Battleground *bg = _player->GetBattleground()) + if (Battleground* bg = _player->GetBattleground()) bg->EventPlayerLoggedOut(_player); ///- Teleport to home if the player is in an invalid instance @@ -441,7 +441,7 @@ 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())) + if (Guild* pGuild = sGuildMgr->GetGuildById(_player->GetGuildId())) pGuild->HandleMemberLogout(this); ///- Remove pet @@ -493,7 +493,7 @@ void WorldSession::LogoutPlayer(bool Save) // calls to GetMap in this case may cause crashes _player->CleanupsBeforeDelete(); sLog->outChar("Account: %d (IP: %s) Logout Character:[%s] (GUID: %u)", GetAccountId(), GetRemoteAddress().c_str(), _player->GetName() , _player->GetGUIDLow()); - Map *_map = _player->GetMap(); + Map* _map = _player->GetMap(); _map->Remove(_player, true); SetPlayer(NULL); // deleted in Remove call @@ -539,7 +539,7 @@ void WorldSession::SendNotification(const char *format, ...) void WorldSession::SendNotification(uint32 string_id, ...) { - char const *format = GetTrinityString(string_id); + char const* format = GetTrinityString(string_id); if (format) { va_list ap; @@ -616,7 +616,7 @@ void WorldSession::LoadAccountData(PreparedQueryResult result, uint32 mask) do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 type = fields[0].GetUInt8(); if (type >= NUM_ACCOUNT_DATA_TYPES) { @@ -717,7 +717,7 @@ void WorldSession::SaveTutorialsData(SQLTransaction &trans) m_TutorialsChanged = false; } -void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo *mi) +void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo* mi) { data >> mi->flags; data >> mi->flags2; @@ -787,7 +787,7 @@ void WorldSession::ReadMovementInfo(WorldPacket &data, MovementInfo *mi) mi->flags &= ~(MOVEMENTFLAG_FORWARD | MOVEMENTFLAG_BACKWARD); } -void WorldSession::WriteMovementInfo(WorldPacket *data, MovementInfo *mi) +void WorldSession::WriteMovementInfo(WorldPacket* data, MovementInfo* mi) { data->appendPackGUID(mi->guid); @@ -868,7 +868,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data) AddonInfo addon(addonName, enabled, crc, 2, true); - SavedAddon const* savedAddon = sAddonMgr->GetAddonInfo(addonName); + SavedAddon const* savedAddon = AddonMgr::GetAddonInfo(addonName); if (savedAddon) { bool match = true; @@ -883,7 +883,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data) } else { - sAddonMgr->SaveAddon(addon); + AddonMgr::SaveAddon(addon); sLog->outDetail("ADDON: %s (0x%x) was not known, saving...", addon.Name.c_str(), addon.CRC); } @@ -964,7 +964,7 @@ void WorldSession::SendAddonsInfo() SendPacket(&data); } -void WorldSession::SetPlayer(Player *plr) +void WorldSession::SetPlayer(Player* plr) { _player = plr; diff --git a/src/server/game/Server/WorldSession.h b/src/server/game/Server/WorldSession.h index fe082119f78..8e489b7ea50 100755 --- a/src/server/game/Server/WorldSession.h +++ b/src/server/game/Server/WorldSession.h @@ -142,23 +142,23 @@ enum CharterTypes class PacketFilter { public: - explicit PacketFilter(WorldSession * pSession) : m_pSession(pSession) {} + explicit PacketFilter(WorldSession* pSession) : m_pSession(pSession) {} virtual ~PacketFilter() {} - virtual bool Process(WorldPacket * /*packet*/) { return true; } + virtual bool Process(WorldPacket* /*packet*/) { return true; } virtual bool ProcessLogout() const { return true; } protected: - WorldSession * const m_pSession; + WorldSession* const m_pSession; }; //process only thread-safe packets in Map::Update() class MapSessionFilter : public PacketFilter { public: - explicit MapSessionFilter(WorldSession * pSession) : PacketFilter(pSession) {} + explicit MapSessionFilter(WorldSession* pSession) : PacketFilter(pSession) {} ~MapSessionFilter() {} - virtual bool Process(WorldPacket * packet); + virtual bool Process(WorldPacket* packet); //in Map::Update() we do not process player logout! virtual bool ProcessLogout() const { return false; } }; @@ -168,7 +168,7 @@ public: class WorldSessionFilter : public PacketFilter { public: - explicit WorldSessionFilter(WorldSession * pSession) : PacketFilter(pSession) {} + explicit WorldSessionFilter(WorldSession* pSession) : PacketFilter(pSession) {} ~WorldSessionFilter() {} virtual bool Process(WorldPacket* packet); @@ -214,7 +214,7 @@ class CharacterCreateInfo class WorldSession { public: - WorldSession(uint32 id, WorldSocket *sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale, uint32 recruiter, bool isARecruiter); + WorldSession(uint32 id, WorldSocket* sock, AccountTypes sec, uint8 expansion, time_t mute_time, LocaleConstant locale, uint32 recruiter, bool isARecruiter); ~WorldSession(); bool PlayerLoading() const { return m_playerLoading; } @@ -226,8 +226,8 @@ class WorldSession void ReadAddonsInfo(WorldPacket &data); void SendAddonsInfo(); - void ReadMovementInfo(WorldPacket &data, MovementInfo *mi); - void WriteMovementInfo(WorldPacket *data, MovementInfo *mi); + void ReadMovementInfo(WorldPacket &data, MovementInfo* mi); + void WriteMovementInfo(WorldPacket* data, MovementInfo* mi); void SendPacket(WorldPacket const* packet); void SendNotification(const char *format, ...) ATTR_PRINTF(2, 3); @@ -247,7 +247,7 @@ class WorldSession char const* GetPlayerName() const; void SetSecurity(AccountTypes security) { _security = security; } std::string const& GetRemoteAddress() { return m_Address; } - void SetPlayer(Player *plr); + void SetPlayer(Player* plr); uint8 Expansion() const { return m_expansion; } /// Session in auth.queue currently @@ -311,7 +311,7 @@ class WorldSession bool CheckStableMaster(uint64 guid); // Account Data - AccountData *GetAccountData(AccountDataType type) { return &m_accountData[type]; } + AccountData* GetAccountData(AccountDataType type) { return &m_accountData[type]; } void SetAccountData(AccountDataType type, time_t tm, std::string data); void SendAccountDataTimes(uint32 mask); void LoadGlobalAccountData(); @@ -335,7 +335,7 @@ class WorldSession void SendAuctionHello(uint64 guid, Creature* unit); void SendAuctionCommandResult(uint32 auctionId, uint32 Action, uint32 ErrorCode, uint32 bidError = 0); void SendAuctionBidderNotification(uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template); - void SendAuctionOwnerNotification(AuctionEntry * auction); + void SendAuctionOwnerNotification(AuctionEntry* auction); //Item Enchantment void SendEnchantmentLog(uint64 Target, uint64 Caster, uint32 ItemID, uint32 SpellID); @@ -353,7 +353,7 @@ class WorldSession void SendNotInArenaTeamPacket(uint8 type); void SendPetitionShowList(uint64 guid); - void BuildPartyMemberStatsChangedPacket(Player* player, WorldPacket *data); + void BuildPartyMemberStatsChangedPacket(Player* player, WorldPacket* data); void DoLootRelease(uint64 lguid); @@ -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* pPlayer, Object* questgiver, uint32 defstatus); time_t m_timeOutTime; void UpdateTimeOutTime(uint32 diff) @@ -635,7 +635,7 @@ class WorldSession void HandleQueryNextMailTime(WorldPacket & recv_data); void HandleCancelChanneling(WorldPacket & recv_data); - void SendItemPageInfo(ItemTemplate *itemProto); + void SendItemPageInfo(ItemTemplate* itemProto); void HandleSplitItemOpcode(WorldPacket& recvPacket); void HandleSwapInvItemOpcode(WorldPacket& recvPacket); void HandleDestroyItemOpcode(WorldPacket& recvPacket); @@ -737,7 +737,7 @@ class WorldSession //Pet void HandlePetAction(WorldPacket & recv_data); void HandlePetStopAttack(WorldPacket& recv_data); - void HandlePetActionHelper(Unit *pet, uint64 guid1, uint16 spellid, uint16 flag, uint64 guid2); + void HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid, uint16 flag, uint64 guid2); void HandlePetNameQuery(WorldPacket & recv_data); void HandlePetSetAction(WorldPacket & recv_data); void HandlePetAbandon(WorldPacket & recv_data); @@ -800,12 +800,12 @@ class WorldSession void SendLfgUpdatePlayer(const LfgUpdateData& updateData); void SendLfgUpdateParty(const LfgUpdateData& updateData); void SendLfgRoleChosen(uint64 guid, uint8 roles); - void SendLfgRoleCheckUpdate(const LfgRoleCheck *pRoleCheck); + void SendLfgRoleCheckUpdate(const LfgRoleCheck* pRoleCheck); void SendLfgUpdateSearch(bool update); void SendLfgJoinResult(const LfgJoinResultData& joinData); void SendLfgQueueStatus(uint32 dungeon, int32 waitTime, int32 avgWaitTime, int32 waitTimeTanks, int32 waitTimeHealer, int32 waitTimeDps, uint32 queuedTime, uint8 tanks, uint8 healers, uint8 dps); - void SendLfgPlayerReward(uint32 rdungeonEntry, uint32 sdungeonEntry, uint8 done, const LfgReward *reward, const Quest *qRew); - void SendLfgBootPlayer(const LfgPlayerBoot *pBoot); + void SendLfgPlayerReward(uint32 rdungeonEntry, uint32 sdungeonEntry, uint8 done, const LfgReward* reward, const Quest *qRew); + void SendLfgBootPlayer(const LfgPlayerBoot* pBoot); void SendLfgUpdateProposal(uint32 proposalId, const LfgProposal *pProp); void SendLfgDisabled(); void SendLfgOfferContinue(uint32 dungeonEntry); @@ -931,14 +931,16 @@ class WorldSession std::set<uint32> _allowedCharsToLogin; uint32 m_GUIDLow; // set loggined or recently logout player (while m_playerRecentlyLogout set) - Player *_player; - WorldSocket *m_Socket; + Player* _player; + WorldSocket* m_Socket; std::string m_Address; AccountTypes _security; uint32 _accountId; uint8 m_expansion; + typedef std::list<AddonInfo> AddonsList; + time_t _logoutTime; bool m_inQueue; // session wait in auth.queue bool m_playerLoading; // code processed in LoginPlayer diff --git a/src/server/game/Server/WorldSocket.cpp b/src/server/game/Server/WorldSocket.cpp index 74187686fe6..c5daa540632 100755 --- a/src/server/game/Server/WorldSocket.cpp +++ b/src/server/game/Server/WorldSocket.cpp @@ -44,6 +44,7 @@ #include "Log.h" #include "WorldLog.h" #include "ScriptMgr.h" +#include "AccountMgr.h" #if defined(__GNUC__) #pragma pack(1) @@ -384,7 +385,7 @@ int WorldSocket::handle_output_queue (GuardType& g) if (msg_queue()->is_empty()) return cancel_wakeup_output(g); - ACE_Message_Block *mblk; + ACE_Message_Block* mblk; if (msg_queue()->dequeue_head(mblk, (ACE_Time_Value*)&ACE_Time_Value::zero) == -1) { @@ -494,7 +495,7 @@ int WorldSocket::handle_input_header (void) if ((header.size < 4) || (header.size > 10240) || (header.cmd > 10240)) { - Player *_player = m_Session ? m_Session->GetPlayer() : NULL; + Player* _player = m_Session ? m_Session->GetPlayer() : NULL; sLog->outError ("WorldSocket::handle_input_header(): client (account: %u, char [GUID: %u, name: %s]) sent malformed packet (size: %d , cmd: %d)", m_Session ? m_Session->GetAccountId() : 0, _player ? _player->GetGUIDLow() : 0, @@ -935,7 +936,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) // Check locked state for server AccountTypes allowedAccountType = sWorld->GetPlayerSecurityLimit(); sLog->outDebug(LOG_FILTER_NETWORKIO, "Allowed Level: %u Player Level %u", allowedAccountType, AccountTypes(security)); - if (allowedAccountType > SEC_PLAYER && AccountTypes(security) < allowedAccountType) + if (AccountTypes(security) < allowedAccountType) { WorldPacket Packet (SMSG_AUTH_RESPONSE, 1); Packet << uint8 (AUTH_UNAVAILABLE); @@ -1039,7 +1040,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket) { ACE_GUARD_RETURN (LockType, Guard, m_SessionLock, -1); - if (m_Session && m_Session->GetSecurity() == SEC_PLAYER) + if (m_Session && AccountMgr::IsPlayerAccount(m_Session->GetSecurity())) { Player* _player = m_Session->GetPlayer(); sLog->outError("WorldSocket::HandlePing: Player (account: %u, GUID: %u, name: %s) kicked for over-speed pings (address: %s)", diff --git a/src/server/game/Server/WorldSocket.h b/src/server/game/Server/WorldSocket.h index 7a121cbe3df..d10b0a11301 100755 --- a/src/server/game/Server/WorldSocket.h +++ b/src/server/game/Server/WorldSocket.h @@ -195,7 +195,7 @@ class WorldSocket : public WorldHandler LockType m_OutBufferLock; /// Buffer used for writing output. - ACE_Message_Block *m_OutBuffer; + ACE_Message_Block* m_OutBuffer; /// Size of the m_OutBuffer. size_t m_OutBufferSize; diff --git a/src/server/game/Skills/SkillDiscovery.cpp b/src/server/game/Skills/SkillDiscovery.cpp index 884d0710037..1899d75b4cf 100755 --- a/src/server/game/Skills/SkillDiscovery.cpp +++ b/src/server/game/Skills/SkillDiscovery.cpp @@ -67,7 +67,7 @@ void LoadSkillDiscoveryTable() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 spellId = fields[0].GetUInt32(); int32 reqSkillOrSpell = fields[1].GetInt32(); diff --git a/src/server/game/Skills/SkillExtraItems.cpp b/src/server/game/Skills/SkillExtraItems.cpp index 207fae93fe6..600655c4a60 100755 --- a/src/server/game/Skills/SkillExtraItems.cpp +++ b/src/server/game/Skills/SkillExtraItems.cpp @@ -69,7 +69,7 @@ void LoadSkillExtraItemTable() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 spellId = fields[0].GetUInt32(); diff --git a/src/server/game/Spells/Auras/SpellAuraDefines.h b/src/server/game/Spells/Auras/SpellAuraDefines.h index 727e48b2041..7c0be84bf50 100755 --- a/src/server/game/Spells/Auras/SpellAuraDefines.h +++ b/src/server/game/Spells/Auras/SpellAuraDefines.h @@ -373,7 +373,7 @@ enum AuraType SPELL_AURA_311 = 311, SPELL_AURA_312 = 312, SPELL_AURA_313 = 313, - SPELL_AURA_PREVENT_RESSURECTION = 314, + SPELL_AURA_PREVENT_RESURRECTION = 314, SPELL_AURA_UNDERWATER_WALKING = 315, SPELL_AURA_PERIODIC_HASTE = 316, TOTAL_AURAS = 317 diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 0fe54f2f2e8..e8de9c4c773 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -367,7 +367,7 @@ pAuraEffectHandler AuraEffectHandler[TOTAL_AURAS]= &AuraEffect::HandleNULL, //311 0 spells in 3.3.5 &AuraEffect::HandleNULL, //312 0 spells in 3.3.5 &AuraEffect::HandleNULL, //313 0 spells in 3.3.5 - &AuraEffect::HandlePreventResurrection, //314 SPELL_AURA_PREVENT_RESSURECTION todo + &AuraEffect::HandlePreventResurrection, //314 SPELL_AURA_PREVENT_RESURRECTION todo &AuraEffect::HandleNoImmediateEffect, //315 SPELL_AURA_UNDERWATER_WALKING todo &AuraEffect::HandleNoImmediateEffect, //316 SPELL_AURA_PERIODIC_HASTE implemented in AuraEffect::CalculatePeriodic }; @@ -390,7 +390,7 @@ AuraEffect::~AuraEffect() delete m_spellmod; } -void AuraEffect::GetTargetList(std::list<Unit *> & targetList) const +void AuraEffect::GetTargetList(std::list<Unit*> & targetList) const { Aura::ApplicationMap const & targetMap = GetBase()->GetApplicationMap(); // remove all targets which were not added to new list - they no longer deserve area aura @@ -1278,7 +1278,7 @@ bool AuraEffect::IsAffectedOnSpell(SpellInfo const* spell) const return false; } -void AuraEffect::SendTickImmune(Unit* target, Unit *caster) const +void AuraEffect::SendTickImmune(Unit* target, Unit* caster) const { if (caster) caster->SendSpellDamageImmune(target, m_spellInfo->Id); @@ -4522,7 +4522,7 @@ void AuraEffect::HandleModDamagePercentDone(AuraApplication const* aurApp, uint8 } else { - // done in Player::_ApplyWeaponDependentAuraMods for !SPELL_SCHOOL_MASK_NORMAL and also for wand case + // done in Player::_ApplyWeaponDependentAuraMods for SPELL_SCHOOL_MASK_NORMAL && EquippedItemClass != -1 and also for wand case } } @@ -5219,12 +5219,11 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool { if (apply) { - uint64 guid = caster->m_SummonSlot[3]; - if (guid) + if (uint64 guid = caster->m_SummonSlot[4]) { - Creature* totem = caster->GetMap()->GetCreature(guid); - if (totem && totem->isTotem()) - caster->ToPlayer()->CastSpell(totem, 6277, true); + if (Creature* totem = caster->GetMap()->GetCreature(guid)) + if (totem->isTotem()) + caster->ToPlayer()->CastSpell(totem, 6277, true); } } else @@ -5624,6 +5623,13 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const case SPELLFAMILY_GENERIC: switch (GetId()) { + case 66149: // Bullet Controller Periodic - 10 Man + case 68396: // Bullet Controller Periodic - 25 Man + { + caster->CastCustomSpell(66152, SPELLVALUE_MAX_TARGETS, urand(1,6), target, true); + caster->CastCustomSpell(66153, SPELLVALUE_MAX_TARGETS, urand(1,6), target, true); + break; + } case 54798: // FLAMING Arrow Triggered Effect { if (!caster || !target || !target->ToCreature() || !caster->GetVehicle() || target->HasAura(54683)) @@ -5665,7 +5671,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const // Mirror Image if (GetId() == 55342) // Set name of summons to name of caster - target->CastSpell((Unit *)NULL, m_spellInfo->Effects[m_effIndex].TriggerSpell, true); + target->CastSpell((Unit* )NULL, m_spellInfo->Effects[m_effIndex].TriggerSpell, true); break; } case SPELLFAMILY_WARLOCK: @@ -5749,9 +5755,7 @@ void AuraEffect::HandlePeriodicDummyAuraTick(Unit* target, Unit* caster) const if (targets.empty()) return; - UnitList::const_iterator itr = targets.begin(); - std::advance(itr, rand()%targets.size()); - Unit* spellTarget = *itr; + Unit* spellTarget = SelectRandomContainerElement(targets); target->CastSpell(spellTarget, 57840, true); target->CastSpell(spellTarget, 57841, true); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.h b/src/server/game/Spells/Auras/SpellAuraEffects.h index bdaeefa71c2..c34391471d7 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.h +++ b/src/server/game/Spells/Auras/SpellAuraEffects.h @@ -30,15 +30,15 @@ typedef void(AuraEffect::*pAuraEffectHandler)(AuraApplication const* aurApp, uin class AuraEffect { friend void Aura::_InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount); - friend Aura * Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID); + friend Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID); friend Aura::~Aura(); private: ~AuraEffect(); - explicit AuraEffect(Aura * base, uint8 effIndex, int32 *baseAmount, Unit* caster); + explicit AuraEffect(Aura* base, uint8 effIndex, int32 *baseAmount, Unit* caster); public: Unit* GetCaster() const { return GetBase()->GetCaster(); } uint64 GetCasterGUID() const { return GetBase()->GetCasterGUID(); } - Aura * GetBase() const { return m_base; } + Aura* GetBase() const { return m_base; } void GetTargetList(std::list<Unit*> & targetList) const; void GetApplicationList(std::list<AuraApplication*> & applicationList) const; SpellModifier* GetSpellModifier() const { return m_spellmod; } @@ -79,9 +79,9 @@ class AuraEffect bool IsPeriodic() const { return m_isPeriodic; } void SetPeriodic(bool isPeriodic) { m_isPeriodic = isPeriodic; } - bool IsAffectedOnSpell(SpellInfo const *spell) const; + bool IsAffectedOnSpell(SpellInfo const* spell) const; - void SendTickImmune(Unit* target, Unit *caster) const; + void SendTickImmune(Unit* target, Unit* caster) const; void PeriodicTick(AuraApplication * aurApp, Unit* caster) const; void HandleProc(AuraApplication* aurApp, ProcEventInfo& eventInfo); @@ -91,7 +91,7 @@ class AuraEffect // add/remove SPELL_AURA_MOD_SHAPESHIFT (36) linked auras void HandleShapeshiftBoosts(Unit* target, bool apply) const; private: - Aura * const m_base; + Aura* const m_base; SpellInfo const* const m_spellInfo; uint8 const m_effIndex; @@ -100,7 +100,7 @@ class AuraEffect int32 m_amount; bool m_canBeRecalculated; - SpellModifier *m_spellmod; + SpellModifier* m_spellmod; bool m_isPeriodic; int32 m_periodicTimer; @@ -307,7 +307,7 @@ namespace Trinity { public: AbsorbAuraOrderPred() { } - bool operator() (AuraEffect * aurEffA, AuraEffect * aurEffB) const + bool operator() (AuraEffect* aurEffA, AuraEffect* aurEffB) const { SpellInfo const* spellProtoA = aurEffA->GetSpellInfo(); SpellInfo const* spellProtoB = aurEffB->GetSpellInfo(); diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index a5cf014e3d3..8bb46ed6144 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -36,7 +36,7 @@ #include "SpellScript.h" #include "Vehicle.h" -AuraApplication::AuraApplication(Unit* target, Unit* caster, Aura * aura, uint8 effMask): +AuraApplication::AuraApplication(Unit* target, Unit* caster, Aura* aura, uint8 effMask): m_target(target), m_base(aura), m_slot(MAX_AURAS), m_flags(AFLAG_NONE), m_effectsToApply(effMask), m_removeMode(AURA_REMOVE_NONE), m_needClientUpdate(false) { @@ -151,7 +151,7 @@ void AuraApplication::_InitFlags(Unit* caster, uint8 effMask) void AuraApplication::_HandleEffect(uint8 effIndex, bool apply) { - AuraEffect * aurEff = GetBase()->GetEffect(effIndex); + AuraEffect* aurEff = GetBase()->GetEffect(effIndex); ASSERT(aurEff); ASSERT(HasEffect(effIndex) == (!apply)); ASSERT((1<<effIndex) & m_effectsToApply); @@ -330,7 +330,7 @@ Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owne return aura; } -Aura::Aura(SpellInfo const* spellproto, WorldObject * owner, Unit* caster, Item* castItem, uint64 casterGUID) : +Aura::Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, uint64 casterGUID) : m_spellInfo(spellproto), m_casterGuid(casterGUID ? casterGUID : caster->GetGUID()), m_castItemGuid(castItem ? castItem->GetGUID() : 0), m_applyTime(time(NULL)), m_owner(owner), m_timeCla(0), m_updateTargetMapInterval(0), @@ -364,7 +364,7 @@ Aura::~Aura() // unload scripts while(!m_loadedScripts.empty()) { - std::list<AuraScript *>::iterator itr = m_loadedScripts.begin(); + std::list<AuraScript*>::iterator itr = m_loadedScripts.begin(); (*itr)->_Unload(); delete (*itr); m_loadedScripts.erase(itr); @@ -469,7 +469,7 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply) // fill up to date target list // target, effMask - std::map<Unit *, uint8> targets; + std::map<Unit* , uint8> targets; FillTargetMap(targets, caster); @@ -478,7 +478,7 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply) // mark all auras as ready to remove for (ApplicationMap::iterator appIter = m_applications.begin(); appIter != m_applications.end();++appIter) { - std::map<Unit *, uint8>::iterator existing = targets.find(appIter->second->GetTarget()); + std::map<Unit* , uint8>::iterator existing = targets.find(appIter->second->GetTarget()); // not found in current area - remove the aura if (existing == targets.end()) targetsToRemove.push_back(appIter->second->GetTarget()); @@ -495,7 +495,7 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply) } // register auras for units - for (std::map<Unit *, uint8>::iterator itr = targets.begin(); itr!= targets.end();) + for (std::map<Unit* , uint8>::iterator itr = targets.begin(); itr!= targets.end();) { // aura mustn't be already applied on target if (AuraApplication * aurApp = GetApplicationOfTarget(itr->first->GetGUID())) @@ -572,7 +572,7 @@ void Aura::UpdateTargetMap(Unit* caster, bool apply) return; // apply aura effects for units - for (std::map<Unit *, uint8>::iterator itr = targets.begin(); itr!= targets.end();++itr) + for (std::map<Unit* , uint8>::iterator itr = targets.begin(); itr!= targets.end();++itr) { if (AuraApplication * aurApp = GetApplicationOfTarget(itr->first->GetGUID())) { @@ -605,7 +605,7 @@ void Aura::_ApplyEffectForTargets(uint8 effIndex) } } } -void Aura::UpdateOwner(uint32 diff, WorldObject * owner) +void Aura::UpdateOwner(uint32 diff, WorldObject* owner) { ASSERT(owner == m_owner); @@ -853,7 +853,7 @@ bool Aura::ModStackAmount(int32 num, AuraRemoveMode removeMode) void Aura::RefreshSpellMods() { for (Aura::ApplicationMap::const_iterator appIter = m_applications.begin(); appIter != m_applications.end(); ++appIter) - if (Player * player = appIter->second->GetTarget()->ToPlayer()) + if (Player* player = appIter->second->GetTarget()->ToPlayer()) player->RestoreAllSpellMods(0, this); } @@ -1256,7 +1256,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b if (GetCasterGUID() == target->GetGUID()) break; - AuraEffect * aurEff = NULL; + AuraEffect* aurEff = NULL; // Ebon Plaguebringer / Crypt Fever Unit::AuraEffectList const& TalentAuras = caster->GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS); for (Unit::AuraEffectList::const_iterator itr = TalentAuras.begin(); itr != TalentAuras.end(); ++itr) @@ -1490,7 +1490,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b Player* player = caster->ToPlayer(); // Glyph of Guardian Spirit - if (AuraEffect * aurEff = player->GetAuraEffect(63231, 0)) + if (AuraEffect* aurEff = player->GetAuraEffect(63231, 0)) { if (!player->HasSpellCooldown(47788)) break; @@ -1638,9 +1638,9 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b case SPELLFAMILY_DEATHKNIGHT: if (GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_PRESENCE) { - AuraEffect *bloodPresenceAura=0; // healing by damage done - AuraEffect *frostPresenceAura=0; // increased health - AuraEffect *unholyPresenceAura=0; // increased movement speed, faster rune recovery + AuraEffect* bloodPresenceAura=0; // healing by damage done + AuraEffect* frostPresenceAura=0; // increased health + AuraEffect* unholyPresenceAura=0; // increased movement speed, faster rune recovery // Improved Presences Unit::AuraEffectList const& vDummyAuras = target->GetAuraEffectsByType(SPELL_AURA_DUMMY); @@ -1958,7 +1958,7 @@ bool Aura::IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& eventI if (eventInfo.GetDamageInfo()) { WeaponAttackType attType = eventInfo.GetDamageInfo()->GetAttackType(); - Item *item = NULL; + Item* item = NULL; if (attType == BASE_ATTACK) item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); else if (attType == OFF_ATTACK) @@ -1973,7 +1973,7 @@ bool Aura::IsProcTriggeredOnEvent(AuraApplication* aurApp, ProcEventInfo& eventI else if (GetSpellInfo()->EquippedItemClass == ITEM_CLASS_ARMOR) { // Check if player is wearing shield - Item *item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); + Item* item = target->ToPlayer()->GetUseableItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); if (!item || item->IsBroken() || item->GetTemplate()->Class != ITEM_CLASS_ARMOR || !((1<<item->GetTemplate()->SubClass) & GetSpellInfo()->EquippedItemSubClassMask)) return false; } @@ -1987,7 +1987,7 @@ float Aura::CalcProcChance(SpellProcEntry const& procEntry, ProcEventInfo& event float chance = procEntry.chance; // calculate chances depending on unit with caster's data // so talents modifying chances and judgements will have properly calculated proc chance - if (Unit * caster = GetCaster()) + if (Unit* caster = GetCaster()) { // calculate ppm chance if present and we're using weapon if (eventInfo.GetDamageInfo() && procEntry.ratePerMinute != 0) @@ -2028,11 +2028,11 @@ void Aura::LoadScripts() { sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Aura::LoadScripts"); sScriptMgr->CreateAuraScripts(m_spellInfo->Id, m_loadedScripts); - for (std::list<AuraScript *>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end() ;) + for (std::list<AuraScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end() ;) { if (!(*itr)->_Load(this)) { - std::list<AuraScript *>::iterator bitr = itr; + std::list<AuraScript*>::iterator bitr = itr; ++itr; m_loadedScripts.erase(bitr); continue; @@ -2059,7 +2059,7 @@ bool Aura::CallScriptCheckAreaTargetHandlers(Unit* target) bool Aura::CallScriptEffectApplyHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode) { bool preventDefault = false; - for (std::list<AuraScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_APPLY, aurApp); std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectApply.end(), effItr = (*scritr)->OnEffectApply.begin(); @@ -2078,7 +2078,7 @@ bool Aura::CallScriptEffectApplyHandlers(AuraEffect const* aurEff, AuraApplicati bool Aura::CallScriptEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode) { bool preventDefault = false; - for (std::list<AuraScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_REMOVE, aurApp); std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->OnEffectRemove.end(), effItr = (*scritr)->OnEffectRemove.begin(); @@ -2096,7 +2096,7 @@ bool Aura::CallScriptEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplicat void Aura::CallScriptAfterEffectApplyHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode) { - for (std::list<AuraScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_APPLY, aurApp); std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectApply.end(), effItr = (*scritr)->AfterEffectApply.begin(); @@ -2111,7 +2111,7 @@ void Aura::CallScriptAfterEffectApplyHandlers(AuraEffect const* aurEff, AuraAppl void Aura::CallScriptAfterEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode) { - for (std::list<AuraScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_REMOVE, aurApp); std::list<AuraScript::EffectApplyHandler>::iterator effEndItr = (*scritr)->AfterEffectRemove.end(), effItr = (*scritr)->AfterEffectRemove.begin(); @@ -2127,7 +2127,7 @@ void Aura::CallScriptAfterEffectRemoveHandlers(AuraEffect const* aurEff, AuraApp bool Aura::CallScriptEffectPeriodicHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp) { bool preventDefault = false; - for (std::list<AuraScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_PERIODIC, aurApp); std::list<AuraScript::EffectPeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectPeriodic.end(), effItr = (*scritr)->OnEffectPeriodic.begin(); @@ -2143,9 +2143,9 @@ bool Aura::CallScriptEffectPeriodicHandlers(AuraEffect const* aurEff, AuraApplic return preventDefault; } -void Aura::CallScriptEffectUpdatePeriodicHandlers(AuraEffect * aurEff) +void Aura::CallScriptEffectUpdatePeriodicHandlers(AuraEffect* aurEff) { - for (std::list<AuraScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_UPDATE_PERIODIC); std::list<AuraScript::EffectUpdatePeriodicHandler>::iterator effEndItr = (*scritr)->OnEffectUpdatePeriodic.end(), effItr = (*scritr)->OnEffectUpdatePeriodic.begin(); @@ -2160,7 +2160,7 @@ void Aura::CallScriptEffectUpdatePeriodicHandlers(AuraEffect * aurEff) void Aura::CallScriptEffectCalcAmountHandlers(AuraEffect const* aurEff, int32 & amount, bool & canBeRecalculated) { - for (std::list<AuraScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_AMOUNT); std::list<AuraScript::EffectCalcAmountHandler>::iterator effEndItr = (*scritr)->DoEffectCalcAmount.end(), effItr = (*scritr)->DoEffectCalcAmount.begin(); @@ -2175,7 +2175,7 @@ void Aura::CallScriptEffectCalcAmountHandlers(AuraEffect const* aurEff, int32 & void Aura::CallScriptEffectCalcPeriodicHandlers(AuraEffect const* aurEff, bool & isPeriodic, int32 & amplitude) { - for (std::list<AuraScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_PERIODIC); std::list<AuraScript::EffectCalcPeriodicHandler>::iterator effEndItr = (*scritr)->DoEffectCalcPeriodic.end(), effItr = (*scritr)->DoEffectCalcPeriodic.begin(); @@ -2188,9 +2188,9 @@ void Aura::CallScriptEffectCalcPeriodicHandlers(AuraEffect const* aurEff, bool & } } -void Aura::CallScriptEffectCalcSpellModHandlers(AuraEffect const* aurEff, SpellModifier *& spellMod) +void Aura::CallScriptEffectCalcSpellModHandlers(AuraEffect const* aurEff, SpellModifier* & spellMod) { - for (std::list<AuraScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_CALC_SPELLMOD); std::list<AuraScript::EffectCalcSpellModHandler>::iterator effEndItr = (*scritr)->DoEffectCalcSpellMod.end(), effItr = (*scritr)->DoEffectCalcSpellMod.begin(); @@ -2203,9 +2203,9 @@ void Aura::CallScriptEffectCalcSpellModHandlers(AuraEffect const* aurEff, SpellM } } -void Aura::CallScriptEffectAbsorbHandlers(AuraEffect * aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool & /*defaultPrevented*/) +void Aura::CallScriptEffectAbsorbHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool & /*defaultPrevented*/) { - for (std::list<AuraScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_ABSORB, aurApp); std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->OnEffectAbsorb.end(), effItr = (*scritr)->OnEffectAbsorb.begin(); @@ -2218,9 +2218,9 @@ void Aura::CallScriptEffectAbsorbHandlers(AuraEffect * aurEff, AuraApplication c } } -void Aura::CallScriptEffectAfterAbsorbHandlers(AuraEffect * aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount) +void Aura::CallScriptEffectAfterAbsorbHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount) { - for (std::list<AuraScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_ABSORB, aurApp); std::list<AuraScript::EffectAbsorbHandler>::iterator effEndItr = (*scritr)->AfterEffectAbsorb.end(), effItr = (*scritr)->AfterEffectAbsorb.begin(); @@ -2233,9 +2233,9 @@ void Aura::CallScriptEffectAfterAbsorbHandlers(AuraEffect * aurEff, AuraApplicat } } -void Aura::CallScriptEffectManaShieldHandlers(AuraEffect * aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool & /*defaultPrevented*/) +void Aura::CallScriptEffectManaShieldHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool & /*defaultPrevented*/) { - for (std::list<AuraScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_MANASHIELD, aurApp); std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->OnEffectManaShield.end(), effItr = (*scritr)->OnEffectManaShield.begin(); @@ -2248,9 +2248,9 @@ void Aura::CallScriptEffectManaShieldHandlers(AuraEffect * aurEff, AuraApplicati } } -void Aura::CallScriptEffectAfterManaShieldHandlers(AuraEffect * aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount) +void Aura::CallScriptEffectAfterManaShieldHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount) { - for (std::list<AuraScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<AuraScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) { (*scritr)->_PrepareScriptCall(AURA_SCRIPT_HOOK_EFFECT_AFTER_MANASHIELD, aurApp); std::list<AuraScript::EffectManaShieldHandler>::iterator effEndItr = (*scritr)->AfterEffectManaShield.end(), effItr = (*scritr)->AfterEffectManaShield.begin(); @@ -2263,7 +2263,7 @@ void Aura::CallScriptEffectAfterManaShieldHandlers(AuraEffect * aurEff, AuraAppl } } -UnitAura::UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID) +UnitAura::UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID) : Aura(spellproto, owner, caster, castItem, casterGUID) { m_AuraDRGroup = DIMINISHING_NONE; @@ -2297,7 +2297,7 @@ void UnitAura::Remove(AuraRemoveMode removeMode) GetUnitOwner()->RemoveOwnedAura(this, removeMode); } -void UnitAura::FillTargetMap(std::map<Unit *, uint8> & targets, Unit* caster) +void UnitAura::FillTargetMap(std::map<Unit* , uint8> & targets, Unit* caster) { for (uint8 effIndex = 0; effIndex < MAX_SPELL_EFFECTS ; ++effIndex) { @@ -2355,7 +2355,7 @@ void UnitAura::FillTargetMap(std::map<Unit *, uint8> & targets, Unit* caster) for (UnitList::iterator itr = targetList.begin(); itr!= targetList.end();++itr) { - std::map<Unit *, uint8>::iterator existing = targets.find(*itr); + std::map<Unit* , uint8>::iterator existing = targets.find(*itr); if (existing != targets.end()) existing->second |= 1<<effIndex; else @@ -2364,7 +2364,7 @@ void UnitAura::FillTargetMap(std::map<Unit *, uint8> & targets, Unit* caster) } } -DynObjAura::DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID) +DynObjAura::DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID) : Aura(spellproto, owner, caster, castItem, casterGUID) { LoadScripts(); @@ -2382,7 +2382,7 @@ void DynObjAura::Remove(AuraRemoveMode removeMode) _Remove(removeMode); } -void DynObjAura::FillTargetMap(std::map<Unit *, uint8> & targets, Unit* /*caster*/) +void DynObjAura::FillTargetMap(std::map<Unit* , uint8> & targets, Unit* /*caster*/) { Unit* dynObjOwnerCaster = GetDynobjOwner()->GetCaster(); float radius = GetDynobjOwner()->GetRadius(); @@ -2408,7 +2408,7 @@ void DynObjAura::FillTargetMap(std::map<Unit *, uint8> & targets, Unit* /*caster for (UnitList::iterator itr = targetList.begin(); itr!= targetList.end();++itr) { - std::map<Unit *, uint8>::iterator existing = targets.find(*itr); + std::map<Unit* , uint8>::iterator existing = targets.find(*itr); if (existing != targets.end()) existing->second |= 1<<effIndex; else diff --git a/src/server/game/Spells/Auras/SpellAuras.h b/src/server/game/Spells/Auras/SpellAuras.h index 1c22a31e791..6c641ef7d9b 100755 --- a/src/server/game/Spells/Auras/SpellAuras.h +++ b/src/server/game/Spells/Auras/SpellAuras.h @@ -42,19 +42,19 @@ class AuraApplication { friend void Unit::_ApplyAura(AuraApplication * aurApp, uint8 effMask); friend void Unit::_UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode); - friend void Unit::_ApplyAuraEffect(Aura * aura, uint8 effIndex); + friend void Unit::_ApplyAuraEffect(Aura* aura, uint8 effIndex); friend void Unit::RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode); - friend AuraApplication * Unit::_CreateAuraApplication(Aura * aura, uint8 effMask); + friend AuraApplication * Unit::_CreateAuraApplication(Aura* aura, uint8 effMask); private: Unit* const m_target; - Aura * const m_base; + Aura* const m_base; uint8 m_slot; // Aura slot on unit uint8 m_flags; // Aura info flag uint8 m_effectsToApply; // Used only at spell hit to determine which effect should be applied AuraRemoveMode m_removeMode:8; // Store info for know remove aura reason bool m_needClientUpdate:1; - explicit AuraApplication(Unit* target, Unit* caster, Aura * base, uint8 effMask); + explicit AuraApplication(Unit* target, Unit* caster, Aura* base, uint8 effMask); void _Remove(); private: void _InitFlags(Unit* caster, uint8 effMask); @@ -62,7 +62,7 @@ class AuraApplication public: Unit* GetTarget() const { return m_target; } - Aura * GetBase() const { return m_base; } + Aura* GetBase() const { return m_base; } uint8 GetSlot() const { return m_slot; } uint8 GetFlags() const { return m_flags; } @@ -83,15 +83,15 @@ class AuraApplication class Aura { - friend Aura * Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID); + friend Aura* Unit::_TryStackingOrRefreshingExistingAura(SpellInfo const* newAura, uint8 effMask, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID); public: typedef std::map<uint64, AuraApplication *> ApplicationMap; static uint8 BuildEffectMaskForOwner(SpellInfo const* spellProto, uint8 avalibleEffectMask, WorldObject* owner); static Aura* TryRefreshStackOrCreate(SpellInfo const* spellproto, uint8 tryEffMask, WorldObject* owner, Unit* caster, int32* baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0, bool* refresh = NULL); - static Aura* TryCreate(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0); + static Aura* TryCreate(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount = NULL, Item* castItem = NULL, uint64 casterGUID = 0); static Aura* Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32* baseAmount, Item* castItem, uint64 casterGUID); - explicit Aura(SpellInfo const* spellproto, WorldObject * owner, Unit* caster, Item* castItem, uint64 casterGUID); + explicit Aura(SpellInfo const* spellproto, WorldObject* owner, Unit* caster, Item* castItem, uint64 casterGUID); void _InitEffects(uint8 effMask, Unit* caster, int32 *baseAmount); virtual ~Aura(); @@ -101,9 +101,9 @@ class Aura uint64 GetCastItemGUID() const { return m_castItemGuid; } uint64 GetCasterGUID() const { return m_casterGuid; } Unit* GetCaster() const; - WorldObject * GetOwner() const { return m_owner; } + WorldObject* GetOwner() const { return m_owner; } Unit* GetUnitOwner() const { ASSERT(GetType() == UNIT_AURA_TYPE); return (Unit*)m_owner; } - DynamicObject * GetDynobjOwner() const { ASSERT(GetType() == DYNOBJ_AURA_TYPE); return (DynamicObject*)m_owner; } + DynamicObject* GetDynobjOwner() const { ASSERT(GetType() == DYNOBJ_AURA_TYPE); return (DynamicObject*)m_owner; } AuraObjectType GetType() const; @@ -112,14 +112,14 @@ class Aura void _Remove(AuraRemoveMode removeMode); virtual void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT) = 0; - virtual void FillTargetMap(std::map<Unit *, uint8> & targets, Unit* caster) = 0; + virtual void FillTargetMap(std::map<Unit* , uint8> & targets, Unit* caster) = 0; void UpdateTargetMap(Unit* caster, bool apply = true); void _RegisterForTargets() {Unit* caster = GetCaster(); UpdateTargetMap(caster, false);} void ApplyForTargets() {Unit* caster = GetCaster(); UpdateTargetMap(caster, true);} void _ApplyEffectForTargets(uint8 effIndex); - void UpdateOwner(uint32 diff, WorldObject * owner); + void UpdateOwner(uint32 diff, WorldObject* owner); void Update(uint32 diff, Unit* caster); time_t GetApplyTime() const { return m_applyTime; } @@ -167,7 +167,7 @@ class Aura // helpers for aura effects bool HasEffect(uint8 effIndex) const { return bool(GetEffect(effIndex)); } bool HasEffectType(AuraType type) const; - AuraEffect * GetEffect(uint8 effIndex) const { ASSERT (effIndex < MAX_SPELL_EFFECTS); return m_effects[effIndex]; } + AuraEffect* GetEffect(uint8 effIndex) const { ASSERT (effIndex < MAX_SPELL_EFFECTS); return m_effects[effIndex]; } uint8 GetEffectMask() const { uint8 effMask = 0; for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) if (m_effects[i]) effMask |= 1<<i; return effMask; } void RecalculateAmountOfEffects(); void HandleAllEffects(AuraApplication * aurApp, uint8 mode, bool apply); @@ -203,15 +203,15 @@ class Aura void CallScriptAfterEffectApplyHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode); void CallScriptAfterEffectRemoveHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp, AuraEffectHandleModes mode); bool CallScriptEffectPeriodicHandlers(AuraEffect const* aurEff, AuraApplication const* aurApp); - void CallScriptEffectUpdatePeriodicHandlers(AuraEffect * aurEff); + void CallScriptEffectUpdatePeriodicHandlers(AuraEffect* aurEff); void CallScriptEffectCalcAmountHandlers(AuraEffect const* aurEff, int32 & amount, bool & canBeRecalculated); void CallScriptEffectCalcPeriodicHandlers(AuraEffect const* aurEff, bool & isPeriodic, int32 & amplitude); - void CallScriptEffectCalcSpellModHandlers(AuraEffect const* aurEff, SpellModifier *& spellMod); - void CallScriptEffectAbsorbHandlers(AuraEffect * aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool & defaultPrevented); - void CallScriptEffectAfterAbsorbHandlers(AuraEffect * aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount); - void CallScriptEffectManaShieldHandlers(AuraEffect * aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool & defaultPrevented); - void CallScriptEffectAfterManaShieldHandlers(AuraEffect * aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount); - std::list<AuraScript *> m_loadedScripts; + void CallScriptEffectCalcSpellModHandlers(AuraEffect const* aurEff, SpellModifier* & spellMod); + void CallScriptEffectAbsorbHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool & defaultPrevented); + void CallScriptEffectAfterAbsorbHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount); + void CallScriptEffectManaShieldHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount, bool & defaultPrevented); + void CallScriptEffectAfterManaShieldHandlers(AuraEffect* aurEff, AuraApplication const* aurApp, DamageInfo & dmgInfo, uint32 & absorbAmount); + std::list<AuraScript*> m_loadedScripts; private: void _DeleteRemovedApplications(); protected: @@ -219,7 +219,7 @@ class Aura uint64 const m_casterGuid; uint64 const m_castItemGuid; // it is NOT safe to keep a pointer to the item because it may get deleted time_t const m_applyTime; - WorldObject * const m_owner; // + WorldObject* const m_owner; // int32 m_maxDuration; // Max aura duration int32 m_duration; // Current time @@ -230,7 +230,7 @@ class Aura uint8 m_procCharges; // Aura charges (0 for infinite) uint8 m_stackAmount; // Aura stack amount - AuraEffect * m_effects[3]; + AuraEffect* m_effects[3]; ApplicationMap m_applications; bool m_isRemoved:1; @@ -243,16 +243,16 @@ class Aura class UnitAura : public Aura { - friend Aura * Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID); + friend Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID); protected: - explicit UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID); + explicit UnitAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID); public: void _ApplyForTarget(Unit* target, Unit* caster, AuraApplication * aurApp); void _UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * aurApp); void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); - void FillTargetMap(std::map<Unit *, uint8> & targets, Unit* caster); + void FillTargetMap(std::map<Unit* , uint8> & targets, Unit* caster); // Allow Apply Aura Handler to modify and access m_AuraDRGroup void SetDiminishGroup(DiminishingGroup group) { m_AuraDRGroup = group; } @@ -264,12 +264,12 @@ class UnitAura : public Aura class DynObjAura : public Aura { - friend Aura * Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID); + friend Aura* Aura::Create(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID); protected: - explicit DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject * owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID); + explicit DynObjAura(SpellInfo const* spellproto, uint8 effMask, WorldObject* owner, Unit* caster, int32 *baseAmount, Item* castItem, uint64 casterGUID); public: void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT); - void FillTargetMap(std::map<Unit *, uint8> & targets, Unit* caster); + void FillTargetMap(std::map<Unit* , uint8> & targets, Unit* caster); }; #endif diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 6d10f40ae58..c5392a0e55b 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -419,7 +419,7 @@ void SpellCastTargets::Update(Unit* caster) // update positions by transport move if (HasSrc() && m_srcTransGUID) { - if (WorldObject * transport = ObjectAccessor::GetWorldObject(*caster, m_srcTransGUID)) + if (WorldObject* transport = ObjectAccessor::GetWorldObject(*caster, m_srcTransGUID)) { m_srcPos.Relocate(transport); m_srcPos.RelocateOffset(m_srcTransOffset); @@ -428,7 +428,7 @@ void SpellCastTargets::Update(Unit* caster) if (HasDst() && m_dstTransGUID) { - if (WorldObject * transport = ObjectAccessor::GetWorldObject(*caster, m_dstTransGUID)) + if (WorldObject* transport = ObjectAccessor::GetWorldObject(*caster, m_dstTransGUID)) { m_dstPos.Relocate(transport); m_dstPos.RelocateOffset(m_dstTransOffset); @@ -467,7 +467,7 @@ SpellValue::SpellValue(SpellInfo const* proto) AuraStackAmount = 1; } -Spell::Spell(Unit* caster, SpellInfo const *info, TriggerCastFlags triggerFlags, uint64 originalCasterGUID, bool skipCheck) : +Spell::Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, uint64 originalCasterGUID, bool skipCheck) : m_spellInfo(sSpellMgr->GetSpellForDifficultyFromSpell(info, caster)), m_caster((info->AttributesEx6 & SPELL_ATTR6_CAST_BY_CHARMER && caster->GetCharmerOrOwner()) ? caster->GetCharmerOrOwner() : caster) , m_spellValue(new SpellValue(m_spellInfo)) @@ -572,7 +572,7 @@ Spell::~Spell() // unload scripts while(!m_loadedScripts.empty()) { - std::list<SpellScript *>::iterator itr = m_loadedScripts.begin(); + std::list<SpellScript*>::iterator itr = m_loadedScripts.begin(); (*itr)->_Unload(); delete (*itr); m_loadedScripts.erase(itr); @@ -691,11 +691,15 @@ void Spell::InitExplicitTargets(SpellCastTargets const& targets) void Spell::SelectSpellTargets() { + uint32 processedTargets = 0; for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) { // not call for empty effect. // Also some spells use not used effect targets for store targets for dummy effect in triggered spells - if (!m_spellInfo->Effects[i].Effect) + if (!m_spellInfo->Effects[i].IsEffect()) + continue; + + if (processedTargets & (1 << i)) continue; // set expected type of implicit targets to be sent to client @@ -715,17 +719,17 @@ void Spell::SelectSpellTargets() uint32 targetB = m_spellInfo->Effects[i].TargetB.GetTarget(); if (targetA) - SelectEffectTargets(i, m_spellInfo->Effects[i].TargetA); + processedTargets |= SelectEffectTargets(i, m_spellInfo->Effects[i].TargetA); if (targetB) // In very rare case !A && B - SelectEffectTargets(i, m_spellInfo->Effects[i].TargetB); + processedTargets |= SelectEffectTargets(i, m_spellInfo->Effects[i].TargetB); if (effectTargetType != SPELL_REQUIRE_UNIT) { if (effectTargetType == SPELL_REQUIRE_CASTER) - AddUnitTarget(m_caster, i, false); + AddUnitTarget(m_caster, 1 << i, false); else if (effectTargetType == SPELL_REQUIRE_ITEM) if (m_targets.GetItemTarget()) - AddItemTarget(m_targets.GetItemTarget(), i); + AddItemTarget(m_targets.GetItemTarget(), 1 << i); continue; } @@ -733,7 +737,7 @@ void Spell::SelectSpellTargets() { if (!m_spellInfo->GetMaxRange(true)) { - AddUnitTarget(m_caster, i, false); + AddUnitTarget(m_caster, 1 << i, false); continue; } @@ -744,9 +748,9 @@ void Spell::SelectSpellTargets() case SPELL_EFFECT_DUMMY: { if (m_targets.GetUnitTarget()) - AddUnitTarget(m_targets.GetUnitTarget(), i, false); + AddUnitTarget(m_targets.GetUnitTarget(), 1 << i, false); else - AddUnitTarget(m_caster, i, false); + AddUnitTarget(m_caster, 1 << i, false); break; } case SPELL_EFFECT_BIND: @@ -761,10 +765,10 @@ void Spell::SelectSpellTargets() case SPELL_EFFECT_LEARN_SPELL: case SPELL_EFFECT_SEND_TAXI: if (m_targets.GetUnitTarget()) - AddUnitTarget(m_targets.GetUnitTarget(), i, false); + AddUnitTarget(m_targets.GetUnitTarget(), 1 << i, false); // Triggered spells have additional spell targets - cast them even if no explicit unit target is given (required for spell 50516 for example) else if (m_spellInfo->Effects[i].Effect == SPELL_EFFECT_TRIGGER_SPELL) - AddUnitTarget(m_caster, i, false); + AddUnitTarget(m_caster, 1 << i, false); break; case SPELL_EFFECT_SUMMON_RAF_FRIEND: case SPELL_EFFECT_SUMMON_PLAYER: @@ -772,7 +776,7 @@ void Spell::SelectSpellTargets() { Player* target = ObjectAccessor::FindPlayer(m_caster->ToPlayer()->GetSelection()); if (target) - AddUnitTarget(target, i, false); + AddUnitTarget(target, 1 << i, false); } break; case SPELL_EFFECT_SKIN_PLAYER_CORPSE: @@ -780,12 +784,12 @@ void Spell::SelectSpellTargets() if (WorldObject* target = m_targets.GetObjectTarget()) { if (Unit* unitTarget = target->ToUnit()) - AddUnitTarget(unitTarget, i, false); + AddUnitTarget(unitTarget, 1 << i, false); else if (Corpse* corpseTarget = target->ToCorpse()) { Player* owner = ObjectAccessor::FindPlayer(corpseTarget->GetOwnerGUID()); if (owner) - AddUnitTarget(owner, i, false); + AddUnitTarget(owner, 1 << i, false); } } break; @@ -796,33 +800,33 @@ void Spell::SelectSpellTargets() case SPELL_EFFECT_FEED_PET: case SPELL_EFFECT_DESTROY_ALL_TOTEMS: case SPELL_EFFECT_KILL_CREDIT2: // only one spell: 42793 - AddUnitTarget(m_caster, i, false); + AddUnitTarget(m_caster, 1 << i, false); break; case SPELL_EFFECT_LEARN_PET_SPELL: if (Guardian* pet = m_caster->GetGuardianPet()) - AddUnitTarget(pet, i); + AddUnitTarget(pet, 1 << i); break; case SPELL_EFFECT_APPLY_AURA: switch (m_spellInfo->Effects[i].ApplyAuraName) { case SPELL_AURA_ADD_FLAT_MODIFIER: // some spell mods auras have 0 target modes instead expected TARGET_UNIT_CASTER(1) (and present for other ranks for same spell for example) case SPELL_AURA_ADD_PCT_MODIFIER: - AddUnitTarget(m_caster, i, false); + AddUnitTarget(m_caster, 1 << i, false); break; default: // apply to target in other case if (m_targets.GetUnitTarget()) - AddUnitTarget(m_targets.GetUnitTarget(), i, false); + AddUnitTarget(m_targets.GetUnitTarget(), 1 << i, false); break; } break; default: - AddUnitTarget(m_caster, i, false); + AddUnitTarget(m_caster, 1 << i, false); break; } } if (m_spellInfo->IsChanneled()) { - uint8 mask = (1<<i); + uint8 mask = (1 << i); for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { if (ihit->effectMask & mask) @@ -960,34 +964,38 @@ void Spell::CleanupTargetList() m_delayMoment = 0; } -void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex, bool checkIfValid /*=true*/) +void Spell::AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid /*= true*/) { - if (!m_spellInfo->Effects[effIndex].IsEffect()) + for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) + if (!m_spellInfo->Effects[effIndex].IsEffect() || !CheckEffectTarget(target, effIndex)) + effectMask &= ~(1 << effIndex); + + // no effects left + if (!effectMask) return; if (checkIfValid) - if (m_spellInfo->CheckTarget(m_caster, pVictim, true) != SPELL_CAST_OK) + if (m_spellInfo->CheckTarget(m_caster, target, true) != SPELL_CAST_OK) return; - if (!CheckEffectTarget(pVictim, effIndex)) - return; // Check for effect immune skip if immuned - bool immuned = pVictim->IsImmunedToSpellEffect(m_spellInfo, effIndex); + for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) + if (target->IsImmunedToSpellEffect(m_spellInfo, effIndex)) + effectMask &= ~(1 << effIndex); - uint64 targetGUID = pVictim->GetGUID(); + uint64 targetGUID = target->GetGUID(); // Lookup target in already in list for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) { - if (targetGUID == ihit->targetGUID) // Found in list + if (targetGUID == ihit->targetGUID) // Found in list { - if (!immuned) - ihit->effectMask |= 1 << effIndex; // Add only effect mask if not immuned + ihit->effectMask |= effectMask; // Immune effects removed from mask ihit->scaleAura = false; - if (m_auraScaleMask && ihit->effectMask == m_auraScaleMask && m_caster != pVictim) + if (m_auraScaleMask && ihit->effectMask == m_auraScaleMask && m_caster != target) { SpellInfo const* auraSpell = sSpellMgr->GetSpellInfo(sSpellMgr->GetFirstSpellInChain(m_spellInfo->Id)); - if (uint32(pVictim->getLevel() + 10) >= auraSpell->SpellLevel) + if (uint32(target->getLevel() + 10) >= auraSpell->SpellLevel) ihit->scaleAura = true; } return; @@ -997,85 +1005,94 @@ void Spell::AddUnitTarget(Unit* pVictim, uint32 effIndex, bool checkIfValid /*=t // This is new target calculate data for him // Get spell hit result on target - TargetInfo target; - target.targetGUID = targetGUID; // Store target GUID - target.effectMask = immuned ? 0 : 1 << effIndex; // Store index of effect if not immuned - target.processed = false; // Effects not apply on target - target.alive = pVictim->isAlive(); - target.damage = 0; - target.crit = false; - target.scaleAura = false; - if (m_auraScaleMask && target.effectMask == m_auraScaleMask && m_caster != pVictim) + TargetInfo targetInfo; + targetInfo.targetGUID = targetGUID; // Store target GUID + targetInfo.effectMask = effectMask; // Store all effects not immune + targetInfo.processed = false; // Effects not apply on target + targetInfo.alive = target->isAlive(); + targetInfo.damage = 0; + targetInfo.crit = false; + targetInfo.scaleAura = false; + if (m_auraScaleMask && targetInfo.effectMask == m_auraScaleMask && m_caster != target) { SpellInfo const* auraSpell = sSpellMgr->GetSpellInfo(sSpellMgr->GetFirstSpellInChain(m_spellInfo->Id)); - if (uint32(pVictim->getLevel() + 10) >= auraSpell->SpellLevel) - target.scaleAura = true; + if (uint32(target->getLevel() + 10) >= auraSpell->SpellLevel) + targetInfo.scaleAura = true; } // Calculate hit result if (m_originalCaster) { - target.missCondition = m_originalCaster->SpellHitResult(pVictim, m_spellInfo, m_canReflect); - if (m_skipCheck && target.missCondition != SPELL_MISS_IMMUNE) - target.missCondition = SPELL_MISS_NONE; + targetInfo.missCondition = m_originalCaster->SpellHitResult(target, m_spellInfo, m_canReflect); + if (m_skipCheck && targetInfo.missCondition != SPELL_MISS_IMMUNE) + targetInfo.missCondition = SPELL_MISS_NONE; } else - target.missCondition = SPELL_MISS_EVADE; //SPELL_MISS_NONE; + targetInfo.missCondition = SPELL_MISS_EVADE; //SPELL_MISS_NONE; // Spell have speed - need calculate incoming time // Incoming time is zero for self casts. At least I think so. - if (m_spellInfo->Speed > 0.0f && m_caster != pVictim) + if (m_spellInfo->Speed > 0.0f && m_caster != target) { // calculate spell incoming interval // TODO: this is a hack - float dist = m_caster->GetDistance(pVictim->GetPositionX(), pVictim->GetPositionY(), pVictim->GetPositionZ()); + float dist = m_caster->GetDistance(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ()); - if (dist < 5.0f) dist = 5.0f; - target.timeDelay = (uint64) floor(dist / m_spellInfo->Speed * 1000.0f); + if (dist < 5.0f) + dist = 5.0f; + targetInfo.timeDelay = (uint64) floor(dist / m_spellInfo->Speed * 1000.0f); // Calculate minimum incoming time - if (m_delayMoment == 0 || m_delayMoment>target.timeDelay) - m_delayMoment = target.timeDelay; + if (m_delayMoment == 0 || m_delayMoment > targetInfo.timeDelay) + m_delayMoment = targetInfo.timeDelay; } else - target.timeDelay = 0LL; + targetInfo.timeDelay = 0LL; // If target reflect spell back to caster - if (target.missCondition == SPELL_MISS_REFLECT) + if (targetInfo.missCondition == SPELL_MISS_REFLECT) { // Calculate reflected spell result on caster - target.reflectResult = m_caster->SpellHitResult(m_caster, m_spellInfo, m_canReflect); + targetInfo.reflectResult = m_caster->SpellHitResult(m_caster, m_spellInfo, m_canReflect); - if (target.reflectResult == SPELL_MISS_REFLECT) // Impossible reflect again, so simply deflect spell - target.reflectResult = SPELL_MISS_PARRY; + if (targetInfo.reflectResult == SPELL_MISS_REFLECT) // Impossible reflect again, so simply deflect spell + targetInfo.reflectResult = SPELL_MISS_PARRY; // Increase time interval for reflected spells by 1.5 - target.timeDelay += target.timeDelay >> 1; + targetInfo.timeDelay += targetInfo.timeDelay >> 1; } else - target.reflectResult = SPELL_MISS_NONE; + targetInfo.reflectResult = SPELL_MISS_NONE; // Add target to list - m_UniqueTargetInfo.push_back(target); + m_UniqueTargetInfo.push_back(targetInfo); } -void Spell::AddGOTarget(GameObject* go, uint32 effIndex) +void Spell::AddGOTarget(GameObject* go, uint32 effectMask) { - if (!m_spellInfo->Effects[effIndex].IsEffect()) - return; - - switch (m_spellInfo->Effects[effIndex].Effect) + for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) { - case SPELL_EFFECT_GAMEOBJECT_DAMAGE: - case SPELL_EFFECT_GAMEOBJECT_REPAIR: - case SPELL_EFFECT_GAMEOBJECT_SET_DESTRUCTION_STATE: - if (go->GetGoType() != GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING) - return; - break; - default: - break; + if (!m_spellInfo->Effects[effIndex].IsEffect()) + effectMask &= ~(1 << effIndex); + else + { + switch (m_spellInfo->Effects[effIndex].Effect) + { + case SPELL_EFFECT_GAMEOBJECT_DAMAGE: + case SPELL_EFFECT_GAMEOBJECT_REPAIR: + case SPELL_EFFECT_GAMEOBJECT_SET_DESTRUCTION_STATE: + if (go->GetGoType() != GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING) + effectMask &= ~(1 << effIndex); + break; + default: + break; + } + } } + if (!effectMask) + return; + uint64 targetGUID = go->GetGUID(); // Lookup target in already in list @@ -1083,7 +1100,7 @@ void Spell::AddGOTarget(GameObject* go, uint32 effIndex) { if (targetGUID == ihit->targetGUID) // Found in list { - ihit->effectMask |= 1 << effIndex; // Add only effect mask + ihit->effectMask |= effectMask; // Add only effect mask return; } } @@ -1092,7 +1109,7 @@ void Spell::AddGOTarget(GameObject* go, uint32 effIndex) GOTargetInfo target; target.targetGUID = targetGUID; - target.effectMask = 1 << effIndex; + target.effectMask = effectMask; target.processed = false; // Effects not apply on target // Spell have speed - need calculate incoming time @@ -1113,34 +1130,42 @@ void Spell::AddGOTarget(GameObject* go, uint32 effIndex) m_UniqueGOTargetInfo.push_back(target); } -void Spell::AddGOTarget(uint64 goGUID, uint32 effIndex) +void Spell::AddGOTarget(uint64 goGUID, uint32 effectMask) { if (GameObject* go = m_caster->GetMap()->GetGameObject(goGUID)) - AddGOTarget(go, effIndex); + AddGOTarget(go, effectMask); } -void Spell::AddItemTarget(Item* pitem, uint32 effIndex) +void Spell::AddItemTarget(Item* item, uint32 effectMask) { - if (!m_spellInfo->Effects[effIndex].IsEffect()) + for (uint32 effIndex = 0; effIndex < MAX_SPELL_EFFECTS; ++effIndex) + if (!m_spellInfo->Effects[effIndex].IsEffect()) + effectMask &= ~(1 << effIndex); + + // no effects left + if (!effectMask) return; // Lookup target in already in list for (std::list<ItemTargetInfo>::iterator ihit = m_UniqueItemInfo.begin(); ihit != m_UniqueItemInfo.end(); ++ihit) - if (pitem == ihit->item) // Found in list + { + if (item == ihit->item) // Found in list { - ihit->effectMask |= 1 << effIndex; // Add only effect mask + ihit->effectMask |= effectMask; // Add only effect mask return; } + } // This is new target add data ItemTargetInfo target; - target.item = pitem; - target.effectMask = 1 << effIndex; + target.item = item; + target.effectMask = effectMask; + m_UniqueItemInfo.push_back(target); } -void Spell::DoAllEffectOnTarget(TargetInfo *target) +void Spell::DoAllEffectOnTarget(TargetInfo* target) { if (!target || target->processed) return; @@ -1182,7 +1207,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) return; // No missinfo in that case // Get original caster (if exist) and calculate damage/healing from him data - Unit *caster = m_originalCaster ? m_originalCaster : m_caster; + Unit* caster = m_originalCaster ? m_originalCaster : m_caster; // Skip if m_originalCaster not avaiable if (!caster) @@ -1406,7 +1431,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target) } } -SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool scaleAura) +SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, const uint32 effectMask, bool scaleAura) { if (!unit || !effectMask) return SPELL_MISS_EVADE; @@ -1437,9 +1462,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool if (m_spellInfo->Speed > 0.0f && unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE) && unit->GetCharmerOrOwnerGUID() != m_caster->GetGUID()) return SPELL_MISS_EVADE; - // check for IsHostileTo() instead of !IsFriendlyTo() - // ex: spell 47463 needs to be casted by different units on the same neutral target - if (m_caster->IsHostileTo(unit)) + if (m_caster->IsValidAttackTarget(unit)) { unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_HITBYSPELL); //TODO: This is a hack. But we do not know what types of stealth should be interrupted by CC @@ -1575,7 +1598,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool return SPELL_MISS_NONE; } -void Spell::DoTriggersOnSpellHit(Unit *unit, uint8 effMask) +void Spell::DoTriggersOnSpellHit(Unit* unit, uint8 effMask) { // Apply additional spell effects to target // TODO: move this code to scripts @@ -1618,12 +1641,12 @@ void Spell::DoTriggersOnSpellHit(Unit *unit, uint8 effMask) // set duration of current aura to the triggered spell if (i->first->GetDuration() == -1) { - if (Aura * triggeredAur = unit->GetAura(i->first->Id, m_caster->GetGUID())) + if (Aura* triggeredAur = unit->GetAura(i->first->Id, m_caster->GetGUID())) { // get duration from aura-only once if (!_duration) { - Aura * aur = unit->GetAura(m_spellInfo->Id, m_caster->GetGUID()); + Aura* aur = unit->GetAura(m_spellInfo->Id, m_caster->GetGUID()); _duration = aur ? aur->GetDuration() : -1; } triggeredAur->SetDuration(_duration); @@ -1643,7 +1666,7 @@ void Spell::DoTriggersOnSpellHit(Unit *unit, uint8 effMask) unit->CastSpell(unit, *i, true, 0, 0, m_caster->GetGUID()); } -void Spell::DoAllEffectOnTarget(GOTargetInfo *target) +void Spell::DoAllEffectOnTarget(GOTargetInfo* target) { if (target->processed) // Check target return; @@ -1674,7 +1697,7 @@ void Spell::DoAllEffectOnTarget(GOTargetInfo *target) CallScriptAfterHitHandlers(); } -void Spell::DoAllEffectOnTarget(ItemTargetInfo *target) +void Spell::DoAllEffectOnTarget(ItemTargetInfo* target) { uint32 effectMask = target->effectMask; if (!target->item || !effectMask) @@ -1718,7 +1741,7 @@ bool Spell::UpdateChanneledTargetList() { if (ihit->missCondition == SPELL_MISS_NONE && (channelTargetEffectMask & ihit->effectMask)) { - Unit *unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); + Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID); if (!unit) continue; @@ -1779,7 +1802,7 @@ struct ChainHealingOrder : public std::binary_function<const Unit*, const Unit*, void Spell::SearchChainTarget(std::list<Unit*> &TagUnitMap, float max_range, uint32 num, SpellTargets TargetType) { - Unit *cur = m_targets.GetUnitTarget(); + Unit* cur = m_targets.GetUnitTarget(); if (!cur) return; @@ -1948,7 +1971,7 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType, Spe case SPELL_TARGET_TYPE_GAMEOBJECT: if ((*i_spellST)->mConditionValue2) { - if (GameObject *go = m_caster->FindNearestGameObject((*i_spellST)->mConditionValue2, range)) + if (GameObject* go = m_caster->FindNearestGameObject((*i_spellST)->mConditionValue2, range)) { // remember found target and range, next attempt will find more near target with another entry goScriptTarget = go; @@ -1972,7 +1995,7 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType, Spe return m_targets.GetUnitTarget(); case SPELL_TARGET_TYPE_DEAD: default: - if (Creature *cre = m_caster->FindNearestCreature((*i_spellST)->mConditionValue2, range, (*i_spellST)->mConditionValue1 != SPELL_TARGET_TYPE_DEAD)) + if (Creature* cre = m_caster->FindNearestCreature((*i_spellST)->mConditionValue2, range, (*i_spellST)->mConditionValue1 != SPELL_TARGET_TYPE_DEAD)) { creatureScriptTarget = cre; goScriptTarget = NULL; @@ -2007,13 +2030,23 @@ WorldObject* Spell::SearchNearbyTarget(float range, SpellTargets TargetType, Spe } } -void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) +uint32 Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) { SpellNotifyPushType pushType = PUSH_NONE; - Player *modOwner = NULL; + Player* modOwner = NULL; if (m_originalCaster) modOwner = m_originalCaster->GetSpellModOwner(); + uint32 effectMask = 1 << i; + // ENTRY targets may have different selection lists, skip those for now until we can compare lists easily and quickly + if (GetSpellInfo()->Effects[i].TargetA.GetSelectionCheckType() != TARGET_SELECT_CHECK_ENTRY && + GetSpellInfo()->Effects[i].TargetB.GetSelectionCheckType() != TARGET_SELECT_CHECK_ENTRY) + for (uint32 j = i + 1; j < MAX_SPELL_EFFECTS; ++j) + if (GetSpellInfo()->Effects[i].TargetA.GetTarget() == GetSpellInfo()->Effects[j].TargetA.GetTarget() && + GetSpellInfo()->Effects[i].TargetB.GetTarget() == GetSpellInfo()->Effects[j].TargetB.GetTarget() && + GetSpellInfo()->Effects[i].CalcRadius(m_caster) == GetSpellInfo()->Effects[j].CalcRadius(m_caster)) + effectMask |= 1 << j; + switch (cur.GetType()) { case TARGET_TYPE_UNIT_CASTER: @@ -2021,7 +2054,7 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) switch (cur.GetTarget()) { case TARGET_UNIT_CASTER: - AddUnitTarget(m_caster, i, false); + AddUnitTarget(m_caster, effectMask, false); break; case TARGET_DEST_CASTER_FISHING: { @@ -2036,24 +2069,24 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) } case TARGET_UNIT_MASTER: if (Unit* owner = m_caster->GetCharmerOrOwner()) - AddUnitTarget(owner, i); + AddUnitTarget(owner, effectMask); break; case TARGET_UNIT_PET: if (Guardian* pet = m_caster->GetGuardianPet()) - AddUnitTarget(pet, i); + AddUnitTarget(pet, effectMask); break; case TARGET_UNIT_SUMMONER: if (m_caster->isSummon()) if (Unit* unit = m_caster->ToTempSummon()->GetSummoner()) - AddUnitTarget(unit, i); + AddUnitTarget(unit, effectMask); break; case TARGET_UNIT_CASTER_AREA_PARTY: case TARGET_UNIT_CASTER_AREA_RAID: pushType = PUSH_CASTER_CENTER; break; case TARGET_UNIT_VEHICLE: - if (Unit *vehicle = m_caster->GetVehicleBase()) - AddUnitTarget(vehicle, i); + if (Unit* vehicle = m_caster->GetVehicleBase()) + AddUnitTarget(vehicle, effectMask); break; case TARGET_UNIT_PASSENGER_0: case TARGET_UNIT_PASSENGER_1: @@ -2064,8 +2097,8 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) case TARGET_UNIT_PASSENGER_6: case TARGET_UNIT_PASSENGER_7: if (m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->IsVehicle()) - if (Unit *unit = m_caster->GetVehicleKit()->GetPassenger(cur.GetTarget() - TARGET_UNIT_PASSENGER_0)) - AddUnitTarget(unit, i); + if (Unit* unit = m_caster->GetVehicleKit()->GetPassenger(cur.GetTarget() - TARGET_UNIT_PASSENGER_0)) + AddUnitTarget(unit, effectMask); break; default: break; @@ -2085,14 +2118,14 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) switch (cur.GetTarget()) { case TARGET_UNIT_TARGET_ENEMY: - if (Unit *magnet = m_caster->SelectMagnetTarget(target, m_spellInfo)) + if (Unit* magnet = m_caster->SelectMagnetTarget(target, m_spellInfo)) if (magnet != target) m_targets.SetUnitTarget(magnet); pushType = PUSH_CHAIN; break; case TARGET_UNIT_TARGET_ANY: if (!m_spellInfo->IsPositive()) - if (Unit *magnet = m_caster->SelectMagnetTarget(target, m_spellInfo)) + if (Unit* magnet = m_caster->SelectMagnetTarget(target, m_spellInfo)) if (magnet != target) m_targets.SetUnitTarget(magnet); pushType = PUSH_CHAIN; @@ -2101,15 +2134,15 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) pushType = PUSH_CHAIN; break; case TARGET_UNIT_TARGET_ALLY: - AddUnitTarget(target, i, false); + AddUnitTarget(target, effectMask, false); break; case TARGET_UNIT_TARGET_RAID: case TARGET_UNIT_TARGET_PARTY: case TARGET_UNIT_TARGET_MINIPET: - AddUnitTarget(target, i, false); + AddUnitTarget(target, effectMask, false); break; case TARGET_UNIT_TARGET_PASSENGER: - AddUnitTarget(target, i, false); + AddUnitTarget(target, effectMask, false); break; case TARGET_UNIT_LASTTARGET_AREA_PARTY: case TARGET_UNIT_TARGET_AREA_RAID_CLASS: @@ -2123,7 +2156,7 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) case TARGET_TYPE_UNIT_NEARBY: { - WorldObject *target = NULL; + WorldObject* target = NULL; float range; switch (cur.GetTarget()) @@ -2151,9 +2184,9 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) } if (!target) - return; + return 0; else if (target->GetTypeId() == TYPEID_GAMEOBJECT) - AddGOTarget((GameObject*)target, i); + AddGOTarget((GameObject*)target, effectMask); else { pushType = PUSH_CHAIN; @@ -2292,10 +2325,10 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) case TARGET_DEST_DYNOBJ_ALLY: case TARGET_DEST_DYNOBJ_NONE: case TARGET_DEST_DEST: - return; + return effectMask; case TARGET_DEST_TRAJ: SelectTrajTargets(); - return; + return effectMask; case TARGET_DEST_DEST_FRONT: angle = 0.0f; break; case TARGET_DEST_DEST_BACK: angle = static_cast<float>(M_PI); break; case TARGET_DEST_DEST_RIGHT: angle = static_cast<float>(M_PI/2); break; @@ -2349,7 +2382,7 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) float range = m_spellInfo->GetMaxRange(m_spellInfo->IsPositive()); if (modOwner) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RANGE, range, this); - if (WorldObject *target = SearchNearbyTarget(range, SPELL_TARGETS_ENTRY, SpellEffIndex(i))) + if (WorldObject* target = SearchNearbyTarget(range, SPELL_TARGETS_ENTRY, SpellEffIndex(i))) m_targets.SetDst(*target); break; } @@ -2372,7 +2405,7 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) case TARGET_UNIT_CHANNEL_TARGET: // unit target may be no longer avalible - teleported out of map for example if (Unit* target = Unit::GetUnit(*m_caster, m_originalCaster->GetCurrentSpell(CURRENT_CHANNELED_SPELL)->m_targets.GetUnitTargetGUID())) - AddUnitTarget(target, i); + AddUnitTarget(target, effectMask); else sLog->outError("SPELL: cannot find channel spell target for spell ID %u", m_spellInfo->Id); break; @@ -2399,13 +2432,13 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) { case TARGET_GAMEOBJECT_TARGET: if (m_targets.GetGOTarget()) - AddGOTarget(m_targets.GetGOTarget(), i); + AddGOTarget(m_targets.GetGOTarget(), effectMask); break; case TARGET_GAMEOBJECT_ITEM_TARGET: if (m_targets.GetGOTargetGUID()) - AddGOTarget(m_targets.GetGOTarget(), i); + AddGOTarget(m_targets.GetGOTarget(), effectMask); else if (m_targets.GetItemTarget()) - AddItemTarget(m_targets.GetItemTarget(), i); + AddItemTarget(m_targets.GetItemTarget(), effectMask); break; default: sLog->outError("SPELL (caster[type: %u; guidlow: %u], spell: %u): unhandled spell target (%u)", @@ -2422,7 +2455,7 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) if (!target) { sLog->outError("SPELL: no chain unit target for spell ID %u", m_spellInfo->Id); - return; + return 0; } //Chain: 2, 6, 22, 25, 45, 77 @@ -2433,8 +2466,10 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) if (maxTargets > 1) { //otherwise, this multiplier is used for something else - m_damageMultipliers[i] = 1.0f; - m_applyMultiplierMask |= 1 << i; + for (uint32 k = i; k < MAX_SPELL_EFFECTS; ++k) + if (effectMask & (1 << k)) + m_damageMultipliers[k] = 1.0f; + m_applyMultiplierMask |= effectMask; float range; std::list<Unit*> unitList; @@ -2463,16 +2498,16 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) CallScriptAfterUnitTargetSelectHandlers(unitList, SpellEffIndex(i)); for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr) - AddUnitTarget(*itr, i, false); + AddUnitTarget(*itr, effectMask, false); } else - AddUnitTarget(target, i, false); + AddUnitTarget(target, effectMask, false); } else if (pushType) { // Dummy, just for client if (m_spellInfo->Effects[i].GetRequiredTargetType() != SPELL_REQUIRE_UNIT) - return; + return 0; float radius; SpellTargets targetType; @@ -2527,7 +2562,7 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) { if ((*i_spellST)->mConditionType != CONDITION_SPELL_SCRIPT_TARGET) continue; - if ((*i_spellST)->mConditionValue3 && !((*i_spellST)->mConditionValue3 & (1<<i))) + if ((*i_spellST)->mConditionValue3 && !((*i_spellST)->mConditionValue3 & effectMask)) continue; if ((*i_spellST)->mConditionValue1 == SPELL_TARGET_TYPE_CREATURE) SearchAreaTarget(unitList, radius, pushType, SPELL_TARGETS_ENTRY, (*i_spellST)->mConditionValue2); @@ -2622,7 +2657,7 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) { if ((*i_spellST)->mConditionType != CONDITION_SPELL_SCRIPT_TARGET) continue; - if ((*i_spellST)->mConditionValue3 && !((*i_spellST)->mConditionValue3 & (1<<i))) + if ((*i_spellST)->mConditionValue3 && !((*i_spellST)->mConditionValue3 & effectMask)) continue; if ((*i_spellST)->mConditionValue1 == SPELL_TARGET_TYPE_GAMEOBJECT) SearchGOAreaTarget(gobjectList, radius, pushType, SPELL_TARGETS_GO, (*i_spellST)->mConditionValue2); @@ -2666,17 +2701,17 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) Group* pGroup = targetPlayer ? targetPlayer->GetGroup() : NULL; if (pGroup) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* Target = itr->getSource(); // IsHostileTo check duel and controlled by enemy if (Target && targetPlayer->IsWithinDistInMap(Target, radius) && targetPlayer->getClass() == Target->getClass() && !m_caster->IsHostileTo(Target)) - AddUnitTarget(Target, i); + AddUnitTarget(Target, effectMask); } } else if (m_targets.GetUnitTarget()) - AddUnitTarget(m_targets.GetUnitTarget(), i); + AddUnitTarget(m_targets.GetUnitTarget(), effectMask); break; } default: @@ -2822,7 +2857,7 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) CallScriptAfterUnitTargetSelectHandlers(unitList, SpellEffIndex(i)); for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr) - AddUnitTarget(*itr, i, false); + AddUnitTarget(*itr, effectMask, false); } if (!gobjectList.empty()) @@ -2837,9 +2872,11 @@ void Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) Trinity::RandomResizeList(gobjectList, maxTargets); } for (std::list<GameObject*>::iterator itr = gobjectList.begin(); itr != gobjectList.end(); ++itr) - AddGOTarget(*itr, i); + AddGOTarget(*itr, effectMask); } } + + return effectMask; } void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura) @@ -2903,7 +2940,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect const* triggered return; } - if (sDisableMgr->IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, m_caster)) + if (DisableMgr::IsDisabledFor(DISABLE_TYPE_SPELL, m_spellInfo->Id, m_caster)) { SendCastResult(SPELL_FAILED_SPELL_UNAVAILABLE); finish(false); @@ -3062,25 +3099,11 @@ void Spell::cast(bool skipCheck) // update pointers base at GUIDs to prevent access to non-existed already object UpdatePointers(); - if (Unit* target = m_targets.GetUnitTarget()) - { - // three check: prepare, cast (m_casttime > 0), hit (delayed) - if (m_casttime && target->isAlive() && !target->IsFriendlyTo(m_caster) && !m_caster->canSeeOrDetect(target)) - { - SendCastResult(SPELL_FAILED_BAD_TARGETS); - SendInterrupted(0); - finish(false); - return; - } - } - else + // cancel at lost explicit target during cast + if (m_targets.GetObjectTargetGUID() && !m_targets.GetObjectTarget()) { - // cancel at lost main target unit - if (m_targets.GetUnitTargetGUID() && m_targets.GetUnitTargetGUID() != m_caster->GetGUID()) - { - cancel(); - return; - } + cancel(); + return; } // now that we've done the basic check, now run the scripts @@ -3101,8 +3124,8 @@ void Spell::cast(bool skipCheck) m_caster->ToPlayer()->SetSpellModTakingSpell(this, true); } - // triggered cast called from Spell::prepare where it was already checked - if (!IsTriggered() || !skipCheck) + // skip check if done already (for instant cast spells for example) + if (!skipCheck) { SpellCastResult castResult = CheckCast(false); if (castResult != SPELL_CAST_OK) @@ -3622,7 +3645,7 @@ void Spell::finish(bool ok) // Unsummon summon as possessed creatures on spell cancel if (m_spellInfo->IsChanneled() && m_caster->GetTypeId() == TYPEID_PLAYER) { - if (Unit *charm = m_caster->GetCharm()) + if (Unit* charm = m_caster->GetCharm()) if (charm->GetTypeId() == TYPEID_UNIT && charm->ToCreature()->HasUnitTypeMask(UNIT_MASK_PUPPET) && charm->GetUInt32Value(UNIT_CREATED_BY_SPELL) == m_spellInfo->Id) @@ -3639,7 +3662,7 @@ void Spell::finish(bool ok) { // Unsummon statue uint32 spell = m_caster->GetUInt32Value(UNIT_CREATED_BY_SPELL); - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell); if (spellInfo && spellInfo->SpellIconID == 2056) { sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Statue %d is unsummoned in spell %d finish", m_caster->GetGUIDLow(), m_spellInfo->Id); @@ -3925,14 +3948,14 @@ void Spell::SendSpellGo() m_caster->SendMessageToSet(&data, true); } -void Spell::WriteAmmoToPacket(WorldPacket * data) +void Spell::WriteAmmoToPacket(WorldPacket* data) { uint32 ammoInventoryType = 0; uint32 ammoDisplayID = 0; if (m_caster->GetTypeId() == TYPEID_PLAYER) { - Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK); + Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK); if (pItem) { ammoInventoryType = pItem->GetTemplate()->InventoryType; @@ -3943,7 +3966,7 @@ void Spell::WriteAmmoToPacket(WorldPacket * data) uint32 ammoID = m_caster->ToPlayer()->GetUInt32Value(PLAYER_AMMO_ID); if (ammoID) { - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(ammoID); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(ammoID); if (pProto) { ammoDisplayID = pProto->DisplayInfoID; @@ -3997,7 +4020,7 @@ void Spell::WriteAmmoToPacket(WorldPacket * data) *data << uint32(ammoInventoryType); } -void Spell::WriteSpellGoTargets(WorldPacket * data) +void Spell::WriteSpellGoTargets(WorldPacket* data) { // This function also fill data for channeled spells: // m_needAliveTargetMask req for stop channelig if one target die @@ -4111,7 +4134,7 @@ void Spell::ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, uint3 *m_effectExecuteData[effIndex] << uint32(damage); } -void Spell::ExecuteLogEffectOpenLock(uint8 effIndex, Object * obj) +void Spell::ExecuteLogEffectOpenLock(uint8 effIndex, Object* obj) { InitEffectExecuteData(effIndex); m_effectExecuteData[effIndex]->append(obj->GetPackGUID()); @@ -4129,13 +4152,13 @@ void Spell::ExecuteLogEffectDestroyItem(uint8 effIndex, uint32 entry) *m_effectExecuteData[effIndex] << uint32(entry); } -void Spell::ExecuteLogEffectSummonObject(uint8 effIndex, WorldObject * obj) +void Spell::ExecuteLogEffectSummonObject(uint8 effIndex, WorldObject* obj) { InitEffectExecuteData(effIndex); m_effectExecuteData[effIndex]->append(obj->GetPackGUID()); } -void Spell::ExecuteLogEffectUnsummonObject(uint8 effIndex, WorldObject * obj) +void Spell::ExecuteLogEffectUnsummonObject(uint8 effIndex, WorldObject* obj) { InitEffectExecuteData(effIndex); m_effectExecuteData[effIndex]->append(obj->GetPackGUID()); @@ -4229,7 +4252,7 @@ void Spell::TakeCastItem() if (_triggeredCastFlags & TRIGGERED_IGNORE_CAST_ITEM) return; - ItemTemplate const *proto = m_CastItem->GetTemplate(); + ItemTemplate const* proto = m_CastItem->GetTemplate(); if (!proto) { @@ -4301,7 +4324,7 @@ void Spell::TakePower() if (ihit->missCondition != SPELL_MISS_NONE) { //lower spell cost on fail (by talent aura) - if (Player *modOwner = m_caster->ToPlayer()->GetSpellModOwner()) + if (Player* modOwner = m_caster->ToPlayer()->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_SPELL_COST_REFUND_ON_FAIL, m_powerCost); } break; @@ -4344,7 +4367,7 @@ void Spell::TakeAmmo() { if (m_attackType == RANGED_ATTACK && m_caster->GetTypeId() == TYPEID_PLAYER) { - Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK); + Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK); // wands don't have ammo if (!pItem || pItem->IsBroken() || pItem->GetTemplate()->SubClass == ITEM_SUBCLASS_WEAPON_WAND) @@ -4377,12 +4400,12 @@ SpellCastResult Spell::CheckRuneCost(uint32 runeCostID) if (m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_CAST_OK; - Player *plr = (Player*)m_caster; + Player* plr = (Player*)m_caster; if (plr->getClass() != CLASS_DEATH_KNIGHT) return SPELL_CAST_OK; - SpellRuneCostEntry const *src = sSpellRuneCostStore.LookupEntry(runeCostID); + SpellRuneCostEntry const* src = sSpellRuneCostStore.LookupEntry(runeCostID); if (!src) return SPELL_CAST_OK; @@ -4423,11 +4446,11 @@ void Spell::TakeRunePower(bool didHit) if (m_caster->GetTypeId() != TYPEID_PLAYER || m_caster->getClass() != CLASS_DEATH_KNIGHT) return; - SpellRuneCostEntry const *runeCostData = sSpellRuneCostStore.LookupEntry(m_spellInfo->RuneCostID); + SpellRuneCostEntry const* runeCostData = sSpellRuneCostStore.LookupEntry(m_spellInfo->RuneCostID); if (!runeCostData || (runeCostData->NoRuneCost() && runeCostData->NoRunicPowerGain())) return; - Player *player = m_caster->ToPlayer(); + Player* player = m_caster->ToPlayer(); m_runesState = player->GetRunesState(); // store previous state int32 runeCost[NUM_RUNE_TYPES]; // blood, frost, unholy, death @@ -4582,7 +4605,7 @@ void Spell::HandleThreatSpells() sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell %u, added an additional %f threat for %s %u target(s)", m_spellInfo->Id, threat, m_spellInfo->_IsPositiveSpell() ? "assisting" : "harming", uint32(m_UniqueTargetInfo.size())); } -void Spell::HandleEffects(Unit *pUnitTarget, Item *pItemTarget, GameObject *pGOTarget, uint32 i) +void Spell::HandleEffects(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGOTarget, uint32 i) { //effect has been handled, skip it if (m_effectMask & (1<<i)) @@ -4752,6 +4775,11 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_DONT_REPORT; } + // Don't check explicit target for passive spells (workaround) (check should be skipped only for learn case) + // those spells may have incorrect target entries or not filled at all (for example 15332) + // such spells when learned are not targeting anyone using targeting system, they should apply directly to caster instead + // also, such casts shouldn't be sent to client + if (!((m_spellInfo->Attributes & SPELL_ATTR0_PASSIVE) && (!m_targets.GetUnitTarget() || m_targets.GetUnitTarget() == m_caster))) { // Check explicit target for m_originalCaster - todo: get rid of such workarounds SpellCastResult castResult = m_spellInfo->CheckExplicitTarget(m_originalCaster ? m_originalCaster : m_caster, m_targets.GetObjectTarget(), m_targets.GetItemTarget()); @@ -4788,22 +4816,21 @@ SpellCastResult Spell::CheckCast(bool strict) return SPELL_FAILED_TARGET_AURASTATE; } } + } - // check pet presence - for (int j = 0; j < MAX_SPELL_EFFECTS; ++j) + // check pet presence + for (int j = 0; j < MAX_SPELL_EFFECTS; ++j) + { + if (m_spellInfo->Effects[j].TargetA.GetTarget() == TARGET_UNIT_PET) { - if (m_spellInfo->Effects[j].TargetA.GetTarget() == TARGET_UNIT_PET) + if (!m_caster->GetGuardianPet()) { - target = m_caster->GetGuardianPet(); - if (!target) - { - if (m_triggeredByAuraSpell) // not report pet not existence for triggered spells - return SPELL_FAILED_DONT_REPORT; - else - return SPELL_FAILED_NO_PET; - } - break; + if (m_triggeredByAuraSpell) // not report pet not existence for triggered spells + return SPELL_FAILED_DONT_REPORT; + else + return SPELL_FAILED_NO_PET; } + break; } } @@ -4897,11 +4924,6 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_targets.GetUnitTarget() && !m_caster->IsFriendlyTo(m_targets.GetUnitTarget()) && !m_caster->HasInArc(static_cast<float>(M_PI), m_targets.GetUnitTarget())) return SPELL_FAILED_UNIT_NOT_INFRONT; } - else if (m_spellInfo->SpellIconID == 33 && m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_SHAMAN_FIRE_NOVA) - { - if (!m_caster->m_SummonSlot[1]) - return SPELL_FAILED_SUCCESS; - } else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_DEATHKNIGHT && m_spellInfo->SpellFamilyFlags[0] == 0x2000) // Death Coil (DeathKnight) { Unit* target = m_targets.GetUnitTarget(); @@ -4910,7 +4932,7 @@ SpellCastResult Spell::CheckCast(bool strict) } else if (m_spellInfo->Id == 19938) // Awaken Peon { - Unit *unit = m_targets.GetUnitTarget(); + Unit* unit = m_targets.GetUnitTarget(); if (!unit || !unit->HasAura(17743)) return SPELL_FAILED_BAD_TARGETS; } @@ -4944,7 +4966,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (!pet) return SPELL_FAILED_NO_PET; - SpellInfo const *learn_spellproto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[i].TriggerSpell); + SpellInfo const* learn_spellproto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[i].TriggerSpell); if (!learn_spellproto) return SPELL_FAILED_NOT_KNOWN; @@ -4963,7 +4985,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (!pet) return SPELL_FAILED_NO_PET; - SpellInfo const *learn_spellproto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[i].TriggerSpell); + SpellInfo const* learn_spellproto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[i].TriggerSpell); if (!learn_spellproto) return SPELL_FAILED_NOT_KNOWN; @@ -4976,7 +4998,7 @@ SpellCastResult Spell::CheckCast(bool strict) case SPELL_EFFECT_APPLY_GLYPH: { uint32 glyphId = m_spellInfo->Effects[i].MiscValue; - if (GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyphId)) + if (GlyphPropertiesEntry const* gp = sGlyphPropertiesStore.LookupEntry(glyphId)) if (m_caster->HasAura(gp->SpellId)) return SPELL_FAILED_UNIQUE_GLYPH; break; @@ -5067,7 +5089,7 @@ SpellCastResult Spell::CheckCast(bool strict) || (m_spellInfo->Effects[i].TargetA.GetTarget() == TARGET_GAMEOBJECT_TARGET && !m_targets.GetGOTarget())) return SPELL_FAILED_BAD_TARGETS; - Item *pTempItem = NULL; + Item* pTempItem = NULL; if (m_targets.GetTargetMask() & TARGET_FLAG_TRADE_ITEM) { if (TradeData* pTrade = m_caster->ToPlayer()->GetTradeData()) @@ -5122,7 +5144,7 @@ SpellCastResult Spell::CheckCast(bool strict) } case SPELL_EFFECT_SUMMON_DEAD_PET: { - Creature *pet = m_caster->GetGuardianPet(); + Creature* pet = m_caster->GetGuardianPet(); if (!pet) return SPELL_FAILED_NO_PET; @@ -5134,7 +5156,7 @@ SpellCastResult Spell::CheckCast(bool strict) // This is generic summon effect case SPELL_EFFECT_SUMMON: { - SummonPropertiesEntry const *SummonProperties = sSummonPropertiesStore.LookupEntry(m_spellInfo->Effects[i].MiscValueB); + SummonPropertiesEntry const* SummonProperties = sSummonPropertiesStore.LookupEntry(m_spellInfo->Effects[i].MiscValueB); if (!SummonProperties) break; switch (SummonProperties->Category) @@ -5198,8 +5220,9 @@ SpellCastResult Spell::CheckCast(bool strict) Difficulty difficulty = m_caster->GetMap()->GetDifficulty(); if (map->IsRaid()) if (InstancePlayerBind* targetBind = target->GetBoundInstance(mapId, difficulty)) - if (targetBind->perm && targetBind != m_caster->ToPlayer()->GetBoundInstance(mapId, difficulty)) - return SPELL_FAILED_TARGET_LOCKED_TO_RAID_INSTANCE; + if (InstancePlayerBind* casterBind = m_caster->ToPlayer()->GetBoundInstance(mapId, difficulty)) + if (targetBind->perm && targetBind->save != casterBind->save) + return SPELL_FAILED_TARGET_LOCKED_TO_RAID_INSTANCE; InstanceTemplate const* instance = sObjectMgr->GetInstanceTemplate(mapId); if (!instance) @@ -5233,7 +5256,7 @@ SpellCastResult Spell::CheckCast(bool strict) { //Do not allow to cast it before BG starts. if (m_caster->GetTypeId() == TYPEID_PLAYER) - if (Battleground const *bg = m_caster->ToPlayer()->GetBattleground()) + if (Battleground const* bg = m_caster->ToPlayer()->GetBattleground()) if (bg->GetStatus() != STATUS_IN_PROGRESS) return SPELL_FAILED_TRY_AGAIN; break; @@ -5337,7 +5360,7 @@ SpellCastResult Spell::CheckCast(bool strict) if (m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_NO_PET; - Pet *pet = m_caster->ToPlayer()->GetPet(); + Pet* pet = m_caster->ToPlayer()->GetPet(); if (!pet) return SPELL_FAILED_NO_PET; @@ -5387,7 +5410,7 @@ SpellCastResult Spell::CheckCast(bool strict) // Ignore map check if spell have AreaId. AreaId already checked and this prevent special mount spells bool allowMount = !m_caster->GetMap()->IsDungeon() || m_caster->GetMap()->IsBattlegroundOrArena(); - InstanceTemplate const *it = sObjectMgr->GetInstanceTemplate(m_caster->GetMapId()); + InstanceTemplate const* it = sObjectMgr->GetInstanceTemplate(m_caster->GetMapId()); if (it) allowMount = it->AllowMount; if (m_caster->GetTypeId() == TYPEID_PLAYER && !allowMount && !m_spellInfo->AreaGroupId) @@ -5479,7 +5502,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target) return SPELL_FAILED_SPELL_IN_PROGRESS; // dead owner (pets still alive when owners ressed?) - if (Unit *owner = m_caster->GetCharmerOrOwner()) + if (Unit* owner = m_caster->GetCharmerOrOwner()) if (!owner->isAlive()) return SPELL_FAILED_CASTER_DEAD; @@ -5649,7 +5672,7 @@ bool Spell::CanAutoCast(Unit* target) } else { - if (AuraEffect * aureff = target->GetAuraEffect(m_spellInfo->Id, j)) + if (AuraEffect* aureff = target->GetAuraEffect(m_spellInfo->Id, j)) if (aureff->GetBase()->GetStackAmount() >= m_spellInfo->StackAmount) return false; } @@ -5787,7 +5810,7 @@ SpellCastResult Spell::CheckItems() if (!p_caster->HasItemCount(itemid, 1)) return SPELL_FAILED_ITEM_NOT_READY; - ItemTemplate const *proto = m_CastItem->GetTemplate(); + ItemTemplate const* proto = m_CastItem->GetTemplate(); if (!proto) return SPELL_FAILED_ITEM_NOT_READY; @@ -5912,7 +5935,7 @@ SpellCastResult Spell::CheckItems() // if CastItem is also spell reagent if (m_CastItem && m_CastItem->GetEntry() == itemid) { - ItemTemplate const *proto = m_CastItem->GetTemplate(); + ItemTemplate const* proto = m_CastItem->GetTemplate(); if (!proto) return SPELL_FAILED_ITEM_NOT_READY; for (int s=0; s < MAX_ITEM_PROTO_SPELLS; ++s) @@ -5981,7 +6004,7 @@ SpellCastResult Spell::CheckItems() InventoryResult msg = p_caster->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, m_spellInfo->Effects[i].ItemType, 1); if (msg != EQUIP_ERR_OK) { - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(m_spellInfo->Effects[i].ItemType); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(m_spellInfo->Effects[i].ItemType); // TODO: Needs review if (pProto && !(pProto->ItemLimitCategory)) { @@ -6032,7 +6055,7 @@ SpellCastResult Spell::CheckItems() bool isItemUsable = false; for (uint8 e = 0; e < MAX_ITEM_PROTO_SPELLS; ++e) { - ItemTemplate const *proto = targetItem->GetTemplate(); + ItemTemplate const* proto = targetItem->GetTemplate(); if (proto->Spells[e].SpellId && ( proto->Spells[e].SpellTrigger == ITEM_SPELLTRIGGER_ON_USE || proto->Spells[e].SpellTrigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE)) @@ -6042,7 +6065,7 @@ SpellCastResult Spell::CheckItems() } } - SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(m_spellInfo->Effects[i].MiscValue); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(m_spellInfo->Effects[i].MiscValue); // do not allow adding usable enchantments to items that have use effect already if (pEnchant && isItemUsable) for (uint8 s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s) @@ -6061,14 +6084,14 @@ SpellCastResult Spell::CheckItems() } case SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY: { - Item *item = m_targets.GetItemTarget(); + Item* item = m_targets.GetItemTarget(); if (!item) return SPELL_FAILED_ITEM_NOT_FOUND; // Not allow enchant in trade slot for some enchant type if (item->GetOwner() != m_caster) { uint32 enchant_id = m_spellInfo->Effects[i].MiscValue; - SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) return SPELL_FAILED_ERROR; if (pEnchant->slot & ENCHANTMENT_CAN_SOULBOUND) @@ -6159,7 +6182,7 @@ SpellCastResult Spell::CheckItems() if (m_caster->GetTypeId() != TYPEID_PLAYER) return SPELL_FAILED_TARGET_NOT_PLAYER; if (m_attackType != RANGED_ATTACK) break; - Item *pItem = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType); + Item* pItem = m_caster->ToPlayer()->GetWeaponForAttack(m_attackType); if (!pItem || pItem->IsBroken()) return SPELL_FAILED_EQUIPPED_ITEM; @@ -6185,7 +6208,7 @@ SpellCastResult Spell::CheckItems() return SPELL_FAILED_NO_AMMO; } - ItemTemplate const *ammoProto = sObjectMgr->GetItemTemplate(ammo); + ItemTemplate const* ammoProto = sObjectMgr->GetItemTemplate(ammo); if (!ammoProto) return SPELL_FAILED_NO_AMMO; @@ -6224,7 +6247,7 @@ SpellCastResult Spell::CheckItems() case SPELL_EFFECT_CREATE_MANA_GEM: { uint32 item_id = m_spellInfo->Effects[i].ItemType; - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(item_id); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item_id); if (!pProto) return SPELL_FAILED_ITEM_AT_MAX_CHARGES; @@ -6424,7 +6447,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const if (!m_targets.GetCorpseTargetGUID()) return false; - Corpse *corpse = ObjectAccessor::GetCorpse(*m_caster, m_targets.GetCorpseTargetGUID()); + Corpse* corpse = ObjectAccessor::GetCorpse(*m_caster, m_targets.GetCorpseTargetGUID()); if (!corpse) return false; @@ -6439,7 +6462,7 @@ bool Spell::CheckEffectTarget(Unit const* target, uint32 eff) const break; default: // normal case // Get GO cast coordinates if original caster -> GO - WorldObject *caster = NULL; + WorldObject* caster = NULL; if (IS_GAMEOBJECT_GUID(m_originalCasterGUID)) caster = m_caster->GetMap()->GetGameObject(m_originalCasterGUID); if (!caster) @@ -6684,7 +6707,7 @@ void Spell::CalculateDamageDoneForAllTargets() } } -int32 Spell::CalculateDamageDone(Unit *unit, const uint32 effectMask, float * multiplier) +int32 Spell::CalculateDamageDone(Unit* unit, const uint32 effectMask, float * multiplier) { int32 damageDone = 0; unitTarget = unit; @@ -6747,7 +6770,7 @@ SpellCastResult Spell::CanOpenLock(uint32 effIndex, uint32 lockId, SkillType& sk return SPELL_CAST_OK; // Get LockInfo - LockEntry const *lockInfo = sLockStore.LookupEntry(lockId); + LockEntry const* lockInfo = sLockStore.LookupEntry(lockId); if (!lockInfo) return SPELL_FAILED_BAD_TARGETS; @@ -7009,11 +7032,11 @@ void Spell::LoadScripts() { sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "Spell::LoadScripts"); sScriptMgr->CreateSpellScripts(m_spellInfo->Id, m_loadedScripts); - for (std::list<SpellScript *>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end() ;) + for (std::list<SpellScript*>::iterator itr = m_loadedScripts.begin(); itr != m_loadedScripts.end() ;) { if (!(*itr)->_Load(this)) { - std::list<SpellScript *>::iterator bitr = itr; + std::list<SpellScript*>::iterator bitr = itr; ++itr; m_loadedScripts.erase(bitr); continue; @@ -7025,14 +7048,14 @@ void Spell::LoadScripts() void Spell::PrepareScriptHitHandlers() { - for (std::list<SpellScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) (*scritr)->_InitHit(); } SpellCastResult Spell::CallScriptCheckCastHandlers() { SpellCastResult retVal = SPELL_CAST_OK; - for (std::list<SpellScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) { (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_CHECK_CAST); std::list<SpellScript::CheckCastHandler>::iterator hookItrEnd = (*scritr)->OnCheckCast.end(), hookItr = (*scritr)->OnCheckCast.begin(); @@ -7052,7 +7075,7 @@ bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex) { // execute script effect handler hooks and check if effects was prevented bool preventDefault = false; - for (std::list<SpellScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) { (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_EFFECT); std::list<SpellScript::EffectHandler>::iterator effEndItr = (*scritr)->OnEffect.end(), effItr = (*scritr)->OnEffect.begin(); @@ -7071,7 +7094,7 @@ bool Spell::CallScriptEffectHandlers(SpellEffIndex effIndex) void Spell::CallScriptBeforeHitHandlers() { - for (std::list<SpellScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) { (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_BEFORE_HIT); std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->BeforeHit.end(), hookItr = (*scritr)->BeforeHit.begin(); @@ -7084,7 +7107,7 @@ void Spell::CallScriptBeforeHitHandlers() void Spell::CallScriptOnHitHandlers() { - for (std::list<SpellScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) { (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_HIT); std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->OnHit.end(), hookItr = (*scritr)->OnHit.begin(); @@ -7097,7 +7120,7 @@ void Spell::CallScriptOnHitHandlers() void Spell::CallScriptAfterHitHandlers() { - for (std::list<SpellScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) { (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_AFTER_HIT); std::list<SpellScript::HitHandler>::iterator hookItrEnd = (*scritr)->AfterHit.end(), hookItr = (*scritr)->AfterHit.begin(); @@ -7110,7 +7133,7 @@ void Spell::CallScriptAfterHitHandlers() void Spell::CallScriptAfterUnitTargetSelectHandlers(std::list<Unit*>& unitTargets, SpellEffIndex effIndex) { - for (std::list<SpellScript *>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) + for (std::list<SpellScript*>::iterator scritr = m_loadedScripts.begin(); scritr != m_loadedScripts.end() ; ++scritr) { (*scritr)->_PrepareScriptCall(SPELL_SCRIPT_HOOK_UNIT_TARGET_SELECT); std::list<SpellScript::UnitTargetHandler>::iterator hookItrEnd = (*scritr)->OnUnitTargetSelect.end(), hookItr = (*scritr)->OnUnitTargetSelect.begin(); @@ -7174,9 +7197,9 @@ void Spell::PrepareTriggersExecutedOnHit() { if (!(*i)->IsAffectedOnSpell(m_spellInfo)) continue; - SpellInfo const *auraSpellInfo = (*i)->GetSpellInfo(); + SpellInfo const* auraSpellInfo = (*i)->GetSpellInfo(); uint32 auraSpellIdx = (*i)->GetEffIndex(); - if (SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(auraSpellInfo->Effects[auraSpellIdx].TriggerSpell)) + if (SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(auraSpellInfo->Effects[auraSpellIdx].TriggerSpell)) { // calculate the chance using spell base amount, because aura amount is not updated on combo-points change // this possibly needs fixing diff --git a/src/server/game/Spells/Spell.h b/src/server/game/Spells/Spell.h index 74198aa0dfd..be6e16b30d2 100755 --- a/src/server/game/Spells/Spell.h +++ b/src/server/game/Spells/Spell.h @@ -230,7 +230,7 @@ class Spell void EffectDistract(SpellEffIndex effIndex); void EffectPull(SpellEffIndex effIndex); void EffectSchoolDMG(SpellEffIndex effIndex); - void EffectEnvirinmentalDMG(SpellEffIndex effIndex); + void EffectEnvironmentalDMG(SpellEffIndex effIndex); void EffectInstaKill(SpellEffIndex effIndex); void EffectDummy(SpellEffIndex effIndex); void EffectTeleportUnits(SpellEffIndex effIndex); @@ -355,7 +355,7 @@ class Spell typedef std::set<Aura*> UsedSpellMods; - Spell(Unit* caster, SpellInfo const *info, TriggerCastFlags triggerFlags, uint64 originalCasterGUID = 0, bool skipCheck = false); + Spell(Unit* caster, SpellInfo const* info, TriggerCastFlags triggerFlags, uint64 originalCasterGUID = 0, bool skipCheck = false); ~Spell(); void prepare(SpellCastTargets const* targets, AuraEffect const* triggeredByAura = NULL); @@ -395,12 +395,12 @@ class Spell void setState(uint32 state) { m_spellState = state; } void DoCreateItem(uint32 i, uint32 itemtype); - void WriteSpellGoTargets(WorldPacket * data); - void WriteAmmoToPacket(WorldPacket * data); + void WriteSpellGoTargets(WorldPacket* data); + void WriteAmmoToPacket(WorldPacket* data); void InitExplicitTargets(SpellCastTargets const& targets); void SelectSpellTargets(); - void SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur); + uint32 SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur); void SelectTrajTargets(); template<typename T> WorldObject* FindCorpseUsing(); @@ -420,18 +420,18 @@ class Spell void ExecuteLogEffectExtraAttacks(uint8 effIndex, Unit* victim, uint32 attCount); void ExecuteLogEffectInterruptCast(uint8 effIndex, Unit* victim, uint32 spellId); void ExecuteLogEffectDurabilityDamage(uint8 effIndex, Unit* victim, uint32 itemslot, uint32 damage); - void ExecuteLogEffectOpenLock(uint8 effIndex, Object * obj); + void ExecuteLogEffectOpenLock(uint8 effIndex, Object* obj); void ExecuteLogEffectCreateItem(uint8 effIndex, uint32 entry); void ExecuteLogEffectDestroyItem(uint8 effIndex, uint32 entry); - void ExecuteLogEffectSummonObject(uint8 effIndex, WorldObject * obj); - void ExecuteLogEffectUnsummonObject(uint8 effIndex, WorldObject * obj); + void ExecuteLogEffectSummonObject(uint8 effIndex, WorldObject* obj); + void ExecuteLogEffectUnsummonObject(uint8 effIndex, WorldObject* obj); void ExecuteLogEffectResurrect(uint8 effIndex, Unit* target); void SendInterrupted(uint8 result); void SendChannelUpdate(uint32 time); void SendChannelStart(uint32 duration); void SendResurrectRequest(Player* target); - void HandleEffects(Unit *pUnitTarget, Item *pItemTarget, GameObject *pGOTarget, uint32 i); + void HandleEffects(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGOTarget, uint32 i); void HandleThreatSpells(); SpellInfo const* const m_spellInfo; @@ -531,7 +531,7 @@ class Spell GameObject* gameObjTarget; int32 damage; // used in effects handlers - Aura * m_spellAura; + Aura* m_spellAura; // this is set in Spell Hit, but used in Apply Aura handler DiminishingLevels m_diminishLevel; @@ -588,15 +588,15 @@ class Spell }; std::list<ItemTargetInfo> m_UniqueItemInfo; - void AddUnitTarget(Unit* target, uint32 effIndex, bool checkIfValid = true); - void AddGOTarget(GameObject* target, uint32 effIndex); - void AddGOTarget(uint64 goGUID, uint32 effIndex); - void AddItemTarget(Item* target, uint32 effIndex); - void DoAllEffectOnTarget(TargetInfo *target); - SpellMissInfo DoSpellHitOnUnit(Unit *unit, uint32 effectMask, bool scaleAura); - void DoTriggersOnSpellHit(Unit *unit, uint8 effMask); - void DoAllEffectOnTarget(GOTargetInfo *target); - void DoAllEffectOnTarget(ItemTargetInfo *target); + void AddUnitTarget(Unit* target, uint32 effectMask, bool checkIfValid = true); + void AddGOTarget(GameObject* target, uint32 effectMask); + void AddGOTarget(uint64 goGUID, uint32 effectMask); + void AddItemTarget(Item* item, uint32 effectMask); + void DoAllEffectOnTarget(TargetInfo* target); + SpellMissInfo DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleAura); + void DoTriggersOnSpellHit(Unit* unit, uint8 effMask); + void DoAllEffectOnTarget(GOTargetInfo* target); + void DoAllEffectOnTarget(ItemTargetInfo* target); bool UpdateChanneledTargetList(); void SearchAreaTarget(std::list<Unit*> &unitList, float radius, SpellNotifyPushType type, SpellTargets TargetType, uint32 entry = 0); void SearchGOAreaTarget(std::list<GameObject*> &gobjectList, float radius, SpellNotifyPushType type, SpellTargets TargetType, uint32 entry = 0); @@ -604,7 +604,7 @@ class Spell WorldObject* SearchNearbyTarget(float range, SpellTargets TargetType, SpellEffIndex effIndex); bool IsValidDeadOrAliveTarget(Unit const* target) const; void CalculateDamageDoneForAllTargets(); - int32 CalculateDamageDone(Unit *unit, const uint32 effectMask, float *multiplier); + int32 CalculateDamageDone(Unit* unit, const uint32 effectMask, float *multiplier); void SpellDamageSchoolDmg(SpellEffIndex effIndex); void SpellDamageWeaponDmg(SpellEffIndex effIndex); void SpellDamageHeal(SpellEffIndex effIndex); @@ -626,7 +626,7 @@ class Spell void CallScriptOnHitHandlers(); void CallScriptAfterHitHandlers(); void CallScriptAfterUnitTargetSelectHandlers(std::list<Unit*>& unitTargets, SpellEffIndex effIndex); - std::list<SpellScript *> m_loadedScripts; + std::list<SpellScript*> m_loadedScripts; bool CanExecuteTriggersOnHit(uint8 effMask) const; void PrepareTriggersExecutedOnHit(); @@ -635,7 +635,7 @@ class Spell // effect helpers void GetSummonPosition(uint32 i, Position &pos, float radius = 0.0f, uint32 count = 0); - void SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const *properties); + void SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* properties); void CalculateJumpSpeeds(uint8 i, float dist, float & speedxy, float & speedz); SpellCastResult CanOpenLock(uint32 effIndex, uint32 lockid, SkillType& skillid, int32& reqSkillValue, int32& skillValue); @@ -676,11 +676,11 @@ namespace Trinity SpellTargets i_TargetType; const Unit* const i_source; uint32 i_entry; - const Position * const i_pos; + const Position* const i_pos; SpellInfo const* i_spellProto; - SpellNotifierCreatureAndPlayer(Unit *source, std::list<Unit*> &data, float radius, SpellNotifyPushType type, - SpellTargets TargetType = SPELL_TARGETS_ENEMY, const Position *pos = NULL, uint32 entry = 0, SpellInfo const* spellProto = NULL) + SpellNotifierCreatureAndPlayer(Unit* source, std::list<Unit*> &data, float radius, SpellNotifyPushType type, + SpellTargets TargetType = SPELL_TARGETS_ENEMY, const Position* pos = NULL, uint32 entry = 0, SpellInfo const* spellProto = NULL) : i_data(&data), i_push_type(type), i_radius(radius), i_TargetType(TargetType), i_source(source), i_entry(entry), i_pos(pos), i_spellProto(spellProto) { @@ -701,26 +701,13 @@ namespace Trinity case SPELL_TARGETS_ENEMY: if (target->isTotem()) continue; - // can't be checked in SpellInfo::CheckTarget - needs more research - if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE)) + if (!i_source->_IsValidAttackTarget(target, i_spellProto)) continue; - if (target->HasUnitState(UNIT_STAT_UNATTACKABLE)) - continue; - if (i_source->IsControlledByPlayer()) - { - if (i_source->IsFriendlyTo(target)) - continue; - } - else - { - if (!i_source->IsHostileTo(target)) - continue; - } break; case SPELL_TARGETS_ALLY: if (target->isTotem()) continue; - if (!i_source->IsFriendlyTo(target)) + if (!i_source->_IsValidAssistTarget(target, i_spellProto)) continue; break; case SPELL_TARGETS_ENTRY: diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index d1aee5b884e..8f7bdc1ba25 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -61,6 +61,7 @@ #include "Vehicle.h" #include "ScriptMgr.h" #include "GameObjectAI.h" +#include "AccountMgr.h" pEffect SpellEffects[TOTAL_SPELL_EFFECTS]= { @@ -71,7 +72,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]= &Spell::EffectUnused, // 4 SPELL_EFFECT_PORTAL_TELEPORT unused &Spell::EffectTeleportUnits, // 5 SPELL_EFFECT_TELEPORT_UNITS &Spell::EffectApplyAura, // 6 SPELL_EFFECT_APPLY_AURA - &Spell::EffectEnvirinmentalDMG, // 7 SPELL_EFFECT_ENVIRONMENTAL_DAMAGE + &Spell::EffectEnvironmentalDMG, // 7 SPELL_EFFECT_ENVIRONMENTAL_DAMAGE &Spell::EffectPowerDrain, // 8 SPELL_EFFECT_POWER_DRAIN &Spell::EffectHealthLeech, // 9 SPELL_EFFECT_HEALTH_LEECH &Spell::EffectHeal, // 10 SPELL_EFFECT_HEAL @@ -281,7 +282,7 @@ void Spell::EffectInstaKill(SpellEffIndex /*effIndex*/) m_caster->DealDamage(unitTarget, unitTarget->GetHealth(), NULL, NODAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); } -void Spell::EffectEnvirinmentalDMG(SpellEffIndex /*effIndex*/) +void Spell::EffectEnvironmentalDMG(SpellEffIndex /*effIndex*/) { if (!unitTarget || !unitTarget->isAlive()) return; @@ -418,6 +419,7 @@ void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex) damage = unitTarget->CountPctFromMaxHealth(50); break; } + case 20625: // Ritual of Doom Sacrifice case 29142: // Eyesore Blaster case 35139: // Throw Boom's Doom case 55269: // Deathly Stare @@ -675,7 +677,7 @@ void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex) if (m_caster->GetTypeId() == TYPEID_PLAYER) { // Add Ammo and Weapon damage plus RAP * 0.1 - Item *item = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK); + Item* item = m_caster->ToPlayer()->GetWeaponForAttack(RANGED_ATTACK); if (item) { float dmg_min = item->GetTemplate()->Damage->DamageMin; @@ -722,6 +724,14 @@ void Spell::SpellDamageSchoolDmg(SpellEffIndex effIndex) } break; } + case SPELLFAMILY_MAGE: + { + // Deep Freeze should deal damage to permanently stun-immune targets. + if (m_spellInfo->Id == 71757) + if (unitTarget->GetTypeId() != TYPEID_UNIT || !(unitTarget->IsImmunedToSpellEffect(sSpellMgr->GetSpellInfo(44572), 0))) + return; + break; + } } if (m_originalCaster && damage > 0 && apply_direct_bonus) @@ -953,7 +963,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) damage = 12000; // maybe wrong value damage /= count; - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(42784); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(42784); // now deal the damage for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) @@ -1160,7 +1170,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) } case 53808: // Pygmy Oil { - Aura *pAura = m_caster->GetAura(53806); + Aura* pAura = m_caster->GetAura(53806); if (pAura) pAura->RefreshDuration(); else @@ -1238,7 +1248,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) int32 newRage = std::max<int32>(0, m_caster->GetPower(POWER_RAGE) - rageUsed); // Sudden Death rage save - if (AuraEffect * aurEff = m_caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_GENERIC, 1989, EFFECT_0)) + if (AuraEffect* aurEff = m_caster->GetAuraEffect(SPELL_AURA_PROC_TRIGGER_SPELL, SPELLFAMILY_GENERIC, 1989, EFFECT_0)) { int32 ragesave = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue() * 10; newRage = std::max(newRage, ragesave); @@ -1247,7 +1257,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) m_caster->SetPower(POWER_RAGE, uint32(newRage)); // Glyph of Execution bonus - if (AuraEffect * aurEff = m_caster->GetAuraEffect(58367, EFFECT_0)) + if (AuraEffect* aurEff = m_caster->GetAuraEffect(58367, EFFECT_0)) rageUsed += aurEff->GetAmount() * 10; bp = damage + int32(rageUsed * m_spellInfo->Effects[effIndex].DamageMultiplier + m_caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.2f); @@ -1354,7 +1364,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) // remove invalid attackers for (Unit::AttackerSet::iterator aItr = attackers.begin(); aItr != attackers.end();) - if (!(*aItr)->canAttack(m_caster)) + if (!(*aItr)->IsValidAttackTarget(m_caster)) attackers.erase(aItr++); else ++aItr; @@ -1363,10 +1373,9 @@ void Spell::EffectDummy(SpellEffIndex effIndex) uint32 maxTargets = std::min<uint32>(3, attackers.size()); for (uint32 i = 0; i < maxTargets; ++i) { - Unit::AttackerSet::iterator aItr = attackers.begin(); - std::advance(aItr, urand(0, attackers.size() - 1)); - AddUnitTarget(*aItr, 1); - attackers.erase(aItr); + Unit* attacker = SelectRandomContainerElement(attackers); + AddUnitTarget(attacker, 1 << 1); + attackers.erase(attacker); } // now let next effect cast spell at each target. @@ -1391,7 +1400,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) return; // Restorative Totems if (Unit* owner = m_caster->GetOwner()) - if (AuraEffect *dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 338, 1)) + if (AuraEffect* dummy = owner->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 338, 1)) AddPctN(damage, dummy->GetAmount()); m_caster->CastCustomSpell(unitTarget, 52042, &damage, 0, 0, true, 0, 0, m_originalCasterGUID); @@ -1495,7 +1504,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex) //spells triggered by dummy effect should not miss if (spell_id) { - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id); if (!spellInfo) { @@ -1535,7 +1544,7 @@ void Spell::EffectTriggerSpellWithValue(SpellEffIndex effIndex) uint32 triggered_spell_id = m_spellInfo->Effects[effIndex].TriggerSpell; // normal case - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id); if (!spellInfo) { @@ -1553,7 +1562,7 @@ void Spell::EffectTriggerSpellWithValue(SpellEffIndex effIndex) void Spell::EffectTriggerRitualOfSummoning(SpellEffIndex effIndex) { uint32 triggered_spell_id = m_spellInfo->Effects[effIndex].TriggerSpell; - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id); if (!spellInfo) { @@ -1574,7 +1583,7 @@ void Spell::EffectForceCast(SpellEffIndex effIndex) uint32 triggered_spell_id = m_spellInfo->Effects[effIndex].TriggerSpell; // normal case - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id); if (!spellInfo) { @@ -1611,7 +1620,7 @@ void Spell::EffectForceCastWithValue(SpellEffIndex effIndex) uint32 triggered_spell_id = m_spellInfo->Effects[effIndex].TriggerSpell; // normal case - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id); if (!spellInfo) { @@ -1755,7 +1764,7 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex) } // normal case - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id); if (!spellInfo) { sLog->outError("EffectTriggerSpell of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id); @@ -1780,7 +1789,7 @@ void Spell::EffectTriggerMissileSpell(SpellEffIndex effIndex) uint32 triggered_spell_id = m_spellInfo->Effects[effIndex].TriggerSpell; // normal case - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id); if (!spellInfo) { @@ -2090,7 +2099,7 @@ void Spell::EffectPowerDrain(SpellEffIndex effIndex) { gainMultiplier = m_spellInfo->Effects[effIndex].CalcValueMultiplier(m_originalCaster, this); - int32 gain = int32(newDamage * gainMultiplier); + int32 gain = int32(newDamage* gainMultiplier); m_caster->EnergizeBySpell(m_caster, m_spellInfo->Id, gain, powerType); } @@ -2149,7 +2158,7 @@ void Spell::EffectPowerBurn(SpellEffIndex effIndex) // add log data before multiplication (need power amount, not damage) ExecuteLogEffectTakeTargetPower(effIndex, unitTarget, powerType, newDamage, 0.0f); - newDamage = int32(newDamage * dmgMultiplier); + newDamage = int32(newDamage* dmgMultiplier); m_damage += newDamage; } @@ -2189,7 +2198,7 @@ void Spell::SpellDamageHeal(SpellEffIndex /*effIndex*/) { Unit::AuraEffectList const& RejorRegr = unitTarget->GetAuraEffectsByType(SPELL_AURA_PERIODIC_HEAL); // find most short by duration - AuraEffect *targetAura = NULL; + AuraEffect* targetAura = NULL; for (Unit::AuraEffectList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i) { if ((*i)->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_DRUID @@ -2251,7 +2260,7 @@ void Spell::SpellDamageHeal(SpellEffIndex /*effIndex*/) else if (m_spellInfo->SpellFamilyName == SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[0] & 0x100) { addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL); - if (AuraEffect * aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_SHAMAN, 0, 0, 0x10, m_originalCasterGUID)) + if (AuraEffect* aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_SHAMAN, 0, 0, 0x10, m_originalCasterGUID)) { addhealth = int32(addhealth * 1.25f); // consume aura @@ -2330,7 +2339,7 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype) Player* player = (Player*)unitTarget; uint32 newitemid = itemtype; - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(newitemid); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(newitemid); if (!pProto) { player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); @@ -2597,7 +2606,7 @@ void Spell::EffectEnergize(SpellEffIndex effIndex) sSpellMgr->GetSetOfSpellsInSpellGroup(SPELL_GROUP_ELIXIR_BATTLE, avalibleElixirs); for (std::set<uint32>::iterator itr = avalibleElixirs.begin(); itr != avalibleElixirs.end() ;) { - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(*itr); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(*itr); if (spellInfo->SpellLevel < m_spellInfo->SpellLevel || spellInfo->SpellLevel > unitTarget->getLevel()) avalibleElixirs.erase(itr++); else if (sSpellMgr->IsSpellMemberOfSpellGroup(*itr, SPELL_GROUP_ELIXIR_SHATTRATH)) @@ -2611,10 +2620,7 @@ void Spell::EffectEnergize(SpellEffIndex effIndex) if (!avalibleElixirs.empty()) { // cast random elixir on target - uint32 rand_spell = urand(0, avalibleElixirs.size()-1); - std::set<uint32>::iterator itr = avalibleElixirs.begin(); - std::advance(itr, rand_spell); - m_caster->CastSpell(unitTarget, *itr, true, m_CastItem); + m_caster->CastSpell(unitTarget, SelectRandomContainerElement(avalibleElixirs), true, m_CastItem); } } } @@ -2725,23 +2731,23 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex) if (gameObjTarget) { GameObjectTemplate const* goInfo = gameObjTarget->GetGOInfo(); - // Arathi Basin banner opening ! + // Arathi Basin banner opening. // TODO: Verify correctness of this check if ((goInfo->type == GAMEOBJECT_TYPE_BUTTON && goInfo->button.noDamageImmune) || (goInfo->type == GAMEOBJECT_TYPE_GOOBER && goInfo->goober.losOK)) { //CanUseBattlegroundObject() already called in CheckCast() // in battleground check - if (Battleground *bg = player->GetBattleground()) - { - bg->EventPlayerClickedOnFlag(player, gameObjTarget); - return; - } + if (Battleground* bg = player->GetBattleground()) + { + bg->EventPlayerClickedOnFlag(player, gameObjTarget); + return; + } } else if (goInfo->type == GAMEOBJECT_TYPE_FLAGSTAND) { //CanUseBattlegroundObject() already called in CheckCast() // in battleground check - if (Battleground *bg = player->GetBattleground()) + if (Battleground* bg = player->GetBattleground()) { if (bg->GetTypeID(true) == BATTLEGROUND_EY) bg->EventPlayerClickedOnFlag(player, gameObjTarget); @@ -2831,7 +2837,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex effIndex) uint16 pos = m_CastItem->GetPos(); - Item *pNewItem = Item::CreateItem(newitemid, 1, player); + Item* pNewItem = Item::CreateItem(newitemid, 1, player); if (!pNewItem) return; @@ -2934,7 +2940,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) if (!entry) return; - SummonPropertiesEntry const *properties = sSummonPropertiesStore.LookupEntry(m_spellInfo->Effects[effIndex].MiscValueB); + SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(m_spellInfo->Effects[effIndex].MiscValueB); if (!properties) { sLog->outError("EffectSummonType: Unhandled summon type %u", m_spellInfo->Effects[effIndex].MiscValueB); @@ -2951,7 +2957,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) Position pos; GetSummonPosition(effIndex, pos); - TempSummon *summon = NULL; + TempSummon* summon = NULL; switch (properties->Category) { @@ -3099,7 +3105,7 @@ void Spell::EffectLearnSpell(SpellEffIndex effIndex) } typedef std::list< std::pair<uint32, uint64> > DispelList; -typedef std::list< std::pair<Aura *, uint8> > DispelChargesList; +typedef std::list< std::pair<Aura* , uint8> > DispelChargesList; void Spell::EffectDispel(SpellEffIndex effIndex) { if (!unitTarget) @@ -3118,7 +3124,7 @@ void Spell::EffectDispel(SpellEffIndex effIndex) Unit::AuraMap const& auras = unitTarget->GetOwnedAuras(); for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) { - Aura * aura = itr->second; + Aura* aura = itr->second; AuraApplication * aurApp = aura->GetApplicationOfTarget(unitTarget->GetGUID()); if (!aurApp) continue; @@ -3424,7 +3430,7 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex) if (!enchant_id) return; - SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) return; @@ -3433,7 +3439,7 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex) if (!item_owner) return; - if (item_owner != p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) + if (item_owner != p_caster && !AccountMgr::IsPlayerAccount(p_caster->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(p_caster->GetSession()->GetAccountId(), "GM %s (Account: %u) enchanting(perm): %s (Entry: %d) for player: %s (Account: %u)", p_caster->GetName(), p_caster->GetSession()->GetAccountId(), @@ -3466,7 +3472,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex) if (!enchant_id) return; - SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) return; @@ -3494,7 +3500,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex) if (!item_owner) return; - if (item_owner != p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) + if (item_owner != p_caster && !AccountMgr::IsPlayerAccount(p_caster->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(p_caster->GetSession()->GetAccountId(), "GM %s (Account: %u) enchanting(perm): %s (Entry: %d) for player: %s (Account: %u)", p_caster->GetName(), p_caster->GetSession()->GetAccountId(), @@ -3549,7 +3555,7 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex) return; } - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id); if (!spellInfo) { sLog->outError("Spell::EffectEnchantItemTmp: unknown spell id %i", spell_id); @@ -3583,7 +3589,7 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex) return; } - SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) { sLog->outError("Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have not existed enchanting id %u ", m_spellInfo->Id, effIndex, enchant_id); @@ -3624,7 +3630,7 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex) if (!item_owner) return; - if (item_owner != p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) + if (item_owner != p_caster && !AccountMgr::IsPlayerAccount(p_caster->GetSession()->GetSecurity()) && sWorld->getBoolConfig(CONFIG_GM_LOG_TRADE)) { sLog->outCommand(p_caster->GetSession()->GetAccountId(), "GM %s (Account: %u) enchanting(temp): %s (Entry: %d) for player: %s (Account: %u)", p_caster->GetName(), p_caster->GetSession()->GetAccountId(), @@ -3708,7 +3714,7 @@ void Spell::EffectSummonPet(SpellEffIndex effIndex) if (!owner) { - SummonPropertiesEntry const *properties = sSummonPropertiesStore.LookupEntry(67); + SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(67); if (properties) SummonGuardian(effIndex, petentry, properties); return; @@ -3786,7 +3792,7 @@ void Spell::EffectLearnPetSpell(SpellEffIndex effIndex) if (!pet->isAlive()) return; - SpellInfo const *learn_spellproto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[effIndex].TriggerSpell); + SpellInfo const* learn_spellproto = sSpellMgr->GetSpellInfo(m_spellInfo->Effects[effIndex].TriggerSpell); if (!learn_spellproto) return; @@ -3891,7 +3897,7 @@ void Spell::SpellDamageWeaponDmg(SpellEffIndex effIndex) if (needCast) m_caster->CastSpell(unitTarget, 58567, true); - if (Aura * aur = unitTarget->GetAura(58567, m_caster->GetGUID())) + if (Aura* aur = unitTarget->GetAura(58567, m_caster->GetGUID())) { // 58388 - Glyph of Devastate dummy aura. if (int32 num = (needCast ? 0 : 1) + (m_caster->HasAura(58388) ? 1 : 0)) @@ -3959,7 +3965,7 @@ void Spell::SpellDamageWeaponDmg(SpellEffIndex effIndex) { // Skyshatter Harness item set bonus // Stormstrike - if (AuraEffect * aurEff = m_caster->IsScriptOverriden(m_spellInfo, 5634)) + if (AuraEffect* aurEff = m_caster->IsScriptOverriden(m_spellInfo, 5634)) m_caster->CastSpell(m_caster, 38430, true, NULL, aurEff); break; } @@ -4104,7 +4110,7 @@ void Spell::SpellDamageWeaponDmg(SpellEffIndex effIndex) weaponDamage += fixed_bonus; break; case SPELL_EFFECT_WEAPON_PERCENT_DAMAGE: - weaponDamage = int32(weaponDamage * weaponDamagePercentMod); + weaponDamage = int32(weaponDamage* weaponDamagePercentMod); default: break; // not weapon damage effect, just skip } @@ -4114,7 +4120,7 @@ void Spell::SpellDamageWeaponDmg(SpellEffIndex effIndex) weaponDamage += spell_bonus; if (totalDamagePercentMod != 1.0f) - weaponDamage = int32(weaponDamage * totalDamagePercentMod); + weaponDamage = int32(weaponDamage* totalDamagePercentMod); // prevent negative damage uint32 eff_damage(std::max(weaponDamage, 0)); @@ -4206,7 +4212,7 @@ void Spell::EffectSummonObjectWild(SpellEffIndex effIndex) else m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE); - Map *map = target->GetMap(); + Map* map = target->GetMap(); if (!pGameObj->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), gameobject_id, map, m_caster->GetPhaseMask(), x, y, z, target->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY)) @@ -4501,7 +4507,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) float x, y, z; unitTarget->GetPosition(x, y, z); uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z); - AreaTableEntry const *pArea = sAreaStore.LookupEntry(areaFlag); + AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag); if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE))) canFly = false; @@ -4546,7 +4552,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) float x, y, z; unitTarget->GetPosition(x, y, z); uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z); - AreaTableEntry const *pArea = sAreaStore.LookupEntry(areaFlag); + AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag); if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE))) canFly = false; @@ -4579,7 +4585,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) uint8 bag = 19; uint8 slot = 0; - Item *item = NULL; + Item* item = NULL; while (bag) // 256 = 0 due to var type { @@ -4862,7 +4868,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) float x, y, z; unitTarget->GetPosition(x, y, z); uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z); - AreaTableEntry const *pArea = sAreaStore.LookupEntry(areaFlag); + AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag); if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE))) canFly = false; @@ -4908,7 +4914,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) float x, y, z; unitTarget->GetPosition(x, y, z); uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z); - AreaTableEntry const *pArea = sAreaStore.LookupEntry(areaFlag); + AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag); if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE))) canFly = false; @@ -4971,7 +4977,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) float x, y, z; unitTarget->GetPosition(x, y, z); uint32 areaFlag = unitTarget->GetBaseMap()->GetAreaFlag(x, y, z); - AreaTableEntry const *pArea = sAreaStore.LookupEntry(areaFlag); + AreaTableEntry const* pArea = sAreaStore.LookupEntry(areaFlag); if (!pArea || (canFly && (pArea->flags & AREA_FLAG_NO_FLY_ZONE))) canFly = false; @@ -5088,7 +5094,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) } // proc a spellcast - if (Aura * chargesAura = m_caster->GetAura(59907)) + if (Aura* chargesAura = m_caster->GetAura(59907)) { m_caster->CastSpell(unitTarget, spell_heal, true, NULL, NULL, m_caster->ToTempSummon()->GetSummonerGUID()); if (chargesAura->ModCharges(-1)) @@ -5123,7 +5129,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) } } // Glyph of Stoneclaw Totem - if (AuraEffect *aur=unitTarget->GetAuraEffect(63298, 0)) + if (AuraEffect* aur=unitTarget->GetAuraEffect(63298, 0)) { basepoints0 *= aur->GetAmount(); m_caster->CastCustomSpell(unitTarget, 55277, &basepoints0, NULL, NULL, true); @@ -5173,7 +5179,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) Player* plr = unitTarget->ToPlayer(); static uint32 const itemId[] = {45061, 45176, 45177, 45178, 45179, 0}; // player can only have one of these items - for (uint32 const *itr = &itemId[0]; *itr; ++itr) + for (uint32 const* itr = &itemId[0]; *itr; ++itr) if (plr->HasItemCount(*itr, 1, true)) return; DoCreateItem(effIndex, itemId[urand(0, 4)]); @@ -5206,10 +5212,10 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex) Unit::AuraApplicationMap & sealAuras = m_caster->GetAppliedAuras(); for (Unit::AuraApplicationMap::iterator iter = sealAuras.begin(); iter != sealAuras.end();) { - Aura * aura = iter->second->GetBase(); + Aura* aura = iter->second->GetBase(); if (aura->GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_SEAL) { - if (AuraEffect * aureff = aura->GetEffect(2)) + if (AuraEffect* aureff = aura->GetEffect(2)) if (aureff->GetAuraType() == SPELL_AURA_DUMMY) { if (sSpellMgr->GetSpellInfo(aureff->GetAmount())) @@ -5427,14 +5433,14 @@ void Spell::EffectDuel(SpellEffIndex effIndex) target->GetSession()->SendPacket(&data); // create duel-info - DuelInfo *duel = new DuelInfo; + DuelInfo* duel = new DuelInfo; duel->initiator = caster; duel->opponent = target; duel->startTime = 0; duel->startTimer = 0; caster->duel = duel; - DuelInfo *duel2 = new DuelInfo; + DuelInfo* duel2 = new DuelInfo; duel2->initiator = caster; duel2->opponent = caster; duel2->startTime = 0; @@ -5468,7 +5474,7 @@ void Spell::EffectStuck(SpellEffIndex /*effIndex*/) // pTarget->TeleportTo(pTarget->m_homebindMapId, pTarget->m_homebindX, pTarget->m_homebindY, pTarget->m_homebindZ, pTarget->GetOrientation(), (unitTarget == m_caster ? TELE_TO_SPELL : 0)); // Stuck spell trigger Hearthstone cooldown - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(8690); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(8690); if (!spellInfo) return; Spell spell(pTarget, spellInfo, TRIGGERED_FULL_MASK); @@ -5536,9 +5542,9 @@ void Spell::EffectApplyGlyph(SpellEffIndex effIndex) // apply new one if (uint32 glyph = m_spellInfo->Effects[effIndex].MiscValue) { - if (GlyphPropertiesEntry const *gp = sGlyphPropertiesStore.LookupEntry(glyph)) + if (GlyphPropertiesEntry const* gp = sGlyphPropertiesStore.LookupEntry(glyph)) { - if (GlyphSlotEntry const *gs = sGlyphSlotStore.LookupEntry(player->GetGlyphSlot(m_glyphIndex))) + if (GlyphSlotEntry const* gs = sGlyphSlotStore.LookupEntry(player->GetGlyphSlot(m_glyphIndex))) { if (gp->TypeFlags != gs->TypeFlags) { @@ -5550,7 +5556,7 @@ void Spell::EffectApplyGlyph(SpellEffIndex effIndex) // remove old glyph if (uint32 oldglyph = player->GetGlyph(m_glyphIndex)) { - if (GlyphPropertiesEntry const *old_gp = sGlyphPropertiesStore.LookupEntry(oldglyph)) + if (GlyphPropertiesEntry const* old_gp = sGlyphPropertiesStore.LookupEntry(oldglyph)) { player->RemoveAurasDueToSpell(old_gp->SpellId); player->SetGlyph(m_glyphIndex, 0); @@ -5589,7 +5595,7 @@ void Spell::EffectEnchantHeldItem(SpellEffIndex effIndex) if (!duration) duration = 10; //10 seconds for enchants which don't have listed duration - SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); if (!pEnchant) return; @@ -5724,7 +5730,7 @@ void Spell::EffectSummonObject(SpellEffIndex effIndex) else m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE); - Map *map = m_caster->GetMap(); + Map* map = m_caster->GetMap(); if (!pGameObj->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map, m_caster->GetPhaseMask(), x, y, z, m_caster->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 0, GO_STATE_READY)) { @@ -6134,7 +6140,7 @@ void Spell::EffectDispelMechanic(SpellEffIndex effIndex) Unit::AuraMap const& auras = unitTarget->GetOwnedAuras(); for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) { - Aura * aura = itr->second; + Aura* aura = itr->second; if (!aura->GetApplicationOfTarget(unitTarget->GetGUID())) continue; if (roll_chance_i(aura->CalcDispelChance(unitTarget, !unitTarget->IsFriendlyTo(m_caster)))) @@ -6293,7 +6299,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex) m_caster->GetClosePoint(fx, fy, fz, DEFAULT_WORLD_OBJECT_SIZE, dis); } - Map *cMap = m_caster->GetMap(); + Map* cMap = m_caster->GetMap(); if (goinfo->type == GAMEOBJECT_TYPE_FISHINGNODE || goinfo->type == GAMEOBJECT_TYPE_FISHINGHOLE) { LiquidData liqData; @@ -6497,7 +6503,7 @@ void Spell::EffectStealBeneficialBuff(SpellEffIndex effIndex) Unit::AuraMap const& auras = unitTarget->GetOwnedAuras(); for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr) { - Aura * aura = itr->second; + Aura* aura = itr->second; AuraApplication * aurApp = aura->GetApplicationOfTarget(unitTarget->GetGUID()); if (!aurApp) continue; @@ -6749,7 +6755,7 @@ void Spell::EffectGameObjectSetDestructionState(SpellEffIndex effIndex) gameObjTarget->SetDestructibleState(GameObjectDestructibleState(m_spellInfo->Effects[effIndex].MiscValue), player, true); } -void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const *properties) +void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const* properties) { Unit* caster = m_originalCaster; if (!caster) @@ -6763,7 +6769,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const * // level of pet summoned using engineering item based at engineering skill level if (m_CastItem && caster->GetTypeId() == TYPEID_PLAYER) - if (ItemTemplate const *proto = m_CastItem->GetTemplate()) + if (ItemTemplate const* proto = m_CastItem->GetTemplate()) if (proto->RequiredSkill == SKILL_ENGINERING) if (uint16 skill202 = caster->ToPlayer()->GetSkillValue(SKILL_ENGINERING)) level = skill202/5; @@ -6778,7 +6784,7 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const * amount = 1; break; case 49028: // Dancing Rune Weapon - if (AuraEffect *aurEff = m_originalCaster->GetAuraEffect(63330, 0)) // glyph of Dancing Rune Weapon + if (AuraEffect* aurEff = m_originalCaster->GetAuraEffect(63330, 0)) // glyph of Dancing Rune Weapon duration += aurEff->GetAmount(); break; } @@ -6786,14 +6792,14 @@ void Spell::SummonGuardian(uint32 i, uint32 entry, SummonPropertiesEntry const * modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DURATION, duration); //TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN; - Map *map = caster->GetMap(); + Map* map = caster->GetMap(); for (uint32 count = 0; count < amount; ++count) { Position pos; GetSummonPosition(i, pos, radius, count); - TempSummon *summon = map->SummonCreature(entry, pos, properties, duration, caster, m_spellInfo->Id); + TempSummon* summon = map->SummonCreature(entry, pos, properties, duration, caster, m_spellInfo->Id); if (!summon) return; if (summon->HasUnitTypeMask(UNIT_MASK_GUARDIAN)) @@ -6958,7 +6964,7 @@ void Spell::EffectCastButtons(SpellEffIndex effIndex) if (!spell_id) continue; - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(spell_id); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id); if (!spellInfo) continue; @@ -6989,7 +6995,7 @@ void Spell::EffectRechargeManaGem(SpellEffIndex /*effIndex*/) uint32 item_id = m_spellInfo->Effects[EFFECT_0].ItemType; - ItemTemplate const *pProto = sObjectMgr->GetItemTemplate(item_id); + ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item_id); if (!pProto) { player->SendEquipError(EQUIP_ERR_ITEM_NOT_FOUND, NULL, NULL); diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 3e374b62cd1..d880b9524b2 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -586,7 +586,7 @@ int32 SpellEffectInfo::CalcValue(Unit const* caster, int32 const* bp, Unit const if (caster->m_movedPlayer) if (uint8 comboPoints = caster->m_movedPlayer->GetComboPoints()) if (float comboDamage = PointsPerComboPoint) - value += comboDamage * comboPoints; + value += comboDamage* comboPoints; value = caster->ApplyEffectModifiers(_spellInfo, _effIndex, value); @@ -1634,8 +1634,9 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, Unit const* target, b if (!(AttributesEx6 & SPELL_ATTR6_CAN_TARGET_INVISIBLE) && !caster->canSeeOrDetect(target, implicit)) return SPELL_FAILED_BAD_TARGETS; - if (!(AttributesEx6 & SPELL_ATTR6_CAN_TARGET_UNTARGETABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) - return SPELL_FAILED_BAD_TARGETS; + // checked in Unit::IsValidAttack/AssistTarget, shouldn't be checked for ENTRY targets + //if (!(AttributesEx6 & SPELL_ATTR6_CAN_TARGET_UNTARGETABLE) && target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE)) + // return SPELL_FAILED_BAD_TARGETS; //if (!(AttributesEx6 & SPELL_ATTR6_CAN_TARGET_POSSESSED_FRIENDS) @@ -1647,14 +1648,6 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, Unit const* target, b return SPELL_FAILED_BAD_TARGETS; } - // check UNIT_FLAG_NON_ATTACKABLE flag - a player can cast spells on his pet (or other controlled unit) though in any state - if (!IsPositive() && target != caster && target->GetCharmerOrOwnerGUID() != caster->GetGUID()) - { - // any unattackable target skipped - if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE)) - return SPELL_FAILED_BAD_TARGETS; - } - // check GM mode and GM invisibility - only for player casts (npc casts are controlled by AI) and negative spells if (target != caster && (caster->IsControlledByPlayer() || !IsPositive()) && target->GetTypeId() == TYPEID_PLAYER) { @@ -1714,7 +1707,7 @@ SpellCastResult SpellInfo::CheckTarget(Unit const* caster, Unit const* target, b } } - if (target->HasAuraType(SPELL_AURA_PREVENT_RESSURECTION)) + if (target->HasAuraType(SPELL_AURA_PREVENT_RESURRECTION)) if (HasEffect(SPELL_EFFECT_SELF_RESURRECT) || HasEffect(SPELL_EFFECT_RESURRECT) || HasEffect(SPELL_EFFECT_RESURRECT_NEW)) return SPELL_FAILED_TARGET_CANNOT_BE_RESURRECTED; @@ -1737,17 +1730,13 @@ SpellCastResult SpellInfo::CheckExplicitTarget(Unit const* caster, WorldObject c if (neededTargets & (TARGET_FLAG_UNIT_ENEMY | TARGET_FLAG_UNIT_ALLY | TARGET_FLAG_UNIT_RAID | TARGET_FLAG_UNIT_PARTY | TARGET_FLAG_UNIT_MINIPET | TARGET_FLAG_UNIT_PASSENGER)) { if (neededTargets & TARGET_FLAG_UNIT_ENEMY) - if (!caster->IsFriendlyTo(unitTarget)) - return SPELL_CAST_OK; - if (neededTargets & TARGET_FLAG_UNIT_ALLY) - if (caster->IsFriendlyTo(unitTarget)) - return SPELL_CAST_OK; - if (neededTargets & TARGET_FLAG_UNIT_PARTY) - if (caster->IsInPartyWith(unitTarget)) - return SPELL_CAST_OK; - if (neededTargets & TARGET_FLAG_UNIT_RAID) - if (caster->IsInRaidWith(unitTarget)) + if (caster->_IsValidAttackTarget(unitTarget, this)) return SPELL_CAST_OK; + if (neededTargets & TARGET_FLAG_UNIT_ALLY + || (neededTargets & TARGET_FLAG_UNIT_PARTY && caster->IsInPartyWith(unitTarget)) + || (neededTargets & TARGET_FLAG_UNIT_RAID && caster->IsInRaidWith(unitTarget))) + if (caster->_IsValidAssistTarget(unitTarget, this)) + return SPELL_CAST_OK; if (neededTargets & TARGET_FLAG_UNIT_MINIPET) if (unitTarget->GetGUID() == caster->GetCritterGUID()) return SPELL_CAST_OK; @@ -2505,7 +2494,7 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const case SPELL_AURA_PERIODIC_LEECH: case SPELL_AURA_MOD_STALKED: case SPELL_AURA_PERIODIC_DAMAGE_PERCENT: - case SPELL_AURA_PREVENT_RESSURECTION: + case SPELL_AURA_PREVENT_RESURRECTION: return false; case SPELL_AURA_PERIODIC_DAMAGE: // used in positive spells also. // part of negative spell if casted at self (prevent cancel) diff --git a/src/server/game/Spells/SpellInfo.h b/src/server/game/Spells/SpellInfo.h index b79e50db001..77d27a908d3 100644 --- a/src/server/game/Spells/SpellInfo.h +++ b/src/server/game/Spells/SpellInfo.h @@ -21,6 +21,7 @@ #include "SharedDefines.h" #include "Util.h" #include "DBCStructure.h" +#include "Object.h" class Unit; class Player; diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 85139061303..a0098237e18 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -33,7 +33,7 @@ bool IsPrimaryProfessionSkill(uint32 skill) { - SkillLineEntry const *pSkill = sSkillLineStore.LookupEntry(skill); + SkillLineEntry const* pSkill = sSkillLineStore.LookupEntry(skill); if (!pSkill) return false; @@ -351,7 +351,7 @@ SpellMgr::~SpellMgr() } /// Some checks for spells, to prevent adding deprecated/broken spells for trainers, spell book, etc -bool SpellMgr::IsSpellValid(SpellInfo const *spellInfo, Player *pl, bool msg) +bool SpellMgr::IsSpellValid(SpellInfo const* spellInfo, Player* pl, bool msg) { // not exist if (!spellInfo) @@ -473,7 +473,7 @@ uint32 SpellMgr::GetSpellIdForDifficulty(uint32 spellId, Unit const* caster) con if (!difficultyId) return spellId; //return source spell, it has only REGULAR_DIFFICULTY - SpellDifficultyEntry const *difficultyEntry = sSpellDifficultyStore.LookupEntry(difficultyId); + SpellDifficultyEntry const* difficultyEntry = sSpellDifficultyStore.LookupEntry(difficultyId); if (!difficultyEntry) { sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "SpellMgr::GetSpellIdForDifficulty: SpellDifficultyEntry not found for spell %u. This should never happen.", spellId); @@ -1158,7 +1158,7 @@ void SpellMgr::LoadSpellRanks() // fill one chain while (currentSpell == lastSpell && !finished) { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); currentSpell = fields[0].GetUInt32(); if (lastSpell == -1) @@ -1260,7 +1260,7 @@ void SpellMgr::LoadSpellRequired() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 spell_id = fields[0].GetUInt32(); uint32 spell_req = fields[1].GetUInt32(); @@ -1355,7 +1355,7 @@ void SpellMgr::LoadSpellLearnSpells() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 spell_id = fields[0].GetUInt32(); @@ -1459,7 +1459,7 @@ void SpellMgr::LoadSpellTargetPositions() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 Spell_ID = fields[0].GetUInt32(); @@ -1583,7 +1583,7 @@ void SpellMgr::LoadSpellGroups() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 group_id = fields[0].GetUInt32(); if (group_id <= SPELL_GROUP_DB_RANGE_MIN && group_id >= SPELL_GROUP_CORE_RANGE_MAX) @@ -1664,7 +1664,7 @@ void SpellMgr::LoadSpellGroupStackRules() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 group_id = fields[0].GetUInt32(); uint8 stack_rule = fields[1].GetUInt32(); @@ -1711,7 +1711,7 @@ void SpellMgr::LoadSpellProcEvents() uint32 customProc = 0; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); @@ -1915,7 +1915,7 @@ void SpellMgr::LoadSpellBonusess() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); SpellInfo const* spell = GetSpellInfo(entry); @@ -1957,7 +1957,7 @@ void SpellMgr::LoadSpellThreats() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 entry = fields[0].GetUInt32(); @@ -1973,7 +1973,7 @@ void SpellMgr::LoadSpellThreats() ste.apPctMod = fields[3].GetFloat(); mSpellThreatMap[entry] = ste; - count++; + ++count; } while (result->NextRow()); sLog->outString(">> Loaded %u SpellThreatEntries in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); @@ -1988,7 +1988,7 @@ void SpellMgr::LoadSkillLineAbilityMap() uint32 count = 0; - for (uint32 i = 0; i < sSpellMgr->GetSpellInfoStoreSize(); ++i) + for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); ++i) { SkillLineAbilityEntry const* SkillInfo = sSkillLineAbilityStore.LookupEntry(i); if (!SkillInfo) @@ -2021,7 +2021,7 @@ void SpellMgr::LoadSpellPetAuras() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 spell = fields[0].GetUInt32(); uint8 eff = fields[1].GetUInt8(); @@ -2126,7 +2126,7 @@ void SpellMgr::LoadSpellEnchantProcData() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 enchantId = fields[0].GetUInt32(); @@ -2171,7 +2171,7 @@ void SpellMgr::LoadSpellLinked() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); int32 trigger = fields[0].GetInt32(); int32 effect = fields[1].GetInt32(); @@ -2416,7 +2416,7 @@ void SpellMgr::LoadSpellAreas() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 spell = fields[0].GetUInt32(); SpellArea spellArea; @@ -2852,6 +2852,9 @@ void SpellMgr::LoadSpellCustomAttr() spellInfo->AttributesCu |= SPELL_ATTR0_CU_SHARE_DAMAGE; spellInfo->AttributesCu |= SPELL_ATTR0_CU_IGNORE_ARMOR; break; + case 72293: // Mark of the Fallen Champion (Deathbringer Saurfang) + spellInfo->AttributesCu |= SPELL_ATTR0_CU_NEGATIVE_EFF0; + break; default: break; } @@ -2979,6 +2982,9 @@ void SpellMgr::LoadDbcDataCorrections() spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_NEARBY_ENTRY; spellInfo->EffectImplicitTargetB[0] = TARGET_DEST_NEARBY_ENTRY; break; + case 19465: // Improved Stings, only rank 2 of this spell has target for effect 2 = TARGET_DST_DB + spellInfo->EffectImplicitTargetA[2] = TARGET_UNIT_CASTER; + break; case 59725: // Improved Spell Reflection - aoe aura // Target entry seems to be wrong for this spell :/ spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER_AREA_PARTY; @@ -3092,6 +3098,7 @@ void SpellMgr::LoadDbcDataCorrections() case 51852: // The Eye of Acherus (no spawn in phase 2 in db) spellInfo->EffectMiscValue[0] |= 1; break; + case 18541: // Ritual of Doom Effect (temp hack, current targeting system requires implicit targets to be set. Was target_dest_caster) case 51904: // Summon Ghouls On Scarlet Crusade (core does not know the triggered spell is summon spell) spellInfo->EffectImplicitTargetA[0] = TARGET_UNIT_CASTER; break; @@ -3229,6 +3236,11 @@ void SpellMgr::LoadDbcDataCorrections() // that will be clear if we get more spells with problem like this spellInfo->AttributesEx |= SPELL_ATTR1_DISPEL_AURAS_ON_IMMUNITY; break; + case 62584: // Lifebinder's Gift + case 64185: // Lifebinder's Gift + spellInfo->EffectImplicitTargetB[1] = TARGET_UNIT_NEARBY_ENTRY; + spellInfo->EffectImplicitTargetB[2] = TARGET_UNIT_NEARBY_ENTRY; + break; // ENDOF ULDUAR SPELLS // // TRIAL OF THE CRUSADER SPELLS diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index c9f88092028..8a742cbd118 100755 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -364,13 +364,13 @@ class AuraScript : public _SpellScript #define AURASCRIPT_FUNCTION_TYPE_DEFINES(CLASSNAME) \ typedef bool(CLASSNAME::*AuraCheckAreaTargetFnType)(Unit* target); \ - typedef void(CLASSNAME::*AuraEffectApplicationModeFnType)(AuraEffect const *, AuraEffectHandleModes); \ - typedef void(CLASSNAME::*AuraEffectPeriodicFnType)(AuraEffect const *); \ - typedef void(CLASSNAME::*AuraEffectUpdatePeriodicFnType)(AuraEffect *); \ - typedef void(CLASSNAME::*AuraEffectCalcAmountFnType)(AuraEffect const *, int32 &, bool &); \ - typedef void(CLASSNAME::*AuraEffectCalcPeriodicFnType)(AuraEffect const *, bool &, int32 &); \ - typedef void(CLASSNAME::*AuraEffectCalcSpellModFnType)(AuraEffect const *, SpellModifier *&); \ - typedef void(CLASSNAME::*AuraEffectAbsorbFnType)(AuraEffect *, DamageInfo &, uint32 &); \ + typedef void(CLASSNAME::*AuraEffectApplicationModeFnType)(AuraEffect const* , AuraEffectHandleModes); \ + typedef void(CLASSNAME::*AuraEffectPeriodicFnType)(AuraEffect const* ); \ + typedef void(CLASSNAME::*AuraEffectUpdatePeriodicFnType)(AuraEffect* ); \ + typedef void(CLASSNAME::*AuraEffectCalcAmountFnType)(AuraEffect const* , int32 &, bool &); \ + typedef void(CLASSNAME::*AuraEffectCalcPeriodicFnType)(AuraEffect const* , bool &, int32 &); \ + typedef void(CLASSNAME::*AuraEffectCalcSpellModFnType)(AuraEffect const* , SpellModifier* &); \ + typedef void(CLASSNAME::*AuraEffectAbsorbFnType)(AuraEffect* , DamageInfo &, uint32 &); \ AURASCRIPT_FUNCTION_TYPE_DEFINES(AuraScript) @@ -393,7 +393,7 @@ class AuraScript : public _SpellScript { public: EffectPeriodicHandler(AuraEffectPeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName); - void Call(AuraScript * auraScript, AuraEffect const* _aurEff); + void Call(AuraScript* auraScript, AuraEffect const* _aurEff); private: AuraEffectPeriodicFnType pEffectHandlerScript; }; @@ -401,7 +401,7 @@ class AuraScript : public _SpellScript { public: EffectUpdatePeriodicHandler(AuraEffectUpdatePeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName); - void Call(AuraScript * auraScript, AuraEffect * aurEff); + void Call(AuraScript* auraScript, AuraEffect* aurEff); private: AuraEffectUpdatePeriodicFnType pEffectHandlerScript; }; @@ -409,7 +409,7 @@ class AuraScript : public _SpellScript { public: EffectCalcAmountHandler(AuraEffectCalcAmountFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName); - void Call(AuraScript * auraScript, AuraEffect const* aurEff, int32 & amount, bool & canBeRecalculated); + void Call(AuraScript* auraScript, AuraEffect const* aurEff, int32 & amount, bool & canBeRecalculated); private: AuraEffectCalcAmountFnType pEffectHandlerScript; }; @@ -417,7 +417,7 @@ class AuraScript : public _SpellScript { public: EffectCalcPeriodicHandler(AuraEffectCalcPeriodicFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName); - void Call(AuraScript * auraScript, AuraEffect const* aurEff, bool & isPeriodic, int32 & periodicTimer); + void Call(AuraScript* auraScript, AuraEffect const* aurEff, bool & isPeriodic, int32 & periodicTimer); private: AuraEffectCalcPeriodicFnType pEffectHandlerScript; }; @@ -425,7 +425,7 @@ class AuraScript : public _SpellScript { public: EffectCalcSpellModHandler(AuraEffectCalcSpellModFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName); - void Call(AuraScript * auraScript, AuraEffect const* aurEff, SpellModifier *& spellMod); + void Call(AuraScript* auraScript, AuraEffect const* aurEff, SpellModifier* & spellMod); private: AuraEffectCalcSpellModFnType pEffectHandlerScript; }; @@ -433,7 +433,7 @@ class AuraScript : public _SpellScript { public: EffectApplyHandler(AuraEffectApplicationModeFnType _pEffectHandlerScript, uint8 _effIndex, uint16 _effName, AuraEffectHandleModes _mode); - void Call(AuraScript * auraScript, AuraEffect const* _aurEff, AuraEffectHandleModes _mode); + void Call(AuraScript* auraScript, AuraEffect const* _aurEff, AuraEffectHandleModes _mode); private: AuraEffectApplicationModeFnType pEffectHandlerScript; AuraEffectHandleModes mode; @@ -442,7 +442,7 @@ class AuraScript : public _SpellScript { public: EffectAbsorbHandler(AuraEffectAbsorbFnType _pEffectHandlerScript, uint8 _effIndex); - void Call(AuraScript * auraScript, AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount); + void Call(AuraScript* auraScript, AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount); private: AuraEffectAbsorbFnType pEffectHandlerScript; }; @@ -450,7 +450,7 @@ class AuraScript : public _SpellScript { public: EffectManaShieldHandler(AuraEffectAbsorbFnType _pEffectHandlerScript, uint8 _effIndex); - void Call(AuraScript * auraScript, AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount); + void Call(AuraScript* auraScript, AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount); private: AuraEffectAbsorbFnType pEffectHandlerScript; }; @@ -472,12 +472,12 @@ class AuraScript : public _SpellScript AuraScript() : _SpellScript(), m_aura(NULL), m_auraApplication(NULL), m_defaultActionPrevented(false) {} bool _Validate(SpellInfo const* entry); - bool _Load(Aura * aura); + bool _Load(Aura* aura); void _PrepareScriptCall(AuraScriptHookType hookType, AuraApplication const* aurApp = NULL); void _FinishScriptCall(); bool _IsDefaultActionPrevented(); private: - Aura * m_aura; + Aura* m_aura; AuraApplication const* m_auraApplication; bool m_defaultActionPrevented; @@ -595,16 +595,16 @@ class AuraScript : public _SpellScript // returns unit which casted the aura or NULL if not avalible (caster logged out for example) Unit* GetCaster() const; // returns object on which aura was casted, target for non-area auras, area aura source for area auras - WorldObject * GetOwner() const; + WorldObject* GetOwner() const; // returns owner if it's unit or unit derived object, NULL otherwise (only for persistent area auras NULL is returned) Unit* GetUnitOwner() const; // returns owner if it's dynobj, NULL otherwise - DynamicObject * GetDynobjOwner() const; + DynamicObject* GetDynobjOwner() const; // removes aura with remove mode (see AuraRemoveMode enum) void Remove(uint32 removeMode = 0); // returns aura object of script - Aura * GetAura() const; + Aura* GetAura() const; // returns type of the aura, may be dynobj owned aura or unit owned aura AuraObjectType GetType() const; @@ -644,7 +644,7 @@ class AuraScript : public _SpellScript // check if aura has effect of given effindex bool HasEffect(uint8 effIndex) const; // returns aura effect of given effect index or NULL - AuraEffect * GetEffect(uint8 effIndex) const; + AuraEffect* GetEffect(uint8 effIndex) const; // check if aura has effect of given aura type bool HasEffectType(AuraType type) const; diff --git a/src/server/game/Texts/CreatureTextMgr.cpp b/src/server/game/Texts/CreatureTextMgr.cpp index c7df22561fd..f901c0acac8 100755 --- a/src/server/game/Texts/CreatureTextMgr.cpp +++ b/src/server/game/Texts/CreatureTextMgr.cpp @@ -256,7 +256,7 @@ void CreatureTextMgr::SendChatString(WorldObject* source, char const* text, Chat SendChatPacket(&data, source, msgtype, whisperGuid, range, team, gmOnly);//send our packet } -void CreatureTextMgr::BuildMonsterChat(WorldPacket *data, WorldObject* source, ChatMsg msgType, char const* text, Language language, uint64 whisperGuid) const +void CreatureTextMgr::BuildMonsterChat(WorldPacket* data, WorldObject* source, ChatMsg msgType, char const* text, Language language, uint64 whisperGuid) const { if (!source) return; diff --git a/src/server/game/Texts/CreatureTextMgr.h b/src/server/game/Texts/CreatureTextMgr.h index 5d0f13433a8..5d4e6357079 100755 --- a/src/server/game/Texts/CreatureTextMgr.h +++ b/src/server/game/Texts/CreatureTextMgr.h @@ -72,8 +72,8 @@ class CreatureTextMgr private: CreatureTextRepeatIds GetRepeatGroup(Creature* source, uint8 textGroup); void SetRepeatId(Creature* source, uint8 textGroup, uint8 id); - void BuildMonsterChat(WorldPacket *data, WorldObject* source, ChatMsg msgType, char const* text, Language language, uint64 whisperGuid) const; - void SendChatPacket(WorldPacket *data, WorldObject* source, ChatMsg msgType, uint64 whisperGuid, TextRange range, Team team, bool gmOnly) const; + void BuildMonsterChat(WorldPacket* data, WorldObject* source, ChatMsg msgType, char const* text, Language language, uint64 whisperGuid) const; + void SendChatPacket(WorldPacket* data, WorldObject* source, ChatMsg msgType, uint64 whisperGuid, TextRange range, Team team, bool gmOnly) const; CreatureTextMap mTextMap; CreatureTextRepeatMap mTextRepeatMap; diff --git a/src/server/game/Tools/CharacterDatabaseCleaner.cpp b/src/server/game/Tools/CharacterDatabaseCleaner.cpp index f690b5401b4..24955737b46 100644 --- a/src/server/game/Tools/CharacterDatabaseCleaner.cpp +++ b/src/server/game/Tools/CharacterDatabaseCleaner.cpp @@ -80,7 +80,7 @@ void CharacterDatabaseCleaner::CheckUnique(const char* column, const char* table std::ostringstream ss; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 id = fields[0].GetUInt32(); @@ -138,7 +138,7 @@ void CharacterDatabaseCleaner::CleanCharacterSpell() bool CharacterDatabaseCleaner::TalentCheck(uint32 talent_id) { - TalentEntry const *talentInfo = sTalentStore.LookupEntry(talent_id); + TalentEntry const* talentInfo = sTalentStore.LookupEntry(talent_id); if (!talentInfo) return false; diff --git a/src/server/game/Tools/PlayerDump.cpp b/src/server/game/Tools/PlayerDump.cpp index 7961c705d5b..fff06661e10 100644 --- a/src/server/game/Tools/PlayerDump.cpp +++ b/src/server/game/Tools/PlayerDump.cpp @@ -199,7 +199,7 @@ std::string CreateDumpString(char const* tableName, QueryResult result) if (!tableName || !result) return ""; std::ostringstream ss; ss << "INSERT INTO "<< _TABLE_SIM_ << tableName << _TABLE_SIM_ << " VALUES ("; - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); for (uint32 i = 0; i < result->GetFieldCount(); ++i) { if (i == 0) ss << '\''; @@ -352,7 +352,7 @@ bool PlayerDumpWriter::GetDump(uint32 guid, std::string &dump) DumpReturn PlayerDumpWriter::WriteDump(const std::string& file, uint32 guid) { - FILE *fout = fopen(file.c_str(), "w"); + FILE* fout = fopen(file.c_str(), "w"); if (!fout) return DUMP_FILE_OPEN_ERROR; @@ -382,11 +382,11 @@ void fixNULLfields(std::string &line) DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, std::string name, uint32 guid) { - uint32 charcount = sAccountMgr->GetCharactersCount(account); + uint32 charcount = AccountMgr::GetCharactersCount(account); if (charcount >= 10) return DUMP_TOO_MANY_CHARS; - FILE *fin = fopen(file.c_str(), "r"); + FILE* fin = fopen(file.c_str(), "r"); if (!fin) return DUMP_FILE_OPEN_ERROR; diff --git a/src/server/game/Weather/WeatherMgr.cpp b/src/server/game/Weather/WeatherMgr.cpp index 2c1b7e5fc54..17f0c89d725 100755 --- a/src/server/game/Weather/WeatherMgr.cpp +++ b/src/server/game/Weather/WeatherMgr.cpp @@ -91,7 +91,7 @@ void WeatherMgr::LoadWeatherData() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 zone_id = fields[0].GetUInt32(); diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index aa4ce9444ae..9f1d99cff98 100755 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -260,7 +260,7 @@ World::AddSession_(WorldSession* s) if (decrease_session) --Sessions; - if (pLimit > 0 && Sessions >= pLimit && s->GetSecurity() == SEC_PLAYER && !HasRecentlyDisconnected(s)) + if (pLimit > 0 && Sessions >= pLimit && AccountMgr::IsPlayerAccount(s->GetSecurity()) && !HasRecentlyDisconnected(s)) { AddQueuedPlayer (s); UpdateMaxSessionCounters(); @@ -398,6 +398,8 @@ void World::LoadConfigSettings(bool reload) sLog->outError("World settings reload fail: can't read settings from %s.", sConfig->GetFilename().c_str()); return; } + + sLog->ReloadConfig(); // Reload log levels and filters } ///- Read the player limit and the Message of the day from the config file @@ -1337,7 +1339,7 @@ void World::SetInitialWorldSettings() LoadRandomEnchantmentsTable(); sLog->outString("Loading Disables"); - sDisableMgr->LoadDisables(); // must be before loading quests and items + DisableMgr::LoadDisables(); // must be before loading quests and items sLog->outString("Loading Items..."); // must be after LoadRandomEnchantmentsTable and LoadPageTexts sObjectMgr->LoadItemTemplates(); @@ -1403,7 +1405,7 @@ void World::SetInitialWorldSettings() sObjectMgr->LoadQuests(); // must be loaded after DBCs, creature_template, item_template, gameobject tables sLog->outString("Checking Quest Disables"); - sDisableMgr->CheckQuestDisables(); // must be after loading quests + DisableMgr::CheckQuestDisables(); // must be after loading quests sLog->outString("Loading Quest POI"); sObjectMgr->LoadQuestPOI(); @@ -1586,7 +1588,7 @@ void World::SetInitialWorldSettings() sTicketMgr->LoadSurveys(); sLog->outString("Loading client addons..."); - sAddonMgr->LoadFromDB(); + AddonMgr::LoadFromDB(); ///- Handle outdated emails (delete/return) sLog->outString("Returning old mails..."); @@ -1827,7 +1829,7 @@ void World::LoadAutobroadcasts() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); std::string message = fields[0].GetString(); m_Autobroadcasts.push_back(message); @@ -2037,7 +2039,7 @@ void World::SendGlobalGMMessage(WorldPacket* packet, WorldSession* self, uint32 itr->second->GetPlayer() && itr->second->GetPlayer()->IsInWorld() && itr->second != self && - itr->second->GetSecurity() > SEC_PLAYER && + !AccountMgr::IsPlayerAccount(itr->second->GetSecurity()) && (team == 0 || itr->second->GetPlayer()->GetTeam() == team)) { itr->second->SendPacket(packet); @@ -2134,7 +2136,7 @@ void World::SendGMText(int32 string_id, ...) if (!itr->second || !itr->second->GetPlayer() || !itr->second->GetPlayer()->IsInWorld()) continue; - if (itr->second->GetSecurity() < SEC_MODERATOR) + if (AccountMgr::IsPlayerAccount(itr->second->GetSecurity())) continue; wt_do(itr->second->GetPlayer()); @@ -2298,7 +2300,7 @@ bool World::RemoveBanAccount(BanMode mode, std::string nameOrIP) { uint32 account = 0; if (mode == BAN_ACCOUNT) - account = sAccountMgr->GetId(nameOrIP); + account = AccountMgr::GetId(nameOrIP); else if (mode == BAN_CHARACTER) account = sObjectMgr->GetPlayerAccountIdByPlayerName(nameOrIP); @@ -2450,9 +2452,8 @@ void World::ShutdownMsg(bool show, Player* player) ///- Display a message every 12 hours, hours, 5 minutes, minute, 5 seconds and finally seconds if (show || - (m_ShutdownTimer < 10) || - (m_ShutdownTimer < 30 && (m_ShutdownTimer % 5) == 0) || // < 30 sec; every 5 sec - (m_ShutdownTimer < 5 * MINUTE && (m_ShutdownTimer % MINUTE) == 0) || // < 5 min ; every 1 min + (m_ShutdownTimer < 5* MINUTE && (m_ShutdownTimer % 15) == 0) || // < 5 min; every 15 sec + (m_ShutdownTimer < 15 * MINUTE && (m_ShutdownTimer % MINUTE) == 0) || // < 15 min ; every 1 min (m_ShutdownTimer < 30 * MINUTE && (m_ShutdownTimer % (5 * MINUTE)) == 0) || // < 30 min ; every 5 min (m_ShutdownTimer < 12 * HOUR && (m_ShutdownTimer % HOUR) == 0) || // < 12 h ; every 1 h (m_ShutdownTimer > 12 * HOUR && (m_ShutdownTimer % (12 * HOUR)) == 0)) // > 12 h ; every 12 h @@ -2513,7 +2514,7 @@ void World::UpdateSessions(uint32 diff) ++next; ///- and remove not active sessions from the list - WorldSession * pSession = itr->second; + WorldSession* pSession = itr->second; WorldSessionFilter updater(pSession); if (!pSession->Update(diff, updater)) // As interval = 0 @@ -2554,9 +2555,7 @@ void World::SendAutoBroadcast() std::string msg; - std::list<std::string>::const_iterator itr = m_Autobroadcasts.begin(); - std::advance(itr, rand() % m_Autobroadcasts.size()); - msg = *itr; + msg = SelectRandomContainerElement(m_Autobroadcasts); uint32 abcenter = sWorld->getIntConfig(CONFIG_AUTOBROADCAST_CENTER); @@ -2594,7 +2593,7 @@ void World::_UpdateRealmCharCount(PreparedQueryResult resultCharCount) { if (resultCharCount) { - Field *fields = resultCharCount->Fetch(); + Field* fields = resultCharCount->Fetch(); uint32 accountId = fields[0].GetUInt32(); uint32 charCount = fields[1].GetUInt32(); @@ -2625,7 +2624,7 @@ void World::InitDailyQuestResetTime() QueryResult result = CharacterDatabase.Query("SELECT MAX(time) FROM character_queststatus_daily"); if (result) { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); mostRecentQuestTime = time_t(fields[0].GetUInt32()); } else @@ -2797,7 +2796,7 @@ void World::LoadWorldStates() do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); m_worldstates[fields[0].GetUInt32()] = fields[1].GetUInt32(); ++count; } diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index b045ce60347..75a3f674b19 100755 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -521,7 +521,7 @@ class World ~World(); WorldSession* FindSession(uint32 id) const; - void AddSession(WorldSession *s); + void AddSession(WorldSession* s); void SendAutoBroadcast(); bool RemoveSession(uint32 id); /// Get the number of current active sessions diff --git a/src/server/scripts/Commands/CMakeLists.txt b/src/server/scripts/Commands/CMakeLists.txt index 19c42ba92ad..b17350c265d 100644 --- a/src/server/scripts/Commands/CMakeLists.txt +++ b/src/server/scripts/Commands/CMakeLists.txt @@ -20,6 +20,7 @@ set(scripts_STAT_SRCS Commands/cs_gps.cpp Commands/cs_honor.cpp Commands/cs_learn.cpp + Commands/cs_misc.cpp Commands/cs_modify.cpp Commands/cs_npc.cpp Commands/cs_quest.cpp diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 17bc0daec5b..6db414555da 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -99,11 +99,11 @@ public: if (!szAcc || !szPassword) return false; - // normalized in sAccountMgr->CreateAccount + // normalized in AccountMgr::CreateAccount std::string account_name = szAcc; std::string password = szPassword; - AccountOpResult result = sAccountMgr->CreateAccount(account_name, password); + AccountOpResult result = AccountMgr::CreateAccount(account_name, password); switch(result) { case AOR_OK: @@ -150,7 +150,7 @@ public: return false; } - uint32 account_id = sAccountMgr->GetId(account_name); + uint32 account_id = AccountMgr::GetId(account_name); if (!account_id) { handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); @@ -164,7 +164,7 @@ public: if (handler->HasLowerSecurityAccount (NULL, account_id, true)) return false; - AccountOpResult result = sAccountMgr->DeleteAccount(account_id); + AccountOpResult result = AccountMgr::DeleteAccount(account_id); switch(result) { case AOR_OK: @@ -206,7 +206,7 @@ public: ///- Cycle through accounts do { - Field *fieldsDB = resultDB->Fetch(); + Field* fieldsDB = resultDB->Fetch(); std::string name = fieldsDB[0].GetString(); uint32 account = fieldsDB[1].GetUInt32(); @@ -220,9 +220,11 @@ public: "WHERE a.id = '%u'", account); if (resultLogin) { - Field *fieldsLogin = resultLogin->Fetch(); + Field* fieldsLogin = resultLogin->Fetch(); handler->PSendSysMessage(LANG_ACCOUNT_LIST_LINE, - fieldsLogin[0].GetCString(), name.c_str(), fieldsLogin[1].GetCString(), fieldsDB[2].GetUInt16(), fieldsDB[3].GetUInt16(), fieldsLogin[3].GetUInt32(), fieldsLogin[2].GetUInt32()); + fieldsLogin[0].GetCString(), name.c_str(), fieldsLogin[1].GetCString(), + fieldsDB[2].GetUInt16(), fieldsDB[3].GetUInt16(), fieldsLogin[3].GetUInt32(), + fieldsLogin[2].GetUInt32()); } else handler->PSendSysMessage(LANG_ACCOUNT_LIST_ERROR, name.c_str()); @@ -282,7 +284,7 @@ public: return false; } - if (!sAccountMgr->CheckPassword(handler->GetSession()->GetAccountId(), std::string(old_pass))) + if (!AccountMgr::CheckPassword(handler->GetSession()->GetAccountId(), std::string(old_pass))) { handler->SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD); handler->SetSentErrorMessage(true); @@ -296,7 +298,7 @@ public: return false; } - AccountOpResult result = sAccountMgr->ChangePassword(handler->GetSession()->GetAccountId(), std::string(new_pass)); + AccountOpResult result = AccountMgr::ChangePassword(handler->GetSession()->GetAccountId(), std::string(new_pass)); switch(result) { case AOR_OK: @@ -342,7 +344,7 @@ public: return false; account_id = player->GetSession()->GetAccountId(); - sAccountMgr->GetName(account_id, account_name); + AccountMgr::GetName(account_id, account_name); szExp = szAcc; } else @@ -356,7 +358,7 @@ public: return false; } - account_id = sAccountMgr->GetId(account_name); + account_id = AccountMgr::GetId(account_name); if (!account_id) { handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); @@ -429,17 +431,17 @@ public: } // handler->getSession() == NULL only for console - targetAccountId = (isAccountNameGiven) ? sAccountMgr->GetId(targetAccountName) : handler->getSelectedPlayer()->GetSession()->GetAccountId(); + targetAccountId = (isAccountNameGiven) ? AccountMgr::GetId(targetAccountName) : handler->getSelectedPlayer()->GetSession()->GetAccountId(); int32 gmRealmID = (isAccountNameGiven) ? atoi(arg3) : atoi(arg2); uint32 plSecurity; if (handler->GetSession()) - plSecurity = sAccountMgr->GetSecurity(handler->GetSession()->GetAccountId(), gmRealmID); + plSecurity = AccountMgr::GetSecurity(handler->GetSession()->GetAccountId(), gmRealmID); else plSecurity = SEC_CONSOLE; // can set security level only for target with less security and to less security that we have // This is also reject self apply in fact - targetSecurity = sAccountMgr->GetSecurity(targetAccountId, gmRealmID); + targetSecurity = AccountMgr::GetSecurity(targetAccountId, gmRealmID); if (targetSecurity >= plSecurity || gm >= plSecurity) { handler->SendSysMessage(LANG_YOURS_SECURITY_IS_LOW); @@ -448,7 +450,7 @@ public: } // Check and abort if the target gm has a higher rank on one of the realms and the new realm is -1 - if (gmRealmID == -1 && plSecurity != SEC_CONSOLE) + if (gmRealmID == -1 && !AccountMgr::IsConsoleAccount(plSecurity)) { QueryResult result = LoginDatabase.PQuery("SELECT * FROM account_access WHERE id = '%u' AND gmlevel > '%d'", targetAccountId, gm); if (result) @@ -501,7 +503,7 @@ public: return false; } - uint32 targetAccountId = sAccountMgr->GetId(account_name); + uint32 targetAccountId = AccountMgr::GetId(account_name); if (!targetAccountId) { handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, account_name.c_str()); @@ -521,7 +523,7 @@ public: return false; } - AccountOpResult result = sAccountMgr->ChangePassword(targetAccountId, szPassword1); + AccountOpResult result = AccountMgr::ChangePassword(targetAccountId, szPassword1); switch (result) { diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 55b85a888d2..1848e22121c 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -548,13 +548,13 @@ public: if (list_queue) { - std::vector<Item *> &updateQueue = player->GetItemUpdateQueue(); + std::vector<Item*> &updateQueue = player->GetItemUpdateQueue(); for (size_t i = 0; i < updateQueue.size(); ++i) { Item* item = updateQueue[i]; if (!item) continue; - Bag *container = item->GetContainer(); + Bag* container = item->GetContainer(); uint8 bag_slot = container ? container->GetSlot() : uint8(INVENTORY_SLOT_BAG_0); std::string st; @@ -575,7 +575,7 @@ public: if (check_all) { bool error = false; - std::vector<Item *> &updateQueue = player->GetItemUpdateQueue(); + std::vector<Item*> &updateQueue = player->GetItemUpdateQueue(); for (uint8 i = PLAYER_SLOT_START; i < PLAYER_SLOT_END; ++i) { if (i >= BUYBACK_SLOT_START && i < BUYBACK_SLOT_END) @@ -596,7 +596,7 @@ public: error = true; continue; } - if (Bag *container = item->GetContainer()) + if (Bag* container = item->GetContainer()) { handler->PSendSysMessage("The item with slot %d and guid %d has a container (slot: %d, guid: %d) but shouldn't!", item->GetSlot(), item->GetGUIDLow(), container->GetSlot(), container->GetGUIDLow()); error = true; continue; @@ -648,7 +648,7 @@ public: error = true; continue; } - Bag *container = item2->GetContainer(); + Bag* container = item2->GetContainer(); if (!container) { handler->PSendSysMessage("The item in bag %d at slot %d with guid %d has no container!", bag->GetSlot(), item2->GetSlot(), item2->GetGUIDLow()); @@ -860,19 +860,19 @@ public: uint32 id = (uint32)atoi(i); - CreatureTemplate const *ci = sObjectMgr->GetCreatureTemplate(entry); + CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(entry); if (!ci) return false; - VehicleEntry const *ve = sVehicleStore.LookupEntry(id); + VehicleEntry const* ve = sVehicleStore.LookupEntry(id); if (!ve) return false; Creature* v = new Creature; - Map *map = handler->GetSession()->GetPlayer()->GetMap(); + Map* map = handler->GetSession()->GetPlayer()->GetMap(); if (!v->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_VEHICLE), map, handler->GetSession()->GetPlayer()->GetPhaseMask(), entry, id, handler->GetSession()->GetPlayer()->GetTeam(), x, y, z, o)) { diff --git a/src/server/scripts/Commands/cs_gm.cpp b/src/server/scripts/Commands/cs_gm.cpp index a520eac1ee7..9a7146c641c 100644 --- a/src/server/scripts/Commands/cs_gm.cpp +++ b/src/server/scripts/Commands/cs_gm.cpp @@ -25,6 +25,7 @@ EndScriptData */ #include "ScriptMgr.h" #include "ObjectMgr.h" #include "Chat.h" +#include "AccountMgr.h" class gm_commandscript : public CommandScript { @@ -56,10 +57,11 @@ public: { if (!*args) { - if (handler->GetSession()->GetPlayer()->isGMChat()) - handler->GetSession()->SendNotification(LANG_GM_CHAT_ON); + WorldSession* session = handler->GetSession(); + if (!AccountMgr::IsPlayerAccount(session->GetSecurity()) && session->GetPlayer()->isGMChat()) + session->SendNotification(LANG_GM_CHAT_ON); else - handler->GetSession()->SendNotification(LANG_GM_CHAT_OFF); + session->SendNotification(LANG_GM_CHAT_OFF); return true; } @@ -120,7 +122,7 @@ public: for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr) { AccountTypes itr_sec = itr->second->GetSession()->GetSecurity(); - if ((itr->second->isGameMaster() || (itr_sec > SEC_PLAYER && itr_sec <= AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) && + if ((itr->second->isGameMaster() || (!AccountMgr::IsPlayerAccount(itr_sec) && itr_sec <= AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_GM_LIST)))) && (!handler->GetSession() || itr->second->IsVisibleGloballyFor(handler->GetSession()->GetPlayer()))) { if (first) @@ -153,7 +155,7 @@ public: static bool HandleGMListFullCommand(ChatHandler* handler, const char* /*args*/) { ///- Get the accounts with GM Level >0 - QueryResult result = LoginDatabase.Query("SELECT a.username, aa.gmlevel FROM account a, account_access aa WHERE a.id=aa.id AND aa.gmlevel > 0"); + QueryResult result = LoginDatabase.PQuery("SELECT a.username, aa.gmlevel FROM account a, account_access aa WHERE a.id=aa.id AND aa.gmlevel >= %u", SEC_MODERATOR); if (result) { handler->SendSysMessage(LANG_GMLIST); @@ -161,7 +163,7 @@ public: ///- Cycle through them. Display username and GM level do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); const char* name = fields[0].GetCString(); uint8 security = fields[1].GetUInt8(); uint8 max = ((16 - strlen(name)) / 2); @@ -232,7 +234,7 @@ public: handler->GetSession()->SendNotification(LANG_GM_ON); handler->GetSession()->GetPlayer()->UpdateTriggerVisibility(); #ifdef _DEBUG_VMAPS - VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager(); + VMAP::IVMapManager* vMapManager = VMAP::VMapFactory::createOrGetVMapManager(); vMapManager->processCommand("stoplog"); #endif return true; @@ -244,7 +246,7 @@ public: handler->GetSession()->SendNotification(LANG_GM_OFF); handler->GetSession()->GetPlayer()->UpdateTriggerVisibility(); #ifdef _DEBUG_VMAPS - VMAP::IVMapManager *vMapManager = VMAP::VMapFactory::createOrGetVMapManager(); + VMAP::IVMapManager* vMapManager = VMAP::VMapFactory::createOrGetVMapManager(); vMapManager->processCommand("startlog"); #endif return true; diff --git a/src/server/scripts/Commands/cs_go.cpp b/src/server/scripts/Commands/cs_go.cpp index f077d6ec9c0..9ffd366544e 100644 --- a/src/server/scripts/Commands/cs_go.cpp +++ b/src/server/scripts/Commands/cs_go.cpp @@ -132,7 +132,7 @@ public: if (result->GetRowCount() > 1) handler->SendSysMessage(LANG_COMMAND_GOCREATMULTIPLE); - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); float x = fields[0].GetFloat(); float y = fields[1].GetFloat(); float z = fields[2].GetFloat(); @@ -255,7 +255,7 @@ public: else _player->SaveRecallPosition(); - Map const *map = sMapMgr->CreateBaseMap(mapid); + Map const* map = sMapMgr->CreateBaseMap(mapid); float z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y)); _player->TeleportTo(mapid, x, y, z, _player->GetOrientation()); @@ -443,7 +443,7 @@ public: // update to parent zone if exist (client map show only zones without parents) AreaTableEntry const* zoneEntry = areaEntry->zone ? GetAreaEntryByAreaID(areaEntry->zone) : areaEntry; - Map const *map = sMapMgr->CreateBaseMap(zoneEntry->mapid); + Map const* map = sMapMgr->CreateBaseMap(zoneEntry->mapid); if (map->Instanceable()) { @@ -527,7 +527,7 @@ public: handler->SetSentErrorMessage(true); return false; } - Map const *map = sMapMgr->CreateBaseMap(mapid); + Map const* map = sMapMgr->CreateBaseMap(mapid); z = std::max(map->GetHeight(x, y, MAX_HEIGHT), map->GetWaterLevel(x, y)); } diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index c51ab45acea..f8e636fb961 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -121,7 +121,7 @@ public: char* spawntimeSecs = strtok(NULL, " "); - const GameObjectTemplate *gInfo = sObjectMgr->GetGameObjectTemplate(id); + const GameObjectTemplate* gInfo = sObjectMgr->GetGameObjectTemplate(id); if (!gInfo) { @@ -144,7 +144,7 @@ public: float y = float(chr->GetPositionY()); float z = float(chr->GetPositionZ()); float o = float(chr->GetOrientation()); - Map *map = chr->GetMap(); + Map* map = chr->GetMap(); GameObject* pGameObj = new GameObject; uint32 db_lowGUID = sObjectMgr->GenerateLowGuid(HIGHGUID_GAMEOBJECT); @@ -283,7 +283,7 @@ public: do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); lowguid = fields[0].GetUInt32(); id = fields[1].GetUInt32(); x = fields[2].GetFloat(); @@ -548,7 +548,7 @@ public: { do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); uint32 entry = fields[1].GetUInt32(); float x = fields[2].GetFloat(); @@ -582,7 +582,7 @@ public: if (!*args) { - if (WorldObject * obj = handler->getSelectedObject()) + if (WorldObject* obj = handler->getSelectedObject()) entry = obj->GetEntry(); else entry = atoi((char*)args); diff --git a/src/server/scripts/Commands/cs_gps.cpp b/src/server/scripts/Commands/cs_gps.cpp index e8812cf41c7..57b11630a85 100644 --- a/src/server/scripts/Commands/cs_gps.cpp +++ b/src/server/scripts/Commands/cs_gps.cpp @@ -45,7 +45,7 @@ public: static bool HandleGPSCommand(ChatHandler* handler, const char *args) { - WorldObject *obj = NULL; + WorldObject* obj = NULL; if (*args) { uint64 guid = handler->extractGuidFromLink((char*)args); @@ -85,7 +85,7 @@ public: Map2ZoneCoordinates(zone_x, zone_y, zone_id); - Map const *map = obj->GetMap(); + Map const* map = obj->GetMap(); float ground_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), MAX_HEIGHT); float floor_z = map->GetHeight(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ()); diff --git a/src/server/scripts/Commands/cs_learn.cpp b/src/server/scripts/Commands/cs_learn.cpp index 3638414ced7..9eb315b0b6a 100644 --- a/src/server/scripts/Commands/cs_learn.cpp +++ b/src/server/scripts/Commands/cs_learn.cpp @@ -151,11 +151,11 @@ public: for (uint32 i = 0; i < sSkillLineAbilityStore.GetNumRows(); ++i) { - SkillLineAbilityEntry const *entry = sSkillLineAbilityStore.LookupEntry(i); + SkillLineAbilityEntry const* entry = sSkillLineAbilityStore.LookupEntry(i); if (!entry) continue; - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(entry->spellId); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(entry->spellId); if (!spellInfo) continue; @@ -194,11 +194,11 @@ public: for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i) { - TalentEntry const *talentInfo = sTalentStore.LookupEntry(i); + TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); if (!talentInfo) continue; - TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; @@ -246,7 +246,7 @@ public: return false; } - CreatureTemplate const *ci = pet->GetCreatureInfo(); + CreatureTemplate const* ci = pet->GetCreatureInfo(); if (!ci) { handler->SendSysMessage(LANG_WRONG_PET_TYPE); @@ -254,7 +254,7 @@ public: return false; } - CreatureFamilyEntry const *pet_family = sCreatureFamilyStore.LookupEntry(ci->family); + CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(ci->family); if (!pet_family) { handler->SendSysMessage(LANG_WRONG_PET_TYPE); @@ -271,11 +271,11 @@ public: for (uint32 i = 0; i < sTalentStore.GetNumRows(); ++i) { - TalentEntry const *talentInfo = sTalentStore.LookupEntry(i); + TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); if (!talentInfo) continue; - TalentTabEntry const *talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); + TalentTabEntry const* talentTabInfo = sTalentTabStore.LookupEntry(talentInfo->TalentTab); if (!talentTabInfo) continue; @@ -340,7 +340,7 @@ public: for (uint32 i = 0; i < sSkillLineStore.GetNumRows(); ++i) { - SkillLineEntry const *skillInfo = sSkillLineStore.LookupEntry(i); + SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(i); if (!skillInfo) continue; @@ -380,10 +380,10 @@ public: std::string name; - SkillLineEntry const *targetSkillInfo = NULL; + SkillLineEntry const* targetSkillInfo = NULL; for (uint32 i = 1; i < sSkillLineStore.GetNumRows(); ++i) { - SkillLineEntry const *skillInfo = sSkillLineStore.LookupEntry(i); + SkillLineEntry const* skillInfo = sSkillLineStore.LookupEntry(i); if (!skillInfo) continue; @@ -437,7 +437,7 @@ public: for (uint32 j = 0; j < sSkillLineAbilityStore.GetNumRows(); ++j) { - SkillLineAbilityEntry const *skillLine = sSkillLineAbilityStore.LookupEntry(j); + SkillLineAbilityEntry const* skillLine = sSkillLineAbilityStore.LookupEntry(j); if (!skillLine) continue; diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp new file mode 100644 index 00000000000..fe4dc2af1e2 --- /dev/null +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -0,0 +1,72 @@ +/*
+ * 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 "ScriptPCH.h"
+#include "Chat.h"
+
+class misc_commandscript : public CommandScript
+{
+public:
+ misc_commandscript() : CommandScript("misc_commandscript") { }
+
+ ChatCommand* GetCommands() const
+ {
+ static ChatCommand commandTable[] =
+ {
+ { "dev", SEC_ADMINISTRATOR, false, &HandleDevCommand, "", NULL },
+ { NULL, 0, false, NULL, "", NULL }
+ };
+ return commandTable;
+ }
+
+ static bool HandleDevCommand(ChatHandler* handler, char const* args)
+ {
+ if (!*args)
+ {
+ if (handler->GetSession()->GetPlayer()->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER))
+ handler->GetSession()->SendNotification(LANG_DEV_ON);
+ else
+ handler->GetSession()->SendNotification(LANG_DEV_OFF);
+ return true;
+ }
+
+ std::string argstr = (char*)args;
+
+ if (argstr == "on")
+ {
+ handler->GetSession()->GetPlayer()->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
+ handler->GetSession()->SendNotification(LANG_DEV_ON);
+ return true;
+ }
+
+ if (argstr == "off")
+ {
+ handler->GetSession()->GetPlayer()->RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_DEVELOPER);
+ handler->GetSession()->SendNotification(LANG_DEV_OFF);
+ return true;
+ }
+
+ handler->SendSysMessage(LANG_USE_BOL);
+ handler->SetSentErrorMessage(true);
+ return false;
+ }
+};
+
+void AddSC_misc_commandscript()
+{
+ new misc_commandscript();
+}
diff --git a/src/server/scripts/Commands/cs_modify.cpp b/src/server/scripts/Commands/cs_modify.cpp index c2371243150..1951b6cd361 100644 --- a/src/server/scripts/Commands/cs_modify.cpp +++ b/src/server/scripts/Commands/cs_modify.cpp @@ -441,12 +441,12 @@ public: else if (target->ToCreature()->isPet()) { Unit* owner = target->GetOwner(); - if (owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet *)target)->IsPermanentPetFor(owner->ToPlayer())) + if (owner && owner->GetTypeId() == TYPEID_PLAYER && ((Pet* )target)->IsPermanentPetFor(owner->ToPlayer())) { // check online security if (handler->HasLowerSecurity(owner->ToPlayer(), 0)) return false; - ((Pet *)target)->SetFreeTalentPoints(tp); + ((Pet* )target)->SetFreeTalentPoints(tp); owner->ToPlayer()->SendTalentsInfoData(true); return true; } @@ -1211,7 +1211,7 @@ public: } } - FactionEntry const *factionEntry = sFactionStore.LookupEntry(factionId); + FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); if (!factionEntry) { diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 9431bba41d6..b91f85ec1b6 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -124,7 +124,7 @@ public: float y = chr->GetPositionY(); float z = chr->GetPositionZ(); float o = chr->GetOrientation(); - Map *map = chr->GetMap(); + Map* map = chr->GetMap(); if (chr->GetTransport()) { @@ -453,7 +453,7 @@ public: // faction is set in creature_template - not inside creature // update in memory - if (CreatureTemplate const *cinfo = creature->GetCreatureInfo()) + if (CreatureTemplate const* cinfo = creature->GetCreatureInfo()) { const_cast<CreatureTemplate*>(cinfo)->faction_A = factionId; const_cast<CreatureTemplate*>(cinfo)->faction_H = factionId; @@ -1182,7 +1182,7 @@ public: return false; Player* chr = handler->GetSession()->GetPlayer(); - FormationInfo *group_member; + FormationInfo* group_member; group_member = new FormationInfo; group_member->follow_angle = (creature->GetAngle(chr) - chr->GetOrientation()) * 180 / M_PI; diff --git a/src/server/scripts/Commands/cs_quest.cpp b/src/server/scripts/Commands/cs_quest.cpp index 381860e5f53..5e08a1b0611 100644 --- a/src/server/scripts/Commands/cs_quest.cpp +++ b/src/server/scripts/Commands/cs_quest.cpp @@ -222,7 +222,7 @@ public: uint32 repValue = pQuest->GetRepObjectiveValue(); uint32 curRep = player->GetReputationMgr().GetReputation(repFaction); if (curRep < repValue) - if (FactionEntry const *factionEntry = sFactionStore.LookupEntry(repFaction)) + if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(repFaction)) player->GetReputationMgr().SetReputation(factionEntry, repValue); } @@ -232,7 +232,7 @@ public: uint32 repValue2 = pQuest->GetRepObjectiveValue2(); uint32 curRep = player->GetReputationMgr().GetReputation(repFaction); if (curRep < repValue2) - if (FactionEntry const *factionEntry = sFactionStore.LookupEntry(repFaction)) + if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(repFaction)) player->GetReputationMgr().SetReputation(factionEntry, repValue2); } diff --git a/src/server/scripts/Commands/cs_reload.cpp b/src/server/scripts/Commands/cs_reload.cpp index 214e624fb22..4e7a2794f58 100644 --- a/src/server/scripts/Commands/cs_reload.cpp +++ b/src/server/scripts/Commands/cs_reload.cpp @@ -375,7 +375,7 @@ public: static bool HandleReloadAutobroadcastCommand(ChatHandler* handler, const char* /*args*/) { - sLog->outString("Re-Loading Autobroadcast..."); + sLog->outString("Re-Loading Autobroadcasts..."); sWorld->LoadAutobroadcasts(); handler->SendGlobalGMSysMessage("DB table `autobroadcast` reloaded."); return true; @@ -420,7 +420,7 @@ public: sLog->outString("Reloading creature template entry %u", entry); - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); const_cast<CreatureTemplate*>(cInfo)->DifficultyEntry[0] = fields[0].GetUInt32(); const_cast<CreatureTemplate*>(cInfo)->DifficultyEntry[1] = fields[1].GetUInt32(); @@ -1104,9 +1104,9 @@ public: static bool HandleReloadDisablesCommand(ChatHandler* handler, const char* /*args*/) { sLog->outString("Re-Loading disables table..."); - sDisableMgr->LoadDisables(); + DisableMgr::LoadDisables(); sLog->outString("Checking quest disables..."); - sDisableMgr->CheckQuestDisables(); + DisableMgr::CheckQuestDisables(); handler->SendGlobalGMSysMessage("DB table `disables` reloaded."); return true; } diff --git a/src/server/scripts/Commands/cs_tele.cpp b/src/server/scripts/Commands/cs_tele.cpp index 2bc777afe85..17c076f903c 100644 --- a/src/server/scripts/Commands/cs_tele.cpp +++ b/src/server/scripts/Commands/cs_tele.cpp @@ -218,7 +218,7 @@ public: std::string nameLink = handler->GetNameLink(player); - Group *grp = player->GetGroup(); + Group* grp = player->GetGroup(); if (!grp) { handler->PSendSysMessage(LANG_NOT_IN_GROUP, nameLink.c_str()); @@ -226,7 +226,7 @@ public: return false; } - for (GroupReference *itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* pl = itr->getSource(); diff --git a/src/server/scripts/Commands/cs_wp.cpp b/src/server/scripts/Commands/cs_wp.cpp index 184e24c1488..34ea264fd9e 100644 --- a/src/server/scripts/Commands/cs_wp.cpp +++ b/src/server/scripts/Commands/cs_wp.cpp @@ -115,7 +115,7 @@ public: point = (*result)[0].GetUInt32(); Player* player = handler->GetSession()->GetPlayer(); - //Map *map = player->GetMap(); + //Map* map = player->GetMap(); WorldDatabase.PExecute("INSERT INTO waypoint_data (id, point, position_x, position_y, position_z) VALUES ('%u', '%u', '%f', '%f', '%f')", pathid, point+1, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); @@ -293,7 +293,7 @@ public: return true; } - Field *fields; + Field* fields; do { @@ -519,7 +519,7 @@ public: do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); pathid = fields[0].GetUInt32(); point = fields[1].GetUInt32(); } @@ -566,7 +566,7 @@ public: handler->PSendSysMessage("|cff00ff00DEBUG: wp move, PathID: |r|cff00ffff%u|r", pathid); Player* chr = handler->GetSession()->GetPlayer(); - Map *map = chr->GetMap(); + Map* map = chr->GetMap(); { // wpCreature Creature* wpCreature = NULL; @@ -694,7 +694,7 @@ public: handler->SendSysMessage("|cff00ffffDEBUG: wp show info:|r"); do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); pathid = fields[0].GetUInt32(); uint32 point = fields[1].GetUInt32(); uint32 delay = fields[2].GetUInt32(); @@ -734,7 +734,7 @@ public: bool hasError = false; do { - Field *fields = result2->Fetch(); + Field* fields = result2->Fetch(); uint32 wpguid = fields[0].GetUInt32(); Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(wpguid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); @@ -764,7 +764,7 @@ public: do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 point = fields[0].GetUInt32(); float x = fields[1].GetFloat(); float y = fields[2].GetFloat(); @@ -773,7 +773,7 @@ public: uint32 id = VISUAL_WAYPOINT; Player* chr = handler->GetSession()->GetPlayer(); - Map *map = chr->GetMap(); + Map* map = chr->GetMap(); float o = chr->GetOrientation(); Creature* wpCreature = new Creature; @@ -817,7 +817,7 @@ public: return false; } - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); float x = fields[0].GetFloat(); float y = fields[1].GetFloat(); float z = fields[2].GetFloat(); @@ -825,7 +825,7 @@ public: Player* chr = handler->GetSession()->GetPlayer(); float o = chr->GetOrientation(); - Map *map = chr->GetMap(); + Map* map = chr->GetMap(); Creature* creature = new Creature; if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o)) @@ -865,7 +865,7 @@ public: handler->SetSentErrorMessage(true); return false; } - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); float x = fields[0].GetFloat(); float y = fields[1].GetFloat(); float z = fields[2].GetFloat(); @@ -873,7 +873,7 @@ public: Player* chr = handler->GetSession()->GetPlayer(); float o = chr->GetOrientation(); - Map *map = chr->GetMap(); + Map* map = chr->GetMap(); Creature* creature = new Creature; if (!creature->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_UNIT), map, chr->GetPhaseMaskForSpawn(), id, 0, 0, x, y, z, o)) @@ -908,7 +908,7 @@ public: bool hasError = false; do { - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); uint32 guid = fields[0].GetUInt32(); Creature* creature = handler->GetSession()->GetPlayer()->GetMap()->GetCreature(MAKE_NEW_GUID(guid, VISUAL_WAYPOINT, HIGHGUID_UNIT)); if (!creature) diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp index aef3e1b3502..f1884b7c0e9 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_balinda.cpp @@ -84,7 +84,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new mob_water_elementalAI(creature); } @@ -194,7 +194,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new boss_balindaAI(creature); } diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp index 7e4e6f15384..e7a7b1a01ba 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_drekthar.cpp @@ -128,7 +128,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new boss_drektharAI(creature); } diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp index 783be5bf7a3..40d1ca2fe68 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_galvangar.cpp @@ -118,7 +118,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new boss_galvangarAI(creature); } diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp index c5b600c8807..973e7ca5f64 100644 --- a/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp +++ b/src/server/scripts/EasternKingdoms/AlteracValley/boss_vanndar.cpp @@ -118,7 +118,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new boss_vanndarAI(creature); } diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp index 6efe5f01f37..d9d8627403a 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.cpp @@ -106,7 +106,7 @@ class at_ring_of_law : public AreaTriggerScript public: at_ring_of_law() : AreaTriggerScript("at_ring_of_law") { } - bool OnTrigger(Player* player, const AreaTriggerEntry * /*at*/) + bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) { if (InstanceScript* pInstance = player->GetInstanceScript()) { @@ -761,7 +761,7 @@ public: return marshal_windsorAI; } - bool OnQuestAccept(Player* player, Creature* creature, Quest const *quest) + bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) { if (quest->GetQuestId() == 4322) {PlayerStart = player; diff --git a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp index 896d27bd768..058e295b646 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.cpp @@ -38,7 +38,7 @@ public: bool OnUse(Player* player, Item* item, SpellCastTargets const& targets) { - InstanceScript *pInstance = player->GetInstanceScript(); + InstanceScript* pInstance = player->GetInstanceScript(); if (!pInstance) { diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp index 2cc56f9f502..92c2d417cda 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_midnight.cpp @@ -98,7 +98,7 @@ public: void UpdateAI(const uint32 diff); - void SpellHit(Unit* /*source*/, const SpellInfo *spell) + void SpellHit(Unit* /*source*/, const SpellInfo* spell) { if (spell->Mechanic == MECHANIC_DISARM) DoScriptText(SAY_DISARMED, me); @@ -277,9 +277,9 @@ void boss_attumen::boss_attumenAI::UpdateAI(const uint32 diff) if (ChargeTimer <= diff) { Unit* target = NULL; - std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); - std::vector<Unit* > target_list; - for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); + std::vector<Unit*> target_list; + for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); if (target && !target->IsWithinDist(me, ATTACK_DISTANCE, false)) diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp index 14cfd95fae4..04981669681 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_moroes.cpp @@ -81,7 +81,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint64 AddGUID[4]; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp index a9dd97fef28..d25d3518b9e 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_prince_malchezaar.cpp @@ -149,7 +149,7 @@ public: CAST_CRE(pMalchezaar)->AI()->KilledUnit(who); } - void SpellHit(Unit* /*who*/, const SpellInfo *spell) + void SpellHit(Unit* /*who*/, const SpellInfo* spell) { if (spell->Id == SPELL_INFERNAL_RELAY) { @@ -188,7 +188,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 EnfeebleTimer; uint32 EnfeebleResetTimer; uint32 ShadowNovaTimer; @@ -297,7 +297,7 @@ public: SetEquipmentSlots(false, EQUIP_UNEQUIP, EQUIP_UNEQUIP, EQUIP_NO_CHANGE); //damage - const CreatureTemplate *cinfo = me->GetCreatureInfo(); + const CreatureTemplate* cinfo = me->GetCreatureInfo(); me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, cinfo->mindmg); me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, cinfo->maxdmg); me->UpdateDamagePhysical(BASE_ATTACK); @@ -305,18 +305,18 @@ public: void EnfeebleHealthEffect() { - const SpellInfo *info = sSpellMgr->GetSpellInfo(SPELL_ENFEEBLE_EFFECT); + const SpellInfo* info = sSpellMgr->GetSpellInfo(SPELL_ENFEEBLE_EFFECT); if (!info) return; - std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); - std::vector<Unit* > targets; + std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); + std::vector<Unit*> targets; if (t_list.empty()) return; //begin + 1, so we don't target the one with the highest threat - std::list<HostileReference *>::const_iterator itr = t_list.begin(); + std::list<HostileReference*>::const_iterator itr = t_list.begin(); std::advance(itr, 1); for (; itr != t_list.end(); ++itr) //store the threat list in a different container if (Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid())) @@ -328,7 +328,7 @@ public: targets.erase(targets.begin()+rand()%targets.size()); uint32 i = 0; - for (std::vector<Unit* >::const_iterator iter = targets.begin(); iter != targets.end(); ++iter, ++i) + for (std::vector<Unit*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter, ++i) if (Unit* target = *iter) { enfeeble_targets[i] = target->GetGUID(); @@ -420,7 +420,7 @@ public: SetEquipmentSlots(false, EQUIP_ID_AXE, EQUIP_ID_AXE, EQUIP_NO_CHANGE); //damage - const CreatureTemplate *cinfo = me->GetCreatureInfo(); + const CreatureTemplate* cinfo = me->GetCreatureInfo(); me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, 2*cinfo->mindmg); me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, 2*cinfo->maxdmg); me->UpdateDamagePhysical(BASE_ATTACK); 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 c8a38164126..51085504f99 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_shade_of_aran.cpp @@ -187,13 +187,13 @@ public: void FlameWreathEffect() { std::vector<Unit*> targets; - std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); + std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); if (t_list.empty()) return; //store the threat list in a different container - for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); //only on alive players diff --git a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp index a80ee5575ae..fb7feb5f267 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/boss_terestian_illhoof.cpp @@ -265,7 +265,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint64 PortalGUID[2]; uint8 PortalsCount; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp index 3d497e3811a..a6239394784 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/bosses_opera.cpp @@ -340,7 +340,7 @@ public: me->DespawnOrUnsummon(); } - void SpellHit(Unit* /*caster*/, const SpellInfo *Spell) + void SpellHit(Unit* /*caster*/, const SpellInfo* Spell) { if ((Spell->SchoolMask == SPELL_SCHOOL_MASK_FIRE) && (!(rand()%10))) { @@ -745,7 +745,7 @@ public: }; /**************************************/ -/**** Opera Red Riding Hood Event ****/ +/**** Opera Red Riding Hood Event* ***/ /************************************/ /**** Yells for the Wolf ****/ @@ -761,7 +761,7 @@ public: #define GOSSIP_GRANDMA "What phat lewtz you have grandmother?" -/**** The Wolf's Entry ****/ +/**** The Wolf's Entry* ***/ #define CREATURE_BIG_BAD_WOLF 17521 class npc_grandmother : public CreatureScript @@ -920,7 +920,7 @@ public: }; /**********************************************/ -/******** Opera Romeo and Juliet Event *******/ +/******** Opera Romeo and Juliet Event* ******/ /********************************************/ /**** Speech *****/ @@ -1080,7 +1080,7 @@ public: me->DespawnOrUnsummon(); } - void SpellHit(Unit* /*caster*/, const SpellInfo *Spell) + void SpellHit(Unit* /*caster*/, const SpellInfo* Spell) { if (Spell->Id == SPELL_DRINK_POISON) { diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp index 0123e51146b..e22bdb1e9ef 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.cpp @@ -479,7 +479,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint64 ArcanagosGUID; diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp index 04cc421fae6..9126df968e2 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/boss_sulfuron_harbinger.cpp @@ -101,17 +101,9 @@ class boss_sulfuron : public CreatureScript break; case EVENT_INSPIRE: { - Creature* target = NULL; std::list<Creature*> healers = DoFindFriendlyMissingBuff(45.0f, SPELL_INSPIRE); if (!healers.empty()) - { - std::list<Creature*>::const_iterator itr = healers.begin(); - std::advance(itr, urand(0, healers.size()-1)); - target = *itr; - } - - if (target) - DoCast(target, SPELL_INSPIRE); + DoCast(SelectRandomContainerElement(healers), SPELL_INSPIRE); DoCast(me, SPELL_INSPIRE); events.ScheduleEvent(EVENT_INSPIRE, urand(20000, 26000)); diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/molten_core.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/molten_core.cpp index d082140e34c..871cef96316 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/molten_core.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/molten_core.cpp @@ -48,7 +48,7 @@ public: CreatureAI* GetAI(Creature* creature) const { - SimpleAI *ai = new SimpleAI(creature); + SimpleAI* ai = new SimpleAI(creature); ai->Spell[0].Enabled = true; ai->Spell[0].Spell_Id = SPELL_CONE_OF_FIRE; diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 7faa8df44bf..d2982900be1 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -106,7 +106,7 @@ public: { me->SetReactState(REACT_PASSIVE); if (!me->GetEquipmentId()) - if (const CreatureTemplate *info = sObjectMgr->GetCreatureTemplate(28406)) + if (const CreatureTemplate* info = sObjectMgr->GetCreatureTemplate(28406)) if (info->equipmentId) const_cast<CreatureTemplate*>(me->GetCreatureInfo())->equipmentId = info->equipmentId; } @@ -625,7 +625,7 @@ public: { npc_salanar_the_horsemanAI(Creature* c) : ScriptedAI(c) {} - void SpellHit(Unit* caster, const SpellInfo *spell) + void SpellHit(Unit* caster, const SpellInfo* spell) { if (spell->Id == DELIVER_STOLEN_HORSE) { diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp index af534444468..532ede1d3c6 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter2.cpp @@ -71,7 +71,7 @@ public: me->RestoreFaction(); } - void SpellHit(Unit* caster, const SpellInfo *spell) + void SpellHit(Unit* caster, const SpellInfo* spell) { if (spell->Id == SPELL_PERSUASIVE_STRIKE && caster->GetTypeId() == TYPEID_PLAYER && me->isAlive() && !uiSpeech_counter) { diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp index 8bcdce608cf..2f7fde7ec60 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter5.cpp @@ -234,7 +234,7 @@ struct Location float x, y, z, o; }; -void UpdateWorldState(Map *map, uint32 id, uint32 state) +void UpdateWorldState(Map* map, uint32 id, uint32 state) { Map::PlayerList const& players = map->GetPlayers(); @@ -487,7 +487,7 @@ public: if (!who) return; - if (who->isTargetableForAttack() && me->IsHostileTo(who)) + if (me->IsValidAttackTarget(who)) if (me->IsWithinDistInMap(who, 20) && me->IsWithinLOSInMap(who)) AttackStart(who); } @@ -1311,7 +1311,7 @@ public: // pGo->SetPhaseMask(0, true); { - Map *map = me->GetMap(); // search players with in 50 yards for quest credit + Map* map = me->GetMap(); // search players with in 50 yards for quest credit Map::PlayerList const &PlayerList = map->GetPlayers(); if (!PlayerList.isEmpty()) { diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp index 5262ed6620c..80cbcedda7c 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/boss_headless_horseman.cpp @@ -176,7 +176,7 @@ public: DoCast(me, spell); } - void SpellHit(Unit* /*caster*/, const SpellInfo *spell) + void SpellHit(Unit* /*caster*/, const SpellInfo* spell) { if (spell->Id == SPELL_WISP_FLIGHT_PORT && Creaturetype == 4) me->SetDisplayId(2027); @@ -364,7 +364,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint64 headGUID; uint64 PlayerGUID; @@ -774,7 +774,7 @@ public: void EnterCombat(Unit* /*who*/){} - void SpellHit(Unit* /*caster*/, const SpellInfo *spell) + void SpellHit(Unit* /*caster*/, const SpellInfo* spell) { if (spell->Id == SPELL_SPROUTING) { @@ -800,7 +800,7 @@ public: void MoveInLineOfSight(Unit* who) { - if (!who || !who->isTargetableForAttack() || !me->IsHostileTo(who) || me->getVictim()) + if (!who || !me->IsValidAttackTarget(who) || me->getVictim()) return; me->AddThreat(who, 0.0f); diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp index 1de9a507d2f..16e7ecfd4bc 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_illucia_barov.cpp @@ -60,7 +60,7 @@ public: void JustDied(Unit* /*killer*/) { - InstanceScript *pInstance = me->GetInstanceScript(); + InstanceScript* pInstance = me->GetInstanceScript(); if (pInstance) { pInstance->SetData(DATA_LADYILLUCIABAROV_DEATH, 0); diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp index fbea2f35219..1b4ae929e17 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_malicia.cpp @@ -67,7 +67,7 @@ public: void JustDied(Unit* /*killer*/) { - InstanceScript *pInstance = me->GetInstanceScript(); + InstanceScript* pInstance = me->GetInstanceScript(); if (pInstance) { pInstance->SetData(DATA_INSTRUCTORMALICIA_DEATH, 0); diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp index 794758b6bd7..3b6d3557265 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lord_alexei_barov.cpp @@ -56,7 +56,7 @@ public: void JustDied(Unit* /*killer*/) { - InstanceScript *pInstance = me->GetInstanceScript(); + InstanceScript* pInstance = me->GetInstanceScript(); if (pInstance) { pInstance->SetData(DATA_LORDALEXEIBAROV_DEATH, 0); diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp index d23eee99bb9..f3743230fc8 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_lorekeeper_polkelt.cpp @@ -60,7 +60,7 @@ public: void JustDied(Unit* /*killer*/) { - InstanceScript *pInstance = me->GetInstanceScript(); + InstanceScript* pInstance = me->GetInstanceScript(); if (pInstance) { pInstance->SetData(DATA_LOREKEEPERPOLKELT_DEATH, 0); diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp index e69fa65a00e..cedcd626261 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_the_ravenian.cpp @@ -62,7 +62,7 @@ public: void JustDied(Unit* /*killer*/) { - InstanceScript *pInstance = me->GetInstanceScript(); + InstanceScript* pInstance = me->GetInstanceScript(); if (pInstance) { pInstance->SetData(DATA_THERAVENIAN_DEATH, 0); diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp index 3640d5be4a4..25ff8c9d9ec 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp @@ -96,7 +96,7 @@ public: uiNpcEntry = c->GetEntry(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 uiNpcEntry; void WaypointReached(uint32 uiPoint) diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp index fac45e5ffaa..af71960763d 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_order_of_silver_hand.cpp @@ -59,7 +59,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 HolyLight_Timer; uint32 DivineShield_Timer; diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.cpp index 249463cd090..82c83948c27 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* pGroup = player->GetGroup()) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* pGroupie = itr->getSource(); if (!pGroupie) @@ -148,7 +148,7 @@ public: void EnterCombat(Unit* /*who*/) {} - void SpellHit(Unit* caster, const SpellInfo *spell) + void SpellHit(Unit* caster, const SpellInfo* spell) { if (caster->GetTypeId() == TYPEID_PLAYER) { @@ -224,7 +224,7 @@ public: void EnterCombat(Unit* /*who*/) {} - void SpellHit(Unit* /*caster*/, const SpellInfo *spell) + void SpellHit(Unit* /*caster*/, const SpellInfo* spell) { if (!Tagged && spell->Id == SPELL_EGAN_BLASTER) Tagged = true; diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp index 18d8bd26106..86ed6690751 100644 --- a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp +++ b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.cpp @@ -39,7 +39,7 @@ class at_malfurion_stormrage : public AreaTriggerScript public: at_malfurion_stormrage() : AreaTriggerScript("at_malfurion_stormrage") { } - bool OnTrigger(Player* player, const AreaTriggerEntry * /*at*/) + bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) { if (player->GetInstanceScript() && !player->FindNearestCreature(15362, 15)) player->SummonCreature(15362, player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), -1.52f, TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, 100000); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp index ade340d7abb..5123bd2c0ec 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_brutallus.cpp @@ -269,7 +269,7 @@ public: void MoveInLineOfSight(Unit* who) { - if (!who->isTargetableForAttack() || !me->IsHostileTo(who)) + if (!me->IsValidAttackTarget(who)) return; if (pInstance && Intro) pInstance->SetData(DATA_BRUTALLUS_EVENT, SPECIAL); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp index e25211f454a..644c0eacde5 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_eredar_twins.cpp @@ -102,7 +102,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; bool SisterDeath; bool Enraged; @@ -361,7 +361,7 @@ public: IntroStepCounter = 10; } - InstanceScript *pInstance; + InstanceScript* pInstance; bool SisterDeath; bool Enraged; @@ -437,9 +437,8 @@ public: if (!who || me->getVictim()) return; - if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me) && me->IsHostileTo(who)) + if (me->canCreatureAttack(who)) { - float attackRadius = me->GetAttackDistance(who); if (me->IsWithinDistInMap(who, attackRadius) && me->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && me->IsWithinLOSInMap(who)) { diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp index b156caa911f..584ce3856a4 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_felmyst.cpp @@ -120,7 +120,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; PhaseFelmyst phase; EventMap events; @@ -192,7 +192,7 @@ public: pInstance->SetData(DATA_FELMYST_EVENT, DONE); } - void SpellHit(Unit* caster, const SpellInfo *spell) + void SpellHit(Unit* caster, const SpellInfo* spell) { // workaround for linked aura /*if (spell->Id == SPELL_VAPOR_FORCE) diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp index febf43f1614..39aa4f6f6f3 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kalecgos.cpp @@ -124,7 +124,7 @@ public: me->setActive(true); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 ArcaneBuffetTimer; uint32 FrostBreathTimer; @@ -331,7 +331,7 @@ public: if (bJustReset)//boss is invisible, don't attack return; - if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who))) + if (!me->getVictim() && me->IsValidAttackTarget(who)) { float attackRadius = me->GetAttackDistance(who); if (me->IsWithinDistInMap(who, attackRadius)) @@ -445,7 +445,7 @@ public: struct boss_kalecAI : public ScriptedAI { - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 RevitalizeTimer; uint32 HeroicStrikeTimer; @@ -582,7 +582,7 @@ public: KalecgosGUID = 0; } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 CorruptionStrikeTimer; uint32 AgonyCurseTimer; diff --git a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp index 089c9e9973d..06b04e0ca6a 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/boss_archaedas.cpp @@ -112,7 +112,7 @@ class boss_archaedas : public CreatureScript me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE); } - void SpellHit(Unit* /*caster*/, const SpellInfo *spell) + void SpellHit(Unit* /*caster*/, const SpellInfo* spell) { // Being woken up from the altar, start the awaken sequence if (spell == sSpellMgr->GetSpellInfo(SPELL_ARCHAEDAS_AWAKEN)) @@ -267,7 +267,7 @@ class mob_archaedas_minions : public CreatureScript bAmIAwake = true; } - void SpellHit (Unit* /*caster*/, const SpellInfo *spell) { + void SpellHit (Unit* /*caster*/, const SpellInfo* spell) { // time to wake up, start animation if (spell == sSpellMgr->GetSpellInfo(SPELL_ARCHAEDAS_AWAKEN)) { diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp index 3701383b0ae..542e11d15da 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_akilzon.cpp @@ -76,7 +76,7 @@ class boss_akilzon : public CreatureScript { pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint64 BirdGUIDs[8]; uint64 TargetGUID; @@ -194,7 +194,7 @@ class boss_akilzon : public CreatureScript cell.data.Part.reserved = ALL_DISTRICT; cell.SetNoCreate(); - std::list<Unit* > tempUnitMap; + std::list<Unit*> tempUnitMap; { Trinity::AnyAoETargetUnitInObjectRangeCheck u_check(me, me, 999); diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp index 0a3cdbebdfa..9933529e59a 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_halazzi.cpp @@ -88,7 +88,7 @@ class boss_halazzi : public CreatureScript pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 FrenzyTimer; uint32 SaberlashTimer; @@ -142,7 +142,7 @@ class boss_halazzi : public CreatureScript damage = 0; } - void SpellHit(Unit*, const SpellInfo *spell) + void SpellHit(Unit*, const SpellInfo* spell) { if (spell->Id == SPELL_TRANSFORM_SPLIT2) EnterPhase(PHASE_HUMAN); diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp index 1a4082855a9..f19652f912d 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_hexlord.cpp @@ -219,7 +219,7 @@ class boss_hexlord_malacrass : public CreatureScript AddGUID[i] = 0; } - InstanceScript *pInstance; + InstanceScript* pInstance; uint64 AddGUID[4]; uint32 AddEntry[4]; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp index 4962ac285ca..9638936a3d1 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_janalai.cpp @@ -118,7 +118,7 @@ class boss_janalai : public CreatureScript pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 FireBreathTimer; uint32 BombTimer; @@ -454,7 +454,7 @@ class mob_janalai_firebomb : public CreatureScript void Reset() {} - void SpellHit(Unit* /*caster*/, const SpellInfo *spell) + void SpellHit(Unit* /*caster*/, const SpellInfo* spell) { if (spell->Id == SPELL_FIRE_BOMB_THROW) DoCast(me, SPELL_FIRE_BOMB_DUMMY, true); @@ -491,7 +491,7 @@ class mob_janalai_hatcher : public CreatureScript pInstance =c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 waypoint; uint32 HatchNum; @@ -624,7 +624,7 @@ class mob_janalai_hatchling : public CreatureScript pInstance =c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 BuffetTimer; void Reset() diff --git a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp index 812e1e79b4f..ff4fe3f8a06 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/boss_nalorakk.cpp @@ -108,7 +108,7 @@ class boss_nalorakk : public CreatureScript pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 BrutalSwipe_Timer; uint32 Mangle_Timer; diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp index fe6780f6768..12811742f26 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.cpp @@ -54,7 +54,7 @@ class npc_forest_frog : public CreatureScript pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; void Reset() {} @@ -91,7 +91,7 @@ class npc_forest_frog : public CreatureScript } } - void SpellHit(Unit* caster, const SpellInfo *spell) + void SpellHit(Unit* caster, const SpellInfo* spell) { if (spell->Id == SPELL_REMOVE_AMANI_CURSE && caster->GetTypeId() == TYPEID_PLAYER && me->GetEntry() == ENTRY_FOREST_FROG) { diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp index 5345801f801..15c72992766 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_arlokk.cpp @@ -237,7 +237,7 @@ class boss_arlokk : public CreatureScript me->SetDisplayId(MODEL_ID_PANTHER); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - const CreatureTemplate *cinfo = me->GetCreatureInfo(); + const CreatureTemplate* cinfo = me->GetCreatureInfo(); me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35))); me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35))); me->UpdateDamagePhysical(BASE_ATTACK); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp index 9a7a21fb46c..1c8a1eef388 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_hakkar.cpp @@ -60,7 +60,7 @@ class boss_hakkar : public CreatureScript m_pInstance = c->GetInstanceScript(); } - InstanceScript *m_pInstance; + InstanceScript* m_pInstance; uint32 BloodSiphon_Timer; uint32 CorruptedBlood_Timer; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp index a1421f7cfba..7c339a342af 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jeklik.cpp @@ -59,7 +59,7 @@ class boss_jeklik : public CreatureScript m_pInstance = c->GetInstanceScript(); } - InstanceScript *m_pInstance; + InstanceScript* m_pInstance; uint32 Charge_Timer; uint32 SonicBurst_Timer; @@ -241,7 +241,7 @@ class mob_batrider : public CreatureScript m_pInstance = c->GetInstanceScript(); } - InstanceScript *m_pInstance; + InstanceScript* m_pInstance; uint32 Bomb_Timer; uint32 Check_Timer; diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp index 51db392d3a6..b8eaefbd0f8 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_jindo.cpp @@ -194,7 +194,7 @@ class mob_healing_ward : public CreatureScript uint32 Heal_Timer; - InstanceScript *pInstance; + InstanceScript* pInstance; void Reset() { diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp index 75fa999825d..7f7a85b881f 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_mandokir.cpp @@ -72,7 +72,7 @@ class boss_mandokir : public CreatureScript float targetY; float targetZ; - InstanceScript *m_pInstance; + InstanceScript* m_pInstance; bool endWatch; bool someWatched; @@ -300,7 +300,7 @@ class mob_ohgan : public CreatureScript } uint32 SunderArmor_Timer; - InstanceScript *m_pInstance; + InstanceScript* m_pInstance; void Reset() { diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp index ca34747f8a3..793a404736a 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_marli.cpp @@ -56,7 +56,7 @@ class boss_marli : public CreatureScript m_pInstance = c->GetInstanceScript(); } - InstanceScript *m_pInstance; + InstanceScript* m_pInstance; uint32 SpawnStartSpiders_Timer; uint32 PoisonVolley_Timer; @@ -156,7 +156,7 @@ class boss_marli : public CreatureScript { DoScriptText(SAY_TRANSFORM, me); DoCast(me, SPELL_SPIDER_FORM); - const CreatureTemplate *cinfo = me->GetCreatureInfo(); + const CreatureTemplate* cinfo = me->GetCreatureInfo(); me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 35))); me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 35))); me->UpdateDamagePhysical(BASE_ATTACK); @@ -196,7 +196,7 @@ class boss_marli : public CreatureScript if (TransformBack_Timer <= diff) { me->SetDisplayId(15220); - const CreatureTemplate *cinfo = me->GetCreatureInfo(); + const CreatureTemplate* cinfo = me->GetCreatureInfo(); me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 1))); me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 1))); me->UpdateDamagePhysical(BASE_ATTACK); diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp index b99cd3b180f..9dc2512e8c5 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/boss_thekal.cpp @@ -42,7 +42,7 @@ enum eSpells SPELL_RESURRECT = 24173, //We will not use this spell. //Zealot Lor'Khan Spells - SPELL_SHIELD = 25045, + SPELL_SHIELD = 20545, SPELL_BLOODLUST = 24185, SPELL_GREATERHEAL = 24208, SPELL_DISARM = 6713, @@ -81,7 +81,7 @@ class boss_thekal : public CreatureScript uint32 Check_Timer; uint32 Resurrect_Timer; - InstanceScript *m_pInstance; + InstanceScript* m_pInstance; bool Enraged; bool PhaseTwo; bool WasDead; @@ -201,7 +201,7 @@ class boss_thekal : public CreatureScript me->SetStandState(UNIT_STAND_STATE_STAND); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); me->SetFullHealth(); - const CreatureTemplate *cinfo = me->GetCreatureInfo(); + const CreatureTemplate* cinfo = me->GetCreatureInfo(); me->SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, (cinfo->mindmg +((cinfo->mindmg/100) * 40))); me->SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, (cinfo->maxdmg +((cinfo->maxdmg/100) * 40))); me->UpdateDamagePhysical(BASE_ATTACK); @@ -290,7 +290,7 @@ class mob_zealot_lorkhan : public CreatureScript bool FakeDeath; - InstanceScript *m_pInstance; + InstanceScript* m_pInstance; void Reset() { @@ -451,7 +451,7 @@ class mob_zealot_zath : public CreatureScript bool FakeDeath; - InstanceScript *m_pInstance; + InstanceScript* m_pInstance; void Reset() { diff --git a/src/server/scripts/EasternKingdoms/alterac_mountains.cpp b/src/server/scripts/EasternKingdoms/alterac_mountains.cpp index 86ecfce5684..36daf41ec78 100644 --- a/src/server/scripts/EasternKingdoms/alterac_mountains.cpp +++ b/src/server/scripts/EasternKingdoms/alterac_mountains.cpp @@ -30,5 +30,5 @@ EndContentData */ /*void AddSC_alterac_mountains() { - Script *newscript; + Script* newscript; }*/ diff --git a/src/server/scripts/EasternKingdoms/duskwood.cpp b/src/server/scripts/EasternKingdoms/duskwood.cpp index 6c6086b8c74..145e560c946 100644 --- a/src/server/scripts/EasternKingdoms/duskwood.cpp +++ b/src/server/scripts/EasternKingdoms/duskwood.cpp @@ -34,7 +34,7 @@ class at_twilight_grove : public AreaTriggerScript public: at_twilight_grove() : AreaTriggerScript("at_twilight_grove") { } - bool OnTrigger(Player* player, const AreaTriggerEntry * /*at*/) + bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) { if (player->HasQuestForItem(21149)) { diff --git a/src/server/scripts/EasternKingdoms/eversong_woods.cpp b/src/server/scripts/EasternKingdoms/eversong_woods.cpp index b9c54806c51..6960fed819e 100644 --- a/src/server/scripts/EasternKingdoms/eversong_woods.cpp +++ b/src/server/scripts/EasternKingdoms/eversong_woods.cpp @@ -346,7 +346,7 @@ class npc_second_trial_controller : public CreatureScript public: npc_second_trial_controller() : CreatureScript("npc_second_trial_controller") { } - bool OnQuestAccept(Player* /*player*/, Creature* creature, Quest const *quest) + bool OnQuestAccept(Player* /*player*/, Creature* creature, Quest const* quest) { // One Player exclusive quest, wait for user go activation if (quest->GetQuestId() == QUEST_SECOND_TRIAL) diff --git a/src/server/scripts/EasternKingdoms/redridge_mountains.cpp b/src/server/scripts/EasternKingdoms/redridge_mountains.cpp index 0e8021ed2e2..7e376b65020 100644 --- a/src/server/scripts/EasternKingdoms/redridge_mountains.cpp +++ b/src/server/scripts/EasternKingdoms/redridge_mountains.cpp @@ -43,7 +43,7 @@ class npc_corporal_keeshan : public CreatureScript public: npc_corporal_keeshan() : CreatureScript("npc_corporal_keeshan") { } - bool OnQuestAccept(Player* player, Creature* creature, Quest const *pQuest) + bool OnQuestAccept(Player* player, Creature* creature, Quest const* pQuest) { if (pQuest->GetQuestId() == QUEST_MISSING_IN_ACTION) { diff --git a/src/server/scripts/EasternKingdoms/silvermoon_city.cpp b/src/server/scripts/EasternKingdoms/silvermoon_city.cpp index a46b0ca7b38..c4e105d3bee 100644 --- a/src/server/scripts/EasternKingdoms/silvermoon_city.cpp +++ b/src/server/scripts/EasternKingdoms/silvermoon_city.cpp @@ -85,7 +85,7 @@ public: } } - void SpellHit(Unit* Hitter, const SpellInfo *Spellkind) + void SpellHit(Unit* Hitter, const SpellInfo* Spellkind) { if ((Spellkind->Id == SPELL_SHIMMERING_VESSEL) && !spellHit && (Hitter->GetTypeId() == TYPEID_PLAYER) && (CAST_PLR(Hitter)->IsActiveQuest(QUEST_REDEEMING_THE_DEAD))) diff --git a/src/server/scripts/EasternKingdoms/stormwind_city.cpp b/src/server/scripts/EasternKingdoms/stormwind_city.cpp index 5095d702f2e..88f76d47c53 100644 --- a/src/server/scripts/EasternKingdoms/stormwind_city.cpp +++ b/src/server/scripts/EasternKingdoms/stormwind_city.cpp @@ -510,7 +510,7 @@ public: Unit* summoner = me->ToTempSummon()->GetSummoner(); if (summoner && summoner->GetTypeId() == TYPEID_UNIT && summoner->IsAIEnabled) { - npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI *ai = + npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI* ai = CAST_AI(npc_lord_gregor_lescovar::npc_lord_gregor_lescovarAI, summoner->GetAI()); if (ai) { @@ -696,7 +696,7 @@ class npc_tyrion : public CreatureScript public: npc_tyrion() : CreatureScript("npc_tyrion") { } - bool OnQuestAccept(Player* player, Creature* creature, Quest const *pQuest) + bool OnQuestAccept(Player* player, Creature* creature, Quest const* pQuest) { if (pQuest->GetQuestId() == QUEST_THE_ATTACK) { diff --git a/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp b/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp index 00f8274bf31..4e4a077636b 100644 --- a/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp +++ b/src/server/scripts/EasternKingdoms/stranglethorn_vale.cpp @@ -59,7 +59,7 @@ public: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); } - void SpellHit(Unit* caster, const SpellInfo *spell) + void SpellHit(Unit* caster, const SpellInfo* spell) { if (caster->GetTypeId() == TYPEID_PLAYER) { diff --git a/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp b/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp index dc04f77a488..71359a07afa 100644 --- a/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp +++ b/src/server/scripts/EasternKingdoms/swamp_of_sorrows.cpp @@ -44,7 +44,7 @@ public: npc_galen_goodward() : CreatureScript("npc_galen_goodward") { } - bool OnQuestAccept(Player* player, Creature* creature, Quest const *quest) + bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) { if (quest->GetQuestId() == QUEST_GALENS_ESCAPE) { diff --git a/src/server/scripts/EasternKingdoms/western_plaguelands.cpp b/src/server/scripts/EasternKingdoms/western_plaguelands.cpp index 72c5d8ace5b..2a2becb906f 100644 --- a/src/server/scripts/EasternKingdoms/western_plaguelands.cpp +++ b/src/server/scripts/EasternKingdoms/western_plaguelands.cpp @@ -293,7 +293,7 @@ class npc_anchorite_truuen : public CreatureScript public: npc_anchorite_truuen() : CreatureScript("npc_anchorite_truuen") { } - bool OnQuestAccept(Player* player, Creature* creature, Quest const *quest) + bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) { npc_escortAI* pEscortAI = CAST_AI(npc_anchorite_truuen::npc_anchorite_truuenAI, creature->AI()); diff --git a/src/server/scripts/Examples/example_commandscript.cpp b/src/server/scripts/Examples/example_commandscript.cpp index 78e0ddc7272..8513fbf8cf2 100644 --- a/src/server/scripts/Examples/example_commandscript.cpp +++ b/src/server/scripts/Examples/example_commandscript.cpp @@ -29,7 +29,7 @@ EndScriptData */ // **** This script is designed as an example for others to build on **** // **** Please modify whatever you'd like to as this script is only for developement **** -// **** Script Info **** +// **** Script Info* *** // This script's primary purpose is to show just how much you can really do with commandscripts class example_commandscript : public CommandScript diff --git a/src/server/scripts/Examples/example_creature.cpp b/src/server/scripts/Examples/example_creature.cpp index 221a5f2f4f7..d1ac2045e61 100644 --- a/src/server/scripts/Examples/example_creature.cpp +++ b/src/server/scripts/Examples/example_creature.cpp @@ -28,12 +28,12 @@ EndScriptData */ // **** This script is designed as an example for others to build on **** // **** Please modify whatever you'd like to as this script is only for developement **** -// **** Script Info **** +// **** Script Info* *** // This script is written in a way that it can be used for both friendly and hostile monsters // Its primary purpose is to show just how much you can really do with scripts // I recommend trying it out on both an agressive NPC and on friendly npc -// **** Quick Info **** +// **** Quick Info* *** // Functions with Handled Function marked above them are functions that are called automatically by the core // Functions that are marked Custom Function are functions I've created to simplify code diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp index 303a307d2b9..adafc78f33f 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.cpp @@ -53,7 +53,7 @@ public: bool OnGossipHello(Player* /*player*/, GameObject* pGo) { - InstanceScript *pInstance = pGo->GetInstanceScript(); + InstanceScript* pInstance = pGo->GetInstanceScript(); if (pInstance) { diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp index 5b88ddf63a1..455ea4c4796 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_aku_mai.cpp @@ -44,7 +44,7 @@ public: uint32 uiPoisonCloudTimer; bool bIsEnraged; - InstanceScript *pInstance; + InstanceScript* pInstance; void Reset() { diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp index b8fe114f9df..0a137b7eac0 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_gelihast.cpp @@ -42,7 +42,7 @@ public: uint32 uiNetTimer; - InstanceScript *pInstance; + InstanceScript* pInstance; void Reset() { diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp index 9476380deb6..09a9b52353b 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/boss_kelris.cpp @@ -52,7 +52,7 @@ public: uint32 uiMindBlastTimer; uint32 uiSleepTimer; - InstanceScript *pInstance; + InstanceScript* pInstance; void Reset() { diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp index d590bc5cfe2..aab3aaeef77 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_anetheron.cpp @@ -281,7 +281,7 @@ public: void MoveInLineOfSight(Unit* who) { - if (me->IsWithinDist(who, 50) && !me->isInCombat() && me->IsHostileTo(who)) + if (me->IsWithinDist(who, 50) && !me->isInCombat() && me->IsValidAttackTarget(who)) AttackStart(who); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp index 477e0601d9e..35c81432d5f 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_azgalor.cpp @@ -250,7 +250,7 @@ public: void MoveInLineOfSight(Unit* who) { - if (me->IsWithinDist(who, 50) && !me->isInCombat() && me->IsHostileTo(who)) + if (me->IsWithinDist(who, 50) && !me->isInCombat() && me->IsValidAttackTarget(who)) AttackStart(who); } diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp index 337c4cbb1f9..670ccabd322 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/boss_kazrogal.cpp @@ -172,8 +172,8 @@ public: //cast dummy, useful for bos addons me->CastCustomSpell(me, SPELL_MARK, NULL, NULL, NULL, false, NULL, NULL, me->GetGUID()); - std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); + for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); if (target && target->GetTypeId() == TYPEID_PLAYER && target->getPowerType() == POWER_MANA) diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp index a3d5e4886e0..6a7e6f71003 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal_trash.cpp @@ -1437,7 +1437,7 @@ public: if (!who || me->getVictim()) return; - if (who->isTargetableForAttack() && me->IsHostileTo(who)) + if (me->IsValidAttackTarget(who)) { //float attackRadius = me->GetAttackDistance(who); if (me->IsWithinDistInMap(who, 30)) diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp index 666470617c7..4c89fcfe5b4 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_aeonus.cpp @@ -60,7 +60,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 SandBreath_Timer; uint32 TimeStop_Timer; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp index 092ee779d75..1566058aef0 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_chrono_lord_deja.cpp @@ -60,7 +60,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 ArcaneBlast_Timer; uint32 TimeLapse_Timer; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp index d284a115f0c..b9a3c954771 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/boss_temporus.cpp @@ -59,7 +59,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 Haste_Timer; uint32 SpellReflection_Timer; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp index 2b2151daf02..e1ea473998d 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.cpp @@ -73,7 +73,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 SpellCorrupt_Timer; uint32 Check_Timer; @@ -266,7 +266,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 TimeRiftWave_Timer; uint8 mRiftWaveCount; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp index 31397ec7ad2..fca0545292a 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_captain_skarloc.cpp @@ -57,7 +57,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 Holy_Light_Timer; uint32 Cleanse_Timer; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp index a965fb74517..b20882958d9 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/boss_epoch_hunter.cpp @@ -59,7 +59,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 SandBreath_Timer; uint32 ImpendingDeath_Timer; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp index ec39737b39f..485c52d0423 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.cpp @@ -289,7 +289,7 @@ public: me->setActive(true); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint64 TarethaGUID; @@ -629,7 +629,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; void WaypointReached(uint32 i) { diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp index a5efb416b76..c057430bd18 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_bug_trio.cpp @@ -54,7 +54,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 Cleave_Timer; uint32 ToxicVolley_Timer; @@ -151,7 +151,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 Charge_Timer; uint32 KnockBack_Timer; @@ -244,7 +244,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 Heal_Timer; uint32 Fear_Timer; diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp index 4fc02c70728..b0033aa582a 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_skeram.cpp @@ -238,7 +238,7 @@ public: { if (Player* target = CAST_PLR(SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true))) { - if (Group *pGrp = target->GetGroup()) + if (Group* pGrp = target->GetGroup()) for (uint8 ico = 0; ico < TARGETICONCOUNT; ++ico) { //if (grp->m_targetIcons[ico] == me->GetGUID()) -- private member :( diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp index e5b6d79f912..62d92c35489 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_twinemperors.cpp @@ -66,7 +66,7 @@ struct boss_twinemperorsAI : public ScriptedAI pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 Heal_Timer; uint32 Teleport_Timer; @@ -147,7 +147,7 @@ struct boss_twinemperorsAI : public ScriptedAI { // TODO: we should activate the other boss location so he can start attackning even if nobody // is near I dont know how to do that - ScriptedAI *otherAI = CAST_AI(ScriptedAI, pOtherBoss->AI()); + ScriptedAI* otherAI = CAST_AI(ScriptedAI, pOtherBoss->AI()); if (!pOtherBoss->isInCombat()) { DoPlaySoundToSet(me, IAmVeklor() ? SOUND_VL_AGGRO : SOUND_VN_AGGRO); @@ -157,7 +157,7 @@ struct boss_twinemperorsAI : public ScriptedAI } } - void SpellHit(Unit* caster, const SpellInfo *entry) + void SpellHit(Unit* caster, const SpellInfo* entry) { if (caster == me) return; @@ -221,7 +221,7 @@ struct boss_twinemperorsAI : public ScriptedAI float other_z = pOtherBoss->GetPositionZ(); float other_o = pOtherBoss->GetOrientation(); - Map *thismap = me->GetMap(); + Map* thismap = me->GetMap(); thismap->CreatureRelocation(pOtherBoss, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation()); thismap->CreatureRelocation(me, other_x, other_y, other_z, other_o); @@ -294,7 +294,7 @@ struct boss_twinemperorsAI : public ScriptedAI if (!who || me->getVictim()) return; - if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me) && me->IsHostileTo(who)) + if (me->canCreatureAttack(who)) { float attackRadius = me->GetAttackDistance(who); if (attackRadius < PULL_RANGE) diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp index 650463a02df..13b4acbca3e 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/mob_anubisath_sentinel.cpp @@ -118,7 +118,7 @@ public: void GiveBuddyMyList(Creature* c) { - aqsentinelAI *cai = CAST_AI(aqsentinelAI, (c)->AI()); + aqsentinelAI* cai = CAST_AI(aqsentinelAI, (c)->AI()); for (int i=0; i<3; ++i) if (NearbyGUID[i] && NearbyGUID[i] != c->GetGUID()) cai->AddBuddyToList(NearbyGUID[i]); diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp index 23ce945daaf..7cc1b71a97f 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp @@ -88,7 +88,7 @@ public: bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) { player->PlayerTalkClass->ClearMenus(); - InstanceScript *pInstance = creature->GetInstanceScript(); + InstanceScript* pInstance = creature->GetInstanceScript(); if (uiAction == GOSSIP_ACTION_INFO_DEF + 1) { player->CLOSE_GOSSIP_MENU(); @@ -109,7 +109,7 @@ public: bool OnGossipHello(Player* player, Creature* creature) { - InstanceScript *pInstance = creature->GetInstanceScript(); + InstanceScript* pInstance = creature->GetInstanceScript(); if (pInstance) { @@ -149,7 +149,7 @@ public: uint32 eventTimer; uint32 currentEvent; uint32 eventProgress; - InstanceScript *pInstance; + InstanceScript* pInstance; void WaypointReached(uint32 i) { @@ -315,7 +315,7 @@ public: eventTimer = 3000; if (Creature* naralex = pInstance->instance->GetCreature(pInstance->GetData64(DATA_NARALEX))) { - AchievementEntry const *AchievWC = GetAchievementStore()->LookupEntry(ACHIEVEMENT_WAILING_CAVERNS); + AchievementEntry const* AchievWC = GetAchievementStore()->LookupEntry(ACHIEVEMENT_WAILING_CAVERNS); if (AchievWC) { Map* pMap = me->GetMap(); diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp index 98c93ec3c34..e6a4bca2f91 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.cpp @@ -443,7 +443,7 @@ class at_zumrah : public AreaTriggerScript public: at_zumrah() : AreaTriggerScript("at_zumrah") { } - bool OnTrigger(Player* player, const AreaTriggerEntry * /*at*/) + bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) { Creature* pZumrah = player->FindNearestCreature(ZUMRAH_ID, 30.0f); diff --git a/src/server/scripts/Kalimdor/azshara.cpp b/src/server/scripts/Kalimdor/azshara.cpp index d49a776fa4d..ef6a6dd1f90 100644 --- a/src/server/scripts/Kalimdor/azshara.cpp +++ b/src/server/scripts/Kalimdor/azshara.cpp @@ -63,7 +63,7 @@ public: void EnterCombat(Unit* /*who*/) { } - void SpellHit(Unit* Hitter, const SpellInfo *Spellkind) + void SpellHit(Unit* Hitter, const SpellInfo* Spellkind) { if (!spellhit && Hitter->GetTypeId() == TYPEID_PLAYER && diff --git a/src/server/scripts/Kalimdor/azuremyst_isle.cpp b/src/server/scripts/Kalimdor/azuremyst_isle.cpp index 3e8bcbef02e..e043f9e05b4 100644 --- a/src/server/scripts/Kalimdor/azuremyst_isle.cpp +++ b/src/server/scripts/Kalimdor/azuremyst_isle.cpp @@ -111,7 +111,7 @@ public: } } - void SpellHit(Unit* Caster, const SpellInfo *Spell) + void SpellHit(Unit* Caster, const SpellInfo* Spell) { if (Spell->SpellFamilyFlags[2] & 0x080000000) { diff --git a/src/server/scripts/Kalimdor/durotar.cpp b/src/server/scripts/Kalimdor/durotar.cpp index 6998eb2f8e7..e92faa5cde7 100644 --- a/src/server/scripts/Kalimdor/durotar.cpp +++ b/src/server/scripts/Kalimdor/durotar.cpp @@ -68,7 +68,7 @@ public: work = true; } - void SpellHit(Unit* caster, const SpellInfo * spell) + void SpellHit(Unit* caster, const SpellInfo* spell) { if (spell->Id == SPELL_AWAKEN_PEON && caster->GetTypeId() == TYPEID_PLAYER && CAST_PLR(caster)->GetQuestStatus(QUEST_LAZY_PEONS) == QUEST_STATUS_INCOMPLETE) diff --git a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp index a0f30c53a4d..1de4f115f36 100644 --- a/src/server/scripts/Kalimdor/dustwallow_marsh.cpp +++ b/src/server/scripts/Kalimdor/dustwallow_marsh.cpp @@ -273,7 +273,7 @@ public: return true; } - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_theramore_guardAI(creature); } @@ -588,7 +588,7 @@ public: return new npc_stinkyAI(creature); } - bool OnQuestAccept(Player* player, Creature* creature, Quest const *quest) + bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) { if (quest->GetQuestId() == QUEST_STINKYS_ESCAPE_H || QUEST_STINKYS_ESCAPE_A) { diff --git a/src/server/scripts/Kalimdor/moonglade.cpp b/src/server/scripts/Kalimdor/moonglade.cpp index db294ddbc1b..a714f8716ae 100644 --- a/src/server/scripts/Kalimdor/moonglade.cpp +++ b/src/server/scripts/Kalimdor/moonglade.cpp @@ -559,7 +559,7 @@ class npc_clintar_dreamwalker : public CreatureScript public: npc_clintar_dreamwalker() : CreatureScript("npc_clintar_dreamwalker") { } - bool OnQuestAccept(Player* player, Creature* creature, Quest const *quest) + bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) { if (quest->GetQuestId() == 10965) { diff --git a/src/server/scripts/Kalimdor/silithus.cpp b/src/server/scripts/Kalimdor/silithus.cpp index d57bb932479..000717e1c56 100644 --- a/src/server/scripts/Kalimdor/silithus.cpp +++ b/src/server/scripts/Kalimdor/silithus.cpp @@ -1003,7 +1003,7 @@ public: if (!player) return; - if (Group *EventGroup = player->GetGroup()) + if (Group* EventGroup = player->GetGroup()) { Player* GroupMember; diff --git a/src/server/scripts/Kalimdor/tanaris.cpp b/src/server/scripts/Kalimdor/tanaris.cpp index e03a71f55a1..0c4b73b8658 100644 --- a/src/server/scripts/Kalimdor/tanaris.cpp +++ b/src/server/scripts/Kalimdor/tanaris.cpp @@ -279,7 +279,7 @@ class npc_steward_of_time : public CreatureScript public: npc_steward_of_time() : CreatureScript("npc_steward_of_time") { } - bool OnQuestAccept(Player* player, Creature* /*creature*/, Quest const *quest) + bool OnQuestAccept(Player* player, Creature* /*creature*/, Quest const* quest) { if (quest->GetQuestId() == 10279) //Quest: To The Master's Lair player->CastSpell(player, 34891, true); //(Flight through Caverns) diff --git a/src/server/scripts/Kalimdor/the_barrens.cpp b/src/server/scripts/Kalimdor/the_barrens.cpp index 4fb76c9c610..21b0a5c6ee1 100644 --- a/src/server/scripts/Kalimdor/the_barrens.cpp +++ b/src/server/scripts/Kalimdor/the_barrens.cpp @@ -265,7 +265,7 @@ public: me->HandleEmoteCommand(EMOTE_ONESHOT_SALUTE); } - void SpellHit(Unit* /*caster*/, const SpellInfo *spell) + void SpellHit(Unit* /*caster*/, const SpellInfo* spell) { if (spell->Id == SPELL_FLARE || spell->Id == SPELL_FOLLY) { diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp index 77b1d7366e5..71f810a6020 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_anubarak.cpp @@ -96,7 +96,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; bool bChanneling; bool bGuardianSummoned; @@ -346,7 +346,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new boss_anub_arakAI(creature); } diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp index f4fe681bcb9..afb04ace085 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_hadronox.cpp @@ -188,7 +188,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new boss_hadronoxAI(creature); } diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp index 3b67d12d4b3..42d03f05e51 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/boss_krikthir_the_gatewatcher.cpp @@ -199,7 +199,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new boss_krik_thirAI(creature); } @@ -221,7 +221,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_skittering_infectorAI(creature); } @@ -272,7 +272,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_anub_ar_skirmisherAI(creature); } @@ -318,7 +318,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_anub_ar_shadowcasterAI(creature); } @@ -363,7 +363,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_anub_ar_warriorAI(creature); } @@ -414,7 +414,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_watcher_gashraAI(creature); } @@ -468,7 +468,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_watcher_narjilAI(creature); } @@ -524,7 +524,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_watcher_silthikAI(creature); } diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp index 997b11fb084..7d35814a8a0 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp @@ -203,7 +203,7 @@ public: } }; - InstanceScript* GetInstanceScript(InstanceMap *map) const + InstanceScript* GetInstanceScript(InstanceMap* map) const { return new instance_azjol_nerub_InstanceScript(map); } diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp index c9278bffead..03279579098 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_amanitar.cpp @@ -154,7 +154,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new boss_amanitarAI(creature); } @@ -215,7 +215,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new mob_amanitar_mushroomsAI(creature); } diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp index 1513bebead7..a2371fa0121 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_elder_nadox.cpp @@ -290,7 +290,7 @@ public: void UpdateAI(const uint32 /*diff*/) {} }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new mob_nadox_eggsAI(creature); } diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp index 51e2f833d3a..ea8771ab635 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_herald_volazj.cpp @@ -72,7 +72,7 @@ public: pInstance = creature->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 uiMindFlayTimer; uint32 uiShadowBoltVolleyTimer; @@ -101,7 +101,7 @@ public: } } - void SpellHitTarget(Unit* target, const SpellInfo *spell) + void SpellHitTarget(Unit* target, const SpellInfo* spell) { if (spell->Id == SPELL_INSANITY) { @@ -314,7 +314,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new boss_volazjAI(creature); } diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp index 1522d679fd0..2e0e0661cf7 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_jedoga_shadowseeker.cpp @@ -184,7 +184,7 @@ public: if (pInstance->GetData(DATA_JEDOGA_SHADOWSEEKER_EVENT) != IN_PROGRESS || !bOnGround) return; - if (!me->getVictim() && who->isTargetableForAttack() && me->IsHostileTo(who) && who->isInAccessiblePlaceFor(me)) + if (!me->getVictim() && me->canCreatureAttack(who)) { float attackRadius = me->GetAttackDistance(who); if (me->IsWithinDistInMap(who, attackRadius) && me->IsWithinLOSInMap(who)) @@ -342,7 +342,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new boss_jedoga_shadowseekerAI(creature); } @@ -508,7 +508,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new mob_jedoga_initiandAI(creature); } @@ -591,7 +591,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_jedogas_aufseher_triggerAI(creature); } diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp index e3f6bbbfdd0..347283a891b 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/boss_prince_taldaram.cpp @@ -211,9 +211,9 @@ public: { //Count alive players Unit* target = NULL; - std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); - std::vector<Unit* > target_list; - for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); + std::vector<Unit*> target_list; + for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); // exclude pets & totems @@ -325,7 +325,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new boss_taldaramAI(creature); } @@ -375,7 +375,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new mob_taldaram_flamesphereAI(creature); } @@ -388,7 +388,7 @@ public: bool OnGossipHello(Player* /*player*/, GameObject* pGO) { - InstanceScript *pInstance = pGO->GetInstanceScript(); + InstanceScript* pInstance = pGO->GetInstanceScript(); Creature* pPrinceTaldaram = Unit::GetCreature(*pGO, pInstance ? pInstance->GetData64(DATA_PRINCE_TALDARAM) : 0); if (pPrinceTaldaram && pPrinceTaldaram->isAlive()) diff --git a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp index 7472efcdc42..352ac2d09e5 100644 --- a/src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/ahnkahet/instance_ahnkahet.cpp @@ -296,7 +296,7 @@ public: } }; - InstanceScript* GetInstanceScript(InstanceMap *map) const + InstanceScript* GetInstanceScript(InstanceMap* map) const { return new instance_ahnkahet_InstanceScript(map); } diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp index a272e47d771..d29a05b3b5d 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/boss_sartharion.cpp @@ -1330,7 +1330,7 @@ public: } Creature* pDebuffTarget = NULL; - Map *map = me->GetMap(); + Map* map = me->GetMap(); if (map->IsDungeon()) { Map::PlayerList const &PlayerList = map->GetPlayers(); @@ -1429,7 +1429,7 @@ public: if (pVesperon && pVesperon->isAlive() && pVesperon->HasAura(SPELL_TWILIGHT_TORMENT_VESP)) pVesperon->RemoveAurasDueToSpell(SPELL_TWILIGHT_TORMENT_VESP); - Map *map = me->GetMap(); + Map* map = me->GetMap(); if (map->IsDungeon()) { Map::PlayerList const &PlayerList = map->GetPlayers(); diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp index 3bbe7b125af..2558b03beb6 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_baltharus_the_warborn.cpp @@ -116,6 +116,7 @@ class boss_baltharus_the_warborn : public CreatureScript { me->InterruptNonMeleeSpells(false); _EnterCombat(); + events.Reset(); events.SetPhase(PHASE_COMBAT); events.ScheduleEvent(EVENT_CLEAVE, 11000, 0, PHASE_COMBAT); events.ScheduleEvent(EVENT_ENERVATING_BRAND, 13000, 0, PHASE_COMBAT); @@ -228,16 +229,18 @@ class npc_baltharus_the_warborn_clone : public CreatureScript struct npc_baltharus_the_warborn_cloneAI : public ScriptedAI { - npc_baltharus_the_warborn_cloneAI(Creature* creature) : ScriptedAI(creature) + npc_baltharus_the_warborn_cloneAI(Creature* creature) : ScriptedAI(creature), + _instance(creature->GetInstanceScript()) { - _instance = (InstanceScript*)creature->GetInstanceScript(); } void EnterCombat(Unit* /*who*/) { DoZoneInCombat(); + _events.Reset(); _events.ScheduleEvent(EVENT_CLEAVE, urand(5000, 10000)); _events.ScheduleEvent(EVENT_BLADE_TEMPEST, urand(18000, 25000)); + _events.ScheduleEvent(EVENT_ENERVATING_BRAND, urand(10000, 15000)); } void DamageTaken(Unit* /*attacker*/, uint32& damage) @@ -280,6 +283,12 @@ class npc_baltharus_the_warborn_clone : public CreatureScript DoCastVictim(SPELL_BLADE_TEMPEST); _events.ScheduleEvent(EVENT_BLADE_TEMPEST, 24000); break; + case EVENT_ENERVATING_BRAND: + for (uint8 i = 0; i < RAID_MODE<uint8>(4, 8, 8, 10); i++) + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 45.0f, true)) + DoCast(target, SPELL_ENERVATING_BRAND); + _events.ScheduleEvent(EVENT_ENERVATING_BRAND, 26000); + break; default: break; } @@ -299,59 +308,6 @@ class npc_baltharus_the_warborn_clone : public CreatureScript } }; -class spell_baltharus_enervating_brand : public SpellScriptLoader -{ - public: - spell_baltharus_enervating_brand() : SpellScriptLoader("spell_baltharus_enervating_brand") { } - - class spell_baltharus_enervating_brand_AuraScript : public AuraScript - { - PrepareAuraScript(spell_baltharus_enervating_brand_AuraScript); - - void HandleTriggerSpell(AuraEffect const* aurEff) - { - PreventDefaultAction(); - Unit* target = GetTarget(); - uint32 triggerSpellId = GetSpellInfo()->Effects[aurEff->GetEffIndex()].TriggerSpell; - target->CastSpell(target, triggerSpellId, true); - - if (Unit* caster = GetCaster()) - if (target->GetDistance(caster) <= 12.0f) - target->CastSpell(caster, SPELL_SIPHONED_MIGHT, true); - } - - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_baltharus_enervating_brand_AuraScript::HandleTriggerSpell, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - } - }; - - AuraScript* GetAuraScript() const - { - return new spell_baltharus_enervating_brand_AuraScript(); - } -}; - -class EnervatingBrandSelector -{ - public: - explicit EnervatingBrandSelector(Unit* caster) : _caster(caster) {} - - bool operator()(Unit* unit) - { - if (_caster->GetDistance(unit) > 12.0f) - return true; - - if (unit->GetTypeId() != TYPEID_PLAYER) - return true; - - return false; - } - - private: - Unit* _caster; -}; - class spell_baltharus_enervating_brand_trigger : public SpellScriptLoader { public: @@ -361,16 +317,18 @@ class spell_baltharus_enervating_brand_trigger : public SpellScriptLoader { PrepareSpellScript(spell_baltharus_enervating_brand_trigger_SpellScript); - void FilterTargets(std::list<Unit*>& unitList) + void CheckDistance() { - unitList.remove_if(EnervatingBrandSelector(GetCaster())); - unitList.push_back(GetCaster()); + if (Unit* caster = GetOriginalCaster()) + { + if (Unit* target = GetHitUnit()) + target->CastSpell(caster, SPELL_SIPHONED_MIGHT, true); + } } void Register() { - OnUnitTargetSelect += SpellUnitTargetFn(spell_baltharus_enervating_brand_trigger_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY); - OnUnitTargetSelect += SpellUnitTargetFn(spell_baltharus_enervating_brand_trigger_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ALLY); + OnHit += SpellHitFn(spell_baltharus_enervating_brand_trigger_SpellScript::CheckDistance); } }; @@ -384,6 +342,5 @@ void AddSC_boss_baltharus_the_warborn() { new boss_baltharus_the_warborn(); new npc_baltharus_the_warborn_clone(); - new spell_baltharus_enervating_brand(); new spell_baltharus_enervating_brand_trigger(); } diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp index cc1e4051bbc..d0c59627be7 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/boss_saviana_ragefire.cpp @@ -81,6 +81,7 @@ class boss_saviana_ragefire : public CreatureScript { _EnterCombat(); Talk(SAY_AGGRO); + events.Reset(); events.ScheduleEvent(EVENT_ENRAGE, 20000, EVENT_GROUP_LAND_PHASE); events.ScheduleEvent(EVENT_FLAME_BREATH, 14000, EVENT_GROUP_LAND_PHASE); events.ScheduleEvent(EVENT_FLIGHT, 60000); diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp index ca6509060c3..abfaaa0229d 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp @@ -206,9 +206,17 @@ class instance_ruby_sanctum : public InstanceMapScript case DATA_GENERAL_ZARITHRIAN: if (GetBossState(DATA_SAVIANA_RAGEFIRE) == DONE && GetBossState(DATA_BALTHARUS_THE_WARBORN) == DONE) HandleGameObject(FlameWallsGUID, state != IN_PROGRESS); + /* if (state == DONE) if (Creature* halionController = instance->SummonCreature(NPC_HALION_CONTROLLER, HalionControllerSpawnPos)) halionController->AI()->DoAction(ACTION_INTRO_HALION); + */ + break; + case DATA_HALION: + /* + if (state != IN_PROGRESS) + HandleGameObject(FlameRingGUID, true); + */ break; default: break; diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h index 0acffc50272..52a4c67e544 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h @@ -81,11 +81,13 @@ enum CreaturesIds NPC_ORB_ROTATION_FOCUS = 40091, NPC_SHADOW_ORB_N = 40083, NPC_SHADOW_ORB_S = 40100, + NPC_METEOR_STRIKE_MARK = 40029, NPC_METEOR_STRIKE_NORTH = 40041, NPC_METEOR_STRIKE_EAST = 40042, NPC_METEOR_STRIKE_WEST = 40043, NPC_METEOR_STRIKE_SOUTH = 40044, NPC_METEOR_STRIKE_FLAME = 40055, + NPC_COMBUSTION = 40001, // Xerestrasza NPC_XERESTRASZA = 40429, diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp index f605942e34f..139e74ab67e 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_argent_challenge.cpp @@ -88,7 +88,7 @@ class spell_eadric_radiance : public SpellScriptLoader } }; - SpellScript *GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_eadric_radiance_SpellScript(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp index 392f160d0c5..f0c2ca635b2 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_anubarak_trial.cpp @@ -174,7 +174,7 @@ public: m_uiSummonFrostSphereTimer = 20*IN_MILLISECONDS; - m_uiBerserkTimer = 15*MINUTE*IN_MILLISECONDS; + m_uiBerserkTimer = 10*MINUTE*IN_MILLISECONDS; m_uiStage = 0; m_uiScarabSummoned = 0; m_bIntro = true; 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 c0abd53e007..cf7b6868946 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_faction_champions.cpp @@ -64,7 +64,7 @@ public: { boss_toc_champion_controllerAI(Creature* creature) : ScriptedAI(creature), Summons(me) { - m_pInstance = (InstanceScript *) creature->GetInstanceScript(); + m_pInstance = (InstanceScript* ) creature->GetInstanceScript(); } InstanceScript* m_pInstance; @@ -253,7 +253,7 @@ struct boss_faction_championsAI : public ScriptedAI { boss_faction_championsAI(Creature* creature, uint32 aitype) : ScriptedAI(creature) { - m_pInstance = (InstanceScript *) creature->GetInstanceScript(); + m_pInstance = (InstanceScript* ) creature->GetInstanceScript(); mAIType = aitype; } @@ -369,8 +369,8 @@ struct boss_faction_championsAI : public ScriptedAI Creature* SelectRandomFriendlyMissingBuff(uint32 spell) { - std::list<Creature* > lst = DoFindFriendlyMissingBuff(40.0f, spell); - std::list<Creature* >::const_iterator itr = lst.begin(); + std::list<Creature*> lst = DoFindFriendlyMissingBuff(40.0f, spell); + std::list<Creature*>::const_iterator itr = lst.begin(); if (lst.empty()) return NULL; advance(itr, rand()%lst.size()); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp index c960cd1671c..7d741cc3226 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_lord_jaraxxus.cpp @@ -367,7 +367,7 @@ public: me->SetInCombatWithZone(); } - /*void SpellHitTarget(Unit* target, const SpellInfo *pSpell) + /*void SpellHitTarget(Unit* target, const SpellInfo* pSpell) { if (pSpell->Id == SPELL_FEL_STREAK) DoCastAOE(SPELL_FEL_INFERNO); //66517 diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp index 8c9741f407f..51a125d8c79 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_northrend_beasts.cpp @@ -95,7 +95,7 @@ enum BossSpells SPELL_BURNING_SPRAY = 66902, SPELL_SWEEP_1 = 67646, SPELL_EMERGE_0 = 66947, - SPELL_SUBMERGE_0 = 53421, + SPELL_SUBMERGE_0 = 66948, SPELL_ENRAGE = 68335, SPELL_SLIME_POOL_EFFECT = 66882, //In 60s it diameter grows from 10y to 40y (r=r+0.25 per second) @@ -149,6 +149,27 @@ public: Summons.DespawnAll(); } + void EnterEvadeMode() + { + m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); + ScriptedAI::EnterEvadeMode(); + } + + void MovementInform(uint32 uiType, uint32 uiId) + { + if (uiType != POINT_MOTION_TYPE) return; + + switch (uiId) + { + case 0: + m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetReactState(REACT_AGGRESSIVE); + me->SetInCombatWithZone(); + break; + } + } + void JustDied(Unit* /*killer*/) { if (m_pInstance) @@ -158,7 +179,10 @@ public: void JustReachedHome() { if (m_pInstance) + { + m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); m_pInstance->SetData(TYPE_NORTHREND_BEASTS, FAIL); + } me->DespawnOrUnsummon(); } @@ -265,6 +289,12 @@ public: me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); } + void EnterEvadeMode() + { + m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); + ScriptedAI::EnterEvadeMode(); + } + void EnterCombat(Unit* who) { m_uiTargetGUID = who->GetGUID(); @@ -397,7 +427,9 @@ struct boss_jormungarAI : public ScriptedAI void JustReachedHome() { if (instanceScript && instanceScript->GetData(TYPE_NORTHREND_BEASTS) != FAIL) + { instanceScript->SetData(TYPE_NORTHREND_BEASTS, FAIL); + } me->DespawnOrUnsummon(); } @@ -608,7 +640,12 @@ public: struct boss_dreadscaleAI : public boss_jormungarAI { - boss_dreadscaleAI(Creature* creature) : boss_jormungarAI(creature) { } + boss_dreadscaleAI(Creature* creature) : boss_jormungarAI(creature) + { + instanceScript = creature->GetInstanceScript(); + } + + InstanceScript* instanceScript; void Reset() { @@ -624,6 +661,42 @@ public: submergeTimer = 45 * IN_MILLISECONDS; stage = 0; } + + void MovementInform(uint32 uiType, uint32 uiId) + { + if (uiType != POINT_MOTION_TYPE) return; + + switch (uiId) + { + case 0: + instanceScript->DoUseDoorOrButton(instanceScript->GetData64(GO_MAIN_GATE_DOOR)); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetReactState(REACT_AGGRESSIVE); + me->SetInCombatWithZone(); + if (Creature* otherWorm = Unit::GetCreature(*me, instanceScript->GetData64(otherWormEntry))) + { + otherWorm->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + otherWorm->SetReactState(REACT_AGGRESSIVE); + otherWorm->SetVisible(true); + otherWorm->SetInCombatWithZone(); + } + break; + } + } + + void EnterEvadeMode() + { + instanceScript->DoUseDoorOrButton(instanceScript->GetData64(GO_MAIN_GATE_DOOR)); + boss_jormungarAI::EnterEvadeMode(); + } + + void JustReachedHome() + { + if (instanceScript) + instanceScript->DoUseDoorOrButton(instanceScript->GetData64(GO_MAIN_GATE_DOOR)); + + boss_jormungarAI::JustReachedHome(); + } }; CreatureAI* GetAI(Creature* creature) const @@ -746,13 +819,28 @@ public: case 1: // Finish trample m_bMovementFinish = true; break; + case 2: + m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetReactState(REACT_AGGRESSIVE); + me->SetInCombatWithZone(); + break; } } + void EnterEvadeMode() + { + m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); + ScriptedAI::EnterEvadeMode(); + } + void JustReachedHome() { if (m_pInstance) + { + m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); m_pInstance->SetData(TYPE_NORTHREND_BEASTS, FAIL); + } me->DespawnOrUnsummon(); } diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp index 6d1c2b5d991..1c32debc45a 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/boss_twin_valkyr.cpp @@ -53,50 +53,39 @@ enum Equipment enum Summons { - NPC_UNLEASHED_DARK = 34628, - NPC_UNLEASHED_LIGHT = 34630, + NPC_BULLET_CONTROLLER = 34743, - // Future Development - NPC_BULLET_CONTROLLER = 34743, // Npc controller for all bullets - - NPC_BULLET_STALKER_DARK = 34704, // Npc spawner for dark bullets - NPC_BULLET_STALKER_LIGHT = 34720, // Npc spawner for light bullets + NPC_BULLET_DARK = 34628, + NPC_BULLET_LIGHT = 34630, }; enum BossSpells { - SPELL_CONTROLLER_PERIODIC = 66149, // Future Development - SPELL_LIGHT_TWIN_SPIKE = 66075, SPELL_LIGHT_SURGE = 65766, SPELL_LIGHT_SHIELD = 65858, SPELL_LIGHT_TWIN_PACT = 65876, SPELL_LIGHT_VORTEX = 66046, SPELL_LIGHT_TOUCH = 67297, + SPELL_LIGHT_ESSENCE = 65686, + SPELL_EMPOWERED_LIGHT = 65748, + SPELL_TWIN_EMPATHY_LIGHT = 66133, + SPELL_UNLEASHED_LIGHT = 65795, SPELL_DARK_TWIN_SPIKE = 66069, SPELL_DARK_SURGE = 65768, SPELL_DARK_SHIELD = 65874, SPELL_DARK_TWIN_PACT = 65875, - SPELL_POWER_TWINS = 65879, SPELL_DARK_VORTEX = 66058, SPELL_DARK_TOUCH = 67282, - - SPELL_TWIN_POWER = 65916, - SPELL_LIGHT_ESSENCE = 65686, SPELL_DARK_ESSENCE = 65684, - SPELL_BERSERK = 64238, - SPELL_NONE = 0, - SPELL_EMPOWERED_DARK = 65724, - SPELL_EMPOWERED_LIGHT = 65748, - - SPELL_UNLEASHED_DARK = 65808, - SPELL_UNLEASHED_LIGHT = 65795, - - SPELL_TWIN_EMPATHY_1 = 66132, - SPELL_TWIN_EMPATHY_2 = 66133, - + SPELL_TWIN_EMPATHY_DARK = 66132, + SPELL_UNLEASHED_DARK = 65808, + + SPELL_CONTROLLER_PERIODIC = 66149, + SPELL_POWER_TWINS = 65879, + SPELL_BERSERK = 64238, SPELL_POWERING_UP = 67590, SPELL_SURGE_OF_SPEED = 65828, }; @@ -104,10 +93,10 @@ enum BossSpells #define SPELL_DARK_ESSENCE_HELPER RAID_MODE<uint32>(65684, 67176, 67177, 67178) #define SPELL_LIGHT_ESSENCE_HELPER RAID_MODE<uint32>(65686, 67222, 67223, 67224) -#define SPELL_POWERING_UP_HELPER RAID_MODE(67590, 67602, 67603, 67604) +#define SPELL_POWERING_UP_HELPER RAID_MODE<uint32>(67590, 67602, 67603, 67604) -#define SPELL_EMPOWERED_DARK_HELPER RAID_MODE<uint32>(65724,67213,67214,67215) -#define SPELL_EMPOWERED_LIGHT_HELPER RAID_MODE<uint32>(65748, 67216, 67217, 67218) +#define SPELL_UNLEASHED_DARK_HELPER RAID_MODE<uint32>(65808, 67172, 67173, 67174) +#define SPELL_UNLEASHED_LIGHT_HELPER RAID_MODE<uint32>(65795, 67238, 67239, 67240) enum Actions { @@ -119,6 +108,37 @@ enum Actions ## boss_twin_base ######*/ +class OrbsDespawner : public BasicEvent +{ + public: + explicit OrbsDespawner(Creature* creature) : _creature(creature) + { + } + + bool Execute(uint64 /*currTime*/, uint32 /*diff*/) + { + Trinity::CreatureWorker<OrbsDespawner> worker(_creature, *this); + _creature->VisitNearbyGridObject(5000.0f, worker); + return true; + } + + void operator()(Creature* creature) const + { + switch (creature->GetEntry()) + { + case NPC_BULLET_DARK: + case NPC_BULLET_LIGHT: + creature->DespawnOrUnsummon(); + return; + default: + return; + } + } + + private: + Creature* _creature; +}; + struct boss_twin_baseAI : public ScriptedAI { boss_twin_baseAI(Creature* creature) : ScriptedAI(creature), Summons(me) @@ -133,9 +153,7 @@ struct boss_twin_baseAI : public ScriptedAI uint8 m_uiStage; bool m_bIsBerserk; - uint8 m_uiWaveCount; uint32 m_uiWeapon; - uint32 m_uiColorballsTimer; uint32 m_uiSpecialAbilityTimer; uint32 m_uiSpikeTimer; uint32 m_uiTouchTimer; @@ -144,12 +162,8 @@ struct boss_twin_baseAI : public ScriptedAI int32 m_uiVortexSay; int32 m_uiVortexEmote; uint32 m_uiSisterNpcId; - uint32 m_uiColorballNpcId; uint32 m_uiMyEmphatySpellId; - uint32 m_uiEssenceNpcId; - uint32 m_uiMyEssenceSpellId; uint32 m_uiOtherEssenceSpellId; - uint32 m_uiEmpoweredWeaknessSpellId; uint32 m_uiSurgeSpellId; uint32 m_uiVortexSpellId; uint32 m_uiShieldSpellId; @@ -157,9 +171,6 @@ struct boss_twin_baseAI : public ScriptedAI uint32 m_uiSpikeSpellId; uint32 m_uiTouchSpellId; - Position HomeLocation; - Position EssenceLocation[2]; - void Reset() { me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_PASSIVE); @@ -169,8 +180,6 @@ struct boss_twin_baseAI : public ScriptedAI me->SetFlying(true); */ m_bIsBerserk = false; - m_uiWaveCount = 1; - m_uiColorballsTimer = 15*IN_MILLISECONDS; m_uiSpecialAbilityTimer = MINUTE*IN_MILLISECONDS; m_uiSpikeTimer = 20*IN_MILLISECONDS; m_uiTouchTimer = urand(10, 15)*IN_MILLISECONDS; @@ -182,9 +191,9 @@ struct boss_twin_baseAI : public ScriptedAI void JustReachedHome() { if (m_pInstance) - { m_pInstance->SetData(TYPE_VALKIRIES, FAIL); - } + + Summons.DespawnAll(); me->DespawnOrUnsummon(); } @@ -194,11 +203,8 @@ struct boss_twin_baseAI : public ScriptedAI switch (uiId) { - case 0: - me->GetMotionMaster()->MovePoint(1, HomeLocation.GetPositionX(), HomeLocation.GetPositionY(), HomeLocation.GetPositionZ()); - me->SetHomePosition(HomeLocation); - break; case 1: + m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); me->SetReactState(REACT_AGGRESSIVE); break; @@ -217,13 +223,6 @@ struct boss_twin_baseAI : public ScriptedAI void JustSummoned(Creature* summoned) { - switch (summoned->GetEntry()) - { - case NPC_UNLEASHED_DARK: - case NPC_UNLEASHED_LIGHT: - summoned->SetCorpseDelay(0); - break; - } Summons.Summon(summoned); } @@ -239,25 +238,13 @@ struct boss_twin_baseAI : public ScriptedAI m_pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_DARK_ESSENCE_HELPER); m_pInstance->DoRemoveAurasDueToSpellOnPlayers(SPELL_POWERING_UP_HELPER); break; + case NPC_BULLET_CONTROLLER: + me->m_Events.AddEvent(new OrbsDespawner(me), me->m_Events.CalculateTime(100)); + break; } Summons.Despawn(summoned); } - void SummonColorballs(uint8 quantity) - { - float x0 = ToCCommonLoc[1].GetPositionX(), y0 = ToCCommonLoc[1].GetPositionY(), r = 47.0f; - float y = y0; - for (uint8 i = 0; i < quantity; i++) - { - float x = float(urand(uint32(x0 - r), uint32(x0 + r))); - if (urand(0, 1)) - y = y0 + sqrt(pow(r, 2) - pow((x-x0), 2)); - else - y = y0 - sqrt(pow(r, 2) - pow((x-x0), 2)); - me->SummonCreature(m_uiColorballNpcId, x, y, me->GetPositionZ(), TEMPSUMMON_CORPSE_DESPAWN); - } - } - void JustDied(Unit* /*killer*/) { DoScriptText(SAY_DEATH, me); @@ -267,10 +254,17 @@ struct boss_twin_baseAI : public ScriptedAI { if (!pSister->isAlive()) { + me->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + pSister->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + m_pInstance->SetData(TYPE_VALKIRIES, DONE); Summons.DespawnAll(); } - else m_pInstance->SetData(TYPE_VALKIRIES, SPECIAL); + else + { + me->RemoveFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE); + m_pInstance->SetData(TYPE_VALKIRIES, SPECIAL); + } } } Summons.DespawnAll(); @@ -288,15 +282,13 @@ struct boss_twin_baseAI : public ScriptedAI if (m_pInstance) { if (Creature* pSister = GetSister()) + { me->AddAura(m_uiMyEmphatySpellId, pSister); - + pSister->SetInCombatWithZone(); + } m_pInstance->SetData(TYPE_VALKIRIES, IN_PROGRESS); } - if (me->isAlive()) - { - me->SummonCreature(m_uiEssenceNpcId, EssenceLocation[0].GetPositionX(), EssenceLocation[0].GetPositionY(), EssenceLocation[0].GetPositionZ()); - me->SummonCreature(m_uiEssenceNpcId, EssenceLocation[1].GetPositionX(), EssenceLocation[1].GetPositionY(), EssenceLocation[1].GetPositionZ()); - } + DoScriptText(SAY_AGGRO, me); DoCast(me, m_uiSurgeSpellId); } @@ -310,12 +302,11 @@ struct boss_twin_baseAI : public ScriptedAI break; case ACTION_PACT: m_uiStage = me->GetEntry() == NPC_LIGHTBANE ? 1 : 2; - DoCast(me, SPELL_TWIN_POWER); break; } } - void EnableDualWield(bool mode) + void EnableDualWield(bool mode = true) { SetEquipmentSlots(false, m_uiWeapon, mode ? m_uiWeapon : EQUIP_UNEQUIP, EQUIP_UNEQUIP); me->SetCanDualWield(mode); @@ -384,23 +375,6 @@ struct boss_twin_baseAI : public ScriptedAI else m_uiTouchTimer -= uiDiff; - if (m_uiColorballsTimer <= uiDiff) - { - if (m_uiWaveCount >= 2) - { - SummonColorballs(12); - m_uiWaveCount = 0; - } - else - { - SummonColorballs(2); - m_uiWaveCount++; - } - m_uiColorballsTimer = 15*IN_MILLISECONDS; - } - else - m_uiColorballsTimer -= uiDiff; - if (!m_bIsBerserk && m_uiBerserkTimer <= uiDiff) { DoCast(me, SPELL_BERSERK); @@ -430,7 +404,12 @@ public: struct boss_fjolaAI : public boss_twin_baseAI { - boss_fjolaAI(Creature* creature) : boss_twin_baseAI(creature) {} + boss_fjolaAI(Creature* creature) : boss_twin_baseAI(creature) + { + m_pInstance = (InstanceScript*)creature->GetInstanceScript(); + } + + InstanceScript* m_pInstance; void Reset() { boss_twin_baseAI::Reset(); @@ -441,12 +420,8 @@ public: m_uiVortexEmote = EMOTE_LIGHT_VORTEX; m_uiVortexSay = SAY_LIGHT_VORTEX; m_uiSisterNpcId = NPC_DARKBANE; - m_uiColorballNpcId = NPC_UNLEASHED_LIGHT; - m_uiEssenceNpcId = NPC_LIGHT_ESSENCE; - m_uiMyEmphatySpellId = SPELL_TWIN_EMPATHY_1; - m_uiMyEssenceSpellId = SPELL_LIGHT_ESSENCE_HELPER; + m_uiMyEmphatySpellId = SPELL_TWIN_EMPATHY_DARK; m_uiOtherEssenceSpellId = SPELL_DARK_ESSENCE_HELPER; - m_uiEmpoweredWeaknessSpellId = SPELL_EMPOWERED_DARK_HELPER; m_uiSurgeSpellId = SPELL_LIGHT_SURGE; m_uiVortexSpellId = SPELL_LIGHT_VORTEX; m_uiShieldSpellId = SPELL_LIGHT_SHIELD; @@ -454,10 +429,6 @@ public: m_uiTouchSpellId = SPELL_LIGHT_TOUCH; m_uiSpikeSpellId = SPELL_LIGHT_TWIN_SPIKE; - HomeLocation = ToCCommonLoc[8]; - EssenceLocation[0] = TwinValkyrsLoc[2]; - EssenceLocation[1] = TwinValkyrsLoc[3]; - if (m_pInstance) { m_pInstance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EVENT_START_TWINS_FIGHT); @@ -466,11 +437,27 @@ public: void EnterCombat(Unit* who) { - boss_twin_baseAI::EnterCombat(who); if (m_pInstance) { m_pInstance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, EVENT_START_TWINS_FIGHT); } + + me->SummonCreature(NPC_BULLET_CONTROLLER, ToCCommonLoc[1].GetPositionX(), ToCCommonLoc[1].GetPositionY(), ToCCommonLoc[1].GetPositionZ(), 0.0f, TEMPSUMMON_MANUAL_DESPAWN); + boss_twin_baseAI::EnterCombat(who); + } + + void EnterEvadeMode() + { + m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); + boss_twin_baseAI::EnterEvadeMode(); + } + + void JustReachedHome() + { + if (m_pInstance) + m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); + + boss_twin_baseAI::JustReachedHome(); } }; @@ -503,22 +490,14 @@ public: m_uiVortexEmote = EMOTE_DARK_VORTEX; m_uiVortexSay = SAY_DARK_VORTEX; m_uiSisterNpcId = NPC_LIGHTBANE; - m_uiColorballNpcId = NPC_UNLEASHED_DARK; - m_uiEssenceNpcId = NPC_DARK_ESSENCE; - m_uiMyEmphatySpellId = SPELL_TWIN_EMPATHY_2; - m_uiMyEssenceSpellId = SPELL_DARK_ESSENCE_HELPER; + m_uiMyEmphatySpellId = SPELL_TWIN_EMPATHY_LIGHT; m_uiOtherEssenceSpellId = SPELL_LIGHT_ESSENCE_HELPER; - m_uiEmpoweredWeaknessSpellId = SPELL_EMPOWERED_LIGHT_HELPER; m_uiSurgeSpellId = SPELL_DARK_SURGE; m_uiVortexSpellId = SPELL_DARK_VORTEX; m_uiShieldSpellId = SPELL_DARK_SHIELD; m_uiTwinPactSpellId = SPELL_DARK_TWIN_PACT; m_uiTouchSpellId = SPELL_DARK_TOUCH; m_uiSpikeSpellId = SPELL_DARK_TWIN_SPIKE; - - HomeLocation = ToCCommonLoc[9]; - EssenceLocation[0] = TwinValkyrsLoc[0]; - EssenceLocation[1] = TwinValkyrsLoc[1]; } }; @@ -648,10 +627,13 @@ public: else m_uiRangeCheckTimer -= uiDiff; } - void SpellHitTarget(Unit* who, const SpellInfo* spell) + void SpellHitTarget(Unit* who, SpellInfo const* spell) { - if (who->HasAura(SPELL_DARK_ESSENCE_HELPER)) - who->CastSpell(who, SPELL_POWERING_UP, true); + if (spell->Id == SPELL_UNLEASHED_DARK_HELPER) + { + if (who->HasAura(SPELL_DARK_ESSENCE_HELPER)) + who->CastSpell(who, SPELL_POWERING_UP, true); + } } }; @@ -687,15 +669,47 @@ public: else m_uiRangeCheckTimer -= uiDiff; } - void SpellHitTarget(Unit* who, const SpellInfo* spell) + void SpellHitTarget(Unit* who, SpellInfo const* spell) { - if (who->HasAura(SPELL_LIGHT_ESSENCE_HELPER)) - who->CastSpell(who, SPELL_POWERING_UP, true); + if (spell->Id == SPELL_UNLEASHED_LIGHT_HELPER) + { + if (who->HasAura(SPELL_LIGHT_ESSENCE_HELPER)) + who->CastSpell(who, SPELL_POWERING_UP, true); + } } }; }; +class mob_bullet_controller : public CreatureScript +{ +public: + mob_bullet_controller() : CreatureScript("mob_bullet_controller") { } + + CreatureAI* GetAI(Creature* creature) const + { + return new mob_bullet_controllerAI(creature); + } + + struct mob_bullet_controllerAI : public Scripted_NoMovementAI + { + mob_bullet_controllerAI(Creature* creature) : Scripted_NoMovementAI(creature) + { + Reset(); + } + + void Reset() + { + DoCastAOE(SPELL_CONTROLLER_PERIODIC); + } + + void UpdateAI(const uint32 /*uiDiff*/) + { + UpdateVictim(); + } + }; +}; + class spell_powering_up : public SpellScriptLoader { public: @@ -743,7 +757,7 @@ class spell_powering_up : public SpellScriptLoader uint32 spellId; - bool Validate(SpellEntry const * /*spellEntry*/) + bool Validate(SpellEntry const* /*spellEntry*/) { spellId = sSpellMgr->GetSpellIdForDifficulty(SPELL_SURGE_OF_SPEED, GetCaster()); if (!sSpellMgr->GetSpellInfo(spellId)) @@ -789,7 +803,7 @@ class spell_valkyr_essences : public SpellScriptLoader return true; } - void Absorb(AuraEffect * /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & /*absorbAmount*/) + void Absorb(AuraEffect* /*aurEff*/, DamageInfo & /*dmgInfo*/, uint32 & /*absorbAmount*/) { if (urand(0, 99) < 5) GetTarget()->CastSpell(GetTarget(), spellId, true); @@ -801,7 +815,7 @@ class spell_valkyr_essences : public SpellScriptLoader } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_valkyr_essences_AuraScript(); } @@ -821,7 +835,7 @@ class spell_power_of_the_twins : public SpellScriptLoader return GetCaster()->GetTypeId() == TYPEID_UNIT; } - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) + void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (InstanceScript* instance = GetCaster()->GetInstanceScript()) { @@ -847,7 +861,7 @@ class spell_power_of_the_twins : public SpellScriptLoader } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_power_of_the_twins_AuraScript(); } @@ -860,6 +874,7 @@ void AddSC_boss_twin_valkyr() new mob_unleashed_light(); new mob_unleashed_dark(); new mob_essence_of_twin(); + new mob_bullet_controller(); new spell_powering_up(); new spell_valkyr_essences(); new spell_power_of_the_twins(); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp index 34c065f5649..dd772a14b5d 100755 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.cpp @@ -553,17 +553,16 @@ class npc_tirion_toc : public CreatureScript DoScriptText(SAY_STAGE_0_02, me); m_uiUpdateTimer = 5000; m_pInstance->SetData(TYPE_EVENT, 150); - m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); break; case 150: me->SetUInt32Value(UNIT_NPC_EMOTESTATE, EMOTE_STATE_NONE); if (m_pInstance->GetData(TYPE_BEASTS) != DONE) { - me->SummonCreature(NPC_GORMOK, ToCCommonLoc[10].GetPositionX(), ToCCommonLoc[10].GetPositionY(), ToCCommonLoc[10].GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30*IN_MILLISECONDS); - if (Creature* pTemp = Unit::GetCreature((*me), m_pInstance->GetData64(NPC_GORMOK))) + m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); + + if (Creature* pTemp = me->SummonCreature(NPC_GORMOK, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30*IN_MILLISECONDS)) { pTemp->GetMotionMaster()->MovePoint(0, ToCCommonLoc[5].GetPositionX(), ToCCommonLoc[5].GetPositionY(), ToCCommonLoc[5].GetPositionZ()); - pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); pTemp->SetReactState(REACT_PASSIVE); } @@ -572,13 +571,6 @@ class npc_tirion_toc : public CreatureScript m_pInstance->SetData(TYPE_EVENT, 155); break; case 155: - if (Creature* pTemp = Unit::GetCreature((*me), m_pInstance->GetData64(NPC_GORMOK))) - { - pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - pTemp->SetReactState(REACT_AGGRESSIVE); - pTemp->SetInCombatWithZone(); - } - m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); m_pInstance->SetData(TYPE_BEASTS, IN_PROGRESS); m_uiUpdateTimer = 5000; m_pInstance->SetData(TYPE_EVENT, 160); @@ -591,24 +583,20 @@ class npc_tirion_toc : public CreatureScript case 205: m_uiUpdateTimer = 3000; m_pInstance->SetData(TYPE_EVENT, 210); - m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); break; case 210: if (m_pInstance->GetData(TYPE_BEASTS) != DONE) { - me->SummonCreature(NPC_DREADSCALE, ToCCommonLoc[3].GetPositionX(), ToCCommonLoc[3].GetPositionY(), ToCCommonLoc[3].GetPositionZ(), 5, TEMPSUMMON_MANUAL_DESPAWN); - me->SummonCreature(NPC_ACIDMAW, ToCCommonLoc[4].GetPositionX(), ToCCommonLoc[4].GetPositionY(), ToCCommonLoc[4].GetPositionZ(), 5, TEMPSUMMON_MANUAL_DESPAWN); - if (Creature* pTemp = Unit::GetCreature((*me), m_pInstance->GetData64(NPC_DREADSCALE))) + m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); + if (Creature* pTemp = me->SummonCreature(NPC_DREADSCALE, ToCSpawnLoc[1].GetPositionX(), ToCSpawnLoc[1].GetPositionY(), ToCSpawnLoc[1].GetPositionZ(), 5, TEMPSUMMON_MANUAL_DESPAWN)) { pTemp->GetMotionMaster()->MovePoint(0, ToCCommonLoc[8].GetPositionX(), ToCCommonLoc[8].GetPositionY(), ToCCommonLoc[8].GetPositionZ()); - pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); pTemp->SetReactState(REACT_PASSIVE); } - if (Creature* pTemp = Unit::GetCreature((*me), m_pInstance->GetData64(NPC_ACIDMAW))) + if (Creature* pTemp = me->SummonCreature(NPC_ACIDMAW, ToCCommonLoc[9].GetPositionX(), ToCCommonLoc[9].GetPositionY(), ToCCommonLoc[9].GetPositionZ(), 5, TEMPSUMMON_MANUAL_DESPAWN)) { - pTemp->GetMotionMaster()->MovePoint(0, ToCCommonLoc[9].GetPositionX(), ToCCommonLoc[9].GetPositionY(), ToCCommonLoc[9].GetPositionZ()); - pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->SetVisible(true); pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); pTemp->SetReactState(REACT_PASSIVE); } @@ -617,20 +605,7 @@ class npc_tirion_toc : public CreatureScript m_pInstance->SetData(TYPE_EVENT, 220); break; case 220: - if (Creature* pTemp = Unit::GetCreature((*me), m_pInstance->GetData64(NPC_DREADSCALE))) - { - pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - pTemp->SetReactState(REACT_AGGRESSIVE); - pTemp->SetInCombatWithZone(); - } - if (Creature* pTemp = Unit::GetCreature((*me), m_pInstance->GetData64(NPC_ACIDMAW))) - { - pTemp->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); - pTemp->SetReactState(REACT_AGGRESSIVE); - pTemp->SetInCombatWithZone(); - } m_pInstance->SetData(TYPE_EVENT, 230); - m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); break; case 300: DoScriptText(SAY_STAGE_0_05, me); @@ -640,23 +615,23 @@ class npc_tirion_toc : public CreatureScript case 305: m_uiUpdateTimer = 3000; m_pInstance->SetData(TYPE_EVENT, 310); - m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); break; case 310: if (m_pInstance->GetData(TYPE_BEASTS) != DONE) { - me->SummonCreature(NPC_ICEHOWL, ToCCommonLoc[10].GetPositionX(), ToCCommonLoc[10].GetPositionY(), ToCCommonLoc[10].GetPositionZ(), 5, TEMPSUMMON_DEAD_DESPAWN); - if (Creature* pTemp = Unit::GetCreature((*me), m_pInstance->GetData64(NPC_ICEHOWL))) + m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); + if (Creature* pTemp = me->SummonCreature(NPC_ICEHOWL, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5, TEMPSUMMON_DEAD_DESPAWN)) { - pTemp->GetMotionMaster()->MovePoint(0, ToCCommonLoc[5].GetPositionX(), ToCCommonLoc[5].GetPositionY(), ToCCommonLoc[5].GetPositionZ()); - pTemp->SetInCombatWithZone(); + pTemp->GetMotionMaster()->MovePoint(2, ToCCommonLoc[5].GetPositionX(), ToCCommonLoc[5].GetPositionY(), ToCCommonLoc[5].GetPositionZ()); + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); + me->SetReactState(REACT_PASSIVE); + } } m_uiUpdateTimer = 5000; m_pInstance->SetData(TYPE_EVENT, 315); break; case 315: - m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); m_pInstance->SetData(TYPE_EVENT, 320); break; case 400: @@ -673,7 +648,7 @@ class npc_tirion_toc : public CreatureScript DoScriptText(SAY_STAGE_1_01, me); m_uiUpdateTimer = 7000; m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); - me->SummonCreature(NPC_FIZZLEBANG, ToCCommonLoc[10].GetPositionX(), ToCCommonLoc[10].GetPositionY(), ToCCommonLoc[10].GetPositionZ(), 2, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); + me->SummonCreature(NPC_FIZZLEBANG, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 2, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME); m_pInstance->SetData(TYPE_EVENT, 0); break; case 1180: @@ -713,16 +688,14 @@ class npc_tirion_toc : public CreatureScript break; //Summoning crusaders case 3091: - me->SummonCreature(NPC_CHAMPIONS_CONTROLLER, ToCCommonLoc[1]); - if (Creature* pChampionController = Unit::GetCreature((*me), m_pInstance->GetData64(NPC_CHAMPIONS_CONTROLLER))) + if (Creature* pChampionController = me->SummonCreature(NPC_CHAMPIONS_CONTROLLER, ToCCommonLoc[1])) pChampionController->AI()->SetData(0, HORDE); m_uiUpdateTimer = 3000; m_pInstance->SetData(TYPE_EVENT, 3092); break; //Summoning crusaders case 3090: - me->SummonCreature(NPC_CHAMPIONS_CONTROLLER, ToCCommonLoc[1]); - if (Creature* pChampionController = Unit::GetCreature((*me), m_pInstance->GetData64(NPC_CHAMPIONS_CONTROLLER))) + if (Creature* pChampionController = me->SummonCreature(NPC_CHAMPIONS_CONTROLLER, ToCCommonLoc[1])) pChampionController->AI()->SetData(0, ALLIANCE); m_uiUpdateTimer = 3000; m_pInstance->SetData(TYPE_EVENT, 3092); @@ -745,14 +718,14 @@ class npc_tirion_toc : public CreatureScript break; case 4010: DoScriptText(SAY_STAGE_3_02, me); - if(Creature* pTemp = me->SummonCreature(NPC_LIGHTBANE, ToCCommonLoc[3].GetPositionX(), ToCCommonLoc[3].GetPositionY(), ToCCommonLoc[3].GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME)) + if(Creature* pTemp = me->SummonCreature(NPC_LIGHTBANE, ToCSpawnLoc[1].GetPositionX(), ToCSpawnLoc[1].GetPositionY(), ToCSpawnLoc[1].GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME)) { pTemp->SetVisible(false); pTemp->SetReactState(REACT_PASSIVE); pTemp->SummonCreature(NPC_LIGHT_ESSENCE, TwinValkyrsLoc[0].GetPositionX(), TwinValkyrsLoc[0].GetPositionY(), TwinValkyrsLoc[0].GetPositionZ()); pTemp->SummonCreature(NPC_LIGHT_ESSENCE, TwinValkyrsLoc[1].GetPositionX(), TwinValkyrsLoc[1].GetPositionY(), TwinValkyrsLoc[1].GetPositionZ()); } - if(Creature* pTemp = me->SummonCreature(NPC_DARKBANE, ToCCommonLoc[4].GetPositionX(), ToCCommonLoc[4].GetPositionY(), ToCCommonLoc[4].GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME)) + if(Creature* pTemp = me->SummonCreature(NPC_DARKBANE, ToCSpawnLoc[2].GetPositionX(), ToCSpawnLoc[2].GetPositionY(), ToCSpawnLoc[2].GetPositionZ(), 5, TEMPSUMMON_CORPSE_TIMED_DESPAWN, DESPAWN_TIME)) { pTemp->SetVisible(false); pTemp->SetReactState(REACT_PASSIVE); @@ -766,14 +739,12 @@ class npc_tirion_toc : public CreatureScript m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); if (Creature* pTemp = Unit::GetCreature((*me), m_pInstance->GetData64(NPC_LIGHTBANE))) { - pTemp->GetMotionMaster()->MovePoint(0, ToCCommonLoc[6].GetPositionX(), ToCCommonLoc[6].GetPositionY(), ToCCommonLoc[6].GetPositionZ()); - pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(1, ToCCommonLoc[8].GetPositionX(), ToCCommonLoc[8].GetPositionY(), ToCCommonLoc[8].GetPositionZ()); pTemp->SetVisible(true); } if (Creature* pTemp = Unit::GetCreature((*me), m_pInstance->GetData64(NPC_DARKBANE))) { - pTemp->GetMotionMaster()->MovePoint(0, ToCCommonLoc[7].GetPositionX(), ToCCommonLoc[7].GetPositionY(), ToCCommonLoc[7].GetPositionZ()); - pTemp->AddUnitMovementFlag(MOVEMENTFLAG_WALKING); + pTemp->GetMotionMaster()->MovePoint(1, ToCCommonLoc[9].GetPositionX(), ToCCommonLoc[9].GetPositionY(), ToCCommonLoc[9].GetPositionZ()); pTemp->SetVisible(true); } m_uiUpdateTimer = 5000; @@ -781,7 +752,6 @@ class npc_tirion_toc : public CreatureScript break; case 4016: m_pInstance->SetData(TYPE_EVENT, 4017); - m_pInstance->DoUseDoorOrButton(m_pInstance->GetData64(GO_MAIN_GATE_DOOR)); break; case 4040: m_uiUpdateTimer = 60000; @@ -795,7 +765,7 @@ class npc_tirion_toc : public CreatureScript case 5005: m_uiUpdateTimer = 8000; m_pInstance->SetData(TYPE_EVENT, 5010); - me->SummonCreature(NPC_LICH_KING_1, ToCCommonLoc[2].GetPositionX(), ToCCommonLoc[2].GetPositionY(), ToCCommonLoc[2].GetPositionZ(), 5); + me->SummonCreature(NPC_LICH_KING_1, ToCSpawnLoc[0].GetPositionX(), ToCSpawnLoc[0].GetPositionY(), ToCSpawnLoc[0].GetPositionZ(), 5); break; case 5020: DoScriptText(SAY_STAGE_4_03, me); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h index a0ee721a26a..99525b6fb32 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h @@ -35,6 +35,13 @@ enum DESPAWN_TIME = 300000, }; +const Position ToCSpawnLoc[]= +{ + {563.912f, 261.625f, 394.73f, 4.70437f}, // 0 Center + {575.451f, 261.496f, 394.73f, 4.6541f}, // 1 Left + {549.951f, 261.55f, 394.73f, 4.74835f}, // 2 Right +}; + const Position ToCCommonLoc[]= { {559.257996f, 90.266197f, 395.122986f, 0}, // 0 Barrent diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp index 3779ed42329..eda54abc7a5 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_novos.cpp @@ -241,7 +241,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new boss_novosAI(creature); } @@ -267,7 +267,7 @@ public: uint32 uiFlashOfDarknessTimer; - InstanceScript *pInstance; + InstanceScript* pInstance; void Reset() { @@ -304,7 +304,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new mob_crystal_handlerAI(creature); } @@ -322,7 +322,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; void MovementInform(uint32 type, uint32 id) { @@ -337,7 +337,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new mob_novos_minionAI(creature); } diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp index 6024fba7f68..976633c2ade 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_tharon_ja.cpp @@ -151,7 +151,7 @@ public: DoScriptText(RAND(SAY_FLESH_1, SAY_FLESH_2), me); me->SetDisplayId(MODEL_FLESH); - std::list<Unit* > playerList; + std::list<Unit*> playerList; SelectTargetList(playerList, 5, SELECT_TARGET_TOPAGGRO, 0, true); for (std::list<Unit*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr) { @@ -206,7 +206,7 @@ public: uiRainOfFireTimer = urand(14*IN_MILLISECONDS, 18*IN_MILLISECONDS); uiShadowVolleyTimer = urand(8*IN_MILLISECONDS, 10*IN_MILLISECONDS); - std::list<Unit* > playerList; + std::list<Unit*> playerList; SelectTargetList(playerList, 5, SELECT_TARGET_TOPAGGRO, 0, true); for (std::list<Unit*>::const_iterator itr = playerList.begin(); itr != playerList.end(); ++itr) { @@ -244,7 +244,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new boss_tharon_jaAI(creature); } diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp index d7bcb04a7f6..aa7d1434080 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp @@ -189,7 +189,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new boss_trollgoreAI(creature); } diff --git a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp index 22f129c8418..6c4920f7744 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp @@ -232,7 +232,7 @@ public: } }; - InstanceScript* GetInstanceScript(InstanceMap *map) const + InstanceScript* GetInstanceScript(InstanceMap* map) const { return new instance_drak_tharon_InstanceScript(map); } diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp index c34528530bd..289371907ee 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp @@ -181,7 +181,7 @@ class boss_bronjahm : public CreatureScript } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new boss_bronjahmAI(creature); } @@ -225,7 +225,7 @@ class mob_corrupted_soul_fragment : public CreatureScript InstanceScript* instance; }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new mob_corrupted_soul_fragmentAI(creature); } diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp index 4d784b1f555..51b240976c9 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_devourer_of_souls.cpp @@ -171,7 +171,7 @@ class boss_devourer_of_souls : public CreatureScript { if (player->GetAura(SPELL_MIRRORED_SOUL)) { - int32 mirrorDamage = (uiDamage * 45)/100; + int32 mirrorDamage = (uiDamage* 45)/100; me->CastCustomSpell(player, 69034, &mirrorDamage, 0, 0, true); } else @@ -234,7 +234,7 @@ class boss_devourer_of_souls : public CreatureScript } } - void SpellHitTarget(Unit* /*target*/, const SpellInfo *spell) + void SpellHitTarget(Unit* /*target*/, const SpellInfo* spell) { if (spell->Id == H_SPELL_PHANTOM_BLAST) threeFaced = false; @@ -360,7 +360,7 @@ class boss_devourer_of_souls : public CreatureScript uint64 mirroredSoulTarget; }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new boss_devourer_of_soulsAI(creature); } diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp index ef5023c5a3e..e337050a5a2 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.cpp @@ -267,7 +267,7 @@ public: return true; } - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_sylvanas_fosAI(creature); } @@ -404,7 +404,7 @@ public: return true; } - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_jaina_fosAI(creature); } @@ -459,7 +459,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new mob_spiteful_apparitionAI(creature); } @@ -519,7 +519,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new mob_spectral_wardenAI(creature); } @@ -576,7 +576,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new mob_soulguard_watchmanAI(creature); } @@ -635,7 +635,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new mob_soulguard_reaperAI(creature); } @@ -698,7 +698,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new mob_soulguard_bonecasterAI(creature); } @@ -771,7 +771,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new mob_soulguard_animatorAI(creature); } @@ -843,7 +843,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new mob_soulguard_adeptAI(creature); } @@ -896,7 +896,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new mob_soul_horrorAI(creature); } diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp index 578fa2d1ec5..0425a34d8dc 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp @@ -147,7 +147,7 @@ class instance_forge_of_souls : public InstanceMapScript uint32 teamInInstance; }; - InstanceScript* GetInstanceScript(InstanceMap *map) const + InstanceScript* GetInstanceScript(InstanceMap* map) const { return new instance_forge_of_souls_InstanceScript(map); } diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp index ec294afb79e..4c74488b6a6 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_forgemaster_garfrost.cpp @@ -169,7 +169,7 @@ class boss_garfrost : public CreatureScript { if (spell->Id == SPELL_PERMAFROST_HELPER) { - if (Aura *aura = target->GetAura(SPELL_PERMAFROST_HELPER)) + if (Aura* aura = target->GetAura(SPELL_PERMAFROST_HELPER)) _permafrostStack = std::max<uint32>(_permafrostStack, aura->GetStackAmount()); } else if (spell->Id == SPELL_FORGE_BLADE) diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp index fffd2a48ce4..87015dfc0cb 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_krickandick.cpp @@ -578,7 +578,7 @@ class spell_ick_explosive_barrage : public SpellScriptLoader } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_ick_explosive_barrage_AuraScript(); } diff --git a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp index f9ba820d54d..945239cc594 100644 --- a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp +++ b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp @@ -521,7 +521,7 @@ public: bool OnGossipHello(Player* /*player*/, GameObject* pGO) { - InstanceScript *pInstance = pGO->GetInstanceScript(); + InstanceScript* pInstance = pGO->GetInstanceScript(); uint64 uiStatue = 0; pGO->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index 25c804f2eed..9b062761edf 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -20,6 +20,7 @@ #include "ScriptedCreature.h" #include "Spell.h" #include "SpellAuraEffects.h" +#include "GridNotifiers.h" #include "icecrown_citadel.h" enum Texts @@ -480,9 +481,7 @@ class boss_blood_queen_lana_thel : public CreatureScript return tempTargets.front(); } - std::list<Player*>::iterator itr = tempTargets.begin(); - std::advance(itr, urand(0, tempTargets.size() - 1)); - return *itr; + return SelectRandomContainerElement(tempTargets); } std::set<uint64> _vampires; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index b17de17e74a..0962dbf35a4 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -1189,9 +1189,7 @@ class spell_deathbringer_blood_nova_targeting : public SpellScriptLoader if (targetsAtRange < minTargets) targetsAtRange = std::min<uint32>(unitList.size() - 1, minTargets); - std::list<Unit*>::iterator itr = unitList.begin(); - std::advance(itr, urand(0, targetsAtRange)); - target = *itr; + target = SelectRandomContainerElement(unitList); unitList.clear(); unitList.push_back(target); } @@ -1241,9 +1239,7 @@ class spell_deathbringer_boiling_blood : public SpellScriptLoader if (unitList.empty()) return; - std::list<Unit*>::iterator itr = unitList.begin(); - std::advance(itr, urand(0, unitList.size() - 1)); - Unit* target = *itr; + Unit* target = SelectRandomContainerElement(unitList); unitList.clear(); unitList.push_back(target); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp index 56613d59e99..ab4e6b8a4ce 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp @@ -322,7 +322,7 @@ class boss_lady_deathwhisper : public CreatureScript { if (Group* group = owner->GetGroup()) { - for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) if (Player* member = itr->getSource()) member->KilledMonsterCredit(NPC_DARNAVAN_CREDIT, 0); } @@ -605,10 +605,7 @@ class boss_lady_deathwhisper : public CreatureScript return; // select random cultist - std::list<Creature*>::iterator cultistItr = temp.begin(); - std::advance(cultistItr, urand(0, temp.size()-1)); - - Creature* cultist = *cultistItr; + Creature* cultist = SelectRandomContainerElement(temp); DoCast(cultist, cultist->GetEntry() == NPC_CULT_FANATIC ? SPELL_DARK_TRANSFORMATION_T : SPELL_DARK_EMPOWERMENT_T, true); Talk(uint8(cultist->GetEntry() == NPC_CULT_FANATIC ? SAY_DARK_TRANSFORMATION : SAY_DARK_EMPOWERMENT)); } @@ -862,7 +859,7 @@ class npc_darnavan : public CreatureScript { if (Group* group = owner->GetGroup()) { - for (GroupReference *itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next()) if (Player* member = itr->getSource()) member->FailQuest(QUEST_DEPROGRAMMING); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index b5bcd93d257..ec5318be15b 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -775,9 +775,7 @@ class spell_putricide_ooze_channel : public SpellScriptLoader return; } - std::list<Unit*>::iterator itr = targetList.begin(); - std::advance(itr, urand(0, targetList.size() - 1)); - Unit* target = *itr; + Unit* target = SelectRandomContainerElement(targetList); targetList.clear(); targetList.push_back(target); _target = target; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index dd645562501..b46c0653c09 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -19,6 +19,7 @@ #include "ScriptMgr.h" #include "ScriptedCreature.h" #include "SpellAuras.h" +#include "GridNotifiers.h" #include "icecrown_citadel.h" // KNOWN BUGS: @@ -493,9 +494,7 @@ class spell_rotface_mutated_infection : public SpellScriptLoader if (targets.empty()) return; - std::list<Unit*>::iterator itr = targets.begin(); - std::advance(itr, urand(0, targets.size() - 1)); - Unit* target = *itr; + Unit* target = SelectRandomContainerElement(targets); targets.clear(); targets.push_back(target); _target = target; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index e0b8afdbfd5..bf2ef447cb4 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -1341,9 +1341,7 @@ class spell_frostwarden_handler_order_whelp : public SpellScriptLoader ++itr; } - std::list<Unit*>::iterator itr = unitList.begin(); - std::advance(itr, urand(0, unitList.size()-1)); - Unit* target = *itr; + Unit* target = SelectRandomContainerElement(unitList); unitList.clear(); unitList.push_back(target); } @@ -1357,9 +1355,7 @@ class spell_frostwarden_handler_order_whelp : public SpellScriptLoader if (Creature* creature = GetCaster()->ToCreature()) unitList.remove_if(OrderWhelpTargetSelector(creature)); - std::list<Creature*>::iterator itr = unitList.begin(); - std::advance(itr, urand(0, unitList.size()-1)); - (*itr)->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true); + SelectRandomContainerElement(unitList)->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true); } void Register() diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index c167dfc8e95..fd8f2b3714a 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -339,9 +339,7 @@ class boss_valithria_dreamwalker : public CreatureScript _instance->SendEncounterUnit(ENCOUNTER_FRAME_REMOVE, me); me->RemoveAurasDueToSpell(SPELL_CORRUPTION_VALITHRIA); DoCast(me, SPELL_ACHIEVEMENT_CHECK); - float x, y, z; - me->GetPosition(x, y, z); - me->CastSpell(x, y, z, SPELL_DREAMWALKERS_RAGE, false); + DoCastAOE(SPELL_DREAMWALKERS_RAGE); _events.ScheduleEvent(EVENT_DREAM_SLIP, 3500); if (Creature* lichKing = ObjectAccessor::GetCreature(*me, _instance->GetData64(DATA_VALITHRIA_LICH_KING))) lichKing->AI()->EnterEvadeMode(); @@ -529,7 +527,7 @@ class npc_green_dragon_combat_trigger : public CreatureScript void JustReachedHome() { - BossAI::JustReachedHome(); + _JustReachedHome(); DoAction(ACTION_DEATH); } @@ -537,7 +535,7 @@ class npc_green_dragon_combat_trigger : public CreatureScript { if (action == ACTION_DEATH) { - instance->SetBossState(DATA_VALITHRIA_DREAMWALKER, FAIL); + instance->SetBossState(DATA_VALITHRIA_DREAMWALKER, NOT_STARTED); me->m_Events.AddEvent(new ValithriaDespawner(me), me->m_Events.CalculateTime(5000)); } } @@ -617,7 +615,8 @@ class npc_the_lich_king_controller : public CreatureScript // must not be in dream phase summon->SetPhaseMask((summon->GetPhaseMask() & ~0x10), true); if (summon->GetEntry() != NPC_SUPPRESSER) - summon->AI()->DoZoneInCombat(); + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true)) + summon->AI()->AttackStart(target); } void UpdateAI(uint32 const diff) @@ -883,7 +882,7 @@ class npc_suppresser : public CreatureScript switch (eventId) { case EVENT_SUPPRESSION: - DoCast(me, SPELL_SUPPRESSION); + DoCastAOE(SPELL_SUPPRESSION); _events.ScheduleEvent(EVENT_SUPPRESSION, 5000); break; default: @@ -891,7 +890,10 @@ class npc_suppresser : public CreatureScript } } - DoMeleeAttackIfReady(); + // this creature has REACT_PASSIVE so it does not always have victim here + if (Unit* victim = me->getVictim()) + if (victim->GetEntry() != NPC_VALITHRIA_DREAMWALKER) + DoMeleeAttackIfReady(); } private: @@ -1176,22 +1178,37 @@ class spell_dreamwalker_summoner : public SpellScriptLoader { PrepareSpellScript(spell_dreamwalker_summoner_SpellScript); + bool Load() + { + if (!GetCaster()->GetInstanceScript()) + return false; + return true; + } + void FilterTargets(std::list<Unit*>& targets) { targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED)); if (targets.empty()) return; - std::list<Unit*>::iterator itr = targets.begin(); - std::advance(itr, urand(0, targets.size() - 1)); - Unit* target = *itr; + Unit* target = SelectRandomContainerElement(targets); targets.clear(); targets.push_back(target); } + void HandleForceCast(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (!GetHitUnit()) + return; + + GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, GetCaster()->GetInstanceScript()->GetData64(DATA_VALITHRIA_LICH_KING)); + } + void Register() { OnUnitTargetSelect += SpellUnitTargetFn(spell_dreamwalker_summoner_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENTRY); + OnEffect += SpellEffectFn(spell_dreamwalker_summoner_SpellScript::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST); } }; @@ -1218,7 +1235,7 @@ class spell_dreamwalker_summon_suppresser : public SpellScriptLoader return; std::list<Creature*> summoners; - GetCreatureListWithEntryInGrid(summoners, caster, 22515, 100.0f); + GetCreatureListWithEntryInGrid(summoners, caster, NPC_WORLD_TRIGGER, 100.0f); summoners.remove_if(Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED)); Trinity::RandomResizeList(summoners, 2); if (summoners.empty()) @@ -1234,8 +1251,6 @@ class spell_dreamwalker_summon_suppresser : public SpellScriptLoader { OnEffectPeriodic += AuraEffectPeriodicFn(spell_dreamwalker_summon_suppresser_AuraScript::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } - - int32 _decayRate; }; AuraScript* GetAuraScript() const @@ -1244,6 +1259,43 @@ class spell_dreamwalker_summon_suppresser : public SpellScriptLoader } }; +class spell_dreamwalker_summon_suppresser_effect : public SpellScriptLoader +{ + public: + spell_dreamwalker_summon_suppresser_effect() : SpellScriptLoader("spell_dreamwalker_summon_suppresser_effect") { } + + class spell_dreamwalker_summon_suppresser_effect_SpellScript : public SpellScript + { + PrepareSpellScript(spell_dreamwalker_summon_suppresser_effect_SpellScript); + + bool Load() + { + if (!GetCaster()->GetInstanceScript()) + return false; + return true; + } + + void HandleForceCast(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (!GetHitUnit()) + return; + + GetHitUnit()->CastSpell(GetCaster(), GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, GetCaster()->GetInstanceScript()->GetData64(DATA_VALITHRIA_LICH_KING)); + } + + void Register() + { + OnEffect += SpellEffectFn(spell_dreamwalker_summon_suppresser_effect_SpellScript::HandleForceCast, EFFECT_0, SPELL_EFFECT_FORCE_CAST); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_dreamwalker_summon_suppresser_effect_SpellScript(); + } +}; + class spell_dreamwalker_summon_dream_portal : public SpellScriptLoader { public: @@ -1341,6 +1393,38 @@ class spell_dreamwalker_nightmare_cloud : public SpellScriptLoader } }; +class spell_dreamwalker_twisted_nightmares : public SpellScriptLoader +{ + public: + spell_dreamwalker_twisted_nightmares() : SpellScriptLoader("spell_dreamwalker_twisted_nightmares") { } + + class spell_dreamwalker_twisted_nightmares_SpellScript : public SpellScript + { + PrepareSpellScript(spell_dreamwalker_twisted_nightmares_SpellScript); + + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + // impossible with TARGET_UNIT_CASTER + //if (!GetHitUnit()) + // return; + + if (InstanceScript* instance = GetHitUnit()->GetInstanceScript()) + GetHitUnit()->CastSpell((Unit*)NULL, GetSpellInfo()->Effects[effIndex].TriggerSpell, true, NULL, NULL, instance->GetData64(DATA_VALITHRIA_DREAMWALKER)); + } + + void Register() + { + OnEffect += SpellEffectFn(spell_dreamwalker_twisted_nightmares_SpellScript::HandleScript, EFFECT_2, SPELL_EFFECT_FORCE_CAST); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_dreamwalker_twisted_nightmares_SpellScript(); + } +}; + class achievement_portal_jockey : public AchievementCriteriaScript { public: @@ -1368,8 +1452,10 @@ void AddSC_boss_valithria_dreamwalker() new spell_dreamwalker_decay_periodic_timer(); new spell_dreamwalker_summoner(); new spell_dreamwalker_summon_suppresser(); + new spell_dreamwalker_summon_suppresser_effect(); new spell_dreamwalker_summon_dream_portal(); new spell_dreamwalker_summon_nightmare_portal(); new spell_dreamwalker_nightmare_cloud(); + new spell_dreamwalker_twisted_nightmares(); new achievement_portal_jockey(); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp index 1e061c38c08..16cb0c50beb 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.cpp @@ -273,6 +273,11 @@ enum EventIds EVENT_AWAKEN_WARD_4 = 22909, }; +enum MovementPoints +{ + POINT_LAND = 1, +}; + class FrostwingVrykulSearcher { public: @@ -666,10 +671,6 @@ class npc_frost_freeze_trap : public CreatureScript case 11000: _events.ScheduleEvent(EVENT_ACTIVATE_TRAP, uint32(action)); break; - case ACTION_STOP_TRAPS: - me->RemoveAurasDueToSpell(SPELL_COLDFLAME_JETS); - _events.CancelEvent(EVENT_ACTIVATE_TRAP); - break; default: break; } @@ -761,7 +762,6 @@ class boss_sister_svalna : public CreatureScript _EnterCombat(); if (Creature* crok = ObjectAccessor::GetCreature(*me, instance->GetData64(DATA_CROK_SCOURGEBANE))) crok->AI()->Talk(SAY_CROK_COMBAT_SVALNA); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_1); events.ScheduleEvent(EVENT_SVALNA_COMBAT, 9000); events.ScheduleEvent(EVENT_IMPALING_SPEAR, urand(40000, 50000)); events.ScheduleEvent(EVENT_AETHER_SHIELD, urand(100000, 110000)); @@ -835,17 +835,30 @@ class boss_sister_svalna : public CreatureScript } } + void MovementInform(uint32 type, uint32 id) + { + if (type != POINT_MOTION_TYPE || id != POINT_LAND) + return; + + _isEventInProgress = false; + me->setActive(false); + me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_PASSIVE); + } + void SpellHitTarget(Unit* target, SpellInfo const* spell) { switch (spell->Id) { case SPELL_REVIVE_CHAMPION: + { if (!_isEventInProgress) break; - _isEventInProgress = false; - me->setActive(false); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE | UNIT_FLAG_PASSIVE); + Position pos; + me->GetPosition(&pos); + me->UpdateGroundPositionZ(pos.GetPositionX(), pos.GetPositionY(), pos.m_positionZ); + me->GetMotionMaster()->MovePoint(POINT_LAND, pos); break; + } case SPELL_IMPALING_SPEAR_KILL: me->Kill(target); break; @@ -884,7 +897,6 @@ class boss_sister_svalna : public CreatureScript me->CastSpell(me, SPELL_REVIVE_CHAMPION, false); break; case EVENT_SVALNA_COMBAT: - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_ATTACKABLE_1); me->SetReactState(REACT_DEFENSIVE); Talk(SAY_SVALNA_AGGRO); break; @@ -1361,9 +1373,7 @@ class npc_captain_arnath : public CreatureScript case EVENT_ARNATH_PW_SHIELD: { std::list<Creature*> targets = DoFindFriendlyMissingBuff(40.0f, SPELL_POWER_WORD_SHIELD); - std::list<Creature*>::iterator itr = targets.begin(); - std::advance(itr, urand(0, targets.size() - 1)); - DoCast(*itr, SPELL_POWER_WORD_SHIELD); + DoCast(SelectRandomContainerElement(targets), SPELL_POWER_WORD_SHIELD); Events.ScheduleEvent(EVENT_ARNATH_PW_SHIELD, urand(15000, 20000)); break; } @@ -1505,8 +1515,7 @@ class npc_captain_grondel : public CreatureScript switch (eventId) { case EVENT_GRONDEL_CHARGE_CHECK: - if (CanCast(me->getVictim(), sSpellMgr->GetSpellInfo(SPELL_CHARGE))) - DoCastVictim(SPELL_CHARGE); + DoCastVictim(SPELL_CHARGE); Events.ScheduleEvent(EVENT_GRONDEL_CHARGE_CHECK, 500); break; case EVENT_GRONDEL_MORTAL_STRIKE: @@ -1818,9 +1827,7 @@ class spell_frost_giant_death_plague : public SpellScriptLoader unitList.remove_if(DeathPlagueTargetSelector(GetCaster())); if (!unitList.empty()) { - std::list<Unit*>::iterator itr = unitList.begin(); - std::advance(itr, urand(0, unitList.size()-1)); - Unit* target = *itr; + Unit* target = SelectRandomContainerElement(unitList); unitList.clear(); unitList.push_back(target); } @@ -1992,8 +1999,7 @@ class at_icc_shutdown_traps : public AreaTriggerScript bool OnTrigger(Player* player, AreaTriggerEntry const* /*areaTrigger*/) { if (InstanceScript* instance = player->GetInstanceScript()) - if (instance->GetData(DATA_COLDFLAME_JETS) == IN_PROGRESS) - instance->SetData(DATA_COLDFLAME_JETS, DONE); + instance->SetData(DATA_COLDFLAME_JETS, DONE); return true; } }; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h index f5973fc0c8c..26b2546fc50 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h @@ -247,6 +247,7 @@ enum CreaturesIds // The Lich King NPC_THE_LICH_KING = 36597, + NPC_WORLD_TRIGGER = 22515, }; enum GameObjectsIds diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp index 01391f029ce..41bed882166 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel_teleport.cpp @@ -41,6 +41,7 @@ class icecrown_citadel_teleport : public GameObjectScript player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport to the Deathbringer's Rise.", GOSSIP_SENDER_ICC_PORT, DEATHBRINGER_S_RISE_TELEPORT); if (instance->GetData(DATA_COLDFLAME_JETS) == DONE) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport to the Upper Spire.", GOSSIP_SENDER_ICC_PORT, UPPER_SPIRE_TELEPORT); + // TODO: Gauntlet event before Sindragosa if (instance->GetBossState(DATA_VALITHRIA_DREAMWALKER) == DONE) player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, "Teleport to Sindragosa's Lair", GOSSIP_SENDER_ICC_PORT, SINDRAGOSA_S_LAIR_TELEPORT); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index 890fb66cb2b..41705ca0e78 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -207,9 +207,6 @@ class instance_icecrown_citadel : public InstanceMapScript if (TeamInInstance == ALLIANCE) creature->UpdateEntry(NPC_SE_SKYBREAKER_MARINE, ALLIANCE); break; - case NPC_FROST_FREEZE_TRAP: - ColdflameJetGUIDs.insert(creature->GetGUID()); - break; case NPC_FESTERGUT: FestergutGUID = creature->GetGUID(); break; @@ -310,12 +307,6 @@ class instance_icecrown_citadel : public InstanceMapScript return entry; } - void OnCreatureRemove(Creature* creature) - { - if (creature->GetEntry() == NPC_FROST_FREEZE_TRAP) - ColdflameJetGUIDs.erase(creature->GetGUID()); - } - void OnCreatureDeath(Creature* creature) { switch (creature->GetEntry()) @@ -792,12 +783,7 @@ class instance_icecrown_citadel : public InstanceMapScript case DATA_COLDFLAME_JETS: ColdflameJetsState = data; if (ColdflameJetsState == DONE) - { SaveToDB(); - for (std::set<uint64>::iterator itr = ColdflameJetGUIDs.begin(); itr != ColdflameJetGUIDs.end(); ++itr) - if (Creature* trap = instance->GetCreature(*itr)) - trap->AI()->DoAction(ACTION_STOP_TRAPS); - } break; case DATA_BLOOD_QUICKENING_STATE: { @@ -1090,7 +1076,6 @@ class instance_icecrown_citadel : public InstanceMapScript } protected: - std::set<uint64> ColdflameJetGUIDs; uint64 LadyDeathwisperElevatorGUID; uint64 DeathbringerSaurfangGUID; uint64 DeathbringerSaurfangDoorGUID; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp index 856d0031d0d..5bd675ea0ba 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_four_horsemen.cpp @@ -226,7 +226,7 @@ public: Unit* eventStarter = Unit::GetUnit(*me, uiEventStarterGUID); - if (eventStarter && me->canAttack(eventStarter)) + if (eventStarter && me->IsValidAttackTarget(eventStarter)) AttackStart(eventStarter); else if (!UpdateVictim()) { @@ -250,7 +250,7 @@ public: // switch to "who" if nearer than current target. void SelectNearestTarget(Unit* who) { - if (me->getVictim() && me->GetDistanceOrder(who, me->getVictim()) && me->canAttack(who)) + if (me->getVictim() && me->GetDistanceOrder(who, me->getVictim()) && me->IsValidAttackTarget(who)) { me->getThreatManager().modifyThreatPercent(me->getVictim(), -100); me->AddThreat(who, 1000000.0f); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp index b2184615bb3..6bb0675b7fc 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_grobbulus.cpp @@ -59,11 +59,11 @@ public: events.ScheduleEvent(EVENT_BERSERK, 12*60000); } - void SpellHitTarget(Unit* target, const SpellInfo *spell) + void SpellHitTarget(Unit* target, const SpellInfo* spell) { if (spell->Id == uint32(SPELL_SLIME_SPRAY)) { - if (TempSummon *slime = me->SummonCreature(MOB_FALLOUT_SLIME, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0)) + if (TempSummon* slime = me->SummonCreature(MOB_FALLOUT_SLIME, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 0)) DoZoneInCombat(slime); } } diff --git a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp index 09f3bd49279..33122567bad 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_kelthuzad.cpp @@ -658,7 +658,7 @@ class at_kelthuzad_center : public AreaTriggerScript public: at_kelthuzad_center() : AreaTriggerScript("at_kelthuzad_center") { } - bool OnTrigger(Player* player, const AreaTriggerEntry * /*at*/) + bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) { if (player->isGameMaster()) return false; diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp index a6d36e7eaa2..c39072ae2d1 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp @@ -132,7 +132,7 @@ public: CheckPlayersFrostResist(); } - void SpellHitTarget(Unit* target, const SpellInfo *spell) + void SpellHitTarget(Unit* target, const SpellInfo* spell) { if (spell->Id == SPELL_ICEBOLT) { @@ -153,7 +153,7 @@ public: CheckPlayersFrostResist(); if (CanTheHundredClub) { - AchievementEntry const *AchievTheHundredClub = GetAchievementStore()->LookupEntry(ACHIEVEMENT_THE_HUNDRED_CLUB); + AchievementEntry const* AchievTheHundredClub = GetAchievementStore()->LookupEntry(ACHIEVEMENT_THE_HUNDRED_CLUB); if (AchievTheHundredClub) { if (pMap && pMap->IsDungeon()) diff --git a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp index cf653284e6a..7d355b2f71a 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/boss_keristrasza.cpp @@ -210,7 +210,7 @@ public: bool OnGossipHello(Player* /*player*/, GameObject* pGO) { - InstanceScript *pInstance = pGO->GetInstanceScript(); + InstanceScript* pInstance = pGO->GetInstanceScript(); Creature* pKeristrasza = Unit::GetCreature(*pGO, pInstance ? pInstance->GetData64(DATA_KERISTRASZA) : 0); if (pKeristrasza && pKeristrasza->isAlive()) diff --git a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp index a4676dee852..30fd0695a9f 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp @@ -31,14 +31,14 @@ class instance_nexus : public InstanceMapScript public: instance_nexus() : InstanceMapScript("instance_nexus", 576) { } - InstanceScript *GetInstanceScript(InstanceMap *pMap) const + InstanceScript* GetInstanceScript(InstanceMap* pMap) const { return new instance_nexus_InstanceMapScript(pMap); } struct instance_nexus_InstanceMapScript : public InstanceScript { - instance_nexus_InstanceMapScript(Map *pMap) : InstanceScript(pMap) {} + instance_nexus_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {} uint32 m_auiEncounter[NUMBER_OF_ENCOUNTERS]; diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp index e90ca9052f4..bb62b921289 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_drakos.cpp @@ -28,21 +28,20 @@ enum Spells NPC_UNSTABLE_SPHERE = 28166, }; -//not in db enum Yells { - SAY_AGGRO = -1578000, - SAY_KILL_1 = -1578001, - SAY_KILL_2 = -1578002, - SAY_KILL_3 = -1578003, - SAY_DEATH = -1578004, - SAY_PULL_1 = -1578005, - SAY_PULL_2 = -1578006, - SAY_PULL_3 = -1578007, - SAY_PULL_4 = -1578008, - SAY_STOMP_1 = -1578009, - SAY_STOMP_2 = -1578010, - SAY_STOMP_3 = -1578011 + SAY_AGGRO = -1578005, + SAY_KILL_1 = -1578006, + SAY_KILL_2 = -1578007, + SAY_KILL_3 = -1578008, + SAY_DEATH = -1578009, + SAY_PULL_1 = -1578010, + SAY_PULL_2 = -1578011, + SAY_PULL_3 = -1578012, + SAY_PULL_4 = -1578013, + SAY_STOMP_1 = -1578014, + SAY_STOMP_2 = -1578015, + SAY_STOMP_3 = -1578016 }; enum DrakosAchievement diff --git a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp index 343ca29ddca..f3384b7ec15 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/boss_varos.cpp @@ -327,7 +327,7 @@ class spell_varos_energize_core_area_enemy : public SpellScriptLoader } }; - SpellScript *GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_varos_energize_core_area_enemySpellScript(); } @@ -374,7 +374,7 @@ class spell_varos_energize_core_area_entry : public SpellScriptLoader } }; - SpellScript *GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_varos_energize_core_area_entrySpellScript(); } diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp index 07cd031e66b..d15d9ee6900 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp @@ -156,7 +156,7 @@ public: if (IsHeroic() && GolemsShattered < 5) { - AchievementEntry const *AchievShatterResistant = GetAchievementStore()->LookupEntry(ACHIEVEMENT_SHATTER_RESISTANT); + AchievementEntry const* AchievShatterResistant = GetAchievementStore()->LookupEntry(ACHIEVEMENT_SHATTER_RESISTANT); if (AchievShatterResistant) { Map* pMap = me->GetMap(); 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 9a0e912eab0..53d5fe22db6 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_flame_leviathan.cpp @@ -418,25 +418,25 @@ class boss_flame_leviathan : public CreatureScript me->CastSpell(target, SPELL_PURSUED, true); me->MonsterTextEmote(EMOTE_PURSUE, target->GetGUID(), true); } - events.RepeatEvent(30*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_PURSUE, 30*IN_MILLISECONDS); break; case EVENT_MISSILE: DoCast(me, SPELL_MISSILE_BARRAGE, true); - events.RepeatEvent(2*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_MISSILE, 2*IN_MILLISECONDS); break; case EVENT_VENT: DoCastAOE(SPELL_FLAME_VENTS); - events.RepeatEvent(20*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_VENT, 20*IN_MILLISECONDS); break; case EVENT_SPEED: DoCastAOE(SPELL_GATHERING_SPEED); - events.RepeatEvent(15*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_SPEED, 15*IN_MILLISECONDS); break; case EVENT_SUMMON: if (summons.size() < 15) if (Creature* lift = DoSummonFlyer(NPC_MECHANOLIFT, me, 30.0f, 50.0f, 0)) lift->GetMotionMaster()->MoveRandom(100); - events.RepeatEvent(2*IN_MILLISECONDS); + events.ScheduleEvent(EVENT_SUMMON, 2*IN_MILLISECONDS); break; case EVENT_SHUTDOWN: DoScriptText(RAND(SAY_OVERLOAD_1, SAY_OVERLOAD_2, SAY_OVERLOAD_3), me); @@ -881,7 +881,7 @@ class npc_colossus : public CreatureScript instance = creature->GetInstanceScript(); } - InstanceScript *instance; + InstanceScript* instance; void JustDied(Unit* /*Who*/) { diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_general_vezax.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_general_vezax.cpp index de7a3ef2685..7d00c0e59fc 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_general_vezax.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_general_vezax.cpp @@ -290,9 +290,7 @@ class boss_general_vezax : public CreatureScript if (size < playersMin) return NULL; - std::list<Player*>::const_iterator itr = PlayerList.begin(); - std::advance(itr, urand(0, size - 1)); - return *itr; + return SelectRandomContainerElement(PlayerList); } return NULL; diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp index 26b200bdbbc..a6f67c6f970 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_xt002.cpp @@ -900,7 +900,7 @@ class spell_xt002_heart_overload_periodic : public SpellScriptLoader { if (Unit* caster = GetCaster()) { - if (InstanceScript* instance = GetCaster()->GetInstanceScript()) + if (InstanceScript* instance = caster->GetInstanceScript()) { if (Unit* toyPile = ObjectAccessor::GetUnit(*caster, instance->GetData64(DATA_TOY_PILE_0 + urand(0, 3)))) { @@ -978,7 +978,7 @@ class spell_xt002_submerged : public SpellScriptLoader if (!caster) return; - caster->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_0 | UNIT_FLAG_NOT_SELECTABLE); + caster->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); caster->SetByteValue(UNIT_FIELD_BYTES_1, 0, UNIT_STAND_STATE_SUBMERGED); } @@ -1009,7 +1009,7 @@ class spell_xt002_stand : public SpellScriptLoader if (!target) return; - target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_0 | UNIT_FLAG_NOT_SELECTABLE); + target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); target->SetByteValue(UNIT_FIELD_BYTES_1, 0, UNIT_STAND_STATE_STAND); } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp index 57a4a1f02eb..639ff4e07d3 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_keleseth.cpp @@ -166,7 +166,7 @@ public: if (IsHeroic() && !ShatterFrostTomb) { - AchievementEntry const *AchievOnTheRocks = GetAchievementStore()->LookupEntry(ACHIEVEMENT_ON_THE_ROCKS); + AchievementEntry const* AchievOnTheRocks = GetAchievementStore()->LookupEntry(ACHIEVEMENT_ON_THE_ROCKS); if (AchievOnTheRocks) { Map* pMap = me->GetMap(); @@ -272,7 +272,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 Respawn_Time; uint64 Target_Guid; uint32 Decrepify_Timer; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp index 9727ce3cbec..c93b9c7bda6 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_palehoof.cpp @@ -107,7 +107,7 @@ public: uint8 AddCount; bool DoneAdds[4]; - InstanceScript *pInstance; + InstanceScript* pInstance; void Reset() { @@ -306,7 +306,7 @@ public: uint32 uiCrazedTimer; uint32 uiTerrifyingRoarTimer; - InstanceScript *pInstance; + InstanceScript* pInstance; void Reset() { @@ -419,7 +419,7 @@ public: uint32 uiEnrage1Timer; uint32 uiEnrage2Timer; - InstanceScript *pInstance; + InstanceScript* pInstance; void Reset() { @@ -535,7 +535,7 @@ public: uint32 uiGoreTimer; uint32 uiGrievousWoundTimer; - InstanceScript *pInstance; + InstanceScript* pInstance; void Reset() { @@ -655,7 +655,7 @@ public: uint32 uiAcidSplatterTimer; uint32 uiPoisonBreathTimer; - InstanceScript *pInstance; + InstanceScript* pInstance; void Reset() { @@ -757,7 +757,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 SummonTimer; Phase currentPhase; @@ -836,7 +836,7 @@ public: bool OnGossipHello(Player* /*player*/, GameObject* pGO) { - InstanceScript *pInstance = pGO->GetInstanceScript(); + InstanceScript* pInstance = pGO->GetInstanceScript(); Creature* pPalehoof = Unit::GetCreature(*pGO, pInstance ? pInstance->GetData64(DATA_GORTOK_PALEHOOF) : 0); if (pPalehoof && pPalehoof->isAlive()) diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp index c970d27cb23..325dd67443f 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_skadi.cpp @@ -276,7 +276,7 @@ public: Summons.Despawn(summoned); } - void SpellHit(Unit* /*caster*/, const SpellInfo *spell) + void SpellHit(Unit* /*caster*/, const SpellInfo* spell) { if (spell->Id == SPELL_HARPOON_DAMAGE) { diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp index e5343e65711..ab6eae9a241 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_svala.cpp @@ -128,7 +128,7 @@ public: if (!who) return; - if (Phase == IDLE && who->isTargetableForAttack() && me->IsHostileTo(who) && me->IsWithinDistInMap(who, 40)) + if (Phase == IDLE && me->IsValidAttackTarget(who) && me->IsWithinDistInMap(who, 40)) { Phase = INTRO; me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp index 2228b4ef528..e021936fcc4 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/boss_ymiron.cpp @@ -150,7 +150,7 @@ public: uint64 m_uiActivedCreatureGUID; uint64 m_uiOrbGUID; - InstanceScript *pInstance; + InstanceScript* pInstance; void Reset() { diff --git a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp index e160cda0699..bb9302c911d 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/boss_emalon.cpp @@ -139,9 +139,7 @@ class boss_emalon : public CreatureScript case EVENT_OVERCHARGE: if (!summons.empty()) { - std::list<uint64>::const_iterator itr = summons.begin(); - std::advance(itr, urand(0, summons.size()-1)); - Creature* minion = Unit::GetCreature(*me, *itr); + Creature* minion = Unit::GetCreature(*me, SelectRandomContainerElement(summons)); if (minion && minion->isAlive()) { minion->CastSpell(me, SPELL_OVERCHARGED, true); diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp index d7e57c813ea..819681e1ef2 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.cpp @@ -261,7 +261,7 @@ public: case GOSSIP_ACTION_INFO_DEF+1: player->CLOSE_GOSSIP_MENU(); CAST_AI(npc_sinclari_vh::npc_sinclariAI, (creature->AI()))->uiPhase = 1; - if (InstanceScript *pInstance = creature->GetInstanceScript()) + if (InstanceScript* pInstance = creature->GetInstanceScript()) pInstance->SetData(DATA_MAIN_EVENT_PHASE, SPECIAL); break; case GOSSIP_ACTION_INFO_DEF+2: @@ -563,7 +563,7 @@ public: SummonList listOfMobs; - InstanceScript *pInstance; + InstanceScript* pInstance; void Reset() { diff --git a/src/server/scripts/Northrend/borean_tundra.cpp b/src/server/scripts/Northrend/borean_tundra.cpp index e270122d539..5c7dc9abfda 100644 --- a/src/server/scripts/Northrend/borean_tundra.cpp +++ b/src/server/scripts/Northrend/borean_tundra.cpp @@ -73,7 +73,7 @@ public: casterGuid = 0; } - void SpellHit(Unit* caster, const SpellInfo *spell) + void SpellHit(Unit* caster, const SpellInfo* spell) { if (Phase) return; @@ -153,7 +153,7 @@ public: }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_sinkhole_kill_creditAI(creature); } @@ -193,7 +193,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_khunok_the_behemothAI(creature); } @@ -375,7 +375,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new mob_nerubar_victimAI(creature); } @@ -410,7 +410,7 @@ public: }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_scourge_prisonerAI(creature); } @@ -483,7 +483,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_jennyAI (creature); } @@ -527,7 +527,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_fezzix_geartwistAI(creature); } @@ -596,7 +596,7 @@ public: if (GameObject* go_caribou = me->GetMap()->GetGameObject(go_caribouGUID)) go_caribou->SetLootState(GO_JUST_DEACTIVATED); - if (TempSummon *summon = me->ToTempSummon()) + if (TempSummon* summon = me->ToTempSummon()) if (summon->isSummon()) if (Unit* pTemp = summon->GetSummoner()) if (pTemp->GetTypeId() == TYPEID_PLAYER) @@ -672,7 +672,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_nesingwary_trapperAI(creature); } @@ -789,12 +789,12 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_lurgglbrAI(creature); } - bool OnQuestAccept(Player* player, Creature* creature, Quest const *pQuest) + bool OnQuestAccept(Player* player, Creature* creature, Quest const* pQuest) { if (pQuest->GetQuestId() == QUEST_ESCAPE_WINTERFIN_CAVERNS) { @@ -862,11 +862,11 @@ public: void EnterCombat(Unit* who) { - if (me->canAttack(who)) + if (me->IsValidAttackTarget(who)) AttackStart(who); } - void SpellHit(Unit* caster, const SpellInfo *spell) + void SpellHit(Unit* caster, const SpellInfo* spell) { if (spell->Id == SPELL_DRAKE_HARPOON && caster->GetTypeId() == TYPEID_PLAYER) { @@ -923,7 +923,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_nexus_drake_hatchlingAI(creature); } @@ -1269,7 +1269,7 @@ public: return true; } - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_thassarianAI(creature); } @@ -1304,7 +1304,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_image_lich_kingAI(creature); } @@ -1336,7 +1336,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_general_arlosAI(creature); } @@ -1454,7 +1454,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_counselor_talbotAI(creature); } @@ -1579,7 +1579,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_leryssaAI(creature); } @@ -1618,7 +1618,7 @@ public: void EnterCombat(Unit* who) { - if (me->canAttack(who)) + if (me->IsValidAttackTarget(who)) AttackStart(who); } @@ -1656,7 +1656,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_beryl_sorcererAI(creature); } @@ -1791,7 +1791,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_imprisoned_beryl_sorcererAI(creature); } @@ -1887,7 +1887,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_mootoo_the_youngerAI(creature); } @@ -1899,13 +1899,13 @@ public: enum Bonker_Togglevolt_Entries { - NPC_BONKER_TOGGLEVOLT =25589, - QUEST_GET_ME_OUTA_HERE =11673 + NPC_BONKER_TOGGLEVOLT = 25589, + QUEST_GET_ME_OUTA_HERE = 11673 }; enum Script_Texts_Bonker_Togglevolt { - SAY_bonker_1 =-1700002, - SAY_bonker_2 =-1700003 + SAY_bonker_1 = -1700002, + SAY_bonker_2 = -1700003 }; class npc_bonker_togglevolt : public CreatureScript @@ -1917,15 +1917,7 @@ public: { if (quest->GetQuestId() == QUEST_GET_ME_OUTA_HERE) { - switch (player->GetTeam()) - { - case ALLIANCE: - creature->setFaction(FACTION_ESCORTEE_A); - break; - case HORDE: - creature->setFaction(FACTION_ESCORTEE_H); - break; - } + creature->SetStandState(UNIT_STAND_STATE_STAND); DoScriptText(SAY_bonker_2, creature, player); CAST_AI(npc_escortAI, (creature->AI()))->Start(true, true, player->GetGUID()); } @@ -1939,8 +1931,8 @@ public: void Reset() { - Bonker_agro=0; - SetDespawnAtFar(false); + Bonker_agro=0; + SetDespawnAtFar(false); } void JustDied(Unit* /*killer*/) @@ -1972,15 +1964,15 @@ public: switch(i) { - case 29: - if (player) - player->GroupEventHappens(QUEST_GET_ME_OUTA_HERE, me); - break; + case 29: + if (player) + player->GroupEventHappens(QUEST_GET_ME_OUTA_HERE, me); + break; } } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_bonker_togglevoltAI(creature); } @@ -2096,7 +2088,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_trapped_mammoth_calfAI(creature); } @@ -2138,7 +2130,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_magmoth_crusherAI(creature); } @@ -2188,7 +2180,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_seaforium_depth_chargeAI(creature); } @@ -2240,7 +2232,7 @@ public: }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_valiance_keep_cannoneerAI(creature); } @@ -2345,7 +2337,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_warmage_coldarraAI(creature); } diff --git a/src/server/scripts/Northrend/crystalsong_forest.cpp b/src/server/scripts/Northrend/crystalsong_forest.cpp index a35e4781971..22b72586e37 100644 --- a/src/server/scripts/Northrend/crystalsong_forest.cpp +++ b/src/server/scripts/Northrend/crystalsong_forest.cpp @@ -98,7 +98,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_warmage_violetstandAI(creature); } diff --git a/src/server/scripts/Northrend/dalaran.cpp b/src/server/scripts/Northrend/dalaran.cpp index 4854261aeae..be9e9308f4f 100644 --- a/src/server/scripts/Northrend/dalaran.cpp +++ b/src/server/scripts/Northrend/dalaran.cpp @@ -108,7 +108,7 @@ public: void UpdateAI(const uint32 /*diff*/){} }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_mageguard_dalaranAI(creature); } diff --git a/src/server/scripts/Northrend/grizzly_hills.cpp b/src/server/scripts/Northrend/grizzly_hills.cpp index 877b649e630..d7b90fc4a44 100644 --- a/src/server/scripts/Northrend/grizzly_hills.cpp +++ b/src/server/scripts/Northrend/grizzly_hills.cpp @@ -325,7 +325,7 @@ public: return true; } - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_emilyAI(creature); } @@ -376,7 +376,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_mrfloppyAI(creature); } @@ -440,7 +440,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_outhouse_bunnyAI(creature); } @@ -484,7 +484,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_tallhorn_stagAI(creature); } @@ -550,7 +550,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_amberpine_woodsmanAI(creature); } @@ -594,7 +594,7 @@ public: me->DespawnOrUnsummon(DespawnTimer); } - void SpellHit(Unit* caster, const SpellInfo *spell) + void SpellHit(Unit* caster, const SpellInfo* spell) { if (spell->Id == SPELL_RENEW_SKIRMISHER && caster->GetTypeId() == TYPEID_PLAYER && caster->ToPlayer()->GetQuestStatus(12288) == QUEST_STATUS_INCOMPLETE) @@ -620,7 +620,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_wounded_skirmisherAI(creature); } @@ -643,7 +643,7 @@ class npc_lightning_sentry : public CreatureScript public: npc_lightning_sentry() : CreatureScript("npc_lightning_sentry") { } - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_lightning_sentryAI(creature); } @@ -710,7 +710,7 @@ class npc_venture_co_straggler : public CreatureScript public: npc_venture_co_straggler() : CreatureScript("npc_venture_co_straggler") { } - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_venture_co_stragglerAI(creature); } @@ -784,7 +784,7 @@ public: DoMeleeAttackIfReady(); } - void SpellHit(Unit* pCaster, const SpellInfo *pSpell) + void SpellHit(Unit* pCaster, const SpellInfo* pSpell) { if (pCaster && pCaster->GetTypeId() == TYPEID_PLAYER && pSpell->Id == SPELL_SMOKE_BOMB) { diff --git a/src/server/scripts/Northrend/howling_fjord.cpp b/src/server/scripts/Northrend/howling_fjord.cpp index 33884dc0cb6..1fceeb0303d 100644 --- a/src/server/scripts/Northrend/howling_fjord.cpp +++ b/src/server/scripts/Northrend/howling_fjord.cpp @@ -147,7 +147,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_Apothecary_HanesAI(creature); } @@ -196,7 +196,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_plaguehound_trackerAI(creature); } @@ -421,7 +421,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_daegarnAI(creature); } diff --git a/src/server/scripts/Northrend/icecrown.cpp b/src/server/scripts/Northrend/icecrown.cpp index dc55c2f6ad3..9ca2a2a5349 100644 --- a/src/server/scripts/Northrend/icecrown.cpp +++ b/src/server/scripts/Northrend/icecrown.cpp @@ -269,7 +269,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_argent_valiantAI(creature); } @@ -328,7 +328,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_alorah_and_grimminAI(creature); } @@ -375,7 +375,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_guardian_pavilionAI(creature); } @@ -420,7 +420,7 @@ public: } }; - CreatureAI *GetAI(Creature *creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_vereth_the_cunningAI(creature); } diff --git a/src/server/scripts/Northrend/sholazar_basin.cpp b/src/server/scripts/Northrend/sholazar_basin.cpp index ebdaded0ba0..dc0b3c0e032 100644 --- a/src/server/scripts/Northrend/sholazar_basin.cpp +++ b/src/server/scripts/Northrend/sholazar_basin.cpp @@ -161,7 +161,7 @@ public: return false; } - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_injured_rainspeaker_oracleAI(creature); } @@ -323,7 +323,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_bushwhackerAI(creature); } @@ -428,7 +428,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_engineer_heliceAI(creature); } @@ -587,7 +587,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_jungle_punch_targetAI(creature); } @@ -624,7 +624,7 @@ class npc_adventurous_dwarf : public CreatureScript public: npc_adventurous_dwarf() : CreatureScript("npc_adventurous_dwarf") { } - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { DoScriptText(SAY_DWARF_OUCH, creature); return NULL; diff --git a/src/server/scripts/Northrend/storm_peaks.cpp b/src/server/scripts/Northrend/storm_peaks.cpp index 0fedf101a9c..fdd9c626ac1 100644 --- a/src/server/scripts/Northrend/storm_peaks.cpp +++ b/src/server/scripts/Northrend/storm_peaks.cpp @@ -47,7 +47,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_agnetta_tyrsdottarAI(creature); } @@ -223,7 +223,7 @@ public: }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_goblin_prisonerAI(creature); } @@ -320,7 +320,7 @@ public: return true; } - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_victorious_challengerAI(creature); } @@ -446,7 +446,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_injured_goblinAI(creature); } @@ -466,7 +466,7 @@ public: return true; } - bool OnQuestAccept(Player* /*player*/, Creature* creature, Quest const *quest) + bool OnQuestAccept(Player* /*player*/, Creature* creature, Quest const* quest) { if (quest->GetQuestId() == QUEST_BITTER_DEPARTURE) DoScriptText(SAY_QUEST_ACCEPT, creature); @@ -558,7 +558,7 @@ public: { npc_brunnhildar_prisonerAI(Creature* creature) : ScriptedAI(creature) {} - Unit* drake; + uint64 drakeGUID; uint16 enter_timer; bool hasEmptySeats; @@ -566,14 +566,25 @@ public: { me->CastSpell(me, SPELL_ICE_PRISON, true); enter_timer = 0; - drake = NULL; + drakeGUID = 0; hasEmptySeats = false; } void UpdateAI(const uint32 diff) { + //TODO: not good script + if (!drakeGUID) + return; + + Creature* drake = Unit::GetCreature(*me, drakeGUID); + if (!drake) + { + drakeGUID = 0; + return; + } + // drake unsummoned, passengers dropped - if (drake && !me->IsOnVehicle(drake) && !hasEmptySeats) + if (!me->IsOnVehicle(drake) && !hasEmptySeats) me->ForcedDespawn(3000); if (enter_timer <= 0) @@ -593,9 +604,16 @@ public: void MoveInLineOfSight(Unit* unit) { - if (!unit || !drake) + if (!unit || !drakeGUID) return; + Creature* drake = Unit::GetCreature(*me, drakeGUID); + if (!drake) + { + drakeGUID = 0; + return; + } + if (!me->IsOnVehicle(drake) && !me->HasAura(SPELL_ICE_PRISON)) { if (unit->IsVehicle() && me->IsWithinDist(unit, 25.0f, true) && unit->ToCreature() && unit->ToCreature()->GetEntry() == 29709) @@ -651,7 +669,7 @@ public: enter_timer = 500; if (hitter->IsVehicle()) - drake = hitter; + drakeGUID = hitter->GetGUID(); else return; @@ -660,7 +678,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_brunnhildar_prisonerAI(creature); } diff --git a/src/server/scripts/Northrend/zuldrak.cpp b/src/server/scripts/Northrend/zuldrak.cpp index 16567be9636..6667a7751e1 100644 --- a/src/server/scripts/Northrend/zuldrak.cpp +++ b/src/server/scripts/Northrend/zuldrak.cpp @@ -102,7 +102,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_drakuru_shacklesAI(creature); } @@ -184,7 +184,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_captured_rageclawAI(creature); } @@ -554,7 +554,7 @@ public: return false; } - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_gurgthockAI(creature); } @@ -696,7 +696,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_orinoko_tuskbreakerAI(creature); } @@ -794,7 +794,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_korrak_bloodragerAI(creature); } @@ -836,8 +836,8 @@ public: if (me->getVictim()->GetPositionZ() >= 286.276f) { - std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + 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())) { @@ -886,7 +886,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_yggdrasAI(creature); } @@ -958,8 +958,8 @@ public: { if (victim->GetPositionZ() >= 286.276f) { - std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + 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())) { @@ -1019,7 +1019,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_stinkbeardAI(creature); } @@ -1103,8 +1103,8 @@ public: if (me->getVictim()->GetPositionZ() >= 286.276f) { - std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + 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())) { @@ -1164,7 +1164,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_elemental_lordAI(creature); } @@ -1229,7 +1229,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_fiend_elementalAI(creature); } @@ -1263,7 +1263,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_released_offspring_harkoaAI(creature); } @@ -1351,7 +1351,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_crusade_recruitAI(creature); } diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp index 7fc24a75d61..2cfedc14b14 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.cpp @@ -28,7 +28,7 @@ #include "GossipDef.h" #include "ScriptPCH.h" -OPvPCapturePointEP_EWT::OPvPCapturePointEP_EWT(OutdoorPvP *pvp) +OPvPCapturePointEP_EWT::OPvPCapturePointEP_EWT(OutdoorPvP* pvp) : OPvPCapturePoint(pvp), m_TowerState(EP_TS_N), m_UnitsSummonedSide(0) { SetCapturePointData(EPCapturePoints[EP_EWT].entry, EPCapturePoints[EP_EWT].map, EPCapturePoints[EP_EWT].x, EPCapturePoints[EP_EWT].y, EPCapturePoints[EP_EWT].z, EPCapturePoints[EP_EWT].o, EPCapturePoints[EP_EWT].rot0, EPCapturePoints[EP_EWT].rot1, EPCapturePoints[EP_EWT].rot2, EPCapturePoints[EP_EWT].rot3); @@ -41,12 +41,12 @@ void OPvPCapturePointEP_EWT::ChangeState() if ( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State ) { sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOSE_EWT_A)); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = 0; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_EWT, 0); } else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State ) { sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOSE_EWT_H)); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = 0; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_EWT, 0); } uint32 artkit = 21; @@ -57,14 +57,14 @@ void OPvPCapturePointEP_EWT::ChangeState() m_TowerState = EP_TS_A; artkit = 2; SummonSupportUnitAtNorthpassTower(ALLIANCE); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = ALLIANCE; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_EWT, ALLIANCE); if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_A)); break; case OBJECTIVESTATE_HORDE: m_TowerState = EP_TS_H; artkit = 1; SummonSupportUnitAtNorthpassTower(HORDE); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_EWT] = HORDE; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_EWT, HORDE); if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_EWT_H)); break; case OBJECTIVESTATE_NEUTRAL: @@ -166,7 +166,7 @@ void OPvPCapturePointEP_EWT::SummonSupportUnitAtNorthpassTower(uint32 team) } // NPT -OPvPCapturePointEP_NPT::OPvPCapturePointEP_NPT(OutdoorPvP *pvp) +OPvPCapturePointEP_NPT::OPvPCapturePointEP_NPT(OutdoorPvP* pvp) : OPvPCapturePoint(pvp), m_TowerState(EP_TS_N), m_SummonedGOSide(0) { SetCapturePointData(EPCapturePoints[EP_NPT].entry, EPCapturePoints[EP_NPT].map, EPCapturePoints[EP_NPT].x, EPCapturePoints[EP_NPT].y, EPCapturePoints[EP_NPT].z, EPCapturePoints[EP_NPT].o, EPCapturePoints[EP_NPT].rot0, EPCapturePoints[EP_NPT].rot1, EPCapturePoints[EP_NPT].rot2, EPCapturePoints[EP_NPT].rot3); @@ -179,12 +179,12 @@ void OPvPCapturePointEP_NPT::ChangeState() if ( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State ) { sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOSE_NPT_A)); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = 0; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, 0); } else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State ) { sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOSE_NPT_H)); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = 0; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, 0); } uint32 artkit = 21; @@ -195,14 +195,14 @@ void OPvPCapturePointEP_NPT::ChangeState() m_TowerState = EP_TS_A; artkit = 2; SummonGO(ALLIANCE); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = ALLIANCE; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, ALLIANCE); if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_A)); break; case OBJECTIVESTATE_HORDE: m_TowerState = EP_TS_H; artkit = 1; SummonGO(HORDE); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_NPT] = HORDE; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_NPT, HORDE); if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_NPT_H)); break; case OBJECTIVESTATE_NEUTRAL: @@ -309,7 +309,7 @@ void OPvPCapturePointEP_NPT::SummonGO(uint32 team) } // CGT -OPvPCapturePointEP_CGT::OPvPCapturePointEP_CGT(OutdoorPvP *pvp) +OPvPCapturePointEP_CGT::OPvPCapturePointEP_CGT(OutdoorPvP* pvp) : OPvPCapturePoint(pvp), m_TowerState(EP_TS_N), m_GraveyardSide(0) { SetCapturePointData(EPCapturePoints[EP_CGT].entry, EPCapturePoints[EP_CGT].map, EPCapturePoints[EP_CGT].x, EPCapturePoints[EP_CGT].y, EPCapturePoints[EP_CGT].z, EPCapturePoints[EP_CGT].o, EPCapturePoints[EP_CGT].rot0, EPCapturePoints[EP_CGT].rot1, EPCapturePoints[EP_CGT].rot2, EPCapturePoints[EP_CGT].rot3); @@ -322,12 +322,12 @@ void OPvPCapturePointEP_CGT::ChangeState() if( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State ) { sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOSE_CGT_A)); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = 0; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_CGT, 0); } else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State ) { sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOSE_CGT_H)); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = 0; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_CGT, 0); } uint32 artkit = 21; @@ -338,14 +338,14 @@ void OPvPCapturePointEP_CGT::ChangeState() m_TowerState = EP_TS_A; artkit = 2; LinkGraveYard(ALLIANCE); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = ALLIANCE; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_CGT, ALLIANCE); if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_A)); break; case OBJECTIVESTATE_HORDE: m_TowerState = EP_TS_H; artkit = 1; LinkGraveYard(HORDE); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_CGT] = HORDE; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_CGT, HORDE); if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_CGT_H)); break; case OBJECTIVESTATE_NEUTRAL: @@ -438,7 +438,7 @@ void OPvPCapturePointEP_CGT::LinkGraveYard(uint32 team) } // PWT -OPvPCapturePointEP_PWT::OPvPCapturePointEP_PWT(OutdoorPvP *pvp) +OPvPCapturePointEP_PWT::OPvPCapturePointEP_PWT(OutdoorPvP* pvp) : OPvPCapturePoint(pvp), m_FlightMasterSpawned(0), m_TowerState(EP_TS_N) { SetCapturePointData(EPCapturePoints[EP_PWT].entry, EPCapturePoints[EP_PWT].map, EPCapturePoints[EP_PWT].x, EPCapturePoints[EP_PWT].y, EPCapturePoints[EP_PWT].z, EPCapturePoints[EP_PWT].o, EPCapturePoints[EP_PWT].rot0, EPCapturePoints[EP_PWT].rot1, EPCapturePoints[EP_PWT].rot2, EPCapturePoints[EP_PWT].rot3); @@ -451,12 +451,12 @@ void OPvPCapturePointEP_PWT::ChangeState() if ( m_OldState == OBJECTIVESTATE_ALLIANCE && m_OldState != m_State ) { sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOSE_PWT_A)); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = 0; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, 0); } else if ( m_OldState == OBJECTIVESTATE_HORDE && m_OldState != m_State ) { sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_LOSE_PWT_H)); - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = 0; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, 0); } uint32 artkit = 21; @@ -467,14 +467,14 @@ void OPvPCapturePointEP_PWT::ChangeState() m_TowerState = EP_TS_A; SummonFlightMaster(ALLIANCE); artkit = 2; - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = ALLIANCE; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, ALLIANCE); if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_A)); break; case OBJECTIVESTATE_HORDE: m_TowerState = EP_TS_H; SummonFlightMaster(HORDE); artkit = 1; - ((OutdoorPvPEP*)m_PvP)->EP_Controls[EP_PWT] = HORDE; + ((OutdoorPvPEP*)m_PvP)->SetControlledState(EP_PWT, HORDE); if (m_OldState != m_State) sWorld->SendZoneText(EP_GraveYardZone, sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_EP_CAPTURE_PWT_H)); break; case OBJECTIVESTATE_NEUTRAL: @@ -714,6 +714,11 @@ void OutdoorPvPEP::BuffTeams() } } +void OutdoorPvPEP::SetControlledState(uint32 index, uint32 state) +{ + EP_Controls[index] = state; +} + void OutdoorPvPEP::FillInitialWorldStates(WorldPacket & data) { data << EP_UI_TOWER_COUNT_A << m_AllianceTowersControlled; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h index f196e65725c..01da001a990 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPEP.h @@ -184,11 +184,9 @@ class OutdoorPvPEP; class OPvPCapturePointEP_EWT : public OPvPCapturePoint { - friend class OutdoorPvPEP; - public: - OPvPCapturePointEP_EWT(OutdoorPvP * pvp); + OPvPCapturePointEP_EWT(OutdoorPvP* pvp); void ChangeState(); @@ -215,11 +213,9 @@ class OPvPCapturePointEP_EWT : public OPvPCapturePoint class OPvPCapturePointEP_NPT : public OPvPCapturePoint { - friend class OutdoorPvPEP; - public: - OPvPCapturePointEP_NPT(OutdoorPvP * pvp); + OPvPCapturePointEP_NPT(OutdoorPvP* pvp); void ChangeState(); @@ -246,11 +242,9 @@ class OPvPCapturePointEP_NPT : public OPvPCapturePoint class OPvPCapturePointEP_CGT : public OPvPCapturePoint { - friend class OutdoorPvPEP; - public: - OPvPCapturePointEP_CGT(OutdoorPvP * pvp); + OPvPCapturePointEP_CGT(OutdoorPvP* pvp); void ChangeState(); @@ -277,11 +271,9 @@ class OPvPCapturePointEP_CGT : public OPvPCapturePoint class OPvPCapturePointEP_PWT : public OPvPCapturePoint { - friend class OutdoorPvPEP; - public: - OPvPCapturePointEP_PWT(OutdoorPvP * pvp); + OPvPCapturePointEP_PWT(OutdoorPvP* pvp); void ChangeState(); @@ -308,11 +300,6 @@ class OPvPCapturePointEP_PWT : public OPvPCapturePoint class OutdoorPvPEP : public OutdoorPvP { - friend class OPvPCapturePointEP_EWT; - friend class OPvPCapturePointEP_NPT; - friend class OPvPCapturePointEP_PWT; - friend class OPvPCapturePointEP_CGT; - public: OutdoorPvPEP(); @@ -330,6 +317,8 @@ class OutdoorPvPEP : public OutdoorPvP void BuffTeams(); + void SetControlledState(uint32 index, uint32 state); + private: // how many towers are controlled diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp index 2d26ab80e5c..343027a02c8 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.cpp @@ -33,7 +33,7 @@ const uint32 HP_LANG_CAPTURE_A[HP_TOWER_NUM] = {LANG_OPVP_HP_CAPTURE_BROKENHILL_ const uint32 HP_LANG_CAPTURE_H[HP_TOWER_NUM] = {LANG_OPVP_HP_CAPTURE_BROKENHILL_H, LANG_OPVP_HP_CAPTURE_OVERLOOK_H, LANG_OPVP_HP_CAPTURE_STADIUM_H}; -OPvPCapturePointHP::OPvPCapturePointHP(OutdoorPvP *pvp, OutdoorPvPHPTowerType type) +OPvPCapturePointHP::OPvPCapturePointHP(OutdoorPvP* pvp, OutdoorPvPHPTowerType type) : OPvPCapturePoint(pvp), m_TowerType(type) { SetCapturePointData(HPCapturePoints[type].entry, @@ -173,14 +173,14 @@ void OPvPCapturePointHP::ChangeState() break; case OBJECTIVESTATE_ALLIANCE: field = HP_MAP_A[m_TowerType]; - if (((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled) - ((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled--; + if (uint32 alliance_towers = ((OutdoorPvPHP*)m_PvP)->GetAllianceTowersControlled()) + ((OutdoorPvPHP*)m_PvP)->SetAllianceTowersControlled(--alliance_towers); sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(HP_LANG_LOSE_A[m_TowerType])); break; case OBJECTIVESTATE_HORDE: field = HP_MAP_H[m_TowerType]; - if (((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled) - ((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled--; + if (uint32 horde_towers = ((OutdoorPvPHP*)m_PvP)->GetHordeTowersControlled()) + ((OutdoorPvPHP*)m_PvP)->SetHordeTowersControlled(--horde_towers); sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(HP_LANG_LOSE_H[m_TowerType])); break; case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: @@ -211,21 +211,27 @@ void OPvPCapturePointHP::ChangeState() field = HP_MAP_N[m_TowerType]; break; case OBJECTIVESTATE_ALLIANCE: + { field = HP_MAP_A[m_TowerType]; artkit = 2; artkit2 = HP_TowerArtKit_A[m_TowerType]; - if (((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled<3) - ((OutdoorPvPHP*)m_PvP)->m_AllianceTowersControlled++; + uint32 alliance_towers = ((OutdoorPvPHP*)m_PvP)->GetAllianceTowersControlled(); + if (alliance_towers < 3) + ((OutdoorPvPHP*)m_PvP)->SetAllianceTowersControlled(++alliance_towers); sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(HP_LANG_CAPTURE_A[m_TowerType])); break; + } case OBJECTIVESTATE_HORDE: + { field = HP_MAP_H[m_TowerType]; artkit = 1; artkit2 = HP_TowerArtKit_H[m_TowerType]; - if (((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled<3) - ((OutdoorPvPHP*)m_PvP)->m_HordeTowersControlled++; + uint32 horde_towers = ((OutdoorPvPHP*)m_PvP)->GetHordeTowersControlled(); + if (horde_towers < 3) + ((OutdoorPvPHP*)m_PvP)->SetHordeTowersControlled(++horde_towers); sWorld->SendZoneText(OutdoorPvPHPBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(HP_LANG_CAPTURE_H[m_TowerType])); break; + } case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: field = HP_MAP_N[m_TowerType]; break; @@ -331,6 +337,26 @@ void OutdoorPvPHP::HandleKillImpl(Player* player, Unit* killed) player->CastSpell(player, HordePlayerKillReward, true); } +uint32 OutdoorPvPHP::GetAllianceTowersControlled() const +{ + return m_AllianceTowersControlled; +} + +void OutdoorPvPHP::SetAllianceTowersControlled(uint32 count) +{ + m_AllianceTowersControlled = count; +} + +uint32 OutdoorPvPHP::GetHordeTowersControlled() const +{ + return m_HordeTowersControlled; +} + +void OutdoorPvPHP::SetHordeTowersControlled(uint32 count) +{ + m_HordeTowersControlled = count; +} + class OutdoorPvP_hellfire_peninsula : public OutdoorPvPScript { public: diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h index da18f639ba1..9f494b748be 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPHP.h @@ -89,7 +89,7 @@ class OPvPCapturePointHP : public OPvPCapturePoint { public: - OPvPCapturePointHP(OutdoorPvP * pvp, OutdoorPvPHPTowerType type); + OPvPCapturePointHP(OutdoorPvP* pvp, OutdoorPvPHPTowerType type); void ChangeState(); @@ -108,8 +108,6 @@ class OPvPCapturePointHP : public OPvPCapturePoint class OutdoorPvPHP : public OutdoorPvP { - friend class OPvPCapturePointHP; - public: OutdoorPvPHP(); @@ -127,6 +125,12 @@ class OutdoorPvPHP : public OutdoorPvP void HandleKillImpl(Player* player, Unit* killed); + uint32 GetAllianceTowersControlled() const; + void SetAllianceTowersControlled(uint32 count); + + uint32 GetHordeTowersControlled() const; + void SetHordeTowersControlled(uint32 count); + private: // how many towers are controlled diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp index 03b50f77a50..17a5e9940be 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.cpp @@ -63,14 +63,10 @@ uint32 OPvPCapturePointNA::GetAliveGuardsCount() case NA_NPC_GUARD_13: case NA_NPC_GUARD_14: case NA_NPC_GUARD_15: - { - if (Creature* cr = HashMapHolder<Creature>::Find(itr->second)) - { + if (Creature const* const cr = HashMapHolder<Creature>::Find(itr->second)) if (cr->isAlive()) ++cnt; - } - } - break; + break; default: break; } @@ -78,6 +74,11 @@ uint32 OPvPCapturePointNA::GetAliveGuardsCount() return cnt; } +uint32 OPvPCapturePointNA::GetControllingFaction() const +{ + return m_ControllingFaction; +} + void OPvPCapturePointNA::SpawnNPCsForTeam(uint32 team) { const creature_type * creatures = NULL; @@ -197,7 +198,7 @@ void OPvPCapturePointNA::HandlePlayerLeave(Player* player) OPvPCapturePoint::HandlePlayerLeave(player); } -OPvPCapturePointNA::OPvPCapturePointNA(OutdoorPvP *pvp) : +OPvPCapturePointNA::OPvPCapturePointNA(OutdoorPvP* pvp) : OPvPCapturePoint(pvp), m_capturable(true), m_GuardsAlive(0), m_ControllingFaction(0), m_WyvernStateNorth(0), m_WyvernStateSouth(0), m_WyvernStateEast(0), m_WyvernStateWest(0), m_HalaaState(HALAA_N), m_RespawnTimer(NA_RESPAWN_TIME), m_GuardCheckTimer(NA_GUARD_CHECK_TIME) @@ -223,7 +224,7 @@ bool OutdoorPvPNA::SetupOutdoorPvP() void OutdoorPvPNA::HandlePlayerEnterZone(Player* player, uint32 zone) { // add buffs - if (player->GetTeam() == m_obj->m_ControllingFaction) + if (player->GetTeam() == m_obj->GetControllingFaction()) player->CastSpell(player, NA_CAPTURE_BUFF, true); OutdoorPvP::HandlePlayerEnterZone(player, zone); } diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h index 7ddb47ac437..3a322bbaba0 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPNA.h @@ -252,11 +252,9 @@ class OutdoorPvPNA; class OPvPCapturePointNA : public OPvPCapturePoint { - friend class OutdoorPvPNA; - public: - OPvPCapturePointNA(OutdoorPvP * pvp); + OPvPCapturePointNA(OutdoorPvP* pvp); bool Update(uint32 diff); @@ -275,6 +273,7 @@ class OPvPCapturePointNA : public OPvPCapturePoint int32 HandleOpenGo(Player* player, uint64 guid); uint32 GetAliveGuardsCount(); + uint32 GetControllingFaction() const; protected: @@ -312,8 +311,6 @@ class OPvPCapturePointNA : public OPvPCapturePoint class OutdoorPvPNA : public OutdoorPvP { - friend class OPvPCapturePointNA; - public: OutdoorPvPNA(); diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp index 73c94a0d593..88a820f4492 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPSI.cpp @@ -156,7 +156,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId) { // he dropped it further, summon mound GameObject* go = new GameObject; - Map * map = player->GetMap(); + Map* map = player->GetMap(); if (!map) { delete go; @@ -186,7 +186,7 @@ bool OutdoorPvPSI::HandleDropFlag(Player* player, uint32 spellId) { // he dropped it further, summon mound GameObject* go = new GameObject; - Map * map = player->GetMap(); + Map* map = player->GetMap(); if (!map) { delete go; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp index 666df2360c5..6b9c0500fc4 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.cpp @@ -30,7 +30,7 @@ OutdoorPvPTF::OutdoorPvPTF() m_TypeId = OUTDOOR_PVP_TF; } -OPvPCapturePointTF::OPvPCapturePointTF(OutdoorPvP *pvp, OutdoorPvPTF_TowerType type) +OPvPCapturePointTF::OPvPCapturePointTF(OutdoorPvP* pvp, OutdoorPvPTF_TowerType type) : OPvPCapturePoint(pvp), m_TowerType(type), m_TowerState(TF_TOWERSTATE_N) { SetCapturePointData(TFCapturePoints[type].entry, TFCapturePoints[type].map, TFCapturePoints[type].x, TFCapturePoints[type].y, TFCapturePoints[type].z, TFCapturePoints[type].o, TFCapturePoints[type].rot0, TFCapturePoints[type].rot1, TFCapturePoints[type].rot2, TFCapturePoints[type].rot3); @@ -208,6 +208,31 @@ void OutdoorPvPTF::HandlePlayerLeaveZone(Player* player, uint32 zone) OutdoorPvP::HandlePlayerLeaveZone(player, zone); } +uint32 OutdoorPvPTF::GetAllianceTowersControlled() const +{ + return m_AllianceTowersControlled; +} + +void OutdoorPvPTF::SetAllianceTowersControlled(uint32 count) +{ + m_AllianceTowersControlled = count; +} + +uint32 OutdoorPvPTF::GetHordeTowersControlled() const +{ + return m_HordeTowersControlled; +} + +void OutdoorPvPTF::SetHordeTowersControlled(uint32 count) +{ + m_HordeTowersControlled = count; +} + +bool OutdoorPvPTF::IsLocked() const +{ + return m_IsLocked; +} + bool OutdoorPvPTF::SetupOutdoorPvP() { m_AllianceTowersControlled = 0; @@ -236,10 +261,10 @@ bool OutdoorPvPTF::SetupOutdoorPvP() bool OPvPCapturePointTF::Update(uint32 diff) { // can update even in locked state if gathers the controlling faction - bool canupdate = ((((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled > 0) && m_activePlayers[0].size() > m_activePlayers[1].size()) || - ((((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled > 0) && m_activePlayers[0].size() < m_activePlayers[1].size()); + bool canupdate = ((((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled() > 0) && m_activePlayers[0].size() > m_activePlayers[1].size()) || + ((((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled() > 0) && m_activePlayers[0].size() < m_activePlayers[1].size()); // if gathers the other faction, then only update if the pvp is unlocked - canupdate = canupdate || !((OutdoorPvPTF*)m_PvP)->m_IsLocked; + canupdate = canupdate || !((OutdoorPvPTF*)m_PvP)->IsLocked(); return canupdate && OPvPCapturePoint::Update(diff); } @@ -248,15 +273,15 @@ void OPvPCapturePointTF::ChangeState() // if changing from controlling alliance to horde if (m_OldState == OBJECTIVESTATE_ALLIANCE) { - if (((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled) - ((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled--; + if (uint32 alliance_towers = ((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled()) + ((OutdoorPvPTF*)m_PvP)->SetAllianceTowersControlled(--alliance_towers); sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_TF_LOSE_A)); } // if changing from controlling horde to alliance else if (m_OldState == OBJECTIVESTATE_HORDE) { - if (((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled) - ((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled--; + if (uint32 horde_towers = ((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled()) + ((OutdoorPvPTF*)m_PvP)->SetHordeTowersControlled(--horde_towers); sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_TF_LOSE_H)); } @@ -265,23 +290,29 @@ void OPvPCapturePointTF::ChangeState() switch(m_State) { case OBJECTIVESTATE_ALLIANCE: + { m_TowerState = TF_TOWERSTATE_A; artkit = 2; - if (((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled<TF_TOWER_NUM) - ((OutdoorPvPTF*)m_PvP)->m_AllianceTowersControlled++; + uint32 alliance_towers = ((OutdoorPvPTF*)m_PvP)->GetAllianceTowersControlled(); + if (alliance_towers < TF_TOWER_NUM) + ((OutdoorPvPTF*)m_PvP)->SetAllianceTowersControlled(++alliance_towers); sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_A)); for (PlayerSet::iterator itr = m_activePlayers[0].begin(); itr != m_activePlayers[0].end(); ++itr) (*itr)->AreaExploredOrEventHappens(TF_ALLY_QUEST); break; + } case OBJECTIVESTATE_HORDE: + { m_TowerState = TF_TOWERSTATE_H; artkit = 1; - if (((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled<TF_TOWER_NUM) - ((OutdoorPvPTF*)m_PvP)->m_HordeTowersControlled++; + uint32 horde_towers = ((OutdoorPvPTF*)m_PvP)->GetHordeTowersControlled(); + if (horde_towers < TF_TOWER_NUM) + ((OutdoorPvPTF*)m_PvP)->SetHordeTowersControlled(++horde_towers); sWorld->SendZoneText(OutdoorPvPTFBuffZones[0], sObjectMgr->GetTrinityStringForDBCLocale(LANG_OPVP_TF_CAPTURE_H)); for (PlayerSet::iterator itr = m_activePlayers[1].begin(); itr != m_activePlayers[1].end(); ++itr) (*itr)->AreaExploredOrEventHappens(TF_HORDE_QUEST); break; + } case OBJECTIVESTATE_NEUTRAL: case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h index f8257e490f6..642f45090a9 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPTF.h @@ -125,7 +125,7 @@ class OPvPCapturePointTF : public OPvPCapturePoint { public: - OPvPCapturePointTF(OutdoorPvP * pvp, OutdoorPvPTF_TowerType type); + OPvPCapturePointTF(OutdoorPvP* pvp, OutdoorPvPTF_TowerType type); bool Update(uint32 diff); @@ -150,8 +150,6 @@ class OPvPCapturePointTF : public OPvPCapturePoint class OutdoorPvPTF : public OutdoorPvP { - friend class OPvPCapturePointTF; - public: OutdoorPvPTF(); @@ -167,6 +165,14 @@ class OutdoorPvPTF : public OutdoorPvP void SendRemoveWorldStates(Player* player); + uint32 GetAllianceTowersControlled() const; + void SetAllianceTowersControlled(uint32 count); + + uint32 GetHordeTowersControlled() const; + void SetHordeTowersControlled(uint32 count); + + bool IsLocked() const; + private: bool m_IsLocked; diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp index 22811b84f75..2866a341903 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.cpp @@ -26,7 +26,7 @@ #include "World.h" #include "ScriptPCH.h" -OPvPCapturePointZM_Beacon::OPvPCapturePointZM_Beacon(OutdoorPvP *pvp, ZM_BeaconType type) +OPvPCapturePointZM_Beacon::OPvPCapturePointZM_Beacon(OutdoorPvP* pvp, ZM_BeaconType type) : OPvPCapturePoint(pvp), m_TowerType(type), m_TowerState(ZM_TOWERSTATE_N) { SetCapturePointData(ZMCapturePoints[type].entry, ZMCapturePoints[type].map, ZMCapturePoints[type].x, ZMCapturePoints[type].y, ZMCapturePoints[type].z, ZMCapturePoints[type].o, ZMCapturePoints[type].rot0, ZMCapturePoints[type].rot1, ZMCapturePoints[type].rot2, ZMCapturePoints[type].rot3); @@ -76,32 +76,38 @@ void OPvPCapturePointZM_Beacon::ChangeState() // if changing from controlling alliance to horde if (m_OldState == OBJECTIVESTATE_ALLIANCE) { - if (((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled) - ((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled--; + if (uint32 alliance_towers = ((OutdoorPvPZM*)m_PvP)->GetAllianceTowersControlled()) + ((OutdoorPvPZM*)m_PvP)->SetAllianceTowersControlled(--alliance_towers); sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetTrinityStringForDBCLocale(ZMBeaconLoseA[m_TowerType])); } // if changing from controlling horde to alliance else if (m_OldState == OBJECTIVESTATE_HORDE) { - if (((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled) - ((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled--; + if (uint32 horde_towers = ((OutdoorPvPZM*)m_PvP)->GetHordeTowersControlled()) + ((OutdoorPvPZM*)m_PvP)->SetHordeTowersControlled(--horde_towers); sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetTrinityStringForDBCLocale(ZMBeaconLoseH[m_TowerType])); } switch(m_State) { case OBJECTIVESTATE_ALLIANCE: + { m_TowerState = ZM_TOWERSTATE_A; - if (((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled<ZM_NUM_BEACONS) - ((OutdoorPvPZM*)m_PvP)->m_AllianceTowersControlled++; + uint32 alliance_towers = ((OutdoorPvPZM*)m_PvP)->GetAllianceTowersControlled(); + if (alliance_towers < ZM_NUM_BEACONS) + ((OutdoorPvPZM*)m_PvP)->SetAllianceTowersControlled(++alliance_towers); sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetTrinityStringForDBCLocale(ZMBeaconCaptureA[m_TowerType])); break; + } case OBJECTIVESTATE_HORDE: + { m_TowerState = ZM_TOWERSTATE_H; - if (((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled<ZM_NUM_BEACONS) - ((OutdoorPvPZM*)m_PvP)->m_HordeTowersControlled++; + uint32 horde_towers = ((OutdoorPvPZM*)m_PvP)->GetHordeTowersControlled(); + if (horde_towers < ZM_NUM_BEACONS) + ((OutdoorPvPZM*)m_PvP)->SetHordeTowersControlled(++horde_towers); sWorld->SendZoneText(ZM_GRAVEYARD_ZONE, sObjectMgr->GetTrinityStringForDBCLocale(ZMBeaconCaptureH[m_TowerType])); break; + } case OBJECTIVESTATE_NEUTRAL: case OBJECTIVESTATE_NEUTRAL_ALLIANCE_CHALLENGE: case OBJECTIVESTATE_NEUTRAL_HORDE_CHALLENGE: @@ -143,12 +149,12 @@ void OutdoorPvPZM::HandlePlayerEnterZone(Player* player, uint32 zone) { if (player->GetTeam() == ALLIANCE) { - if (m_GraveYard->m_GraveYardState & ZM_GRAVEYARD_A) + if (m_GraveYard->GetGraveYardState() & ZM_GRAVEYARD_A) player->CastSpell(player, ZM_CAPTURE_BUFF, true); } else { - if (m_GraveYard->m_GraveYardState & ZM_GRAVEYARD_H) + if (m_GraveYard->GetGraveYardState() & ZM_GRAVEYARD_H) player->CastSpell(player, ZM_CAPTURE_BUFF, true); } OutdoorPvP::HandlePlayerEnterZone(player, zone); @@ -244,7 +250,7 @@ int32 OPvPCapturePointZM_GraveYard::HandleOpenGo(Player* player, uint64 guid) return retval; } -OPvPCapturePointZM_GraveYard::OPvPCapturePointZM_GraveYard(OutdoorPvP *pvp) +OPvPCapturePointZM_GraveYard::OPvPCapturePointZM_GraveYard(OutdoorPvP* pvp) : OPvPCapturePoint(pvp) { m_BothControllingFaction = 0; @@ -382,6 +388,31 @@ bool OPvPCapturePointZM_GraveYard::HandleDropFlag(Player* /*player*/, uint32 spe return false; } +uint32 OPvPCapturePointZM_GraveYard::GetGraveYardState() const +{ + return m_GraveYardState; +} + +uint32 OutdoorPvPZM::GetAllianceTowersControlled() const +{ + return m_AllianceTowersControlled; +} + +void OutdoorPvPZM::SetAllianceTowersControlled(uint32 count) +{ + m_AllianceTowersControlled = count; +} + +uint32 OutdoorPvPZM::GetHordeTowersControlled() const +{ + return m_HordeTowersControlled; +} + +void OutdoorPvPZM::SetHordeTowersControlled(uint32 count) +{ + m_HordeTowersControlled = count; +} + void OutdoorPvPZM::FillInitialWorldStates(WorldPacket &data) { data << ZM_WORLDSTATE_UNK_1 << uint32(1); diff --git a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h index ed181f81bef..048ba04dc57 100755 --- a/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h +++ b/src/server/scripts/OutdoorPvP/OutdoorPvPZM.h @@ -168,11 +168,9 @@ class OutdoorPvPZM; class OPvPCapturePointZM_Beacon : public OPvPCapturePoint { - friend class OutdoorPvPZM; - public: - OPvPCapturePointZM_Beacon(OutdoorPvP * pvp, ZM_BeaconType type); + OPvPCapturePointZM_Beacon(OutdoorPvP* pvp, ZM_BeaconType type); void ChangeState(); @@ -201,11 +199,9 @@ enum ZM_GraveYardState class OPvPCapturePointZM_GraveYard : public OPvPCapturePoint { - friend class OutdoorPvPZM; - public: - OPvPCapturePointZM_GraveYard(OutdoorPvP * pvp); + OPvPCapturePointZM_GraveYard(OutdoorPvP* pvp); bool Update(uint32 diff); @@ -225,6 +221,8 @@ class OPvPCapturePointZM_GraveYard : public OPvPCapturePoint bool CanTalkTo(Player* player, Creature* c, GossipMenuItems const& gso); + uint32 GetGraveYardState() const; + private: uint32 m_GraveYardState; @@ -238,8 +236,6 @@ class OPvPCapturePointZM_GraveYard : public OPvPCapturePoint class OutdoorPvPZM : public OutdoorPvP { - friend class OPvPCapturePointZM_Beacon; - public: OutdoorPvPZM(); @@ -257,6 +253,12 @@ class OutdoorPvPZM : public OutdoorPvP void HandleKillImpl(Player* player, Unit* killed); + uint32 GetAllianceTowersControlled() const; + void SetAllianceTowersControlled(uint32 count); + + uint32 GetHordeTowersControlled() const; + void SetHordeTowersControlled(uint32 count); + private: OPvPCapturePointZM_GraveYard * m_GraveYard; diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp index bc1c4ee27b5..a77c0214730 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/boss_tailonking_ikiss.cpp @@ -93,7 +93,7 @@ public: void MoveInLineOfSight(Unit* who) { - if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)) && who->isInAccessiblePlaceFor(me)) + if (!me->getVictim() && me->canCreatureAttack(who)) { if (!Intro && me->IsWithinDistInMap(who, 100)) { diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp index d22dbd4b172..f5439918ce2 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_blackheart_the_inciter.cpp @@ -71,7 +71,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; bool InciteChaos; uint32 InciteChaos_Timer; @@ -133,12 +133,12 @@ public: { DoCast(me, SPELL_INCITE_CHAOS); - std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); + for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); if (target && target->GetTypeId() == TYPEID_PLAYER) - target->CastSpell(target, SPELL_INCITE_CHAOS_B, true); + me->CastSpell(target, SPELL_INCITE_CHAOS_B, true); } DoResetThreat(); diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp index 8f014956d77..df2693c7b86 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_grandmaster_vorpil.cpp @@ -153,7 +153,7 @@ public: Intro = false; } - InstanceScript *pInstance; + InstanceScript* pInstance; bool Intro, HelpYell; bool sumportals; @@ -254,7 +254,7 @@ public: { ScriptedAI::MoveInLineOfSight(who); - if (!Intro && me->IsWithinLOSInMap(who)&& me->IsWithinDistInMap(who, 100) && me->IsHostileTo(who)) + if (!Intro && me->IsWithinLOSInMap(who)&& me->IsWithinDistInMap(who, 100) && me->IsValidAttackTarget(who)) { DoScriptText(SAY_INTRO, me); Intro = true; diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp index cec706eda08..bd6539335c8 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/boss_murmur.cpp @@ -79,8 +79,8 @@ public: void SonicBoomEffect() { - std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); + for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); if (target && target->GetTypeId() == TYPEID_PLAYER) @@ -98,7 +98,7 @@ public: void EnterCombat(Unit* /*who*/) { } // Sonic Boom instant damage (needs core fix instead of this) - void SpellHitTarget(Unit* target, const SpellInfo *spell) + void SpellHitTarget(Unit* target, const SpellInfo* spell) { if (target && target->isAlive() && spell && spell->Id == uint32(SPELL_SONIC_BOOM_EFFECT)) me->DealDamage(target, (target->GetHealth()*90)/100, NULL, SPELL_DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NATURE, spell); diff --git a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp index b1f17c38737..66ef35f7400 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_bloodboil.cpp @@ -142,13 +142,13 @@ public: void CastBloodboil() { // Get the Threat List - std::list<HostileReference *> m_threatlist = me->getThreatManager().getThreatList(); + std::list<HostileReference*> m_threatlist = me->getThreatManager().getThreatList(); if (m_threatlist.empty()) // He doesn't have anyone in his threatlist, useless to continue return; - std::list<Unit* > targets; - std::list<HostileReference *>::const_iterator itr = m_threatlist.begin(); + std::list<Unit*> targets; + std::list<HostileReference*>::const_iterator itr = m_threatlist.begin(); for (; itr!= m_threatlist.end(); ++itr) //store the threat list in a different container { Unit* target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); @@ -163,10 +163,10 @@ public: targets.resize(5); //Aura each player in the targets list with Bloodboil. Aura code copied+pasted from Aura command in Level3.cpp - /*SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(SPELL_BLOODBOIL); + /*SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(SPELL_BLOODBOIL); if (spellInfo) { - for (std::list<Unit* >::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) + for (std::list<Unit*>::const_iterator itr = targets.begin(); itr != targets.end(); ++itr) { Unit* target = *itr; if (!target) return; @@ -176,7 +176,7 @@ public: if (eff >= TOTAL_SPELL_EFFECTS) continue; - Aura *Aur = new Aura(spellInfo, i, target, target, target); + Aura* Aur = new Aura(spellInfo, i, target, target, target); target->AddAura(Aur); } } diff --git a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp index 7b6a9e97687..308a6de4f0c 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_illidan.cpp @@ -454,7 +454,7 @@ public: }; -/************************************** Illidan's AI ***************************************/ +/************************************** Illidan's AI* **************************************/ class boss_illidan_stormrage : public CreatureScript { public: @@ -585,7 +585,7 @@ public: done_by->AddThreat(me, -(3*(float)damage)/4); // do not let maiev tank him } - void SpellHit(Unit* /*caster*/, const SpellInfo *spell) + void SpellHit(Unit* /*caster*/, const SpellInfo* spell) { if (spell->Id == SPELL_GLAIVE_RETURNS) // Re-equip our warblades! { @@ -1138,9 +1138,9 @@ public: }; -/********************************** End of Illidan AI ******************************************/ +/********************************** End of Illidan AI* *****************************************/ -/******* Functions and vars for Akama's AI ******/ +/******* Functions and vars for Akama's AI* *****/ class boss_maiev_shadowsong : public CreatureScript { public: @@ -2163,7 +2163,7 @@ public: { blade_of_azzinothAI(Creature* c) : NullCreatureAI(c) {} - void SpellHit(Unit* /*caster*/, const SpellInfo *spell) + void SpellHit(Unit* /*caster*/, const SpellInfo* spell) { if (spell->Id == SPELL_THROW_GLAIVE2 || spell->Id == SPELL_THROW_GLAIVE) me->SetDisplayId(21431);//appear when hit by Illidan's glaive 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 8b057949b2e..813deacf7a2 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_reliquary_of_souls.cpp @@ -536,7 +536,7 @@ public: } } - void SpellHit(Unit* /*caster*/, const SpellInfo *spell) + void SpellHit(Unit* /*caster*/, const SpellInfo* spell) { if (me->GetCurrentSpell(CURRENT_GENERIC_SPELL)) for (uint8 i = 0; i < 3; ++i) diff --git a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp index f346de0e859..0d3301ec29b 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_teron_gorefiend.cpp @@ -267,7 +267,7 @@ public: void MoveInLineOfSight(Unit* who) { - if (!Intro && who->GetTypeId() == TYPEID_PLAYER && who->isTargetableForAttack() && me->IsHostileTo(who) && who->isInAccessiblePlaceFor(me)) + if (!Intro && who->GetTypeId() == TYPEID_PLAYER && me->canCreatureAttack(who)) { if (me->IsWithinDistInMap(who, VISIBLE_RANGE) && me->IsWithinLOSInMap(who)) { diff --git a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp index 6f5dfba9a9c..080d26b7c49 100644 --- a/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp +++ b/src/server/scripts/Outland/BlackTemple/boss_warlord_najentus.cpp @@ -106,7 +106,7 @@ public: DoScriptText(SAY_DEATH, me); } - void SpellHit(Unit* /*caster*/, const SpellInfo *spell) + void SpellHit(Unit* /*caster*/, const SpellInfo* spell) { if (spell->Id == SPELL_HURL_SPINE && me->HasAura(SPELL_TIDAL_SHIELD)) { diff --git a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp index f4785d847a2..7d698559197 100644 --- a/src/server/scripts/Outland/BlackTemple/illidari_council.cpp +++ b/src/server/scripts/Outland/BlackTemple/illidari_council.cpp @@ -896,7 +896,7 @@ public: return sSpellMgr->GetSpellInfo(SPELL_REFLECTIVE_SHIELD_T); } - void Trigger(AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) + void Trigger(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) { Unit* target = GetTarget(); if (dmgInfo.GetAttacker() == target) @@ -911,7 +911,7 @@ public: } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_boss_lady_malande_shield_AuraScript(); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp index 9cd7dfc9af8..817c38fef2e 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lady_vashj.cpp @@ -153,7 +153,7 @@ public: c->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); //set it only once on Creature create (no need do intro if wiped) } - InstanceScript *pInstance; + InstanceScript* pInstance; uint64 ShieldGeneratorChannel[4]; @@ -282,7 +282,7 @@ public: if (!who || me->getVictim()) return; - if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me) && me->IsHostileTo(who)) + if (me->canCreatureAttack(who)) { float attackRadius = me->GetAttackDistance(who); if (me->IsWithinDistInMap(who, attackRadius) && me->GetDistanceZ(who) <= CREATURE_Z_ATTACK_RANGE && me->IsWithinLOSInMap(who)) @@ -451,8 +451,8 @@ public: { bool InMeleeRange = false; Unit* target; - std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); - for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); + for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); //if in melee range @@ -592,7 +592,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 move; uint32 phase; float x, y, z; @@ -694,7 +694,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 PoisonBolt_Timer; uint32 Despawn_Timer; @@ -770,7 +770,7 @@ public: EnterEvadeMode(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 movement_timer; uint32 ToxicSpore_Timer; @@ -927,7 +927,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 Check_Timer; bool Casted; void Reset() @@ -976,7 +976,7 @@ public: bool OnUse(Player* player, Item* /*_Item*/, SpellCastTargets const& targets) { - InstanceScript *pInstance = player->GetInstanceScript(); + InstanceScript* pInstance = player->GetInstanceScript(); if (!pInstance) { 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 d058f73cb04..f3da63af38b 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 @@ -180,7 +180,7 @@ public: SpellBinderGUID[i] = 0; } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 Whirlwind_Timer; uint32 ChaosBlast_Timer; @@ -253,7 +253,7 @@ public: if (me->HasAura(AURA_BANISH)) return; - if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)) && who->isInAccessiblePlaceFor(me)) + if (!me->getVictim() && me->canCreatureAttack(who)) { if (me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; @@ -507,16 +507,16 @@ public: //Summon Inner Demon if (InnerDemons_Timer <= diff) { - std::list<HostileReference *>& ThreatList = me->getThreatManager().getThreatList(); - std::vector<Unit* > TargetList; - for (std::list<HostileReference *>::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) + std::list<HostileReference*>& ThreatList = me->getThreatManager().getThreatList(); + std::vector<Unit*> TargetList; + for (std::list<HostileReference*>::const_iterator itr = ThreatList.begin(); itr != ThreatList.end(); ++itr) { Unit* tempTarget = Unit::GetUnit(*me, (*itr)->getUnitGuid()); if (tempTarget && tempTarget->GetTypeId() == TYPEID_PLAYER && tempTarget->GetGUID() != me->getVictim()->GetGUID() && TargetList.size()<5) TargetList.push_back(tempTarget); } - //SpellInfo *spell = GET_SPELL(SPELL_INSIDIOUS_WHISPER); - for (std::vector<Unit* >::const_iterator itr = TargetList.begin(); itr != TargetList.end(); ++itr) + //SpellInfo* spell = GET_SPELL(SPELL_INSIDIOUS_WHISPER); + for (std::vector<Unit*>::const_iterator itr = TargetList.begin(); itr != TargetList.end(); ++itr) { if ((*itr) && (*itr)->isAlive()) { @@ -680,7 +680,7 @@ public: AddedBanish = false; } - InstanceScript *pInstance; + InstanceScript* pInstance; uint64 leotherasGUID; diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp index d5d3d8a81ba..7f84ce504e7 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_lurker_below.cpp @@ -161,7 +161,7 @@ public: { if (!CanStartEvent)//boss is invisible, don't attack return; - if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who))) + if (!me->getVictim() && who->IsValidAttackTarget(me)) { float attackRadius = me->GetAttackDistance(who); if (me->IsWithinDistInMap(who, attackRadius)) @@ -424,7 +424,7 @@ public: { if (!who || me->getVictim()) return; - if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me) && me->IsHostileTo(who) && me->IsWithinDistInMap(who, 45)) + if (who->isInAccessiblePlaceFor(me) && me->IsValidAttackTarget(who) && me->IsWithinDistInMap(who, 45)) { AttackStart(who); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp index b2abb397dfe..a30b46c2346 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/boss_morogrim_tidewalker.cpp @@ -96,7 +96,7 @@ public: InstanceScript* pInstance; - Map::PlayerList const *PlayerList; + Map::PlayerList const* PlayerList; uint32 TidalWave_Timer; uint32 WateryGrave_Timer; @@ -316,7 +316,7 @@ public: if (!who || me->getVictim()) return; - if (who->isTargetableForAttack() && who->isInAccessiblePlaceFor(me) && me->IsHostileTo(who)) + if (me->canCreatureAttack(who)) { //no attack radius check - it attacks the first target that moves in his los //who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp index 4d5b3ecc86a..5ae358ba046 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_hydromancer_thespia.cpp @@ -63,7 +63,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 LightningCloud_Timer; uint32 LungBurst_Timer; diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp index 49c5df03ed8..602c9b33a24 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_mekgineer_steamrigger.cpp @@ -65,7 +65,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 Shrink_Timer; uint32 Saw_Blade_Timer; diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp index 83ae22222de..f9a477e58c5 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/boss_warlord_kalithresh.cpp @@ -59,7 +59,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; void Reset() { @@ -117,7 +117,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 Reflection_Timer; uint32 Impale_Timer; @@ -148,7 +148,7 @@ public: DoScriptText(RAND(SAY_SLAY1, SAY_SLAY2), me); } - void SpellHit(Unit* /*caster*/, const SpellInfo *spell) + void SpellHit(Unit* /*caster*/, const SpellInfo* spell) { //hack :( if (spell->Id == SPELL_WARLORDS_RAGE_PROC) diff --git a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp index 6479cdd3d6d..789d33a7a1b 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_gruul.cpp @@ -71,7 +71,7 @@ public: pInstance = c->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 m_uiGrowth_Timer; uint32 m_uiCaveIn_Timer; diff --git a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp index 03133b81e17..38c087889eb 100644 --- a/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp +++ b/src/server/scripts/Outland/GruulsLair/boss_high_king_maulgar.cpp @@ -438,7 +438,7 @@ class boss_kiggler_the_crazed : public CreatureScript public: boss_kiggler_the_crazed() : CreatureScript("boss_kiggler_the_crazed") { } - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new boss_kiggler_the_crazedAI (creature); } @@ -560,7 +560,7 @@ class boss_blindeye_the_seer : public CreatureScript public: boss_blindeye_the_seer() : CreatureScript("boss_blindeye_the_seer") { } - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new boss_blindeye_the_seerAI (creature); } @@ -670,7 +670,7 @@ class boss_krosh_firehand : public CreatureScript public: boss_krosh_firehand() : CreatureScript("boss_krosh_firehand") { } - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new boss_krosh_firehandAI (creature); } @@ -766,9 +766,9 @@ public: if (BlastWave_Timer <= diff) { Unit* target = NULL; - std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); - std::vector<Unit* > target_list; - for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); + std::vector<Unit*> target_list; + for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); //15 yard radius minimum diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp index 7558a10d7bf..23b2ed5ca2b 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/boss_kelidan_the_breaker.cpp @@ -249,7 +249,7 @@ class boss_kelidan_the_breaker : public CreatureScript if (SpellInfo const* nova = sSpellMgr->GetSpellInfo(SPELL_BURNING_NOVA)) { - if (Aura * aura = Aura::TryRefreshStackOrCreate(nova, MAX_EFFECT_MASK, me, me)) + if (Aura* aura = Aura::TryRefreshStackOrCreate(nova, MAX_EFFECT_MASK, me, me)) aura->ApplyForTargets(); } diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp index aad3eb1a544..6661bf2ee15 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_vazruden_the_herald.cpp @@ -95,7 +95,7 @@ class boss_nazan : public CreatureScript uint32 Turn_Timer; bool flight; uint64 VazrudenGUID; - SpellInfo *liquid_fire; + SpellInfo* liquid_fire; void Reset() { diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp index 44a0225fc2c..f01f01b5bf8 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/boss_watchkeeper_gargolmar.cpp @@ -85,7 +85,7 @@ class boss_watchkeeper_gargolmar : public CreatureScript void MoveInLineOfSight(Unit* who) { - if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)) && who->isInAccessiblePlaceFor(me)) + if (!me->getVictim() && me->canCreatureAttack(who)) { if (!me->canFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp index 5166a276ac3..cbcde257a1d 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/boss_magtheridon.cpp @@ -124,7 +124,7 @@ class mob_abyssal : public CreatureScript FireBlast_Timer = 6000; } - void SpellHit(Unit*, const SpellInfo *spell) + void SpellHit(Unit*, const SpellInfo* spell) { if (trigger == 2 && spell->Id == SPELL_BLAZE_TARGET) { diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp index 87df08d9bf5..37404b348db 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_alar.cpp @@ -86,7 +86,7 @@ class boss_alar : public CreatureScript DefaultMoveSpeedRate = creature->GetSpeedRate(MOVE_RUN); } - InstanceScript *pInstance; + InstanceScript* pInstance; WaitEventType WaitEvent; uint32 WaitTimer; @@ -190,7 +190,7 @@ class boss_alar : public CreatureScript } } - void SpellHit(Unit*, const SpellInfo *spell) + void SpellHit(Unit*, const SpellInfo* spell) { if (spell->Id == SPELL_DIVE_BOMB_VISUAL) { @@ -474,7 +474,7 @@ class mob_ember_of_alar : public CreatureScript creature->ApplySpellImmune(0, IMMUNITY_SCHOOL, SPELL_SCHOOL_MASK_FIRE, true); } - InstanceScript *pInstance; + InstanceScript* pInstance; bool toDie; void Reset() diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp index 8aba632365a..7b7c8c5e478 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_astromancer.cpp @@ -91,7 +91,7 @@ class boss_high_astromancer_solarian : public CreatureScript defaultsize = creature->GetFloatValue(OBJECT_FIELD_SCALE_X); } - InstanceScript *pInstance; + InstanceScript* pInstance; SummonList Summons; uint8 Phase; @@ -422,7 +422,7 @@ class mob_solarium_priest : public CreatureScript pInstance = creature->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 healTimer; uint32 holysmiteTimer; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp index ff3c3199d31..592c2a1190d 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_kaelthas.cpp @@ -397,8 +397,7 @@ class boss_kaelthas : public CreatureScript void MoveInLineOfSight(Unit* who) { - if (!me->HasUnitState(UNIT_STAT_STUNNED) && who->isTargetableForAttack() && - me->IsHostileTo(who) && who->isInAccessiblePlaceFor(me)) + if (!me->HasUnitState(UNIT_STAT_STUNNED) && me->canCreatureAttack(who)) { if (!me->canFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; diff --git a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp index d4f9803b800..add35e75dad 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/boss_void_reaver.cpp @@ -119,9 +119,9 @@ class boss_void_reaver : public CreatureScript if (ArcaneOrb_Timer <= diff) { Unit* target = NULL; - std::list<HostileReference *> t_list = me->getThreatManager().getThreatList(); - std::vector<Unit* > target_list; - for (std::list<HostileReference *>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) + std::list<HostileReference*> t_list = me->getThreatManager().getThreatList(); + std::vector<Unit*> target_list; + for (std::list<HostileReference*>::const_iterator itr = t_list.begin(); itr!= t_list.end(); ++itr) { target = Unit::GetUnit(*me, (*itr)->getUnitGuid()); if (!target) diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp index 707a4ae5946..5ad4eeb26a5 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/boss_nethermancer_sepethrea.cpp @@ -66,7 +66,7 @@ class boss_nethermancer_sepethrea : public CreatureScript pInstance = creature->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 frost_attack_Timer; uint32 arcane_blast_Timer; @@ -188,7 +188,7 @@ class mob_ragin_flames : public CreatureScript pInstance = creature->GetInstanceScript(); } - InstanceScript *pInstance; + InstanceScript* pInstance; uint32 inferno_Timer; uint32 flame_timer; diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp index 0cdcca1ae2f..adf71c8a25b 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.cpp @@ -315,7 +315,7 @@ class npc_warden_mellichar : public CreatureScript if (IsRunning) return; - if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)) && who->isInAccessiblePlaceFor(me)) + if (!me->getVictim() && me->canCreatureAttack(who)) { if (!me->canFly() && me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp index dee6da11c3d..f3310035f8d 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/boss_harbinger_skyriss.cpp @@ -73,7 +73,7 @@ class boss_harbinger_skyriss : public CreatureScript Intro = false; } - InstanceScript *pInstance; + InstanceScript* pInstance; bool Intro; bool IsImage33; diff --git a/src/server/scripts/Outland/blades_edge_mountains.cpp b/src/server/scripts/Outland/blades_edge_mountains.cpp index 79d111bfaf8..8ea12b48a07 100644 --- a/src/server/scripts/Outland/blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/blades_edge_mountains.cpp @@ -157,7 +157,7 @@ public: } } - void SpellHit(Unit* caster, const SpellInfo *spell) + void SpellHit(Unit* caster, const SpellInfo* spell) { if (spell->Id == SPELL_T_PHASE_MODULATOR && caster->GetTypeId() == TYPEID_PLAYER) { diff --git a/src/server/scripts/Outland/boss_doomwalker.cpp b/src/server/scripts/Outland/boss_doomwalker.cpp index 9cd408c38f2..8143ac528b5 100644 --- a/src/server/scripts/Outland/boss_doomwalker.cpp +++ b/src/server/scripts/Outland/boss_doomwalker.cpp @@ -91,7 +91,7 @@ class boss_doomwalker : public CreatureScript void MoveInLineOfSight(Unit* who) { - if (who && who->GetTypeId() == TYPEID_PLAYER && me->IsHostileTo(who)) + if (who && who->GetTypeId() == TYPEID_PLAYER && me->IsValidAttackTarget(who)) if (who->HasAura(SPELL_MARK_DEATH, 0)) who->CastSpell(who, SPELL_AURA_DEATH, 1); } diff --git a/src/server/scripts/Outland/nagrand.cpp b/src/server/scripts/Outland/nagrand.cpp index 21265a1b7f2..ad30ab32e92 100644 --- a/src/server/scripts/Outland/nagrand.cpp +++ b/src/server/scripts/Outland/nagrand.cpp @@ -64,7 +64,7 @@ public: void EnterCombat(Unit* /*who*/) {} - void SpellHit(Unit* Hitter, const SpellInfo *Spellkind) + void SpellHit(Unit* Hitter, const SpellInfo* Spellkind) { if (Spellkind->Id == 32001 && !Spawn) { @@ -838,7 +838,7 @@ public: ScriptedAI::UpdateAI(diff); } - void SpellHit(Unit* caster, const SpellInfo *spell) + void SpellHit(Unit* caster, const SpellInfo* spell) { if (caster->GetTypeId() == TYPEID_PLAYER) { @@ -925,7 +925,7 @@ class npc_corki : public CreatureScript public: npc_corki() : CreatureScript("npc_corki") { } - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_corkiAI(creature); } diff --git a/src/server/scripts/Outland/netherstorm.cpp b/src/server/scripts/Outland/netherstorm.cpp index 3620f09e7c8..5843787b1be 100644 --- a/src/server/scripts/Outland/netherstorm.cpp +++ b/src/server/scripts/Outland/netherstorm.cpp @@ -100,7 +100,7 @@ public: void EnterCombat(Unit* /*who*/) {} - /*void SpellHit(Unit* caster, const SpellInfo *spell) + /*void SpellHit(Unit* caster, const SpellInfo* spell) { //we have no way of telling the Creature was hit by spell -> got aura applied after 10-12 seconds //then no way for the mobs to actually stop the shutdown as intended. @@ -640,7 +640,7 @@ class at_commander_dawnforge : public AreaTriggerScript public: at_commander_dawnforge() : AreaTriggerScript("at_commander_dawnforge") { } - bool OnTrigger(Player* player, const AreaTriggerEntry * /*at*/) + bool OnTrigger(Player* player, const AreaTriggerEntry* /*at*/) { //if player lost aura or not have at all, we should not try start event. if (!player->HasAura(SPELL_SUNFURY_DISGUISE)) @@ -681,7 +681,7 @@ class npc_professor_dabiri : public CreatureScript public: npc_professor_dabiri() : CreatureScript("npc_professor_dabiri") { } - bool OnQuestAccept(Player* player, Creature* creature, Quest const *quest) + bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) { if (quest->GetQuestId() == QUEST_DIMENSIUS) DoScriptText(WHISPER_DABIRI, creature, player); @@ -782,7 +782,7 @@ public: PlayerGUID = who->GetGUID(); } - void SpellHit(Unit* /*caster*/, const SpellInfo * /*spell*/) + void SpellHit(Unit* /*caster*/, const SpellInfo* /*spell*/) { DoCast(me, SPELL_DE_MATERIALIZE); } @@ -817,9 +817,7 @@ public: } if (!UnitsWithMana.empty()) { - std::list<Unit*>::const_iterator it = UnitsWithMana.begin(); - std::advance(it, rand() % UnitsWithMana.size()); - DoCast(*it, SPELL_MANA_BURN); + DoCast(SelectRandomContainerElement(UnitsWithMana), SPELL_MANA_BURN); ManaBurnTimer = 8000 + (rand() % 10 * 1000); // 8-18 sec cd } else @@ -958,7 +956,7 @@ class npc_maxx_a_million_escort : public CreatureScript public: npc_maxx_a_million_escort() : CreatureScript("npc_maxx_a_million_escort") { } - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_maxx_a_million_escortAI(creature); } diff --git a/src/server/scripts/Outland/shadowmoon_valley.cpp b/src/server/scripts/Outland/shadowmoon_valley.cpp index a99b2946409..1666cfa78e2 100644 --- a/src/server/scripts/Outland/shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/shadowmoon_valley.cpp @@ -1379,7 +1379,7 @@ public: if (!player) return; - if (Group *EventGroup = player->GetGroup()) + if (Group* EventGroup = player->GetGroup()) { Player* GroupMember; diff --git a/src/server/scripts/Outland/terokkar_forest.cpp b/src/server/scripts/Outland/terokkar_forest.cpp index 538821efe61..785f476b9ab 100644 --- a/src/server/scripts/Outland/terokkar_forest.cpp +++ b/src/server/scripts/Outland/terokkar_forest.cpp @@ -97,7 +97,7 @@ public: { if (Group* pGroup = CAST_PLR(done_by)->GetGroup()) { - for (GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) + for (GroupReference* itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next()) { Player* pGroupie = itr->getSource(); if (pGroupie && diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index f5817ba0d9d..98faef9e00a 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -65,7 +65,7 @@ class spell_dk_anti_magic_shell_raid : public SpellScriptLoader amount = -1; } - void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) + void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct); } @@ -77,7 +77,7 @@ class spell_dk_anti_magic_shell_raid : public SpellScriptLoader } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_dk_anti_magic_shell_raid_AuraScript(); } @@ -112,12 +112,12 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader amount = -1; } - void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) + void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { absorbAmount = std::min(CalculatePctN(dmgInfo.GetDamage(), absorbPct), GetTarget()->CountPctFromMaxHealth(hpPct)); } - void Trigger(AuraEffect * aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount) + void Trigger(AuraEffect* aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount) { Unit* target = GetTarget(); // damage absorbed by Anti-Magic Shell energizes the DK with additional runic power. @@ -134,7 +134,7 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_dk_anti_magic_shell_self_AuraScript(); } @@ -172,7 +172,7 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader amount += int32(2 * caster->ToPlayer()->GetTotalAttackPowerValue(BASE_ATTACK)); } - void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) + void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct); } @@ -184,7 +184,7 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_dk_anti_magic_zone_AuraScript(); } @@ -427,7 +427,7 @@ class spell_dk_spell_deflection : public SpellScriptLoader amount = -1; } - void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) + void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { // You have a chance equal to your Parry chance if ((dmgInfo.GetDamageType() == SPELL_DIRECT_DAMAGE) && roll_chance_f(GetTarget()->GetUnitParryChance())) @@ -441,7 +441,7 @@ class spell_dk_spell_deflection : public SpellScriptLoader } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_dk_spell_deflection_AuraScript(); } @@ -503,7 +503,7 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader { PrepareAuraScript(spell_dk_will_of_the_necropolis_AuraScript); - bool Validate(SpellInfo const *spellEntry) + bool Validate(SpellInfo const* spellEntry) { // can't use other spell than will of the necropolis due to spell_ranks dependency if (sSpellMgr->GetFirstSpellInChain(DK_SPELL_WILL_OF_THE_NECROPOLIS_AURA_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id)) @@ -530,7 +530,7 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader amount = -1; } - void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) + void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { // min pct of hp is stored in effect 0 of talent spell uint32 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id); @@ -551,7 +551,7 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_dk_will_of_the_necropolis_AuraScript(); } @@ -599,7 +599,7 @@ public: } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_dk_improved_blood_presence_AuraScript(); } @@ -648,7 +648,7 @@ public: } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_dk_improved_unholy_presence_AuraScript(); } diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 8dc4b3063a5..cd256931532 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -108,7 +108,7 @@ class spell_dru_moonkin_form_passive : public SpellScriptLoader amount = -1; } - void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) + void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { // reduces all damage taken while Stunned in Moonkin Form if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)) @@ -122,7 +122,7 @@ class spell_dru_moonkin_form_passive : public SpellScriptLoader } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_dru_moonkin_form_passive_AuraScript(); } @@ -152,7 +152,7 @@ class spell_dru_primal_tenacity : public SpellScriptLoader amount = -1; } - void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) + void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { // reduces all damage taken while Stunned in Cat Form if (GetTarget()->GetShapeshiftForm() == FORM_CAT && GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN)) @@ -166,7 +166,7 @@ class spell_dru_primal_tenacity : public SpellScriptLoader } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_dru_primal_tenacity_AuraScript(); } @@ -196,7 +196,7 @@ class spell_dru_savage_defense : public SpellScriptLoader amount = -1; } - void Absorb(AuraEffect * aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount) + void Absorb(AuraEffect* aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount) { absorbAmount = uint32(CalculatePctN(GetTarget()->GetTotalAttackPowerValue(BASE_ATTACK), absorbPct)); aurEff->SetAmount(0); @@ -209,7 +209,7 @@ class spell_dru_savage_defense : public SpellScriptLoader } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_dru_savage_defense_AuraScript(); } @@ -251,10 +251,9 @@ class spell_dru_t10_restoration_4p_bonus : public SpellScriptLoader return; } - std::list<Unit*>::const_iterator it2 = tempTargets.begin(); - std::advance(it2, urand(0, tempTargets.size() - 1)); + Unit* target = SelectRandomContainerElement(tempTargets); unitList.clear(); - unitList.push_back(*it2); + unitList.push_back(target); } } @@ -290,7 +289,7 @@ class spell_dru_starfall_aoe : public SpellScriptLoader } }; - SpellScript *GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_dru_starfall_aoe_SpellScript(); } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 3d6b4fba8bc..248dd31c2a8 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -734,7 +734,7 @@ class spell_gen_gunship_portal : public SpellScriptLoader if (caster->GetTypeId() != TYPEID_PLAYER) return; - if (Battleground *bg = caster->ToPlayer()->GetBattleground()) + if (Battleground* bg = caster->ToPlayer()->GetBattleground()) if (bg->GetTypeID(true) == BATTLEGROUND_IC) bg->DoAction(1, caster->GetGUID()); } @@ -1313,6 +1313,52 @@ class spell_gen_vehicle_scaling : public SpellScriptLoader } }; + +class spell_gen_oracle_wolvar_reputation: public SpellScriptLoader +{ +public: + spell_gen_oracle_wolvar_reputation() : SpellScriptLoader("spell_gen_oracle_wolvar_reputation") { } + + class spell_gen_oracle_wolvar_reputation_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_oracle_wolvar_reputation_SpellScript) + + void HandleDummy(SpellEffIndex effIndex) + { + + if (Player* player = GetCaster()->ToPlayer()) + { + + uint32 factionId = GetSpellInfo()->Effects[effIndex].CalcValue(); + int32 repChange = GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + + FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId); + + if (!factionEntry) + return; + + // Set rep to baserep + basepoints (expecting spillover for oposite faction -> become hated) + // Not when player already has equal or higher rep with this faction + if (player->GetReputationMgr().GetBaseReputation(factionEntry) < repChange) + player->GetReputationMgr().SetReputation(factionEntry, repChange); + + // EFFECT_INDEX_2 most likely update at war state, we already handle this in SetReputation + } + + } + + void Register() + { + OnEffect += SpellEffectFn(spell_gen_oracle_wolvar_reputation_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_oracle_wolvar_reputation_SpellScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -1343,4 +1389,5 @@ void AddSC_generic_spell_scripts() new spell_gen_allow_cast_from_item_only(); new spell_gen_launch(); new spell_gen_vehicle_scaling(); + new spell_gen_oracle_wolvar_reputation(); } diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 16d147a4000..d0e62b9b758 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -76,7 +76,7 @@ public: Unit* caster = GetCaster(); if (caster->ToPlayer()) - if (Pet* pet = caster->ToPlayer()->GetPet()) + if (caster->ToPlayer()->GetPet()) caster->CastSpell(caster, HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET, true); } @@ -87,7 +87,7 @@ public: } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_hun_aspect_of_the_beast_AuraScript(); } @@ -328,7 +328,7 @@ public: const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap(); for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();) { - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(itr->first); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); ///! If spellId in cooldown map isn't valid, the above will return a null pointer. if (spellInfo && @@ -433,7 +433,7 @@ public: } } - void HandleUpdatePeriodic(AuraEffect * aurEff) + void HandleUpdatePeriodic(AuraEffect* aurEff) { Unit* target = GetUnitOwner(); if (Player* playerTarget = target->ToPlayer()) @@ -453,7 +453,7 @@ public: } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_hun_sniper_training_AuraScript(); } diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index d271bf36887..eb889993030 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -65,7 +65,7 @@ class spell_mage_blast_wave : public SpellScriptLoader } }; - SpellScript * GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_mage_blast_wave_SpellScript(); } @@ -90,7 +90,7 @@ class spell_mage_cold_snap : public SpellScriptLoader const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap(); for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();) { - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(itr->first); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (spellInfo->GetSchoolMask() & SPELL_SCHOOL_MASK_FROST) && @@ -203,7 +203,7 @@ class spell_mage_summon_water_elemental : public SpellScriptLoader } }; - SpellScript * GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_mage_summon_water_elemental_SpellScript(); } @@ -231,10 +231,10 @@ public: && sSpellMgr->GetSpellInfo(SPELL_MAGE_FROST_WARDING_R1); } - void Absorb(AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) + void Absorb(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) { Unit* target = GetTarget(); - if (AuraEffect * talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_FROST_WARDING_R1, EFFECT_0)) + if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_FROST_WARDING_R1, EFFECT_0)) { int32 chance = talentAurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue(); @@ -253,7 +253,7 @@ public: } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_mage_frost_warding_trigger_AuraScript(); } @@ -274,11 +274,11 @@ public: && sSpellMgr->GetSpellInfo(SPELL_MAGE_INCANTERS_ABSORBTION_R1); } - void Trigger(AuraEffect * aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount) + void Trigger(AuraEffect* aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount) { Unit* target = GetTarget(); - if (AuraEffect * talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_INCANTERS_ABSORBTION_R1, EFFECT_0)) + if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_INCANTERS_ABSORBTION_R1, EFFECT_0)) { int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount()); target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); @@ -302,7 +302,7 @@ public: } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_mage_incanters_absorbtion_absorb_AuraScript(); } @@ -324,7 +324,7 @@ public: } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_mage_incanters_absorbtion_manashield_AuraScript(); } diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index 9269dade108..87c1b96a3ef 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -69,7 +69,7 @@ public: amount = -1; } - void Absorb(AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) + void Absorb(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) { Unit* victim = GetTarget(); int32 remainingHealth = victim->GetHealth() - dmgInfo.GetDamage(); @@ -109,7 +109,7 @@ public: } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_pal_ardent_defender_AuraScript(); } @@ -161,7 +161,7 @@ public: } }; - SpellScript *GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_pal_blessing_of_faith_SpellScript(); } @@ -204,7 +204,7 @@ public: } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_pal_blessing_of_sanctuary_AuraScript(); } @@ -253,7 +253,7 @@ public: class spell_pal_holy_shock_SpellScript : public SpellScript { PrepareSpellScript(spell_pal_holy_shock_SpellScript) - bool Validate(SpellInfo const *spellEntry) + bool Validate(SpellInfo const* spellEntry) { if (!sSpellMgr->GetSpellInfo(PALADIN_SPELL_HOLY_SHOCK_R1)) return false; @@ -293,7 +293,7 @@ public: } }; - SpellScript *GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_pal_holy_shock_SpellScript(); } @@ -321,7 +321,7 @@ public: } }; - SpellScript *GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_pal_judgement_of_command_SpellScript(); } diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 77048d6ea29..0e22404764b 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -64,7 +64,7 @@ class spell_pri_guardian_spirit : public SpellScriptLoader amount = -1; } - void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) + void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { Unit* target = GetTarget(); if (dmgInfo.GetDamage() < target->GetHealth()) @@ -84,7 +84,7 @@ class spell_pri_guardian_spirit : public SpellScriptLoader } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_pri_guardian_spirit_AuraScript(); } @@ -114,7 +114,7 @@ class spell_pri_mana_burn : public SpellScriptLoader } }; - SpellScript * GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_pri_mana_burn_SpellScript; } @@ -140,7 +140,7 @@ class spell_pri_mind_sear : public SpellScriptLoader } }; - SpellScript *GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_pri_mind_sear_SpellScript(); } @@ -170,7 +170,7 @@ class spell_pri_pain_and_suffering_proc : public SpellScriptLoader } }; - SpellScript *GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_pri_pain_and_suffering_proc_SpellScript; } @@ -225,7 +225,7 @@ class spell_pri_penance : public SpellScriptLoader } }; - SpellScript *GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_pri_penance_SpellScript; } @@ -246,7 +246,7 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader return sSpellMgr->GetSpellInfo(PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED) && sSpellMgr->GetSpellInfo(PRIEST_SPELL_REFLECTIVE_SHIELD_R1); } - void Trigger(AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) + void Trigger(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) { Unit* target = GetTarget(); if (dmgInfo.GetAttacker() == target) @@ -254,7 +254,7 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader Unit* caster = GetCaster(); if (!caster) return; - if (AuraEffect * talentAurEff = target->GetAuraEffectOfRankedSpell(PRIEST_SPELL_REFLECTIVE_SHIELD_R1, EFFECT_0)) + if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(PRIEST_SPELL_REFLECTIVE_SHIELD_R1, EFFECT_0)) { int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount()); target->CastCustomSpell(dmgInfo.GetAttacker(), PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); @@ -267,7 +267,7 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_pri_reflective_shield_trigger_AuraScript(); } diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index a9ffe2e0f47..8f90bca5e79 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -470,7 +470,7 @@ public: } }; - SpellScript * GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_q11730_ultrasonic_screwdriver_SpellScript(); } diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index f1add24fc73..079ee5ded32 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -65,7 +65,7 @@ public: amount = -1; } - void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) + void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { Unit* target = GetTarget(); if (dmgInfo.GetDamage() < target->GetHealth()) @@ -95,7 +95,7 @@ public: } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_rog_cheat_death_AuraScript(); } @@ -125,7 +125,7 @@ public: amount = -1; } - void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) + void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { // reduces all damage taken while stun or fear if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN))) @@ -139,7 +139,7 @@ public: } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_rog_nerves_of_steel_AuraScript(); } @@ -170,7 +170,7 @@ class spell_rog_preparation : public SpellScriptLoader const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap(); for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();) { - SpellInfo const *spellInfo = sSpellMgr->GetSpellInfo(itr->first); + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); if (spellInfo->SpellFamilyName == SPELLFAMILY_ROGUE) { @@ -202,7 +202,7 @@ class spell_rog_preparation : public SpellScriptLoader } }; - SpellScript *GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_rog_preparation_SpellScript(); } @@ -246,7 +246,7 @@ public: } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_rog_prey_on_the_weak_AuraScript(); } @@ -284,7 +284,7 @@ class spell_rog_shiv : public SpellScriptLoader } }; - SpellScript *GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_rog_shiv_SpellScript(); } diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 7ffec9f7051..cd46e0eab1c 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -60,7 +60,7 @@ public: amount = -1; } - void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) + void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { // reduces all damage taken while stun, fear or silence if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_FLEEING | UNIT_FLAG_SILENCED) || (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED) && GetTarget()->HasAuraWithMechanic(1<<MECHANIC_STUN))) @@ -74,7 +74,7 @@ public: } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_sha_astral_shift_AuraScript(); } @@ -167,7 +167,7 @@ public: int32 effValue = GetEffectValue(); // Glyph of Mana Tide if (Unit* owner = caster->GetOwner()) - if (AuraEffect *dummy = owner->GetAuraEffect(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE, 0)) + if (AuraEffect* dummy = owner->GetAuraEffect(SHAMAN_SPELL_GLYPH_OF_MANA_TIDE, 0)) effValue += dummy->GetAmount(); // Regenerate 6% of Total Mana Every 3 secs int32 effBasePoints0 = int32(CalculatePctN(unitTarget->GetMaxPower(POWER_MANA), effValue)); @@ -222,7 +222,7 @@ public: } }; - AuraScript *GetAuraScript() const + AuraScript* GetAuraScript() const { return new spell_sha_earthbind_totem_AuraScript(); } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index da6fde2c8f0..c8329a74b47 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -36,6 +36,57 @@ enum WarlockSpells WARLOCK_IMPROVED_HEALTHSTONE_R2 = 18693, }; +class spell_warl_banish : public SpellScriptLoader +{ +public: + spell_warl_banish() : SpellScriptLoader("spell_warl_banish") { } + + class spell_warl_banish_SpellScript : public SpellScript + { + PrepareSpellScript(spell_warl_banish_SpellScript); + + bool Load() + { + _removed = false; + return true; + } + + void HandleBanish() + { + if (Unit* target = GetHitUnit()) + { + if (target->GetAuraEffect(SPELL_AURA_SCHOOL_IMMUNITY, SPELLFAMILY_WARLOCK, 0, 0x08000000, 0)) + { + //No need to remove old aura since its removed due to not stack by current Banish aura + PreventHitDefaultEffect(EFFECT_0); + PreventHitDefaultEffect(EFFECT_1); + PreventHitDefaultEffect(EFFECT_2); + _removed = true; + } + } + } + + void RemoveAura() + { + if (_removed) + PreventHitAura(); + } + + void Register() + { + BeforeHit += SpellHitFn(spell_warl_banish_SpellScript::HandleBanish); + AfterHit += SpellHitFn(spell_warl_banish_SpellScript::RemoveAura); + } + + bool _removed; + }; + + SpellScript* GetSpellScript() const + { + return new spell_warl_banish_SpellScript(); + } +}; + // 47193 Demonic Empowerment class spell_warl_demonic_empowerment : public SpellScriptLoader { @@ -204,88 +255,65 @@ class spell_warl_everlasting_affliction : public SpellScriptLoader } }; -class spell_warl_seed_of_corruption : public SpellScriptLoader +// 18541 Ritual of Doom Effect +class spell_warl_ritual_of_doom_effect : public SpellScriptLoader { - public: - spell_warl_seed_of_corruption() : SpellScriptLoader("spell_warl_seed_of_corruption") { } - - class spell_warl_seed_of_corruption_SpellScript : public SpellScript - { - PrepareSpellScript(spell_warl_seed_of_corruption_SpellScript); +public: + spell_warl_ritual_of_doom_effect() : SpellScriptLoader("spell_warl_ritual_of_doom_effect") { } - void FilterTargets(std::list<Unit*>& unitList) - { - unitList.remove(GetTargetUnit()); - } + class spell_warl_ritual_of_doom_effect_SpellScript : public SpellScript + { + PrepareSpellScript(spell_warl_ritual_of_doom_effect_SpellScript); - void Register() - { - OnUnitTargetSelect += SpellUnitTargetFn(spell_warl_seed_of_corruption_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); - } - }; + void HandleDummy(SpellEffIndex /*effIndex*/) + { + GetCaster()->CastSpell(GetHitUnit(), GetEffectValue(), true); + } - SpellScript *GetSpellScript() const + void Register() { - return new spell_warl_seed_of_corruption_SpellScript(); + OnEffect += SpellEffectFn(spell_warl_ritual_of_doom_effect_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } + }; + + SpellScript* GetSpellScript() const + { + return new spell_warl_ritual_of_doom_effect_SpellScript(); + } }; -class spell_warl_banish : public SpellScriptLoader +class spell_warl_seed_of_corruption : public SpellScriptLoader { public: - spell_warl_banish() : SpellScriptLoader("spell_warl_banish") { } + spell_warl_seed_of_corruption() : SpellScriptLoader("spell_warl_seed_of_corruption") { } - class spell_warl_banish_SpellScript : public SpellScript + class spell_warl_seed_of_corruption_SpellScript : public SpellScript { - PrepareSpellScript(spell_warl_banish_SpellScript); - - bool Load() - { - _removed = false; - return true; - } - - void HandleBanish() - { - if (Unit* target = GetHitUnit()) - { - if (target->GetAuraEffect(SPELL_AURA_SCHOOL_IMMUNITY, SPELLFAMILY_WARLOCK, 0, 0x08000000, 0)) - { - //No need to remove old aura since its removed due to not stack by current Banish aura - PreventHitDefaultEffect(EFFECT_0); - PreventHitDefaultEffect(EFFECT_1); - PreventHitDefaultEffect(EFFECT_2); - _removed = true; - } - } - } + PrepareSpellScript(spell_warl_seed_of_corruption_SpellScript); - void RemoveAura() + void FilterTargets(std::list<Unit*>& unitList) { - if (_removed) - PreventHitAura(); + unitList.remove(GetTargetUnit()); } void Register() { - BeforeHit += SpellHitFn(spell_warl_banish_SpellScript::HandleBanish); - AfterHit += SpellHitFn(spell_warl_banish_SpellScript::RemoveAura); + OnUnitTargetSelect += SpellUnitTargetFn(spell_warl_seed_of_corruption_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY); } - - bool _removed; }; SpellScript* GetSpellScript() const { - return new spell_warl_banish_SpellScript(); + return new spell_warl_seed_of_corruption_SpellScript(); } }; void AddSC_warlock_spell_scripts() { + new spell_warl_banish(); new spell_warl_demonic_empowerment(); new spell_warl_create_healthstone(); new spell_warl_everlasting_affliction(); + new spell_warl_ritual_of_doom_effect(); new spell_warl_seed_of_corruption(); - new spell_warl_banish(); } diff --git a/src/server/scripts/Spells/spell_warrior.cpp b/src/server/scripts/Spells/spell_warrior.cpp index 9f484f4966d..395673b28a2 100644 --- a/src/server/scripts/Spells/spell_warrior.cpp +++ b/src/server/scripts/Spells/spell_warrior.cpp @@ -57,7 +57,7 @@ class spell_warr_last_stand : public SpellScriptLoader } }; - SpellScript *GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_warr_last_stand_SpellScript(); } @@ -83,7 +83,7 @@ class spell_warr_improved_spell_reflection : public SpellScriptLoader } }; - SpellScript *GetSpellScript() const + SpellScript* GetSpellScript() const { return new spell_warr_improved_spell_reflection_SpellScript(); } diff --git a/src/server/scripts/World/achievement_scripts.cpp b/src/server/scripts/World/achievement_scripts.cpp index af966e3e22e..2dbbd949526 100755 --- a/src/server/scripts/World/achievement_scripts.cpp +++ b/src/server/scripts/World/achievement_scripts.cpp @@ -34,7 +34,7 @@ class achievement_storm_glory : public AchievementCriteriaScript if (source->GetBattlegroundTypeId() != BATTLEGROUND_EY) return false; - Battleground *pEotS = source->GetBattleground(); + Battleground* pEotS = source->GetBattleground(); if (!pEotS) return false; diff --git a/src/server/scripts/World/go_scripts.cpp b/src/server/scripts/World/go_scripts.cpp index d99501f6aaa..0bda63b4177 100644 --- a/src/server/scripts/World/go_scripts.cpp +++ b/src/server/scripts/World/go_scripts.cpp @@ -936,7 +936,7 @@ public: if (!caster || caster->GetTypeId() != TYPEID_PLAYER) return true; - if (!player->IsInSameRaidWith(static_cast<Player* >(caster))) + if (!player->IsInSameRaidWith(static_cast<Player*>(caster))) return true; // Repeating this at every use is ugly and inefficient. But as long as we don't have proper diff --git a/src/server/scripts/World/guards.cpp b/src/server/scripts/World/guards.cpp index 6c71f3c2167..a40405d3021 100644 --- a/src/server/scripts/World/guards.cpp +++ b/src/server/scripts/World/guards.cpp @@ -83,7 +83,7 @@ public: if (buffTimer <= diff) { //Find a spell that targets friendly and applies an aura (these are generally buffs) - SpellInfo const *info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA); + SpellInfo const* info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA); if (info && !globalCooldown) { @@ -111,7 +111,7 @@ public: if (me->IsWithinMeleeRange(me->getVictim())) { bool healing = false; - SpellInfo const *info = NULL; + SpellInfo const* info = NULL; //Select a healing spell if less than 30% hp if (me->HealthBelowPct(30)) @@ -147,7 +147,7 @@ public: if (!me->IsNonMeleeSpellCasted(false)) { bool healing = false; - SpellInfo const *info = NULL; + SpellInfo const* info = NULL; //Select a healing spell if less than 30% hp ONLY 33% of the time if (me->HealthBelowPct(30) && 33 > urand(0, 99)) @@ -228,7 +228,7 @@ public: uint32 buffTimer; }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new guard_genericAI(creature); } @@ -301,7 +301,7 @@ public: bool canTeleport; }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new guard_shattrath_scryerAI(creature); } @@ -365,7 +365,7 @@ public: bool canTeleport; }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new guard_shattrath_aldorAI(creature); } diff --git a/src/server/scripts/World/mob_generic_creature.cpp b/src/server/scripts/World/mob_generic_creature.cpp index 5cb707bb2a4..92909f3885a 100644 --- a/src/server/scripts/World/mob_generic_creature.cpp +++ b/src/server/scripts/World/mob_generic_creature.cpp @@ -66,7 +66,7 @@ public: if (BuffTimer <= diff) { //Find a spell that targets friendly and applies an aura (these are generally buffs) - SpellInfo const *info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA); + SpellInfo const* info = SelectSpell(me, 0, 0, SELECT_TARGET_ANY_FRIEND, 0, 0, 0, 0, SELECT_EFFECT_AURA); if (info && !GlobalCooldown) { @@ -94,7 +94,7 @@ public: if (me->isAttackReady() && !me->IsNonMeleeSpellCasted(false)) { bool Healing = false; - SpellInfo const *info = NULL; + SpellInfo const* info = NULL; //Select a healing spell if less than 30% hp if (HealthBelowPct(30)) @@ -125,7 +125,7 @@ public: if (!me->IsNonMeleeSpellCasted(false)) { bool Healing = false; - SpellInfo const *info = NULL; + SpellInfo const* info = NULL; //Select a healing spell if less than 30% hp ONLY 33% of the time if (HealthBelowPct(30) && rand() % 3 == 0) @@ -161,7 +161,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new generic_creatureAI(creature); } @@ -182,7 +182,7 @@ public: } uint32 timer, interval; - const SpellInfo * spell; + const SpellInfo* spell; void UpdateAI(const uint32 diff) { @@ -197,7 +197,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new trigger_periodicAI(creature); } @@ -218,7 +218,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new trigger_deathAI(creature); } diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 5ceab74efd1..392e20734a8 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -60,9 +60,9 @@ enum SpawnType struct SpawnAssociation { - uint32 m_uiThisCreatureEntry; - uint32 m_uiSpawnedCreatureEntry; - SpawnType m_SpawnType; + uint32 thisCreatureEntry; + uint32 spawnedCreatureEntry; + SpawnType spawnType; }; enum eEnums @@ -71,10 +71,10 @@ enum eEnums AURA_DURATION_TIME_LEFT = 5000 }; -const float RANGE_TRIPWIRE = 15.0f; -const float RANGE_GUARDS_MARK = 50.0f; +float const RANGE_TRIPWIRE = 15.0f; +float const RANGE_GUARDS_MARK = 50.0f; -SpawnAssociation m_aSpawnAssociations[] = +SpawnAssociation spawnAssociations[] = { {2614, 15241, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Alliance) {2615, 15242, SPAWNTYPE_ALARMBOT}, //Air Force Alarm Bot (Horde) @@ -114,51 +114,51 @@ public: { npc_air_force_botsAI(Creature* creature) : ScriptedAI(creature) { - m_pSpawnAssoc = NULL; - m_uiSpawnedGUID = 0; + SpawnAssoc = NULL; + SpawnedGUID = 0; // find the correct spawnhandling - static uint32 uiEntryCount = sizeof(m_aSpawnAssociations)/sizeof(SpawnAssociation); + static uint32 entryCount = sizeof(spawnAssociations) / sizeof(SpawnAssociation); - for (uint8 i=0; i<uiEntryCount; ++i) + for (uint8 i = 0; i < entryCount; ++i) { - if (m_aSpawnAssociations[i].m_uiThisCreatureEntry == creature->GetEntry()) + if (spawnAssociations[i].thisCreatureEntry == creature->GetEntry()) { - m_pSpawnAssoc = &m_aSpawnAssociations[i]; + SpawnAssoc = &spawnAssociations[i]; break; } } - if (!m_pSpawnAssoc) + if (!SpawnAssoc) sLog->outErrorDb("TCSR: Creature template entry %u has ScriptName npc_air_force_bots, but it's not handled by that script", creature->GetEntry()); else { - CreatureTemplate const* spawnedTemplate = sObjectMgr->GetCreatureTemplate(m_pSpawnAssoc->m_uiSpawnedCreatureEntry); + CreatureTemplate const* spawnedTemplate = sObjectMgr->GetCreatureTemplate(SpawnAssoc->spawnedCreatureEntry); if (!spawnedTemplate) { - m_pSpawnAssoc = NULL; - sLog->outErrorDb("TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", m_pSpawnAssoc->m_uiSpawnedCreatureEntry); + SpawnAssoc = NULL; + sLog->outErrorDb("TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", SpawnAssoc->spawnedCreatureEntry); return; } } } - SpawnAssociation* m_pSpawnAssoc; - uint64 m_uiSpawnedGUID; + SpawnAssociation* SpawnAssoc; + uint64 SpawnedGUID; void Reset() {} Creature* SummonGuard() { - Creature* summoned = me->SummonCreature(m_pSpawnAssoc->m_uiSpawnedCreatureEntry, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000); + Creature* summoned = me->SummonCreature(SpawnAssoc->spawnedCreatureEntry, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 300000); if (summoned) - m_uiSpawnedGUID = summoned->GetGUID(); + SpawnedGUID = summoned->GetGUID(); else { - sLog->outErrorDb("TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", m_pSpawnAssoc->m_uiSpawnedCreatureEntry); - m_pSpawnAssoc = NULL; + sLog->outErrorDb("TCSR: npc_air_force_bots: wasn't able to spawn Creature %u", SpawnAssoc->spawnedCreatureEntry); + SpawnAssoc = NULL; } return summoned; @@ -166,7 +166,7 @@ public: Creature* GetSummonedGuard() { - Creature* creature = Unit::GetCreature(*me, m_uiSpawnedGUID); + Creature* creature = Unit::GetCreature(*me, SpawnedGUID); if (creature && creature->isAlive()) return creature; @@ -176,57 +176,55 @@ public: void MoveInLineOfSight(Unit* who) { - if (!m_pSpawnAssoc) + if (!SpawnAssoc) return; - if (who->isTargetableForAttack() && me->IsHostileTo(who)) + if (me->IsValidAttackTarget(who)) { - Player* playerTarget = who->GetTypeId() == TYPEID_PLAYER ? CAST_PLR(who) : NULL; + Player* playerTarget = who->ToPlayer(); // airforce guards only spawn for players if (!playerTarget) return; - Creature* pLastSpawnedGuard = m_uiSpawnedGUID == 0 ? NULL : GetSummonedGuard(); + Creature* lastSpawnedGuard = SpawnedGUID == 0 ? NULL : GetSummonedGuard(); // prevent calling Unit::GetUnit at next MoveInLineOfSight call - speedup - if (!pLastSpawnedGuard) - m_uiSpawnedGUID = 0; + if (!lastSpawnedGuard) + SpawnedGUID = 0; - switch(m_pSpawnAssoc->m_SpawnType) + switch(SpawnAssoc->spawnType) { case SPAWNTYPE_ALARMBOT: { if (!who->IsWithinDistInMap(me, RANGE_GUARDS_MARK)) return; - Aura* pMarkAura = who->GetAura(SPELL_GUARDS_MARK); - if (pMarkAura) + Aura* markAura = who->GetAura(SPELL_GUARDS_MARK); + if (markAura) { // the target wasn't able to move out of our range within 25 seconds - if (!pLastSpawnedGuard) + if (!lastSpawnedGuard) { - pLastSpawnedGuard = SummonGuard(); + lastSpawnedGuard = SummonGuard(); - if (!pLastSpawnedGuard) + if (!lastSpawnedGuard) return; } - if (pMarkAura->GetDuration() < AURA_DURATION_TIME_LEFT) - { - if (!pLastSpawnedGuard->getVictim()) - pLastSpawnedGuard->AI()->AttackStart(who); - } + if (markAura->GetDuration() < AURA_DURATION_TIME_LEFT) + if (!lastSpawnedGuard->getVictim()) + lastSpawnedGuard->AI()->AttackStart(who); } else { - if (!pLastSpawnedGuard) - pLastSpawnedGuard = SummonGuard(); + if (!lastSpawnedGuard) + lastSpawnedGuard = SummonGuard(); - if (!pLastSpawnedGuard) + if (!lastSpawnedGuard) return; - pLastSpawnedGuard->CastSpell(who, SPELL_GUARDS_MARK, true); + lastSpawnedGuard->CastSpell(who, SPELL_GUARDS_MARK, true); } break; } @@ -235,18 +233,16 @@ public: if (!who->IsWithinDistInMap(me, RANGE_TRIPWIRE)) return; - if (!pLastSpawnedGuard) - pLastSpawnedGuard = SummonGuard(); + if (!lastSpawnedGuard) + lastSpawnedGuard = SummonGuard(); - if (!pLastSpawnedGuard) + if (!lastSpawnedGuard) return; // ROOFTOP only triggers if the player is on the ground - if (!playerTarget->IsFlying()) - { - if (!pLastSpawnedGuard->getVictim()) - pLastSpawnedGuard->AI()->AttackStart(who); - } + if (!playerTarget->IsFlying() && !lastSpawnedGuard->getVictim()) + lastSpawnedGuard->AI()->AttackStart(who); + break; } } @@ -254,7 +250,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_air_force_botsAI(creature); } @@ -283,16 +279,16 @@ public: bool OnGossipHello(Player* player, Creature* creature) { if (player->GetQuestStatus(QUEST_BODY_HEART_A) == QUEST_STATUS_INCOMPLETE || player->GetQuestStatus(QUEST_BODY_HEART_H) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_GRANT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_GRANT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); player->SEND_GOSSIP_MENU(TEXT_ID_DEFAULT, creature->GetGUID()); return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF + 1) { player->SEND_GOSSIP_MENU(TEXT_ID_PROGRESS, creature->GetGUID()); player->AreaExploredOrEventHappens(player->GetTeam() == ALLIANCE ? QUEST_BODY_HEART_A : QUEST_BODY_HEART_H); @@ -332,7 +328,7 @@ public: void EnterCombat(Unit* /*who*/) {} - void UpdateAI(const uint32 diff) + void UpdateAI(uint32 const diff) { // Reset flags after a certain time has passed so that the next player has to start the 'event' again if (me->HasFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER)) @@ -341,7 +337,9 @@ public: { EnterEvadeMode(); return; - } else ResetFlagTimer -= diff; + } + else + ResetFlagTimer -= diff; } if (UpdateVictim()) @@ -353,7 +351,7 @@ public: switch(emote) { case TEXT_EMOTE_CHICKEN: - if (player->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_NONE && rand()%30 == 1) + if (player->GetQuestStatus(QUEST_CLUCK) == QUEST_STATUS_NONE && rand() % 30 == 1) { me->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER); me->setFaction(FACTION_FRIENDLY); @@ -372,22 +370,22 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_chicken_cluckAI(creature); } - bool OnQuestAccept(Player* /*player*/, Creature* creature, const Quest *_Quest) + bool OnQuestAccept(Player* /*player*/, Creature* creature, Quest const* quest) { - if (_Quest->GetQuestId() == QUEST_CLUCK) + if (quest->GetQuestId() == QUEST_CLUCK) CAST_AI(npc_chicken_cluck::npc_chicken_cluckAI, creature->AI())->Reset(); return true; } - bool OnQuestComplete(Player* /*player*/, Creature* creature, const Quest *_Quest) + bool OnQuestComplete(Player* /*player*/, Creature* creature, Quest const* quest) { - if (_Quest->GetQuestId() == QUEST_CLUCK) + if (quest->GetQuestId() == QUEST_CLUCK) CAST_AI(npc_chicken_cluck::npc_chicken_cluckAI, creature->AI())->Reset(); return true; @@ -411,13 +409,13 @@ public: { npc_dancing_flamesAI(Creature* c) : ScriptedAI(c) {} - bool active; - uint32 can_iteract; + bool Active; + uint32 CanIteract; void Reset() { - active = true; - can_iteract = 3500; + Active = true; + CanIteract = 3500; DoCast(me, SPELL_BRAZIER, true); DoCast(me, SPELL_FIERY_AURA, false); float x, y, z; @@ -430,16 +428,18 @@ public: me->SendMessageToSet(&data, true); } - void UpdateAI(const uint32 diff) + void UpdateAI(uint32 const diff) { - if (!active) + if (!Active) { - if (can_iteract <= diff) + if (CanIteract <= diff) { - active = true; - can_iteract = 3500; + Active = true; + CanIteract = 3500; me->HandleEmoteCommand(EMOTE_ONESHOT_DANCE); - } else can_iteract -= diff; + } + else + CanIteract -= diff; } } @@ -450,29 +450,35 @@ public: if (me->IsWithinLOS(player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()) && me->IsWithinDistInMap(player, 30.0f)) { me->SetInFront(player); - active = false; + Active = false; WorldPacket data; me->BuildHeartBeatMsg(&data); me->SendMessageToSet(&data, true); switch(emote) { - case TEXT_EMOTE_KISS: me->HandleEmoteCommand(EMOTE_ONESHOT_SHY); break; - case TEXT_EMOTE_WAVE: me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); break; - case TEXT_EMOTE_BOW: me->HandleEmoteCommand(EMOTE_ONESHOT_BOW); break; - case TEXT_EMOTE_JOKE: me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); break; + case TEXT_EMOTE_KISS: + me->HandleEmoteCommand(EMOTE_ONESHOT_SHY); + break; + case TEXT_EMOTE_WAVE: + me->HandleEmoteCommand(EMOTE_ONESHOT_WAVE); + break; + case TEXT_EMOTE_BOW: + me->HandleEmoteCommand(EMOTE_ONESHOT_BOW); + break; + case TEXT_EMOTE_JOKE: + me->HandleEmoteCommand(EMOTE_ONESHOT_LAUGH); + break; case TEXT_EMOTE_DANCE: - { if (!player->HasAura(SPELL_SEDUCTION)) DoCast(player, SPELL_SEDUCTION, true); - } - break; + break; } } } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_dancing_flamesAI(creature); } @@ -528,14 +534,14 @@ static Location HordeCoords[]= #define H_RUNTOY -3508.48f #define H_RUNTOZ 62.96f -const uint32 AllianceSoldierId[3] = +uint32 const AllianceSoldierId[3] = { 12938, // 12938 Injured Alliance Soldier 12936, // 12936 Badly injured Alliance Soldier 12937 // 12937 Critically injured Alliance Soldier }; -const uint32 HordeSoldierId[3] = +uint32 const HordeSoldierId[3] = { 12923, //12923 Injured Soldier 12924, //12924 Badly injured Soldier @@ -556,7 +562,7 @@ public: uint64 PlayerGUID; - uint32 SummonPatient_Timer; + uint32 SummonPatientTimer; uint32 SummonPatientCount; uint32 PatientDiedCount; uint32 PatientSavedCount; @@ -570,7 +576,7 @@ public: { PlayerGUID = 0; - SummonPatient_Timer = 10000; + SummonPatientTimer = 10000; SummonPatientCount = 0; PatientDiedCount = 0; PatientSavedCount = 0; @@ -587,7 +593,7 @@ public: { PlayerGUID = player->GetGUID(); - SummonPatient_Timer = 10000; + SummonPatientTimer = 10000; SummonPatientCount = 0; PatientDiedCount = 0; PatientSavedCount = 0; @@ -608,7 +614,7 @@ public: me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); } - void PatientDied(Location* Point) + void PatientDied(Location* point) { Player* player = Unit::GetPlayer(*me, PlayerGUID); if (player && ((player->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (player->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE))) @@ -626,14 +632,14 @@ public: return; } - Coordinates.push_back(Point); + Coordinates.push_back(point); } else // If no player or player abandon quest in progress Reset(); } - void PatientSaved(Creature* /*soldier*/, Player* player, Location* Point) + void PatientSaved(Creature* /*soldier*/, Player* player, Location* point) { if (player && PlayerGUID == player->GetGUID()) { @@ -648,8 +654,8 @@ public: std::list<uint64>::const_iterator itr; for (itr = Patients.begin(); itr != Patients.end(); ++itr) { - if (Creature* Patient = Unit::GetCreature((*me), *itr)) - Patient->setDeathState(JUST_DIED); + if (Creature* patient = Unit::GetCreature((*me), *itr)) + patient->setDeathState(JUST_DIED); } } @@ -662,17 +668,17 @@ public: return; } - Coordinates.push_back(Point); + Coordinates.push_back(point); } } } - void UpdateAI(const uint32 diff); + void UpdateAI(uint32 const diff); void EnterCombat(Unit* /*who*/){} }; - bool OnQuestAccept(Player* player, Creature* creature, Quest const *quest) + bool OnQuestAccept(Player* player, Creature* creature, Quest const* quest) { if ((quest->GetQuestId() == 6624) || (quest->GetQuestId() == 6622)) CAST_AI(npc_doctor::npc_doctorAI, creature->AI())->BeginEvent(player); @@ -680,7 +686,7 @@ public: return true; } - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_doctorAI(creature); } @@ -699,12 +705,12 @@ public: { npc_injured_patientAI(Creature* c) : ScriptedAI(c) {} - uint64 Doctorguid; + uint64 DoctorGUID; Location* Coord; void Reset() { - Doctorguid = 0; + DoctorGUID = 0; Coord = NULL; //no select @@ -737,14 +743,14 @@ public: void EnterCombat(Unit* /*who*/){} - void SpellHit(Unit* caster, const SpellInfo *spell) + void SpellHit(Unit* caster, SpellInfo const* spell) { if (caster->GetTypeId() == TYPEID_PLAYER && me->isAlive() && spell->Id == 20804) { if ((CAST_PLR(caster)->GetQuestStatus(6624) == QUEST_STATUS_INCOMPLETE) || (CAST_PLR(caster)->GetQuestStatus(6622) == QUEST_STATUS_INCOMPLETE)) - if (Doctorguid) - if (Creature* Doctor = Unit::GetCreature(*me, Doctorguid)) - CAST_AI(npc_doctor::npc_doctorAI, Doctor->AI())->PatientSaved(me, CAST_PLR(caster), Coord); + if (DoctorGUID) + if (Creature* doctor = Unit::GetCreature(*me, DoctorGUID)) + CAST_AI(npc_doctor::npc_doctorAI, doctor->AI())->PatientSaved(me, CAST_PLR(caster), Coord); //make not selectable me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); @@ -776,13 +782,11 @@ public: } } - void UpdateAI(const uint32 /*diff*/) + void UpdateAI(uint32 const /*diff*/) { //lower HP on every world tick makes it a useful counter, not officlone though if (me->isAlive() && me->GetHealth() > 6) - { me->ModifyHealth(-5); - } if (me->isAlive() && me->GetHealth() <= 6) { @@ -791,22 +795,20 @@ public: me->setDeathState(JUST_DIED); me->SetFlag(UNIT_DYNAMIC_FLAGS, 32); - if (Doctorguid) - { - if (Creature* Doctor = Unit::GetCreature((*me), Doctorguid)) - CAST_AI(npc_doctor::npc_doctorAI, Doctor->AI())->PatientDied(Coord); - } + if (DoctorGUID) + if (Creature* doctor = Unit::GetCreature((*me), DoctorGUID)) + CAST_AI(npc_doctor::npc_doctorAI, doctor->AI())->PatientDied(Coord); } } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_injured_patientAI(creature); } }; -void npc_doctor::npc_doctorAI::UpdateAI(const uint32 diff) +void npc_doctor::npc_doctorAI::UpdateAI(uint32 const diff) { if (Event && SummonPatientCount >= 20) { @@ -816,42 +818,46 @@ void npc_doctor::npc_doctorAI::UpdateAI(const uint32 diff) if (Event) { - if (SummonPatient_Timer <= diff) + if (SummonPatientTimer <= diff) { if (Coordinates.empty()) return; - std::vector<Location*>::iterator itr = Coordinates.begin()+rand()%Coordinates.size(); + std::vector<Location*>::iterator itr = Coordinates.begin() + rand() % Coordinates.size(); uint32 patientEntry = 0; switch(me->GetEntry()) { - case DOCTOR_ALLIANCE: patientEntry = AllianceSoldierId[rand()%3]; break; - case DOCTOR_HORDE: patientEntry = HordeSoldierId[rand()%3]; break; - default: - sLog->outError("TSCR: Invalid entry for Triage doctor. Please check your database"); - return; + case DOCTOR_ALLIANCE: + patientEntry = AllianceSoldierId[rand() % 3]; + break; + case DOCTOR_HORDE: + patientEntry = HordeSoldierId[rand() % 3]; + break; + default: + sLog->outError("TSCR: Invalid entry for Triage doctor. Please check your database"); + return; } - if (Location* Point = *itr) + if (Location* point = *itr) { - if (Creature* Patient = me->SummonCreature(patientEntry, Point->x, Point->y, Point->z, Point->o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) + if (Creature* Patient = me->SummonCreature(patientEntry, point->x, point->y, point->z, point->o, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000)) { //303, this flag appear to be required for client side item->spell to work (TARGET_SINGLE_FRIEND) Patient->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); Patients.push_back(Patient->GetGUID()); - CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Doctorguid = me->GetGUID(); - - if (Point) - CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Coord = Point; + CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->DoctorGUID = me->GetGUID(); + CAST_AI(npc_injured_patient::npc_injured_patientAI, Patient->AI())->Coord = point; Coordinates.erase(itr); } } - SummonPatient_Timer = 10000; + SummonPatientTimer = 10000; ++SummonPatientCount; - } else SummonPatient_Timer -= diff; + } + else + SummonPatientTimer -= diff; } } @@ -901,19 +907,19 @@ public: { npc_garments_of_questsAI(Creature* c) : npc_escortAI(c) {Reset();} - uint64 caster; + uint64 CasterGUID; - bool bIsHealed; - bool bCanRun; + bool IsHealed; + bool CanRun; uint32 RunAwayTimer; void Reset() { - caster = 0; + CasterGUID = 0; - bIsHealed = false; - bCanRun = false; + IsHealed = false; + CanRun = false; RunAwayTimer = 5000; @@ -924,7 +930,7 @@ public: void EnterCombat(Unit* /*who*/) {} - void SpellHit(Unit* pCaster, const SpellInfo *Spell) + void SpellHit(Unit* caster, SpellInfo const* Spell) { if (Spell->Id == SPELL_LESSER_HEAL_R2 || Spell->Id == SPELL_FORTITUDE_R1) { @@ -933,126 +939,136 @@ public: return; //nothing to be done now - if (bIsHealed && bCanRun) + if (IsHealed && CanRun) return; - if (pCaster->GetTypeId() == TYPEID_PLAYER) + if (Player* player = caster->ToPlayer()) { switch(me->GetEntry()) { case ENTRY_SHAYA: - if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_MOON) == QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(QUEST_MOON) == QUEST_STATUS_INCOMPLETE) { - if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1) + if (IsHealed && !CanRun && Spell->Id == SPELL_FORTITUDE_R1) { - DoScriptText(SAY_SHAYA_THANKS, me, pCaster); - bCanRun = true; + DoScriptText(SAY_SHAYA_THANKS, me, caster); + CanRun = true; } - else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) + else if (!IsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) { - caster = pCaster->GetGUID(); + CasterGUID = caster->GetGUID(); me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_COMMON_HEALED, me, pCaster); - bIsHealed = true; + DoScriptText(SAY_COMMON_HEALED, me, caster); + IsHealed = true; } } break; case ENTRY_ROBERTS: - if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_LIGHT_1) == QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(QUEST_LIGHT_1) == QUEST_STATUS_INCOMPLETE) { - if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1) + if (IsHealed && !CanRun && Spell->Id == SPELL_FORTITUDE_R1) { - DoScriptText(SAY_ROBERTS_THANKS, me, pCaster); - bCanRun = true; + DoScriptText(SAY_ROBERTS_THANKS, me, caster); + CanRun = true; } - else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) + else if (!IsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) { - caster = pCaster->GetGUID(); + CasterGUID = caster->GetGUID(); me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_COMMON_HEALED, me, pCaster); - bIsHealed = true; + DoScriptText(SAY_COMMON_HEALED, me, caster); + IsHealed = true; } } break; case ENTRY_DOLF: - if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_LIGHT_2) == QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(QUEST_LIGHT_2) == QUEST_STATUS_INCOMPLETE) { - if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1) + if (IsHealed && !CanRun && Spell->Id == SPELL_FORTITUDE_R1) { - DoScriptText(SAY_DOLF_THANKS, me, pCaster); - bCanRun = true; + DoScriptText(SAY_DOLF_THANKS, me, caster); + CanRun = true; } - else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) + else if (!IsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) { - caster = pCaster->GetGUID(); + CasterGUID = caster->GetGUID(); me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_COMMON_HEALED, me, pCaster); - bIsHealed = true; + DoScriptText(SAY_COMMON_HEALED, me, caster); + IsHealed = true; } } break; case ENTRY_KORJA: - if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_SPIRIT) == QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(QUEST_SPIRIT) == QUEST_STATUS_INCOMPLETE) { - if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1) + if (IsHealed && !CanRun && Spell->Id == SPELL_FORTITUDE_R1) { - DoScriptText(SAY_KORJA_THANKS, me, pCaster); - bCanRun = true; + DoScriptText(SAY_KORJA_THANKS, me, caster); + CanRun = true; } - else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) + else if (!IsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) { - caster = pCaster->GetGUID(); + CasterGUID = caster->GetGUID(); me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_COMMON_HEALED, me, pCaster); - bIsHealed = true; + DoScriptText(SAY_COMMON_HEALED, me, caster); + IsHealed = true; } } break; case ENTRY_DG_KEL: - if (CAST_PLR(pCaster)->GetQuestStatus(QUEST_DARKNESS) == QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(QUEST_DARKNESS) == QUEST_STATUS_INCOMPLETE) { - if (bIsHealed && !bCanRun && Spell->Id == SPELL_FORTITUDE_R1) + if (IsHealed && !CanRun && Spell->Id == SPELL_FORTITUDE_R1) { - DoScriptText(SAY_DG_KEL_THANKS, me, pCaster); - bCanRun = true; + DoScriptText(SAY_DG_KEL_THANKS, me, caster); + CanRun = true; } - else if (!bIsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) + else if (!IsHealed && Spell->Id == SPELL_LESSER_HEAL_R2) { - caster = pCaster->GetGUID(); + CasterGUID = caster->GetGUID(); me->SetStandState(UNIT_STAND_STATE_STAND); - DoScriptText(SAY_COMMON_HEALED, me, pCaster); - bIsHealed = true; + DoScriptText(SAY_COMMON_HEALED, me, caster); + IsHealed = true; } } break; } //give quest credit, not expect any special quest objectives - if (bCanRun) - CAST_PLR(pCaster)->TalkedToCreature(me->GetEntry(), me->GetGUID()); + if (CanRun) + player->TalkedToCreature(me->GetEntry(), me->GetGUID()); } } } - void WaypointReached(uint32 /*uiPoint*/) + void WaypointReached(uint32 /*point*/) { } - void UpdateAI(const uint32 diff) + void UpdateAI(uint32 const diff) { - if (bCanRun && !me->isInCombat()) + if (CanRun && !me->isInCombat()) { if (RunAwayTimer <= diff) { - if (Unit* pUnit = Unit::GetUnit(*me, caster)) + if (Unit* unit = Unit::GetUnit(*me, CasterGUID)) { switch(me->GetEntry()) { - case ENTRY_SHAYA: DoScriptText(SAY_SHAYA_GOODBYE, me, pUnit); break; - case ENTRY_ROBERTS: DoScriptText(SAY_ROBERTS_GOODBYE, me, pUnit); break; - case ENTRY_DOLF: DoScriptText(SAY_DOLF_GOODBYE, me, pUnit); break; - case ENTRY_KORJA: DoScriptText(SAY_KORJA_GOODBYE, me, pUnit); break; - case ENTRY_DG_KEL: DoScriptText(SAY_DG_KEL_GOODBYE, me, pUnit); break; + case ENTRY_SHAYA: + DoScriptText(SAY_SHAYA_GOODBYE, me, unit); + break; + case ENTRY_ROBERTS: + DoScriptText(SAY_ROBERTS_GOODBYE, me, unit); + break; + case ENTRY_DOLF: + DoScriptText(SAY_DOLF_GOODBYE, me, unit); + break; + case ENTRY_KORJA: + DoScriptText(SAY_KORJA_GOODBYE, me, unit); + break; + case ENTRY_DG_KEL: + DoScriptText(SAY_DG_KEL_GOODBYE, me, unit); + break; } Start(false, true, true); @@ -1061,14 +1077,16 @@ public: EnterEvadeMode(); //something went wrong RunAwayTimer = 30000; - } else RunAwayTimer -= diff; + } + else + RunAwayTimer -= diff; } npc_escortAI::UpdateAI(diff); } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_garments_of_questsAI(creature); } @@ -1098,7 +1116,7 @@ public: { } - void UpdateAI(const uint32 /*diff*/) + void UpdateAI(uint32 const /*diff*/) { if (!UpdateVictim()) return; @@ -1111,7 +1129,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_guardianAI(creature); } @@ -1143,16 +1161,16 @@ public: if (player->HasItemCount(ITEM_KT_SIGNET, 1) && (!player->GetQuestRewardStatus(QUEST_MAGICAL_KINGDOM_A) || !player->GetQuestRewardStatus(QUEST_MAGICAL_KINGDOM_H) || !player->GetQuestRewardStatus(QUEST_MAGICAL_KINGDOM_N))) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELEPORT_TO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ITEM_TELEPORT_TO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; } - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_INFO_DEF+1) + if (action == GOSSIP_ACTION_INFO_DEF + 1) { player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, SPELL_TELEPORT_DALARAN, false); @@ -1175,8 +1193,7 @@ public: if (creature->isQuestGiver()) player->PrepareQuestMenu(creature->GetGUID()); - bool canBuy; - canBuy = false; + bool canBuy = false; uint32 vendor = creature->GetEntry(); uint8 race = player->getRace(); @@ -1246,10 +1263,10 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - if (uiAction == GOSSIP_ACTION_TRADE) + if (action == GOSSIP_ACTION_TRADE) player->GetSession()->SendListInventory(creature->GetGUID()); return true; @@ -1285,7 +1302,7 @@ public: if (player->getClass() == CLASS_ROGUE && player->getLevel() >= 24 && !player->HasItemCount(17126, 1) && !player->GetQuestRewardStatus(6681)) { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_ROGUE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_ROGUE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); player->SEND_GOSSIP_MENU(5996, creature->GetGUID()); } else player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); @@ -1293,12 +1310,12 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch(uiAction) + switch(action) { - case GOSSIP_ACTION_INFO_DEF+1: + case GOSSIP_ACTION_INFO_DEF + 1: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, 21100, false); break; @@ -1391,106 +1408,106 @@ public: player->SEND_GOSSIP_MENU(7393, creature->GetGUID()); else { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_SAYGE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO_SAYGE, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); player->SEND_GOSSIP_MENU(7339, creature->GetGUID()); } return true; } - void SendAction(Player* player, Creature* creature, uint32 uiAction) + void SendAction(Player* player, Creature* creature, uint32 action) { - switch(uiAction) + switch(action) { - case GOSSIP_ACTION_INFO_DEF+1: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + case GOSSIP_ACTION_INFO_DEF + 1: + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); player->SEND_GOSSIP_MENU(7340, creature->GetGUID()); break; - case GOSSIP_ACTION_INFO_DEF+2: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE5, GOSSIP_SENDER_MAIN+1, GOSSIP_ACTION_INFO_DEF); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE6, GOSSIP_SENDER_MAIN+2, GOSSIP_ACTION_INFO_DEF); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE7, GOSSIP_SENDER_MAIN+3, GOSSIP_ACTION_INFO_DEF); + case GOSSIP_ACTION_INFO_DEF + 2: + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE5, GOSSIP_SENDER_MAIN + 1, GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE6, GOSSIP_SENDER_MAIN + 2, GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE7, GOSSIP_SENDER_MAIN + 3, GOSSIP_ACTION_INFO_DEF); player->SEND_GOSSIP_MENU(7341, creature->GetGUID()); break; - case GOSSIP_ACTION_INFO_DEF+3: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE8, GOSSIP_SENDER_MAIN+4, GOSSIP_ACTION_INFO_DEF); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE9, GOSSIP_SENDER_MAIN+5, GOSSIP_ACTION_INFO_DEF); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE10, GOSSIP_SENDER_MAIN+2, GOSSIP_ACTION_INFO_DEF); + case GOSSIP_ACTION_INFO_DEF + 3: + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE8, GOSSIP_SENDER_MAIN + 4, GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE9, GOSSIP_SENDER_MAIN + 5, GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE10, GOSSIP_SENDER_MAIN + 2, GOSSIP_ACTION_INFO_DEF); player->SEND_GOSSIP_MENU(7361, creature->GetGUID()); break; - case GOSSIP_ACTION_INFO_DEF+4: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE11, GOSSIP_SENDER_MAIN+6, GOSSIP_ACTION_INFO_DEF); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE12, GOSSIP_SENDER_MAIN+7, GOSSIP_ACTION_INFO_DEF); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE13, GOSSIP_SENDER_MAIN+8, GOSSIP_ACTION_INFO_DEF); + case GOSSIP_ACTION_INFO_DEF + 4: + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE11, GOSSIP_SENDER_MAIN + 6, GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE12, GOSSIP_SENDER_MAIN + 7, GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE13, GOSSIP_SENDER_MAIN + 8, GOSSIP_ACTION_INFO_DEF); player->SEND_GOSSIP_MENU(7362, creature->GetGUID()); break; - case GOSSIP_ACTION_INFO_DEF+5: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE14, GOSSIP_SENDER_MAIN+5, GOSSIP_ACTION_INFO_DEF); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE15, GOSSIP_SENDER_MAIN+4, GOSSIP_ACTION_INFO_DEF); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE16, GOSSIP_SENDER_MAIN+3, GOSSIP_ACTION_INFO_DEF); + case GOSSIP_ACTION_INFO_DEF + 5: + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE14, GOSSIP_SENDER_MAIN + 5, GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE15, GOSSIP_SENDER_MAIN + 4, GOSSIP_ACTION_INFO_DEF); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE16, GOSSIP_SENDER_MAIN + 3, GOSSIP_ACTION_INFO_DEF); player->SEND_GOSSIP_MENU(7363, creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF: - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE17, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_SENDACTION_SAYGE17, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); player->SEND_GOSSIP_MENU(7364, creature->GetGUID()); break; - case GOSSIP_ACTION_INFO_DEF+6: + case GOSSIP_ACTION_INFO_DEF + 6: creature->CastSpell(player, SPELL_FORTUNE, false); player->SEND_GOSSIP_MENU(7365, creature->GetGUID()); break; } } - bool OnGossipSelect(Player* player, Creature* creature, uint32 uiSender, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch(uiSender) + switch(sender) { case GOSSIP_SENDER_MAIN: - SendAction(player, creature, uiAction); + SendAction(player, creature, action); break; - case GOSSIP_SENDER_MAIN+1: + case GOSSIP_SENDER_MAIN + 1: creature->CastSpell(player, SPELL_DMG, false); player->AddSpellCooldown(SPELL_DMG, 0, time(NULL) + 7200); - SendAction(player, creature, uiAction); + SendAction(player, creature, action); break; - case GOSSIP_SENDER_MAIN+2: + case GOSSIP_SENDER_MAIN + 2: creature->CastSpell(player, SPELL_RES, false); player->AddSpellCooldown(SPELL_RES, 0, time(NULL) + 7200); - SendAction(player, creature, uiAction); + SendAction(player, creature, action); break; - case GOSSIP_SENDER_MAIN+3: + case GOSSIP_SENDER_MAIN + 3: creature->CastSpell(player, SPELL_ARM, false); player->AddSpellCooldown(SPELL_ARM, 0, time(NULL) + 7200); - SendAction(player, creature, uiAction); + SendAction(player, creature, action); break; - case GOSSIP_SENDER_MAIN+4: + case GOSSIP_SENDER_MAIN + 4: creature->CastSpell(player, SPELL_SPI, false); player->AddSpellCooldown(SPELL_SPI, 0, time(NULL) + 7200); - SendAction(player, creature, uiAction); + SendAction(player, creature, action); break; - case GOSSIP_SENDER_MAIN+5: + case GOSSIP_SENDER_MAIN + 5: creature->CastSpell(player, SPELL_INT, false); player->AddSpellCooldown(SPELL_INT, 0, time(NULL) + 7200); - SendAction(player, creature, uiAction); + SendAction(player, creature, action); break; - case GOSSIP_SENDER_MAIN+6: + case GOSSIP_SENDER_MAIN + 6: creature->CastSpell(player, SPELL_STM, false); player->AddSpellCooldown(SPELL_STM, 0, time(NULL) + 7200); - SendAction(player, creature, uiAction); + SendAction(player, creature, action); break; - case GOSSIP_SENDER_MAIN+7: + case GOSSIP_SENDER_MAIN + 7: creature->CastSpell(player, SPELL_STR, false); player->AddSpellCooldown(SPELL_STR, 0, time(NULL) + 7200); - SendAction(player, creature, uiAction); + SendAction(player, creature, action); break; - case GOSSIP_SENDER_MAIN+8: + case GOSSIP_SENDER_MAIN + 8: creature->CastSpell(player, SPELL_AGI, false); player->AddSpellCooldown(SPELL_AGI, 0, time(NULL) + 7200); - SendAction(player, creature, uiAction); + SendAction(player, creature, action); break; } return true; @@ -1525,7 +1542,7 @@ public: }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_steam_tonkAI(creature); } @@ -1556,18 +1573,19 @@ public: void AttackStart(Unit* /*who*/) {} void MoveInLineOfSight(Unit* /*who*/) {} - void UpdateAI(const uint32 diff) + void UpdateAI(uint32 const diff) { if (ExplosionTimer <= diff) { DoCast(me, SPELL_TONK_MINE_DETONATE, true); me->setDeathState(DEAD); // unsummon it - } else + } + else ExplosionTimer -= diff; } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_tonk_mineAI(creature); } @@ -1595,7 +1613,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_brewfest_revelerAI(creature); } @@ -1627,15 +1645,21 @@ public: player->CastSpell(player, 26218, false); switch (urand(0, 2)) { - case 0: me->CastSpell(player, 26207, false); break; - case 1: me->CastSpell(player, 26206, false); break; - case 2: me->CastSpell(player, 45036, false); break; + case 0: + me->CastSpell(player, 26207, false); + break; + case 1: + me->CastSpell(player, 26206, false); + break; + case 2: + me->CastSpell(player, 45036, false); + break; } } } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_winter_revelerAI(creature); } @@ -1674,12 +1698,9 @@ public: { SpellTimer = 0; - CreatureTemplate const *Info = me->GetCreatureInfo(); + CreatureTemplate const* Info = me->GetCreatureInfo(); - if (Info->Entry == C_VIPER) - IsViper = true; - else - IsViper = false; + IsViper = Info->Entry == C_VIPER ? true : false; me->SetMaxHealth(uint32(107 * (me->getLevel() - 40) * 0.025f)); //Add delta to make them not all hit the same time @@ -1697,7 +1718,7 @@ public: //Redefined for random target selection: void MoveInLineOfSight(Unit* who) { - if (!me->getVictim() && who->isTargetableForAttack() && (me->IsHostileTo(who)) && who->isInAccessiblePlaceFor(me)) + if (!me->getVictim() && me->canCreatureAttack(who)) { if (me->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) return; @@ -1715,7 +1736,7 @@ public: } } - void UpdateAI(const uint32 diff) + void UpdateAI(uint32 const diff) { if (!UpdateVictim()) return; @@ -1741,14 +1762,17 @@ public: { if (urand(0, 2) == 0) //33% chance to cast DoCast(me->getVictim(), SPELL_DEADLY_POISON); - SpellTimer = VENOMOUS_SNAKE_TIMER + (rand() %5)*100; + SpellTimer = VENOMOUS_SNAKE_TIMER + (rand() % 5) * 100; } - } else SpellTimer -= diff; + } + else + SpellTimer -= diff; + DoMeleeAttackIfReady(); } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_snake_trap_serpentsAI(creature); } @@ -1772,27 +1796,33 @@ public: struct mob_mojoAI : public ScriptedAI { mob_mojoAI(Creature* c) : ScriptedAI(c) {Reset();} - uint32 hearts; - uint64 victimGUID; + + uint32 Hearts; + uint64 VictimGUID; + void Reset() { - victimGUID = 0; - hearts = 15000; + VictimGUID = 0; + Hearts = 15000; if (Unit* own = me->GetOwner()) me->GetMotionMaster()->MoveFollow(own, 0, 0); } + void EnterCombat(Unit* /*who*/){} - void UpdateAI(const uint32 diff) + + void UpdateAI(uint32 const diff) { if (me->HasAura(20372)) { - if (hearts <= diff) + if (Hearts <= diff) { me->RemoveAurasDueToSpell(20372); - hearts = 15000; - } hearts -= diff; + Hearts = 15000; + } + Hearts -= diff; } } + void ReceiveEmote(Player* player, uint32 emote) { me->HandleEmoteCommand(emote); @@ -1802,38 +1832,50 @@ public: if (emote == TEXT_EMOTE_KISS) { std::string whisp = ""; - switch (rand()%8) + switch (rand() % 8) { - case 0:whisp.append(SAY_RANDOM_MOJO0);break; - case 1:whisp.append(SAY_RANDOM_MOJO1);break; - case 2:whisp.append(SAY_RANDOM_MOJO2);break; - case 3:whisp.append(SAY_RANDOM_MOJO3);break; - case 4:whisp.append(SAY_RANDOM_MOJO4);break; - case 5:whisp.append(SAY_RANDOM_MOJO5);break; + case 0: + whisp.append(SAY_RANDOM_MOJO0); + break; + case 1: + whisp.append(SAY_RANDOM_MOJO1); + break; + case 2: + whisp.append(SAY_RANDOM_MOJO2); + break; + case 3: + whisp.append(SAY_RANDOM_MOJO3); + break; + case 4: + whisp.append(SAY_RANDOM_MOJO4); + break; + case 5: + whisp.append(SAY_RANDOM_MOJO5); + break; case 6: whisp.append(SAY_RANDOM_MOJO6a); whisp.append(player->GetName()); whisp.append(SAY_RANDOM_MOJO6b); break; - case 7:whisp.append(SAY_RANDOM_MOJO7);break; + case 7: + whisp.append(SAY_RANDOM_MOJO7); + break; } + me->MonsterWhisper(whisp.c_str(), player->GetGUID()); - if (victimGUID) - { - Player* victim = Unit::GetPlayer(*me, victimGUID); - if (victim) + if (VictimGUID) + if (Player* victim = Unit::GetPlayer(*me, VictimGUID)) victim->RemoveAura(43906);//remove polymorph frog thing - } me->AddAura(43906, player);//add polymorph frog thing - victimGUID = player->GetGUID(); + VictimGUID = player->GetGUID(); DoCast(me, 20372, true);//tag.hearts me->GetMotionMaster()->MoveFollow(player, 0, 0); - hearts = 15000; + Hearts = 15000; } } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new mob_mojoAI(creature); } @@ -1879,7 +1921,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_mirror_imageAI(creature); } @@ -1894,23 +1936,23 @@ public: { npc_ebon_gargoyleAI(Creature* c) : CasterAI(c) {} - uint32 despawnTimer; + uint32 DespawnTimer; void InitializeAI() { CasterAI::InitializeAI(); - uint64 owner_guid = me->GetOwnerGUID(); - if (!owner_guid) + uint64 ownerGuid = me->GetOwnerGUID(); + if (!ownerGuid) return; // Not needed to be despawned now - despawnTimer = 0; + DespawnTimer = 0; // Find victim of Summon Gargoyle spell std::list<Unit*> targets; Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(me, me, 30); Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(me, targets, u_check); me->VisitNearbyObject(30, searcher); for (std::list<Unit*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) - if ((*iter)->GetAura(49206, owner_guid)) + if ((*iter)->GetAura(49206, ownerGuid)) { me->Attack((*iter), false); break; @@ -1925,7 +1967,7 @@ public: } // Fly away when dismissed - void SpellHit(Unit* source, const SpellInfo *spell) + void SpellHit(Unit* source, SpellInfo const* spell) { if (spell->Id != 50515 || !me->isAlive()) return; @@ -1952,26 +1994,24 @@ public: me->GetMotionMaster()->MovePoint(0, x, y, z); // Despawn as soon as possible - despawnTimer = 4 * IN_MILLISECONDS; + DespawnTimer = 4 * IN_MILLISECONDS; } void UpdateAI(const uint32 diff) { - if (despawnTimer > 0) + if (DespawnTimer > 0) { - if (despawnTimer > diff) - despawnTimer -= diff; + if (DespawnTimer > diff) + DespawnTimer -= diff; else - { me->DespawnOrUnsummon(); - } return; } CasterAI::UpdateAI(diff); } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_ebon_gargoyleAI(creature); } @@ -1992,7 +2032,7 @@ public: } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_lightwellAI(creature); } @@ -2013,20 +2053,20 @@ public: { npc_training_dummyAI(Creature* creature) : Scripted_NoMovementAI(creature) { - uiEntry = creature->GetEntry(); + Entry = creature->GetEntry(); } - uint32 uiEntry; - uint32 uiResetTimer; - uint32 uiDespawnTimer; + uint32 Entry; + uint32 ResetTimer; + uint32 DespawnTimer; void Reset() { me->SetControlled(true, UNIT_STAT_STUNNED);//disable rotate me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true);//imune to knock aways like blast wave - uiResetTimer = 5000; - uiDespawnTimer = 15000; + ResetTimer = 5000; + DespawnTimer = 15000; } void EnterEvadeMode() @@ -2037,19 +2077,19 @@ public: Reset(); } - void DamageTaken(Unit* /*done_by*/, uint32 &damage) + void DamageTaken(Unit* /*doneBy*/, uint32& damage) { - uiResetTimer = 5000; + ResetTimer = 5000; damage = 0; } void EnterCombat(Unit* /*who*/) { - if (uiEntry != NPC_ADVANCED_TARGET_DUMMY && uiEntry != NPC_TARGET_DUMMY) + if (Entry != NPC_ADVANCED_TARGET_DUMMY && Entry != NPC_TARGET_DUMMY) return; } - void UpdateAI(const uint32 uiDiff) + void UpdateAI(uint32 const diff) { if (!UpdateVictim()) return; @@ -2057,23 +2097,23 @@ public: if (!me->HasUnitState(UNIT_STAT_STUNNED)) me->SetControlled(true, UNIT_STAT_STUNNED);//disable rotate - if (uiEntry != NPC_ADVANCED_TARGET_DUMMY && uiEntry != NPC_TARGET_DUMMY) + if (Entry != NPC_ADVANCED_TARGET_DUMMY && Entry != NPC_TARGET_DUMMY) { - if (uiResetTimer <= uiDiff) + if (ResetTimer <= diff) { EnterEvadeMode(); - uiResetTimer = 5000; + ResetTimer = 5000; } else - uiResetTimer -= uiDiff; + ResetTimer -= diff; return; } else { - if (uiDespawnTimer <= uiDiff) + if (DespawnTimer <= diff) me->DespawnOrUnsummon(); else - uiDespawnTimer -= uiDiff; + DespawnTimer -= diff; } } void MoveInLineOfSight(Unit* /*who*/){return;} @@ -2100,24 +2140,24 @@ public: { npc_shadowfiendAI(Creature* creature) : ScriptedAI(creature) {} - void DamageTaken(Unit* /*killer*/, uint32 &damage) + void DamageTaken(Unit* /*killer*/, uint32& damage) { if (me->isSummon()) if (Unit* owner = me->ToTempSummon()->GetSummoner()) - { - if (owner->HasAura(GLYPH_OF_SHADOWFIEND)) - if (damage >= me->GetHealth()) - owner->CastSpell(owner, GLYPH_OF_SHADOWFIEND_MANA, true); - } + if (owner->HasAura(GLYPH_OF_SHADOWFIEND) && damage >= me->GetHealth()) + owner->CastSpell(owner, GLYPH_OF_SHADOWFIEND_MANA, true); } - void UpdateAI(const uint32 /*diff*/) + void UpdateAI(uint32 const /*diff*/) { + if (!UpdateVictim()) + return; + DoMeleeAttackIfReady(); } }; - CreatureAI *GetAI(Creature* creature) const + CreatureAI* GetAI(Creature* creature) const { return new npc_shadowfiendAI(creature); } @@ -2154,11 +2194,11 @@ public: { if (player == creature->ToTempSummon()->GetSummoner()) { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING3, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING4, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_ENGINEERING5, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); player->PlayerTalkClass->SendGossipMenu(TEXT_WORMHOLE, creature->GetGUID()); } @@ -2166,12 +2206,12 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); bool roll = urand(0, 1); - switch(uiAction) + switch(action) { case GOSSIP_ACTION_INFO_DEF + 1: //Borean Tundra player->CLOSE_GOSSIP_MENU(); @@ -2229,9 +2269,9 @@ public: if (player->getClass() == CLASS_HUNTER) { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET1, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); if (player->GetPet() && player->GetPet()->getPetType() == HUNTER_PET) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET2, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); player->PlayerTalkClass->SendGossipMenu(TEXT_ISHUNTER, creature->GetGUID()); return true; @@ -2240,17 +2280,17 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch(uiAction) + switch(action) { case GOSSIP_ACTION_INFO_DEF + 1: player->PlayerTalkClass->SendGossipMenu(TEXT_PETINFO, creature->GetGUID()); break; case GOSSIP_ACTION_INFO_DEF + 2: { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET_CONFIRM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_PET_CONFIRM, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); player->PlayerTalkClass->SendGossipMenu(TEXT_CONFIRM, creature->GetGUID()); } break; @@ -2311,61 +2351,61 @@ public: { // Arcatraz Key if (player->GetQuestRewardStatus(QUEST_HOW_TO_BRAKE_IN_TO_THE_ARCATRAZ) && !player->HasItemCount(ITEM_ARCATRAZ_KEY, 1, true)) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_ARCATRAZ_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +1); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_ARCATRAZ_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); // Shadowforge Key if (player->GetQuestRewardStatus(QUEST_DARK_IRON_LEGACY) && !player->HasItemCount(ITEM_SHADOWFORGE_KEY, 1, true)) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_SHADOWFORGE_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +2); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_SHADOWFORGE_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); // Skeleton Key if ((player->GetQuestRewardStatus(QUEST_THE_KEY_TO_SCHOLOMANCE_A) || player->GetQuestRewardStatus(QUEST_THE_KEY_TO_SCHOLOMANCE_H)) && !player->HasItemCount(ITEM_SKELETON_KEY, 1, true)) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_SKELETON_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +3); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_SKELETON_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); // Shatered Halls Key if ((player->GetQuestRewardStatus(QUEST_HOTTER_THAN_HELL_A) || player->GetQuestRewardStatus(QUEST_HOTTER_THAN_HELL_H)) && !player->HasItemCount(ITEM_SHATTERED_HALLS_KEY, 1, true)) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_SHATTERED_HALLS_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +4); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_SHATTERED_HALLS_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); // Master's Key if (player->GetQuestRewardStatus(QUEST_RETURN_TO_KHAGDAR) && !player->HasItemCount(ITEM_THE_MASTERS_KEY, 1, true)) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_THE_MASTERS_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +5); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_THE_MASTERS_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); // Violet Hold Key if (player->GetQuestRewardStatus(QUEST_CONTAINMENT) && !player->HasItemCount(ITEM_VIOLET_HOLD_KEY, 1, true)) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_VIOLET_HOLD_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +6); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_VIOLET_HOLD_KEY, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); return true; } - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch(uiAction) + switch(action) { - case GOSSIP_ACTION_INFO_DEF+1: + case GOSSIP_ACTION_INFO_DEF + 1: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, SPELL_ARCATRAZ_KEY, false); break; - case GOSSIP_ACTION_INFO_DEF+2: + case GOSSIP_ACTION_INFO_DEF + 2: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, SPELL_SHADOWFORGE_KEY, false); break; - case GOSSIP_ACTION_INFO_DEF+3: + case GOSSIP_ACTION_INFO_DEF + 3: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, SPELL_SKELETON_KEY, false); break; - case GOSSIP_ACTION_INFO_DEF+4: + case GOSSIP_ACTION_INFO_DEF + 4: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, SPELL_SHATTERED_HALLS_KEY, false); break; - case GOSSIP_ACTION_INFO_DEF+5: + case GOSSIP_ACTION_INFO_DEF + 5: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, SPELL_THE_MASTERS_KEY, false); break; - case GOSSIP_ACTION_INFO_DEF+6: + case GOSSIP_ACTION_INFO_DEF + 6: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, SPELL_VIOLET_HOLD_KEY, false); break; @@ -2433,23 +2473,23 @@ public: bool OnGossipHello(Player* player, Creature* creature) { - bool m_bLostBloodKnight = false; - bool m_bLostHand = false; - bool m_bLostProtector = false; - bool m_bLostIllidari = false; - bool m_bLostSummer = false; + bool lostBloodKnight = false; + bool lostHand = false; + bool lostProtector = false; + bool lostIllidari = false; + bool lostSummer = false; //Tabard of the Blood Knight if (player->GetQuestRewardStatus(QUEST_TRUE_MASTERS_OF_LIGHT) && !player->HasItemCount(ITEM_TABARD_OF_THE_BLOOD_KNIGHT, 1, true)) - m_bLostBloodKnight = true; + lostBloodKnight = true; //Tabard of the Hand if (player->GetQuestRewardStatus(QUEST_THE_UNWRITTEN_PROPHECY) && !player->HasItemCount(ITEM_TABARD_OF_THE_HAND, 1, true)) - m_bLostHand = true; + lostHand = true; //Tabard of the Protector if (player->GetQuestRewardStatus(QUEST_INTO_THE_BREACH) && !player->HasItemCount(ITEM_TABARD_OF_THE_PROTECTOR, 1, true)) - m_bLostProtector = true; + lostProtector = true; //Green Trophy Tabard of the Illidari //Purple Trophy Tabard of the Illidari @@ -2457,38 +2497,38 @@ public: (!player->HasItemCount(ITEM_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, 1, true) && !player->HasItemCount(ITEM_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, 1, true) && !player->HasItemCount(ITEM_OFFERING_OF_THE_SHATAR, 1, true))) - m_bLostIllidari = true; + lostIllidari = true; //Tabard of Summer Skies //Tabard of Summer Flames if (player->GetQuestRewardStatus(QUEST_SHARDS_OF_AHUNE) && !player->HasItemCount(ITEM_TABARD_OF_THE_SUMMER_SKIES, 1, true) && !player->HasItemCount(ITEM_TABARD_OF_THE_SUMMER_FLAMES, 1, true)) - m_bLostSummer = true; + lostSummer = true; - if (m_bLostBloodKnight || m_bLostHand || m_bLostProtector || m_bLostIllidari || m_bLostSummer) + if (lostBloodKnight || lostHand || lostProtector || lostIllidari || lostSummer) { player->ADD_GOSSIP_ITEM(GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE); - if (m_bLostBloodKnight) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_BLOOD_KNIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +1); + if (lostBloodKnight) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_BLOOD_KNIGHT, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); - if (m_bLostHand) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_THE_HAND, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF +2); + if (lostHand) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_THE_HAND, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); - if (m_bLostProtector) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_THE_PROTECTOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+3); + if (lostProtector) + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_THE_PROTECTOR, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 3); - if (m_bLostIllidari) + if (lostIllidari) { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+4); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+5); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 4); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 5); } - if (m_bLostSummer) + if (lostSummer) { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_SUMMER_SKIES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+6); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_SUMMER_FLAMES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+7); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_SUMMER_SKIES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 6); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_LOST_TABARD_OF_SUMMER_FLAMES, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 7); } player->SEND_GOSSIP_MENU(13583, creature->GetGUID()); @@ -2499,39 +2539,39 @@ public: return true; } - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); - switch(uiAction) + switch(action) { case GOSSIP_ACTION_TRADE: player->GetSession()->SendListInventory(creature->GetGUID()); break; - case GOSSIP_ACTION_INFO_DEF+1: + case GOSSIP_ACTION_INFO_DEF + 1: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, SPELL_TABARD_OF_THE_BLOOD_KNIGHT, false); break; - case GOSSIP_ACTION_INFO_DEF+2: + case GOSSIP_ACTION_INFO_DEF + 2: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, SPELL_TABARD_OF_THE_HAND, false); break; - case GOSSIP_ACTION_INFO_DEF+3: + case GOSSIP_ACTION_INFO_DEF + 3: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, SPELL_TABARD_OF_THE_PROTECTOR, false); break; - case GOSSIP_ACTION_INFO_DEF+4: + case GOSSIP_ACTION_INFO_DEF + 4: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, SPELL_GREEN_TROPHY_TABARD_OF_THE_ILLIDARI, false); break; - case GOSSIP_ACTION_INFO_DEF+5: + case GOSSIP_ACTION_INFO_DEF + 5: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, SPELL_PURPLE_TROPHY_TABARD_OF_THE_ILLIDARI, false); break; - case GOSSIP_ACTION_INFO_DEF+6: + case GOSSIP_ACTION_INFO_DEF + 6: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, SPELL_TABARD_OF_SUMMER_SKIES, false); break; - case GOSSIP_ACTION_INFO_DEF+7: + case GOSSIP_ACTION_INFO_DEF + 7: player->CLOSE_GOSSIP_MENU(); player->CastSpell(player, SPELL_TABARD_OF_SUMMER_FLAMES, false); break; @@ -2544,10 +2584,10 @@ public: ## npc_experience ######*/ -#define EXP_COST 100000//10 00 00 copper (10golds) +#define EXP_COST 100000 //10 00 00 copper (10golds) #define GOSSIP_TEXT_EXP 14736 -#define GOSSIP_XP_OFF "I no longer wish to gain experience." -#define GOSSIP_XP_ON "I wish to start gaining experience again." +#define GOSSIP_XP_OFF "I no longer wish to gain experience." +#define GOSSIP_XP_ON "I wish to start gaining experience again." class npc_experience : public CreatureScript { @@ -2556,19 +2596,19 @@ public: bool OnGossipHello(Player* player, Creature* creature) { - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_XP_OFF, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_XP_ON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+2); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_XP_OFF, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1); + player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_XP_ON, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 2); player->PlayerTalkClass->SendGossipMenu(GOSSIP_TEXT_EXP, creature->GetGUID()); return true; } - bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*uiSender*/, uint32 uiAction) + bool OnGossipSelect(Player* player, Creature* /*creature*/, uint32 /*sender*/, uint32 action) { player->PlayerTalkClass->ClearMenus(); bool noXPGain = player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_NO_XP_GAIN); bool doSwitch = false; - switch(uiAction) + switch(action) { case GOSSIP_ACTION_INFO_DEF + 1://xp off { diff --git a/src/server/shared/Configuration/Config.cpp b/src/server/shared/Configuration/Config.cpp index 3114d363919..9c3a906cd2b 100755 --- a/src/server/shared/Configuration/Config.cpp +++ b/src/server/shared/Configuration/Config.cpp @@ -19,7 +19,7 @@ #include "Config.h" #include <ace/Configuration_Import_Export.h> -static bool GetValueHelper(ACE_Configuration_Heap *mConf, const char *name, ACE_TString &result) +static bool GetValueHelper(ACE_Configuration_Heap* mConf, const char *name, ACE_TString &result) { if (!mConf) return false; diff --git a/src/server/shared/Configuration/Config.h b/src/server/shared/Configuration/Config.h index 33c0080a06e..fa42bdcfc6c 100755 --- a/src/server/shared/Configuration/Config.h +++ b/src/server/shared/Configuration/Config.h @@ -46,7 +46,7 @@ class Config private: std::string mFilename; - ACE_Configuration_Heap *mConf; + ACE_Configuration_Heap* mConf; }; #define sConfig ACE_Singleton<Config, ACE_Null_Mutex>::instance() diff --git a/src/server/shared/Cryptography/Authentication/AuthCrypt.cpp b/src/server/shared/Cryptography/Authentication/AuthCrypt.cpp index 9367c227f74..146f4e992b7 100755 --- a/src/server/shared/Cryptography/Authentication/AuthCrypt.cpp +++ b/src/server/shared/Cryptography/Authentication/AuthCrypt.cpp @@ -31,7 +31,7 @@ AuthCrypt::~AuthCrypt() } -void AuthCrypt::Init(BigNumber *K) +void AuthCrypt::Init(BigNumber* K) { uint8 ServerEncryptionKey[SEED_KEY_SIZE] = { 0xCC, 0x98, 0xAE, 0x04, 0xE8, 0x97, 0xEA, 0xCA, 0x12, 0xDD, 0xC0, 0x93, 0x42, 0x91, 0x53, 0x57 }; HmacHash serverEncryptHmac(SEED_KEY_SIZE, (uint8*)ServerEncryptionKey); diff --git a/src/server/shared/Cryptography/Authentication/AuthCrypt.h b/src/server/shared/Cryptography/Authentication/AuthCrypt.h index 1a8a7d3b205..0304ef6b69e 100755 --- a/src/server/shared/Cryptography/Authentication/AuthCrypt.h +++ b/src/server/shared/Cryptography/Authentication/AuthCrypt.h @@ -30,7 +30,7 @@ class AuthCrypt AuthCrypt(); ~AuthCrypt(); - void Init(BigNumber *K); + void Init(BigNumber* K); void DecryptRecv(uint8 *, size_t); void EncryptSend(uint8 *, size_t); diff --git a/src/server/shared/Cryptography/HMACSHA1.cpp b/src/server/shared/Cryptography/HMACSHA1.cpp index aeaf211dd97..5bb837b1544 100755 --- a/src/server/shared/Cryptography/HMACSHA1.cpp +++ b/src/server/shared/Cryptography/HMACSHA1.cpp @@ -30,7 +30,7 @@ HmacHash::~HmacHash() HMAC_CTX_cleanup(&m_ctx); } -void HmacHash::UpdateBigNumber(BigNumber *bn) +void HmacHash::UpdateBigNumber(BigNumber* bn) { UpdateData(bn->AsByteArray(), bn->GetNumBytes()); } @@ -52,7 +52,7 @@ void HmacHash::Finalize() ASSERT(length == SHA_DIGEST_LENGTH) } -uint8 *HmacHash::ComputeHash(BigNumber *bn) +uint8 *HmacHash::ComputeHash(BigNumber* bn) { HMAC_Update(&m_ctx, bn->AsByteArray(), bn->GetNumBytes()); Finalize(); diff --git a/src/server/shared/Cryptography/HMACSHA1.h b/src/server/shared/Cryptography/HMACSHA1.h index 5f348c6a42b..180ac6f4262 100755 --- a/src/server/shared/Cryptography/HMACSHA1.h +++ b/src/server/shared/Cryptography/HMACSHA1.h @@ -32,11 +32,11 @@ class HmacHash public: HmacHash(uint32 len, uint8 *seed); ~HmacHash(); - void UpdateBigNumber(BigNumber *bn); + void UpdateBigNumber(BigNumber* bn); void UpdateData(const uint8 *data, int length); void UpdateData(const std::string &str); void Finalize(); - uint8 *ComputeHash(BigNumber *bn); + uint8 *ComputeHash(BigNumber* bn); uint8 *GetDigest() { return (uint8*)m_digest; } int GetLength() const { return SHA_DIGEST_LENGTH; } private: diff --git a/src/server/shared/Cryptography/SHA1.cpp b/src/server/shared/Cryptography/SHA1.cpp index 99b62425210..6f2c985ddfb 100755 --- a/src/server/shared/Cryptography/SHA1.cpp +++ b/src/server/shared/Cryptography/SHA1.cpp @@ -40,17 +40,17 @@ void SHA1Hash::UpdateData(const std::string &str) UpdateData((uint8 const*)str.c_str(), str.length()); } -void SHA1Hash::UpdateBigNumbers(BigNumber *bn0, ...) +void SHA1Hash::UpdateBigNumbers(BigNumber* bn0, ...) { va_list v; - BigNumber *bn; + BigNumber* bn; va_start(v, bn0); bn = bn0; while (bn) { UpdateData(bn->AsByteArray(), bn->GetNumBytes()); - bn = va_arg(v, BigNumber *); + bn = va_arg(v, BigNumber* ); } va_end(v); } diff --git a/src/server/shared/Cryptography/SHA1.h b/src/server/shared/Cryptography/SHA1.h index e239088b154..27e2d3290d0 100755 --- a/src/server/shared/Cryptography/SHA1.h +++ b/src/server/shared/Cryptography/SHA1.h @@ -31,8 +31,8 @@ class SHA1Hash SHA1Hash(); ~SHA1Hash(); - void UpdateFinalizeBigNumbers(BigNumber *bn0, ...); - void UpdateBigNumbers(BigNumber *bn0, ...); + void UpdateFinalizeBigNumbers(BigNumber* bn0, ...); + void UpdateBigNumbers(BigNumber* bn0, ...); void UpdateData(const uint8 *dta, int len); void UpdateData(const std::string &str); diff --git a/src/server/shared/DataStores/DBCStore.h b/src/server/shared/DataStores/DBCStore.h index bae253f4114..fbf31bb092e 100755 --- a/src/server/shared/DataStores/DBCStore.h +++ b/src/server/shared/DataStores/DBCStore.h @@ -94,7 +94,7 @@ class DBCStorage uint32 sqlRecordCount = 0; uint32 sqlHighestIndex = 0; - Field *fields = NULL; + Field* fields = NULL; QueryResult result = QueryResult(NULL); // Load data from sql if (sql) diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index e96319aa3a0..68fc7ba9c0a 100755 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -49,7 +49,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() "base_amount0, base_amount1, base_amount2, maxduration, remaintime, remaincharges FROM character_aura WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_LOAD_PLAYER_SPELLS, "SELECT spell, active, disabled FROM character_spell WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_LOAD_PLAYER_QUESTSTATUS, "SELECT quest, status, explored, timer, mobcount1, mobcount2, mobcount3, mobcount4, " - "itemcount1, itemcount2, itemcount3, itemcount4 FROM character_queststatus WHERE guid = ?", CONNECTION_ASYNC) + "itemcount1, itemcount2, itemcount3, itemcount4, playercount FROM character_queststatus WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_LOAD_PLAYER_DAILYQUESTSTATUS, "SELECT quest, time FROM character_queststatus_daily WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_LOAD_PLAYER_WEKLYQUESTSTATUS, "SELECT quest FROM character_queststatus_weekly WHERE guid = ?", CONNECTION_ASYNC) PREPARE_STATEMENT(CHAR_LOAD_PLAYER_REPUTATION, "SELECT faction, standing, flags FROM character_reputation WHERE guid = ?", CONNECTION_ASYNC) diff --git a/src/server/shared/Database/QueryHolder.cpp b/src/server/shared/Database/QueryHolder.cpp index f8908e0c62d..b948a92fc5f 100755 --- a/src/server/shared/Database/QueryHolder.cpp +++ b/src/server/shared/Database/QueryHolder.cpp @@ -172,7 +172,7 @@ bool SQLQueryHolderTask::Execute() { case SQL_ELEMENT_RAW: { - char const *sql = data->element.query; + char const* sql = data->element.query; if (sql) m_holder->SetResult(i, m_conn->Query(sql)); break; diff --git a/src/server/shared/Database/QueryResult.h b/src/server/shared/Database/QueryResult.h index 399779fb66f..6dc01076b59 100755 --- a/src/server/shared/Database/QueryResult.h +++ b/src/server/shared/Database/QueryResult.h @@ -40,7 +40,7 @@ class ResultSet uint64 GetRowCount() const { return m_rowCount; } uint32 GetFieldCount() const { return m_fieldCount; } - Field *Fetch() const { return m_currentRow; } + Field* Fetch() const { return m_currentRow; } const Field & operator [] (uint32 index) const { ASSERT(index < m_fieldCount); @@ -48,7 +48,7 @@ class ResultSet } protected: - Field *m_currentRow; + Field* m_currentRow; uint64 m_rowCount; uint32 m_fieldCount; diff --git a/src/server/shared/Dynamic/LinkedReference/Reference.h b/src/server/shared/Dynamic/LinkedReference/Reference.h index 87c17ce7738..707f4e7cfa8 100755 --- a/src/server/shared/Dynamic/LinkedReference/Reference.h +++ b/src/server/shared/Dynamic/LinkedReference/Reference.h @@ -72,14 +72,14 @@ template <class TO, class FROM> class Reference : public LinkedListElement } Reference<TO, FROM> * next() { return((Reference<TO, FROM> *) LinkedListElement::next()); } - Reference<TO, FROM> const* next() const { return((Reference<TO, FROM> const *) LinkedListElement::next()); } + Reference<TO, FROM> const* next() const { return((Reference<TO, FROM> const* ) LinkedListElement::next()); } Reference<TO, FROM> * prev() { return((Reference<TO, FROM> *) LinkedListElement::prev()); } - Reference<TO, FROM> const* prev() const { return((Reference<TO, FROM> const *) LinkedListElement::prev()); } + Reference<TO, FROM> const* prev() const { return((Reference<TO, FROM> const* ) LinkedListElement::prev()); } Reference<TO, FROM> * nocheck_next() { return((Reference<TO, FROM> *) LinkedListElement::nocheck_next()); } - Reference<TO, FROM> const* nocheck_next() const { return((Reference<TO, FROM> const *) LinkedListElement::nocheck_next()); } + Reference<TO, FROM> const* nocheck_next() const { return((Reference<TO, FROM> const* ) LinkedListElement::nocheck_next()); } Reference<TO, FROM> * nocheck_prev() { return((Reference<TO, FROM> *) LinkedListElement::nocheck_prev()); } - Reference<TO, FROM> const* nocheck_prev() const { return((Reference<TO, FROM> const *) LinkedListElement::nocheck_prev()); } + Reference<TO, FROM> const* nocheck_prev() const { return((Reference<TO, FROM> const* ) LinkedListElement::nocheck_prev()); } TO* operator ->() const { return iRefTo; } TO* getTarget() const { return iRefTo; } diff --git a/src/server/shared/Logging/Log.cpp b/src/server/shared/Logging/Log.cpp index b1318bf4aef..d7222c8564f 100755 --- a/src/server/shared/Logging/Log.cpp +++ b/src/server/shared/Logging/Log.cpp @@ -187,6 +187,15 @@ void Log::Initialize() } } +void Log::ReloadConfig() +{ + m_logLevel = sConfig->GetIntDefault("LogLevel", LOGL_NORMAL); + m_logFileLevel = sConfig->GetIntDefault("LogFileLevel", LOGL_NORMAL); + m_dbLogLevel = sConfig->GetIntDefault("DBLogLevel", LOGL_NORMAL); + + m_DebugLogMask = DebugLogFilters(sConfig->GetIntDefault("DebugLogMask", LOG_FILTER_NONE)); +} + FILE* Log::openLogFile(char const* configFileName, char const* configTimeStampFlag, char const* mode) { std::string logfn=sConfig->GetStringDefault(configFileName, ""); @@ -956,7 +965,7 @@ void Log::outChar(const char * str, ...) void Log::outCharDump(const char * str, uint32 account_id, uint32 guid, const char * name) { - FILE *file = NULL; + FILE* file = NULL; if (m_charLog_Dump_Separate) { char fileName[29]; // Max length: name(12) + guid(11) + _.log (5) + \0 diff --git a/src/server/shared/Logging/Log.h b/src/server/shared/Logging/Log.h index 9b5aedb8e2f..aba1708232f 100755 --- a/src/server/shared/Logging/Log.h +++ b/src/server/shared/Logging/Log.h @@ -108,6 +108,8 @@ class Log public: void Initialize(); + void ReloadConfig(); + void InitColors(const std::string& init_str); void SetColor(bool stdout_stream, ColorTypes color); void ResetColor(bool stdout_stream); diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 34bfea019ab..8ad5af56d1a 100755 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -147,14 +147,14 @@ class ByteBuffer ByteBuffer &operator<<(const std::string &value) { - append((uint8 const *)value.c_str(), value.length()); + append((uint8 const* )value.c_str(), value.length()); append((uint8)0); return *this; } ByteBuffer &operator<<(const char *str) { - append((uint8 const *)str, str ? strlen(str) : 0); + append((uint8 const* )str, str ? strlen(str) : 0); append((uint8)0); return *this; } diff --git a/src/server/shared/Threading/Threading.cpp b/src/server/shared/Threading/Threading.cpp index 85914994cb1..9b72d0f1499 100755 --- a/src/server/shared/Threading/Threading.cpp +++ b/src/server/shared/Threading/Threading.cpp @@ -179,7 +179,7 @@ void Thread::resume() ACE_THR_FUNC_RETURN Thread::ThreadTask(void * param) { - Runnable * _task = (Runnable*)param; + Runnable* _task = (Runnable*)param; _task->run(); // task execution complete, free referecne added at diff --git a/src/server/shared/Threading/Threading.h b/src/server/shared/Threading/Threading.h index 085659a42ac..0d327d5abaa 100755 --- a/src/server/shared/Threading/Threading.h +++ b/src/server/shared/Threading/Threading.h @@ -95,7 +95,7 @@ namespace ACE_Based ACE_thread_t m_iThreadId; ACE_hthread_t m_hThreadHandle; - Runnable * m_task; + Runnable* m_task; typedef ACE_TSS<Thread> ThreadStorage; //global object - container for Thread class representation of every thread diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp index 6a78897bbe0..7d3a6f7ed58 100755 --- a/src/server/shared/Utilities/Util.cpp +++ b/src/server/shared/Utilities/Util.cpp @@ -236,7 +236,7 @@ bool IsIPAddress(char const* ipaddress) /// create PID file uint32 CreatePIDFile(const std::string& filename) { - FILE * pid_file = fopen (filename.c_str(), "w" ); + FILE* pid_file = fopen (filename.c_str(), "w" ); if (pid_file == NULL) return 0; @@ -474,7 +474,7 @@ bool Utf8FitTo(const std::string& str, std::wstring search) return true; } -void utf8printf(FILE *out, const char *str, ...) +void utf8printf(FILE* out, const char *str, ...) { va_list ap; va_start(ap, str); @@ -482,7 +482,7 @@ void utf8printf(FILE *out, const char *str, ...) va_end(ap); } -void vutf8printf(FILE *out, const char *str, va_list* ap) +void vutf8printf(FILE* out, const char *str, va_list* ap) { #if PLATFORM == PLATFORM_WINDOWS char temp_buf[32*1024]; diff --git a/src/server/shared/Utilities/Util.h b/src/server/shared/Utilities/Util.h index 902b6019f0f..a91bfe3faa5 100755 --- a/src/server/shared/Utilities/Util.h +++ b/src/server/shared/Utilities/Util.h @@ -368,8 +368,8 @@ std::wstring GetMainPartOfName(std::wstring wname, uint32 declension); bool utf8ToConsole(const std::string& utf8str, std::string& conStr); bool consoleToUtf8(const std::string& conStr, std::string& utf8str); bool Utf8FitTo(const std::string& str, std::wstring search); -void utf8printf(FILE *out, const char *str, ...); -void vutf8printf(FILE *out, const char *str, va_list* ap); +void utf8printf(FILE* out, const char *str, ...); +void vutf8printf(FILE* out, const char *str, va_list* ap); bool IsIPAddress(char const* ipaddress); uint32 CreatePIDFile(const std::string& filename); @@ -648,4 +648,13 @@ public: return (part[el]); }; }; + +/* Select a random element from a container. Note: make sure you explicitly empty check the container */ +template <class C> typename C::value_type const& SelectRandomContainerElement(C const& container) +{ + typename C::const_iterator it = container.begin(); + std::advance(it, urand(0, container.size() - 1)); + return *it; +} + #endif diff --git a/src/server/worldserver/CommandLine/CliRunnable.cpp b/src/server/worldserver/CommandLine/CliRunnable.cpp index 5af2a4972db..3fd47c42dc3 100755 --- a/src/server/worldserver/CommandLine/CliRunnable.cpp +++ b/src/server/worldserver/CommandLine/CliRunnable.cpp @@ -43,7 +43,7 @@ char * command_finder(const char* text, int state) { static int idx, len; const char* ret; - ChatCommand *cmd = ChatHandler::getCommandTable(); + ChatCommand* cmd = ChatHandler::getCommandTable(); if (!state) { @@ -155,7 +155,7 @@ bool ChatHandler::GetDeletedCharacterInfoList(DeletedInfoList& foundList, std::s info.accountId = fields[2].GetUInt32(); // account name will be empty for not existed account - sAccountMgr->GetName(info.accountId, info.accountName); + AccountMgr::GetName(info.accountId, info.accountName); info.deleteDate = time_t(fields[3].GetUInt32()); @@ -278,7 +278,7 @@ void ChatHandler::HandleCharacterDeletedRestoreHelper(DeletedInfo const& delInfo } // check character count - uint32 charcount = sAccountMgr->GetCharactersCount(delInfo.accountId); + uint32 charcount = AccountMgr::GetCharactersCount(delInfo.accountId); if (charcount >= 10) { PSendSysMessage(LANG_CHARACTER_DELETED_SKIP_FULL, delInfo.name.c_str(), delInfo.lowguid, delInfo.accountId); @@ -350,7 +350,7 @@ bool ChatHandler::HandleCharacterDeletedRestoreCommand(const char* args) if (newAccount && newAccount != delInfo.accountId) { delInfo.accountId = newAccount; - sAccountMgr->GetName(newAccount, delInfo.accountName); + AccountMgr::GetName(newAccount, delInfo.accountName); } HandleCharacterDeletedRestoreHelper(delInfo); @@ -466,7 +466,7 @@ bool ChatHandler::HandleCharacterEraseCommand(const char* args){ } std::string account_name; - sAccountMgr->GetName (account_id, account_name); + AccountMgr::GetName (account_id, account_name); Player::DeleteFromDB(character_guid, account_id, true, true); PSendSysMessage(LANG_CHARACTER_DELETED, character_name.c_str(), GUID_LOPART(character_guid), account_name.c_str(), account_id); diff --git a/src/server/worldserver/Master.cpp b/src/server/worldserver/Master.cpp index c44ac1c9266..cb3cd1289f7 100755 --- a/src/server/worldserver/Master.cpp +++ b/src/server/worldserver/Master.cpp @@ -247,7 +247,7 @@ int Master::Run() if (sConfig->GetBoolDefault("SOAP.Enabled", false)) { - TCSoapRunnable *runnable = new TCSoapRunnable(); + TCSoapRunnable* runnable = new TCSoapRunnable(); runnable->setListenArguments(sConfig->GetStringDefault("SOAP.IP", "127.0.0.1"), sConfig->GetIntDefault("SOAP.Port", 7878)); soap_thread = new ACE_Based::Thread(runnable); } @@ -255,7 +255,7 @@ int Master::Run() ///- Start up freeze catcher thread if (uint32 freeze_delay = sConfig->GetIntDefault("MaxCoreStuckTime", 0)) { - FreezeDetectorRunnable *fdr = new FreezeDetectorRunnable(); + FreezeDetectorRunnable* fdr = new FreezeDetectorRunnable(); fdr->SetDelayTime(freeze_delay*1000); ACE_Based::Thread freeze_thread(fdr); freeze_thread.setPriority(ACE_Based::Highest); diff --git a/src/server/worldserver/RemoteAccess/RASocket.cpp b/src/server/worldserver/RemoteAccess/RASocket.cpp index 6ea3157b457..500869973d3 100755 --- a/src/server/worldserver/RemoteAccess/RASocket.cpp +++ b/src/server/worldserver/RemoteAccess/RASocket.cpp @@ -187,7 +187,7 @@ int RASocket::check_access_level(const std::string& user) return -1; } - Field *fields = result->Fetch(); + Field* fields = result->Fetch(); if (fields[1].GetUInt32() < iMinLevel) { @@ -213,7 +213,7 @@ int RASocket::check_password(const std::string& user, const std::string& pass) AccountMgr::normalizeString(safe_pass); LoginDatabase.EscapeString(safe_pass); - std::string hash = sAccountMgr->CalculateShaPassHash(safe_user, safe_pass); + std::string hash = AccountMgr::CalculateShaPassHash(safe_user, safe_pass); QueryResult check = LoginDatabase.PQuery( "SELECT 1 FROM account WHERE username = '%s' AND sha_pass_hash = '%s'", diff --git a/src/server/worldserver/TCSoap/TCSoap.cpp b/src/server/worldserver/TCSoap/TCSoap.cpp index 603b4824408..67c54e7e011 100755 --- a/src/server/worldserver/TCSoap/TCSoap.cpp +++ b/src/server/worldserver/TCSoap/TCSoap.cpp @@ -46,7 +46,7 @@ void TCSoapRunnable::run() sLog->outDebug(LOG_FILTER_NETWORKIO, "TCSoap: accepted connection from IP=%d.%d.%d.%d", (int)(soap.ip>>24)&0xFF, (int)(soap.ip>>16)&0xFF, (int)(soap.ip>>8)&0xFF, (int)soap.ip&0xFF); struct soap* thread_soap = soap_copy(&soap);// make a safe copy - ACE_Message_Block *mb = new ACE_Message_Block(sizeof(struct soap*)); + ACE_Message_Block* mb = new ACE_Message_Block(sizeof(struct soap*)); ACE_OS::memcpy(mb->wr_ptr(), &thread_soap, sizeof(struct soap*)); process_message(mb); } @@ -54,7 +54,7 @@ void TCSoapRunnable::run() soap_done(&soap); } -void TCSoapRunnable::process_message(ACE_Message_Block *mb) +void TCSoapRunnable::process_message(ACE_Message_Block* mb) { ACE_TRACE (ACE_TEXT ("SOAPWorkingThread::process_message")); @@ -82,20 +82,20 @@ int ns1__executeCommand(soap* soap, char* command, char** result) return 401; } - uint32 accountId = sAccountMgr->GetId(soap->userid); + uint32 accountId = AccountMgr::GetId(soap->userid); if(!accountId) { sLog->outDebug(LOG_FILTER_NETWORKIO, "TCSoap: Client used invalid username '%s'", soap->userid); return 401; } - if(!sAccountMgr->CheckPassword(accountId, soap->passwd)) + if(!AccountMgr::CheckPassword(accountId, soap->passwd)) { sLog->outDebug(LOG_FILTER_NETWORKIO, "TCSoap: invalid password for account '%s'", soap->userid); return 401; } - if(sAccountMgr->GetSecurity(accountId) < SEC_ADMINISTRATOR) + if(AccountMgr::GetSecurity(accountId) < SEC_ADMINISTRATOR) { sLog->outDebug(LOG_FILTER_NETWORKIO, "TCSoap: %s's gmlevel is too low", soap->userid); return 403; diff --git a/src/server/worldserver/TCSoap/TCSoap.h b/src/server/worldserver/TCSoap/TCSoap.h index 863d7597ef8..37ed841086d 100755 --- a/src/server/worldserver/TCSoap/TCSoap.h +++ b/src/server/worldserver/TCSoap/TCSoap.h @@ -41,7 +41,7 @@ class TCSoapRunnable: public ACE_Based::Runnable m_port = port; } private: - void process_message(ACE_Message_Block *mb); + void process_message(ACE_Message_Block* mb); std::string m_host; uint16 m_port; diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index d9ce9ee223f..75020b7e7bd 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2156,8 +2156,10 @@ Rate.MoveSpeed = 1 # # Rate.InstanceResetTime -# Description: Multiplier for the number of days in between global raid/heroic instance -# resets. +# Description: Multiplier for the rate between global raid/heroic instance resets +# (dbc value). Higher value increases the time between resets, +# lower value lowers the time, you need clean instance_reset in +# characters db in order to let new values work. # Default: 1 Rate.InstanceResetTime = 1 |
