feat(Core/WorldState): improved WorldState scripting (#20141)
* implement world state script based on https://github.com/cmangos/mangos-wotlk/commit/0b87ca9d9edf2d4752a3c0f8e9cf85c6689ca861 Co-authored-by: killerwife <killerwife@gmail.com> * refactor to use onleave and onenter instead of spell_area allows players to right click remove adal's buff * add MapMgr.h * refactor: use condition enum instead of uint32, prefix WORLD_STATE where needed * remove lock from WorldState::Update sWorldState->Update() is only called from World::Update * remove unsafe SmartAI action of setWorldState --------- Co-authored-by: killerwife <killerwife@gmail.com>
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
#include "ScriptedGossip.h"
|
||||
#include "SpellScript.h"
|
||||
#include "SpellScriptLoader.h"
|
||||
#include "WorldState.h"
|
||||
|
||||
enum q10935Exorcism
|
||||
{
|
||||
@@ -602,6 +603,26 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
struct go_magtheridons_head : public GameObjectAI
|
||||
{
|
||||
go_magtheridons_head(GameObject* gameObject) : GameObjectAI(gameObject) { }
|
||||
|
||||
void InitializeAI() override
|
||||
{
|
||||
me->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); // spawn head on spike
|
||||
me->SetGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
|
||||
sWorldState->HandleExternalEvent(WORLD_STATE_CUSTOM_EVENT_ON_MAGTHERIDON_HEAD_SPAWN, me->GetPositionX() > 0.f ? TEAM_HORDE : TEAM_ALLIANCE);
|
||||
}
|
||||
|
||||
void OnStateChanged(uint32 state, Unit* /*unit*/) override
|
||||
{
|
||||
if (state == GO_JUST_DEACTIVATED)
|
||||
{
|
||||
sWorldState->HandleExternalEvent(WORLD_STATE_CUSTOM_EVENT_ON_MAGTHERIDON_HEAD_DESPAWN, me->GetPositionX() > 0.f ? TEAM_HORDE : TEAM_ALLIANCE);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_hellfire_peninsula()
|
||||
{
|
||||
// Ours
|
||||
@@ -615,4 +636,5 @@ void AddSC_hellfire_peninsula()
|
||||
new go_beacon();
|
||||
|
||||
RegisterCreatureAI(npc_magister_aledis);
|
||||
RegisterGameObjectAI(go_magtheridons_head);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user