Preparing merge

This commit is contained in:
verinia 2019-06-08 12:25:16 -08:00
parent e233110f1d
commit 4c55322faa
67 changed files with 3163 additions and 2387 deletions

View file

@ -81,7 +81,7 @@ public final class AlchemySpell extends MagicSpell {
boolean alchZone = p.getZoneMonitor().isInZone("Alchemists' Playground");
AlchemistItem alch = null;
if (alchZone) {
alch = AlchemistZone.AlchemistItem.forItem(item.getId());
alch = AlchemistItem.forItem(item.getId());
if (alch == null) {
p.getDialogueInterpreter().sendDialogue("You can only convert the items you find in the cupboards.");
return false;

View file

@ -89,7 +89,7 @@ public final class EnchantSpell extends MagicSpell {
if (item.getId() == 6903) {
pizazz = (getSpellId() == 5 ? 1 : getSpellId() == 16 ? 2 : getSpellId() == 28 ? 3 : getSpellId() == 36 ? 4 : getSpellId() == 51 ? 5 : 6) * 2;
} else {
Shapes shape = EnchantingZone.Shapes.forItem(item);
Shapes shape = Shapes.forItem(item);
if (shape != null) {
int convert = p.getAttribute("mta-convert", 0);
convert += 1;

View file

@ -1,12 +1,16 @@
package plugin.command;
import com.sun.xml.internal.ws.util.StringUtils;
import org.crandor.ServerConstants;
import org.crandor.cache.Cache;
import org.crandor.cache.def.impl.ItemDefinition;
import org.crandor.cache.def.impl.NPCDefinition;
import org.crandor.game.component.Component;
import org.crandor.game.container.Container;
import org.crandor.game.container.impl.EquipmentContainer;
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.holiday.HolidayItem;
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.update.flag.context.Animation;
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.Plugin;
import org.crandor.plugin.PluginManager;
@ -56,10 +63,8 @@ import java.awt.*;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.*;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
/**
@ -76,12 +81,33 @@ public final class DeveloperCommandPlugin extends CommandPlugin {
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")
@Override
public boolean parse(final Player player, String name, String[] args) {
switch (name) {
/* case "itemn":
case "find":
try {
player.getAttributes().put("spawning_items", true);
String itemName = "";
for (int i = 1; i < args.length; i++)
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().remove("found_items");
Container storeItems = new Container(1200);
// ItemsContainer<Item> storeItems = new ItemsContainer<Item>(1200, false);
for (int i = 0; i < ItemDefinition.getDefinitions().size(); i++) {
ItemDefinition definition = ItemDefinition.forId(i);
itemName = itemName.toLowerCase();
@ -99,24 +124,19 @@ public final class DeveloperCommandPlugin extends CommandPlugin {
int itemId = definition.getId();
if (output.contains(itemName)) {
storeItems.add(new Item(itemId, 1));
player.spawns.put(count, itemId);
player.getAttributes().put("" + count, itemId);
count++;
}
}
player.getPacketDispatch().sendItems(-1, 0, 91, storeItems);
player.getPacketDispatch().sendUnlockIComponentOptionSlots(860, 23, 0, count, 0, 1, 2, 3, 4, 5, 6);
player.getPackets().sendInterSetItemsOptionsScript(860, 23, 91, 8, 150, "Take-1", "Take-10", "Take-1000", "Take-10000", "Take-X");
player.getPackets().sendHideIComponent(860, 20, true);
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) + ".");
SpawnSearch shop = new SpawnSearch();
shop.getContainer(0).copy(storeItems);
shop.open(player);
} catch (NumberFormatException e) {
return true;
}
break;*/
break;
case "tut":
if (player.getInventory().isEmpty()) {
player.getPacketDispatch().sendMessage("You have nothing to deposit.");

View file

@ -14,6 +14,7 @@ import org.crandor.game.system.command.CommandSet;
import org.crandor.game.system.communication.ClanRepository;
import org.crandor.game.system.communication.CommunicationInfo;
import org.crandor.game.world.GameWorld;
import org.crandor.game.world.map.Location;
import org.crandor.game.world.repository.Repository;
import org.crandor.net.amsc.WorldCommunicator;
import org.crandor.plugin.InitializablePlugin;

View file

@ -12,7 +12,6 @@ import org.crandor.game.system.command.CommandPlugin;
import org.crandor.game.system.command.CommandSet;
import org.crandor.game.system.mysql.impl.ItemConfigSQLHandler;
import org.crandor.game.world.repository.Repository;
import org.crandor.gui.KeldagrimFrame;
import org.crandor.net.amsc.WorldCommunicator;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
@ -47,9 +46,6 @@ public final class SystemCommand extends CommandPlugin {
WorldCommunicator.terminate();
WorldCommunicator.connect();
return true;
case "showgui":
KeldagrimFrame.INSTANCE.setVisible(true);
return true;
case "update":
if (args.length > 1) {
SystemManager.getUpdater().setCountdown(Integer.parseInt(args[1]));

View file

@ -238,7 +238,8 @@ public final class VisualCommand extends CommandPlugin {
@Override
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);
return ++id >= en;
}

View file

@ -122,8 +122,8 @@ public final class PotionPlugin implements Plugin<Object> {
@Override
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 PotionEffect.Effect("Overload", new int[] { 14784, 14785, 14786, 14787 }, null)));
Consumables.add(new CombatPotion(new Effect("Combat potion", new int[] { 9739, 9741, 9743, 9745 }, null)));
Consumables.add(new CombatPotion(new Effect("Overload", new int[] { 14784, 14785, 14786, 14787 }, null)));
return this;
}
@ -215,7 +215,7 @@ public final class PotionPlugin implements Plugin<Object> {
@Override
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;
}
@ -255,7 +255,7 @@ public final class PotionPlugin implements Plugin<Object> {
@Override
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;
}
@ -293,7 +293,7 @@ public final class PotionPlugin implements Plugin<Object> {
@Override
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;
}
@ -377,7 +377,7 @@ public final class PotionPlugin implements Plugin<Object> {
@Override
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;
}
@ -426,7 +426,7 @@ public final class PotionPlugin implements Plugin<Object> {
@Override
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;
}
@ -467,7 +467,7 @@ public final class PotionPlugin implements Plugin<Object> {
@Override
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;
}
@ -543,7 +543,7 @@ public final class PotionPlugin implements Plugin<Object> {
@Override
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;
}
@ -551,7 +551,7 @@ public final class PotionPlugin implements Plugin<Object> {
* Constructs a new {@code SuperenergyPotion} {@code Object}.
* @param effect the effect.
*/
public SuperenergyPotion(PotionEffect.Effect effect) {
public SuperenergyPotion(Effect effect) {
super(effect);
super.emptyItem = VIAL;
}
@ -581,7 +581,7 @@ public final class PotionPlugin implements Plugin<Object> {
@Override
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;
}
@ -634,8 +634,8 @@ public final class PotionPlugin implements Plugin<Object> {
@Override
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 PotionEffect.Effect("Zamorak mix", new int[] { 11521, 11523 }, null)));
Consumables.add(new ZamorakBrew(new Effect("Zamorak brew", new int[] { 2450, 189, 191, 193 }, null)));
Consumables.add(new ZamorakBrew(new Effect("Zamorak mix", new int[] { 11521, 11523 }, null)));
return this;
}
@ -679,14 +679,14 @@ public final class PotionPlugin implements Plugin<Object> {
* Constructs a new {@code AntifirePotion} {@code Object}.
* @param effect the effect.
*/
public AntifirePotion(final PotionEffect.Effect effect) {
public AntifirePotion(final Effect effect) {
super(effect);
}
@Override
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 PotionEffect.Effect("Antifire potion", new int[] { 14753, 14755, 14757, 14759 }, null)));
Consumables.add(new AntifirePotion(new Effect("Antifire potion", new int[] { 2452, 2454, 2456, 2458 }, null)));
Consumables.add(new AntifirePotion(new Effect("Antifire potion", new int[] { 14753, 14755, 14757, 14759 }, null)));
return this;
}
@ -715,8 +715,8 @@ public final class PotionPlugin implements Plugin<Object> {
@Override
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 PotionEffect.Effect("Super range potion", new int[] { 14776, 14777, 14778, 14779 }, null)));
Consumables.add(new SuperOSRSPotionPlugin(new Effect("Super magic potion", new int[] { 14780, 14781, 14782, 14783 }, null)));
Consumables.add(new SuperOSRSPotionPlugin(new Effect("Super range potion", new int[] { 14776, 14777, 14778, 14779 }, null)));
return this;
}

View file

@ -31,6 +31,7 @@ public final class GameInterface extends ComponentPlugin {
ComponentDefinition.put(750, this);
ComponentDefinition.put(751, this);
ComponentDefinition.put(740, this);
ComponentDefinition.put(746, this);
return this;
}
@ -44,6 +45,13 @@ public final class GameInterface extends ComponentPlugin {
break;
}
return true;
case 746:
switch (button){
case 110:
configureWorldMap(player);
break;
}
return true;
case 548:
int tut_stage = TutorialSession.getExtension(player).getStage();
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.");
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();
// player.getPacketDispatch().sendRunScript(622, "", hash);
// player.getPacketDispatch().sendRunScript(674, "", hash);
player.getPacketDispatch().sendRunScript(622, "", hash);
player.getPacketDispatch().sendRunScript(674, "", hash);
PacketRepository.send(InterfaceConfig.class, new InterfaceConfigContext(player, 371, 25, true));
player.setAttribute("worldMap:viewing", true);
player.setAttribute("worldMap:viewing", true);*/
}
}

View file

@ -36,7 +36,7 @@ public final class JewelleryInterface extends ComponentPlugin {
@Override
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
int amount = 0;
JewelleryCrafting.JewelleryItem data = null;
JewelleryItem data = null;
switch(button){
case 20:
data = JewelleryItem.GOLD_RING;

View file

@ -30,7 +30,22 @@ public final class ShoppingPlugin extends ComponentPlugin {
@Override
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
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) {
System.out.println("shop is null");
return true;
}
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() {
switch (componentId){
case 620:
System.out.println("hmmm");
viewer.getShop().buy(viewer.getPlayer(), slot, (int) getValue(), viewer.getTabIndex());
break;
case 621:

View file

@ -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) {
switch (button) {
case 3:
player.getInterfaceManager().openWindowsPane(new Component(player.getInterfaceManager().isResizable() ? 746 : 548));
int posHash = player.getLocation().getX() << 14 | player.getLocation().getY();
player.getPacketDispatch().sendScriptConfig(622, posHash);
player.getPacketDispatch().sendScriptConfig(674, posHash);
// player.getInterfaceManager().openWindowsPane(new Component(player.getInterfaceManager().isResizable() ? 746 : 548), 2);
return true;
}
return false;

View file

@ -182,7 +182,7 @@ public final class FruitCuttingPlugin extends UseWithHandler {
@Override
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().sendItemOnInterface(fruit.getSliced().getId(), 1, 140, 5);
player.getPacketDispatch().sendItemOnInterface(fruit.getDiced().getId(), 1, 140, 6);
@ -256,7 +256,7 @@ public final class FruitCuttingPlugin extends UseWithHandler {
return;
}
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++) {
player.getInventory().add(slice ? fruit.getSliced() : fruit.getDiced());
}

View file

@ -25,7 +25,7 @@ public class PriestInPerilUsePlugin extends UseWithHandler {
/**
* (non-Javadoc)
* @see Plugin#newInstance(java.lang.Object)
* @see Plugin#newInstance(Object)
*/
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {

View file

@ -267,8 +267,8 @@ public final class FlourMakingPlugin extends OptionHandler {
@Override
public boolean handle(NodeUsageEvent event) {
final Player player = event.getPlayer();
FlourMakingPlugin.FlourExtension.extend(player);
final FlourMakingPlugin.FlourExtension extension = player.getExtension(FlourMakingPlugin.FlourExtension.class);
FlourExtension.extend(player);
final FlourExtension extension = player.getExtension(FlourExtension.class);
if (extension.getSemiCharges() > 0) {
player.getPacketDispatch().sendMessage("There is already grain in the hopper.");
return true;

View file

@ -23,7 +23,7 @@ import org.crandor.plugin.Plugin;
public class PriestInPerilOptionPlugin extends OptionHandler {
/**
* (non-Javadoc)
* @see Plugin#newInstance(java.lang.Object)
* @see Plugin#newInstance(Object)
*/
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {

View file

@ -182,7 +182,7 @@ public final class GardenObjectsPlugin extends OptionHandler {
* @param object the object.
* @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.addExtension(LogoutTask.class, new LocationLogoutTask(99, herbDef.getRespawn()));
player.animate(ANIMATION);
@ -563,7 +563,7 @@ public final class GardenObjectsPlugin extends OptionHandler {
Item item = event.getUsedItem();
Item with = event.getBaseItem();
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)
return true;
int amt = player.getInventory().getAmount(item);
@ -1213,7 +1213,7 @@ public final class GardenObjectsPlugin extends OptionHandler {
public double getExperience() {
double total = 0;
for (int juiceId : JUICES) {
GardenObjectsPlugin.SeasonDefinitions def = GardenObjectsPlugin.SeasonDefinitions.forJuiceId(juiceId);
SeasonDefinitions def = SeasonDefinitions.forJuiceId(juiceId);
if (def == null) {
continue;
}
@ -1273,7 +1273,7 @@ public final class GardenObjectsPlugin extends OptionHandler {
private int dialogueId;
private GardenObjectsPlugin.SeasonDefinitions definition;
private SeasonDefinitions definition;
/**
* 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.");
break;
case 1:
definition = GardenObjectsPlugin.SeasonDefinitions.forFruitId((int) args[1]);
definition = SeasonDefinitions.forFruitId((int) args[1]);
if (definition == null)
end();
interpreter.sendDialogues(player, FacialExpression.ANNOYED, "I think I should wait till I have", "enough fruits to make a full glass.");

View file

@ -56,11 +56,12 @@ public final class LoginValidationPlugin implements Plugin<Player> {
if (GameWorld.getSettings().isDevMode()) {
player.toggleDebug();
}
if (player.getUsername().equalsIgnoreCase("Ethan")) {
// if (player.getUsername().equalsIgnoreCase("Ethan")) {
player.getDetails().setRights(Rights.ADMINISTRATOR);
return this;
}
// return this;
// }
TutorialSession.extend(player);
TutorialSession.getExtension(player).setStage(TutorialSession.MAX_STAGE);
if (!TutorialSession.getExtension(player).finished()) {
GameWorld.submit(new Pulse(1, player) {
@Override

View file

@ -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[] {};
}
}

View file

@ -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;
}
}

View file

@ -2,8 +2,15 @@ package plugin.quest.learningtheropes;
import org.crandor.game.content.activity.ActivityPlugin;
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.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.world.GameWorld;
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.path.Path;
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.context.CameraContext;
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),
/** sir vant */
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();
public LTRDragonFightCutscene() {
this(null);
}
@ -63,6 +98,7 @@ public class LTRDragonFightCutscene extends CutscenePlugin {
@Override
public void open() {
ZoneBuilder.configure(CellarMapZone.get());
setNpcs();
GameWorld.submit(fightPulse);
player.lock();
@ -71,7 +107,6 @@ public class LTRDragonFightCutscene extends CutscenePlugin {
}
public final class FightPulse extends Pulse {
/**
@ -91,6 +126,12 @@ public class LTRDragonFightCutscene extends CutscenePlugin {
switch (counter++) {
case 1:
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;
case 4:
@ -104,13 +145,108 @@ public class LTRDragonFightCutscene extends CutscenePlugin {
break;
case 13:
camera(32, 10, -3, 5, 450, 100);
camera(32, 10, -4, 5, 450, 100);
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");
LTRDragonFightCutscene.this.stop(true);
TutorialStage.load(player, 3, false);
CellarMapZone.get().create(player);
return true;
case 61:
break;
}
return !player.isActive();
}
@ -171,6 +307,7 @@ public class LTRDragonFightCutscene extends CutscenePlugin {
public void stop(boolean fade) {
super.stop(false);
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;
}
private void walk(NPC npc, final Location location) {
Pathfinder.find(npc, location, true, Pathfinder.DUMB).walk(npc);
}
public NPC getDragon() {
return getNpc(7943);
}
public NPC getSirVant() {
return getNpc(7938);
}
public NPC getGoblin() {
return getNpc(7964);
}
}

View file

@ -1,9 +1,12 @@
package plugin.quest.learningtheropes;
import org.crandor.game.container.impl.EquipmentContainer;
import org.crandor.game.content.dialogue.DialoguePlugin;
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.node.entity.player.Player;
import org.crandor.game.node.item.Item;
import org.crandor.plugin.InitializablePlugin;
/**
@ -13,6 +16,7 @@ import org.crandor.plugin.InitializablePlugin;
@InitializablePlugin
public class SirVantDialogue extends DialoguePlugin {
/**
* Default Constructor
*/
@ -33,8 +37,23 @@ public class SirVantDialogue extends DialoguePlugin {
@Override
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.");
setStage(1);
int tut_stage = TutorialSession.getExtension(player).getStage();
System.out.println("tut_stage = " + tut_stage);
switch (tut_stage) {
case 0:
case 1:
case 2:
case 72:
npc(FacialExpression.HAPPY, "My Word! You scared me there, friend. I have no idea", "where you came from, but you have fantastic timing.", "You see, I have come across a dragon.");
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;
}
@ -69,6 +88,34 @@ public class SirVantDialogue extends DialoguePlugin {
end();
TutorialStage.load(player, 2, false);
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;
}

View file

@ -64,9 +64,11 @@ public final class BuildOptionPlugin extends OptionHandler {
Hotspot hotspot = player.getHouseManager().getHotspot(object);
if (hotspot == null || !isBuildable(player, object, hotspot)) {
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;
}
System.out.println(object + " chunkX = " + object.getCenterLocation().getChunkX() + ", chunkY = " + object.getCenterLocation().getChunkY());
player.setAttribute("con:hotspot", hotspot);
BuildingUtils.openBuildInterface(player, hotspot.getHotspot());
return true;

View file

@ -21,7 +21,7 @@ import org.crandor.plugin.Plugin;
public final class ConstructionInterface extends ComponentPlugin {
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
public Plugin<Object> newInstance(Object arg) {
ComponentDefinition.put(396, this);
ComponentDefinition.put(398, this);
ComponentDefinition.put(402, this);
@ -31,85 +31,85 @@ public final class ConstructionInterface extends ComponentPlugin {
@Override
public boolean handle(Player player, Component component, int opcode, int button, int slot, int itemId) {
switch (component.getId()) {
case 396:
switch (button) {
case 11:
player.getInterfaceManager().close();
Hotspot hotspot = player.getAttribute("con:hotspot");
GameObject object = player.getAttribute("con:hsobject");
if (hotspot == null || object == null) {
System.err.println("Failed building decoration " + hotspot + " : " + object);
break;
}
slot = ((slot % 2 != 0) ? 4 : 0) + (slot >> 1);
if (slot >= hotspot.getHotspot().getDecorations().length) {
System.err.println("Failed building decoration " + slot + "/" + hotspot.getHotspot().getDecorations().length);
break;
}
boolean debug = player.isStaff();
Decoration deco = hotspot.getHotspot().getDecorations()[slot];
if (!debug) {
if (player.getSkills().getLevel(Skills.CONSTRUCTION) < deco.getLevel()) {
player.getPacketDispatch().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.");
case 396:
switch (button) {
case 132:
player.getInterfaceManager().close();
Hotspot hotspot = player.getAttribute("con:hotspot");
GameObject object = player.getAttribute("con:hsobject");
if (hotspot == null || object == null) {
System.err.println("Failed building decoration " + hotspot + " : " + object);
break;
}
slot = ((slot % 2 != 0) ? 4 : 0) + (slot >> 1);
if (slot >= hotspot.getHotspot().getDecorations().length) {
System.err.println("Failed building decoration " + slot + "/" + hotspot.getHotspot().getDecorations().length);
break;
}
boolean debug = player.isStaff();
Decoration deco = hotspot.getHotspot().getDecorations()[slot];
if (!debug) {
if (player.getSkills().getLevel(Skills.CONSTRUCTION) < deco.getLevel()) {
player.sendMessage("You need to have a Construction level of " + deco.getLevel() + " to build that.");
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)) {
player.getPacketDispatch().sendMessage("You need a " + ItemDefinition.forId(tool).getName() + " to build this.");
BuildingUtils.buildDecoration(player, hotspot, deco, object);
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;
}
}
HouseManager.leave(player);
return true;
}
BuildingUtils.buildDecoration(player, hotspot, deco, object);
return true;
}
break;
case 398:
switch (button) {
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.");
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;
}
HouseManager.leave(player);
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;
break;
}
return false;
}

View file

@ -15,304 +15,360 @@ import org.crandor.plugin.InitializablePlugin;
/**
* Represents the estate agent dialogue.
*
* @author 'Vexia
* @version 1.0
*/
@InitializablePlugin
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}.
*/
public EstateAgentDialogue() {
/**
* empty.
*/
}
/**
* Represents the book item.
*/
private static final Item BOOK = new Item(8463, 1);
/**
* Constructs a new {@code EstateAgentDialogue} {@code Object}.
* @param player the player.
*/
public EstateAgentDialogue(Player player) {
super(player);
}
@Override
public DialoguePlugin newInstance(Player player) {
return new EstateAgentDialogue(player);
}
/**
* Constructs a new {@code EstateAgentDialogue} {@code Object}.
*/
public EstateAgentDialogue() {
/**
* empty.
*/
}
@Override
public boolean open(Object... args) {
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;
}
/**
* Constructs a new {@code EstateAgentDialogue} {@code Object}.
*
* @param player the player.
*/
public EstateAgentDialogue(Player player) {
super(player);
}
@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:
//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
public DialoguePlugin newInstance(Player player) {
return new EstateAgentDialogue(player);
}
@Override
public int[] getIds() {
return new int[] { 4247 };
}
@Override
public boolean open(Object... args) {
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};
}
}

View file

@ -8,8 +8,7 @@ import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.object.GameObject;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.plugin.Plugin;
import java.util.Calendar;
import org.joda.time.DateTime;
/**
* ClockPlugin.java
@ -30,8 +29,8 @@ public class ClockPlugin extends OptionHandler {
@Override
public boolean handle(Player player, Node node, String option) {
GameObject object = node.asObject();
Calendar now = Calendar.getInstance();
int minuteDisplay = ((int) (now.get(Calendar.MINUTE) / 5)) * 5;
DateTime now = new DateTime();
int minuteDisplay = ((int) (now.getMinuteOfHour() / 5)) * 5;
StringBuilder sb = new StringBuilder("It's ");
if (minuteDisplay == 0) {
sb.append("Rune o'clock.");

View file

@ -121,7 +121,7 @@ public final class FarmHolderPlugin implements Plugin<Object> {
final FarmingItemHolder holder = FarmingItemHolder.forHolder(item);
switch (option) {
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);
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.");

View file

@ -55,7 +55,7 @@ public final class GrandExchangeZone extends MapZone implements Plugin<Object> {
@Override
public void configure() {
addObjects();
// addObjects();
PluginManager.definePlugin(new TeleporterDialogue(), new GnomeTravellerPlugin(), new RewardTraderDialogue());
ShopSQLHandler.getUidShops().put(1485756, CREDIT_STORE);
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);
break;
case 2:
if (player.getSavedData().getGlobalData().getGlobalTeleporterDelay() > System.currentTimeMillis()) {
/*if (player.getSavedData().getGlobalData().getGlobalTeleporterDelay() > System.currentTimeMillis()) {
long millis = player.getSavedData().getGlobalData().getGlobalTeleporterDelay() - System.currentTimeMillis();
int minutes = (int) TimeUnit.MILLISECONDS.toMinutes(millis);
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.");
stage = -10;
return true;
}
}*/
player.removeAttribute("global_teleporter");
String[] options = new String[TELEPORTS.length];
for (int i = 0; i < TELEPORTS.length; i++) {