diff options
-rw-r--r-- | sql/updates/world/2014_05_04_01_world_sai.sql | 32 | ||||
-rw-r--r-- | sql/updates/world/2014_05_04_03_world_creature_text.sql | 3 | ||||
-rw-r--r-- | sql/updates/world/2014_05_04_04_world_creature.sql | 29 | ||||
-rw-r--r-- | src/server/game/Entities/GameObject/GameObject.cpp | 102 | ||||
-rw-r--r-- | src/server/game/Entities/GameObject/GameObject.h | 2 | ||||
-rw-r--r-- | src/server/game/Spells/Spell.cpp | 39 | ||||
-rw-r--r-- | src/server/scripts/Northrend/Ulduar/Ulduar/boss_algalon_the_observer.cpp | 2 |
7 files changed, 162 insertions, 47 deletions
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'); 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..3741afbb641 --- /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); 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); diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index 27250e6c82a..dd018911a14 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -452,84 +452,85 @@ 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) - { - if (goInfo->trap.cooldown != 3) // cast in other case (at some triggering/linked go/etc explicit call) - return; - else - { - if (m_respawnTime > 0) - break; + // Type 0 despawns after being triggered, type 1 does not. - radius = (float)goInfo->trap.cooldown; // battlegrounds gameobjects has data2 == 0 && data5 == 3 - IsBattlegroundTrap = true; + bool isBattlegroundTrap; - if (!radius) - return; - } + /// @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) + { + // Cast in other case (at some triggering/linked go/etc explicit call) + if (goInfo->trap.cooldown != 3 || m_respawnTime > 0) + break; + + // Battleground gameobjects have data2 == 0 && data5 == 3 + isBattlegroundTrap = true; + radius = 3.f; } + else + { + isBattlegroundTrap = false; + radius = goInfo->trap.diameter / 2.f; + } + + Unit* owner = GetOwner(); + // Pointer to appropriate target if found any + Unit* target = NULL; - // Note: this hack with search required until GO casting not implemented - // search unfriendly creature - if (owner) // hunter trap + /// @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<Trinity::AnyUnfriendlyNoTotemUnitInObjectRangeCheck> searcher(this, ok, checker); + Trinity::UnitSearcher<Trinity::AnyUnfriendlyNoTotemUnitInObjectRangeCheck> 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<Trinity::AnyPlayerInObjectRangeCheck> 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()) @@ -575,6 +576,17 @@ void GameObject::Update(uint32 diff) } else m_groupLootTimer -= diff; } + break; + 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 dacc44c27ad..7d4e6ed548f 100644 --- a/src/server/game/Entities/GameObject/GameObject.h +++ b/src/server/game/Entities/GameObject/GameObject.h @@ -124,7 +124,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 diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index a9961e06cbc..74b33d9550b 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -6370,6 +6370,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 (uint32(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); 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<WorldObject*>& targets) |