Skip to content

Commit

Permalink
Icecrown: support for random groups
Browse files Browse the repository at this point in the history
Part of DB update
  • Loading branch information
Grz3s authored and killerwife committed Feb 21, 2024
1 parent a4648af commit 8056ceb
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/game/AI/ScriptDevAI/scripts/northrend/world_northrend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "AI/ScriptDevAI/include/sc_common.h"
#include "world_northrend.h"
#include "World/WorldStateDefines.h"
#include "AI/ScriptDevAI/scripts/world/world_map_scripts.h"

world_map_northrend::world_map_northrend(Map* map) : ScriptedMap(map)
Expand All @@ -25,10 +26,45 @@ world_map_northrend::world_map_northrend(Map* map) : ScriptedMap(map)

void world_map_northrend::Initialize()
{
instance->GetVariableManager().SetVariable(WORLD_STATE_CUSTOM_ICC_GRP_01, urand(0, 1));
instance->GetVariableManager().SetVariable(WORLD_STATE_CUSTOM_ICC_GRP_02, urand(0, 1));
instance->GetVariableManager().SetVariable(WORLD_STATE_CUSTOM_ICC_GRP_03, urand(0, 1));
instance->GetVariableManager().SetVariable(WORLD_STATE_CUSTOM_ICC_GRP_04, urand(0, 1));
instance->GetVariableManager().SetVariable(WORLD_STATE_CUSTOM_ICC_GRP_05, urand(0, 1));
instance->GetVariableManager().SetVariable(WORLD_STATE_CUSTOM_ICC_GRP_06, urand(0, 1));
instance->GetVariableManager().SetVariable(WORLD_STATE_CUSTOM_ICC_GRP_07, urand(0, 1));
instance->GetVariableManager().SetVariable(WORLD_STATE_CUSTOM_ICC_GRP_08, urand(0, 1));
}

void world_map_northrend::OnCreatureGroupDespawn(CreatureGroup* creatureGroup, Creature* creature)
{
switch (creatureGroup->GetGroupEntry().WorldStateCondition)
{
case 25000: case 25001: // TODO: Propagate respawn info so they do not instant respawn
instance->GetVariableManager().SetVariable(WORLD_STATE_CUSTOM_ICC_GRP_01, urand(0, 1));
break;
case 25002: case 25003:
instance->GetVariableManager().SetVariable(WORLD_STATE_CUSTOM_ICC_GRP_02, urand(0, 1));
break;
case 25004: case 25005:
instance->GetVariableManager().SetVariable(WORLD_STATE_CUSTOM_ICC_GRP_03, urand(0, 1));
break;
case 25006: case 25007:
instance->GetVariableManager().SetVariable(WORLD_STATE_CUSTOM_ICC_GRP_04, urand(0, 1));
break;
case 25008: case 25009:
instance->GetVariableManager().SetVariable(WORLD_STATE_CUSTOM_ICC_GRP_05, urand(0, 1));
break;
case 25010: case 25011:
instance->GetVariableManager().SetVariable(WORLD_STATE_CUSTOM_ICC_GRP_06, urand(0, 1));
break;
case 25012: case 25013:
instance->GetVariableManager().SetVariable(WORLD_STATE_CUSTOM_ICC_GRP_07, urand(0, 1));
break;
case 25014: case 25015:
instance->GetVariableManager().SetVariable(WORLD_STATE_CUSTOM_ICC_GRP_08, urand(0, 1));
break;
}
}

void world_map_northrend::OnCreatureCreate(Creature* creature)
Expand Down
9 changes: 9 additions & 0 deletions src/game/World/WorldStateDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,15 @@ enum WorldStateID : int32
WORLD_STATE_CUSTOM_COREN_DIREBREW_DUNGEON = 20002,
WORLD_STATE_CUSTOM_CROWN_CHEMICAL_CO_DUNGEON = 20003,

WORLD_STATE_CUSTOM_ICC_GRP_01 = 350001,
WORLD_STATE_CUSTOM_ICC_GRP_02 = 350002,
WORLD_STATE_CUSTOM_ICC_GRP_03 = 350003,
WORLD_STATE_CUSTOM_ICC_GRP_04 = 350004,
WORLD_STATE_CUSTOM_ICC_GRP_05 = 350005,
WORLD_STATE_CUSTOM_ICC_GRP_06 = 350006,
WORLD_STATE_CUSTOM_ICC_GRP_07 = 350007,
WORLD_STATE_CUSTOM_ICC_GRP_08 = 350008,

// Obsidian Sanctum
WORLD_STATE_CUSTOM_SPAWN_FLAME_WALL_LEFT = 20004,
WORLD_STATE_CUSTOM_SPAWN_FLAME_WALL_RIGHT = 20005,
Expand Down

0 comments on commit 8056ceb

Please sign in to comment.