From e581a52dbd7682677f1a608b08a636bc92c5b975 Mon Sep 17 00:00:00 2001 From: Grz3s Date: Wed, 21 Feb 2024 00:05:13 +0100 Subject: [PATCH] Icecrown: support for random groups Part of DB update --- .../scripts/northrend/world_northrend.cpp | 36 +++++++++++++++++++ src/game/World/WorldStateDefines.h | 9 +++++ 2 files changed, 45 insertions(+) diff --git a/src/game/AI/ScriptDevAI/scripts/northrend/world_northrend.cpp b/src/game/AI/ScriptDevAI/scripts/northrend/world_northrend.cpp index 7d9231f7e2a..b0c966b951f 100644 --- a/src/game/AI/ScriptDevAI/scripts/northrend/world_northrend.cpp +++ b/src/game/AI/ScriptDevAI/scripts/northrend/world_northrend.cpp @@ -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) @@ -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) diff --git a/src/game/World/WorldStateDefines.h b/src/game/World/WorldStateDefines.h index 0221fb93b61..f1a58ea82d6 100644 --- a/src/game/World/WorldStateDefines.h +++ b/src/game/World/WorldStateDefines.h @@ -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,