aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNaddley <64811442+Naddley@users.noreply.github.com>2025-10-02 18:41:32 +0200
committerGitHub <noreply@github.com>2025-10-02 18:41:32 +0200
commita89b995c09b105de9c679e6d730489ac690f7b3c (patch)
tree7ec8f3b46980f40218eafeb165b27c7a68a708f0
parent3fecc05f1997d04b09d9cae23d8f5aabf99edc5a (diff)
Scripts/Westfall: Implement Quest: "It's Alive!" (#31316)
Co-authored-by: Ovahlord <18347559+Ovahlord@users.noreply.github.com>
-rw-r--r--sql/updates/world/master/2025_10_02_00_world.sql24
-rw-r--r--src/server/scripts/EasternKingdoms/zone_westfall.cpp148
2 files changed, 172 insertions, 0 deletions
diff --git a/sql/updates/world/master/2025_10_02_00_world.sql b/sql/updates/world/master/2025_10_02_00_world.sql
new file mode 100644
index 00000000000..ee564fa63e8
--- /dev/null
+++ b/sql/updates/world/master/2025_10_02_00_world.sql
@@ -0,0 +1,24 @@
+-- Quest: Its Alive!
+UPDATE `creature_template` SET `VehicleId`= 907, `ScriptName`= 'npc_westfall_overloaded_harvest_golem' WHERE `entry`= 42601;
+
+DELETE FROM `npc_spellclick_spells` WHERE `npc_entry`= 42601;
+INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `cast_flags`, `user_type`) VALUES
+(42601, 46598, 1, 0);
+
+DELETE FROM `creature_template_spell` WHERE (`CreatureID`=42601 AND `Index` IN (1,0));
+INSERT INTO `creature_template_spell` (`CreatureID`, `Index`, `Spell`, `VerifiedBuild`) VALUES
+(42601, 1, 79430, 63305), -- Overloaded Harvest Golem
+(42601, 0, 79425, 63305); -- Overloaded Harvest Golem
+
+DELETE FROM `conditions` WHERE `SourceEntry`= 79436 AND `SourceTypeOrReferenceId`= 13;
+INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ScriptName`, `Comment`) VALUES
+(13, 2, 79436, 0, 0, 31, 0, 3, 42381, 0, 0, 0, '', 'Wake Harvest Golem - Target Overloaded Harvest Golem');
+
+DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_westfall_reaping_blows', 'spell_westfall_wake_harvest_golem');
+INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
+(79425, 'spell_westfall_reaping_blows'),
+(79436, 'spell_westfall_wake_harvest_golem');
+
+DELETE FROM `creature_text` WHERE `CreatureID`= 42601;
+INSERT INTO `creature_text` (`CreatureID`, `GroupID`, `ID`, `Text`, `Type`, `Language`, `Probability`, `Emote`, `Duration`, `Sound`, `BroadcastTextId`, `Comment`) VALUES
+(42601, 0, 0, 'You may only ride the Overloaded Harvest Golem at the Molsen Farm.', 42, 0, 100, 0, 0, 0, 42475, '');
diff --git a/src/server/scripts/EasternKingdoms/zone_westfall.cpp b/src/server/scripts/EasternKingdoms/zone_westfall.cpp
index 17b5a2de406..60162630e80 100644
--- a/src/server/scripts/EasternKingdoms/zone_westfall.cpp
+++ b/src/server/scripts/EasternKingdoms/zone_westfall.cpp
@@ -15,11 +15,45 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include "CombatAI.h"
#include "Containers.h"
+#include "CreatureAIImpl.h"
+#include "Player.h"
#include "ScriptedCreature.h"
#include "ScriptMgr.h"
+#include "SpellAuraEffects.h"
#include "SpellScript.h"
+namespace Scripts::EasternKingdoms::Westfall
+{
+namespace Creatures
+{
+ static constexpr uint32 EnergizedHarvestReaper = 42342;
+ static constexpr uint32 OverloadedHarvestGolem = 42601;
+}
+
+namespace Events
+{
+ namespace ItsAlive
+ {
+ static constexpr uint32 CheckArea = 1;
+ static constexpr uint32 DespawnHarvester = 2;
+ }
+}
+
+namespace Text
+{
+ namespace HarvestGolem
+ {
+ static constexpr uint32 AnnounceOutOfArea = 0;
+ }
+}
+
+namespace Area
+{
+ static constexpr uint32 TheMoestFarm = 918;
+}
+
// 79084 - Unbound Energy
class spell_westfall_unbound_energy : public SpellScript
{
@@ -44,7 +78,121 @@ class spell_westfall_unbound_energy : public SpellScript
}
};
+// 42601 - Overloaded Harvest Golem
+struct npc_westfall_overloaded_harvest_golem : public ScriptedAI
+{
+ npc_westfall_overloaded_harvest_golem(Creature* creature) : ScriptedAI(creature) {}
+
+ void JustAppeared() override
+ {
+ _events.ScheduleEvent(Events::ItsAlive::CheckArea, 1s);
+ }
+
+ void PassengerBoarded(Unit* /*passenger*/, int8 /*seatId*/, bool apply) override
+ {
+ if (!apply)
+ me->DespawnOrUnsummon();
+ }
+
+ void UpdateAI(uint32 diff) override
+ {
+ _events.Update(diff);
+ while (uint32 eventId = _events.ExecuteEvent())
+ {
+ switch (eventId)
+ {
+ case Events::ItsAlive::CheckArea:
+ if (me->GetAreaId() != Area::TheMoestFarm)
+ {
+ if (Unit* owner = me->GetCharmerOrOwner())
+ Talk(Text::HarvestGolem::AnnounceOutOfArea, owner);
+ _events.ScheduleEvent(Events::ItsAlive::DespawnHarvester, 8s);
+ }
+ else
+ _events.Repeat(1s);
+ break;
+ case Events::ItsAlive::DespawnHarvester:
+ if (me->GetAreaId() != Area::TheMoestFarm)
+ me->DespawnOrUnsummon();
+ else
+ _events.ScheduleEvent(Events::ItsAlive::CheckArea, 1s);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+private:
+ EventMap _events;
+};
+
+// 79425 - Reaping Blows
+class spell_westfall_reaping_blows : public AuraScript
+{
+ bool Validate(SpellInfo const* spellInfo) override
+ {
+ return ValidateSpellEffect({ { spellInfo->Id, EFFECT_1 } }) && ValidateSpellInfo({ uint32(spellInfo->GetEffect(EFFECT_1).TriggerSpell) });
+ }
+
+ void HandlePeriodic(AuraEffect const* /*aurEff*/)
+ {
+ // HACK
+ // periodic ticks are forcing to cast the spell onto himself instead of target
+ // ref AuraEffect::HandlePeriodicTriggerSpellAuraTick
+ PreventDefaultAction();
+ if (Creature* reaper = GetTarget()->FindNearestCreature(Creatures::EnergizedHarvestReaper, 5.f, true))
+ GetTarget()->CastSpell(reaper, GetSpellInfo()->GetEffect(EFFECT_1).TriggerSpell, true);
+ }
+
+ void Register() override
+ {
+ OnEffectPeriodic += AuraEffectPeriodicFn(spell_westfall_reaping_blows::HandlePeriodic, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
+ }
+};
+
+// 79436 - Wake Harvest Golem
+class spell_westfall_wake_harvest_golem : public SpellScript
+{
+ SpellCastResult CheckTarget()
+ {
+ Unit* target = GetExplTargetUnit();
+ if (!target || !target->IsCreature())
+ return SPELL_FAILED_BAD_TARGETS;
+
+ return SPELL_CAST_OK;
+ }
+
+ void HandleScriptEffect(SpellEffIndex /*effIndex*/)
+ {
+ Unit* caster = GetCaster();
+ if (!caster || !caster->IsPlayer())
+ return;
+
+ if (Creature* target = GetHitCreature())
+ {
+ caster->ToPlayer()->KilledMonsterCredit(Creatures::OverloadedHarvestGolem);
+ target->DespawnOrUnsummon(100ms);
+ }
+ }
+
+ void Register() override
+ {
+ OnCheckCast += SpellCheckCastFn(spell_westfall_wake_harvest_golem::CheckTarget);
+ OnEffectHitTarget += SpellEffectFn(spell_westfall_wake_harvest_golem::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
+ }
+};
+}
+
void AddSC_westfall()
{
+ using namespace Scripts::EasternKingdoms::Westfall;
+
+ // Creature
+ RegisterCreatureAI(npc_westfall_overloaded_harvest_golem);
+
+ // Spells
RegisterSpellScript(spell_westfall_unbound_energy);
+ RegisterSpellScript(spell_westfall_reaping_blows);
+ RegisterSpellScript(spell_westfall_wake_harvest_golem);
}