diff options
-rw-r--r-- | sql/updates/world/2012_12_20_00_world_conditions (2).sql (renamed from sql/updates/world/2012_12_20_0_world_conditions.sql) | 0 | ||||
-rw-r--r-- | sql/updates/world/2012_12_23_00_world_creature_text.sql (renamed from sql/updates/world/2012_12_23_00_creature_text.sql) | 0 | ||||
-rw-r--r-- | sql/updates/world/2012_12_23_01_world_creature_text.sql (renamed from sql/updates/world/2012_12_23_01_creature_text.sql) | 0 | ||||
-rw-r--r-- | sql/updates/world/2012_12_23_02_world_trinity_string.sql | 1 | ||||
-rw-r--r-- | sql/updates/world/2012_12_23_03_world_misc.sql | 121 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 44 | ||||
-rw-r--r-- | src/server/game/Entities/Player/Player.h | 7 | ||||
-rw-r--r-- | src/server/game/Handlers/ChatHandler.cpp | 51 | ||||
-rw-r--r-- | src/server/game/Spells/Spell.cpp | 2 |
9 files changed, 174 insertions, 52 deletions
diff --git a/sql/updates/world/2012_12_20_0_world_conditions.sql b/sql/updates/world/2012_12_20_00_world_conditions (2).sql index f07b18ed2e4..f07b18ed2e4 100644 --- a/sql/updates/world/2012_12_20_0_world_conditions.sql +++ b/sql/updates/world/2012_12_20_00_world_conditions (2).sql diff --git a/sql/updates/world/2012_12_23_00_creature_text.sql b/sql/updates/world/2012_12_23_00_world_creature_text.sql index 37b4d66b3fe..37b4d66b3fe 100644 --- a/sql/updates/world/2012_12_23_00_creature_text.sql +++ b/sql/updates/world/2012_12_23_00_world_creature_text.sql diff --git a/sql/updates/world/2012_12_23_01_creature_text.sql b/sql/updates/world/2012_12_23_01_world_creature_text.sql index b663c5269e9..b663c5269e9 100644 --- a/sql/updates/world/2012_12_23_01_creature_text.sql +++ b/sql/updates/world/2012_12_23_01_world_creature_text.sql diff --git a/sql/updates/world/2012_12_23_02_world_trinity_string.sql b/sql/updates/world/2012_12_23_02_world_trinity_string.sql new file mode 100644 index 00000000000..ac99945d5a5 --- /dev/null +++ b/sql/updates/world/2012_12_23_02_world_trinity_string.sql @@ -0,0 +1 @@ +UPDATE `trinity_string` SET `content_default` = '%s does not wish to be disturbed: %s' WHERE `entry`=707; diff --git a/sql/updates/world/2012_12_23_03_world_misc.sql b/sql/updates/world/2012_12_23_03_world_misc.sql new file mode 100644 index 00000000000..c9a42df10dd --- /dev/null +++ b/sql/updates/world/2012_12_23_03_world_misc.sql @@ -0,0 +1,121 @@ +SET @NPC_QUETZLUN := 28030; +SET @NPC_MUFUNU := 28752; +SET @NPC_MUFUNU_KC := 28753; +SET @NPC_TUATUA := 28754; +SET @NPC_TUATUA_KC := 28755; +SET @NPC_HAWINNI := 28756; +SET @NPC_HAWINNI_KC := 28757; +SET @SPELL_HIGH_PRIEST_IMMUNITY := 4309; +SET @SPELL_HEX_OF_AIR_KNOCKBACK := 41909; +SET @SPELL_RANDOM_CIRCUMFERENCE_1 := 42267; +SET @SPELL_RANDOM_CIRCUMFERENCE_2 := 42274; +SET @SPELL_SUICIDE := 45254; +SET @SPELL_HEX := 52250; +SET @SPELL_HEXXING_STICK := 52251; +SET @SPELL_HEX_OF_AIR := 52249; +SET @SPELL_HEX_OF_FIRE := 52278; +SET @SPELL_TUATUA_ON_BURN := 52279; +SET @SPELL_HEX_OF_FROST := 52287; +SET @SPELL_HAWINNI_ON_FROZEN := 52303; +SET @SPELL_RANDOM_CIRCUMFERENCE := 52320; + +DELETE FROM `creature_text` WHERE `entry` IN (@NPC_QUETZLUN,@NPC_MUFUNU,@NPC_TUATUA,@NPC_HAWINNI); +INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES +(@NPC_QUETZLUN,0,0,'There is no escape. There is only my wrath!',14,0,100,0,0,0,'Quetz''lun'), +(@NPC_QUETZLUN,0,1,'Eternal damnation is your future.',14,0,100,0,0,0,'Quetz''lun'), +(@NPC_QUETZLUN,0,2,'My judgment is final.',14,0,100,0,0,0,'Quetz''lun'), +(@NPC_QUETZLUN,0,3,'Beg for your life. Plead. It will do you no good!',14,0,100,0,0,0,'Quetz''lun'), +(@NPC_QUETZLUN,0,4,'Burn in the fires of my fury!',14,0,100,0,0,0,'Quetz''lun'), +(@NPC_QUETZLUN,0,5,'Die!',14,0,100,0,0,0,'Quetz''lun'), +(@NPC_QUETZLUN,0,6,'You killed me and now I will kill you... over and over!',14,0,100,0,0,0,'Quetz''lun'), +(@NPC_QUETZLUN,0,7,'I find you wanting.',14,0,100,0,0,0,'Quetz''lun'), +(@NPC_MUFUNU,0,0,'NOOOOOOOOOoooooooo.......!',12,0,100,0,0,0,'Mu''funu'), +(@NPC_TUATUA,0,0,'FIRE! AHHHHHHHH!',12,0,100,0,0,0,'Tua-tua'), +(@NPC_TUATUA,1,0,'The high priestess is reduced to charcoal.',16,0,100,0,0,0,'Tua-Tua'), +(@NPC_HAWINNI,0,0,'%s becomes enraged!',16,0,100,0,0,0,'Hawinni'), +(@NPC_HAWINNI,1,0,'BRRRRRR!',12,0,100,0,0,0,'Hawinni'), +(@NPC_HAWINNI,2,0,'%s explodes!',16,0,100,0,0,0,'Hawinni'); + +UPDATE `creature_model_info` SET `bounding_radius`=0.875, `combat_reach`=1.75 WHERE `modelid`=25669; +UPDATE `creature_model_info` SET `bounding_radius`=1.5, `combat_reach`=3 WHERE `modelid`=25672; + +DELETE FROM `conditions` WHERE `SourceEntry`=@SPELL_HEXXING_STICK AND `SourceTypeOrReferenceId`=17; +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceEntry` IN (@NPC_MUFUNU,@NPC_TUATUA); +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(17,0,@SPELL_HEXXING_STICK,0,0,31,1,3,@NPC_MUFUNU,0,0,0,'','Spell Quetz''lun''s Hexxing Stick can only be casted on High Priest Mu''funu'), +(17,0,@SPELL_HEXXING_STICK,0,1,31,1,3,@NPC_TUATUA,0,0,0,'','Spell Quetz''lun''s Hexxing Stick can only be casted on High Priestess Tua-Tua'), +(17,0,@SPELL_HEXXING_STICK,0,2,31,1,3,@NPC_HAWINNI,0,0,0,'','Spell Quetz''lun''s Hexxing Stick can only be casted on High Priest Hawinni'), +(22,2,@NPC_MUFUNU,0,0,1,1,@SPELL_HEX_OF_AIR,0,0,1,0,'','SAI High Priest Mu''funu cast Shadow Channeling if aura Hex is not applied'), +(22,2,@NPC_TUATUA,0,0,1,1,@SPELL_HEX_OF_FIRE,0,0,1,0,'','SAI High Priestess Tua-tua remove Shadow Form and cast Shadow Channeling if aura Hex is not applied'); + +DELETE FROM `spell_linked_spell` WHERE `spell_trigger` IN (-@SPELL_HEX_OF_AIR_KNOCKBACK,@SPELL_TUATUA_ON_BURN,@SPELL_HEX_OF_FROST,@SPELL_HAWINNI_ON_FROZEN); +INSERT INTO `spell_linked_spell` (`spell_trigger`,`spell_effect`,`type`,`comment`) VALUES +(-@SPELL_HEX_OF_AIR_KNOCKBACK,@SPELL_SUICIDE,0,'On spellfade Hex of Air Knockback - Spellcast Suicide'), +(@SPELL_TUATUA_ON_BURN,@SPELL_SUICIDE,1,'On spellhit Tua-Tua on Burn - Spellcast Suicide'), +(@SPELL_HEX_OF_FROST,@SPELL_HIGH_PRIEST_IMMUNITY,2,'On aura Hex of Frost - Apply High Priest Immunity'), +(@SPELL_HAWINNI_ON_FROZEN,@SPELL_SUICIDE,1,'On spellhit Hawinni on Frozen - Spellcast Suicide'); + +-- SmartAIs +UPDATE `smart_scripts` SET `link`=1 WHERE `entryorguid`=@NPC_QUETZLUN; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@NPC_QUETZLUN AND `source_type`=0 AND `id`=1; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@NPC_MUFUNU AND `source_type`=0 AND `id` IN (11,12,13); +DELETE FROM `smart_scripts` WHERE `entryorguid`=@NPC_TUATUA AND `source_type`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`=@NPC_HAWINNI AND `source_type`=0 AND `id` IN (3,4,5); +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@NPC_MUFUNU*100,@NPC_TUATUA*100,@NPC_HAWINNI*100) AND `source_type`=9; +INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES +(@NPC_QUETZLUN,0,1,0,61,0,100,0,0,0,0,0,1,0,0,0,0,0,0,21,100,0,0,0,0,0,0, 'Quetz''lun - On update OOC - Say line'), + +(@NPC_MUFUNU,0,11,0,8,0,100,0,@SPELL_HEX,0,0,0,42,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Mu''funu - On spellhit Hex - Set invincibility 1 HP'), +(@NPC_MUFUNU,0,12,13,2,0,100,1,0,0.1,0,0,33,@NPC_MUFUNU_KC,0,0,0,0,0,16,0,0,0,0,0,0,0, 'High Priest Mu''funu - On health below 0.1% - Quest credit'), +(@NPC_MUFUNU,0,13,0,61,0,100,0,0,0,0,0,80,@NPC_MUFUNU*100,2,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Mu''funu - On health below 0.1% - Run script'), +(@NPC_MUFUNU*100,9,0,0,0,0,100,0,0,0,0,0,101,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Mu''funu script - Set homeposition'), +(@NPC_MUFUNU*100,9,1,0,0,0,100,0,0,0,0,0,102,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Mu''funu script - Stop health regen'), +(@NPC_MUFUNU*100,9,2,0,0,0,100,0,0,0,0,0,18,256,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Mu''funu script - Set unit_flags IMMUNE_TO_PC'), +(@NPC_MUFUNU*100,9,3,0,0,0,100,0,0,0,0,0,24,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Mu''funu script - Evade'), +(@NPC_MUFUNU*100,9,4,0,0,0,100,0,0,0,0,0,42,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Mu''funu script - Remove invincibility'), +(@NPC_MUFUNU*100,9,5,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,7,0,0,0,0,0,0,0, 'High Priest Mu''funu script - Say line'), +(@NPC_MUFUNU*100,9,6,0,0,0,100,0,0,0,0,0,11,@SPELL_HEX_OF_AIR,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Mu''funu script - Spellcast Hex of Air'), +(@NPC_MUFUNU*100,9,7,0,0,0,100,0,10000,10000,0,0,11,@SPELL_HEX_OF_AIR_KNOCKBACK,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Mu''funu script - Spellcast Knockback'), +(@NPC_MUFUNU*100,9,8,0,0,0,100,0,0,0,0,0,19,256,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Mu''funu script - Remove unit_flags IMMUNE_TO_PC'), + +(@NPC_TUATUA,0,0,0,11,0,100,0,0,0,0,0,11,51733,0,0,0,0,0,1,0,0,0,0,0,0,0,'High Priestess Tua-Tua - On spawn - Spellcast Shadow Channelling'), +(@NPC_TUATUA,0,1,2,21,0,100,0,0,0,0,0,28,29406,0,0,0,0,0,1,0,0,0,0,0,0,0,'High Priestess Tua-Tua - On homeposition reached - Spellcast Shadow Channelling'), +(@NPC_TUATUA,0,2,0,61,0,100,0,0,0,0,0,11,51733,0,0,0,0,0,1,0,0,0,0,0,0,0,'High Priestess Tua-Tua - On homeposition reached - Remove aura Shadowform'), +(@NPC_TUATUA,0,3,0,4,0,100,0,0,0,0,0,11,29406,0,0,0,0,0,1,0,0,0,0,0,0,0,'High Priestess Tua-Tua - On aggro - Spellcast Shadowform'), +(@NPC_TUATUA,0,4,0,0,0,100,0,2000,3000,15000,20000,11,51818,0,0,0,0,0,2,0,0,0,0,0,0,0,'High Priestess Tua-Tua - On update IC - Spellcast Shadow Word: Death'), +(@NPC_TUATUA,0,5,0,0,0,100,0,4000,5000,3000,5000,11,13860,0,0,0,0,0,2,0,0,0,0,0,0,0,'High Priestess Tua-Tua - On update IC - Spellcast Mind Blast'), +(@NPC_TUATUA,0,6,0,8,0,100,0,@SPELL_HEX,0,0,0,42,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priestess Tua-tua - On spellhit Hex - Set invincibility 1 HP'), +(@NPC_TUATUA,0,7,8,2,0,100,1,0,0.1,0,0,33,@NPC_TUATUA_KC,0,0,0,0,0,16,0,0,0,0,0,0,0, 'High Priestess Tua-tua - On health below 0.1% - Quest credit'), +(@NPC_TUATUA,0,8,0,61,0,100,0,0,0,0,0,80,@NPC_TUATUA*100,2,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priestess Tua-tua - On health below 0.1% - Run script'), +(@NPC_TUATUA*100,9,0,0,0,0,100,0,0,0,0,0,101,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priestess Tua-tua script - Set homeposition'), +(@NPC_TUATUA*100,9,1,0,0,0,100,0,0,0,0,0,102,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priestess Tua-tua script - Stop health regen'), +(@NPC_TUATUA*100,9,2,0,0,0,100,0,0,0,0,0,18,256,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priestess Tua-tua script - Set unit_flags IMMUNE_TO_PC'), +(@NPC_TUATUA*100,9,3,0,0,0,100,0,0,0,0,0,24,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priestess Tua-tua script - Evade'), +(@NPC_TUATUA*100,9,4,0,0,0,100,0,0,0,0,0,42,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priestess Tua-tua script - Remove invincibility'), +(@NPC_TUATUA*100,9,5,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,7,0,0,0,0,0,0,0, 'High Priestess Tua-tua script - Say line'), +(@NPC_TUATUA*100,9,6,0,0,0,100,0,0,0,0,0,11,@SPELL_HEX_OF_FIRE,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priestess Tua-tua script - Spellcast Hex of Fire'), +(@NPC_TUATUA*100,9,7,0,0,0,100,0,10000,10000,0,0,11,@SPELL_TUATUA_ON_BURN,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priestess Tua-tua script - Spellcast Tua-tua on Burn'), +(@NPC_TUATUA*100,9,8,0,0,0,100,0,0,0,0,0,3,0,25669,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priestess Tua-tua script - Change modelid'), +(@NPC_TUATUA*100,9,9,0,0,0,100,0,0,0,0,0,19,256,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priestess Tua-tua script - Remove unit_flags IMMUNE_TO_PC'), +(@NPC_TUATUA*100,9,10,0,0,0,100,0,0,0,0,0,1,1,0,0,0,0,0,7,0,0,0,0,0,0,0, 'High Priestess Tua-tua script - Say line'), + +(@NPC_HAWINNI,0,3,0,8,0,100,0,@SPELL_HEX,0,0,0,42,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Hawinni - On spellhit Hex - Set invincibility 1 HP'), +(@NPC_HAWINNI,0,4,5,2,0,100,1,0,0.1,0,0,33,@NPC_HAWINNI_KC,0,0,0,0,0,16,0,0,0,0,0,0,0, 'High Priest Hawinni - On health below 0.1% - Quest credit'), +(@NPC_HAWINNI,0,5,0,61,0,100,0,0,0,0,0,80,@NPC_HAWINNI*100,2,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Hawinni - On health below 0.1% - Run script'), +(@NPC_HAWINNI*100,9,0,0,0,0,100,0,0,0,0,0,11,@SPELL_HEX_OF_FROST,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Hawinni script - Spellcast Hex of Frost'), +(@NPC_HAWINNI*100,9,1,0,0,0,100,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Hawinni script - Say line'), +(@NPC_HAWINNI*100,9,2,0,0,0,100,0,10000,10000,0,0,11,@SPELL_RANDOM_CIRCUMFERENCE_1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Hawinni script - Spellcast Random Circumference Point Bone'), +(@NPC_HAWINNI*100,9,3,0,0,0,100,0,0,0,0,0,11,@SPELL_RANDOM_CIRCUMFERENCE_2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Hawinni script - Spellcast Random Circumference Point Bone 2'), +(@NPC_HAWINNI*100,9,4,0,0,0,100,0,0,0,0,0,11,@SPELL_RANDOM_CIRCUMFERENCE_1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Hawinni script - Spellcast Random Circumference Point Bone'), +(@NPC_HAWINNI*100,9,5,0,0,0,100,0,0,0,0,0,11,@SPELL_RANDOM_CIRCUMFERENCE_2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Hawinni script - Spellcast Random Circumference Point Bone 2'), +(@NPC_HAWINNI*100,9,6,0,0,0,100,0,0,0,0,0,11,@SPELL_RANDOM_CIRCUMFERENCE,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Hawinni script - Spellcast Random Circumference Ice Chunk'), +(@NPC_HAWINNI*100,9,7,0,0,0,100,0,0,0,0,0,11,@SPELL_RANDOM_CIRCUMFERENCE_1,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Hawinni script - Spellcast Random Circumference Point Bone'), +(@NPC_HAWINNI*100,9,8,0,0,0,100,0,0,0,0,0,11,@SPELL_RANDOM_CIRCUMFERENCE_2,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Hawinni script - Spellcast Random Circumference Point Bone 2'), +(@NPC_HAWINNI*100,9,9,0,0,0,100,0,0,0,0,0,11,@SPELL_RANDOM_CIRCUMFERENCE,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Hawinni script - Spellcast Random Circumference Ice Chunk'), +(@NPC_HAWINNI*100,9,10,0,0,0,100,0,0,0,0,0,11,@SPELL_RANDOM_CIRCUMFERENCE,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Hawinni script - Spellcast Random Circumference Ice Chunk'), +(@NPC_HAWINNI*100,9,11,0,0,0,100,0,0,0,0,0,11,@SPELL_RANDOM_CIRCUMFERENCE,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Hawinni script - Spellcast Random Circumference Ice Chunk'), +(@NPC_HAWINNI*100,9,12,0,0,0,100,0,0,0,0,0,11,@SPELL_RANDOM_CIRCUMFERENCE,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Hawinni script - Spellcast Random Circumference Ice Chunk'), +(@NPC_HAWINNI*100,9,13,0,0,0,100,0,0,0,0,0,1,2,0,0,0,0,0,7,0,0,0,0,0,0,0, 'High Priest Hawinni script - Say line'), +(@NPC_HAWINNI*100,9,14,0,0,0,100,0,0,0,0,0,42,0,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Hawinni script - Remove invincibility'), +(@NPC_HAWINNI*100,9,15,0,0,0,100,0,50,50,0,0,11,@SPELL_HAWINNI_ON_FROZEN,0,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Hawinni script - Spellcast Hawinni on Frozen'), +(@NPC_HAWINNI*100,9,16,0,0,0,100,0,0,0,0,0,3,0,25672,0,0,0,0,1,0,0,0,0,0,0,0, 'High Priest Hawinni script - Change modelid'); diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index b3f05ab9733..471cbc6d114 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -2042,24 +2042,18 @@ bool Player::BuildEnumData(PreparedQueryResult result, ByteBuffer* dataBuffer, B return true; } -bool Player::ToggleAFK() +void Player::ToggleAFK() { ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK); - bool state = HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK); - // afk player not allowed in battleground - if (state && InBattleground() && !InArena()) + if (isAFK() && InBattleground() && !InArena()) LeaveBattleground(); - - return state; } -bool Player::ToggleDND() +void Player::ToggleDND() { ToggleFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND); - - return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND); } uint8 Player::GetChatTag() const @@ -20342,19 +20336,17 @@ void Player::Whisper(const std::string& text, uint32 language, uint64 receiver) std::string _text(text); sScriptMgr->OnPlayerChat(this, CHAT_MSG_WHISPER, language, _text, rPlayer); - // when player you are whispering to is dnd, he cannot receive your message, unless you are in gm mode - if (!rPlayer->isDND() || isGameMaster()) - { - WorldPacket data(SMSG_MESSAGECHAT, 200); - BuildPlayerChat(&data, CHAT_MSG_WHISPER, _text, language); - rPlayer->GetSession()->SendPacket(&data); + WorldPacket data(SMSG_MESSAGECHAT, 200); + BuildPlayerChat(&data, CHAT_MSG_WHISPER, _text, language); + rPlayer->GetSession()->SendPacket(&data); - data.Initialize(SMSG_MESSAGECHAT, 200); - rPlayer->BuildPlayerChat(&data, CHAT_MSG_WHISPER_INFORM, _text, language); - GetSession()->SendPacket(&data); - } - else // announce to player that player he is whispering to is dnd and cannot receive his message - ChatHandler(GetSession()).PSendSysMessage(LANG_PLAYER_DND, rPlayer->GetName().c_str(), rPlayer->dndMsg.c_str()); + // rest stuff shouldn't happen in case of addon message + if (isAddonMessage) + return; + + data.Initialize(SMSG_MESSAGECHAT, 200); + rPlayer->BuildPlayerChat(&data, CHAT_MSG_WHISPER_INFORM, _text, language); + GetSession()->SendPacket(&data); if (!isAcceptWhispers() && !isGameMaster() && !rPlayer->isGameMaster()) { @@ -20362,13 +20354,11 @@ void Player::Whisper(const std::string& text, uint32 language, uint64 receiver) ChatHandler(GetSession()).SendSysMessage(LANG_COMMAND_WHISPERON); } - // announce to player that player he is whispering to is afk + // announce afk or dnd message if (rPlayer->isAFK()) - ChatHandler(GetSession()).PSendSysMessage(LANG_PLAYER_AFK, rPlayer->GetName().c_str(), rPlayer->afkMsg.c_str()); - - // if player whisper someone, auto turn of dnd to be able to receive an answer - if (isDND() && !rPlayer->isGameMaster()) - ToggleDND(); + ChatHandler(GetSession()).PSendSysMessage(LANG_PLAYER_AFK, rPlayer->GetName().c_str(), rPlayer->autoReplyMsg.c_str()); + else if (rPlayer->isDND()) + ChatHandler(GetSession()).PSendSysMessage(LANG_PLAYER_DND, rPlayer->GetName().c_str(), rPlayer->autoReplyMsg.c_str()); } void Player::PetSpellInitialize() diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index 15628c61e10..d74fd372451 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1291,13 +1291,12 @@ class Player : public Unit, public GridObject<Player> Creature* GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask); GameObject* GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes type) const; - bool ToggleAFK(); - bool ToggleDND(); + void ToggleAFK(); + void ToggleDND(); bool isAFK() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK); } bool isDND() const { return HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_DND); } uint8 GetChatTag() const; - std::string afkMsg; - std::string dndMsg; + std::string autoReplyMsg; uint32 GetBarberShopCost(uint8 newhairstyle, uint8 newhaircolor, uint8 newfacialhair, BarberShopStyleEntry const* newSkin=NULL); diff --git a/src/server/game/Handlers/ChatHandler.cpp b/src/server/game/Handlers/ChatHandler.cpp index d194d379b5c..a7c6442854e 100644 --- a/src/server/game/Handlers/ChatHandler.cpp +++ b/src/server/game/Handlers/ChatHandler.cpp @@ -472,40 +472,51 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData) } break; case CHAT_MSG_AFK: { - if ((msg.empty() || !_player->isAFK()) && !_player->isInCombat()) + if (!_player->isInCombat()) { - if (!_player->isAFK()) + if (_player->isAFK()) // Already AFK { if (msg.empty()) - msg = GetTrinityString(LANG_PLAYER_AFK_DEFAULT); - _player->afkMsg = msg; + _player->ToggleAFK(); // Remove AFK + else + _player->autoReplyMsg = msg; // Update message } + else // New AFK mode + { + _player->autoReplyMsg = msg.empty() ? GetTrinityString(LANG_PLAYER_AFK_DEFAULT) : msg; - sScriptMgr->OnPlayerChat(_player, type, lang, msg); + if (_player->isDND()) + _player->ToggleDND(); + + _player->ToggleAFK(); + } - _player->ToggleAFK(); - if (_player->isAFK() && _player->isDND()) - _player->ToggleDND(); + sScriptMgr->OnPlayerChat(_player, type, lang, msg); } - } break; + break; + } case CHAT_MSG_DND: { - if (msg.empty() || !_player->isDND()) + if (_player->isDND()) // Already DND { - if (!_player->isDND()) - { - if (msg.empty()) - msg = GetTrinityString(LANG_PLAYER_DND_DEFAULT); - _player->dndMsg = msg; - } + if (msg.empty()) + _player->ToggleDND(); // Remove DND + else + _player->autoReplyMsg = msg; // Update message + } + else // New DND mode + { + _player->autoReplyMsg = msg.empty() ? GetTrinityString(LANG_PLAYER_DND_DEFAULT) : msg; - sScriptMgr->OnPlayerChat(_player, type, lang, msg); + if (_player->isAFK()) + _player->ToggleAFK(); _player->ToggleDND(); - if (_player->isDND() && _player->isAFK()) - _player->ToggleAFK(); } - } break; + + sScriptMgr->OnPlayerChat(_player, type, lang, msg); + break; + } default: sLog->outError(LOG_FILTER_NETWORKIO, "CHAT: unknown message type %u, lang: %u", type, lang); break; diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 364127a55ba..25dcd0c43ba 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5656,7 +5656,7 @@ SpellCastResult Spell::CheckCasterAuras() const Unit::AuraEffectList const& stunAuras = m_caster->GetAuraEffectsByType(SPELL_AURA_MOD_STUN); for (Unit::AuraEffectList::const_iterator i = stunAuras.begin(); i != stunAuras.end(); ++i) { - if (!((*i)->GetSpellInfo()->GetAllEffectsMechanicMask() & (1<<MECHANIC_STUN))) + if ((*i)->GetSpellInfo()->GetAllEffectsMechanicMask() && !((*i)->GetSpellInfo()->GetAllEffectsMechanicMask() & (1<<MECHANIC_STUN))) { foundNotStun = true; break; |