From e7861a725910d6a0d8308605a8209eecceaf922d Mon Sep 17 00:00:00 2001 From: balakethelock <111737968+balakethelock@users.noreply.github.com> Date: Fri, 15 Dec 2023 17:49:17 +0100 Subject: [PATCH 1/7] Add target_type for furthest hostile --- src/game/Maps/ScriptCommands.h | 2 ++ src/game/ScriptMgr.cpp | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/game/Maps/ScriptCommands.h b/src/game/Maps/ScriptCommands.h index 820fd62d8d9..fa28d77f26b 100644 --- a/src/game/Maps/ScriptCommands.h +++ b/src/game/Maps/ScriptCommands.h @@ -1200,6 +1200,8 @@ enum ScriptTarget TARGET_T_RANDOM_GAMEOBJECT_WITH_ENTRY = 27, //Searches for random nearby gameobject with the given entry. //Param1 = gameobject_entry //Param2 = search_radius + TARGET_T_HOSTILE_FURTHEST = 28, //Furthest hostile on threat list. + //Param1 = select_flags TARGET_T_END }; diff --git a/src/game/ScriptMgr.cpp b/src/game/ScriptMgr.cpp index f47150ca8f0..7640b5a4773 100644 --- a/src/game/ScriptMgr.cpp +++ b/src/game/ScriptMgr.cpp @@ -1262,6 +1262,7 @@ bool ScriptMgr::CheckScriptTargets(uint32 targetType, uint32 targetParam1, uint3 case TARGET_T_HOSTILE_LAST_AGGRO: case TARGET_T_HOSTILE_RANDOM: case TARGET_T_HOSTILE_RANDOM_NOT_TOP: + case TARGET_T_HOSTILE_FURTHEST: { if (targetParam1& ~MAX_SELECT_FLAG_MASK) { @@ -2955,6 +2956,10 @@ WorldObject* GetTargetByType(WorldObject* pSource, WorldObject* pTarget, Map* pM if (Unit* pUnitSource = ToUnit(pSource)) return pUnitSource->FindNearestFriendlyPlayer(param1); break; + case TARGET_T_HOSTILE_FURTHEST: + if (Creature* pCreatureSource = ToCreature(pSource)) + return pCreatureSource->SelectAttackingTarget(ATTACKING_TARGET_FARTHEST, 0, pSpellEntry, param1 ? param1 : SELECT_FLAG_NO_TOTEM); + break; } return nullptr; } From 50fcaf7d7ecf82579f8a20063859fddebef5414e Mon Sep 17 00:00:00 2001 From: balakethelock <111737968+balakethelock@users.noreply.github.com> Date: Fri, 15 Dec 2023 17:58:44 +0100 Subject: [PATCH 2/7] Venom Stalker and Necro Stalker AI fix Changed spell timers (based on sniffs) and targeting (based on warcraft logs live replay) --- sql/migrations/20231215165730_world.sql | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 sql/migrations/20231215165730_world.sql diff --git a/sql/migrations/20231215165730_world.sql b/sql/migrations/20231215165730_world.sql new file mode 100644 index 00000000000..c537566e88d --- /dev/null +++ b/sql/migrations/20231215165730_world.sql @@ -0,0 +1,23 @@ +DROP PROCEDURE IF EXISTS add_migration; +delimiter ?? +CREATE PROCEDURE `add_migration`() +BEGIN +DECLARE v INT DEFAULT 1; +SET v = (SELECT COUNT(*) FROM `migrations` WHERE `id`='20231215165730'); +IF v=0 THEN +INSERT INTO `migrations` VALUES ('20231215165730'); +-- Add your query below. + +-- Venom Stalker +REPLACE INTO `creature_spells` (`entry`, `name`, `spellId_1`, `probability_1`, `castTarget_1`, `targetParam1_1`, `targetParam2_1`, `castFlags_1`, `delayInitialMin_1`, `delayInitialMax_1`, `delayRepeatMin_1`, `delayRepeatMax_1`, `scriptId_1`, `spellId_2`, `probability_2`, `castTarget_2`, `targetParam1_2`, `targetParam2_2`, `castFlags_2`, `delayInitialMin_2`, `delayInitialMax_2`, `delayRepeatMin_2`, `delayRepeatMax_2`, `scriptId_2`, `spellId_3`, `probability_3`, `castTarget_3`, `targetParam1_3`, `targetParam2_3`, `castFlags_3`, `delayInitialMin_3`, `delayInitialMax_3`, `delayRepeatMin_3`, `delayRepeatMax_3`, `scriptId_3`, `spellId_4`, `probability_4`, `castTarget_4`, `targetParam1_4`, `targetParam2_4`, `castFlags_4`, `delayInitialMin_4`, `delayInitialMax_4`, `delayRepeatMin_4`, `delayRepeatMax_4`, `scriptId_4`, `spellId_5`, `probability_5`, `castTarget_5`, `targetParam1_5`, `targetParam2_5`, `castFlags_5`, `delayInitialMin_5`, `delayInitialMax_5`, `delayRepeatMin_5`, `delayRepeatMax_5`, `scriptId_5`, `spellId_6`, `probability_6`, `castTarget_6`, `targetParam1_6`, `targetParam2_6`, `castFlags_6`, `delayInitialMin_6`, `delayInitialMax_6`, `delayRepeatMin_6`, `delayRepeatMax_6`, `scriptId_6`, `spellId_7`, `probability_7`, `castTarget_7`, `targetParam1_7`, `targetParam2_7`, `castFlags_7`, `delayInitialMin_7`, `delayInitialMax_7`, `delayRepeatMin_7`, `delayRepeatMax_7`, `scriptId_7`, `spellId_8`, `probability_8`, `castTarget_8`, `targetParam1_8`, `targetParam2_8`, `castFlags_8`, `delayInitialMin_8`, `delayInitialMax_8`, `delayRepeatMin_8`, `delayRepeatMax_8`, `scriptId_8`) VALUES (159760, 'Naxxramas - Necro Stalker', 28431, 100, 28, 0, 0, 0, 5, 15, 28, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + +-- Necro Stalker +REPLACE INTO `creature_spells` (`entry`, `name`, `spellId_1`, `probability_1`, `castTarget_1`, `targetParam1_1`, `targetParam2_1`, `castFlags_1`, `delayInitialMin_1`, `delayInitialMax_1`, `delayRepeatMin_1`, `delayRepeatMax_1`, `scriptId_1`, `spellId_2`, `probability_2`, `castTarget_2`, `targetParam1_2`, `targetParam2_2`, `castFlags_2`, `delayInitialMin_2`, `delayInitialMax_2`, `delayRepeatMin_2`, `delayRepeatMax_2`, `scriptId_2`, `spellId_3`, `probability_3`, `castTarget_3`, `targetParam1_3`, `targetParam2_3`, `castFlags_3`, `delayInitialMin_3`, `delayInitialMax_3`, `delayRepeatMin_3`, `delayRepeatMax_3`, `scriptId_3`, `spellId_4`, `probability_4`, `castTarget_4`, `targetParam1_4`, `targetParam2_4`, `castFlags_4`, `delayInitialMin_4`, `delayInitialMax_4`, `delayRepeatMin_4`, `delayRepeatMax_4`, `scriptId_4`, `spellId_5`, `probability_5`, `castTarget_5`, `targetParam1_5`, `targetParam2_5`, `castFlags_5`, `delayInitialMin_5`, `delayInitialMax_5`, `delayRepeatMin_5`, `delayRepeatMax_5`, `scriptId_5`, `spellId_6`, `probability_6`, `castTarget_6`, `targetParam1_6`, `targetParam2_6`, `castFlags_6`, `delayInitialMin_6`, `delayInitialMax_6`, `delayRepeatMin_6`, `delayRepeatMax_6`, `scriptId_6`, `spellId_7`, `probability_7`, `castTarget_7`, `targetParam1_7`, `targetParam2_7`, `castFlags_7`, `delayInitialMin_7`, `delayInitialMax_7`, `delayRepeatMin_7`, `delayRepeatMax_7`, `scriptId_7`, `spellId_8`, `probability_8`, `castTarget_8`, `targetParam1_8`, `targetParam2_8`, `castFlags_8`, `delayInitialMin_8`, `delayInitialMax_8`, `delayRepeatMin_8`, `delayRepeatMax_8`, `scriptId_8`) VALUES (164530, 'Naxxramas - Necro Stalker', 28431, 100, 28, 0, 0, 0, 5, 15, 28, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + + +-- End of migration. +END IF; +END?? +delimiter ; +CALL add_migration(); +DROP PROCEDURE IF EXISTS add_migration; From 88a547cda72fd37d29ba06da889ce687df22c463 Mon Sep 17 00:00:00 2001 From: balakethelock <111737968+balakethelock@users.noreply.github.com> Date: Fri, 15 Dec 2023 18:00:34 +0100 Subject: [PATCH 3/7] Typo in comment mob name typo --- sql/migrations/20231215165730_world.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/migrations/20231215165730_world.sql b/sql/migrations/20231215165730_world.sql index c537566e88d..9c45e48dba8 100644 --- a/sql/migrations/20231215165730_world.sql +++ b/sql/migrations/20231215165730_world.sql @@ -9,7 +9,7 @@ INSERT INTO `migrations` VALUES ('20231215165730'); -- Add your query below. -- Venom Stalker -REPLACE INTO `creature_spells` (`entry`, `name`, `spellId_1`, `probability_1`, `castTarget_1`, `targetParam1_1`, `targetParam2_1`, `castFlags_1`, `delayInitialMin_1`, `delayInitialMax_1`, `delayRepeatMin_1`, `delayRepeatMax_1`, `scriptId_1`, `spellId_2`, `probability_2`, `castTarget_2`, `targetParam1_2`, `targetParam2_2`, `castFlags_2`, `delayInitialMin_2`, `delayInitialMax_2`, `delayRepeatMin_2`, `delayRepeatMax_2`, `scriptId_2`, `spellId_3`, `probability_3`, `castTarget_3`, `targetParam1_3`, `targetParam2_3`, `castFlags_3`, `delayInitialMin_3`, `delayInitialMax_3`, `delayRepeatMin_3`, `delayRepeatMax_3`, `scriptId_3`, `spellId_4`, `probability_4`, `castTarget_4`, `targetParam1_4`, `targetParam2_4`, `castFlags_4`, `delayInitialMin_4`, `delayInitialMax_4`, `delayRepeatMin_4`, `delayRepeatMax_4`, `scriptId_4`, `spellId_5`, `probability_5`, `castTarget_5`, `targetParam1_5`, `targetParam2_5`, `castFlags_5`, `delayInitialMin_5`, `delayInitialMax_5`, `delayRepeatMin_5`, `delayRepeatMax_5`, `scriptId_5`, `spellId_6`, `probability_6`, `castTarget_6`, `targetParam1_6`, `targetParam2_6`, `castFlags_6`, `delayInitialMin_6`, `delayInitialMax_6`, `delayRepeatMin_6`, `delayRepeatMax_6`, `scriptId_6`, `spellId_7`, `probability_7`, `castTarget_7`, `targetParam1_7`, `targetParam2_7`, `castFlags_7`, `delayInitialMin_7`, `delayInitialMax_7`, `delayRepeatMin_7`, `delayRepeatMax_7`, `scriptId_7`, `spellId_8`, `probability_8`, `castTarget_8`, `targetParam1_8`, `targetParam2_8`, `castFlags_8`, `delayInitialMin_8`, `delayInitialMax_8`, `delayRepeatMin_8`, `delayRepeatMax_8`, `scriptId_8`) VALUES (159760, 'Naxxramas - Necro Stalker', 28431, 100, 28, 0, 0, 0, 5, 15, 28, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +REPLACE INTO `creature_spells` (`entry`, `name`, `spellId_1`, `probability_1`, `castTarget_1`, `targetParam1_1`, `targetParam2_1`, `castFlags_1`, `delayInitialMin_1`, `delayInitialMax_1`, `delayRepeatMin_1`, `delayRepeatMax_1`, `scriptId_1`, `spellId_2`, `probability_2`, `castTarget_2`, `targetParam1_2`, `targetParam2_2`, `castFlags_2`, `delayInitialMin_2`, `delayInitialMax_2`, `delayRepeatMin_2`, `delayRepeatMax_2`, `scriptId_2`, `spellId_3`, `probability_3`, `castTarget_3`, `targetParam1_3`, `targetParam2_3`, `castFlags_3`, `delayInitialMin_3`, `delayInitialMax_3`, `delayRepeatMin_3`, `delayRepeatMax_3`, `scriptId_3`, `spellId_4`, `probability_4`, `castTarget_4`, `targetParam1_4`, `targetParam2_4`, `castFlags_4`, `delayInitialMin_4`, `delayInitialMax_4`, `delayRepeatMin_4`, `delayRepeatMax_4`, `scriptId_4`, `spellId_5`, `probability_5`, `castTarget_5`, `targetParam1_5`, `targetParam2_5`, `castFlags_5`, `delayInitialMin_5`, `delayInitialMax_5`, `delayRepeatMin_5`, `delayRepeatMax_5`, `scriptId_5`, `spellId_6`, `probability_6`, `castTarget_6`, `targetParam1_6`, `targetParam2_6`, `castFlags_6`, `delayInitialMin_6`, `delayInitialMax_6`, `delayRepeatMin_6`, `delayRepeatMax_6`, `scriptId_6`, `spellId_7`, `probability_7`, `castTarget_7`, `targetParam1_7`, `targetParam2_7`, `castFlags_7`, `delayInitialMin_7`, `delayInitialMax_7`, `delayRepeatMin_7`, `delayRepeatMax_7`, `scriptId_7`, `spellId_8`, `probability_8`, `castTarget_8`, `targetParam1_8`, `targetParam2_8`, `castFlags_8`, `delayInitialMin_8`, `delayInitialMax_8`, `delayRepeatMin_8`, `delayRepeatMax_8`, `scriptId_8`) VALUES (159760, 'Naxxramas - Venom Stalker', 28431, 100, 28, 0, 0, 0, 5, 15, 28, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); -- Necro Stalker REPLACE INTO `creature_spells` (`entry`, `name`, `spellId_1`, `probability_1`, `castTarget_1`, `targetParam1_1`, `targetParam2_1`, `castFlags_1`, `delayInitialMin_1`, `delayInitialMax_1`, `delayRepeatMin_1`, `delayRepeatMax_1`, `scriptId_1`, `spellId_2`, `probability_2`, `castTarget_2`, `targetParam1_2`, `targetParam2_2`, `castFlags_2`, `delayInitialMin_2`, `delayInitialMax_2`, `delayRepeatMin_2`, `delayRepeatMax_2`, `scriptId_2`, `spellId_3`, `probability_3`, `castTarget_3`, `targetParam1_3`, `targetParam2_3`, `castFlags_3`, `delayInitialMin_3`, `delayInitialMax_3`, `delayRepeatMin_3`, `delayRepeatMax_3`, `scriptId_3`, `spellId_4`, `probability_4`, `castTarget_4`, `targetParam1_4`, `targetParam2_4`, `castFlags_4`, `delayInitialMin_4`, `delayInitialMax_4`, `delayRepeatMin_4`, `delayRepeatMax_4`, `scriptId_4`, `spellId_5`, `probability_5`, `castTarget_5`, `targetParam1_5`, `targetParam2_5`, `castFlags_5`, `delayInitialMin_5`, `delayInitialMax_5`, `delayRepeatMin_5`, `delayRepeatMax_5`, `scriptId_5`, `spellId_6`, `probability_6`, `castTarget_6`, `targetParam1_6`, `targetParam2_6`, `castFlags_6`, `delayInitialMin_6`, `delayInitialMax_6`, `delayRepeatMin_6`, `delayRepeatMax_6`, `scriptId_6`, `spellId_7`, `probability_7`, `castTarget_7`, `targetParam1_7`, `targetParam2_7`, `castFlags_7`, `delayInitialMin_7`, `delayInitialMax_7`, `delayRepeatMin_7`, `delayRepeatMax_7`, `scriptId_7`, `spellId_8`, `probability_8`, `castTarget_8`, `targetParam1_8`, `targetParam2_8`, `castFlags_8`, `delayInitialMin_8`, `delayInitialMax_8`, `delayRepeatMin_8`, `delayRepeatMax_8`, `scriptId_8`) VALUES (164530, 'Naxxramas - Necro Stalker', 28431, 100, 28, 0, 0, 0, 5, 15, 28, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); From e7e3898ed02e576f8ba96e614c3aaa7edcfc2961 Mon Sep 17 00:00:00 2001 From: balakethelock <111737968+balakethelock@users.noreply.github.com> Date: Sat, 16 Dec 2023 09:01:07 +0100 Subject: [PATCH 4/7] Changed name for consistency --- src/game/Maps/ScriptCommands.h | 2 +- src/game/ScriptMgr.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/Maps/ScriptCommands.h b/src/game/Maps/ScriptCommands.h index fa28d77f26b..34cec73a64e 100644 --- a/src/game/Maps/ScriptCommands.h +++ b/src/game/Maps/ScriptCommands.h @@ -1200,7 +1200,7 @@ enum ScriptTarget TARGET_T_RANDOM_GAMEOBJECT_WITH_ENTRY = 27, //Searches for random nearby gameobject with the given entry. //Param1 = gameobject_entry //Param2 = search_radius - TARGET_T_HOSTILE_FURTHEST = 28, //Furthest hostile on threat list. + TARGET_T_HOSTILE_FARTHEST = 28, //Farthest hostile on threat list. //Param1 = select_flags TARGET_T_END }; diff --git a/src/game/ScriptMgr.cpp b/src/game/ScriptMgr.cpp index 7640b5a4773..1325d64ff9d 100644 --- a/src/game/ScriptMgr.cpp +++ b/src/game/ScriptMgr.cpp @@ -1262,7 +1262,7 @@ bool ScriptMgr::CheckScriptTargets(uint32 targetType, uint32 targetParam1, uint3 case TARGET_T_HOSTILE_LAST_AGGRO: case TARGET_T_HOSTILE_RANDOM: case TARGET_T_HOSTILE_RANDOM_NOT_TOP: - case TARGET_T_HOSTILE_FURTHEST: + case TARGET_T_HOSTILE_FARTHEST: { if (targetParam1& ~MAX_SELECT_FLAG_MASK) { @@ -2956,7 +2956,7 @@ WorldObject* GetTargetByType(WorldObject* pSource, WorldObject* pTarget, Map* pM if (Unit* pUnitSource = ToUnit(pSource)) return pUnitSource->FindNearestFriendlyPlayer(param1); break; - case TARGET_T_HOSTILE_FURTHEST: + case TARGET_T_HOSTILE_FARTHEST: if (Creature* pCreatureSource = ToCreature(pSource)) return pCreatureSource->SelectAttackingTarget(ATTACKING_TARGET_FARTHEST, 0, pSpellEntry, param1 ? param1 : SELECT_FLAG_NO_TOTEM); break; From d697d96308b1d2817d24c75573a6e73eaaffaeb2 Mon Sep 17 00:00:00 2001 From: balakethelock <111737968+balakethelock@users.noreply.github.com> Date: Sat, 23 Dec 2023 13:52:38 +0100 Subject: [PATCH 5/7] include SpellEntry in target finding of Cast Spell scripts --- src/game/Maps/Map.cpp | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/game/Maps/Map.cpp b/src/game/Maps/Map.cpp index 54b719fb5f7..ba96e125f9f 100644 --- a/src/game/Maps/Map.cpp +++ b/src/game/Maps/Map.cpp @@ -2531,14 +2531,29 @@ bool Map::FindScriptFinalTargets(WorldObject*& source, WorldObject*& target, Scr // If we have a buddy lets find it. if (script.target_type) { - if (!(target = GetTargetByType(source, target, this, script.target_type, script.target_param1, script.target_param2))) + // Cast Spell scripts include spellinfo in target finding + if ((script.command == SCRIPT_COMMAND_CAST_SPELL)) { - if (!(script.raw.data[4] & SF_GENERAL_SKIP_MISSING_TARGETS)) - sLog.Out(LOG_BASIC, LOG_LVL_ERROR, "FindScriptTargets: Failed to find target for script with id %u (target_param1: %u), (target_param2: %u), (target_type: %u).", script.id, script.target_param1, script.target_param2, script.target_type); - return false; + SpellEntry const* pSpellInfo = sSpellMgr.GetSpellEntry(script.castSpell.spellId); + if (!(target = GetTargetByType(source, target, this, script.target_type, script.target_param1, script.target_param2, pSpellInfo))) + { + if (!(script.raw.data[4] & SF_GENERAL_SKIP_MISSING_TARGETS)) + sLog.Out(LOG_BASIC, LOG_LVL_ERROR, "FindScriptTargets: Failed to find target for Cast Spell script with id %u (spellId: %u), (target_param1: %u), (target_param2: %u), (target_type: %u).", script.castSpell.spellId, script.id, script.target_param1, script.target_param2, script.target_type); + return false; + } + } + else + { + if (!(target = GetTargetByType(source, target, this, script.target_type, script.target_param1, script.target_param2))) + { + if (!(script.raw.data[4] & SF_GENERAL_SKIP_MISSING_TARGETS)) + sLog.Out(LOG_BASIC, LOG_LVL_ERROR, "FindScriptTargets: Failed to find target for script with id %u (target_param1: %u), (target_param2: %u), (target_type: %u).", script.id, script.target_param1, script.target_param2, script.target_type); + return false; + } } } + // we swap target and source again if data_flags & 0x2 // this way we have all possible combinations with 3 targets if (script.raw.data[4] & SF_GENERAL_SWAP_FINAL_TARGETS) From 0ee11ff025c2b7cc0742bcd77d110ee5eca19a51 Mon Sep 17 00:00:00 2001 From: balakethelock <111737968+balakethelock@users.noreply.github.com> Date: Sat, 23 Dec 2023 18:07:12 +0100 Subject: [PATCH 6/7] Minimum charge distance conditional for Venom Stalker & Necro Stalker --- sql/migrations/20231215165730_world.sql | 30 +++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/sql/migrations/20231215165730_world.sql b/sql/migrations/20231215165730_world.sql index 9c45e48dba8..06076bf62f0 100644 --- a/sql/migrations/20231215165730_world.sql +++ b/sql/migrations/20231215165730_world.sql @@ -8,11 +8,33 @@ IF v=0 THEN INSERT INTO `migrations` VALUES ('20231215165730'); -- Add your query below. --- Venom Stalker -REPLACE INTO `creature_spells` (`entry`, `name`, `spellId_1`, `probability_1`, `castTarget_1`, `targetParam1_1`, `targetParam2_1`, `castFlags_1`, `delayInitialMin_1`, `delayInitialMax_1`, `delayRepeatMin_1`, `delayRepeatMax_1`, `scriptId_1`, `spellId_2`, `probability_2`, `castTarget_2`, `targetParam1_2`, `targetParam2_2`, `castFlags_2`, `delayInitialMin_2`, `delayInitialMax_2`, `delayRepeatMin_2`, `delayRepeatMax_2`, `scriptId_2`, `spellId_3`, `probability_3`, `castTarget_3`, `targetParam1_3`, `targetParam2_3`, `castFlags_3`, `delayInitialMin_3`, `delayInitialMax_3`, `delayRepeatMin_3`, `delayRepeatMax_3`, `scriptId_3`, `spellId_4`, `probability_4`, `castTarget_4`, `targetParam1_4`, `targetParam2_4`, `castFlags_4`, `delayInitialMin_4`, `delayInitialMax_4`, `delayRepeatMin_4`, `delayRepeatMax_4`, `scriptId_4`, `spellId_5`, `probability_5`, `castTarget_5`, `targetParam1_5`, `targetParam2_5`, `castFlags_5`, `delayInitialMin_5`, `delayInitialMax_5`, `delayRepeatMin_5`, `delayRepeatMax_5`, `scriptId_5`, `spellId_6`, `probability_6`, `castTarget_6`, `targetParam1_6`, `targetParam2_6`, `castFlags_6`, `delayInitialMin_6`, `delayInitialMax_6`, `delayRepeatMin_6`, `delayRepeatMax_6`, `scriptId_6`, `spellId_7`, `probability_7`, `castTarget_7`, `targetParam1_7`, `targetParam2_7`, `castFlags_7`, `delayInitialMin_7`, `delayInitialMax_7`, `delayRepeatMin_7`, `delayRepeatMax_7`, `scriptId_7`, `spellId_8`, `probability_8`, `castTarget_8`, `targetParam1_8`, `targetParam2_8`, `castFlags_8`, `delayInitialMin_8`, `delayInitialMax_8`, `delayRepeatMin_8`, `delayRepeatMax_8`, `scriptId_8`) VALUES (159760, 'Naxxramas - Venom Stalker', 28431, 100, 28, 0, 0, 0, 5, 15, 28, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); +-- 500: Distance Between Targets Is Equal Or Greater Than 8 Yards +INSERT INTO `conditions` (`condition_entry`, `type`, `value1`, `value2`, `value3`, `value4`, `flags`) VALUES (500, 38, 8, 1, 0, 0, 0); + +-- Removing unused creature spell lists for Venom Stalker +DELETE FROM `creature_spells` WHERE `entry`=159760; +UPDATE `creature_template` SET `spell_list_id`=0 WHERE `entry`=15976; + +-- Events list for Venom Stalker +DELETE FROM `creature_ai_events` WHERE `creature_id`=15976; +INSERT INTO `creature_ai_events` (`id`, `creature_id`, `condition_id`, `event_type`, `event_inverse_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_script`, `action2_script`, `action3_script`, `comment`) VALUES (1597601, 15976, 0, 0, 0, 100, 1, 5000, 15000, 28000, 32000, 1597601, 0, 0, 'Venom Stalker - Cast Poison Charge'); +DELETE FROM `creature_ai_scripts` WHERE `id`=1597601; +INSERT INTO `creature_ai_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(1597601, 0, 0, 15, 28431, 0, 0, 0, 1, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 'Venom Stalker - Cast Poison Charge'); +UPDATE `creature_template` SET `ai_name`='EventAI' WHERE `entry`=15976; + +-- Removing unused creature spell lists for Necro Stalker +DELETE FROM `creature_spells` WHERE `entry`=164530; +UPDATE `creature_template` SET `spell_list_id`=0 WHERE `entry`=16453; + +-- Events list for Necro Stalker +DELETE FROM `creature_ai_events` WHERE `creature_id`=16453; +INSERT INTO `creature_ai_events` (`id`, `creature_id`, `condition_id`, `event_type`, `event_inverse_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action1_script`, `action2_script`, `action3_script`, `comment`) VALUES (1645301, 16453, 0, 0, 0, 100, 1, 5000, 15000, 28000, 32000, 1645301, 0, 0, 'Necro Stalker - Cast Poison Charge'); +DELETE FROM `creature_ai_scripts` WHERE `id`=1645301; +INSERT INTO `creature_ai_scripts` (`id`, `delay`, `priority`, `command`, `datalong`, `datalong2`, `datalong3`, `datalong4`, `target_param1`, `target_param2`, `target_type`, `data_flags`, `dataint`, `dataint2`, `dataint3`, `dataint4`, `x`, `y`, `z`, `o`, `condition_id`, `comments`) VALUES +(1645301, 0, 0, 15, 28431, 0, 0, 0, 1, 0, 28, 0, 0, 0, 0, 0, 0, 0, 0, 0, 500, 'Necro Stalker - Cast Poison Charge'); +UPDATE `creature_template` SET `ai_name`='EventAI' WHERE `entry`=16453; --- Necro Stalker -REPLACE INTO `creature_spells` (`entry`, `name`, `spellId_1`, `probability_1`, `castTarget_1`, `targetParam1_1`, `targetParam2_1`, `castFlags_1`, `delayInitialMin_1`, `delayInitialMax_1`, `delayRepeatMin_1`, `delayRepeatMax_1`, `scriptId_1`, `spellId_2`, `probability_2`, `castTarget_2`, `targetParam1_2`, `targetParam2_2`, `castFlags_2`, `delayInitialMin_2`, `delayInitialMax_2`, `delayRepeatMin_2`, `delayRepeatMax_2`, `scriptId_2`, `spellId_3`, `probability_3`, `castTarget_3`, `targetParam1_3`, `targetParam2_3`, `castFlags_3`, `delayInitialMin_3`, `delayInitialMax_3`, `delayRepeatMin_3`, `delayRepeatMax_3`, `scriptId_3`, `spellId_4`, `probability_4`, `castTarget_4`, `targetParam1_4`, `targetParam2_4`, `castFlags_4`, `delayInitialMin_4`, `delayInitialMax_4`, `delayRepeatMin_4`, `delayRepeatMax_4`, `scriptId_4`, `spellId_5`, `probability_5`, `castTarget_5`, `targetParam1_5`, `targetParam2_5`, `castFlags_5`, `delayInitialMin_5`, `delayInitialMax_5`, `delayRepeatMin_5`, `delayRepeatMax_5`, `scriptId_5`, `spellId_6`, `probability_6`, `castTarget_6`, `targetParam1_6`, `targetParam2_6`, `castFlags_6`, `delayInitialMin_6`, `delayInitialMax_6`, `delayRepeatMin_6`, `delayRepeatMax_6`, `scriptId_6`, `spellId_7`, `probability_7`, `castTarget_7`, `targetParam1_7`, `targetParam2_7`, `castFlags_7`, `delayInitialMin_7`, `delayInitialMax_7`, `delayRepeatMin_7`, `delayRepeatMax_7`, `scriptId_7`, `spellId_8`, `probability_8`, `castTarget_8`, `targetParam1_8`, `targetParam2_8`, `castFlags_8`, `delayInitialMin_8`, `delayInitialMax_8`, `delayRepeatMin_8`, `delayRepeatMax_8`, `scriptId_8`) VALUES (164530, 'Naxxramas - Necro Stalker', 28431, 100, 28, 0, 0, 0, 5, 15, 28, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); -- End of migration. From cb70b0681af7b234960cfebefc5f82f5f8a3580e Mon Sep 17 00:00:00 2001 From: balakethelock <111737968+balakethelock@users.noreply.github.com> Date: Sat, 23 Dec 2023 18:10:55 +0100 Subject: [PATCH 7/7] Flipped script id and spell id For logging --- src/game/Maps/Map.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/Maps/Map.cpp b/src/game/Maps/Map.cpp index ba96e125f9f..14d06485faf 100644 --- a/src/game/Maps/Map.cpp +++ b/src/game/Maps/Map.cpp @@ -2538,7 +2538,7 @@ bool Map::FindScriptFinalTargets(WorldObject*& source, WorldObject*& target, Scr if (!(target = GetTargetByType(source, target, this, script.target_type, script.target_param1, script.target_param2, pSpellInfo))) { if (!(script.raw.data[4] & SF_GENERAL_SKIP_MISSING_TARGETS)) - sLog.Out(LOG_BASIC, LOG_LVL_ERROR, "FindScriptTargets: Failed to find target for Cast Spell script with id %u (spellId: %u), (target_param1: %u), (target_param2: %u), (target_type: %u).", script.castSpell.spellId, script.id, script.target_param1, script.target_param2, script.target_type); + sLog.Out(LOG_BASIC, LOG_LVL_ERROR, "FindScriptTargets: Failed to find target for Cast Spell script with id %u (spellId: %u), (target_param1: %u), (target_param2: %u), (target_type: %u).", script.id, script.castSpell.spellId, script.target_param1, script.target_param2, script.target_type); return false; } }