fix(Scripts/Quest): Implement Cocoon Summoning for Rivenwood Captives (#26837)

Co-authored-by: Copilot Autofix powered by AI <[email protected]>
Co-authored-by: Ludwig <[email protected]>
This commit is contained in:
Gultask
2026-08-08 19:33:45 +02:00
committed by GitHub
co-authored by Copilot Autofix powered by AI Ludwig
parent 114322299e
commit df5c8337f4
2 changed files with 78 additions and 0 deletions
@@ -0,0 +1,23 @@
--
UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 24210;
DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 24210);
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`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(24210, 0, 0, 0, 6, 0, 100, 0, 0, 0, 0, 0, 0, 0, 11, 43287, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Riven Widow Cocoon - On Just Died - Cast \'Rivenwood Captives: Player On Quest\''),
(24210, 0, 1, 0, 6, 0, 100, 0, 0, 0, 0, 0, 0, 0, 11, 43288, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Riven Widow Cocoon - On Just Died - Cast \'Rivenwood Captives: Player Not On Quest\'');
UPDATE `creature_template` SET `AIName` = 'SmartAI' WHERE `entry` = 24211;
DELETE FROM `smart_scripts` WHERE (`source_type` = 0 AND `entryorguid` = 24211);
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`, `event_param5`, `event_param6`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_param4`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
(24211, 0, 0, 0, 54, 0, 100, 0, 0, 0, 0, 0, 0, 0, 69, 1, 0, 0, 0, 1, 0, 21, 60, 0, 0, 0, 0, 0, 0, 0, 'Freed Winterhoof Longrunner - On Just Summoned - Move To Closest Player'),
(24211, 0, 1, 2, 34, 0, 100, 0, 8, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Freed Winterhoof Longrunner - On Reached Player - Say Line'),
(24211, 0, 2, 0, 61, 0, 100, 0, 0, 0, 0, 0, 0, 0, 41, 3600, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 'Freed Winterhoof Longrunner - On Reached Player - Despawn In 3600 ms');
DELETE FROM `spell_script_names` WHERE `spell_id` IN (43287, 43288);
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(43287, 'spell_q11296_rivenwood_captives'),
(43288, 'spell_q11296_rivenwood_captives');
DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 22) AND (`SourceEntry` = 24210) AND (`SourceId` = 0) AND (`ElseGroup` = 0) AND (`ConditionTypeOrReference` = 47);
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(22, 1, 24210, 0, 0, 47, 0, 11296, 10, 0, 0, 0, 0, '', 'Cast \'Rivenwood Captives: Player On Quest\' if its namesake is true'),
(22, 2, 24210, 0, 0, 47, 0, 11296, 10, 0, 1, 0, 0, '', 'Cast \'Rivenwood Captives: Player Not On Quest\' if its namesake is true');
@@ -306,6 +306,60 @@ class spell_the_cleansing_on_death_cast_on_master : public SpellScript
}
};
// Quest 11296: Rivenwood Captives
enum RivenwoodCaptives
{
SPELL_CAPTIVES_ON_QUEST = 43287,
SPELL_CAPTIVES_NOT_ON_QUEST = 43288,
SPELL_SUMMON_FREED_SCOUT = 43289,
SPELL_SUMMON_HOSTILE_START = 43275,
SPELL_SUMMON_HOSTILE_END = 43285,
NPC_FREED_SCOUT = 24211
};
class spell_q11296_rivenwood_captives : public SpellScript
{
PrepareSpellScript(spell_q11296_rivenwood_captives);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
std::vector<uint32> spellIds = { SPELL_SUMMON_FREED_SCOUT };
for (uint32 spellId = SPELL_SUMMON_HOSTILE_START; spellId <= SPELL_SUMMON_HOSTILE_END; ++spellId)
spellIds.push_back(spellId);
return ValidateSpellInfo(spellIds);
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (!caster)
return;
uint32 spellId = urand(SPELL_SUMMON_HOSTILE_START, SPELL_SUMMON_HOSTILE_END);
if (GetSpellInfo()->Id == SPELL_CAPTIVES_ON_QUEST && roll_chance_i(50))
{
spellId = SPELL_SUMMON_FREED_SCOUT;
if (Creature* web = caster->ToCreature())
if (Player* player = web->GetLootRecipient())
player->RewardPlayerAndGroupAtEvent(NPC_FREED_SCOUT, player);
}
caster->CastSpell(caster, spellId, true);
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_q11296_rivenwood_captives::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
}
};
/*######
## Quest 11529: Sorlof's Booty
######*/
@@ -573,6 +627,7 @@ void AddSC_howling_fjord()
RegisterSpellScript(spell_the_cleansing_cleansing_soul);
RegisterSpellScript(spell_the_cleansing_mirror_image_script_effect);
RegisterSpellScript(spell_the_cleansing_on_death_cast_on_master);
RegisterSpellScript(spell_q11296_rivenwood_captives);
RegisterSpellScript(spell_sorlofs_booty_cannon_primer);
RegisterSpellScript(spell_sorlofs_booty_big_gun_assault);
RegisterSpellScript(spell_sorlofs_booty_boulder_assault);