From f16caf49ac0540daf5eb86b17bcd7b1446f77ebd Mon Sep 17 00:00:00 2001 From: Aokromes Date: Sun, 4 May 2014 04:26:35 +0200 Subject: [PATCH 01/11] DB/Quest: Prepping the Speech By untaught, closes #11348 --- sql/updates/world/2014_05_04_01_world_sai.sql | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 sql/updates/world/2014_05_04_01_world_sai.sql diff --git a/sql/updates/world/2014_05_04_01_world_sai.sql b/sql/updates/world/2014_05_04_01_world_sai.sql new file mode 100644 index 00000000000..65602cbbb6e --- /dev/null +++ b/sql/updates/world/2014_05_04_01_world_sai.sql @@ -0,0 +1,32 @@ +-- +DELETE FROM `smart_scripts` WHERE `entryorguid`=39712 AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(39712,0,0,1,38,0,100,0,1,1,0,0,41,1000,0,0,0,0,0,1,0,0,0,0,0,0,0,'High Tinker Mekkatorque - On Data Set 1 1 - Despawn In 1000 ms'), +(39712,0,1,0,61,0,100,0,0,0,0,0,11,74154,0,0,0,0,0,23,0,0,0,0,0,0,0,'High Tinker Mekkatorque - Link With Previous - Cast ''Speech Performed'''), +(39712,0,2,3,38,0,100,0,1,2,0,0,41,1000,0,0,0,0,0,1,0,0,0,0,0,0,0,'High Tinker Mekkatorque - On Data Set 1 2 - Despawn In 1000 ms'), +(39712,0,3,0,61,0,100,0,0,0,0,0,11,74155,0,0,0,0,0,23,0,0,0,0,0,0,0,'High Tinker Mekkatorque - Link With Previous - Cast ''Speech Performed'''), +(39712,0,4,5,38,0,100,0,1,3,0,0,41,1000,0,0,0,0,0,1,0,0,0,0,0,0,0,'High Tinker Mekkatorque - On Data Set 1 3 - Despawn In 1000 ms'), +(39712,0,5,0,61,0,100,0,0,0,0,0,11,74156,0,0,0,0,0,23,0,0,0,0,0,0,0,'High Tinker Mekkatorque - Link With Previous - Cast ''Speech Performed'''); + +DELETE FROM `smart_scripts` WHERE `entryorguid`=1268 AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(1268,0,0,0,8,0,100,0,74222,0,0,0,1,2,2000,0,0,0,0,11,39712,10,0,0,0,0,0,'Ozzie Togglevolt - On Spellhit ''Perform Speech'' - Say Line 2'), +(1268,0,1,0,52,0,100,0,2,39712,0,0,1,3,4000,0,0,0,0,11,39712,10,0,0,0,0,0,'Ozzie Togglevolt - On Text 2 Over - Say Line 3'), +(1268,0,2,0,52,0,100,0,3,39712,0,0,1,4,4000,0,0,0,0,11,39712,10,0,0,0,0,0,'Ozzie Togglevolt - On Text 3 Over - Say Line 4'), +(1268,0,3,4,52,0,100,0,4,39712,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ozzie Togglevolt - On Text 4 Over - Say Line 0'), +(1268,0,4,0,61,0,100,0,0,0,0,0,45,1,1,0,0,0,0,11,39712,10,0,0,0,0,0,'Ozzie Togglevolt - On Text 4 Over - Set Data 1 1'); + +DELETE FROM `smart_scripts` WHERE `entryorguid`=6119 AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(6119,0,0,0,8,0,100,0,74222,0,0,0,1,5,2000,0,0,0,0,11,39712,10,0,0,0,0,0,'Tog Rustsprocket - On Spellhit ''Perform Speech'' - Say Line 5'), +(6119,0,1,0,52,0,100,0,5,39712,0,0,1,6,4000,0,0,0,0,11,39712,10,0,0,0,0,0,'Tog Rustsprocket - On Text 5 Over - Say Line 6'), +(6119,0,2,0,52,0,100,0,6,39712,0,0,1,7,4000,0,0,0,0,11,39712,10,0,0,0,0,0,'Tog Rustsprocket - On Text 6 Over - Say Line 7'), +(6119,0,3,4,52,0,100,0,7,39712,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Tog Rustsprocket - On Text 7 Over - Say Line 0'), +(6119,0,4,0,61,0,100,0,0,0,0,0,45,1,3,0,0,0,0,11,39712,10,0,0,0,0,0,'Tog Rustsprocket - On Text 7 Over - Set Data 1 3'); + +DELETE FROM `smart_scripts` WHERE `entryorguid`=7955 AND `source_type`=0; +INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES +(7955,0,0,0,8,0,100,0,74222,0,0,0,1,0,2000,0,0,0,0,11,39712,10,0,0,0,0,0,'Milli Featherwhistle - On Spellhit ''Perform Speech'' - Say Line 0 (Phase 1) (No Repeat)'), +(7955,0,1,0,52,0,100,0,0,39712,0,0,1,1,4000,0,0,0,0,11,39712,10,0,0,0,0,0,'Milli Featherwhistle - On Text 0 Over - Say Line 1 (Phase 1) (No Repeat)'), +(7955,0,2,3,52,0,100,0,1,39712,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Milli Featherwhistle - On Text 1 Over - Say Line 0'), +(7955,0,3,0,61,0,100,0,0,0,0,0,45,1,2,0,0,0,0,11,39712,10,0,0,0,0,0,'Milli Featherwhistle - On Text 1 Over - Set Data 1 2'); From 49018c4bdbcec5e64413b908ba998bacc2ff708a Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Sun, 4 May 2014 12:10:52 +0200 Subject: [PATCH 02/11] DB/CreatureTexts: Set some creature_text field BroadcastTextId to 0 because change on cata/mop --- .../world/2014_05_04_02_world_creature_text.sql | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 sql/updates/world/2014_05_04_02_world_creature_text.sql diff --git a/sql/updates/world/2014_05_04_02_world_creature_text.sql b/sql/updates/world/2014_05_04_02_world_creature_text.sql new file mode 100644 index 00000000000..d68bdc4ed1c --- /dev/null +++ b/sql/updates/world/2014_05_04_02_world_creature_text.sql @@ -0,0 +1,16 @@ +UPDATE `creature_text` SET `BroadcastTextId`=0 WHERE `entry`=3977 AND `groupid`=1; +UPDATE `creature_text` SET `BroadcastTextId`=0 WHERE `entry`=11380 AND `groupid`=0; +UPDATE `creature_text` SET `BroadcastTextId`=0 WHERE `entry`=23863 AND `groupid`=2; +UPDATE `creature_text` SET `BroadcastTextId`=0 WHERE `entry`=23863 AND `groupid`=3; +UPDATE `creature_text` SET `BroadcastTextId`=0 WHERE `entry`=23863 AND `groupid`=4; +UPDATE `creature_text` SET `BroadcastTextId`=0 WHERE `entry`=23863 AND `groupid`=5; +UPDATE `creature_text` SET `BroadcastTextId`=0 WHERE `entry`=23863 AND `groupid`=6; +UPDATE `creature_text` SET `BroadcastTextId`=0 WHERE `entry`=23863 AND `groupid`=8; +UPDATE `creature_text` SET `BroadcastTextId`=0 WHERE `entry`=23863 AND `groupid`=8; +UPDATE `creature_text` SET `BroadcastTextId`=0 WHERE `entry`=23863 AND `groupid`=9; +UPDATE `creature_text` SET `BroadcastTextId`=0 WHERE `entry`=29 AND `groupid`=1; +UPDATE `creature_text` SET `BroadcastTextId`=0 WHERE `entry`=22515 AND `groupid`=6; +UPDATE `creature_text` SET `BroadcastTextId`=0 WHERE `entry`=22515 AND `groupid`=7; +UPDATE `creature_text` SET `BroadcastTextId`=0 WHERE `entry`=22515 AND `groupid`=8; +UPDATE `creature_text` SET `BroadcastTextId`=0 WHERE `entry`=22515 AND `groupid`=9; +UPDATE `creature_text` SET `BroadcastTextId`=0 WHERE `entry`=22515 AND `groupid`=10; From 3aca9e64b34baee781f402c3f33ad7ee7991c232 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sun, 4 May 2014 13:41:07 +0200 Subject: [PATCH 03/11] Core/Misc: Fix exploit Fix exploit that allowed to learn spells from recipes without consuming them. --- src/server/game/Spells/Spell.cpp | 39 ++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 3a947b1b07f..3282ce880f9 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -6335,6 +6335,45 @@ bool Spell::UpdatePointers() // cast item not found, somehow the item is no longer where we expected if (!m_CastItem) return false; + + // check if the retrieved item can even cast the spell + ItemTemplate const* proto = m_CastItem->GetTemplate(); + bool spellFound = false; + for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) + { + if (proto->Spells[i].SpellId == GetSpellInfo()->Id) + { + spellFound = true; + break; + } + } + + // check enchantment if the spell wasn't found in item proto + if (!spellFound) + { + for (uint8 e_slot = 0; e_slot < MAX_ENCHANTMENT_SLOT; ++e_slot) + { + uint32 enchant_id = m_CastItem->GetEnchantmentId(EnchantmentSlot(e_slot)); + SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); + if (!pEnchant) + continue; + + for (uint8 s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s) + { + if (pEnchant->spellid[s] == GetSpellInfo()->Id) + { + spellFound = true; + break; + } + } + + if (spellFound) + break; + } + } + + if (!spellFound) + return false; } m_targets.Update(m_caster); From 1c0c163485a2ba1781abf5a1f72b168375199d40 Mon Sep 17 00:00:00 2001 From: jackpoz Date: Sun, 4 May 2014 14:03:42 +0200 Subject: [PATCH 04/11] Core/Misc: Fix warning --- src/server/game/Spells/Spell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 3282ce880f9..2dc501d896f 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -6341,7 +6341,7 @@ bool Spell::UpdatePointers() bool spellFound = false; for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i) { - if (proto->Spells[i].SpellId == GetSpellInfo()->Id) + if (uint32(proto->Spells[i].SpellId) == GetSpellInfo()->Id) { spellFound = true; break; From fd7a40ca97ccb642080bfb35edf4ac95e9fdab8e Mon Sep 17 00:00:00 2001 From: Aokromes Date: Sun, 4 May 2014 14:55:06 +0200 Subject: [PATCH 05/11] DB/Creature: Remove more incorrect trigger flags By dr-j, closes #11995 Closes #7744 --- sql/updates/world/2014_05_04_03_world_creature_text.sql | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 sql/updates/world/2014_05_04_03_world_creature_text.sql diff --git a/sql/updates/world/2014_05_04_03_world_creature_text.sql b/sql/updates/world/2014_05_04_03_world_creature_text.sql new file mode 100644 index 00000000000..68375879d8e --- /dev/null +++ b/sql/updates/world/2014_05_04_03_world_creature_text.sql @@ -0,0 +1,3 @@ +-- +UPDATE `creature_template` SET `flags_extra`=0 WHERE `entry`IN(28455,28299,28459,28300,28456,28457,28458,28462,28454,28460,26468,26469,26470,34735); +UPDATE `creature_template` SET `mechanic_immune_mask`=2048 WHERE `entry` IN (29307,29573) From fdbb96d3963a37117653046f875a2cfd718eed38 Mon Sep 17 00:00:00 2001 From: w1sht0l1v3 Date: Sun, 4 May 2014 16:56:53 +0300 Subject: [PATCH 06/11] DB/Creature: Add some missing spawns in HoL. --- .../world/2014_05_04_04_world_creature.sql | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 sql/updates/world/2014_05_04_04_world_creature.sql diff --git a/sql/updates/world/2014_05_04_04_world_creature.sql b/sql/updates/world/2014_05_04_04_world_creature.sql new file mode 100644 index 00000000000..778f1fdb7f2 --- /dev/null +++ b/sql/updates/world/2014_05_04_04_world_creature.sql @@ -0,0 +1,29 @@ +UPDATE `creature_template` SET `faction`=16 WHERE `entry` IN (28825,30965); + +SET @CGUID := 76278; +DELETE FROM `creature` WHERE `guid` BETWEEN @CGUID+0 AND @CGUID+20; +INSERT INTO `creature` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `spawntimesecs`, `spawndist`, `MovementType`) VALUES +-- Storming Vortex +(@CGUID+0, 28547, 602, 3, 1, 1175.453, -260.0605, 52.3494, 3.60509, 7200, 10, 1), +-- Cyclone +(@CGUID+1, 28825, 602, 3, 1, 1176.089, -249.2833, 52.35361, 4.021614, 7200, 0, 0), +(@CGUID+2, 28825, 602, 3, 1, 1166.917, -254.8407, 52.34347, 3.005888, 7200, 0, 0), +(@CGUID+3, 28825, 602, 3, 1, 1185.568, -258.9233, 52.35489, 1.944182, 7200, 0, 0), +(@CGUID+4, 28825, 602, 3, 1, 1166.591, -266.7376, 52.34578, 6.258945, 7200, 0, 0), +(@CGUID+5, 28825, 602, 3, 1, 1183.476, -274.8163, 52.35885, 5.94552, 7200, 0, 0), +(@CGUID+6, 28825, 602, 3, 1, 1173.505, -320.6456, 52.33779, 3.109934, 7200, 0, 0), +(@CGUID+7, 28825, 602, 3, 1, 1180.375, -313.61, 52.33779, 1.67872, 7200, 0, 0), +(@CGUID+8, 28825, 602, 3, 1, 1170.669, -317.3578, 52.33778, 6.266668, 7200, 0, 0), +(@CGUID+9, 28825, 602, 3, 1, 1124.124, -317.3333, 56.87379, 3.969684, 7200, 0, 0), +(@CGUID+10, 28825, 602, 3, 1, 1137.76, -318.5208, 56.99253, 3.95068, 7200, 0, 0), +(@CGUID+11, 28825, 602, 3, 1, 1116.752, -317.0807, 56.87379, 2.218908, 7200, 0, 0), +(@CGUID+12, 28825, 602, 3, 1, 1120.521, -325.4324, 56.8738, 4.654937, 7200, 0, 0), +(@CGUID+13, 28825, 602, 3, 1, 1123.408, -331.2204, 56.87381, 1.389227, 7200, 0, 0), +(@CGUID+14, 28825, 602, 3, 1, 1133.739, -324.2768, 56.8738, 2.719939, 7200, 0, 0), +(@CGUID+15, 28825, 602, 3, 1, 1178.836, -328.0336, 52.33779, 2.54861, 7200, 0, 0), +(@CGUID+16, 28825, 602, 3, 1, 1189.168, -323.8203, 52.33779, 3.040508, 7200, 0, 0), +(@CGUID+17, 28825, 602, 3, 1, 1166.612, -323.9933, 52.77784, 5.973127, 7200, 0, 0), +-- Stormfury Revenant +(@CGUID+18, 28826, 602, 3, 1, 1175.958, -253.4928, 52.35357, 4.728991, 7200, 10, 1), +(@CGUID+19, 28826, 602, 3, 1, 1183.695, -314.559, 52.33779, 2.208076, 7200, 10, 1), +(@CGUID+20, 28826, 602, 3, 1, 1120.32, -317.8011, 56.87379, 3.325409, 7200, 10, 1); From 5dd3fbcb19aac769f7238a12332d7a1427dc6aa0 Mon Sep 17 00:00:00 2001 From: Gacko Date: Sun, 4 May 2014 16:24:33 +0200 Subject: [PATCH 07/11] Fix import --- sql/updates/world/2014_05_04_03_world_creature_text.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/updates/world/2014_05_04_03_world_creature_text.sql b/sql/updates/world/2014_05_04_03_world_creature_text.sql index 68375879d8e..3741afbb641 100644 --- a/sql/updates/world/2014_05_04_03_world_creature_text.sql +++ b/sql/updates/world/2014_05_04_03_world_creature_text.sql @@ -1,3 +1,3 @@ -- UPDATE `creature_template` SET `flags_extra`=0 WHERE `entry`IN(28455,28299,28459,28300,28456,28457,28458,28462,28454,28460,26468,26469,26470,34735); -UPDATE `creature_template` SET `mechanic_immune_mask`=2048 WHERE `entry` IN (29307,29573) +UPDATE `creature_template` SET `mechanic_immune_mask`=2048 WHERE `entry` IN (29307,29573); From 109495ac9b5120f302728887dcca9a4de0f921d9 Mon Sep 17 00:00:00 2001 From: Dehravor Date: Sun, 4 May 2014 20:30:19 +0200 Subject: [PATCH 08/11] Scripts/Ulduar: Fix crash when Algalon's Big Bang is casted by player --- .../Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp index bd446c60c90..67500382758 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp @@ -1196,7 +1196,7 @@ class spell_algalon_big_bang : public SpellScriptLoader bool Load() override { _targetCount = 0; - return true; + return GetCaster()->GetTypeId() == TYPEID_UNIT && GetCaster()->IsAIEnabled; } void CountTargets(std::list& targets) From 24ef7dbdf4b76d312cb1df44958c6ccc79bf75f4 Mon Sep 17 00:00:00 2001 From: Gacko Date: Sun, 4 May 2014 22:15:11 +0200 Subject: [PATCH 09/11] Core/GameObject: Solve some TODOs related to traps in GameObject::Update and improve logic. Some more changes, TODO solutions and a fix for traps like those in #1359 or #6388 will follow. --- .../game/Entities/GameObject/GameObject.cpp | 99 ++++++++++--------- .../game/Entities/GameObject/GameObject.h | 2 +- 2 files changed, 55 insertions(+), 46 deletions(-) diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 77f9ca59db4..a8b63eddb85 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -451,84 +451,83 @@ void GameObject::Update(uint32 diff) if (isSpawned()) { - // traps can have time and can not have GameObjectTemplate const* goInfo = GetGOInfo(); if (goInfo->type == GAMEOBJECT_TYPE_TRAP) { if (m_cooldownTime >= time(NULL)) - return; + break; - // Type 2 - Bomb (will go away after casting it's spell) + // Type 2 (bomb) does not need to be triggered by a unit and despawns after casting its spell. if (goInfo->trap.type == 2) { - if (goInfo->trap.spellId) - CastSpell(NULL, goInfo->trap.spellId); // FIXME: null target won't work for target type 1 - SetLootState(GO_JUST_DEACTIVATED); + SetLootState(GO_ACTIVATED); break; } - // Type 0 and 1 - trap (type 0 will not get removed after casting a spell) - Unit* owner = GetOwner(); - Unit* ok = NULL; // pointer to appropriate target if found any - bool IsBattlegroundTrap = false; - //FIXME: this is activation radius (in different casting radius that must be selected from spell data) - /// @todo move activated state code (cast itself) to GO_ACTIVATED, in this place only check activating and set state - float radius = (float)(goInfo->trap.radius)/3*2; /// @todo rename radius to diameter (goInfo->trap.radius) should be (goInfo->trap.diameter) - if (!radius) + // Type 0 despawns after being triggered, type 1 does not. + + bool isBattlegroundTrap; + + /// @todo This is activation radius. Casting radius must be selected from spell data. + /// @todo Move activated state code to GO_ACTIVATED, in this place just check for activation and set state. + float radius; + if (!goInfo->trap.diameter) { - if (goInfo->trap.cooldown != 3) // cast in other case (at some triggering/linked go/etc explicit call) - return; - else - { - if (m_respawnTime > 0) - break; + // Cast in other case (at some triggering/linked go/etc explicit call) + if (goInfo->trap.cooldown != 3 || m_respawnTime > 0) + break; - radius = (float)goInfo->trap.cooldown; // battlegrounds gameobjects has data2 == 0 && data5 == 3 - IsBattlegroundTrap = true; - - if (!radius) - return; - } + // Battleground gameobjects have data2 == 0 && data5 == 3 + isBattlegroundTrap = true; + radius = 3.f; + } else { + isBattlegroundTrap = false; + radius = goInfo->trap.diameter / 2.f; } - // Note: this hack with search required until GO casting not implemented - // search unfriendly creature - if (owner) // hunter trap + Unit* owner = GetOwner(); + // Pointer to appropriate target if found any + Unit* target = NULL; + + /// @todo this hack with search required until GO casting not implemented + // Hunter trap: Search units which are unfriendly to the trap's owner + if (owner) { Trinity::AnyUnfriendlyNoTotemUnitInObjectRangeCheck checker(this, owner, radius); - Trinity::UnitSearcher searcher(this, ok, checker); + Trinity::UnitSearcher searcher(this, target, checker); VisitNearbyGridObject(radius, searcher); - if (!ok) VisitNearbyWorldObject(radius, searcher); + if (!target) + VisitNearbyWorldObject(radius, searcher); } - else // environmental trap + // Environmental trap: Any target + else { - // environmental damage spells already have around enemies targeting but this not help in case not existed GO casting support - // affect only players + // Environmental damage spells already have around enemies targeting but this does not help in case of not existing GO casting support + // Affect only players Player* player = NULL; Trinity::AnyPlayerInObjectRangeCheck checker(this, radius); Trinity::PlayerSearcher searcher(this, player, checker); VisitNearbyWorldObject(radius, searcher); - ok = player; + target = player; } - if (ok) + if (target) { - // some traps do not have spell but should be triggered + // Some traps do not have a spell but should be triggered if (goInfo->trap.spellId) - CastSpell(ok, goInfo->trap.spellId); + CastSpell(target, goInfo->trap.spellId); - m_cooldownTime = time(NULL) + (goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4)); // template or 4 seconds + // Template value or 4 seconds + m_cooldownTime = time(NULL) + (goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4)); if (goInfo->trap.type == 1) SetLootState(GO_JUST_DEACTIVATED); - if (IsBattlegroundTrap && ok->GetTypeId() == TYPEID_PLAYER) - { - //Battleground gameobjects case - if (ok->ToPlayer()->InBattleground()) - if (Battleground* bg = ok->ToPlayer()->GetBattleground()) + // Battleground gameobjects case + if (isBattlegroundTrap) + if (Player* player = target->ToPlayer()) + if (Battleground* bg = player->GetBattleground()) bg->HandleTriggerBuff(GetGUID()); - } } } else if (uint32 max_charges = goInfo->GetCharges()) @@ -574,6 +573,16 @@ void GameObject::Update(uint32 diff) } else m_groupLootTimer -= diff; } + case GAMEOBJECT_TYPE_TRAP: + { + GameObjectTemplate const* goInfo = GetGOInfo(); + if (goInfo->trap.spellId) + /// @todo NULL target won't work for target type 1 + CastSpell(NULL, goInfo->trap.spellId); + + SetLootState(GO_JUST_DEACTIVATED); + break; + } default: break; } diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index e94bccc4835..511a04bb9af 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -123,7 +123,7 @@ struct GameObjectTemplate { uint32 lockId; //0 -> Lock.dbc uint32 level; //1 - uint32 radius; //2 radius for trap activation + uint32 diameter; //2 radius for trap activation uint32 spellId; //3 uint32 type; //4 0 trap with no despawn after cast. 1 trap despawns after cast. 2 bomb casts on spawn. uint32 cooldown; //5 time in secs From 99e04ddaf6b5c7a6634dcef21417ecf369bac081 Mon Sep 17 00:00:00 2001 From: Gacko Date: Sun, 4 May 2014 22:32:24 +0200 Subject: [PATCH 10/11] Fix indention from changes in previous commit. --- src/server/game/Entities/GameObject/GameObject.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/game/Entities/GameObject/GameObject.h b/src/server/game/Entities/GameObject/GameObject.h index 511a04bb9af..95d8933a1fa 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -123,7 +123,7 @@ struct GameObjectTemplate { uint32 lockId; //0 -> Lock.dbc uint32 level; //1 - uint32 diameter; //2 radius for trap activation + uint32 diameter; //2 radius for trap activation uint32 spellId; //3 uint32 type; //4 0 trap with no despawn after cast. 1 trap despawns after cast. 2 bomb casts on spawn. uint32 cooldown; //5 time in secs From b6bf83589c7000a9d327009a01d9a22ba4bc6df8 Mon Sep 17 00:00:00 2001 From: Vincent-Michael Date: Mon, 5 May 2014 10:06:44 +0200 Subject: [PATCH 11/11] Core/Gameobject: Added missing break in 24ef7dbdf4b76d312cb1df44958c6ccc79bf75f4 --- src/server/game/Entities/GameObject/GameObject.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index a8b63eddb85..98cfb722e50 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -480,7 +480,9 @@ void GameObject::Update(uint32 diff) // Battleground gameobjects have data2 == 0 && data5 == 3 isBattlegroundTrap = true; radius = 3.f; - } else { + } + else + { isBattlegroundTrap = false; radius = goInfo->trap.diameter / 2.f; } @@ -573,6 +575,7 @@ void GameObject::Update(uint32 diff) } else m_groupLootTimer -= diff; } + break; case GAMEOBJECT_TYPE_TRAP: { GameObjectTemplate const* goInfo = GetGOInfo();