Skip to content

Commit

Permalink
STV: Add support for randomized spawn groups prototype
Browse files Browse the repository at this point in the history
  • Loading branch information
killerwife committed Jan 13, 2024
1 parent 204e707 commit 93af480
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,29 @@
*/
struct world_map_eastern_kingdoms : public ScriptedMap
{
world_map_eastern_kingdoms(Map* pMap) : ScriptedMap(pMap) {}
world_map_eastern_kingdoms(Map* pMap) : ScriptedMap(pMap)
{
Initialize();
}

void Initialize() override
{
instance->GetVariableManager().SetVariable(WORLD_STATE_CUSTOM_STV_GRP_01, urand(0, 1));
instance->GetVariableManager().SetVariable(WORLD_STATE_CUSTOM_STV_GRP_02, urand(0, 1));
}

void OnCreatureGroupDespawn(CreatureGroup* creatureGroup, Creature* /*creature*/) override
{
switch (creatureGroup->GetGroupEntry().WorldStateCondition)
{
case 9900: case 9901: // TODO: Propagate respawn info so they do not instant respawn
instance->GetVariableManager().SetVariable(WORLD_STATE_CUSTOM_STV_GRP_01, urand(0, 1));
break;
case 9902: case 9903:
instance->GetVariableManager().SetVariable(WORLD_STATE_CUSTOM_STV_GRP_02, urand(0, 1));
break;
}
}

void OnCreatureCreate(Creature* pCreature) override
{
Expand Down
3 changes: 3 additions & 0 deletions src/game/World/WorldStateDefines.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,9 @@ enum WorldStateID : int32
// Vanilla
WORLD_STATE_CUSTOM_SPAWN_ANNORA = 700001,

WORLD_STATE_CUSTOM_STV_GRP_01 = 330001,
WORLD_STATE_CUSTOM_STV_GRP_02 = 330002,

// Tbc

// Wotlk
Expand Down

0 comments on commit 93af480

Please sign in to comment.