mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-16 11:30:17 -07:00
Preparing merge
This commit is contained in:
parent
e233110f1d
commit
4c55322faa
67 changed files with 3163 additions and 2387 deletions
|
|
@ -1,4 +1,6 @@
|
||||||
package org.runite.jagex;
|
package org.runite.jagex;
|
||||||
|
import org.runite.GameLaunch;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
final class Class3_Sub13_Sub3 extends Class3_Sub13 {
|
final class Class3_Sub13_Sub3 extends Class3_Sub13 {
|
||||||
|
|
@ -42,10 +44,10 @@ final class Class3_Sub13_Sub3 extends Class3_Sub13 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (var4.toString().contains("RuneScape")) {
|
if (var4.toString().contains("RuneScape")) {
|
||||||
var4 = RSString.createRSString(var4.toString().replace("RuneScape", "Runite"));
|
var4 = RSString.createRSString(var4.toString().replace("RuneScape", GameLaunch.SETTINGS.getName()));
|
||||||
}
|
}
|
||||||
if (var4.toString().contains("Jagex")) {
|
if (var4.toString().contains("Jagex")) {
|
||||||
var4 = RSString.createRSString(var4.toString().replace("Jagex", "Runite"));
|
var4 = RSString.createRSString(var4.toString().replace("Jagex", GameLaunch.SETTINGS.getName()));
|
||||||
}
|
}
|
||||||
return var4;
|
return var4;
|
||||||
} catch (RuntimeException var6) {
|
} catch (RuntimeException var6) {
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ public class ClientLoader extends Applet {
|
||||||
try {
|
try {
|
||||||
ClientLoader.world = "" + GameLaunch.SETTINGS.getWorld();
|
ClientLoader.world = "" + GameLaunch.SETTINGS.getWorld();
|
||||||
System.out.println(GameLaunch.SETTINGS.getWorld());
|
System.out.println(GameLaunch.SETTINGS.getWorld());
|
||||||
this.frame = new JFrame("Runite");
|
this.frame = new JFrame(GameLaunch.SETTINGS.getName());
|
||||||
this.frame.setLayout(new BorderLayout());
|
this.frame.setLayout(new BorderLayout());
|
||||||
this.frame.setBackground(Color.BLACK);
|
this.frame.setBackground(Color.BLACK);
|
||||||
if (!GameLaunch.SETTINGS.isSwiftKit())
|
if (!GameLaunch.SETTINGS.isSwiftKit())
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package org.runite.jagex;
|
package org.runite.jagex;
|
||||||
|
|
||||||
import org.runite.Configurations;
|
import org.runite.Configurations;
|
||||||
|
import org.runite.GameLaunch;
|
||||||
import org.runite.GameSetting;
|
import org.runite.GameSetting;
|
||||||
|
|
||||||
import java.applet.Applet;
|
import java.applet.Applet;
|
||||||
|
|
@ -19,7 +20,7 @@ public abstract class GameShell extends Applet implements Runnable, FocusListene
|
||||||
/**
|
/**
|
||||||
* The game settings.
|
* The game settings.
|
||||||
*/
|
*/
|
||||||
public static GameSetting SETTINGS = new GameSetting("Runite", Configurations.LOCAL_MS ? "127.0.0.1" : "frostblades.org", 1, "live", false, false);
|
public static GameSetting SETTINGS = new GameSetting(GameLaunch.SETTINGS.getName(), Configurations.LOCAL_MS ? "127.0.0.1" : "frostblades.org", 1, "live", false, false);
|
||||||
|
|
||||||
|
|
||||||
private boolean aBoolean1 = false;
|
private boolean aBoolean1 = false;
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
package org.runite.jagex;
|
package org.runite.jagex;
|
||||||
|
import org.runite.GameLaunch;
|
||||||
|
|
||||||
import java.applet.Applet;
|
import java.applet.Applet;
|
||||||
import java.awt.FontMetrics;
|
import java.awt.FontMetrics;
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
|
|
@ -1578,7 +1580,7 @@ final class RSString implements Interface3 {
|
||||||
|
|
||||||
static final RSString createRSString(String string) {
|
static final RSString createRSString(String string) {
|
||||||
if (string != null) {
|
if (string != null) {
|
||||||
string = string.replace("RuneScape", "Runite");
|
string = string.replace("RuneScape", GameLaunch.SETTINGS.getName());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
byte[] var2 = string.getBytes();
|
byte[] var2 = string.getBytes();
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
|
|
@ -2,7 +2,7 @@ name=Crandor
|
||||||
beta=true
|
beta=true
|
||||||
sql=true
|
sql=true
|
||||||
devMode=false
|
devMode=false
|
||||||
gui=false
|
gui=true
|
||||||
gameType=economy
|
gameType=economy
|
||||||
worldId=1
|
worldId=1
|
||||||
country=0
|
country=0
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ import org.crandor.game.system.SystemShutdownHook;
|
||||||
import org.crandor.game.system.mysql.SQLManager;
|
import org.crandor.game.system.mysql.SQLManager;
|
||||||
import org.crandor.game.world.GameSettings;
|
import org.crandor.game.world.GameSettings;
|
||||||
import org.crandor.game.world.GameWorld;
|
import org.crandor.game.world.GameWorld;
|
||||||
|
import org.crandor.gui.ConsoleFrame;
|
||||||
import org.crandor.net.NioReactor;
|
import org.crandor.net.NioReactor;
|
||||||
import org.crandor.net.amsc.WorldCommunicator;
|
import org.crandor.net.amsc.WorldCommunicator;
|
||||||
import org.crandor.tools.TimeStamp;
|
import org.crandor.tools.TimeStamp;
|
||||||
|
|
@ -21,7 +22,7 @@ import org.crandor.tools.backup.AutoBackup;
|
||||||
* @author Vexia
|
* @author Vexia
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public final class Main {
|
public final class Main extends Application {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The time stamp of when the server started running.
|
* The time stamp of when the server started running.
|
||||||
|
|
@ -45,9 +46,9 @@ public final class Main {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
GameWorld.setSettings(GameSettings.parse(args));
|
GameWorld.setSettings(GameSettings.parse(args));
|
||||||
}
|
}
|
||||||
// if (GameWorld.getSettings().isGui()) {
|
if (GameWorld.getSettings().isGui()) {
|
||||||
// KeldagrimFrame.getInstance().init();
|
ConsoleFrame.getInstance().init();
|
||||||
// }
|
}
|
||||||
startTime = System.currentTimeMillis();
|
startTime = System.currentTimeMillis();
|
||||||
final TimeStamp t = new TimeStamp();
|
final TimeStamp t = new TimeStamp();
|
||||||
// backup = new AutoBackup();
|
// backup = new AutoBackup();
|
||||||
|
|
@ -78,4 +79,12 @@ public final class Main {
|
||||||
public static void setStartTime(long startTime) {
|
public static void setStartTime(long startTime) {
|
||||||
Main.startTime = startTime;
|
Main.startTime = startTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void start(Stage primaryStage) throws Exception {
|
||||||
|
Parent root = FXMLLoader.load(getClass().getResource("Main Frame.fxml"));
|
||||||
|
primaryStage.setTitle("Management Panel");
|
||||||
|
primaryStage.setScene(new Scene(root, 600, 450));
|
||||||
|
primaryStage.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -16,7 +16,7 @@ public final class ServerConstants {
|
||||||
* The administrators.
|
* The administrators.
|
||||||
*/
|
*/
|
||||||
public static final String[] ADMINISTRATORS = {
|
public static final String[] ADMINISTRATORS = {
|
||||||
"torv",
|
"ethan",
|
||||||
"austin",
|
"austin",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -209,6 +209,13 @@ public abstract class DialoguePlugin implements Plugin<Player> {
|
||||||
public Component player(final String... messages) {
|
public Component player(final String... messages) {
|
||||||
return interpreter.sendDialogues(player, null, messages);
|
return interpreter.sendDialogues(player, null, messages);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Method wrapper to send a player dial.
|
||||||
|
* @return the component.
|
||||||
|
*/
|
||||||
|
public Component player(FacialExpression expression, final String... messages) {
|
||||||
|
return interpreter.sendDialogues(player, expression, messages);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method used to send options.
|
* Method used to send options.
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package org.crandor.game.content.dialogue;
|
||||||
/**
|
/**
|
||||||
* Represents the facial expressions (the animations the entity does when
|
* Represents the facial expressions (the animations the entity does when
|
||||||
* talking).
|
* talking).
|
||||||
|
*
|
||||||
* @author Emperor
|
* @author Emperor
|
||||||
* @author Empathy
|
* @author Empathy
|
||||||
*/
|
*/
|
||||||
|
|
@ -12,7 +13,14 @@ public enum FacialExpression {
|
||||||
* The normal talking expression.
|
* The normal talking expression.
|
||||||
*/
|
*/
|
||||||
OSRS_HAPPY(588), OSRS_NORMAL(594), OSRS_SAD(596), OSRS_LAUGH1(605), OSRS_LAUGH2(606), OSRS_LAUGH3(607), OSRS_LAUGH4(608), //TODO: More
|
OSRS_HAPPY(588), OSRS_NORMAL(594), OSRS_SAD(596), OSRS_LAUGH1(605), OSRS_LAUGH2(606), OSRS_LAUGH3(607), OSRS_LAUGH4(608), //TODO: More
|
||||||
NORMAL(9760), ANGRY(9792), GRUMPY(9784), ANNOYED(9812), SNEAKY(595), SAD(9776), DISTRESSED(9820), HAPPY(9851), NEARLY_CRYING(9836), CHILD_QUESTIONABLE(7171), CHILD_BACK_AND_FORTH(7172), CHILD_NORMAL(7173), CHILD_SLOW_NOD(7174), CHILD_CRAZY_LAUGH(7175), CHILD_THINKING(7176), CHILD_SAD(7177), CHILD_BIG_EYES(7178), CHILD_LOOKING_OUT(7179);
|
NORMAL(9760), ANGRY(9792), GRUMPY(9784), ANNOYED(9812), SNEAKY(595), SAD(9776), DISTRESSED(9820), HAPPY(9851), NEARLY_CRYING(9836), CHILD_QUESTIONABLE(7171), CHILD_BACK_AND_FORTH(7172), CHILD_NORMAL(7173), CHILD_SLOW_NOD(7174), CHILD_CRAZY_LAUGH(7175), CHILD_THINKING(7176), CHILD_SAD(7177), CHILD_BIG_EYES(7178), CHILD_LOOKING_OUT(7179),
|
||||||
|
|
||||||
|
NO_EXPRESSION(9760), SAD_TWO(9768), NO_EXPRESSION_TWO(9772), WHY(9776),
|
||||||
|
SCARED(9780), MIDLY_ANGRY(9784), VERY_ANGRY(9792), ANGRY_TWO(9796),
|
||||||
|
JUST_LISTEN(9804), CALM_TALKING(9808), LOOK_DOWN(9812), WHAT_THE(9816), WHAT_THE_TWO(9820),
|
||||||
|
CROOKED_HEAD(9828), GLANCE_DOWN(9832), UNSURE(9836), LISTEN_LAUGH(9840),
|
||||||
|
TALK_SWING(9844), GOOFY_LAUGH(9851), DRUNK(9835), ASKING(9827), SUSPICIOUS(9831);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The animation id.
|
* The animation id.
|
||||||
|
|
@ -21,14 +29,16 @@ public enum FacialExpression {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@code FacialExpression} {@code Object}.
|
* Constructs a new {@code FacialExpression} {@code Object}.
|
||||||
|
*
|
||||||
* @param animationId The animation id.
|
* @param animationId The animation id.
|
||||||
*/
|
*/
|
||||||
private FacialExpression(int animationId) {
|
FacialExpression(int animationId) {
|
||||||
this.animationId = animationId;
|
this.animationId = animationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the animation id.
|
* Gets the animation id.
|
||||||
|
*
|
||||||
* @return The animation id.
|
* @return The animation id.
|
||||||
*/
|
*/
|
||||||
public int getAnimationId() {
|
public int getAnimationId() {
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A class representing a shop.
|
* A class representing a shop.
|
||||||
|
*
|
||||||
* @author 'Vexia
|
* @author 'Vexia
|
||||||
*/
|
*/
|
||||||
public class Shop {
|
public class Shop {
|
||||||
|
|
@ -23,22 +24,18 @@ public class Shop {
|
||||||
* Represents the general store items.
|
* Represents the general store items.
|
||||||
*/
|
*/
|
||||||
public final static Item[] GENERAL_STORE_ITEMS = {new Item(1931, 30), new Item(1935, 30), new Item(1735, 10), new Item(1925, 10), new Item(1923, 10), new Item(1887, 10), new Item(590, 10), new Item(1755, 10), new Item(2347, 10), new Item(550, 10), new Item(9003, 10)};
|
public final static Item[] GENERAL_STORE_ITEMS = {new Item(1931, 30), new Item(1935, 30), new Item(1735, 10), new Item(1925, 10), new Item(1923, 10), new Item(1887, 10), new Item(590, 10), new Item(1755, 10), new Item(2347, 10), new Item(550, 10), new Item(9003, 10)};
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the shop containers.
|
|
||||||
*/
|
|
||||||
private final Container[] containers = new Container[] { new Container(40, ContainerType.SHOP), new Container(40, ContainerType.SHOP) };
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the coins item.
|
* Represents the coins item.
|
||||||
*/
|
*/
|
||||||
private static final int COINS = 995;
|
private static final int COINS = 995;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the tokkul item id.
|
* Represents the tokkul item id.
|
||||||
*/
|
*/
|
||||||
private static final int TOKKUL = 6529;
|
private static final int TOKKUL = 6529;
|
||||||
|
/**
|
||||||
|
* Represents the shop containers.
|
||||||
|
*/
|
||||||
|
private final Container[] containers = new Container[]{new Container(40, ContainerType.SHOP), new Container(40, ContainerType.SHOP)};
|
||||||
/**
|
/**
|
||||||
* Represents the list of shop viewers.
|
* Represents the list of shop viewers.
|
||||||
*/
|
*/
|
||||||
|
|
@ -96,6 +93,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@code Shop} {@code Object}.
|
* Constructs a new {@code Shop} {@code Object}.
|
||||||
|
*
|
||||||
* @param title the title.
|
* @param title the title.
|
||||||
* @param items the items.
|
* @param items the items.
|
||||||
* @param npcs the npcs.
|
* @param npcs the npcs.
|
||||||
|
|
@ -115,9 +113,9 @@ public class Shop {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@code Shop} {@code Object}.
|
* Constructs a new {@code Shop} {@code Object}.
|
||||||
|
*
|
||||||
* @param title the title.
|
* @param title the title.
|
||||||
* @param items the items.
|
* @param items the items.
|
||||||
* @param npcs the npcs.
|
* @param npcs the npcs.
|
||||||
|
|
@ -134,6 +132,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@Code Shop} {@Code Object}
|
* Constructs a new {@Code Shop} {@Code Object}
|
||||||
|
*
|
||||||
* @param title
|
* @param title
|
||||||
* @param items
|
* @param items
|
||||||
* @param npcs
|
* @param npcs
|
||||||
|
|
@ -147,6 +146,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@code Shop} {@code Object}.
|
* Constructs a new {@code Shop} {@code Object}.
|
||||||
|
*
|
||||||
* @param title the title.
|
* @param title the title.
|
||||||
* @param items the items.
|
* @param items the items.
|
||||||
* @param npcs the npcs.
|
* @param npcs the npcs.
|
||||||
|
|
@ -158,6 +158,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@code Shop} {@code Object}.
|
* Constructs a new {@code Shop} {@code Object}.
|
||||||
|
*
|
||||||
* @param title the title.
|
* @param title the title.
|
||||||
* @param npcs the npcs.
|
* @param npcs the npcs.
|
||||||
* @param general the general.
|
* @param general the general.
|
||||||
|
|
@ -168,6 +169,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@code Shop} {@code Object}.
|
* Constructs a new {@code Shop} {@code Object}.
|
||||||
|
*
|
||||||
* @param title the title.
|
* @param title the title.
|
||||||
* @param npcs the npcs.
|
* @param npcs the npcs.
|
||||||
* @param general the general.
|
* @param general the general.
|
||||||
|
|
@ -179,6 +181,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@code Shop} {@code Object}.
|
* Constructs a new {@code Shop} {@code Object}.
|
||||||
|
*
|
||||||
* @param title the title.
|
* @param title the title.
|
||||||
* @param npcs the npcs.
|
* @param npcs the npcs.
|
||||||
* @param general the general.
|
* @param general the general.
|
||||||
|
|
@ -190,6 +193,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@code Shop} {@code Object}.
|
* Constructs a new {@code Shop} {@code Object}.
|
||||||
|
*
|
||||||
* @param title the title.
|
* @param title the title.
|
||||||
* @param items the items.
|
* @param items the items.
|
||||||
* @param npcs the npcs.
|
* @param npcs the npcs.
|
||||||
|
|
@ -202,6 +206,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@code Shop} {@code Object}.
|
* Constructs a new {@code Shop} {@code Object}.
|
||||||
|
*
|
||||||
* @param title the title.
|
* @param title the title.
|
||||||
* @param npcs the npcs.
|
* @param npcs the npcs.
|
||||||
* @param general the general.
|
* @param general the general.
|
||||||
|
|
@ -213,6 +218,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@code Shop} {@code Object}.
|
* Constructs a new {@code Shop} {@code Object}.
|
||||||
|
*
|
||||||
* @param title the title.
|
* @param title the title.
|
||||||
* @param npcs the npcs.
|
* @param npcs the npcs.
|
||||||
* @param general the general.
|
* @param general the general.
|
||||||
|
|
@ -225,14 +231,36 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method used to open the shop.
|
* Method used to open the shop.
|
||||||
|
*
|
||||||
* @param player the shop.
|
* @param player the shop.
|
||||||
*/
|
*/
|
||||||
public void open(final Player player) {
|
public void open(final Player player) {
|
||||||
ShopViewer.extend(player, this).open();
|
ShopViewer.extend(player, this).open();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void give(Player player, final int slot, int amount, int tabIndex) {
|
||||||
|
final Container container = getContainer(tabIndex);
|
||||||
|
final Item item = container.get(slot);
|
||||||
|
if (item == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
final Item add = new Item(item.getId(), amount);
|
||||||
|
if (add.getAmount() < 1 || !player.getInventory().hasSpaceFor(add)) {
|
||||||
|
player.getPacketDispatch().sendMessage("You have no inventory space at the moment and cannot get anything.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
add.setAmount(getAmount(player, add));
|
||||||
|
if (add.getAmount() < 1 || !player.getInventory().hasSpaceFor(add)) {
|
||||||
|
player.getPacketDispatch().sendMessage("You have no inventory space at the moment and cannot get anything.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
player.getInventory().add(add);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method used to buy an item from the shop.
|
* Method used to buy an item from the shop.
|
||||||
|
*
|
||||||
* @param slot the slot.
|
* @param slot the slot.
|
||||||
* @param amount the amount.
|
* @param amount the amount.
|
||||||
*/
|
*/
|
||||||
|
|
@ -290,6 +318,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method used to sell an item to the shop.
|
* Method used to sell an item to the shop.
|
||||||
|
*
|
||||||
* @param slot the slot.
|
* @param slot the slot.
|
||||||
* @param amount the amount.
|
* @param amount the amount.
|
||||||
*/
|
*/
|
||||||
|
|
@ -343,6 +372,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Values an item.
|
* Values an item.
|
||||||
|
*
|
||||||
* @param player the player.
|
* @param player the player.
|
||||||
* @param viewer the viewer.
|
* @param viewer the viewer.
|
||||||
* @param item the item.
|
* @param item the item.
|
||||||
|
|
@ -372,6 +402,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method used to send a stock
|
* Method used to send a stock
|
||||||
|
*
|
||||||
* @param player
|
* @param player
|
||||||
* @param tabIndex
|
* @param tabIndex
|
||||||
*/
|
*/
|
||||||
|
|
@ -431,6 +462,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the player can sell an item to the shop.
|
* Checks if the player can sell an item to the shop.
|
||||||
|
*
|
||||||
* @param player the player.
|
* @param player the player.
|
||||||
* @param item the item.
|
* @param item the item.
|
||||||
* @param def the def.
|
* @param def the def.
|
||||||
|
|
@ -450,6 +482,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the amount to buy/sell.
|
* Gets the amount to buy/sell.
|
||||||
|
*
|
||||||
* @param player the player.
|
* @param player the player.
|
||||||
* @param add the added item.
|
* @param add the added item.
|
||||||
* @return the amount.
|
* @return the amount.
|
||||||
|
|
@ -460,6 +493,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the player can buy the item.
|
* Checks if the player can buy the item.
|
||||||
|
*
|
||||||
* @param player the player.
|
* @param player the player.
|
||||||
* @param currency the currency.
|
* @param currency the currency.
|
||||||
* @return {@code True} if so.
|
* @return {@code True} if so.
|
||||||
|
|
@ -470,6 +504,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the player can buy from the shop.
|
* Checks if the player can buy from the shop.
|
||||||
|
*
|
||||||
* @param player the player.
|
* @param player the player.
|
||||||
* @param item the item.
|
* @param item the item.
|
||||||
* @param price the price.
|
* @param price the price.
|
||||||
|
|
@ -490,6 +525,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the points.
|
* Gets the points.
|
||||||
|
*
|
||||||
* @param player the player.
|
* @param player the player.
|
||||||
* @return the points.
|
* @return the points.
|
||||||
*/
|
*/
|
||||||
|
|
@ -499,6 +535,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Decrements the points.
|
* Decrements the points.
|
||||||
|
*
|
||||||
* @param player the player.
|
* @param player the player.
|
||||||
* @param decrement the decrementation.
|
* @param decrement the decrementation.
|
||||||
*/
|
*/
|
||||||
|
|
@ -508,6 +545,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the points name.
|
* Gets the points name.
|
||||||
|
*
|
||||||
* @return the name.
|
* @return the name.
|
||||||
*/
|
*/
|
||||||
public String getPointsName() {
|
public String getPointsName() {
|
||||||
|
|
@ -516,6 +554,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the value gained for selling this item to a certain shop.
|
* Gets the value gained for selling this item to a certain shop.
|
||||||
|
*
|
||||||
* @param item The item to sell.
|
* @param item The item to sell.
|
||||||
* @param player the player.
|
* @param player the player.
|
||||||
* @return The value.
|
* @return The value.
|
||||||
|
|
@ -547,6 +586,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the selling value formula based.
|
* Gets the selling value formula based.
|
||||||
|
*
|
||||||
* @param amount the amount.
|
* @param amount the amount.
|
||||||
* @param item the item.
|
* @param item the item.
|
||||||
* @return the selling value.
|
* @return the selling value.
|
||||||
|
|
@ -571,6 +611,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the buying price.
|
* Gets the buying price.
|
||||||
|
*
|
||||||
* @param item the item.
|
* @param item the item.
|
||||||
* @return the price.
|
* @return the price.
|
||||||
*/
|
*/
|
||||||
|
|
@ -598,6 +639,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the item is allowed to be sold to the shop.
|
* Checks if the item is allowed to be sold to the shop.
|
||||||
|
*
|
||||||
* @param item the item id.
|
* @param item the item id.
|
||||||
* @return {@code True} if so.
|
* @return {@code True} if so.
|
||||||
*/
|
*/
|
||||||
|
|
@ -619,6 +661,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the container the item should go to.
|
* Gets the container the item should go to.
|
||||||
|
*
|
||||||
* @param item the item.
|
* @param item the item.
|
||||||
* @return the container.
|
* @return the container.
|
||||||
*/
|
*/
|
||||||
|
|
@ -638,6 +681,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a copy of this shop.
|
* Creates a copy of this shop.
|
||||||
|
*
|
||||||
* @return the shop.
|
* @return the shop.
|
||||||
*/
|
*/
|
||||||
public Shop copy() {
|
public Shop copy() {
|
||||||
|
|
@ -646,6 +690,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the container on the slot.
|
* Gets the container on the slot.
|
||||||
|
*
|
||||||
* @param tabIndex the tab index.
|
* @param tabIndex the tab index.
|
||||||
* @return the container.
|
* @return the container.
|
||||||
*/
|
*/
|
||||||
|
|
@ -658,6 +703,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the viewers.
|
* Gets the viewers.
|
||||||
|
*
|
||||||
* @return The viewers.
|
* @return The viewers.
|
||||||
*/
|
*/
|
||||||
public List<ShopViewer> getViewers() {
|
public List<ShopViewer> getViewers() {
|
||||||
|
|
@ -666,6 +712,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the title.
|
* Gets the title.
|
||||||
|
*
|
||||||
* @return The title.
|
* @return The title.
|
||||||
*/
|
*/
|
||||||
public String getTitle() {
|
public String getTitle() {
|
||||||
|
|
@ -674,6 +721,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the items.
|
* Gets the items.
|
||||||
|
*
|
||||||
* @return The items.
|
* @return The items.
|
||||||
*/
|
*/
|
||||||
public Item[] getItems() {
|
public Item[] getItems() {
|
||||||
|
|
@ -682,6 +730,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the items.
|
* Sets the items.
|
||||||
|
*
|
||||||
* @return true if the items were changed.
|
* @return true if the items were changed.
|
||||||
*/
|
*/
|
||||||
public boolean setItems(Item... item) {
|
public boolean setItems(Item... item) {
|
||||||
|
|
@ -690,6 +739,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the general.
|
* Gets the general.
|
||||||
|
*
|
||||||
* @return The general.
|
* @return The general.
|
||||||
*/
|
*/
|
||||||
public boolean isGeneral() {
|
public boolean isGeneral() {
|
||||||
|
|
@ -698,6 +748,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the currency.
|
* Gets the currency.
|
||||||
|
*
|
||||||
* @return The currency.
|
* @return The currency.
|
||||||
*/
|
*/
|
||||||
public int getCurrency() {
|
public int getCurrency() {
|
||||||
|
|
@ -706,6 +757,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the containers.
|
* Gets the containers.
|
||||||
|
*
|
||||||
* @return The containers.
|
* @return The containers.
|
||||||
*/
|
*/
|
||||||
public Container[] getContainers() {
|
public Container[] getContainers() {
|
||||||
|
|
@ -714,6 +766,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the bhighAlch.
|
* Gets the bhighAlch.
|
||||||
|
*
|
||||||
* @return the highAlch
|
* @return the highAlch
|
||||||
*/
|
*/
|
||||||
public boolean isHighAlch() {
|
public boolean isHighAlch() {
|
||||||
|
|
@ -727,6 +780,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the lastRestock.
|
* Gets the lastRestock.
|
||||||
|
*
|
||||||
* @return the lastRestock
|
* @return the lastRestock
|
||||||
*/
|
*/
|
||||||
public int getLastRestock() {
|
public int getLastRestock() {
|
||||||
|
|
@ -735,6 +789,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the balastRestock.
|
* Sets the balastRestock.
|
||||||
|
*
|
||||||
* @param lastRestock the lastRestock to set.
|
* @param lastRestock the lastRestock to set.
|
||||||
*/
|
*/
|
||||||
public void setLastRestock(int lastRestock) {
|
public void setLastRestock(int lastRestock) {
|
||||||
|
|
@ -743,6 +798,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the npcs.
|
* Gets the npcs.
|
||||||
|
*
|
||||||
* @return the npcs
|
* @return the npcs
|
||||||
*/
|
*/
|
||||||
public int[] getNpcs() {
|
public int[] getNpcs() {
|
||||||
|
|
@ -751,6 +807,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the banpcs.
|
* Sets the banpcs.
|
||||||
|
*
|
||||||
* @param npcs the npcs to set.
|
* @param npcs the npcs to set.
|
||||||
*/
|
*/
|
||||||
public void setNpcs(int[] npcs) {
|
public void setNpcs(int[] npcs) {
|
||||||
|
|
@ -759,6 +816,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the pointShop.
|
* Gets the pointShop.
|
||||||
|
*
|
||||||
* @return the pointShop
|
* @return the pointShop
|
||||||
*/
|
*/
|
||||||
public boolean isPointShop() {
|
public boolean isPointShop() {
|
||||||
|
|
@ -767,6 +825,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the pointShop.
|
* Sets the pointShop.
|
||||||
|
*
|
||||||
* @param pointShop the pointShop to set.
|
* @param pointShop the pointShop to set.
|
||||||
*/
|
*/
|
||||||
public void setPointShop(boolean pointShop) {
|
public void setPointShop(boolean pointShop) {
|
||||||
|
|
@ -775,6 +834,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if shop should restock.
|
* Check if shop should restock.
|
||||||
|
*
|
||||||
* @return the restock
|
* @return the restock
|
||||||
*/
|
*/
|
||||||
public boolean isRestock() {
|
public boolean isRestock() {
|
||||||
|
|
@ -783,6 +843,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the restock.
|
* Sets the restock.
|
||||||
|
*
|
||||||
* @param reStock
|
* @param reStock
|
||||||
*/
|
*/
|
||||||
public void setRestock(boolean reStock) {
|
public void setRestock(boolean reStock) {
|
||||||
|
|
@ -792,6 +853,7 @@ public class Shop {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the SellAllFor value.
|
* Gets the SellAllFor value.
|
||||||
|
*
|
||||||
* @return the sellAllFor
|
* @return the sellAllFor
|
||||||
*/
|
*/
|
||||||
public int getSellAllFor() {
|
public int getSellAllFor() {
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ public final class ShopViewer {
|
||||||
/**
|
/**
|
||||||
* Represents the shop being viewed.
|
* Represents the shop being viewed.
|
||||||
*/
|
*/
|
||||||
private final Shop shop;
|
private Shop shop;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the tab index.
|
* Represents the tab index.
|
||||||
|
|
@ -146,6 +146,7 @@ public final class ShopViewer {
|
||||||
player.removeExtension(ShopViewer.class);
|
player.removeExtension(ShopViewer.class);
|
||||||
viewer.getShop().getViewers().remove(viewer);
|
viewer.getShop().getViewers().remove(viewer);
|
||||||
player.getInterfaceManager().closeSingleTab();
|
player.getInterfaceManager().closeSingleTab();
|
||||||
|
player.removeAttribute("spawning_items");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,6 @@ public enum TutorialStage {
|
||||||
player.getInterfaceManager().hideTabs(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13);
|
player.getInterfaceManager().hideTabs(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13);
|
||||||
ActivityManager.start(player, "ltr:dragon_fight_cs", false);
|
ActivityManager.start(player, "ltr:dragon_fight_cs", false);
|
||||||
}
|
}
|
||||||
// player.setAttribute("tut-island:hi_slot", HintIconManager.registerHintIcon(player, Repository.findNPC(945)));
|
|
||||||
Component.setUnclosable(player, player.getDialogueInterpreter().sendPlaneMessageWithBlueTitle("Cutscenes", "There are moments in " + GameWorld.getName() + " that you cannot change what is", "going on you must simply watch to see what unfolds. Some call", "these 'cutscenes'. Watch the knight fight the dragon in this cutscene.", ""));
|
Component.setUnclosable(player, player.getDialogueInterpreter().sendPlaneMessageWithBlueTitle("Cutscenes", "There are moments in " + GameWorld.getName() + " that you cannot change what is", "going on you must simply watch to see what unfolds. Some call", "these 'cutscenes'. Watch the knight fight the dragon in this cutscene.", ""));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -74,11 +73,13 @@ public enum TutorialStage {
|
||||||
public void run(final Player player) {
|
public void run(final Player player) {
|
||||||
if (login) {
|
if (login) {
|
||||||
player.getInterfaceManager().hideTabs(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13);
|
player.getInterfaceManager().hideTabs(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13);
|
||||||
|
player.setAttribute("tut-island:hi_slot", HintIconManager.registerHintIcon(player, Repository.findNPC(7938), HintIconManager.DEFAULT_ARROW, HintIconManager.ARROW_CIRCLE_MODEL));
|
||||||
} else {
|
} else {
|
||||||
removeHintIcon(player);
|
removeHintIcon(player);
|
||||||
}
|
}
|
||||||
player.setAttribute("tut-island:hi_slot", HintIconManager.registerHintIcon(player, Location.create(3098, 3107, 0), 1, -1, player.getHintIconManager().freeSlot(), 125, 3));
|
player.getInterfaceManager().hideTabs(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13);
|
||||||
Component.setUnclosable(player, player.getDialogueInterpreter().sendScrollMessageWithBlueTitle("Interacting with scenery", "You can interact with many items of scenery by simply clicking", "on them. Right clicking will also give more options. Feel free to", "try it with the things in this room, then click on the door", "indicated with the yellow arrow to go though to the next", "instructor."));
|
player.setAttribute("tut-island:hi_slot", HintIconManager.registerHintIcon(player, Repository.findNPC(7938), HintIconManager.DEFAULT_ARROW, HintIconManager.ARROW_CIRCLE_MODEL));
|
||||||
|
Component.setUnclosable(player, player.getDialogueInterpreter().sendPlaneMessageWithBlueTitle("Combat!", TutorialStage.blue("Left-click") + "on the knight to talk to him about combat. I have", "put a flashing yellow arrow above his head. If you can't see", "him, use your keyboard's arrow keys to rotate your view."));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
STAGE_4(4) {
|
STAGE_4(4) {
|
||||||
|
|
@ -86,12 +87,14 @@ public enum TutorialStage {
|
||||||
public void run(final Player player) {
|
public void run(final Player player) {
|
||||||
if (login) {
|
if (login) {
|
||||||
player.getInterfaceManager().hideTabs(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13);
|
player.getInterfaceManager().hideTabs(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13);
|
||||||
|
player.setAttribute("tut-island:hi_slot", HintIconManager.registerHintIcon(player, Repository.findNPC(7938), HintIconManager.DEFAULT_ARROW, HintIconManager.ARROW_CIRCLE_MODEL));
|
||||||
} else {
|
} else {
|
||||||
removeHintIcon(player);
|
removeHintIcon(player);
|
||||||
}
|
}
|
||||||
player.getConfigManager().set(406, 2);
|
player.getInterfaceManager().hideTabs(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 13);
|
||||||
player.setAttribute("tut-island:hi_slot", HintIconManager.registerHintIcon(player, Repository.findNPC(943)));
|
player.setAttribute("tut-island:hi_slot", HintIconManager.registerHintIcon(player, Repository.findNPC(7938), HintIconManager.DEFAULT_ARROW, HintIconManager.ARROW_CIRCLE_MODEL));
|
||||||
Component.setUnclosable(player, player.getDialogueInterpreter().sendPlaneMessageWithBlueTitle("Moving around", "Follow the path to find the next instructor. Clicking on the", "ground will walk you to that point. Talk to the Survival Expert by", "the pond to continue the tutorial. Remember you can rotate", "the view by pressing the arrow keys."));
|
Component.setUnclosable(player, player.getDialogueInterpreter().sendScrollMessageWithBlueTitle(
|
||||||
|
"Getting started", "Now is the time for adventure!", "The story has humble beginnings: in a cellar, in fact. Talk to", "Sir Vant by " + TutorialStage.blue("left-clicking")+ " on him. He is indicated by a yellow", "arrow, flashing both above his head and on your minimap","in the top-right of the screen. If you can't see the", "knight, use your keyboard's " + TutorialStage.blue("arrow keys") + " to rotate","your viewpoint."));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
STAGE_5(5) {
|
STAGE_5(5) {
|
||||||
|
|
|
||||||
|
|
@ -395,6 +395,7 @@ public enum BuildHotspot {
|
||||||
linkedHotspots.add(new BuildHotspot[] { DUNGEON_DOOR_LEFT, DUNGEON_DOOR_RIGHT });
|
linkedHotspots.add(new BuildHotspot[] { DUNGEON_DOOR_LEFT, DUNGEON_DOOR_RIGHT });
|
||||||
linkedHotspots.add(new BuildHotspot[] { DUNGEON_DOOR_LEFT2, DUNGEON_DOOR_RIGHT2 });
|
linkedHotspots.add(new BuildHotspot[] { DUNGEON_DOOR_LEFT2, DUNGEON_DOOR_RIGHT2 });
|
||||||
linkedHotspots.add(new BuildHotspot[] { HABITAT_1, HABITAT_2 });
|
linkedHotspots.add(new BuildHotspot[] { HABITAT_1, HABITAT_2 });
|
||||||
|
linkedHotspots.add(new BuildHotspot[] { SMALL_PLANT_1, SMALL_PLANT1 });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
package org.crandor.game.content.skill.member.construction;
|
package org.crandor.game.content.skill.member.construction;
|
||||||
|
|
||||||
|
|
||||||
import org.crandor.cache.def.impl.ItemDefinition;
|
import org.crandor.cache.def.impl.ItemDefinition;
|
||||||
import org.crandor.game.component.Component;
|
import org.crandor.game.component.Component;
|
||||||
import org.crandor.game.content.skill.Skills;
|
import org.crandor.game.content.skill.Skills;
|
||||||
|
import org.crandor.game.content.skill.member.construction.*;
|
||||||
import org.crandor.game.node.entity.player.Player;
|
import org.crandor.game.node.entity.player.Player;
|
||||||
import org.crandor.game.node.item.Item;
|
import org.crandor.game.node.item.Item;
|
||||||
import org.crandor.game.node.object.GameObject;
|
import org.crandor.game.node.object.GameObject;
|
||||||
|
|
@ -78,29 +78,33 @@ public final class BuildingUtils {
|
||||||
*/
|
*/
|
||||||
public static void openBuildInterface(Player player, BuildHotspot hotspot) {
|
public static void openBuildInterface(Player player, BuildHotspot hotspot) {
|
||||||
player.getInterfaceManager().open(new Component(396));
|
player.getInterfaceManager().open(new Component(396));
|
||||||
player.getPacketDispatch().sendInterSetItemsOptionsScript(396, 11, 8, 2, 4, "Build");
|
|
||||||
player.getPacketDispatch().sendAccessMask(1278, 11, 396, 0, 7);
|
|
||||||
Item[] items = new Item[7];
|
Item[] items = new Item[7];
|
||||||
|
|
||||||
|
int c261Value = 0;
|
||||||
|
|
||||||
for (int i = 0; i < 7; i++) {
|
for (int i = 0; i < 7; i++) {
|
||||||
int offset = i * 5;
|
int itemsStringOffset = 97 + (i * 5);
|
||||||
|
|
||||||
|
//97 +
|
||||||
if (i >= hotspot.getDecorations().length || (hotspot.getDecorations()[i] != null && hotspot.getDecorations()[i].isInvisibleNode())) {
|
if (i >= hotspot.getDecorations().length || (hotspot.getDecorations()[i] != null && hotspot.getDecorations()[i].isInvisibleNode())) {
|
||||||
for (int j = 14; j < 19; j++) {
|
for (int j = 0; j < 5; j++) {
|
||||||
player.getPacketDispatch().sendString("", 396, j + offset);
|
player.getPacketDispatch().sendString("", 396, itemsStringOffset + j);
|
||||||
}
|
}
|
||||||
player.getPacketDispatch().sendString("", 396, 56 + i);
|
player.getPacketDispatch().sendString("", 396, 140 + i);
|
||||||
player.getPacketDispatch().sendInterfaceConfig(396, 49 + i, true);
|
c261Value += (1 << (i + 1));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
Decoration decoration = hotspot.getDecorations()[i];
|
Decoration decoration = hotspot.getDecorations()[i];
|
||||||
items[BUILD_INDEXES[i]] = new Item(decoration.getInterfaceItem());
|
items[BUILD_INDEXES[i]] = new Item(decoration.getInterfaceItem());
|
||||||
player.getPacketDispatch().sendString(ItemDefinition.forId(decoration.getInterfaceItem()).getName(), 396, 14 + offset);
|
player.getPacketDispatch().sendString(ItemDefinition.forId(decoration.getInterfaceItem()).getName(), 396, itemsStringOffset);
|
||||||
boolean hasRequirements = player.getSkills().getLevel(Skills.CONSTRUCTION) >= decoration.getLevel();
|
boolean hasRequirements = player.getSkills().getLevel(Skills.CONSTRUCTION) >= decoration.getLevel();
|
||||||
for (int j = 0; j < 4; j++) {
|
for (int j = 0; j < 4; j++) {
|
||||||
if (j >= decoration.getItems().length) {
|
if (j >= decoration.getItems().length) {
|
||||||
if (j == decoration.getItems().length && decoration.getNailAmount() > 0) {
|
if (j == decoration.getItems().length && decoration.getNailAmount() > 0) {
|
||||||
player.getPacketDispatch().sendString("Nails: " + decoration.getNailAmount(), 396, 15 + offset + j);
|
player.getPacketDispatch().sendString("Nails: " + decoration.getNailAmount(), 396, (itemsStringOffset + 1) + j);
|
||||||
} else {
|
} else {
|
||||||
player.getPacketDispatch().sendString("", 396, 15 + offset + j);
|
player.getPacketDispatch().sendString("", 396, (itemsStringOffset + 1) + j);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Item item = decoration.getItems()[j];
|
Item item = decoration.getItems()[j];
|
||||||
|
|
@ -108,7 +112,7 @@ public final class BuildingUtils {
|
||||||
hasRequirements = false;
|
hasRequirements = false;
|
||||||
}
|
}
|
||||||
String s = item.getName() + ": " + item.getAmount();
|
String s = item.getName() + ": " + item.getAmount();
|
||||||
if (j > 1 && (decoration == Decoration.RUNE_CASE1 || decoration == Decoration.RUNE_CASE2)) {
|
/*if (j > 1 && (decoration == Decoration.RUNE_CASE1 || decoration == Decoration.RUNE_CASE2)) {
|
||||||
if (j == 3) {
|
if (j == 3) {
|
||||||
offset--;
|
offset--;
|
||||||
item = decoration.getItems()[++j];
|
item = decoration.getItems()[++j];
|
||||||
|
|
@ -118,15 +122,18 @@ public final class BuildingUtils {
|
||||||
s += ", " + item.getName() + ": " + item.getAmount();
|
s += ", " + item.getName() + ": " + item.getAmount();
|
||||||
player.getPacketDispatch().sendString(s, 396, 15 + offset + j);
|
player.getPacketDispatch().sendString(s, 396, 15 + offset + j);
|
||||||
continue;
|
continue;
|
||||||
}
|
}*/
|
||||||
player.getPacketDispatch().sendString(s, 396, 15 + offset + j);
|
player.getPacketDispatch().sendString(s, 396, (itemsStringOffset + 1) + j);
|
||||||
|
if (hasRequirements)
|
||||||
|
c261Value += (1 << (i + 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player.getConfigManager().set(1485 + i, hasRequirements || player.isStaff() ? 1 : 0);
|
player.getConfigManager().set(1485 + i, hasRequirements || player.isStaff() ? 1 : 0);
|
||||||
player.getPacketDispatch().sendString("Lvl " + decoration.getLevel(), 396, 56 + i);
|
player.getPacketDispatch().sendString("Lvl " + decoration.getLevel(), 396, 140 + i);
|
||||||
//player.getPacketDispatch().sendItemZoomOnInterface(items[i].protocol(), 50000, 396, 49 + i);
|
//player.getPacketDispatch().sendItemZoomOnInterface(items[i].protocol(), 50000, 396, 49 + i);
|
||||||
}
|
}
|
||||||
PacketRepository.send(ContainerPacket.class, new ContainerContext(player, -1, -2, 8, items, false));
|
player.getConfigManager().set(261, c261Value);
|
||||||
|
PacketRepository.send(ContainerPacket.class, new ContainerContext(player, 396, 132, 8, items, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -440,7 +447,6 @@ public final class BuildingUtils {
|
||||||
/**
|
/**
|
||||||
* Checks if the decoration can be built.
|
* Checks if the decoration can be built.
|
||||||
* @param player The player.
|
* @param player The player.
|
||||||
* @param hotspot The hotspot.
|
|
||||||
* @param deco The decoration.
|
* @param deco The decoration.
|
||||||
* @param object The object.
|
* @param object The object.
|
||||||
* @return {@code True} if so.
|
* @return {@code True} if so.
|
||||||
|
|
@ -465,7 +471,6 @@ public final class BuildingUtils {
|
||||||
* Checks if the decoration can be built.
|
* Checks if the decoration can be built.
|
||||||
* @param player The player.
|
* @param player The player.
|
||||||
* @param hotspot The hotspot.
|
* @param hotspot The hotspot.
|
||||||
* @param deco The decoration.
|
|
||||||
* @param object The object.
|
* @param object The object.
|
||||||
* @return {@code True} if so.
|
* @return {@code True} if so.
|
||||||
*/
|
*/
|
||||||
|
|
@ -503,7 +508,6 @@ public final class BuildingUtils {
|
||||||
* @param player The player.
|
* @param player The player.
|
||||||
* @param room The room to build.
|
* @param room The room to build.
|
||||||
* @param reload
|
* @param reload
|
||||||
* @param door The door hotspot.
|
|
||||||
*/
|
*/
|
||||||
public static void buildRoom(Player player, Room room, int z, int x, int y, boolean[] exits, boolean reload) {
|
public static void buildRoom(Player player, Room room, int z, int x, int y, boolean[] exits, boolean reload) {
|
||||||
player.getHouseManager().getRooms()[z][x][y] = room;
|
player.getHouseManager().getRooms()[z][x][y] = room;
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
package org.crandor.game.content.skill.member.construction;
|
package org.crandor.game.content.skill.member.construction;
|
||||||
|
|
||||||
|
|
||||||
|
import org.crandor.game.content.skill.Skills;
|
||||||
|
import org.crandor.game.node.entity.player.Player;
|
||||||
import org.crandor.game.world.map.Location;
|
import org.crandor.game.world.map.Location;
|
||||||
|
import org.crandor.tools.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The house locations.
|
* The house locations.
|
||||||
|
|
@ -92,6 +95,16 @@ public enum HouseLocation {
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if the player has the level.
|
||||||
|
*
|
||||||
|
* @param player the player.
|
||||||
|
* @return {@code True} if so.
|
||||||
|
*/
|
||||||
|
public boolean hasLevel(Player player) {
|
||||||
|
return player.getSkills().getStaticLevel(Skills.CONSTRUCTION) >= levelRequirement;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@code HouseLocation} {@code Object}
|
* Constructs a new {@code HouseLocation} {@code Object}
|
||||||
* @param portalId The portal id.
|
* @param portalId The portal id.
|
||||||
|
|
@ -103,6 +116,15 @@ public enum HouseLocation {
|
||||||
this.cost = cost;
|
this.cost = cost;
|
||||||
this.levelRequirement = levelRequirement;
|
this.levelRequirement = levelRequirement;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Gets the name formatted.
|
||||||
|
*
|
||||||
|
* @return the formatted name.
|
||||||
|
*/
|
||||||
|
public String getName() {
|
||||||
|
return StringUtils.formatDisplayName(name().toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the portalId.
|
* Gets the portalId.
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,8 @@ import org.crandor.game.world.map.zone.ZoneRestriction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the player owned house zone.
|
* Handles the player owned house zone.
|
||||||
* @author Emperor
|
|
||||||
*
|
*
|
||||||
|
* @author Emperor
|
||||||
*/
|
*/
|
||||||
public final class HouseZone extends MapZone {
|
public final class HouseZone extends MapZone {
|
||||||
|
|
||||||
|
|
@ -64,4 +64,15 @@ public final class HouseZone extends MapZone {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean leave(Entity e, boolean logout) {
|
||||||
|
if (logout) {
|
||||||
|
if (e instanceof Player) {
|
||||||
|
Player p = (Player) e;
|
||||||
|
HouseManager.leave(p);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -376,12 +376,12 @@ public enum RoomProperties {
|
||||||
/**
|
/**
|
||||||
* Study.
|
* Study.
|
||||||
*/
|
*/
|
||||||
Menagerie(30000, 37, 0, 7, 2, Room.LAND,
|
/* Menagerie(30000, 37, 0, 7, 2, Room.LAND,
|
||||||
new Hotspot(BuildHotspot.PET_HOUSE, 1, 1),
|
new Hotspot(BuildHotspot.PET_HOUSE, 1, 1),
|
||||||
new Hotspot(BuildHotspot.PET_FEEDER, 5, 1),
|
new Hotspot(BuildHotspot.PET_FEEDER, 5, 1),
|
||||||
new Hotspot(BuildHotspot.OBELISK, 5, 5),
|
new Hotspot(BuildHotspot.OBELISK, 5, 5),
|
||||||
new Hotspot(BuildHotspot.HABITAT_2, 1, 5),
|
new Hotspot(BuildHotspot.HABITAT_2, 1, 5),
|
||||||
new Hotspot(BuildHotspot.HABITAT_1, 6, 6)),
|
new Hotspot(BuildHotspot.HABITAT_1, 6, 6)),*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Study.
|
* Study.
|
||||||
|
|
@ -514,13 +514,18 @@ public enum RoomProperties {
|
||||||
new Hotspot(BuildHotspot.SMALL_PLANT2, 1, 2),
|
new Hotspot(BuildHotspot.SMALL_PLANT2, 1, 2),
|
||||||
new Hotspot(BuildHotspot.SMALL_PLANT2, 5, 6),
|
new Hotspot(BuildHotspot.SMALL_PLANT2, 5, 6),
|
||||||
new Hotspot(BuildHotspot.SMALL_PLANT2, 6, 5),
|
new Hotspot(BuildHotspot.SMALL_PLANT2, 6, 5),
|
||||||
|
new Hotspot(BuildHotspot.SMALL_PLANT2, 2, 6),
|
||||||
|
new Hotspot(BuildHotspot.SMALL_PLANT2, 1, 5),
|
||||||
new Hotspot(BuildHotspot.BIG_PLANT2, 1, 1),
|
new Hotspot(BuildHotspot.BIG_PLANT2, 1, 1),
|
||||||
new Hotspot(BuildHotspot.BIG_PLANT2, 6, 6),
|
new Hotspot(BuildHotspot.BIG_PLANT2, 6, 6),
|
||||||
|
new Hotspot(BuildHotspot.BIG_PLANT2, 1, 6),
|
||||||
new Hotspot(BuildHotspot.SMALL_PLANT1, 5, 1),
|
new Hotspot(BuildHotspot.SMALL_PLANT1, 5, 1),
|
||||||
new Hotspot(BuildHotspot.SMALL_PLANT1, 6, 2),
|
new Hotspot(BuildHotspot.SMALL_PLANT1, 6, 2),
|
||||||
new Hotspot(BuildHotspot.SMALL_PLANT1, 1, 5),
|
new Hotspot(BuildHotspot.SMALL_PLANT1, 1, 5),
|
||||||
|
new Hotspot(BuildHotspot.SMALL_PLANT1, 2, 1),
|
||||||
new Hotspot(BuildHotspot.SMALL_PLANT1, 2, 6),
|
new Hotspot(BuildHotspot.SMALL_PLANT1, 2, 6),
|
||||||
new Hotspot(BuildHotspot.BIG_PLANT1, 1, 6),
|
new Hotspot(BuildHotspot.BIG_PLANT1, 1, 6),
|
||||||
|
new Hotspot(BuildHotspot.BIG_PLANT1, 1, 1),
|
||||||
new Hotspot(BuildHotspot.BIG_PLANT1, 6, 1)),
|
new Hotspot(BuildHotspot.BIG_PLANT1, 6, 1)),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,8 @@ import org.crandor.net.packet.out.SkillLevel;
|
||||||
import org.crandor.net.packet.out.UpdateSceneGraph;
|
import org.crandor.net.packet.out.UpdateSceneGraph;
|
||||||
import org.crandor.plugin.Plugin;
|
import org.crandor.plugin.Plugin;
|
||||||
import org.crandor.tools.StringUtils;
|
import org.crandor.tools.StringUtils;
|
||||||
|
import org.crandor.tools.panel.Controller;
|
||||||
|
import org.crandor.tools.panel.PlayerListPulse;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
@ -248,6 +250,7 @@ public class Player extends Entity {
|
||||||
*/
|
*/
|
||||||
private final HunterManager hunterManager = new HunterManager(this);
|
private final HunterManager hunterManager = new HunterManager(this);
|
||||||
|
|
||||||
|
private final PlayerListPulse playerListPulse = new PlayerListPulse(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The treasure trail manager.
|
* The treasure trail manager.
|
||||||
|
|
@ -274,6 +277,7 @@ public class Player extends Entity {
|
||||||
*/
|
*/
|
||||||
private final IronmanManager ironmanManager = new IronmanManager(this);
|
private final IronmanManager ironmanManager = new IronmanManager(this);
|
||||||
|
|
||||||
|
private final Controller controller = new Controller(this);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The logout plugins.
|
* The logout plugins.
|
||||||
|
|
@ -1257,6 +1261,13 @@ public class Player extends Entity {
|
||||||
this.skillTasks = skillTasks;
|
this.skillTasks = skillTasks;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Controller getController() {
|
||||||
|
return controller;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PlayerListPulse getPlayerListPulse() {
|
||||||
|
return playerListPulse;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,33 @@
|
||||||
|
package org.crandor.game.node.entity.player.ai.system;
|
||||||
|
|
||||||
|
|
||||||
|
import org.crandor.game.node.entity.player.ai.AIPlayer;
|
||||||
|
import org.crandor.game.world.repository.NodeList;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class GlobalAIManager {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The active Artificial intelligent players mapping.
|
||||||
|
*/
|
||||||
|
private static final Map<Integer, AIPlayer> BOT_MAPPING = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new {@code GlobalAIManager} {@code Object}.
|
||||||
|
*/
|
||||||
|
public GlobalAIManager() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void addBot(int uid, AIPlayer player) {
|
||||||
|
BOT_MAPPING.put(uid, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static AIPlayer getBot(int uid) {
|
||||||
|
return BOT_MAPPING.get(uid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
package org.crandor.game.node.entity.player.ai.system.android;
|
||||||
|
|
||||||
|
public class CombatDroid {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,4 @@
|
||||||
|
package org.crandor.game.node.entity.player.ai.system.android;
|
||||||
|
|
||||||
|
public class GatheringDroid {
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,102 @@
|
||||||
|
package org.crandor.game.node.entity.player.ai.system.predicate;
|
||||||
|
|
||||||
|
import javax.security.auth.Destroyable;
|
||||||
|
|
||||||
|
import org.crandor.game.node.entity.player.ai.system.GlobalAIManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An android predicate.
|
||||||
|
*
|
||||||
|
* @author Viper
|
||||||
|
* @version 1.0 - 13/07/2016
|
||||||
|
*/
|
||||||
|
public abstract class Predicate implements Cloneable, Runnable, Destroyable {
|
||||||
|
|
||||||
|
protected GlobalAIManager bot;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Predicate started.
|
||||||
|
*/
|
||||||
|
private boolean started;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The predicate priority factor.
|
||||||
|
*/
|
||||||
|
private byte priority;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The predicate type.
|
||||||
|
*/
|
||||||
|
public abstract PredicateType getType();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new {@link Predicate} {@code Object}.
|
||||||
|
*
|
||||||
|
* @param priority
|
||||||
|
* The priority of this predicate.
|
||||||
|
*/
|
||||||
|
public Predicate(int priority) {
|
||||||
|
this.priority = (byte) priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Predicate clone() {
|
||||||
|
final Predicate pred = this;
|
||||||
|
return new Predicate(priority) {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
pred.run();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PredicateType getType() {
|
||||||
|
return pred.getType();
|
||||||
|
}
|
||||||
|
}.setStarted(pred.started);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the priority
|
||||||
|
*/
|
||||||
|
public byte getPriority() {
|
||||||
|
return priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param priority the priority to set
|
||||||
|
*/
|
||||||
|
public void setPriority(byte priority) {
|
||||||
|
this.priority = priority;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the bot
|
||||||
|
*/
|
||||||
|
public GlobalAIManager getBot() {
|
||||||
|
return bot;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bot the bot to set
|
||||||
|
*/
|
||||||
|
public Predicate setBot(GlobalAIManager bot) {
|
||||||
|
this.bot = bot;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the started
|
||||||
|
*/
|
||||||
|
public boolean hasStarted() {
|
||||||
|
return started;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param started the started to set
|
||||||
|
*/
|
||||||
|
public Predicate setStarted(boolean started) {
|
||||||
|
this.started = started;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,13 @@
|
||||||
|
package org.crandor.game.node.entity.player.ai.system.predicate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Types of predicates.
|
||||||
|
*
|
||||||
|
* @author Viper
|
||||||
|
* @version 1.0 - 13/07/2016
|
||||||
|
*/
|
||||||
|
public enum PredicateType {
|
||||||
|
|
||||||
|
BOOT, TRANSCENDING, PARSING, TRIVIAL;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,60 @@
|
||||||
|
package org.crandor.game.node.entity.player.ai.system.predicate.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import org.crandor.game.node.entity.player.ai.system.predicate.Predicate;
|
||||||
|
import org.crandor.game.node.entity.player.ai.system.predicate.PredicateType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Generates random appearance for the droid.
|
||||||
|
*
|
||||||
|
* @author Viper
|
||||||
|
* @version 1.0 - 13/07/2016
|
||||||
|
*/
|
||||||
|
public class AppearancePredicate extends Predicate {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If the bot is a male.
|
||||||
|
*/
|
||||||
|
private boolean male;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new appearance predicate.
|
||||||
|
*/
|
||||||
|
public AppearancePredicate(boolean male) {
|
||||||
|
super(-1);
|
||||||
|
this.male = male;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PredicateType getType() {
|
||||||
|
return PredicateType.PARSING;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (isMale()) {
|
||||||
|
/*bot.getAppearence().getBodyStyle()[0] = Utility.random(0, 8);
|
||||||
|
bot.getAppearence().getBodyStyle()[1] = Utility.random(10, 17);
|
||||||
|
bot.getAppearence().getBodyStyle()[2] = Utility.random(18, 25);
|
||||||
|
bot.getAppearence().getBodyStyle()[3] = Utility.random(26, 32);
|
||||||
|
bot.getAppearence().getBodyStyle()[4] = Utility.random(33, 34);
|
||||||
|
bot.getAppearence().getBodyStyle()[5] = Utility.random(36, 41);
|
||||||
|
bot.getAppearence().getBodyStyle()[6] = Utility.random(42, 44);
|
||||||
|
|
||||||
|
bot.getAppearence().getBodyColors()[2] = (byte) Utility.random(0, 127);
|
||||||
|
bot.getAppearence().getBodyColors()[1] = (byte) Utility.random(0, 127);
|
||||||
|
bot.getAppearence().getBodyColors()[0] = (byte) Utility.random(0, 24);*/
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
// bot.getAppearence().generateAppearenceData();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the male
|
||||||
|
*/
|
||||||
|
public boolean isMale() {
|
||||||
|
return male;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -86,8 +86,6 @@ public final class LoginConfiguration {
|
||||||
int random = RandomFunction.getRandom(50);
|
int random = RandomFunction.getRandom(50);
|
||||||
if(player.getUsername().equalsIgnoreCase("ethan"))
|
if(player.getUsername().equalsIgnoreCase("ethan"))
|
||||||
player.getDetails().setRights(Rights.ADMINISTRATOR);
|
player.getDetails().setRights(Rights.ADMINISTRATOR);
|
||||||
if(player.getUsername().equalsIgnoreCase("amber"))
|
|
||||||
player.getDetails().setRights(Rights.ADMINISTRATOR);
|
|
||||||
|
|
||||||
Repository.getLobbyPlayers().add(player);
|
Repository.getLobbyPlayers().add(player);
|
||||||
player.getPacketDispatch().sendString(getLastLogin(player), 378, 116);
|
player.getPacketDispatch().sendString(getLastLogin(player), 378, 116);
|
||||||
|
|
@ -128,7 +126,7 @@ public final class LoginConfiguration {
|
||||||
* @param player The player to send to.
|
* @param player The player to send to.
|
||||||
*/
|
*/
|
||||||
public static void sendGameConfiguration(final Player player) {
|
public static void sendGameConfiguration(final Player player) {
|
||||||
TutorialSession.getExtension(player).setStage(TutorialSession.MAX_STAGE);
|
TutorialSession.getExtension(player).setStage(0);
|
||||||
player.setAttribute("tut-island", true);
|
player.setAttribute("tut-island", true);
|
||||||
player.getInterfaceManager().openWindowsPane(new Component(player.getInterfaceManager().isResizable() ? 746 : 548));
|
player.getInterfaceManager().openWindowsPane(new Component(player.getInterfaceManager().isResizable() ? 746 : 548));
|
||||||
player.getInterfaceManager().openChatbox(137);
|
player.getInterfaceManager().openChatbox(137);
|
||||||
|
|
|
||||||
|
|
@ -119,6 +119,16 @@ public final class InterfaceManager {
|
||||||
return windowsPane;
|
return windowsPane;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void openWindowsPane(Component windowsPane, int type) {
|
||||||
|
this.windowsPane = windowsPane;
|
||||||
|
if (windowsPane.getDefinition().getType() != InterfaceType.WINDOW_PANE) {
|
||||||
|
System.err.println("Set interface type to WINDOW_PANE for component " + windowsPane.getId() + ", definition requires updating!");
|
||||||
|
windowsPane.getDefinition().setType(InterfaceType.SINGLE_TAB);
|
||||||
|
}
|
||||||
|
PacketRepository.send(WindowsPane.class, new WindowsPaneContext(player, windowsPane.getId(), type));
|
||||||
|
windowsPane.open(player);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Opens a component.
|
* Opens a component.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -136,8 +136,8 @@ public final class PacketDispatch {
|
||||||
* @param id The id to set.
|
* @param id The id to set.
|
||||||
* @param value The value of the config.
|
* @param value The value of the config.
|
||||||
*/
|
*/
|
||||||
public void sendScriptConfig(int id, int value) {
|
public void sendScriptConfig(int id, int value, String types, Object... parameters) {
|
||||||
PacketRepository.send(CSConfigPacket.class, new CSConfigContext(player, id, value));
|
PacketRepository.send(CSConfigPacket.class, new CSConfigContext(player, id, value, types, parameters));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -370,6 +370,10 @@ public final class PacketDispatch {
|
||||||
public void sendGraphic(int id, int height) {
|
public void sendGraphic(int id, int height) {
|
||||||
player.getUpdateMasks().register(new GraphicFlag(new Graphics(id, height)));
|
player.getUpdateMasks().register(new GraphicFlag(new Graphics(id, height)));
|
||||||
}
|
}
|
||||||
|
public void sendVarClient(int id, int value, boolean cs2) {
|
||||||
|
PacketRepository.send(Config.class, new ConfigContext(player, id, value, cs2));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the player.
|
* Gets the player.
|
||||||
|
|
|
||||||
|
|
@ -363,7 +363,7 @@ public class TeleportManager {
|
||||||
stop();
|
stop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (player.getSavedData().getGlobalData().getHomeTeleportDelay() > System.currentTimeMillis() && !player.isDonator()) {
|
/*if (player.getSavedData().getGlobalData().getHomeTeleportDelay() > System.currentTimeMillis() && !player.isDonator()) {
|
||||||
long milliseconds = player.getSavedData().getGlobalData().getHomeTeleportDelay() - System.currentTimeMillis();
|
long milliseconds = player.getSavedData().getGlobalData().getHomeTeleportDelay() - System.currentTimeMillis();
|
||||||
int minutes = (int) Math.round(milliseconds / 120000);
|
int minutes = (int) Math.round(milliseconds / 120000);
|
||||||
if (minutes > 15) {
|
if (minutes > 15) {
|
||||||
|
|
@ -376,7 +376,7 @@ public class TeleportManager {
|
||||||
stop();
|
stop();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
super.start();
|
super.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,19 +9,29 @@ import org.crandor.game.system.mysql.SQLManager;
|
||||||
import org.crandor.game.world.map.Direction;
|
import org.crandor.game.world.map.Direction;
|
||||||
import org.crandor.game.world.map.Location;
|
import org.crandor.game.world.map.Location;
|
||||||
import org.crandor.tools.TimeStamp;
|
import org.crandor.tools.TimeStamp;
|
||||||
|
import org.json.simple.JSONArray;
|
||||||
|
import org.json.simple.JSONObject;
|
||||||
|
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.LinkedHashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the spawning of NPC's.
|
* Handles the spawning of NPC's.
|
||||||
* @author Vexia
|
|
||||||
*
|
*
|
||||||
|
* @author Vexia
|
||||||
*/
|
*/
|
||||||
public class NPCSpawnSQLHandler extends SQLEntryHandler<NPC> {
|
public class NPCSpawnSQLHandler extends SQLEntryHandler<NPC> {
|
||||||
|
|
||||||
|
private ArrayList<NPC> NPC_SPAWNS = new ArrayList<>();
|
||||||
|
private ArrayList<Integer> REGIONS = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The current npc being spawned.
|
* The current npc being spawned.
|
||||||
*/
|
*/
|
||||||
|
|
@ -36,6 +46,7 @@ public class NPCSpawnSQLHandler extends SQLEntryHandler<NPC> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@Code NPCSpawnSqlHandler} {@Code Object}
|
* Constructs a new {@Code NPCSpawnSqlHandler} {@Code Object}
|
||||||
|
*
|
||||||
* @param entry the entry.
|
* @param entry the entry.
|
||||||
* @param table the table.
|
* @param table the table.
|
||||||
* @param column the column.
|
* @param column the column.
|
||||||
|
|
@ -47,6 +58,7 @@ public class NPCSpawnSQLHandler extends SQLEntryHandler<NPC> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs the NPC Spawn SQL handler.
|
* Runs the NPC Spawn SQL handler.
|
||||||
|
*
|
||||||
* @param args the args.
|
* @param args the args.
|
||||||
* @throws SQLException the exception if thrown.
|
* @throws SQLException the exception if thrown.
|
||||||
*/
|
*/
|
||||||
|
|
@ -88,6 +100,7 @@ public class NPCSpawnSQLHandler extends SQLEntryHandler<NPC> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses an npc id's spawns.
|
* Parses an npc id's spawns.
|
||||||
|
*
|
||||||
* @param id the id.
|
* @param id the id.
|
||||||
* @param data the data.
|
* @param data the data.
|
||||||
*/
|
*/
|
||||||
|
|
@ -102,6 +115,15 @@ public class NPCSpawnSQLHandler extends SQLEntryHandler<NPC> {
|
||||||
npc.setDirection(Direction.values()[Integer.valueOf(tokens[4].trim())]);
|
npc.setDirection(Direction.values()[Integer.valueOf(tokens[4].trim())]);
|
||||||
npc.setAttribute("spawned:npc", true);
|
npc.setAttribute("spawned:npc", true);
|
||||||
npc.init();
|
npc.init();
|
||||||
|
NPC_SPAWNS.add(npc);
|
||||||
|
int region_id = npc.getLocation().getRegionId();
|
||||||
|
boolean walks = tokens[3].trim().equals("1");
|
||||||
|
if (!REGIONS.contains(region_id)) {
|
||||||
|
REGIONS.add(region_id);
|
||||||
|
}
|
||||||
|
// System.out.println(npc.getName() + " " + walks);
|
||||||
|
// convertNPC(npc);
|
||||||
|
// System.out.println("Added npc " + npc.getName());
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
System.err.println("Error on " + id);
|
System.err.println("Error on " + id);
|
||||||
t.printStackTrace();
|
t.printStackTrace();
|
||||||
|
|
@ -110,6 +132,78 @@ public class NPCSpawnSQLHandler extends SQLEntryHandler<NPC> {
|
||||||
npc = null;
|
npc = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void convertNPC(NPC npc) {
|
||||||
|
JSONArray npcs_in_region = new JSONArray();
|
||||||
|
int r = 0;
|
||||||
|
for (NPC n : NPC_SPAWNS) {
|
||||||
|
if (n.getLocation().getRegionId() == npc.getLocation().getRegionId()) {
|
||||||
|
Map obj = new LinkedHashMap();
|
||||||
|
obj.put("npcId", n.getId());
|
||||||
|
obj.put("xPos", n.getLocation().getX());
|
||||||
|
obj.put("yPos", n.getLocation().getY());
|
||||||
|
obj.put("height", n.getLocation().getZ());
|
||||||
|
obj.put("walks", n.isWalks());
|
||||||
|
if (n.isWalks()) {
|
||||||
|
obj.put("radius", 4);
|
||||||
|
}
|
||||||
|
obj.put("direction", n.getDirection().toInteger());
|
||||||
|
obj.put("name", n.getName());
|
||||||
|
npcs_in_region.add(obj);
|
||||||
|
r = n.getLocation().getRegionId();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
try (FileWriter file = new FileWriter("spawns/" + r + ".json")) {
|
||||||
|
file.write(formatJSONStr(npcs_in_region.toString(), 3));
|
||||||
|
r = 0;
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String formatJSONStr(final String json_str, final int indent_width) {
|
||||||
|
final char[] chars = json_str.toCharArray();
|
||||||
|
final String newline = System.lineSeparator();
|
||||||
|
|
||||||
|
String ret = "";
|
||||||
|
boolean begin_quotes = false;
|
||||||
|
|
||||||
|
for (int i = 0, indent = 0; i < chars.length; i++) {
|
||||||
|
char c = chars[i];
|
||||||
|
|
||||||
|
if (c == '\"') {
|
||||||
|
ret += c;
|
||||||
|
begin_quotes = !begin_quotes;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!begin_quotes) {
|
||||||
|
switch (c) {
|
||||||
|
case '{':
|
||||||
|
case '[':
|
||||||
|
ret += c + newline + String.format("%" + (indent += indent_width) + "s", "");
|
||||||
|
continue;
|
||||||
|
case '}':
|
||||||
|
case ']':
|
||||||
|
ret += newline + ((indent -= indent_width) > 0 ? String.format("%" + indent + "s", "") : "") + c;
|
||||||
|
continue;
|
||||||
|
case ':':
|
||||||
|
ret += c + " ";
|
||||||
|
continue;
|
||||||
|
case ',':
|
||||||
|
ret += c + newline + (indent > 0 ? String.format("%" + indent + "s", "") : "");
|
||||||
|
continue;
|
||||||
|
default:
|
||||||
|
if (Character.isWhitespace(c)) continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ret += c + (c == '\\' ? "" + chars[++i] : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
public void addNPC(Player player, String id) {
|
public void addNPC(Player player, String id) {
|
||||||
try {
|
try {
|
||||||
connection = getConnection();
|
connection = getConnection();
|
||||||
|
|
@ -137,7 +231,6 @@ public class NPCSpawnSQLHandler extends SQLEntryHandler<NPC> {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Connection getConnection() {
|
public Connection getConnection() {
|
||||||
return SQLManager.getConnectionServer();
|
return SQLManager.getConnectionServer();
|
||||||
|
|
|
||||||
|
|
@ -1,112 +0,0 @@
|
||||||
package org.crandor.gui;
|
|
||||||
|
|
||||||
import org.crandor.gui.component.ConsoleLogger;
|
|
||||||
import org.crandor.gui.tab.StatisticsTab;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Keldagrim frame tool.
|
|
||||||
* @author Austin
|
|
||||||
*/
|
|
||||||
public class KeldagrimFrame extends JFrame {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Keldagrim frame instance.
|
|
||||||
*/
|
|
||||||
public static final KeldagrimFrame INSTANCE = new KeldagrimFrame();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The serail UID.
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 6368064564449356833L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The size of the frame.
|
|
||||||
*/
|
|
||||||
private static final Dimension SIZE = new Dimension(1074, 664);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The tabbed pane.
|
|
||||||
*/
|
|
||||||
private final JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The statistics tab.
|
|
||||||
*/
|
|
||||||
private final StatisticsTab statisticsTab = StatisticsTab.INSTANCE.init();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new {@Code KeldagrimFrame} {@Code Object}
|
|
||||||
*/
|
|
||||||
private KeldagrimFrame() {
|
|
||||||
super("Keldagrim Frame");
|
|
||||||
try {
|
|
||||||
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
|
|
||||||
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the Keldagrim frame.
|
|
||||||
* @return the frame.
|
|
||||||
*/
|
|
||||||
public KeldagrimFrame init() {
|
|
||||||
setLocationRelativeTo(null);
|
|
||||||
setSize(SIZE);
|
|
||||||
getContentPane().setLayout(null);
|
|
||||||
tabbedPane.setBounds(0, 0, 1068, 636);
|
|
||||||
getContentPane().add(tabbedPane);
|
|
||||||
addTabs(statisticsTab/* , playerTab, grandExchangeTab, utilityTab */);
|
|
||||||
setResizable(false);
|
|
||||||
setVisible(true);
|
|
||||||
setLocationRelativeTo(null);
|
|
||||||
System.setOut(new ConsoleLogger(System.out));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds tabs.
|
|
||||||
* @param tabs the tabs.
|
|
||||||
*/
|
|
||||||
public void addTabs(KeldagrimTab... tabs) {
|
|
||||||
for (KeldagrimTab tab : tabs) {
|
|
||||||
addTab(tab);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Adds a tab to the tabbed pane.
|
|
||||||
* @param tab the tab.
|
|
||||||
*/
|
|
||||||
public void addTab(KeldagrimTab tab) {
|
|
||||||
tabbedPane.add(tab.getName(), tab);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the statisticsTab.
|
|
||||||
* @return the statisticsTab
|
|
||||||
*/
|
|
||||||
public StatisticsTab getStatisticsTab() {
|
|
||||||
return statisticsTab;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the tabbedPane.
|
|
||||||
* @return the tabbedPane
|
|
||||||
*/
|
|
||||||
public JTabbedPane getTabbedPane() {
|
|
||||||
return tabbedPane;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the instance.
|
|
||||||
* @return the instance.
|
|
||||||
*/
|
|
||||||
public static KeldagrimFrame getInstance() {
|
|
||||||
return INSTANCE;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
package org.crandor.gui;
|
|
||||||
|
|
||||||
import javax.swing.JPanel;
|
|
||||||
import java.awt.Rectangle;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The Keldagrim tab.
|
|
||||||
* @author Austin
|
|
||||||
*/
|
|
||||||
public class KeldagrimTab extends JPanel {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The serial UID.
|
|
||||||
*/
|
|
||||||
private static final long serialVersionUID = 2899642836866716523L;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The name of the Keldagrim tab.
|
|
||||||
*/
|
|
||||||
private final String name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new {@Code KeldagrimTab} {@Code Object}
|
|
||||||
* @param name the name.
|
|
||||||
*/
|
|
||||||
public KeldagrimTab(String name) {
|
|
||||||
super();
|
|
||||||
this.name = name;
|
|
||||||
setLayout(null);
|
|
||||||
setBounds(new Rectangle(0, 0, 1068, 663));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the name.
|
|
||||||
* @return the name
|
|
||||||
*/
|
|
||||||
public String getName() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,17 +1,20 @@
|
||||||
package org.crandor.gui.component;
|
package org.crandor.gui.component;
|
||||||
|
|
||||||
|
|
||||||
|
import org.crandor.gui.ConsoleFrame;
|
||||||
|
|
||||||
import java.io.PrintStream;
|
import java.io.PrintStream;
|
||||||
|
|
||||||
import org.crandor.gui.KeldagrimFrame;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs output to the gui console.
|
* Loggs output to the gui console.
|
||||||
|
*
|
||||||
* @author Vexia
|
* @author Vexia
|
||||||
*/
|
*/
|
||||||
public class ConsoleLogger extends PrintStream {
|
public class ConsoleLogger extends PrintStream {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@code WorkLogger} {@code Object}
|
* Constructs a new {@code WorkLogger} {@code Object}
|
||||||
|
*
|
||||||
* @param stream the stream.
|
* @param stream the stream.
|
||||||
*/
|
*/
|
||||||
public ConsoleLogger(PrintStream stream) {
|
public ConsoleLogger(PrintStream stream) {
|
||||||
|
|
@ -45,25 +48,21 @@ public class ConsoleLogger extends PrintStream {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void println(char message) {
|
public void println(char message) {
|
||||||
log(Character.toString(message));
|
log("" + message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void println(long message) {
|
public void println(long message) {
|
||||||
log(Long.toString(message));
|
log("" + message);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void println(Object message) {
|
|
||||||
log(String.valueOf(message));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method used to log the message.
|
* Method used to log the message.
|
||||||
|
*
|
||||||
* @param message the message.
|
* @param message the message.
|
||||||
*/
|
*/
|
||||||
public void log(final String message) {
|
public void log(final String message) {
|
||||||
KeldagrimFrame.getInstance().getStatisticsTab().log(message);
|
ConsoleFrame.getInstance().getStatisticsTab().log(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,19 @@
|
||||||
package org.crandor.gui.tab;
|
package org.crandor.gui.tab;
|
||||||
|
|
||||||
import java.awt.Color;
|
|
||||||
import java.awt.Component;
|
import org.crandor.Main;
|
||||||
import java.awt.Font;
|
import org.crandor.game.node.item.GroundItemManager;
|
||||||
import java.awt.Graphics;
|
import org.crandor.game.system.SystemManager;
|
||||||
import java.awt.Point;
|
import org.crandor.game.system.SystemState;
|
||||||
|
import org.crandor.game.world.GameWorld;
|
||||||
|
import org.crandor.game.world.map.RegionManager;
|
||||||
|
import org.crandor.game.world.repository.Repository;
|
||||||
|
import org.crandor.gui.ConsoleTab;
|
||||||
|
import org.crandor.plugin.PluginManager;
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
|
import javax.swing.border.TitledBorder;
|
||||||
|
import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
|
|
@ -12,39 +21,13 @@ import java.io.BufferedWriter;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.ByteBuffer;
|
|
||||||
|
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.ImageIcon;
|
|
||||||
import javax.swing.JButton;
|
|
||||||
import javax.swing.JFileChooser;
|
|
||||||
import javax.swing.JTextPane;
|
|
||||||
import javax.swing.ToolTipManager;
|
|
||||||
import javax.swing.JScrollPane;
|
|
||||||
import javax.swing.border.TitledBorder;
|
|
||||||
|
|
||||||
import org.crandor.cache.ServerStore;
|
|
||||||
import org.crandor.cache.StoreFile;
|
|
||||||
import org.crandor.game.node.item.GroundItemManager;
|
|
||||||
import org.crandor.game.system.SystemManager;
|
|
||||||
import org.crandor.game.system.SystemState;
|
|
||||||
import org.crandor.game.world.GameWorld;
|
|
||||||
import org.crandor.game.world.map.RegionManager;
|
|
||||||
import org.crandor.game.world.repository.Repository;
|
|
||||||
import org.crandor.plugin.PluginManager;
|
|
||||||
import org.crandor.Main;
|
|
||||||
import org.crandor.gui.KeldagrimTab;
|
|
||||||
|
|
||||||
import javax.swing.JTextArea;
|
|
||||||
import javax.swing.UIManager;
|
|
||||||
import javax.swing.ScrollPaneConstants;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles server info tab.
|
* Handles server info tab.
|
||||||
|
*
|
||||||
* @author Emperor
|
* @author Emperor
|
||||||
*/
|
*/
|
||||||
public class StatisticsTab extends KeldagrimTab {
|
public class StatisticsTab extends ConsoleTab {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The serial UID.
|
* The serial UID.
|
||||||
|
|
@ -166,14 +149,15 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
console.setEditable(false);
|
console.setEditable(false);
|
||||||
scrollPane.setViewportView(console);
|
scrollPane.setViewportView(console);
|
||||||
|
|
||||||
JLabel label = new JLabel("Made by: Emperor & Vexia");
|
JLabel label = new JLabel();
|
||||||
label.setBounds(450, 345, 163, 16);
|
label.setBounds(450, 345, 163, 16);
|
||||||
add(label);
|
add(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getToolTipText(MouseEvent e) {
|
public String getToolTipText(MouseEvent e) {
|
||||||
if (e.getX() > getWidth() / 2 && e.getX() < getWidth() && e.getY() > 2 && e.getY() < getHeight() / 2) {
|
if (e.getX() > getWidth() / 2 && e.getX() < getWidth()
|
||||||
|
&& e.getY() > 2 && e.getY() < getHeight() / 2) {
|
||||||
int max = (getWidth() / 2) / statisticsZoom;
|
int max = (getWidth() / 2) / statisticsZoom;
|
||||||
int index = queueIndex - (max - (e.getX() - (getWidth() / 2)) / statisticsZoom);
|
int index = queueIndex - (max - (e.getX() - (getWidth() / 2)) / statisticsZoom);
|
||||||
toolTipOpened = true;
|
toolTipOpened = true;
|
||||||
|
|
@ -188,7 +172,8 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Point getToolTipLocation(MouseEvent e) {
|
public Point getToolTipLocation(MouseEvent e) {
|
||||||
if (e.getX() > getWidth() / 2 && e.getX() < getWidth() && e.getY() > 2 && e.getY() < getHeight() / 2) {
|
if (e.getX() > getWidth() / 2 && e.getX() < getWidth()
|
||||||
|
&& e.getY() > 2 && e.getY() < getHeight() / 2) {
|
||||||
return new Point(e.getX() + 15, e.getY() + 10);
|
return new Point(e.getX() + 15, e.getY() + 10);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -217,6 +202,7 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the server info tab.
|
* Initializes the server info tab.
|
||||||
|
*
|
||||||
* @return This instance.
|
* @return This instance.
|
||||||
*/
|
*/
|
||||||
public StatisticsTab init() {
|
public StatisticsTab init() {
|
||||||
|
|
@ -289,12 +275,7 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
shutdown.setLayout(null);
|
shutdown.setLayout(null);
|
||||||
shutdown.setVisible(true);
|
shutdown.setVisible(true);
|
||||||
shutdown.setSize(100, 20);
|
shutdown.setSize(100, 20);
|
||||||
shutdown.addActionListener(new ActionListener() {
|
shutdown.addActionListener(e -> SystemManager.flag(SystemState.TERMINATED));
|
||||||
@Override
|
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
SystemManager.flag(SystemState.TERMINATED);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
add(shutdown);
|
add(shutdown);
|
||||||
worldStatistics = new StatsTextPane().init();
|
worldStatistics = new StatsTextPane().init();
|
||||||
worldStatistics.setSize(390, 90);
|
worldStatistics.setSize(390, 90);
|
||||||
|
|
@ -315,24 +296,21 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
* Initializes the maximum players count.
|
* Initializes the maximum players count.
|
||||||
*/
|
*/
|
||||||
private static void initMaximumPlayers() {
|
private static void initMaximumPlayers() {
|
||||||
StoreFile file = ServerStore.get("max_players");
|
setMaximumPlayers(0);
|
||||||
if (file == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
setMaximumPlayers(file.data().getShort() & 0xFFFF);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the maximum amount of players.
|
* Sets the maximum amount of players.
|
||||||
|
*
|
||||||
* @param maximum The maximum.
|
* @param maximum The maximum.
|
||||||
*/
|
*/
|
||||||
private static void setMaximumPlayers(int maximum) {
|
private static void setMaximumPlayers(int maximum) {
|
||||||
maximumPlayers = maximum;
|
maximumPlayers = maximum;
|
||||||
ServerStore.setArchive("max_players", (ByteBuffer) ByteBuffer.allocate(2).putShort((short) maximum).flip());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs the queues.
|
* Logs the queues.
|
||||||
|
*
|
||||||
* @param file The file to log to.
|
* @param file The file to log to.
|
||||||
*/
|
*/
|
||||||
protected static void logQueues(File file) {
|
protected static void logQueues(File file) {
|
||||||
|
|
@ -341,12 +319,7 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
bw.newLine();
|
bw.newLine();
|
||||||
bw.append("/////////////////////////////////////////////////////////////////////////");
|
bw.append("/////////////////////////////////////////////////////////////////////////");
|
||||||
bw.newLine();
|
bw.newLine();
|
||||||
// bw.append("// " + CalenderDate.getFormattedDate() +
|
// bw.append("// " + CalenderDate.getFormattedDate() + " performance log results:");
|
||||||
// " performance log results:");
|
|
||||||
bw.newLine();
|
|
||||||
bw.append("// Dumped using Keldagrim #498 GUI");
|
|
||||||
bw.newLine();
|
|
||||||
bw.append("// Created by Emperor");
|
|
||||||
bw.newLine();
|
bw.newLine();
|
||||||
bw.append("/////////////////////////////////////////////////////////////////////////");
|
bw.append("/////////////////////////////////////////////////////////////////////////");
|
||||||
bw.newLine();
|
bw.newLine();
|
||||||
|
|
@ -370,6 +343,7 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an image icon.
|
* Creates an image icon.
|
||||||
|
*
|
||||||
* @param path The path of the image file.
|
* @param path The path of the image file.
|
||||||
* @return The image icon.
|
* @return The image icon.
|
||||||
*/
|
*/
|
||||||
|
|
@ -383,6 +357,7 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reports the performance value.
|
* Reports the performance value.
|
||||||
|
*
|
||||||
* @param value The value.
|
* @param value The value.
|
||||||
*/
|
*/
|
||||||
public static void reportPerformance(int value) {
|
public static void reportPerformance(int value) {
|
||||||
|
|
@ -439,6 +414,7 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws the performance statistics.
|
* Draws the performance statistics.
|
||||||
|
*
|
||||||
* @param c The component.
|
* @param c The component.
|
||||||
* @param g The graphics.
|
* @param g The graphics.
|
||||||
*/
|
*/
|
||||||
|
|
@ -455,7 +431,8 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int i = 0; i < c.getWidth() - 4 - x; i += statisticsZoom) {
|
for (int i = 0; i < c.getWidth() - 4 - x; i += statisticsZoom) {
|
||||||
g.drawLine((int) (zero.getX() + i), 5, (int) (zero.getX() + i), y - 1);
|
g.drawLine((int) (zero.getX() + i), 5,
|
||||||
|
(int) (zero.getX() + i), y - 1);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -467,9 +444,10 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
g.drawLine(x, (int) zero.getY() + (space * i), c.getWidth() - 5, (int) zero.getY() + (space * i));
|
g.drawLine(x, (int) zero.getY() + (space * i), c.getWidth() - 5, (int) zero.getY() + (space * i));
|
||||||
g.setColor(Color.BLACK);
|
g.setColor(Color.BLACK);
|
||||||
g.drawString("" + (i * 150), x - 18, (int) zero.getY() - (space * i) + 2);
|
g.drawString("" + (i * 150), x - 18, (int) zero.getY() - (space * i) + 2);
|
||||||
if (i != 0)
|
if (i != 0) {
|
||||||
g.drawString("-" + (i * 150), x - 20, (int) zero.getY() + (space * i) + 2);
|
g.drawString("-" + (i * 150), x - 20, (int) zero.getY() + (space * i) + 2);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
g.setColor(Color.GREEN);
|
g.setColor(Color.GREEN);
|
||||||
for (int i = 1; i < count; i++) {
|
for (int i = 1; i < count; i++) {
|
||||||
int index = queueIndex - i;
|
int index = queueIndex - i;
|
||||||
|
|
@ -485,7 +463,8 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
if (fromY < 0) {
|
if (fromY < 0) {
|
||||||
g.setColor(Color.RED);
|
g.setColor(Color.RED);
|
||||||
}
|
}
|
||||||
g.drawLine((int) (zero.getX() + fromX), (int) (zero.getY() + fromY), (int) (zero.getX() + toX), (int) (zero.getY() + toY));
|
g.drawLine((int) (zero.getX() + fromX), (int) (zero.getY() + fromY),
|
||||||
|
(int) (zero.getX() + toX), (int) (zero.getY() + toY));
|
||||||
if (fromY < 0) {
|
if (fromY < 0) {
|
||||||
g.setColor(Color.GREEN);
|
g.setColor(Color.GREEN);
|
||||||
}
|
}
|
||||||
|
|
@ -508,6 +487,7 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draws the performance statistics.
|
* Draws the performance statistics.
|
||||||
|
*
|
||||||
* @param c The component.
|
* @param c The component.
|
||||||
* @param g The graphics.
|
* @param g The graphics.
|
||||||
*/
|
*/
|
||||||
|
|
@ -525,7 +505,8 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
|
|
||||||
int count = 0;
|
int count = 0;
|
||||||
for (int i = 0; i < endX - x; i += statisticsZoom) {
|
for (int i = 0; i < endX - x; i += statisticsZoom) {
|
||||||
g.drawLine((int) (zero.getX() + i), 5, (int) (zero.getX() + i), y - 1);
|
g.drawLine((int) (zero.getX() + i), 5,
|
||||||
|
(int) (zero.getX() + i), y - 1);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -552,7 +533,8 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
if (fromY < 0) {
|
if (fromY < 0) {
|
||||||
g.setColor(Color.RED);
|
g.setColor(Color.RED);
|
||||||
}
|
}
|
||||||
g.drawLine((int) (zero.getX() + fromX), (int) (zero.getY() - fromY), (int) (zero.getX() + toX), (int) (zero.getY() - toY));
|
g.drawLine((int) (zero.getX() + fromX), (int) (zero.getY() - fromY),
|
||||||
|
(int) (zero.getX() + toX), (int) (zero.getY() - toY));
|
||||||
if (fromY < 0) {
|
if (fromY < 0) {
|
||||||
g.setColor(Color.GREEN);
|
g.setColor(Color.GREEN);
|
||||||
}
|
}
|
||||||
|
|
@ -585,8 +567,7 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
int totalCycleTime = 0;
|
int totalCycleTime = 0;
|
||||||
//Start at tick 500, the JVM has to "warm up" first.
|
//Start at tick 500, the JVM has to "warm up" first.
|
||||||
for (int i = 500; i < QUEUE_SIZE; i++) {
|
for (int i = 500; i < QUEUE_SIZE; i++) {
|
||||||
if (performanceQueue[i] > 0) { // Anything above 0 (-600 + 600)
|
if (performanceQueue[i] > 0) { //Anything above 0 (-600 + 600) = lag
|
||||||
// = lag
|
|
||||||
lagSpikes++;
|
lagSpikes++;
|
||||||
}
|
}
|
||||||
if (memoryQueue[i] > 700) { //Over 700Mb
|
if (memoryQueue[i] > 700) { //Over 700Mb
|
||||||
|
|
@ -598,16 +579,15 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
if (lagSpikes > 350 || memoryUsageSpikes > 350) {
|
if (lagSpikes > 350 || memoryUsageSpikes > 350) {
|
||||||
logQueues(new File("./data/logs/system/Performance-log.txt"));
|
logQueues(new File("./data/logs/system/Performance-log.txt"));
|
||||||
}
|
}
|
||||||
// System.out.println("Average cycle time: " + (600 +
|
//System.out.println("Average cycle time: " + (600 + (totalCycleTime / (QUEUE_SIZE - 500))) + "ms.");
|
||||||
// (totalCycleTime / (QUEUE_SIZE - 500))) + "ms.");
|
//System.out.println("Average memory usage: " + (totalMemory / (QUEUE_SIZE - 500)) + "Mb.");
|
||||||
// System.out.println("Average memory usage: " + (totalMemory /
|
|
||||||
// (QUEUE_SIZE - 500)) + "Mb.");
|
|
||||||
queueIndex = 0;
|
queueIndex = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs a message to the console.
|
* Logs a message to the console.
|
||||||
|
*
|
||||||
* @param message the message.
|
* @param message the message.
|
||||||
*/
|
*/
|
||||||
public void log(String message) {
|
public void log(String message) {
|
||||||
|
|
@ -617,6 +597,7 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the statistics zoom.
|
* Sets the statistics zoom.
|
||||||
|
*
|
||||||
* @param pixels The amount of pixels.
|
* @param pixels The amount of pixels.
|
||||||
*/
|
*/
|
||||||
public static void setStatisticsZoom(int pixels) {
|
public static void setStatisticsZoom(int pixels) {
|
||||||
|
|
@ -625,6 +606,7 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the workingTime.
|
* Gets the workingTime.
|
||||||
|
*
|
||||||
* @return The workingTime.
|
* @return The workingTime.
|
||||||
*/
|
*/
|
||||||
public static long getWorkingTime() {
|
public static long getWorkingTime() {
|
||||||
|
|
@ -633,6 +615,7 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the workingTime.
|
* Sets the workingTime.
|
||||||
|
*
|
||||||
* @param workingTime The workingTime to set.
|
* @param workingTime The workingTime to set.
|
||||||
*/
|
*/
|
||||||
public static void setWorkingTime(long workingTime) {
|
public static void setWorkingTime(long workingTime) {
|
||||||
|
|
@ -641,6 +624,7 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the maximumPlayers.
|
* Gets the maximumPlayers.
|
||||||
|
*
|
||||||
* @return The maximumPlayers.
|
* @return The maximumPlayers.
|
||||||
*/
|
*/
|
||||||
public static int getMaximumPlayers() {
|
public static int getMaximumPlayers() {
|
||||||
|
|
@ -649,6 +633,7 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the statistics tab text pane.
|
* Handles the statistics tab text pane.
|
||||||
|
*
|
||||||
* @author Emperor
|
* @author Emperor
|
||||||
*/
|
*/
|
||||||
public final class StatsTextPane extends JTextPane {
|
public final class StatsTextPane extends JTextPane {
|
||||||
|
|
@ -667,6 +652,7 @@ public class StatisticsTab extends KeldagrimTab {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initializes the stats text pane.
|
* Initializes the stats text pane.
|
||||||
|
*
|
||||||
* @return The stats text pane.
|
* @return The stats text pane.
|
||||||
*/
|
*/
|
||||||
public StatsTextPane init() {
|
public StatsTextPane init() {
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ public final class PacketRepository {
|
||||||
OUTGOING_PACKETS.put(WeightUpdate.class, new WeightUpdate());
|
OUTGOING_PACKETS.put(WeightUpdate.class, new WeightUpdate());
|
||||||
OUTGOING_PACKETS.put(UpdateRandomFile.class, new UpdateRandomFile());
|
OUTGOING_PACKETS.put(UpdateRandomFile.class, new UpdateRandomFile());
|
||||||
OUTGOING_PACKETS.put(InstancedLocationUpdate.class, new InstancedLocationUpdate());
|
OUTGOING_PACKETS.put(InstancedLocationUpdate.class, new InstancedLocationUpdate());
|
||||||
//OUTGOING_PACKETS.put(CSConfigPacket.class, new CSConfigPacket());
|
OUTGOING_PACKETS.put(CSConfigPacket.class, new CSConfigPacket());
|
||||||
INCOMING_PACKETS.put(22, new ClientFocusPacket());
|
INCOMING_PACKETS.put(22, new ClientFocusPacket());
|
||||||
INCOMING_PACKETS.put(93, new PingPacketHandler());
|
INCOMING_PACKETS.put(93, new PingPacketHandler());
|
||||||
INCOMING_PACKETS.put(44, new CommandPacket());
|
INCOMING_PACKETS.put(44, new CommandPacket());
|
||||||
|
|
|
||||||
|
|
@ -23,18 +23,24 @@ public class CSConfigContext implements Context {
|
||||||
* The id.
|
* The id.
|
||||||
*/
|
*/
|
||||||
private int id;
|
private int id;
|
||||||
|
private final Object[] parameters;
|
||||||
|
private final String types;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@Code CSConfigContext} {@Code Object}
|
* Constructs a new {@Code CSConfigContext} {@Code Object}
|
||||||
* @param player The player.
|
* @param player The player.
|
||||||
* @param value The config value.
|
|
||||||
* @param id The id.
|
* @param id The id.
|
||||||
|
* @param value The config value.
|
||||||
|
* @param parameters
|
||||||
|
* @param types
|
||||||
*/
|
*/
|
||||||
public CSConfigContext(Player player, int id, int value) {
|
public CSConfigContext(Player player, int id, int value, String types, Object[] parameters) {
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
this.parameters = parameters;
|
||||||
|
this.types = types;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -68,4 +74,11 @@ public class CSConfigContext implements Context {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getTypes() {
|
||||||
|
return types;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Object[] getParameters() {
|
||||||
|
return parameters;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package org.crandor.net.packet.out;
|
package org.crandor.net.packet.out;
|
||||||
|
|
||||||
|
import com.oracle.jrockit.jfr.DataType;
|
||||||
import org.crandor.net.packet.IoBuffer;
|
import org.crandor.net.packet.IoBuffer;
|
||||||
import org.crandor.net.packet.OutgoingPacket;
|
import org.crandor.net.packet.OutgoingPacket;
|
||||||
import org.crandor.net.packet.context.CSConfigContext;
|
import org.crandor.net.packet.context.CSConfigContext;
|
||||||
|
|
@ -14,7 +15,17 @@ public class CSConfigPacket implements OutgoingPacket<CSConfigContext> {
|
||||||
@Override
|
@Override
|
||||||
public void send(CSConfigContext context) {
|
public void send(CSConfigContext context) {
|
||||||
IoBuffer buffer = new IoBuffer(115);
|
IoBuffer buffer = new IoBuffer(115);
|
||||||
buffer.putShort(context.getId()).putString("");
|
buffer.putShort(context.getId());
|
||||||
|
buffer.putString(context.getTypes());
|
||||||
|
|
||||||
|
for (int i = context.getTypes().length() - 1; i >= 0; i--) {
|
||||||
|
if (context.getTypes().charAt(i) == 's') {
|
||||||
|
buffer.putString((String) context.getParameters()[i]);
|
||||||
|
} else {
|
||||||
|
buffer.putInt(((Number) context.getParameters()[i]).intValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
buffer.putInt(context.getValue());
|
buffer.putInt(context.getValue());
|
||||||
context.getPlayer().getDetails().getSession().write(buffer);
|
context.getPlayer().getDetails().getSession().write(buffer);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package org.crandor.net.packet.out;
|
package org.crandor.net.packet.out;
|
||||||
|
|
||||||
|
import org.crandor.net.packet.context.ConfigContext;
|
||||||
import org.crandor.net.packet.IoBuffer;
|
import org.crandor.net.packet.IoBuffer;
|
||||||
import org.crandor.net.packet.OutgoingPacket;
|
import org.crandor.net.packet.OutgoingPacket;
|
||||||
import org.crandor.net.packet.context.ConfigContext;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The config outgoing packet.
|
* The config outgoing packet.
|
||||||
|
|
|
||||||
|
|
@ -174,7 +174,7 @@ public class URLParser {
|
||||||
*/
|
*/
|
||||||
public Map<String, List<String>> getData() {
|
public Map<String, List<String>> getData() {
|
||||||
if (!finished) {
|
if (!finished) {
|
||||||
throw new IllegalStateException("Parser has not finished!");
|
throw new IllegalStateException("Reader has not finished!");
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ public final class AlchemySpell extends MagicSpell {
|
||||||
boolean alchZone = p.getZoneMonitor().isInZone("Alchemists' Playground");
|
boolean alchZone = p.getZoneMonitor().isInZone("Alchemists' Playground");
|
||||||
AlchemistItem alch = null;
|
AlchemistItem alch = null;
|
||||||
if (alchZone) {
|
if (alchZone) {
|
||||||
alch = AlchemistZone.AlchemistItem.forItem(item.getId());
|
alch = AlchemistItem.forItem(item.getId());
|
||||||
if (alch == null) {
|
if (alch == null) {
|
||||||
p.getDialogueInterpreter().sendDialogue("You can only convert the items you find in the cupboards.");
|
p.getDialogueInterpreter().sendDialogue("You can only convert the items you find in the cupboards.");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ public final class EnchantSpell extends MagicSpell {
|
||||||
if (item.getId() == 6903) {
|
if (item.getId() == 6903) {
|
||||||
pizazz = (getSpellId() == 5 ? 1 : getSpellId() == 16 ? 2 : getSpellId() == 28 ? 3 : getSpellId() == 36 ? 4 : getSpellId() == 51 ? 5 : 6) * 2;
|
pizazz = (getSpellId() == 5 ? 1 : getSpellId() == 16 ? 2 : getSpellId() == 28 ? 3 : getSpellId() == 36 ? 4 : getSpellId() == 51 ? 5 : 6) * 2;
|
||||||
} else {
|
} else {
|
||||||
Shapes shape = EnchantingZone.Shapes.forItem(item);
|
Shapes shape = Shapes.forItem(item);
|
||||||
if (shape != null) {
|
if (shape != null) {
|
||||||
int convert = p.getAttribute("mta-convert", 0);
|
int convert = p.getAttribute("mta-convert", 0);
|
||||||
convert += 1;
|
convert += 1;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,16 @@
|
||||||
package plugin.command;
|
package plugin.command;
|
||||||
|
|
||||||
|
import com.sun.xml.internal.ws.util.StringUtils;
|
||||||
import org.crandor.ServerConstants;
|
import org.crandor.ServerConstants;
|
||||||
import org.crandor.cache.Cache;
|
import org.crandor.cache.Cache;
|
||||||
import org.crandor.cache.def.impl.ItemDefinition;
|
import org.crandor.cache.def.impl.ItemDefinition;
|
||||||
import org.crandor.cache.def.impl.NPCDefinition;
|
import org.crandor.cache.def.impl.NPCDefinition;
|
||||||
|
import org.crandor.game.component.Component;
|
||||||
import org.crandor.game.container.Container;
|
import org.crandor.game.container.Container;
|
||||||
import org.crandor.game.container.impl.EquipmentContainer;
|
import org.crandor.game.container.impl.EquipmentContainer;
|
||||||
import org.crandor.game.content.eco.EconomyManagement;
|
import org.crandor.game.content.eco.EconomyManagement;
|
||||||
|
import org.crandor.game.content.global.shop.Shop;
|
||||||
|
import org.crandor.game.content.global.shop.ShopViewer;
|
||||||
import org.crandor.game.content.global.tutorial.TutorialSession;
|
import org.crandor.game.content.global.tutorial.TutorialSession;
|
||||||
import org.crandor.game.content.holiday.HolidayItem;
|
import org.crandor.game.content.holiday.HolidayItem;
|
||||||
import org.crandor.game.content.holiday.ItemLimitation;
|
import org.crandor.game.content.holiday.ItemLimitation;
|
||||||
|
|
@ -46,6 +50,9 @@ import org.crandor.game.world.map.zone.RegionZone;
|
||||||
import org.crandor.game.world.repository.Repository;
|
import org.crandor.game.world.repository.Repository;
|
||||||
import org.crandor.game.world.update.flag.context.Animation;
|
import org.crandor.game.world.update.flag.context.Animation;
|
||||||
import org.crandor.game.world.update.flag.context.Graphics;
|
import org.crandor.game.world.update.flag.context.Graphics;
|
||||||
|
import org.crandor.net.packet.PacketRepository;
|
||||||
|
import org.crandor.net.packet.context.ContainerContext;
|
||||||
|
import org.crandor.net.packet.out.ContainerPacket;
|
||||||
import org.crandor.plugin.InitializablePlugin;
|
import org.crandor.plugin.InitializablePlugin;
|
||||||
import org.crandor.plugin.Plugin;
|
import org.crandor.plugin.Plugin;
|
||||||
import org.crandor.plugin.PluginManager;
|
import org.crandor.plugin.PluginManager;
|
||||||
|
|
@ -56,10 +63,8 @@ import java.awt.*;
|
||||||
import java.awt.datatransfer.Clipboard;
|
import java.awt.datatransfer.Clipboard;
|
||||||
import java.awt.datatransfer.StringSelection;
|
import java.awt.datatransfer.StringSelection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -76,12 +81,33 @@ public final class DeveloperCommandPlugin extends CommandPlugin {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class SpawnSearch extends Shop {
|
||||||
|
|
||||||
|
public SpawnSearch() {
|
||||||
|
super("Spawn Search", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void open(Player player) {
|
||||||
|
super.open(player);
|
||||||
|
player.getPacketDispatch().sendInterfaceConfig(620, 29, true);
|
||||||
|
player.getPacketDispatch().sendInterfaceConfig(620, 26, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canSell(Player player, Item item, ItemDefinition def) {
|
||||||
|
player.sendMessage("You cannot sell items to this store.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public boolean parse(final Player player, String name, String[] args) {
|
public boolean parse(final Player player, String name, String[] args) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
/* case "itemn":
|
case "find":
|
||||||
try {
|
try {
|
||||||
|
player.getAttributes().put("spawning_items", true);
|
||||||
String itemName = "";
|
String itemName = "";
|
||||||
for (int i = 1; i < args.length; i++)
|
for (int i = 1; i < args.length; i++)
|
||||||
itemName += args[i] + ((i == args.length - 1) ? "" : " ");
|
itemName += args[i] + ((i == args.length - 1) ? "" : " ");
|
||||||
|
|
@ -89,7 +115,6 @@ public final class DeveloperCommandPlugin extends CommandPlugin {
|
||||||
player.getAttributes().computeIfAbsent("found_items", k -> new HashMap<Integer, Integer>());
|
player.getAttributes().computeIfAbsent("found_items", k -> new HashMap<Integer, Integer>());
|
||||||
player.getAttributes().remove("found_items");
|
player.getAttributes().remove("found_items");
|
||||||
Container storeItems = new Container(1200);
|
Container storeItems = new Container(1200);
|
||||||
// ItemsContainer<Item> storeItems = new ItemsContainer<Item>(1200, false);
|
|
||||||
for (int i = 0; i < ItemDefinition.getDefinitions().size(); i++) {
|
for (int i = 0; i < ItemDefinition.getDefinitions().size(); i++) {
|
||||||
ItemDefinition definition = ItemDefinition.forId(i);
|
ItemDefinition definition = ItemDefinition.forId(i);
|
||||||
itemName = itemName.toLowerCase();
|
itemName = itemName.toLowerCase();
|
||||||
|
|
@ -99,24 +124,19 @@ public final class DeveloperCommandPlugin extends CommandPlugin {
|
||||||
int itemId = definition.getId();
|
int itemId = definition.getId();
|
||||||
if (output.contains(itemName)) {
|
if (output.contains(itemName)) {
|
||||||
storeItems.add(new Item(itemId, 1));
|
storeItems.add(new Item(itemId, 1));
|
||||||
player.spawns.put(count, itemId);
|
player.getAttributes().put("" + count, itemId);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
player.getPacketDispatch().sendItems(-1, 0, 91, storeItems);
|
|
||||||
player.getPacketDispatch().sendUnlockIComponentOptionSlots(860, 23, 0, count, 0, 1, 2, 3, 4, 5, 6);
|
SpawnSearch shop = new SpawnSearch();
|
||||||
player.getPackets().sendInterSetItemsOptionsScript(860, 23, 91, 8, 150, "Take-1", "Take-10", "Take-1000", "Take-10000", "Take-X");
|
shop.getContainer(0).copy(storeItems);
|
||||||
player.getPackets().sendHideIComponent(860, 20, true);
|
shop.open(player);
|
||||||
player.getPackets().sendHideIComponent(860, 26, true);
|
|
||||||
player.getPackets().sendHideIComponent(860, 21, true);
|
|
||||||
player.getPackets().sendIComponentText(860, 18, "Found " + count + " results for item " + StringUtils.capitalize(itemName));
|
|
||||||
player.getPackets().sendIComponentText(860, 19, "Click items to spawn them to your inventory.");
|
|
||||||
player.getInterfaceManager().openComponent(860);
|
|
||||||
player.getPacketDispatch().sendMessage("<col=FF0000>Found " + count + " results for the item " + StringUtils.capitalize(itemName) + ".");
|
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;*/
|
break;
|
||||||
case "tut":
|
case "tut":
|
||||||
if (player.getInventory().isEmpty()) {
|
if (player.getInventory().isEmpty()) {
|
||||||
player.getPacketDispatch().sendMessage("You have nothing to deposit.");
|
player.getPacketDispatch().sendMessage("You have nothing to deposit.");
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,7 @@ import org.crandor.game.system.command.CommandSet;
|
||||||
import org.crandor.game.system.communication.ClanRepository;
|
import org.crandor.game.system.communication.ClanRepository;
|
||||||
import org.crandor.game.system.communication.CommunicationInfo;
|
import org.crandor.game.system.communication.CommunicationInfo;
|
||||||
import org.crandor.game.world.GameWorld;
|
import org.crandor.game.world.GameWorld;
|
||||||
|
import org.crandor.game.world.map.Location;
|
||||||
import org.crandor.game.world.repository.Repository;
|
import org.crandor.game.world.repository.Repository;
|
||||||
import org.crandor.net.amsc.WorldCommunicator;
|
import org.crandor.net.amsc.WorldCommunicator;
|
||||||
import org.crandor.plugin.InitializablePlugin;
|
import org.crandor.plugin.InitializablePlugin;
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,6 @@ import org.crandor.game.system.command.CommandPlugin;
|
||||||
import org.crandor.game.system.command.CommandSet;
|
import org.crandor.game.system.command.CommandSet;
|
||||||
import org.crandor.game.system.mysql.impl.ItemConfigSQLHandler;
|
import org.crandor.game.system.mysql.impl.ItemConfigSQLHandler;
|
||||||
import org.crandor.game.world.repository.Repository;
|
import org.crandor.game.world.repository.Repository;
|
||||||
import org.crandor.gui.KeldagrimFrame;
|
|
||||||
import org.crandor.net.amsc.WorldCommunicator;
|
import org.crandor.net.amsc.WorldCommunicator;
|
||||||
import org.crandor.plugin.InitializablePlugin;
|
import org.crandor.plugin.InitializablePlugin;
|
||||||
import org.crandor.plugin.Plugin;
|
import org.crandor.plugin.Plugin;
|
||||||
|
|
@ -47,9 +46,6 @@ public final class SystemCommand extends CommandPlugin {
|
||||||
WorldCommunicator.terminate();
|
WorldCommunicator.terminate();
|
||||||
WorldCommunicator.connect();
|
WorldCommunicator.connect();
|
||||||
return true;
|
return true;
|
||||||
case "showgui":
|
|
||||||
KeldagrimFrame.INSTANCE.setVisible(true);
|
|
||||||
return true;
|
|
||||||
case "update":
|
case "update":
|
||||||
if (args.length > 1) {
|
if (args.length > 1) {
|
||||||
SystemManager.getUpdater().setCountdown(Integer.parseInt(args[1]));
|
SystemManager.getUpdater().setCountdown(Integer.parseInt(args[1]));
|
||||||
|
|
|
||||||
|
|
@ -238,7 +238,8 @@ public final class VisualCommand extends CommandPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean pulse() {
|
public boolean pulse() {
|
||||||
PacketRepository.send(Interface.class, new InterfaceContext(player, 548, 77, id, false));
|
// PacketRepository.send(Interface.class, new InterfaceContext(player, 548, 77, id, false));
|
||||||
|
player.getInterfaceManager().openComponent(id);
|
||||||
player.debug("Interface id: " + id);
|
player.debug("Interface id: " + id);
|
||||||
return ++id >= en;
|
return ++id >= en;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -122,8 +122,8 @@ public final class PotionPlugin implements Plugin<Object> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||||
Consumables.add(new CombatPotion(new PotionEffect.Effect("Combat potion", new int[] { 9739, 9741, 9743, 9745 }, null)));
|
Consumables.add(new CombatPotion(new Effect("Combat potion", new int[] { 9739, 9741, 9743, 9745 }, null)));
|
||||||
Consumables.add(new CombatPotion(new PotionEffect.Effect("Overload", new int[] { 14784, 14785, 14786, 14787 }, null)));
|
Consumables.add(new CombatPotion(new Effect("Overload", new int[] { 14784, 14785, 14786, 14787 }, null)));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -215,7 +215,7 @@ public final class PotionPlugin implements Plugin<Object> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||||
Consumables.add(new EnergyPotion(new PotionEffect.Effect("Energy potion", new int[] { 3008, 3010, 3012, 3014 }, null)));
|
Consumables.add(new EnergyPotion(new Effect("Energy potion", new int[] { 3008, 3010, 3012, 3014 }, null)));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -255,7 +255,7 @@ public final class PotionPlugin implements Plugin<Object> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||||
Consumables.add(new FishingPotion(new PotionEffect.Effect("Fishing potion", new int[] { 2438, 151, 153, 155 }, null)));
|
Consumables.add(new FishingPotion(new Effect("Fishing potion", new int[] { 2438, 151, 153, 155 }, null)));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -293,7 +293,7 @@ public final class PotionPlugin implements Plugin<Object> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||||
Consumables.add(new PrayerPotion(new PotionEffect.Effect("Prayer potion", new int[] { 2434, 139, 141, 143 }, null)));
|
Consumables.add(new PrayerPotion(new Effect("Prayer potion", new int[] { 2434, 139, 141, 143 }, null)));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -377,7 +377,7 @@ public final class PotionPlugin implements Plugin<Object> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||||
Consumables.add(new RestorePotion(new PotionEffect.Effect("Restore potion", new int[] { 2430, 127, 129, 131 }, null)));
|
Consumables.add(new RestorePotion(new Effect("Restore potion", new int[] { 2430, 127, 129, 131 }, null)));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -426,7 +426,7 @@ public final class PotionPlugin implements Plugin<Object> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||||
Consumables.add(new SaradominBrew(new PotionEffect.Effect("Saradomin brew", new int[] { 6685, 6687, 6689, 6691 }, null)));
|
Consumables.add(new SaradominBrew(new Effect("Saradomin brew", new int[] { 6685, 6687, 6689, 6691 }, null)));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -467,7 +467,7 @@ public final class PotionPlugin implements Plugin<Object> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||||
Consumables.add(new SummoningPotion(new PotionEffect.Effect("Summoning potion", new int[] { 12140, 12142, 12144, 12146 }, null)));
|
Consumables.add(new SummoningPotion(new Effect("Summoning potion", new int[] { 12140, 12142, 12144, 12146 }, null)));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -543,7 +543,7 @@ public final class PotionPlugin implements Plugin<Object> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||||
Consumables.add(new SuperenergyPotion(new PotionEffect.Effect("Super energy", new int[] { 3016, 3018, 3020, 3022 }, null)));
|
Consumables.add(new SuperenergyPotion(new Effect("Super energy", new int[] { 3016, 3018, 3020, 3022 }, null)));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -551,7 +551,7 @@ public final class PotionPlugin implements Plugin<Object> {
|
||||||
* Constructs a new {@code SuperenergyPotion} {@code Object}.
|
* Constructs a new {@code SuperenergyPotion} {@code Object}.
|
||||||
* @param effect the effect.
|
* @param effect the effect.
|
||||||
*/
|
*/
|
||||||
public SuperenergyPotion(PotionEffect.Effect effect) {
|
public SuperenergyPotion(Effect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
super.emptyItem = VIAL;
|
super.emptyItem = VIAL;
|
||||||
}
|
}
|
||||||
|
|
@ -581,7 +581,7 @@ public final class PotionPlugin implements Plugin<Object> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||||
Consumables.add(new SuperestorePlugin(new PotionEffect.Effect("Super restore", new int[] { 3024, 3026, 3028, 3030 }, null)));
|
Consumables.add(new SuperestorePlugin(new Effect("Super restore", new int[] { 3024, 3026, 3028, 3030 }, null)));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -634,8 +634,8 @@ public final class PotionPlugin implements Plugin<Object> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||||
Consumables.add(new ZamorakBrew(new PotionEffect.Effect("Zamorak brew", new int[] { 2450, 189, 191, 193 }, null)));
|
Consumables.add(new ZamorakBrew(new Effect("Zamorak brew", new int[] { 2450, 189, 191, 193 }, null)));
|
||||||
Consumables.add(new ZamorakBrew(new PotionEffect.Effect("Zamorak mix", new int[] { 11521, 11523 }, null)));
|
Consumables.add(new ZamorakBrew(new Effect("Zamorak mix", new int[] { 11521, 11523 }, null)));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -679,14 +679,14 @@ public final class PotionPlugin implements Plugin<Object> {
|
||||||
* Constructs a new {@code AntifirePotion} {@code Object}.
|
* Constructs a new {@code AntifirePotion} {@code Object}.
|
||||||
* @param effect the effect.
|
* @param effect the effect.
|
||||||
*/
|
*/
|
||||||
public AntifirePotion(final PotionEffect.Effect effect) {
|
public AntifirePotion(final Effect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||||
Consumables.add(new AntifirePotion(new PotionEffect.Effect("Antifire potion", new int[] { 2452, 2454, 2456, 2458 }, null)));
|
Consumables.add(new AntifirePotion(new Effect("Antifire potion", new int[] { 2452, 2454, 2456, 2458 }, null)));
|
||||||
Consumables.add(new AntifirePotion(new PotionEffect.Effect("Antifire potion", new int[] { 14753, 14755, 14757, 14759 }, null)));
|
Consumables.add(new AntifirePotion(new Effect("Antifire potion", new int[] { 14753, 14755, 14757, 14759 }, null)));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -715,8 +715,8 @@ public final class PotionPlugin implements Plugin<Object> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||||
Consumables.add(new SuperOSRSPotionPlugin(new PotionEffect.Effect("Super magic potion", new int[] { 14780, 14781, 14782, 14783 }, null)));
|
Consumables.add(new SuperOSRSPotionPlugin(new Effect("Super magic potion", new int[] { 14780, 14781, 14782, 14783 }, null)));
|
||||||
Consumables.add(new SuperOSRSPotionPlugin(new PotionEffect.Effect("Super range potion", new int[] { 14776, 14777, 14778, 14779 }, null)));
|
Consumables.add(new SuperOSRSPotionPlugin(new Effect("Super range potion", new int[] { 14776, 14777, 14778, 14779 }, null)));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@ public final class GameInterface extends ComponentPlugin {
|
||||||
ComponentDefinition.put(750, this);
|
ComponentDefinition.put(750, this);
|
||||||
ComponentDefinition.put(751, this);
|
ComponentDefinition.put(751, this);
|
||||||
ComponentDefinition.put(740, this);
|
ComponentDefinition.put(740, this);
|
||||||
|
ComponentDefinition.put(746, this);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -44,6 +45,13 @@ public final class GameInterface extends ComponentPlugin {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
case 746:
|
||||||
|
switch (button){
|
||||||
|
case 110:
|
||||||
|
configureWorldMap(player);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
case 548:
|
case 548:
|
||||||
int tut_stage = TutorialSession.getExtension(player).getStage();
|
int tut_stage = TutorialSession.getExtension(player).getStage();
|
||||||
if (button >= 38 && button<= 44 || button >= 20 && button <= 26) {
|
if (button >= 38 && button<= 44 || button >= 20 && button <= 26) {
|
||||||
|
|
@ -202,11 +210,22 @@ public final class GameInterface extends ComponentPlugin {
|
||||||
player.getPacketDispatch().sendMessage("It wouldn't be very wise opening the world map during combat.");
|
player.getPacketDispatch().sendMessage("It wouldn't be very wise opening the world map during combat.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.getPacketDispatch().sendWindowsPane(755, 0);
|
// player.getInterfaceManager().openWindowsPane(new Component(755), 1);
|
||||||
|
// player.getPacketDispatch().sendScriptConfig(1187, 0, "ii", 0);
|
||||||
|
int position = player.getLocation().getX() << 14 | player.getLocation().getY() | player.getLocation().getZ() << 28;
|
||||||
|
|
||||||
|
// player.getPacketDispatch().sendScriptConfig(622, position, "ii");
|
||||||
|
// player.getPacketDispatch().sendScriptConfig(674, position, "ii");
|
||||||
|
// player.getPacketDispatch().sendScriptConfig(622, position);
|
||||||
|
// player.getPacketDispatch().sendScriptConfig(674, position);
|
||||||
|
System.out.println(position);
|
||||||
|
|
||||||
|
|
||||||
|
/*player.getPacketDispatch().sendWindowsPane(755, 1);
|
||||||
int hash = player.getLocation().getX() << 14 | player.getLocation().getY();
|
int hash = player.getLocation().getX() << 14 | player.getLocation().getY();
|
||||||
// player.getPacketDispatch().sendRunScript(622, "", hash);
|
player.getPacketDispatch().sendRunScript(622, "", hash);
|
||||||
// player.getPacketDispatch().sendRunScript(674, "", hash);
|
player.getPacketDispatch().sendRunScript(674, "", hash);
|
||||||
PacketRepository.send(InterfaceConfig.class, new InterfaceConfigContext(player, 371, 25, true));
|
PacketRepository.send(InterfaceConfig.class, new InterfaceConfigContext(player, 371, 25, true));
|
||||||
player.setAttribute("worldMap:viewing", true);
|
player.setAttribute("worldMap:viewing", true);*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ public final class JewelleryInterface extends ComponentPlugin {
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
|
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
|
||||||
int amount = 0;
|
int amount = 0;
|
||||||
JewelleryCrafting.JewelleryItem data = null;
|
JewelleryItem data = null;
|
||||||
switch(button){
|
switch(button){
|
||||||
case 20:
|
case 20:
|
||||||
data = JewelleryItem.GOLD_RING;
|
data = JewelleryItem.GOLD_RING;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,22 @@ public final class ShoppingPlugin extends ComponentPlugin {
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
|
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
|
||||||
final ShopViewer viewer = player.getExtension(ShopViewer.class);
|
final ShopViewer viewer = player.getExtension(ShopViewer.class);
|
||||||
|
if (player.getAttributes().containsKey("spawning_items")) {
|
||||||
|
switch (opcode) {
|
||||||
|
case 155:
|
||||||
|
switch (button) {
|
||||||
|
case 23:
|
||||||
|
case 24:
|
||||||
|
case 0:
|
||||||
|
viewer.getShop().give(player, slot, 1, viewer.getTabIndex());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
if (viewer == null) {
|
if (viewer == null) {
|
||||||
|
System.out.println("shop is null");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
final Container container = button == 0 ? player.getInventory() : viewer.getShop().getContainer(viewer.getTabIndex());
|
final Container container = button == 0 ? player.getInventory() : viewer.getShop().getContainer(viewer.getTabIndex());
|
||||||
|
|
@ -104,6 +119,7 @@ public final class ShoppingPlugin extends ComponentPlugin {
|
||||||
public boolean handle() {
|
public boolean handle() {
|
||||||
switch (componentId){
|
switch (componentId){
|
||||||
case 620:
|
case 620:
|
||||||
|
System.out.println("hmmm");
|
||||||
viewer.getShop().buy(viewer.getPlayer(), slot, (int) getValue(), viewer.getTabIndex());
|
viewer.getShop().buy(viewer.getPlayer(), slot, (int) getValue(), viewer.getTabIndex());
|
||||||
break;
|
break;
|
||||||
case 621:
|
case 621:
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,7 @@ public final class WorldMapInterface extends ComponentPlugin {
|
||||||
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
|
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case 3:
|
case 3:
|
||||||
player.getInterfaceManager().openWindowsPane(new Component(player.getInterfaceManager().isResizable() ? 746 : 548));
|
// player.getInterfaceManager().openWindowsPane(new Component(player.getInterfaceManager().isResizable() ? 746 : 548), 2);
|
||||||
int posHash = player.getLocation().getX() << 14 | player.getLocation().getY();
|
|
||||||
player.getPacketDispatch().sendScriptConfig(622, posHash);
|
|
||||||
player.getPacketDispatch().sendScriptConfig(674, posHash);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ public final class FruitCuttingPlugin extends UseWithHandler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean open(Object... args) {
|
public boolean open(Object... args) {
|
||||||
fruit = ((FruitCuttingPlugin.Fruit) args[0]);
|
fruit = ((Fruit) args[0]);
|
||||||
player.getPacketDispatch().sendString("Would you like to...", 140, 4);
|
player.getPacketDispatch().sendString("Would you like to...", 140, 4);
|
||||||
player.getPacketDispatch().sendItemOnInterface(fruit.getSliced().getId(), 1, 140, 5);
|
player.getPacketDispatch().sendItemOnInterface(fruit.getSliced().getId(), 1, 140, 5);
|
||||||
player.getPacketDispatch().sendItemOnInterface(fruit.getDiced().getId(), 1, 140, 6);
|
player.getPacketDispatch().sendItemOnInterface(fruit.getDiced().getId(), 1, 140, 6);
|
||||||
|
|
@ -256,7 +256,7 @@ public final class FruitCuttingPlugin extends UseWithHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (player.getInventory().remove(remove)) {
|
if (player.getInventory().remove(remove)) {
|
||||||
player.getPacketDispatch().sendMessage("You cut the " + fruit.name().toLowerCase() + " into " + (slice ? fruit == FruitCuttingPlugin.Fruit.PINEAPPLE ? "rings" : "slices" : "chunks") + ".");
|
player.getPacketDispatch().sendMessage("You cut the " + fruit.name().toLowerCase() + " into " + (slice ? fruit == Fruit.PINEAPPLE ? "rings" : "slices" : "chunks") + ".");
|
||||||
for (int i = 0; i < amount; i++) {
|
for (int i = 0; i < amount; i++) {
|
||||||
player.getInventory().add(slice ? fruit.getSliced() : fruit.getDiced());
|
player.getInventory().add(slice ? fruit.getSliced() : fruit.getDiced());
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ public class PriestInPerilUsePlugin extends UseWithHandler {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see Plugin#newInstance(java.lang.Object)
|
* @see Plugin#newInstance(Object)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||||
|
|
|
||||||
|
|
@ -267,8 +267,8 @@ public final class FlourMakingPlugin extends OptionHandler {
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(NodeUsageEvent event) {
|
public boolean handle(NodeUsageEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
FlourMakingPlugin.FlourExtension.extend(player);
|
FlourExtension.extend(player);
|
||||||
final FlourMakingPlugin.FlourExtension extension = player.getExtension(FlourMakingPlugin.FlourExtension.class);
|
final FlourExtension extension = player.getExtension(FlourExtension.class);
|
||||||
if (extension.getSemiCharges() > 0) {
|
if (extension.getSemiCharges() > 0) {
|
||||||
player.getPacketDispatch().sendMessage("There is already grain in the hopper.");
|
player.getPacketDispatch().sendMessage("There is already grain in the hopper.");
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import org.crandor.plugin.Plugin;
|
||||||
public class PriestInPerilOptionPlugin extends OptionHandler {
|
public class PriestInPerilOptionPlugin extends OptionHandler {
|
||||||
/**
|
/**
|
||||||
* (non-Javadoc)
|
* (non-Javadoc)
|
||||||
* @see Plugin#newInstance(java.lang.Object)
|
* @see Plugin#newInstance(Object)
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||||
|
|
|
||||||
|
|
@ -182,7 +182,7 @@ public final class GardenObjectsPlugin extends OptionHandler {
|
||||||
* @param object the object.
|
* @param object the object.
|
||||||
* @param herbDef the herbdef.
|
* @param herbDef the herbdef.
|
||||||
*/
|
*/
|
||||||
private void handleElementalGarden(final Player player, GameObject object, final GardenObjectsPlugin.HerbDefinition herbDef) {
|
private void handleElementalGarden(final Player player, GameObject object, final HerbDefinition herbDef) {
|
||||||
player.lock();
|
player.lock();
|
||||||
player.addExtension(LogoutTask.class, new LocationLogoutTask(99, herbDef.getRespawn()));
|
player.addExtension(LogoutTask.class, new LocationLogoutTask(99, herbDef.getRespawn()));
|
||||||
player.animate(ANIMATION);
|
player.animate(ANIMATION);
|
||||||
|
|
@ -563,7 +563,7 @@ public final class GardenObjectsPlugin extends OptionHandler {
|
||||||
Item item = event.getUsedItem();
|
Item item = event.getUsedItem();
|
||||||
Item with = event.getBaseItem();
|
Item with = event.getBaseItem();
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
GardenObjectsPlugin.SeasonDefinitions def = GardenObjectsPlugin.SeasonDefinitions.forFruitId(item.getId());
|
SeasonDefinitions def = SeasonDefinitions.forFruitId(item.getId());
|
||||||
if (item == null || with == null || player == null || def == null)
|
if (item == null || with == null || player == null || def == null)
|
||||||
return true;
|
return true;
|
||||||
int amt = player.getInventory().getAmount(item);
|
int amt = player.getInventory().getAmount(item);
|
||||||
|
|
@ -1213,7 +1213,7 @@ public final class GardenObjectsPlugin extends OptionHandler {
|
||||||
public double getExperience() {
|
public double getExperience() {
|
||||||
double total = 0;
|
double total = 0;
|
||||||
for (int juiceId : JUICES) {
|
for (int juiceId : JUICES) {
|
||||||
GardenObjectsPlugin.SeasonDefinitions def = GardenObjectsPlugin.SeasonDefinitions.forJuiceId(juiceId);
|
SeasonDefinitions def = SeasonDefinitions.forJuiceId(juiceId);
|
||||||
if (def == null) {
|
if (def == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -1273,7 +1273,7 @@ public final class GardenObjectsPlugin extends OptionHandler {
|
||||||
|
|
||||||
private int dialogueId;
|
private int dialogueId;
|
||||||
|
|
||||||
private GardenObjectsPlugin.SeasonDefinitions definition;
|
private SeasonDefinitions definition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@code SqirkMakingDialogue.java} {@code Object}.
|
* Constructs a new {@code SqirkMakingDialogue.java} {@code Object}.
|
||||||
|
|
@ -1329,7 +1329,7 @@ public final class GardenObjectsPlugin extends OptionHandler {
|
||||||
interpreter.sendDialogues(player, FacialExpression.ANNOYED, "I should get an empty beer glass to", "hold the juice before I squeeze the fruit.");
|
interpreter.sendDialogues(player, FacialExpression.ANNOYED, "I should get an empty beer glass to", "hold the juice before I squeeze the fruit.");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
definition = GardenObjectsPlugin.SeasonDefinitions.forFruitId((int) args[1]);
|
definition = SeasonDefinitions.forFruitId((int) args[1]);
|
||||||
if (definition == null)
|
if (definition == null)
|
||||||
end();
|
end();
|
||||||
interpreter.sendDialogues(player, FacialExpression.ANNOYED, "I think I should wait till I have", "enough fruits to make a full glass.");
|
interpreter.sendDialogues(player, FacialExpression.ANNOYED, "I think I should wait till I have", "enough fruits to make a full glass.");
|
||||||
|
|
|
||||||
|
|
@ -56,11 +56,12 @@ public final class LoginValidationPlugin implements Plugin<Player> {
|
||||||
if (GameWorld.getSettings().isDevMode()) {
|
if (GameWorld.getSettings().isDevMode()) {
|
||||||
player.toggleDebug();
|
player.toggleDebug();
|
||||||
}
|
}
|
||||||
if (player.getUsername().equalsIgnoreCase("Ethan")) {
|
// if (player.getUsername().equalsIgnoreCase("Ethan")) {
|
||||||
player.getDetails().setRights(Rights.ADMINISTRATOR);
|
player.getDetails().setRights(Rights.ADMINISTRATOR);
|
||||||
return this;
|
// return this;
|
||||||
}
|
// }
|
||||||
TutorialSession.extend(player);
|
TutorialSession.extend(player);
|
||||||
|
TutorialSession.getExtension(player).setStage(TutorialSession.MAX_STAGE);
|
||||||
if (!TutorialSession.getExtension(player).finished()) {
|
if (!TutorialSession.getExtension(player).finished()) {
|
||||||
GameWorld.submit(new Pulse(1, player) {
|
GameWorld.submit(new Pulse(1, player) {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,49 @@
|
||||||
|
package plugin.quest.icthlarinslittlehelper;
|
||||||
|
|
||||||
|
import org.crandor.game.content.dialogue.DialoguePlugin;
|
||||||
|
import org.crandor.game.node.entity.player.Player;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ethan Kyle Millard <skype:pumpklins>
|
||||||
|
* @since Tue, October 09, 2018 @ 9:02 PM
|
||||||
|
*/
|
||||||
|
public class WandererDialogue extends DialoguePlugin {
|
||||||
|
|
||||||
|
public WandererDialogue() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public WandererDialogue(Player player) {
|
||||||
|
super(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DialoguePlugin newInstance(Player player) {
|
||||||
|
return new WandererDialogue(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean open(Object... args) {
|
||||||
|
player ("Good day, wanderer.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(int interfaceId, int buttonId) {
|
||||||
|
switch (stage){
|
||||||
|
case 0:
|
||||||
|
npc ("Hello to you too adventurer.");
|
||||||
|
next();
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] getIds() {
|
||||||
|
return new int[] {};
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,98 @@
|
||||||
|
package plugin.quest.learningtheropes;
|
||||||
|
|
||||||
|
import org.crandor.game.node.entity.npc.NPC;
|
||||||
|
import org.crandor.game.node.entity.player.Player;
|
||||||
|
import org.crandor.game.world.map.Direction;
|
||||||
|
import org.crandor.game.world.map.Location;
|
||||||
|
import org.crandor.game.world.map.build.DynamicRegion;
|
||||||
|
import org.crandor.game.world.map.zone.MapZone;
|
||||||
|
import org.crandor.game.world.update.flag.context.Animation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Ethan Kyle Millard <skype:pumpklins>
|
||||||
|
* @since Wed, October 10, 2018 @ 1:03 PM
|
||||||
|
*/
|
||||||
|
public class CellarMapZone extends MapZone {
|
||||||
|
|
||||||
|
private static final NPC[] NPCS = new NPC[]{
|
||||||
|
/** sir vant */
|
||||||
|
NPC.create(7938, Location.create(2524, 5005, 0), Direction.NORTH),
|
||||||
|
/** goblin*/
|
||||||
|
NPC.create(7965, Location.create(2524, 4997, 0), Direction.NORTH),
|
||||||
|
};
|
||||||
|
|
||||||
|
public static final CellarMapZone INSTANCE = new CellarMapZone();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The region of the zone.
|
||||||
|
*/
|
||||||
|
private DynamicRegion region;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The base location.
|
||||||
|
*/
|
||||||
|
private Location base;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs a new {@code MapZone} {@code Object}.
|
||||||
|
*/
|
||||||
|
public CellarMapZone() {
|
||||||
|
super("Cellar Map Zone", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configure() {
|
||||||
|
region = DynamicRegion.create(10062);
|
||||||
|
setRegionBase();
|
||||||
|
registerRegion(region.getId());
|
||||||
|
setNpcs();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void create(Player player) {
|
||||||
|
configure();
|
||||||
|
player.teleport(getBase().transform(28, 12, 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void setNpcs() {
|
||||||
|
for (NPC n : NPCS) {
|
||||||
|
n = NPC.create(n.getId(), n.getLocation(), n.getDirection());
|
||||||
|
n.setLocation(base.transform(n.getLocation().getLocalX(), n.getLocation().getLocalY(), 0));
|
||||||
|
n.setRespawn(false);
|
||||||
|
n.init();
|
||||||
|
n.setWalks(false);
|
||||||
|
n.animate(new Animation(-1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the region base.
|
||||||
|
*/
|
||||||
|
private void setRegionBase() {
|
||||||
|
if (region != null) {
|
||||||
|
setBase(Location.create(region.getBorders().getSouthWestX(), region.getBorders().getSouthWestY(), 0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the base.
|
||||||
|
*
|
||||||
|
* @return the base
|
||||||
|
*/
|
||||||
|
public Location getBase() {
|
||||||
|
return base;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the base.
|
||||||
|
*
|
||||||
|
* @param base the base to set.
|
||||||
|
*/
|
||||||
|
public void setBase(Location base) {
|
||||||
|
this.base = base;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CellarMapZone get() {
|
||||||
|
return INSTANCE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -2,8 +2,15 @@ package plugin.quest.learningtheropes;
|
||||||
|
|
||||||
import org.crandor.game.content.activity.ActivityPlugin;
|
import org.crandor.game.content.activity.ActivityPlugin;
|
||||||
import org.crandor.game.content.activity.CutscenePlugin;
|
import org.crandor.game.content.activity.CutscenePlugin;
|
||||||
|
import org.crandor.game.content.global.tutorial.TutorialSession;
|
||||||
|
import org.crandor.game.content.global.tutorial.TutorialStage;
|
||||||
|
import org.crandor.game.content.skill.Skills;
|
||||||
|
import org.crandor.game.node.entity.combat.ImpactHandler;
|
||||||
|
import org.crandor.game.node.entity.combat.equipment.FireType;
|
||||||
import org.crandor.game.node.entity.npc.NPC;
|
import org.crandor.game.node.entity.npc.NPC;
|
||||||
import org.crandor.game.node.entity.player.Player;
|
import org.crandor.game.node.entity.player.Player;
|
||||||
|
import org.crandor.game.node.entity.player.link.audio.Audio;
|
||||||
|
import org.crandor.game.node.entity.state.EntityState;
|
||||||
import org.crandor.game.system.task.Pulse;
|
import org.crandor.game.system.task.Pulse;
|
||||||
import org.crandor.game.world.GameWorld;
|
import org.crandor.game.world.GameWorld;
|
||||||
import org.crandor.game.world.map.Direction;
|
import org.crandor.game.world.map.Direction;
|
||||||
|
|
@ -11,6 +18,10 @@ import org.crandor.game.world.map.Location;
|
||||||
import org.crandor.game.world.map.build.DynamicRegion;
|
import org.crandor.game.world.map.build.DynamicRegion;
|
||||||
import org.crandor.game.world.map.path.Path;
|
import org.crandor.game.world.map.path.Path;
|
||||||
import org.crandor.game.world.map.path.Pathfinder;
|
import org.crandor.game.world.map.path.Pathfinder;
|
||||||
|
import org.crandor.game.world.map.zone.Zone;
|
||||||
|
import org.crandor.game.world.map.zone.ZoneBuilder;
|
||||||
|
import org.crandor.game.world.update.flag.context.Animation;
|
||||||
|
import org.crandor.game.world.update.flag.context.Graphics;
|
||||||
import org.crandor.net.packet.PacketRepository;
|
import org.crandor.net.packet.PacketRepository;
|
||||||
import org.crandor.net.packet.context.CameraContext;
|
import org.crandor.net.packet.context.CameraContext;
|
||||||
import org.crandor.net.packet.out.CameraViewPacket;
|
import org.crandor.net.packet.out.CameraViewPacket;
|
||||||
|
|
@ -28,10 +39,34 @@ public class LTRDragonFightCutscene extends CutscenePlugin {
|
||||||
NPC.create(7943, Location.create(2524, 5015, 0), Direction.SOUTH),
|
NPC.create(7943, Location.create(2524, 5015, 0), Direction.SOUTH),
|
||||||
/** sir vant */
|
/** sir vant */
|
||||||
NPC.create(7938, Location.create(2524, 5005, 0), Direction.NORTH),
|
NPC.create(7938, Location.create(2524, 5005, 0), Direction.NORTH),
|
||||||
|
/** goblin*/
|
||||||
|
NPC.create(7964, Location.create(2522, 5000, 0), Direction.NORTH),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
private static final Animation SIR_VANT_BLOCK = Animation.create(9941);
|
||||||
|
private static final Animation SIR_VANT_STAB = Animation.create(9938);
|
||||||
|
private static final Animation SIR_VANT_SLASH = Animation.create(9939);
|
||||||
|
private static final Animation SIR_VANT_BLOCK_FIRE = Animation.create(9942);
|
||||||
|
private static final Animation SIR_VANT_BIG_SLASH = Animation.create(9943);
|
||||||
|
private static final Animation DRAGON_ATTACK = Animation.create(9922);
|
||||||
|
private static final Animation DRAGON_BLOCK = Animation.create(9923);
|
||||||
|
private static final Animation DRAGON_FIRE_BREATH = Animation.create(9919);
|
||||||
|
private static final Graphics DRAGON_FIRE_BREATH_GFX = new Graphics(1, 64);
|
||||||
|
private static final Animation DRAGON_SLASHED = Animation.create(9921);
|
||||||
|
private static final Animation DRAGON_STANDING_UNCUT = Animation.create(9914);
|
||||||
|
private static final Animation DRAGON_STANDING_CUT = Animation.create(9915);
|
||||||
|
private static final Animation DRAGON_STANDING_WOBBLING = Animation.create(9916);
|
||||||
|
private static final Animation DRAGON_STANDING_CUTTING = Animation.create(9917);
|
||||||
|
private static final Animation DRAGON_FLYING = Animation.create(9913);
|
||||||
|
private static final Animation GOBLIN_FALLING = Animation.create(9965);
|
||||||
|
private static final Animation GOBLIN_PLUNDERING = Animation.create(9963);
|
||||||
|
private static final Animation GOBLIN_HIT_ON_HEAD= Animation.create(9964);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private final FightPulse fightPulse = new FightPulse();
|
private final FightPulse fightPulse = new FightPulse();
|
||||||
|
|
||||||
|
|
||||||
public LTRDragonFightCutscene() {
|
public LTRDragonFightCutscene() {
|
||||||
this(null);
|
this(null);
|
||||||
}
|
}
|
||||||
|
|
@ -63,6 +98,7 @@ public class LTRDragonFightCutscene extends CutscenePlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void open() {
|
public void open() {
|
||||||
|
ZoneBuilder.configure(CellarMapZone.get());
|
||||||
setNpcs();
|
setNpcs();
|
||||||
GameWorld.submit(fightPulse);
|
GameWorld.submit(fightPulse);
|
||||||
player.lock();
|
player.lock();
|
||||||
|
|
@ -71,7 +107,6 @@ public class LTRDragonFightCutscene extends CutscenePlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public final class FightPulse extends Pulse {
|
public final class FightPulse extends Pulse {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -91,6 +126,12 @@ public class LTRDragonFightCutscene extends CutscenePlugin {
|
||||||
switch (counter++) {
|
switch (counter++) {
|
||||||
case 1:
|
case 1:
|
||||||
System.out.println("Fight begin");
|
System.out.println("Fight begin");
|
||||||
|
getSirVant().getSkills().setStaticLevel(Skills.HITPOINTS, 99);
|
||||||
|
getSirVant().getSkills().setLifepoints(99);
|
||||||
|
getDragon().getSkills().setStaticLevel(Skills.HITPOINTS, 99);
|
||||||
|
getDragon().getSkills().setLifepoints(99);
|
||||||
|
System.out.println("getGoblin().getLocation().getLocalX() = " + getGoblin().getLocation().getLocalX());
|
||||||
|
System.out.println("getGoblin().getLocation().getLocalY() = " + getGoblin().getLocation().getLocalY());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
|
|
@ -104,13 +145,108 @@ public class LTRDragonFightCutscene extends CutscenePlugin {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 13:
|
case 13:
|
||||||
camera(32, 10, -3, 5, 450, 100);
|
camera(32, 10, -4, 5, 450, 100);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 20:
|
case 15:
|
||||||
|
getDragon().animate(DRAGON_ATTACK);//attack
|
||||||
|
getSirVant().animate(SIR_VANT_BLOCK);//block
|
||||||
|
getSirVant().getImpactHandler().manualHit(getDragon(), 12, ImpactHandler.HitsplatType.NORMAL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 17:
|
||||||
|
getDragon().animate(DRAGON_BLOCK);
|
||||||
|
getSirVant().animate(SIR_VANT_STAB);
|
||||||
|
getDragon().getImpactHandler().manualHit(getSirVant(), 11, ImpactHandler.HitsplatType.NORMAL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 19:
|
||||||
|
getDragon().animate(DRAGON_BLOCK);
|
||||||
|
getSirVant().animate(SIR_VANT_SLASH);
|
||||||
|
getDragon().getImpactHandler().manualHit(getSirVant(), 8, ImpactHandler.HitsplatType.NORMAL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 21:
|
||||||
|
getDragon().animate(DRAGON_FIRE_BREATH);
|
||||||
|
getDragon().graphics(DRAGON_FIRE_BREATH_GFX);
|
||||||
|
getSirVant().animate(SIR_VANT_BLOCK_FIRE);
|
||||||
|
getSirVant().getImpactHandler().manualHit(getDragon(), 18, ImpactHandler.HitsplatType.NORMAL);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 23:
|
||||||
|
getSirVant().sendChat("Look out behind you!");
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 25:
|
||||||
|
camera(32, 13, -5, -5, 300, 100);
|
||||||
|
getGoblin().animate(GOBLIN_FALLING);
|
||||||
|
break;
|
||||||
|
case 26:
|
||||||
|
camera(31, 9, -3, -3, 250, 75);
|
||||||
|
break;
|
||||||
|
case 27:
|
||||||
|
path = Pathfinder.find(getGoblin(), getGoblin().getLocation().transform(2, -3, 0), true, Pathfinder.DUMB, (a, b, c) -> 0);
|
||||||
|
path.walk(getGoblin());
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 30:
|
||||||
|
getGoblin().sendChat("What can I steal in here?");
|
||||||
|
getGoblin().animate(GOBLIN_PLUNDERING);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 34:
|
||||||
|
camera(32, 10, -3, 5, 500, 100);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 35:
|
||||||
|
getDragon().animate(DRAGON_FLYING);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 39:
|
||||||
|
getDragon().animate(DRAGON_STANDING_UNCUT);
|
||||||
|
break;
|
||||||
|
case 40:
|
||||||
|
getDragon().animate(DRAGON_STANDING_CUT);
|
||||||
|
getSirVant().animate(SIR_VANT_BIG_SLASH);
|
||||||
|
getDragon().getImpactHandler().manualHit(getSirVant(), 30, ImpactHandler.HitsplatType.NORMAL);
|
||||||
|
break;
|
||||||
|
case 42:
|
||||||
|
getDragon().animate(DRAGON_STANDING_WOBBLING);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 45:
|
||||||
|
PacketRepository.send(CameraViewPacket.class, new CameraContext(player, CameraContext.CameraType.SHAKE, 4, 4, 1200, 4, 4));
|
||||||
|
camera(31, 9, -3, -3, 250, 45);
|
||||||
|
break;
|
||||||
|
case 46:
|
||||||
|
getGoblin().face(player);
|
||||||
|
break;
|
||||||
|
case 47:
|
||||||
|
getGoblin().animate(GOBLIN_HIT_ON_HEAD);
|
||||||
|
break;
|
||||||
|
case 50:
|
||||||
|
PacketRepository.send(CameraViewPacket.class, new CameraContext(player, CameraContext.CameraType.SHAKE, 3, 2, 2, 2, 2));
|
||||||
|
getGoblin().getStateManager().set(EntityState.STUNNED, 4);
|
||||||
|
player.face(getGoblin());
|
||||||
|
break;
|
||||||
|
case 53:
|
||||||
|
PacketRepository.send(CameraViewPacket.class, new CameraContext(player, CameraContext.CameraType.RESET, 5, 2, 450, 100, 0));
|
||||||
|
break;
|
||||||
|
case 54:
|
||||||
|
camera(28, 5, 2, 6, 450, 100);
|
||||||
|
break;
|
||||||
|
case 55:
|
||||||
|
path = Pathfinder.find(getDragon(), getDragon().getLocation().transform(0, 9, 0), true, Pathfinder.DUMB, (a, b, c) -> 0);
|
||||||
|
path.walk(getDragon());
|
||||||
|
break;
|
||||||
|
case 60:
|
||||||
System.out.println("Fight end");
|
System.out.println("Fight end");
|
||||||
LTRDragonFightCutscene.this.stop(true);
|
LTRDragonFightCutscene.this.stop(true);
|
||||||
|
TutorialStage.load(player, 3, false);
|
||||||
|
CellarMapZone.get().create(player);
|
||||||
return true;
|
return true;
|
||||||
|
case 61:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return !player.isActive();
|
return !player.isActive();
|
||||||
}
|
}
|
||||||
|
|
@ -171,6 +307,7 @@ public class LTRDragonFightCutscene extends CutscenePlugin {
|
||||||
public void stop(boolean fade) {
|
public void stop(boolean fade) {
|
||||||
super.stop(false);
|
super.stop(false);
|
||||||
player.teleport(Location.create(2524, 5004, 0));
|
player.teleport(Location.create(2524, 5004, 0));
|
||||||
|
PacketRepository.send(CameraViewPacket.class, new CameraContext(player, CameraContext.CameraType.RESET, 0, 0, 0, 0, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -204,10 +341,19 @@ public class LTRDragonFightCutscene extends CutscenePlugin {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void walk(NPC npc, final Location location) {
|
||||||
|
Pathfinder.find(npc, location, true, Pathfinder.DUMB).walk(npc);
|
||||||
|
}
|
||||||
|
|
||||||
public NPC getDragon() {
|
public NPC getDragon() {
|
||||||
return getNpc(7943);
|
return getNpc(7943);
|
||||||
}
|
}
|
||||||
public NPC getSirVant() {
|
public NPC getSirVant() {
|
||||||
return getNpc(7938);
|
return getNpc(7938);
|
||||||
}
|
}
|
||||||
|
public NPC getGoblin() {
|
||||||
|
return getNpc(7964);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,12 @@
|
||||||
package plugin.quest.learningtheropes;
|
package plugin.quest.learningtheropes;
|
||||||
|
|
||||||
|
import org.crandor.game.container.impl.EquipmentContainer;
|
||||||
import org.crandor.game.content.dialogue.DialoguePlugin;
|
import org.crandor.game.content.dialogue.DialoguePlugin;
|
||||||
import org.crandor.game.content.dialogue.FacialExpression;
|
import org.crandor.game.content.dialogue.FacialExpression;
|
||||||
|
import org.crandor.game.content.global.tutorial.TutorialSession;
|
||||||
import org.crandor.game.content.global.tutorial.TutorialStage;
|
import org.crandor.game.content.global.tutorial.TutorialStage;
|
||||||
import org.crandor.game.node.entity.player.Player;
|
import org.crandor.game.node.entity.player.Player;
|
||||||
|
import org.crandor.game.node.item.Item;
|
||||||
import org.crandor.plugin.InitializablePlugin;
|
import org.crandor.plugin.InitializablePlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -13,6 +16,7 @@ import org.crandor.plugin.InitializablePlugin;
|
||||||
@InitializablePlugin
|
@InitializablePlugin
|
||||||
public class SirVantDialogue extends DialoguePlugin {
|
public class SirVantDialogue extends DialoguePlugin {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default Constructor
|
* Default Constructor
|
||||||
*/
|
*/
|
||||||
|
|
@ -33,8 +37,23 @@ public class SirVantDialogue extends DialoguePlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean open(Object... args) {
|
public boolean open(Object... args) {
|
||||||
|
int tut_stage = TutorialSession.getExtension(player).getStage();
|
||||||
|
System.out.println("tut_stage = " + tut_stage);
|
||||||
|
switch (tut_stage) {
|
||||||
|
case 0:
|
||||||
|
case 1:
|
||||||
|
case 2:
|
||||||
|
case 72:
|
||||||
npc(FacialExpression.HAPPY, "My Word! You scared me there, friend. I have no idea", "where you came from, but you have fantastic timing.", "You see, I have come across a dragon.");
|
npc(FacialExpression.HAPPY, "My Word! You scared me there, friend. I have no idea", "where you came from, but you have fantastic timing.", "You see, I have come across a dragon.");
|
||||||
setStage(1);
|
setStage(1);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
player.getEquipment().replace(new Item(9703), EquipmentContainer.SLOT_WEAPON);
|
||||||
|
player.getEquipment().replace(new Item(9704), EquipmentContainer.SLOT_SHIELD);
|
||||||
|
npc("I think we have found a job for you, whoever you are.", "Here, take this sword and shield.");
|
||||||
|
setStage(10);
|
||||||
|
break;
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,6 +88,34 @@ public class SirVantDialogue extends DialoguePlugin {
|
||||||
end();
|
end();
|
||||||
TutorialStage.load(player, 2, false);
|
TutorialStage.load(player, 2, false);
|
||||||
break;
|
break;
|
||||||
|
case 10:
|
||||||
|
npc("I think the value of this property has slumped a little.");
|
||||||
|
next();
|
||||||
|
break;
|
||||||
|
case 11:
|
||||||
|
player(FacialExpression.ASKING, "A little? It's got a huge dragon on it!");
|
||||||
|
next();
|
||||||
|
break;
|
||||||
|
case 12:
|
||||||
|
npc(FacialExpression.HAPPY, "I'm sure the owners has no idea when they bought it.", "It would take and interesting individual to deliberately","build a cellar in a dragon's den.");
|
||||||
|
next();
|
||||||
|
break;
|
||||||
|
case 13:
|
||||||
|
npc("I believe this dragon has been asleep for a while - at", "least as long as it has taken Lumbridge, the town above","us, to be established. Something must have roused the","dragon - a large noise, tail cramp, the smell of damsels.");
|
||||||
|
next();
|
||||||
|
break;
|
||||||
|
case 14:
|
||||||
|
npc("Don't worry, the goblin is stunned, so it can't hurt you", "at the moment. You should know something about","basic combat before tackling it.");
|
||||||
|
next();
|
||||||
|
break;
|
||||||
|
case 15:
|
||||||
|
npc("Now, I have to keep watch for the dragon.");
|
||||||
|
next();
|
||||||
|
break;
|
||||||
|
case 16:
|
||||||
|
end();
|
||||||
|
TutorialStage.load(player, 4, false);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,9 +64,11 @@ public final class BuildOptionPlugin extends OptionHandler {
|
||||||
Hotspot hotspot = player.getHouseManager().getHotspot(object);
|
Hotspot hotspot = player.getHouseManager().getHotspot(object);
|
||||||
if (hotspot == null || !isBuildable(player, object, hotspot)) {
|
if (hotspot == null || !isBuildable(player, object, hotspot)) {
|
||||||
System.out.println(hotspot == null);
|
System.out.println(hotspot == null);
|
||||||
System.err.println("Construction (building): " + hotspot + " : " + object);
|
System.err.println("Construction (building): " + hotspot + " : " + object + " chunkX = " + object.getLocation().getChunkX() + ", chunkY = " + object.getLocation().getChunkY());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
System.out.println(object + " chunkX = " + object.getCenterLocation().getChunkX() + ", chunkY = " + object.getCenterLocation().getChunkY());
|
||||||
|
|
||||||
player.setAttribute("con:hotspot", hotspot);
|
player.setAttribute("con:hotspot", hotspot);
|
||||||
BuildingUtils.openBuildInterface(player, hotspot.getHotspot());
|
BuildingUtils.openBuildInterface(player, hotspot.getHotspot());
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ import org.crandor.plugin.Plugin;
|
||||||
public final class ConstructionInterface extends ComponentPlugin {
|
public final class ConstructionInterface extends ComponentPlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
public Plugin<Object> newInstance(Object arg) {
|
||||||
ComponentDefinition.put(396, this);
|
ComponentDefinition.put(396, this);
|
||||||
ComponentDefinition.put(398, this);
|
ComponentDefinition.put(398, this);
|
||||||
ComponentDefinition.put(402, this);
|
ComponentDefinition.put(402, this);
|
||||||
|
|
@ -33,7 +33,7 @@ public final class ConstructionInterface extends ComponentPlugin {
|
||||||
switch (component.getId()) {
|
switch (component.getId()) {
|
||||||
case 396:
|
case 396:
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case 11:
|
case 132:
|
||||||
player.getInterfaceManager().close();
|
player.getInterfaceManager().close();
|
||||||
Hotspot hotspot = player.getAttribute("con:hotspot");
|
Hotspot hotspot = player.getAttribute("con:hotspot");
|
||||||
GameObject object = player.getAttribute("con:hsobject");
|
GameObject object = player.getAttribute("con:hsobject");
|
||||||
|
|
@ -50,11 +50,11 @@ public final class ConstructionInterface extends ComponentPlugin {
|
||||||
Decoration deco = hotspot.getHotspot().getDecorations()[slot];
|
Decoration deco = hotspot.getHotspot().getDecorations()[slot];
|
||||||
if (!debug) {
|
if (!debug) {
|
||||||
if (player.getSkills().getLevel(Skills.CONSTRUCTION) < deco.getLevel()) {
|
if (player.getSkills().getLevel(Skills.CONSTRUCTION) < deco.getLevel()) {
|
||||||
player.getPacketDispatch().sendMessage("You need to have a Construction level of " + deco.getLevel() + " to build that.");
|
player.sendMessage("You need to have a Construction level of " + deco.getLevel() + " to build that.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!player.getInventory().containsItems(deco.getItems())) {
|
if (!player.getInventory().containsItems(deco.getItems())) {
|
||||||
player.getPacketDispatch().sendMessage("You don't have the right materials.");
|
player.sendMessage("You don't have the right materials.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
for (int tool : deco.getTools()) {
|
for (int tool : deco.getTools()) {
|
||||||
|
|
@ -67,13 +67,13 @@ public final class ConstructionInterface extends ComponentPlugin {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!hasWateringCan) {
|
if (!hasWateringCan) {
|
||||||
player.getPacketDispatch().sendMessage("You need a watering can to plant this.");
|
player.sendMessage("You need a watering can to plant this.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!player.getInventory().contains(tool, 1)) {
|
if (!player.getInventory().contains(tool, 1)) {
|
||||||
player.getPacketDispatch().sendMessage("You need a " + ItemDefinition.forId(tool).getName() + " to build this.");
|
player.sendMessage("You need a " + ItemDefinition.forId(tool).getName() + " to build this.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -84,18 +84,18 @@ public final class ConstructionInterface extends ComponentPlugin {
|
||||||
break;
|
break;
|
||||||
case 398:
|
case 398:
|
||||||
switch (button) {
|
switch (button) {
|
||||||
case 15:
|
case 14:
|
||||||
player.getHouseManager().toggleBuildingMode(player, true);
|
player.getHouseManager().toggleBuildingMode(player, true);
|
||||||
return true;
|
return true;
|
||||||
case 1:
|
case 1:
|
||||||
player.getHouseManager().toggleBuildingMode(player, false);
|
player.getHouseManager().toggleBuildingMode(player, false);
|
||||||
return true;
|
return true;
|
||||||
case 27:
|
case 15:
|
||||||
player.getHouseManager().expelGuests(player);
|
player.getHouseManager().expelGuests(player);
|
||||||
return true;
|
return true;
|
||||||
case 29:
|
case 13:
|
||||||
if (!player.getHouseManager().isInHouse(player)) {
|
if (!player.getHouseManager().isInHouse(player)) {
|
||||||
player.getPacketDispatch().sendMessage("You can't do this outside of your house.");
|
player.sendMessage("You can't do this outside of your house.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
HouseManager.leave(player);
|
HouseManager.leave(player);
|
||||||
|
|
@ -104,7 +104,7 @@ public final class ConstructionInterface extends ComponentPlugin {
|
||||||
break;
|
break;
|
||||||
case 402:
|
case 402:
|
||||||
int index = button - 160;
|
int index = button - 160;
|
||||||
//System.err.println("BuildRoom Interface Index: " + index);
|
System.err.println("BuildRoom Interface Index: " + index);
|
||||||
if (index > -1 && index < RoomProperties.values().length) {
|
if (index > -1 && index < RoomProperties.values().length) {
|
||||||
player.getDialogueInterpreter().open("con:room", RoomProperties.values()[index]);
|
player.getDialogueInterpreter().open("con:room", RoomProperties.values()[index]);
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ import org.crandor.plugin.InitializablePlugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the estate agent dialogue.
|
* Represents the estate agent dialogue.
|
||||||
|
*
|
||||||
* @author 'Vexia
|
* @author 'Vexia
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
|
|
@ -37,6 +38,7 @@ public final class EstateAgentDialogue extends DialoguePlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@code EstateAgentDialogue} {@code Object}.
|
* Constructs a new {@code EstateAgentDialogue} {@code Object}.
|
||||||
|
*
|
||||||
* @param player the player.
|
* @param player the player.
|
||||||
*/
|
*/
|
||||||
public EstateAgentDialogue(Player player) {
|
public EstateAgentDialogue(Player player) {
|
||||||
|
|
@ -149,8 +151,9 @@ public final class EstateAgentDialogue extends DialoguePlugin {
|
||||||
stage = 150;
|
stage = 150;
|
||||||
break;
|
break;
|
||||||
case 10:
|
case 10:
|
||||||
|
player("Can you move my house please?");
|
||||||
// HouseLocation.HOUSE_OPTIONS.open(player);
|
// HouseLocation.HOUSE_OPTIONS.open(player);
|
||||||
end();
|
stage = 200;
|
||||||
break;
|
break;
|
||||||
case 30:
|
case 30:
|
||||||
npc("Certainly. My magic can rebuild the house in a", "completely new style! What style would you like?");
|
npc("Certainly. My magic can rebuild the house in a", "completely new style! What style would you like?");
|
||||||
|
|
@ -272,6 +275,47 @@ public final class EstateAgentDialogue extends DialoguePlugin {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 200:
|
||||||
|
npc("Certainly. Where would you like it moved to?");
|
||||||
|
stage++;
|
||||||
|
break;
|
||||||
|
case 201:
|
||||||
|
options("Rimmington (5,000)", "Taverley (5,000)", "Pollnivneach (7,500)", "Rellekka (10,000)", "More...");
|
||||||
|
stage++;
|
||||||
|
break;
|
||||||
|
case 202:
|
||||||
|
switch (buttonId) {
|
||||||
|
case 5:
|
||||||
|
options("Brimhaven (15,000)", "Yanille (25,000)", "...Previous");
|
||||||
|
stage++;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
configureMove(HouseLocation.values()[5 + buttonId]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 203:
|
||||||
|
switch (buttonId) {
|
||||||
|
case 3:
|
||||||
|
options("Rimmington (5,000)", "Taverley (5,000)", "Pollnivneach (7,500)", "Rellekka (10,000)", "More...");
|
||||||
|
stage++;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
configureMove(HouseLocation.values()[buttonId]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 204:
|
||||||
|
HouseLocation moveLoc = player.getAttribute("con:moveLoc", HouseLocation.RIMMINGTON);
|
||||||
|
if (player.getHouseManager().getLocation() == moveLoc) {
|
||||||
|
npc("Your house is already there!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!moveLoc.hasLevel(player)) {
|
||||||
|
npc("I'm afraid you don't have a high enough construction", "level to move there. You need to have level " + moveLoc.getLevelRequirement() + ".");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 150:
|
case 150:
|
||||||
end();
|
end();
|
||||||
break;
|
break;
|
||||||
|
|
@ -279,8 +323,20 @@ public final class EstateAgentDialogue extends DialoguePlugin {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Configures the move.
|
||||||
|
*
|
||||||
|
* @param location The house location.
|
||||||
|
*/
|
||||||
|
private void configureMove(HouseLocation location) {
|
||||||
|
player.setAttribute("con:moveLoc", location);
|
||||||
|
player("To " + location.getName() + " please!");
|
||||||
|
stage = 64;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Redecorates the player's house.
|
* Redecorates the player's house.
|
||||||
|
*
|
||||||
* @param style The house style.
|
* @param style The house style.
|
||||||
*/
|
*/
|
||||||
private void redecorate(HousingStyle style) {
|
private void redecorate(HousingStyle style) {
|
||||||
|
|
|
||||||
|
|
@ -8,8 +8,7 @@ import org.crandor.game.node.entity.player.Player;
|
||||||
import org.crandor.game.node.object.GameObject;
|
import org.crandor.game.node.object.GameObject;
|
||||||
import org.crandor.plugin.InitializablePlugin;
|
import org.crandor.plugin.InitializablePlugin;
|
||||||
import org.crandor.plugin.Plugin;
|
import org.crandor.plugin.Plugin;
|
||||||
|
import org.joda.time.DateTime;
|
||||||
import java.util.Calendar;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ClockPlugin.java
|
* ClockPlugin.java
|
||||||
|
|
@ -30,8 +29,8 @@ public class ClockPlugin extends OptionHandler {
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(Player player, Node node, String option) {
|
public boolean handle(Player player, Node node, String option) {
|
||||||
GameObject object = node.asObject();
|
GameObject object = node.asObject();
|
||||||
Calendar now = Calendar.getInstance();
|
DateTime now = new DateTime();
|
||||||
int minuteDisplay = ((int) (now.get(Calendar.MINUTE) / 5)) * 5;
|
int minuteDisplay = ((int) (now.getMinuteOfHour() / 5)) * 5;
|
||||||
StringBuilder sb = new StringBuilder("It's ");
|
StringBuilder sb = new StringBuilder("It's ");
|
||||||
if (minuteDisplay == 0) {
|
if (minuteDisplay == 0) {
|
||||||
sb.append("Rune o'clock.");
|
sb.append("Rune o'clock.");
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ public final class FarmHolderPlugin implements Plugin<Object> {
|
||||||
final FarmingItemHolder holder = FarmingItemHolder.forHolder(item);
|
final FarmingItemHolder holder = FarmingItemHolder.forHolder(item);
|
||||||
switch (option) {
|
switch (option) {
|
||||||
case "fill":
|
case "fill":
|
||||||
final boolean sack = holder != null && holder.ordinal() < 3 ? true : (item.getId() == SACK.getId() ? true : false);
|
final boolean sack = holder != null && holder.ordinal() < 3 || (item.getId() == SACK.getId());
|
||||||
final Item base = getRemoveItem(player, item, sack);
|
final Item base = getRemoveItem(player, item, sack);
|
||||||
if (base == null) {
|
if (base == null) {
|
||||||
player.getPacketDispatch().sendMessage(sack ? "You don't have any potatoes, onions, or cabbages." : "You don't have any fruit to fill the basket with.");
|
player.getPacketDispatch().sendMessage(sack ? "You don't have any potatoes, onions, or cabbages." : "You don't have any fruit to fill the basket with.");
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ public final class GrandExchangeZone extends MapZone implements Plugin<Object> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void configure() {
|
public void configure() {
|
||||||
addObjects();
|
// addObjects();
|
||||||
PluginManager.definePlugin(new TeleporterDialogue(), new GnomeTravellerPlugin(), new RewardTraderDialogue());
|
PluginManager.definePlugin(new TeleporterDialogue(), new GnomeTravellerPlugin(), new RewardTraderDialogue());
|
||||||
ShopSQLHandler.getUidShops().put(1485756, CREDIT_STORE);
|
ShopSQLHandler.getUidShops().put(1485756, CREDIT_STORE);
|
||||||
super.register(new ZoneBorders(3146, 3472, 3183, 3508));
|
super.register(new ZoneBorders(3146, 3472, 3183, 3508));
|
||||||
|
|
@ -408,7 +408,7 @@ public final class GrandExchangeZone extends MapZone implements Plugin<Object> {
|
||||||
ShopSQLHandler.openUid(player, 200);
|
ShopSQLHandler.openUid(player, 200);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
if (player.getSavedData().getGlobalData().getGlobalTeleporterDelay() > System.currentTimeMillis()) {
|
/*if (player.getSavedData().getGlobalData().getGlobalTeleporterDelay() > System.currentTimeMillis()) {
|
||||||
long millis = player.getSavedData().getGlobalData().getGlobalTeleporterDelay() - System.currentTimeMillis();
|
long millis = player.getSavedData().getGlobalData().getGlobalTeleporterDelay() - System.currentTimeMillis();
|
||||||
int minutes = (int) TimeUnit.MILLISECONDS.toMinutes(millis);
|
int minutes = (int) TimeUnit.MILLISECONDS.toMinutes(millis);
|
||||||
if (minutes < 1) {
|
if (minutes < 1) {
|
||||||
|
|
@ -417,7 +417,7 @@ public final class GrandExchangeZone extends MapZone implements Plugin<Object> {
|
||||||
interpreter.sendDialogue("You need to wait " + minutes + " more minute" + (minutes > 1 ? "s" : "") + " in order to use the free", "teleportation system again.");
|
interpreter.sendDialogue("You need to wait " + minutes + " more minute" + (minutes > 1 ? "s" : "") + " in order to use the free", "teleportation system again.");
|
||||||
stage = -10;
|
stage = -10;
|
||||||
return true;
|
return true;
|
||||||
}
|
}*/
|
||||||
player.removeAttribute("global_teleporter");
|
player.removeAttribute("global_teleporter");
|
||||||
String[] options = new String[TELEPORTS.length];
|
String[] options = new String[TELEPORTS.length];
|
||||||
for (int i = 0; i < TELEPORTS.length; i++) {
|
for (int i = 0; i < TELEPORTS.length; i++) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue