diff --git a/configure.ac b/configure.ac index 4fc5e6d68..c9f635b78 100644 --- a/configure.ac +++ b/configure.ac @@ -201,16 +201,34 @@ AC_TYPE_SIGNAL AC_FUNC_VPRINTF AC_CHECK_FUNCS([atexit ftime gethostbyaddr gethostbyname gethostname gettimeofday memmove memset pow realpath select socket sqrt strchr strdup strerror strstr]) -PKG_CHECK_MODULES(ACE, [ACE >= 5.5.2], [need_to_build_ace=no], [need_to_build_ace=yes]) -if test X$need_to_build_ace = Xyes ; then + +# Check for use buildtin ACE sources +AC_ARG_ENABLE(builtin_ace, AC_HELP_STRING([--enable-builtin-ace], [turn on/off using builtin ACE sources])) + +enable_builtin_ace_support=yes + +if test "x$enable_builtin_ace" = "xno"; then + PKG_CHECK_MODULES(ACE, [ACE >= 5.5.2], [need_builtin_ace=no], [need_builtin_ace=yes]) + if test X$need_builtin_ace = Xyes ; then + AC_MSG_ERROR([You need to install ACE package or use built-in ACE sources]) + fi + enable_builtin_ace_support=no +fi + +if test X$enable_builtin_ace_support = Xno; then + + # old ace versions might not have ace/Stack_Trace.h... + AC_LANG_PUSH([C++]) + AC_CHECK_HEADERS([ace/Stack_Trace.h]) + AC_LANG_POP +else + # ...but we certainly have it in our included version + AC_DEFINE(HAVE_ACE_STACK_TRACE_H) ACE_INCLUDES="-I\$(top_srcdir)/dep/ACE_wrappers -I\$(top_builddir)/dep/ACE_wrappers" ACE_LIBS="\$(top_builddir)/dep/ACE_wrappers/ace/libACE.la" fi -AM_CONDITIONAL([MANGOS_BUILD_ACE], [test X$need_to_build_ace = Xyes]) - -# old ace versions not have ace/Stack_Trace.h -AC_CHECK_HEADERS([ace/Stack_Trace.h]) +AM_CONDITIONAL([MANGOS_BUILD_ACE], [test X$enable_builtin_ace_support = Xyes]) ## Unify all additional includes/libs in one variable. # TODO this looks kinda ugly, but when we add m4 folder I will make it look very pritey ( by Derex ). @@ -261,7 +279,7 @@ AC_CONFIG_FILES([ ]) ## Configure ACE, if needed -if test X$need_to_build_ace = Xyes; then +if test X$enable_builtin_ace_support = Xyes; then AC_CONFIG_SUBDIRS([dep/ACE_wrappers]) fi diff --git a/sql/mangos.sql b/sql/mangos.sql index 49fc0ed79..bd201fc65 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -24,7 +24,7 @@ CREATE TABLE `db_version` ( `version` varchar(120) default NULL, `creature_ai_version` varchar(120) default NULL, `cache_id` int(10) default '0', - `required_8399_01_mangos_spell_elixir` bit(1) default NULL + `required_8416_01_mangos_spell_learn_spell` bit(1) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes'; -- @@ -2831,8 +2831,8 @@ INSERT INTO `mangos_string` VALUES (509,'%d - sender: %s (guid: %u account: %u ) receiver: %s (guid: %u account: %u ) %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (510,'%d - owner: %s (guid: %u account: %u ) %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (511,'Wrong link type!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(512,'%d - |cffffffff|Hitem:%d:0:0:0:0:0:0:0|h[%s]|h|r ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), -(513,'%d - |cffffffff|Hquest:%d|h[%s]|h|r %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(512,'%d - |cffffffff|Hitem:%d:0:0:0:0:0:0:0:0|h[%s]|h|r ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(513,'%d - |cffffffff|Hquest:%d:%d|h[%s]|h|r %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (514,'%d - |cffffffff|Hcreature_entry:%d|h[%s]|h|r ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (515,'%d - |cffffffff|Hcreature:%d|h[%s X:%f Y:%f Z:%f MapId:%d]|h|r ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (516,'%d - |cffffffff|Hgameobject_entry:%d|h[%s]|h|r ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), @@ -17045,39 +17045,20 @@ CREATE TABLE `spell_learn_spell` ( LOCK TABLES `spell_learn_spell` WRITE; /*!40000 ALTER TABLE `spell_learn_spell` DISABLE KEYS */; INSERT INTO `spell_learn_spell` VALUES -(71,7376,0), -(768,3025,0), -(783,5419,0), -(1066,5421,0), -(2457,21156,0), -(2458,7381,0), -(5487,1178,0), -(5487,21178,0), (5784,33388,1), -(9634,9635,0), -(9634,21178,0), (13819,33388,1), (17002,24867,0), (23161,33391,1), (23214,33391,1), -(24858,24905,0), (24866,24864,0), (33872,47179,0), (33873,47180,0), -(33891,5420,0), -(33891,34123,0), -(33943,33948,0), (33943,34090,1), -(33943,34764,0), (34767,33391,1), (34769,33388,1), -(40123,40121,0), -(40123,40122,0), (53428,53341,1), (53428,53343,1), (58984,21009,1); - - /*!40000 ALTER TABLE `spell_learn_spell` ENABLE KEYS */; UNLOCK TABLES; diff --git a/sql/mangos_spell_check.sql b/sql/mangos_spell_check.sql index a1a93cb43..1585270f7 100644 --- a/sql/mangos_spell_check.sql +++ b/sql/mangos_spell_check.sql @@ -16,7 +16,7 @@ /* re-adding before command use. So need just adding new line to file. */ /* Current table fill progress state: */ -/* SpellEffect.cpp from start until end of Spell::EffectPowerBurn */ +/* SpellEffect.cpp from start until end of Spell::EffectEnchantItemPrismatic */ DROP TABLE IF EXISTS spell_check; CREATE TABLE `spell_check` ( @@ -41,6 +41,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (1454, 5,0x0000000000040000,0x00000000, -1, -1, -1, 3, -1,-1,'Life Tap', 'Spell::EffectDummy'), (1455, 5,0x0000000000040000,0x00000000, -1, -1, -1, 3, -1,-1,'Life Tap', 'Spell::EffectDummy'), (1456, 5,0x0000000000040000,0x00000000, -1, -1, -1, 3, -1,-1,'Life Tap', 'Spell::EffectDummy'), +(9512, -1, -1, -1, -1, -1, -1, 30, -1,-1,'Restore Energy', 'Spell::EffectEnergize'), (4073, -1, -1, -1, -1, -1, -1, -1, -1,-1,'Mechanical Dragonling', 'Spell::EffectDummy'), (5938, 8, -1, -1, -1, -1, -1, 3, -1,-1,'Shiv', 'Spell::EffectDummy'), (5940, -1, -1, -1, -1, -1, -1, -1, -1,-1,'Shiv', 'Spell::EffectDummy'), @@ -58,7 +59,6 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (8220, -1, -1, -1, -1, -1, -1, -1, -1,-1,'Flip Out', 'Spell::EffectDummy'), (8221, -1, -1, -1, -1, -1, -1, -1, -1,-1,'Yaaarrrr', 'Spell::EffectDummy'), (8222, -1, -1, -1, -1, -1, -1, -1, -1,-1,'Yaaarrrr', 'Spell::EffectDummy'), -(8326, -1, -1, -1, -1, -1, -1, 6, -1,-1,'Ghost', 'Spell::EffectApplyAura'), (8593, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Symbol of life', 'Spell::EffectDummy'), (10399,11,0x0000000000400000,0x00000000, -1, -1, -1, 3, -1,-1,'Rockbiter Weapon', 'Spell::EffectDummy'), (11687, 5,0x0000000000040000,0x00000000, -1, -1, -1, 3, -1,-1,'Life Tap', 'Spell::EffectDummy'), @@ -93,13 +93,13 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (18790,-1, -1, -1, -1, -1, -1, -1, -1,-1,'', 'Spell::EffectInstaKill'), (18791,-1, -1, -1, -1, -1, -1, -1, -1,-1,'', 'Spell::EffectInstaKill'), (18792,-1, -1, -1, -1, -1, -1, -1, -1,-1,'', 'Spell::EffectInstaKill'), +(19658,-1, -1, -1, -1, -1, -1, 10, -1,-1,'Devour Magic Effect', 'Spell::EffectDispel'), (19804,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Arcanite Dragonling', 'Spell::EffectDummy'), (20187,10, -1, -1, -1, -1, -1, 3, -1,-1,'Judgement of Righteousness', 'Spell::EffectDummy'), (20253, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Intercept', 'Spell::EffectSchoolDMG'), (20473,10, -1, -1, 156, -1, -1, 3, -1,-1,'Holy Shock', 'Spell::EffectDummy'), (20577, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Cannibalize', 'Spell::EffectDummy'), (20578,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Cannibalize', 'Spell::EffectDummy'), -(20584,-1, -1, -1, -1, -1, -1, 6, -1,-1,'Ghost', 'Spell::EffectApplyAura'), (20647,-1, -1, -1, -1, -1, -1, 2, -1, 0,'Execute', 'Spell::EffectDummy'), (20929,10, -1, -1, 156, -1, -1, 3, -1,-1,'Holy Shock', 'Spell::EffectDummy'), (20930,10, -1, -1, 156, -1, -1, 3, -1,-1,'Holy Shock', 'Spell::EffectDummy'), @@ -128,7 +128,15 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (23885,-1, -1, -1, -1, -1, -1, 6, 42, 0,'Bloodthirst', 'Spell::EffectDummy'), (23989, 9, -1, -1, -1, -1, -1, 3, -1,-1,'Readiness', 'Spell::EffectDummy'), (24340, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Meteor', 'Spell::EffectSchoolDMG'), +(24532,-1, -1, -1, -1, -1, -1, 30, -1,-1,'Burst of Energy', 'Spell::EffectEnergize'), +(24571,-1, -1, -1, -1, -1, -1, 30, -1,-1,'Blood Fury', 'Spell::EffectEnergize'), (24575,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Brittle Armor', 'Spell::EffectTriggerSpell'), +(24950,-1, -1, -1, -1, -1, -1, 24, -1,-1,'Create Warsong Mark of Honor (Loser)','Spell::DoCreateItem'), +(24951,-1, -1, -1, -1, -1, -1, 24, -1,-1,'Create Warsong Mark of Honor (WInner)','Spell::DoCreateItem'), +(24952,-1, -1, -1, -1, -1, -1, 24, -1,-1,'Arathi Basin Mark of Honor (Loser)', 'Spell::DoCreateItem'), +(24953,-1, -1, -1, -1, -1, -1, 24, -1,-1,'Arathi Basin Mark of Honor (Winner)','Spell::DoCreateItem'), +(24954,-1, -1, -1, -1, -1, -1, 24, -1,-1,'Alterac Valley Mark of Honor (Loser)','Spell::DoCreateItem'), +(24955,-1, -1, -1, -1, -1, -1, 24, -1,-1,'Alterac Valley Mark of Honor (Winner)','Spell::DoCreateItem'), (25599, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Thundercrash', 'Spell::EffectSchoolDMG'), (25858,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Reindeer', 'Spell::EffectDummy'), (25859,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Reindeer', 'Spell::EffectDummy'), @@ -174,6 +182,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (31790,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Righteous Defense', 'Spell::EffectTriggerSpell'), (31803,-1, -1, -1, -1, -1, -1, 6, 3,-1,'Holy Vengeance', 'Spell::EffectSchoolDMG'), (31818,-1, -1, -1, -1, -1, -1, 30, -1, 0,'Life Tap', 'Spell::EffectDummy'), +(31930,-1, -1, -1, -1, -1, -1, 30, -1,-1,'Judgements of the Wise', 'Spell::EffectEnergize'), (32409,-1, -1, -1, -1, -1, -1, 6, 3,-1,'Shadow Word: Death', 'Spell::EffectSchoolDMG'), (32553,-1, -1, -1, -1, -1, -1, 30, -1, 0,'Life Tap', 'Spell::EffectDummy'), (32813,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Squirrel Form', 'Spell::EffectDummy'), @@ -231,7 +240,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (39610,11, -1, -1, -1, -1, -1, 3, -1,-1,'Mana Tide Totem effect', 'Spell::EffectDummy'), (40810, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Saber Lash', 'Spell::EffectSchoolDMG'), (41276, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Meteor', 'Spell::EffectSchoolDMG'), -(41637,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Prayer of Mending', 'Spell::EffectApplyAura'), +(41637,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Prayer of Mending', 'Spell::cast'), (42384, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Brutal Swipe', 'Spell::EffectSchoolDMG'), (43267, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Saber Lash', 'Spell::EffectSchoolDMG'), (43268, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Saber Lash', 'Spell::EffectSchoolDMG'), @@ -246,8 +255,11 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (44997, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Converting Sentry', 'Spell::EffectDummy'), (45009,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Converted Sentry Credit', 'Spell::EffectDummy'), (45030, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Impale Emissary', 'Spell::EffectDummy'), +(45062,-1, -1, -1, -1, -1, -1, -1, 4,-1,'Holy Energy', 'Spell::EffectHeal'), +(45064,-1, -1, -1, -1, -1, -1, 10, -1,-1,'Vessel of the Naaru', 'Spell::EffectHeal'), (45088,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Emissary of Hate Credit', 'Spell::EffectDummy'), (45150, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Meteor Slash', 'Spell::EffectSchoolDMG'), +(45470,-1, -1, -1, -1, -1, -1, 10, -1, 0,'Intercept', 'Spell::EffectDummy'), (64422, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Meteor Slash', 'Spell::EffectSchoolDMG'), (64688, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Meteor Slash', 'Spell::EffectSchoolDMG'), (45182,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Cheat Death', 'Spell::EffectDummy'), @@ -298,6 +310,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (53341, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Rune of Cinderglacier', 'Spell::EffectDummy'), (53343, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Rune of Razorice', 'Spell::EffectDummy'), (54586,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Runeforging Credit', 'Spell::EffectDummy'), +(54824,-1, -1, -1, -1, -1, -1, -1, 4,-1,'Glyph of Swiftmend', 'Spell::EffectHeal'), (54861,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Nitro Boosts', 'Spell::EffectDummy'), (55004, 0, -1, -1, -1, -1, -1, 3, -1,-1,'Nitro Boosts', 'Spell::EffectDummy'), (55441,11, -1, -1, -1, -1, -1, -1, 4,-1,'Glyph of Mana Tide', 'Spell::EffectDummy'), @@ -314,6 +327,7 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas (61290, 5,0x0001000000000000,0x00000000, -1, -1, -1, 2, -1,-1,'Shadowflame', 'Spell::EffectSchoolDMG'), (61291,-1, -1, -1, -1, -1, -1, -1, -1,-1,'Shadowflame', 'Spell::EffectSchoolDMG'), (61491, 0, -1, -1, -1, -1, -1, 2, -1,-1,'Intercept', 'Spell::EffectSchoolDMG'), +(63375,-1, -1, -1, -1, -1, -1, 30, -1,-1,'Improved Stormstrike', 'Spell::EffectEnergize'), /* sorted by spell names */ /*id fm familyMaskA fmMaskB icon vis cat eff aur ef name code */ @@ -328,6 +342,8 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas ( 0, 9,0x0008000000000000,0x00000000, -1, -1, -1, 2, -1,-1,'Counterattack', 'Spell::EffectSchoolDMG'), ( 0, 8,0x0000000000010000,0x00000000, -1, -1, -1, -1, 3,-1,'Deadly poison', 'Spell::EffectSchoolDMG'), ( 0,15,0x0000000000002000,0x00000000, -1, -1, -1, 3, -1,-1,'Death Coil', 'Spell::EffectDummy'), +( 0,15,0x0000000000000010,0x00000000, -1, -1, -1, 3, -1,-1,'Death Strike', 'Spell::EffectDummy'), +( 0, 5, -1, -1, -1, -1, 12, 38, -1,-1,'Devour Magic', 'Spell::EffectDispel'), ( 0, 8,0x0000000800000000,0x00000000, -1, -1, -1, 2, -1,-1,'Envenom', 'Spell::EffectSchoolDMG'), ( 0, 8,0x0000000000020000,0x00000000, -1, -1, -1, 2, -1,-1,'Eviscerate', 'Spell::EffectSchoolDMG'), (0, 4,0x0000000020000000,0x00000000, -1, -1, -1, 3, -1,-1,'Execute', 'Spell::EffectDummy'), @@ -356,8 +372,10 @@ INSERT INTO spell_check (spellid,SpellFamilyName,SpellFamilyMaskA,SpellFamilyMas ( 0, 7,0x0000044000000000,0x00000000, -1, -1, -1, -1, -1,-1,'Mangle (Cat) and Mangle (Bear)', 'Unit::HandleDummyAuraProc'), ( 0, 9,0x0000000000000002,0x00000000, -1, 342, -1, 2, -1,-1,'Mongoose Bite', 'Spell::EffectSchoolDMG'), (0, 6,0x0080000000000000,0x00000000, -1, -1, -1, 3, -1,-1,'Penance', 'Spell::EffectDummy'), -( 0, 6,0x0000002000000000,0x00000000, -1, -1, -1, 6, -1,-1,'Prayer of Mending', 'Spell::EffectApplyAura'), +( 0, 6,0x0000002000000000,0x00000000, -1, -1, -1, 6, -1,-1,'Prayer of Mending', 'Spell::cast'), ( 0, 8,0x0000024000000860,0x00000000, -1, -1, -1, -1, -1,-1,'Preparation (affected spells)', 'Spell::EffectDummy'), +( 0, 7,0x0000000000000040,0x00000000, -1, -1, -1, -1, 8,-1,'Regrowth', 'Spell::EffectHeal'), +( 0, 7,0x0000000000000010,0x00000000, -1, -1, -1, -1, 8,-1,'Rejuvenation', 'Spell::EffectHeal'), ( 0, 7,0x0000000000001000,0x00000000, -1, -1, -1, 2, -1,-1,'Rake', 'Spell::EffectSchoolDMG'), /* used in */ ( 0, 7,0x0000000000001000,0x00000000, -1, -1, -1, 80, -1, 2,'Rake', 'Spell::EffectSchoolDMG'), /* exactly selected */ ( 0, 7,0x0000000000001000,0x00000000, -1, -1, -1, -1, 3,-1,'Rake', 'Aura::HandlePeriodicDamage'), /* used in */ diff --git a/sql/updates/8412_01_mangos_mangos_string.sql b/sql/updates/8412_01_mangos_mangos_string.sql new file mode 100644 index 000000000..5c99698a5 --- /dev/null +++ b/sql/updates/8412_01_mangos_mangos_string.sql @@ -0,0 +1,6 @@ +ALTER TABLE db_version CHANGE COLUMN required_8399_01_mangos_spell_elixir required_8412_01_mangos_mangos_string bit; + +DELETE FROM mangos_string WHERE entry IN(512,513); +INSERT INTO mangos_string VALUES +(512,'%d - |cffffffff|Hitem:%d:0:0:0:0:0:0:0:0|h[%s]|h|r ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(513,'%d - |cffffffff|Hquest:%d:%d|h[%s]|h|r %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/8416_01_mangos_spell_learn_spell.sql b/sql/updates/8416_01_mangos_spell_learn_spell.sql new file mode 100644 index 000000000..86066e05a --- /dev/null +++ b/sql/updates/8416_01_mangos_spell_learn_spell.sql @@ -0,0 +1,21 @@ +ALTER TABLE db_version CHANGE COLUMN required_8412_01_mangos_mangos_string required_8416_01_mangos_spell_learn_spell bit; + +/* All form passives */ +DELETE FROM spell_learn_spell WHERE SpellID in ( +1178, /* Bear Form (Passive) */ +3025, /* Cat Form (Passive) */ +5419, /* Travel Form (Passive) */ +5420, /* Tree of Life _passive_ */ +5421, /* Aquatic Form (Passive) */ +7376, /* Defensive Stance Passive */ +7381, /* Berserker Stance Passive */ +9635, /* Dire Bear Form (Passive) */ +21156, /* Battle Stance Passive */ +21178, /* Bear Form (Passive2) */ +24905, /* Moonkin Form (Passive) */ +34123, /* Tree of Life _pasive_ */ +33948, /* Flight Form (Passive) */ +34764, /* Flight Form (Passive) */ +40121, /* Swift Flight Form (Passive) */ +40122 /* Swift Flight Form (Passive) */ +); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index ffb0148bc..d6e7b108f 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -93,6 +93,8 @@ pkgdata_DATA = \ 8402_01_characters_guild_eventlog.sql \ 8402_02_characters_guild_bank_eventlog.sql \ 8409_01_characters_guild.sql \ + 8412_01_mangos_mangos_string.sql \ + 8416_01_mangos_spell_learn_spell.sql \ README ## Additional files to include when running 'make dist' @@ -166,4 +168,6 @@ EXTRA_DIST = \ 8402_01_characters_guild_eventlog.sql \ 8402_02_characters_guild_bank_eventlog.sql \ 8409_01_characters_guild.sql \ + 8412_01_mangos_mangos_string.sql \ + 8416_01_mangos_spell_learn_spell.sql \ README diff --git a/src/game/AggressorAI.cpp b/src/game/AggressorAI.cpp index c1a544d5d..4d1b9c427 100644 --- a/src/game/AggressorAI.cpp +++ b/src/game/AggressorAI.cpp @@ -141,7 +141,7 @@ bool AggressorAI::IsVisible(Unit *pl) const { return m_creature->IsWithinDist(pl,sWorld.getConfig(CONFIG_SIGHT_MONSTER)) - && pl->isVisibleForOrDetect(m_creature,true); + && pl->isVisibleForOrDetect(m_creature,m_creature,true); } void diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 8f7d8027a..c674e4ad8 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -33,16 +33,21 @@ #include "AccountMgr.h" // Supported shift-links (client generated and server side) +// |color|Hachievement:achievement_id:player_guid:0:0:0:0:0:0:0:0|h[name]|h|r +// - client, item icon shift click, not used in server currently // |color|Harea:area_id|h[name]|h|r // |color|Hcreature:creature_guid|h[name]|h|r // |color|Hcreature_entry:creature_id|h[name]|h|r +// |color|Henchant:recipe_spell_id|h[prof_name: recipe_name]|h|r - client, at shift click in recipes list dialog // |color|Hgameevent:id|h[name]|h|r // |color|Hgameobject:go_guid|h[name]|h|r // |color|Hgameobject_entry:go_id|h[name]|h|r -// |color|Hitem:item_id:perm_ench_id:0:0|h[name]|h|r +// |color|Hglyph:glyph_slot_id:glyph_prop_id|h[%s]|h|r - client, at shift click in glyphs dialog, GlyphSlot.dbc, GlyphProperties.dbc +// |color|Hitem:item_id:perm_ench_id:gem1:gem2:gem3:0:0:0:0:reporter_level|h[name]|h|r +// - client, item icon shift click // |color|Hitemset:itemset_id|h[name]|h|r // |color|Hplayer:name|h[name]|h|r - client, in some messages, at click copy only name instead link -// |color|Hquest:quest_id|h[name]|h|r +// |color|Hquest:quest_id:quest_level|h[name]|h|r - client, quest list name shift-click // |color|Hskill:skill_id|h[name]|h|r // |color|Hspell:spell_id|h[name]|h|r - client, spellbook spell icon shift-click // |color|Htalent:talent_id,rank|h[name]|h|r - client, talent icon shift-click @@ -1357,21 +1362,27 @@ GameObject* ChatHandler::GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid enum SpellLinkType { - SPELL_LINK_SPELL = 0, - SPELL_LINK_TALENT = 1, - SPELL_LINK_TRADE = 2 + SPELL_LINK_SPELL = 0, + SPELL_LINK_TALENT = 1, + SPELL_LINK_ENCHANT = 2, + SPELL_LINK_TRADE = 3, + SPELL_LINK_GLYPH = 4 }; static char const* const spellKeys[] = { "Hspell", // normal spell "Htalent", // talent spell + "Henchant", // enchanting recipe spell "Htrade", // profession/skill spell + "Hglyph", // glyph 0 }; uint32 ChatHandler::extractSpellIdFromLink(char* text) { + // number or [name] Shift-click form |color|Henchant:recipe_spell_id|h[prof_name: recipe_name]|h|r + // number or [name] Shift-click form |color|Hglyph:glyph_slot_id:glyph_prop_id|h[%s]|h|r // number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r // number or [name] Shift-click form |color|Htalent:talent_id,rank|h[name]|h|r // number or [name] Shift-click form |color|Htrade:spell_id,skill_id,max_value,cur_value|h[name]|h|r @@ -1403,8 +1414,19 @@ uint32 ChatHandler::extractSpellIdFromLink(char* text) return talentEntry->RankID[rank]; } + case SPELL_LINK_ENCHANT: case SPELL_LINK_TRADE: return id; + case SPELL_LINK_GLYPH: + { + uint32 glyph_prop_id = param1_str ? (uint32)atol(param1_str) : 0; + + GlyphPropertiesEntry const* glyphPropEntry = sGlyphPropertiesStore.LookupEntry(glyph_prop_id); + if(!glyphPropEntry) + return 0; + + return glyphPropEntry->SpellId; + } } // unknown type? diff --git a/src/game/Corpse.cpp b/src/game/Corpse.cpp index 3115a9473..17f76c74d 100644 --- a/src/game/Corpse.cpp +++ b/src/game/Corpse.cpp @@ -227,7 +227,7 @@ bool Corpse::LoadFromDB(uint32 guid, Field *fields) return true; } -bool Corpse::isVisibleForInState(Player const* u, bool inVisibleList) const +bool Corpse::isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const { - return IsInWorld() && u->IsInWorld() && IsWithinDistInMap(u, World::GetMaxVisibleDistanceForObject() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false); + return IsInWorld() && u->IsInWorld() && IsWithinDistInMap(viewPoint, World::GetMaxVisibleDistanceForObject() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false); } diff --git a/src/game/Corpse.h b/src/game/Corpse.h index c044b339e..b0fc146ed 100644 --- a/src/game/Corpse.h +++ b/src/game/Corpse.h @@ -74,7 +74,7 @@ class Corpse : public WorldObject GridPair const& GetGrid() const { return m_grid; } void SetGrid(GridPair const& grid) { m_grid = grid; } - bool isVisibleForInState(Player const* u, bool inVisibleList) const; + bool isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const; Loot loot; // remove insignia ONLY at BG Player* lootRecipient; diff --git a/src/game/Creature.h b/src/game/Creature.h index e21be72a5..b6f1d676c 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -681,7 +681,7 @@ class MANGOS_DLL_SPEC Creature : public Unit void SetDeadByDefault (bool death_state) { m_isDeadByDefault = death_state; } - bool isActiveObject() const { return m_isActiveObject; } + bool isActiveObject() const { return m_isActiveObject || HasAuraType(SPELL_AURA_BIND_SIGHT) || HasAuraType(SPELL_AURA_FAR_SIGHT); } void SetActiveObjectState(bool on); protected: diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index c2df6c436..e70b153ff 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -1116,7 +1116,7 @@ void CreatureEventAI::UpdateAI(const uint32 diff) bool CreatureEventAI::IsVisible(Unit *pl) const { return m_creature->IsWithinDist(pl,sWorld.getConfig(CONFIG_SIGHT_MONSTER)) - && pl->isVisibleForOrDetect(m_creature,true); + && pl->isVisibleForOrDetect(m_creature,m_creature,true); } inline Unit* CreatureEventAI::SelectUnit(AttackingTarget target, uint32 position) diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp index df5e6a7d3..bb775038b 100644 --- a/src/game/DynamicObject.cpp +++ b/src/game/DynamicObject.cpp @@ -25,8 +25,9 @@ #include "GridNotifiers.h" #include "CellImpl.h" #include "GridNotifiersImpl.h" +#include "SpellMgr.h" -DynamicObject::DynamicObject() : WorldObject() +DynamicObject::DynamicObject() : WorldObject(), m_isActiveObject(false) { m_objectType |= TYPEMASK_DYNAMICOBJECT; m_objectTypeId = TYPEID_DYNAMICOBJECT; @@ -78,6 +79,11 @@ bool DynamicObject::Create( uint32 guidlow, Unit *caster, uint32 spellId, uint32 m_radius = radius; m_effIndex = effIndex; m_spellId = spellId; + + // set to active for far sight case + if(SpellEntry const* spellEntry = sSpellStore.LookupEntry(spellId)) + m_isActiveObject = IsSpellHaveEffect(spellEntry,SPELL_EFFECT_ADD_FARSIGHT); + return true; } @@ -104,20 +110,24 @@ void DynamicObject::Update(uint32 p_time) else deleteThis = true; - // TODO: make a timer and update this in larger intervals - CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY())); - Cell cell(p); - cell.data.Part.reserved = ALL_DISTRICT; - cell.SetNoCreate(); + // have radius and work as persistent effect + if(m_radius) + { + // TODO: make a timer and update this in larger intervals + CellPair p(MaNGOS::ComputeCellPair(GetPositionX(), GetPositionY())); + Cell cell(p); + cell.data.Part.reserved = ALL_DISTRICT; + cell.SetNoCreate(); - MaNGOS::DynamicObjectUpdater notifier(*this, caster); + MaNGOS::DynamicObjectUpdater notifier(*this, caster); - TypeContainerVisitor world_object_notifier(notifier); - TypeContainerVisitor grid_object_notifier(notifier); + TypeContainerVisitor world_object_notifier(notifier); + TypeContainerVisitor grid_object_notifier(notifier); - CellLock cell_lock(cell, p); - cell_lock->Visit(cell_lock, world_object_notifier, *GetMap()); - cell_lock->Visit(cell_lock, grid_object_notifier, *GetMap()); + CellLock cell_lock(cell, p); + cell_lock->Visit(cell_lock, world_object_notifier, *GetMap()); + cell_lock->Visit(cell_lock, grid_object_notifier, *GetMap()); + } if(deleteThis) { @@ -140,7 +150,15 @@ void DynamicObject::Delay(int32 delaytime) (*iunit)->DelayAura(m_spellId, m_effIndex, delaytime); } -bool DynamicObject::isVisibleForInState(Player const* u, bool inVisibleList) const +bool DynamicObject::isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const { - return IsInWorld() && u->IsInWorld() && IsWithinDistInMap(u, World::GetMaxVisibleDistanceForObject() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false); + if(!IsInWorld() || !u->IsInWorld()) + return false; + + // always seen by owner + if(GetCasterGUID()==u->GetGUID()) + return true; + + // normal case + return IsWithinDistInMap(viewPoint, World::GetMaxVisibleDistanceForObject() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false); } diff --git a/src/game/DynamicObject.h b/src/game/DynamicObject.h index 3db328055..066361b8c 100644 --- a/src/game/DynamicObject.h +++ b/src/game/DynamicObject.h @@ -46,7 +46,7 @@ class DynamicObject : public WorldObject void AddAffected(Unit *unit) { m_affected.insert(unit); } void RemoveAffected(Unit *unit) { m_affected.erase(unit); } void Delay(int32 delaytime); - bool isVisibleForInState(Player const* u, bool inVisibleList) const; + bool isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const; void Say(int32 textId, uint32 language, uint64 TargetGuid) { MonsterSay(textId,language,TargetGuid); } void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); } @@ -56,15 +56,16 @@ class DynamicObject : public WorldObject GridReference &GetGridRef() { return m_gridRef; } - bool isActiveObject() const { return false; } + bool isActiveObject() const { return m_isActiveObject; } protected: uint32 m_spellId; uint32 m_effIndex; int32 m_aliveDuration; time_t m_nextThinkTime; - float m_radius; + float m_radius; // radius apply persistent effect, 0 = no persistent effect AffectedSet m_affected; private: GridReference m_gridRef; + bool m_isActiveObject; }; #endif diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index ad8c23ea6..6ddd5a22a 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -690,7 +690,7 @@ void GameObject::SaveRespawnTime() objmgr.SaveGORespawnTime(m_DBTableGuid,GetInstanceId(),m_respawnTime); } -bool GameObject::isVisibleForInState(Player const* u, bool inVisibleList) const +bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const { // Not in world if(!IsInWorld() || !u->IsInWorld()) @@ -717,7 +717,7 @@ bool GameObject::isVisibleForInState(Player const* u, bool inVisibleList) const } // check distance - return IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject() + + return IsWithinDistInMap(viewPoint,World::GetMaxVisibleDistanceForObject() + (inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false); } diff --git a/src/game/GameObject.h b/src/game/GameObject.h index 9eddf9092..06ebfa278 100644 --- a/src/game/GameObject.h +++ b/src/game/GameObject.h @@ -670,7 +670,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject void TriggeringLinkedGameObject( uint32 trapEntry, Unit* target); - bool isVisibleForInState(Player const* u, bool inVisibleList) const; + bool isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const; GameObject* LookupFishingHoleAround(float range); diff --git a/src/game/GridNotifiers.cpp b/src/game/GridNotifiers.cpp index 1aefbcb4a..5ff6d5d79 100644 --- a/src/game/GridNotifiers.cpp +++ b/src/game/GridNotifiers.cpp @@ -30,13 +30,16 @@ using namespace MaNGOS; void MaNGOS::PlayerNotifier::Visit(PlayerMapType &m) { + WorldObject const* viewPoint = i_player.GetViewPoint(); + for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter) { - if( iter->getSource() == &i_player ) + Player* player = iter->getSource(); + if( player == &i_player ) continue; - iter->getSource()->UpdateVisibilityOf(&i_player); - i_player.UpdateVisibilityOf(iter->getSource()); + player->UpdateVisibilityOf(player->GetViewPoint(),&i_player); + i_player.UpdateVisibilityOf(viewPoint,player); } } @@ -45,24 +48,28 @@ VisibleChangesNotifier::Visit(PlayerMapType &m) { for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter) { - if(iter->getSource() == &i_object) + Player* player = iter->getSource(); + if(player == &i_object) continue; - iter->getSource()->UpdateVisibilityOf(&i_object); + player->UpdateVisibilityOf(player->GetViewPoint(),&i_object); } } void VisibleNotifier::Visit(PlayerMapType &m) { + WorldObject const* viewPoint = i_player.GetViewPoint(); + for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter) { - if( iter->getSource() == &i_player ) + Player* player = iter->getSource(); + if( player == &i_player ) continue; - iter->getSource()->UpdateVisibilityOf(&i_player); - i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_data_updates,i_visibleNow); - i_clientGUIDs.erase(iter->getSource()->GetGUID()); + player->UpdateVisibilityOf(player->GetViewPoint(),&i_player); + i_player.UpdateVisibilityOf(viewPoint,player,i_data,i_data_updates,i_visibleNow); + i_clientGUIDs.erase(player->GetGUID()); } } @@ -77,8 +84,9 @@ VisibleNotifier::Notify() { if(i_clientGUIDs.find((*itr)->GetGUID())!=i_clientGUIDs.end()) { - (*itr)->UpdateVisibilityOf(&i_player); - i_player.UpdateVisibilityOf((*itr),i_data,i_data_updates,i_visibleNow); + // ignore far sight case + (*itr)->UpdateVisibilityOf((*itr),&i_player); + i_player.UpdateVisibilityOf(&i_player,(*itr),i_data,i_data_updates,i_visibleNow); i_clientGUIDs.erase((*itr)->GetGUID()); } } @@ -121,9 +129,8 @@ VisibleNotifier::Notify() if(!IS_PLAYER_GUID(*iter)) continue; - Player* plr = ObjectAccessor::GetPlayer(i_player,*iter); - if(plr) - plr->UpdateVisibilityOf(&i_player); + if (Player* plr = ObjectAccessor::GetPlayer(i_player,*iter)) + plr->UpdateVisibilityOf(plr->GetViewPoint(),&i_player); } } diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index ae34ed7e0..32454762d 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -778,7 +778,7 @@ namespace MaNGOS return u->isAlive() && i_obj->IsWithinDistInMap(u, i_range) && !i_funit->IsFriendlyTo(u) - && u->isVisibleForOrDetect(i_funit, false); + && u->isVisibleForOrDetect(i_funit,i_funit,false); } private: WorldObject const* i_obj; @@ -827,7 +827,7 @@ namespace MaNGOS bool operator()(Unit* u) { if( u->isTargetableForAttack() && i_obj->IsWithinDistInMap(u, i_range) && - !i_funit->IsFriendlyTo(u) && u->isVisibleForOrDetect(i_funit,false) ) + !i_funit->IsFriendlyTo(u) && u->isVisibleForOrDetect(i_funit,i_funit,false) ) { i_range = i_obj->GetDistance(u); // use found unit range as new range limit for next check return true; @@ -863,7 +863,7 @@ namespace MaNGOS return false; if(u->GetTypeId()==TYPEID_UNIT && ((Creature*)u)->isTotem()) return false; - if (!i_hitHidden && !u->isVisibleForOrDetect(i_funit, false)) + if (!i_hitHidden && !u->isVisibleForOrDetect(i_funit, i_funit, false)) return false; if(( i_targetForPlayer ? !i_funit->IsFriendlyTo(u) : i_funit->IsHostileTo(u) )&& i_obj->IsWithinDistInMap(u, i_range)) diff --git a/src/game/GridNotifiersImpl.h b/src/game/GridNotifiersImpl.h index 583732a65..8d2433ce3 100644 --- a/src/game/GridNotifiersImpl.h +++ b/src/game/GridNotifiersImpl.h @@ -31,9 +31,11 @@ template inline void MaNGOS::VisibleNotifier::Visit(GridRefManager &m) { + WorldObject const* viewPoint = i_player.GetViewPoint(); + for(typename GridRefManager::iterator iter = m.begin(); iter != m.end(); ++iter) { - i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_data_updates,i_visibleNow); + i_player.UpdateVisibilityOf(viewPoint,iter->getSource(),i_data,i_data_updates,i_visibleNow); i_clientGUIDs.erase(iter->getSource()->GetGUID()); } } @@ -64,10 +66,10 @@ MaNGOS::PlayerRelocationNotifier::Visit(PlayerMapType &m) } } -inline void PlayerCreatureRelocationWorker(Player* pl, Creature* c) +inline void PlayerCreatureRelocationWorker(Player* pl, WorldObject const* viewPoint, Creature* c) { // update creature visibility at player/creature move - pl->UpdateVisibilityOf(c); + pl->UpdateVisibilityOf(viewPoint,c); // Creature AI reaction if(!c->hasUnitState(UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING)) @@ -98,9 +100,11 @@ MaNGOS::PlayerRelocationNotifier::Visit(CreatureMapType &m) if(!i_player.isAlive() || i_player.isInFlight()) return; + WorldObject const* viewPoint = i_player.GetViewPoint(); + for(CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter) - if( iter->getSource()->isAlive()) - PlayerCreatureRelocationWorker(&i_player,iter->getSource()); + if (iter->getSource()->isAlive()) + PlayerCreatureRelocationWorker(&i_player,viewPoint,iter->getSource()); } template<> @@ -111,8 +115,9 @@ MaNGOS::CreatureRelocationNotifier::Visit(PlayerMapType &m) return; for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter) - if( iter->getSource()->isAlive() && !iter->getSource()->isInFlight()) - PlayerCreatureRelocationWorker(iter->getSource(), &i_creature); + if (Player* player = iter->getSource()) + if (player->isAlive() && !player->isInFlight()) + PlayerCreatureRelocationWorker(player, player->GetViewPoint(), &i_creature); } template<> diff --git a/src/game/Group.cpp b/src/game/Group.cpp index 3a38909c1..f9b616fcd 100644 --- a/src/game/Group.cpp +++ b/src/game/Group.cpp @@ -980,7 +980,7 @@ void Group::UpdatePlayerOutOfRange(Player* pPlayer) for(GroupReference *itr = GetFirstMember(); itr != NULL; itr = itr->next()) { player = itr->getSource(); - if (player && player != pPlayer && !pPlayer->isVisibleFor(player)) + if (player && player != pPlayer && !pPlayer->isVisibleFor(player,player->GetViewPoint())) player->GetSession()->SendPacket(&data); } } diff --git a/src/game/GuardAI.cpp b/src/game/GuardAI.cpp index 5dcbb5a23..e87f5812b 100644 --- a/src/game/GuardAI.cpp +++ b/src/game/GuardAI.cpp @@ -126,7 +126,7 @@ void GuardAI::UpdateAI(const uint32 /*diff*/) bool GuardAI::IsVisible(Unit *pl) const { return m_creature->IsWithinDist(pl,sWorld.getConfig(CONFIG_SIGHT_GUARDER)) - && pl->isVisibleForOrDetect(m_creature,true); + && pl->isVisibleForOrDetect(m_creature,m_creature,true); } void GuardAI::AttackStart(Unit *u) diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index fd7b693a9..9e1ab765c 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -2935,7 +2935,7 @@ bool ChatHandler::HandleLookupQuestCommand(const char* args) } if (m_session) - PSendSysMessage(LANG_QUEST_LIST_CHAT,qinfo->GetQuestId(),qinfo->GetQuestId(),title.c_str(),statusStr); + PSendSysMessage(LANG_QUEST_LIST_CHAT,qinfo->GetQuestId(),qinfo->GetQuestId(),qinfo->GetQuestLevel(),title.c_str(),statusStr); else PSendSysMessage(LANG_QUEST_LIST_CONSOLE,qinfo->GetQuestId(),title.c_str(),statusStr); ++counter; @@ -2969,7 +2969,7 @@ bool ChatHandler::HandleLookupQuestCommand(const char* args) } if (m_session) - PSendSysMessage(LANG_QUEST_LIST_CHAT,qinfo->GetQuestId(),qinfo->GetQuestId(),title.c_str(),statusStr); + PSendSysMessage(LANG_QUEST_LIST_CHAT,qinfo->GetQuestId(),qinfo->GetQuestId(),qinfo->GetQuestLevel(),title.c_str(),statusStr); else PSendSysMessage(LANG_QUEST_LIST_CONSOLE,qinfo->GetQuestId(),title.c_str(),statusStr); @@ -4686,7 +4686,7 @@ bool ChatHandler::HandleQuestAdd(const char* args) } // .addquest #entry' - // number or [name] Shift-click form |color|Hquest:quest_id|h[name]|h|r + // number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r char* cId = extractKeyFromLink((char*)args,"Hquest"); if(!cId) return false; @@ -4740,7 +4740,7 @@ bool ChatHandler::HandleQuestRemove(const char* args) } // .removequest #entry' - // number or [name] Shift-click form |color|Hquest:quest_id|h[name]|h|r + // number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r char* cId = extractKeyFromLink((char*)args,"Hquest"); if(!cId) return false; @@ -4790,7 +4790,7 @@ bool ChatHandler::HandleQuestComplete(const char* args) } // .quest complete #entry - // number or [name] Shift-click form |color|Hquest:quest_id|h[name]|h|r + // number or [name] Shift-click form |color|Hquest:quest_id:quest_level|h[name]|h|r char* cId = extractKeyFromLink((char*)args,"Hquest"); if(!cId) return false; diff --git a/src/game/LootHandler.cpp b/src/game/LootHandler.cpp index da7c2bb6a..274a7f94f 100644 --- a/src/game/LootHandler.cpp +++ b/src/game/LootHandler.cpp @@ -256,8 +256,7 @@ void WorldSession::HandleLootReleaseOpcode( WorldPacket & recv_data ) // cheaters can modify lguid to prevent correct apply loot release code and re-loot // use internal stored guid - //uint64 lguid; - //recv_data >> lguid; + recv_data.read_skip(); // guid; if(uint64 lguid = GetPlayer()->GetLootGUID()) DoLootRelease(lguid); diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 99ceebfc6..eabc8f0a6 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1502,13 +1502,15 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode( WorldPacket & recv_data ) sLog.outDebug("WORLD: CMSG_MOVE_SET_CAN_FLY_ACK"); //recv_data.hexlike(); - uint64 guid; - uint32 unk; - uint32 flags; + recv_data.read_skip(); // guid + recv_data.read_skip(); // unk - recv_data >> guid >> unk >> flags; + MovementInfo movementInfo; + ReadMovementInfo(recv_data, &movementInfo); - _player->m_movementInfo.SetMovementFlags(MovementFlags(flags)); + recv_data.read_skip(); // unk2 + + _player->m_movementInfo.SetMovementFlags(movementInfo.GetMovementFlags()); } void WorldSession::HandleRequestPetInfoOpcode( WorldPacket & /*recv_data */) diff --git a/src/game/Object.cpp b/src/game/Object.cpp index e370e4be7..16017389a 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -1359,6 +1359,16 @@ bool WorldObject::HasInArc(const float arcangle, const WorldObject* obj) const return (( angle >= lborder ) && ( angle <= rborder )); } +bool WorldObject::isInFrontInMap(WorldObject const* target, float distance, float arc) const +{ + return IsWithinDistInMap(target, distance) && HasInArc( arc, target ); +} + +bool WorldObject::isInBackInMap(WorldObject const* target, float distance, float arc) const +{ + return IsWithinDistInMap(target, distance) && !HasInArc( 2 * M_PI - arc, target ); +} + void WorldObject::GetRandomPoint( float x, float y, float z, float distance, float &rand_x, float &rand_y, float &rand_z) const { if(distance == 0) diff --git a/src/game/Object.h b/src/game/Object.h index 1a697fe1d..265d184a7 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -445,6 +445,8 @@ class MANGOS_DLL_SPEC WorldObject : public Object float GetAngle( const WorldObject* obj ) const; float GetAngle( const float x, const float y ) const; bool HasInArc( const float arcangle, const WorldObject* obj ) const; + bool isInFrontInMap(WorldObject const* target,float distance, float arc = M_PI) const; + bool isInBackInMap(WorldObject const* target, float distance, float arc = M_PI) const; virtual void CleanupsBeforeDelete(); // used in destructor or explicitly before mass creature delete to remove cross-references to already deleted units @@ -471,10 +473,10 @@ class MANGOS_DLL_SPEC WorldObject : public Object void AddObjectToRemoveList(); // main visibility check function in normal case (ignore grey zone distance check) - bool isVisibleFor(Player const* u) const { return isVisibleForInState(u,false); } + bool isVisibleFor(Player const* u, WorldObject const* viewPoint) const { return isVisibleForInState(u,viewPoint,false); } // low level function for visibility change code, must be define in all main world object subclasses - virtual bool isVisibleForInState(Player const* u, bool inVisibleList) const = 0; + virtual bool isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const = 0; void SetMap(Map * map); Map * GetMap() const { ASSERT(m_currMap); return m_currMap; } diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index 58c220f8e..79b9d9c02 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -90,43 +90,61 @@ ObjectAccessor::GetCorpse(WorldObject const &u, uint64 guid) return ret; } +WorldObject* ObjectAccessor::GetWorldObject(WorldObject const &p, uint64 guid) +{ + switch(GUID_HIPART(guid)) + { + case HIGHGUID_PLAYER: return FindPlayer(guid); + case HIGHGUID_GAMEOBJECT: return p.GetMap()->GetGameObject(guid); + case HIGHGUID_UNIT: return p.GetMap()->GetCreature(guid); + case HIGHGUID_PET: return GetPet(guid); + case HIGHGUID_VEHICLE: return GetVehicle(guid); + case HIGHGUID_DYNAMICOBJECT:return p.GetMap()->GetDynamicObject(guid); + case HIGHGUID_TRANSPORT: return NULL; + case HIGHGUID_CORPSE: return GetCorpse(p,guid); + case HIGHGUID_MO_TRANSPORT: return NULL; + default: break; + } + + return NULL; +} + Object* ObjectAccessor::GetObjectByTypeMask(WorldObject const &p, uint64 guid, uint32 typemask) { - Object *obj = NULL; - - if(typemask & TYPEMASK_PLAYER) + switch(GUID_HIPART(guid)) { - obj = FindPlayer(guid); - if(obj) - return obj; - } - - if(typemask & TYPEMASK_UNIT) - { - obj = GetCreatureOrPetOrVehicle(p,guid); - if(obj) - return obj; - } - - if(typemask & TYPEMASK_GAMEOBJECT) - { - obj = p.GetMap()->GetGameObject(guid); - if(obj) - return obj; - } - - if(typemask & TYPEMASK_DYNAMICOBJECT) - { - obj = p.GetMap()->GetDynamicObject(guid); - if(obj) - return obj; - } - - if(typemask & TYPEMASK_ITEM && p.GetTypeId() == TYPEID_PLAYER) - { - obj = ((Player const &)p).GetItemByGuid( guid ); - if(obj) - return obj; + case HIGHGUID_ITEM: + if(typemask & TYPEMASK_ITEM && p.GetTypeId() == TYPEID_PLAYER) + return ((Player const &)p).GetItemByGuid( guid ); + break; + case HIGHGUID_PLAYER: + if(typemask & TYPEMASK_PLAYER) + return FindPlayer(guid); + break; + case HIGHGUID_GAMEOBJECT: + if(typemask & TYPEMASK_GAMEOBJECT) + return p.GetMap()->GetGameObject(guid); + break; + case HIGHGUID_UNIT: + if(typemask & TYPEMASK_UNIT) + return p.GetMap()->GetCreature(guid); + break; + case HIGHGUID_PET: + if(typemask & TYPEMASK_UNIT) + return GetPet(guid); + break; + case HIGHGUID_VEHICLE: + if(typemask & TYPEMASK_UNIT) + return GetVehicle(guid); + break; + case HIGHGUID_DYNAMICOBJECT: + if(typemask & TYPEMASK_DYNAMICOBJECT) + return p.GetMap()->GetDynamicObject(guid); + break; + case HIGHGUID_TRANSPORT: + case HIGHGUID_CORPSE: + case HIGHGUID_MO_TRANSPORT: + break; } return NULL; diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index 6ed1b26cf..cf223ebc9 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -142,6 +142,7 @@ class MANGOS_DLL_DECL ObjectAccessor : public MaNGOS::SingletonIsPvP()) SetPvP(true); + SetCanModifyStats(true); InitStatsForLevel(petlevel); InitTalentForLevel(); // set original talents points before spell loading @@ -263,7 +264,6 @@ bool Pet::LoadPetFromDB( Player* owner, uint32 petentry, uint32 petnumber, bool delete result; //load spells/cooldowns/auras - SetCanModifyStats(true); _LoadAuras(timediff); //init AB diff --git a/src/game/PetAI.cpp b/src/game/PetAI.cpp index 7bc2c7cef..c8281d4aa 100644 --- a/src/game/PetAI.cpp +++ b/src/game/PetAI.cpp @@ -307,7 +307,7 @@ void PetAI::UpdateAI(const uint32 diff) bool PetAI::_isVisible(Unit *u) const { return m_creature->IsWithinDist(u,sWorld.getConfig(CONFIG_SIGHT_GUARDER)) - && u->isVisibleForOrDetect(m_creature,true); + && u->isVisibleForOrDetect(m_creature,m_creature,true); } void PetAI::UpdateAllies() diff --git a/src/game/Player.cpp b/src/game/Player.cpp index a4185350c..2281a44c8 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -3118,24 +3118,9 @@ bool Player::addSpell(uint32 spell_id, bool active, bool learning, bool dependen bool Player::IsNeedCastPassiveSpellAtLearn(SpellEntry const* spellInfo) const { - bool need_cast = false; - - switch(spellInfo->Id) - { - // some spells not have stance data expected cast at form change or present - case 5420: need_cast = (m_form == FORM_TREE); break; - case 5419: need_cast = (m_form == FORM_TRAVEL); break; - case 7376: need_cast = (m_form == FORM_DEFENSIVESTANCE); break; - case 7381: need_cast = (m_form == FORM_BERSERKERSTANCE); break; - case 21156: need_cast = (m_form == FORM_BATTLESTANCE); break; - case 21178: need_cast = (m_form == FORM_BEAR || m_form == FORM_DIREBEAR); break; - case 33948: need_cast = (m_form == FORM_FLIGHT); break; - case 34764: need_cast = (m_form == FORM_FLIGHT); break; - case 40121: need_cast = (m_form == FORM_FLIGHT_EPIC); break; - case 40122: need_cast = (m_form == FORM_FLIGHT_EPIC); break; - // another spells have proper stance data - default: need_cast = !spellInfo->Stances || m_form != 0 && (spellInfo->Stances & (1<<(m_form-1))); break; - } + // note: form passives activated with shapeshift spells be implemented by HandleShapeshiftBoosts instead of spell_learn_spell + // talent dependent passives activated at form apply have proper stance data + bool need_cast = !spellInfo->Stances || m_form != 0 && (spellInfo->Stances & (1<<(m_form-1))); //Check CasterAuraStates return need_cast && (!spellInfo->CasterAuraState || HasAuraState(AuraState(spellInfo->CasterAuraState))); @@ -16825,13 +16810,15 @@ void Player::HandleStealthedUnitsDetection() cell_lock->Visit(cell_lock, world_unit_searcher, *GetMap()); cell_lock->Visit(cell_lock, grid_unit_searcher, *GetMap()); + WorldObject const* viewPoint = GetViewPoint(); + for (std::list::const_iterator i = stealthedUnits.begin(); i != stealthedUnits.end(); ++i) { if((*i)==this) continue; bool hasAtClient = HaveAtClient((*i)); - bool hasDetected = (*i)->isVisibleForOrDetect(this, true); + bool hasDetected = (*i)->isVisibleForOrDetect(this, viewPoint, true); if (hasDetected) { @@ -17915,6 +17902,17 @@ void Player::ReportedAfkBy(Player* reporter) } } +WorldObject const* Player::GetViewPoint() const +{ + if(uint64 far_sight = GetFarSight()) + { + WorldObject const* viewPoint = ObjectAccessor::GetWorldObject(*this,far_sight); + return viewPoint ? viewPoint : this; // always expected not NULL + } + else + return this; +} + bool Player::IsVisibleInGridForPlayer( Player* pl ) const { // gamemaster in GM mode see all, including ghosts @@ -17980,11 +17978,11 @@ bool Player::IsVisibleGloballyFor( Player* u ) const return true; } -void Player::UpdateVisibilityOf(WorldObject* target) +void Player::UpdateVisibilityOf(WorldObject const* viewPoint, WorldObject* target) { if(HaveAtClient(target)) { - if(!target->isVisibleForInState(this, true)) + if(!target->isVisibleForInState(this, viewPoint, true)) { target->DestroyForPlayer(this); m_clientGUIDs.erase(target->GetGUID()); @@ -17997,7 +17995,7 @@ void Player::UpdateVisibilityOf(WorldObject* target) } else { - if(target->isVisibleForInState(this,false)) + if(target->isVisibleForInState(this, viewPoint, false)) { target->SendUpdateToPlayer(this); if(target->GetTypeId()!=TYPEID_GAMEOBJECT||!((GameObject*)target)->IsTransport()) @@ -18033,11 +18031,11 @@ inline void UpdateVisibilityOf_helper(std::set& s64, GameObject* target) } template -void Player::UpdateVisibilityOf(T* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow) +void Player::UpdateVisibilityOf(WorldObject const* viewPoint, T* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow) { if(HaveAtClient(target)) { - if(!target->isVisibleForInState(this,true)) + if(!target->isVisibleForInState(this,viewPoint,true)) { target->BuildOutOfRangeUpdateBlock(&data); m_clientGUIDs.erase(target->GetGUID()); @@ -18050,7 +18048,7 @@ void Player::UpdateVisibilityOf(T* target, UpdateData& data, UpdateDataMapType& } else { - if(target->isVisibleForInState(this,false)) + if(target->isVisibleForInState(this,viewPoint,false)) { visibleNow.insert(target); target->BuildUpdate(data_updates); @@ -18065,11 +18063,11 @@ void Player::UpdateVisibilityOf(T* target, UpdateData& data, UpdateDataMapType& } } -template void Player::UpdateVisibilityOf(Player* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); -template void Player::UpdateVisibilityOf(Creature* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); -template void Player::UpdateVisibilityOf(Corpse* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); -template void Player::UpdateVisibilityOf(GameObject* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); -template void Player::UpdateVisibilityOf(DynamicObject* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); +template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, Player* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); +template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, Creature* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); +template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, Corpse* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); +template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, GameObject* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); +template void Player::UpdateVisibilityOf(WorldObject const* viewPoint, DynamicObject* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); void Player::InitPrimaryProfessions() { @@ -20594,6 +20592,17 @@ bool Player::HasMovementFlag( MovementFlags f ) const return m_movementInfo.HasMovementFlag(f); } +void Player::SetFarSightGUID( uint64 guid ) +{ + if(GetFarSight() == guid) + return; + + SetUInt64Value(PLAYER_FARSIGHT, guid); + + // need triggering load grids around new view point + ObjectAccessor::UpdateVisibilityForPlayer(this); +} + void Player::SendDuelCountdown(uint32 counter) { WorldPacket data(SMSG_DUEL_COUNTDOWN, 4); diff --git a/src/game/Player.h b/src/game/Player.h index 9ff2cf931..2a1d1eb42 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -2099,7 +2099,7 @@ class MANGOS_DLL_SPEC Player : public Unit void ExitVehicle(Vehicle *vehicle); uint64 GetFarSight() const { return GetUInt64Value(PLAYER_FARSIGHT); } - void SetFarSightGUID(uint64 guid) { SetUInt64Value(PLAYER_FARSIGHT, guid); } + void SetFarSightGUID(uint64 guid); // Transports Transport * GetTransport() const { return m_transport; } @@ -2137,13 +2137,14 @@ class MANGOS_DLL_SPEC Player : public Unit bool HaveAtClient(WorldObject const* u) { return u==this || m_clientGUIDs.find(u->GetGUID())!=m_clientGUIDs.end(); } + WorldObject const* GetViewPoint() const; bool IsVisibleInGridForPlayer(Player* pl) const; bool IsVisibleGloballyFor(Player* pl) const; - void UpdateVisibilityOf(WorldObject* target); + void UpdateVisibilityOf(WorldObject const* viewPoint, WorldObject* target); template - void UpdateVisibilityOf(T* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); + void UpdateVisibilityOf(WorldObject const* viewPoint,T* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); // Stealth detection system void HandleStealthedUnitsDetection(); diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index ad713a2d2..d00305557 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -2416,7 +2416,8 @@ enum SummonType SUMMON_TYPE_UNKNOWN2 = 427, SUMMON_TYPE_POSESSED2 = 428, SUMMON_TYPE_INFERNO = 711, - SUMMON_TYPE_GUARDIAN2 = 1161, + SUMMON_TYPE_GUARDIAN2 = 713, + SUMMON_TYPE_GUARDIAN3 = 1161, SUMMON_TYPE_ELEMENTAL = 1561, SUMMON_TYPE_FORCE_OF_NATURE = 1562 }; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 1c745f496..24b155e62 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -1194,7 +1194,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) { // for delayed spells ignore not visible explicit target if (m_spellInfo->speed > 0.0f && unit == m_targets.getUnitTarget() && - !unit->isVisibleForOrDetect(m_caster,false)) + !unit->isVisibleForOrDetect(m_caster,m_caster,false)) { realCaster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_EVADE); return; @@ -1204,9 +1204,9 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask) if (!(m_spellInfo->AttributesEx & SPELL_ATTR_EX_NOT_BREAK_STEALTH)) unit->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); - // can cause back attack (if detected) + // can cause back attack (if detected), stealth removed at Spell::cast if spell break it if (!(m_spellInfo->AttributesEx & SPELL_ATTR_EX_NO_INITIAL_AGGRO) && !IsPositiveSpell(m_spellInfo->Id) && - m_caster->isVisibleForOrDetect(unit,false)) // stealth removed at Spell::cast if spell break it + m_caster->isVisibleForOrDetect(unit,unit,false)) { // use speedup check to avoid re-remove after above lines if (m_spellInfo->AttributesEx & SPELL_ATTR_EX_NOT_BREAK_STEALTH) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 7ef0cc7ae..983afe46f 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -4899,11 +4899,17 @@ void Aura::HandleAuraModIncreaseHealth(bool apply, bool Real) case 34511: // Valor (Bulwark of Kings, Bulwark of the Ancient Kings) case 44055: // Tremendous Fortitude (Battlemaster's Alacrity) case 50322: // Survival Instincts + case 54443: // Demonic Empowerment (Voidwalker) { if(Real) { if(apply) { + // Demonic Empowerment (Voidwalker) - special case, store percent in data + // recalculate to full amount at apply for proper remove + if (GetId() == 54443) + m_modifier.m_amount = m_target->GetMaxHealth() * m_modifier.m_amount / 100; + m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_VALUE, float(m_modifier.m_amount), apply); m_target->ModifyHealth(m_modifier.m_amount); } @@ -5486,8 +5492,6 @@ void Aura::HandleShapeshiftBoosts(bool apply) break; case FORM_MOONKIN: spellId1 = 24905; - // aura from effect trigger spell - spellId2 = 24907; MasterShaperSpellId = 48421; break; case FORM_FLIGHT: @@ -5495,15 +5499,15 @@ void Aura::HandleShapeshiftBoosts(bool apply) spellId2 = 34764; break; case FORM_FLIGHT_EPIC: - spellId1 = 40122; + spellId1 = 40122; spellId2 = 40121; break; case FORM_METAMORPHOSIS: - spellId1 = 54817; + spellId1 = 54817; spellId2 = 54879; break; case FORM_SPIRITOFREDEMPTION: - spellId1 = 27792; + spellId1 = 27792; spellId2 = 27795; // must be second, this important at aura remove to prevent to early iterator invalidation. break; case FORM_SHADOW: @@ -5518,14 +5522,15 @@ void Aura::HandleShapeshiftBoosts(bool apply) case FORM_STEALTH: case FORM_CREATURECAT: case FORM_CREATUREBEAR: - spellId1 = 0; break; } if(apply) { - if (spellId1) m_target->CastSpell(m_target, spellId1, true, NULL, this ); - if (spellId2) m_target->CastSpell(m_target, spellId2, true, NULL, this); + if (spellId1) + m_target->CastSpell(m_target, spellId1, true, NULL, this ); + if (spellId2) + m_target->CastSpell(m_target, spellId2, true, NULL, this); if (m_target->GetTypeId() == TYPEID_PLAYER) { @@ -5616,9 +5621,12 @@ void Aura::HandleShapeshiftBoosts(bool apply) } else { - m_target->RemoveAurasDueToSpell(spellId1); - m_target->RemoveAurasDueToSpell(spellId2); - m_target->RemoveAurasDueToSpell(MasterShaperSpellId); + if(spellId1) + m_target->RemoveAurasDueToSpell(spellId1); + if(spellId2) + m_target->RemoveAurasDueToSpell(spellId2); + if(MasterShaperSpellId) + m_target->RemoveAurasDueToSpell(MasterShaperSpellId); Unit::AuraMap& tAuras = m_target->GetAuras(); for (Unit::AuraMap::iterator itr = tAuras.begin(); itr != tAuras.end();) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 67a9867f3..f4ecd31eb 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -670,7 +670,7 @@ void Spell::EffectSchoolDMG(uint32 effect_idx) void Spell::EffectDummy(uint32 i) { - if(!unitTarget && !gameObjTarget && !itemTarget) + if (!unitTarget && !gameObjTarget && !itemTarget) return; // selection by spell family @@ -682,7 +682,7 @@ void Spell::EffectDummy(uint32 i) { case 8063: // Deviate Fish { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; uint32 spell_id = 0; @@ -699,7 +699,7 @@ void Spell::EffectDummy(uint32 i) } case 8213: // Savory Deviate Delight { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; uint32 spell_id = 0; @@ -716,7 +716,7 @@ void Spell::EffectDummy(uint32 i) case 8593: // Symbol of life (restore creature to life) case 31225: // Shimmering Vessel (restore creature to life) { - if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) return; ((Creature*)unitTarget)->setDeathState(JUST_ALIVED); return; @@ -725,7 +725,7 @@ void Spell::EffectDummy(uint32 i) case 12850: // (now good common check for this spells) case 12868: { - if(!unitTarget) + if (!unitTarget) return; float damage; @@ -748,7 +748,7 @@ void Spell::EffectDummy(uint32 i) // get remaining damage of old Deep Wound aura Aura* deepWound = unitTarget->GetAura(12721, 0); - if(deepWound) + if (deepWound) { int32 remainingTicks = deepWound->GetAuraDuration() / deepWound->GetModifier()->periodictime; damage += remainingTicks * deepWound->GetModifier()->m_amount; @@ -761,16 +761,16 @@ void Spell::EffectDummy(uint32 i) } case 13120: // net-o-matic { - if(!unitTarget) + if (!unitTarget) return; uint32 spell_id = 0; uint32 roll = urand(0, 99); - if(roll < 2) // 2% for 30 sec self root (off-like chance unknown) + if (roll < 2) // 2% for 30 sec self root (off-like chance unknown) spell_id = 16566; - else if(roll < 4) // 2% for 20 sec root, charge to target (off-like chance unknown) + else if (roll < 4) // 2% for 20 sec root, charge to target (off-like chance unknown) spell_id = 13119; else // normal root spell_id = 13099; @@ -781,7 +781,7 @@ void Spell::EffectDummy(uint32 i) case 13567: // Dummy Trigger { // can be used for different aura triggering, so select by aura - if(!m_triggeredByAuraSpell || !unitTarget) + if (!m_triggeredByAuraSpell || !unitTarget) return; switch(m_triggeredByAuraSpell->Id) @@ -798,7 +798,7 @@ void Spell::EffectDummy(uint32 i) case 15998: // Capture Worg Pup case 29435: // Capture Female Kaliri Hatchling { - if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) return; Creature* creatureTarget = (Creature*)unitTarget; @@ -808,7 +808,7 @@ void Spell::EffectDummy(uint32 i) } case 16589: // Noggenfogger Elixir { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; uint32 spell_id = 0; @@ -824,10 +824,10 @@ void Spell::EffectDummy(uint32 i) } case 17251: // Spirit Healer Res { - if(!unitTarget || !m_originalCaster) + if (!unitTarget || !m_originalCaster) return; - if(m_originalCaster->GetTypeId() == TYPEID_PLAYER) + if (m_originalCaster->GetTypeId() == TYPEID_PLAYER) { WorldPacket data(SMSG_SPIRIT_HEALER_CONFIRM, 8); data << uint64(unitTarget->GetGUID()); @@ -837,7 +837,7 @@ void Spell::EffectDummy(uint32 i) } case 17271: // Test Fetid Skull { - if(!itemTarget && m_caster->GetTypeId()!=TYPEID_PLAYER) + if (!itemTarget && m_caster->GetTypeId()!=TYPEID_PLAYER) return; uint32 spell_id = roll_chance_i(50) @@ -853,11 +853,11 @@ void Spell::EffectDummy(uint32 i) return; case 23019: // Crystal Prison Dummy DND { - if(!unitTarget || !unitTarget->isAlive() || unitTarget->GetTypeId() != TYPEID_UNIT || ((Creature*)unitTarget)->isPet()) + if (!unitTarget || !unitTarget->isAlive() || unitTarget->GetTypeId() != TYPEID_UNIT || ((Creature*)unitTarget)->isPet()) return; Creature* creatureTarget = (Creature*)unitTarget; - if(creatureTarget->isPet()) + if (creatureTarget->isPet()) return; GameObject* pGameObj = new GameObject; @@ -865,7 +865,7 @@ void Spell::EffectDummy(uint32 i) Map *map = creatureTarget->GetMap(); // create before death for get proper coordinates - if(!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 179644, map, m_caster->GetPhaseMask(), + if (!pGameObj->Create(objmgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), 179644, map, m_caster->GetPhaseMask(), creatureTarget->GetPositionX(), creatureTarget->GetPositionY(), creatureTarget->GetPositionZ(), creatureTarget->GetOrientation(), 0.0f, 0.0f, 0.0f, 0.0f, 100, GO_STATE_READY) ) { @@ -886,34 +886,38 @@ void Spell::EffectDummy(uint32 i) return; } case 23074: // Arcanite Dragonling - if (!m_CastItem) return; + if (!m_CastItem) + return; m_caster->CastSpell(m_caster, 19804, true, m_CastItem); return; case 23075: // Mithril Mechanical Dragonling - if (!m_CastItem) return; + if (!m_CastItem) + return; m_caster->CastSpell(m_caster, 12749, true, m_CastItem); return; case 23076: // Mechanical Dragonling - if (!m_CastItem) return; + if (!m_CastItem) + return; m_caster->CastSpell(m_caster, 4073, true, m_CastItem); return; case 23133: // Gnomish Battle Chicken - if (!m_CastItem) return; + if (!m_CastItem) + return; m_caster->CastSpell(m_caster, 13166, true, m_CastItem); return; case 23448: // Transporter Arrival - Ultrasafe Transporter: Gadgetzan - backfires { int32 r = irand(0, 119); - if ( r < 20 ) // Transporter Malfunction - 1/6 polymorph + if (r < 20) // Transporter Malfunction - 1/6 polymorph m_caster->CastSpell(m_caster, 23444, true); - else if ( r < 100 ) // Evil Twin - 4/6 evil twin + else if (r < 100) // Evil Twin - 4/6 evil twin m_caster->CastSpell(m_caster, 23445, true); else // Transporter Malfunction - 1/6 miss the target m_caster->CastSpell(m_caster, 36902, true); return; } case 23453: // Gnomish Transporter - Ultrasafe Transporter: Gadgetzan - if ( roll_chance_i(50) ) // Gadgetzan Transporter - success + if (roll_chance_i(50)) // Gadgetzan Transporter - success m_caster->CastSpell(m_caster, 23441, true); else // Gadgetzan Transporter Failure - failure m_caster->CastSpell(m_caster, 23446, true); @@ -966,7 +970,7 @@ void Spell::EffectDummy(uint32 i) } case 29200: // Purify Helboar Meat { - if( m_caster->GetTypeId() != TYPEID_PLAYER ) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; uint32 spell_id = roll_chance_i(50) @@ -981,22 +985,24 @@ void Spell::EffectDummy(uint32 i) m_caster->CastSpell(unitTarget,32835,true); return; case 30458: // Nigh Invulnerability - if (!m_CastItem) return; - if(roll_chance_i(86)) // Nigh-Invulnerability - success + if (!m_CastItem) + return; + if (roll_chance_i(86)) // Nigh-Invulnerability - success m_caster->CastSpell(m_caster, 30456, true, m_CastItem); else // Complete Vulnerability - backfire in 14% casts m_caster->CastSpell(m_caster, 30457, true, m_CastItem); return; case 30507: // Poultryizer - if (!m_CastItem) return; - if(roll_chance_i(80)) // Poultryized! - success + if(!m_CastItem) + return; + if (roll_chance_i(80)) // Poultryized! - success m_caster->CastSpell(unitTarget, 30501, true, m_CastItem); else // Poultryized! - backfire 20% m_caster->CastSpell(unitTarget, 30504, true, m_CastItem); return; case 33060: // Make a Wish { - if(m_caster->GetTypeId()!=TYPEID_PLAYER) + if (m_caster->GetTypeId()!=TYPEID_PLAYER) return; uint32 spell_id = 0; @@ -1028,7 +1034,7 @@ void Spell::EffectDummy(uint32 i) } case 37674: // Chaos Blast { - if(!unitTarget) + if (!unitTarget) return; int32 basepoints0 = 100; @@ -1081,7 +1087,7 @@ void Spell::EffectDummy(uint32 i) */ case 44875: // Complete Raptor Capture { - if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) return; Creature* creatureTarget = (Creature*)unitTarget; @@ -1094,7 +1100,7 @@ void Spell::EffectDummy(uint32 i) } case 34665: //Administer Antidote { - if(!unitTarget || m_caster->GetTypeId() != TYPEID_PLAYER ) + if (!unitTarget || m_caster->GetTypeId() != TYPEID_PLAYER ) return; // Spell has scriptable target but for sure. if (unitTarget->GetTypeId() != TYPEID_UNIT) @@ -1130,21 +1136,22 @@ void Spell::EffectDummy(uint32 i) return; } case 55004: // Nitro Boosts - if(!m_CastItem) return; - if(roll_chance_i(95)) // Nitro Boosts - success + if (!m_CastItem) + return; + if (roll_chance_i(95)) // Nitro Boosts - success m_caster->CastSpell(m_caster, 54861, true, m_CastItem); else // Knocked Up - backfire 5% m_caster->CastSpell(m_caster, 46014, true, m_CastItem); return; case 50243: // Teach Language { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; // spell has a 1/3 chance to trigger one of the below - if(roll_chance_i(66)) + if (roll_chance_i(66)) return; - if(((Player*)m_caster)->GetTeam() == ALLIANCE) + if (((Player*)m_caster)->GetTeam() == ALLIANCE) { // 1000001 - gnomish binary m_caster->CastSpell(m_caster, 50242, true); @@ -1159,10 +1166,10 @@ void Spell::EffectDummy(uint32 i) } case 51582: //Rocket Boots Engaged (Rocket Boots Xtreme and Rocket Boots Xtreme Lite) { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; - if(BattleGround* bg = ((Player*)m_caster)->GetBattleGround()) + if (BattleGround* bg = ((Player*)m_caster)->GetBattleGround()) bg->EventPlayerDroppedFlag((Player*)m_caster); m_caster->CastSpell(m_caster, 30452, true, NULL); @@ -1170,7 +1177,7 @@ void Spell::EffectDummy(uint32 i) } case 51592: // Pickup Primordial Hatchling { - if(!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) return; Creature* creatureTarget = (Creature*)unitTarget; @@ -1214,7 +1221,7 @@ void Spell::EffectDummy(uint32 i) return; // implemented in EffectScript[0] case 59640: // Underbelly Elixir { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; uint32 spell_id = 0; @@ -1259,7 +1266,7 @@ void Spell::EffectDummy(uint32 i) { case 11958: // Cold Snap { - if(m_caster->GetTypeId()!=TYPEID_PLAYER) + if (m_caster->GetTypeId()!=TYPEID_PLAYER) return; // immediately finishes the cooldown on Frost spells @@ -1268,9 +1275,9 @@ void Spell::EffectDummy(uint32 i) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(itr->first); - if( spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && + if (spellInfo->SpellFamilyName == SPELLFAMILY_MAGE && (GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_FROST) && - spellInfo->Id != 11958 && GetSpellRecoveryTime(spellInfo) > 0 ) + spellInfo->Id != 11958 && GetSpellRecoveryTime(spellInfo) > 0) { ((Player*)m_caster)->RemoveSpellCooldown((itr++)->first, true); } @@ -1281,7 +1288,7 @@ void Spell::EffectDummy(uint32 i) } case 32826: // Polymorph Cast Visual { - if ( unitTarget && unitTarget->GetTypeId() == TYPEID_UNIT ) + if (unitTarget && unitTarget->GetTypeId() == TYPEID_UNIT) { //Polymorph Cast Visual Rank 1 const uint32 spell_list[6] = { @@ -1300,14 +1307,14 @@ void Spell::EffectDummy(uint32 i) break; case SPELLFAMILY_WARRIOR: // Charge - if((m_spellInfo->SpellFamilyFlags & UI64LIT(0x1)) && m_spellInfo->SpellVisual[0] == 867) + if ((m_spellInfo->SpellFamilyFlags & UI64LIT(0x1)) && m_spellInfo->SpellVisual[0] == 867) { int32 chargeBasePoints0 = damage; m_caster->CastCustomSpell(m_caster, 34846, &chargeBasePoints0, NULL, NULL, true); return; } // Execute - if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x20000000)) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x20000000)) { if(!unitTarget) return; @@ -1324,7 +1331,7 @@ void Spell::EffectDummy(uint32 i) return; } // Slam - if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000200000)) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000200000)) { if(!unitTarget) return; @@ -1333,7 +1340,7 @@ void Spell::EffectDummy(uint32 i) return; } // Concussion Blow - if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000004000000)) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000004000000)) { m_damage+= uint32(damage * m_caster->GetTotalAttackPowerValue(BASE_ATTACK) / 100); return; @@ -1343,7 +1350,7 @@ void Spell::EffectDummy(uint32 i) // Warrior's Wrath case 21977: { - if(!unitTarget) + if (!unitTarget) return; m_caster->CastSpell(unitTarget, 21887, true);// spell mod return; @@ -1385,7 +1392,7 @@ void Spell::EffectDummy(uint32 i) } // Think its not need (also need remove Life Tap from SpellDamageBonus or add new value) // damage = m_caster->SpellDamageBonus(m_caster, m_spellInfo,uint32(damage > 0 ? damage : 0), SPELL_DIRECT_DAMAGE); - if(unitTarget && (int32(unitTarget->GetHealth()) > damage)) + if (unitTarget && (int32(unitTarget->GetHealth()) > damage)) { // Shouldn't Appear in Combat Log unitTarget->ModifyHealth(-damage); @@ -1408,7 +1415,7 @@ void Spell::EffectDummy(uint32 i) if((*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_WARLOCK && (*itr)->GetSpellProto()->SpellIconID == 1982) manaFeedVal+= (*itr)->GetModifier()->m_amount; } - if(manaFeedVal > 0) + if (manaFeedVal > 0) { manaFeedVal = manaFeedVal * mana / 100; m_caster->CastCustomSpell(m_caster, 32553, &manaFeedVal, NULL, NULL, true, NULL); @@ -1458,7 +1465,7 @@ void Spell::EffectDummy(uint32 i) } //Any effect which causes you to lose control of your character will supress the starfall effect. - if(m_caster->hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_FLEEING | UNIT_STAT_ROOT | UNIT_STAT_CONFUSED)) + if (m_caster->hasUnitState(UNIT_STAT_STUNNED | UNIT_STAT_FLEEING | UNIT_STAT_ROOT | UNIT_STAT_CONFUSED)) return; switch(m_spellInfo->Id) @@ -1478,31 +1485,31 @@ void Spell::EffectDummy(uint32 i) { case 5938: // Shiv { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; Player *pCaster = ((Player*)m_caster); Item *item = pCaster->GetWeaponForAttack(OFF_ATTACK); - if(!item) + if (!item) return; // all poison enchantments is temporary uint32 enchant_id = item->GetEnchantmentId(TEMP_ENCHANTMENT_SLOT); - if(!enchant_id) + if (!enchant_id) return; SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); - if(!pEnchant) + if (!pEnchant) return; for (int s=0;s<3;s++) { - if(pEnchant->type[s]!=ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL) + if (pEnchant->type[s]!=ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL) continue; SpellEntry const* combatEntry = sSpellStore.LookupEntry(pEnchant->spellid[s]); - if(!combatEntry || combatEntry->Dispel != DISPEL_POISON) + if (!combatEntry || combatEntry->Dispel != DISPEL_POISON) continue; m_caster->CastSpell(unitTarget, combatEntry, true, item); @@ -1513,7 +1520,7 @@ void Spell::EffectDummy(uint32 i) } case 14185: // Preparation { - if(m_caster->GetTypeId()!=TYPEID_PLAYER) + if (m_caster->GetTypeId()!=TYPEID_PLAYER) return; //immediately finishes the cooldown on certain Rogue abilities @@ -1538,9 +1545,9 @@ void Spell::EffectDummy(uint32 i) break; case SPELLFAMILY_HUNTER: // Steady Shot - if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x100000000)) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x100000000)) { - if( !unitTarget || !unitTarget->isAlive()) + if (!unitTarget || !unitTarget->isAlive()) return; bool found = false; @@ -1549,14 +1556,14 @@ void Spell::EffectDummy(uint32 i) Unit::AuraList const& decSpeedList = unitTarget->GetAurasByType(SPELL_AURA_MOD_DECREASE_SPEED); for(Unit::AuraList::const_iterator iter = decSpeedList.begin(); iter != decSpeedList.end(); ++iter) { - if((*iter)->GetSpellProto()->SpellIconID==15 && (*iter)->GetSpellProto()->Dispel==0) + if ((*iter)->GetSpellProto()->SpellIconID==15 && (*iter)->GetSpellProto()->Dispel==0) { found = true; break; } } - if(found) + if (found) m_damage+= damage; return; } @@ -1565,7 +1572,7 @@ void Spell::EffectDummy(uint32 i) { case 23989: // Readiness talent { - if(m_caster->GetTypeId()!=TYPEID_PLAYER) + if (m_caster->GetTypeId()!=TYPEID_PLAYER) return; //immediately finishes the cooldown for hunter abilities @@ -1599,7 +1606,7 @@ void Spell::EffectDummy(uint32 i) { case 156: // Holy Shock { - if(!unitTarget) + if (!unitTarget) return; int hurt = 0; @@ -1619,7 +1626,7 @@ void Spell::EffectDummy(uint32 i) return; } - if(m_caster->IsFriendlyTo(unitTarget)) + if (m_caster->IsFriendlyTo(unitTarget)) m_caster->CastSpell(unitTarget, heal, true, 0); else m_caster->CastSpell(unitTarget, hurt, true, 0); @@ -1628,15 +1635,15 @@ void Spell::EffectDummy(uint32 i) } case 561: // Judgement of command { - if(!unitTarget) + if (!unitTarget) return; uint32 spell_id = m_currentBasePoints[i]+1; SpellEntry const* spell_proto = sSpellStore.LookupEntry(spell_id); - if(!spell_proto) + if (!spell_proto) return; - if( !unitTarget->hasUnitState(UNIT_STAT_STUNNED) && m_caster->GetTypeId()==TYPEID_PLAYER) + if (!unitTarget->hasUnitState(UNIT_STAT_STUNNED) && m_caster->GetTypeId()==TYPEID_PLAYER) { // decreased damage (/2) for non-stunned target. SpellModifier *mod = new SpellModifier; @@ -1676,7 +1683,7 @@ void Spell::EffectDummy(uint32 i) // non-standard cast requirement check if (!unitTarget || unitTarget->getAttackers().empty()) { - if(m_caster->GetTypeId()==TYPEID_PLAYER) + if (m_caster->GetTypeId()==TYPEID_PLAYER) ((Player*)m_caster)->RemoveSpellCooldown(m_spellInfo->Id,true); SendCastResult(SPELL_FAILED_TARGET_AFFECTING_COMBAT); return; @@ -1695,7 +1702,7 @@ void Spell::EffectDummy(uint32 i) uint32 count=0; for(Unit::AttackerSet::const_iterator aItr = attackers.begin(); aItr != attackers.end() && count < 3; ++aItr) { - if(!roll_chance_f(chance)) + if (!roll_chance_f(chance)) continue; ++count; AddUnitTarget((*aItr), 1); @@ -1706,7 +1713,7 @@ void Spell::EffectDummy(uint32 i) } case 37877: // Blessing of Faith { - if(!unitTarget) + if (!unitTarget) return; uint32 spell_id = 0; @@ -1742,22 +1749,22 @@ void Spell::EffectDummy(uint32 i) return; } - SpellEntry const *spellInfo = sSpellStore.LookupEntry( spell_id ); + SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id); - if(!spellInfo) + if (!spellInfo) { sLog.outError("WORLD: unknown spell id %i", spell_id); return; } - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; for(int j = BASE_ATTACK; j <= OFF_ATTACK; ++j) { - if(Item* item = ((Player*)m_caster)->GetWeaponForAttack(WeaponAttackType(j))) + if (Item* item = ((Player*)m_caster)->GetWeaponForAttack(WeaponAttackType(j))) { - if(item->IsFitToSpellRequirements(m_spellInfo)) + if (item->IsFitToSpellRequirements(m_spellInfo)) { Spell *spell = new Spell(m_caster, spellInfo, true); @@ -1775,31 +1782,31 @@ void Spell::EffectDummy(uint32 i) return; } // Cleansing Totem - if((m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000004000000)) && m_spellInfo->SpellIconID==1673) + if ((m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000004000000)) && m_spellInfo->SpellIconID==1673) { m_caster->CastSpell(unitTarget, 52025, true); return; } // Healing Stream Totem - if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000002000)) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000002000)) { m_caster->CastCustomSpell(unitTarget, 52042, &damage, 0, 0, true, 0, 0, m_originalCasterGUID); return; } // Mana Spring Totem - if(m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000004000)) + if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000004000)) { - if(unitTarget->getPowerType()!=POWER_MANA) + if (unitTarget->getPowerType()!=POWER_MANA) return; m_caster->CastCustomSpell(unitTarget, 52032, &damage, 0, 0, true, 0, 0, m_originalCasterGUID); return; } - if(m_spellInfo->Id == 39610) // Mana Tide Totem effect + if (m_spellInfo->Id == 39610) // Mana Tide Totem effect { - if(!unitTarget || unitTarget->getPowerType() != POWER_MANA) + if (!unitTarget || unitTarget->getPowerType() != POWER_MANA) return; // Glyph of Mana Tide - if(Unit *owner = m_caster->GetOwner()) + if (Unit *owner = m_caster->GetOwner()) if (Aura *dummy = owner->GetDummyAura(55441)) damage+=dummy->GetModifier()->m_amount; // Regenerate 6% of Total Mana Every 3 secs @@ -1819,7 +1826,7 @@ void Spell::EffectDummy(uint32 i) Unit::AuraList const& auraDummy = m_caster->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator itr = auraDummy.begin(); itr != auraDummy.end(); ++itr) { - if( (*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_SHAMAN && + if ((*itr)->GetSpellProto()->SpellFamilyName==SPELLFAMILY_SHAMAN && ((*itr)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000200000)) && (*itr)->GetCastItemGUID() == item->GetGUID()) { @@ -1835,9 +1842,9 @@ void Spell::EffectDummy(uint32 i) // Death Coil if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x002000)) { - if(m_caster->IsFriendlyTo(unitTarget)) + if (m_caster->IsFriendlyTo(unitTarget)) { - if(unitTarget->GetCreatureType() != CREATURE_TYPE_UNDEAD) + if (unitTarget->GetCreatureType() != CREATURE_TYPE_UNDEAD) return; int32 bp = damage * 1.5f; @@ -1863,13 +1870,13 @@ void Spell::EffectDummy(uint32 i) Unit::AuraMap const& auras = unitTarget->GetAuras(); for(Unit::AuraMap::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr) { - if(itr->second->GetSpellProto()->Dispel == DISPEL_DISEASE && + if (itr->second->GetSpellProto()->Dispel == DISPEL_DISEASE && itr->second->GetCasterGUID() == m_caster->GetGUID() && IsSpellLastAuraEffect(itr->second->GetSpellProto(), itr->second->GetEffIndex())) { ++count; // max. 15% - if(count == 3) + if (count == 3) break; } } @@ -1882,7 +1889,7 @@ void Spell::EffectDummy(uint32 i) } // pet auras - if(PetAura const* petSpell = spellmgr.GetPetAura(m_spellInfo->Id, i)) + if (PetAura const* petSpell = spellmgr.GetPetAura(m_spellInfo->Id, i)) { m_caster->AddPetAura(petSpell); return; @@ -1890,11 +1897,11 @@ void Spell::EffectDummy(uint32 i) // Script based implementation. Must be used only for not good for implementation in core spell effects // So called only for not proccessed cases - if(gameObjTarget) + if (gameObjTarget) Script->EffectDummyGameObj(m_caster, m_spellInfo->Id, i, gameObjTarget); - else if(unitTarget && unitTarget->GetTypeId()==TYPEID_UNIT) + else if (unitTarget && unitTarget->GetTypeId()==TYPEID_UNIT) Script->EffectDummyCreature(m_caster, m_spellInfo->Id, i, (Creature*)unitTarget); - else if(itemTarget) + else if (itemTarget) Script->EffectDummyItem(m_caster, m_spellInfo->Id, i, itemTarget); } @@ -2472,22 +2479,22 @@ void Spell::EffectSendEvent(uint32 EffectIndex) void Spell::EffectPowerBurn(uint32 i) { - if(m_spellInfo->EffectMiscValue[i] < 0 || m_spellInfo->EffectMiscValue[i] >= MAX_POWERS) + if (m_spellInfo->EffectMiscValue[i] < 0 || m_spellInfo->EffectMiscValue[i] >= MAX_POWERS) return; Powers powertype = Powers(m_spellInfo->EffectMiscValue[i]); - if(!unitTarget) + if (!unitTarget) return; - if(!unitTarget->isAlive()) + if (!unitTarget->isAlive()) return; - if(unitTarget->getPowerType()!=powertype) + if (unitTarget->getPowerType()!=powertype) return; - if(damage < 0) + if (damage < 0) return; // burn x% of target's mana, up to maximum of 2x% of caster's mana (Mana Burn) - if(m_spellInfo->ManaCostPercentage) + if (m_spellInfo->ManaCostPercentage) { uint32 maxdamage = m_caster->GetMaxPower(powertype) * damage * 2 / 100; damage = unitTarget->GetMaxPower(powertype) * damage / 100; @@ -2498,7 +2505,7 @@ void Spell::EffectPowerBurn(uint32 i) // resilience reduce mana draining effect at spell crit damage reduction (added in 2.4) uint32 power = damage; - if ( powertype == POWER_MANA && unitTarget->GetTypeId() == TYPEID_PLAYER ) + if (powertype == POWER_MANA && unitTarget->GetTypeId() == TYPEID_PLAYER) power -= ((Player*)unitTarget)->GetSpellCritDamageReduction(power); int32 new_damage = (curPower < power) ? curPower : power; @@ -2506,7 +2513,7 @@ void Spell::EffectPowerBurn(uint32 i) unitTarget->ModifyPower(powertype, -new_damage); float multiplier = m_spellInfo->EffectMultipleValue[i]; - if(Player *modOwner = m_caster->GetSpellModOwner()) + if (Player *modOwner = m_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_MULTIPLE_VALUE, multiplier); new_damage = int32(new_damage * multiplier); @@ -2515,7 +2522,7 @@ void Spell::EffectPowerBurn(uint32 i) void Spell::EffectHeal( uint32 /*i*/ ) { - if( unitTarget && unitTarget->isAlive() && damage >= 0) + if (unitTarget && unitTarget->isAlive() && damage >= 0) { // Try to get original caster Unit *caster = m_originalCasterGUID ? m_originalCaster : m_caster; @@ -2533,7 +2540,7 @@ void Spell::EffectHeal( uint32 /*i*/ ) int damageAmount = 0; Unit::AuraList const& mDummyAuras = m_caster->GetAurasByType(SPELL_AURA_DUMMY); for(Unit::AuraList::const_iterator i = mDummyAuras.begin(); i != mDummyAuras.end(); ++i) - if((*i)->GetId() == 45062) + if ((*i)->GetId() == 45062) damageAmount+=(*i)->GetModifier()->m_amount; if (damageAmount) m_caster->RemoveAurasDueToSpell(45062); @@ -2552,12 +2559,12 @@ void Spell::EffectHeal( uint32 /*i*/ ) // Regrowth or Rejuvenation 0x40 | 0x10 ((*i)->GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000000050))) { - if(!targetAura || (*i)->GetAuraDuration() < targetAura->GetAuraDuration()) + if (!targetAura || (*i)->GetAuraDuration() < targetAura->GetAuraDuration()) targetAura = *i; } } - if(!targetAura) + if (!targetAura) { sLog.outError("Target (GUID: %u TypeId: %u) has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUIDLow(), unitTarget->GetTypeId()); return; @@ -2574,7 +2581,7 @@ void Spell::EffectHeal( uint32 /*i*/ ) int32 tickcount = GetSpellDuration(targetAura->GetSpellProto()) / targetAura->GetSpellProto()->EffectAmplitude[idx]; // Glyph of Swiftmend - if(!caster->HasAura(54824)) + if (!caster->HasAura(54824)) unitTarget->RemoveAurasDueToSpell(targetAura->GetId()); addhealth += tickheal * tickcount; @@ -2588,7 +2595,7 @@ void Spell::EffectHeal( uint32 /*i*/ ) void Spell::EffectHealPct( uint32 /*i*/ ) { - if( unitTarget && unitTarget->isAlive() && damage >= 0) + if (unitTarget && unitTarget->isAlive() && damage >= 0) { // Try to get original caster Unit *caster = m_originalCasterGUID ? m_originalCaster : m_caster; @@ -2598,7 +2605,7 @@ void Spell::EffectHealPct( uint32 /*i*/ ) return; uint32 addhealth = unitTarget->GetMaxHealth() * damage / 100; - if(Player* modOwner = m_caster->GetSpellModOwner()) + if (Player* modOwner = m_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DAMAGE, addhealth, this); int32 gain = caster->DealHeal(unitTarget, addhealth, m_spellInfo); @@ -2609,7 +2616,7 @@ void Spell::EffectHealPct( uint32 /*i*/ ) void Spell::EffectHealMechanical( uint32 /*i*/ ) { // Mechanic creature type should be correctly checked by targetCreatureType field - if( unitTarget && unitTarget->isAlive() && damage >= 0) + if (unitTarget && unitTarget->isAlive() && damage >= 0) { // Try to get original caster Unit *caster = m_originalCasterGUID ? m_originalCaster : m_caster; @@ -2625,34 +2632,32 @@ void Spell::EffectHealMechanical( uint32 /*i*/ ) void Spell::EffectHealthLeech(uint32 i) { - if(!unitTarget) + if (!unitTarget) return; - if(!unitTarget->isAlive()) + if (!unitTarget->isAlive()) return; - if(damage < 0) + if (damage < 0) return; sLog.outDebug("HealthLeech :%i", damage); float multiplier = m_spellInfo->EffectMultipleValue[i]; - if(Player *modOwner = m_caster->GetSpellModOwner()) + if (Player *modOwner = m_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_MULTIPLE_VALUE, multiplier); int32 new_damage = int32(damage*multiplier); uint32 curHealth = unitTarget->GetHealth(); new_damage = m_caster->SpellNonMeleeDamageLog(unitTarget, m_spellInfo->Id, new_damage ); - if(curHealth < new_damage) + if (curHealth < new_damage) new_damage = curHealth; - if(m_caster->isAlive()) + if (m_caster->isAlive()) { new_damage = m_caster->SpellHealingBonus(m_caster, m_spellInfo, new_damage, HEAL); m_caster->DealHeal(m_caster, uint32(new_damage), m_spellInfo); } -// m_healthLeech+=tmpvalue; -// m_damage+=new_damage; } void Spell::DoCreateItem(uint32 i, uint32 itemtype) @@ -2792,7 +2797,7 @@ void Spell::EffectCreateItem(uint32 i) void Spell::EffectCreateItem2(uint32 i) { - if(m_caster->GetTypeId()!=TYPEID_PLAYER) + if (m_caster->GetTypeId()!=TYPEID_PLAYER) return; Player* player = (Player*)m_caster; @@ -2801,9 +2806,9 @@ void Spell::EffectCreateItem2(uint32 i) DoCreateItem(i, item_id); // special case: fake item replaced by generate using spell_loot_template - if(IsLootCraftingSpell(m_spellInfo)) + if (IsLootCraftingSpell(m_spellInfo)) { - if(!player->HasItemCount(item_id, 1)) + if (!player->HasItemCount(item_id, 1)) return; // remove reagent @@ -2817,7 +2822,7 @@ void Spell::EffectCreateItem2(uint32 i) void Spell::EffectCreateRandomItem(uint32 i) { - if(m_caster->GetTypeId()!=TYPEID_PLAYER) + if (m_caster->GetTypeId()!=TYPEID_PLAYER) return; Player* player = (Player*)m_caster; @@ -2829,12 +2834,12 @@ void Spell::EffectPersistentAA(uint32 i) { float radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); - if(Player* modOwner = m_caster->GetSpellModOwner()) + if (Player* modOwner = m_caster->GetSpellModOwner()) modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius); int32 duration = GetSpellDuration(m_spellInfo); DynamicObject* dynObj = new DynamicObject; - if(!dynObj->Create(objmgr.GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo->Id, i, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, duration, radius)) + if (!dynObj->Create(objmgr.GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo->Id, i, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, duration, radius)) { delete dynObj; return; @@ -2938,18 +2943,18 @@ void Spell::EffectEnergize(uint32 i) void Spell::EffectEnergisePct(uint32 i) { - if(!unitTarget) + if (!unitTarget) return; - if(!unitTarget->isAlive()) + if (!unitTarget->isAlive()) return; - if(m_spellInfo->EffectMiscValue[i] < 0 || m_spellInfo->EffectMiscValue[i] >= MAX_POWERS) + if (m_spellInfo->EffectMiscValue[i] < 0 || m_spellInfo->EffectMiscValue[i] >= MAX_POWERS) return; Powers power = Powers(m_spellInfo->EffectMiscValue[i]); uint32 maxPower = unitTarget->GetMaxPower(power); - if(maxPower == 0) + if (maxPower == 0) return; uint32 gain = damage * maxPower / 100; @@ -2983,7 +2988,7 @@ void Spell::SendLoot(uint64 guid, LootType loottype) case GAMEOBJECT_TYPE_SPELL_FOCUS: // triggering linked GO - if(uint32 trapEntry = gameObjTarget->GetGOInfo()->spellFocus.linkedTrapId) + if (uint32 trapEntry = gameObjTarget->GetGOInfo()->spellFocus.linkedTrapId) gameObjTarget->TriggeringLinkedGameObject(trapEntry,m_caster); return; @@ -2998,7 +3003,7 @@ void Spell::SendLoot(uint64 guid, LootType loottype) // cast goober spell if (gameObjTarget->GetGOInfo()->goober.questId) ///Quest require to be active for GO using - if(player->GetQuestStatus(gameObjTarget->GetGOInfo()->goober.questId) != QUEST_STATUS_INCOMPLETE) + if (player->GetQuestStatus(gameObjTarget->GetGOInfo()->goober.questId) != QUEST_STATUS_INCOMPLETE) return; gameObjTarget->AddUniqueUse(player); @@ -3011,7 +3016,7 @@ void Spell::SendLoot(uint64 guid, LootType loottype) player->CastedCreatureOrGO(gameObjTarget->GetEntry(), gameObjTarget->GetGUID(), 0); // triggering linked GO - if(uint32 trapEntry = gameObjTarget->GetGOInfo()->goober.linkedTrapId) + if (uint32 trapEntry = gameObjTarget->GetGOInfo()->goober.linkedTrapId) gameObjTarget->TriggeringLinkedGameObject(trapEntry,m_caster); return; @@ -3025,7 +3030,7 @@ void Spell::SendLoot(uint64 guid, LootType loottype) } // triggering linked GO - if(uint32 trapEntry = gameObjTarget->GetGOInfo()->chest.linkedTrapId) + if (uint32 trapEntry = gameObjTarget->GetGOInfo()->chest.linkedTrapId) gameObjTarget->TriggeringLinkedGameObject(trapEntry,m_caster); // Don't return, let loots been taken @@ -3040,7 +3045,7 @@ void Spell::SendLoot(uint64 guid, LootType loottype) void Spell::EffectOpenLock(uint32 effIndex) { - if(!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER) + if (!m_caster || m_caster->GetTypeId() != TYPEID_PLAYER) { sLog.outDebug( "WORLD: Open Lock - No Player Caster!"); return; @@ -3052,19 +3057,19 @@ void Spell::EffectOpenLock(uint32 effIndex) uint64 guid = 0; // Get lockId - if(gameObjTarget) + if (gameObjTarget) { GameObjectInfo const* goInfo = gameObjTarget->GetGOInfo(); // Arathi Basin banner opening ! - if( goInfo->type == GAMEOBJECT_TYPE_BUTTON && goInfo->button.noDamageImmune || - goInfo->type == GAMEOBJECT_TYPE_GOOBER && goInfo->goober.losOK ) + 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()) + if (BattleGround *bg = player->GetBattleGround()) { // check if it's correct bg - if(bg && bg->GetTypeID() == BATTLEGROUND_AB) + if (bg && bg->GetTypeID() == BATTLEGROUND_AB) bg->EventPlayerClickedOnFlag(player, gameObjTarget); return; } @@ -3073,9 +3078,9 @@ void Spell::EffectOpenLock(uint32 effIndex) { //CanUseBattleGroundObject() already called in CheckCast() // in battleground check - if(BattleGround *bg = player->GetBattleGround()) + if (BattleGround *bg = player->GetBattleGround()) { - if(bg->GetTypeID() == BATTLEGROUND_EY) + if (bg->GetTypeID() == BATTLEGROUND_EY) bg->EventPlayerClickedOnFlag(player, gameObjTarget); return; } @@ -3083,7 +3088,7 @@ void Spell::EffectOpenLock(uint32 effIndex) lockId = goInfo->GetLockId(); guid = gameObjTarget->GetGUID(); } - else if(itemTarget) + else if (itemTarget) { lockId = itemTarget->GetProto()->LockID; guid = itemTarget->GetGUID(); @@ -3099,7 +3104,7 @@ void Spell::EffectOpenLock(uint32 effIndex) int32 skillValue; SpellCastResult res = CanOpenLock(effIndex, lockId, skillId, reqSkillValue, skillValue); - if(res != SPELL_CAST_OK) + if (res != SPELL_CAST_OK) { SendCastResult(res); return; @@ -3108,19 +3113,19 @@ void Spell::EffectOpenLock(uint32 effIndex) SendLoot(guid, LOOT_SKINNING); // not allow use skill grow at item base open - if(!m_CastItem && skillId != SKILL_NONE) + if (!m_CastItem && skillId != SKILL_NONE) { // update skill if really known - if(uint32 pureSkillValue = player->GetPureSkillValue(skillId)) + if (uint32 pureSkillValue = player->GetPureSkillValue(skillId)) { - if(gameObjTarget) + if (gameObjTarget) { // Allow one skill-up until respawned - if ( !gameObjTarget->IsInSkillupList( player->GetGUIDLow() ) && - player->UpdateGatherSkill(skillId, pureSkillValue, reqSkillValue) ) - gameObjTarget->AddToSkillupList( player->GetGUIDLow() ); + if (!gameObjTarget->IsInSkillupList(player->GetGUIDLow()) && + player->UpdateGatherSkill(skillId, pureSkillValue, reqSkillValue)) + gameObjTarget->AddToSkillupList(player->GetGUIDLow()); } - else if(itemTarget) + else if (itemTarget) { // Do one skill-up player->UpdateGatherSkill(skillId, pureSkillValue, reqSkillValue); @@ -3131,51 +3136,51 @@ void Spell::EffectOpenLock(uint32 effIndex) void Spell::EffectSummonChangeItem(uint32 i) { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; Player *player = (Player*)m_caster; // applied only to using item - if(!m_CastItem) + if (!m_CastItem) return; // ... only to item in own inventory/bank/equip_slot - if(m_CastItem->GetOwnerGUID()!=player->GetGUID()) + if (m_CastItem->GetOwnerGUID()!=player->GetGUID()) return; uint32 newitemid = m_spellInfo->EffectItemType[i]; - if(!newitemid) + if (!newitemid) return; uint16 pos = m_CastItem->GetPos(); Item *pNewItem = Item::CreateItem( newitemid, 1, player); - if( !pNewItem ) + if (!pNewItem) return; for(uint8 j= PERM_ENCHANTMENT_SLOT; j<=TEMP_ENCHANTMENT_SLOT; ++j) { - if(m_CastItem->GetEnchantmentId(EnchantmentSlot(j))) + if (m_CastItem->GetEnchantmentId(EnchantmentSlot(j))) pNewItem->SetEnchantment(EnchantmentSlot(j), m_CastItem->GetEnchantmentId(EnchantmentSlot(j)), m_CastItem->GetEnchantmentDuration(EnchantmentSlot(j)), m_CastItem->GetEnchantmentCharges(EnchantmentSlot(j))); } - if(m_CastItem->GetUInt32Value(ITEM_FIELD_DURABILITY) < m_CastItem->GetUInt32Value(ITEM_FIELD_MAXDURABILITY)) + if (m_CastItem->GetUInt32Value(ITEM_FIELD_DURABILITY) < m_CastItem->GetUInt32Value(ITEM_FIELD_MAXDURABILITY)) { double loosePercent = 1 - m_CastItem->GetUInt32Value(ITEM_FIELD_DURABILITY) / double(m_CastItem->GetUInt32Value(ITEM_FIELD_MAXDURABILITY)); player->DurabilityLoss(pNewItem, loosePercent); } - if( player->IsInventoryPos( pos ) ) + if (player->IsInventoryPos(pos)) { ItemPosCountVec dest; uint8 msg = player->CanStoreItem( m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), dest, pNewItem, true ); - if( msg == EQUIP_ERR_OK ) + if (msg == EQUIP_ERR_OK) { player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true); // prevent crash at access and unexpected charges counting with item update queue corrupt - if(m_CastItem==m_targets.getItemTarget()) + if (m_CastItem==m_targets.getItemTarget()) m_targets.setItemTarget(NULL); m_CastItem = NULL; @@ -3184,16 +3189,16 @@ void Spell::EffectSummonChangeItem(uint32 i) return; } } - else if( player->IsBankPos ( pos ) ) + else if (player->IsBankPos (pos)) { ItemPosCountVec dest; uint8 msg = player->CanBankItem( m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), dest, pNewItem, true ); - if( msg == EQUIP_ERR_OK ) + if (msg == EQUIP_ERR_OK) { player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true); // prevent crash at access and unexpected charges counting with item update queue corrupt - if(m_CastItem==m_targets.getItemTarget()) + if (m_CastItem==m_targets.getItemTarget()) m_targets.setItemTarget(NULL); m_CastItem = NULL; @@ -3202,16 +3207,16 @@ void Spell::EffectSummonChangeItem(uint32 i) return; } } - else if( player->IsEquipmentPos ( pos ) ) + else if (player->IsEquipmentPos (pos)) { uint16 dest; uint8 msg = player->CanEquipItem( m_CastItem->GetSlot(), dest, pNewItem, true ); - if( msg == EQUIP_ERR_OK ) + if (msg == EQUIP_ERR_OK) { player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(), true); // prevent crash at access and unexpected charges counting with item update queue corrupt - if(m_CastItem==m_targets.getItemTarget()) + if (m_CastItem==m_targets.getItemTarget()) m_targets.setItemTarget(NULL); m_CastItem = NULL; @@ -3233,12 +3238,12 @@ void Spell::EffectProficiency(uint32 /*i*/) Player *p_target = (Player*)unitTarget; uint32 subClassMask = m_spellInfo->EquippedItemSubClassMask; - if(m_spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && !(p_target->GetWeaponProficiency() & subClassMask)) + if (m_spellInfo->EquippedItemClass == ITEM_CLASS_WEAPON && !(p_target->GetWeaponProficiency() & subClassMask)) { p_target->AddWeaponProficiency(subClassMask); p_target->SendProficiency(ITEM_CLASS_WEAPON, p_target->GetWeaponProficiency()); } - if(m_spellInfo->EquippedItemClass == ITEM_CLASS_ARMOR && !(p_target->GetArmorProficiency() & subClassMask)) + if (m_spellInfo->EquippedItemClass == ITEM_CLASS_ARMOR && !(p_target->GetArmorProficiency() & subClassMask)) { p_target->AddArmorProficiency(subClassMask); p_target->SendProficiency(ITEM_CLASS_ARMOR, p_target->GetArmorProficiency()); @@ -3247,9 +3252,9 @@ void Spell::EffectProficiency(uint32 /*i*/) void Spell::EffectApplyAreaAura(uint32 i) { - if(!unitTarget) + if (!unitTarget) return; - if(!unitTarget->isAlive()) + if (!unitTarget->isAlive()) return; AreaAura* Aur = new AreaAura(m_spellInfo, i, &m_currentBasePoints[i], unitTarget, m_caster, m_CastItem); @@ -3265,6 +3270,7 @@ void Spell::EffectSummonType(uint32 i) case SUMMON_TYPE_POSESSED2: case SUMMON_TYPE_FORCE_OF_NATURE: case SUMMON_TYPE_GUARDIAN2: + case SUMMON_TYPE_GUARDIAN3: // Jewelery statue case (totem like) if(m_spellInfo->SpellIconID == 2056) EffectSummonTotem(i); @@ -3308,22 +3314,22 @@ void Spell::EffectSummonType(uint32 i) void Spell::EffectSummon(uint32 i) { - if(m_caster->GetPetGUID()) + if (m_caster->GetPetGUID()) return; - if(!unitTarget) + if (!unitTarget) return; uint32 pet_entry = m_spellInfo->EffectMiscValue[i]; - if(!pet_entry) + if (!pet_entry) return; uint32 level = m_caster->getLevel(); Pet* spawnCreature = new Pet(SUMMON_PET); - if(m_caster->GetTypeId()==TYPEID_PLAYER && spawnCreature->LoadPetFromDB((Player*)m_caster,pet_entry)) + if (m_caster->GetTypeId()==TYPEID_PLAYER && spawnCreature->LoadPetFromDB((Player*)m_caster,pet_entry)) { // Summon in dest location float x, y, z; - if(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) + if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) { x = m_targets.m_destX; y = m_targets.m_destY; @@ -3333,7 +3339,7 @@ void Spell::EffectSummon(uint32 i) // set timer for unsummon int32 duration = GetSpellDuration(m_spellInfo); - if(duration > 0) + if (duration > 0) spawnCreature->SetDuration(duration); return; @@ -3341,7 +3347,7 @@ void Spell::EffectSummon(uint32 i) Map *map = m_caster->GetMap(); uint32 pet_number = objmgr.GeneratePetNumber(); - if(!spawnCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_PET), map, m_caster->GetPhaseMask(), + if (!spawnCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_PET), map, m_caster->GetPhaseMask(), m_spellInfo->EffectMiscValue[i], pet_number)) { sLog.outErrorDb("Spell::EffectSummon: no such creature entry %u",m_spellInfo->EffectMiscValue[i]); @@ -3351,7 +3357,7 @@ void Spell::EffectSummon(uint32 i) // Summon in dest location float x, y, z; - if(m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) + if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION) { x = m_targets.m_destX; y = m_targets.m_destY; @@ -3362,7 +3368,7 @@ void Spell::EffectSummon(uint32 i) spawnCreature->Relocate(x, y, z, -m_caster->GetOrientation()); - if(!spawnCreature->IsPositionValid()) + if (!spawnCreature->IsPositionValid()) { sLog.outError("Pet (guidlow %d, entry %d) not summoned. Suggested coordinates isn't valid (X: %f Y: %f)", spawnCreature->GetGUIDLow(), spawnCreature->GetEntry(), spawnCreature->GetPositionX(), spawnCreature->GetPositionY()); @@ -3372,7 +3378,7 @@ void Spell::EffectSummon(uint32 i) // set timer for unsummon int32 duration = GetSpellDuration(m_spellInfo); - if(duration > 0) + if (duration > 0) spawnCreature->SetDuration(duration); spawnCreature->SetOwnerGUID(m_caster->GetGUID()); @@ -3406,7 +3412,7 @@ void Spell::EffectSummon(uint32 i) m_caster->SetPet(spawnCreature); - if(m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->GetTypeId() == TYPEID_PLAYER) { spawnCreature->GetCharmInfo()->SetReactState( REACT_DEFENSIVE ); spawnCreature->SavePetToDB(PET_SAVE_AS_CURRENT); @@ -3416,12 +3422,12 @@ void Spell::EffectSummon(uint32 i) void Spell::EffectLearnSpell(uint32 i) { - if(!unitTarget) + if (!unitTarget) return; - if(unitTarget->GetTypeId() != TYPEID_PLAYER) + if (unitTarget->GetTypeId() != TYPEID_PLAYER) { - if(m_caster->GetTypeId() == TYPEID_PLAYER) + if (m_caster->GetTypeId() == TYPEID_PLAYER) EffectLearnPetSpell(i); return; @@ -3437,7 +3443,7 @@ void Spell::EffectLearnSpell(uint32 i) void Spell::EffectDispel(uint32 i) { - if(!unitTarget) + if (!unitTarget) return; // Fill possible dispell list @@ -3462,7 +3468,7 @@ void Spell::EffectDispel(uint32 i) // do not remove positive auras if friendly target // negative auras if non-friendly target - if(positive == unitTarget->IsFriendlyTo(m_caster)) + if (positive == unitTarget->IsFriendlyTo(m_caster)) continue; } // Add aura to dispel list @@ -3594,15 +3600,15 @@ void Spell::EffectDistract(uint32 /*i*/) void Spell::EffectPickPocket(uint32 /*i*/) { - if( m_caster->GetTypeId() != TYPEID_PLAYER ) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; // victim must be creature and attackable - if( !unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT || m_caster->IsFriendlyTo(unitTarget) ) + if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT || m_caster->IsFriendlyTo(unitTarget)) return; // victim have to be alive and humanoid or undead - if( unitTarget->isAlive() && (unitTarget->GetCreatureTypeMask() &CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) != 0) + if (unitTarget->isAlive() && (unitTarget->GetCreatureTypeMask() & CREATURE_TYPEMASK_HUMANOID_OR_UNDEAD) != 0) { int32 chance = 10 + int32(m_caster->getLevel()) - int32(unitTarget->getLevel()); @@ -3624,10 +3630,14 @@ void Spell::EffectPickPocket(uint32 /*i*/) void Spell::EffectAddFarsight(uint32 i) { - float radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); + if(m_caster->GetTypeId() != TYPEID_PLAYER) + return; + int32 duration = GetSpellDuration(m_spellInfo); DynamicObject* dynObj = new DynamicObject; - if(!dynObj->Create(objmgr.GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo->Id, i, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, duration, radius)) + + // set radius to 0: spell not expected to work as persistent aura + if(!dynObj->Create(objmgr.GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo->Id, i, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, duration, 0)) { delete dynObj; return; @@ -3636,26 +3646,25 @@ void Spell::EffectAddFarsight(uint32 i) dynObj->SetUInt32Value(DYNAMICOBJECT_BYTES, 0x80000002); m_caster->AddDynObject(dynObj); m_caster->GetMap()->Add(dynObj); - if(m_caster->GetTypeId() == TYPEID_PLAYER) - ((Player*)m_caster)->SetFarSightGUID(dynObj->GetGUID()); + ((Player*)m_caster)->SetFarSightGUID(dynObj->GetGUID()); } void Spell::EffectSummonWild(uint32 i) { uint32 creature_entry = m_spellInfo->EffectMiscValue[i]; - if(!creature_entry) + if (!creature_entry) return; uint32 level = m_caster->getLevel(); // level of creature summoned using engineering item based at engineering skill level - if(m_caster->GetTypeId()==TYPEID_PLAYER && m_CastItem) + if (m_caster->GetTypeId()==TYPEID_PLAYER && m_CastItem) { ItemPrototype const *proto = m_CastItem->GetProto(); - if(proto && proto->RequiredSkill == SKILL_ENGINERING) + if (proto && proto->RequiredSkill == SKILL_ENGINERING) { uint16 skill202 = ((Player*)m_caster)->GetSkillValue(SKILL_ENGINERING); - if(skill202) + if (skill202) { level = skill202/5; } @@ -3703,7 +3712,7 @@ void Spell::EffectSummonWild(uint32 i) void Spell::EffectSummonGuardian(uint32 i) { uint32 pet_entry = m_spellInfo->EffectMiscValue[i]; - if(!pet_entry) + if (!pet_entry) return; // set timer for unsummon @@ -3712,7 +3721,7 @@ void Spell::EffectSummonGuardian(uint32 i) // Search old Guardian only for players (if casted spell not have duration or cooldown) // FIXME: some guardians have control spell applied and controlled by player and anyway player can't summon in this time // so this code hack in fact - if( m_caster->GetTypeId() == TYPEID_PLAYER && (duration <= 0 || GetSpellRecoveryTime(m_spellInfo) == 0) ) + if (m_caster->GetTypeId() == TYPEID_PLAYER && (duration <= 0 || GetSpellRecoveryTime(m_spellInfo) == 0)) if(m_caster->FindGuardianWithEntry(pet_entry)) return; // find old guardian, ignore summon @@ -3720,13 +3729,13 @@ void Spell::EffectSummonGuardian(uint32 i) uint32 level = m_caster->getLevel(); // level of pet summoned using engineering item based at engineering skill level - if(m_caster->GetTypeId() == TYPEID_PLAYER && m_CastItem) + if (m_caster->GetTypeId() == TYPEID_PLAYER && m_CastItem) { ItemPrototype const *proto = m_CastItem->GetProto(); - if(proto && proto->RequiredSkill == SKILL_ENGINERING) + if (proto && proto->RequiredSkill == SKILL_ENGINERING) { uint16 skill202 = ((Player*)m_caster)->GetSkillValue(SKILL_ENGINERING); - if(skill202) + if (skill202) { level = skill202 / 5; } @@ -3748,7 +3757,7 @@ void Spell::EffectSummonGuardian(uint32 i) Map *map = m_caster->GetMap(); uint32 pet_number = objmgr.GeneratePetNumber(); - if(!spawnCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_PET), map,m_caster->GetPhaseMask(), + if (!spawnCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_PET), map,m_caster->GetPhaseMask(), m_spellInfo->EffectMiscValue[i], pet_number)) { sLog.outError("no such creature entry %u", m_spellInfo->EffectMiscValue[i]); @@ -3777,7 +3786,7 @@ void Spell::EffectSummonGuardian(uint32 i) spawnCreature->Relocate(px, py, pz, m_caster->GetOrientation()); - if(!spawnCreature->IsPositionValid()) + if (!spawnCreature->IsPositionValid()) { sLog.outError("Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %f Y: %f)", spawnCreature->GetGUIDLow(), spawnCreature->GetEntry(), spawnCreature->GetPositionX(), spawnCreature->GetPositionY()); @@ -3785,7 +3794,7 @@ void Spell::EffectSummonGuardian(uint32 i) return; } - if(duration > 0) + if (duration > 0) spawnCreature->SetDuration(duration); spawnCreature->SetOwnerGUID(m_caster->GetGUID()); @@ -3811,10 +3820,10 @@ void Spell::EffectSummonGuardian(uint32 i) void Spell::EffectTeleUnitsFaceCaster(uint32 i) { - if(!unitTarget) + if (!unitTarget) return; - if(unitTarget->isInFlight()) + if (unitTarget->isInFlight()) return; float dis = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); @@ -3827,10 +3836,10 @@ void Spell::EffectTeleUnitsFaceCaster(uint32 i) void Spell::EffectLearnSkill(uint32 i) { - if(unitTarget->GetTypeId() != TYPEID_PLAYER) + if (unitTarget->GetTypeId() != TYPEID_PLAYER) return; - if(damage < 0) + if (damage < 0) return; uint32 skillid = m_spellInfo->EffectMiscValue[i]; @@ -3840,11 +3849,11 @@ void Spell::EffectLearnSkill(uint32 i) void Spell::EffectAddHonor(uint32 /*i*/) { - if(unitTarget->GetTypeId() != TYPEID_PLAYER) + if (unitTarget->GetTypeId() != TYPEID_PLAYER) return; // not scale value for item based reward (/10 value expected) - if(m_CastItem) + if (m_CastItem) { ((Player*)unitTarget)->RewardHonor(NULL, 1, damage / 10); sLog.outError("SpellEffect::AddHonor (spell_id %u) rewards %d honor points (item %u) for player: %u", m_spellInfo->Id, damage/10, m_CastItem->GetEntry(),((Player*)unitTarget)->GetGUIDLow()); @@ -3852,7 +3861,7 @@ void Spell::EffectAddHonor(uint32 /*i*/) } // do not allow to add too many honor for player (50 * 21) = 1040 at level 70, or (50 * 31) = 1550 at level 80 - if( damage <= 50) + if (damage <= 50) { uint32 honor_reward = MaNGOS::Honor::hk_honor_at_level(unitTarget->getLevel(), damage); ((Player*)unitTarget)->RewardHonor(NULL, 1, honor_reward); @@ -3868,7 +3877,7 @@ void Spell::EffectAddHonor(uint32 /*i*/) void Spell::EffectTradeSkill(uint32 /*i*/) { - if(unitTarget->GetTypeId() != TYPEID_PLAYER) + if (unitTarget->GetTypeId() != TYPEID_PLAYER) return; // uint32 skillid = m_spellInfo->EffectMiscValue[i]; // uint16 skillmax = ((Player*)unitTarget)->(skillid); @@ -3877,7 +3886,7 @@ void Spell::EffectTradeSkill(uint32 /*i*/) void Spell::EffectEnchantItemPerm(uint32 effect_idx) { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; if (!itemTarget) return; @@ -3892,15 +3901,15 @@ void Spell::EffectEnchantItemPerm(uint32 effect_idx) return; SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); - if(!pEnchant) + if (!pEnchant) return; // item can be in trade slot and have owner diff. from caster Player* item_owner = itemTarget->GetOwner(); - if(!item_owner) + if (!item_owner) return; - if(item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) ) + if (item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(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(), @@ -3919,7 +3928,7 @@ void Spell::EffectEnchantItemPerm(uint32 effect_idx) void Spell::EffectEnchantItemPrismatic(uint32 effect_idx) { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; if (!itemTarget) return; @@ -3931,7 +3940,7 @@ void Spell::EffectEnchantItemPrismatic(uint32 effect_idx) return; SpellItemEnchantmentEntry const *pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); - if(!pEnchant) + if (!pEnchant) return; // support only enchantings with add socket in this slot @@ -3939,13 +3948,13 @@ void Spell::EffectEnchantItemPrismatic(uint32 effect_idx) bool add_socket = false; for(int i = 0; i < 3; ++i) { - if(pEnchant->type[i]==ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET) + if (pEnchant->type[i]==ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET) { add_socket = true; break; } } - if(!add_socket) + if (!add_socket) { sLog.outError("Spell::EffectEnchantItemPrismatic: attempt apply enchant spell %u with SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC (%u) but without ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET (%u), not suppoted yet.", m_spellInfo->Id,SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC,ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET); @@ -3955,10 +3964,10 @@ void Spell::EffectEnchantItemPrismatic(uint32 effect_idx) // item can be in trade slot and have owner diff. from caster Player* item_owner = itemTarget->GetOwner(); - if(!item_owner) + if (!item_owner) return; - if(item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(CONFIG_GM_LOG_TRADE) ) + if (item_owner!=p_caster && p_caster->GetSession()->GetSecurity() > SEC_PLAYER && sWorld.getConfig(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(), @@ -3977,18 +3986,18 @@ void Spell::EffectEnchantItemPrismatic(uint32 effect_idx) void Spell::EffectEnchantItemTmp(uint32 i) { - if(m_caster->GetTypeId() != TYPEID_PLAYER) + if (m_caster->GetTypeId() != TYPEID_PLAYER) return; Player* p_caster = (Player*)m_caster; - if(!itemTarget) + if (!itemTarget) return; uint32 enchant_id = m_spellInfo->EffectMiscValue[i]; // Shaman Rockbiter Weapon - if(i==0 && m_spellInfo->Effect[1]==SPELL_EFFECT_DUMMY) + if (i==0 && m_spellInfo->Effect[1]==SPELL_EFFECT_DUMMY) { int32 enchnting_damage = m_currentBasePoints[1]+1; @@ -4913,11 +4922,26 @@ void Spell::EffectScriptEffect(uint32 effIndex) unitTarget->HandleEmoteCommand(EMOTE_STATE_DANCE); return; } + // Demonic Empowerment (succubus Vanish effect) + case 54436: + { + if(!unitTarget) + return; + + unitTarget->RemoveSpellsCausingAura(SPELL_AURA_MOD_ROOT); + unitTarget->RemoveSpellsCausingAura(SPELL_AURA_MOD_DECREASE_SPEED); + unitTarget->RemoveSpellsCausingAura(SPELL_AURA_MOD_STALKED); + unitTarget->RemoveSpellsCausingAura(SPELL_AURA_MOD_STUN); + return; + } // Escape artist case 20589: { - m_caster->RemoveSpellsCausingAura(SPELL_AURA_MOD_ROOT); - m_caster->RemoveSpellsCausingAura(SPELL_AURA_MOD_DECREASE_SPEED); + if(!unitTarget) + return; + + unitTarget->RemoveSpellsCausingAura(SPELL_AURA_MOD_ROOT); + unitTarget->RemoveSpellsCausingAura(SPELL_AURA_MOD_DECREASE_SPEED); return; } // Mirren's Drinking Hat @@ -4943,6 +4967,8 @@ void Spell::EffectScriptEffect(uint32 effIndex) // Improved Sprint case 30918: { + if(!unitTarget) + return; // Removes snares and roots. uint32 mechanic_mask = (1<GetAuras(); @@ -5111,6 +5137,8 @@ void Spell::EffectScriptEffect(uint32 effIndex) case 47871: case 47878: { + if(!unitTarget) + return; uint32 itemtype; uint32 rank = 0; Unit::AuraList const& mDummyAuras = unitTarget->GetAurasByType(SPELL_AURA_DUMMY); @@ -5163,6 +5191,26 @@ void Spell::EffectScriptEffect(uint32 effIndex) DoCreateItem( effIndex, itemtype ); return; } + // Demonic Empowerment + case 47193: + { + if(!unitTarget) + return; + uint32 entry = unitTarget->GetEntry(); + uint32 spellID; + switch(entry) + { + case 416: spellID = 54444; break; //imp + case 417: spellID = 54509; break; //fellhunter + case 1860: spellID = 54443; break; //void + case 1863: spellID = 54435; break; //succubus + case 17252: spellID = 54508; break; //fellguard + default: + return; + } + unitTarget->CastSpell(unitTarget,spellID,true); + return; + } // Everlasting Affliction case 47422: { @@ -5217,6 +5265,8 @@ void Spell::EffectScriptEffect(uint32 effIndex) // Chimera Shot case 53209: { + if(!unitTarget) + return; uint32 spellId = 0; int32 basePoint = 0; Unit* target = unitTarget; diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp index fc6d8bbf5..85e5389c0 100644 --- a/src/game/SpellMgr.cpp +++ b/src/game/SpellMgr.cpp @@ -277,36 +277,53 @@ SpellSpecific GetSpellSpecific(uint32 spellId) // target not allow have more one spell specific from same caster -bool IsSingleFromSpellSpecificPerCaster(SpellSpecific spellSpec1,SpellSpecific spellSpec2) +bool IsSingleFromSpellSpecificPerTargetPerCaster(SpellSpecific spellSpec1,SpellSpecific spellSpec2) { switch(spellSpec1) { - case SPELL_SEAL: case SPELL_BLESSING: case SPELL_AURA: case SPELL_STING: case SPELL_CURSE: + case SPELL_POSITIVE_SHOUT: + case SPELL_JUDGEMENT: + case SPELL_HAND: + return spellSpec1==spellSpec2; + default: + return false; + } +} + +// target not allow have more one ranks from spell from spell specific per target +bool IsSingleFromSpellSpecificSpellRanksPerTarget(SpellSpecific spellSpec1,SpellSpecific spellSpec2) +{ + switch(spellSpec1) + { + case SPELL_BLESSING: + case SPELL_AURA: + case SPELL_CURSE: + case SPELL_HAND: + return spellSpec1==spellSpec2; + default: + return false; + } +} + +// target not allow have more one spell specific per target from any caster +bool IsSingleFromSpellSpecificPerTarget(SpellSpecific spellSpec1,SpellSpecific spellSpec2) +{ + switch(spellSpec1) + { + case SPELL_SEAL: case SPELL_ASPECT: case SPELL_TRACKER: case SPELL_WARLOCK_ARMOR: case SPELL_MAGE_ARMOR: + case SPELL_ELEMENTAL_SHIELD: case SPELL_MAGE_POLYMORPH: - case SPELL_POSITIVE_SHOUT: - case SPELL_JUDGEMENT: case SPELL_PRESENCE: - case SPELL_HAND: case SPELL_WELL_FED: return spellSpec1==spellSpec2; - case SPELL_FOOD: - return spellSpec2==SPELL_FOOD - || spellSpec2==SPELL_FOOD_AND_DRINK; - case SPELL_DRINK: - return spellSpec2==SPELL_DRINK - || spellSpec2==SPELL_FOOD_AND_DRINK; - case SPELL_FOOD_AND_DRINK: - return spellSpec2==SPELL_FOOD - || spellSpec2==SPELL_DRINK - || spellSpec2==SPELL_FOOD_AND_DRINK; case SPELL_BATTLE_ELIXIR: return spellSpec2==SPELL_BATTLE_ELIXIR || spellSpec2==SPELL_FLASK_ELIXIR; @@ -317,22 +334,16 @@ bool IsSingleFromSpellSpecificPerCaster(SpellSpecific spellSpec1,SpellSpecific s return spellSpec2==SPELL_BATTLE_ELIXIR || spellSpec2==SPELL_GUARDIAN_ELIXIR || spellSpec2==SPELL_FLASK_ELIXIR; - default: - return false; - } -} - -// target not allow have more one ranks from spell from spell specific per target -bool IsSingleFromSpellSpecificRanksPerTarget(SpellSpecific spellId_spec, SpellSpecific i_spellId_spec) -{ - switch(spellId_spec) - { - case SPELL_BLESSING: - case SPELL_AURA: - case SPELL_CURSE: - case SPELL_HAND: - case SPELL_ELEMENTAL_SHIELD: - return spellId_spec==i_spellId_spec; + case SPELL_FOOD: + return spellSpec2==SPELL_FOOD + || spellSpec2==SPELL_FOOD_AND_DRINK; + case SPELL_DRINK: + return spellSpec2==SPELL_DRINK + || spellSpec2==SPELL_FOOD_AND_DRINK; + case SPELL_FOOD_AND_DRINK: + return spellSpec2==SPELL_FOOD + || spellSpec2==SPELL_DRINK + || spellSpec2==SPELL_FOOD_AND_DRINK; default: return false; } diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index a5760ea8a..a43e51437 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -180,8 +180,12 @@ inline bool IsLootCraftingSpell(SpellEntry const *spellInfo) } int32 CompareAuraRanks(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2); -bool IsSingleFromSpellSpecificPerCaster(SpellSpecific spellSpec1,SpellSpecific spellSpec2); -bool IsSingleFromSpellSpecificRanksPerTarget(SpellSpecific spellId_spec, SpellSpecific i_spellId_spec); + +// order from less to more strict +bool IsSingleFromSpellSpecificPerTargetPerCaster(SpellSpecific spellSpec1,SpellSpecific spellSpec2); +bool IsSingleFromSpellSpecificSpellRanksPerTarget(SpellSpecific spellSpec1,SpellSpecific spellSpec2); +bool IsSingleFromSpellSpecificPerTarget(SpellSpecific spellSpec1,SpellSpecific spellSpec2); + bool IsPassiveSpell(uint32 spellId); inline bool IsPassiveSpellStackableWithRanks(SpellEntry const* spellProto) diff --git a/src/game/TotemAI.cpp b/src/game/TotemAI.cpp index 6b1344140..b826bef03 100644 --- a/src/game/TotemAI.cpp +++ b/src/game/TotemAI.cpp @@ -76,7 +76,7 @@ TotemAI::UpdateAI(const uint32 /*diff*/) // Search victim if no, not attackable, or out of range, or friendly (possible in case duel end) if( !victim || !victim->isTargetableForAttack() || !m_creature->IsWithinDistInMap(victim, max_range) || - m_creature->IsFriendlyTo(victim) || !victim->isVisibleForOrDetect(m_creature,false) ) + m_creature->IsFriendlyTo(victim) || !victim->isVisibleForOrDetect(m_creature,m_creature,false) ) { CellPair p(MaNGOS::ComputeCellPair(m_creature->GetPositionX(),m_creature->GetPositionY())); Cell cell(p); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index aa2ee8a85..802c949f1 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -3193,21 +3193,11 @@ Spell* Unit::FindCurrentSpellBySpellId(uint32 spell_id) const return NULL; } -bool Unit::isInFrontInMap(Unit const* target, float distance, float arc) const -{ - return IsWithinDistInMap(target, distance) && HasInArc( arc, target ); -} - void Unit::SetInFront(Unit const* target) { SetOrientation(GetAngle(target)); } -bool Unit::isInBackInMap(Unit const* target, float distance, float arc) const -{ - return IsWithinDistInMap(target, distance) && !HasInArc( 2 * M_PI - arc, target ); -} - bool Unit::isInAccessablePlaceFor(Creature const* c) const { if(IsInWater()) @@ -3631,9 +3621,10 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) SpellSpecific i_spellId_spec = GetSpellSpecific(i_spellId); - // single allowed spell specific from same caster - bool is_sspc = IsSingleFromSpellSpecificPerCaster(spellId_spec,i_spellId_spec); - if( is_sspc && Aur->GetCasterGUID() == (*i).second->GetCasterGUID() ) + // single allowed spell specific from same caster or from any caster at target + bool is_spellSpecPerTargetPerCaster = IsSingleFromSpellSpecificPerTargetPerCaster(spellId_spec,i_spellId_spec); + bool is_spellSpecPerTarget = IsSingleFromSpellSpecificPerTarget(spellId_spec,i_spellId_spec); + if( is_spellSpecPerTarget || is_spellSpecPerTargetPerCaster && Aur->GetCasterGUID() == (*i).second->GetCasterGUID() ) { // cannot remove higher rank if (spellmgr.IsRankSpellDueToSpell(spellProto, i_spellId)) @@ -3658,9 +3649,8 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) // spell with spell specific that allow single ranks for spell from diff caster // same caster case processed or early or later - bool is_sspt = IsSingleFromSpellSpecificRanksPerTarget(spellId_spec,i_spellId_spec); - if ( is_sspt && Aur->GetCasterGUID() != (*i).second->GetCasterGUID() && - (spellProto->Id == i_spellId || spellmgr.IsRankSpellDueToSpell(spellProto, i_spellId))) + bool is_spellPerTarget = IsSingleFromSpellSpecificSpellRanksPerTarget(spellId_spec,i_spellId_spec); + if ( is_spellPerTarget && Aur->GetCasterGUID() != (*i).second->GetCasterGUID() && spellmgr.IsRankSpellDueToSpell(spellProto, i_spellId)) { // cannot remove higher rank if(CompareAuraRanks(spellId, effIndex, i_spellId, i_effIndex) < 0) @@ -3682,8 +3672,8 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur) continue; } - // non single per caster spell specific (possible single per target spells at caster) - if( !is_sspc && spellmgr.IsNoStackSpellDueToSpell(spellId, i_spellId) ) + // non single (per caster) per target spell specific (possible single spell per target at caster) + if( !is_spellSpecPerTargetPerCaster && !is_spellSpecPerTarget && spellmgr.IsNoStackSpellDueToSpell(spellId, i_spellId) ) { // Its a parent aura (create this aura in ApplyModifier) if ((*i).second->IsInUse()) @@ -9272,7 +9262,7 @@ int32 Unit::ModifyPower(Powers power, int32 dVal) return gain; } -bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList, bool is3dDistance) const +bool Unit::isVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, bool detect, bool inVisibleList, bool is3dDistance) const { if(!u) return false; @@ -9319,16 +9309,20 @@ bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList, if(GetCharmerOrOwnerGUID()==u->GetGUID()) return true; + // always seen by far sight caster + if( u->GetTypeId()==TYPEID_PLAYER && ((Player*)u)->GetFarSight()==GetGUID()) + return true; + // different visible distance checks if(u->isInFlight()) // what see player in flight { // use object grey distance for all (only see objects any way) - if (!IsWithinDistInMap(u,World::GetMaxVisibleDistanceInFlight()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance)) + if (!IsWithinDistInMap(viewPoint,World::GetMaxVisibleDistanceInFlight()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance)) return false; } else if(!isAlive()) // distance for show body { - if (!IsWithinDistInMap(u,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance)) + if (!IsWithinDistInMap(viewPoint,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), is3dDistance)) return false; } else if(GetTypeId()==TYPEID_PLAYER) // distance for show player @@ -9336,26 +9330,26 @@ bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList, if(u->GetTypeId()==TYPEID_PLAYER) { // Players far than max visible distance for player or not in our map are not visible too - if (!at_same_transport && !IsWithinDistInMap(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance)) + if (!at_same_transport && !IsWithinDistInMap(viewPoint,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance)) return false; } else { // Units far than max visible distance for creature or not in our map are not visible too - if (!IsWithinDistInMap(u,World::GetMaxVisibleDistanceForCreature()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance)) + if (!IsWithinDistInMap(viewPoint,World::GetMaxVisibleDistanceForCreature()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance)) return false; } } else if(GetCharmerOrOwnerGUID()) // distance for show pet/charmed { // Pet/charmed far than max visible distance for player or not in our map are not visible too - if (!IsWithinDistInMap(u,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance)) + if (!IsWithinDistInMap(viewPoint,World::GetMaxVisibleDistanceForPlayer()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance)) return false; } else // distance for show creature { // Units far than max visible distance for creature or not in our map are not visible too - if (!IsWithinDistInMap(u,World::GetMaxVisibleDistanceForCreature()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance)) + if (!IsWithinDistInMap(viewPoint,World::GetMaxVisibleDistanceForCreature()+(inVisibleList ? World::GetVisibleUnitGreyDistance() : 0.0f), is3dDistance)) return false; } @@ -9463,7 +9457,7 @@ bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList, float visibleDistance = (u->GetTypeId() == TYPEID_PLAYER) ? MAX_PLAYER_STEALTH_DETECT_RANGE : ((Creature const*)u)->GetAttackDistance(this); //Always invisible from back (when stealth detection is on), also filter max distance cases - bool isInFront = u->isInFrontInMap(this, visibleDistance); + bool isInFront = viewPoint->isInFrontInMap(this, visibleDistance); if(!isInFront) return false; @@ -9490,13 +9484,13 @@ bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList, visibleDistance = visibleDistance > MAX_PLAYER_STEALTH_DETECT_RANGE ? MAX_PLAYER_STEALTH_DETECT_RANGE : visibleDistance; // recheck new distance - if(visibleDistance <= 0 || !IsWithinDist(u,visibleDistance)) + if(visibleDistance <= 0 || !IsWithinDist(viewPoint,visibleDistance)) return false; } // Now check is target visible with LoS float ox,oy,oz; - u->GetPosition(ox,oy,oz); + viewPoint->GetPosition(ox,oy,oz); return IsWithinLOS(ox,oy,oz); } @@ -10203,9 +10197,9 @@ Unit* Unit::GetUnit(WorldObject& object, uint64 guid) return ObjectAccessor::GetUnit(object,guid); } -bool Unit::isVisibleForInState( Player const* u, bool inVisibleList ) const +bool Unit::isVisibleForInState( Player const* u, WorldObject const* viewPoint, bool inVisibleList ) const { - return isVisibleForOrDetect(u, false, inVisibleList, false); + return isVisibleForOrDetect(u, viewPoint, false, inVisibleList, false); } uint32 Unit::GetCreatureType() const diff --git a/src/game/Unit.h b/src/game/Unit.h index cbd827e97..30875044d 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -1310,21 +1310,19 @@ class MANGOS_DLL_SPEC Unit : public WorldObject float GetWeaponDamageRange(WeaponAttackType attType ,WeaponDamageRange type) const; void SetBaseWeaponDamage(WeaponAttackType attType ,WeaponDamageRange damageRange, float value) { m_weaponDamage[attType][damageRange] = value; } - bool isInFrontInMap(Unit const* target,float distance, float arc = M_PI) const; void SetInFront(Unit const* target); - bool isInBackInMap(Unit const* target, float distance, float arc = M_PI) const; // Visibility system UnitVisibility GetVisibility() const { return m_Visibility; } void SetVisibility(UnitVisibility x); // common function for visibility checks for player/creatures with detection code - bool isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList = false, bool is3dDistance = true) const; + bool isVisibleForOrDetect(Unit const* u, WorldObject const* viewPoint, bool detect, bool inVisibleList = false, bool is3dDistance = true) const; bool canDetectInvisibilityOf(Unit const* u) const; void SetPhaseMask(uint32 newPhaseMask, bool update);// overwrite WorldObject::SetPhaseMask // virtual functions for all world objects types - bool isVisibleForInState(Player const* u, bool inVisibleList) const; + bool isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const; // function for low level grid visibility checks in player/creature cases virtual bool IsVisibleInGridForPlayer(Player* pl) const = 0; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 34ff53d61..f34136be4 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "8411" + #define REVISION_NR "8423" #endif // __REVISION_NR_H__