mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Scenarios: Allow scripts to set instance scenario by id (#31104)
* add example at Stratholme service entrance
This commit is contained in:
@@ -33,7 +33,9 @@ EndContentData */
|
||||
#include "GameObject.h"
|
||||
#include "GameObjectAI.h"
|
||||
#include "Group.h"
|
||||
#include "ScenarioMgr.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "Map.h"
|
||||
#include "MotionMaster.h"
|
||||
#include "ObjectAccessor.h"
|
||||
#include "Player.h"
|
||||
@@ -388,6 +390,25 @@ class spell_stratholme_haunting_phantoms : public AuraScript
|
||||
}
|
||||
};
|
||||
|
||||
static constexpr uint32 StratholmeLfgDungeonServiceEntrance = 274;
|
||||
static constexpr uint32 StratholmeScenarioServiceEntrance = 637;
|
||||
|
||||
// 10107 - Areatrigger
|
||||
class at_stratholme_service_entrance : public OnlyOnceAreaTriggerScript
|
||||
{
|
||||
public:
|
||||
at_stratholme_service_entrance() : OnlyOnceAreaTriggerScript("at_stratholme_service_entrance") { }
|
||||
|
||||
bool TryHandleOnce(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override
|
||||
{
|
||||
if (InstanceMap* map = player->GetMap()->ToInstanceMap())
|
||||
if (map->GetLfgDungeonsId() == StratholmeLfgDungeonServiceEntrance)
|
||||
map->SetInstanceScenario(sScenarioMgr->CreateInstanceScenario(map, StratholmeScenarioServiceEntrance));
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_stratholme()
|
||||
{
|
||||
new go_gauntlet_gate();
|
||||
@@ -395,4 +416,5 @@ void AddSC_stratholme()
|
||||
new npc_spectral_ghostly_citizen();
|
||||
RegisterSpellScript(spell_ysida_saved_credit);
|
||||
RegisterSpellScript(spell_stratholme_haunting_phantoms);
|
||||
new at_stratholme_service_entrance();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user