From 0e6b4ad8162434bc6bd02528836efa1b3dae8217 Mon Sep 17 00:00:00 2001 From: Zerken Date: Tue, 17 Oct 2023 11:02:12 +0000 Subject: [PATCH] Fixed fishing trawler teleport and random event issues --- .../fishingtrawler/FishingTrawlerActivity.kt | 15 +++++++++++++-- Server/src/main/core/game/node/entity/Entity.java | 3 ++- .../node/entity/player/link/TeleportManager.java | 2 +- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Server/src/main/content/minigame/fishingtrawler/FishingTrawlerActivity.kt b/Server/src/main/content/minigame/fishingtrawler/FishingTrawlerActivity.kt index 1a2a64f1c..1522316c6 100644 --- a/Server/src/main/content/minigame/fishingtrawler/FishingTrawlerActivity.kt +++ b/Server/src/main/content/minigame/fishingtrawler/FishingTrawlerActivity.kt @@ -1,5 +1,6 @@ package content.minigame.fishingtrawler +import core.api.MapArea import core.game.node.entity.player.Player import core.game.system.task.Pulse import core.game.world.GameWorld @@ -10,6 +11,7 @@ import core.plugin.Initializable import core.tools.ticksToSeconds import core.game.activity.ActivityManager import core.game.activity.ActivityPlugin +import core.game.world.map.zone.ZoneBorders import core.tools.colorize @@ -17,13 +19,14 @@ import core.tools.colorize * Handles the fishing trawler "waiting room" * @author Ceikry */ -private val WAIT_TIME = if(GameWorld.settings?.isDevMode == true) 10 else 203 +private val WAIT_TIME = if(GameWorld.settings?.isDevMode == true) 30 else 203 private val waitingPlayers = ArrayList() +private val ftWaitingArea = arrayOf(ZoneBorders(2668, 3165, 2675, 3184)) private val sessions = ArrayList() private var activity: FishingTrawlerActivity? = null private var nextStart = GameWorld.ticks + WAIT_TIME @Initializable -class FishingTrawlerActivity : ActivityPlugin("fishing trawler",false,false,true,ZoneRestriction.CANNON,ZoneRestriction.FIRES,ZoneRestriction.FOLLOWERS,ZoneRestriction.RANDOM_EVENTS) { +class FishingTrawlerActivity : ActivityPlugin("fishing trawler",false,false,true,ZoneRestriction.CANNON,ZoneRestriction.FIRES,ZoneRestriction.FOLLOWERS,ZoneRestriction.RANDOM_EVENTS), MapArea { init { activity = this @@ -86,4 +89,12 @@ class FishingTrawlerActivity : ActivityPlugin("fishing trawler",false,false,true override fun getSpawnLocation(): Location { return Location.create(2667, 3161, 0) } + + override fun defineAreaBorders(): Array { + return ftWaitingArea + } + + override fun getRestrictions(): Array { + return arrayOf(ZoneRestriction.RANDOM_EVENTS, ZoneRestriction.TELEPORT) + } } \ No newline at end of file diff --git a/Server/src/main/core/game/node/entity/Entity.java b/Server/src/main/core/game/node/entity/Entity.java index 65197342f..c1c930645 100644 --- a/Server/src/main/core/game/node/entity/Entity.java +++ b/Server/src/main/core/game/node/entity/Entity.java @@ -16,6 +16,7 @@ import core.game.node.entity.player.Player; import core.game.node.entity.player.link.TeleportManager; import core.game.node.entity.skill.Skills; import core.game.system.task.Pulse; +import core.game.world.map.zone.ZoneRestriction; import org.jetbrains.annotations.NotNull; import core.game.world.GameWorld; import core.game.world.map.Location; @@ -928,7 +929,7 @@ public abstract class Entity extends Node { * @return {@code True} if so. */ public boolean isTeleBlocked() { - return timers.getTimer("teleblock") != null || getLocks().isTeleportLocked(); + return timers.getTimer("teleblock") != null || getLocks().isTeleportLocked() || getZoneMonitor().isRestricted(ZoneRestriction.TELEPORT); } /** diff --git a/Server/src/main/core/game/node/entity/player/link/TeleportManager.java b/Server/src/main/core/game/node/entity/player/link/TeleportManager.java index 2bbbd4c02..5641766b4 100644 --- a/Server/src/main/core/game/node/entity/player/link/TeleportManager.java +++ b/Server/src/main/core/game/node/entity/player/link/TeleportManager.java @@ -99,7 +99,7 @@ public class TeleportManager { if (!entity.getZoneMonitor().teleport(teleportType, null)) { return false; } - if (teleportType != -1 && (entity.isTeleBlocked() || entity.getZoneMonitor().isRestricted(ZoneRestriction.TELEPORT))) { + if (teleportType != -1 && entity.isTeleBlocked()) { if (entity.isPlayer()) entity.asPlayer().sendMessage("A magical force has stopped you from teleporting."); return false;