Skip to content

Commit

Permalink
Port scourge invasions from vmangos
Browse files Browse the repository at this point in the history
Closes cmangos/issues#2313
Credit: Vmangos for original implementation. Killerwife rewrites for our worldstate system. Mantislord event data. Anon EAI port. Killerwife rest of db data.
  • Loading branch information
MantisLord authored and killerwife committed Dec 21, 2021
1 parent eaf5385 commit d794e29
Show file tree
Hide file tree
Showing 24 changed files with 2,679 additions and 13 deletions.
1 change: 1 addition & 0 deletions doc/script_commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ Defining a buddy could be done in several way:
35 SCRIPT_COMMAND_SEND_AI_EVENT * resultingSource = Creature, resultingTarget = Unit
* datalong = AIEventType - limited only to EventAI supported events
* datalong2 = radius. If radius isn't provided and the target is a creature, then send AIEvent to target
* datalong3 = miscvalue - uint32 - for use in ReceiveAIEvent handler

36 SCRIPT_COMMAND_SET_FACING Turn resultingSource towards resultingTarget
* resultingSource = Creature, resultingTarget WorldObject
Expand Down
7 changes: 7 additions & 0 deletions sql/base/dbc/cmangos_fixes/Spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2108,6 +2108,9 @@ INSERT INTO `spell_template` (`Id`, `SchoolMask`, `Category`, `CastUI`, `Dispel`
-- Toxic Gas - used by Garden Gas in Naxx, remove SPELL_ATTR_EX_CHANNELED_1 and CHANNEL_FLAG_MOVEMENT to prevent aura being removed
UPDATE spell_template SET AttributesEx=0, ChannelInterruptFlags=0 WHERE Id=30074;

INSERT INTO spell_template (Id, Category, CastUI, Dispel, Mechanic, Attributes, AttributesEx, AttributesEx2, AttributesEx3, AttributesEx4, Stances, StancesNot, Targets, TargetCreatureType, RequiresSpellFocus, CasterAuraState, TargetAuraState, CastingTimeIndex, RecoveryTime, CategoryRecoveryTime, InterruptFlags, AuraInterruptFlags, ChannelInterruptFlags, ProcFlags, ProcChance, ProcCharges, MaxLevel, BaseLevel, SpellLevel, DurationIndex, PowerType, ManaCost, ManaCostPerlevel, ManaPerSecond, ManaPerSecondPerLevel, RangeIndex, Speed, ModalNextSpell, StackAmount, Totem1, Totem2, Reagent1, Reagent2, Reagent3, Reagent4, Reagent5, Reagent6, Reagent7, Reagent8, ReagentCount1, ReagentCount2, ReagentCount3, ReagentCount4, ReagentCount5, ReagentCount6, ReagentCount7, ReagentCount8, EquippedItemClass, EquippedItemSubClassMask, EquippedItemInventoryTypeMask, Effect1, Effect2, Effect3, EffectDieSides1, EffectDieSides2, EffectDieSides3, EffectBaseDice1, EffectBaseDice2, EffectBaseDice3, EffectDicePerLevel1, EffectDicePerLevel2, EffectDicePerLevel3, EffectRealPointsPerLevel1, EffectRealPointsPerLevel2, EffectRealPointsPerLevel3, EffectBasePoints1, EffectBasePoints2, EffectBasePoints3, EffectMechanic1, EffectMechanic2, EffectMechanic3, EffectImplicitTargetA1, EffectImplicitTargetA2, EffectImplicitTargetA3, EffectImplicitTargetB1, EffectImplicitTargetB2, EffectImplicitTargetB3, EffectRadiusIndex1, EffectRadiusIndex2, EffectRadiusIndex3, EffectApplyAuraName1, EffectApplyAuraName2, EffectApplyAuraName3, EffectAmplitude1, EffectAmplitude2, EffectAmplitude3, EffectMultipleValue1, EffectMultipleValue2, EffectMultipleValue3, EffectChainTarget1, EffectChainTarget2, EffectChainTarget3, EffectItemType1, EffectItemType2, EffectItemType3, EffectMiscValue1, EffectMiscValue2, EffectMiscValue3, EffectTriggerSpell1, EffectTriggerSpell2, EffectTriggerSpell3, EffectPointsPerComboPoint1, EffectPointsPerComboPoint2, EffectPointsPerComboPoint3, SpellVisual, SpellIconID, ActiveIconID, SpellPriority, SpellName, SpellName2, SpellName3, SpellName4, SpellName5, SpellName6, SpellName7, SpellName8, Rank1, Rank2, Rank3, Rank4, Rank5, Rank6, Rank7, Rank8, ManaCostPercentage, StartRecoveryCategory, StartRecoveryTime, MaxTargetLevel, SpellFamilyName, SpellFamilyFlags, MaxAffectedTargets, DmgClass, PreventionType, StanceBarOrder, DmgMultiplier1, DmgMultiplier2, DmgMultiplier3, MinFactionId, MinReputation, RequiredAuraVision, SchoolMask, IsServerSide, AttributesServerside) VALUES
(28203, 0, 0, 0, 0, 384, 1024, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 101, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 'Find Camp Type', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0);

-- ==================
-- MaxAffectedTargets
UPDATE `spell_template` SET `MaxAffectedTargets` = 1 WHERE `Id` IN (
Expand Down Expand Up @@ -2177,6 +2180,10 @@ UPDATE `spell_template` SET `AttributesServerSide` = `AttributesServerSide`|4 WH
28330 -- Flameshocker - Immolate Visual
);

-- Scourge invasion serverside
INSERT INTO spell_template(Id, SchoolMask, Category, Dispel, Mechanic, Attributes, AttributesEx, AttributesEx2, AttributesEx3, AttributesEx4, AttributesEx5, Stances, StancesNot, Targets, TargetCreatureType, RequiresSpellFocus, CasterAuraState, TargetAuraState, CasterAuraStateNot, TargetAuraStateNot, CastingTimeIndex, RecoveryTime, CategoryRecoveryTime, InterruptFlags, AuraInterruptFlags, ChannelInterruptFlags, procFlags, procChance, procCharges, maxLevel, baseLevel, spellLevel, DurationIndex, powerType, manaCost, manaCostPerLevel, manaPerSecond, manaPerSecondPerLevel, rangeIndex, speed, StackAmount, Totem1, Totem2, Reagent1, Reagent2, Reagent3, Reagent4, Reagent5, Reagent6, Reagent7, Reagent8, ReagentCount1, ReagentCount2, ReagentCount3, ReagentCount4, ReagentCount5, ReagentCount6, ReagentCount7, ReagentCount8, EquippedItemClass, EquippedItemSubClassMask, EquippedItemInventoryTypeMask, Effect1, Effect2, Effect3, EffectDieSides1, EffectDieSides2, EffectDieSides3, EffectBaseDice1, EffectBaseDice2, EffectBaseDice3, EffectDicePerLevel1, EffectDicePerLevel2, EffectDicePerLevel3, EffectRealPointsPerLevel1, EffectRealPointsPerLevel2, EffectRealPointsPerLevel3, EffectBasePoints1, EffectBasePoints2, EffectBasePoints3, EffectMechanic1, EffectMechanic2, EffectMechanic3, EffectImplicitTargetA1, EffectImplicitTargetA2, EffectImplicitTargetA3, EffectImplicitTargetB1, EffectImplicitTargetB2, EffectImplicitTargetB3, EffectRadiusIndex1, EffectRadiusIndex2, EffectRadiusIndex3, EffectApplyAuraName1, EffectApplyAuraName2, EffectApplyAuraName3, EffectAmplitude1, EffectAmplitude2, EffectAmplitude3, EffectMultipleValue1, EffectMultipleValue2, EffectMultipleValue3, EffectChainTarget1, EffectChainTarget2, EffectChainTarget3, EffectItemType1, EffectItemType2, EffectItemType3, EffectMiscValue1, EffectMiscValue2, EffectMiscValue3, EffectMiscValueB1, EffectMiscValueB2, EffectMiscValueB3, EffectTriggerSpell1, EffectTriggerSpell2, EffectTriggerSpell3, EffectPointsPerComboPoint1, EffectPointsPerComboPoint2, EffectPointsPerComboPoint3, SpellVisual, SpellIconID, activeIconID, spellPriority, SpellName, SpellName2, SpellName3, SpellName4, SpellName5, SpellName6, SpellName7, SpellName8, ManaCostPercentage, StartRecoveryCategory, StartRecoveryTime, MaxTargetLevel, SpellFamilyName, SpellFamilyFlags, MaxAffectedTargets, DmgClass, PreventionType, DmgMultiplier1, DmgMultiplier2, DmgMultiplier3, TotemCategory1, TotemCategory2, AreaId) VALUES
('28345', '1', '0', '0', '0', '256', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '101', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '0', '0', '3', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', 'Communique Trigger', '', '', '', '', '', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0'),
('28349', '1', '0', '0', '0', '8388608', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0', '0', '101', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '135', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '-1', '0', '0', '3', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '25', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', 'Despawner, other', '', '', '', '', '', '', '', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0');

-- ============================================================
-- TBC section
Expand Down
14 changes: 14 additions & 0 deletions sql/scriptdev2/scriptdev2.sql
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,20 @@ INSERT INTO scripted_areatrigger VALUES
(4786,'at_brewfest_receive_keg'),
(4787,'at_brewfest_send_keg');

/* Scourge Invasion */
UPDATE creature_template SET ScriptName='scourge_invasion_necrotic_shard' WHERE entry IN (16136,16172);
UPDATE creature_template SET ScriptName='scourge_invasion_necropolis' WHERE entry=16401;
UPDATE creature_template SET ScriptName='scourge_invasion_mouth' WHERE entry=16995;
UPDATE creature_template SET ScriptName='scourge_invasion_necropolis_health' WHERE entry=16421;
UPDATE creature_template SET ScriptName='scourge_invasion_necropolis_relay' WHERE entry=16386;
UPDATE creature_template SET ScriptName='scourge_invasion_necropolis_proxy' WHERE entry=16398;
UPDATE creature_template SET ScriptName='scourge_invasion_minion_spawner' WHERE entry IN (16306,16336,16338);
UPDATE creature_template SET ScriptName='scourge_invasion_cultist_engineer' WHERE entry=16230;
UPDATE creature_template SET ScriptName='scourge_invasion_minion' WHERE entry IN (16143,16383);
UPDATE creature_template SET ScriptName='npc_pallid_horror' WHERE entry IN (16394,16382);
UPDATE gameobject_template SET ScriptName='scourge_invasion_go_circle' WHERE entry=181136;
UPDATE gameobject_template SET ScriptName='scourge_invasion_go_necropolis' WHERE entry IN (181154,181215,181223,181374,181373);

/* */
/* ZONE */
/* */
Expand Down
5 changes: 4 additions & 1 deletion sql/scriptdev2/spell.sql
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,10 @@ INSERT INTO spell_scripts(Id, ScriptName) VALUES
(29875,'spell_check_gothik_side'),
(29897,'spell_icecrown_guardian_periodic'),
(30114,'spell_plague_wave_controller'),
(30132,'spell_sapphiron_iceblock');
(30132,'spell_sapphiron_iceblock'),
(28091,'spell_despawner_self'),
(28345,'spell_communique_trigger'),
(31315,'spell_summon_boss');

-- TBC
INSERT INTO spell_scripts(Id, ScriptName) VALUES
Expand Down
2 changes: 2 additions & 0 deletions src/game/AI/BaseAI/CreatureAI.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ class CreatureAI : public UnitAI

virtual void Reset();

virtual void OnRemoveFromWorld() {}

virtual void EnterCombat(Unit* enemy) override;
virtual void AttackStart(Unit* who) override;
virtual void DamageTaken(Unit* dealer, uint32& damage, DamageEffectType damageType, SpellEntry const* spellInfo) override;
Expand Down
6 changes: 4 additions & 2 deletions src/game/AI/EventAI/CreatureEventAI.h
Original file line number Diff line number Diff line change
Expand Up @@ -771,8 +771,9 @@ struct CreatureEventAI_Event
// EVENT_T_TARGET_NOT_REACHABLE = 36
struct
{
uint32 unused;
} unreachable;
uint32 eventId;
uint32 data;
} map_event;
// RAW
struct
{
Expand Down Expand Up @@ -894,6 +895,7 @@ class CreatureEventAI : public CreatureAI

uint32 m_EventUpdateTime; // Time between event updates
uint32 m_EventDiff; // Time between the last event call
bool m_bEmptyList;

// Variables used by Events themselves
typedef std::vector<CreatureEventAIHolder> CreatureEventAIList;
Expand Down
16 changes: 16 additions & 0 deletions src/game/AI/ScriptDevAI/include/sc_grid_searchers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ void GetGameObjectListWithEntryInGrid(GameObjectList& goList, WorldObject* sourc
Cell::VisitGridObjects(source, searcher, maxSearchRange);
}

void GetGameObjectListWithEntryInGrid(GameObjectList& goList, WorldObject* source, std::vector<uint32> const& entries, float maxSearchRange)
{
MaNGOS::AllGameObjectsMatchingOneEntryInRange check(source, entries, maxSearchRange);
MaNGOS::GameObjectListSearcher<MaNGOS::AllGameObjectsMatchingOneEntryInRange> searcher(goList, check);

Cell::VisitGridObjects(source, searcher, maxSearchRange);
}

void GetCreatureListWithEntryInGrid(CreatureList& creatureList, WorldObject* source, uint32 entry, float maxSearchRange)
{
MaNGOS::AllCreaturesOfEntryInRangeCheck check(source, entry, maxSearchRange);
Expand All @@ -51,6 +59,14 @@ void GetCreatureListWithEntryInGrid(CreatureList& creatureList, WorldObject* sou
Cell::VisitGridObjects(source, searcher, maxSearchRange);
}

void GetCreatureListWithEntryInGrid(CreatureList& creatureList, WorldObject* source, std::vector<uint32> const& entries, float maxSearchRange)
{
MaNGOS::AllCreaturesMatchingOneEntryInRange check(source, entries, maxSearchRange);
MaNGOS::CreatureListSearcher<MaNGOS::AllCreaturesMatchingOneEntryInRange> searcher(creatureList, check);

Cell::VisitGridObjects(source, searcher, maxSearchRange);
}

void GetPlayerListWithEntryInWorld(PlayerList& playerList, WorldObject* source, float maxSearchRange)
{
MaNGOS::AnyPlayerInObjectRangeCheck check(source, maxSearchRange);
Expand Down
2 changes: 2 additions & 0 deletions src/game/AI/ScriptDevAI/include/sc_grid_searchers.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ GameObject* GetClosestGameObjectWithEntry(WorldObject* source, uint32 entry, flo
Creature* GetClosestCreatureWithEntry(WorldObject* source, uint32 entry, float maxSearchRange, bool onlyAlive = true, bool onlyDead = false, bool excludeSelf = false);

void GetGameObjectListWithEntryInGrid(GameObjectList& goList, WorldObject* source, uint32 entry, float maxSearchRange);
void GetGameObjectListWithEntryInGrid(GameObjectList& goList, WorldObject* source, std::vector<uint32> const& entries, float maxSearchRange);
void GetCreatureListWithEntryInGrid(CreatureList& creatureList, WorldObject* source, uint32 entry, float maxSearchRange);
void GetCreatureListWithEntryInGrid(CreatureList& creatureList, WorldObject* source, std::vector<uint32> const& entries, float maxSearchRange);
void GetPlayerListWithEntryInWorld(PlayerList& playerList, WorldObject* source, float maxSearchRange);

// Used in: hyjalAI.cpp
Expand Down
Loading

0 comments on commit d794e29

Please sign in to comment.