text
stringlengths
33
161k
plugins { application `maven-publish` id("com.github.johnrengelman.shadow") version "8.1.1" kotlin("jvm") version("1.9.21") } val darkanVersion: String = "1.9.0" val ktVer: String = "1.9.21" application { group = "rs.darkan" version = darkanVersion mainClass.set("com.rs.Launcher") } java { toolchain.languag...
rootProject.name = "world-server"
/* * OpenRS Cache Library * Copyright (c) 2011 Graham and `Discardedx2 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later v...
onNpcClick("Man", options = arrayOf("Talk-to")) { e -> e.player.startConversation { npc(e.npc.id, HAPPY_TALKING, "Hello there, adventurer! What brings you to our town?") options { //Conditional options example if (e.player.inventory.containsItem(1050, 1)) opti...
val messages = arrayOf( Pair(HAPPY_TALKING, "I'm fine!"), Pair(CALM_TALK, "I think we need a new king. The one we've got isn't good."), Pair(CALM_TALK, "Not too bad. But I'm quite worried about the goblin population these days."), Pair(CONFUSED, "Who are you?.."), Pair(HAPPY_TALKING, "Hello."), ...
package com.rs; public final class Launcher { public static void main(String[] args) throws Exception { Logger.setupFormat(); Logger.setLevel(Level.FINE); //FINER for traces JsonFileManager.setGSON(new GsonBuilder() .registerTypeAdapter(Controller.class, new ControllerAdapter()) .registerTypeAdapt...
package com.rs; public final class Settings { private static Settings SETTINGS; private static final Settings DEFAULTS = new Settings(); public static Settings getConfig() { if (SETTINGS == null) loadConfig(); return SETTINGS; } private String serverName; private String ownerName; private String cac...
package com.rs.db; public class WorldDB extends DBConnection { private static final PlayerManager PLAYERS = new PlayerManager(); private static final HighscoresManager HIGHSCORES = new HighscoresManager(); private static final GEManager GE = new GEManager(); private static final LogManager LOGS = new LogManager(...
package com.rs.db.collection; public class GEManager extends DBItemManager { public GEManager() { super("grandexchange"); } @Override public void initCollection() { getDocs().createIndex(Indexes.text("owner")); getDocs().createIndex(Indexes.compoundIndex(Indexes.ascending("itemId"), Indexes.ascending("co...
package com.rs.db.collection; public class HighscoresManager extends DBItemManager { public HighscoresManager() { super("highscores"); } @Override public void initCollection() { getDocs().createIndex(Indexes.compoundIndex(Indexes.text("displayName"), Indexes.text("username"))); getDocs().createIndex(Ind...
package com.rs.db.collection; public class PlayerManager extends DBItemManager { public PlayerManager() { super("players"); } @Override public void initCollection() { getDocs().createIndex(Indexes.text("username")); } public void getByUsername(String username, Consumer<Player> func) { execute(() -> f...
package com.rs.db.collection.logs; public class CommandLog { private final String uuid; private final String player; private final String command; public CommandLog(String player, String command) { this.player = player; this.command = command; this.uuid = UUID.randomUUID().toString(); } @Override publi...
package com.rs.db.collection.logs; public class GELog { private final String uuid; private final String from; private final String to; private final String item; private final int itemId; private final int amount; private final int price; public GELog(Offer offer1, Offer offer2, int amount, int price) { ...
package com.rs.db.collection.logs; public class GraveLog { private final String uuid; private final String player; private final Tile tile; private final List<Item> items; public GraveLog(String player, GraveStone grave) { this.player = player; this.tile = grave.getTile(); items = new ArrayList<>(); fo...
package com.rs.db.collection.logs; public class LogEntry { public enum LogType { ERROR, GE, PICKUP, GRAVE, COMMAND, REPORT, TRADE } private final Date date; private final LogType type; private final long hash; private final Object data; public LogEntry(LogType type, long hash,...
package com.rs.db.collection.logs; public class LogManager extends DBItemManager { public LogManager() { super("logs"); } @Override public void initCollection() { getDocs().createIndex(Indexes.text("type")); getDocs().createIndex(Indexes.descending("hash")); getDocs().createIndex(Indexes.ascending("da...
package com.rs.db.collection.logs; public class PickupLog { private final String uuid; private final String player; private final String itemName; private final Item item; private final Tile tile; private final String owner; public PickupLog(Player player, GroundItem item) { this.player = player.getUsernam...
package com.rs.db.collection.logs; public class ReportLog { private Object relevantData; public ReportLog(Player reporter, Player reported, Rule rule) { String player = reported.getUsername(); String reporter1 = reporter.getUsername(); } //TODO finish //TODO create hashCode and equals }
package com.rs.db.collection.logs; public class TradeLog { private final String uuid; private final String player1; private final List<Item> p1Items; private final String player2; private final List<Item> p2Items; public TradeLog(Player p1, List<Item> p1Items, Player p2, List<Item> p2Items) { this.player1 =...
package com.rs.db.model; public class Highscore { private final String username; private final String displayName; private final boolean ironman; private final int totalLevel; private final long totalXp; private final int[] xp; public Highscore(Player player) { if (player.getDisplayName() == null) throw...
package com.rs.engine; @PluginEventHandler public class Shop { private static final int MAIN_STOCK_ITEMS_KEY = 0; private static final int MAX_SHOP_ITEMS = 40; private String name; private ShopItem[] mainStock; private int[] defaultQuantity; private ShopItem[] generalStock; private boolean buyOnly; privat...
package com.rs.engine.book; @PluginEventHandler public abstract class Book { private static final int INTERFACE = 960; private static final int[] LEFT_COMPONENTS = { 49, 56, 61, 62, 54, 63, 55, 51, 60, 58, 53, 50, 57, 59, 52 }; private static final int[] RIGHT_COMPONENTS = { 33, 39, 36, 44, 37, 46, 40, 42, 34, ...
package com.rs.engine.book; public class BookPage { private final String[] left; private final String[] right; public BookPage(String[] left, String[] right) { if (left.length > 15 || right.length > 15) throw new RuntimeException("Cannot create book page with longer than 15 lines of text."); this.left = le...
package com.rs.engine.command; public class Command { private final String usage; private final String description; private final CommandExecution execution; public Command(String usage, String description, CommandExecution execution) { this.description = description; this.execution = execution; this.usag...
package com.rs.engine.command; public interface CommandExecution { void run(Player p, String[] args); }
package com.rs.engine.command; public final class Commands { private static final Map<Rights, Map<String , Command>> COMMANDS = new HashMap<>(); private static final Map<Rights, Set<Command>> UNIQUE_COMMANDS = new HashMap<>(); static { for (Rights r : Rights.values()) { COMMANDS.put(r, new HashMap<>()); ...
package com.rs.engine.cutscene; public abstract class Cutscene { private Player player; private int currIndex; private final Map<String, Object> objects = new HashMap<>(); private final List<CutsceneAction> actions = new ArrayList<>(); private int delay; private boolean hideMap; private boolean dialoguePaused...
package com.rs.engine.cutscene @DslMarker annotation class CutsceneDsl @CutsceneDsl open class CutsceneBuilder { private var cutscene = object: Cutscene() { override fun construct(player: Player?) { } } internal open fun build(): Cutscene = cutscene } fun Player.playCutscene(block: CutsceneBu...
package com.rs.engine.cutscene; public class ExampleCutscene extends Cutscene { @Override public void construct(Player player) { fadeIn(5); dynamicRegion(player.getTile(), 178, 554, 4, 4); playerMove(15, 20, 0, MoveType.TELE); spawnObj(67500, 0, 14, 23, 0); npcCreate("meme", 50, 14, 20, 0, 0); fadeOut...
package com.rs.engine.cutscene.actions; public class ConstructMapAction extends CutsceneAction { private final Tile returnTile; private final int baseChunkX; private final int baseChunkY; private final int widthChunks; private final int heightChunks; private final boolean copyNpcs; public Construct...
package com.rs.engine.cutscene.actions; public class CreateNPCAction extends CutsceneAction { private final int id; private final int x; private final int y; private final int plane; private final Consumer<NPC> configureNpc; public CreateNPCAction(String key, int id, int x, int y, int plane, int act...
package com.rs.engine.cutscene.actions; public abstract class CutsceneAction { private final String objectKey; private final int delay; public CutsceneAction(String objectKey, int delay) { this.objectKey = objectKey; this.delay = delay; } public abstract void process(Player player, Map<String, Object> o...
package com.rs.engine.cutscene.actions; public class CutsceneCodeAction extends CutsceneAction { private final Runnable runnable; public CutsceneCodeAction(Runnable runnable, int actionDelay) { super(null, actionDelay); this.runnable = runnable; } @Override public void process(Player player, Map<String, ...
package com.rs.engine.cutscene.actions; public class DelayAction extends CutsceneAction { public DelayAction(int delay) { super(null, delay); } @Override public void process(Player player, Map<String, Object> objects) { } }
package com.rs.engine.cutscene.actions; public class DestroyCachedObjectAction extends CutsceneAction { public DestroyCachedObjectAction(String objectKey, int actionDelay) { super(objectKey, actionDelay); } @Override public void process(Player player, Map<String, Object> objects) { Cutscene scene = (Cutsce...
package com.rs.engine.cutscene.actions; public class DialogueAction extends CutsceneAction { private final Dialogue dialogue; private final boolean pause; public DialogueAction(Dialogue dialogue, int delay, boolean pause) { super(null, delay); this.dialogue = dialogue; this.pause = pause; } @Override ...
package com.rs.engine.cutscene.actions; public final class InterfaceAction extends CutsceneAction { private final int interfaceId; private final int delay; public InterfaceAction(int interfaceId, int actionDelay) { super(null, actionDelay); this.interfaceId = interfaceId; delay = actionDelay; } @Overri...
package com.rs.engine.cutscene.actions; public class LookCameraAction extends CutsceneAction { private final int viewLocalX; private final int viewLocalY; private final int viewZ; private final int speedToExactDestination; private final int speedOnRoutePath; public LookCameraAction(int viewLocalX, int viewLo...
package com.rs.engine.cutscene.actions; public class MoveNPCAction extends CutsceneAction { private final int x; private final int y; private final int plane; private final MoveType movementType; public MoveNPCAction(String key, int x, int y, boolean run, int actionDelay) { this(key, x, y, 0, run ? Mo...
package com.rs.engine.cutscene.actions; public class MovePlayerAction extends CutsceneAction { private final int x; private final int y; private final int plane; private final MoveType movementType; public MovePlayerAction(int x, int y, int plane, MoveType movementType, int actionDelay) { super(null, ...
package com.rs.engine.cutscene.actions; public class NPCAnimationAction extends CutsceneAction { private final Animation anim; public NPCAnimationAction(String key, Animation anim, int actionDelay) { super(key, actionDelay); this.anim = anim; } @Override public void process(Player player, Map<String, Obj...
package com.rs.engine.cutscene.actions; public class NPCFaceTileAction extends CutsceneAction { private final int x; private final int y; public NPCFaceTileAction(String key, int x, int y, int actionDelay) { super(key, actionDelay); this.x = x; this.y = y; } @Override public void process(Player pla...
package com.rs.engine.cutscene.actions; public class NPCForceTalkAction extends CutsceneAction { private final String text; public NPCForceTalkAction(String key, String text, int actionDelay) { super(key, actionDelay); this.text = text; } @Override public void process(Player player, Map<String, Object> o...
package com.rs.engine.cutscene.actions; public class NPCSpotAnimAction extends CutsceneAction { private final SpotAnim gfx; public NPCSpotAnimAction(String key, SpotAnim gfx, int actionDelay) { super(key, actionDelay); this.gfx = gfx; } @Override public void process(Player player, Map<String, Object> obj...
package com.rs.engine.cutscene.actions; public class NPCTransformAction extends CutsceneAction { private final int id; public NPCTransformAction(String key, int id, int actionDelay) { super(key, actionDelay); this.id = id; } @Override public void process(Player player, Map<String, Object> objects) { NP...
package com.rs.engine.cutscene.actions; public class PlayerAnimationAction extends CutsceneAction { private final Animation anim; public PlayerAnimationAction(Animation anim, int actionDelay) { super(null, actionDelay); this.anim = anim; } @Override public void process(Player player, Map<String, Object> ...
package com.rs.engine.cutscene.actions; public class PlayerFaceEntityAction extends CutsceneAction { public PlayerFaceEntityAction(String key, int actionDelay) { super(key, actionDelay); } @Override public void process(Player player, Map<String, Object> objects) { NPC npc = (NPC) objects.get(getObjectKey()...
package com.rs.engine.cutscene.actions; public class PlayerFaceTileAction extends CutsceneAction { private final int x; private final int y; public PlayerFaceTileAction(int x, int y, int actionDelay) { super(null, actionDelay); this.x = x; this.y = y; } @Override public void process(Player player, ...
package com.rs.engine.cutscene.actions; public class PlayerForceTalkAction extends CutsceneAction { private final String text; public PlayerForceTalkAction(String text, int actionDelay) { super(null, actionDelay); this.text = text; } @Override public void process(Player player, Map<String, Object> object...
package com.rs.engine.cutscene.actions; public class PlayerGraphicAction extends CutsceneAction { private final SpotAnim gfx; public PlayerGraphicAction(SpotAnim gfx, int actionDelay) { super(null, actionDelay); this.gfx = gfx; } @Override public void process(Player player, Map<String, Object> objects) {...
package com.rs.engine.cutscene.actions; public class PlayerMusicEffectAction extends CutsceneAction { private final int id; public PlayerMusicEffectAction(int id, int actionDelay) { super(null, actionDelay); this.id = id; } @Override public void process(Player player, Map<String, Object> objects) { pla...
package com.rs.engine.cutscene.actions; public class PlayerTransformAction extends CutsceneAction { private final int npcId; public PlayerTransformAction(int npcId, int actionDelay) { super(null, actionDelay); this.npcId = npcId; } @Override public void process(Player player, Map<String, Object> objects)...
package com.rs.engine.cutscene.actions; public class PlayMusicAction extends CutsceneAction { private final int id; private final int delay; private final int volume; public PlayMusicAction(int id, int delay, int volume, int actionDelay) { super(null, actionDelay); this.id = id; this.delay = delay; thi...
package com.rs.engine.cutscene.actions; public class PosCameraAction extends CutsceneAction { private final int moveLocalX; private final int moveLocalY; private final int moveZ; private final int speed; private final int speed2; public PosCameraAction(int moveLocalX, int moveLocalY, int moveZ, int speed, in...
package com.rs.engine.dialogue; public class Conversation { public static String DEFAULT_OPTIONS_TITLE = "Choose an option"; private final HashMap<String, Dialogue> markedStages; private Dialogue firstDialogue; protected Player player; protected Dialogue current; protected int npcId; private boolean created...
package com.rs.engine.dialogue; public class Dialogue { private Dialogue prev; private ArrayList<Dialogue> next = new ArrayList<>(); private Runnable event; private Statement statement; private int voiceEffectId = -1; private boolean started = true; public Dialogue(Statement statement, Runnable extraFunctio...
package com.rs.engine.dialogue @DslMarker annotation class DialogueDsl @DialogueDsl open class DialogueBuilder(val stages: MutableMap<String, Dialogue> = mutableMapOf()) { private var dialogue = Dialogue() private var pendingLabel: String? = null val start = dialogue fun player(expression: HeadE, te...
package com.rs.engine.dialogue; public enum HeadE { NONE(-1), AMAZED_MILD(9742), AMAZED(9746), MORTIFIED_JAW_DROP(9750), MORTIFIED(9753), SAD_MILD_LOOK_DOWN(9757), SAD_MILD(9760), SAD_SNIFFLE(9761), SAD(9764), SAD_CRYING(9765), SAD_EXTREME(9768), UPSET(9770), UPSET_SNIFFLE(9772), SCARED(9773), WORRIED(9...
package com.rs.engine.dialogue; public class Option { private final Dialogue dialogue; private final Supplier<Boolean> constraint; public Option(Supplier<Boolean> constraint, Dialogue dialogue) { this.constraint = constraint; this.dialogue = dialogue; } public Option(Dialogue dialogue) { this(null, dial...
package com.rs.engine.dialogue; public abstract class Options { private final Map<String, Option> options = new LinkedHashMap<>(); //LinkedHashMap O(1) but allows ordered keys private String stageName; private Conversation conv; public Options() { create(); } public Options(String stageName, Conversation c...
package com.rs.engine.dialogue.impl; public class MakeXActionD extends Dialogue { private final List<MakeXItem> options = new ArrayList<>(); public MakeXActionD addOption(MakeXItem option) { clearChildren(); options.add(option); MakeXItem[] opArr = new MakeXItem[options.size()]; options.toArray(opArr); ...
package com.rs.engine.dialogue.impl; public class MakeXItem extends Dialogue { private final int itemId; public MakeXItem(Player player, Item[] materials, Item[] products, double xp, int anim, int req, int skill, int delay) { itemId = products[0].getId(); setFunc(() -> { int quantity = MakeXStatement.getQu...
package com.rs.engine.dialogue.statements; public class DestroyItemStatement implements Statement { private final Item item; private final String message; public DestroyItemStatement(Item item, String message) { this.item = item; this.message = message; } @Override public void send(Player player) { p...
package com.rs.engine.dialogue.statements; public class ItemStatement implements Statement { private final int itemId; private int zoom = 500; private final String[] text; public ItemStatement(int itemId, String... text) { this.itemId = itemId; this.text = text; } public ItemStatement(int itemId, int zo...
package com.rs.engine.dialogue.statements; public class LampXPSelectStatement implements Statement { private final Lamp lamp; public LampXPSelectStatement(Lamp lamp) { this.lamp = lamp; } @Override public void send(Player player) { if (lamp.getId() == 12628) lamp.setXp(500); player.g...
package com.rs.engine.dialogue.statements; public class LegacyItemStatement implements Statement { private final int[] itemIds; private final String title; private final String[] text; public LegacyItemStatement(int item, String title, String... text) { itemIds = new int[] { item }; this.title = title; th...
package com.rs.engine.dialogue.statements; @PluginEventHandler public class MakeXStatement implements Statement { public enum MakeXType { MAKE, MAKE_SET, COOK, ROAST, OFFER, SELL, BAKE, CUT, DEPOSIT, MAKE_INTERVAL, TELEPORT, SELECT, MAKE_SET_INTERVAL, TAKE, RETURN, HEAT, ADD } ...
package com.rs.engine.dialogue.statements; public class NPCStatement implements Statement { private final String nameOverride; private final int npcId; private final HeadE emote; private final String[] texts; public NPCStatement(String nameOverride, int npcId, HeadE emote, String... texts) { this.nameOverrid...
package com.rs.engine.dialogue.statements; public class OptionStatement implements Statement { private final String title; private final String[] options; public OptionStatement(String title, String... options) { this.title = title; if (options.length > 5) throw new InvalidParameterException("The max opt...
package com.rs.engine.dialogue.statements; public class PlayerStatement implements Statement { private final HeadE emote; private final String[] texts; public PlayerStatement(HeadE emote, String... texts) { this.emote = emote; this.texts = texts; } @Override public void send(Player player) { StringBuil...
package com.rs.engine.dialogue.statements; public class QuestStartStatement implements Statement { private final Quest quest; public QuestStartStatement(Quest quest) { this.quest = quest; } @Override public void send(Player player) { quest.openQuestInfo(player, true); } @Override public int getOptionI...
package com.rs.engine.dialogue.statements; public class SimpleStatement implements Statement { private final String[] texts; public SimpleStatement(String... texts) { this.texts = texts; } @Override public void send(Player player) { StringBuilder builder = new StringBuilder(); for (int line = 0; line < ...
package com.rs.engine.dialogue.statements; public interface Statement { void send(Player player); int getOptionId(int componentId); void close(Player player); }
package com.rs.engine.miniquest; public enum Miniquest { ENTER_THE_ABYSS("Enter the Abyss", new Quest[]{Quest.RUNE_MYSTERIES}, null, null, null), KNIGHTS_WAVE_TRAINING_GROUNDS("Knights Waves Training Grounds", new Quest[]{Quest.KINGS_RANSOM}, null, null, null), TROLL_WARZONE("Troll Warzone Tutorial", null, null, ...
package com.rs.engine.miniquest; @Retention(RetentionPolicy.RUNTIME) @Target(ElementType.TYPE) public @interface MiniquestHandler { Miniquest miniquest(); String startText(); String itemsText(); String combatText(); String rewardsText(); int completedStage(); }
package com.rs.engine.miniquest; @PluginEventHandler public class MiniquestManager { private transient Player player; private final Map<Miniquest, Integer> questStages; private final Map<Miniquest, GenericAttribMap> questAttribs; public MiniquestManager() { questStages = new HashMap<>(); questAttribs = new...
package com.rs.engine.miniquest; public abstract class MiniquestOutline { public final Miniquest getMiniquest() { return getClass().getAnnotation(MiniquestHandler.class).miniquest(); } public final int getCompletedStage() { return getClass().getAnnotation(MiniquestHandler.class).completedStage(); } public a...
package com.rs.engine.pathfinder /** * @author Kris | 16/03/2022 */ @Suppress("MemberVisibilityCanBePrivate") @JvmInline public value class AbsoluteCoords(public val packedCoord: Int) { public constructor( x: Int, y: Int, z: Int, ) : this((y and 0x3FFF) or ((x and 0x3FFF) shl 14) or (...
package com.rs.engine.pathfinder enum class Direction(@JvmField val id: Int, @JvmField val dx: Int, @JvmField val dy: Int) { NORTH(0, 0, 1), NORTHEAST(1, 1, 1), EAST(2, 1, 0), SOUTHEAST(3, 1, -1), SOUTH(4, 0, -1), SOUTHWEST(5, -1, -1), WEST(6, -1, 0), NORTHWEST(7, -1, 1); val angl...
package com.rs.engine.pathfinder object DumbRouteFinder { @JvmStatic fun addDumbPathfinderSteps(entity: Entity, target: Any, collision: CollisionStrategy): Boolean { return addDumbPathfinderSteps(entity, target, 25, collision) } @JvmStatic fun addDumbPathfinderSteps(entity: Entity, target: Any,...
/* * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * 2. Redistributions in bin...
@file:Suppress("MemberVisibilityCanBePrivate") package com.rs.engine.pathfinder public data class Route( public val coords: ArrayDeque<RouteCoordinates>, public val alternative: Boolean, public val success: Boolean ) : List<RouteCoordinates> by coords { public val failed: Boolean get() = !suc...
package com.rs.engine.pathfinder class RouteEvent(private val target: Any, private val onReachedEvent: Runnable, private val onNearestEvent: (() -> Boolean)?) { constructor(target: Any, event: Runnable): this(target, event, null) //F-U java //TODO add optimized boolean for stationary targets that doesn't rec...
@file:Suppress("DuplicatedCode") package com.rs.engine.pathfinder private const val DEFAULT_RESET_ON_SEARCH = true internal const val DEFAULT_SEARCH_MAP_SIZE = 128 private const val DEFAULT_RING_BUFFER_SIZE = 4096 private const val DEFAULT_DISTANCE_VALUE = 999 // Default is 99_999_999 but it is unnecessary and we bi...
package com.rs.engine.pathfinder /** * @author Kris | 16/03/2022 */ public class StepValidator(private val flags: Array<IntArray?>) { public fun canTravel( level: Int, x: Int, y: Int, offsetX: Int, offsetY: Int, size: Int = 1, extraFlag: Int, coll...
package com.rs.engine.pathfinder class WalkStep(@JvmField val dir: Direction, @JvmField val x: Int, @JvmField val y: Int, private var clip: Boolean) { fun checkClip(): Boolean { return clip } fun setCheckClip(clip: Boolean) { this.clip = clip } override fun toString(): String { ...
package com.rs.engine.pathfinder object WorldCollision { private const val CHUNK_SIZE = 2048 //2048 chunk size = max capacity 16384x16384 tiles val allFlags: Array<IntArray?> = arrayOfNulls(CHUNK_SIZE * CHUNK_SIZE * 4) private val LOCK = Any() @JvmStatic fun clipNPC(npc: NPC) { if (!npc.b...
package com.rs.engine.pathfinder /** * @author Kris | 16/03/2022 */ @JvmInline public value class ZoneCoords(public val packedCoords: Int) { public constructor( x: Int, y: Int, z: Int, ) : this((x and 0x7FF) or ((y and 0x7FF) shl 11) or ((z and 0x3) shl 22)) public val x: Int ...
package com.rs.engine.pathfinder /** * @author Kris | 16/03/2022 * * A class to hold all the flags for every tile in the game. * The flags are placed into a two-dimensional array, where the outer array * returns the flags array for a given zone(1 x 8 x 8 flags total). * This is done for memory reasons, as it is ...
package com.rs.engine.pathfinder.bound /** * @author Kris | 12/09/2021 */ public object RectangleBoundaryUtils { public fun collides( srcX: Int, srcY: Int, destX: Int, destY: Int, srcWidth: Int, srcHeight: Int, destWidth: Int, destHeight: Int )...
package com.rs.engine.pathfinder.bound internal fun reachRectangle( flags: Array<IntArray?>, x: Int, y: Int, z: Int, accessBitMask: Int, destX: Int, destY: Int, srcSize: Int, destWidth: Int, destHeight: Int ): Boolean = when { srcSize > 1 -> { RectangleBoundaryUtils...
package com.rs.engine.pathfinder.bound /** * @author Kris | 12/09/2021 */ internal fun reachExclusiveRectangle( flags: Array<IntArray?>, x: Int, y: Int, z: Int, accessBitMask: Int, destX: Int, destY: Int, srcSize: Int, destWidth: Int, destHeight: Int ): Boolean = when { s...
@file:Suppress("DuplicatedCode") package com.rs.engine.pathfinder.bound internal fun reachWall( flags: Array<IntArray?>, x: Int, y: Int, z: Int, destX: Int, destY: Int, srcSize: Int, shape: Int, rot: Int ): Boolean = when { srcSize == 1 && x == destX && y == destY -> true ...
@file:Suppress("DuplicatedCode") package com.rs.engine.pathfinder.bound internal fun reachWallDeco( flags: Array<IntArray?>, x: Int, y: Int, z: Int, destX: Int, destY: Int, srcSize: Int, shape: Int, rot: Int ): Boolean = when { srcSize == 1 && x == destX && destY == y -> true ...
@file:Suppress("unused") package com.rs.engine.pathfinder.collision enum class CollisionStrategyType(val strategy: CollisionStrategy) { NORMAL(NormalBlockFlagCollision()), WATER(BlockedFlagCollision()), FLY(LineOfSightBlockFlagCollision()), INDOOR(IndoorsFlagCollision()), OUTDOOR(OutdoorsFlagColli...
package com.rs.engine.pathfinder.collision public interface CollisionStrategy { public fun canMove(tileFlag: Int, blockFlag: Int): Boolean } public class NormalBlockFlagCollision : CollisionStrategy { override fun canMove(tileFlag: Int, blockFlag: Int): Boolean { return (tileFlag and blockFlag) == 0 ...
package com.rs.engine.pathfinder.flag /** * @author Kris | 15/01/2022 */ public object AccessBitFlag { public const val BLOCK_NORTH: Int = 0x1 public const val BLOCK_EAST: Int = 0x2 public const val BLOCK_SOUTH: Int = 0x4 public const val BLOCK_WEST: Int = 0x8 }
@file:Suppress("MemberVisibilityCanBePrivate", "unused") package com.rs.engine.pathfinder.flag public object CollisionFlag { public const val WALL_NORTH_WEST: Int = 0x1 public const val WALL_NORTH: Int = 0x2 public const val WALL_NORTH_EAST: Int = 0x4 public const val WALL_EAST: Int = 0x8 public ...
package com.rs.engine.pathfinder.flag public object DirectionFlag { public const val NORTH: Int = 0x1 public const val EAST: Int = 0x2 public const val SOUTH: Int = 0x4 public const val WEST: Int = 0x8 public const val SOUTH_WEST: Int = WEST or SOUTH public const val NORTH_WEST: Int = WEST or ...
package com.rs.engine.pathfinder.reach private const val WALL_STRATEGY = 0 private const val WALL_DECO_STRATEGY = 1 private const val RECTANGLE_STRATEGY = 2 private const val NO_STRATEGY = 3 private const val RECTANGLE_EXCLUSIVE_STRATEGY = 4 public object DefaultReachStrategy : ReachStrategy { override fun reac...