Script for aborting a wbl zone transfer (#766)

This commit is contained in:
Aaron Kimbrell 2022-09-02 13:49:38 -05:00 committed by GitHub
parent 26f2eb409f
commit 14d4bf3cc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 29 additions and 0 deletions

View File

@ -247,6 +247,7 @@ set(DSCRIPT_SOURCES "ActivityManager.cpp"
"WaveBossHammerling.cpp" "WaveBossHammerling.cpp"
"WaveBossHorsemen.cpp" "WaveBossHorsemen.cpp"
"WaveBossSpiderling.cpp" "WaveBossSpiderling.cpp"
"WblGenericZone.cpp"
"WhFans.cpp" "WhFans.cpp"
"WildAmbients.cpp" "WildAmbients.cpp"
"WishingWellServer.cpp" "WishingWellServer.cpp"

View File

@ -288,6 +288,9 @@
#include "RockHydrantBroken.h" #include "RockHydrantBroken.h"
#include "WhFans.h" #include "WhFans.h"
// WBL scripts
#include "WblGenericZone.h"
//Big bad global bc this is a namespace and not a class: //Big bad global bc this is a namespace and not a class:
InvalidScript* invalidToReturn = new InvalidScript(); InvalidScript* invalidToReturn = new InvalidScript();
std::map<std::string, CppScripts::Script*> m_Scripts; std::map<std::string, CppScripts::Script*> m_Scripts;
@ -834,12 +837,17 @@ CppScripts::Script* CppScripts::GetScript(Entity* parent, const std::string& scr
script = new BuccaneerValiantShip(); script = new BuccaneerValiantShip();
else if (scriptName == "scripts\\EquipmentScripts\\FireFirstSkillonStartup.lua") else if (scriptName == "scripts\\EquipmentScripts\\FireFirstSkillonStartup.lua")
script = new FireFirstSkillonStartup(); script = new FireFirstSkillonStartup();
// FB // FB
else if (scriptName == "scripts\\ai\\NS\\WH\\L_ROCKHYDRANT_BROKEN.lua") else if (scriptName == "scripts\\ai\\NS\\WH\\L_ROCKHYDRANT_BROKEN.lua")
script = new RockHydrantBroken(); script = new RockHydrantBroken();
else if (scriptName == "scripts\\ai\\NS\\L_NS_WH_FANS.lua") else if (scriptName == "scripts\\ai\\NS\\L_NS_WH_FANS.lua")
script = new WhFans(); script = new WhFans();
// WBL
else if (scriptName == "scripts\\zone\\LUPs\\WBL_generic_zone.lua")
script = new WblGenericZone();
//Ignore these scripts: //Ignore these scripts:
else if (scriptName == "scripts\\02_server\\Enemy\\General\\L_SUSPEND_LUA_AI.lua") else if (scriptName == "scripts\\02_server\\Enemy\\General\\L_SUSPEND_LUA_AI.lua")
script = invalidToReturn; script = invalidToReturn;

View File

@ -0,0 +1,10 @@
#include "WblGenericZone.h"
#include "Player.h"
void WblGenericZone::OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) {
if (args == m_WblAbortMsg) {
if (!sender) return;
auto player = dynamic_cast<Player*>(sender);
if (player) player->SendToZone(m_WblMainZone);
}
}

10
dScripts/WblGenericZone.h Normal file
View File

@ -0,0 +1,10 @@
#pragma once
#include "CppScripts.h"
class WblGenericZone : public CppScripts::Script
{
public:
void OnFireEventServerSide(Entity* self, Entity* sender, std::string args, int32_t param1, int32_t param2, int32_t param3) override;
private:
const LWOMAPID m_WblMainZone = 1600;
const std::string m_WblAbortMsg = "AbortWBLZone";
};