Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialogue plugins #536

Draft
wants to merge 43 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
45450db
Start Setting Up Second World
Dark98 Nov 12, 2021
ccc0353
Small Cleanup For World 2 Support
Dark98 Nov 14, 2021
00932b8
Woops Wrong Ports
Dark98 Nov 14, 2021
8fc1e17
Merge branch 'master' into world2
Dark98 Nov 23, 2021
8ab3177
Set Server Port After Loading Config
Dark98 Nov 23, 2021
bdd5297
Add xpRate Var & Include With XPRate Calculations
Dark98 Nov 23, 2021
8a10201
Add -w/-world arg to client
Dark98 Nov 23, 2021
38140d8
Add XP Rate Multiplier For Non-Bot Worlds
Dark98 Dec 5, 2021
d2faea6
More Multi World Stuff
Dark98 Dec 6, 2021
5c02c34
Add Kick Command To Discord Bot & Fix Type In ConfigLoader
Dark98 Dec 6, 2021
f64b046
Create/Use commandPrefix Var For Discord Bot
Dark98 Dec 6, 2021
2fc416c
Small Fixup For World 2
Dark98 Dec 6, 2021
375cc1a
More Discord Commands(GameKick, MoveHome & Update)
Dark98 Dec 10, 2021
5ed9394
Minor fixup
RedSparr0w Dec 10, 2021
c15722c
43597 → 43598
RedSparr0w Dec 10, 2021
8761116
Fix XP Rate Multiplier & add ::xprate to cooamnds list if enabled
Dark98 Dec 10, 2021
83eb0be
Use Either VARIABLE_SKILL_RATE OR XP_RATE Not Both
Dark98 Dec 11, 2021
c47d9a4
Create/Use PLAYER_XP_RATES For Easier Rate Changes
Dark98 Dec 13, 2021
c7a6cb2
Fixed Abusive Client Command Privileges & Added myxprate/checkxprate
Dark98 Dec 13, 2021
49a2810
Allow Loading VARIABLE_XP_RATES & PLAYER_XP_RATES From Config
Dark98 Dec 14, 2021
790cc51
Properly Update Client Title Logo
Dark98 Nov 1, 2021
6d23a5b
Fix Cache CRC Checks For The Client(Allows Cache To Actually Check Fo…
Dark98 Nov 1, 2021
7935721
Add -no-crc & -dev Arguments To Client
Dark98 Dec 14, 2021
24e5ad9
Fix Naming For Some Vars
Dark98 Dec 14, 2021
736b3b0
Make CHECK_CRC Description More Descriptive
Dark98 Dec 14, 2021
d3f5ebc
Fix More Var Descriptions
Dark98 Dec 14, 2021
3aaf413
Cleanup Unused GameConstants Vars & Add More Vars To ConfigLoader
Dark98 Dec 14, 2021
8ee8884
Astraeus Dialogue System Port (#512)
Qweqker Oct 31, 2021
8d0000d
Update NPC Plugins Layout To Put Click Actions Per NPC Plugin
Dark98 Oct 31, 2021
3c61ba6
Small Update
Dark98 Dec 15, 2021
5f4a5ef
Fix Discord Bot Derp
Dark98 Jan 8, 2022
315d103
Added/Fixed Right Click Banking For Fadli(Duel Arena Banker)
Dark98 Jan 8, 2022
3e00708
Added Current World To Client Title
Dark98 Jan 8, 2022
d061f18
Added jad ranged attack projectile (#521)
sad-emu Jan 20, 2022
8b3bdc8
East falador staircase was falling into the last if which was telepor…
sad-emu Jan 22, 2022
860adc8
Various Changes (#523)
Dark98 Jan 27, 2022
0481b93
Revert Library Updates To Fix Server
Jan 29, 2022
f254773
Merge pull request #527
JohnsonMichaels123 Apr 19, 2022
fab3c3e
Various Changes (#533)
Dark98 Aug 22, 2022
7bc2b8b
Setup GH Actions For Windows Single-Player
Dark98 Aug 22, 2022
374b03a
Bump gson from 2.8.6 to 2.8.9 in /2006Scape Server
dependabot[bot] May 20, 2022
cb3686a
Bump jackson-databind from 2.10.5.1 to 2.13.4.1 in /2006Scape Server
dependabot[bot] Oct 19, 2022
997ccce
Update Readme For Local Bot Client Use
Dark98 Oct 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This workflow will build a Java project with Maven
# This workflow will build a Java project with Maven
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven

name: Java CI with Maven
Expand All @@ -11,14 +11,26 @@ on:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Build with Maven
run: mvn -B clean install
id: build
run: |
mvn -B clean package
mkdir -p ~/artifacts
cp "2006Scape Client/target/client-1.0-jar-with-dependencies.jar" ~/artifacts/Client.jar
cp "2006Scape Server/target/server-1.0-jar-with-dependencies.jar" ~/artifacts/Server.jar
cp "2006Scape Server/ServerConfig.Sample.json" ~/artifacts/ServerConfig.json
cp SinglePlayer.bat ~/artifacts/
cp -r "2006Scape Server/plugins" ~/artifacts/
cp -r "2006Scape Server/data" ~/artifacts/
- name: Publish build to GH Actions
uses: actions/upload-artifact@v2
with:
path: ~/artifacts/*
name: 2006Scape-Build
22 changes: 17 additions & 5 deletions 2006Scape Client/src/main/java/ClientSettings.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/

public class ClientSettings {
public static String SNOW_MONTH = ".12";

public static String SNOW_MONTH = ".12";
/**
* The Servers Name
*/
Expand All @@ -18,12 +18,24 @@ public class ClientSettings {
public final static String SERVER_WEBSITE = "www.2006Scape.org";
/**
* The Servers Ip
*
* You don't have to change this, the client will automatically connect to the server
* on localhost (Assuming you're running Client and LocalGame respectively)
*
*/
public static String SERVER_IP = "www.2006Scape.org";
public static String SERVER_IP = "server.2006Scape.org";
/**
* The Servers World
* This Determines The Port The Server Will Connect On
* World 1 Will Connect On Port 43594
* World 2 Will Connect On Port 43598
*/
public static int SERVER_WORLD = 1;

/**
* Enables/Disables FileServer CRC Checking For Cache Updates
* FileServer Must Be Running Before Starting The Client If This Is True
*/
public static boolean CHECK_CRC = true;

/**
* The Npc Bits for the Server
*/
Expand Down
51 changes: 31 additions & 20 deletions 2006Scape Client/src/main/java/Game.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import java.text.DecimalFormatSymbols;
import java.util.Calendar;
import java.util.Date;
import java.util.zip.CRC32;

/**
* NOTICE: IF YOU CHANGE ANYTHING IN GAME.JAVA, PLEASE COPY-PASTE THE WHOLE CLASS OVER TO LOCALGAME.JAVA
Expand Down Expand Up @@ -3429,11 +3430,12 @@ public StreamLoader streamLoaderForName(int i, String s, String s1, int j, int k
}
} catch (Exception _ex) {
}
if (abyte0 != null) {
// aCRC32_930.reset();
// aCRC32_930.update(abyte0);
// int i1 = (int)aCRC32_930.getValue();
// if(i1 != j)
if(abyte0 != null && ClientSettings.CHECK_CRC) {
aCRC32_930.reset();
aCRC32_930.update(abyte0);
int i1 = (int)aCRC32_930.getValue();
if(i1 != j)
abyte0 = null;
}
if (abyte0 != null) {
StreamLoader streamLoader = new StreamLoader(abyte0);
Expand Down Expand Up @@ -3480,12 +3482,20 @@ public StreamLoader streamLoaderForName(int i, String s, String s1, int j, int k
} catch (Exception _ex) {
decompressors[0] = null;
}
/*
* if(abyte0 != null) { aCRC32_930.reset();
* aCRC32_930.update(abyte0); int i3 =
* (int)aCRC32_930.getValue(); if(i3 != j) { abyte0 = null;
* j1++; s2 = "Checksum error: " + i3; } }
*/

if(abyte0 != null && ClientSettings.CHECK_CRC)
{
aCRC32_930.reset();
aCRC32_930.update(abyte0);
int i3 = (int)aCRC32_930.getValue();
if(i3 != j)
{
abyte0 = null;
j1++;
s2 = "Checksum error: " + i3;
}
}

} catch (IOException ioexception) {
if (s2.equals("Unknown error")) {
s2 = "Connection error";
Expand Down Expand Up @@ -5021,12 +5031,12 @@ public void method73() {
if (inputString.equals("::gfxtgl") || inputString.equals("::tglgfx") || inputString.equals("::togglerender") || inputString.equals("::togglegfx")) {
graphicsEnabled = !graphicsEnabled;
}
if (myPrivilege >= 0) {
if(inputString.equals("::noclip"))
for(int k1 = 0; k1 < 4; k1++)
for(int i2 = 1; i2 < 103; i2++)
for(int k2 = 1; k2 < 103; k2++)
aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;
if (myPrivilege >= 2) {
if (inputString.equals("::noclip"))
for (int k1 = 0; k1 < 4; k1++)
for (int i2 = 1; i2 < 103; i2++)
for (int k2 = 1; k2 < 103; k2++)
aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;
if (inputString.equals("::clientdrop")) {
dropClient();
}
Expand Down Expand Up @@ -5060,6 +5070,7 @@ public void method73() {
onDemandFetcher.method563((byte) 1, 2, j1);
}
}
}
if (inputString.startsWith("::dd")) {
String[] args = inputString.split(" ");
int distance = 25;
Expand All @@ -5078,7 +5089,6 @@ public void method73() {
if (inputString.equals("::dataon")) {
showInfo = !showInfo;
}
}
if (inputString.startsWith("::")) {
stream.createFrame(103);
stream.writeWordBigEndian(inputString.length() - 1);
Expand Down Expand Up @@ -5927,7 +5937,7 @@ public void login(String s, String s1, boolean flag) {
loginMessage2 = "Connecting to server...";
drawLoginScreen(true);
}
socketStream = new RSSocket(this, openSocket(43594 + portOff));
socketStream = new RSSocket(this, openSocket((ClientSettings.SERVER_WORLD == 1) ? 43594 : 43596 + ClientSettings.SERVER_WORLD + portOff));
long l = TextClass.longForName(s);
int i = (int) (l >> 16 & 31L);
stream.currentOffset = 0;
Expand Down Expand Up @@ -12046,8 +12056,9 @@ public Game() {
bigX = new int[4000];
bigY = new int[4000];
anInt1289 = -1;
aCRC32_930 = new CRC32();
}

public CRC32 aCRC32_930;
public static String server;
public int ignoreCount;
public long aLong824;
Expand Down
19 changes: 16 additions & 3 deletions 2006Scape Client/src/main/java/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,25 @@ public final class Main {
DEAR DEVELOPER!

If you want to run the client locally, the easiest way to do that is run the class "Client.java" instead!

If you REALLY want to use this class, add program arguments "-s localhost".
But seriously, Client.java is just a copy-paste of this class and does it locally. Use that instead!

*/

public static void main(String[] args) {
try {
// Process server/ip address to connect to
for (int i = 0; i < args.length; i++) {
switch(args[i]) {
case "-dev" :
case "-local":
case "-offline":
ClientSettings.SERVER_IP = "localhost";
ClientSettings.CHECK_CRC = false;
break;
case "-no-crc":
case "-no-cache-crc":
ClientSettings.CHECK_CRC = false;
break;
}
if (args[i].startsWith("-") && (i + 1) < args.length && !args[i + 1].startsWith("-")) {
switch(args[i]) {
case "-s":
Expand Down Expand Up @@ -45,6 +54,10 @@ public static void main(String[] args) {
case "-password":
game.myPassword = args[++i];
break;
case "-w":
case "-world":
ClientSettings.SERVER_WORLD = Integer.parseInt(args[++i]);
break;
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions 2006Scape Client/src/main/java/RSFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

import java.awt.*;

@SuppressWarnings("serial")
final class RSFrame extends Frame {

public RSFrame(RSApplet RSApplet_, int i, int j) {
rsApplet = RSApplet_;
setTitle(ClientSettings.SERVER_NAME);
setTitle(ClientSettings.SERVER_NAME + " World: " + ClientSettings.SERVER_WORLD);
setResizable(false);
setMinimumSize(new Dimension(i + 8, j + 28));
setVisible(true);
Expand Down
7 changes: 5 additions & 2 deletions 2006Scape Server/ServerConfig.Sample.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"server_debug": false,
"file_server": true,
"world_id": 1,
"xp_rate": 1.0,
"variable_xp_rate": false,
"variable_xp_rates": [1, 2, 5, 10],
"members_only": false,
"tutorial_island_enabled": false,
"party_room_enabled": true,
Expand All @@ -15,6 +18,6 @@
"save_timer": 120,
"timeout": 60,
"item_requirements": true,
"xp_rate": 1.0,
"max_players": 200
"max_players": 200,
"website_integration": false
}
Binary file modified 2006Scape Server/data/cache/main_file_cache.dat
Binary file not shown.
Binary file modified 2006Scape Server/data/cache/main_file_cache.idx0
Binary file not shown.
18 changes: 9 additions & 9 deletions 2006Scape Server/data/cfg/spawns.json
Original file line number Diff line number Diff line change
Expand Up @@ -10970,7 +10970,7 @@
"height": 2
},
{
"maxHit": 16,
"maxHit": 8,
"strength": 150,
"attack": 250,
"x": 3425,
Expand All @@ -10980,7 +10980,7 @@
"height": 2
},
{
"maxHit": 16,
"maxHit": 8,
"strength": 150,
"attack": 250,
"x": 3428,
Expand All @@ -10990,7 +10990,7 @@
"height": 2
},
{
"maxHit": 16,
"maxHit": 8,
"strength": 150,
"attack": 250,
"x": 3425,
Expand All @@ -11000,7 +11000,7 @@
"height": 2
},
{
"maxHit": 16,
"maxHit": 8,
"strength": 150,
"attack": 250,
"x": 3423,
Expand All @@ -11010,7 +11010,7 @@
"height": 2
},
{
"maxHit": 16,
"maxHit": 8,
"strength": 150,
"attack": 250,
"x": 3427,
Expand All @@ -11020,7 +11020,7 @@
"height": 2
},
{
"maxHit": 16,
"maxHit": 8,
"strength": 150,
"attack": 250,
"x": 3416,
Expand All @@ -11030,7 +11030,7 @@
"height": 2
},
{
"maxHit": 16,
"maxHit": 8,
"strength": 150,
"attack": 250,
"x": 3413,
Expand All @@ -11040,7 +11040,7 @@
"height": 2
},
{
"maxHit": 16,
"maxHit": 8,
"strength": 150,
"attack": 250,
"x": 3410,
Expand All @@ -11050,7 +11050,7 @@
"height": 2
},
{
"maxHit": 16,
"maxHit": 8,
"strength": 150,
"attack": 250,
"x": 3413,
Expand Down
1 change: 0 additions & 1 deletion 2006Scape Server/data/discord.json

This file was deleted.

41 changes: 41 additions & 0 deletions 2006Scape Server/plugins/plugin/buttons/DialogueOptionButtons.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package plugin.buttons

import com.rs2.event.SubscribesTo
import com.rs2.event.impl.ButtonActionEvent
import com.rs2.game.dialogues.DialoguePlugin
import com.rs2.game.players.Player
import plugin.buttons.ButtonClick

@SubscribesTo(ButtonActionEvent::class)
class DialogueOptionButtons : ButtonClick() {

override fun execute(player: Player, event: ButtonActionEvent) {

when (event.button) {

// First Option (Option Interfaces 2, 3, 4, and 5)
9157, 9167, 9178, 9190 ->
player.dialogueFactory.executeOption(0, player.optionDialogue)

// Second Option (Option Interfaces 2, 3, 4, and 5)
9158, 9168, 9179, 9191 ->
player.dialogueFactory.executeOption(1, player.optionDialogue)

// Third Option (Option Interfaces 3, 4, and 5)
9169, 9180, 9192 ->
player.dialogueFactory.executeOption(2, player.optionDialogue)

// Fourth Option (Option Interfaces 4 and 5)
9181, 9193 ->
player.dialogueFactory.executeOption(3, player.optionDialogue)

// Fifth Option (Option Interface 5)
9194 ->
player.dialogueFactory.executeOption(4, player.optionDialogue)
}
}

override fun test(event: ButtonActionEvent): Boolean {
return DialoguePlugin.isDialogueButton(event.button)
}
}
Loading