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();
} |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 6