Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Scourge invasion Event Rework #1717

Open
wants to merge 75 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 34 commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
53773b2
Damaged Necrotic Shards do not necessarily adopt the same camp type
Oroxzy Aug 4, 2022
055a0e0
Merge branch 'development' into scourge_invasion_fixes2
Oroxzy Aug 15, 2022
ca2a9d8
miau
Oroxzy Aug 29, 2022
d4ba23d
next
Oroxzy Oct 29, 2022
316367d
Merge remote-tracking branch 'upstream/development' into scourge_inva…
Oroxzy Oct 29, 2022
7cf9791
next
Oroxzy Nov 1, 2022
bb3c6f8
Update 20220806100341_world.sql
Oroxzy Nov 1, 2022
22b2b57
Update 20220806100341_world.sql
Oroxzy Nov 1, 2022
92dbb02
next
Oroxzy Nov 1, 2022
e433797
Update 20220806100341_world.sql
Oroxzy Nov 1, 2022
8ab1eb4
next
Oroxzy Nov 1, 2022
5e27480
next
Oroxzy Nov 1, 2022
eddbd22
whooopooo
Oroxzy Nov 3, 2022
cc06ac3
next
Oroxzy Nov 4, 2022
44170ed
Merge remote-tracking branch 'upstream/development' into scourge_inva…
Oroxzy Nov 4, 2022
21541d1
next
Oroxzy Nov 4, 2022
d4918b8
Update 20220806100341_world.sql
Oroxzy Nov 5, 2022
c96e8d6
next
Oroxzy Nov 8, 2022
1bc208e
next
Oroxzy Nov 9, 2022
4edf859
next
Oroxzy Nov 12, 2022
a7dce2a
Merge remote-tracking branch 'upstream/development' into scourge_inva…
Oroxzy Nov 13, 2022
d9c9d62
Update 20220806100341_world.sql
Oroxzy Nov 13, 2022
e369b75
next
Oroxzy Nov 16, 2022
cceb32d
next
Oroxzy Nov 20, 2022
2efd1a8
Update 20220806100341_world.sql
Oroxzy Nov 20, 2022
835653f
Update 20220806100341_world.sql
Oroxzy Nov 20, 2022
9e236d5
next
Oroxzy Nov 21, 2022
d15b566
next
Oroxzy Nov 26, 2022
6f05f7c
idk
Oroxzy Nov 26, 2022
2c7c3ae
next
Oroxzy Nov 27, 2022
49d298b
Merge remote-tracking branch 'upstream/development' into scourge_inva…
Oroxzy Nov 29, 2022
2cebde4
next
Oroxzy Dec 1, 2022
393be4e
Update 20220806100341_world.sql
Oroxzy Dec 1, 2022
00ce0b0
Update 20220806100341_world.sql
Oroxzy Dec 2, 2022
0555496
next
Oroxzy Dec 5, 2022
d769cc4
next
Oroxzy Dec 7, 2022
118764b
next
Oroxzy Dec 9, 2022
fa6d7a2
next
Oroxzy Dec 11, 2022
02924cf
Update 20220806100341_world.sql
Oroxzy Dec 11, 2022
42d19ce
next
Oroxzy Dec 19, 2022
520ffc0
next
Oroxzy Dec 21, 2022
b98da6b
Update 20220806100341_world.sql
Oroxzy Dec 24, 2022
915a202
Update 20220806100341_world.sql
Oroxzy Dec 24, 2022
0c31930
Update 20220806100341_world.sql
Oroxzy Dec 24, 2022
3d90dca
Update 20220806100341_world.sql
Oroxzy Dec 25, 2022
04e1491
Merge remote-tracking branch 'upstream/development' into scourge_inva…
Oroxzy Dec 28, 2022
ff07868
next
Oroxzy Dec 30, 2022
fa1c27a
Update 20220806100341_world.sql
Oroxzy Dec 30, 2022
45e3eb4
Merge remote-tracking branch 'upstream/development' into scourge_inva…
Oroxzy Dec 31, 2022
ffa328d
Merge remote-tracking branch 'upstream/development' into scourge_inva…
Oroxzy Jan 1, 2023
31114c9
next
Oroxzy Jan 4, 2023
fbd45b2
Merge remote-tracking branch 'upstream/development' into scourge_inva…
Oroxzy Feb 19, 2023
541f9ed
Merge remote-tracking branch 'upstream/development' into scourge_inva…
Oroxzy Mar 4, 2023
dfefdfd
idk
Oroxzy Mar 4, 2023
ca75f7e
Merge remote-tracking branch 'upstream/development' into scourge_inva…
Oroxzy Apr 27, 2023
cdc9995
fix sql
Oroxzy Apr 27, 2023
4445733
Merge remote-tracking branch 'upstream/development' into scourge_inva…
Oroxzy May 13, 2023
b8616cb
Merge remote-tracking branch 'upstream/development' into scourge_inva…
Oroxzy Jun 18, 2023
dc2bafa
Merge remote-tracking branch 'upstream/development' into scourge_inva…
Oroxzy Jun 26, 2023
8f4fcce
Merge remote-tracking branch 'upstream/development' into scourge_inva…
Oroxzy Jul 29, 2023
b02f96b
fix
Oroxzy Jul 30, 2023
489c974
Merge remote-tracking branch 'upstream/development' into scourge_inva…
Oroxzy Sep 17, 2023
845a467
Update SpellEffects.cpp
Oroxzy Sep 17, 2023
764795c
Update 20220806100341_world.sql
Oroxzy Sep 18, 2023
ef7d1db
fixes
Oroxzy Sep 26, 2023
ca45f8a
Update 20220806100341_world.sql
Oroxzy Sep 28, 2023
4cbd7f9
Merge remote-tracking branch 'upstream/development' into scourge_inva…
Oroxzy Nov 14, 2023
b82437d
Merge remote-tracking branch 'upstream/development' into scourge_inva…
Oroxzy Mar 9, 2024
507a861
Merge remote-tracking branch 'upstream/development' into scourge_inva…
Oroxzy Mar 17, 2024
a22ef54
Update 20220806100341_world.sql
Oroxzy Mar 17, 2024
3bc66ba
yeye
Oroxzy Mar 17, 2024
871ec83
Update 20220806100341_world.sql
Oroxzy Mar 17, 2024
e304783
Update 20220806100341_world.sql
Oroxzy Mar 21, 2024
904ae51
Merge remote-tracking branch 'upstream/development' into scourge_inva…
Oroxzy Aug 3, 2024
89080ef
Merge remote-tracking branch 'upstream/development' into scourge_inva…
Oroxzy Jan 26, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9,451 changes: 9,451 additions & 0 deletions sql/migrations/20220806100341_world.sql

Large diffs are not rendered by default.

703 changes: 8 additions & 695 deletions src/game/HardcodedEvents.cpp

Large diffs are not rendered by default.

56 changes: 0 additions & 56 deletions src/game/HardcodedEvents.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,67 +170,11 @@ struct ScourgeInvasionEvent : WorldEvent
ScourgeInvasionEvent();

void Update() override;
uint32 GetZoneTime(uint32 zoneId);
void LogNextZoneTime();
void EnableAndStartEvent(uint16 event_id);
void DisableAndStopEvent(uint16 event_id);
void HandleDefendedZones();
void Enable() override;
void Disable() override;
uint32 GetNextUpdateDelay() override;

private:
struct InvasionZone
{
uint32 map;
uint32 zoneId;
uint32 remainingVar;
uint32 necroAmount;
ObjectGuid mouthGuid;
std::vector<Position> mouth;
};

struct CityAttack
{
uint32 map;
uint32 zoneId;
ObjectGuid pallidGuid;
std::vector<Position> pallid;
};

bool invasion1Loaded;
bool invasion2Loaded;
bool invasion3Loaded;
bool invasion4Loaded;
bool invasion5Loaded;
bool invasion6Loaded;

bool undercityLoaded;
bool stormwindLoaded;

void HandleActiveZone(uint32 attackTimeVar, uint32 zoneId, uint32 remainingVar, time_t now);
void HandleActiveCity(uint32 attackTimeVar, time_t now, uint32 zoneId);

bool OnEnable(uint32 zoneId, uint32 attackTimeVar);

void StartNewInvasionIfTime(uint32 timeVariable, uint32 zoneVariable);
void StartNewCityAttackIfTime(uint32 timeVariable, uint32 zoneVariable);
bool ResumeInvasion(uint32 zoneId);
bool SummonMouth(Map* pMap, InvasionZone* zone, Position position);
bool SummonPallid(Map* pMap, CityAttack* zone, Position position, uint32 spawnLoc);

Map* GetMap(uint32 mapId, Position const& invZone);
bool isValidZoneId(uint32 zoneId);
bool isActiveZone(uint32 zoneId);
uint32 GetActiveZones();
InvasionZone* GetInvasionZone(uint32 zoneId);
CityAttack* GetCityZone(uint32 zoneId);

void UpdateWorldState();

std::vector<InvasionZone> invasionPoints;
std::vector<CityAttack> attackPoints;
int previousRemainingCounts[6];
};

enum WarEffortEventStage
Expand Down
3 changes: 2 additions & 1 deletion src/game/Maps/Pool/PoolManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -846,7 +846,8 @@ void PoolManager::LoadFromDB()
if (goinfo->type != GAMEOBJECT_TYPE_CHEST &&
goinfo->type != GAMEOBJECT_TYPE_GOOBER &&
goinfo->type != GAMEOBJECT_TYPE_FISHINGHOLE &&
goinfo->type != GAMEOBJECT_TYPE_SPELL_FOCUS)
goinfo->type != GAMEOBJECT_TYPE_SPELL_FOCUS &&
goinfo->type != GAMEOBJECT_TYPE_GENERIC)
{
sLog.Out(LOG_DBERROR, LOG_LVL_MINIMAL, "`%s` has a not lootable gameobject spawn (GUID: %u, type: %u) defined for pool id (%u), skipped.", table, guid, goinfo->type, pool_id);
continue;
Expand Down
5 changes: 4 additions & 1 deletion src/game/Maps/ScriptCommands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2222,7 +2222,10 @@ bool Map::ScriptCommand_JoinCreatureGroup(ScriptInfo const& script, WorldObject*
return ShouldAbortScript(script);
}

pSource->JoinCreatureGroup(pTarget, script.x, script.o, script.joinCreatureGroup.options);
if (script.x == 0 && script.o == 0)
pSource->JoinCreatureGroup(pTarget, pSource->GetDistance3dToCenter(pTarget), pSource->GetAngle(pTarget), script.joinCreatureGroup.options);
else
pSource->JoinCreatureGroup(pTarget, script.x, script.o, script.joinCreatureGroup.options);

return false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/game/Objects/Creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3341,7 +3341,7 @@ void Creature::DisappearAndDie()
{
if (!IsInWorld())
{
sLog.Out(LOG_BASIC, LOG_LVL_MINIMAL, "[CRASH][%s]DisappearAndDie: le mob n'est pas InWorld.", GetName());
sLog.Out(LOG_BASIC, LOG_LVL_MINIMAL, "[CRASH][%s]DisappearAndDie: the mob is not In World.", GetName());
return;
}

Expand Down
16 changes: 8 additions & 8 deletions src/game/Objects/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8467,23 +8467,23 @@ void Player::SendInitWorldStates(uint32 zoneid) const
// Scourge Invasion - Patch 1.11
if (sGameEventMgr.IsActiveEvent(GAME_EVENT_SCOURGE_INVASION))
{
int VICTORIES = sObjectMgr.GetSavedVariable(VARIABLE_SI_ATTACK_COUNT);
int VICTORIES = sObjectMgr.GetSavedVariable(VARIABLE_SI_VICTORIES);
int REMAINING_AZSHARA = sObjectMgr.GetSavedVariable(VARIABLE_SI_AZSHARA_REMAINING);
int REMAINING_BLASTED_LANDS = sObjectMgr.GetSavedVariable(VARIABLE_SI_BLASTED_LANDS_REMAINING);
int REMAINING_BURNING_STEPPES = sObjectMgr.GetSavedVariable(VARIABLE_SI_BURNING_STEPPES_REMAINING);
int REMAINING_EASTERN_PLAGUELANDS = sObjectMgr.GetSavedVariable(VARIABLE_SI_EASTERN_PLAGUELANDS_REMAINING);
int REMAINING_TANARIS = sObjectMgr.GetSavedVariable(VARIABLE_SI_TANARIS_REMAINING);
int REMAINING_WINTERSPRING = sObjectMgr.GetSavedVariable(VARIABLE_SI_WINTERSPRING_REMAINING);

data << uint32(WORLDSTATE_AZSHARA) << uint32(REMAINING_AZSHARA > 0 ? 1 : 0);
data << uint32(WORLDSTATE_BLASTED_LANDS) << uint32(REMAINING_BLASTED_LANDS > 0 ? 1 : 0);
data << uint32(WORLDSTATE_BURNING_STEPPES) << uint32(REMAINING_BURNING_STEPPES > 0 ? 1 : 0);
data << uint32(WORLDSTATE_EASTERN_PLAGUELANDS) << uint32(REMAINING_EASTERN_PLAGUELANDS > 0 ? 1 : 0);
data << uint32(WORLDSTATE_TANARIS) << uint32(REMAINING_TANARIS > 0 ? 1 : 0);
data << uint32(WORLDSTATE_WINTERSPRING) << uint32(REMAINING_WINTERSPRING > 0 ? 1 : 0);
data << uint32(WORLDSTATE_AZSHARA) << uint32(sGameEventMgr.IsActiveEvent(GAME_EVENT_SCOURGE_INVASION_AZSHARA) ? 1 : 0);
data << uint32(WORLDSTATE_BLASTED_LANDS) << uint32(sGameEventMgr.IsActiveEvent(GAME_EVENT_SCOURGE_INVASION_BLASTED_LANDS) ? 1 : 0);
data << uint32(WORLDSTATE_BURNING_STEPPES) << uint32(sGameEventMgr.IsActiveEvent(GAME_EVENT_SCOURGE_INVASION_BURNING_STEPPES) ? 1 : 0);
data << uint32(WORLDSTATE_EASTERN_PLAGUELANDS) << uint32(sGameEventMgr.IsActiveEvent(GAME_EVENT_SCOURGE_INVASION_EASTERN_PLAGUELANDS) ? 1 : 0);
data << uint32(WORLDSTATE_TANARIS) << uint32(sGameEventMgr.IsActiveEvent(GAME_EVENT_SCOURGE_INVASION_TANARIS) ? 1 : 0);
data << uint32(WORLDSTATE_WINTERSPRING) << uint32(sGameEventMgr.IsActiveEvent(GAME_EVENT_SCOURGE_INVASION_WINTERSPRING) ? 1 : 0);

// Battles & remaining necropolisses
data << uint32(WORLDSTATE_SI_BATTLES_WON) << uint32(VICTORIES);
data << uint32(WORLDSTATE_SI_VICTORIES) << uint32(VICTORIES);
data << uint32(WORLDSTATE_SI_AZSHARA_REMAINING) << uint32(REMAINING_AZSHARA);
data << uint32(WORLDSTATE_SI_BLASTED_LANDS_REMAINING) << uint32(REMAINING_BLASTED_LANDS);
data << uint32(WORLDSTATE_SI_BURNING_STEPPES_REMAINING) << uint32(REMAINING_BURNING_STEPPES);
Expand Down
10 changes: 6 additions & 4 deletions src/game/Spells/Spell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
#include "PathFinder.h"
#include "CharacterDatabaseCache.h"
#include "ZoneScript.h"
#include "scriptPCH.h"


using namespace Spells;

Expand Down Expand Up @@ -2664,16 +2666,16 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
if (i_spellST->second.type == SPELL_TARGET_TYPE_GAMEOBJECT)
{
// search all GO's with entry, within range of m_destN
MaNGOS::GameObjectEntryInPosRangeCheck go_check(*m_caster, i_spellST->second.targetEntry, x, y, z, radius);
MaNGOS::GameObjectListSearcher<MaNGOS::GameObjectEntryInPosRangeCheck> checker(tempTargetGOList, go_check);
Cell::VisitGridObjects(m_caster, checker, radius);
GetGameObjectListWithEntryInGrid(tempTargetGOList, m_casterUnit, i_spellST->second.targetEntry, radius);
tempTargetGOList.sort(ObjectDistanceOrder(m_casterUnit));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wtf are these changes to spell target code? it is supposed to search around the x, y, z which are set above according to target type
you are also assuming caster is always unit by using m_casterUnit, which can crash server

}
}

if (!tempTargetGOList.empty())
{
for (const auto& iter : tempTargetGOList)
AddGOTarget(iter, effIndex);
if (iter->isSpawned())
AddGOTarget(iter, effIndex);
}

break;
Expand Down
31 changes: 31 additions & 0 deletions src/game/Spells/SpellAuras.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1762,6 +1762,37 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
m_modifier.periodictime = 5 * IN_MILLISECONDS; // expected to tick with 5 sec period
return;
}
case 17680: // [Event: Scourge Invasion] Spirit Spawn-out
{
if (Creature* pCreature = ToCreature(GetCaster()))
{
if (pCreature->IsAlive() && !pCreature->HasCreatureState(CSTATE_DESPAWNING))
pCreature->DespawnOrUnsummon(2000);
}
return;
}
case 27852: // [Event: Scourge Invasion] [PH] Kill Summoner Buff
{
if (Creature* pCreature = ToCreature(GetCaster())) // Casted by Cultist Engineer
{
if (Player* pPlayer = ToPlayer(target)) // Target is Player
{
pPlayer->CastSpell(pCreature, 27894, true); // Kill Summoner, who will Summon Boss
}
}
return;
}
case 31316: // [Event: Scourge Invasion] Summon Boss Buff
{
if (Creature* pCreature = ToCreature(GetCaster())) // Casted by Cultist Engineer
{
if (Player* pPlayer = ToPlayer(target)) // Target is Player
{
pPlayer->CastSpell(pPlayer, 31315, true); // Summon Boss
}
}
return;
}
case 21827: // Frostwolf Aura DND
case 21863: // Alterac Ram Aura DND
{
Expand Down
157 changes: 153 additions & 4 deletions src/game/Spells/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
#include "InstanceData.h"
#include "ScriptMgr.h"
#include "SocialMgr.h"
#include "TemporarySummon.h"
#include "scriptPCH.h"


using namespace Spells;

Expand Down Expand Up @@ -413,11 +416,35 @@ void Spell::EffectSchoolDMG(SpellEffectIndex effect_idx)
damage = 0;
break;
}
case 24933: // Cannon (Darkmoon Steam Tonk)
case 24933: // Cannon (Darkmoon Steam Tonk)
{
m_caster->CastSpell(unitTarget, 27766, true);
break;
}
case 28056: // [Event: Scourge Invasion] Zap Crystal Corpse
{
if (unitTarget->GetEntry() == 16172) // Damaged Necrotic Shard
{
if (m_caster->GetEntry() == 16143) // Casted by Shadow of Doom.
damage = unitTarget->CountPctFromMaxHealth(25);
else // Casted by Damaged Necrotic Shard. https://classic.wowhead.com/spell=348571/zap-crystal-corpse
damage = unitTarget->CountPctFromMaxHealth(6);
}
break;
}
case 28386: // [Event: Scourge Invasion] Zap Necropolis
{
if (unitTarget->GetEntry() == 16421) // Necropolis health
{
/*
This Spell is castet on the NPC "Necropolis Health" if a Shard dies.
There are always 3 Necrotic Shards spawns per Necropolis.
*/
unitTarget->SetArmor(0);
damage = unitTarget->CountPctFromMaxHealth(34);
}
break;
}
}
break;
}
Expand Down Expand Up @@ -587,20 +614,87 @@ void Spell::EffectDummy(SpellEffectIndex effIdx)
pCaster->m_Events.AddLambdaEventAtOffset([pCaster, spellId]
{
pCaster->CastSpell(pCaster, spellId, false);
}, 1);
}, 500);
return;
}
case 10389: // [Event: Scourge Invasion] Spawn Smoke
{
if (Creature* pCreature = ToCreature(m_casterUnit))
{
// This should be already set in creature_template, otherwise the player will quickly enter and leave combat on spawn and thats not Blizzlike.
pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PLAYER);
pCreature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_NPC);

// This is the only way to get it Blizzlike... (And who knows? maybe it is!)
pCreature->m_Events.AddLambdaEventAtOffset([pCreature]
{
if (pCreature->IsTemporarySummon())
{
if (Player* player = pCreature->GetMap()->GetPlayer(((TemporarySummon*)pCreature)->GetSummonerGuid()))
{
pCreature->GetThreatManager().addThreat(player, 1.0f);
// DoScriptText(PickRandomValue(12420, 12421, 12422, 12243), pCreature, player, CHAT_TYPE_SAY);
}
}
}, 1);
}
return;
}
case 27894: // [Event: Scourge Invasion] Kill Summoner, who will Summon Boss
{
Player* pPlayer = ToPlayer(m_casterUnit);
{
if (Creature* pCreature = ToCreature(unitTarget)) // Target is Cultist Engineer
{
pCreature->CastSpell(pPlayer, 31316, true); // Summon Boss Buff
pCreature->CastSpell(pCreature, 3617, true); // Quiet Suicide
}
}
return;
}
case 28091: // [Event: Scourge Invasion] (Despawner, self) triggers (Spirit Spawn-out)?
{
if (!m_casterUnit->IsInCombat())
m_casterUnit->CastSpell(m_casterUnit, 17680, false);
m_casterUnit->CastSpell(m_casterUnit, 17680, false);
return;
}
case 28203: // [Event: Scourge Invasion] Find Camp Type
{

// Lets the finder spawn the associated spawner.
if (unitTarget->HasAura(28197))
m_casterUnit->CastSpell(m_casterUnit, 28186, true);
else if (unitTarget->HasAura(28198))
m_casterUnit->CastSpell(m_casterUnit, 27883, true);
else if (unitTarget->HasAura(28199))
m_casterUnit->CastSpell(m_casterUnit, 28187, true);

return;
}
case 28345: // [Event: Scourge Invasion] (Communique Trigger) triggers (Communique, Camp-to-Relay)?
{
unitTarget->CastSpell(unitTarget, 28281, true);
return;
}
case 28349: // [Event: Scourge Invasion] Despawner, other
{
std::list<GameObject*> necropolisList;
GetGameObjectListWithEntryInGrid(necropolisList, unitTarget, { 181154,181373,181374,181215,181223 }, ATTACK_DISTANCE);
for (const auto pNecropolis : necropolisList)
pNecropolis->Despawn();

unitTarget->ToCreature()->RemoveFromWorld();
m_casterUnit->ToCreature()->RemoveFromWorld();
return;
}
case 28351: // [Event: Scourge Invasion] Communique, Camp-to-Relay, Death
{
if (Creature* pCreature = ToCreature(m_casterUnit))
{
pCreature->DisappearAndDie();
pCreature->RemoveFromWorld();
}
return;
}
case 23383: // Alliance Flag Click
case 23384: // Horde Flag Click
{
Expand Down Expand Up @@ -5015,6 +5109,61 @@ void Spell::EffectScriptEffect(SpellEffectIndex effIdx)
unitTarget->CastSpell(unitTarget, 27699, true);
return;
}
case 28201: // [Event: Scourge Invasion] Choose Camp Type
{
// Casted by Necrotic Shard and Damaged Necrotic Shard on spawn. They should have 0 Armor and a huge visibility.
m_casterUnit->SetArmor(0);
m_casterUnit->SetActiveObjectState(true);
m_casterUnit->SetVisibilityModifier(DEFAULT_VISIBILITY_BG);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is correct, they have a set visibility distance already set. Perhaps just set the active state for these camps.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the shard is spawned by a spell, i can't change the visibilty in the database.

m_casterUnit->CastSpell(m_casterUnit, PickRandomValue(28199, 28198, 28197), true);
return;
}
case 28314: // [Event: Scourge Invasion] Flameshocker's Touch
{
m_casterUnit->CastSpell(unitTarget, 28329, true);
return;
}
case 28183: // [Event: Scourge Invasion] [PH] Summon Minion parent (ghost/ghoul)
case 28184: // [Event: Scourge Invasion] [PH] Summon Minion parent (ghost/skeleton)
case 28185: // [Event: Scourge Invasion] [PH] Summon Minion parent (ghoul/skeleton)
{
// 0.2% Chance of a Rare Spawn.
uint32 roll = urand(1, 500);

bool UncommonMinionspawner = false;
bool CanSummon = true;

if (roll == 1)
UncommonMinionspawner = true;

uint32 Entry = PickRandomValue(16298, 16141, 16299); // just in case.

switch (m_spellInfo->Id)
{
case 28183: Entry = UncommonMinionspawner ? PickRandomValue(16379, 14697) : PickRandomValue(16298, 16141); break;
case 28184: Entry = UncommonMinionspawner ? PickRandomValue(16379, 16380) : PickRandomValue(16298, 16299); break;
case 28185: Entry = UncommonMinionspawner ? PickRandomValue(14697, 16380) : PickRandomValue(16141, 16299); break;
default: Entry = PickRandomValue(16298, 16141, 16299); break;
}

std::list<Creature*> minions;
GetCreatureListWithEntryInGrid(minions, m_casterUnit, { 16299, 16141, 16298, 14697, 16380, 16379 }, INTERACTION_DISTANCE);

for (const auto pMinion : minions)
if (pMinion->IsAlive())
CanSummon = false;

if (CanSummon)
{
if (Creature* pMinion = m_casterUnit->SummonCreature(Entry, m_casterUnit->GetPositionX(), m_casterUnit->GetPositionY(), m_casterUnit->GetPositionZ(), m_casterUnit->GetOrientation(), TEMPSUMMON_TIMED_OR_DEAD_DESPAWN, IN_MILLISECONDS * HOUR, true, IN_MILLISECONDS * 2))
{
m_casterUnit->SendSpellGo(m_casterUnit, 28234);
UncommonMinionspawner ? pMinion->SetWanderDistance(5.0f) : pMinion->SetWanderDistance(1.0f); // Seems to be very low for common Minions but not for Rares.
}
}

return;
}
case 28374: // Decimate (Naxxramas: Gluth)
{
//implemented in SpellEffects::EffectSchoolDMG instead, under case 28375
Expand Down
Loading