mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 01:37:37 +01:00
Scripts/Creature: Replace trigger_periodic with unique scripts (#27240)
This commit is contained in:
21
sql/updates/world/3.3.5/2021_11_10_00_world.sql
Normal file
21
sql/updates/world/3.3.5/2021_11_10_00_world.sql
Normal file
@@ -0,0 +1,21 @@
|
||||
-- Shadow Fissure
|
||||
UPDATE `creature_template` SET `unit_flags` = 33554432, `unit_flags2` = `unit_flags2` &~ 2048, `BaseAttackTime` = 2000, `ScriptName` = 'npc_kelthuzad_shadow_fissure' WHERE `entry` = 16129;
|
||||
DELETE FROM `creature_template_spell` WHERE `CreatureID` = 16129;
|
||||
|
||||
-- Sapphiron's Wing Buffet
|
||||
UPDATE `creature_template` SET `BaseAttackTime` = 2000, `ScriptName` = 'npc_sapphiron_wing_buffet', `flags_extra` = `flags_extra` &~ 0x00002000 WHERE `entry` = 17025;
|
||||
DELETE FROM `creature_template_addon` WHERE `entry` = 17025;
|
||||
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id` = 29330 AND `ScriptName` = 'spell_sapphiron_wing_buffet_despawn_periodic';
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id` = 29336 AND `ScriptName` = 'spell_sapphiron_despawn_buffet';
|
||||
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
|
||||
(29330,'spell_sapphiron_wing_buffet_despawn_periodic'),
|
||||
(29336,'spell_sapphiron_despawn_buffet');
|
||||
|
||||
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 13 AND `SourceEntry` = 29336;
|
||||
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorType`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
|
||||
(13,1,29336,0,0,31,0,3,17025,0,0,0,0,"","Group 0: Spell 'Despawn Buffet' (Effect 0) targets creature 'Sapphiron's Wing Buffet'");
|
||||
|
||||
-- Void Zone
|
||||
UPDATE `creature_template` SET `unit_flags2` = `unit_flags2` &~ 2048, `BaseAttackTime` = 2000, `ScriptName` = 'npc_gen_void_zone' WHERE `entry` = 16697;
|
||||
DELETE FROM `creature_template_spell` WHERE `CreatureID` = 16697;
|
||||
@@ -105,7 +105,10 @@ enum Spells
|
||||
SPELL_MORTAL_WOUND = 28467,
|
||||
|
||||
// Guardian of Icecrown
|
||||
SPELL_BLOOD_TAP = 28470
|
||||
SPELL_BLOOD_TAP = 28470,
|
||||
|
||||
// Shadow Fissure
|
||||
SPELL_VOID_BLAST = 27812
|
||||
};
|
||||
|
||||
static const uint8 nGuardianSpawns = 4;
|
||||
@@ -825,6 +828,32 @@ struct npc_kelthuzad_guardian : public ScriptedAI
|
||||
uint32 _bloodTapTimer;
|
||||
};
|
||||
|
||||
struct npc_kelthuzad_shadow_fissure : public ScriptedAI
|
||||
{
|
||||
npc_kelthuzad_shadow_fissure(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
void InitializeAI() override
|
||||
{
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
}
|
||||
|
||||
void JustAppeared() override
|
||||
{
|
||||
_scheduler.Schedule(5s, [this](TaskContext /*task*/)
|
||||
{
|
||||
DoCastSelf(SPELL_VOID_BLAST);
|
||||
});
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
_scheduler.Update(diff);
|
||||
}
|
||||
|
||||
private:
|
||||
TaskScheduler _scheduler;
|
||||
};
|
||||
|
||||
// 28410 - Chains of Kel'Thuzad
|
||||
class spell_kelthuzad_chains : public AuraScript
|
||||
{
|
||||
@@ -956,6 +985,7 @@ void AddSC_boss_kelthuzad()
|
||||
RegisterNaxxramasCreatureAI(npc_kelthuzad_banshee);
|
||||
RegisterNaxxramasCreatureAI(npc_kelthuzad_abomination);
|
||||
RegisterNaxxramasCreatureAI(npc_kelthuzad_guardian);
|
||||
RegisterNaxxramasCreatureAI(npc_kelthuzad_shadow_fissure);
|
||||
RegisterSpellScript(spell_kelthuzad_chains);
|
||||
RegisterSpellScript(spell_kelthuzad_detonate_mana);
|
||||
RegisterSpellScript(spell_kelthuzad_frost_blast);
|
||||
|
||||
@@ -38,19 +38,22 @@ enum Yells
|
||||
|
||||
enum Spells
|
||||
{
|
||||
SPELL_FROST_AURA = 28531,
|
||||
SPELL_CLEAVE = 19983,
|
||||
SPELL_TAIL_SWEEP = 55697,
|
||||
SPELL_SUMMON_BLIZZARD = 28560,
|
||||
SPELL_LIFE_DRAIN = 28542,
|
||||
SPELL_ICEBOLT = 28522,
|
||||
SPELL_FROST_BREATH_ANTICHEAT = 29318, // damage effect ignoring LoS on the entrance platform to prevent cheese
|
||||
SPELL_FROST_BREATH = 28524, // damage effect below sapphiron
|
||||
SPELL_FROST_MISSILE = 30101, // visual only
|
||||
SPELL_BERSERK = 26662,
|
||||
SPELL_DIES = 29357,
|
||||
SPELL_CHECK_RESISTS = 60539,
|
||||
SPELL_SAPPHIRON_WING_BUFFET = 29328
|
||||
SPELL_FROST_AURA = 28531,
|
||||
SPELL_CLEAVE = 19983,
|
||||
SPELL_TAIL_SWEEP = 55697,
|
||||
SPELL_SUMMON_BLIZZARD = 28560,
|
||||
SPELL_LIFE_DRAIN = 28542,
|
||||
SPELL_ICEBOLT = 28522,
|
||||
SPELL_FROST_BREATH_ANTICHEAT = 29318, // damage effect ignoring LoS on the entrance platform to prevent cheese
|
||||
SPELL_FROST_BREATH = 28524, // damage effect below sapphiron
|
||||
SPELL_FROST_MISSILE = 30101, // visual only
|
||||
SPELL_BERSERK = 26662,
|
||||
SPELL_DIES = 29357,
|
||||
SPELL_CHECK_RESISTS = 60539,
|
||||
SPELL_SUMMON_WING_BUFFET = 29329,
|
||||
SPELL_WING_BUFFET_PERIODIC = 29327,
|
||||
SPELL_WING_BUFFET_DESPAWN_PERIODIC = 29330,
|
||||
SPELL_DESPAWN_BUFFET = 29336
|
||||
};
|
||||
|
||||
enum Phases
|
||||
@@ -81,7 +84,6 @@ enum Events
|
||||
enum Misc
|
||||
{
|
||||
NPC_BLIZZARD = 16474,
|
||||
NPC_WING_BUFFET = 17025,
|
||||
GO_ICEBLOCK = 181247,
|
||||
|
||||
// The Hundred Club
|
||||
@@ -335,8 +337,7 @@ struct boss_sapphiron : public BossAI
|
||||
case EVENT_LIFTOFF:
|
||||
{
|
||||
Talk(EMOTE_AIR_PHASE);
|
||||
if (Creature* buffet = DoSummon(NPC_WING_BUFFET, me, 0.0f, 0s, TEMPSUMMON_MANUAL_DESPAWN))
|
||||
_buffet = buffet->GetGUID();
|
||||
DoCastSelf(SPELL_SUMMON_WING_BUFFET);
|
||||
me->HandleEmoteCommand(EMOTE_ONESHOT_LIFTOFF);
|
||||
me->SetHover(true);
|
||||
events.ScheduleEvent(EVENT_ICEBOLT, Seconds(7), 0, PHASE_FLIGHT);
|
||||
@@ -382,13 +383,9 @@ struct boss_sapphiron : public BossAI
|
||||
events.ScheduleEvent(EVENT_LAND, Seconds(3) + Milliseconds(500), 0, PHASE_FLIGHT);
|
||||
return;
|
||||
case EVENT_LAND:
|
||||
DoCastSelf(SPELL_DESPAWN_BUFFET); /// @todo: at this point it should already despawn, probably that spell is used in another place
|
||||
if (_delayedDrain)
|
||||
CastDrain();
|
||||
if (Creature* cBuffet = ObjectAccessor::GetCreature(*me, _buffet))
|
||||
{
|
||||
cBuffet->DespawnOrUnsummon(1s);
|
||||
_buffet.Clear();
|
||||
}
|
||||
me->HandleEmoteCommand(EMOTE_ONESHOT_LAND);
|
||||
Talk(EMOTE_GROUND_PHASE);
|
||||
me->SetHover(false);
|
||||
@@ -410,7 +407,6 @@ struct boss_sapphiron : public BossAI
|
||||
|
||||
private:
|
||||
GuidVector _iceboltTargets;
|
||||
ObjectGuid _buffet;
|
||||
bool _delayedDrain;
|
||||
bool _canTheHundredClub;
|
||||
};
|
||||
@@ -450,6 +446,22 @@ private:
|
||||
ObjectGuid _targetGuid;
|
||||
};
|
||||
|
||||
struct npc_sapphiron_wing_buffet : public ScriptedAI
|
||||
{
|
||||
npc_sapphiron_wing_buffet(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
void InitializeAI() override
|
||||
{
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
}
|
||||
|
||||
void JustAppeared() override
|
||||
{
|
||||
DoCastSelf(SPELL_WING_BUFFET_PERIODIC);
|
||||
DoCastSelf(SPELL_WING_BUFFET_DESPAWN_PERIODIC);
|
||||
}
|
||||
};
|
||||
|
||||
struct go_sapphiron_birth : public GameObjectAI
|
||||
{
|
||||
go_sapphiron_birth(GameObject* go) : GameObjectAI(go), instance(go->GetInstanceScript()) { }
|
||||
@@ -581,6 +593,41 @@ class spell_sapphiron_summon_blizzard : public SpellScript
|
||||
}
|
||||
};
|
||||
|
||||
// 29330 - Sapphiron's Wing Buffet Despawn
|
||||
class spell_sapphiron_wing_buffet_despawn_periodic : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_sapphiron_wing_buffet_despawn_periodic);
|
||||
|
||||
void PeriodicTick(AuraEffect const* /*aurEff*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (Creature* creature = target->ToCreature())
|
||||
creature->DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectPeriodic += AuraEffectPeriodicFn(spell_sapphiron_wing_buffet_despawn_periodic::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
|
||||
}
|
||||
};
|
||||
|
||||
// 29336 - Despawn Buffet
|
||||
class spell_sapphiron_despawn_buffet : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_sapphiron_despawn_buffet);
|
||||
|
||||
void HandleScriptEffect(SpellEffIndex /* effIndex */)
|
||||
{
|
||||
if (Creature* target = GetHitCreature())
|
||||
target->DespawnOrUnsummon();
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_sapphiron_despawn_buffet::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
|
||||
}
|
||||
};
|
||||
|
||||
class achievement_the_hundred_club : public AchievementCriteriaScript
|
||||
{
|
||||
public:
|
||||
@@ -596,9 +643,12 @@ void AddSC_boss_sapphiron()
|
||||
{
|
||||
RegisterNaxxramasCreatureAI(boss_sapphiron);
|
||||
RegisterNaxxramasCreatureAI(npc_sapphiron_blizzard);
|
||||
RegisterNaxxramasCreatureAI(npc_sapphiron_wing_buffet);
|
||||
RegisterNaxxramasGameObjectAI(go_sapphiron_birth);
|
||||
RegisterSpellScript(spell_sapphiron_change_blizzard_target);
|
||||
RegisterSpellScript(spell_sapphiron_icebolt);
|
||||
RegisterSpellScript(spell_sapphiron_summon_blizzard);
|
||||
RegisterSpellScript(spell_sapphiron_wing_buffet_despawn_periodic);
|
||||
RegisterSpellScript(spell_sapphiron_despawn_buffet);
|
||||
new achievement_the_hundred_club();
|
||||
}
|
||||
|
||||
@@ -1,60 +0,0 @@
|
||||
/*
|
||||
* This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "Creature.h"
|
||||
#include "PassiveAI.h"
|
||||
#include "SpellMgr.h"
|
||||
|
||||
class trigger_periodic : public CreatureScript
|
||||
{
|
||||
public:
|
||||
trigger_periodic() : CreatureScript("trigger_periodic") { }
|
||||
|
||||
struct trigger_periodicAI : public NullCreatureAI
|
||||
{
|
||||
trigger_periodicAI(Creature* creature) : NullCreatureAI(creature)
|
||||
{
|
||||
interval = me->GetAttackTime(BASE_ATTACK);
|
||||
timer = interval;
|
||||
}
|
||||
|
||||
uint32 timer, interval;
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
if (timer <= diff)
|
||||
{
|
||||
if (uint32 spell = me->m_spells[0])
|
||||
me->CastSpell(me, spell, TRIGGERED_FULL_MASK);
|
||||
timer = interval;
|
||||
}
|
||||
else
|
||||
timer -= diff;
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return new trigger_periodicAI(creature);
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_generic_creature()
|
||||
{
|
||||
new trigger_periodic();
|
||||
}
|
||||
@@ -2694,6 +2694,37 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
enum VoidZone
|
||||
{
|
||||
SPELL_CONSUMPTION = 28874
|
||||
};
|
||||
|
||||
struct npc_gen_void_zone : public ScriptedAI
|
||||
{
|
||||
npc_gen_void_zone(Creature* creature) : ScriptedAI(creature) { }
|
||||
|
||||
void InitializeAI() override
|
||||
{
|
||||
me->SetReactState(REACT_PASSIVE);
|
||||
}
|
||||
|
||||
void JustAppeared() override
|
||||
{
|
||||
_scheduler.Schedule(2s, [this](TaskContext /*task*/)
|
||||
{
|
||||
DoCastSelf(SPELL_CONSUMPTION);
|
||||
});
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
{
|
||||
_scheduler.Update(diff);
|
||||
}
|
||||
|
||||
private:
|
||||
TaskScheduler _scheduler;
|
||||
};
|
||||
|
||||
void AddSC_npcs_special()
|
||||
{
|
||||
new npc_air_force_bots();
|
||||
@@ -2720,4 +2751,5 @@ void AddSC_npcs_special()
|
||||
new npc_train_wrecker();
|
||||
new npc_argent_squire_gruntling();
|
||||
new npc_bountiful_table();
|
||||
RegisterCreatureAI(npc_gen_void_zone);
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
// world
|
||||
void AddSC_areatrigger_scripts();
|
||||
void AddSC_emerald_dragons();
|
||||
void AddSC_generic_creature();
|
||||
void AddSC_go_scripts();
|
||||
void AddSC_npc_guard();
|
||||
void AddSC_item_scripts();
|
||||
@@ -42,7 +41,6 @@ void AddWorldScripts()
|
||||
{
|
||||
AddSC_areatrigger_scripts();
|
||||
AddSC_emerald_dragons();
|
||||
AddSC_generic_creature();
|
||||
AddSC_go_scripts();
|
||||
AddSC_npc_guard();
|
||||
AddSC_item_scripts();
|
||||
|
||||
Reference in New Issue
Block a user