mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-16 03:20:19 -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,35 +3,45 @@ 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
|
||||||
*/
|
*/
|
||||||
public enum FacialExpression {
|
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),
|
||||||
* The animation id.
|
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),
|
||||||
private final int animationId;
|
CROOKED_HEAD(9828), GLANCE_DOWN(9832), UNSURE(9836), LISTEN_LAUGH(9840),
|
||||||
|
TALK_SWING(9844), GOOFY_LAUGH(9851), DRUNK(9835), ASKING(9827), SUSPICIOUS(9831);
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructs a new {@code FacialExpression} {@code Object}.
|
|
||||||
* @param animationId The animation id.
|
|
||||||
*/
|
|
||||||
private FacialExpression(int animationId) {
|
|
||||||
this.animationId = animationId;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the animation id.
|
* The animation id.
|
||||||
* @return The animation id.
|
*/
|
||||||
*/
|
private final int animationId;
|
||||||
public int getAnimationId() {
|
|
||||||
return animationId;
|
/**
|
||||||
}
|
* Constructs a new {@code FacialExpression} {@code Object}.
|
||||||
|
*
|
||||||
|
* @param animationId The animation id.
|
||||||
|
*/
|
||||||
|
FacialExpression(int animationId) {
|
||||||
|
this.animationId = animationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the animation id.
|
||||||
|
*
|
||||||
|
* @return The animation id.
|
||||||
|
*/
|
||||||
|
public int getAnimationId() {
|
||||||
|
return animationId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -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;
|
||||||
|
|
@ -34,26 +34,26 @@ public final class BuildingUtils {
|
||||||
Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST
|
Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The building a decoration animation.
|
* The building a decoration animation.
|
||||||
*/
|
*/
|
||||||
public static final Animation BUILD_LOW_ANIM = Animation.create(3683);
|
public static final Animation BUILD_LOW_ANIM = Animation.create(3683);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The building a decoration animation.
|
* The building a decoration animation.
|
||||||
*/
|
*/
|
||||||
public static final Animation BUILD_MID_ANIM = Animation.create(3676);
|
public static final Animation BUILD_MID_ANIM = Animation.create(3676);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The building a decoration animation.
|
* The building a decoration animation.
|
||||||
*/
|
*/
|
||||||
public static final Animation BUILD_HIGH_ANIM = Animation.create(3684);
|
public static final Animation BUILD_HIGH_ANIM = Animation.create(3684);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The planting animation.
|
* The planting animation.
|
||||||
*/
|
*/
|
||||||
public static final Animation PLANT_ANIM = Animation.create(3691);
|
public static final Animation PLANT_ANIM = Animation.create(3691);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The removing a decoration animation.
|
* The removing a decoration animation.
|
||||||
*/
|
*/
|
||||||
|
|
@ -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,25 +112,28 @@ 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];
|
||||||
s = item.getName() + ": " + item.getAmount();
|
s = item.getName() + ": " + item.getAmount();
|
||||||
}
|
}
|
||||||
item = decoration.getItems()[j + 1];
|
item = decoration.getItems()[j + 1];
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -143,7 +150,7 @@ public final class BuildingUtils {
|
||||||
* @param player The player.
|
* @param player The player.
|
||||||
* @param deco The decoration.
|
* @param deco The decoration.
|
||||||
* @param object The object.
|
* @param object The object.
|
||||||
*/
|
*/
|
||||||
public static void buildDecoration(final Player player, final Hotspot hotspot, final Decoration deco, final GameObject object) {
|
public static void buildDecoration(final Player player, final Hotspot hotspot, final Decoration deco, final GameObject object) {
|
||||||
final int nailAmount = deco.getNailAmount();
|
final int nailAmount = deco.getNailAmount();
|
||||||
final NailType type = nailAmount > 0 ? NailType.get(player, nailAmount) : null;
|
final NailType type = nailAmount > 0 ? NailType.get(player, nailAmount) : null;
|
||||||
|
|
@ -205,7 +212,7 @@ public final class BuildingUtils {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a decoration for the given hotspot.
|
* Sets a decoration for the given hotspot.
|
||||||
* @param player The player.
|
* @param player The player.
|
||||||
|
|
@ -220,91 +227,91 @@ public final class BuildingUtils {
|
||||||
HousingStyle style = player.getHouseManager().getStyle();
|
HousingStyle style = player.getHouseManager().getStyle();
|
||||||
int decIndex = hotspot.getHotspot().getDecorationIndex(deco);
|
int decIndex = hotspot.getHotspot().getDecorationIndex(deco);
|
||||||
switch(hotspot.getHotspot().getType()) {
|
switch(hotspot.getHotspot().getType()) {
|
||||||
case STAIRCASE:
|
case STAIRCASE:
|
||||||
int z = l.getZ();
|
int z = l.getZ();
|
||||||
if (region == player.getHouseManager().getDungeonRegion()) {
|
if (region == player.getHouseManager().getDungeonRegion()) {
|
||||||
z = 3;
|
z = 3;
|
||||||
}
|
|
||||||
for (int i = -1; i <= 1; i++) {
|
|
||||||
int plane = (z + (i == -1 ? 3 : i)) % 4;
|
|
||||||
Room r = player.getHouseManager().getRooms()[plane][l.getChunkX()][l.getChunkY()];
|
|
||||||
if (r != null && r.getRotation() == room.getRotation() && !r.getProperties().isLand()) {
|
|
||||||
Hotspot h = r.getStairs();
|
|
||||||
if (h != null) {
|
|
||||||
h.setDecorationIndex(decIndex);
|
|
||||||
Region reg = plane == 3 ? player.getHouseManager().getDungeonRegion() : player.getHouseManager().getRegion();
|
|
||||||
if (reg == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
BuildRegionChunk chunk = (BuildRegionChunk) reg.getPlanes()[plane % 3].getChunks()[l.getChunkX()][l.getChunkY()];
|
|
||||||
GameObject[] objects = chunk.getObjects(h.getCurrentX(), h.getCurrentY());
|
|
||||||
for (GameObject o : objects) {
|
|
||||||
if (o != null && o.getType() == object.getType()) {
|
|
||||||
ObjectBuilder.replace(o, o.transform(h.getHotspot().getDecorations()[decIndex].getObjectId(style)));
|
|
||||||
System.err.println("Found stairs!");
|
|
||||||
if (plane == 1) {
|
|
||||||
if (r.getProperties() == RoomProperties.SKILL_HALL) {
|
|
||||||
r.updateProperties(player, RoomProperties.SKILL_HALL_2);
|
|
||||||
} else if (r.getProperties() == RoomProperties.QUEST_HALL) {
|
|
||||||
r.updateProperties(player, RoomProperties.QUEST_HALL_2);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
player.getHouseManager().reload(player, true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
System.err.println("Couldn't find stairs! " + plane);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
for (int i = -1; i <= 1; i++) {
|
||||||
break;
|
int plane = (z + (i == -1 ? 3 : i)) % 4;
|
||||||
case CREST:
|
Room r = player.getHouseManager().getRooms()[plane][l.getChunkX()][l.getChunkY()];
|
||||||
ObjectBuilder.replace(object, object.transform(deco.getObjectId(style) + player.getHouseManager().getCrest().ordinal()));
|
if (r != null && r.getRotation() == room.getRotation() && !r.getProperties().isLand()) {
|
||||||
hotspot.setDecorationIndex(decIndex);
|
Hotspot h = r.getStairs();
|
||||||
break;
|
|
||||||
case INDIVIDUAL:
|
|
||||||
ObjectBuilder.replace(object, object.transform(deco.getObjectId(style)));
|
|
||||||
hotspot.setDecorationIndex(decIndex);
|
|
||||||
break;
|
|
||||||
case RECURSIVE:
|
|
||||||
BuildRegionChunk chunk = (BuildRegionChunk) region.getPlanes()[l.getZ()].getChunks()[l.getChunkX()][l.getChunkY()];
|
|
||||||
for (int x = 0; x < 8; x++) {
|
|
||||||
for (int y = 0; y < 8; y++) {
|
|
||||||
Hotspot h = room.getHotspot(hotspot.getHotspot(), x, y);
|
|
||||||
if (h != null) {
|
|
||||||
h.setDecorationIndex(decIndex);
|
|
||||||
int objectId = hotspot.getHotspot().getObjectId(style);
|
|
||||||
GameObject o = chunk.get(x, y, chunk.getIndex(x, y, objectId));
|
|
||||||
if (o != null && objectId == o.getId()) {
|
|
||||||
ObjectBuilder.replace(o, o.transform(hotspot.getHotspot().getDecorations()[decIndex].getObjectId(style)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case LINKED:
|
|
||||||
BuildHotspot[] linkedHotspots = BuildHotspot.getLinkedHotspots(hotspot.getHotspot());
|
|
||||||
chunk = (BuildRegionChunk) region.getPlanes()[l.getZ()].getChunks()[l.getChunkX()][l.getChunkY()];
|
|
||||||
for (int x = 0; x < 8; x++) {
|
|
||||||
for (int y = 0; y < 8; y++) {
|
|
||||||
for (BuildHotspot bh : linkedHotspots) {
|
|
||||||
Hotspot h = room.getHotspot(bh, x, y);
|
|
||||||
if (h != null) {
|
if (h != null) {
|
||||||
h.setDecorationIndex(decIndex);
|
h.setDecorationIndex(decIndex);
|
||||||
int objectId = bh.getObjectId(style);
|
Region reg = plane == 3 ? player.getHouseManager().getDungeonRegion() : player.getHouseManager().getRegion();
|
||||||
|
if (reg == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
BuildRegionChunk chunk = (BuildRegionChunk) reg.getPlanes()[plane % 3].getChunks()[l.getChunkX()][l.getChunkY()];
|
||||||
|
GameObject[] objects = chunk.getObjects(h.getCurrentX(), h.getCurrentY());
|
||||||
|
for (GameObject o : objects) {
|
||||||
|
if (o != null && o.getType() == object.getType()) {
|
||||||
|
ObjectBuilder.replace(o, o.transform(h.getHotspot().getDecorations()[decIndex].getObjectId(style)));
|
||||||
|
System.err.println("Found stairs!");
|
||||||
|
if (plane == 1) {
|
||||||
|
if (r.getProperties() == RoomProperties.SKILL_HALL) {
|
||||||
|
r.updateProperties(player, RoomProperties.SKILL_HALL_2);
|
||||||
|
} else if (r.getProperties() == RoomProperties.QUEST_HALL) {
|
||||||
|
r.updateProperties(player, RoomProperties.QUEST_HALL_2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
player.getHouseManager().reload(player, true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
System.err.println("Couldn't find stairs! " + plane);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case CREST:
|
||||||
|
ObjectBuilder.replace(object, object.transform(deco.getObjectId(style) + player.getHouseManager().getCrest().ordinal()));
|
||||||
|
hotspot.setDecorationIndex(decIndex);
|
||||||
|
break;
|
||||||
|
case INDIVIDUAL:
|
||||||
|
ObjectBuilder.replace(object, object.transform(deco.getObjectId(style)));
|
||||||
|
hotspot.setDecorationIndex(decIndex);
|
||||||
|
break;
|
||||||
|
case RECURSIVE:
|
||||||
|
BuildRegionChunk chunk = (BuildRegionChunk) region.getPlanes()[l.getZ()].getChunks()[l.getChunkX()][l.getChunkY()];
|
||||||
|
for (int x = 0; x < 8; x++) {
|
||||||
|
for (int y = 0; y < 8; y++) {
|
||||||
|
Hotspot h = room.getHotspot(hotspot.getHotspot(), x, y);
|
||||||
|
if (h != null) {
|
||||||
|
h.setDecorationIndex(decIndex);
|
||||||
|
int objectId = hotspot.getHotspot().getObjectId(style);
|
||||||
GameObject o = chunk.get(x, y, chunk.getIndex(x, y, objectId));
|
GameObject o = chunk.get(x, y, chunk.getIndex(x, y, objectId));
|
||||||
if (o != null && objectId == o.getId()) {
|
if (o != null && objectId == o.getId()) {
|
||||||
ObjectBuilder.replace(o, o.transform(bh.getDecorations()[decIndex].getObjectId(style)));
|
ObjectBuilder.replace(o, o.transform(hotspot.getHotspot().getDecorations()[decIndex].getObjectId(style)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case LINKED:
|
||||||
|
BuildHotspot[] linkedHotspots = BuildHotspot.getLinkedHotspots(hotspot.getHotspot());
|
||||||
|
chunk = (BuildRegionChunk) region.getPlanes()[l.getZ()].getChunks()[l.getChunkX()][l.getChunkY()];
|
||||||
|
for (int x = 0; x < 8; x++) {
|
||||||
|
for (int y = 0; y < 8; y++) {
|
||||||
|
for (BuildHotspot bh : linkedHotspots) {
|
||||||
|
Hotspot h = room.getHotspot(bh, x, y);
|
||||||
|
if (h != null) {
|
||||||
|
h.setDecorationIndex(decIndex);
|
||||||
|
int objectId = bh.getObjectId(style);
|
||||||
|
GameObject o = chunk.get(x, y, chunk.getIndex(x, y, objectId));
|
||||||
|
if (o != null && objectId == o.getId()) {
|
||||||
|
ObjectBuilder.replace(o, o.transform(bh.getDecorations()[decIndex].getObjectId(style)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -352,112 +359,111 @@ public final class BuildingUtils {
|
||||||
private static void removeDecoration(Player player, Region region, Room room, Hotspot hotspot, GameObject object, HousingStyle style) {
|
private static void removeDecoration(Player player, Region region, Room room, Hotspot hotspot, GameObject object, HousingStyle style) {
|
||||||
Location l = object.getLocation();
|
Location l = object.getLocation();
|
||||||
switch (hotspot.getHotspot().getType()) {
|
switch (hotspot.getHotspot().getType()) {
|
||||||
case STAIRCASE:
|
case STAIRCASE:
|
||||||
int z = l.getZ();
|
int z = l.getZ();
|
||||||
if (region == player.getHouseManager().getDungeonRegion()) {
|
if (region == player.getHouseManager().getDungeonRegion()) {
|
||||||
z = 3;
|
z = 3;
|
||||||
}
|
|
||||||
for (int i = -1; i <= 1; i++) {
|
|
||||||
int plane = (z + (i == -1 ? 3 : i)) % 4;
|
|
||||||
Room r = player.getHouseManager().getRooms()[plane][l.getChunkX()][l.getChunkY()];
|
|
||||||
if (r != null && r.getRotation() == room.getRotation()) {
|
|
||||||
Hotspot h = r.getStairs();
|
|
||||||
if (h != null) {
|
|
||||||
h.setDecorationIndex(-1);
|
|
||||||
Region reg = plane == 3 ? player.getHouseManager().getDungeonRegion() : player.getHouseManager().getRegion();
|
|
||||||
if (reg == null) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
BuildRegionChunk chunk = (BuildRegionChunk) reg.getPlanes()[plane % 3].getChunks()[l.getChunkX()][l.getChunkY()];
|
|
||||||
GameObject[] objects = chunk.getObjects(h.getCurrentX(), h.getCurrentY());
|
|
||||||
for (GameObject o : objects) {
|
|
||||||
if (o != null && o.getType() == object.getType()) {
|
|
||||||
ObjectBuilder.replace(o, o.transform(h.getHotspot().getObjectId(style)));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
System.err.println("Couldn't find stairs! " + plane);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
for (int i = -1; i <= 1; i++) {
|
||||||
if (l.getZ() == 1) {
|
int plane = (z + (i == -1 ? 3 : i)) % 4;
|
||||||
if (room.getProperties() == RoomProperties.SKILL_HALL_2) {
|
Room r = player.getHouseManager().getRooms()[plane][l.getChunkX()][l.getChunkY()];
|
||||||
room.updateProperties(player, RoomProperties.SKILL_HALL);
|
if (r != null && r.getRotation() == room.getRotation()) {
|
||||||
}
|
Hotspot h = r.getStairs();
|
||||||
else if (room.getProperties() == RoomProperties.QUEST_HALL_2) {
|
|
||||||
room.updateProperties(player, RoomProperties.QUEST_HALL);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
player.getHouseManager().reload(player, true);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case INDIVIDUAL:
|
|
||||||
case CREST:
|
|
||||||
ObjectBuilder.replace(object, object.transform(hotspot.getHotspot().getObjectId(style)));
|
|
||||||
hotspot.setDecorationIndex(-1);
|
|
||||||
break;
|
|
||||||
case RECURSIVE:
|
|
||||||
BuildRegionChunk chunk = (BuildRegionChunk) region.getPlanes()[l.getZ()].getChunks()[l.getChunkX()][l.getChunkY()];
|
|
||||||
for (int x = 0; x < 8; x++) {
|
|
||||||
for (int y = 0; y < 8; y++) {
|
|
||||||
Hotspot h = room.getHotspot(hotspot.getHotspot(), x, y);
|
|
||||||
if (h != null) {
|
|
||||||
int objectId = hotspot.getHotspot().getDecorations()[h.getDecorationIndex()].getObjectId(style);
|
|
||||||
GameObject o = chunk.get(x, y, chunk.getIndex(x, y, objectId));
|
|
||||||
h.setDecorationIndex(-1);
|
|
||||||
if (o != null && objectId == o.getId()) {
|
|
||||||
ObjectBuilder.replace(o, o.transform(hotspot.getHotspot().getObjectId(style)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case LINKED:
|
|
||||||
BuildHotspot[] linkedHotspots = BuildHotspot.getLinkedHotspots(hotspot.getHotspot());
|
|
||||||
chunk = (BuildRegionChunk) region.getPlanes()[l.getZ()].getChunks()[l.getChunkX()][l.getChunkY()];
|
|
||||||
for (int x = 0; x < 8; x++) {
|
|
||||||
for (int y = 0; y < 8; y++) {
|
|
||||||
for (BuildHotspot bh : linkedHotspots) {
|
|
||||||
Hotspot h = room.getHotspot(bh, x, y);
|
|
||||||
if (h != null) {
|
if (h != null) {
|
||||||
int objectId = bh.getDecorations()[h.getDecorationIndex()].getObjectId(style);
|
h.setDecorationIndex(-1);
|
||||||
|
Region reg = plane == 3 ? player.getHouseManager().getDungeonRegion() : player.getHouseManager().getRegion();
|
||||||
|
if (reg == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
BuildRegionChunk chunk = (BuildRegionChunk) reg.getPlanes()[plane % 3].getChunks()[l.getChunkX()][l.getChunkY()];
|
||||||
|
GameObject[] objects = chunk.getObjects(h.getCurrentX(), h.getCurrentY());
|
||||||
|
for (GameObject o : objects) {
|
||||||
|
if (o != null && o.getType() == object.getType()) {
|
||||||
|
ObjectBuilder.replace(o, o.transform(h.getHotspot().getObjectId(style)));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
System.err.println("Couldn't find stairs! " + plane);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (l.getZ() == 1) {
|
||||||
|
if (room.getProperties() == RoomProperties.SKILL_HALL_2) {
|
||||||
|
room.updateProperties(player, RoomProperties.SKILL_HALL);
|
||||||
|
}
|
||||||
|
else if (room.getProperties() == RoomProperties.QUEST_HALL_2) {
|
||||||
|
room.updateProperties(player, RoomProperties.QUEST_HALL);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
player.getHouseManager().reload(player, true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case INDIVIDUAL:
|
||||||
|
case CREST:
|
||||||
|
ObjectBuilder.replace(object, object.transform(hotspot.getHotspot().getObjectId(style)));
|
||||||
|
hotspot.setDecorationIndex(-1);
|
||||||
|
break;
|
||||||
|
case RECURSIVE:
|
||||||
|
BuildRegionChunk chunk = (BuildRegionChunk) region.getPlanes()[l.getZ()].getChunks()[l.getChunkX()][l.getChunkY()];
|
||||||
|
for (int x = 0; x < 8; x++) {
|
||||||
|
for (int y = 0; y < 8; y++) {
|
||||||
|
Hotspot h = room.getHotspot(hotspot.getHotspot(), x, y);
|
||||||
|
if (h != null) {
|
||||||
|
int objectId = hotspot.getHotspot().getDecorations()[h.getDecorationIndex()].getObjectId(style);
|
||||||
GameObject o = chunk.get(x, y, chunk.getIndex(x, y, objectId));
|
GameObject o = chunk.get(x, y, chunk.getIndex(x, y, objectId));
|
||||||
h.setDecorationIndex(-1);
|
h.setDecorationIndex(-1);
|
||||||
if (o != null && objectId == o.getId()) {
|
if (o != null && objectId == o.getId()) {
|
||||||
ObjectBuilder.replace(o, o.transform(bh.getObjectId(style)));
|
ObjectBuilder.replace(o, o.transform(hotspot.getHotspot().getObjectId(style)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
break;
|
||||||
break;
|
case LINKED:
|
||||||
|
BuildHotspot[] linkedHotspots = BuildHotspot.getLinkedHotspots(hotspot.getHotspot());
|
||||||
|
chunk = (BuildRegionChunk) region.getPlanes()[l.getZ()].getChunks()[l.getChunkX()][l.getChunkY()];
|
||||||
|
for (int x = 0; x < 8; x++) {
|
||||||
|
for (int y = 0; y < 8; y++) {
|
||||||
|
for (BuildHotspot bh : linkedHotspots) {
|
||||||
|
Hotspot h = room.getHotspot(bh, x, y);
|
||||||
|
if (h != null) {
|
||||||
|
int objectId = bh.getDecorations()[h.getDecorationIndex()].getObjectId(style);
|
||||||
|
GameObject o = chunk.get(x, y, chunk.getIndex(x, y, objectId));
|
||||||
|
h.setDecorationIndex(-1);
|
||||||
|
if (o != null && objectId == o.getId()) {
|
||||||
|
ObjectBuilder.replace(o, o.transform(bh.getObjectId(style)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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.
|
||||||
*/
|
*/
|
||||||
private static boolean canBuildDecoration(Player player, Room room, Decoration deco, GameObject object) {
|
private static boolean canBuildDecoration(Player player, Room room, Decoration deco, GameObject object) {
|
||||||
switch (deco) {
|
switch (deco) {
|
||||||
case TENTACLE_MID:
|
case TENTACLE_MID:
|
||||||
case TENTACLE_SIDE:
|
case TENTACLE_SIDE:
|
||||||
case TENTACLE_CORNER:
|
case TENTACLE_CORNER:
|
||||||
case TENTACLE_FL:
|
case TENTACLE_FL:
|
||||||
if (!room.isBuilt(BuildHotspot.PRISON)) {
|
if (!room.isBuilt(BuildHotspot.PRISON)) {
|
||||||
player.getPacketDispatch().sendMessage("You can't build a tentacle pool without a cage.");
|
player.getPacketDispatch().sendMessage("You can't build a tentacle pool without a cage.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -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.
|
||||||
*/
|
*/
|
||||||
|
|
@ -474,27 +479,27 @@ public final class BuildingUtils {
|
||||||
Location l = object.getLocation();
|
Location l = object.getLocation();
|
||||||
int z = l.getZ();
|
int z = l.getZ();
|
||||||
switch (hotspot.getHotspot()) {
|
switch (hotspot.getHotspot()) {
|
||||||
case STAIRWAYS:
|
case STAIRWAYS:
|
||||||
case QUEST_STAIRWAYS:
|
case QUEST_STAIRWAYS:
|
||||||
case STAIRWAYS_DUNGEON:
|
case STAIRWAYS_DUNGEON:
|
||||||
BuildHotspot[] stairs = { BuildHotspot.STAIRS_DOWN, BuildHotspot.STAIRS_DOWN2, BuildHotspot.STAIRWAYS, BuildHotspot.QUEST_STAIRWAYS, BuildHotspot.STAIRWAYS_DUNGEON };
|
BuildHotspot[] stairs = { BuildHotspot.STAIRS_DOWN, BuildHotspot.STAIRS_DOWN2, BuildHotspot.STAIRWAYS, BuildHotspot.QUEST_STAIRWAYS, BuildHotspot.STAIRWAYS_DUNGEON };
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
int plane = (z + 1 + (i * 2)) % 4;
|
int plane = (z + 1 + (i * 2)) % 4;
|
||||||
Room r = player.getHouseManager().getRooms()[plane][l.getChunkX()][l.getChunkY()];
|
Room r = player.getHouseManager().getRooms()[plane][l.getChunkX()][l.getChunkY()];
|
||||||
if (r != null) {
|
if (r != null) {
|
||||||
for (BuildHotspot h : stairs) {
|
for (BuildHotspot h : stairs) {
|
||||||
Hotspot hs = r.getHotspot(h, hotspot.getCurrentX(), hotspot.getCurrentY());
|
Hotspot hs = r.getHotspot(h, hotspot.getCurrentX(), hotspot.getCurrentY());
|
||||||
if (hs != null) {
|
if (hs != null) {
|
||||||
hs.setDecorationIndex(decorationIndex);
|
hs.setDecorationIndex(decorationIndex);
|
||||||
ObjectBuilder.replace(object, object.transform(h.getDecorations()[decorationIndex].getObjectId(player.getHouseManager().getStyle())));
|
ObjectBuilder.replace(object, object.transform(h.getDecorations()[decorationIndex].getObjectId(player.getHouseManager().getStyle())));
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
return true;
|
||||||
return true;
|
default:
|
||||||
default:
|
return true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -502,8 +507,7 @@ public final class BuildingUtils {
|
||||||
* Builds a room.
|
* Builds a room.
|
||||||
* @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;
|
||||||
|
|
@ -574,19 +578,19 @@ public final class BuildingUtils {
|
||||||
public static int[] getRoomPosition(Player player, GameObject door) {
|
public static int[] getRoomPosition(Player player, GameObject door) {
|
||||||
Location l = door.getLocation();
|
Location l = door.getLocation();
|
||||||
int rotation = door.getRotation();
|
int rotation = door.getRotation();
|
||||||
if (player.getLocation().getChunkX() != l.getLocation().getChunkX()
|
if (player.getLocation().getChunkX() != l.getLocation().getChunkX()
|
||||||
|| player.getLocation().getChunkY() != l.getLocation().getChunkY()) {
|
|| player.getLocation().getChunkY() != l.getLocation().getChunkY()) {
|
||||||
return new int[] { l.getChunkX(), l.getChunkY() };
|
return new int[] { l.getChunkX(), l.getChunkY() };
|
||||||
}
|
}
|
||||||
switch (rotation) {
|
switch (rotation) {
|
||||||
case 0: //West
|
case 0: //West
|
||||||
return new int[] { l.getChunkX() - 1, l.getChunkY() };
|
return new int[] { l.getChunkX() - 1, l.getChunkY() };
|
||||||
case 1: //North
|
case 1: //North
|
||||||
return new int[] { l.getChunkX(), l.getChunkY() + 1};
|
return new int[] { l.getChunkX(), l.getChunkY() + 1};
|
||||||
case 2: //East
|
case 2: //East
|
||||||
return new int[] { l.getChunkX() + 1, l.getChunkY() };
|
return new int[] { l.getChunkX() + 1, l.getChunkY() };
|
||||||
case 3: //South
|
case 3: //South
|
||||||
return new int[] { l.getChunkX(), l.getChunkY() - 1};
|
return new int[] { l.getChunkX(), l.getChunkY() - 1};
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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.
|
||||||
|
|
@ -91,6 +94,16 @@ public enum HouseLocation {
|
||||||
HOUSE_OPTIONS.addPage(new Page(pageActions));
|
HOUSE_OPTIONS.addPage(new Page(pageActions));
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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}
|
||||||
|
|
@ -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,60 +8,71 @@ 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 {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The house manager.
|
* The house manager.
|
||||||
*/
|
*/
|
||||||
private HouseManager house;
|
private HouseManager house;
|
||||||
|
|
||||||
/**
|
|
||||||
* The previous house region id.
|
|
||||||
*/
|
|
||||||
private int previousRegion = -1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The previous dungeon region id.
|
|
||||||
*/
|
|
||||||
private int previousDungeon = -1;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs the house zone object.
|
* The previous house region id.
|
||||||
*/
|
*/
|
||||||
public HouseZone(HouseManager house) {
|
private int previousRegion = -1;
|
||||||
super("poh-zone" + house, true, ZoneRestriction.RANDOM_EVENTS, ZoneRestriction.FOLLOWERS);
|
|
||||||
this.house = house;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public void configure() {
|
* The previous dungeon region id.
|
||||||
if (previousRegion != -1) {
|
*/
|
||||||
unregisterRegion(previousRegion);
|
private int previousDungeon = -1;
|
||||||
}
|
|
||||||
if (previousDungeon != -1) {
|
|
||||||
unregisterRegion(previousDungeon);
|
|
||||||
}
|
|
||||||
registerRegion(house.getRegion().getId());
|
|
||||||
if (house.getDungeonRegion() != null) {
|
|
||||||
registerRegion(house.getRegion().getId());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean enter(Entity e) {
|
|
||||||
return super.enter(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean death(Entity e, Entity killer) {
|
|
||||||
if (e instanceof Player) {
|
|
||||||
Player p = (Player) e;
|
|
||||||
HouseManager.leave(p);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructs the house zone object.
|
||||||
|
*/
|
||||||
|
public HouseZone(HouseManager house) {
|
||||||
|
super("poh-zone" + house, true, ZoneRestriction.RANDOM_EVENTS, ZoneRestriction.FOLLOWERS);
|
||||||
|
this.house = house;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void configure() {
|
||||||
|
if (previousRegion != -1) {
|
||||||
|
unregisterRegion(previousRegion);
|
||||||
|
}
|
||||||
|
if (previousDungeon != -1) {
|
||||||
|
unregisterRegion(previousDungeon);
|
||||||
|
}
|
||||||
|
registerRegion(house.getRegion().getId());
|
||||||
|
if (house.getDungeonRegion() != null) {
|
||||||
|
registerRegion(house.getRegion().getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean enter(Entity e) {
|
||||||
|
return super.enter(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean death(Entity e, Entity killer) {
|
||||||
|
if (e instanceof Player) {
|
||||||
|
Player p = (Player) e;
|
||||||
|
HouseManager.leave(p);
|
||||||
|
}
|
||||||
|
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,9 +86,7 @@ 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);
|
||||||
player.getPacketDispatch().sendString("Welcome to " + GameWorld.getName(), 378, 115);
|
player.getPacketDispatch().sendString("Welcome to " + GameWorld.getName(), 378, 115);
|
||||||
|
|
@ -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,138 +9,231 @@ 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<>();
|
||||||
* The current npc being spawned.
|
private ArrayList<Integer> REGIONS = new ArrayList<>();
|
||||||
*/
|
|
||||||
private NPC npc;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@Code NPCSpawnSqlHandler} {@Code Object}
|
* The current npc being spawned.
|
||||||
*/
|
*/
|
||||||
public NPCSpawnSQLHandler() {
|
private NPC npc;
|
||||||
super(null, (SQLManager.LOCAL ? "server" : ServerConstants.DATABASE_NAMES[0]) + ".npc_spawns", "", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@Code NPCSpawnSqlHandler} {@Code Object}
|
* Constructs a new {@Code NPCSpawnSqlHandler} {@Code Object}
|
||||||
* @param entry the entry.
|
*/
|
||||||
* @param table the table.
|
public NPCSpawnSQLHandler() {
|
||||||
* @param column the column.
|
super(null, (SQLManager.LOCAL ? "server" : ServerConstants.DATABASE_NAMES[0]) + ".npc_spawns", "", "");
|
||||||
* @param value the value.
|
}
|
||||||
*/
|
|
||||||
public NPCSpawnSQLHandler(NPC entry, String table, String column, String value) {
|
|
||||||
super(entry, (SQLManager.LOCAL ? "server" : ServerConstants.DATABASE_NAMES[0]) + ".npc_spawns", "npc_id", "" + entry.getId());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Runs the NPC Spawn SQL handler.
|
* Constructs a new {@Code NPCSpawnSqlHandler} {@Code Object}
|
||||||
* @param args the args.
|
*
|
||||||
* @throws SQLException the exception if thrown.
|
* @param entry the entry.
|
||||||
*/
|
* @param table the table.
|
||||||
public static void main(String... args) throws SQLException {
|
* @param column the column.
|
||||||
Cache.init();
|
* @param value the value.
|
||||||
TimeStamp stamp = new TimeStamp();
|
*/
|
||||||
new NPCSpawnSQLHandler().parse();
|
public NPCSpawnSQLHandler(NPC entry, String table, String column, String value) {
|
||||||
stamp.duration(true, "");
|
super(entry, (SQLManager.LOCAL ? "server" : ServerConstants.DATABASE_NAMES[0]) + ".npc_spawns", "npc_id", "" + entry.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public void parse() throws SQLException {
|
* Runs the NPC Spawn SQL handler.
|
||||||
connection = getConnection();
|
*
|
||||||
if (connection == null) {
|
* @param args the args.
|
||||||
SQLManager.close(connection);
|
* @throws SQLException the exception if thrown.
|
||||||
return;
|
*/
|
||||||
}
|
public static void main(String... args) throws SQLException {
|
||||||
PreparedStatement statement = connection.prepareStatement("SELECT * FROM " + (SQLManager.LOCAL ? "server" : ServerConstants.DATABASE_NAMES[0]) + ".npc_spawns");
|
Cache.init();
|
||||||
ResultSet set = statement.executeQuery();
|
TimeStamp stamp = new TimeStamp();
|
||||||
while (set.next()) {
|
new NPCSpawnSQLHandler().parse();
|
||||||
parseNpc(set.getInt(1), set.getString(2));
|
stamp.duration(true, "");
|
||||||
}
|
}
|
||||||
SQLManager.close(statement.getConnection());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void create() throws SQLException {
|
public void parse() throws SQLException {
|
||||||
PreparedStatement statement = connection.prepareStatement("");
|
connection = getConnection();
|
||||||
statement.executeUpdate();
|
if (connection == null) {
|
||||||
SQLManager.close(statement.getConnection());
|
SQLManager.close(connection);
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
PreparedStatement statement = connection.prepareStatement("SELECT * FROM " + (SQLManager.LOCAL ? "server" : ServerConstants.DATABASE_NAMES[0]) + ".npc_spawns");
|
||||||
|
ResultSet set = statement.executeQuery();
|
||||||
|
while (set.next()) {
|
||||||
|
parseNpc(set.getInt(1), set.getString(2));
|
||||||
|
}
|
||||||
|
SQLManager.close(statement.getConnection());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void save() throws SQLException {
|
public void create() throws SQLException {
|
||||||
PreparedStatement statement = connection.prepareStatement("");
|
PreparedStatement statement = connection.prepareStatement("");
|
||||||
statement.executeUpdate();
|
statement.executeUpdate();
|
||||||
SQLManager.close(statement.getConnection());
|
SQLManager.close(statement.getConnection());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
@Override
|
||||||
* Parses an npc id's spawns.
|
public void save() throws SQLException {
|
||||||
* @param id the id.
|
PreparedStatement statement = connection.prepareStatement("");
|
||||||
* @param data the data.
|
statement.executeUpdate();
|
||||||
*/
|
SQLManager.close(statement.getConnection());
|
||||||
public void parseNpc(int id, String data) {
|
}
|
||||||
String[] datas = data.split("-");
|
|
||||||
String[] tokens = null;
|
|
||||||
for (String d : datas) {
|
|
||||||
try {
|
|
||||||
tokens = d.replace("{", "").replace("}", "").split(",");
|
|
||||||
npc = NPC.create(id, Location.create(Integer.valueOf(tokens[0].trim()), Integer.valueOf(tokens[1].trim()), Integer.valueOf(tokens[2].trim())));
|
|
||||||
npc.setWalks(tokens[3].trim().equals("1"));
|
|
||||||
npc.setDirection(Direction.values()[Integer.valueOf(tokens[4].trim())]);
|
|
||||||
npc.setAttribute("spawned:npc", true);
|
|
||||||
npc.init();
|
|
||||||
} catch (Throwable t) {
|
|
||||||
System.err.println("Error on " + id);
|
|
||||||
t.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
npc = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void addNPC(Player player, String id) {
|
/**
|
||||||
try {
|
* Parses an npc id's spawns.
|
||||||
connection = getConnection();
|
*
|
||||||
if (connection == null) {
|
* @param id the id.
|
||||||
SQLManager.close(connection);
|
* @param data the data.
|
||||||
return;
|
*/
|
||||||
}
|
public void parseNpc(int id, String data) {
|
||||||
int npc_id = Integer.parseInt(id);
|
String[] datas = data.split("-");
|
||||||
StringBuilder b = new StringBuilder("UPDATE `npc_spawns` ");
|
String[] tokens = null;
|
||||||
//{3222,3221,0,1,3}
|
for (String d : datas) {
|
||||||
b.append("SET `loc_data`='" + (result.next() ? "-{" +
|
try {
|
||||||
player.getLocation().getX() + ", "
|
tokens = d.replace("{", "").replace("}", "").split(",");
|
||||||
+player.getLocation().getY() + ", "
|
npc = NPC.create(id, Location.create(Integer.valueOf(tokens[0].trim()), Integer.valueOf(tokens[1].trim()), Integer.valueOf(tokens[2].trim())));
|
||||||
+ player.getLocation().getZ() + ", 1, 0}"
|
npc.setWalks(tokens[3].trim().equals("1"));
|
||||||
: "{" +
|
npc.setDirection(Direction.values()[Integer.valueOf(tokens[4].trim())]);
|
||||||
player.getLocation().getX() + ", "
|
npc.setAttribute("spawned:npc", true);
|
||||||
+player.getLocation().getY() + ", "
|
npc.init();
|
||||||
+ player.getLocation().getZ() + ", 1, 0}") + "' WHERE `npc_id`='"+ npc_id +"'");
|
NPC_SPAWNS.add(npc);
|
||||||
PreparedStatement statement = connection.prepareStatement(b.toString());
|
int region_id = npc.getLocation().getRegionId();
|
||||||
statement.executeUpdate();
|
boolean walks = tokens[3].trim().equals("1");
|
||||||
SQLManager.close(statement.getConnection());
|
if (!REGIONS.contains(region_id)) {
|
||||||
} catch (SQLException e) {
|
REGIONS.add(region_id);
|
||||||
e.printStackTrace();
|
}
|
||||||
}
|
// System.out.println(npc.getName() + " " + walks);
|
||||||
}
|
// convertNPC(npc);
|
||||||
|
// System.out.println("Added npc " + npc.getName());
|
||||||
|
} catch (Throwable t) {
|
||||||
|
System.err.println("Error on " + id);
|
||||||
|
t.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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) {
|
||||||
|
try {
|
||||||
|
connection = getConnection();
|
||||||
|
if (connection == null) {
|
||||||
|
SQLManager.close(connection);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int npc_id = Integer.parseInt(id);
|
||||||
|
StringBuilder b = new StringBuilder("UPDATE `npc_spawns` ");
|
||||||
|
//{3222,3221,0,1,3}
|
||||||
|
b.append("SET `loc_data`='" + (result.next() ? "-{" +
|
||||||
|
player.getLocation().getX() + ", "
|
||||||
|
+ player.getLocation().getY() + ", "
|
||||||
|
+ player.getLocation().getZ() + ", 1, 0}"
|
||||||
|
: "{" +
|
||||||
|
player.getLocation().getX() + ", "
|
||||||
|
+ player.getLocation().getY() + ", "
|
||||||
|
+ player.getLocation().getZ() + ", 1, 0}") + "' WHERE `npc_id`='" + npc_id + "'");
|
||||||
|
PreparedStatement statement = connection.prepareStatement(b.toString());
|
||||||
|
statement.executeUpdate();
|
||||||
|
SQLManager.close(statement.getConnection());
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@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,69 +1,68 @@
|
||||||
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) {
|
*/
|
||||||
super(stream);
|
public ConsoleLogger(PrintStream stream) {
|
||||||
}
|
super(stream);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void println(String message) {
|
public void println(String message) {
|
||||||
log(message);
|
log(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PrintStream printf(String message, Object... objects) {
|
public PrintStream printf(String message, Object... objects) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void println(boolean message) {
|
public void println(boolean message) {
|
||||||
log(String.valueOf(message));
|
log(String.valueOf(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void println(int message) {
|
public void println(int message) {
|
||||||
log(String.valueOf(message));
|
log(String.valueOf(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void println(double message) {
|
public void println(double message) {
|
||||||
log(String.valueOf(message));
|
log(String.valueOf(message));
|
||||||
}
|
}
|
||||||
|
|
||||||
@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) {
|
* Method used to log the message.
|
||||||
log(String.valueOf(message));
|
*
|
||||||
}
|
* @param message the message.
|
||||||
|
*/
|
||||||
/**
|
public void log(final String message) {
|
||||||
* Method used to log the message.
|
ConsoleFrame.getInstance().getStatisticsTab().log(message);
|
||||||
* @param message the message.
|
}
|
||||||
*/
|
|
||||||
public void log(final String message) {
|
|
||||||
KeldagrimFrame.getInstance().getStatisticsTab().log(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -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) {
|
||||||
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.");
|
int tut_stage = TutorialSession.getExtension(player).getStage();
|
||||||
setStage(1);
|
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.");
|
||||||
|
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);
|
||||||
|
|
@ -31,85 +31,85 @@ public final class ConstructionInterface 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) {
|
||||||
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");
|
||||||
if (hotspot == null || object == null) {
|
if (hotspot == null || object == null) {
|
||||||
System.err.println("Failed building decoration " + hotspot + " : " + object);
|
System.err.println("Failed building decoration " + hotspot + " : " + object);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
slot = ((slot % 2 != 0) ? 4 : 0) + (slot >> 1);
|
slot = ((slot % 2 != 0) ? 4 : 0) + (slot >> 1);
|
||||||
if (slot >= hotspot.getHotspot().getDecorations().length) {
|
if (slot >= hotspot.getHotspot().getDecorations().length) {
|
||||||
System.err.println("Failed building decoration " + slot + "/" + hotspot.getHotspot().getDecorations().length);
|
System.err.println("Failed building decoration " + slot + "/" + hotspot.getHotspot().getDecorations().length);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
boolean debug = player.isStaff();
|
boolean debug = player.isStaff();
|
||||||
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;
|
|
||||||
}
|
|
||||||
if (!player.getInventory().containsItems(deco.getItems())) {
|
|
||||||
player.getPacketDispatch().sendMessage("You don't have the right materials.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
for (int tool : deco.getTools()) {
|
|
||||||
if (tool == BuildingUtils.WATERING_CAN) {
|
|
||||||
boolean hasWateringCan = false;
|
|
||||||
for (int i = 0; i < 8; i++) {
|
|
||||||
if (player.getInventory().contains(tool - i, 1)) {
|
|
||||||
hasWateringCan = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!hasWateringCan) {
|
|
||||||
player.getPacketDispatch().sendMessage("You need a watering can to plant this.");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
continue;
|
if (!player.getInventory().containsItems(deco.getItems())) {
|
||||||
|
player.sendMessage("You don't have the right materials.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
for (int tool : deco.getTools()) {
|
||||||
|
if (tool == BuildingUtils.WATERING_CAN) {
|
||||||
|
boolean hasWateringCan = false;
|
||||||
|
for (int i = 0; i < 8; i++) {
|
||||||
|
if (player.getInventory().contains(tool - i, 1)) {
|
||||||
|
hasWateringCan = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!hasWateringCan) {
|
||||||
|
player.sendMessage("You need a watering can to plant this.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!player.getInventory().contains(tool, 1)) {
|
||||||
|
player.sendMessage("You need a " + ItemDefinition.forId(tool).getName() + " to build this.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!player.getInventory().contains(tool, 1)) {
|
BuildingUtils.buildDecoration(player, hotspot, deco, object);
|
||||||
player.getPacketDispatch().sendMessage("You need a " + ItemDefinition.forId(tool).getName() + " to build this.");
|
return true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 398:
|
||||||
|
switch (button) {
|
||||||
|
case 14:
|
||||||
|
player.getHouseManager().toggleBuildingMode(player, true);
|
||||||
|
return true;
|
||||||
|
case 1:
|
||||||
|
player.getHouseManager().toggleBuildingMode(player, false);
|
||||||
|
return true;
|
||||||
|
case 15:
|
||||||
|
player.getHouseManager().expelGuests(player);
|
||||||
|
return true;
|
||||||
|
case 13:
|
||||||
|
if (!player.getHouseManager().isInHouse(player)) {
|
||||||
|
player.sendMessage("You can't do this outside of your house.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
HouseManager.leave(player);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
BuildingUtils.buildDecoration(player, hotspot, deco, object);
|
break;
|
||||||
return true;
|
case 402:
|
||||||
}
|
int index = button - 160;
|
||||||
break;
|
System.err.println("BuildRoom Interface Index: " + index);
|
||||||
case 398:
|
if (index > -1 && index < RoomProperties.values().length) {
|
||||||
switch (button) {
|
player.getDialogueInterpreter().open("con:room", RoomProperties.values()[index]);
|
||||||
case 15:
|
|
||||||
player.getHouseManager().toggleBuildingMode(player, true);
|
|
||||||
return true;
|
|
||||||
case 1:
|
|
||||||
player.getHouseManager().toggleBuildingMode(player, false);
|
|
||||||
return true;
|
|
||||||
case 27:
|
|
||||||
player.getHouseManager().expelGuests(player);
|
|
||||||
return true;
|
|
||||||
case 29:
|
|
||||||
if (!player.getHouseManager().isInHouse(player)) {
|
|
||||||
player.getPacketDispatch().sendMessage("You can't do this outside of your house.");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
HouseManager.leave(player);
|
break;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 402:
|
|
||||||
int index = button - 160;
|
|
||||||
//System.err.println("BuildRoom Interface Index: " + index);
|
|
||||||
if (index > -1 && index < RoomProperties.values().length) {
|
|
||||||
player.getDialogueInterpreter().open("con:room", RoomProperties.values()[index]);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,304 +15,360 @@ 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
|
||||||
*/
|
*/
|
||||||
@InitializablePlugin
|
@InitializablePlugin
|
||||||
public final class EstateAgentDialogue extends DialoguePlugin {
|
public final class EstateAgentDialogue extends DialoguePlugin {
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents the book item.
|
|
||||||
*/
|
|
||||||
private static final Item BOOK = new Item(8463, 1);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@code EstateAgentDialogue} {@code Object}.
|
* Represents the book item.
|
||||||
*/
|
*/
|
||||||
public EstateAgentDialogue() {
|
private static final Item BOOK = new Item(8463, 1);
|
||||||
/**
|
|
||||||
* empty.
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructs a new {@code EstateAgentDialogue} {@code Object}.
|
* Constructs a new {@code EstateAgentDialogue} {@code Object}.
|
||||||
* @param player the player.
|
*/
|
||||||
*/
|
public EstateAgentDialogue() {
|
||||||
public EstateAgentDialogue(Player player) {
|
/**
|
||||||
super(player);
|
* empty.
|
||||||
}
|
*/
|
||||||
|
}
|
||||||
@Override
|
|
||||||
public DialoguePlugin newInstance(Player player) {
|
|
||||||
return new EstateAgentDialogue(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
/**
|
||||||
public boolean open(Object... args) {
|
* Constructs a new {@code EstateAgentDialogue} {@code Object}.
|
||||||
npc = (NPC) args[0];
|
*
|
||||||
interpreter.sendDialogues(npc, FacialExpression.NORMAL, "Hello. Welcome to the " + GameWorld.getName() + " Housing Agency! What", "can I do for you?");
|
* @param player the player.
|
||||||
stage = 0;
|
*/
|
||||||
return true;
|
public EstateAgentDialogue(Player player) {
|
||||||
}
|
super(player);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean handle(int interfaceId, int buttonId) {
|
public DialoguePlugin newInstance(Player player) {
|
||||||
switch (stage) {
|
return new EstateAgentDialogue(player);
|
||||||
case 0:
|
}
|
||||||
if (player.getHouseManager().hasHouse()) {
|
|
||||||
interpreter.sendOptions("Select an Option", "Can you move my house please?", "Can you redecorate my house please?", "Could I have a Construction guidebook?", "Tell me about houses.", "Tell me about that skillcape you're wearing.");
|
|
||||||
stage = 1;
|
|
||||||
} else {
|
|
||||||
interpreter.sendOptions("Select an Option", "How can I get a house?", "Tell me about houses.");
|
|
||||||
stage = 2;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
switch (buttonId) {
|
|
||||||
case 1:
|
|
||||||
interpreter.sendDialogues(player, FacialExpression.NORMAL, "Can you move my house please?");
|
|
||||||
stage = 10;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
interpreter.sendDialogues(player, FacialExpression.NORMAL, "Can you redecorate my house please?");
|
|
||||||
stage = 30;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
interpreter.sendDialogues(player, FacialExpression.NORMAL, "Could I have a Construction guidebook?");
|
|
||||||
stage = 60;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
interpreter.sendDialogues(player, FacialExpression.NORMAL, "Tell me about houses!");
|
|
||||||
stage = 90;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
interpreter.sendDialogues(player, FacialExpression.NORMAL, "Tell me about that skillcape you're wearing!");
|
|
||||||
stage = Skillcape.isMaster(player, Skills.CONSTRUCTION) ? 102 : 100;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
switch (buttonId) {
|
|
||||||
case 1:
|
|
||||||
player("How can I get a house?");
|
|
||||||
stage = 3;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
player("Tell me about houses.");
|
|
||||||
stage = 90;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
npc("I can sell you a starting house in Rimmington for", "1000 coins. As you increase your construction skill you", "will be able to have your house moved to other areas", "and redecorated in other styles.");
|
|
||||||
stage = 4;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
npc("Do you want to buy a starter house?");
|
|
||||||
stage = 5;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
options("Yes please!", "No thanks.");
|
|
||||||
stage = 6;
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
switch (buttonId) {
|
|
||||||
case 1:
|
|
||||||
player("Yes please!");
|
|
||||||
stage = 7;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
player("No thanks.");
|
|
||||||
stage = 150;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 7:
|
|
||||||
if (player.getInventory().contains(995, 1000)) {
|
|
||||||
player.getInventory().remove(new Item(995, 1000));
|
|
||||||
player.getHouseManager().create(HouseLocation.RIMMINGTON);
|
|
||||||
npc("Thank you. Go through the Rimmington house portal", "and you will find your house ready for you to start", "building in it.");
|
|
||||||
stage = 150;
|
|
||||||
} else {
|
|
||||||
npc("You don't have enough money to buy a house,", "come back when you can afford one.");
|
|
||||||
stage = 150;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 8:
|
|
||||||
if (GameWorld.getSettings().isDevMode() && GameWorld.getSettings().isBeta()) {
|
|
||||||
npc("This book will help you to start building your house.", "When you open the book you will receive some", "Construction resources.");
|
|
||||||
} else {
|
|
||||||
npc("This book will help you to start building your house.");
|
|
||||||
}
|
|
||||||
player.getInventory().add(BOOK);
|
|
||||||
stage = 150;
|
|
||||||
break;
|
|
||||||
case 10:
|
|
||||||
//HouseLocation.HOUSE_OPTIONS.open(player);
|
|
||||||
end();
|
|
||||||
break;
|
|
||||||
case 30:
|
|
||||||
npc("Certainly. My magic can rebuild the house in a", "completely new style! What style would you like?");
|
|
||||||
stage = 31;
|
|
||||||
break;
|
|
||||||
case 31:
|
|
||||||
options("Basic wood (5,000)", "Basic stone (5,000)", "Whitewashed stone (7,500)", "Fremennik-style wood (10,000)", "More...");
|
|
||||||
stage = 32;
|
|
||||||
break;
|
|
||||||
case 32:
|
|
||||||
switch (buttonId) {
|
|
||||||
case 1:
|
|
||||||
player("Basic wood please!");
|
|
||||||
stage = 33;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
player("Basic stone please!");
|
|
||||||
stage = 34;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
player("Whitewashed stone please!");
|
|
||||||
stage = 35;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
player("Fremennik-style wood please!");
|
|
||||||
stage = 36;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
options("Tropical wood (15,000)", "Fancy stone (25,000)", "Previous...");
|
|
||||||
stage = 39;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 33:
|
|
||||||
redecorate(HousingStyle.BASIC_WOOD);
|
|
||||||
break;
|
|
||||||
case 34:
|
|
||||||
redecorate(HousingStyle.BASIC_STONE);
|
|
||||||
break;
|
|
||||||
case 35:
|
|
||||||
redecorate(HousingStyle.WHITEWASHED_STONE);
|
|
||||||
break;
|
|
||||||
case 36:
|
|
||||||
redecorate(HousingStyle.FREMENNIK_STYLE_WOOD);
|
|
||||||
break;
|
|
||||||
case 37:
|
|
||||||
redecorate(HousingStyle.TROPICAL_WOOD);
|
|
||||||
break;
|
|
||||||
case 38:
|
|
||||||
redecorate(HousingStyle.FANCY_STONE);
|
|
||||||
break;
|
|
||||||
case 39:
|
|
||||||
switch (buttonId) {
|
|
||||||
case 1:
|
|
||||||
player("Tropical wood please!");
|
|
||||||
stage = 37;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
player("Fancy stone please!");
|
|
||||||
stage = 38;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
options("Basic wood (5,000)", "Basic stone (5,000)", "Whitewashed stone (7,500)", "Fremennik-style wood (10,000)", "More...");
|
|
||||||
stage = 32;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 60:
|
|
||||||
interpreter.sendDialogues(npc, FacialExpression.NORMAL, "Certainly.");
|
|
||||||
player.getInventory().add(BOOK);
|
|
||||||
stage = 150;
|
|
||||||
break;
|
|
||||||
case 90:
|
|
||||||
interpreter.sendDialogues(npc, FacialExpression.NORMAL, "It all came out of the wizards' experiments. They found", "a way to fold space, so that they could pack many", "acres of land into an area only a foot across.");
|
|
||||||
stage = 91;
|
|
||||||
break;
|
|
||||||
case 91:
|
|
||||||
interpreter.sendDialogues(npc, FacialExpression.NORMAL, "They created several folded-space regions across", "" + GameWorld.getName() + ". Each one contains hundreds of small plots", "where people can build houses.");
|
|
||||||
stage = 92;
|
|
||||||
break;
|
|
||||||
case 92:
|
|
||||||
interpreter.sendDialogues(player, FacialExpression.NORMAL, "Ah, so that's how everyone can have a house without", "them cluttering up the world!");
|
|
||||||
stage = 93;
|
|
||||||
break;
|
|
||||||
case 93:
|
|
||||||
interpreter.sendDialogues(npc, FacialExpression.NORMAL, "Quite. The wizards didn't want to get bogged down", "in the business side of things so they ", "hired me to sell the houses.");
|
|
||||||
stage = 94;
|
|
||||||
break;
|
|
||||||
case 94:
|
|
||||||
interpreter.sendDialogues(npc, FacialExpression.NORMAL, "There are various other people across " + GameWorld.getName() + " who can", "help you furnish your house. You should start buying", "planks from the sawmill operator in Varrock.");
|
|
||||||
stage = 150;
|
|
||||||
break;
|
|
||||||
case 100:
|
|
||||||
interpreter.sendDialogues(npc, FacialExpression.NORMAL, "As you may know, skillcapes are only available to masters", "in a skill. I have spent my entire life building houses and", "now I spend my time selling them! As a sign of my abilites", "I wear this Skillcape of Construction. If you ever have");
|
|
||||||
stage = 101;
|
|
||||||
break;
|
|
||||||
case 101:
|
|
||||||
interpreter.sendDialogues(npc, FacialExpression.NORMAL, "enough skill to build a demonic throne, come and talk to", "me and I'll sell you a skillcape like mine.");
|
|
||||||
stage = 150;
|
|
||||||
break;
|
|
||||||
case 102:
|
|
||||||
interpreter.sendDialogues(npc, FacialExpression.HAPPY, "I see you have recently achieved 99 construction.", "Would you like to buy a cape for 99,0000 gp?");
|
|
||||||
stage = 103;
|
|
||||||
break;
|
|
||||||
case 103:
|
|
||||||
interpreter.sendOptions("Select an Option", "Yes, I'll pay the 99k", "No thanks, maybe later.");
|
|
||||||
stage = 104;
|
|
||||||
break;
|
|
||||||
case 104:
|
|
||||||
switch (buttonId) {
|
|
||||||
case 1:
|
|
||||||
if (Skillcape.purchase(player, Skills.CONSTRUCTION)) {
|
|
||||||
npc("Here you go lad, enjoy!");
|
|
||||||
}
|
|
||||||
stage = 150;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
stage = 150;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 150:
|
|
||||||
end();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Redecorates the player's house.
|
|
||||||
* @param style The house style.
|
|
||||||
*/
|
|
||||||
private void redecorate(HousingStyle style) {
|
|
||||||
boolean diary = false;//player.getAchievementDiaryManager().getDiary(DiaryType.FALADOR).isComplete(0);
|
|
||||||
if (style == player.getHouseManager().getStyle()) {
|
|
||||||
npc("Your house is already in that style!");
|
|
||||||
stage = 31;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (style.getLevel() > player.getSkills().getStaticLevel(Skills.CONSTRUCTION)) {
|
|
||||||
npc("You need a Construction level of " + style.getLevel() + " to buy this style.");
|
|
||||||
stage = 31;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!player.getInventory().contains(995, style.getCost()) && !diary) {
|
|
||||||
npc("Hmph. Come back when you have " + style.getCost() + " coins.");
|
|
||||||
stage = 150;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!diary) {
|
|
||||||
player.getInventory().remove(new Item(995, style.getCost()));
|
|
||||||
}
|
|
||||||
player.getHouseManager().redecorate(style);
|
|
||||||
npc("Your house has been redecorated.");
|
|
||||||
if (player.getLocation().withinDistance(new Location(2982, 3370))) {
|
|
||||||
//player.getAchievementDiaryManager().getDiary(DiaryType.FALADOR).updateTask(player, 1, 5, true);
|
|
||||||
}
|
|
||||||
stage = 150;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[] getIds() {
|
public boolean open(Object... args) {
|
||||||
return new int[] { 4247 };
|
npc = (NPC) args[0];
|
||||||
}
|
interpreter.sendDialogues(npc, FacialExpression.NORMAL, "Hello. Welcome to the " + GameWorld.getName() + " Housing Agency! What", "can I do for you?");
|
||||||
|
stage = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean handle(int interfaceId, int buttonId) {
|
||||||
|
switch (stage) {
|
||||||
|
case 0:
|
||||||
|
if (player.getHouseManager().hasHouse()) {
|
||||||
|
interpreter.sendOptions("Select an Option", "Can you move my house please?", "Can you redecorate my house please?", "Could I have a Construction guidebook?", "Tell me about houses.", "Tell me about that skillcape you're wearing.");
|
||||||
|
stage = 1;
|
||||||
|
} else {
|
||||||
|
interpreter.sendOptions("Select an Option", "How can I get a house?", "Tell me about houses.");
|
||||||
|
stage = 2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
switch (buttonId) {
|
||||||
|
case 1:
|
||||||
|
interpreter.sendDialogues(player, FacialExpression.NORMAL, "Can you move my house please?");
|
||||||
|
stage = 10;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
interpreter.sendDialogues(player, FacialExpression.NORMAL, "Can you redecorate my house please?");
|
||||||
|
stage = 30;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
interpreter.sendDialogues(player, FacialExpression.NORMAL, "Could I have a Construction guidebook?");
|
||||||
|
stage = 60;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
interpreter.sendDialogues(player, FacialExpression.NORMAL, "Tell me about houses!");
|
||||||
|
stage = 90;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
interpreter.sendDialogues(player, FacialExpression.NORMAL, "Tell me about that skillcape you're wearing!");
|
||||||
|
stage = Skillcape.isMaster(player, Skills.CONSTRUCTION) ? 102 : 100;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
switch (buttonId) {
|
||||||
|
case 1:
|
||||||
|
player("How can I get a house?");
|
||||||
|
stage = 3;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
player("Tell me about houses.");
|
||||||
|
stage = 90;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
npc("I can sell you a starting house in Rimmington for", "1000 coins. As you increase your construction skill you", "will be able to have your house moved to other areas", "and redecorated in other styles.");
|
||||||
|
stage = 4;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
npc("Do you want to buy a starter house?");
|
||||||
|
stage = 5;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
options("Yes please!", "No thanks.");
|
||||||
|
stage = 6;
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
switch (buttonId) {
|
||||||
|
case 1:
|
||||||
|
player("Yes please!");
|
||||||
|
stage = 7;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
player("No thanks.");
|
||||||
|
stage = 150;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 7:
|
||||||
|
if (player.getInventory().contains(995, 1000)) {
|
||||||
|
player.getInventory().remove(new Item(995, 1000));
|
||||||
|
player.getHouseManager().create(HouseLocation.RIMMINGTON);
|
||||||
|
npc("Thank you. Go through the Rimmington house portal", "and you will find your house ready for you to start", "building in it.");
|
||||||
|
stage = 150;
|
||||||
|
} else {
|
||||||
|
npc("You don't have enough money to buy a house,", "come back when you can afford one.");
|
||||||
|
stage = 150;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 8:
|
||||||
|
if (GameWorld.getSettings().isDevMode() && GameWorld.getSettings().isBeta()) {
|
||||||
|
npc("This book will help you to start building your house.", "When you open the book you will receive some", "Construction resources.");
|
||||||
|
} else {
|
||||||
|
npc("This book will help you to start building your house.");
|
||||||
|
}
|
||||||
|
player.getInventory().add(BOOK);
|
||||||
|
stage = 150;
|
||||||
|
break;
|
||||||
|
case 10:
|
||||||
|
player("Can you move my house please?");
|
||||||
|
// HouseLocation.HOUSE_OPTIONS.open(player);
|
||||||
|
stage = 200;
|
||||||
|
break;
|
||||||
|
case 30:
|
||||||
|
npc("Certainly. My magic can rebuild the house in a", "completely new style! What style would you like?");
|
||||||
|
stage = 31;
|
||||||
|
break;
|
||||||
|
case 31:
|
||||||
|
options("Basic wood (5,000)", "Basic stone (5,000)", "Whitewashed stone (7,500)", "Fremennik-style wood (10,000)", "More...");
|
||||||
|
stage = 32;
|
||||||
|
break;
|
||||||
|
case 32:
|
||||||
|
switch (buttonId) {
|
||||||
|
case 1:
|
||||||
|
player("Basic wood please!");
|
||||||
|
stage = 33;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
player("Basic stone please!");
|
||||||
|
stage = 34;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
player("Whitewashed stone please!");
|
||||||
|
stage = 35;
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
player("Fremennik-style wood please!");
|
||||||
|
stage = 36;
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
options("Tropical wood (15,000)", "Fancy stone (25,000)", "Previous...");
|
||||||
|
stage = 39;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 33:
|
||||||
|
redecorate(HousingStyle.BASIC_WOOD);
|
||||||
|
break;
|
||||||
|
case 34:
|
||||||
|
redecorate(HousingStyle.BASIC_STONE);
|
||||||
|
break;
|
||||||
|
case 35:
|
||||||
|
redecorate(HousingStyle.WHITEWASHED_STONE);
|
||||||
|
break;
|
||||||
|
case 36:
|
||||||
|
redecorate(HousingStyle.FREMENNIK_STYLE_WOOD);
|
||||||
|
break;
|
||||||
|
case 37:
|
||||||
|
redecorate(HousingStyle.TROPICAL_WOOD);
|
||||||
|
break;
|
||||||
|
case 38:
|
||||||
|
redecorate(HousingStyle.FANCY_STONE);
|
||||||
|
break;
|
||||||
|
case 39:
|
||||||
|
switch (buttonId) {
|
||||||
|
case 1:
|
||||||
|
player("Tropical wood please!");
|
||||||
|
stage = 37;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
player("Fancy stone please!");
|
||||||
|
stage = 38;
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
options("Basic wood (5,000)", "Basic stone (5,000)", "Whitewashed stone (7,500)", "Fremennik-style wood (10,000)", "More...");
|
||||||
|
stage = 32;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 60:
|
||||||
|
interpreter.sendDialogues(npc, FacialExpression.NORMAL, "Certainly.");
|
||||||
|
player.getInventory().add(BOOK);
|
||||||
|
stage = 150;
|
||||||
|
break;
|
||||||
|
case 90:
|
||||||
|
interpreter.sendDialogues(npc, FacialExpression.NORMAL, "It all came out of the wizards' experiments. They found", "a way to fold space, so that they could pack many", "acres of land into an area only a foot across.");
|
||||||
|
stage = 91;
|
||||||
|
break;
|
||||||
|
case 91:
|
||||||
|
interpreter.sendDialogues(npc, FacialExpression.NORMAL, "They created several folded-space regions across", "" + GameWorld.getName() + ". Each one contains hundreds of small plots", "where people can build houses.");
|
||||||
|
stage = 92;
|
||||||
|
break;
|
||||||
|
case 92:
|
||||||
|
interpreter.sendDialogues(player, FacialExpression.NORMAL, "Ah, so that's how everyone can have a house without", "them cluttering up the world!");
|
||||||
|
stage = 93;
|
||||||
|
break;
|
||||||
|
case 93:
|
||||||
|
interpreter.sendDialogues(npc, FacialExpression.NORMAL, "Quite. The wizards didn't want to get bogged down", "in the business side of things so they ", "hired me to sell the houses.");
|
||||||
|
stage = 94;
|
||||||
|
break;
|
||||||
|
case 94:
|
||||||
|
interpreter.sendDialogues(npc, FacialExpression.NORMAL, "There are various other people across " + GameWorld.getName() + " who can", "help you furnish your house. You should start buying", "planks from the sawmill operator in Varrock.");
|
||||||
|
stage = 150;
|
||||||
|
break;
|
||||||
|
case 100:
|
||||||
|
interpreter.sendDialogues(npc, FacialExpression.NORMAL, "As you may know, skillcapes are only available to masters", "in a skill. I have spent my entire life building houses and", "now I spend my time selling them! As a sign of my abilites", "I wear this Skillcape of Construction. If you ever have");
|
||||||
|
stage = 101;
|
||||||
|
break;
|
||||||
|
case 101:
|
||||||
|
interpreter.sendDialogues(npc, FacialExpression.NORMAL, "enough skill to build a demonic throne, come and talk to", "me and I'll sell you a skillcape like mine.");
|
||||||
|
stage = 150;
|
||||||
|
break;
|
||||||
|
case 102:
|
||||||
|
interpreter.sendDialogues(npc, FacialExpression.HAPPY, "I see you have recently achieved 99 construction.", "Would you like to buy a cape for 99,0000 gp?");
|
||||||
|
stage = 103;
|
||||||
|
break;
|
||||||
|
case 103:
|
||||||
|
interpreter.sendOptions("Select an Option", "Yes, I'll pay the 99k", "No thanks, maybe later.");
|
||||||
|
stage = 104;
|
||||||
|
break;
|
||||||
|
case 104:
|
||||||
|
switch (buttonId) {
|
||||||
|
case 1:
|
||||||
|
if (Skillcape.purchase(player, Skills.CONSTRUCTION)) {
|
||||||
|
npc("Here you go lad, enjoy!");
|
||||||
|
}
|
||||||
|
stage = 150;
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
stage = 150;
|
||||||
|
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:
|
||||||
|
end();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
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.
|
||||||
|
*
|
||||||
|
* @param style The house style.
|
||||||
|
*/
|
||||||
|
private void redecorate(HousingStyle style) {
|
||||||
|
boolean diary = false;//player.getAchievementDiaryManager().getDiary(DiaryType.FALADOR).isComplete(0);
|
||||||
|
if (style == player.getHouseManager().getStyle()) {
|
||||||
|
npc("Your house is already in that style!");
|
||||||
|
stage = 31;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (style.getLevel() > player.getSkills().getStaticLevel(Skills.CONSTRUCTION)) {
|
||||||
|
npc("You need a Construction level of " + style.getLevel() + " to buy this style.");
|
||||||
|
stage = 31;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!player.getInventory().contains(995, style.getCost()) && !diary) {
|
||||||
|
npc("Hmph. Come back when you have " + style.getCost() + " coins.");
|
||||||
|
stage = 150;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!diary) {
|
||||||
|
player.getInventory().remove(new Item(995, style.getCost()));
|
||||||
|
}
|
||||||
|
player.getHouseManager().redecorate(style);
|
||||||
|
npc("Your house has been redecorated.");
|
||||||
|
if (player.getLocation().withinDistance(new Location(2982, 3370))) {
|
||||||
|
//player.getAchievementDiaryManager().getDiary(DiaryType.FALADOR).updateTask(player, 1, 5, true);
|
||||||
|
}
|
||||||
|
stage = 150;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int[] getIds() {
|
||||||
|
return new int[]{4247};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -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