mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-03 08:39:04 +00:00
Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 3c61ba69f3 | |||
| 8d0000de0b | |||
| 8ee88848a3 | |||
| 3aaf413bc7 | |||
| d3f5ebc7a2 | |||
| 736b3b0ea3 | |||
| 24e5ad9415 | |||
| 79357215c7 | |||
| 6d23a5b536 | |||
| 790cc51d81 | |||
| 49a2810e3e | |||
| c7a6cb2811 | |||
| c47d9a4b15 | |||
| 83eb0be61a | |||
| 8761116b9b | |||
| c15722c766 | |||
| 5ed9394f44 | |||
| 375cc1ac6f | |||
| 2fc416c3e1 | |||
| f64b0469c2 | |||
| 5c02c34569 | |||
| d2faea6f71 | |||
| 38140d8665 | |||
| 8a10201637 | |||
| bdd5297a94 | |||
| 8ab31771b3 | |||
| 8fc1e17a25 | |||
| 00932b82ee | |||
| ccc0353bad | |||
| 45450dbb9c |
@@ -7,7 +7,7 @@ import java.math.BigInteger;
|
|||||||
|
|
||||||
public class ClientSettings {
|
public class ClientSettings {
|
||||||
|
|
||||||
public static String SNOW_MONTH = ".12";
|
public static String SNOW_MONTH = ".12";
|
||||||
/**
|
/**
|
||||||
* The Servers Name
|
* The Servers Name
|
||||||
*/
|
*/
|
||||||
@@ -18,12 +18,24 @@ public class ClientSettings {
|
|||||||
public final static String SERVER_WEBSITE = "www.2006Scape.org";
|
public final static String SERVER_WEBSITE = "www.2006Scape.org";
|
||||||
/**
|
/**
|
||||||
* The Servers Ip
|
* The Servers Ip
|
||||||
*
|
|
||||||
* You don't have to change this, the client will automatically connect to the server
|
* 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)
|
* on localhost (Assuming you're running Client and LocalGame respectively)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public static String SERVER_IP = "www.2006Scape.org";
|
public static String SERVER_IP = "www.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
|
* The Npc Bits for the Server
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import java.text.DecimalFormat;
|
|||||||
import java.text.DecimalFormatSymbols;
|
import java.text.DecimalFormatSymbols;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
import java.util.Date;
|
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
|
* NOTICE: IF YOU CHANGE ANYTHING IN GAME.JAVA, PLEASE COPY-PASTE THE WHOLE CLASS OVER TO LOCALGAME.JAVA
|
||||||
@@ -3429,11 +3430,12 @@ public class Game extends RSApplet {
|
|||||||
}
|
}
|
||||||
} catch (Exception _ex) {
|
} catch (Exception _ex) {
|
||||||
}
|
}
|
||||||
if (abyte0 != null) {
|
if(abyte0 != null && ClientSettings.CHECK_CRC) {
|
||||||
// aCRC32_930.reset();
|
aCRC32_930.reset();
|
||||||
// aCRC32_930.update(abyte0);
|
aCRC32_930.update(abyte0);
|
||||||
// int i1 = (int)aCRC32_930.getValue();
|
int i1 = (int)aCRC32_930.getValue();
|
||||||
// if(i1 != j)
|
if(i1 != j)
|
||||||
|
abyte0 = null;
|
||||||
}
|
}
|
||||||
if (abyte0 != null) {
|
if (abyte0 != null) {
|
||||||
StreamLoader streamLoader = new StreamLoader(abyte0);
|
StreamLoader streamLoader = new StreamLoader(abyte0);
|
||||||
@@ -3480,12 +3482,20 @@ public class Game extends RSApplet {
|
|||||||
} catch (Exception _ex) {
|
} catch (Exception _ex) {
|
||||||
decompressors[0] = null;
|
decompressors[0] = null;
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
* if(abyte0 != null) { aCRC32_930.reset();
|
if(abyte0 != null && ClientSettings.CHECK_CRC)
|
||||||
* aCRC32_930.update(abyte0); int i3 =
|
{
|
||||||
* (int)aCRC32_930.getValue(); if(i3 != j) { abyte0 = null;
|
aCRC32_930.reset();
|
||||||
* j1++; s2 = "Checksum error: " + i3; } }
|
aCRC32_930.update(abyte0);
|
||||||
*/
|
int i3 = (int)aCRC32_930.getValue();
|
||||||
|
if(i3 != j)
|
||||||
|
{
|
||||||
|
abyte0 = null;
|
||||||
|
j1++;
|
||||||
|
s2 = "Checksum error: " + i3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} catch (IOException ioexception) {
|
} catch (IOException ioexception) {
|
||||||
if (s2.equals("Unknown error")) {
|
if (s2.equals("Unknown error")) {
|
||||||
s2 = "Connection error";
|
s2 = "Connection error";
|
||||||
@@ -5021,12 +5031,12 @@ public class Game extends RSApplet {
|
|||||||
if (inputString.equals("::gfxtgl") || inputString.equals("::tglgfx") || inputString.equals("::togglerender") || inputString.equals("::togglegfx")) {
|
if (inputString.equals("::gfxtgl") || inputString.equals("::tglgfx") || inputString.equals("::togglerender") || inputString.equals("::togglegfx")) {
|
||||||
graphicsEnabled = !graphicsEnabled;
|
graphicsEnabled = !graphicsEnabled;
|
||||||
}
|
}
|
||||||
if (myPrivilege >= 0) {
|
if (myPrivilege >= 2) {
|
||||||
if(inputString.equals("::noclip"))
|
if (inputString.equals("::noclip"))
|
||||||
for(int k1 = 0; k1 < 4; k1++)
|
for (int k1 = 0; k1 < 4; k1++)
|
||||||
for(int i2 = 1; i2 < 103; i2++)
|
for (int i2 = 1; i2 < 103; i2++)
|
||||||
for(int k2 = 1; k2 < 103; k2++)
|
for (int k2 = 1; k2 < 103; k2++)
|
||||||
aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;
|
aClass11Array1230[k1].anIntArrayArray294[i2][k2] = 0;
|
||||||
if (inputString.equals("::clientdrop")) {
|
if (inputString.equals("::clientdrop")) {
|
||||||
dropClient();
|
dropClient();
|
||||||
}
|
}
|
||||||
@@ -5060,6 +5070,7 @@ public class Game extends RSApplet {
|
|||||||
onDemandFetcher.method563((byte) 1, 2, j1);
|
onDemandFetcher.method563((byte) 1, 2, j1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (inputString.startsWith("::dd")) {
|
if (inputString.startsWith("::dd")) {
|
||||||
String[] args = inputString.split(" ");
|
String[] args = inputString.split(" ");
|
||||||
int distance = 25;
|
int distance = 25;
|
||||||
@@ -5078,7 +5089,6 @@ public class Game extends RSApplet {
|
|||||||
if (inputString.equals("::dataon")) {
|
if (inputString.equals("::dataon")) {
|
||||||
showInfo = !showInfo;
|
showInfo = !showInfo;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (inputString.startsWith("::")) {
|
if (inputString.startsWith("::")) {
|
||||||
stream.createFrame(103);
|
stream.createFrame(103);
|
||||||
stream.writeWordBigEndian(inputString.length() - 1);
|
stream.writeWordBigEndian(inputString.length() - 1);
|
||||||
@@ -5927,7 +5937,7 @@ public class Game extends RSApplet {
|
|||||||
loginMessage2 = "Connecting to server...";
|
loginMessage2 = "Connecting to server...";
|
||||||
drawLoginScreen(true);
|
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);
|
long l = TextClass.longForName(s);
|
||||||
int i = (int) (l >> 16 & 31L);
|
int i = (int) (l >> 16 & 31L);
|
||||||
stream.currentOffset = 0;
|
stream.currentOffset = 0;
|
||||||
@@ -12046,8 +12056,9 @@ public class Game extends RSApplet {
|
|||||||
bigX = new int[4000];
|
bigX = new int[4000];
|
||||||
bigY = new int[4000];
|
bigY = new int[4000];
|
||||||
anInt1289 = -1;
|
anInt1289 = -1;
|
||||||
|
aCRC32_930 = new CRC32();
|
||||||
}
|
}
|
||||||
|
public CRC32 aCRC32_930;
|
||||||
public static String server;
|
public static String server;
|
||||||
public int ignoreCount;
|
public int ignoreCount;
|
||||||
public long aLong824;
|
public long aLong824;
|
||||||
|
|||||||
@@ -8,10 +8,7 @@ public final class Main {
|
|||||||
DEAR DEVELOPER!
|
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 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".
|
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) {
|
public static void main(String[] args) {
|
||||||
@@ -25,6 +22,16 @@ public final class Main {
|
|||||||
case "-ip":
|
case "-ip":
|
||||||
ClientSettings.SERVER_IP = args[++i];
|
ClientSettings.SERVER_IP = args[++i];
|
||||||
break;
|
break;
|
||||||
|
case "-no-crc":
|
||||||
|
case "-no-cache-crc":
|
||||||
|
ClientSettings.CHECK_CRC = false;
|
||||||
|
break;
|
||||||
|
case "-dev" :
|
||||||
|
case "-local":
|
||||||
|
case "-offline":
|
||||||
|
ClientSettings.SERVER_IP = "localhost";
|
||||||
|
ClientSettings.CHECK_CRC = false;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -45,6 +52,10 @@ public final class Main {
|
|||||||
case "-password":
|
case "-password":
|
||||||
game.myPassword = args[++i];
|
game.myPassword = args[++i];
|
||||||
break;
|
break;
|
||||||
|
case "-w":
|
||||||
|
case "-world":
|
||||||
|
ClientSettings.SERVER_WORLD = Integer.parseInt(args[++i]);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
"server_debug": false,
|
"server_debug": false,
|
||||||
"file_server": true,
|
"file_server": true,
|
||||||
"world_id": 1,
|
"world_id": 1,
|
||||||
|
"xp_rate": 1.0,
|
||||||
|
"variable_xp_rate": false,
|
||||||
|
"variable_xp_rates": [1, 2, 5, 10],
|
||||||
"members_only": false,
|
"members_only": false,
|
||||||
"tutorial_island_enabled": false,
|
"tutorial_island_enabled": false,
|
||||||
"party_room_enabled": true,
|
"party_room_enabled": true,
|
||||||
@@ -15,6 +18,6 @@
|
|||||||
"save_timer": 120,
|
"save_timer": 120,
|
||||||
"timeout": 60,
|
"timeout": 60,
|
||||||
"item_requirements": true,
|
"item_requirements": true,
|
||||||
"xp_rate": 1.0,
|
"max_players": 200,
|
||||||
"max_players": 200
|
"website_total_characters_integration": false
|
||||||
}
|
}
|
||||||
BIN
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
|||||||
{"token":""}
|
|
||||||
@@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package plugin.npc.banker
|
||||||
|
|
||||||
|
import com.rs2.game.dialogues.DialoguePlugin
|
||||||
|
import com.rs2.game.dialogues.DialogueFactoryPlugin
|
||||||
|
import com.rs2.game.dialogues.ExpressionPlugin
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Dialogue Class for Gnome and Human Banker NPCs
|
||||||
|
* Does NOT include dialogue for Ghost Bankers
|
||||||
|
* @author Qweqker
|
||||||
|
*/
|
||||||
|
class BankerDialogue : DialoguePlugin() {
|
||||||
|
|
||||||
|
override fun sendDialogues(factory: DialogueFactoryPlugin) {
|
||||||
|
|
||||||
|
factory
|
||||||
|
.sendNPCChat(ExpressionPlugin.HAPPY, "Good day. How may I help you?")
|
||||||
|
.sendOption("I'd like to access my bank account, please.", {
|
||||||
|
factory
|
||||||
|
.onAction {
|
||||||
|
factory.player.packetSender.openUpBank()
|
||||||
|
}
|
||||||
|
}, "I'd like to check my PIN settings.", {
|
||||||
|
factory
|
||||||
|
.onAction {
|
||||||
|
factory.player.bankPin.bankPinSettings()
|
||||||
|
}
|
||||||
|
}, "What is this place?") {
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT,"What is this place?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT,"This is the bank of <servername>. We have many branches in many towns.")
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT,"And what do you do?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT,"We will look after your items and money for you. Leave your valuables with us if you want to keep them safe.")
|
||||||
|
}
|
||||||
|
.execute()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package plugin.npc.banker
|
||||||
|
|
||||||
|
import com.rs2.event.EventContext
|
||||||
|
import com.rs2.event.EventSubscriber
|
||||||
|
import com.rs2.event.SubscribesTo
|
||||||
|
import com.rs2.event.impl.NpcFirstClickEvent
|
||||||
|
import com.rs2.game.content.skills.SkillHandler
|
||||||
|
import com.rs2.game.players.Player
|
||||||
|
import com.rs2.util.Misc
|
||||||
|
import plugin.npc.banker.BankerDialogue
|
||||||
|
import plugin.npc.manwoman.ManWomanDialogue
|
||||||
|
|
||||||
|
|
||||||
|
@SubscribesTo(NpcFirstClickEvent::class)
|
||||||
|
class FirstClick : EventSubscriber<NpcFirstClickEvent> {
|
||||||
|
|
||||||
|
override fun subscribe(context: EventContext, player: Player, event: NpcFirstClickEvent) {
|
||||||
|
|
||||||
|
if (player.playerRights >= 3) {
|
||||||
|
player.packetSender.sendMessage("[click= npc], [type = first], [id= ${event.npc}], [Type= ${event.npc}]")
|
||||||
|
}
|
||||||
|
|
||||||
|
when(event.npc) {
|
||||||
|
// Banker (NOT INCLUDING GHOST BANKER IN PORT PHASMATYS)
|
||||||
|
166, 494, 495, 496, 497, 498, 499, 953, 1036, 1360, 2163, 2164, 2354, 2355, 2568, 2569, 2570 -> {
|
||||||
|
if (!SkillHandler.isSkilling(player)) {
|
||||||
|
player.dialogueFactory.sendDialogue(BankerDialogue())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+8
-15
@@ -1,35 +1,28 @@
|
|||||||
package plugin.click.npc
|
package plugin.npc.manwoman
|
||||||
|
|
||||||
import com.rs2.GameConstants
|
|
||||||
import com.rs2.event.EventContext
|
import com.rs2.event.EventContext
|
||||||
import com.rs2.event.EventSubscriber
|
import com.rs2.event.EventSubscriber
|
||||||
import com.rs2.event.SubscribesTo
|
import com.rs2.event.SubscribesTo
|
||||||
import com.rs2.event.impl.NpcFirstClickEvent
|
import com.rs2.event.impl.NpcFirstClickEvent
|
||||||
import com.rs2.game.npcs.Npc
|
import com.rs2.game.content.skills.SkillHandler
|
||||||
import com.rs2.game.players.Player
|
import com.rs2.game.players.Player
|
||||||
import com.rs2.util.Misc
|
import com.rs2.util.Misc
|
||||||
|
import plugin.npc.banker.BankerDialogue
|
||||||
|
import plugin.npc.manwoman.ManWomanDialogue
|
||||||
|
|
||||||
|
|
||||||
@SubscribesTo(NpcFirstClickEvent::class)
|
@SubscribesTo(NpcFirstClickEvent::class)
|
||||||
class NpcFirstClick : EventSubscriber<NpcFirstClickEvent> {
|
class FirstClick : EventSubscriber<NpcFirstClickEvent> {
|
||||||
|
|
||||||
override fun subscribe(context: EventContext, player: Player, event: NpcFirstClickEvent) {
|
override fun subscribe(context: EventContext, player: Player, event: NpcFirstClickEvent) {
|
||||||
|
|
||||||
if (player.playerRights >= 3) {
|
if (player.playerRights >= 3) {
|
||||||
player.packetSender.sendMessage("[click= npc], [type = first], [id= ${event.npc}], [Type= ${event.npc}]");
|
player.packetSender.sendMessage("[click= npc], [type = first], [id= ${event.npc}], [Type= ${event.npc}]")
|
||||||
}
|
}
|
||||||
|
|
||||||
when(event.npc) {
|
when(event.npc) {
|
||||||
|
// Man or Woman
|
||||||
1,2,3,4,5,6 -> if (Misc.random(10) <= 5) {
|
1,2,3,4,5,6 -> player.dialogueFactory.sendDialogue(ManWomanDialogue(Misc.random(22)))
|
||||||
player.dialogueHandler.sendDialogues(3869, player.npcType)
|
|
||||||
} else {
|
|
||||||
player.dialogueHandler.sendDialogues(3872, player.npcType)
|
|
||||||
}
|
|
||||||
|
|
||||||
//else ->
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,163 @@
|
|||||||
|
package plugin.npc.manwoman
|
||||||
|
|
||||||
|
import com.rs2.game.dialogues.DialoguePlugin
|
||||||
|
import com.rs2.game.dialogues.DialogueFactoryPlugin
|
||||||
|
import com.rs2.game.dialogues.ExpressionPlugin
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Dialogue Class for Man and Woman NPCs
|
||||||
|
* @author Qweqker
|
||||||
|
*/
|
||||||
|
class ManWomanDialogue(private val randomDialogue: Int) : DialoguePlugin() {
|
||||||
|
|
||||||
|
override fun sendDialogues(factory: DialogueFactoryPlugin) {
|
||||||
|
|
||||||
|
// Since Man and Woman NPCs provide a random dialogue every interaction, use a switch statement
|
||||||
|
// There are 23 dialogues, but a random number is rolled between 0 and 22 in the FirstClick.kt file
|
||||||
|
// as part of the calling process
|
||||||
|
when(randomDialogue) {
|
||||||
|
0 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT, "Not too bad, but I'm a little worried about the increase of goblins these days.")
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Don't worry, I'll kill them.")
|
||||||
|
.execute()
|
||||||
|
1 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT, "How can I help you?")
|
||||||
|
.sendOption("Do you want to trade? ", {
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT,"Do you want to trade?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT,"No, I have nothing I wish to get rid of. If you want to do some trading, there are plenty of shops and market stalls around though.")
|
||||||
|
}, "I'm in search of a quest.", {
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT,"I'm in search of a quest.")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT,"I'm sorry I can't help you there.")
|
||||||
|
}, "I'm in search of enemies to kill.") {
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "I'm in search of enemies to kill.")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT,"I've heard there are many fearsome creatures that dwell under the ground...")
|
||||||
|
}
|
||||||
|
.execute()
|
||||||
|
2 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.ANNOYED, "Get out of my way, I'm in a hurry!")
|
||||||
|
.execute()
|
||||||
|
3 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.HAPPY, "I'm fine, how are you?")
|
||||||
|
.sendPlayerChat(ExpressionPlugin.HAPPY, "Very well thank you.")
|
||||||
|
.execute()
|
||||||
|
4 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.HAPPY, "Hello there! Nice weather we've been having.")
|
||||||
|
.execute()
|
||||||
|
5 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.HAPPY, "I'm very well thank you.")
|
||||||
|
.execute()
|
||||||
|
6 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT, "Who are you?")
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "I'm a bold adventurer.")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT, "Ah, a very noble profession.")
|
||||||
|
.execute()
|
||||||
|
7 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.ANNOYED, "Do I know you? I'm in a hurry!")
|
||||||
|
.execute()
|
||||||
|
8 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT, "I think we need a new king. The one we've got isn't very good.")
|
||||||
|
.execute()
|
||||||
|
9 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT, "Not too bad thanks.")
|
||||||
|
.execute()
|
||||||
|
10 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT, "Are you asking for a fight?")
|
||||||
|
/* TODO: Have NPC Attack Player
|
||||||
|
.onAction {
|
||||||
|
|
||||||
|
}*/
|
||||||
|
.execute()
|
||||||
|
11 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT, "I'm busy right now.")
|
||||||
|
.execute()
|
||||||
|
12 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT, "Hello.")
|
||||||
|
.execute()
|
||||||
|
13 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT, "None of your business.")
|
||||||
|
.execute()
|
||||||
|
14 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT,"Do you wish to trade?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT, "No, I have nothing I wish to get rid of. If you want to do some trading, there are plenty of shops and market stalls around though.")
|
||||||
|
.execute()
|
||||||
|
15 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT,"I'm in search of a quest.")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT, "I'm sorry I can't help you there.")
|
||||||
|
.execute()
|
||||||
|
16 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT,"I'm in search of enemies to kill.")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT, "I've heard there are many fearsome creatures that dwell under the ground...")
|
||||||
|
.execute()
|
||||||
|
17 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.ANNOYED, "No I don't have any spare change.")
|
||||||
|
.execute()
|
||||||
|
18 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DISTRESSED, "I'm a little worried - I've heard there's lots of people going about, killing citizens at random.")
|
||||||
|
.execute()
|
||||||
|
19 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DISTRESSED, "No, I don't want to buy anything!")
|
||||||
|
.execute()
|
||||||
|
20 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT, "That is classified information.")
|
||||||
|
.execute()
|
||||||
|
21 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT, "Have this flyer...")
|
||||||
|
.onAction {
|
||||||
|
factory.player.itemAssistant.addOrDropItem(956, 1)
|
||||||
|
}
|
||||||
|
.execute()
|
||||||
|
22 ->
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.DEFAULT, "Hello, how's it going?")
|
||||||
|
.sendNPCChat(ExpressionPlugin.DEFAULT, "Yo, wassup!")
|
||||||
|
.execute()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package plugin.quests.cooksassistant
|
||||||
|
|
||||||
|
import com.rs2.event.EventContext
|
||||||
|
import com.rs2.event.EventSubscriber
|
||||||
|
import com.rs2.event.SubscribesTo
|
||||||
|
import com.rs2.event.impl.NpcFirstClickEvent
|
||||||
|
import com.rs2.game.players.Player
|
||||||
|
import plugin.quests.cooksassistant.dialogue.LumbridgeCookDialogue
|
||||||
|
|
||||||
|
|
||||||
|
@SubscribesTo(NpcFirstClickEvent::class)
|
||||||
|
class FirstClick : EventSubscriber<NpcFirstClickEvent> {
|
||||||
|
|
||||||
|
override fun subscribe(context: EventContext, player: Player, event: NpcFirstClickEvent) {
|
||||||
|
|
||||||
|
when(event.npc) {
|
||||||
|
//Lumbridge Cook (278)
|
||||||
|
278 -> {
|
||||||
|
if (player.playerRights >= 3) {
|
||||||
|
player.packetSender.sendMessage("[click= npc], [type = first/quest], [id= ${event.npc}], [Type= ${event.npc}]")
|
||||||
|
}
|
||||||
|
player.dialogueFactory.sendDialogue(LumbridgeCookDialogue())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+151
@@ -0,0 +1,151 @@
|
|||||||
|
package plugin.quests.cooksassistant.dialogue
|
||||||
|
|
||||||
|
import com.rs2.game.content.quests.QuestAssistant
|
||||||
|
import com.rs2.game.content.quests.QuestRewards
|
||||||
|
import com.rs2.game.dialogues.DialogueFactoryPlugin
|
||||||
|
import com.rs2.game.dialogues.DialoguePlugin
|
||||||
|
import com.rs2.game.dialogues.ExpressionPlugin
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Dialogue For The Lumbridge Castle Cook/Cooks Assistant Quest
|
||||||
|
*/
|
||||||
|
class LumbridgeCookDialogue : DialoguePlugin() {
|
||||||
|
|
||||||
|
override fun sendDialogues(factory: DialogueFactoryPlugin) {
|
||||||
|
if (factory.player.cookAss == 0) {
|
||||||
|
factory
|
||||||
|
.sendNPCChat(ExpressionPlugin.ANXIOUS, "What am I to do?")
|
||||||
|
.sendOption("What's wrong?", {
|
||||||
|
factory
|
||||||
|
.onAction {
|
||||||
|
factory
|
||||||
|
.sendPlayerChat("What's wrong?")
|
||||||
|
.sendNPCChat(
|
||||||
|
"Oh dear, oh dear, oh dear, I'm in a terrible terrible",
|
||||||
|
"mess! It's the Duke's birthday today, and I should be",
|
||||||
|
"making him a lovely big birthday cake!"
|
||||||
|
)
|
||||||
|
.sendNPCChat(
|
||||||
|
"I've forgotten to buy the ingredients. I'll never get",
|
||||||
|
"them in time now. He'll sack me! What will I do? I have",
|
||||||
|
"four children and a goat to look after. Would you help",
|
||||||
|
"me? Please?"
|
||||||
|
)
|
||||||
|
.sendOption("I'm always happy to help a cook in distress", {
|
||||||
|
factory.onAction {
|
||||||
|
factory
|
||||||
|
.sendPlayerChat("Yes, I'll help you.")
|
||||||
|
.sendNPCChat(
|
||||||
|
"Oh thank you, thank you. I need milk, an egg, and",
|
||||||
|
"flour. I'd be very grateful if you can get them for me."
|
||||||
|
)
|
||||||
|
.sendPlayerChat("So where do I find these ingredients then?")
|
||||||
|
.sendNPCChat(
|
||||||
|
"You can find flour in any of the shops here.",
|
||||||
|
"You can find eggs by killing chickens.",
|
||||||
|
"You can find milk by using a bucket on a cow"
|
||||||
|
)
|
||||||
|
.execute()
|
||||||
|
.player.cookAss = 1
|
||||||
|
QuestAssistant.sendStages(factory.player)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"I can't right now, Maybe later.", {
|
||||||
|
factory.onAction {
|
||||||
|
factory
|
||||||
|
.sendPlayerChat("I can't right now, Maybe later.")
|
||||||
|
.sendNPCChat("Oh please! Hurry then!")
|
||||||
|
.execute()
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}, "Can you cook me a cake?", {
|
||||||
|
factory
|
||||||
|
.onAction {
|
||||||
|
factory
|
||||||
|
.sendNPCChat("Does it look like I have the time?")
|
||||||
|
.execute()
|
||||||
|
}
|
||||||
|
}, "You don't look very happy.", {
|
||||||
|
factory
|
||||||
|
.sendPlayerChat(ExpressionPlugin.ANXIOUS, "You don't look so happy.")
|
||||||
|
.sendNPCChat(
|
||||||
|
"Oh dear, oh dear, oh dear, I'm in a terrible terrible",
|
||||||
|
"mess! It's the Duke's birthday today, and I should be",
|
||||||
|
"making him a lovely big birthday cake!"
|
||||||
|
)
|
||||||
|
.sendNPCChat(
|
||||||
|
"I've forgotten to buy the ingredients. I'll never get",
|
||||||
|
"them in time now. He'll sack me! What will I do? I have",
|
||||||
|
"four children and a goat to look after. Would you help",
|
||||||
|
"me? Please?"
|
||||||
|
)
|
||||||
|
.sendOption("I'm always happy to help a cook in distress", {
|
||||||
|
factory.onAction {
|
||||||
|
factory
|
||||||
|
.sendPlayerChat("Yes, I'll help you.")
|
||||||
|
.sendNPCChat(
|
||||||
|
"Oh thank you, thank you. I need milk, an egg, and",
|
||||||
|
"flour. I'd be very grateful if you can get them for me."
|
||||||
|
)
|
||||||
|
.sendPlayerChat("So where do I find these ingredients then?")
|
||||||
|
.sendNPCChat(
|
||||||
|
"You can find flour in any of the shops here.",
|
||||||
|
"You can find eggs by killing chickens.",
|
||||||
|
"You can find milk by using a bucket on a cow"
|
||||||
|
)
|
||||||
|
.execute()
|
||||||
|
.player.cookAss = 1
|
||||||
|
QuestAssistant.sendStages(factory.player)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"I can't right now, Maybe later.", {
|
||||||
|
factory.onAction {
|
||||||
|
factory
|
||||||
|
.sendPlayerChat("I can't right now, Maybe later.")
|
||||||
|
.sendNPCChat("Oh please! Hurry then!")
|
||||||
|
.execute()
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}, "Nice hat.") {
|
||||||
|
factory
|
||||||
|
.sendNPCChat("I don't have time for your jibber-jabber!")
|
||||||
|
}
|
||||||
|
.execute()
|
||||||
|
} else if(factory.player.cookAss == 1) {
|
||||||
|
factory
|
||||||
|
.sendNPCChat("How are you getting on with finding the ingredients?")
|
||||||
|
if (factory.player.itemAssistant.playerHasItem(1944, 1)
|
||||||
|
&& factory.player.itemAssistant.playerHasItem(1927, 1)
|
||||||
|
&& factory.player.itemAssistant.playerHasItem(1933, 1)
|
||||||
|
) {
|
||||||
|
factory.sendPlayerChat("Here's all the items!")
|
||||||
|
factory.player.itemAssistant.deleteItem(1944, 1)
|
||||||
|
factory.player.itemAssistant.deleteItem(1927, 1)
|
||||||
|
factory.player.itemAssistant.deleteItem(1933, 1)
|
||||||
|
factory.player.cookAss = 2
|
||||||
|
factory.sendNPCChat("You brought me everything I need! I'm saved!", "Thank you!")
|
||||||
|
.sendPlayerChat("So do I get to go to the Duke's Party?")
|
||||||
|
.sendNPCChat("I'm afraid not, only the big cheeses get to dine with the", "Duke.")
|
||||||
|
.sendPlayerChat("Well, maybe one day I'll be important enough to sit on", "the Duke's table")
|
||||||
|
.sendNPCChat("Maybe, but I won't be holding my breath.")
|
||||||
|
QuestRewards.cookReward(factory.player)
|
||||||
|
} else {
|
||||||
|
factory.sendPlayerChat("I don't have all the items yet.")
|
||||||
|
.sendNPCChat("Oh please! Hurry then!")
|
||||||
|
.execute()
|
||||||
|
}
|
||||||
|
} else if(factory.player.cookAss == 2) {
|
||||||
|
factory
|
||||||
|
.sendPlayerChat("So do I get to go to the Duke's Party?")
|
||||||
|
.sendNPCChat("I'm afraid not, only the big cheeses get to dine with the", "Duke.")
|
||||||
|
.sendPlayerChat("Well, maybe one day I'll be important enough to sit on", "the Duke's table")
|
||||||
|
.sendNPCChat("Maybe, but I won't be holding my breath.")
|
||||||
|
QuestRewards.cookReward(factory.player)
|
||||||
|
} else if(factory.player.cookAss == 3) {
|
||||||
|
factory.sendNPCChat("Thanks for helping me out friend!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.rs2;
|
|||||||
import com.rs2.integrations.PlayersOnlineWebsite;
|
import com.rs2.integrations.PlayersOnlineWebsite;
|
||||||
import com.rs2.integrations.RegisteredAccsWebsite;
|
import com.rs2.integrations.RegisteredAccsWebsite;
|
||||||
import com.rs2.integrations.discord.JavaCord;
|
import com.rs2.integrations.discord.JavaCord;
|
||||||
|
import org.json.JSONArray;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
@@ -17,6 +18,8 @@ public class ConfigLoader {
|
|||||||
|
|
||||||
if(obj.has("server_name"))
|
if(obj.has("server_name"))
|
||||||
GameConstants.SERVER_NAME = obj.getString("server_name");
|
GameConstants.SERVER_NAME = obj.getString("server_name");
|
||||||
|
if(obj.has("server_test_version"))
|
||||||
|
GameConstants.TEST_VERSION = obj.getDouble("server_test_version");
|
||||||
if(obj.has("website_link"))
|
if(obj.has("website_link"))
|
||||||
GameConstants.WEBSITE_LINK = obj.getString("website_link");
|
GameConstants.WEBSITE_LINK = obj.getString("website_link");
|
||||||
if(obj.has("debug"))
|
if(obj.has("debug"))
|
||||||
@@ -49,10 +52,20 @@ public class ConfigLoader {
|
|||||||
GameConstants.TIMEOUT = obj.getInt("timeout");
|
GameConstants.TIMEOUT = obj.getInt("timeout");
|
||||||
if(obj.has("item_requirements"))
|
if(obj.has("item_requirements"))
|
||||||
GameConstants.ITEM_REQUIREMENTS = obj.getBoolean("item_requirements");
|
GameConstants.ITEM_REQUIREMENTS = obj.getBoolean("item_requirements");
|
||||||
|
if(obj.has("variable_xp_rate"))
|
||||||
|
GameConstants.VARIABLE_XP_RATE = obj.getBoolean("variable_xp_rate");
|
||||||
if(obj.has("xp_rate"))
|
if(obj.has("xp_rate"))
|
||||||
GameConstants.XP_RATE = obj.getDouble("xp_rate");
|
GameConstants.XP_RATE = obj.getDouble("xp_rate");
|
||||||
if(obj.has("max_players"))
|
if(obj.has("max_players"))
|
||||||
GameConstants.MAX_PLAYERS = obj.getInt("max_players");
|
GameConstants.MAX_PLAYERS = obj.getInt("max_players");
|
||||||
|
if (obj.has("variable_xp_rates")) {
|
||||||
|
JSONArray rates = obj.optJSONArray("variable_xp_rates");
|
||||||
|
for (int i = 0; i < rates.length(); ++i) {
|
||||||
|
GameConstants.VARIABLE_XP_RATES[i] = rates.optInt(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(obj.has("website_total_characters_integration"))
|
||||||
|
GameConstants.WEBSITE_TOTAL_CHARACTERS_INTEGRATION = obj.getBoolean("website_total_characters_integration");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void initialize() {
|
private static void initialize() {
|
||||||
@@ -71,7 +84,7 @@ public class ConfigLoader {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void loadSecrets() throws IOException {
|
public static void loadSecrets() throws IOException {
|
||||||
if (!new File("data/Secrets.json").exists()) {
|
if (!new File("data/secrets.json").exists()) {
|
||||||
initialize();
|
initialize();
|
||||||
System.out.println("Please open \"data/secrets.json\" file and enter your discord token bot there!");
|
System.out.println("Please open \"data/secrets.json\" file and enter your discord token bot there!");
|
||||||
System.out.println("Please open \"data/secrets.json\" file and enter your Website Password there!");
|
System.out.println("Please open \"data/secrets.json\" file and enter your Website Password there!");
|
||||||
@@ -88,7 +101,7 @@ public class ConfigLoader {
|
|||||||
JavaCord.token = obj.getString("bot-token");
|
JavaCord.token = obj.getString("bot-token");
|
||||||
if(obj.has("websitepass"))
|
if(obj.has("websitepass"))
|
||||||
PlayersOnlineWebsite.password = obj.getString("websitepass");
|
PlayersOnlineWebsite.password = obj.getString("websitepass");
|
||||||
RegisteredAccsWebsite.password = obj.getString("websitepass");
|
RegisteredAccsWebsite.password = obj.getString("websitepass");
|
||||||
if(obj.has("erssecret"))
|
if(obj.has("erssecret"))
|
||||||
GameEngine.ersSecret = obj.getString("erssecret");
|
GameEngine.ersSecret = obj.getString("erssecret");
|
||||||
|
|
||||||
|
|||||||
@@ -16,38 +16,35 @@ public class GameConstants {
|
|||||||
* FILE_SERVER Sets Whether The FileServer Should Run With The Server
|
* FILE_SERVER Sets Whether The FileServer Should Run With The Server
|
||||||
* SERVER_DEBUG Sets Whether The Server Should Start In Debug Mode
|
* SERVER_DEBUG Sets Whether The Server Should Start In Debug Mode
|
||||||
* MEMBERS_ONLY Sets Whether The World Is Members Only
|
* MEMBERS_ONLY Sets Whether The World Is Members Only
|
||||||
* TUTORIAL_ISLAND Sets Enables/Disables Tutorial Island For Players On First Login
|
* TUTORIAL_ISLAND Enables/Disables Tutorial Island For Players On First Login
|
||||||
* PARTY_ROOM_DISABLED Enables/Disables The Party Room Should Be Disabled
|
* PARTY_ROOM_DISABLED Enables/Disables The Party Room Should Be Disabled
|
||||||
* CLUES_ENABLED Enables/Disables Clue Scrolls
|
* CLUES_ENABLED Enables/Disables Clue Scrolls
|
||||||
* ITEM_REQUIREMENTS Enables/Disables Item Requirements for All Players
|
* ITEM_REQUIREMENTS Enables/Disables Item Requirements for All Players
|
||||||
* ADMIN_CAN_TRADE Defines Whether Admins Can Trade
|
* ADMIN_CAN_TRADE Defines Whether Admins Can Trade
|
||||||
* ADMIN_DROP_ITEMS Defines Whether Admins Can Drop Items
|
* ADMIN_DROP_ITEMS Defines Whether Admins Can Drop Items
|
||||||
* ADMIN_CAN_SELL_ITEMS Defines Whether Admins Can Sell Items
|
* ADMIN_CAN_SELL_ITEMS Defines Whether Admins Can Sell Items
|
||||||
* XP_RATE Sets The XP Rate Multiplier For All Players/Skills
|
* VARIABLE_XP_RATE Allows Players To Choose An XP Rate Set In VARIABLE_XP_RATES
|
||||||
|
* VARIABLE_XP_RATES Defines The XP Rates That Should Be Available To Players When VARIABLE_XP_RATES is true(Array Must Contain Four Entries)
|
||||||
|
* XP_RATE Sets The XP Rate Multiplier For All Players/Skills If VARIABLE_XP_RATES is false
|
||||||
*/
|
*/
|
||||||
public static String SERVER_NAME = "2006Scape", WEBSITE_LINK = "https://2006Scape.org";
|
public static String SERVER_NAME = "2006Scape", WEBSITE_LINK = "https://2006Scape.org";
|
||||||
public static int WORLD = 1, MAX_PLAYERS = 200, TIMEOUT = 60, SAVE_TIMER = 120,
|
public static int WORLD = 1, MAX_PLAYERS = 200, TIMEOUT = 60, SAVE_TIMER = 120,
|
||||||
RESPAWN_X = 3222, RESPAWN_Y = 3218;
|
RESPAWN_X = 3222, RESPAWN_Y = 3218;
|
||||||
public static boolean FILE_SERVER = true, SERVER_DEBUG = false, MEMBERS_ONLY = false, TUTORIAL_ISLAND = false,
|
public static boolean FILE_SERVER = true, SERVER_DEBUG = false, MEMBERS_ONLY = false, TUTORIAL_ISLAND = false,
|
||||||
PARTY_ROOM_DISABLED = false, CLUES_ENABLED = true, ITEM_REQUIREMENTS = true,
|
PARTY_ROOM_DISABLED = false, CLUES_ENABLED = true, ITEM_REQUIREMENTS = true,
|
||||||
ADMIN_CAN_TRADE = false, ADMIN_DROP_ITEMS = false, ADMIN_CAN_SELL_ITEMS = false;
|
ADMIN_CAN_TRADE = false, ADMIN_DROP_ITEMS = false, ADMIN_CAN_SELL_ITEMS = false, VARIABLE_XP_RATE = false,
|
||||||
public static double XP_RATE = 1;
|
WEBSITE_TOTAL_CHARACTERS_INTEGRATION = false;
|
||||||
|
public static int[] VARIABLE_XP_RATES = new int[] {1, 2, 5, 10};
|
||||||
|
public static double TEST_VERSION = 2.3, XP_RATE = 1.0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Variables Below Should Only Be Changed If You Understand What You Are Doing
|
* The Variables Below Should Only Be Changed If You Understand What You Are Doing
|
||||||
*/
|
*/
|
||||||
|
public final static int ITEM_LIMIT = 15000, MAXITEM_AMOUNT = Integer.MAX_VALUE,
|
||||||
|
IPS_ALLOWED = 250, CONNECTION_DELAY = 100;
|
||||||
|
|
||||||
public final static String SERVER_VERSION = "Server Stage v " + GameConstants.TEST_VERSION + ".";
|
public final static boolean sendServerPackets = false, SOUND = true, GUILDS = true;
|
||||||
public final static boolean WEBSITE_TOTAL_CHARACTERS_INTEGRATION = false;
|
|
||||||
public final static double TEST_VERSION = 2.3;
|
|
||||||
|
|
||||||
public final static int ITEM_LIMIT = 15000, MAXITEM_AMOUNT = Integer.MAX_VALUE, CLIENT_VERSION = 999999,
|
|
||||||
IPS_ALLOWED = 250, CONNECTION_DELAY = 100,
|
|
||||||
MESSAGE_DELAY = 6000, REQ_AMOUNT = 150;
|
|
||||||
|
|
||||||
public final static boolean sendServerPackets = false, SOUND = true, GUILDS = true,
|
|
||||||
PRINT_OBJECT_ID = false, EXPERIMENTS = false;
|
|
||||||
|
|
||||||
public static int[] SIDEBARS = { 2423, 3917, 638, 3213, 1644, 5608, 1151,
|
public static int[] SIDEBARS = { 2423, 3917, 638, 3213, 1644, 5608, 1151,
|
||||||
18128, 5065, 5715, 2449, 904, 147, 962 };
|
18128, 5065, 5715, 2449, 904, 147, 962 };
|
||||||
@@ -63,10 +60,6 @@ public class GameConstants {
|
|||||||
|
|
||||||
public final static int NO_TELEPORT_WILD_LEVEL = 20;
|
public final static int NO_TELEPORT_WILD_LEVEL = 20;
|
||||||
|
|
||||||
public final static int CASTLE_WARS_X = 2439;
|
|
||||||
|
|
||||||
public final static int CASTLE_WARS_Y = 3087;
|
|
||||||
|
|
||||||
public final static int NPC_RANDOM_WALK_DISTANCE = 5;
|
public final static int NPC_RANDOM_WALK_DISTANCE = 5;
|
||||||
|
|
||||||
public final static int NPC_FOLLOW_DISTANCE = 10;
|
public final static int NPC_FOLLOW_DISTANCE = 10;
|
||||||
|
|||||||
@@ -131,11 +131,7 @@ public class GameEngine {
|
|||||||
private final static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
private final static ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||||
private final static Lock lock = new ReentrantLock();
|
private final static Lock lock = new ReentrantLock();
|
||||||
|
|
||||||
/**
|
|
||||||
* Port and Cycle rate.
|
|
||||||
*/
|
|
||||||
static {
|
static {
|
||||||
serverlistenerPort = 43594;
|
|
||||||
shutdownServer = false;
|
shutdownServer = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -158,6 +154,7 @@ public class GameEngine {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
serverlistenerPort = (GameConstants.WORLD == 1) ? 43594 : 43596 + GameConstants.WORLD;
|
||||||
|
|
||||||
System.out.println("Starting game engine..");
|
System.out.println("Starting game engine..");
|
||||||
if (GameConstants.SERVER_DEBUG) {
|
if (GameConstants.SERVER_DEBUG) {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,14 @@
|
|||||||
|
package com.rs2.game.dialogues;
|
||||||
|
|
||||||
|
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The chain-able interface that allows implementing dialogue factories the ability to chain
|
||||||
|
* together.
|
||||||
|
*
|
||||||
|
* @author Vult-R
|
||||||
|
*/
|
||||||
|
public interface ChainablePlugin extends Consumer<DialogueFactoryPlugin> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,7 +4,12 @@ package com.rs2.game.dialogues;
|
|||||||
* ChatEmotes.java
|
* ChatEmotes.java
|
||||||
* @author Andrew (Mr Extremez)
|
* @author Andrew (Mr Extremez)
|
||||||
*/
|
*/
|
||||||
|
/**
|
||||||
|
* Contains a List of Chat Head Emotes NPCs and Players can use during Dialogues
|
||||||
|
* @Deprecated Consider using {@link ExpressionPlugin} instead to add Chat Head Animations to Dialogues.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public enum ChatEmotes {
|
public enum ChatEmotes {
|
||||||
|
|
||||||
HAPPY_JOYFUL(588),
|
HAPPY_JOYFUL(588),
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
package com.rs2.game.dialogues;
|
|
||||||
|
|
||||||
import com.rs2.game.players.Player;
|
|
||||||
import com.rs2.net.packets.PacketType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Dialogue
|
|
||||||
**/
|
|
||||||
|
|
||||||
public class Dialogue implements PacketType {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void processPacket(Player c, int packetType, int packetSize) {
|
|
||||||
if (c.nextChat > 0) {
|
|
||||||
c.getDialogueHandler().sendDialogues(c.nextChat, c.talkingNpc);
|
|
||||||
} else {
|
|
||||||
c.getDialogueHandler().sendDialogues(0, -1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,743 @@
|
|||||||
|
package com.rs2.game.dialogues;
|
||||||
|
|
||||||
|
import com.rs2.GameConstants;
|
||||||
|
import com.rs2.game.npcs.NpcHandler;
|
||||||
|
import com.rs2.game.players.Player;
|
||||||
|
import com.rs2.util.LoggerUtils;
|
||||||
|
import com.rs2.util.Misc;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a factory class that contains important functions for building dialogues.
|
||||||
|
*
|
||||||
|
* @author Vult-R <https://github.com/Vult-R>
|
||||||
|
*
|
||||||
|
* Ported by Qweqker
|
||||||
|
*/
|
||||||
|
public final class DialogueFactoryPlugin {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The single logger for this class.
|
||||||
|
*/
|
||||||
|
private static final Logger logger = LoggerUtils.getLogger(DialogueFactoryPlugin.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The queue of dialogues in this factory.
|
||||||
|
*/
|
||||||
|
private final Queue<ChainablePlugin> chain = new ArrayDeque<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The approximate maximum characters that can be fit onto a dialogue line in the interface
|
||||||
|
*
|
||||||
|
* Defined for use in the dialogue line splitting code
|
||||||
|
*/
|
||||||
|
private static final int MAXIMUM_CHARACTERS_PER_LINE = 52;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The maximum length for any dialogue
|
||||||
|
*
|
||||||
|
* Because each line can fit approximately 52 characters, we'll set the maximum
|
||||||
|
* to 260 characters to accommodate for five lines of dialogue. It can be adjusted later if needed.
|
||||||
|
*/
|
||||||
|
private static final int MAXIMUM_LENGTH = 260;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The player who owns this factory.
|
||||||
|
*/
|
||||||
|
private final Player player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The flag that denotes dialogue is active.
|
||||||
|
*/
|
||||||
|
private boolean active;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The next action in the dialogue chain.
|
||||||
|
*/
|
||||||
|
private Optional<Runnable> nextAction = Optional.empty();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@link DialogueFactoryPlugin}.
|
||||||
|
*
|
||||||
|
* @param player The player who owns this factory.
|
||||||
|
*/
|
||||||
|
public DialogueFactoryPlugin(Player player) {
|
||||||
|
this.player = player;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a player a dialogue.
|
||||||
|
*
|
||||||
|
* @param dialogue The dialogue to sent.
|
||||||
|
*/
|
||||||
|
public final DialogueFactoryPlugin sendDialogue(DialoguePlugin dialogue) {
|
||||||
|
|
||||||
|
clear(); // Clear dialogue queue before starting new one. Hacky, but it works for this base
|
||||||
|
|
||||||
|
player.setDialogue(Optional.of(dialogue));
|
||||||
|
dialogue.sendDialogues(this);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets an {@code action} so this action can be executed after dialogues are done.
|
||||||
|
*
|
||||||
|
* @param action The action to set.
|
||||||
|
*
|
||||||
|
* @return The instance of this factory.
|
||||||
|
*/
|
||||||
|
public final DialogueFactoryPlugin onAction(Runnable action) {
|
||||||
|
setNextAction(Optional.of(action));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Accepts the next dialogue in the chain.
|
||||||
|
*
|
||||||
|
* @return The instance of this factory.
|
||||||
|
*/
|
||||||
|
public DialogueFactoryPlugin onNext() {
|
||||||
|
if (getChain().peek() != null) {
|
||||||
|
ChainablePlugin chain = getChain().poll();
|
||||||
|
|
||||||
|
chain.accept(this);
|
||||||
|
} else {
|
||||||
|
player.getPacketSender().sendClearScreen();
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Executes an {@code option} for a {@code player}.
|
||||||
|
*
|
||||||
|
* @param type The type of option.
|
||||||
|
*
|
||||||
|
* @param option The option to execute.
|
||||||
|
*/
|
||||||
|
public final void executeOption(int type, Optional<OptionDialoguePlugin> option) {
|
||||||
|
option.ifPresent($it -> $it.getActions().get(type).run());
|
||||||
|
execute();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Clears the current dialogue {@code chain}.
|
||||||
|
*
|
||||||
|
* @return The instance of this factory.
|
||||||
|
*/
|
||||||
|
public void clear() {
|
||||||
|
chain.clear();
|
||||||
|
nextAction = Optional.empty();
|
||||||
|
player.setDialogue(Optional.empty());
|
||||||
|
player.setOptionDialogue(Optional.empty());
|
||||||
|
setActive(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends a {@code chain} to this factory.
|
||||||
|
*
|
||||||
|
* @return The instance of this factory.
|
||||||
|
*/
|
||||||
|
private final DialogueFactoryPlugin append(ChainablePlugin chain) {
|
||||||
|
this.chain.add(chain);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the next dialogue in the chain and executes it.
|
||||||
|
*
|
||||||
|
* @return The instance of this factory.
|
||||||
|
*/
|
||||||
|
public final DialogueFactoryPlugin execute() {
|
||||||
|
// check to see if there are anymore dialogues.
|
||||||
|
if (getChain().peek() != null) {
|
||||||
|
|
||||||
|
// there is so, grab the next dialogue.
|
||||||
|
ChainablePlugin entry = getChain().poll();
|
||||||
|
|
||||||
|
// is this an option dialogue?
|
||||||
|
if (entry instanceof OptionDialoguePlugin) {
|
||||||
|
OptionDialoguePlugin option = (OptionDialoguePlugin) entry;
|
||||||
|
player.setOptionDialogue(Optional.of(option));
|
||||||
|
}
|
||||||
|
setActive(true);
|
||||||
|
// whatever dialogue it is, accept it.
|
||||||
|
entry.accept(this);
|
||||||
|
} else {
|
||||||
|
// there are no dialogues in this chain.
|
||||||
|
|
||||||
|
// is there an action?
|
||||||
|
if (getNextAction().isPresent()) {
|
||||||
|
// there is so, execute it.
|
||||||
|
getNextAction().ifPresent($it -> $it.run());
|
||||||
|
// we just used this action so empty it so it can't be used again.
|
||||||
|
setNextAction(Optional.empty());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
setActive(false);
|
||||||
|
// there are no more dialogues, so clear the screen.
|
||||||
|
player.getPacketSender().sendClearScreen();
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves the next dialogue in the chain and executes it.
|
||||||
|
*
|
||||||
|
* @return The instance of this factory.
|
||||||
|
*/
|
||||||
|
public final DialogueFactoryPlugin executeNoClose() {
|
||||||
|
// check to see if there are anymore dialogues.
|
||||||
|
if (getChain().peek() != null) {
|
||||||
|
|
||||||
|
// there is so, grab the next dialogue.
|
||||||
|
ChainablePlugin entry = getChain().poll();
|
||||||
|
|
||||||
|
// is this an option dialogue?
|
||||||
|
if (entry instanceof OptionDialoguePlugin) {
|
||||||
|
OptionDialoguePlugin option = (OptionDialoguePlugin) entry;
|
||||||
|
player.setOptionDialogue(Optional.of(option));
|
||||||
|
}
|
||||||
|
setActive(true);
|
||||||
|
// whatever dialogue it is, accept it.
|
||||||
|
entry.accept(this);
|
||||||
|
} else {
|
||||||
|
// there are no dialogues in this chain.
|
||||||
|
|
||||||
|
// is there an action?
|
||||||
|
if (getNextAction().isPresent()) {
|
||||||
|
// there is so, execute it.
|
||||||
|
getNextAction().ifPresent($it -> $it.run());
|
||||||
|
// we just used this action so empty it so it can't be used again.
|
||||||
|
setNextAction(Optional.empty());
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
setActive(false);
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replaces keywords with their translated values in an existing dialogue text.
|
||||||
|
*
|
||||||
|
* @param line The line to check for a keyword.
|
||||||
|
*/
|
||||||
|
private final String appendKeywords(String line) {
|
||||||
|
|
||||||
|
// If the line contains #username, replace with a formatted player name.
|
||||||
|
if (line.contains("<username>")) {
|
||||||
|
line = line.replaceAll("<username>", Misc.formatPlayerName((player.playerName)));
|
||||||
|
}
|
||||||
|
if (line.contains("<servername>")) {
|
||||||
|
line = line.replaceAll("<servername>", GameConstants.SERVER_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
return line;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends a {@link PlayerDialoguePlugin} to the current dialogue chain.
|
||||||
|
*
|
||||||
|
* @param lines The dialogue of the player talking.
|
||||||
|
*
|
||||||
|
* @return The instance of this factory.
|
||||||
|
*/
|
||||||
|
public final DialogueFactoryPlugin sendPlayerChat(String... lines) {
|
||||||
|
return append(new PlayerDialoguePlugin(lines));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends a {@link PlayerDialoguePlugin} to the current dialogue chain.
|
||||||
|
*
|
||||||
|
* @param lines The dialogue of the player talking.
|
||||||
|
*
|
||||||
|
* @param expression The expression of this dialogue.
|
||||||
|
*
|
||||||
|
* @return The instance of this factory.
|
||||||
|
*/
|
||||||
|
public final DialogueFactoryPlugin sendPlayerChat(ExpressionPlugin expression, String... lines) {
|
||||||
|
return append(new PlayerDialoguePlugin(expression, lines));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a dialogue with a player talking.
|
||||||
|
*
|
||||||
|
* @param dialogue The player dialogue.
|
||||||
|
*
|
||||||
|
* @return The instance of this factory.
|
||||||
|
*/
|
||||||
|
final DialogueFactoryPlugin sendPlayerChat(PlayerDialoguePlugin dialogue) {
|
||||||
|
ExpressionPlugin expression = dialogue.getExpression();
|
||||||
|
String[] lines = dialogue.getLines();
|
||||||
|
|
||||||
|
validateLength(lines);
|
||||||
|
lines = splitLines(lines);
|
||||||
|
|
||||||
|
switch (lines.length) {
|
||||||
|
case 1:
|
||||||
|
player.getPacketSender().sendDialogueAnimation(969, expression.getId());
|
||||||
|
player.getPacketSender().sendString(Misc.formatPlayerName(player.playerName), 970);
|
||||||
|
player.getPacketSender().sendString(appendKeywords(lines[0]), 971);
|
||||||
|
player.getPacketSender().sendPlayerDialogueHead(969);
|
||||||
|
player.getPacketSender().sendChatInterface(968);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
player.getPacketSender().sendDialogueAnimation(974, expression.getId());
|
||||||
|
player.getPacketSender().sendString(Misc.formatPlayerName(player.playerName), 975);
|
||||||
|
player.getPacketSender().sendString(appendKeywords(lines[0]), 976);
|
||||||
|
player.getPacketSender().sendString(appendKeywords(lines[1]), 977);
|
||||||
|
player.getPacketSender().sendPlayerDialogueHead(974);
|
||||||
|
player.getPacketSender().sendChatInterface(973);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
player.getPacketSender().sendDialogueAnimation(980, expression.getId());
|
||||||
|
player.getPacketSender().sendString(Misc.formatPlayerName(player.playerName), 981);
|
||||||
|
player.getPacketSender().sendString(appendKeywords(lines[0]), 982);
|
||||||
|
player.getPacketSender().sendString(appendKeywords(lines[1]), 983);
|
||||||
|
player.getPacketSender().sendString(appendKeywords(lines[2]), 984);
|
||||||
|
player.getPacketSender().sendPlayerDialogueHead(980);
|
||||||
|
player.getPacketSender().sendChatInterface(979);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
player.getPacketSender().sendDialogueAnimation(987, expression.getId());
|
||||||
|
player.getPacketSender().sendString(Misc.formatPlayerName(player.playerName), 988);
|
||||||
|
player.getPacketSender().sendString(appendKeywords(lines[0]), 989);
|
||||||
|
player.getPacketSender().sendString(appendKeywords(lines[1]), 990);
|
||||||
|
player.getPacketSender().sendString(appendKeywords(lines[2]), 991);
|
||||||
|
player.getPacketSender().sendString(appendKeywords(lines[3]), 992);
|
||||||
|
player.getPacketSender().sendPlayerDialogueHead(987);
|
||||||
|
player.getPacketSender().sendChatInterface(986);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
logger.log(Level.SEVERE, String.format("Invalid player dialogue line length: %s", lines.length));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends an npc dialogue.
|
||||||
|
*
|
||||||
|
* @param lines The text of this dialogue.
|
||||||
|
*
|
||||||
|
* @return The instance of this factory.
|
||||||
|
*/
|
||||||
|
public final DialogueFactoryPlugin sendNPCChat(String... lines) {
|
||||||
|
return append(new NPCDialogue(lines));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends an {@link NPCDialogue} to the current dialogue chain.
|
||||||
|
*
|
||||||
|
* @param expression The expression of this npc.
|
||||||
|
*
|
||||||
|
* @param lines The text of this dialogue.
|
||||||
|
*
|
||||||
|
* @return The instance of this factory.
|
||||||
|
*/
|
||||||
|
public final DialogueFactoryPlugin sendNPCChat(ExpressionPlugin expression, String... lines) {
|
||||||
|
return append(new NPCDialogue(expression, lines));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends an {@link NPCDialogue} to the current dialogue chain.
|
||||||
|
*
|
||||||
|
* @param id The id of this npc.
|
||||||
|
*
|
||||||
|
* @param lines The text of this dialogue.
|
||||||
|
*
|
||||||
|
* @return The instance of this factory.
|
||||||
|
*/
|
||||||
|
public final DialogueFactoryPlugin sendNPCChat(int id, String... lines) {
|
||||||
|
return append(new NPCDialogue(id, ExpressionPlugin.DEFAULT, lines));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends an {@link NPCDialogue} to the current dialogue chain.
|
||||||
|
*
|
||||||
|
* @param id The id of this npc.
|
||||||
|
*
|
||||||
|
* @param expression The expression of this npc.
|
||||||
|
*
|
||||||
|
* @param lines The text of this dialogue.
|
||||||
|
*
|
||||||
|
* @return The instance of this factory.
|
||||||
|
*/
|
||||||
|
public final DialogueFactoryPlugin sendNPCChat(int id, ExpressionPlugin expression, String... lines) {
|
||||||
|
return append(new NPCDialogue(id, expression, lines));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a dialogue with a npc talking.
|
||||||
|
*
|
||||||
|
* @param dialogue The dialogue.
|
||||||
|
*
|
||||||
|
* @return The instance of this factory.
|
||||||
|
*/
|
||||||
|
final DialogueFactoryPlugin sendNPCChat(NPCDialogue dialogue) {
|
||||||
|
ExpressionPlugin expression = dialogue.getExpression();
|
||||||
|
String[] lines = dialogue.getLines();
|
||||||
|
validateLength(lines);
|
||||||
|
lines = splitLines(lines);
|
||||||
|
|
||||||
|
final String npcName = NpcHandler.getNpcListName(player.npcType).replaceAll("_", " ");
|
||||||
|
|
||||||
|
if (npcName == null) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (lines.length) {
|
||||||
|
case 1:
|
||||||
|
player.getPacketSender().sendDialogueAnimation(4883, expression.getId());
|
||||||
|
player.getPacketSender().sendString(npcName, 4884);
|
||||||
|
player.getPacketSender().sendString(appendKeywords(lines[0]), 4885);
|
||||||
|
player.getPacketSender().sendNPCDialogueHead(player.npcType, 4883);
|
||||||
|
player.getPacketSender().sendChatInterface(4882);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
player.getPacketSender().sendDialogueAnimation(4888, expression.getId());
|
||||||
|
player.getPacketSender().sendString(npcName, 4889);
|
||||||
|
player.getPacketSender().sendString(appendKeywords(lines[0]), 4890);
|
||||||
|
player.getPacketSender().sendString(appendKeywords(lines[1]), 4891);
|
||||||
|
player.getPacketSender().sendNPCDialogueHead(player.npcType, 4888);
|
||||||
|
player.getPacketSender().sendChatInterface(4887);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
player.getPacketSender().sendDialogueAnimation(4894, expression.getId());
|
||||||
|
player.getPacketSender().sendString(npcName, 4895);
|
||||||
|
player.getPacketSender().sendString(appendKeywords(lines[0]), 4896);
|
||||||
|
player.getPacketSender().sendString(appendKeywords(lines[1]), 4897);
|
||||||
|
player.getPacketSender().sendString(appendKeywords(lines[2]), 4898);
|
||||||
|
player.getPacketSender().sendNPCDialogueHead(player.npcType, 4894);
|
||||||
|
player.getPacketSender().sendChatInterface(4893);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
player.getPacketSender().sendDialogueAnimation(4901, expression.getId());
|
||||||
|
player.getPacketSender().sendString(npcName, 4902);
|
||||||
|
player.getPacketSender().sendString(appendKeywords(lines[0]), 4903);
|
||||||
|
player.getPacketSender().sendString(appendKeywords(lines[1]), 4904);
|
||||||
|
player.getPacketSender().sendString(appendKeywords(lines[2]), 4905);
|
||||||
|
player.getPacketSender().sendString(appendKeywords(lines[3]), 4906);
|
||||||
|
player.getPacketSender().sendNPCDialogueHead(player.npcType, 4901);
|
||||||
|
player.getPacketSender().sendChatInterface(4900);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
logger.log(Level.SEVERE,
|
||||||
|
String.format("Invalid npc dialogue line length: %s", lines.length));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends the {@link OptionDialoguePlugin} onto the current dialogue chain.
|
||||||
|
*
|
||||||
|
* @param option1 The text for the first option.
|
||||||
|
*
|
||||||
|
* @param action1 The action for the first action.
|
||||||
|
*
|
||||||
|
* @param option2 The text for the second option.
|
||||||
|
*
|
||||||
|
* @param action2 The action for the second action.
|
||||||
|
*/
|
||||||
|
public final DialogueFactoryPlugin sendOption(String option1, Runnable action1, String option2,
|
||||||
|
Runnable action2) {
|
||||||
|
return append(new OptionDialoguePlugin(option1, action1, option2, action2));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends the {@link OptionDialoguePlugin} onto the current dialogue chain.
|
||||||
|
*
|
||||||
|
* @param option1 The text for the first option.
|
||||||
|
*
|
||||||
|
* @param action1 The action for the first action.
|
||||||
|
*
|
||||||
|
* @param option2 The text for the second option.
|
||||||
|
*
|
||||||
|
* @param action2 The action for the second action.
|
||||||
|
*
|
||||||
|
* @param option3 The text for the third option.
|
||||||
|
*
|
||||||
|
* @param action3 The action for the third action.
|
||||||
|
*/
|
||||||
|
public final DialogueFactoryPlugin sendOption(String option1, Runnable action1, String option2,
|
||||||
|
Runnable action2, String option3, Runnable action3) {
|
||||||
|
return append(new OptionDialoguePlugin(option1, action1, option2, action2, option3, action3));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends the {@link OptionDialoguePlugin} onto the current dialogue chain.
|
||||||
|
*
|
||||||
|
* @param option1 The text for the first option.
|
||||||
|
*
|
||||||
|
* @param action1 The action for the first action.
|
||||||
|
*
|
||||||
|
* @param option2 The text for the second option.
|
||||||
|
*
|
||||||
|
* @param action2 The action for the second action.
|
||||||
|
*
|
||||||
|
* @param option3 The text for the third option.
|
||||||
|
*
|
||||||
|
* @param action3 The action for the third action.
|
||||||
|
*
|
||||||
|
* @param option4 The text for the four option.
|
||||||
|
*
|
||||||
|
* @param action4 The action for the four action.
|
||||||
|
*/
|
||||||
|
public final DialogueFactoryPlugin sendOption(String option1, Runnable action1, String option2,
|
||||||
|
Runnable action2, String option3, Runnable action3, String option4, Runnable action4) {
|
||||||
|
return append(
|
||||||
|
new OptionDialoguePlugin(option1, action1, option2, action2, option3, action3, option4, action4));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends the {@link OptionDialoguePlugin} onto the current dialogue chain.
|
||||||
|
*
|
||||||
|
* @param option1 The text for the first option.
|
||||||
|
*
|
||||||
|
* @param action1 The action for the first action.
|
||||||
|
*
|
||||||
|
* @param option2 The text for the second option.
|
||||||
|
*
|
||||||
|
* @param action2 The action for the second action.
|
||||||
|
*
|
||||||
|
* @param option3 The text for the third option.
|
||||||
|
*
|
||||||
|
* @param action3 The action for the third action.
|
||||||
|
*
|
||||||
|
* @param option4 The text for the four option.
|
||||||
|
*
|
||||||
|
* @param action4 The action for the four action.
|
||||||
|
*
|
||||||
|
* @param option5 The text for the fifth option.
|
||||||
|
*
|
||||||
|
* @param action5 The action for the fifth action.
|
||||||
|
*/
|
||||||
|
public final DialogueFactoryPlugin sendOption(String option1, Runnable action1, String option2,
|
||||||
|
Runnable action2, String option3, Runnable action3, String option4, Runnable action4,
|
||||||
|
String option5, Runnable action5) {
|
||||||
|
return append(new OptionDialoguePlugin(option1, action1, option2, action2, option3, action3, option4,
|
||||||
|
action4, option5, action5));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a dialogue with options.
|
||||||
|
*
|
||||||
|
* @param dialogue The dialogue.
|
||||||
|
*
|
||||||
|
* @return The instance of this factory.
|
||||||
|
*/
|
||||||
|
final DialogueFactoryPlugin sendOption(OptionDialoguePlugin dialogue) {
|
||||||
|
String[] options = dialogue.getLines();
|
||||||
|
validateLength(options);
|
||||||
|
|
||||||
|
switch (options.length) {
|
||||||
|
case 2:
|
||||||
|
player.getPacketSender().sendString("Select an Option", 2460);
|
||||||
|
player.getPacketSender().sendString(options[0], 2461);
|
||||||
|
player.getPacketSender().sendString(options[1], 2462);
|
||||||
|
player.getPacketSender().sendChatInterface(2459);
|
||||||
|
return this;
|
||||||
|
|
||||||
|
case 3:
|
||||||
|
player.getPacketSender().sendString("Select an Option", 2470);
|
||||||
|
player.getPacketSender().sendString(options[0], 2471);
|
||||||
|
player.getPacketSender().sendString(options[1], 2472);
|
||||||
|
player.getPacketSender().sendString(options[2], 2473);
|
||||||
|
player.getPacketSender().sendChatInterface(2469);
|
||||||
|
return this;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
player.getPacketSender().sendString("Select an Option", 2481);
|
||||||
|
player.getPacketSender().sendString(options[0], 2482);
|
||||||
|
player.getPacketSender().sendString(options[1], 2483);
|
||||||
|
player.getPacketSender().sendString(options[2], 2484);
|
||||||
|
player.getPacketSender().sendString(options[3], 2485);
|
||||||
|
player.getPacketSender().sendChatInterface(2480);
|
||||||
|
return this;
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
player.getPacketSender().sendString("Select an Option", 2493);
|
||||||
|
player.getPacketSender().sendString(options[0], 2494);
|
||||||
|
player.getPacketSender().sendString(options[1], 2495);
|
||||||
|
player.getPacketSender().sendString(options[2], 2496);
|
||||||
|
player.getPacketSender().sendString(options[3], 2497);
|
||||||
|
player.getPacketSender().sendString(options[4], 2498);
|
||||||
|
player.getPacketSender().sendChatInterface(2492);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Appends a {@link StatementDialoguePlugin} to the current dialogue chain.
|
||||||
|
*
|
||||||
|
* @param lines The text for this statement.
|
||||||
|
*
|
||||||
|
* @return The instance of this factory.
|
||||||
|
*/
|
||||||
|
public final DialogueFactoryPlugin sendStatement(String... lines) {
|
||||||
|
append(new StatementDialoguePlugin(lines));
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a player a statement dialogue.
|
||||||
|
*
|
||||||
|
* @param dialogue The statement dialogue.
|
||||||
|
*/
|
||||||
|
final DialogueFactoryPlugin sendStatement(StatementDialoguePlugin dialogue) {
|
||||||
|
String[] lines = dialogue.getLines();
|
||||||
|
validateLength(lines);
|
||||||
|
lines = splitLines(lines);
|
||||||
|
|
||||||
|
switch (lines.length) {
|
||||||
|
|
||||||
|
case 1:
|
||||||
|
player.getPacketSender().sendString(dialogue.getLines()[0], 357);
|
||||||
|
player.getPacketSender().sendString("Click here to continue", 358);
|
||||||
|
player.getPacketSender().sendChatInterface(356);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
player.getPacketSender().sendString(dialogue.getLines()[0], 360);
|
||||||
|
player.getPacketSender().sendString(dialogue.getLines()[1], 361);
|
||||||
|
player.getPacketSender().sendString("Click here to continue", 362);
|
||||||
|
player.getPacketSender().sendChatInterface(359);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
player.getPacketSender().sendString(dialogue.getLines()[0], 364);
|
||||||
|
player.getPacketSender().sendString(dialogue.getLines()[1], 365);
|
||||||
|
player.getPacketSender().sendString(dialogue.getLines()[2], 366);
|
||||||
|
player.getPacketSender().sendString("Click here to continue", 367);
|
||||||
|
player.getPacketSender().sendChatInterface(363);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
player.getPacketSender().sendString(dialogue.getLines()[0], 369);
|
||||||
|
player.getPacketSender().sendString(dialogue.getLines()[1], 370);
|
||||||
|
player.getPacketSender().sendString(dialogue.getLines()[2], 371);
|
||||||
|
player.getPacketSender().sendString(dialogue.getLines()[3], 372);
|
||||||
|
player.getPacketSender().sendString("Click here to continue", 373);
|
||||||
|
player.getPacketSender().sendChatInterface(368);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
player.getPacketSender().sendString(dialogue.getLines()[0], 375);
|
||||||
|
player.getPacketSender().sendString(dialogue.getLines()[1], 376);
|
||||||
|
player.getPacketSender().sendString(dialogue.getLines()[2], 377);
|
||||||
|
player.getPacketSender().sendString(dialogue.getLines()[3], 378);
|
||||||
|
player.getPacketSender().sendString(dialogue.getLines()[4], 379);
|
||||||
|
player.getPacketSender().sendString("Click here to continue", 380);
|
||||||
|
player.getPacketSender().sendChatInterface(374);
|
||||||
|
default:
|
||||||
|
logger.log(Level.SEVERE, String.format("Invalid statement dialogue line length: %s",
|
||||||
|
dialogue.getLines().length));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The method that validates the length of {@code text}.
|
||||||
|
*
|
||||||
|
* @param text the text that will be validated.
|
||||||
|
* @throws IllegalStateException if any lines of the text exceed a certain length.
|
||||||
|
*/
|
||||||
|
private final void validateLength(String... text) {
|
||||||
|
if (Arrays.stream(text).filter(Objects::nonNull).anyMatch(s -> s.length() > MAXIMUM_LENGTH)) {
|
||||||
|
throw new IllegalStateException(
|
||||||
|
"Dialogue length too long, maximum length is: " + MAXIMUM_LENGTH);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The method that splits the length of {@code text}.
|
||||||
|
*
|
||||||
|
* @param text the text that will be split.
|
||||||
|
* @throws IllegalStateException if the calculated number of lines exceeds 4.
|
||||||
|
* @return text if the line is detected to already be split.
|
||||||
|
* @return splittext the text formatted into lines that fit into the dialogue interface
|
||||||
|
*/
|
||||||
|
private final String[] splitLines(String... text) {
|
||||||
|
|
||||||
|
if(text.length > 1){
|
||||||
|
if(GameConstants.SERVER_DEBUG) {
|
||||||
|
logger.log(Level.INFO, "Detected more than 1 Dialogue line. Assuming Dialogues have been split already.");
|
||||||
|
}
|
||||||
|
return text;
|
||||||
|
}
|
||||||
|
int characters = text[0].length();
|
||||||
|
String[] words = text[0].split(" ");
|
||||||
|
double lines = Math.ceil(characters / MAXIMUM_CHARACTERS_PER_LINE) + 1;
|
||||||
|
|
||||||
|
if(lines > 4){
|
||||||
|
throw new IllegalStateException(
|
||||||
|
"Calculated Line Split Exceeds 4 Lines.");
|
||||||
|
}
|
||||||
|
|
||||||
|
ArrayList<String> splitText = new ArrayList<>();
|
||||||
|
int index = 0;
|
||||||
|
|
||||||
|
// Begin Splitting Lines
|
||||||
|
for(int i = 0; i < lines; i++) {
|
||||||
|
int length = 0;
|
||||||
|
StringBuilder line = new StringBuilder();
|
||||||
|
while (length <= MAXIMUM_CHARACTERS_PER_LINE && !(index == words.length)) {
|
||||||
|
String currentWord = "";
|
||||||
|
try {
|
||||||
|
currentWord = words[index];
|
||||||
|
if (length + (currentWord.length() + 1) <= MAXIMUM_CHARACTERS_PER_LINE) {
|
||||||
|
currentWord += " ";
|
||||||
|
} else {
|
||||||
|
currentWord += "";
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
logger.log(Level.INFO, e.toString());
|
||||||
|
}
|
||||||
|
length += currentWord.length();
|
||||||
|
if (length <= MAXIMUM_CHARACTERS_PER_LINE) {
|
||||||
|
line.append(currentWord);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
splitText.add(line.toString());
|
||||||
|
}
|
||||||
|
return splitText.toArray(new String[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delombok'd Code Below
|
||||||
|
public Queue<ChainablePlugin> getChain() {
|
||||||
|
return this.chain;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player getPlayer() {
|
||||||
|
return this.player;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isActive() {
|
||||||
|
return this.active;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<Runnable> getNextAction() {
|
||||||
|
return this.nextAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setActive(boolean active) {
|
||||||
|
this.active = active;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setNextAction(Optional<Runnable> nextAction) {
|
||||||
|
this.nextAction = nextAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -8,7 +8,6 @@ import com.rs2.game.content.quests.QuestAssistant;
|
|||||||
import com.rs2.game.content.quests.QuestRewards;
|
import com.rs2.game.content.quests.QuestRewards;
|
||||||
import com.rs2.game.content.randomevents.FreakyForester;
|
import com.rs2.game.content.randomevents.FreakyForester;
|
||||||
import com.rs2.game.content.randomevents.RandomEventHandler;
|
import com.rs2.game.content.randomevents.RandomEventHandler;
|
||||||
import com.rs2.game.content.skills.SkillHandler;
|
|
||||||
import com.rs2.game.content.skills.farming.Farmers;
|
import com.rs2.game.content.skills.farming.Farmers;
|
||||||
import com.rs2.game.content.skills.slayer.Slayer;
|
import com.rs2.game.content.skills.slayer.Slayer;
|
||||||
import com.rs2.game.content.traveling.CarpetTravel;
|
import com.rs2.game.content.traveling.CarpetTravel;
|
||||||
@@ -22,6 +21,12 @@ import com.rs2.game.players.PlayerAssistant;
|
|||||||
import com.rs2.game.shops.Shops.Shop;
|
import com.rs2.game.shops.Shops.Shop;
|
||||||
import com.rs2.util.Misc;
|
import com.rs2.util.Misc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handles Dialogues between NPCs and Players
|
||||||
|
* @Deprecated Consider using {@link DialogueFactoryPlugin} instead to implement dialogues.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public class DialogueHandler {
|
public class DialogueHandler {
|
||||||
|
|
||||||
private final Player player;
|
private final Player player;
|
||||||
@@ -312,140 +317,6 @@ public class DialogueHandler {
|
|||||||
player.nextChat = 0;
|
player.nextChat = 0;
|
||||||
player.ptjob = 2;
|
player.ptjob = 2;
|
||||||
break;
|
break;
|
||||||
case 50:
|
|
||||||
sendNpcChat1("What am I to do?", player.talkingNpc, "Cook");
|
|
||||||
player.nextChat = 51;
|
|
||||||
break;
|
|
||||||
case 51:
|
|
||||||
sendOption("What's wrong?", "Can you cook me a cake?",
|
|
||||||
"You don't look very happy.", "Nice hat.");
|
|
||||||
player.dialogueAction = 52;
|
|
||||||
break;
|
|
||||||
case 52:
|
|
||||||
sendPlayerChat("What's wrong?");
|
|
||||||
player.nextChat = 54;
|
|
||||||
break;
|
|
||||||
case 54:
|
|
||||||
sendNpcChat3(
|
|
||||||
"Oh dear, oh dear, oh dear, I'm in a terrible terrible",
|
|
||||||
"mess! It's the Duke's birthday today, and I should be",
|
|
||||||
"making him a lovely big birthday cake!",
|
|
||||||
player.talkingNpc, "Cook");
|
|
||||||
player.nextChat = 55;
|
|
||||||
break;
|
|
||||||
case 55:
|
|
||||||
sendNpcChat4(
|
|
||||||
"I've forgotten to buy the ingredients. I'll never get",
|
|
||||||
"them in time now. He'll sack me! What will I do? I have",
|
|
||||||
"four children and a goat to look after. Would you help",
|
|
||||||
"me? Please?", player.talkingNpc, "Cook");
|
|
||||||
player.nextChat = 56;
|
|
||||||
break;
|
|
||||||
case 56:
|
|
||||||
sendOption("I'm always happy to help a cook in distress.",
|
|
||||||
"I can't right now, Maybe later.");
|
|
||||||
player.dialogueAction = 57;
|
|
||||||
break;
|
|
||||||
case 57:
|
|
||||||
sendPlayerChat("Yes, I'll help you.");// 9157
|
|
||||||
player.nextChat = 60;
|
|
||||||
break;
|
|
||||||
case 58:
|
|
||||||
sendPlayerChat("I can't right now, Maybe later.");// 9158
|
|
||||||
player.nextChat = 59;
|
|
||||||
break;
|
|
||||||
case 59:
|
|
||||||
sendNpcChat1("Oh please! Hurry then!", player.talkingNpc, "Cook");
|
|
||||||
player.nextChat = 0;
|
|
||||||
break;
|
|
||||||
case 60:
|
|
||||||
sendNpcChat2("Oh thank you, thank you. I need milk, an egg, and",
|
|
||||||
"flour. I'd be very grateful if you can get them for me.",
|
|
||||||
player.talkingNpc, "Cook");
|
|
||||||
player.cookAss = 1;
|
|
||||||
QuestAssistant.sendStages(player);
|
|
||||||
player.nextChat = 61;
|
|
||||||
break;
|
|
||||||
case 61:
|
|
||||||
sendPlayerChat("So where do I find these ingredients then?");
|
|
||||||
player.nextChat = 62;
|
|
||||||
break;
|
|
||||||
case 62:
|
|
||||||
sendNpcChat3("You can find flour in any of the shops here.",
|
|
||||||
"You can find eggs by killing chickens.",
|
|
||||||
"You can find milk by using a bucket on a cow",
|
|
||||||
player.talkingNpc, "Cook");
|
|
||||||
player.nextChat = 0;
|
|
||||||
break;
|
|
||||||
case 63:
|
|
||||||
sendNpcChat1("I don't have time for your jibber-jabber!",
|
|
||||||
player.talkingNpc, "Cook");
|
|
||||||
player.nextChat = 0;
|
|
||||||
break;
|
|
||||||
case 64:
|
|
||||||
sendNpcChat1("Does it look like I have the time?",
|
|
||||||
player.talkingNpc, "Cook");
|
|
||||||
player.nextChat = 0;
|
|
||||||
break;
|
|
||||||
case 65:
|
|
||||||
sendPlayerChat("You don't look so happy.");
|
|
||||||
player.nextChat = 54;
|
|
||||||
break;
|
|
||||||
case 66:
|
|
||||||
sendNpcChat1(
|
|
||||||
"How are you getting on with finding the ingredients?",
|
|
||||||
player.talkingNpc, "Cook");
|
|
||||||
player.nextChat = 67;
|
|
||||||
break;
|
|
||||||
case 67:
|
|
||||||
if (player.getItemAssistant().playerHasItem(1944, 1)
|
|
||||||
&& player.getItemAssistant().playerHasItem(1927, 1)
|
|
||||||
&& player.getItemAssistant().playerHasItem(1933, 1)) {
|
|
||||||
sendPlayerChat("Here's all the items!");
|
|
||||||
player.nextChat = 68;
|
|
||||||
} else {
|
|
||||||
sendPlayerChat("I don't have all the items yet.");
|
|
||||||
player.nextChat = 59;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 68:
|
|
||||||
player.getItemAssistant().deleteItem(1944, 1);
|
|
||||||
player.getItemAssistant().deleteItem(1927, 1);
|
|
||||||
player.getItemAssistant().deleteItem(1933, 1);
|
|
||||||
player.cookAss = 2;
|
|
||||||
sendNpcChat2("You brought me everything I need! I'm saved!",
|
|
||||||
"Thank you!", player.talkingNpc, "Cook");
|
|
||||||
player.nextChat = 69;
|
|
||||||
break;
|
|
||||||
case 69:
|
|
||||||
sendPlayerChat("So do I get to go to the Duke's Party?");
|
|
||||||
player.nextChat = 70;
|
|
||||||
break;
|
|
||||||
case 70:
|
|
||||||
sendNpcChat2(
|
|
||||||
"I'm afraid not, only the big cheeses get to dine with the",
|
|
||||||
"Duke.", player.talkingNpc, "Cook");
|
|
||||||
player.nextChat = 72;
|
|
||||||
break;
|
|
||||||
case 72:
|
|
||||||
sendPlayerChat(
|
|
||||||
"Well, maybe one day I'll be important enough to sit on",
|
|
||||||
"the Duke's table");
|
|
||||||
player.nextChat = 74;
|
|
||||||
break;
|
|
||||||
case 74:
|
|
||||||
sendNpcChat1("Maybe, but I won't be holding my breath.",
|
|
||||||
player.talkingNpc, "Cook");
|
|
||||||
player.nextChat = 75;
|
|
||||||
break;
|
|
||||||
case 75:
|
|
||||||
QuestRewards.cookReward(player);
|
|
||||||
break;
|
|
||||||
case 76:
|
|
||||||
sendNpcChat1("Thanks for helping me out friend!",
|
|
||||||
player.talkingNpc, "Cook");
|
|
||||||
player.nextChat = 0;
|
|
||||||
break;
|
|
||||||
case 84:
|
case 84:
|
||||||
sendNpcChat1("How are you getting on finding all my supplies",
|
sendNpcChat1("How are you getting on finding all my supplies",
|
||||||
player.talkingNpc, "Doric");
|
player.talkingNpc, "Doric");
|
||||||
@@ -3942,32 +3813,9 @@ public class DialogueHandler {
|
|||||||
"Tzhaar-Mej-Tal");
|
"Tzhaar-Mej-Tal");
|
||||||
player.nextChat = 0;
|
player.nextChat = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/** Bank Settings **/
|
|
||||||
case 1013:
|
|
||||||
if (SkillHandler.isSkilling(player)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sendNpcChat1("Good day. How may I help you?", player.talkingNpc, "Banker");
|
|
||||||
player.nextChat = 1014;
|
|
||||||
break;
|
|
||||||
case 1014:// bank open done, this place done, settings done, to do
|
|
||||||
// delete pin
|
|
||||||
sendOption("I'd like to access my bank account, please.", "I'd like to check my my P I N settings.", "What is this place?");
|
|
||||||
player.dialogueAction = 251;
|
|
||||||
break;
|
|
||||||
/** What is this place? **/
|
|
||||||
case 1015:
|
|
||||||
sendPlayerChat("What is this place?");
|
|
||||||
player.nextChat = 1016;
|
|
||||||
break;
|
|
||||||
case 1016:
|
|
||||||
sendNpcChat2("This is the bank of " + GameConstants.SERVER_NAME + ".", "We have many branches in many towns.", player.talkingNpc, "Banker");
|
|
||||||
player.nextChat = 0;
|
|
||||||
break;
|
|
||||||
/**
|
/**
|
||||||
* Note on P I N. In order to check your "Pin Settings. You must have
|
* BANK P I N Setting
|
||||||
* enter your Bank Pin first
|
* Note on P I N. In order to check your P I N Settings. You must enter your Bank Pin first
|
||||||
**/
|
**/
|
||||||
/** I don't know option for Bank Pin **/
|
/** I don't know option for Bank Pin **/
|
||||||
case 1017:
|
case 1017:
|
||||||
@@ -6137,10 +5985,14 @@ public class DialogueHandler {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 3116:
|
case 3116:
|
||||||
player.getPacketSender().showInterface(3559);
|
if(GameConstants.VARIABLE_XP_RATE) {
|
||||||
player.canChangeAppearance = true;
|
player.getDialogueHandler().sendDialogues(10001, -1);
|
||||||
player.closeTutorialInterface = true;
|
} else {
|
||||||
player.nextChat = 0;
|
player.getPacketSender().showInterface(3559);
|
||||||
|
player.canChangeAppearance = true;
|
||||||
|
player.closeTutorialInterface = true;
|
||||||
|
player.nextChat = 0;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3117:
|
case 3117:
|
||||||
@@ -7469,27 +7321,7 @@ public class DialogueHandler {
|
|||||||
player.getDialogueHandler().sendNpcChat(player.talkingNpc, ChatEmotes.HAPPY_JOYFUL, "Enjoy your stay here. May it be spiritually uplifting!");
|
player.getDialogueHandler().sendNpcChat(player.talkingNpc, ChatEmotes.HAPPY_JOYFUL, "Enjoy your stay here. May it be spiritually uplifting!");
|
||||||
player.getDialogueHandler().endDialogue();
|
player.getDialogueHandler().endDialogue();
|
||||||
break;
|
break;
|
||||||
case 3869:
|
//holiday events (easter)
|
||||||
player.getDialogueHandler().sendPlayerChat(ChatEmotes.DEFAULT, "Hello, how's it going?");
|
|
||||||
player.nextChat = 3870;
|
|
||||||
break;
|
|
||||||
case 3870:
|
|
||||||
player.getDialogueHandler().sendNpcChat(player.talkingNpc, ChatEmotes.HAPPY_JOYFUL, "I'm fine how are you?");
|
|
||||||
player.nextChat = 3871;
|
|
||||||
break;
|
|
||||||
case 3871:
|
|
||||||
player.getDialogueHandler().sendPlayerChat(ChatEmotes.DEFAULT, "Very well thank you.");
|
|
||||||
player.getDialogueHandler().endDialogue();
|
|
||||||
break;
|
|
||||||
case 3872:
|
|
||||||
player.getDialogueHandler().sendPlayerChat(ChatEmotes.DEFAULT, "Hello, how's it going?");
|
|
||||||
player.nextChat = 3873;
|
|
||||||
break;
|
|
||||||
case 3873:
|
|
||||||
player.getDialogueHandler().sendNpcChat(player.talkingNpc, ChatEmotes.HAPPY_JOYFUL, "Hello there! Nice weather we've been having.");
|
|
||||||
player.getDialogueHandler().endDialogue();
|
|
||||||
break;
|
|
||||||
//holiday events (easter)
|
|
||||||
case 6000:
|
case 6000:
|
||||||
player.getDialogueHandler().sendNpcChat(player.talkingNpc, ChatEmotes.DISTRESSED, "Oh dear... What am I going to do?");
|
player.getDialogueHandler().sendNpcChat(player.talkingNpc, ChatEmotes.DISTRESSED, "Oh dear... What am I going to do?");
|
||||||
player.nextChat = 6001;
|
player.nextChat = 6001;
|
||||||
@@ -7594,6 +7426,34 @@ public class DialogueHandler {
|
|||||||
);
|
);
|
||||||
player.dialogueAction = 10000;
|
player.dialogueAction = 10000;
|
||||||
break;
|
break;
|
||||||
|
case 10001:
|
||||||
|
sendNpcChat(2244, ChatEmotes.HAPPY_JOYFUL, "Please select the XP rate you'd like.", "this can be increased, but not decreased later on.");
|
||||||
|
player.nextChat = 10002;
|
||||||
|
break;
|
||||||
|
case 10002:
|
||||||
|
sendOption("x" + GameConstants.VARIABLE_XP_RATES[0], "x" + GameConstants.VARIABLE_XP_RATES[1], "x" + GameConstants.VARIABLE_XP_RATES[2], "x" + GameConstants.VARIABLE_XP_RATES[3]);
|
||||||
|
player.dialogueAction = 10002;
|
||||||
|
break;
|
||||||
|
case 10003:
|
||||||
|
sendNpcChat(2244, ChatEmotes.HAPPY_JOYFUL, "Are you sure x" + player.getXPRate() + " is the XP rate you'd like?");
|
||||||
|
player.nextChat = 10004;
|
||||||
|
break;
|
||||||
|
case 10004:
|
||||||
|
sendOption("Yes", "No");
|
||||||
|
player.dialogueAction = 10004;
|
||||||
|
break;
|
||||||
|
case 10005:
|
||||||
|
sendOption("x" + GameConstants.VARIABLE_XP_RATES[1], "x" + GameConstants.VARIABLE_XP_RATES[2], "x" + GameConstants.VARIABLE_XP_RATES[3]);
|
||||||
|
player.dialogueAction = 10005;
|
||||||
|
break;
|
||||||
|
case 10006:
|
||||||
|
sendOption("x" + GameConstants.VARIABLE_XP_RATES[2], "x" + GameConstants.VARIABLE_XP_RATES[3]);
|
||||||
|
player.dialogueAction = 10006;
|
||||||
|
break;
|
||||||
|
case 10007:
|
||||||
|
sendOption("x" + GameConstants.VARIABLE_XP_RATES[3], "Don't Change");
|
||||||
|
player.dialogueAction = 10007;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void chatboxText(String text, String text1, String text2,
|
public void chatboxText(String text, String text1, String text2,
|
||||||
|
|||||||
@@ -104,6 +104,12 @@ public class DialogueOptions {
|
|||||||
player.getDialogueHandler().sendStatement("You summoned your shop!");
|
player.getDialogueHandler().sendStatement("You summoned your shop!");
|
||||||
BotHandler.playerShop(player);
|
BotHandler.playerShop(player);
|
||||||
return;
|
return;
|
||||||
|
case 10005:
|
||||||
|
player.setXPRate(GameConstants.VARIABLE_XP_RATES[1]);
|
||||||
|
player.getPacketSender().sendMessage("Your XP rate is now set to x" + player.getXPRate() + " you can increase your rate in the future by using");
|
||||||
|
player.getPacketSender().sendMessage("::xprate");
|
||||||
|
player.getPacketSender().closeAllWindows();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
player.dialogueAction = 0;
|
player.dialogueAction = 0;
|
||||||
player.getPacketSender().closeAllWindows();
|
player.getPacketSender().closeAllWindows();
|
||||||
@@ -192,6 +198,12 @@ public class DialogueOptions {
|
|||||||
player.getDialogueHandler().sendStatement("You close your shop!");
|
player.getDialogueHandler().sendStatement("You close your shop!");
|
||||||
BotHandler.closeShop(player);
|
BotHandler.closeShop(player);
|
||||||
return;
|
return;
|
||||||
|
case 10005:
|
||||||
|
player.setXPRate(GameConstants.VARIABLE_XP_RATES[2]);
|
||||||
|
player.getPacketSender().sendMessage("Your XP rate is now set to x" + player.getXPRate() + " you can increase your rate in the future by using");
|
||||||
|
player.getPacketSender().sendMessage("::xprate");
|
||||||
|
player.getPacketSender().closeAllWindows();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
player.dialogueAction = 0;
|
player.dialogueAction = 0;
|
||||||
player.getPacketSender().closeAllWindows();
|
player.getPacketSender().closeAllWindows();
|
||||||
@@ -283,6 +295,11 @@ public class DialogueOptions {
|
|||||||
player.getDialogueHandler().sendStatement("You withdraw " + Bot.formatSellPrice(BotHandler.checkCoins(player)) + " from your shop!");
|
player.getDialogueHandler().sendStatement("You withdraw " + Bot.formatSellPrice(BotHandler.checkCoins(player)) + " from your shop!");
|
||||||
BotHandler.takeCoins(player);
|
BotHandler.takeCoins(player);
|
||||||
return;
|
return;
|
||||||
|
case 10005:
|
||||||
|
player.setXPRate(GameConstants.VARIABLE_XP_RATES[3]);
|
||||||
|
player.getPacketSender().sendMessage("Your XP rate is now set to x" + player.getXPRate() + " you now have the highest XP rate.");
|
||||||
|
player.getPacketSender().closeAllWindows();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
player.dialogueAction = 0;
|
player.dialogueAction = 0;
|
||||||
player.getPacketSender().closeAllWindows();
|
player.getPacketSender().closeAllWindows();
|
||||||
@@ -376,9 +393,6 @@ public class DialogueOptions {
|
|||||||
} else if (player.dialogueAction == 56) {
|
} else if (player.dialogueAction == 56) {
|
||||||
player.getDialogueHandler().sendDialogues(96, player.npcType);
|
player.getDialogueHandler().sendDialogues(96, player.npcType);
|
||||||
return;
|
return;
|
||||||
} else if (player.dialogueAction == 57) {
|
|
||||||
player.getDialogueHandler().sendDialogues(57, player.npcType);
|
|
||||||
return;
|
|
||||||
} else if (player.dialogueAction == 3222) {
|
} else if (player.dialogueAction == 3222) {
|
||||||
player.getBarrows().checkCoffins();
|
player.getBarrows().checkCoffins();
|
||||||
player.getPacketSender().closeAllWindows();
|
player.getPacketSender().closeAllWindows();
|
||||||
@@ -618,10 +632,36 @@ public class DialogueOptions {
|
|||||||
player.getDialogueHandler().sendDialogues(3586, player.npcType);
|
player.getDialogueHandler().sendDialogues(3586, player.npcType);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (player.dialogueAction == 7559)
|
else if (player.dialogueAction == 7559) {
|
||||||
{
|
|
||||||
player.getDialogueHandler().sendDialogues(3864, player.npcType);
|
player.getDialogueHandler().sendDialogues(3864, player.npcType);
|
||||||
return;
|
return;
|
||||||
|
} else if (player.dialogueAction == 10004) {
|
||||||
|
if(!player.closeTutorialInterface) {
|
||||||
|
player.getPacketSender().sendMessage("Your XP rate is now set to x" + player.getXPRate() + " you can increase your rate in the future by using");
|
||||||
|
player.getPacketSender().sendMessage("::xprate");
|
||||||
|
player.getPacketSender().showInterface(3559);
|
||||||
|
player.canChangeAppearance = true;
|
||||||
|
player.closeTutorialInterface = true;
|
||||||
|
return;
|
||||||
|
} else if (player.getXPRate() != + GameConstants.VARIABLE_XP_RATES[3]) {
|
||||||
|
player.getPacketSender().sendMessage("Your XP rate is now set to x" + player.getXPRate() + " you can increase your rate in the future by using");
|
||||||
|
player.getPacketSender().sendMessage("::xprate");
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
player.getPacketSender().sendMessage("Your XP rate is now set to x" + player.getXPRate() + " you now have the highest XP rate.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if(player.dialogueAction == 10006) {
|
||||||
|
player.setXPRate(GameConstants.VARIABLE_XP_RATES[2]);
|
||||||
|
player.getPacketSender().sendMessage("Your XP rate is now set to x" + player.getXPRate() + " you can increase your rate in the future by using");
|
||||||
|
player.getPacketSender().sendMessage("::xprate");
|
||||||
|
player.getPacketSender().closeAllWindows();
|
||||||
|
return;
|
||||||
|
} else if(player.dialogueAction == 10007) {
|
||||||
|
player.setXPRate(GameConstants.VARIABLE_XP_RATES[3]);
|
||||||
|
player.getPacketSender().sendMessage("Your XP rate is now set to x" + player.getXPRate() + " you now have the highest XP rate.");
|
||||||
|
player.getPacketSender().closeAllWindows();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
player.dialogueAction = 0;
|
player.dialogueAction = 0;
|
||||||
player.getPacketSender().closeAllWindows();
|
player.getPacketSender().closeAllWindows();
|
||||||
@@ -649,9 +689,6 @@ public class DialogueOptions {
|
|||||||
} else if (player.dialogueAction == 74) {
|
} else if (player.dialogueAction == 74) {
|
||||||
player.getDialogueHandler().sendDialogues(535, player.npcType);
|
player.getDialogueHandler().sendDialogues(535, player.npcType);
|
||||||
return;
|
return;
|
||||||
} else if (player.dialogueAction == 57) {
|
|
||||||
player.getDialogueHandler().sendDialogues(58, player.npcType);
|
|
||||||
return;
|
|
||||||
} else if (player.dialogueAction == 62) {
|
} else if (player.dialogueAction == 62) {
|
||||||
player.getDialogueHandler().sendDialogues(309, player.npcType);
|
player.getDialogueHandler().sendDialogues(309, player.npcType);
|
||||||
return;
|
return;
|
||||||
@@ -848,6 +885,15 @@ public class DialogueOptions {
|
|||||||
{
|
{
|
||||||
player.getDialogueHandler().sendDialogues(3865, player.npcType);
|
player.getDialogueHandler().sendDialogues(3865, player.npcType);
|
||||||
return;
|
return;
|
||||||
|
} else if (player.dialogueAction == 10004) {
|
||||||
|
player.getDialogueHandler().sendDialogues(10002, 2244);
|
||||||
|
return;
|
||||||
|
} else if(player.dialogueAction == 10006) {
|
||||||
|
player.setXPRate(GameConstants.VARIABLE_XP_RATES[3]);
|
||||||
|
player.getPacketSender().sendMessage("Your XP rate is now set to x" + player.getXPRate() + " you now have the highest XP rate.");
|
||||||
|
player.getPacketSender().sendMessage("::xprate");
|
||||||
|
player.getPacketSender().closeAllWindows();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
player.dialogueAction = 0;
|
player.dialogueAction = 0;
|
||||||
player.getPacketSender().closeAllWindows();
|
player.getPacketSender().closeAllWindows();
|
||||||
@@ -892,9 +938,6 @@ public class DialogueOptions {
|
|||||||
if (player.dialogueAction == 113) {
|
if (player.dialogueAction == 113) {
|
||||||
player.getDialogueHandler().sendDialogues(3540, player.npcType);
|
player.getDialogueHandler().sendDialogues(3540, player.npcType);
|
||||||
}
|
}
|
||||||
if (player.dialogueAction == 52) {
|
|
||||||
player.getDialogueHandler().sendDialogues(52, player.npcType);
|
|
||||||
}
|
|
||||||
if (player.dialogueAction == 1000) {
|
if (player.dialogueAction == 1000) {
|
||||||
player.getDialogueHandler().sendDialogues(3524,player.npcType);
|
player.getDialogueHandler().sendDialogues(3524,player.npcType);
|
||||||
}
|
}
|
||||||
@@ -922,6 +965,10 @@ public class DialogueOptions {
|
|||||||
if (player.dialogueAction == 701) {
|
if (player.dialogueAction == 701) {
|
||||||
player.getDialogueHandler().sendDialogues(3561, player.npcType);
|
player.getDialogueHandler().sendDialogues(3561, player.npcType);
|
||||||
}
|
}
|
||||||
|
if (player.dialogueAction == 10002) {
|
||||||
|
player.setXPRate(GameConstants.VARIABLE_XP_RATES[0]);
|
||||||
|
player.getDialogueHandler().sendDialogues(10003, player.npcType);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9179:
|
case 9179:
|
||||||
@@ -961,9 +1008,6 @@ public class DialogueOptions {
|
|||||||
player.getPlayerAssistant().gloryTeleport(3293, 3174, 0, "modern");
|
player.getPlayerAssistant().gloryTeleport(3293, 3174, 0, "modern");
|
||||||
Teles.necklaces(player);
|
Teles.necklaces(player);
|
||||||
}
|
}
|
||||||
if (player.dialogueAction == 52) {
|
|
||||||
player.getDialogueHandler().sendDialogues(64, player.npcType);
|
|
||||||
}
|
|
||||||
if (player.dialogueAction == 1000) {
|
if (player.dialogueAction == 1000) {
|
||||||
player.getDialogueHandler().sendDialogues(3523, player.npcType);
|
player.getDialogueHandler().sendDialogues(3523, player.npcType);
|
||||||
}
|
}
|
||||||
@@ -991,6 +1035,10 @@ public class DialogueOptions {
|
|||||||
if (player.dialogueAction == 701) {
|
if (player.dialogueAction == 701) {
|
||||||
player.getDialogueHandler().sendDialogues(3562, player.npcType);
|
player.getDialogueHandler().sendDialogues(3562, player.npcType);
|
||||||
}
|
}
|
||||||
|
if (player.dialogueAction == 10002) {
|
||||||
|
player.setXPRate(GameConstants.VARIABLE_XP_RATES[1]);
|
||||||
|
player.getDialogueHandler().sendDialogues(10003, player.npcType);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9180:
|
case 9180:
|
||||||
@@ -1033,9 +1081,6 @@ public class DialogueOptions {
|
|||||||
player.getPlayerAssistant().gloryTeleport(2911, 3152, 0, "modern");
|
player.getPlayerAssistant().gloryTeleport(2911, 3152, 0, "modern");
|
||||||
Teles.necklaces(player);
|
Teles.necklaces(player);
|
||||||
}
|
}
|
||||||
if (player.dialogueAction == 52) {
|
|
||||||
player.getDialogueHandler().sendDialogues(65, player.npcType);
|
|
||||||
}
|
|
||||||
if (player.dialogueAction == 1000) {
|
if (player.dialogueAction == 1000) {
|
||||||
player.getDialogueHandler().sendDialogues(3523,player.npcType);
|
player.getDialogueHandler().sendDialogues(3523,player.npcType);
|
||||||
}
|
}
|
||||||
@@ -1063,6 +1108,10 @@ public class DialogueOptions {
|
|||||||
if (player.dialogueAction == 701) {
|
if (player.dialogueAction == 701) {
|
||||||
player.getDialogueHandler().sendDialogues(3563, player.npcType);
|
player.getDialogueHandler().sendDialogues(3563, player.npcType);
|
||||||
}
|
}
|
||||||
|
if (player.dialogueAction == 10002) {
|
||||||
|
player.setXPRate(GameConstants.VARIABLE_XP_RATES[2]);
|
||||||
|
player.getDialogueHandler().sendDialogues(10003, player.npcType);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9181:
|
case 9181:
|
||||||
@@ -1090,9 +1139,6 @@ public class DialogueOptions {
|
|||||||
player.getPlayerAssistant().gloryTeleport(3103, 3249, 0, "modern");
|
player.getPlayerAssistant().gloryTeleport(3103, 3249, 0, "modern");
|
||||||
Teles.necklaces(player);
|
Teles.necklaces(player);
|
||||||
}
|
}
|
||||||
if (player.dialogueAction == 52) {
|
|
||||||
player.getDialogueHandler().sendDialogues(63, player.npcType);
|
|
||||||
}
|
|
||||||
if (player.dialogueAction == 1000) {
|
if (player.dialogueAction == 1000) {
|
||||||
player.getDialogueHandler().sendDialogues(3523, player.npcType);
|
player.getDialogueHandler().sendDialogues(3523, player.npcType);
|
||||||
}
|
}
|
||||||
@@ -1120,6 +1166,10 @@ public class DialogueOptions {
|
|||||||
if (player.dialogueAction == 701) {
|
if (player.dialogueAction == 701) {
|
||||||
player.getDialogueHandler().sendDialogues(3564, player.npcType);
|
player.getDialogueHandler().sendDialogues(3564, player.npcType);
|
||||||
}
|
}
|
||||||
|
if (player.dialogueAction == 10002) {
|
||||||
|
player.setXPRate(GameConstants.VARIABLE_XP_RATES[3]);
|
||||||
|
player.getDialogueHandler().sendDialogues(10003, player.npcType);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.rs2.game.dialogues;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents an abstract dialogue, in which extending classes will be able to construct and send
|
||||||
|
* dialogues to a player.
|
||||||
|
*
|
||||||
|
* @author Vult-R
|
||||||
|
*/
|
||||||
|
public abstract class DialoguePlugin {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The action buttons responsible for dialogues.
|
||||||
|
*/
|
||||||
|
public static final ImmutableList<Integer> DIALOGUE_BUTTONS = ImmutableList.of(9157, 9167, 9178, 9190,
|
||||||
|
9158, 9168, 9179, 9191, 9169, 9180, 9192, 9181, 9193, 9194);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sends a player a dialogue.
|
||||||
|
*
|
||||||
|
* @param factory The factory for this dialogue.
|
||||||
|
*/
|
||||||
|
public abstract void sendDialogues(DialogueFactoryPlugin factory);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the button triggered is an optional dialogue button.
|
||||||
|
*
|
||||||
|
* @param button The index of the button being checked.
|
||||||
|
*
|
||||||
|
* @return The result of the operation.
|
||||||
|
*/
|
||||||
|
public static final boolean isDialogueButton(int button) {
|
||||||
|
return DIALOGUE_BUTTONS.stream().anyMatch(search -> search == button);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package com.rs2.game.dialogues;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2010-2011 Graham Edgecombe Copyright (c) 2011-2016 Major <major.emrs@gmail.com> and
|
||||||
|
* other apollo contributors
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for any purpose with or without
|
||||||
|
* fee is hereby granted, provided that the above copyright notice and this permission notice appear
|
||||||
|
* in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||||
|
* SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||||
|
* AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||||
|
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||||
|
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
|
||||||
|
* OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents the expressions of entities for dialogue.
|
||||||
|
*
|
||||||
|
* @author Vult-R
|
||||||
|
*/
|
||||||
|
public enum ExpressionPlugin {
|
||||||
|
HAPPY(588),
|
||||||
|
ANXIOUS(589),
|
||||||
|
CALM_TALK(590),
|
||||||
|
DEFAULT(591),
|
||||||
|
EVIL(592),
|
||||||
|
BAD(593),
|
||||||
|
WICKED(594),
|
||||||
|
ANNOYED(595),
|
||||||
|
DISTRESSED(596),
|
||||||
|
AFFLICTED(597),
|
||||||
|
DRUNK_LEFT(600),
|
||||||
|
DRUNK_RIGHT(601),
|
||||||
|
NOT_INTERESTED(602),
|
||||||
|
SLEEPY(603),
|
||||||
|
PLAIN_EVIL(604),
|
||||||
|
LAUGH(605),
|
||||||
|
SNIGGER(606),
|
||||||
|
HAVE_FUN(607),
|
||||||
|
GUFFAW(608),
|
||||||
|
EVIL_LAUGH_SHORT(609),
|
||||||
|
SLIGHTLY_SAD(610),
|
||||||
|
SAD(599),
|
||||||
|
VERY_SAD(611),
|
||||||
|
ON_ONE_HAND(612),
|
||||||
|
ALMOST_CRYING(598),
|
||||||
|
NEARLY_CRYING(613),
|
||||||
|
ANGRY(614),
|
||||||
|
FURIOUS(615),
|
||||||
|
ENRAGED(616),
|
||||||
|
MAD(617);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id for this expression.
|
||||||
|
*/
|
||||||
|
private final int id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@link ExpressionPlugin}.
|
||||||
|
*
|
||||||
|
* @param expression The id for this expression.
|
||||||
|
*/
|
||||||
|
private ExpressionPlugin(int expression) {
|
||||||
|
this.id = expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delombok'd Code Below
|
||||||
|
public int getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,122 @@
|
|||||||
|
package com.rs2.game.dialogues;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link ChainablePlugin} implementation that represents dialogue in which an NPC is talking.
|
||||||
|
*
|
||||||
|
* @author Vult-R
|
||||||
|
*/
|
||||||
|
public final class NPCDialogue implements ChainablePlugin {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The id of this npc.
|
||||||
|
*/
|
||||||
|
private int id = -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The expression of this NPC.
|
||||||
|
*/
|
||||||
|
private final ExpressionPlugin expression;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The text for this dialogue.
|
||||||
|
*/
|
||||||
|
private final String[] lines;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@link NPCDialogue}
|
||||||
|
*
|
||||||
|
* @param lines The text for this dialogue.
|
||||||
|
*/
|
||||||
|
public NPCDialogue(String... lines) {
|
||||||
|
this(ExpressionPlugin.DEFAULT, lines);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@link NPCDialogue}
|
||||||
|
*
|
||||||
|
* @param expression The expression of this npc.
|
||||||
|
*
|
||||||
|
* @param lines The text for this dialogue.
|
||||||
|
*/
|
||||||
|
public NPCDialogue(ExpressionPlugin expression, String... lines) {
|
||||||
|
this.expression = expression;
|
||||||
|
this.lines = lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@link NPCDialogue}
|
||||||
|
*
|
||||||
|
* @param id The id of this npc.
|
||||||
|
*
|
||||||
|
* @param lines The text for this dialogue.
|
||||||
|
*/
|
||||||
|
public NPCDialogue(int id, String... lines) {
|
||||||
|
this(id, ExpressionPlugin.DEFAULT, lines);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@link NPCDialogue}
|
||||||
|
*
|
||||||
|
* @param id The id of this npc.
|
||||||
|
*
|
||||||
|
* @param expression The expression of this npc.
|
||||||
|
*
|
||||||
|
* @param lines The text for this dialogue.
|
||||||
|
*/
|
||||||
|
public NPCDialogue(int id, ExpressionPlugin expression, String... lines) {
|
||||||
|
this.id = id;
|
||||||
|
this.expression = expression;
|
||||||
|
this.lines = lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accept(DialogueFactoryPlugin factory) {
|
||||||
|
factory.sendNPCChat(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getId() {
|
||||||
|
return this.id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExpressionPlugin getExpression() {
|
||||||
|
return this.expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delombok'd Code Below
|
||||||
|
public String[] getLines() {
|
||||||
|
return this.lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(int id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equals(final Object o) {
|
||||||
|
if (o == this) return true;
|
||||||
|
if (!(o instanceof NPCDialogue)) return false;
|
||||||
|
final NPCDialogue other = (NPCDialogue) o;
|
||||||
|
if (this.getId() != other.getId()) return false;
|
||||||
|
final Object this$expression = this.getExpression();
|
||||||
|
final Object other$expression = other.getExpression();
|
||||||
|
if (this$expression == null ? other$expression != null : !this$expression.equals(other$expression))
|
||||||
|
return false;
|
||||||
|
if (!java.util.Arrays.deepEquals(this.getLines(), other.getLines())) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hashCode() {
|
||||||
|
final int PRIME = 59;
|
||||||
|
int result = 1;
|
||||||
|
result = result * PRIME + this.getId();
|
||||||
|
final Object $expression = this.getExpression();
|
||||||
|
result = result * PRIME + ($expression == null ? 43 : $expression.hashCode());
|
||||||
|
result = result * PRIME + java.util.Arrays.deepHashCode(this.getLines());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return "AstraeusNPCDialogue(id=" + this.getId() + ", expression=" + this.getExpression() + ", lines=" + java.util.Arrays.deepToString(this.getLines()) + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,163 @@
|
|||||||
|
package com.rs2.game.dialogues;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link ChainablePlugin} implementation that represents a dialogue in which options are given to the
|
||||||
|
* player.
|
||||||
|
*
|
||||||
|
* @author Vult-R
|
||||||
|
*/
|
||||||
|
public final class OptionDialoguePlugin implements ChainablePlugin {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The text for this dialogue.
|
||||||
|
*/
|
||||||
|
private final String[] lines;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The list of actions for this dialogue.
|
||||||
|
*/
|
||||||
|
private final List<Runnable> actions = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@link OptionDialoguePlugin}.
|
||||||
|
*
|
||||||
|
* @param option1 The text for the first option.
|
||||||
|
*
|
||||||
|
* @param action1 The action for the first action.
|
||||||
|
*
|
||||||
|
* @param option2 The text for the second option.
|
||||||
|
*
|
||||||
|
* @param action2 The action for the second action.
|
||||||
|
*/
|
||||||
|
public OptionDialoguePlugin(String option1, Runnable action1, String option2, Runnable action2) {
|
||||||
|
lines = new String[] {option1, option2};
|
||||||
|
actions.add(action1);
|
||||||
|
actions.add(action2);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@link OptionDialoguePlugin}.
|
||||||
|
*
|
||||||
|
* @param option1 The text for the first option.
|
||||||
|
*
|
||||||
|
* @param action1 The action for the first action.
|
||||||
|
*
|
||||||
|
* @param option2 The text for the second option.
|
||||||
|
*
|
||||||
|
* @param action2 The action for the second action.
|
||||||
|
*
|
||||||
|
* @param option3 The text for the third option.
|
||||||
|
*
|
||||||
|
* @param action3 The action for the third action.
|
||||||
|
*/
|
||||||
|
public OptionDialoguePlugin(String option1, Runnable action1, String option2, Runnable action2,
|
||||||
|
String option3, Runnable action3) {
|
||||||
|
lines = new String[] {option1, option2, option3};
|
||||||
|
actions.add(action1);
|
||||||
|
actions.add(action2);
|
||||||
|
actions.add(action3);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@link OptionDialoguePlugin}.
|
||||||
|
*
|
||||||
|
* @param option1 The text for the first option.
|
||||||
|
*
|
||||||
|
* @param action1 The action for the first action.
|
||||||
|
*
|
||||||
|
* @param option2 The text for the second option.
|
||||||
|
*
|
||||||
|
* @param action2 The action for the second action.
|
||||||
|
*
|
||||||
|
* @param option3 The text for the third option.
|
||||||
|
*
|
||||||
|
* @param action3 The action for the third action.
|
||||||
|
*
|
||||||
|
* @param option4 The text for the four option.
|
||||||
|
*
|
||||||
|
* @param action4 The action for the four action.
|
||||||
|
*/
|
||||||
|
public OptionDialoguePlugin(String option1, Runnable action1, String option2, Runnable action2,
|
||||||
|
String option3, Runnable action3, String option4, Runnable action4) {
|
||||||
|
lines = new String[] {option1, option2, option3, option4};
|
||||||
|
actions.add(action1);
|
||||||
|
actions.add(action2);
|
||||||
|
actions.add(action3);
|
||||||
|
actions.add(action4);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@link OptionDialoguePlugin}.
|
||||||
|
*
|
||||||
|
* @param option1 The text for the first option.
|
||||||
|
*
|
||||||
|
* @param action1 The action for the first action.
|
||||||
|
*
|
||||||
|
* @param option2 The text for the second option.
|
||||||
|
*
|
||||||
|
* @param action2 The action for the second action.
|
||||||
|
*
|
||||||
|
* @param option3 The text for the third option.
|
||||||
|
*
|
||||||
|
* @param action3 The action for the third action.
|
||||||
|
*
|
||||||
|
* @param option4 The text for the four option.
|
||||||
|
*
|
||||||
|
* @param action4 The action for the four action.
|
||||||
|
*
|
||||||
|
* @param option5 The text for the fifth option.
|
||||||
|
*
|
||||||
|
* @param action5 The action for the fifth action.
|
||||||
|
*/
|
||||||
|
public OptionDialoguePlugin(String option1, Runnable action1, String option2, Runnable action2,
|
||||||
|
String option3, Runnable action3, String option4, Runnable action4, String option5,
|
||||||
|
Runnable action5) {
|
||||||
|
lines = new String[] {option1, option2, option3, option4, option5};
|
||||||
|
actions.add(action1);
|
||||||
|
actions.add(action2);
|
||||||
|
actions.add(action3);
|
||||||
|
actions.add(action4);
|
||||||
|
actions.add(action5);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accept(DialogueFactoryPlugin factory) {
|
||||||
|
factory.sendOption(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delombok'd code below
|
||||||
|
public String[] getLines() {
|
||||||
|
return this.lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Runnable> getActions() {
|
||||||
|
return this.actions;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equals(final Object o) {
|
||||||
|
if (o == this) return true;
|
||||||
|
if (!(o instanceof OptionDialoguePlugin)) return false;
|
||||||
|
final OptionDialoguePlugin other = (OptionDialoguePlugin) o;
|
||||||
|
if (!java.util.Arrays.deepEquals(this.getLines(), other.getLines())) return false;
|
||||||
|
final Object this$actions = this.getActions();
|
||||||
|
final Object other$actions = other.getActions();
|
||||||
|
if (this$actions == null ? other$actions != null : !this$actions.equals(other$actions)) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hashCode() {
|
||||||
|
final int PRIME = 59;
|
||||||
|
int result = 1;
|
||||||
|
result = result * PRIME + java.util.Arrays.deepHashCode(this.getLines());
|
||||||
|
final Object $actions = this.getActions();
|
||||||
|
result = result * PRIME + ($actions == null ? 43 : $actions.hashCode());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return "AstraeusOptionDialogue(lines=" + java.util.Arrays.deepToString(this.getLines()) + ", actions=" + this.getActions() + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package com.rs2.game.dialogues;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A {@link ChainablePlugin} implementation that represents a player talking.
|
||||||
|
*
|
||||||
|
* @author Vult-R
|
||||||
|
*/
|
||||||
|
public class PlayerDialoguePlugin implements ChainablePlugin {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The expression of this player.
|
||||||
|
*/
|
||||||
|
private final ExpressionPlugin expression;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The text for this dialogue.
|
||||||
|
*/
|
||||||
|
private final String[] lines;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@link PlayerDialoguePlugin} with a default expression of {@code DEFAULT}.
|
||||||
|
*
|
||||||
|
* @param lines The text for this dialogue.
|
||||||
|
*/
|
||||||
|
public PlayerDialoguePlugin(String... lines) {
|
||||||
|
this(ExpressionPlugin.DEFAULT, lines);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@link PlayerDialoguePlugin}.
|
||||||
|
*
|
||||||
|
* @param expression The expression for this dialogue.
|
||||||
|
*
|
||||||
|
* @param lines The text for this dialogue.
|
||||||
|
*/
|
||||||
|
public PlayerDialoguePlugin(ExpressionPlugin expression, String... lines) {
|
||||||
|
this.expression = expression;
|
||||||
|
this.lines = lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accept(DialogueFactoryPlugin factory) {
|
||||||
|
factory.sendPlayerChat(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ExpressionPlugin getExpression() {
|
||||||
|
return this.expression;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delombok'd Code Below
|
||||||
|
public String[] getLines() {
|
||||||
|
return this.lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equals(final Object o) {
|
||||||
|
if (o == this) return true;
|
||||||
|
if (!(o instanceof PlayerDialoguePlugin)) return false;
|
||||||
|
final PlayerDialoguePlugin other = (PlayerDialoguePlugin) o;
|
||||||
|
if (!other.canEqual((Object) this)) return false;
|
||||||
|
final Object this$expression = this.getExpression();
|
||||||
|
final Object other$expression = other.getExpression();
|
||||||
|
if (this$expression == null ? other$expression != null : !this$expression.equals(other$expression))
|
||||||
|
return false;
|
||||||
|
if (!java.util.Arrays.deepEquals(this.getLines(), other.getLines())) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof PlayerDialoguePlugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hashCode() {
|
||||||
|
final int PRIME = 59;
|
||||||
|
int result = 1;
|
||||||
|
final Object $expression = this.getExpression();
|
||||||
|
result = result * PRIME + ($expression == null ? 43 : $expression.hashCode());
|
||||||
|
result = result * PRIME + java.util.Arrays.deepHashCode(this.getLines());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return "PlayerDialoguePlugin(expression=" + this.getExpression() + ", lines=" + java.util.Arrays.deepToString(this.getLines()) + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.rs2.game.dialogues;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link ChainablePlugin} implementation that represents a dialogue with a single statement; which
|
||||||
|
* has no models on the dialogue.
|
||||||
|
*
|
||||||
|
* @author Vult-R
|
||||||
|
*/
|
||||||
|
public class StatementDialoguePlugin implements ChainablePlugin {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The text for this dialogue.
|
||||||
|
*/
|
||||||
|
private final String[] lines;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a new {@link StatementDialoguePlugin}.
|
||||||
|
*
|
||||||
|
* @param lines The text for this dialogue.
|
||||||
|
*/
|
||||||
|
public StatementDialoguePlugin(String... lines) {
|
||||||
|
this.lines = lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void accept(DialogueFactoryPlugin factory) {
|
||||||
|
factory.sendStatement(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Delombok'd code below
|
||||||
|
public String[] getLines() {
|
||||||
|
return this.lines;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean equals(final Object o) {
|
||||||
|
if (o == this) return true;
|
||||||
|
if (!(o instanceof StatementDialoguePlugin)) return false;
|
||||||
|
final StatementDialoguePlugin other = (StatementDialoguePlugin) o;
|
||||||
|
if (!other.canEqual((Object) this)) return false;
|
||||||
|
if (!java.util.Arrays.deepEquals(this.getLines(), other.getLines())) return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean canEqual(final Object other) {
|
||||||
|
return other instanceof StatementDialoguePlugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int hashCode() {
|
||||||
|
final int PRIME = 59;
|
||||||
|
int result = 1;
|
||||||
|
result = result * PRIME + java.util.Arrays.deepHashCode(this.getLines());
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return "AstraeusStatementDialogue(lines=" + java.util.Arrays.deepToString(this.getLines()) + ")";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -724,18 +724,6 @@ public class NpcActions {
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 278:
|
|
||||||
if (player.cookAss == 0) {
|
|
||||||
player.getDialogueHandler().sendDialogues(50, npcType);
|
|
||||||
} else if (player.cookAss == 1) {
|
|
||||||
player.getDialogueHandler().sendDialogues(67, npcType);
|
|
||||||
} else if (player.cookAss == 2) {
|
|
||||||
player.getDialogueHandler().sendDialogues(69, npcType);
|
|
||||||
} else if (player.cookAss == 3) {
|
|
||||||
player.getDialogueHandler().sendDialogues(76, npcType);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 608:
|
case 608:
|
||||||
if (player.blackKnight == 0 && player.questPoints >= 12) {
|
if (player.blackKnight == 0 && player.questPoints >= 12) {
|
||||||
player.getDialogueHandler().sendDialogues(3902, npcType);
|
player.getDialogueHandler().sendDialogues(3902, npcType);
|
||||||
|
|||||||
@@ -1,19 +1,9 @@
|
|||||||
package com.rs2.game.players;
|
package com.rs2.game.players;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.GregorianCalendar;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Queue;
|
|
||||||
|
|
||||||
import com.everythingrs.hiscores.Hiscores;
|
import com.everythingrs.hiscores.Hiscores;
|
||||||
import com.rs2.event.*;
|
|
||||||
import com.rs2.plugin.PluginService;
|
|
||||||
import org.apache.mina.common.IoSession;
|
|
||||||
import com.rs2.GameConstants;
|
import com.rs2.GameConstants;
|
||||||
import com.rs2.GameEngine;
|
import com.rs2.GameEngine;
|
||||||
|
import com.rs2.event.*;
|
||||||
import com.rs2.game.content.BankPin;
|
import com.rs2.game.content.BankPin;
|
||||||
import com.rs2.game.content.EmoteHandler;
|
import com.rs2.game.content.EmoteHandler;
|
||||||
import com.rs2.game.content.combat.CombatAssistant;
|
import com.rs2.game.content.combat.CombatAssistant;
|
||||||
@@ -35,28 +25,11 @@ import com.rs2.game.content.minigames.magetrainingarena.MageTrainingArena;
|
|||||||
import com.rs2.game.content.music.PlayList;
|
import com.rs2.game.content.music.PlayList;
|
||||||
import com.rs2.game.content.music.sound.SoundList;
|
import com.rs2.game.content.music.sound.SoundList;
|
||||||
import com.rs2.game.content.skills.SkillInterfaces;
|
import com.rs2.game.content.skills.SkillInterfaces;
|
||||||
import com.rs2.game.content.skills.agility.Agility;
|
import com.rs2.game.content.skills.agility.*;
|
||||||
import com.rs2.game.content.skills.agility.ApeAtollAgility;
|
|
||||||
import com.rs2.game.content.skills.agility.BarbarianAgility;
|
|
||||||
import com.rs2.game.content.skills.agility.GnomeAgility;
|
|
||||||
import com.rs2.game.content.skills.agility.PyramidAgility;
|
|
||||||
import com.rs2.game.content.skills.agility.WerewolfAgility;
|
|
||||||
import com.rs2.game.content.skills.agility.WildernessAgility;
|
|
||||||
import com.rs2.game.content.skills.cooking.Potatoes;
|
import com.rs2.game.content.skills.cooking.Potatoes;
|
||||||
import com.rs2.game.content.skills.core.Mining;
|
import com.rs2.game.content.skills.core.Mining;
|
||||||
import com.rs2.game.content.skills.crafting.GlassBlowing;
|
import com.rs2.game.content.skills.crafting.GlassBlowing;
|
||||||
import com.rs2.game.content.skills.farming.Allotments;
|
import com.rs2.game.content.skills.farming.*;
|
||||||
import com.rs2.game.content.skills.farming.Bushes;
|
|
||||||
import com.rs2.game.content.skills.farming.Compost;
|
|
||||||
import com.rs2.game.content.skills.farming.Flowers;
|
|
||||||
import com.rs2.game.content.skills.farming.FruitTree;
|
|
||||||
import com.rs2.game.content.skills.farming.Herbs;
|
|
||||||
import com.rs2.game.content.skills.farming.Hops;
|
|
||||||
import com.rs2.game.content.skills.farming.Seedling;
|
|
||||||
import com.rs2.game.content.skills.farming.SpecialPlantOne;
|
|
||||||
import com.rs2.game.content.skills.farming.SpecialPlantTwo;
|
|
||||||
import com.rs2.game.content.skills.farming.ToolLeprechaun;
|
|
||||||
import com.rs2.game.content.skills.farming.WoodTrees;
|
|
||||||
import com.rs2.game.content.skills.fletching.LogCuttingInterface;
|
import com.rs2.game.content.skills.fletching.LogCuttingInterface;
|
||||||
import com.rs2.game.content.skills.runecrafting.Runecrafting;
|
import com.rs2.game.content.skills.runecrafting.Runecrafting;
|
||||||
import com.rs2.game.content.skills.slayer.Slayer;
|
import com.rs2.game.content.skills.slayer.Slayer;
|
||||||
@@ -64,18 +37,17 @@ import com.rs2.game.content.skills.smithing.Smithing;
|
|||||||
import com.rs2.game.content.skills.smithing.SmithingInterface;
|
import com.rs2.game.content.skills.smithing.SmithingInterface;
|
||||||
import com.rs2.game.content.traveling.DesertCactus;
|
import com.rs2.game.content.traveling.DesertCactus;
|
||||||
import com.rs2.game.content.traveling.DesertHeat;
|
import com.rs2.game.content.traveling.DesertHeat;
|
||||||
|
import com.rs2.game.dialogues.DialoguePlugin;
|
||||||
|
import com.rs2.game.dialogues.DialogueFactoryPlugin;
|
||||||
|
import com.rs2.game.dialogues.OptionDialoguePlugin;
|
||||||
import com.rs2.game.dialogues.DialogueHandler;
|
import com.rs2.game.dialogues.DialogueHandler;
|
||||||
import com.rs2.game.globalworldobjects.DoubleGates;
|
import com.rs2.game.globalworldobjects.DoubleGates;
|
||||||
import com.rs2.game.globalworldobjects.GateHandler;
|
import com.rs2.game.globalworldobjects.GateHandler;
|
||||||
import com.rs2.game.globalworldobjects.SingleGates;
|
import com.rs2.game.globalworldobjects.SingleGates;
|
||||||
import com.rs2.game.items.GameItem;
|
import com.rs2.game.items.*;
|
||||||
import com.rs2.game.items.Inventory;
|
import com.rs2.game.items.impl.Greegree.MonkeyData;
|
||||||
import com.rs2.game.items.ItemData;
|
|
||||||
import com.rs2.game.items.ItemAssistant;
|
|
||||||
import com.rs2.game.items.ItemConstants;
|
|
||||||
import com.rs2.game.items.impl.PotionMixing;
|
import com.rs2.game.items.impl.PotionMixing;
|
||||||
import com.rs2.game.items.impl.Teles;
|
import com.rs2.game.items.impl.Teles;
|
||||||
import com.rs2.game.items.impl.Greegree.MonkeyData;
|
|
||||||
import com.rs2.game.npcs.Npc;
|
import com.rs2.game.npcs.Npc;
|
||||||
import com.rs2.game.npcs.NpcActions;
|
import com.rs2.game.npcs.NpcActions;
|
||||||
import com.rs2.game.npcs.NpcHandler;
|
import com.rs2.game.npcs.NpcHandler;
|
||||||
@@ -88,17 +60,22 @@ import com.rs2.net.PacketSender;
|
|||||||
import com.rs2.net.StaticPacketBuilder;
|
import com.rs2.net.StaticPacketBuilder;
|
||||||
import com.rs2.net.packets.PacketHandler;
|
import com.rs2.net.packets.PacketHandler;
|
||||||
import com.rs2.net.packets.impl.ChallengePlayer;
|
import com.rs2.net.packets.impl.ChallengePlayer;
|
||||||
|
import com.rs2.plugin.PluginService;
|
||||||
import com.rs2.util.ISAACRandomGen;
|
import com.rs2.util.ISAACRandomGen;
|
||||||
import com.rs2.util.Misc;
|
import com.rs2.util.Misc;
|
||||||
import com.rs2.util.Stream;
|
import com.rs2.util.Stream;
|
||||||
import com.rs2.world.Boundary;
|
import com.rs2.world.Boundary;
|
||||||
import com.rs2.world.ObjectManager;
|
import com.rs2.world.ObjectManager;
|
||||||
|
import org.apache.mina.common.IoSession;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
public abstract class Player {
|
public abstract class Player {
|
||||||
|
|
||||||
public byte buffer[] = null;
|
public byte buffer[] = null;
|
||||||
public String lastConnectedFrom;
|
public String lastConnectedFrom;
|
||||||
private Compost compost = new Compost(this);
|
public static int xpRate = 1;
|
||||||
|
private Compost compost = new Compost(this);
|
||||||
private Allotments allotment = new Allotments(this);
|
private Allotments allotment = new Allotments(this);
|
||||||
private Flowers flower = new Flowers(this);
|
private Flowers flower = new Flowers(this);
|
||||||
private Herbs herb = new Herbs(this);
|
private Herbs herb = new Herbs(this);
|
||||||
@@ -142,6 +119,14 @@ public abstract class Player {
|
|||||||
private final Slayer slayer = new Slayer(this);
|
private final Slayer slayer = new Slayer(this);
|
||||||
private final PacketSender packetSender = new PacketSender(this);
|
private final PacketSender packetSender = new PacketSender(this);
|
||||||
private final DialogueHandler dialogues = new DialogueHandler(this);
|
private final DialogueHandler dialogues = new DialogueHandler(this);
|
||||||
|
|
||||||
|
private final DialogueFactoryPlugin dialogueFactory = new DialogueFactoryPlugin(this);
|
||||||
|
|
||||||
|
private Optional<DialoguePlugin> dialogue = Optional.empty();
|
||||||
|
|
||||||
|
private Optional<OptionDialoguePlugin> optionDialogue = Optional.empty();
|
||||||
|
|
||||||
|
|
||||||
private final GnomeAgility gnomeStrongHold = new GnomeAgility(this);
|
private final GnomeAgility gnomeStrongHold = new GnomeAgility(this);
|
||||||
private final WildernessAgility wildernessAgility = new WildernessAgility(this);
|
private final WildernessAgility wildernessAgility = new WildernessAgility(this);
|
||||||
private final BarbarianAgility barbarianAgility = new BarbarianAgility(this);
|
private final BarbarianAgility barbarianAgility = new BarbarianAgility(this);
|
||||||
@@ -166,6 +151,10 @@ public abstract class Player {
|
|||||||
private DoubleGates doubleGates = new DoubleGates();
|
private DoubleGates doubleGates = new DoubleGates();
|
||||||
public int lastMainFrameInterface = -1; //Possibly used in future to prevent packet exploits
|
public int lastMainFrameInterface = -1; //Possibly used in future to prevent packet exploits
|
||||||
|
|
||||||
|
public int getXPRate() { return xpRate; }
|
||||||
|
|
||||||
|
public void setXPRate(int xpRate) { this.xpRate = xpRate; }
|
||||||
|
|
||||||
public boolean isPreaching() {
|
public boolean isPreaching() {
|
||||||
return preaching;
|
return preaching;
|
||||||
}
|
}
|
||||||
@@ -495,6 +484,26 @@ public abstract class Player {
|
|||||||
|
|
||||||
private Map<Integer, TinterfaceText> interfaceText = new HashMap<Integer, TinterfaceText>();
|
private Map<Integer, TinterfaceText> interfaceText = new HashMap<Integer, TinterfaceText>();
|
||||||
|
|
||||||
|
public DialogueFactoryPlugin getDialogueFactory() {
|
||||||
|
return this.dialogueFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<DialoguePlugin> getDialogue() {
|
||||||
|
return this.dialogue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<OptionDialoguePlugin> getOptionDialogue() {
|
||||||
|
return this.optionDialogue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDialogue(Optional<DialoguePlugin> dialogue) {
|
||||||
|
this.dialogue = dialogue;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOptionDialogue(Optional<OptionDialoguePlugin> optionDialogue) {
|
||||||
|
this.optionDialogue = optionDialogue;
|
||||||
|
}
|
||||||
|
|
||||||
public class TinterfaceText {
|
public class TinterfaceText {
|
||||||
public int id;
|
public int id;
|
||||||
public String currentState;
|
public String currentState;
|
||||||
|
|||||||
@@ -17,7 +17,6 @@ import com.rs2.game.content.music.sound.SoundList;
|
|||||||
import com.rs2.game.content.randomevents.RandomEventHandler;
|
import com.rs2.game.content.randomevents.RandomEventHandler;
|
||||||
import com.rs2.game.content.skills.SkillData;
|
import com.rs2.game.content.skills.SkillData;
|
||||||
import com.rs2.game.content.skills.SkillHandler;
|
import com.rs2.game.content.skills.SkillHandler;
|
||||||
import com.rs2.game.content.skills.smithing.Superheat;
|
|
||||||
import com.rs2.game.items.GameItem;
|
import com.rs2.game.items.GameItem;
|
||||||
import com.rs2.game.items.ItemAssistant;
|
import com.rs2.game.items.ItemAssistant;
|
||||||
import com.rs2.game.items.ItemConstants;
|
import com.rs2.game.items.ItemConstants;
|
||||||
@@ -95,7 +94,7 @@ public class PlayerAssistant {
|
|||||||
|
|
||||||
public void loginScreen() {
|
public void loginScreen() {
|
||||||
player.getPacketSender().showInterface(15244);
|
player.getPacketSender().showInterface(15244);
|
||||||
player.getPacketSender().sendString("Welcome to " + GameConstants.SERVER_NAME + "\\n", 15257);
|
player.getPacketSender().sendString("Welcome to " + GameConstants.SERVER_NAME + " World: " + GameConstants.WORLD + "\\n", 15257);
|
||||||
int currentDay = player.getLastLogin() - player.lastLoginDate;
|
int currentDay = player.getLastLogin() - player.lastLoginDate;
|
||||||
|
|
||||||
if (player.playerLevel[GameConstants.HERBLORE] < 3) {
|
if (player.playerLevel[GameConstants.HERBLORE] < 3) {
|
||||||
@@ -1833,7 +1832,7 @@ public class PlayerAssistant {
|
|||||||
player.getItemAssistant().clearBank();
|
player.getItemAssistant().clearBank();
|
||||||
player.getPlayerAssistant().addStarter();
|
player.getPlayerAssistant().addStarter();
|
||||||
player.getPlayerAssistant().movePlayer(3233, 3229, 0);
|
player.getPlayerAssistant().movePlayer(3233, 3229, 0);
|
||||||
player.getPacketSender().sendMessage("Welcome to @blu@" + GameConstants.SERVER_NAME + "@bla@ - we are currently in Server Stage v@blu@" + GameConstants.TEST_VERSION + "@bla@.");
|
player.getPacketSender().sendMessage("Welcome to @blu@" + GameConstants.SERVER_NAME + " World: " + GameConstants.WORLD + "@bla@ - we are currently in Server Stage v@blu@" + GameConstants.TEST_VERSION + "@bla@.");
|
||||||
player.getPacketSender().sendMessage("@red@Did you know?@bla@ We're open source and pull requests are welcome!");
|
player.getPacketSender().sendMessage("@red@Did you know?@bla@ We're open source and pull requests are welcome!");
|
||||||
player.getPacketSender().sendMessage("Source code: github.com/2006-Scape/2006Scape");
|
player.getPacketSender().sendMessage("Source code: github.com/2006-Scape/2006Scape");
|
||||||
player.getPacketSender().sendMessage("Discord: https://discord.gg/hZ6VfWG");
|
player.getPacketSender().sendMessage("Discord: https://discord.gg/hZ6VfWG");
|
||||||
@@ -2033,7 +2032,11 @@ public class PlayerAssistant {
|
|||||||
if (player.tutorialProgress < 36 && player.playerLevel[skill] == 3 && GameConstants.TUTORIAL_ISLAND) {
|
if (player.tutorialProgress < 36 && player.playerLevel[skill] == 3 && GameConstants.TUTORIAL_ISLAND) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
amount *= GameConstants.XP_RATE;
|
if (GameConstants.VARIABLE_XP_RATE){
|
||||||
|
amount *= player.getXPRate();
|
||||||
|
} else {
|
||||||
|
amount *= GameConstants.XP_RATE;
|
||||||
|
}
|
||||||
int oldLevel = getLevelForXP(player.playerXP[skill]);
|
int oldLevel = getLevelForXP(player.playerXP[skill]);
|
||||||
player.playerXP[skill] += amount;
|
player.playerXP[skill] += amount;
|
||||||
if (oldLevel < getLevelForXP(player.playerXP[skill])) {
|
if (oldLevel < getLevelForXP(player.playerXP[skill])) {
|
||||||
|
|||||||
@@ -92,6 +92,8 @@ public class PlayerSave {
|
|||||||
case "character-rights":
|
case "character-rights":
|
||||||
player.playerRights = Integer.parseInt(token2);
|
player.playerRights = Integer.parseInt(token2);
|
||||||
break;
|
break;
|
||||||
|
case "xp-rate":
|
||||||
|
player.xpRate = Integer.parseInt(token2);
|
||||||
case "last-ip":
|
case "last-ip":
|
||||||
player.lastConnectedFrom = token2;
|
player.lastConnectedFrom = token2;
|
||||||
break;
|
break;
|
||||||
@@ -593,6 +595,8 @@ public class PlayerSave {
|
|||||||
characterfile.newLine();
|
characterfile.newLine();
|
||||||
characterfile.write("character-rights = " + player.playerRights);
|
characterfile.write("character-rights = " + player.playerRights);
|
||||||
characterfile.newLine();
|
characterfile.newLine();
|
||||||
|
characterfile.write("xp-rate = " + player.xpRate);
|
||||||
|
characterfile.newLine();
|
||||||
characterfile.write("last-ip = " + player.connectedFrom);
|
characterfile.write("last-ip = " + player.connectedFrom);
|
||||||
characterfile.newLine();
|
characterfile.newLine();
|
||||||
characterfile.write("isBot = " + player.isBot);
|
characterfile.write("isBot = " + player.isBot);
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class PlayersOnlineWebsite {
|
|||||||
|
|
||||||
private static void setWebsitePlayersOnline(int amount) throws IOException {
|
private static void setWebsitePlayersOnline(int amount) throws IOException {
|
||||||
URL url;
|
URL url;
|
||||||
url = new URL(GameConstants.WEBSITE_LINK + "/playersonline.php?pass=" + password + "&amount=" + amount);
|
url = new URL(GameConstants.WEBSITE_LINK + "/playersonline.php?pass=" + password + "&amount=" + amount + "&world=" + GameConstants.WORLD);
|
||||||
url.openStream().close();
|
url.openStream().close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ public class RegisteredAccsWebsite {
|
|||||||
|
|
||||||
private static void setAccountsRegistered(int amount) throws IOException {
|
private static void setAccountsRegistered(int amount) throws IOException {
|
||||||
URL url;
|
URL url;
|
||||||
url = new URL(GameConstants.WEBSITE_LINK + "/accountsregistered.php?pass=" + password + "&amount=" + amount);
|
url = new URL(GameConstants.WEBSITE_LINK + "/accountsregistered.php?pass=" + password + "&amount=" + amount + "&world=" + GameConstants.WORLD);
|
||||||
url.openStream().close();
|
url.openStream().close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
package com.rs2.integrations.discord;
|
package com.rs2.integrations.discord;
|
||||||
|
|
||||||
import com.rs2.GameConstants;
|
import com.rs2.GameConstants;
|
||||||
|
import com.rs2.integrations.discord.commands.*;
|
||||||
|
import com.rs2.integrations.discord.commands.admin.GameKick;
|
||||||
|
import com.rs2.integrations.discord.commands.admin.MoveHome;
|
||||||
|
import com.rs2.integrations.discord.commands.admin.Update;
|
||||||
import org.javacord.api.DiscordApi;
|
import org.javacord.api.DiscordApi;
|
||||||
import org.javacord.api.DiscordApiBuilder;
|
import org.javacord.api.DiscordApiBuilder;
|
||||||
import org.javacord.api.entity.channel.TextChannel;
|
import org.javacord.api.entity.channel.TextChannel;
|
||||||
import org.javacord.api.entity.message.MessageBuilder;
|
import org.javacord.api.entity.message.MessageBuilder;
|
||||||
import org.javacord.api.util.logging.ExceptionLogger;
|
import org.javacord.api.util.logging.ExceptionLogger;
|
||||||
import com.rs2.integrations.discord.commands.*;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
@@ -17,6 +20,7 @@ import java.io.IOException;
|
|||||||
public class JavaCord {
|
public class JavaCord {
|
||||||
|
|
||||||
public static String serverName = GameConstants.SERVER_NAME;
|
public static String serverName = GameConstants.SERVER_NAME;
|
||||||
|
public static String commandPrefix = "::w" + GameConstants.WORLD;
|
||||||
public static String token;
|
public static String token;
|
||||||
public static DiscordApi api = null;
|
public static DiscordApi api = null;
|
||||||
|
|
||||||
@@ -34,19 +38,14 @@ public class JavaCord {
|
|||||||
api.addListener(new Players());
|
api.addListener(new Players());
|
||||||
api.addListener(new Vote());
|
api.addListener(new Vote());
|
||||||
api.addListener(new Website());
|
api.addListener(new Website());
|
||||||
|
//Admin Commands
|
||||||
|
api.addListener(new GameKick());
|
||||||
|
api.addListener(new MoveHome());
|
||||||
|
api.addListener(new Update());
|
||||||
if(!DiscordActivity.playerCount) {
|
if(!DiscordActivity.playerCount) {
|
||||||
api.updateActivity(GameConstants.WEBSITE_LINK);
|
api.updateActivity(GameConstants.WEBSITE_LINK);
|
||||||
}
|
}
|
||||||
api.addMessageCreateListener(event -> {
|
api.addMessageCreateListener(event -> {
|
||||||
|
|
||||||
if (event.getMessageContent().startsWith("::movehome")) {
|
|
||||||
if (event.getMessageAuthor().isServerAdmin()) {
|
|
||||||
System.out.println("perms");
|
|
||||||
event.getChannel().sendMessage("perms");
|
|
||||||
} else {
|
|
||||||
event.getChannel().sendMessage("You do not have permission to preform this command");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.rs2.integrations.discord.commands;
|
package com.rs2.integrations.discord.commands;
|
||||||
|
|
||||||
|
import com.rs2.integrations.discord.JavaCord;
|
||||||
import org.javacord.api.entity.message.Message;
|
import org.javacord.api.entity.message.Message;
|
||||||
import org.javacord.api.event.message.MessageCreateEvent;
|
import org.javacord.api.event.message.MessageCreateEvent;
|
||||||
import org.javacord.api.listener.message.MessageCreateListener;
|
import org.javacord.api.listener.message.MessageCreateListener;
|
||||||
@@ -8,22 +9,20 @@ public class Commands implements MessageCreateListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onMessageCreate(MessageCreateEvent event) {
|
public void onMessageCreate(MessageCreateEvent event) {
|
||||||
Message message = event.getMessage();
|
Message message = event.getMessage();
|
||||||
if (message.getContent().equalsIgnoreCase("::commands")) {
|
if (message.getContent().equalsIgnoreCase(JavaCord.commandPrefix + " commands")) {
|
||||||
event.getChannel().sendMessage("```fix"
|
event.getChannel().sendMessage("```fix"
|
||||||
+ System.lineSeparator() +
|
+ System.lineSeparator() +
|
||||||
"::forum/::forums"
|
JavaCord.commandPrefix + " forum/" + JavaCord.commandPrefix + " forums"
|
||||||
+ System.lineSeparator() +
|
+ System.lineSeparator() +
|
||||||
"::hiscores/::highscores"
|
JavaCord.commandPrefix + " hiscores/" + JavaCord.commandPrefix + " highscores"
|
||||||
+ System.lineSeparator() +
|
+ System.lineSeparator() +
|
||||||
"::issues/::bugs"
|
JavaCord.commandPrefix + " issues/" + JavaCord.commandPrefix + " bugs"
|
||||||
+ System.lineSeparator() +
|
+ System.lineSeparator() +
|
||||||
"::online"
|
JavaCord.commandPrefix + " online"
|
||||||
+ System.lineSeparator() +
|
+ System.lineSeparator() +
|
||||||
"::players"
|
JavaCord.commandPrefix + " vote"
|
||||||
+ System.lineSeparator() +
|
+ System.lineSeparator() +
|
||||||
"::vote"
|
JavaCord.commandPrefix + " website/" + JavaCord.commandPrefix + " site"
|
||||||
+ System.lineSeparator() +
|
|
||||||
"::website/::site"
|
|
||||||
+ "```");
|
+ "```");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.rs2.integrations.discord.commands;
|
package com.rs2.integrations.discord.commands;
|
||||||
|
|
||||||
|
import com.rs2.integrations.discord.JavaCord;
|
||||||
import org.javacord.api.entity.message.Message;
|
import org.javacord.api.entity.message.Message;
|
||||||
import org.javacord.api.event.message.MessageCreateEvent;
|
import org.javacord.api.event.message.MessageCreateEvent;
|
||||||
import org.javacord.api.listener.message.MessageCreateListener;
|
import org.javacord.api.listener.message.MessageCreateListener;
|
||||||
@@ -10,7 +11,7 @@ public class Forum implements MessageCreateListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onMessageCreate(MessageCreateEvent event) {
|
public void onMessageCreate(MessageCreateEvent event) {
|
||||||
Message message = event.getMessage();
|
Message message = event.getMessage();
|
||||||
if (message.getContent().equalsIgnoreCase("::forum") || message.getContent().equalsIgnoreCase("::forums")) {
|
if (message.getContent().equalsIgnoreCase(JavaCord.commandPrefix + " forum") || message.getContent().equalsIgnoreCase(JavaCord.commandPrefix + " forums")) {
|
||||||
event.getChannel().sendMessage(GameConstants.WEBSITE_LINK + "/forums/index.php");
|
event.getChannel().sendMessage(GameConstants.WEBSITE_LINK + "/forums/index.php");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.rs2.integrations.discord.commands;
|
package com.rs2.integrations.discord.commands;
|
||||||
|
|
||||||
|
import com.rs2.integrations.discord.JavaCord;
|
||||||
import org.javacord.api.entity.message.Message;
|
import org.javacord.api.entity.message.Message;
|
||||||
import org.javacord.api.event.message.MessageCreateEvent;
|
import org.javacord.api.event.message.MessageCreateEvent;
|
||||||
import org.javacord.api.listener.message.MessageCreateListener;
|
import org.javacord.api.listener.message.MessageCreateListener;
|
||||||
@@ -10,7 +11,7 @@ public class Hiscores implements MessageCreateListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onMessageCreate(MessageCreateEvent event) {
|
public void onMessageCreate(MessageCreateEvent event) {
|
||||||
Message message = event.getMessage();
|
Message message = event.getMessage();
|
||||||
if (message.getContent().equalsIgnoreCase("::hiscores") || message.getContent().equalsIgnoreCase("::highscores")) {
|
if (message.getContent().equalsIgnoreCase(JavaCord.commandPrefix + " hiscores") || message.getContent().equalsIgnoreCase(JavaCord.commandPrefix + " highscores")) {
|
||||||
event.getChannel().sendMessage(GameConstants.WEBSITE_LINK + "/hiscores.html");
|
event.getChannel().sendMessage(GameConstants.WEBSITE_LINK + "/hiscores.html");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.rs2.integrations.discord.commands;
|
package com.rs2.integrations.discord.commands;
|
||||||
|
|
||||||
|
import com.rs2.integrations.discord.JavaCord;
|
||||||
import org.javacord.api.entity.message.Message;
|
import org.javacord.api.entity.message.Message;
|
||||||
import org.javacord.api.event.message.MessageCreateEvent;
|
import org.javacord.api.event.message.MessageCreateEvent;
|
||||||
import org.javacord.api.listener.message.MessageCreateListener;
|
import org.javacord.api.listener.message.MessageCreateListener;
|
||||||
@@ -8,7 +9,7 @@ public class Issues implements MessageCreateListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onMessageCreate(MessageCreateEvent event) {
|
public void onMessageCreate(MessageCreateEvent event) {
|
||||||
Message message = event.getMessage();
|
Message message = event.getMessage();
|
||||||
if (message.getContent().equalsIgnoreCase("::issues") || message.getContent().equalsIgnoreCase("::bugs")) {
|
if (message.getContent().equalsIgnoreCase(JavaCord.commandPrefix + " issues") || message.getContent().equalsIgnoreCase(JavaCord.commandPrefix+ " bugs")) {
|
||||||
event.getChannel().sendMessage("https://github.com/2006-Scape/2006Scape/issues");
|
event.getChannel().sendMessage("https://github.com/2006-Scape/2006Scape/issues");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.rs2.integrations.discord.commands;
|
package com.rs2.integrations.discord.commands;
|
||||||
|
|
||||||
|
import com.rs2.GameConstants;
|
||||||
import org.javacord.api.entity.message.Message;
|
import org.javacord.api.entity.message.Message;
|
||||||
import org.javacord.api.event.message.MessageCreateEvent;
|
import org.javacord.api.event.message.MessageCreateEvent;
|
||||||
import org.javacord.api.listener.message.MessageCreateListener;
|
import org.javacord.api.listener.message.MessageCreateListener;
|
||||||
@@ -10,8 +11,8 @@ public class Online implements MessageCreateListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onMessageCreate(MessageCreateEvent event) {
|
public void onMessageCreate(MessageCreateEvent event) {
|
||||||
Message message = event.getMessage();
|
Message message = event.getMessage();
|
||||||
if (message.getContent().equalsIgnoreCase("::online")) {
|
if (message.getContent().equalsIgnoreCase(JavaCord.commandPrefix + " online")) {
|
||||||
event.getChannel().sendMessage(":tada: " + JavaCord.serverName + " is Online! :tada:");
|
event.getChannel().sendMessage(":tada: " + JavaCord.serverName + " World:" + GameConstants.WORLD + " is Online! :tada:");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,16 @@
|
|||||||
package com.rs2.integrations.discord.commands;
|
package com.rs2.integrations.discord.commands;
|
||||||
|
|
||||||
|
import com.rs2.game.players.PlayerHandler;
|
||||||
|
import com.rs2.integrations.discord.JavaCord;
|
||||||
import org.javacord.api.entity.message.Message;
|
import org.javacord.api.entity.message.Message;
|
||||||
import org.javacord.api.event.message.MessageCreateEvent;
|
import org.javacord.api.event.message.MessageCreateEvent;
|
||||||
import org.javacord.api.listener.message.MessageCreateListener;
|
import org.javacord.api.listener.message.MessageCreateListener;
|
||||||
|
|
||||||
import com.rs2.game.players.PlayerHandler;
|
|
||||||
|
|
||||||
public class Players implements MessageCreateListener {
|
public class Players implements MessageCreateListener {
|
||||||
@Override
|
@Override
|
||||||
public void onMessageCreate(MessageCreateEvent event) {
|
public void onMessageCreate(MessageCreateEvent event) {
|
||||||
Message message = event.getMessage();
|
Message message = event.getMessage();
|
||||||
if (message.getContent().equalsIgnoreCase("::players")) {
|
if (message.getContent().equalsIgnoreCase(JavaCord.commandPrefix + " players")) {
|
||||||
if (PlayerHandler.getPlayerCount() != 1) {
|
if (PlayerHandler.getPlayerCount() != 1) {
|
||||||
event.getChannel().sendMessage("There are currently " + PlayerHandler.getPlayerCount() + " players online (" + PlayerHandler.getNonPlayerCount() + " staff online).");
|
event.getChannel().sendMessage("There are currently " + PlayerHandler.getPlayerCount() + " players online (" + PlayerHandler.getNonPlayerCount() + " staff online).");
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.rs2.integrations.discord.commands;
|
package com.rs2.integrations.discord.commands;
|
||||||
|
|
||||||
|
import com.rs2.integrations.discord.JavaCord;
|
||||||
import org.javacord.api.entity.message.Message;
|
import org.javacord.api.entity.message.Message;
|
||||||
import org.javacord.api.event.message.MessageCreateEvent;
|
import org.javacord.api.event.message.MessageCreateEvent;
|
||||||
import org.javacord.api.listener.message.MessageCreateListener;
|
import org.javacord.api.listener.message.MessageCreateListener;
|
||||||
@@ -10,7 +11,7 @@ public class Vote implements MessageCreateListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onMessageCreate(MessageCreateEvent event) {
|
public void onMessageCreate(MessageCreateEvent event) {
|
||||||
Message message = event.getMessage();
|
Message message = event.getMessage();
|
||||||
if (message.getContent().equalsIgnoreCase("::vote")) {
|
if (message.getContent().equalsIgnoreCase(JavaCord.commandPrefix + " vote")) {
|
||||||
event.getChannel().sendMessage("Visit " + GameConstants.WEBSITE_LINK + "/vote.html then type \"::claimvote\" in-game to receive your reward!");
|
event.getChannel().sendMessage("Visit " + GameConstants.WEBSITE_LINK + "/vote.html then type \"::claimvote\" in-game to receive your reward!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.rs2.integrations.discord.commands;
|
package com.rs2.integrations.discord.commands;
|
||||||
|
|
||||||
|
import com.rs2.integrations.discord.JavaCord;
|
||||||
import org.javacord.api.entity.message.Message;
|
import org.javacord.api.entity.message.Message;
|
||||||
import org.javacord.api.event.message.MessageCreateEvent;
|
import org.javacord.api.event.message.MessageCreateEvent;
|
||||||
import org.javacord.api.listener.message.MessageCreateListener;
|
import org.javacord.api.listener.message.MessageCreateListener;
|
||||||
@@ -10,7 +11,7 @@ public class Website implements MessageCreateListener {
|
|||||||
@Override
|
@Override
|
||||||
public void onMessageCreate(MessageCreateEvent event) {
|
public void onMessageCreate(MessageCreateEvent event) {
|
||||||
Message message = event.getMessage();
|
Message message = event.getMessage();
|
||||||
if (message.getContent().equalsIgnoreCase("::website") || message.getContent().equalsIgnoreCase("::site")) {
|
if (message.getContent().equalsIgnoreCase(JavaCord.commandPrefix + " website") || message.getContent().equalsIgnoreCase(JavaCord.commandPrefix + " site")) {
|
||||||
event.getChannel().sendMessage(GameConstants.WEBSITE_LINK);
|
event.getChannel().sendMessage(GameConstants.WEBSITE_LINK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+32
@@ -0,0 +1,32 @@
|
|||||||
|
package com.rs2.integrations.discord.commands.admin;
|
||||||
|
|
||||||
|
import com.rs2.game.players.Client;
|
||||||
|
import com.rs2.game.players.Player;
|
||||||
|
import com.rs2.game.players.PlayerHandler;
|
||||||
|
import com.rs2.integrations.discord.JavaCord;
|
||||||
|
import org.javacord.api.event.message.MessageCreateEvent;
|
||||||
|
import org.javacord.api.listener.message.MessageCreateListener;
|
||||||
|
|
||||||
|
public class GameKick implements MessageCreateListener {
|
||||||
|
@Override
|
||||||
|
public void onMessageCreate(MessageCreateEvent event) {
|
||||||
|
if (event.getMessageContent().startsWith(JavaCord.commandPrefix + " gamekick")) {
|
||||||
|
if (event.getMessageAuthor().isServerAdmin()) {
|
||||||
|
String playerToKick = event.getMessageContent().replace( JavaCord.commandPrefix + " gamekick ", "");
|
||||||
|
for (Player player2 : PlayerHandler.players) {
|
||||||
|
if (player2 != null) {
|
||||||
|
if (player2.playerName.equalsIgnoreCase(playerToKick)) {
|
||||||
|
Client c2 = (Client) player2;
|
||||||
|
event.getChannel().sendMessage( playerToKick+ " was kicked by " + event.getMessageAuthor().getDisplayName() + ".");
|
||||||
|
c2.disconnected = true;
|
||||||
|
c2.logout(true);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getChannel().sendMessage("You do not have permission to perform this command");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+31
@@ -0,0 +1,31 @@
|
|||||||
|
package com.rs2.integrations.discord.commands.admin;
|
||||||
|
|
||||||
|
import com.rs2.GameConstants;
|
||||||
|
import com.rs2.game.players.Client;
|
||||||
|
import com.rs2.game.players.PlayerHandler;
|
||||||
|
import com.rs2.integrations.discord.JavaCord;
|
||||||
|
import org.javacord.api.event.message.MessageCreateEvent;
|
||||||
|
import org.javacord.api.listener.message.MessageCreateListener;
|
||||||
|
|
||||||
|
public class MoveHome implements MessageCreateListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMessageCreate(MessageCreateEvent event) {
|
||||||
|
if (event.getMessageContent().startsWith(JavaCord.commandPrefix + " movehome")) {
|
||||||
|
if (event.getMessageAuthor().isServerAdmin()) {
|
||||||
|
String teleToMe = event.getMessageContent().replace( JavaCord.commandPrefix + " movehome ", "");
|
||||||
|
for (int i = 0; i < PlayerHandler.players.length; i++) {
|
||||||
|
if (PlayerHandler.players[i] != null) {
|
||||||
|
if (PlayerHandler.players[i].playerName.equalsIgnoreCase(teleToMe)) {
|
||||||
|
Client p = (Client) PlayerHandler.players[i];
|
||||||
|
event.getChannel().sendMessage(p.playerName + " has been moved to Lumbridge.");
|
||||||
|
p.getPlayerAssistant().movePlayer(GameConstants.RESPAWN_X, GameConstants.RESPAWN_Y, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getChannel().sendMessage("You do not have permission to perform this command");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+24
@@ -0,0 +1,24 @@
|
|||||||
|
package com.rs2.integrations.discord.commands.admin;
|
||||||
|
|
||||||
|
import com.rs2.game.players.PlayerHandler;
|
||||||
|
import com.rs2.integrations.discord.JavaCord;
|
||||||
|
import org.javacord.api.event.message.MessageCreateEvent;
|
||||||
|
import org.javacord.api.listener.message.MessageCreateListener;
|
||||||
|
|
||||||
|
public class Update implements MessageCreateListener {
|
||||||
|
@Override
|
||||||
|
public void onMessageCreate(MessageCreateEvent event) {
|
||||||
|
if(event.getMessageAuthor().isServerAdmin()) {
|
||||||
|
String seconds = event.getMessageContent().replace(JavaCord.commandPrefix + " update ", "");
|
||||||
|
if (event.getMessageContent().startsWith(JavaCord.commandPrefix + " update")) {
|
||||||
|
PlayerHandler.updateSeconds = Integer.parseInt(seconds);
|
||||||
|
PlayerHandler.updateAnnounced = false;
|
||||||
|
PlayerHandler.updateRunning = true;
|
||||||
|
PlayerHandler.updateStartTime = System.currentTimeMillis();
|
||||||
|
event.getChannel().sendMessage("Server update will begin in " + seconds + " seconds.");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
event.getChannel().sendMessage("You do not have permission to perform this command");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -116,7 +116,7 @@ public class PacketSender {
|
|||||||
if (player.tutorialProgress > 35) {
|
if (player.tutorialProgress > 35) {
|
||||||
player.getPlayerAssistant().sendSidebars();
|
player.getPlayerAssistant().sendSidebars();
|
||||||
Weight.updateWeight(player);
|
Weight.updateWeight(player);
|
||||||
player.getPacketSender().sendMessage("Welcome to @blu@" + GameConstants.SERVER_NAME + "@bla@ - we are currently in Server Stage v@blu@" + GameConstants.TEST_VERSION + "@bla@.");
|
player.getPacketSender().sendMessage("Welcome to @blu@" + GameConstants.SERVER_NAME + " World: " + GameConstants.WORLD + "@bla@ - we are currently in Server Stage v@blu@" + GameConstants.TEST_VERSION + "@bla@.");
|
||||||
player.getPacketSender().sendMessage("@red@Did you know?@bla@ We're open source! Pull requests are welcome");
|
player.getPacketSender().sendMessage("@red@Did you know?@bla@ We're open source! Pull requests are welcome");
|
||||||
player.getPacketSender().sendMessage("Source code at github.com/2006-Scape/2006Scape");
|
player.getPacketSender().sendMessage("Source code at github.com/2006-Scape/2006Scape");
|
||||||
player.getPacketSender().sendMessage("Join our Discord: https://discord.gg/hZ6VfWG");
|
player.getPacketSender().sendMessage("Join our Discord: https://discord.gg/hZ6VfWG");
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
package com.rs2.net.packets;
|
package com.rs2.net.packets;
|
||||||
|
|
||||||
import com.rs2.GameConstants;
|
import com.rs2.GameConstants;
|
||||||
import com.rs2.game.dialogues.Dialogue;
|
import com.rs2.net.packets.impl.DialoguePacket;
|
||||||
import com.rs2.game.players.Player;
|
import com.rs2.game.players.Player;
|
||||||
import com.rs2.net.packets.impl.AttackPlayer;
|
import com.rs2.net.packets.impl.AttackPlayer;
|
||||||
import com.rs2.net.packets.impl.Bank10;
|
import com.rs2.net.packets.impl.Bank10;
|
||||||
@@ -73,7 +73,7 @@ public class PacketHandler {
|
|||||||
packetId[150] = u;
|
packetId[150] = u;
|
||||||
packetId[120] = new ClickTab();
|
packetId[120] = new ClickTab();
|
||||||
packetId[14] = new ItemOnPlayer();
|
packetId[14] = new ItemOnPlayer();
|
||||||
packetId[40] = new Dialogue();
|
packetId[40] = new DialoguePacket();
|
||||||
ClickObject co = new ClickObject();
|
ClickObject co = new ClickObject();
|
||||||
packetId[132] = co;
|
packetId[132] = co;
|
||||||
packetId[252] = co;
|
packetId[252] = co;
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ public class ClickingButtons implements PacketType {
|
|||||||
SilverCrafting.makeSilver(player, actionButtonId, 0);
|
SilverCrafting.makeSilver(player, actionButtonId, 0);
|
||||||
Climbing.handleLadderButtons(player, actionButtonId);
|
Climbing.handleLadderButtons(player, actionButtonId);
|
||||||
Specials.specialClicking(player, actionButtonId);
|
Specials.specialClicking(player, actionButtonId);
|
||||||
DialogueOptions.handleDialogueOptions(player, actionButtonId);
|
//DialogueOptions.handleDialogueOptions(player, actionButtonId);
|
||||||
DairyChurn.churnItem(player, actionButtonId);
|
DairyChurn.churnItem(player, actionButtonId);
|
||||||
if (EnchantStaff.staffButtons(player, actionButtonId)) {
|
if (EnchantStaff.staffButtons(player, actionButtonId)) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import com.rs2.Connection;
|
|||||||
import com.rs2.GameConstants;
|
import com.rs2.GameConstants;
|
||||||
import com.rs2.GameEngine;
|
import com.rs2.GameEngine;
|
||||||
import com.rs2.game.bots.BotHandler;
|
import com.rs2.game.bots.BotHandler;
|
||||||
import com.rs2.game.content.combat.magic.SpellTeleport;
|
|
||||||
import com.rs2.game.npcs.NpcHandler;
|
import com.rs2.game.npcs.NpcHandler;
|
||||||
import com.rs2.game.players.*;
|
import com.rs2.game.players.*;
|
||||||
import com.rs2.game.players.antimacro.AntiSpam;
|
import com.rs2.game.players.antimacro.AntiSpam;
|
||||||
@@ -45,6 +44,34 @@ public class Commands implements PacketType {
|
|||||||
|
|
||||||
public static void playerCommands(Player player, String playerCommand, String[] arguments) {
|
public static void playerCommands(Player player, String playerCommand, String[] arguments) {
|
||||||
switch (playerCommand.toLowerCase()) {
|
switch (playerCommand.toLowerCase()) {
|
||||||
|
case "myxprate":
|
||||||
|
case "checkxprate":
|
||||||
|
if(GameConstants.VARIABLE_XP_RATE) {
|
||||||
|
player.getPacketSender().sendMessage("Your current XP rate is x" + player.getXPRate());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case "xprate":
|
||||||
|
if(GameConstants.VARIABLE_XP_RATE) {
|
||||||
|
if (player.getXPRate() == GameConstants.VARIABLE_XP_RATES[0]) {
|
||||||
|
player.getDialogueHandler().sendDialogues(10005, 2244);
|
||||||
|
return;
|
||||||
|
} else if (player.getXPRate() == GameConstants.VARIABLE_XP_RATES[1]) {
|
||||||
|
player.getDialogueHandler().sendDialogues(10006, 2244);
|
||||||
|
return;
|
||||||
|
} else if (player.getXPRate() == GameConstants.VARIABLE_XP_RATES[2]) {
|
||||||
|
player.getDialogueHandler().sendDialogues(10007, 2244);
|
||||||
|
return;
|
||||||
|
} else if (player.getXPRate() == GameConstants.VARIABLE_XP_RATES[3]) {
|
||||||
|
player.getPacketSender().sendMessage("You already have the highest XP rate.");
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
player.getDialogueHandler().sendDialogues(10001, 2244);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
player.getPacketSender().sendMessage("You can't use this command in this world.");
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "toggleyell":
|
case "toggleyell":
|
||||||
case "tglyell":
|
case "tglyell":
|
||||||
case "hideyell":
|
case "hideyell":
|
||||||
@@ -257,9 +284,6 @@ public class Commands implements PacketType {
|
|||||||
"::loc, ::pos, ::coord",
|
"::loc, ::pos, ::coord",
|
||||||
"Get your current world position",
|
"Get your current world position",
|
||||||
"",
|
"",
|
||||||
"::stuck",
|
|
||||||
"Return to Lumbridge when stuck",
|
|
||||||
"",
|
|
||||||
"::randomtoggle",
|
"::randomtoggle",
|
||||||
"Enable/Disable random events",
|
"Enable/Disable random events",
|
||||||
"",
|
"",
|
||||||
@@ -280,6 +304,8 @@ public class Commands implements PacketType {
|
|||||||
"",
|
"",
|
||||||
"::snow",
|
"::snow",
|
||||||
"Add some snow in your mainscreen(works only in december)",
|
"Add some snow in your mainscreen(works only in december)",
|
||||||
|
(GameConstants.VARIABLE_XP_RATE ? "\\n" + "::xprate\\n" + "Opens dialogue for the player to set/increase their XP rate." : ""),
|
||||||
|
(GameConstants.VARIABLE_XP_RATE ? "\\n" + "::checkxprate(::myxprate)\\n" + "Displays the players currently set XP rate." : ""),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Clear all lines
|
// Clear all lines
|
||||||
@@ -294,17 +320,6 @@ public class Commands implements PacketType {
|
|||||||
}
|
}
|
||||||
player.getPacketSender().showInterface(8134);
|
player.getPacketSender().showInterface(8134);
|
||||||
break;
|
break;
|
||||||
case "stuck":
|
|
||||||
if (player.getCombatAssistant().inCombat()) {
|
|
||||||
player.getPacketSender().sendMessage("You cannot do that while in combat.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
player.getPlayerAssistant().movePlayer(SpellTeleport.LUMBRIDGE.getDestX(), SpellTeleport.LUMBRIDGE.getDestY(), 0);
|
|
||||||
player.getPacketSender().sendMessage("How did you manage that one...");
|
|
||||||
player.getPacketSender().sendMessage("If it's bug related, please report on Github/Discord!");
|
|
||||||
player.gfx100(80);
|
|
||||||
player.startAnimation(404);
|
|
||||||
break;
|
|
||||||
case "randomtoggle":
|
case "randomtoggle":
|
||||||
case "togglerandom":
|
case "togglerandom":
|
||||||
case "random":
|
case "random":
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.rs2.net.packets.impl;
|
||||||
|
|
||||||
|
import com.rs2.game.players.Player;
|
||||||
|
import com.rs2.net.packets.PacketType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Dialogue Packet
|
||||||
|
**/
|
||||||
|
|
||||||
|
public class DialoguePacket implements PacketType {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void processPacket(Player player, int packetType, int packetSize) {
|
||||||
|
/*
|
||||||
|
TODO: Remove the below dialogue handler code when everything has been converted over
|
||||||
|
to the new system. Expect to see flickering in some Astraeus Dialogues as the old
|
||||||
|
dialogue handler activates before it.
|
||||||
|
*/
|
||||||
|
/*if (player.nextChat > 0) {
|
||||||
|
player.getDialogueHandler().sendDialogues(player.nextChat, player.talkingNpc);
|
||||||
|
} else {
|
||||||
|
player.getDialogueHandler().sendDialogues(0, -1);
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// New Dialogue System
|
||||||
|
player.getDialogueFactory().execute();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,27 +5,33 @@ import java.util.ArrayList;
|
|||||||
|
|
||||||
public class Misc {
|
public class Misc {
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* String Functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static final char playerNameXlateTable[] = { '_', 'a', 'b', 'c',
|
||||||
|
'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
|
||||||
|
'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2',
|
||||||
|
'3', '4', '5', '6', '7', '8', '9', '[', ']', '/', '-', ' '
|
||||||
|
};
|
||||||
|
|
||||||
|
public static char xlateTable[] = { ' ', 'e', 't', 'a', 'o', 'i', 'h', 'n',
|
||||||
|
's', 'r', 'd', 'l', 'u', 'm', 'w', 'c', 'y', 'f', 'g', 'p', 'b',
|
||||||
|
'v', 'k', 'x', 'j', 'q', 'z', '0', '1', '2', '3', '4', '5', '6',
|
||||||
|
'7', '8', '9', ' ', '!', '?', '.', ',', ':', ';', '(', ')', '-',
|
||||||
|
'&', '*', '\\', '\'', '@', '#', '+', '=', '\243', '$', '%', '"',
|
||||||
|
'[', ']'
|
||||||
|
};
|
||||||
|
|
||||||
public static String formatPlayerName(String str) {
|
public static String formatPlayerName(String str) {
|
||||||
str = ucFirst(str);
|
str = ucFirst(str);
|
||||||
str.replace("_", " ");
|
str.replace("_", " ");
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int random(final float range) {
|
public static String format(int num) {
|
||||||
return (int) (java.lang.Math.random() * (range + 1));
|
return NumberFormat.getInstance().format(num);
|
||||||
}
|
|
||||||
|
|
||||||
// return a random number from 0 → range - 1
|
|
||||||
public static int randomMinusOne(int range) {
|
|
||||||
return (int) Math.random() * range;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double distance(int x1, int y1, int x2, int y2 ) {
|
|
||||||
return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean goodDistance(int objectX, int objectY, int playerX, int playerY, int distance) {
|
|
||||||
return objectX - playerX <= distance && objectX - playerX >= -distance && objectY - playerY <= distance && objectY - playerY >= -distance;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String longToReportPlayerName(long l) {
|
public static String longToReportPlayerName(long l) {
|
||||||
@@ -39,14 +45,6 @@ public class Misc {
|
|||||||
return new String(ac, 12 - i, i);
|
return new String(ac, 12 - i, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int random3(int range) {
|
|
||||||
return (int) (java.lang.Math.random() * range);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int randomNumber(int range) {
|
|
||||||
return (int) (Math.random() * range);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String longToPlayerName(long l) {
|
public static String longToPlayerName(long l) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
char ac[] = new char[12];
|
char ac[] = new char[12];
|
||||||
@@ -60,11 +58,6 @@ public class Misc {
|
|||||||
return new String(ac, 12 - i, i);
|
return new String(ac, 12 - i, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final char playerNameXlateTable[] = { '_', 'a', 'b', 'c',
|
|
||||||
'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p',
|
|
||||||
'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', '0', '1', '2',
|
|
||||||
'3', '4', '5', '6', '7', '8', '9', '[', ']', '/', '-', ' ' };
|
|
||||||
|
|
||||||
public static String longToPlayerName2(long l) {
|
public static String longToPlayerName2(long l) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
char ac[] = new char[99];
|
char ac[] = new char[99];
|
||||||
@@ -76,10 +69,6 @@ public class Misc {
|
|||||||
return new String(ac, 12 - i, i);
|
return new String(ac, 12 - i, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String format(int num) {
|
|
||||||
return NumberFormat.getInstance().format(num);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String ucFirst(String str) {
|
public static String ucFirst(String str) {
|
||||||
str = str.toLowerCase();
|
str = str.toLowerCase();
|
||||||
if (str.length() > 1) {
|
if (str.length() > 1) {
|
||||||
@@ -124,63 +113,6 @@ public class Misc {
|
|||||||
}
|
}
|
||||||
return temp.toUpperCase().trim();
|
return temp.toUpperCase().trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int hexToInt(byte data[], int offset, int len) {
|
|
||||||
int temp = 0;
|
|
||||||
int i = 1000;
|
|
||||||
for (int cntr = 0; cntr < len; cntr++) {
|
|
||||||
int num = (data[offset + cntr] & 0xFF) * i;
|
|
||||||
temp += num;
|
|
||||||
if (i > 1) {
|
|
||||||
i = i / 1000;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return temp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int random2(int range) {
|
|
||||||
return (int) (java.lang.Math.random() * range + 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// return a random number from 0 → range (including range)
|
|
||||||
public static int random(int range) {
|
|
||||||
return (int) (java.lang.Math.random() * (++range));
|
|
||||||
}
|
|
||||||
|
|
||||||
// return a random number between & including the min/max values
|
|
||||||
public static int random(int min, int max) {
|
|
||||||
++max;
|
|
||||||
return (int) Math.floor(Math.random() * (max - min)) + min;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int randomArrayItem(int[] arr) {
|
|
||||||
return arr[(int) Math.floor(Math.random() * arr.length)];
|
|
||||||
}
|
|
||||||
|
|
||||||
public static int randomArrayListItem(ArrayList<Integer> arr) {
|
|
||||||
int index = (int) Math.floor(Math.random() * arr.size());
|
|
||||||
return arr.get(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static long playerNameToInt64(String s) {
|
|
||||||
long l = 0L;
|
|
||||||
for (int i = 0; i < s.length(); i++) {
|
|
||||||
char c = s.charAt(i);
|
|
||||||
l *= 37L;
|
|
||||||
if (c >= 'A' && c <= 'Z') {
|
|
||||||
l += 1 + c - 65;
|
|
||||||
} else if (c >= 'a' && c <= 'z') {
|
|
||||||
l += 1 + c - 97;
|
|
||||||
} else if (c >= '0' && c <= '9') {
|
|
||||||
l += 27 + c - 48;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
while (l % 37L == 0L && l != 0L) {
|
|
||||||
l /= 37L;
|
|
||||||
}
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static char decodeBuf[] = new char[4096];
|
private static char decodeBuf[] = new char[4096];
|
||||||
|
|
||||||
public static String textUnpack(byte packedData[], int size) {
|
public static String textUnpack(byte packedData[], int size) {
|
||||||
@@ -258,12 +190,126 @@ public class Misc {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static char xlateTable[] = { ' ', 'e', 't', 'a', 'o', 'i', 'h', 'n',
|
public static String capitalize(String s) {
|
||||||
's', 'r', 'd', 'l', 'u', 'm', 'w', 'c', 'y', 'f', 'g', 'p', 'b',
|
for (int i = 0; i < s.length(); i++) {
|
||||||
'v', 'k', 'x', 'j', 'q', 'z', '0', '1', '2', '3', '4', '5', '6',
|
if (i == 0) {
|
||||||
'7', '8', '9', ' ', '!', '?', '.', ',', ':', ';', '(', ')', '-',
|
s = String.format("%s%s", Character.toUpperCase(s.charAt(0)),
|
||||||
'&', '*', '\\', '\'', '@', '#', '+', '=', '\243', '$', '%', '"',
|
s.substring(1));
|
||||||
'[', ']' };
|
}
|
||||||
|
if (!Character.isLetterOrDigit(s.charAt(i))) {
|
||||||
|
if (i + 1 < s.length()) {
|
||||||
|
s = String.format("%s%s%s", s.subSequence(0, i + 1), Character.toUpperCase(s.charAt(i + 1)), s.substring(i + 2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Number Functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static int hexToInt(byte data[], int offset, int len) {
|
||||||
|
int temp = 0;
|
||||||
|
int i = 1000;
|
||||||
|
for (int cntr = 0; cntr < len; cntr++) {
|
||||||
|
int num = (data[offset + cntr] & 0xFF) * i;
|
||||||
|
temp += num;
|
||||||
|
if (i > 1) {
|
||||||
|
i = i / 1000;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static long playerNameToInt64(String s) {
|
||||||
|
long l = 0L;
|
||||||
|
for (int i = 0; i < s.length(); i++) {
|
||||||
|
char c = s.charAt(i);
|
||||||
|
l *= 37L;
|
||||||
|
if (c >= 'A' && c <= 'Z') {
|
||||||
|
l += 1 + c - 65;
|
||||||
|
} else if (c >= 'a' && c <= 'z') {
|
||||||
|
l += 1 + c - 97;
|
||||||
|
} else if (c >= '0' && c <= '9') {
|
||||||
|
l += 27 + c - 48;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (l % 37L == 0L && l != 0L) {
|
||||||
|
l /= 37L;
|
||||||
|
}
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Random Number Generator Functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
// return a random number from 0 → range (including range)
|
||||||
|
public static int random(int range) {
|
||||||
|
return (int) (java.lang.Math.random() * (++range));
|
||||||
|
}
|
||||||
|
|
||||||
|
// return a random number between & including the min/max values
|
||||||
|
public static int random(int min, int max) {
|
||||||
|
++max;
|
||||||
|
return (int) Math.floor(Math.random() * (max - min)) + min;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int random(final float range) {
|
||||||
|
return (int) (java.lang.Math.random() * (range + 1));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int random2(int range) {
|
||||||
|
return (int) (java.lang.Math.random() * range + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int random3(int range) {
|
||||||
|
return (int) (java.lang.Math.random() * range);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int randomNumber(int range) {
|
||||||
|
return (int) (Math.random() * range);
|
||||||
|
}
|
||||||
|
|
||||||
|
// return a random number from 0 → range - 1
|
||||||
|
public static int randomMinusOne(int range) {
|
||||||
|
return (int) Math.random() * range;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int randomArrayItem(int[] arr) {
|
||||||
|
return arr[(int) Math.floor(Math.random() * arr.length)];
|
||||||
|
}
|
||||||
|
|
||||||
|
public static int randomArrayListItem(ArrayList<Integer> arr) {
|
||||||
|
int index = (int) Math.floor(Math.random() * arr.size());
|
||||||
|
return arr.get(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Positioning Functions
|
||||||
|
*/
|
||||||
|
|
||||||
|
public static byte directionDeltaX[] = new byte[] { 0, 1, 1, 1, 0, -1, -1, -1 };
|
||||||
|
public static byte directionDeltaY[] = new byte[] { 1, 1, 0, -1, -1, -1, 0, 1 };
|
||||||
|
public static byte xlateDirectionToClient[] = new byte[] { 1, 2, 4, 7, 6, 5, 3, 0 };
|
||||||
|
|
||||||
|
public static double distance(int x1, int y1, int x2, int y2 ) {
|
||||||
|
return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean goodDistance(int objectX, int objectY, int playerX, int playerY, int distance) {
|
||||||
|
return objectX - playerX <= distance && objectX - playerX >= -distance && objectY - playerY <= distance && objectY - playerY >= -distance;
|
||||||
|
}
|
||||||
|
|
||||||
public static int[] delta(int x1, int y1, int x2, int y2) {
|
public static int[] delta(int x1, int y1, int x2, int y2) {
|
||||||
return new int[] {x2 - x1, y2 - y1};
|
return new int[] {x2 - x1, y2 - y1};
|
||||||
@@ -296,24 +342,4 @@ public class Misc {
|
|||||||
* changeY == directionDeltaY[j]) return j; } return -1;
|
* changeY == directionDeltaY[j]) return j; } return -1;
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public static byte directionDeltaX[] = new byte[] { 0, 1, 1, 1, 0, -1, -1, -1 };
|
|
||||||
public static byte directionDeltaY[] = new byte[] { 1, 1, 0, -1, -1, -1, 0, 1 };
|
|
||||||
public static byte xlateDirectionToClient[] = new byte[] { 1, 2, 4, 7, 6,
|
|
||||||
5, 3, 0 };
|
|
||||||
|
|
||||||
public static String capitalize(String s) {
|
|
||||||
for (int i = 0; i < s.length(); i++) {
|
|
||||||
if (i == 0) {
|
|
||||||
s = String.format("%s%s", Character.toUpperCase(s.charAt(0)),
|
|
||||||
s.substring(1));
|
|
||||||
}
|
|
||||||
if (!Character.isLetterOrDigit(s.charAt(i))) {
|
|
||||||
if (i + 1 < s.length()) {
|
|
||||||
s = String.format("%s%s%s", s.subSequence(0, i + 1), Character.toUpperCase(s.charAt(i + 1)), s.substring(i + 2));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -17,7 +17,7 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- ./2006Scape Server:/usr/src/server
|
- ./2006Scape Server:/usr/src/server
|
||||||
working_dir: /usr/src/server
|
working_dir: /usr/src/server
|
||||||
ports: # You will need to open other ports if your world ID is not 1 (43597 for world 2)
|
ports: # You will need to open other ports if your world ID is not 1 (43598 for world 2)
|
||||||
- 43594:43594 # Server
|
- 43594:43594 # Server
|
||||||
- 43595-43596:43595-43596 # File Server
|
- 43595-43596:43595-43596 # File Server
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|||||||
Reference in New Issue
Block a user