diff --git a/Server/src/main/java/core/game/content/global/worldevents/shootingstar/ScoreboardEntry.java b/Server/src/main/java/core/game/content/global/worldevents/shootingstar/ScoreboardEntry.java deleted file mode 100644 index 0996dd66a..000000000 --- a/Server/src/main/java/core/game/content/global/worldevents/shootingstar/ScoreboardEntry.java +++ /dev/null @@ -1,10 +0,0 @@ -package core.game.content.global.worldevents.shootingstar; - -public class ScoreboardEntry{ - public String playerName; - public int time; - public ScoreboardEntry(String player, int time){ - this.playerName = player; - this.time = time; - } -} diff --git a/Server/src/main/java/core/game/content/global/worldevents/shootingstar/ScoreboardHandler.java b/Server/src/main/java/core/game/content/global/worldevents/shootingstar/ScoreboardHandler.java deleted file mode 100644 index d2c011b97..000000000 --- a/Server/src/main/java/core/game/content/global/worldevents/shootingstar/ScoreboardHandler.java +++ /dev/null @@ -1,31 +0,0 @@ -package core.game.content.global.worldevents.shootingstar; - -import core.cache.def.impl.SceneryDefinition; -import core.game.interaction.OptionHandler; -import core.game.node.Node; -import core.game.node.entity.player.Player; -import rs09.game.world.GameWorld; -import core.plugin.Plugin; - -public class ScoreboardHandler extends OptionHandler { - int index = 0; - int ifaceid = ShootingStarScoreboard.iface.getId(); - @Override - public boolean handle(Player player, Node node, String option) { - ScoreboardManager.getEntries().forEach(e -> { - player.getPacketDispatch().sendString("" + Math.floor(((GameWorld.getTicks() - e.time) / 0.6) / 60) + " minutes ago",ifaceid,index + 6); - player.getPacketDispatch().sendString(e.playerName,ifaceid,index + 11); - index++; - }); - index = 0; - player.getInterfaceManager().open(ShootingStarScoreboard.iface); - return true; - } - - @Override - public Plugin newInstance(Object arg) throws Throwable { - SceneryDefinition.forId(38669).getHandlers().put("option:read",this); - - return this; - } -} diff --git a/Server/src/main/java/core/game/content/global/worldevents/shootingstar/ScoreboardManager.java b/Server/src/main/java/core/game/content/global/worldevents/shootingstar/ScoreboardManager.java deleted file mode 100644 index 86d8f7099..000000000 --- a/Server/src/main/java/core/game/content/global/worldevents/shootingstar/ScoreboardManager.java +++ /dev/null @@ -1,23 +0,0 @@ -package core.game.content.global.worldevents.shootingstar; - -import core.game.node.entity.player.Player; -import rs09.game.system.SystemLogger; -import rs09.game.world.GameWorld; - -import java.util.ArrayList; -import java.util.List; - -public class ScoreboardManager { - public static List entries = new ArrayList<>(20); - - public static void submit(Player player){ - if(entries.size() == 5){ - entries.remove(0); - } - entries.add(new ScoreboardEntry(player.getUsername(), GameWorld.getTicks())); - } - - public static List getEntries(){ - return entries; - } -} diff --git a/Server/src/main/java/core/game/content/global/worldevents/shootingstar/ShootingStarScoreboard.java b/Server/src/main/java/core/game/content/global/worldevents/shootingstar/ShootingStarScoreboard.java deleted file mode 100644 index 654151ffb..000000000 --- a/Server/src/main/java/core/game/content/global/worldevents/shootingstar/ShootingStarScoreboard.java +++ /dev/null @@ -1,22 +0,0 @@ -package core.game.content.global.worldevents.shootingstar; - -import core.game.component.Component; -import core.game.component.ComponentDefinition; -import core.game.component.ComponentPlugin; -import core.game.node.entity.player.Player; -import core.plugin.Plugin; - -public class ShootingStarScoreboard extends ComponentPlugin { - public static Component iface = new Component(787); - - @Override - public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) { - return true; - } - - @Override - public Plugin newInstance(Object arg) throws Throwable { - ComponentDefinition.put(iface.getId(),this); - return null; - } -} diff --git a/Server/src/main/java/core/game/interaction/item/ExplorersRingPlugin.kt b/Server/src/main/java/core/game/interaction/item/ExplorersRingPlugin.kt index 87b49d3eb..5b0c3cdd7 100644 --- a/Server/src/main/java/core/game/interaction/item/ExplorersRingPlugin.kt +++ b/Server/src/main/java/core/game/interaction/item/ExplorersRingPlugin.kt @@ -26,7 +26,7 @@ import rs09.game.interaction.InteractionListener * * @author Vexia */ -class ExplorersRingPlugin : InteractionListener() { +class ExplorersRingPlugin : InteractionListener { val RINGS = intArrayOf(Items.EXPLORERS_RING_1_13560, Items.EXPLORERS_RING_2_13561, Items.EXPLORERS_RING_3_13562) val CABBAGE_PORT = Location.create(3051, 3291, 0) diff --git a/Server/src/main/java/core/game/interaction/npc/NPCTradePlugin.kt b/Server/src/main/java/core/game/interaction/npc/NPCTradePlugin.kt index 72928510e..6f50c1877 100644 --- a/Server/src/main/java/core/game/interaction/npc/NPCTradePlugin.kt +++ b/Server/src/main/java/core/game/interaction/npc/NPCTradePlugin.kt @@ -20,7 +20,7 @@ import rs09.tools.END_DIALOGUE * @author Ceikry * @version 1.0 */ -class NPCTradePlugin : InteractionListener() { +class NPCTradePlugin : InteractionListener { override fun defineListeners() { on(NPC, "trade", "shop"){player, node -> val npc = node as NPC diff --git a/Server/src/main/java/core/game/interaction/object/CulinoChestListener.kt b/Server/src/main/java/core/game/interaction/object/CulinoChestListener.kt index 9c47b357a..ec0fecb32 100644 --- a/Server/src/main/java/core/game/interaction/object/CulinoChestListener.kt +++ b/Server/src/main/java/core/game/interaction/object/CulinoChestListener.kt @@ -18,7 +18,7 @@ import rs09.game.interaction.InteractionListener * Handles the culino chest options. * @author Ceikry */ -class CulinoChestListener : InteractionListener() { +class CulinoChestListener : InteractionListener { val CULINO_CHEST = Scenery.CHEST_12309 override fun defineListeners() { diff --git a/Server/src/main/java/core/game/interaction/object/sorceress/GardenObjectsPlugin.kt b/Server/src/main/java/core/game/interaction/object/sorceress/GardenObjectsPlugin.kt index aa900ce26..e69566e99 100644 --- a/Server/src/main/java/core/game/interaction/object/sorceress/GardenObjectsPlugin.kt +++ b/Server/src/main/java/core/game/interaction/object/sorceress/GardenObjectsPlugin.kt @@ -26,7 +26,7 @@ import rs09.game.world.GameWorld import rs09.plugin.ClassScanner -class GardenObjectsPlugin : InteractionListener() { +class GardenObjectsPlugin : InteractionListener { val SQIRK_TREES = intArrayOf(21767, 21768, 21769, 21766) val FOUNTAIN = 21764 diff --git a/Server/src/main/java/core/game/node/entity/skill/cooking/CookingRewrite.kt b/Server/src/main/java/core/game/node/entity/skill/cooking/CookingRewrite.kt index 94c1413e4..fc6415333 100644 --- a/Server/src/main/java/core/game/node/entity/skill/cooking/CookingRewrite.kt +++ b/Server/src/main/java/core/game/node/entity/skill/cooking/CookingRewrite.kt @@ -17,7 +17,7 @@ import rs09.game.node.entity.skill.cooking.CookingDialogue * @author Ceikry * @author bushtail - added bear meat for sinew making */ -class CookingRewrite : InteractionListener() { +class CookingRewrite : InteractionListener { val RAW_FOODS: IntArray diff --git a/Server/src/main/java/core/game/node/entity/skill/firemaking/FireMakingOptionPlugin.kt b/Server/src/main/java/core/game/node/entity/skill/firemaking/FireMakingOptionPlugin.kt index 35e27354f..e54e9d16c 100644 --- a/Server/src/main/java/core/game/node/entity/skill/firemaking/FireMakingOptionPlugin.kt +++ b/Server/src/main/java/core/game/node/entity/skill/firemaking/FireMakingOptionPlugin.kt @@ -3,7 +3,7 @@ package core.game.node.entity.skill.firemaking import org.rs09.consts.Items import rs09.game.interaction.InteractionListener -class FiremakingListener : InteractionListener() +class FiremakingListener : InteractionListener { val logs = intArrayOf(1511, 1521, 1513, 1515, 1517, 1519, 1521, 2862, 3438, 3440, 3442, 3444, 3446, 3448, 6211, 6213, 6332, 6333, 7404, 7405, 7406, 8934, 9067, 10328, 10329, 10808, 10810, 10812, 11035, 12581, 12583, 3125) diff --git a/Server/src/main/kotlin/api/Commands.kt b/Server/src/main/kotlin/api/Commands.kt new file mode 100644 index 000000000..406350e26 --- /dev/null +++ b/Server/src/main/kotlin/api/Commands.kt @@ -0,0 +1,49 @@ +package api + +import core.game.node.entity.player.Player +import rs09.game.system.command.Command +import rs09.game.system.command.CommandMapping +import rs09.game.system.command.Privilege +import rs09.tools.stringtools.colorize + +/** + * An interface for writing content that allows the class to define commands. + * + * Includes methods [reject] and [notify] for notifying the player of a command rejection or some output text respectively. + * + * Includes the method [define] to define individual commands + * + * Commands should ideally be defined in the required [defineCommands] method. + */ +interface Commands : ContentInterface { + /** + * Glorified player.sendMessage with red text coloring. Please use this + * rather than just player.sendMessage for anything that involves informing the player + * of proper usage or invalid syntax. Throws an IllegalStateException and ends command execution immediately. + */ + fun reject(player: Player, vararg message: String){ + for(msg in message) { + player.sendMessage(colorize("-->%R$msg")) + } + throw IllegalStateException() + } + + /** + * Glorified player.sendMessage with black text coloring and an arrow. Use this when you need to + * notify/inform a player of some information from within the command without ending execution. + */ + fun notify(player: Player, message: String){ + player.sendMessage(colorize("-->$message")) + } + + /** + * Used to define commands. define("name",(optional) privilege override){ handle } + * @param name the name of the command. Example: ::example would be just "example" + * @param privilege the rights level needed to execute the command. Options are [Privilege.STANDARD], [Privilege.MODERATOR], [Privilege.ADMIN]. Defaults to [Privilege.STANDARD] + */ + fun define(name: String, privilege: Privilege = Privilege.STANDARD, handle: (Player, Array) -> Unit){ + CommandMapping.register(Command(name, privilege, handle)) + } + + fun defineCommands() +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/ShootingStarBot.kt b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/ShootingStarBot.kt index cd02989d7..187006e01 100644 --- a/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/ShootingStarBot.kt +++ b/Server/src/main/kotlin/rs09/game/ai/general/scriptrepository/ShootingStarBot.kt @@ -6,17 +6,14 @@ import core.game.world.map.Location import core.tools.RandomFunction import org.rs09.consts.Items import rs09.game.ai.general.GeneralBotCreator -import rs09.game.ai.general.ScriptAPI -import rs09.game.content.global.worldevents.WorldEvents -import rs09.game.content.global.worldevents.shootingstar.ShootingStarEvent -import rs09.game.interaction.InteractionListener.Companion.SCENERY +import rs09.game.content.global.worldevents.shootingstar.ShootingStarPlugin +import rs09.game.interaction.InteractionListener import rs09.game.interaction.InteractionListeners -import kotlin.concurrent.timer class ShootingStarBot : Script() { private var state = State.FULL_IDLE private var timerCountdown = 0 - val star = (WorldEvents.get("shooting-stars") as? ShootingStarEvent)!!.star + val star = ShootingStarPlugin.getStar() override fun tick() { bot.fullRestore() @@ -36,7 +33,7 @@ class ShootingStarBot : Script() { } State.MINING -> { - InteractionListeners.run(star.starObject.id, SCENERY, "mine", bot, star.starObject) + InteractionListeners.run(star.starObject.id, InteractionListener.SCENERY, "mine", bot, star.starObject) } State.TELEPORT_BACK -> { diff --git a/Server/src/main/kotlin/rs09/game/content/activity/allfiredup/AFUBeaconHandler.kt b/Server/src/main/kotlin/rs09/game/content/activity/allfiredup/AFUBeaconHandler.kt index 4f9b76d29..c682c6008 100644 --- a/Server/src/main/kotlin/rs09/game/content/activity/allfiredup/AFUBeaconHandler.kt +++ b/Server/src/main/kotlin/rs09/game/content/activity/allfiredup/AFUBeaconHandler.kt @@ -19,7 +19,7 @@ private val LIGHT_ANIM = Animation(7307) * Handles interactions for beacons * @author Ceikry */ -class AFUBeaconListeners : InteractionListener(){ +class AFUBeaconListeners : InteractionListener{ override fun defineListeners() { on(SCENERY,"add-logs","light"){ player, node -> diff --git a/Server/src/main/kotlin/rs09/game/content/activity/allfiredup/AFURepairClimbHandler.kt b/Server/src/main/kotlin/rs09/game/content/activity/allfiredup/AFURepairClimbHandler.kt index 5e288dbef..b0a5c8710 100644 --- a/Server/src/main/kotlin/rs09/game/content/activity/allfiredup/AFURepairClimbHandler.kt +++ b/Server/src/main/kotlin/rs09/game/content/activity/allfiredup/AFURepairClimbHandler.kt @@ -16,7 +16,7 @@ import java.util.* * Handles repairing and climbing of the 3 beacon shortcuts needed to access them * @author Ceikry */ -class AFURepairClimbHandler : InteractionListener() { +class AFURepairClimbHandler : InteractionListener { val repairIDs = intArrayOf(38480,38470,38494) val climbIDs = intArrayOf(38469,38471,38486,38481,38469) diff --git a/Server/src/main/kotlin/rs09/game/content/activity/blastfurnace/BlastFurnaceInterfaceListener.kt b/Server/src/main/kotlin/rs09/game/content/activity/blastfurnace/BlastFurnaceInterfaceListener.kt index 8d716a34e..7a059ac32 100644 --- a/Server/src/main/kotlin/rs09/game/content/activity/blastfurnace/BlastFurnaceInterfaceListener.kt +++ b/Server/src/main/kotlin/rs09/game/content/activity/blastfurnace/BlastFurnaceInterfaceListener.kt @@ -11,9 +11,9 @@ import rs09.game.interaction.InterfaceListener * @author definitely phil who didn't get help from ceikry at all haha :) * @version 69.0 */ -class BlastFurnaceInterfaceListener : InterfaceListener() { +class BlastFurnaceInterfaceListener : InterfaceListener { - override fun defineListeners() { + override fun defineInterfaceListeners() { on(Components.BLAST_FURNACE_BAR_STOCK_28){ player, _, _, buttonID, _, _ -> val bar = BFBars.forId(buttonID) ?: return@on false diff --git a/Server/src/main/kotlin/rs09/game/content/activity/blastfurnace/BlastFurnaceListeners.kt b/Server/src/main/kotlin/rs09/game/content/activity/blastfurnace/BlastFurnaceListeners.kt index 870fa7e33..7d63e9bb7 100644 --- a/Server/src/main/kotlin/rs09/game/content/activity/blastfurnace/BlastFurnaceListeners.kt +++ b/Server/src/main/kotlin/rs09/game/content/activity/blastfurnace/BlastFurnaceListeners.kt @@ -18,7 +18,7 @@ import rs09.game.node.entity.npc.other.BlastFurnaceOre * That lives in OrdanDialogue.kt * @author phil lips*/ -class BlastFurnaceListeners : InteractionListener() { +class BlastFurnaceListeners : InteractionListener { val disLoc = getScenery(1941, 4963, 0) val brokenPotPipe = 9117 diff --git a/Server/src/main/kotlin/rs09/game/content/activity/blastfurnace/PhunnyGaugeTempInterfaceListener.kt b/Server/src/main/kotlin/rs09/game/content/activity/blastfurnace/PhunnyGaugeTempInterfaceListener.kt index 620e28b72..e2d36a9a9 100644 --- a/Server/src/main/kotlin/rs09/game/content/activity/blastfurnace/PhunnyGaugeTempInterfaceListener.kt +++ b/Server/src/main/kotlin/rs09/game/content/activity/blastfurnace/PhunnyGaugeTempInterfaceListener.kt @@ -7,9 +7,9 @@ import rs09.game.interaction.InterfaceListener * Only updates the gauge if people are actually looking at it * @author phil lips*/ -class PhunnyGaugeTempInterfaceListener : InterfaceListener(){ +class PhunnyGaugeTempInterfaceListener : InterfaceListener { - override fun defineListeners() { + override fun defineInterfaceListeners() { onOpen(30) {player, component -> BlastFurnace.gaugeViewList.add(player) return@onOpen true diff --git a/Server/src/main/kotlin/rs09/game/content/activity/fishingtrawler/FishingTrawlerInteractionHandler.kt b/Server/src/main/kotlin/rs09/game/content/activity/fishingtrawler/FishingTrawlerInteractionHandler.kt index bd28bd28b..a5ed02643 100644 --- a/Server/src/main/kotlin/rs09/game/content/activity/fishingtrawler/FishingTrawlerInteractionHandler.kt +++ b/Server/src/main/kotlin/rs09/game/content/activity/fishingtrawler/FishingTrawlerInteractionHandler.kt @@ -22,7 +22,7 @@ import kotlin.math.ceil * Option handler for fishing trawler * @author Ceikry */ -class FishingTrawlerInteractionHandler : InteractionListener() { +class FishingTrawlerInteractionHandler : InteractionListener { val ENTRANCE_PLANK = 2178 val EXIT_PLANK = 2179 val HOLE = 2167 diff --git a/Server/src/main/kotlin/rs09/game/content/activity/guild/crafting/CraftingGuildListeners.kt b/Server/src/main/kotlin/rs09/game/content/activity/guild/crafting/CraftingGuildListeners.kt index bae2d4250..a14364811 100644 --- a/Server/src/main/kotlin/rs09/game/content/activity/guild/crafting/CraftingGuildListeners.kt +++ b/Server/src/main/kotlin/rs09/game/content/activity/guild/crafting/CraftingGuildListeners.kt @@ -13,7 +13,7 @@ import rs09.game.interaction.InteractionListener * @author bushtail */ -class CraftingGuildListeners : InteractionListener() { +class CraftingGuildListeners : InteractionListener { private val GUILD_DOOR = Scenery.GUILD_DOOR_2647 private val APRON = Items.BROWN_APRON_1757 private val CAPE = Items.CRAFTING_CAPE_9780 diff --git a/Server/src/main/kotlin/rs09/game/content/activity/mta/MTAListeners.kt b/Server/src/main/kotlin/rs09/game/content/activity/mta/MTAListeners.kt index 54c9b13b2..e478e6f2b 100644 --- a/Server/src/main/kotlin/rs09/game/content/activity/mta/MTAListeners.kt +++ b/Server/src/main/kotlin/rs09/game/content/activity/mta/MTAListeners.kt @@ -11,7 +11,7 @@ import rs09.game.interaction.InteractionListener import rs09.game.node.entity.skill.magic.SpellListener import rs09.game.node.entity.skill.magic.spellconsts.Modern -class MTAListeners : InteractionListener() { +class MTAListeners : InteractionListener { override fun defineListeners() { on(NPCs.MAZE_GUARDIAN_3102,NPC,"talk-to"){player,node -> player.dialogueInterpreter.open(node.id, node) diff --git a/Server/src/main/kotlin/rs09/game/content/activity/pyramidplunder/PyramidPlunderMinigame.kt b/Server/src/main/kotlin/rs09/game/content/activity/pyramidplunder/PyramidPlunderMinigame.kt index 703a3794a..d958e3274 100644 --- a/Server/src/main/kotlin/rs09/game/content/activity/pyramidplunder/PyramidPlunderMinigame.kt +++ b/Server/src/main/kotlin/rs09/game/content/activity/pyramidplunder/PyramidPlunderMinigame.kt @@ -17,11 +17,12 @@ import org.rs09.consts.Scenery import rs09.game.content.dialogue.DialogueFile import rs09.game.interaction.InteractionListener + /** * The "controller" class for pyramid plunder. Handles per-tick updates, logout hooks, and defines interaction listeners for the minigame. * @author Ceikry */ -class PyramidPlunderMinigame : InteractionListener(), TickListener, LogoutListener { +class PyramidPlunderMinigame : InteractionListener, TickListener, LogoutListener { override fun tick() { val playersToExpel = PlunderUtils.decrementTimeRemaining() playersToExpel.forEach {player -> PlunderUtils.expel(player, false) } diff --git a/Server/src/main/kotlin/rs09/game/content/activity/vinesweeper/Vinesweeper.kt b/Server/src/main/kotlin/rs09/game/content/activity/vinesweeper/Vinesweeper.kt index e9cf73158..fc10632ed 100644 --- a/Server/src/main/kotlin/rs09/game/content/activity/vinesweeper/Vinesweeper.kt +++ b/Server/src/main/kotlin/rs09/game/content/activity/vinesweeper/Vinesweeper.kt @@ -131,7 +131,7 @@ object VinesweeperTeleport { } } -class VinesweeperListener : InteractionListener() { +class VinesweeperListener : InteractionListener { fun dig(player: Player, loc: Location) { if(isSeed(loc)) { val oldPoints = player.getAttribute("vinesweeper:points", 0) @@ -439,7 +439,7 @@ class VinesweeperZone : MapZone("Vinesweeper", true) { } } -class VinesweeperRewards : InterfaceListener() { +class VinesweeperRewards : InterfaceListener { val IFACE = 686 val TRADE_FOR_XP_BUTTON = 53 val XP_CONFIRM = 72 @@ -506,7 +506,7 @@ class VinesweeperRewards : InterfaceListener() { } } - override fun defineListeners() { + override fun defineInterfaceListeners() { onOpen(IFACE) { _, _ -> /*for((buttonID, reward) in REWARDS) { sendItemOnInterface(player, IFACE, buttonID, reward.itemID, 5) diff --git a/Server/src/main/kotlin/rs09/game/content/activity/wguild/WGuildListeners.kt b/Server/src/main/kotlin/rs09/game/content/activity/wguild/WGuildListeners.kt index d9ad4623e..5ea454ad8 100644 --- a/Server/src/main/kotlin/rs09/game/content/activity/wguild/WGuildListeners.kt +++ b/Server/src/main/kotlin/rs09/game/content/activity/wguild/WGuildListeners.kt @@ -7,7 +7,7 @@ import core.game.node.item.Item import org.rs09.consts.Items import rs09.game.interaction.InteractionListener -class WGuildListeners : InteractionListener() { +class WGuildListeners : InteractionListener { override fun defineListeners() { onEquip(Items.DEFENSIVE_SHIELD_8856){player, node -> if (node is Item) { diff --git a/Server/src/main/kotlin/rs09/game/content/ame/events/certer/CerterEventInterface.kt b/Server/src/main/kotlin/rs09/game/content/ame/events/certer/CerterEventInterface.kt index 10d5725b4..9cfcef0ad 100644 --- a/Server/src/main/kotlin/rs09/game/content/ame/events/certer/CerterEventInterface.kt +++ b/Server/src/main/kotlin/rs09/game/content/ame/events/certer/CerterEventInterface.kt @@ -6,7 +6,7 @@ import org.rs09.consts.Items import rs09.game.content.ame.RandomEventManager import rs09.game.interaction.InterfaceListener -class CerterEventInterface : InterfaceListener() { +class CerterEventInterface : InterfaceListener { val CERTER_INTERFACE = 184 val OPTION_A_CHILD = 1 val OPTION_B_CHILD = 2 @@ -31,7 +31,7 @@ class CerterEventInterface : InterfaceListener() { Items.NULL_6198 to "A necklace." ) val falseOptions = arrayOf("An axe.", "An arrow.", "A pair of boots.", "A pair of gloves.", "A staff.", "A bow.", "A feather.", "The disenfrachaised youth of 1940's Columbia.") - override fun defineListeners() { + override fun defineInterfaceListeners() { on(CERTER_INTERFACE) { player, _, _, buttonID, _, _ -> val answer = buttonID - 7 val correctAnswer = player.getAttribute("certer:correctIndex", 0) diff --git a/Server/src/main/kotlin/rs09/game/content/ame/events/drilldemon/DrillDemonListeners.kt b/Server/src/main/kotlin/rs09/game/content/ame/events/drilldemon/DrillDemonListeners.kt index e73300052..2a9b8b16a 100644 --- a/Server/src/main/kotlin/rs09/game/content/ame/events/drilldemon/DrillDemonListeners.kt +++ b/Server/src/main/kotlin/rs09/game/content/ame/events/drilldemon/DrillDemonListeners.kt @@ -5,7 +5,7 @@ import core.game.system.task.Pulse import org.rs09.consts.NPCs import rs09.game.interaction.InteractionListener -class DrillDemonListeners : InteractionListener() { +class DrillDemonListeners : InteractionListener { val MATS = intArrayOf(10076,10077,10078,10079) override fun defineListeners() { diff --git a/Server/src/main/kotlin/rs09/game/content/ame/events/sandwichlady/SandwichLadyInterface.kt b/Server/src/main/kotlin/rs09/game/content/ame/events/sandwichlady/SandwichLadyInterface.kt index 0abce4b1c..a28bb31fe 100644 --- a/Server/src/main/kotlin/rs09/game/content/ame/events/sandwichlady/SandwichLadyInterface.kt +++ b/Server/src/main/kotlin/rs09/game/content/ame/events/sandwichlady/SandwichLadyInterface.kt @@ -5,7 +5,7 @@ import org.rs09.consts.Items import rs09.game.content.ame.RandomEventManager import rs09.game.interaction.InterfaceListener -class SandwichLadyInterface : InterfaceListener(){ +class SandwichLadyInterface : InterfaceListener{ val SANDWICH_INTERFACE = 297 val baguette = Items.BAGUETTE_6961 @@ -16,7 +16,7 @@ class SandwichLadyInterface : InterfaceListener(){ val kebab = Items.KEBAB_1971 val chocobar = Items.CHOCOLATE_BAR_1973 - override fun defineListeners() { + override fun defineInterfaceListeners() { on(SANDWICH_INTERFACE){player, _, _, buttonID, _, _ -> val item = when(buttonID) { diff --git a/Server/src/main/kotlin/rs09/game/content/ame/events/supriseexam/SEPatternInterface.kt b/Server/src/main/kotlin/rs09/game/content/ame/events/supriseexam/SEPatternInterface.kt index 73ac97c4d..3175b9e1b 100644 --- a/Server/src/main/kotlin/rs09/game/content/ame/events/supriseexam/SEPatternInterface.kt +++ b/Server/src/main/kotlin/rs09/game/content/ame/events/supriseexam/SEPatternInterface.kt @@ -5,11 +5,11 @@ import org.rs09.consts.Components import org.rs09.consts.NPCs import rs09.game.interaction.InterfaceListener -class SEPatternInterface : InterfaceListener() { +class SEPatternInterface : InterfaceListener { val COMPONENT = Components.PATTERN_NEXT_103 - override fun defineListeners() { + override fun defineInterfaceListeners() { on(COMPONENT){player, component, opcode, buttonID, slot, itemID -> val index = buttonID - 10 diff --git a/Server/src/main/kotlin/rs09/game/content/ame/events/supriseexam/SupriseExamListeners.kt b/Server/src/main/kotlin/rs09/game/content/ame/events/supriseexam/SupriseExamListeners.kt index 8d8b241ef..f921b780d 100644 --- a/Server/src/main/kotlin/rs09/game/content/ame/events/supriseexam/SupriseExamListeners.kt +++ b/Server/src/main/kotlin/rs09/game/content/ame/events/supriseexam/SupriseExamListeners.kt @@ -9,7 +9,7 @@ import org.rs09.consts.NPCs import rs09.game.interaction.InteractionListener import rs09.game.interaction.inter.ExperienceInterface -class SupriseExamListeners : InteractionListener() { +class SupriseExamListeners : InteractionListener { val MORDAUT = NPCs.MR_MORDAUT_6117 val BOOK_OF_KNOWLEDGE = Items.BOOK_OF_KNOWLEDGE_11640 override fun defineListeners() { diff --git a/Server/src/main/kotlin/rs09/game/content/global/action/EquipHandler.kt b/Server/src/main/kotlin/rs09/game/content/global/action/EquipHandler.kt index ac25bf1bd..947fe7459 100644 --- a/Server/src/main/kotlin/rs09/game/content/global/action/EquipHandler.kt +++ b/Server/src/main/kotlin/rs09/game/content/global/action/EquipHandler.kt @@ -20,7 +20,7 @@ import rs09.game.system.config.ItemConfigParser * @author Ceikry * @author Woah */ -class EquipHandler : InteractionListener() { +class EquipHandler : InteractionListener { override fun defineListeners() { diff --git a/Server/src/main/kotlin/rs09/game/content/global/worldevents/holiday/christmas/GiftRollPlugin.kt b/Server/src/main/kotlin/rs09/game/content/global/worldevents/holiday/christmas/GiftRollPlugin.kt index 08955ae5e..c2f4bc06a 100644 --- a/Server/src/main/kotlin/rs09/game/content/global/worldevents/holiday/christmas/GiftRollPlugin.kt +++ b/Server/src/main/kotlin/rs09/game/content/global/worldevents/holiday/christmas/GiftRollPlugin.kt @@ -48,7 +48,7 @@ class GiftRollPlugin : XPGainPlugin() { } } -class XMASMboxHandler : InteractionListener() { +class XMASMboxHandler : InteractionListener { val MBOX = Items.MYSTERY_BOX_6199 override fun defineListeners() { diff --git a/Server/src/main/kotlin/rs09/game/content/global/worldevents/holiday/easter/EasterEventListeners.kt b/Server/src/main/kotlin/rs09/game/content/global/worldevents/holiday/easter/EasterEventListeners.kt index aae620fba..b6f166fae 100644 --- a/Server/src/main/kotlin/rs09/game/content/global/worldevents/holiday/easter/EasterEventListeners.kt +++ b/Server/src/main/kotlin/rs09/game/content/global/worldevents/holiday/easter/EasterEventListeners.kt @@ -7,7 +7,7 @@ import org.rs09.consts.Items import org.rs09.consts.NPCs import rs09.game.interaction.InteractionListener -class EasterEventListeners : InteractionListener() { +class EasterEventListeners : InteractionListener { val EGG_ATTRIBUTE = "/save:easter:eggs" val eggs = intArrayOf(Items.EASTER_EGG_11027, Items.EASTER_EGG_11028, Items.EASTER_EGG_11029, Items.EASTER_EGG_11030) diff --git a/Server/src/main/kotlin/rs09/game/content/global/worldevents/holiday/halloween/TrickOrTreatHandler.kt b/Server/src/main/kotlin/rs09/game/content/global/worldevents/holiday/halloween/TrickOrTreatHandler.kt index d40b33533..0420704cc 100644 --- a/Server/src/main/kotlin/rs09/game/content/global/worldevents/holiday/halloween/TrickOrTreatHandler.kt +++ b/Server/src/main/kotlin/rs09/game/content/global/worldevents/holiday/halloween/TrickOrTreatHandler.kt @@ -19,7 +19,7 @@ import rs09.game.interaction.InteractionListener import rs09.game.world.GameWorld import rs09.tools.END_DIALOGUE -class TrickOrTreatHandler : InteractionListener() { +class TrickOrTreatHandler : InteractionListener { override fun defineListeners() { on(NPC, "trick-or-treat"){player, node -> val hasDone5 = getDailyTrickOrTreats(player) == 5 diff --git a/Server/src/main/kotlin/rs09/game/content/global/worldevents/penguinhns/PenguinSpyingHandler.kt b/Server/src/main/kotlin/rs09/game/content/global/worldevents/penguinhns/PenguinSpyingHandler.kt index a2fbe7656..613ec2246 100644 --- a/Server/src/main/kotlin/rs09/game/content/global/worldevents/penguinhns/PenguinSpyingHandler.kt +++ b/Server/src/main/kotlin/rs09/game/content/global/worldevents/penguinhns/PenguinSpyingHandler.kt @@ -13,7 +13,7 @@ import core.game.content.quest.PluginInteraction import core.game.content.quest.PluginInteractionManager import rs09.game.interaction.InteractionListener -class PenguinSpyingHandler : InteractionListener(){ +class PenguinSpyingHandler : InteractionListener{ override fun defineListeners() { on(PENGUINS, NPC, "spy-on"){player, node -> diff --git a/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStar.kt b/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStar.kt index 14602254e..c42369962 100644 --- a/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStar.kt +++ b/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStar.kt @@ -71,15 +71,15 @@ class ShootingStar(var level: ShootingStarType = ShootingStarType.values().rando starSprite.location = starObject.location starSprite.init() spriteSpawned = true - ShootingStarEvent.getStoreFile().clear() + ShootingStarPlugin.getStoreFile().clear() return } level = getNextType() maxDust = level.totalStardust dustLeft = level.totalStardust - ShootingStarEvent.getStoreFile()["level"] = level.ordinal - ShootingStarEvent.getStoreFile()["isDiscovered"] = isDiscovered + ShootingStarPlugin.getStoreFile()["level"] = level.ordinal + ShootingStarPlugin.getStoreFile()["isDiscovered"] = isDiscovered val newStar = Scenery(level.objectId, starObject.location) SceneryBuilder.replace(starObject, newStar) @@ -114,10 +114,10 @@ class ShootingStar(var level: ShootingStarType = ShootingStarType.values().rando * Rebuilds some of the variables with new information. */ fun rebuildVars(){ - if(firstStar && ShootingStarEvent.getStoreFile().isNotEmpty()){ - level = ShootingStarType.values()[ShootingStarEvent.getStoreFile().getInt("level")] - location = ShootingStarEvent.getStoreFile().getString("location") - isDiscovered = ShootingStarEvent.getStoreFile().getBoolean("isDiscovered") + if(firstStar && ShootingStarPlugin.getStoreFile().isNotEmpty()){ + level = ShootingStarType.values()[ShootingStarPlugin.getStoreFile().getInt("level")] + location = ShootingStarPlugin.getStoreFile().getString("location") + isDiscovered = ShootingStarPlugin.getStoreFile().getBoolean("isDiscovered") } else { level = ShootingStarType.values().random() location = crash_locations.entries.random().key @@ -128,9 +128,9 @@ class ShootingStar(var level: ShootingStarType = ShootingStarType.values().rando dustLeft = level.totalStardust starObject = Scenery(level.objectId, crash_locations.get(location)) - ShootingStarEvent.getStoreFile()["level"] = level.ordinal - ShootingStarEvent.getStoreFile()["location"] = location - ShootingStarEvent.getStoreFile()["isDiscovered"] = false + ShootingStarPlugin.getStoreFile()["level"] = level.ordinal + ShootingStarPlugin.getStoreFile()["location"] = location + ShootingStarPlugin.getStoreFile()["isDiscovered"] = false ticks = 0 firstStar = false diff --git a/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStarCommands.kt b/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStarCommands.kt deleted file mode 100644 index 3f067b91e..000000000 --- a/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStarCommands.kt +++ /dev/null @@ -1,40 +0,0 @@ -package rs09.game.content.global.worldevents.shootingstar - -import core.game.node.entity.player.Player -import core.game.system.command.CommandSet -import core.plugin.Plugin -import rs09.game.content.global.worldevents.WorldEvents -import rs09.game.system.command.CommandPlugin -import java.util.concurrent.TimeUnit - -/** - * A few assorted commands for shooting stars. - */ -class ShootingStarCommands : CommandPlugin(){ - override fun newInstance(arg: Any?): Plugin{ - link(CommandSet.DEVELOPER) - return this - } - - override fun parse(player: Player?, name: String?, args: Array?): Boolean { - val star = (WorldEvents.get("shooting-stars") as ShootingStarEvent).star - when (name) { - "tostar" -> { - player!!.teleport(star.starObject.location.transform(1, 1, 0)) - } - "submit" -> { - star.fire() - } - "resettime" -> player!!.savedData.globalData.starSpriteDelay = 0L - "stardust" -> { - val dust = 8 - println("Cosmic Runes: " + 0.76 * dust) - println("Astral runes: " + 0.26 * dust) - println("Gold ores: " + 0.1 * dust) - println("GP: " + 250.1 * dust) - } - "setsprite" -> player!!.savedData.globalData.starSpriteDelay = System.currentTimeMillis() + TimeUnit.DAYS.toMillis(1) - } - return true - } -} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStarEvent.kt b/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStarEvent.kt deleted file mode 100644 index bbfe2df56..000000000 --- a/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStarEvent.kt +++ /dev/null @@ -1,92 +0,0 @@ -package rs09.game.content.global.worldevents.shootingstar - -import core.game.content.global.worldevents.shootingstar.ScoreboardHandler -import core.game.content.global.worldevents.shootingstar.ShootingStarScoreboard -import core.game.content.global.worldevents.shootingstar.StarChartPlugin -import core.game.system.task.Pulse -import org.json.simple.JSONObject -import rs09.ServerStore -import rs09.game.content.global.worldevents.PluginSet -import rs09.game.content.global.worldevents.WorldEvent -import rs09.game.content.global.worldevents.WorldEvents -import rs09.game.world.GameWorld - - -/** - * The world event class for shooting stars. Keeps track of event-related data like the ShootingStar instance. - * Also handles spawning new shooting stars based on time. - * @author Ceikry - */ -class ShootingStarEvent : WorldEvent("shooting-stars") { - val star = ShootingStar() - val tickDelay = if(GameWorld.settings?.isDevMode == true) 200 else 25000 - - - override fun initialize() { - plugins = PluginSet( - ScoreboardHandler(), - ShootingStarScoreboard(), - StarChartPlugin(), - ShootingStarCommands(), - StarSpriteDialogue(), - ShootingStarLogin() - ) - super.initialize() - GameWorld.Pulser.submit(StarPulse()) - log("Shooting Star event has been initialized.") - } - - override fun checkTrigger(): Boolean { - /** - * Spawn a new star only if: star's ticks are greater than the tickDelay and star sprite is not spawned OR, - * neither the star or the sprite are spawned. - */ - star.ticks += 10 - if ((star.ticks >= tickDelay && !star.spriteSpawned) || (!star.isSpawned && !star.spriteSpawned)) { - return true - } - - /** - * Clear the sprite when we have passed the tickDelay + (1/3) of the tickDelay. - * This gives players a little extra time before the star respawns to run to the bank and grab - * stardust or whatever. Once the sprite is cleared a new star will be allowed to spawn. - */ - val maxDelay = tickDelay + (tickDelay / 3) - if(star.ticks > maxDelay && star.spriteSpawned){ - star.clearSprite() - } - - return false - } - - override fun checkActive(): Boolean { - return true //this event is always active. - } - - override fun fireEvent() { - log("Fired new shooting star event.") - star.fire() - } - - /** - * Handles checking star status and spawning new ones if necessary. - */ - class StarPulse : Pulse(10){ - override fun pulse(): Boolean { - val event = WorldEvents.get("shooting-stars") - event ?: return true - - if(event.checkTrigger()){ - event.fireEvent() - } - - return false //always returns false because it needs to run forever. - } - } - - companion object { - fun getStoreFile() : JSONObject { - return ServerStore.getArchive("shooting-star") - } - } -} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStarLogin.kt b/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStarLogin.kt deleted file mode 100644 index 9a2feb669..000000000 --- a/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStarLogin.kt +++ /dev/null @@ -1,29 +0,0 @@ -package rs09.game.content.global.worldevents.shootingstar - -import core.game.node.entity.player.Player -import core.plugin.Plugin -import core.plugin.PluginManifest -import core.plugin.PluginType -import rs09.game.content.global.worldevents.WorldEvents - -/** - * A plugin that handles the message a player receives on login pertaining to shooting stars. - */ -@PluginManifest(type = PluginType.LOGIN) -class ShootingStarLogin : Plugin { - @Throws(Throwable::class) - override fun newInstance(arg: Player?): Plugin? { - if (arg is Player) { - val star = (WorldEvents.get("shooting-stars") as ShootingStarEvent).star - if (star.isSpawned) { - arg.sendMessage("News: A shooting star (Level " + (star.level.ordinal + 1).toString() + ") has just crashed near the " + star.location + "!") - } - return this - } - return this - } - - override fun fireEvent(identifier: String, vararg args: Any): Any { - return Unit - } -} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStarMiningPulse.kt b/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStarMiningPulse.kt index 5d3f6b27a..1d49f14a4 100644 --- a/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStarMiningPulse.kt +++ b/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStarMiningPulse.kt @@ -1,7 +1,6 @@ package rs09.game.content.global.worldevents.shootingstar import api.* -import core.game.content.global.worldevents.shootingstar.ScoreboardManager import core.game.node.scenery.Scenery import core.game.node.entity.player.Player import core.game.node.entity.skill.SkillPulse @@ -50,7 +49,7 @@ class ShootingStarMiningPulse(player: Player?, node: Scenery?, val star: Shootin player.incrementAttribute("/save:shooting-star:bonus-xp", bonusXp) Repository.sendNews(player.username + " is the discoverer of the crashed star near " + star.location + "!") player.sendMessage("You have ${player.skills.experienceMutiplier * player.getAttribute("shooting-star:bonus-xp", 0).toDouble()} bonus xp towards mining stardust.") - ScoreboardManager.submit(player) + ShootingStarPlugin.submitScoreBoard(player) star.isDiscovered = true return player.skills.getLevel(Skills.MINING) >= star.miningLevel } @@ -63,7 +62,7 @@ class ShootingStarMiningPulse(player: Player?, node: Scenery?, val star: Shootin player.packetDispatch.sendMessage("You do not have a pickaxe to use.") return false } - if (player.inventory.freeSlots() < 1 && !player.inventory.contains(ShootingStarOptionHandler.STAR_DUST, 1)) { + if (player.inventory.freeSlots() < 1 && !player.inventory.contains(ShootingStarPlugin.STAR_DUST, 1)) { player.dialogueInterpreter.sendDialogue("Your inventory is too full to hold any more stardust.") return false } @@ -98,8 +97,8 @@ class ShootingStarMiningPulse(player: Player?, node: Scenery?, val star: Shootin } player.skills.addExperience(Skills.MINING, xp) - if (ShootingStarOptionHandler.getStarDust(player) < 200) { - player.inventory.add(Item(ShootingStarOptionHandler.STAR_DUST, 1)) + if (ShootingStarPlugin.getStarDust(player) < 200) { + player.inventory.add(Item(ShootingStarPlugin.STAR_DUST, 1)) } if(!inInventory(player, Items.ANCIENT_BLUEPRINT_14651) && !inBank(player, Items.ANCIENT_BLUEPRINT_14651)){ rollBlueprint(player) diff --git a/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStarOptionHandler.kt b/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStarOptionHandler.kt deleted file mode 100644 index 8b8fc6cee..000000000 --- a/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStarOptionHandler.kt +++ /dev/null @@ -1,39 +0,0 @@ -package rs09.game.content.global.worldevents.shootingstar - -import core.game.node.entity.player.Player -import rs09.game.content.global.worldevents.WorldEvents -import rs09.game.interaction.InteractionListener - -/** - * Option handlers for the various shooting star objects. - */ -class ShootingStarOptionHandler : InteractionListener() { - - val SHOOTING_STARS = ShootingStarType.values().map(ShootingStarType::objectId).toIntArray() - - override fun defineListeners() { - on(SHOOTING_STARS,SCENERY,"mine"){ player, _ -> - val star = (WorldEvents.get("shooting-stars") as ShootingStarEvent).star - star.mine(player) - return@on true - } - - on(SHOOTING_STARS,SCENERY,"prospect"){ player, _ -> - val star = (WorldEvents.get("shooting-stars") as ShootingStarEvent).star - star.prospect(player) - return@on true - } - } - - companion object { - const val STAR_DUST = 13727 - /** - * Gets the star dust amount for a player. - * @param player The player. - * @return The stardust amount. - */ - fun getStarDust(player: Player): Int { - return player.inventory.getAmount(STAR_DUST) + player.bank.getAmount(STAR_DUST) - } - } -} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStarPlugin.kt b/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStarPlugin.kt new file mode 100644 index 000000000..d8305627c --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/ShootingStarPlugin.kt @@ -0,0 +1,176 @@ +package rs09.game.content.global.worldevents.shootingstar + +import api.* +import core.game.node.entity.player.Player +import core.game.node.entity.player.link.TeleportManager +import core.game.node.entity.skill.Skills +import org.json.simple.JSONObject +import org.rs09.consts.Items +import org.rs09.consts.Scenery +import rs09.ServerStore +import rs09.ServerStore.Companion.getBoolean +import rs09.game.content.dialogue.DialogueFile +import rs09.game.interaction.InteractionListener +import rs09.game.system.SystemLogger +import rs09.game.system.command.Privilege +import rs09.game.world.GameWorld +import rs09.tools.secondsToTicks + +class ShootingStarPlugin : LoginListener, InteractionListener, TickListener, Commands, StartupListener { + override fun login(player: Player) { + if(star.isSpawned && !star.spriteSpawned) + sendMessage(player, "News: A shooting star (Level ${star.level.ordinal + 1}) has just crashed near the ${star.location}!") + } + + override fun tick() { + ++star.ticks + + val maxDelay = tickDelay + (tickDelay / 3) + if(star.ticks > maxDelay && star.spriteSpawned){ + star.clearSprite() + } + + if ((star.ticks >= tickDelay && !star.spriteSpawned) || (!star.isSpawned && !star.spriteSpawned)) { + star.fire() + } + } + + override fun defineListeners() { + on(Scenery.SHOOTING_STAR_NOTICEBOARD_38669, SCENERY, "read") { player, _ -> + var index = 0 + scoreboardEntries.forEach { entry -> + val timeElapsed = secondsToTicks(GameWorld.ticks - entry.time) / 60 + setInterfaceText(player, "$timeElapsed minutes ago", scoreboardIface, index + 6) + setInterfaceText(player, entry.player, scoreboardIface, index + 11) + ++index + } + openInterface(player, scoreboardIface) + return@on true + } + + on(SHOOTING_STARS,SCENERY,"mine"){ player, _ -> + star.mine(player) + return@on true + } + + on(SHOOTING_STARS,SCENERY,"prospect"){ player, _ -> + star.prospect(player) + return@on true + } + + on(RING, ITEM, "rub", "operate"){player, node -> + if(getRingStoreFile().getBoolean(player.username.toLowerCase())){ + sendDialogue(player, "The ring is still recharging.") + return@on true + } + + val condition: (Player) -> Boolean = when(star.location.toLowerCase()){ + "canifis bank" -> { p -> p.questRepository.isComplete("Priest in Peril")} + "crafting guild" -> {p -> hasLevelStat(p, Skills.CRAFTING, 40) } + "south crandor mining site" -> {p -> p.questRepository.isComplete("Dragon Slayer")} + else -> {_ -> true} + } + + if(!condition.invoke(player) || player.skullManager.isWilderness){ + sendDialogue(player, "Magical forces prevent your teleportation.") + return@on true + } + + val shouldWarn = when(star.location){ + "North Edgeville mining site", + "Southern wilderness mine", + "Pirates' Hideout mine", + "Lava Maze mining site", + "Mage Arena bank" -> true + else -> false + } + + openDialogue(player, RingDialogue(shouldWarn, star)) + + return@on true + } + } + + override fun defineCommands() { + define("tostar", Privilege.ADMIN) { player, _ -> + teleport(player, star.starObject.location.transform(1,1,0)) + } + + define("submit", Privilege.ADMIN) { _, _ -> + star.fire() + } + + define("resetsprite", Privilege.ADMIN) { player, _ -> + player.savedData.globalData.starSpriteDelay = 0L + } + } + + override fun startup() { + SystemLogger.logInfo("Shooting Stars initialized.") + } + + private data class ScoreboardEntry(val player: String, val time: Int) + + private class RingDialogue(val shouldWarn: Boolean, val star: ShootingStar) : DialogueFile(){ + override fun handle(componentID: Int, buttonID: Int) { + if(shouldWarn){ + when(stage) { + 0 -> dialogue("WARNING: That mining site is located in the wilderness.").also { stage++ } + 1 -> player!!.dialogueInterpreter.sendOptions("Continue?","Yes","No").also { stage++ } + 2 -> when(buttonID){ + 1 -> teleport(player!!, star).also { end() } + 2 -> end() + } + } + } else { + when(stage){ + 0 -> player!!.dialogueInterpreter.sendOptions("Teleport to the Star?", "Yes", "No").also { stage++ } + 1 -> when(buttonID){ + 1 -> teleport(player!!, star).also { end() } + 2 -> end() + } + } + } + } + + fun teleport(player: Player, star: ShootingStar){ + teleport(player, star.crash_locations[star.location]!!.transform(0, -1, 0), TeleportManager.TeleportType.MINIGAME) + getRingStoreFile()[player.username.toLowerCase()] = true + } + } + + companion object { + private val star = ShootingStar() + private val tickDelay = if(GameWorld.settings?.isDevMode == true) 200 else 25000 + private val scoreboardEntries = ArrayList() + private val scoreboardIface = 787 + val SHOOTING_STARS = ShootingStarType.values().map(ShootingStarType::objectId).toIntArray() + val STAR_DUST = Items.STARDUST_13727 + val RING = Items.RING_OF_THE_STAR_SPRITE_14652 + + + @JvmStatic fun submitScoreBoard(player: Player) + { + if(scoreboardEntries.size == 5) + scoreboardEntries.removeAt(0) + scoreboardEntries.add(ScoreboardEntry(player.username, GameWorld.ticks)) + } + + @JvmStatic fun getStar(): ShootingStar + { + return star + } + + @JvmStatic fun getStoreFile() : JSONObject { + return ServerStore.getArchive("shooting-star") + } + + @JvmStatic fun getRingStoreFile() : JSONObject { + return ServerStore.getArchive("daily-star-ring") + } + + fun getStarDust(player: Player): Int { + return player.inventory.getAmount(STAR_DUST) + player.bank.getAmount(STAR_DUST) + } + } +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/StarSpriteDialogue.kt b/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/StarSpriteDialogue.kt index 10d8cafc3..38b77f9c0 100644 --- a/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/StarSpriteDialogue.kt +++ b/Server/src/main/kotlin/rs09/game/content/global/worldevents/shootingstar/StarSpriteDialogue.kt @@ -7,6 +7,7 @@ import core.game.content.dialogue.FacialExpression import core.game.node.entity.npc.NPC import core.game.node.entity.player.Player import core.game.node.item.Item +import core.plugin.Initializable import core.tools.RandomFunction import org.json.simple.JSONObject import org.rs09.consts.Items @@ -21,6 +22,7 @@ import java.util.concurrent.TimeUnit /** * Dialogue for the star sprite. */ +@Initializable class StarSpriteDialogue(player: Player? = null) : DialoguePlugin(player) { /** @@ -70,7 +72,7 @@ class StarSpriteDialogue(player: Player? = null) : DialoguePlugin(player) { } else if (inInventory(player, Items.ANCIENT_BLUEPRINT_14651) && getAttribute(player, "star-ring:bp-shown", false)) { playerl(FacialExpression.HALF_ASKING, "So about those rings...") stage = 2000 - } else if (getStoreFile().getBoolean(player.username.toLowerCase()) || !player.getInventory().contains(ShootingStarOptionHandler.STAR_DUST, 1)) { + } else if (getStoreFile().getBoolean(player.username.toLowerCase()) || !player.getInventory().contains(ShootingStarPlugin.STAR_DUST, 1)) { npc("Hello, strange creature.") stage = 0 } else { @@ -185,8 +187,8 @@ class StarSpriteDialogue(player: Player? = null) : DialoguePlugin(player) { 41 -> end() 50 -> { val wearingRing = inEquipment(player, Items.RING_OF_THE_STAR_SPRITE_14652) - val dust = if (player.getInventory().getAmount(ShootingStarOptionHandler.STAR_DUST) > 200) 200 else player.getInventory().getAmount(ShootingStarOptionHandler.STAR_DUST) - if (player.getInventory().remove(Item(ShootingStarOptionHandler.STAR_DUST, dust))) { + val dust = if (player.getInventory().getAmount(ShootingStarPlugin.STAR_DUST) > 200) 200 else player.getInventory().getAmount(ShootingStarPlugin.STAR_DUST) + if (player.getInventory().remove(Item(ShootingStarPlugin.STAR_DUST, dust))) { val cosmicRunes = (Math.ceil(0.76 * dust) * AMPLIFIER).toInt() val astralRunes = (Math.ceil(0.26 * dust) * AMPLIFIER).toInt() val goldOre = (Math.ceil(0.1 * dust) * AMPLIFIER).toInt() diff --git a/Server/src/main/kotlin/rs09/game/content/jobs/WorkForInteractionListener.kt b/Server/src/main/kotlin/rs09/game/content/jobs/WorkForInteractionListener.kt index 3b3d8d6f0..d40c88e54 100644 --- a/Server/src/main/kotlin/rs09/game/content/jobs/WorkForInteractionListener.kt +++ b/Server/src/main/kotlin/rs09/game/content/jobs/WorkForInteractionListener.kt @@ -24,7 +24,7 @@ import java.util.concurrent.TimeUnit * Handles the work-for actions for the NPCs * @author Ceikry */ -class WorkForInteractionListener : InteractionListener(), LoginListener { +class WorkForInteractionListener : InteractionListener, LoginListener { val possibleWeaponLooks = arrayListOf( Items.BRONZE_SCIMITAR_1321, Items.STEEL_SCIMITAR_1325, diff --git a/Server/src/main/kotlin/rs09/game/content/quest/free/dragonslayer/DSEquipListeners.kt b/Server/src/main/kotlin/rs09/game/content/quest/free/dragonslayer/DSEquipListeners.kt index 78cd02f23..55e1fed93 100644 --- a/Server/src/main/kotlin/rs09/game/content/quest/free/dragonslayer/DSEquipListeners.kt +++ b/Server/src/main/kotlin/rs09/game/content/quest/free/dragonslayer/DSEquipListeners.kt @@ -4,7 +4,7 @@ import api.* import org.rs09.consts.Items import rs09.game.interaction.InteractionListener -class DSEquipListeners : InteractionListener() { +class DSEquipListeners : InteractionListener { private val restrictedItems = intArrayOf( Items.RUNE_PLATEBODY_1127, diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/familycrest/JohnathonAntiPoisonInteraction.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/familycrest/JohnathonAntiPoisonInteraction.kt index 4af81e3db..9476bc3b1 100644 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/familycrest/JohnathonAntiPoisonInteraction.kt +++ b/Server/src/main/kotlin/rs09/game/content/quest/members/familycrest/JohnathonAntiPoisonInteraction.kt @@ -6,7 +6,7 @@ import org.rs09.consts.Items import org.rs09.consts.NPCs import rs09.game.interaction.InteractionListener -class JohnathonAntiPosionInteraction: InteractionListener() { +class JohnathonAntiPosionInteraction: InteractionListener { override fun defineListeners() { val poisons = intArrayOf(Items.ANTIPOISON4_2446, Items.ANTIPOISON3_175, Items.ANTIPOISON2_177, Items.ANTIPOISON1_179) diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/familycrest/WitchavenLeverInteraction.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/familycrest/WitchavenLeverInteraction.kt index c74423672..4973bc451 100644 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/familycrest/WitchavenLeverInteraction.kt +++ b/Server/src/main/kotlin/rs09/game/content/quest/members/familycrest/WitchavenLeverInteraction.kt @@ -32,7 +32,7 @@ fun doDoor(player: Player, scenery: Scenery) { } -class WitchavenLeverInteraction : InteractionListener() { +class WitchavenLeverInteraction : InteractionListener { val DOWN_ANIMATION = Animation(2140) val UP_ANIMATION = Animation(2139) diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/monksfriend/BrotherCedricNPC.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/monksfriend/BrotherCedricNPC.kt index 73d322a38..f7325df2a 100644 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/monksfriend/BrotherCedricNPC.kt +++ b/Server/src/main/kotlin/rs09/game/content/quest/members/monksfriend/BrotherCedricNPC.kt @@ -109,7 +109,7 @@ class BrotherCedricDialogue : DialogueFile() { * Handles BrotherCedricListener to launch the dialogue * @author Kya */ -class BrotherCedricListener : InteractionListener() { +class BrotherCedricListener : InteractionListener { override fun defineListeners() { on(NPCs.BROTHER_CEDRIC_280, NPC, "talk-to"){ player, _ -> player.dialogueInterpreter.open(BrotherCedricDialogue(), NPC(NPCs.BROTHER_CEDRIC_280)) diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/monksfriend/BrotherOmadNPC.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/monksfriend/BrotherOmadNPC.kt index ac1856615..2487cbf4f 100644 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/monksfriend/BrotherOmadNPC.kt +++ b/Server/src/main/kotlin/rs09/game/content/quest/members/monksfriend/BrotherOmadNPC.kt @@ -205,7 +205,7 @@ class BrotherOmadDialogue : DialogueFile() { * Handles BrotherCedricListener to launch the dialogue * @author Kya */ -class BrotherOmadListener : InteractionListener() { +class BrotherOmadListener : InteractionListener { override fun defineListeners() { on(NPCs.BROTHER_OMAD_279, NPC, "talk-to"){ player, _ -> player.dialogueInterpreter.open(BrotherOmadDialogue(), NPC(NPCs.BROTHER_OMAD_279)) diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/monksfriend/MonasteryMonkNPC.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/monksfriend/MonasteryMonkNPC.kt index ce26756b6..e4d94c83a 100644 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/monksfriend/MonasteryMonkNPC.kt +++ b/Server/src/main/kotlin/rs09/game/content/quest/members/monksfriend/MonasteryMonkNPC.kt @@ -34,7 +34,7 @@ class MonasteryMonkDialogue : DialogueFile() { * Handles BrotherCedricListener to launch the dialogue * @author Kya */ -class MonasteryMonkListener : InteractionListener() { +class MonasteryMonkListener : InteractionListener { override fun defineListeners() { on(NPCs.MONK_281, NPC, "talk-to"){ player, _ -> player.dialogueInterpreter.open(MonasteryMonkDialogue(), NPC(NPCs.MONK_281)) diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/naturespirit/NSListeners.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/naturespirit/NSListeners.kt index 971d04a4a..09c86e94d 100644 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/naturespirit/NSListeners.kt +++ b/Server/src/main/kotlin/rs09/game/content/quest/members/naturespirit/NSListeners.kt @@ -20,7 +20,7 @@ import rs09.game.system.SystemLogger import rs09.game.system.config.ShopParser import rs09.tools.END_DIALOGUE -class NSListeners : InteractionListener() { +class NSListeners : InteractionListener { val GROTTO_TREE = 3517 val GROTTO_ENTRANCE = 3516 diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/HunterTalismanListener.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/HunterTalismanListener.kt index a52a0d5ec..15ff19164 100644 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/HunterTalismanListener.kt +++ b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/HunterTalismanListener.kt @@ -10,7 +10,7 @@ import rs09.game.world.GameWorld.Pulser import kotlin.math.abs import kotlin.math.atan2 -class HunterTalismanListener : InteractionListener() { +class HunterTalismanListener : InteractionListener { val TALISMAN = Items.HUNTERS_TALISMAN_3696 diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/SeerLockInterfaceListener.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/SeerLockInterfaceListener.kt index 04ee4eb96..231266e68 100644 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/SeerLockInterfaceListener.kt +++ b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/SeerLockInterfaceListener.kt @@ -4,9 +4,9 @@ import api.sendMessage import core.game.container.access.BitregisterAssembler import rs09.game.interaction.InterfaceListener -class SeerLockInterfaceListener : InterfaceListener() { +class SeerLockInterfaceListener : InterfaceListener { - override fun defineListeners() { + override fun defineInterfaceListeners() { val LETTERONEBACK = 39 val LETTERONEFORWARD = 40 val LETTERTWOBACK = 35 diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/SeersHouseListeners.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/SeersHouseListeners.kt index 4a78dd024..847115c80 100644 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/SeersHouseListeners.kt +++ b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/SeersHouseListeners.kt @@ -16,7 +16,7 @@ import rs09.game.content.dialogue.DialogueFile import rs09.game.interaction.InteractionListener import rs09.tools.stringtools.RED -class SeersHouseListeners : InteractionListener() { +class SeersHouseListeners : InteractionListener { val WESTDOOR = 4165 val EASTDOOR = 4166 diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/TFTInteractionListeners.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/TFTInteractionListeners.kt index 883141fa8..9059824a2 100644 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/TFTInteractionListeners.kt +++ b/Server/src/main/kotlin/rs09/game/content/quest/members/thefremenniktrials/TFTInteractionListeners.kt @@ -30,7 +30,7 @@ import rs09.game.system.config.ItemConfigParser import rs09.game.world.GameWorld import rs09.game.world.GameWorld.Pulser -class TFTInteractionListeners : InteractionListener(){ +class TFTInteractionListeners : InteractionListener{ val BEER = Items.BEER_1917 val WORKER = NPCs.COUNCIL_WORKMAN_1287 diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/thelostcity/DramenTreeListener.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/thelostcity/DramenTreeListener.kt index 5b920e067..a631ee612 100644 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/thelostcity/DramenTreeListener.kt +++ b/Server/src/main/kotlin/rs09/game/content/quest/members/thelostcity/DramenTreeListener.kt @@ -7,7 +7,7 @@ import core.game.node.entity.skill.gather.SkillingTool import core.game.world.map.Location import rs09.game.interaction.InteractionListener -class DramenTreeListener : InteractionListener() { +class DramenTreeListener : InteractionListener { val DRAMEN_TREE = 1292 diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/thelosttribe/PickpocketSigmund.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/thelosttribe/PickpocketSigmund.kt index 01fe466b3..d4da27d6b 100644 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/thelosttribe/PickpocketSigmund.kt +++ b/Server/src/main/kotlin/rs09/game/content/quest/members/thelosttribe/PickpocketSigmund.kt @@ -13,7 +13,7 @@ import rs09.game.world.GameWorld * handles pickpocketing sigmund during the lost tribe quest * @author Ceikry */ -class PickpocketSigmund : InteractionListener(){ +class PickpocketSigmund : InteractionListener{ val SIGMUND = NPCs.SIGMUND_2082 override fun defineListeners() { diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/tribaltotem/TTDoorCodeInterfaceListener.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/tribaltotem/TTDoorCodeInterfaceListener.kt index da9503696..2b041fc58 100644 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/tribaltotem/TTDoorCodeInterfaceListener.kt +++ b/Server/src/main/kotlin/rs09/game/content/quest/members/tribaltotem/TTDoorCodeInterfaceListener.kt @@ -6,9 +6,9 @@ import api.setInterfaceText import core.game.world.map.Location import rs09.game.interaction.InterfaceListener -class TTDoorCodeInterfaceListener : InterfaceListener() { +class TTDoorCodeInterfaceListener : InterfaceListener { - override fun defineListeners() { + override fun defineInterfaceListeners() { val LETTERONEBACK = 10 val LETTERONEFORWARD = 11 val LETTERTWOBACK = 12 diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/tribaltotem/TribalTotemListeners.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/tribaltotem/TribalTotemListeners.kt index 064132275..cf5325ae6 100644 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/tribaltotem/TribalTotemListeners.kt +++ b/Server/src/main/kotlin/rs09/game/content/quest/members/tribaltotem/TribalTotemListeners.kt @@ -10,7 +10,7 @@ import core.game.world.update.flag.context.Animation import org.rs09.consts.Items import rs09.game.interaction.InteractionListener -class TribalTotemListeners : InteractionListener(){ +class TribalTotemListeners : InteractionListener{ val frontDoor = 2706 val wizCrate = 2707 diff --git a/Server/src/main/kotlin/rs09/game/content/quest/members/waterfall/WaterfallListeners.kt b/Server/src/main/kotlin/rs09/game/content/quest/members/waterfall/WaterfallListeners.kt index a2d187a89..9b7ea6c19 100644 --- a/Server/src/main/kotlin/rs09/game/content/quest/members/waterfall/WaterfallListeners.kt +++ b/Server/src/main/kotlin/rs09/game/content/quest/members/waterfall/WaterfallListeners.kt @@ -4,7 +4,7 @@ import core.game.world.map.Location import org.rs09.consts.NPCs import rs09.game.interaction.InteractionListener -class WaterfallListeners : InteractionListener(){ +class WaterfallListeners : InteractionListener{ val HUDON = NPCs.HUDON_305 override fun defineListeners() { diff --git a/Server/src/main/kotlin/rs09/game/content/tutorial/TutorialListeners.kt b/Server/src/main/kotlin/rs09/game/content/tutorial/TutorialListeners.kt index 5fde2e1b2..57008405e 100644 --- a/Server/src/main/kotlin/rs09/game/content/tutorial/TutorialListeners.kt +++ b/Server/src/main/kotlin/rs09/game/content/tutorial/TutorialListeners.kt @@ -13,7 +13,7 @@ import rs09.game.interaction.InteractionListener * Handles tutorial-specific node interactions * @author Ceikry */ -class TutorialListeners : InteractionListener() { +class TutorialListeners : InteractionListener { val GUIDE_HOUSE_DOOR = 3014 val COOKS_DOOR = 3017 val COOKS_EXIT = 3018 diff --git a/Server/src/main/kotlin/rs09/game/content/zone/YanilleAgilityDungeon.kt b/Server/src/main/kotlin/rs09/game/content/zone/YanilleAgilityDungeon.kt index c8255839d..2a6d955ca 100644 --- a/Server/src/main/kotlin/rs09/game/content/zone/YanilleAgilityDungeon.kt +++ b/Server/src/main/kotlin/rs09/game/content/zone/YanilleAgilityDungeon.kt @@ -34,7 +34,7 @@ import core.tools.RandomFunction */ val SINISTER_CHEST_HERBS = arrayOf(Item(205, 2), Item(207, 3), Item(209), Item(211), Item(213), Item(219)) -public class YanilleAgilityDungeonListeners : InteractionListener() { +public class YanilleAgilityDungeonListeners : InteractionListener { override fun defineListeners() { ZoneBuilder.configure(YanilleAgilityDungeon()); diff --git a/Server/src/main/kotlin/rs09/game/content/zone/keldagrim/OrdanDialogue.kt b/Server/src/main/kotlin/rs09/game/content/zone/keldagrim/OrdanDialogue.kt index 891dbc56c..b13af8880 100644 --- a/Server/src/main/kotlin/rs09/game/content/zone/keldagrim/OrdanDialogue.kt +++ b/Server/src/main/kotlin/rs09/game/content/zone/keldagrim/OrdanDialogue.kt @@ -50,7 +50,7 @@ class OrdanDialogue(player: Player? = null) : DialoguePlugin(player) { * just comment those options out if you don't want em * aka "WOW I CAN'T BELIEVE IT'S ALL CONDITIONALS*/ - class OrdanUnnoteListener : InteractionListener() { + class OrdanUnnoteListener : InteractionListener { val notedOre = intArrayOf( Items.IRON_ORE_441, Items.COPPER_ORE_437, diff --git a/Server/src/main/kotlin/rs09/game/content/zone/phasmatys/bonegrinder/BoneGrinderListener.kt b/Server/src/main/kotlin/rs09/game/content/zone/phasmatys/bonegrinder/BoneGrinderListener.kt index afdeb3ac5..1bc75404b 100644 --- a/Server/src/main/kotlin/rs09/game/content/zone/phasmatys/bonegrinder/BoneGrinderListener.kt +++ b/Server/src/main/kotlin/rs09/game/content/zone/phasmatys/bonegrinder/BoneGrinderListener.kt @@ -24,7 +24,7 @@ private val FILL_ANIM = Animation(1649) private val WIND_ANIM = Animation(1648) private val SCOOP_ANIM = Animation(1650) -class BoneGrinderListener : InteractionListener() { +class BoneGrinderListener : InteractionListener { private val boneIDs = Bones.values().map { it.itemId }.toIntArray() diff --git a/Server/src/main/kotlin/rs09/game/interaction/CorporealBeastWarningInterface.kt b/Server/src/main/kotlin/rs09/game/interaction/CorporealBeastWarningInterface.kt index 4772e322a..c259ede92 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/CorporealBeastWarningInterface.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/CorporealBeastWarningInterface.kt @@ -8,11 +8,11 @@ import rs09.game.world.GameWorld * Handles the corporeal beast warning interface * @author Ceikry */ -class CorporealBeastWarningInterface : InterfaceListener(){ +class CorporealBeastWarningInterface : InterfaceListener{ val COMPONENT_ID = 650 - override fun defineListeners() { + override fun defineInterfaceListeners() { on(COMPONENT_ID,17){player,component,_,_,_,_ -> if(player.getAttribute("corp-beast-cave-delay",0) <= GameWorld.ticks) { player.properties.teleportLocation = player.location.transform(4, 0, 0).also { close(player,component) } diff --git a/Server/src/main/kotlin/rs09/game/interaction/InteractionListener.kt b/Server/src/main/kotlin/rs09/game/interaction/InteractionListener.kt index 76113bef4..869f9ba7f 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/InteractionListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/InteractionListener.kt @@ -1,17 +1,21 @@ package rs09.game.interaction +import api.ContentInterface import core.game.node.Node import core.game.node.entity.Entity import core.game.node.entity.player.Player import core.game.world.map.Location -abstract class InteractionListener : Listener{ - companion object { - val ITEM = 0 - val SCENERY = 1 - val NPC = 2 - val GROUNDITEM = 3 - } +interface InteractionListener : ContentInterface{ + val ITEM: Int + get() = 0 + val SCENERY: Int + get() = 1 + val NPC: Int + get() = 2 + val GROUNDITEM: Int + get() = 3 + fun on(id: Int, type: Int, vararg option: String,handler: (player: Player, node: Node) -> Boolean){ InteractionListeners.add(id,type,option,handler) } @@ -65,4 +69,14 @@ abstract class InteractionListener : Listener{ fun onDig(location: Location,method: (player: Player) -> Unit){ SpadeDigListener.registerListener(location,method) } + + fun defineListeners() + + companion object + { + val ITEM = 0 + val SCENERY = 1 + val NPC = 2 + val GROUNDITEM = 3 + } } diff --git a/Server/src/main/kotlin/rs09/game/interaction/InterfaceListener.kt b/Server/src/main/kotlin/rs09/game/interaction/InterfaceListener.kt index b7f38e092..f571de6a8 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/InterfaceListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/InterfaceListener.kt @@ -1,9 +1,17 @@ package rs09.game.interaction +import api.ContentInterface import core.game.component.Component import core.game.node.entity.player.Player -abstract class InterfaceListener : Listener { +/** + * An interface for writing content that allows the class to handle game interface interactions + * + * Interactions should be defined in the required [defineInterfaceListeners] method. + */ +interface InterfaceListener : ContentInterface { + fun defineInterfaceListeners() + fun on(componentID: Int, buttonID: Int, handler: (player: Player, component: Component, opcode: Int, buttonID: Int, slot: Int, itemID: Int) -> Boolean){ InterfaceListeners.add(componentID,buttonID,handler) } diff --git a/Server/src/main/kotlin/rs09/game/interaction/Listener.kt b/Server/src/main/kotlin/rs09/game/interaction/Listener.kt index c576a2f3f..acb46a58b 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/Listener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/Listener.kt @@ -3,8 +3,9 @@ package rs09.game.interaction import api.StartupListener interface Listener : StartupListener { - fun defineListeners() override fun startup() { defineListeners() } + + fun defineListeners() } \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/interaction/inter/CreditShopInterface.kt b/Server/src/main/kotlin/rs09/game/interaction/inter/CreditShopInterface.kt index 781c5c87c..9ecf360ec 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/inter/CreditShopInterface.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/inter/CreditShopInterface.kt @@ -7,12 +7,12 @@ import org.rs09.consts.Components import org.rs09.consts.Items import rs09.game.interaction.InterfaceListener -class CreditShopInterface : InterfaceListener() { +class CreditShopInterface : InterfaceListener { val CREDIT_SHOP = Components.CREDIT_SHOP val TEXT_CHILD = 39 - override fun defineListeners() { + override fun defineInterfaceListeners() { on(CREDIT_SHOP){player, component, opcode, buttonID, slot, itemID -> val item = getItem(buttonID) diff --git a/Server/src/main/kotlin/rs09/game/interaction/inter/FairyRingInterface.kt b/Server/src/main/kotlin/rs09/game/interaction/inter/FairyRingInterface.kt index 800217ab5..4bc6945c7 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/inter/FairyRingInterface.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/inter/FairyRingInterface.kt @@ -21,12 +21,12 @@ val RING_3 = arrayOf('p','s','r','q') * Handles the fairy ring interface * @author Ceikry */ -class FairyRingInterface : InterfaceListener(){ +class FairyRingInterface : InterfaceListener{ val RINGS = 734 val TRAVEL_LOG = 735 - override fun defineListeners() { + override fun defineInterfaceListeners() { onOpen(RINGS){player, _ -> player.interfaceManager.openSingleTab(Component(TRAVEL_LOG)) diff --git a/Server/src/main/kotlin/rs09/game/interaction/inter/MainGameInterface.kt b/Server/src/main/kotlin/rs09/game/interaction/inter/MainGameInterface.kt index 5a8536884..f61c352b7 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/inter/MainGameInterface.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/inter/MainGameInterface.kt @@ -11,14 +11,14 @@ import org.rs09.consts.Components import rs09.game.interaction.InterfaceListener import rs09.game.world.GameWorld.settings -class MainGameInterface : InterfaceListener() { +class MainGameInterface : InterfaceListener { val TOPLEVEL = Components.TOPLEVEL_548 val TOPLEVEL_FS = Components.TOPLEVEL_FULLSCREEN_746 val RUN_BUTTON = Components.TOPSTAT_RUN_750 val FILTER_BUTTONS = Components.FILTERBUTTONS_751 val REPORT_ABUSE = Components.SNAPSHOT_MAIN_553 - override fun defineListeners() { + override fun defineInterfaceListeners() { on(FILTER_BUTTONS){player, _, _, buttonID, _, _ -> if(buttonID == 27) openReport(player) diff --git a/Server/src/main/kotlin/rs09/game/interaction/inter/NPCContactInterface.kt b/Server/src/main/kotlin/rs09/game/interaction/inter/NPCContactInterface.kt index f7c1d8ef5..7f49bbe5f 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/inter/NPCContactInterface.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/inter/NPCContactInterface.kt @@ -7,7 +7,7 @@ import org.rs09.consts.NPCs import rs09.game.content.dialogue.DialogueFile import rs09.game.interaction.InterfaceListener -class NPCContactInterface : InterfaceListener() { +class NPCContactInterface : InterfaceListener { val contactNPCs = arrayOf(NPCs.HONEST_JIMMY_4362, NPCs.BERT_3108, NPCs.ADVISOR_GHRIM_1375, NPCs.TURAEL_8273, NPCs.LANTHUS_1526, NPCs.SUMONA_7780, NPCs.MAZCHNA_8274, NPCs.DURADEL_8275, NPCs.VANNAKA_1597, NPCs.DARK_MAGE_2262, NPCs.CHAELDAR_1598, NPCs.CYRISUS_432, NPCs.LARRY_5424) val DialogueFiles = arrayOf( /*TODO("Honest Jimmy"), @@ -25,7 +25,7 @@ class NPCContactInterface : InterfaceListener() { TODO("Larry")*/ ) val INTER = 429 - override fun defineListeners() { + override fun defineInterfaceListeners() { //Remove a bunch of the buttons/heads so that people don't //waste runes on spells that aren't implemented diff --git a/Server/src/main/kotlin/rs09/game/interaction/inter/RulesAndInfo.kt b/Server/src/main/kotlin/rs09/game/interaction/inter/RulesAndInfo.kt index 7eeac8bdf..6b7e81ad6 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/inter/RulesAndInfo.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/inter/RulesAndInfo.kt @@ -46,9 +46,9 @@ object RulesAndInfo { } } -class RulesListener : InterfaceListener() +class RulesListener : InterfaceListener { - override fun defineListeners() { + override fun defineInterfaceListeners() { onClose(384){player, _ -> if(!getAttribute(player, "rules:confirmed", false)) runTask(player, 1) { RulesAndInfo.openFor(player); sendDialogue(player, "Please read the rules.") } diff --git a/Server/src/main/kotlin/rs09/game/interaction/inter/SilverInterface.kt b/Server/src/main/kotlin/rs09/game/interaction/inter/SilverInterface.kt index 451f8f484..0f5026d75 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/inter/SilverInterface.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/inter/SilverInterface.kt @@ -11,12 +11,12 @@ import org.rs09.consts.Items import rs09.game.interaction.InteractionListener import rs09.game.interaction.InterfaceListener -class SilverInterface : InterfaceListener() { +class SilverInterface : InterfaceListener { val IFACE = Components.CRAFTING_SILVER_CASTING_438 val ANIM = getAnimation(899) - override fun defineListeners() { + override fun defineInterfaceListeners() { onOpen(IFACE){player, _ -> sendItemOnInterface(player, IFACE, 17, 1718) sendItemOnInterface(player, IFACE, 24, 1724) @@ -89,7 +89,7 @@ class SilverInterface : InterfaceListener() { } } -class SilverBarUseWith : InteractionListener() { +class SilverBarUseWith : InteractionListener { val FURNACES = intArrayOf(2966, 3044, 3294, 4304, 6189, 11009, 11010, 11666, 12100, 12809, 18497, 18525, 18526, 21879, 22721, 26814, 28433, 28434, 30021, 30510, 36956, 37651) override fun defineListeners() { onUseWith(SCENERY, Items.SILVER_BAR_2355, *FURNACES){ player, _, _ -> diff --git a/Server/src/main/kotlin/rs09/game/interaction/inter/TeleotherInterface.kt b/Server/src/main/kotlin/rs09/game/interaction/inter/TeleotherInterface.kt index 9c89627cc..53d2589e4 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/inter/TeleotherInterface.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/inter/TeleotherInterface.kt @@ -6,10 +6,10 @@ import core.game.world.update.flag.context.Graphics import org.rs09.consts.Components import rs09.game.interaction.InterfaceListener -class TeleotherInterface : InterfaceListener() { +class TeleotherInterface : InterfaceListener { val IFACE = Components.TELEPORT_OTHER_326 - override fun defineListeners() { + override fun defineInterfaceListeners() { on(IFACE){player, _, _, button, _, _ -> if(button == 5){ player.lock(2) diff --git a/Server/src/main/kotlin/rs09/game/interaction/inter/ge/ExchangeItemSets.kt b/Server/src/main/kotlin/rs09/game/interaction/inter/ge/ExchangeItemSets.kt index 3767b0916..16f307f3c 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/inter/ge/ExchangeItemSets.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/inter/ge/ExchangeItemSets.kt @@ -13,8 +13,8 @@ import core.game.node.entity.player.Player import org.rs09.consts.Components import rs09.game.interaction.InterfaceListener -class ExchangeItemSets : InterfaceListener() { - override fun defineListeners() { +class ExchangeItemSets : InterfaceListener { + override fun defineInterfaceListeners() { onOpen(Components.EXCHANGE_ITEMSETS_645) { player, _ -> val listener: InventoryListener setAttribute(player, "ge-listener", InventoryListener(player).also { listener = it }) diff --git a/Server/src/main/kotlin/rs09/game/interaction/inter/ge/StockMarket.kt b/Server/src/main/kotlin/rs09/game/interaction/inter/ge/StockMarket.kt index c5be8baf6..733461945 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/inter/ge/StockMarket.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/inter/ge/StockMarket.kt @@ -25,8 +25,8 @@ import rs09.game.system.SystemLogger * Handles the grand exchange interface (Stock Market) * @author Ceikry */ -class StockMarket : InterfaceListener() { - override fun defineListeners() { +class StockMarket : InterfaceListener { + override fun defineInterfaceListeners() { onOpen(Components.STOCKMARKET_105){player, _ -> player.packetDispatch.sendInterfaceConfig(105, 193, true) player.packetDispatch.sendAccessMask(6, 211, 105, -1, -1) diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/BraceletOfClayPlugin.kt b/Server/src/main/kotlin/rs09/game/interaction/item/BraceletOfClayPlugin.kt index 7090cebad..a6024728e 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/BraceletOfClayPlugin.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/BraceletOfClayPlugin.kt @@ -8,7 +8,7 @@ import rs09.game.interaction.InteractionListener * Handles the bracelet of clay operate option. * @author Ceikry */ -class BraceletOfClayPlugin : InteractionListener() { +class BraceletOfClayPlugin : InteractionListener { override fun defineListeners() { diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/CadavaPotionListener.kt b/Server/src/main/kotlin/rs09/game/interaction/item/CadavaPotionListener.kt index 54a8b117e..38230812b 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/CadavaPotionListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/CadavaPotionListener.kt @@ -8,7 +8,7 @@ import rs09.game.interaction.InteractionListener * @author bushtail */ -class CadavaPotionListener : InteractionListener() { +class CadavaPotionListener : InteractionListener { var POTION = Items.CADAVA_POTION_756 diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/DrinkBlamishOilListener.kt b/Server/src/main/kotlin/rs09/game/interaction/item/DrinkBlamishOilListener.kt index 443b20f93..5b9df3f41 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/DrinkBlamishOilListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/DrinkBlamishOilListener.kt @@ -4,7 +4,7 @@ import api.* import org.rs09.consts.Items import rs09.game.interaction.InteractionListener -class DrinkBlamishOilListener : InteractionListener() { +class DrinkBlamishOilListener : InteractionListener { override fun defineListeners() { on(Items.BLAMISH_OIL_1582, ITEM, "drink"){player, _ -> diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/EnchantedJewelleryListener.kt b/Server/src/main/kotlin/rs09/game/interaction/item/EnchantedJewelleryListener.kt index f22c93e25..3c01e2780 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/EnchantedJewelleryListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/EnchantedJewelleryListener.kt @@ -9,7 +9,7 @@ import java.util.* * Listener for enchanted jewellery options * @author Ceikry */ -class EnchantedJewelleryListener : InteractionListener() { +class EnchantedJewelleryListener : InteractionListener { val IDs: IntArray init { diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/GodBookListeners.kt b/Server/src/main/kotlin/rs09/game/interaction/item/GodBookListeners.kt index a92ae4090..c030b9b0a 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/GodBookListeners.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/GodBookListeners.kt @@ -9,7 +9,7 @@ import rs09.game.content.dialogue.DialogueFile import rs09.game.interaction.InteractionListener import rs09.tools.END_DIALOGUE -class GodBookListeners : InteractionListener() { +class GodBookListeners : InteractionListener { val GB_SARADOMIN = Items.HOLY_BOOK_3840 val GB_ZAMORAK = Items.UNHOLY_BOOK_3842 diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/GrandSeedPodHandler.kt b/Server/src/main/kotlin/rs09/game/interaction/item/GrandSeedPodHandler.kt index 9abb38463..cf314a495 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/GrandSeedPodHandler.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/GrandSeedPodHandler.kt @@ -30,7 +30,7 @@ private const val LAUNCH_ANIMATION = 4547 * Handles the grand tree pod options * @author Ceikry */ -class GrandSeedPodHandler : InteractionListener() { +class GrandSeedPodHandler : InteractionListener { override fun defineListeners() { on(Items.GRAND_SEED_POD_9469, ITEM, "squash", "launch"){player, _ -> diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/ImplingJarListener.kt b/Server/src/main/kotlin/rs09/game/interaction/item/ImplingJarListener.kt index c8099c25b..a9730319b 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/ImplingJarListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/ImplingJarListener.kt @@ -9,7 +9,7 @@ import rs09.game.content.global.WeightedItem import rs09.game.interaction.InteractionListener import rs09.game.system.SystemLogger -class ImplingJarListener : InteractionListener() { +class ImplingJarListener : InteractionListener { val JARS = ImplingLoot.values().map { it.jarId }.toIntArray() diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/ItemQuestRequirementListener.kt b/Server/src/main/kotlin/rs09/game/interaction/item/ItemQuestRequirementListener.kt index 4828ad515..25ead72bc 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/ItemQuestRequirementListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/ItemQuestRequirementListener.kt @@ -6,7 +6,7 @@ import org.rs09.consts.Items import rs09.game.interaction.InteractionListener import rs09.game.interaction.InteractionListeners.run -class ItemQuestRequirementListener : InteractionListener() { +class ItemQuestRequirementListener : InteractionListener { private val fremennikIslesEquipment = intArrayOf(Items.HELM_OF_NEITIZNOT_10828, Items.HELM_OF_NEITIZNOT_E_12680, Items.HELM_OF_NEITIZNOT_CHARGED_12681) private val fremennikTrialsEquipment = intArrayOf(Items.BERSERKER_HELM_3751, Items.BERSERKER_HELM_13408, Items.BERSERKER_HELM_E_12674, Items.BERSERKER_HELM_CHARGED_12675, diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/StaffOfTheRaven.kt b/Server/src/main/kotlin/rs09/game/interaction/item/StaffOfTheRaven.kt index 397da4e1a..1ffcc15a9 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/StaffOfTheRaven.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/StaffOfTheRaven.kt @@ -11,7 +11,7 @@ import rs09.tools.END_DIALOGUE /** * Handles the Staff of the Raven's (2021 Hween Reward) Recolor Transformation */ -class StaffOfTheRaven : InteractionListener() { +class StaffOfTheRaven : InteractionListener { val ids = intArrayOf(14654, 14655, 14656) override fun defineListeners() { on(ids, ITEM, "recolor", "operate"){player, node -> diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/StarRingListener.kt b/Server/src/main/kotlin/rs09/game/interaction/item/StarRingListener.kt deleted file mode 100644 index d654b6f09..000000000 --- a/Server/src/main/kotlin/rs09/game/interaction/item/StarRingListener.kt +++ /dev/null @@ -1,94 +0,0 @@ -package rs09.game.interaction.item - -import api.* -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.world.map.Location -import org.json.simple.JSONObject -import org.rs09.consts.Items -import rs09.ServerStore -import rs09.ServerStore.Companion.getBoolean -import rs09.game.content.dialogue.DialogueFile -import rs09.game.content.global.worldevents.WorldEvents -import rs09.game.content.global.worldevents.shootingstar.ShootingStar -import rs09.game.content.global.worldevents.shootingstar.ShootingStarEvent -import rs09.game.interaction.InteractionListener -import java.util.concurrent.TimeUnit - -class StarRingListener : InteractionListener(){ - - val RING = Items.RING_OF_THE_STAR_SPRITE_14652 - - override fun defineListeners() { - on(RING, ITEM, "rub", "operate"){player, node -> - val star = WorldEvents.get("shooting-stars") as? ShootingStarEvent - - if(star == null) sendDialogue(player, "There is currently no active star.").also { return@on true } - - if(getStoreFile().getBoolean(player.username.toLowerCase())){ - sendDialogue(player, "The ring is still recharging.") - return@on true - } - - val condition: (Player) -> Boolean = when(star?.star!!.location.toLowerCase()){ - "canifis bank" -> { p -> p.questRepository.isComplete("Priest in Peril")} - "crafting guild" -> {p -> hasLevelStat(p, Skills.CRAFTING, 40) } - "south crandor mining site" -> {p -> p.questRepository.isComplete("Dragon Slayer")} - else -> {_ -> true} - } - - if(!condition.invoke(player) || player.skullManager.isWilderness){ - sendDialogue(player, "Magical forces prevent your teleportation.") - return@on true - } - - val shouldWarn = when(star.star.location){ - "North Edgeville mining site", - "Southern wilderness mine", - "Pirates' Hideout mine", - "Lava Maze mining site", - "Mage Arena bank" -> true - else -> false - } - - openDialogue(player, RingDialogue(shouldWarn, star.star)) - - return@on true - } - } - - internal class RingDialogue(val shouldWarn: Boolean, val star: ShootingStar) : DialogueFile(){ - override fun handle(componentID: Int, buttonID: Int) { - if(shouldWarn){ - when(stage) { - 0 -> dialogue("WARNING: That mining site is located in the wilderness.").also { stage++ } - 1 -> player!!.dialogueInterpreter.sendOptions("Continue?","Yes","No").also { stage++ } - 2 -> when(buttonID){ - 1 -> teleport(player!!, star).also { end() } - 2 -> end() - } - } - } else { - when(stage){ - 0 -> player!!.dialogueInterpreter.sendOptions("Teleport to the Star?", "Yes", "No").also { stage++ } - 1 -> when(buttonID){ - 1 -> teleport(player!!, star).also { end() } - 2 -> end() - } - } - } - } - - fun teleport(player: Player, star: ShootingStar){ - teleport(player, star.crash_locations[star.location]!!.transform(0, -1, 0), TeleportManager.TeleportType.MINIGAME) - getStoreFile()[player.username.toLowerCase()] = true - } - } - - companion object { - fun getStoreFile(): JSONObject { - return ServerStore.getArchive("daily-star-ring") - } - } -} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/ToyHorseyListener.kt b/Server/src/main/kotlin/rs09/game/interaction/item/ToyHorseyListener.kt index 6938257a2..97a677edc 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/ToyHorseyListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/ToyHorseyListener.kt @@ -11,7 +11,7 @@ import rs09.game.interaction.InteractionListener * Interaction listener for the Toy Horsey item * @author Woah */ -class ToyHorseListener : InteractionListener() { +class ToyHorseListener : InteractionListener { // Map of horse item ids to their correct emote val HORSEY_MAP = mapOf( diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/ToyListeners.kt b/Server/src/main/kotlin/rs09/game/interaction/item/ToyListeners.kt index e1d364e99..b77eb943f 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/ToyListeners.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/ToyListeners.kt @@ -6,7 +6,7 @@ import core.game.world.update.flag.context.Graphics import org.rs09.consts.Items import rs09.game.interaction.InteractionListener -class ToyListeners : InteractionListener() { +class ToyListeners : InteractionListener { companion object { val MARIONETTES = intArrayOf(Items.RED_MARIONETTE_6867, Items.GREEN_MARIONETTE_6866, Items.BLUE_MARIONETTE_6865) private val MARIONETTE_JUMP = Animation(3003) diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withitem/HaySackOnSpear.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withitem/HaySackOnSpear.kt index ef31ceb08..5c6f2fe48 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withitem/HaySackOnSpear.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withitem/HaySackOnSpear.kt @@ -5,7 +5,7 @@ import api.* import org.rs09.consts.Items import rs09.game.interaction.InteractionListener -class HaySackOnSpear : InteractionListener() { +class HaySackOnSpear : InteractionListener { val HAYSACK = Items.HAY_SACK_6057 val SPEAR = Items.BRONZE_SPEAR_1237 diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withitem/OilFishingRodListener.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withitem/OilFishingRodListener.kt index 0fb70022e..9054c7136 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withitem/OilFishingRodListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withitem/OilFishingRodListener.kt @@ -6,7 +6,7 @@ import core.game.world.update.flag.context.Animation import org.rs09.consts.Items import rs09.game.interaction.InteractionListener -class OilFishingRodListener : InteractionListener() { +class OilFishingRodListener : InteractionListener { override fun defineListeners() { onUseWith(ITEM, Items.BLAMISH_OIL_1582, Items.FISHING_ROD_307) {player, used, with -> player.pulseManager.run(object : Pulse() { diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withitem/PoisonedWeaponListeners.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withitem/PoisonedWeaponListeners.kt index d7209e2b3..06fed9836 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withitem/PoisonedWeaponListeners.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withitem/PoisonedWeaponListeners.kt @@ -7,7 +7,7 @@ import rs09.game.interaction.InteractionListener import kotlin.collections.toIntArray import kotlin.math.min -class PoisonedWeaponListeners : InteractionListener() { +class PoisonedWeaponListeners : InteractionListener { override fun defineListeners() { val poisons = intArrayOf(Items.WEAPON_POISON_187, Items.WEAPON_POISON_PLUS_5937, Items.WEAPON_POISON_PLUS_PLUS_5940) val poisonableItems = PoisonSets.itemMap.keys.toIntArray() diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withitem/TOTTHelmOnCape.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withitem/TOTTHelmOnCape.kt index 7693542a5..b6af52e2a 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withitem/TOTTHelmOnCape.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withitem/TOTTHelmOnCape.kt @@ -7,7 +7,7 @@ import rs09.game.content.dialogue.DialogueFile import rs09.game.interaction.InteractionListener import rs09.tools.END_DIALOGUE -class TOTTHelmOnCape : InteractionListener() { +class TOTTHelmOnCape : InteractionListener { override fun defineListeners() { onUseWith(ITEM, Items.SLAYER_HELMET_13263, Items.SLAYER_CAPE_9786, Items.SLAYER_CAPET_9787){ player, used, with -> val alreadyHasHelm = getAttribute(player, "cape_perks:tott:helmet-stored", false) diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withitem/WatermelonOnSack.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withitem/WatermelonOnSack.kt index 859a8509b..82117f1eb 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withitem/WatermelonOnSack.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withitem/WatermelonOnSack.kt @@ -6,7 +6,7 @@ import core.game.node.entity.skill.Skills import org.rs09.consts.Items import rs09.game.interaction.InteractionListener -class WatermelonOnSack : InteractionListener() { +class WatermelonOnSack : InteractionListener { val SACK = Items.HAY_SACK_6058 val WATERMELON = Items.WATERMELON_5982 diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/ArchaeologicalExpertListener.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/ArchaeologicalExpertListener.kt index dfa9cd1d2..713d59d7e 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/ArchaeologicalExpertListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/ArchaeologicalExpertListener.kt @@ -7,7 +7,7 @@ import org.rs09.consts.NPCs import rs09.game.content.dialogue.region.examcentre.ArchaeologistcalExpertUsedOnDialogueFile import rs09.game.interaction.InteractionListener -open class ArchaeologicalExpertListener() : InteractionListener() { +open class ArchaeologicalExpertListener() : InteractionListener { val staff = Items.ANCIENT_STAFF_4675 val unidentifiedLiquid = Items.UNIDENTIFIED_LIQUID_702 val nitroglycerin = Items.NITROGLYCERIN_703 diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/BonesOnStrayDog.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/BonesOnStrayDog.kt index 0822c89c8..2188bedbe 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/BonesOnStrayDog.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/BonesOnStrayDog.kt @@ -8,7 +8,7 @@ import core.game.node.entity.player.link.diary.DiaryType import org.rs09.consts.NPCs import rs09.game.interaction.InteractionListener -class BonesOnStrayDog : InteractionListener() { +class BonesOnStrayDog : InteractionListener { override fun defineListeners() { val bones = Bones.array val dogs = intArrayOf(NPCs.STRAY_DOG_4766, NPCs.STRAY_DOG_4767, NPCs.STRAY_DOG_5917, NPCs.STRAY_DOG_5918) diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/CatOnArdougneCivilian.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/CatOnArdougneCivilian.kt index 181d91f14..db1383c41 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/CatOnArdougneCivilian.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/CatOnArdougneCivilian.kt @@ -6,7 +6,7 @@ import org.rs09.consts.Items import org.rs09.consts.NPCs import rs09.game.interaction.InteractionListener -class CatOnArdougneCivilian: InteractionListener() { +class CatOnArdougneCivilian: InteractionListener { private val civilians = intArrayOf( NPCs.CIVILIAN_785, diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/CiderOnForester.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/CiderOnForester.kt index 59cd17f8c..7ab4498e7 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/CiderOnForester.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/CiderOnForester.kt @@ -8,7 +8,7 @@ import org.rs09.consts.Items import rs09.game.content.dialogue.DialogueFile import rs09.game.interaction.InteractionListener -class CiderOnForester : InteractionListener() { +class CiderOnForester : InteractionListener { override fun defineListeners() { val ids = intArrayOf(1,2,3,4,5) diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/GCItemOnCat.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/GCItemOnCat.kt index 94136f656..75e3c992c 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/GCItemOnCat.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/GCItemOnCat.kt @@ -10,7 +10,7 @@ import org.rs09.consts.NPCs import rs09.game.interaction.InteractionListener import rs09.game.world.GameWorld.Pulser -class GCItemOnCat : InteractionListener() { +class GCItemOnCat : InteractionListener { override fun defineListeners() { val GERTCAT = "Gertrude's Cat" val BEND_DOWN = 827 diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/HatEasterEgg.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/HatEasterEgg.kt index d503b6aac..e95b939c9 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/HatEasterEgg.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/HatEasterEgg.kt @@ -9,7 +9,7 @@ import rs09.game.content.dialogue.DialogueFile import rs09.game.interaction.InteractionListener val graphics = 482 -class HatEasterEgg : InteractionListener(){ +class HatEasterEgg : InteractionListener { val MACHINE = 20040 val WIZ_HAT = Items.WIZARD_HAT_579 diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/MistagEasterEgg.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/MistagEasterEgg.kt index ce131bc81..e9ac0d973 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/MistagEasterEgg.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/MistagEasterEgg.kt @@ -9,7 +9,7 @@ import rs09.game.content.dialogue.DialogueFile import rs09.game.interaction.InteractionListener import rs09.tools.END_DIALOGUE -class MistagEasterEgg : InteractionListener() { +class MistagEasterEgg : InteractionListener { val DIAMOND = Items.DIAMOND_1601 val MISTAG = NPCs.MISTAG_2084 val ZANIK_RING = 14649 diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/PoisonChaliceOnKingArthur.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/PoisonChaliceOnKingArthur.kt index fbf80c323..58066c4b2 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/PoisonChaliceOnKingArthur.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/PoisonChaliceOnKingArthur.kt @@ -10,7 +10,7 @@ import org.rs09.consts.NPCs import rs09.game.content.dialogue.DialogueFile import rs09.game.interaction.InteractionListener -class PoisonChaliceOnKingArthur : InteractionListener() { +class PoisonChaliceOnKingArthur : InteractionListener { override fun defineListeners() { onUseWith(NPC, Items.POISON_CHALICE_197, NPCs.KING_ARTHUR_251){player, used, with -> player.dialogueInterpreter.open(PoisonChaliceOnKingArthurDialogue(),with) diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/RopeOnLadyKeli.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/RopeOnLadyKeli.kt index a9a04823a..548ba5442 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/RopeOnLadyKeli.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/RopeOnLadyKeli.kt @@ -5,7 +5,7 @@ import org.rs09.consts.Items import org.rs09.consts.NPCs import rs09.game.interaction.InteractionListener -class RopeOnLadyKeli : InteractionListener() { +class RopeOnLadyKeli : InteractionListener { override fun defineListeners() { val PAR = "Prince Ali Rescue" diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/ZooknockListener.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/ZooknockListener.kt index c3318123a..63a5289fb 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/ZooknockListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withnpc/ZooknockListener.kt @@ -8,7 +8,7 @@ import rs09.game.content.dialogue.region.examcentre.ArchaeologistcalExpertUsedOn import rs09.game.content.dialogue.region.examcentre.ZooknockDialogueFile import rs09.game.interaction.InteractionListener -open class ZooknockListener() : InteractionListener() { +open class ZooknockListener() : InteractionListener { val goldBar = Items.GOLD_BAR_2357 val monkeyAmuletMould = Items.MAMULET_MOULD_4020 val monkeyDentures = Items.MONKEY_DENTURES_4006 diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withobject/AmmoMouldOnFurnace.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withobject/AmmoMouldOnFurnace.kt index 415ba1e06..863a4f6ef 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withobject/AmmoMouldOnFurnace.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withobject/AmmoMouldOnFurnace.kt @@ -12,7 +12,7 @@ import org.rs09.consts.Items import rs09.game.content.dialogue.SkillDialogueHandler import rs09.game.interaction.InteractionListener -class AmmoMouldOnFurnace : InteractionListener(){ +class AmmoMouldOnFurnace : InteractionListener{ private val furnaces = intArrayOf(4304, 6189, 11010, 11666, 12100, 12809, 18497, 26814, 30021, 30510, 36956, 37651) // abstract when smelting converted to kotlin private val levelRequirement = 35 diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withobject/AxeOnTree.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withobject/AxeOnTree.kt index e0ed9c070..07a1abe3c 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withobject/AxeOnTree.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withobject/AxeOnTree.kt @@ -8,7 +8,7 @@ import org.rs09.consts.Items import rs09.ServerConstants import rs09.game.interaction.InteractionListener -class AxeOnTree : InteractionListener(){ +class AxeOnTree : InteractionListener{ val axes = intArrayOf(Items.BRONZE_AXE_1351, Items.MITHRIL_AXE_1355, Items.IRON_AXE_1349, Items.BLACK_AXE_1361, Items.STEEL_AXE_1353, Items.ADAMANT_AXE_1357, Items.RUNE_AXE_1359, Items.DRAGON_AXE_6739, Items.INFERNO_ADZE_13661) val trees = WoodcuttingNode.values().map { it.id }.toIntArray() diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withobject/CoalTrucksHandler.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withobject/CoalTrucksHandler.kt index dfa6ab643..e4be0c19f 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withobject/CoalTrucksHandler.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withobject/CoalTrucksHandler.kt @@ -11,7 +11,7 @@ import java.util.* * Handles coal truck interactions * @author ceik */ -class CoalTruckInteractionListeners : InteractionListener() { +class CoalTruckInteractionListeners : InteractionListener { val SEERS_VILLAGE_COAL_TRUCK_2114 = 2114 val seersVillageTrucks = ZoneBorders(2690,3502,2699,3508) diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withobject/FishEasterEgg.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withobject/FishEasterEgg.kt index 6d90ae74a..db5cc1a23 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withobject/FishEasterEgg.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withobject/FishEasterEgg.kt @@ -5,7 +5,7 @@ import core.game.node.entity.skill.gather.woodcutting.WoodcuttingNode import org.rs09.consts.Items import rs09.game.interaction.InteractionListener -class FishEasterEgg : InteractionListener() { +class FishEasterEgg : InteractionListener { val TREE_IDs = WoodcuttingNode.values().map { it.id }.toIntArray() val fish = intArrayOf(Items.RAW_HERRING_345, Items.HERRING_347) diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withobject/HatStand.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withobject/HatStand.kt index 1e0a7f12f..a7f76b8f6 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withobject/HatStand.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withobject/HatStand.kt @@ -6,7 +6,7 @@ import core.cache.def.impl.ItemDefinition import rs09.game.interaction.InteractionListener import rs09.game.system.SystemLogger -class HatStand : InteractionListener() { +class HatStand : InteractionListener { val hats = ItemDefinition.getDefinitions().values.filter { it.getConfiguration("equipment_slot",0) == EquipmentSlot.HAT.ordinal }.map { it.id }.toIntArray() val hat_stand = 374 diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withobject/SackOnHay.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withobject/SackOnHay.kt index b716ef9a8..8297e0f79 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withobject/SackOnHay.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withobject/SackOnHay.kt @@ -5,7 +5,7 @@ import api.* import org.rs09.consts.Items import rs09.game.interaction.InteractionListener -class SackOnHay : InteractionListener() { +class SackOnHay : InteractionListener { val SACK = Items.EMPTY_SACK_5418 val HAY = intArrayOf(36892, 36894, 36896, 300, 34593, 298, 299) diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withobject/WaterSourceListener.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withobject/WaterSourceListener.kt index 6c0be65fc..e8733591f 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/item/withobject/WaterSourceListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withobject/WaterSourceListener.kt @@ -11,7 +11,7 @@ import rs09.game.interaction.InteractionListener * Handles filling most water sources. * @author Ceikry */ -class WaterSourceListener : InteractionListener() { +class WaterSourceListener : InteractionListener { //this is ugly! private val waterSources = intArrayOf(21355, 16302, 6827, 11661, 24160, 34577, 15936, 15937, 15938, 23920, 35469, 24265, 153, 879, 880, 2864, 6232, 10436, 10437, 10827, 11007, 11759, 21764, 22973, 24161, 24214, 24265, 28662, 30223, 30820, 34579, 36781, 873, 874, 4063, 6151, 8699, 9143, 9684, 10175, 12279, 12974, 13563, 13564, 14868, 14917, 15678, 16704, 16705, 20358, 22715, 24112, 24314, 25729, 25929, 26966, 29105, 33458, 34082, 34411, 34496, 34547, 34566, 35762, 36971, 37154, 37155, 878, 884, 3264, 3305, 3359, 4004, 4005, 6097, 6249, 6549, 8747, 8927, 11793, 12201, 12897, 24166, 26945, 31359, 32023, 32024, 34576, 35671, 40063, 13561, 13563, 13559, 12089) diff --git a/Server/src/main/kotlin/rs09/game/interaction/npc/DecantListener.kt b/Server/src/main/kotlin/rs09/game/interaction/npc/DecantListener.kt index a633eccec..bffc1885f 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/npc/DecantListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/npc/DecantListener.kt @@ -8,7 +8,7 @@ import rs09.game.content.dialogue.DialogueFile import rs09.game.interaction.InteractionListener import rs09.tools.END_DIALOGUE -class DecantListener : InteractionListener() { +class DecantListener : InteractionListener { override fun defineListeners() { on(NPC,"decant"){player, node -> diff --git a/Server/src/main/kotlin/rs09/game/interaction/npc/NPCDepositListener.kt b/Server/src/main/kotlin/rs09/game/interaction/npc/NPCDepositListener.kt index 8ba51e5e9..023584c53 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/npc/NPCDepositListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/npc/NPCDepositListener.kt @@ -9,7 +9,7 @@ import org.rs09.consts.NPCs import rs09.game.interaction.InteractionListener import rs09.tools.END_DIALOGUE -class NPCDepositListener : InteractionListener() { +class NPCDepositListener : InteractionListener { override fun defineListeners() { on(NPCs.PEER_THE_SEER_1288, NPC,"deposit") { player, _ -> diff --git a/Server/src/main/kotlin/rs09/game/interaction/npc/NPCTalkListener.kt b/Server/src/main/kotlin/rs09/game/interaction/npc/NPCTalkListener.kt index f57baf216..59beda1b9 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/npc/NPCTalkListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/npc/NPCTalkListener.kt @@ -13,7 +13,7 @@ import rs09.game.system.SystemLogger * Handles the NPC talk-to option. * @author Ceikry */ -class NPCTalkListener : InteractionListener() { +class NPCTalkListener : InteractionListener { val barCrawlNPCs = intArrayOf(733,848,735,739,737,738,731,568,3217,736,734) diff --git a/Server/src/main/kotlin/rs09/game/interaction/object/DemonTauntHandler.kt b/Server/src/main/kotlin/rs09/game/interaction/object/DemonTauntHandler.kt index 8af5f7612..f7c8bdabf 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/object/DemonTauntHandler.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/object/DemonTauntHandler.kt @@ -11,7 +11,7 @@ import rs09.game.interaction.InteractionListener * @author afaroutdude / Ceikry */ private const val BARS = 37668 -class DemonTauntHandler : InteractionListener(){ +class DemonTauntHandler : InteractionListener{ override fun defineListeners() { on(BARS,SCENERY,"taunt-through"){ player, _ -> diff --git a/Server/src/main/kotlin/rs09/game/interaction/object/EnchantedValleyListeners.kt b/Server/src/main/kotlin/rs09/game/interaction/object/EnchantedValleyListeners.kt index 41beb3236..bf5124b4f 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/object/EnchantedValleyListeners.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/object/EnchantedValleyListeners.kt @@ -7,7 +7,7 @@ import core.game.system.task.Pulse import org.rs09.consts.NPCs import rs09.game.interaction.InteractionListener -class EnchantedValleyListeners : InteractionListener() { +class EnchantedValleyListeners : InteractionListener { val ENCHANTED_V_TREE = 16265 val TREE_SPIRIT_IDS = intArrayOf(NPCs.TREE_SPIRIT_438,NPCs.TREE_SPIRIT_439,NPCs.TREE_SPIRIT_440,NPCs.TREE_SPIRIT_441,NPCs.TREE_SPIRIT_442,NPCs.TREE_SPIRIT_443) override fun defineListeners() { diff --git a/Server/src/main/kotlin/rs09/game/interaction/object/FairyRingPlugin.kt b/Server/src/main/kotlin/rs09/game/interaction/object/FairyRingPlugin.kt index 2706f2a45..25067ba9c 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/object/FairyRingPlugin.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/object/FairyRingPlugin.kt @@ -15,7 +15,7 @@ private val RINGS = intArrayOf(12003, 12094, 12095, 14058, 14061, 14064, 14067, private const val MAIN_RING = 12128 -class FairyRingPlugin : InteractionListener() { +class FairyRingPlugin : InteractionListener { override fun defineListeners() { diff --git a/Server/src/main/kotlin/rs09/game/interaction/object/GutanothChestPlugin.kt b/Server/src/main/kotlin/rs09/game/interaction/object/GutanothChestPlugin.kt index e26c41232..ab6d72adc 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/object/GutanothChestPlugin.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/object/GutanothChestPlugin.kt @@ -14,7 +14,7 @@ import rs09.game.world.GameWorld import java.util.concurrent.TimeUnit private const val CHEST = 2827 -class GutanothChestInteractionHandler : InteractionListener(){ +class GutanothChestInteractionHandler : InteractionListener{ override fun defineListeners() { diff --git a/Server/src/main/kotlin/rs09/game/interaction/object/JungleBushHandler.kt b/Server/src/main/kotlin/rs09/game/interaction/object/JungleBushHandler.kt index d78b5dd97..555bb3074 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/object/JungleBushHandler.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/object/JungleBushHandler.kt @@ -14,7 +14,7 @@ import rs09.game.world.GameWorld * Handles the chopping down of dense jungle, mainly to grant access to the Kharazi Jungle. * @author Ceikry */ -class JungleBushHandler : InteractionListener(){ +class JungleBushHandler : InteractionListener{ val chopped_bush = 2895 val chop_a = Animation(910) val chop_b = Animation(2382) diff --git a/Server/src/main/kotlin/rs09/game/interaction/object/MuddyChestHandler.kt b/Server/src/main/kotlin/rs09/game/interaction/object/MuddyChestHandler.kt index 28f3e7f09..b1ec9a77f 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/object/MuddyChestHandler.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/object/MuddyChestHandler.kt @@ -12,7 +12,7 @@ import rs09.game.interaction.InteractionListener * Handles the muddy chest * @author Ceikry */ -class MuddyChestHandler : InteractionListener() { +class MuddyChestHandler : InteractionListener { private val CHEST = 170 diff --git a/Server/src/main/kotlin/rs09/game/interaction/object/TarBarrelListener.kt b/Server/src/main/kotlin/rs09/game/interaction/object/TarBarrelListener.kt index 27f95711b..32b76160d 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/object/TarBarrelListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/object/TarBarrelListener.kt @@ -15,7 +15,7 @@ import rs09.game.interaction.InteractionListener * Option(s): * "Take-from" */ -class TarBarrelListener : InteractionListener() { +class TarBarrelListener : InteractionListener { val FULL_TAR_BARREL_16860 = 16860 val EMPTY_TAR_BARREL_16688 = 16688 diff --git a/Server/src/main/kotlin/rs09/game/interaction/object/VarrockGuardSignpost.kt b/Server/src/main/kotlin/rs09/game/interaction/object/VarrockGuardSignpost.kt index f7d897de4..51a5afe9f 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/object/VarrockGuardSignpost.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/object/VarrockGuardSignpost.kt @@ -10,7 +10,7 @@ import rs09.GlobalStats import rs09.game.interaction.InteractionListener import rs09.game.system.SystemLogger -class VarrockGuardSignpost : InteractionListener() { +class VarrockGuardSignpost : InteractionListener { override fun defineListeners() { val zone = object : MapZone("Varrock Guards", true){ override fun interact(e: Entity?, target: Node?, option: Option?): Boolean { diff --git a/Server/src/main/kotlin/rs09/game/interaction/object/WizardGuildPortals.kt b/Server/src/main/kotlin/rs09/game/interaction/object/WizardGuildPortals.kt index 8ccabc2ff..6a46c9a1c 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/object/WizardGuildPortals.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/object/WizardGuildPortals.kt @@ -4,7 +4,7 @@ import api.* import core.game.world.map.Location import rs09.game.interaction.InteractionListener -class WizardGuildPortals : InteractionListener() { +class WizardGuildPortals : InteractionListener { val WTOWER_PORTAL = 2156 val DWTOWER_PORTAL = 2157 diff --git a/Server/src/main/kotlin/rs09/game/interaction/object/canoestation/CanoeInterfaceListeners.kt b/Server/src/main/kotlin/rs09/game/interaction/object/canoestation/CanoeInterfaceListeners.kt index 5be9fc004..1c461e58a 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/object/canoestation/CanoeInterfaceListeners.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/object/canoestation/CanoeInterfaceListeners.kt @@ -17,7 +17,7 @@ import org.rs09.consts.Components import rs09.game.interaction.InterfaceListener import kotlin.math.abs -class CanoeInterfaceListeners : InterfaceListener() { +class CanoeInterfaceListeners : InterfaceListener { val SHAPE_INTERFACE = Components.CANOE_52 val DESTINATION_INTERFACE = Components.CANOE_STATIONS_MAP_53 @@ -26,7 +26,7 @@ class CanoeInterfaceListeners : InterfaceListener() { private val locationChilds = intArrayOf(50, 47, 44, 36) - override fun defineListeners() { + override fun defineInterfaceListeners() { onOpen(SHAPE_INTERFACE){player, _ -> CanoeUtils.checkCanoe(player,Canoe.DUGOUT) diff --git a/Server/src/main/kotlin/rs09/game/interaction/object/canoestation/CanoeStationListener.kt b/Server/src/main/kotlin/rs09/game/interaction/object/canoestation/CanoeStationListener.kt index 857ba683e..a752cae91 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/object/canoestation/CanoeStationListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/object/canoestation/CanoeStationListener.kt @@ -8,7 +8,7 @@ import core.game.world.update.flag.context.Animation import org.rs09.consts.Components import rs09.game.interaction.InteractionListener -class CanoeStationListener : InteractionListener() { +class CanoeStationListener : InteractionListener { private val STATION_IDs = intArrayOf(12140, 12141, 12142, 12143, 12144, 12145, 12146, 12147, 12148, 12151, 12152, 12153, 12154, 12155, 12156, 12157, 12158, 12144, 12146, 12149, 12150, 12157) private val STAGE_TREE_NONINTERACTABLE = 9 diff --git a/Server/src/main/kotlin/rs09/game/interaction/object/objects/CrateHandler.kt b/Server/src/main/kotlin/rs09/game/interaction/object/objects/CrateHandler.kt index 8aa99d13e..48364fc2d 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/object/objects/CrateHandler.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/object/objects/CrateHandler.kt @@ -11,7 +11,7 @@ import rs09.game.interaction.`object`.dialogues.CrateDialogues * @author qmqz */ -class CrateHandler : InteractionListener() { +class CrateHandler : InteractionListener { private val monkeyAmuletMouldCrate = 4724 private val threadCrate = 4718 diff --git a/Server/src/main/kotlin/rs09/game/interaction/region/IsafdarListeners.kt b/Server/src/main/kotlin/rs09/game/interaction/region/IsafdarListeners.kt index 18cd96443..2c832b411 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/region/IsafdarListeners.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/region/IsafdarListeners.kt @@ -9,7 +9,7 @@ import rs09.game.interaction.InteractionListener * @author Sir Kermit */ -class IsafdarListeners : InteractionListener() { +class IsafdarListeners : InteractionListener { val CAVE_ENTRANCE = 4006 val CAVE_EXIT = 4007 diff --git a/Server/src/main/kotlin/rs09/game/interaction/region/MorytaniaListeners.kt b/Server/src/main/kotlin/rs09/game/interaction/region/MorytaniaListeners.kt index c7676dc36..2ea974f0b 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/region/MorytaniaListeners.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/region/MorytaniaListeners.kt @@ -20,7 +20,7 @@ import kotlin.random.Random * @author Sir Kermit */ -class MorytaniaListeners : InteractionListener() { +class MorytaniaListeners : InteractionListener { val SWAMP_GATES = intArrayOf(Scenery.GATE_3506, Scenery.GATE_3507) val GROTTO_EXIT = intArrayOf(3525, 3526) diff --git a/Server/src/main/kotlin/rs09/game/interaction/region/dungeons/brimhaven/BrimhavenDungeonListeners.kt b/Server/src/main/kotlin/rs09/game/interaction/region/dungeons/brimhaven/BrimhavenDungeonListeners.kt index 311f0705f..2894cc215 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/region/dungeons/brimhaven/BrimhavenDungeonListeners.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/region/dungeons/brimhaven/BrimhavenDungeonListeners.kt @@ -7,7 +7,7 @@ import core.game.world.update.flag.context.Animation import org.rs09.consts.NPCs import rs09.game.interaction.InteractionListener -class BrimhavenDungeonListeners : InteractionListener() { +class BrimhavenDungeonListeners : InteractionListener { val EXIT = 5084 val SANIBOCH = NPCs.SANIBOCH_1595 diff --git a/Server/src/main/kotlin/rs09/game/interaction/region/dungeons/taverley/TaverleyDungeonListeners.kt b/Server/src/main/kotlin/rs09/game/interaction/region/dungeons/taverley/TaverleyDungeonListeners.kt index ed559503e..d445f7e44 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/region/dungeons/taverley/TaverleyDungeonListeners.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/region/dungeons/taverley/TaverleyDungeonListeners.kt @@ -6,7 +6,7 @@ import org.rs09.consts.Items import org.rs09.consts.Scenery import rs09.game.interaction.InteractionListener -class TaverleyDungeonListeners : InteractionListener() { +class TaverleyDungeonListeners : InteractionListener { val BD_GATE = Scenery.GATE_2623 val JAIL_DOOR = Scenery.DOOR_31838 diff --git a/Server/src/main/kotlin/rs09/game/interaction/region/falador/WineOfZamorakInteraction.kt b/Server/src/main/kotlin/rs09/game/interaction/region/falador/WineOfZamorakInteraction.kt index ced4bdf72..d160409d8 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/region/falador/WineOfZamorakInteraction.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/region/falador/WineOfZamorakInteraction.kt @@ -6,7 +6,7 @@ import org.rs09.consts.Items import rs09.game.content.global.action.PickupHandler import rs09.game.interaction.InteractionListener -class WineOfZamorakInteraction : InteractionListener() { +class WineOfZamorakInteraction : InteractionListener { override fun defineListeners() { on(Items.WINE_OF_ZAMORAK_245,GROUNDITEM,"take"){player, wine -> diff --git a/Server/src/main/kotlin/rs09/game/interaction/region/lumbridge/ChurchSignListener.kt b/Server/src/main/kotlin/rs09/game/interaction/region/lumbridge/ChurchSignListener.kt index 25c234b70..6d20582e2 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/region/lumbridge/ChurchSignListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/region/lumbridge/ChurchSignListener.kt @@ -5,7 +5,7 @@ import org.rs09.consts.Scenery import rs09.GlobalStats import rs09.game.interaction.InteractionListener -class ChurchSignListener : InteractionListener() { +class ChurchSignListener : InteractionListener { val CHURCH_SIGN = Scenery.SIGNPOST_31299 diff --git a/Server/src/main/kotlin/rs09/game/interaction/region/lumbridge/CowFieldSignListener.kt b/Server/src/main/kotlin/rs09/game/interaction/region/lumbridge/CowFieldSignListener.kt index 0f0945499..55107626c 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/region/lumbridge/CowFieldSignListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/region/lumbridge/CowFieldSignListener.kt @@ -9,7 +9,7 @@ import rs09.game.interaction.InteractionListener * @author bushtail */ -class CowFieldSignListener : InteractionListener() { +class CowFieldSignListener : InteractionListener { val SIGN = Scenery.SIGNPOST_31297 diff --git a/Server/src/main/kotlin/rs09/game/interaction/region/lumbridge/FredChestListener.kt b/Server/src/main/kotlin/rs09/game/interaction/region/lumbridge/FredChestListener.kt index 377743477..4abc44895 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/region/lumbridge/FredChestListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/region/lumbridge/FredChestListener.kt @@ -9,7 +9,7 @@ import rs09.game.interaction.InteractionListener * @author bushtail */ -class FredChestListener : InteractionListener() { +class FredChestListener : InteractionListener { val SHUT = Scenery.CLOSED_CHEST_37009 val OPEN = Scenery.OPEN_CHEST_37010 diff --git a/Server/src/main/kotlin/rs09/game/interaction/region/lumbridge/GnomeCopterSignListener.kt b/Server/src/main/kotlin/rs09/game/interaction/region/lumbridge/GnomeCopterSignListener.kt index aebf5b4b4..8e696d7d4 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/region/lumbridge/GnomeCopterSignListener.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/region/lumbridge/GnomeCopterSignListener.kt @@ -9,7 +9,7 @@ import rs09.game.interaction.InteractionListener * @author bushtail */ -class GnomeCopterSignListener : InteractionListener() { +class GnomeCopterSignListener : InteractionListener { val SIGN = Scenery.ADVERTISEMENT_30037 override fun defineListeners() { on(SIGN, SCENERY, "read") { player, _ -> diff --git a/Server/src/main/kotlin/rs09/game/interaction/region/rellekka/JatizsoListeners.kt b/Server/src/main/kotlin/rs09/game/interaction/region/rellekka/JatizsoListeners.kt index 617828539..da8fc12ad 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/region/rellekka/JatizsoListeners.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/region/rellekka/JatizsoListeners.kt @@ -13,7 +13,7 @@ import org.rs09.consts.NPCs import rs09.game.content.dialogue.region.jatizso.LeftieRightieDialogue import rs09.game.interaction.InteractionListener -class JatizsoListeners : InteractionListener() { +class JatizsoListeners : InteractionListener { val GATES_CLOSED = intArrayOf(21403,21405) val NORTH_GATE_ZONE = ZoneBorders(2414,3822,2417,3825) val WEST_GATE_ZONE = ZoneBorders(2386,3797,2390,3801) diff --git a/Server/src/main/kotlin/rs09/game/interaction/region/rellekka/NeitiznotListeners.kt b/Server/src/main/kotlin/rs09/game/interaction/region/rellekka/NeitiznotListeners.kt index 316393fc1..ad1f2fb43 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/region/rellekka/NeitiznotListeners.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/region/rellekka/NeitiznotListeners.kt @@ -12,7 +12,7 @@ import core.game.world.map.zone.ZoneBorders import org.rs09.consts.NPCs import rs09.game.interaction.InteractionListener -class NeitiznotListeners : InteractionListener() { +class NeitiznotListeners : InteractionListener { val STUMP = 21305 override fun defineListeners() { diff --git a/Server/src/main/kotlin/rs09/game/interaction/region/rellekka/RellekkaListeners.kt b/Server/src/main/kotlin/rs09/game/interaction/region/rellekka/RellekkaListeners.kt index 069389363..63b3443a0 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/region/rellekka/RellekkaListeners.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/region/rellekka/RellekkaListeners.kt @@ -13,7 +13,7 @@ import rs09.game.util.region.rellekka.RellekkaUtils * @author Ceikry */ -class RellekkaListeners : InteractionListener() { +class RellekkaListeners : InteractionListener { val UP1A = Location.create(2715, 3798, 0) val UP1B = Location.create(2716, 3798, 0) diff --git a/Server/src/main/kotlin/rs09/game/interaction/region/wilderness/RoguesCastleListeners.kt b/Server/src/main/kotlin/rs09/game/interaction/region/wilderness/RoguesCastleListeners.kt index c3440ab59..9e5e7142f 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/region/wilderness/RoguesCastleListeners.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/region/wilderness/RoguesCastleListeners.kt @@ -13,7 +13,7 @@ import rs09.game.content.global.WeightBasedTable import rs09.game.content.global.WeightedItem import rs09.game.interaction.InteractionListener -class RoguesCastleListeners : InteractionListener() { +class RoguesCastleListeners : InteractionListener { val CHEST_ANIM = getAnimation(536) val FLOOR_1_CHESTS = intArrayOf(14773, 14774) diff --git a/Server/src/main/kotlin/rs09/game/node/entity/player/info/stats/StatsCommandSet.kt b/Server/src/main/kotlin/rs09/game/node/entity/player/info/stats/StatsCommandSet.kt index 7ab9afc06..a15251e52 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/player/info/stats/StatsCommandSet.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/player/info/stats/StatsCommandSet.kt @@ -199,10 +199,10 @@ class StatsCommandSet : CommandSet(Privilege.STANDARD) { } -class StatsInterface : InterfaceListener() { +class StatsInterface : InterfaceListener { val COMPONENT_ID = 26 - override fun defineListeners() { + override fun defineInterfaceListeners() { on(COMPONENT_ID, 61) { player, _, _, _, _, _ -> val info: StatsPageInfo? = player.getAttribute("stats-page-info", null) if(info != null) { diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/AttackListener.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/AttackListener.kt index c3787f435..0f00f1e7c 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/AttackListener.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/AttackListener.kt @@ -3,7 +3,7 @@ package rs09.game.node.entity.skill import core.game.node.entity.combat.CombatStyle import rs09.game.interaction.InteractionListener -class AttackListener : InteractionListener() { +class AttackListener : InteractionListener { override fun defineListeners() { on(NPC, "attack"){player, npc -> //Makes sure player uses correct attack styles for lumbridge dummies diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/construction/decoration/chapel/BurnerListener.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/construction/decoration/chapel/BurnerListener.kt index 1f4c227a0..176881a95 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/construction/decoration/chapel/BurnerListener.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/construction/decoration/chapel/BurnerListener.kt @@ -11,7 +11,7 @@ import rs09.game.interaction.InteractionListener * Handles the lighting of the torches of the Chapel. * @author Splinter */ -class BurnerListener : InteractionListener() { +class BurnerListener : InteractionListener { val IDs = intArrayOf(13202,13203,13204,13205,13206,13207,13208,13209,13210,13211,13212,13213) diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/construction/decoration/questhall/MountedGlory.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/construction/decoration/questhall/MountedGlory.kt index e8de88232..8c3bfc7b6 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/construction/decoration/questhall/MountedGlory.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/construction/decoration/questhall/MountedGlory.kt @@ -11,7 +11,7 @@ import rs09.game.interaction.InteractionListener import java.util.concurrent.Executors import java.util.concurrent.TimeUnit -class MountedGlory : InteractionListener() { +class MountedGlory : InteractionListener { val MOUNTED_GLORY = 13523 diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/construction/decoration/study/TelescopePlugin.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/construction/decoration/study/TelescopePlugin.kt index fee31ef24..731efa14d 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/construction/decoration/study/TelescopePlugin.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/construction/decoration/study/TelescopePlugin.kt @@ -11,8 +11,7 @@ import core.game.world.update.flag.context.Animation import core.plugin.Initializable import core.plugin.Plugin import core.tools.RandomFunction -import rs09.game.content.global.worldevents.WorldEvents -import rs09.game.content.global.worldevents.shootingstar.ShootingStarEvent +import rs09.game.content.global.worldevents.shootingstar.ShootingStarPlugin import rs09.game.world.GameWorld.Pulser import java.util.concurrent.TimeUnit @@ -27,7 +26,7 @@ class TelescopePlugin : OptionHandler() { } override fun handle(player: Player?, node: Node?, option: String?): Boolean { - val star = (WorldEvents.get("shooting-stars") as ShootingStarEvent).star + val star = ShootingStarPlugin.getStar() val delay: Int = 25000 + (25000 / 3) val timeLeft = delay - star.ticks val fakeTimeLeftBecauseFuckPlayers = TimeUnit.MILLISECONDS.toMinutes(timeLeft * 600L) + if(RandomFunction.random(0,100) % 2 == 0) 2 else -2 diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/cooking/DoughMakingListener.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/cooking/DoughMakingListener.kt index 839022e16..0709d4f9d 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/cooking/DoughMakingListener.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/cooking/DoughMakingListener.kt @@ -7,7 +7,7 @@ import org.rs09.consts.Items import rs09.game.content.dialogue.DialogueFile import rs09.game.interaction.InteractionListener -class DoughMakingListener : InteractionListener() { +class DoughMakingListener : InteractionListener { val sourceReturnMap = hashMapOf( Items.BUCKET_OF_WATER_1929 to Items.BUCKET_1925, Items.BOWL_OF_WATER_1921 to Items.BOWL_1923, diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/FarmerPayOptionHandler.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/FarmerPayOptionHandler.kt index 4fa8515ae..b957769d9 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/FarmerPayOptionHandler.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/FarmerPayOptionHandler.kt @@ -4,7 +4,7 @@ import core.game.node.Node import core.game.node.entity.player.Player import rs09.game.interaction.InteractionListener -class FarmerPayOptionHandler : InteractionListener() { +class FarmerPayOptionHandler : InteractionListener { override fun defineListeners() { on(NPC,"pay","pay (north)","pay (north-west)"){player,node -> diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/LeprechaunNoter.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/LeprechaunNoter.kt index 53b74294b..2c8124cfc 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/LeprechaunNoter.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/LeprechaunNoter.kt @@ -8,7 +8,7 @@ import core.plugin.Initializable import org.rs09.consts.NPCs import rs09.game.interaction.InteractionListener -class LeprechaunNoter : InteractionListener() { +class LeprechaunNoter : InteractionListener { val CROPS = Plantable.values().map{ it.harvestItem }.toIntArray() val LEPRECHAUNS = intArrayOf(NPCs.TOOL_LEPRECHAUN_3021,NPCs.GOTH_LEPRECHAUN_8000,NPCs.TOOL_LEPRECHAUN_4965,NPCs.TECLYN_2861) diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/ToolLeprechaunInterface.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/ToolLeprechaunInterface.kt index 7c25ee698..5978653a8 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/ToolLeprechaunInterface.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/ToolLeprechaunInterface.kt @@ -10,12 +10,12 @@ import org.rs09.consts.Items import rs09.game.interaction.InterfaceListener private const val varp = 615 -class ToolLeprechaunInterface : InterfaceListener() { +class ToolLeprechaunInterface : InterfaceListener { private val FARMING_TOOLS = Components.FARMING_TOOLS_125 private val TOOLS_SIDE = Components.FARMING_TOOLS_SIDE_126 - override fun defineListeners() { + override fun defineInterfaceListeners() { onOpen(FARMING_TOOLS){player, component -> player.varpManager?.flagSave(varp) diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/fletching/FletchingListeners.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/fletching/FletchingListeners.kt index 97dde77f3..4867fbdf8 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/fletching/FletchingListeners.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/fletching/FletchingListeners.kt @@ -21,7 +21,7 @@ import org.rs09.consts.Items.YELLOW_FEATHER_10090 import rs09.game.content.dialogue.SkillDialogueHandler import rs09.game.interaction.InteractionListener -class FletchingListeners : InteractionListener() { +class FletchingListeners : InteractionListener { val LIMBIDs = Fletching.Limb.values().map(Fletching.Limb::limb).toIntArray() val STOCKIDs = Fletching.Limb.values().map(Fletching.Limb::stock).toIntArray() diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/gather/GatheringSkillOptionListeners.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/gather/GatheringSkillOptionListeners.kt index efc3903cb..3e7abf503 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/gather/GatheringSkillOptionListeners.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/gather/GatheringSkillOptionListeners.kt @@ -11,7 +11,7 @@ import rs09.game.content.dialogue.KjallakOnChopDialogue import rs09.game.interaction.InteractionListener import rs09.game.node.entity.skill.gather.mining.MiningSkillPulse -class GatheringSkillOptionListeners : InteractionListener() { +class GatheringSkillOptionListeners : InteractionListener { val ETCETERIA_REGION = 10300 diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/gather/fishing/barbfishing/BarbFishInteractionListeners.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/gather/fishing/barbfishing/BarbFishInteractionListeners.kt index 9892ac65d..d016f5e6f 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/gather/fishing/barbfishing/BarbFishInteractionListeners.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/gather/fishing/barbfishing/BarbFishInteractionListeners.kt @@ -3,7 +3,7 @@ package rs09.game.node.entity.skill.gather.fishing.barbfishing import core.game.node.item.Item import rs09.game.interaction.InteractionListener -class BarbFishInteractionListeners : InteractionListener() { +class BarbFishInteractionListeners : InteractionListener { override fun defineListeners() { on(25268,SCENERY,"search"){ player, _ -> diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/gather/mining/ProspectListener.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/gather/mining/ProspectListener.kt index 6d2853798..9ef542b2e 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/gather/mining/ProspectListener.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/gather/mining/ProspectListener.kt @@ -10,7 +10,7 @@ import rs09.game.interaction.InteractionListener * @author: bushtail */ -class ProspectListener : InteractionListener() { +class ProspectListener : InteractionListener { override fun defineListeners() { on(SCENERY, "prospect") { player, node -> diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/hunter/pitfall/HunterPitfall.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/hunter/pitfall/HunterPitfall.kt index d9a0c7de7..19460c562 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/hunter/pitfall/HunterPitfall.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/hunter/pitfall/HunterPitfall.kt @@ -148,7 +148,7 @@ val GRAAHK_PIT = 19231 val LARUPIA_PIT = 19232 val KYATT_PIT = 19233 -class PitfallListeners : InteractionListener() { +class PitfallListeners : InteractionListener { override fun defineListeners() { setDest(SCENERY, intArrayOf(PIT, SPIKED_PIT, LARUPIA_PIT, GRAAHK_PIT, KYATT_PIT), "trap", "jump", "dismantle") { player, node -> diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/magic/SpellTablets.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/magic/SpellTablets.kt index 39eefc17f..ded43db37 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/magic/SpellTablets.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/magic/SpellTablets.kt @@ -7,7 +7,7 @@ import org.rs09.consts.Items import rs09.game.interaction.InteractionListener import rs09.game.node.entity.skill.magic.spellconsts.Modern -class SpellTablets : InteractionListener() { +class SpellTablets : InteractionListener { val B2P_TABLET = Items.BONES_TO_PEACHES_8015 val B2B_TABLET = Items.BONES_TO_BANANAS_8014 override fun defineListeners() { diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/runecrafting/abyss/AbyssPlugin.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/runecrafting/abyss/AbyssPlugin.kt index 57ec46268..1a91840a9 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/runecrafting/abyss/AbyssPlugin.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/runecrafting/abyss/AbyssPlugin.kt @@ -24,7 +24,7 @@ import rs09.game.world.GameWorld * A plugin used to handle the abyss. * @author cfunny */ -class AbyssPlugin : InteractionListener() { +class AbyssPlugin : InteractionListener { val OBSTACLE = AbbysalObstacle.values().filter { it != AbbysalObstacle.MINE && it != AbbysalObstacle.SQUEEZE && it != AbbysalObstacle.PASSAGE && it != AbbysalObstacle.CHOP }.map { it.option }.toTypedArray() val miningObstacle = 7158 diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/thieving/ThievingListeners.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/thieving/ThievingListeners.kt index 9a9c25bc9..38ce80ea5 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/thieving/ThievingListeners.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/thieving/ThievingListeners.kt @@ -13,7 +13,7 @@ import rs09.game.interaction.InteractionListener import rs09.game.system.SystemLogger import rs09.tools.secondsToTicks -class ThievingListeners : InteractionListener() { +class ThievingListeners : InteractionListener { private val PICKPOCKET_ANIM = Animation(881,Animator.Priority.HIGH) private val NPC_ANIM = Animation(422) diff --git a/Server/src/main/kotlin/rs09/plugin/ClassScanner.kt b/Server/src/main/kotlin/rs09/plugin/ClassScanner.kt index 8ca7a043e..66cea83c1 100644 --- a/Server/src/main/kotlin/rs09/plugin/ClassScanner.kt +++ b/Server/src/main/kotlin/rs09/plugin/ClassScanner.kt @@ -85,6 +85,9 @@ object ClassScanner { if(clazz is TickListener) GameWorld.tickListeners.add(clazz) if(clazz is StartupListener) GameWorld.startupListeners.add(clazz) if(clazz is ShutdownListener) GameWorld.shutdownListeners.add(clazz) + if(clazz is InteractionListener) clazz.defineListeners().also { clazz.defineDestinationOverrides() } + if(clazz is InterfaceListener) clazz.defineInterfaceListeners() + if(clazz is Commands) clazz.defineCommands() if(clazz is PersistPlayer) { PlayerSaver.contentHooks.add(clazz) PlayerSaveParser.contentHooks.add(clazz)