mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-10 10:20:41 -07:00
Converted all item on item plugins to listeners
This commit is contained in:
parent
db20e878f4
commit
4a0dfed172
34 changed files with 664 additions and 2402 deletions
|
|
@ -1,69 +0,0 @@
|
|||
package core.game.content.dialogue;
|
||||
|
||||
import core.plugin.Initializable;
|
||||
import core.game.node.entity.player.Player;
|
||||
|
||||
/**
|
||||
* @author 'Vexia
|
||||
*/
|
||||
@Initializable
|
||||
public class SkullSceptreDialogue extends DialoguePlugin {
|
||||
|
||||
public SkullSceptreDialogue() {
|
||||
|
||||
}
|
||||
|
||||
public SkullSceptreDialogue(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { 78489 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
end();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new SkullSceptreDialogue(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
interpreter.sendItemMessage(9009, "The two halves of the skull fit perfectly.");
|
||||
if (args.length == 1) {
|
||||
interpreter.sendItemMessage(9012, "The two halves of the sceptre fit perfectly.");// The
|
||||
// Sceptre", "appears
|
||||
// to
|
||||
// be
|
||||
// designed
|
||||
// to
|
||||
// have
|
||||
// something
|
||||
// on
|
||||
// top.");
|
||||
return true;
|
||||
}
|
||||
if (args.length == 2) {
|
||||
interpreter.sendItemMessage(9013, "The skull fits perfectly atop the Sceptre.");// The
|
||||
// Sceptre", "appears
|
||||
// to
|
||||
// be
|
||||
// designed
|
||||
// to
|
||||
// have
|
||||
// something
|
||||
// on
|
||||
// top.");
|
||||
return true;
|
||||
}
|
||||
stage = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,165 +0,0 @@
|
|||
/*
|
||||
package core.game.interaction.item.withitem;
|
||||
|
||||
import org.rs09.consts.Items;
|
||||
import core.game.content.global.Dyes;
|
||||
import core.game.content.global.action.SpecialLadders;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.map.Location;
|
||||
import core.plugin.InitializablePlugin;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Handles the dyeing of a cape.
|
||||
* @author afaroutdude
|
||||
*//*
|
||||
|
||||
@InitializablePlugin
|
||||
public final class CapeDyeingPlugin extends UseWithHandler {
|
||||
|
||||
*/
|
||||
/**
|
||||
* Constructs a new {@code CapeDyeingPlugin} {@code Object}.
|
||||
*//*
|
||||
|
||||
public CapeDyeingPlugin() {
|
||||
super(Cape.getIds());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
for (Cape c : Cape.values()) {
|
||||
addHandler(c.getDye().getItem().getId(), ITEM_TYPE, this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
final boolean testCape = Cape.isCape(event.getBaseItem());
|
||||
final Item cape = Cape.isCape(event.getBaseItem()) ? event.getBaseItem() : event.getUsedItem();
|
||||
final Item dye = Cape.isCape(event.getBaseItem()) ? event.getUsedItem() : event.getBaseItem();
|
||||
final Item dyedCape = MAP_DYE_TO_CAPE.get(dye);
|
||||
if (dyedCape == null) {
|
||||
return false;
|
||||
}
|
||||
if (!cape.equals(dyedCape) && player.getInventory().containsItems(dye, cape) && player.getInventory().remove(dye, cape)) {
|
||||
player.getInventory().add(dyedCape);
|
||||
if (dye.equals(Dyes.BLACK.getItem())) {
|
||||
player.getInventory().add(new Item(Items.VIAL_229));
|
||||
}
|
||||
if (dye.equals(Dyes.PINK.getItem()) && !player.getAchievementDiaryManager().getDiary(DiaryType.FALADOR).isComplete(2,5)) {
|
||||
player.getAchievementDiaryManager().getDiary(DiaryType.FALADOR).updateTask(player,2,5,true);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* A cape to dye.
|
||||
* @author Vexia
|
||||
*//*
|
||||
|
||||
public enum Cape {
|
||||
BLACK(Dyes.BLACK, new Item(1019)),
|
||||
RED(Dyes.RED, new Item(1007)),
|
||||
BLUE(Dyes.BLUE, new Item(1021)),
|
||||
YELLOW(Dyes.YELLOW, new Item(1023)),
|
||||
GREEN(Dyes.GREEN, new Item(1027)),
|
||||
PURPLE(Dyes.PURPLE, new Item(1029)),
|
||||
ORANGE(Dyes.ORANGE, new Item(1031)),
|
||||
PINK(Dyes.PINK, new Item(6959));
|
||||
|
||||
*/
|
||||
/**
|
||||
* The dye for the cape.
|
||||
*//*
|
||||
|
||||
private final Dyes dye;
|
||||
|
||||
*/
|
||||
/**
|
||||
* The cape item.
|
||||
*//*
|
||||
|
||||
private final Item cape;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Constructs a new {@code Cape} {@code Object}.
|
||||
* @param dye the dye.
|
||||
* @param cape the cape.
|
||||
*//*
|
||||
|
||||
Cape(Dyes dye, Item cape) {
|
||||
this.dye = dye;
|
||||
this.cape = cape;
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* Gets the dye.
|
||||
* @return The dye.
|
||||
*//*
|
||||
|
||||
public Dyes getDye() {
|
||||
return dye;
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* Gets the cape.
|
||||
* @return The cape.
|
||||
*//*
|
||||
|
||||
public Item getCape() {
|
||||
return cape;
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* @return an int array of all cape IDs
|
||||
*//*
|
||||
|
||||
static public int[] getIds() {
|
||||
return Stream.of(Cape.values())
|
||||
.map(Cape::getCape)
|
||||
.map(Item::getId)
|
||||
.mapToInt(Integer::intValue).toArray();
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* @param potentiallyCape
|
||||
* @return true if passed item is a cape that we can handle
|
||||
*//*
|
||||
|
||||
static public boolean isCape(Item potentiallyCape){
|
||||
for (Cape c : Cape.values()) {
|
||||
if (c.getCape().getId() == potentiallyCape.getId()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static HashMap<Item, Item> MAP_DYE_TO_CAPE = new HashMap<>();
|
||||
static {
|
||||
for (Cape c : Cape.values()) {
|
||||
MAP_DYE_TO_CAPE.putIfAbsent(c.getDye().getItem(), c.getCape());
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
|
@ -1,56 +0,0 @@
|
|||
package core.game.interaction.item.withitem;
|
||||
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.game.node.scenery.SceneryBuilder;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the plugin used to handle the usage of a chest key on the chest.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class ChestKeyPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Represents the chest key item.
|
||||
*/
|
||||
private static final Item CHEST_KEY = new Item(432);
|
||||
|
||||
/**
|
||||
* Represents the pirate message item.
|
||||
*/
|
||||
private static final Item PIRATE_MESSAGE = new Item(433);
|
||||
|
||||
/**
|
||||
* Constructs a new {@code ChestKeyPlugin} {@code Object}.
|
||||
*/
|
||||
public ChestKeyPlugin() {
|
||||
super(432);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(2079, OBJECT_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
if (player.getInventory().remove(CHEST_KEY)) {
|
||||
SceneryBuilder.replace((Scenery) event.getUsedWith(), ((Scenery) event.getUsedWith()).transform(2080), 3);
|
||||
player.getInventory().add(PIRATE_MESSAGE);
|
||||
player.getPacketDispatch().sendMessage("You unlock the chest.");
|
||||
player.getPacketDispatch().sendMessage("All that's in the chest is a message...");
|
||||
player.getPacketDispatch().sendMessage("You take the message from the chest.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
package core.game.interaction.item.withitem;
|
||||
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the plugin used to handle the creation of a crystal key.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class CrystalKeyCreatePlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Represents the crystal key item.
|
||||
*/
|
||||
private static final Item KEY = new Item(989, 1);
|
||||
|
||||
/**
|
||||
* Constructs a new {@code CrystalKeyCreatePlugin} {@code Object}.
|
||||
*/
|
||||
public CrystalKeyCreatePlugin() {
|
||||
super(985);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
if (player.getInventory().remove(event.getBaseItem(), event.getUsedItem())) {
|
||||
player.getInventory().add(KEY);
|
||||
player.getPacketDispatch().sendMessage("You join the loop half of a key and the tooth half of a key to make a crystal key.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(987, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
package core.game.interaction.item.withitem;
|
||||
import core.game.content.dialogue.DialogueAction;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Plugin;
|
||||
import core.plugin.Initializable;
|
||||
import rs09.plugin.PluginManager;
|
||||
|
||||
/**
|
||||
* The plugin used to dye a dark bow into a more <fashionable> one.
|
||||
* @author Splinter
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class DarkBowDyePlugin extends UseWithHandler {
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new {@code DarkBowDyePlugin} {@code Object}.
|
||||
*/
|
||||
public DarkBowDyePlugin() {
|
||||
super(11235);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(14795, ITEM_TYPE, this);
|
||||
addHandler(14797, ITEM_TYPE, this);
|
||||
addHandler(14799, ITEM_TYPE, this);
|
||||
addHandler(14801, ITEM_TYPE, this);
|
||||
PluginManager.definePlugin(new DarkBowCleanPlugin());
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(final NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
player.getDialogueInterpreter().sendOptions("Apply "+event.getUsedItem().getName().replace("dark bow paint", "paint?").toLowerCase(), "Yes", "No");
|
||||
player.getDialogueInterpreter().addAction(new DialogueAction() {
|
||||
|
||||
@Override
|
||||
public void handle(Player player, int buttonId) {
|
||||
switch (buttonId) {
|
||||
case 2:
|
||||
if (player.getInventory().remove(event.getBaseItem()) && player.getInventory().remove(event.getUsedItem())) {
|
||||
player.getInventory().add(getResult(event.getUsedItem().getId()));
|
||||
player.sendMessage("You dye the bow into a more fashionable version.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the resulting colored dark bow.
|
||||
* @return the item
|
||||
*/
|
||||
private Item getResult(int dyeId){
|
||||
switch(dyeId){
|
||||
case 14797:
|
||||
return new Item(14803, 1);
|
||||
case 14795:
|
||||
return new Item(14804, 1);
|
||||
case 14799:
|
||||
return new Item(14805, 1);
|
||||
case 14801:
|
||||
return new Item(14806, 1);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Cleans the dark bow and removes the paint.
|
||||
* @author Andrew
|
||||
*/
|
||||
public final class DarkBowCleanPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code DarkBowCleanPlugin} {@code Object}.
|
||||
*/
|
||||
public DarkBowCleanPlugin() {
|
||||
super(3188);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(14803, ITEM_TYPE, this);
|
||||
addHandler(14804, ITEM_TYPE, this);
|
||||
addHandler(14805, ITEM_TYPE, this);
|
||||
addHandler(14806, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(final NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
player.getDialogueInterpreter().sendOptions("Wipe the paint off?", "Yes", "No");
|
||||
player.getDialogueInterpreter().addAction(new DialogueAction() {
|
||||
|
||||
@Override
|
||||
public void handle(Player player, int buttonId) {
|
||||
switch (buttonId) {
|
||||
case 2:
|
||||
if (player.getInventory().remove(event.getBaseItem()) && player.getInventory().remove(event.getUsedItem())) {
|
||||
player.getInventory().add(new Item(11235, 1));
|
||||
player.sendMessage("You wipe the paint off with the cleaning cloth, then toss it away.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
package core.game.interaction.item.withitem;
|
||||
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the plugin used to turn regular logs into a different colour.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public class FirelighterPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Represents the logs item.
|
||||
*/
|
||||
private static final Item LOGS = new Item(1511);
|
||||
|
||||
/**
|
||||
* Constructs a new {@code FirelighterPlugin} {@code Object}.
|
||||
*/
|
||||
public FirelighterPlugin() {
|
||||
super(1511);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
for (FireLighter lighter : FireLighter.values()) {
|
||||
addHandler(lighter.getLighter().getId(), ITEM_TYPE, this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
final FireLighter lighter = FireLighter.forLighter(event.getUsedItem().getId() == 1511 ? event.getBaseItem() : event.getUsedItem());
|
||||
if (player.getInventory().remove(lighter.getLighter(), LOGS)) {
|
||||
player.getInventory().add(lighter.getLog());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a fire lighter.
|
||||
* @author 'Vexia
|
||||
* @date 28/12/2013
|
||||
*/
|
||||
public enum FireLighter {
|
||||
RED(new Item(7329), new Item(7404)), GREEN(new Item(7330), new Item(7405)), BLUE(new Item(7331), new Item(7406)), PURPLE(new Item(10326), new Item(10329)), WHITE(new Item(10327), new Item(10328));
|
||||
|
||||
/**
|
||||
* Represents the fire lighter.
|
||||
*/
|
||||
private final Item lighter;
|
||||
|
||||
/**
|
||||
* Represents the log to turn into.
|
||||
*/
|
||||
private final Item log;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code FirelighterPlugin.java} {@code Object}.
|
||||
* @param lighter the lighter.
|
||||
* @param log the log.
|
||||
*/
|
||||
FireLighter(Item lighter, Item log) {
|
||||
this.lighter = lighter;
|
||||
this.log = log;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the lighter.
|
||||
* @return The lighter.
|
||||
*/
|
||||
public Item getLighter() {
|
||||
return lighter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the log.
|
||||
* @return The log.
|
||||
*/
|
||||
public Item getLog() {
|
||||
return log;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the fire lighter from the lighter used.
|
||||
* @return the fire lighter data.
|
||||
*/
|
||||
public static FireLighter forLighter(final Item item) {
|
||||
for (FireLighter lighter : values()) {
|
||||
if (lighter.getLighter().getId() == item.getId()) {
|
||||
return lighter;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,150 @@
|
|||
package core.game.interaction.item.withitem;
|
||||
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.component.Component;
|
||||
import core.plugin.Initializable;
|
||||
import kotlin.Unit;
|
||||
import org.rs09.consts.Items;
|
||||
import core.game.content.dialogue.DialoguePlugin;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.RunScript;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.plugin.Plugin;
|
||||
import rs09.game.interaction.item.withitem.FruitSlicing;
|
||||
|
||||
/**
|
||||
* Represents the fruit cutting plugin.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class FruitCuttingDialogue extends DialoguePlugin {
|
||||
|
||||
/**
|
||||
* Represents the component interface.
|
||||
*/
|
||||
private static final Component COMPONENT = new Component(140);
|
||||
|
||||
/**
|
||||
* Represents the fruit.
|
||||
*/
|
||||
private FruitSlicing.Fruit fruit;
|
||||
|
||||
/**
|
||||
* Represents the fruit to cut.
|
||||
*/
|
||||
private Item item;
|
||||
|
||||
/**
|
||||
* Represents if its a sliced cut.
|
||||
*/
|
||||
private boolean slice;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code FruitCuttingDialogue} {@code Object}.
|
||||
*/
|
||||
public FruitCuttingDialogue() {
|
||||
/**
|
||||
* empty.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code FruitCuttingDialogue} {@code Object}.
|
||||
* @param player the player.
|
||||
*/
|
||||
public FruitCuttingDialogue(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new FruitCuttingDialogue(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
fruit = ((FruitSlicing.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);
|
||||
player.getPacketDispatch().sendString("Slice the " + fruit.getBase().getName().toLowerCase() + ".", 140, 2);
|
||||
player.getPacketDispatch().sendString("Dice the " + fruit.getBase().getName().toLowerCase() + ".", 140, 3);
|
||||
player.getInterfaceManager().openChatbox(COMPONENT);
|
||||
stage = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
switch (stage) {
|
||||
case 0:
|
||||
player.getInterfaceManager().openChatbox(309);
|
||||
player.getPacketDispatch().sendItemZoomOnInterface(1, 160, 309, 2);
|
||||
slice = buttonId == 2 ? false : true;
|
||||
item = buttonId == 2 ? fruit.getDiced() : fruit.getSliced();
|
||||
player.getPacketDispatch().sendString("<br><br><br><br>" + item.getName(), 309, 6);
|
||||
player.getPacketDispatch().sendItemZoomOnInterface(item.getId(), 175, 309, 2);
|
||||
stage = 1;
|
||||
break;
|
||||
case 1:
|
||||
int amount = 0;
|
||||
switch (buttonId) {
|
||||
case 6:
|
||||
amount = 1;
|
||||
break;
|
||||
case 5:
|
||||
amount = 5;
|
||||
break;
|
||||
case 4:
|
||||
sendInputDialogue(player, false, "Enter the amount:", (value) -> {
|
||||
String s = value.toString();
|
||||
s = s.replace("k","000");
|
||||
s = s.replace("K","000");
|
||||
int val = Integer.parseInt(s);
|
||||
cut(player, val, slice);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
return true;
|
||||
case 3:
|
||||
amount = player.getInventory().getAmount(fruit.getBase());
|
||||
break;
|
||||
}
|
||||
cut(player, amount, slice);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { 31237434 };
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to cut a fruit.
|
||||
* @param player the player.
|
||||
* @param amount the amount.
|
||||
* @param slice if its sliced.
|
||||
*/
|
||||
private final void cut(final Player player, int amount, boolean slice) {
|
||||
if (amount > player.getInventory().getAmount(fruit.getBase())) {
|
||||
amount = player.getInventory().getAmount(fruit.getBase());
|
||||
}
|
||||
end();
|
||||
final Item remove = new Item(fruit.getBase().getId(), amount);
|
||||
if (!player.getInventory().containsItem(remove)) {
|
||||
return;
|
||||
}
|
||||
if (player.getInventory().remove(remove)) {
|
||||
player.getPacketDispatch().sendMessage("You cut the " + fruit.name().toLowerCase() + " into " + (slice ? fruit == FruitSlicing.Fruit.PINEAPPLE ? "rings" : "slices" : "chunks") + ".");
|
||||
for (int i = 0; i < amount; i++) {
|
||||
player.getInventory().add(slice ? fruit.getSliced() : fruit.getDiced());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,273 +0,0 @@
|
|||
package core.game.interaction.item.withitem;
|
||||
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.component.Component;
|
||||
import core.plugin.Initializable;
|
||||
import kotlin.Unit;
|
||||
import org.rs09.consts.Items;
|
||||
import core.game.content.dialogue.DialoguePlugin;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.RunScript;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the fruit cutting plugin.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class FruitCuttingPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Represents the cutting banana animation.
|
||||
*/
|
||||
private static final Animation ANIMATION = new Animation(1192);
|
||||
|
||||
/**
|
||||
* Constructs a new {@code FruitCuttingPlugin} {@code Object}.
|
||||
*/
|
||||
public FruitCuttingPlugin() {
|
||||
super(946);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
for (Fruit fruit : Fruit.values()) {
|
||||
addHandler(fruit.getBase().getId(), ITEM_TYPE, this);
|
||||
}
|
||||
new FruitCuttingDialogue().init();
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
final Fruit fruit = Fruit.forBase(event.getUsedItem());
|
||||
if (fruit == Fruit.BANANA || fruit == Fruit.LEMON) {
|
||||
if (player.getInventory().remove(fruit.getBase())) {
|
||||
player.lock(2);
|
||||
player.animate(ANIMATION);
|
||||
player.getInventory().add(fruit.getSliced());
|
||||
player.getPacketDispatch().sendMessage("You deftly chop the "+ fruit.name().toLowerCase() + " into slices.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
player.getDialogueInterpreter().open(31237434, fruit);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the a fruit to cut.
|
||||
* @author 'Vexia
|
||||
* @date 30/11/2013
|
||||
*/
|
||||
public enum Fruit {
|
||||
PINEAPPLE(new Item(2114), new Item(2116), new Item(2118, 4)),
|
||||
BANANA(new Item(1963), null, new Item(3162)),
|
||||
LEMON(new Item(2102), new Item(Items.LEMON_CHUNKS_2104), new Item(2106)),
|
||||
LIME(new Item(Items.LIME_2120),new Item(Items.LIME_CHUNKS_2122), new Item(Items.LIME_SLICES_2124)),
|
||||
ORANGE(new Item(2108), new Item(2110), new Item(2112));
|
||||
|
||||
/**
|
||||
* Constructs a new {@code FruitCuttingPlugin.java} {@code Object}.
|
||||
* @param base the base item.
|
||||
* @param diced the diced item.
|
||||
* @param sliced the sliced item.
|
||||
*/
|
||||
Fruit(Item base, Item diced, Item sliced) {
|
||||
this.base = base;
|
||||
this.diced = diced;
|
||||
this.sliced = sliced;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the base item.
|
||||
*/
|
||||
private final Item base;
|
||||
|
||||
/**
|
||||
* Represents the diced item.
|
||||
*/
|
||||
private final Item diced;
|
||||
|
||||
/**
|
||||
* Represents the sliced item.
|
||||
*/
|
||||
private final Item sliced;
|
||||
|
||||
/**
|
||||
* Gets the base.
|
||||
* @return The base.
|
||||
*/
|
||||
public Item getBase() {
|
||||
return base;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the diced.
|
||||
* @return The diced.
|
||||
*/
|
||||
public Item getDiced() {
|
||||
return diced;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the sliced.
|
||||
* @return The sliced.
|
||||
*/
|
||||
public Item getSliced() {
|
||||
return sliced;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to get the fruit for the base item.
|
||||
* @param item the item.
|
||||
* @return the fruit.
|
||||
*/
|
||||
public static Fruit forBase(final Item item) {
|
||||
for (Fruit fruit : values()) {
|
||||
if (fruit.getBase().getId() == item.getId()) {
|
||||
return fruit;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the dialogue plugin used to cut fruit.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
public static final class FruitCuttingDialogue extends DialoguePlugin {
|
||||
|
||||
/**
|
||||
* Represents the component interface.
|
||||
*/
|
||||
private static final Component COMPONENT = new Component(140);
|
||||
|
||||
/**
|
||||
* Represents the fruit.
|
||||
*/
|
||||
private Fruit fruit;
|
||||
|
||||
/**
|
||||
* Represents the fruit to cut.
|
||||
*/
|
||||
private Item item;
|
||||
|
||||
/**
|
||||
* Represents if its a sliced cut.
|
||||
*/
|
||||
private boolean slice;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code FruitCuttingDialogue} {@code Object}.
|
||||
*/
|
||||
public FruitCuttingDialogue() {
|
||||
/**
|
||||
* empty.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code FruitCuttingDialogue} {@code Object}.
|
||||
* @param player the player.
|
||||
*/
|
||||
public FruitCuttingDialogue(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new FruitCuttingDialogue(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
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);
|
||||
player.getPacketDispatch().sendString("Slice the " + fruit.getBase().getName().toLowerCase() + ".", 140, 2);
|
||||
player.getPacketDispatch().sendString("Dice the " + fruit.getBase().getName().toLowerCase() + ".", 140, 3);
|
||||
player.getInterfaceManager().openChatbox(COMPONENT);
|
||||
stage = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
switch (stage) {
|
||||
case 0:
|
||||
player.getInterfaceManager().openChatbox(309);
|
||||
player.getPacketDispatch().sendItemZoomOnInterface(1, 160, 309, 2);
|
||||
slice = buttonId == 2 ? false : true;
|
||||
item = buttonId == 2 ? fruit.getDiced() : fruit.getSliced();
|
||||
player.getPacketDispatch().sendString("<br><br><br><br>" + item.getName(), 309, 6);
|
||||
player.getPacketDispatch().sendItemZoomOnInterface(item.getId(), 175, 309, 2);
|
||||
stage = 1;
|
||||
break;
|
||||
case 1:
|
||||
int amount = 0;
|
||||
switch (buttonId) {
|
||||
case 6:
|
||||
amount = 1;
|
||||
break;
|
||||
case 5:
|
||||
amount = 5;
|
||||
break;
|
||||
case 4:
|
||||
sendInputDialogue(player, false, "Enter the amount:", (value) -> {
|
||||
String s = value.toString();
|
||||
s = s.replace("k","000");
|
||||
s = s.replace("K","000");
|
||||
int val = Integer.parseInt(s);
|
||||
cut(player, val, slice);
|
||||
return Unit.INSTANCE;
|
||||
});
|
||||
return true;
|
||||
case 3:
|
||||
amount = player.getInventory().getAmount(fruit.getBase());
|
||||
break;
|
||||
}
|
||||
cut(player, amount, slice);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { 31237434 };
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to cut a fruit.
|
||||
* @param player the player.
|
||||
* @param amount the amount.
|
||||
* @param slice if its sliced.
|
||||
*/
|
||||
private final void cut(final Player player, int amount, boolean slice) {
|
||||
if (amount > player.getInventory().getAmount(fruit.getBase())) {
|
||||
amount = player.getInventory().getAmount(fruit.getBase());
|
||||
}
|
||||
end();
|
||||
final Item remove = new Item(fruit.getBase().getId(), amount);
|
||||
if (!player.getInventory().containsItem(remove)) {
|
||||
return;
|
||||
}
|
||||
if (player.getInventory().remove(remove)) {
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
package core.game.interaction.item.withitem;
|
||||
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Plugin;
|
||||
import core.plugin.Initializable;
|
||||
import core.tools.StringUtils;
|
||||
|
||||
/**
|
||||
* Handles the attaching of a hilt on the godsword blade.
|
||||
* @author Emperor
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class GodswordHiltAttachPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code GodswordHiltAttachPlugin} {@code Object}.
|
||||
*/
|
||||
public GodswordHiltAttachPlugin() {
|
||||
super(11702, 11704, 11706, 11708);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
Item item = event.getUsedItem();
|
||||
if (item == null)
|
||||
return false;
|
||||
Item baseItem = event.getBaseItem();
|
||||
Player player = event.getPlayer();
|
||||
if (!player.getInventory().containsItem(item) || !player.getInventory().containsItem(baseItem)) {
|
||||
return false;
|
||||
}
|
||||
if (player.getInventory().replace(null, item.getSlot(), false) != item || player.getInventory().replace(null, baseItem.getSlot(), false) != baseItem) {
|
||||
player.getInventory().update();
|
||||
return false;
|
||||
}
|
||||
item = new Item(item.getId() - 8);
|
||||
player.getInventory().add(item);
|
||||
String name = item.getDefinition().getName();
|
||||
player.getPacketDispatch().sendMessage("You attach the hilt to the blade and make a" + (StringUtils.isPlusN(name) ? "n " : " ") + name + ".");
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
// In case of item-on-item: register the lowest item id - in this case
|
||||
// godsword blade)
|
||||
// (eg. if one item is 1521 and the other is 842 -> 842 should be
|
||||
// registered)
|
||||
addHandler(11690, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,100 +0,0 @@
|
|||
package core.game.interaction.item.withitem;
|
||||
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.content.dialogue.DialogueAction;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Plugin;
|
||||
import rs09.plugin.PluginManager;
|
||||
|
||||
/**
|
||||
* The plugin used to make the granite maul into the ornamental version.
|
||||
* @author Splinter
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class GraniteMaulPlugin extends UseWithHandler {
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new {@code GraniteMaulPlugin} {@code Object}.
|
||||
*/
|
||||
public GraniteMaulPlugin() {
|
||||
super(4153);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
PluginManager.definePlugin(new GraniteMaulRevertHandler());
|
||||
addHandler(14793, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(final NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
player.getDialogueInterpreter().sendOptions("Attach the clamp?", "Yes", "No");
|
||||
player.getDialogueInterpreter().addAction(new DialogueAction() {
|
||||
|
||||
@Override
|
||||
public void handle(Player player, int buttonId) {
|
||||
switch (buttonId) {
|
||||
case 2:
|
||||
if (player.getInventory().remove(event.getBaseItem()) && player.getInventory().remove(event.getUsedItem())) {
|
||||
player.getInventory().add(new Item(14792, 1));
|
||||
player.sendMessage("You attach the clamp to the granite maul, making it slightly more fashionable.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the removal of the ornamental kit.
|
||||
* @author Splinter
|
||||
*/
|
||||
public final class GraniteMaulRevertHandler extends OptionHandler {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
ItemDefinition.forId(14792).getHandlers().put("option:revert", this);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
final Item item = (Item) node;
|
||||
player.getDialogueInterpreter().sendOptions("Remove the clamp?", "Yes", "No");
|
||||
player.getDialogueInterpreter().addAction(new DialogueAction() {
|
||||
|
||||
@Override
|
||||
public void handle(Player player, int buttonId) {
|
||||
switch (buttonId) {
|
||||
case 2:
|
||||
if(player.getInventory().remove(item)){
|
||||
player.getInventory().add(new Item(4153, 1));
|
||||
player.sendMessage("You remove the clamp from your maul, and in the process, it is destroyed.");
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isWalk() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,64 +0,0 @@
|
|||
package core.game.interaction.item.withitem;
|
||||
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Used to handle the reward of splitting granite with a chisel in to smaller
|
||||
* pieces.
|
||||
* @author Splinter
|
||||
*/
|
||||
@Initializable
|
||||
public class GraniteSplittingPlugin extends UseWithHandler {
|
||||
|
||||
public GraniteSplittingPlugin() {
|
||||
super(1755);
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the 5kg granite
|
||||
*/
|
||||
private static final Item FIVE_KG = new Item(6983, 1);
|
||||
|
||||
/**
|
||||
* Represents the 2kg granite
|
||||
*/
|
||||
private static final Item TWO_KG = new Item(6981, 1);
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
if (event.getUsedItem().getId() == 6981) {
|
||||
if (event.getPlayer().getInventory().freeSlots() < 4) {
|
||||
event.getPlayer().getPacketDispatch().sendMessage("You need four inventory slots to split this.");
|
||||
} else {
|
||||
if (event.getPlayer().getInventory().remove(TWO_KG)) {
|
||||
event.getPlayer().getInventory().add(new Item(6979, 4));
|
||||
event.getPlayer().getPacketDispatch().sendMessage("You chisel the 2kg granite into four smaller pieces.");
|
||||
}
|
||||
}
|
||||
}
|
||||
if (event.getUsedItem().getId() == 6983) {
|
||||
if (event.getPlayer().getInventory().freeSlots() < 4) {
|
||||
event.getPlayer().getPacketDispatch().sendMessage("You need four inventory slots to split this.");
|
||||
} else {
|
||||
if (event.getPlayer().getInventory().remove(FIVE_KG)) {
|
||||
event.getPlayer().getInventory().add(new Item(6981, 2));
|
||||
event.getPlayer().getInventory().add(new Item(6979, 2));
|
||||
event.getPlayer().getPacketDispatch().sendMessage("You chisel the 5kg granite into four smaller pieces.");
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(6981, ITEM_TYPE, this);
|
||||
addHandler(6983, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,161 +0,0 @@
|
|||
package core.game.interaction.item.withitem;
|
||||
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Handles the creating of an imp jar.
|
||||
* @author Vexia
|
||||
*/
|
||||
@Initializable
|
||||
public final class ImpJarCreatePlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* The flower ids.
|
||||
*/
|
||||
private static final int[] FLOWERS = new int[] { 2460, 2461, 2462, 2463, 2464, 2465, 2466, 2467, 2468, 2469, 2470, 2471, 2472, 2473, 2474, 2475, 2476, 2477 };
|
||||
|
||||
/**
|
||||
* Constructs a new {@code ImpJarCreatePlugin} {@code Object}.
|
||||
*/
|
||||
public ImpJarCreatePlugin() {
|
||||
super(6097, 11264, 1939, 4525, 4535, 4546, 4700, 11262, 10012);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(11266, ITEM_TYPE, this);
|
||||
for (int i : FLOWERS) {
|
||||
addHandler(i, ITEM_TYPE, this);
|
||||
}
|
||||
for (int i : getValidChildren(5908)) {
|
||||
addHandler(i, OBJECT_TYPE, this);
|
||||
}
|
||||
addHandler(5909, OBJECT_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (event.getUsedWith() instanceof Scenery) {
|
||||
if ((event.getUsedItem().getId() >= 4525 && event.getUsedItem().getId() <= 4700) || event.getUsedItem().getId() == 1939 || event.getUsedItem().getId() == 11262 || event.getUsedItem().getId() == 10012) {
|
||||
fillOilStill(player, event.getUsedItem());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (((Item) event.getUsedWith()).getId() == 6097) {
|
||||
makeOil(player);
|
||||
} else if (event.getUsedItem().getId() == 11264) {
|
||||
makeRepellent(player, event.getUsedItem(), (Item) event.getUsedWith());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fills the oil still.
|
||||
* @param player the player.
|
||||
*/
|
||||
private void fillOilStill(Player player, Item used) {
|
||||
int configValue = player.getConfigManager().get(425);
|
||||
if (used.getId() == 11262 || used.getId() == 10012) {
|
||||
if (configValue == 0 && used.getId() == 11262) {
|
||||
player.getInventory().replace(new Item(229), used.getSlot());
|
||||
player.sendMessage("You refine some imp repellent.");
|
||||
player.getConfigManager().set(425, 64, true);
|
||||
return;
|
||||
} else if (configValue == 32) {
|
||||
player.sendMessage("There is already lamp oil in the still.");
|
||||
return;
|
||||
} else if (configValue == 64) {
|
||||
if (used.getId() == 11262) {
|
||||
player.sendMessage("There is already imp repellent in the still.");
|
||||
} else {
|
||||
player.getInventory().replace(new Item(11260), used.getSlot());
|
||||
player.getConfigManager().set(425, 0, true);
|
||||
player.sendMessage("You turn the butterfly jar into an impling jar.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
player.sendMessage("There is no refined imp repellent in the still.");
|
||||
return;
|
||||
}
|
||||
if (configValue == 64) {
|
||||
player.sendMessage("There is already imp repellent in the still.");
|
||||
return;
|
||||
}
|
||||
if (configValue == 32 && used.getId() == 1939) {
|
||||
player.sendMessage("There is already lamp oil in the still.");
|
||||
return;
|
||||
}
|
||||
if (used.getId() == 1939) {
|
||||
if (player.getInventory().remove(new Item(1939))) {
|
||||
player.getConfigManager().set(425, 32, true);
|
||||
player.sendMessage("You refine some swamp tar into lamp oil.");
|
||||
}
|
||||
} else {
|
||||
if (configValue == 0) {
|
||||
player.sendMessage("There is no oil in the still.");
|
||||
} else {
|
||||
if (player.getInventory().contains(4525, 1) || player.getInventory().contains(4535, 1) || player.getInventory().contains(4546, 1) || player.getInventory().contains(4700, 1)) {
|
||||
Item replace = new Item(used.getId() == 4525 ? 4522 : used.getId() == 4535 ? 4537 : used.getId() == 4546 ? 4548 : 4701);
|
||||
player.getInventory().replace(replace, used.getSlot());
|
||||
player.getConfigManager().set(425, 0, true);
|
||||
player.sendMessage("You fill the item with oil.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes imp repellent.
|
||||
* @param player the player.
|
||||
* @param usedWith the used item.
|
||||
*/
|
||||
private void makeRepellent(Player player, Item oil, Item usedWith) {
|
||||
if (isFlower(usedWith.getId())) {
|
||||
if (player.getInventory().remove(usedWith)) {
|
||||
player.getInventory().replace(new Item(11262), oil.getSlot());
|
||||
player.sendMessage("You mix the flower petals with the anchovy oil to make a very strange-smelling concoction.");
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes anchovy oil.
|
||||
* @param player the player.
|
||||
*/
|
||||
private void makeOil(Player player) {
|
||||
if (!player.getInventory().contains(229, 1)) {
|
||||
player.sendMessage("You need an empty vial to put your anchovy oil into.");
|
||||
return;
|
||||
}
|
||||
if (!player.getInventory().contains(11266, 8)) {
|
||||
player.sendMessage("You need 8 anchovy paste's in order to make anchovy oil.");
|
||||
return;
|
||||
}
|
||||
if (player.getInventory().remove(new Item(11266, 8), new Item(229))) {
|
||||
player.getInventory().add(new Item(11264));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if the id is a flower.
|
||||
* @param id the id.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
private boolean isFlower(int id) {
|
||||
for (int i : FLOWERS) {
|
||||
if (i == id) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,51 +0,0 @@
|
|||
package core.game.interaction.item.withitem;
|
||||
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the karamjan silk plugin.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class KaramjanSilkPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Represents the cloth item.
|
||||
*/
|
||||
private static final Item CLOTH = new Item(3188);
|
||||
|
||||
/**
|
||||
* Represents the silk item.
|
||||
*/
|
||||
private static final Item SILK = new Item(950);
|
||||
|
||||
/**
|
||||
* Constructs a new {@code KaramjanSilkPlugin} {@code Object}.
|
||||
*/
|
||||
public KaramjanSilkPlugin() {
|
||||
super(950);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(431, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
if (player.getInventory().remove(SILK)) {
|
||||
player.getInventory().add(CLOTH);
|
||||
player.getPacketDispatch().sendMessage("You pour some of the Karamjan rum over the silk.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,105 +0,0 @@
|
|||
package core.game.interaction.item.withitem;
|
||||
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.plugin.Plugin;
|
||||
import rs09.plugin.PluginManager;
|
||||
import core.plugin.Initializable;
|
||||
import core.tools.RandomFunction;
|
||||
|
||||
/**
|
||||
* Handles the grinding of Lava Scales.
|
||||
* @author Splinter
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class LavaScalePlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code LavaScalePlugin} {@code Object}.
|
||||
*/
|
||||
public LavaScalePlugin() {
|
||||
super(14695);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(233, ITEM_TYPE, this);
|
||||
PluginManager.definePlugin(new AntifireMakePlugin());
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if(player.getInventory().remove(new Item(14695))){
|
||||
player.getInventory().add(new Item(14768, RandomFunction.random(3, 6)));
|
||||
player.animate(new Animation(364));
|
||||
player.sendMessage("You grind the scales into fine shards.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles the making of the Extended antifire potion.
|
||||
* It's apparently not made like regular potions.
|
||||
* @author Splinter
|
||||
* @version 1.0
|
||||
*/
|
||||
public final class AntifireMakePlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code LavaScalePlugin} {@code Object}.
|
||||
*/
|
||||
public AntifireMakePlugin() {
|
||||
super(2454, 2456, 2458, 2452);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(14768, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
int count = player.getInventory().getAmount(event.getUsedWith().asItem());
|
||||
int total = count * getReq(event.getUsedWith().asItem().getId());
|
||||
if(player.getInventory().contains(14768, total)){
|
||||
player.getInventory().remove(new Item(14768, total), new Item(event.getUsedWith().getId(), count));
|
||||
player.getInventory().add(new Item(event.getUsedWith().getId() + 12301, count));
|
||||
player.animate(new Animation(363));
|
||||
player.getSkills().addExperience(Skills.HERBLORE, 27.5 * total);
|
||||
player.sendMessages("You drop a total of "+(total)+" lava scales in the potions and upgrade all of the", "potions of the same dose into extended antifire potions.");
|
||||
} else {
|
||||
player.sendMessage("You don't have enough shards to upgrade all your potions of that dose.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the required amount of shards.
|
||||
* @return
|
||||
*/
|
||||
public int getReq(int id){
|
||||
switch(id){
|
||||
case 2452:
|
||||
return 4;
|
||||
case 2454:
|
||||
return 3;
|
||||
case 2456:
|
||||
return 2;
|
||||
case 2458:
|
||||
return 1;
|
||||
}
|
||||
return 4;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,71 +0,0 @@
|
|||
package core.game.interaction.item.withitem;
|
||||
|
||||
import core.game.component.Component;
|
||||
import core.plugin.Initializable;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.entity.skill.crafting.GlassProduct;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the plugin used to make glass.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public class MakeGlassInterfacePlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code MakeGlassInterfacePlugin} {@code Object}.
|
||||
*/
|
||||
public MakeGlassInterfacePlugin() {
|
||||
super(1775);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(1785, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(final NodeUsageEvent event) {
|
||||
event.getPlayer().getInterfaceManager().open(new Component(542));
|
||||
final Player player = event.getPlayer();
|
||||
switch (GlassProduct.BEER) {
|
||||
case BEER:
|
||||
break;
|
||||
case CANDLE:
|
||||
if (player.getSkills().getLevel(Skills.CRAFTING) < 4)
|
||||
player.getPacketDispatch().sendString("<col=FF8000>Candle lantern</col>", 542, 25);
|
||||
break;
|
||||
case FISHBOWL:
|
||||
if (player.getSkills().getLevel(Skills.CRAFTING) < 42)
|
||||
player.getPacketDispatch().sendString("<col=FF8000>Fish Bowl</col>", 542, 28);
|
||||
break;
|
||||
case LANTERN_LENS:
|
||||
if (player.getSkills().getLevel(Skills.CRAFTING) < 49)
|
||||
player.getPacketDispatch().sendString("<col=FF8000>Lantern lens</col>", 542, 27);
|
||||
break;
|
||||
case OIL_LAMP:
|
||||
if (player.getSkills().getLevel(Skills.CRAFTING) < 12)
|
||||
player.getPacketDispatch().sendString("<col=FF8000>Oil lamp</col>", 542, 26);
|
||||
break;
|
||||
case ORB:
|
||||
if (player.getSkills().getLevel(Skills.CRAFTING) < 46)
|
||||
player.getPacketDispatch().sendString("<col=FF8000>Unpowered orb</col>", 542, 23);
|
||||
break;
|
||||
case VIAL:
|
||||
if (player.getSkills().getLevel(Skills.CRAFTING) < 33)
|
||||
player.getPacketDispatch().sendString("<col=FF8000>Vial</col>", 542, 22);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,304 +0,0 @@
|
|||
package core.game.interaction.item.withitem;
|
||||
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the plugin used to remove poision from a weapon.
|
||||
* @author 'Vexia
|
||||
* @date 29/11/2013
|
||||
*/
|
||||
@Initializable
|
||||
public class PoisonRemovePlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code PoisonRemovePlugin} {@code Object}.
|
||||
*/
|
||||
public PoisonRemovePlugin() {
|
||||
super(883, 5616, 883, 885, 5617, 885, 887, 5618, 887, 889, 5619, 889, 891, 5620, 891, 893, 5621, 893, 871, 5655, 5662, 870, 5654, 5661, 872, 5656, 5663, 873, 5657, 5664, 875, 5659, 5666, 876, 5660, 5667, 874, 5658, 5665, 812, 5628, 5635, 813, 5629, 5636, 814, 5630, 5637, 3094, 5631, 5638, 815, 5632, 5639, 816, 5633, 5640, 817, 5634, 5641, 831, 5641, 5648, 832, 5642, 5649, 833, 5643, 5650, 834, 5644, 5651, 835, 5645, 5652, 836, 5646, 5653, 1219, 5668, 5686, 1221, 5670, 5688, 1223, 5672, 5690, 1225, 5674, 5692, 1227, 5676, 5694, 1229, 5678, 5696, 1231, 5680, 5698, 1233, 5682, 5700, 1251, 5704, 5618, 1253, 5706, 5620, 1255, 5708, 5622, 1257, 5710, 5624, 1259, 5712, 5626, 1261, 5714, 5628, 1263, 5716, 5630, 4582, 5734, 5636);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(3188, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
final PoisonedWeapon weapon = PoisonedWeapon.forItem(event.getBaseItem().getName().contains("Cleaning") ? event.getUsedItem() : event.getBaseItem());
|
||||
if (weapon == null) {
|
||||
return true;
|
||||
}
|
||||
if (player.getInventory().remove(event.getBaseItem().getName().contains("Cleaning") ? event.getUsedItem() : event.getBaseItem())) {
|
||||
player.getInventory().add(new Item(weapon.getItem(), 1));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents the poisioning of a weapon.
|
||||
* @author 'Vexia
|
||||
*/
|
||||
public enum PoisonedWeapon {
|
||||
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
BRONZE_ARROW(882, 883, 5616, 883),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
IRON_ARROW(884, 885, 5617, 885),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
STEEL_ARROW(886, 887, 5618, 887),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
MITHRIL_ARROW(888, 889, 5619, 889),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
ADAMANT_ARROW(890, 891, 5620, 891),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
RUNE_ARROW(892, 893, 5621, 893),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
IRON_KNIFE(863, 871, 5655, 5662),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
RONZE_KNIFE(864, 870, 5654, 5661),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
STEEL_KNIFE(865, 872, 5656, 5663),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
MITHRIL_KNIFE(866, 873, 5657, 5664),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
ADAMANT_KNIFE(867, 875, 5659, 5666),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
RUNE_KNIFE(868, 876, 5660, 5667),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
BLACK_KNIFE(869, 874, 5658, 5665),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
BRONZE_DART(806, 812, 5628, 5635),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
IRON_DART(807, 813, 5629, 5636),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
STEEL_DART(808, 814, 5630, 5637),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
BLACK_DART(3093, 3094, 5631, 5638),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
MITHRIL_DART(809, 815, 5632, 5639),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
ADAMANT_DART(810, 816, 5633, 5640),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
RUNE_DART(811, 817, 5634, 5641),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
IRON_JAVELIN(825, 831, 5641, 5648),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
BRONZE_JAVELIN(826, 832, 5642, 5649),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
STEEL_JAVELIN(827, 833, 5643, 5650),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
MITHRIL_JAVELIN(828, 834, 5644, 5651),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
ADAMANT_JAVELIN(829, 835, 5645, 5652),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
RUNE_JAVELIN(830, 836, 5646, 5653),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
IRON_DAGGER(1203, 1219, 5668, 5686),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
BRONZE_DAGGER(1205, 1221, 5670, 5688),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
STEEL_DAGGER(1207, 1223, 5672, 5690),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
MITHRIL_DAGGER(1209, 1225, 5674, 5692),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
ADAMANT_DAGGER(1211, 1227, 5676, 5694),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
RUNE_DAGGER(1213, 1229, 5678, 5696),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
DRAGON_DAGGER(1215, 1231, 5680, 5698),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
BLACK_DAGGER(1217, 1233, 5682, 5700),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
BRONZE_SPEAR(1237, 1251, 5704, 5618),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
IRON_SPEAR(1239, 1253, 5706, 5620),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
STEEL_SPEAR(1241, 1255, 5708, 5622),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
MITHRIL_SPEAR(1243, 1257, 5710, 5624),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
ADAMANT_SPEAR(1245, 1259, 5712, 5626),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
RUNE_SPEAR(1247, 1261, 5714, 5628),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
DRAGON_SPEAR(1249, 1263, 5716, 5630),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
BLACK_SPEAR(4580, 4582, 5734, 5636);
|
||||
|
||||
/**
|
||||
* @param id the id.
|
||||
* @return the value.
|
||||
*/
|
||||
public static PoisonedWeapon forId(int id) {
|
||||
for (PoisonedWeapon weapon : PoisonedWeapon.values()) {
|
||||
if (weapon.getItem() == id) {
|
||||
return weapon;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The item.
|
||||
*/
|
||||
private int item;
|
||||
|
||||
/**
|
||||
* The first stage.
|
||||
*/
|
||||
private int first;
|
||||
|
||||
/**
|
||||
* The second stage.
|
||||
*/
|
||||
private int second;
|
||||
|
||||
/**
|
||||
* The third stage.
|
||||
*/
|
||||
private int third;
|
||||
|
||||
/**
|
||||
* Constructs a new </code>PoisionWeapon</code>.
|
||||
*/
|
||||
PoisonedWeapon(int item, int first, int second, int third) {
|
||||
this.item = item;
|
||||
this.first = first;
|
||||
this.second = second;
|
||||
this.third = third;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the first.
|
||||
*/
|
||||
public int getFirst() {
|
||||
return first;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the item.
|
||||
*/
|
||||
public int getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the second.
|
||||
*/
|
||||
public int getSecond() {
|
||||
return second;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the third.
|
||||
*/
|
||||
public int getThird() {
|
||||
return third;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to get the poisioned weapon for the id.
|
||||
* @param i the id.
|
||||
* @return the weapon.
|
||||
*/
|
||||
public static PoisonedWeapon forItem(final Item i) {
|
||||
for (PoisonedWeapon weapon : values()) {
|
||||
if (weapon.getFirst() == i.getId() || weapon.getSecond() == i.getId() || weapon.getThird() == i.getId()) {
|
||||
return weapon;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,348 +0,0 @@
|
|||
package core.game.interaction.item.withitem;
|
||||
|
||||
import static api.ContentAPIKt.*;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import org.rs09.consts.Items;
|
||||
|
||||
/**
|
||||
* Handles weapon poisiong.
|
||||
* @author 'Vexia
|
||||
*/
|
||||
@Initializable
|
||||
public class PoisonWeaponPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Represents the poisioning of a weapon.
|
||||
* @author 'Vexia
|
||||
*/
|
||||
public enum PoisonedWeapon {
|
||||
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
BRONZE_ARROW(882, 883, 5616, 883),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
IRON_ARROW(884, 885, 5617, 885),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
STEEL_ARROW(886, 887, 5618, 887),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
MITHRIL_ARROW(888, 889, 5619, 889),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
ADAMANT_ARROW(890, 891, 5620, 891),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
RUNE_ARROW(892, 893, 5621, 893),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
IRON_KNIFE(863, 871, 5655, 5662),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
RONZE_KNIFE(864, 870, 5654, 5661),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
STEEL_KNIFE(865, 872, 5656, 5663),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
MITHRIL_KNIFE(866, 873, 5657, 5664),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
ADAMANT_KNIFE(867, 875, 5659, 5666),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
RUNE_KNIFE(868, 876, 5660, 5667),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
BLACK_KNIFE(869, 874, 5658, 5665),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
BRONZE_DART(806, 812, 5628, 5635),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
IRON_DART(807, 813, 5629, 5636),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
STEEL_DART(808, 814, 5630, 5637),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
BLACK_DART(3093, 3094, 5631, 5638),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
MITHRIL_DART(809, 815, 5632, 5639),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
ADAMANT_DART(810, 816, 5633, 5640),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
RUNE_DART(811, 817, 5634, 5641),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
IRON_JAVELIN(825, 831, 5641, 5648),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
BRONZE_JAVELIN(826, 832, 5642, 5649),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
STEEL_JAVELIN(827, 833, 5643, 5650),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
MITHRIL_JAVELIN(828, 834, 5644, 5651),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
ADAMANT_JAVELIN(829, 835, 5645, 5652),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
RUNE_JAVELIN(830, 836, 5646, 5653),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
IRON_DAGGER(1203, 1219, 5668, 5686),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
BRONZE_DAGGER(1205, 1221, 5670, 5688),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
STEEL_DAGGER(1207, 1223, 5672, 5690),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
MITHRIL_DAGGER(1209, 1225, 5674, 5692),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
ADAMANT_DAGGER(1211, 1227, 5676, 5694),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
RUNE_DAGGER(1213, 1229, 5678, 5696),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
DRAGON_DAGGER(1215, 1231, 5680, 5698),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
BLACK_DAGGER(1217, 1233, 5682, 5700),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
BRONZE_SPEAR(1237, 1251, 5704, 5618),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
IRON_SPEAR(1239, 1253, 5706, 5620),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
STEEL_SPEAR(1241, 1255, 5708, 5622),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
MITHRIL_SPEAR(1243, 1257, 5710, 5624),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
ADAMANT_SPEAR(1245, 1259, 5712, 5626),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
RUNE_SPEAR(1247, 1261, 5714, 5628),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
DRAGON_SPEAR(1249, 1263, 5716, 5730),
|
||||
/**
|
||||
* Represents a poisioned weapon.
|
||||
*/
|
||||
BLACK_SPEAR(4580, 4582, 5734, 5636);
|
||||
|
||||
/**
|
||||
* @param id the id.
|
||||
* @return the value.
|
||||
*/
|
||||
public static PoisonedWeapon forId(int id) {
|
||||
for (PoisonedWeapon weapon : PoisonedWeapon.values()) {
|
||||
if (weapon.getItem() == id) {
|
||||
return weapon;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The item.
|
||||
*/
|
||||
private int item;
|
||||
|
||||
/**
|
||||
* The first stage.
|
||||
*/
|
||||
private int first;
|
||||
|
||||
/**
|
||||
* The second stage.
|
||||
*/
|
||||
private int second;
|
||||
|
||||
/**
|
||||
* The third stage.
|
||||
*/
|
||||
private int third;
|
||||
|
||||
/**
|
||||
* Constructs a new </code>PoisionWeapon</code>.
|
||||
*/
|
||||
PoisonedWeapon(int item, int first, int second, int third) {
|
||||
this.item = item;
|
||||
this.first = first;
|
||||
this.second = second;
|
||||
this.third = third;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the first.
|
||||
*/
|
||||
public int getFirst() {
|
||||
return first;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the item.
|
||||
*/
|
||||
public int getItem() {
|
||||
return item;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the second.
|
||||
*/
|
||||
public int getSecond() {
|
||||
return second;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the third.
|
||||
*/
|
||||
public int getThird() {
|
||||
return third;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to get the poisioned weapon for the id.
|
||||
* @param i the id.
|
||||
* @return the weapon.
|
||||
*/
|
||||
public static PoisonedWeapon forItem(final Item i) {
|
||||
for (PoisonedWeapon weapon : values()) {
|
||||
if (weapon.getFirst() == i.getId() || weapon.getSecond() == i.getId() || weapon.getThird() == i.getId()) {
|
||||
return weapon;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static void poison(Player player, int type, int item, final Item weaponItem, PoisonedWeapon weapon) {
|
||||
int product = -1;
|
||||
player.animate(new Animation(1652));
|
||||
switch (item) {
|
||||
case 187:// normal.
|
||||
product = weapon.getFirst();
|
||||
player.getInventory().remove(new Item(187, 1));
|
||||
break;
|
||||
case 5937:// second
|
||||
product = weapon.getSecond();
|
||||
player.getInventory().remove(new Item(5937, 1));
|
||||
break;
|
||||
case 5940:// third.
|
||||
product = weapon.getThird();
|
||||
player.getInventory().remove(new Item(5940, 1));
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
int amt = Math.min(weaponItem.getAmount(), 5);
|
||||
player.getInventory().remove(new Item(weaponItem.getId(), amt));
|
||||
addItemOrDrop(player, product, amt);
|
||||
addItemOrDrop(player, Items.VIAL_229, 1);
|
||||
player.getPacketDispatch().sendMessage("You poison the " + weaponItem.getName().toLowerCase() + ".");
|
||||
}
|
||||
|
||||
public PoisonWeaponPlugin() {
|
||||
super(882, 884, 886, 888, 890, 892, 863, 864, 865, 866, 867, 868, 869, 806, 807, 808, 3093, 809, 810, 811, 825, 826, 827, 828, 829, 830, 1203, 1205, 1207, 1209, 1211, 1213, 1215, 1217, 1237, 1239, 1241, 1243, 1245, 1247, 1249, 4580);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
final Item second = (Item) event.getUsedWith();
|
||||
if (event.getUsedItem().getId() == 187 || second.getId() == 187) {
|
||||
|
||||
if (event.getUsedItem().getId() != 187) {
|
||||
poison(player, 1, second.getId(), event.getUsedItem(), PoisonedWeapon.forId(event.getUsedItem().getId()));
|
||||
} else if (second.getId() != 187) {
|
||||
poison(player, 1, event.getUsedItem().getId(), second, PoisonedWeapon.forId(second.getId()));
|
||||
}
|
||||
}
|
||||
if (event.getUsedItem().getId() == 5937 || second.getId() == 5937) {
|
||||
if (event.getUsedItem().getId() != 5937) {
|
||||
poison(player, 2, second.getId(), event.getUsedItem(), PoisonedWeapon.forId(event.getUsedItem().getId()));
|
||||
} else if (second.getId() != 5937) {
|
||||
poison(player, 2, event.getUsedItem().getId(), second, PoisonedWeapon.forId(second.getId()));
|
||||
}
|
||||
}
|
||||
if (event.getUsedItem().getId() == 5940 || second.getId() == 5940) {
|
||||
if (event.getUsedItem().getId() != 5940) {
|
||||
poison(player, 3, second.getId(), event.getUsedItem(), PoisonedWeapon.forId(event.getUsedItem().getId()));
|
||||
} else if (second.getId() != 5940) {
|
||||
poison(player, 3, event.getUsedItem().getId(), second, PoisonedWeapon.forId(second.getId()));
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(187, ITEM_TYPE, this);
|
||||
addHandler(5937, ITEM_TYPE, this);
|
||||
addHandler(5940, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,46 +0,0 @@
|
|||
package core.game.interaction.item.withitem;
|
||||
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the plugin to make seasoned sardines.
|
||||
* @author 'Vexia
|
||||
* @date Oct 6, 2013
|
||||
*/
|
||||
@Initializable
|
||||
public class SeasonedSardinePlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Represents the seasoned sardine.
|
||||
*/
|
||||
private final Item SEASONED_SARDINE = new Item(1552);
|
||||
|
||||
/**
|
||||
* Constructs a new {@code SeasonedSardinePlugina} {@code Object}.
|
||||
*/
|
||||
public SeasonedSardinePlugin() {
|
||||
super(327);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(1573, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
if (player.getInventory().remove(event.getUsedItem()) && player.getInventory().remove(event.getBaseItem())) {
|
||||
player.getDialogueInterpreter().sendDialogue("You rub the doogle leaves over the sardine.");
|
||||
player.getInventory().add(SEASONED_SARDINE);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
package core.game.interaction.item.withitem;
|
||||
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* @author 'Vexia
|
||||
*/
|
||||
@Initializable
|
||||
public class SkullSceptrePlugin extends UseWithHandler {
|
||||
|
||||
public SkullSceptrePlugin() {
|
||||
super(9008, 9009, 9011);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
if (event.getUsedItem().getId() == 9008 && ((Item) event.getUsedWith()).getId() == 9007) {
|
||||
event.getPlayer().getInventory().remove(new Item(9008, 1));
|
||||
event.getPlayer().getInventory().remove(new Item(9007, 1));
|
||||
event.getPlayer().getInventory().add(new Item(9009, 1));
|
||||
event.getPlayer().getDialogueInterpreter().open(78489);
|
||||
return true;
|
||||
}
|
||||
if (event.getUsedItem().getId() == 9011 && ((Item) event.getUsedWith()).getId() == 9010) {
|
||||
event.getPlayer().getInventory().remove(new Item(9010, 1));
|
||||
event.getPlayer().getInventory().remove(new Item(9011, 1));
|
||||
event.getPlayer().getInventory().add(new Item(9012, 1));
|
||||
event.getPlayer().getDialogueInterpreter().open(78489, true);
|
||||
return true;
|
||||
}
|
||||
if (event.getUsedItem().getId() == 9012 && ((Item) event.getUsedWith()).getId() == 9009) {
|
||||
event.getPlayer().getInventory().remove(new Item(9009, 1));
|
||||
event.getPlayer().getInventory().remove(new Item(9012, 1));
|
||||
event.getPlayer().getInventory().add(new Item(9013, 1));
|
||||
event.getPlayer().getDialogueInterpreter().open(78489, true, true);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(9007, ITEM_TYPE, this);
|
||||
addHandler(9010, ITEM_TYPE, this);
|
||||
addHandler(9012, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,147 +0,0 @@
|
|||
package core.game.interaction.item.withitem;
|
||||
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.plugin.Initializable;
|
||||
import org.rs09.consts.Items;
|
||||
import rs09.game.content.dialogue.SkillDialogueHandler;
|
||||
import rs09.game.content.dialogue.SkillDialogueHandler.SkillDialogue;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.system.task.Pulse;
|
||||
import core.plugin.Plugin;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Represents the plugin used to make soft clay.
|
||||
* @author 'Vexia
|
||||
* @date 1/14/14
|
||||
*/
|
||||
@Initializable
|
||||
public final class SoftclayPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Represents the clay item.
|
||||
*/
|
||||
private static final Item CLAY = new Item(Items.CLAY_434);
|
||||
|
||||
/**
|
||||
* Represents the soft clay item.
|
||||
*/
|
||||
private static final Item SOFT_CLAY = new Item(Items.SOFT_CLAY_1761);
|
||||
|
||||
/**
|
||||
* Represents the bowl of water item.
|
||||
*/
|
||||
private static final Item BOWL_OF_WATER = new Item(Items.BOWL_OF_WATER_1921);
|
||||
|
||||
/**
|
||||
* Represents the empty bowl item.
|
||||
*/
|
||||
private static final Item BOWL = new Item(Items.BOWL_1923);
|
||||
|
||||
/**
|
||||
* Represents the empty bucket item.
|
||||
*/
|
||||
private static final Item BUCKET = new Item(Items.BUCKET_1925);
|
||||
|
||||
/**
|
||||
* Represents the bucket of water item.
|
||||
*/
|
||||
private static final Item BUCKET_OF_WATER = new Item(Items.BUCKET_OF_WATER_1929);
|
||||
|
||||
/**
|
||||
* Represents the jug item.
|
||||
*/
|
||||
private static final Item JUG = new Item(Items.JUG_1935);
|
||||
|
||||
/**
|
||||
* Represents the jug of water item.
|
||||
*/
|
||||
private static final Item JUG_OF_WATER = new Item(Items.JUG_OF_WATER_1937);
|
||||
|
||||
/**
|
||||
* Constructs a new {@code SoftclayPlugin} {@code Object}.
|
||||
*/
|
||||
public SoftclayPlugin() {
|
||||
super(434);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(1921, ITEM_TYPE, this);
|
||||
addHandler(1929, ITEM_TYPE, this);
|
||||
addHandler(1937, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(final NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
SkillDialogueHandler handler = new SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, SOFT_CLAY) {
|
||||
@Override
|
||||
public void create(final int amount, int index) {
|
||||
player.getPulseManager().run(new Pulse(2, player) {
|
||||
int count;
|
||||
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
if (!SoftclayPlugin.this.create(player, event)) {
|
||||
return true;
|
||||
}
|
||||
return ++count >= amount;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAll(int index) {
|
||||
return player.getInventory().getAmount(CLAY);
|
||||
}
|
||||
};
|
||||
if (player.getInventory().getAmount(CLAY) == 1) {
|
||||
create(player, event);
|
||||
} else {
|
||||
handler.open();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a soft clay.
|
||||
* @param player the player.
|
||||
* @param event the event.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
private boolean create(final Player player, NodeUsageEvent event) {
|
||||
Item removeItem = null;
|
||||
Item returnItem = null;
|
||||
if (event.getUsedItem().getId() == Items.BUCKET_OF_WATER_1929 || event.getBaseItem().getId() == Items.BUCKET_OF_WATER_1929) {
|
||||
removeItem = BUCKET_OF_WATER;
|
||||
returnItem = BUCKET;
|
||||
}
|
||||
if (event.getUsedItem().getId() == Items.BOWL_OF_WATER_1921 || event.getBaseItem().getId() == Items.BOWL_OF_WATER_1921) {
|
||||
removeItem = BOWL_OF_WATER;
|
||||
returnItem = BOWL;
|
||||
}
|
||||
if (event.getUsedItem().getId() == Items.JUG_OF_WATER_1937 || event.getBaseItem().getId() == Items.JUG_OF_WATER_1937) {
|
||||
removeItem = JUG_OF_WATER;
|
||||
returnItem = JUG;
|
||||
}
|
||||
|
||||
if (player.getInventory().containsItem(CLAY) && player.getInventory().containsItem(Objects.requireNonNull(removeItem))) {
|
||||
player.getInventory().remove(removeItem);
|
||||
player.getInventory().remove(CLAY);
|
||||
player.getPacketDispatch().sendMessage("You mix the clay and water. You now have some soft, workable clay.");
|
||||
player.getInventory().add(SOFT_CLAY);
|
||||
player.getInventory().add(returnItem);
|
||||
if (!player.getAchievementDiaryManager().hasCompletedTask(DiaryType.LUMBRIDGE, 0, 6) && player.getViewport().getRegion().getId() == 12341) {
|
||||
player.getAchievementDiaryManager().finishTask(player, DiaryType.LUMBRIDGE, 0, 6);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
package core.game.interaction.item.withitem;
|
||||
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the water skin refilling plugin.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class WaterSkinPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Represents the full skill item.
|
||||
*/
|
||||
private final Item FULL_SKIN = new Item(1823);
|
||||
|
||||
/**
|
||||
* Represents data of water skin filling vessils.
|
||||
*/
|
||||
private final int[][] data = new int[][] { { 1937, 1935 }, { 1929, 1925 }, { 1921, 1923 }, { 227, 229 } };
|
||||
|
||||
/**
|
||||
* Constructs a new {@code WaterSkinPlugin} {@code Object}.
|
||||
*/
|
||||
public WaterSkinPlugin() {
|
||||
super(1825, 1827, 1829, 1831);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
addHandler(data[i][0], ITEM_TYPE, this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final Item waterSkin = event.getUsedItem().getName().contains("skin") ? event.getUsedItem() : event.getBaseItem();
|
||||
final Item vessil = !event.getUsedItem().getName().contains("skin") ? event.getUsedItem() : event.getBaseItem();
|
||||
if (event.getPlayer().getInventory().remove(waterSkin)) {
|
||||
event.getPlayer().getInventory().add(vessil.getId() == 227 ? new Item(waterSkin.getId() - 2) : FULL_SKIN);
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
if (data[i][0] == vessil.getId() && event.getPlayer().getInventory().remove(vessil)) {
|
||||
event.getPlayer().getInventory().add(new Item(data[i][1]));
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
24
Server/src/main/kotlin/api/ApiExtensions.kt
Normal file
24
Server/src/main/kotlin/api/ApiExtensions.kt
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
package api
|
||||
|
||||
import core.game.node.item.Item
|
||||
|
||||
fun IntRange.toIntArray(): IntArray {
|
||||
if (last < first)
|
||||
return IntArray(0)
|
||||
|
||||
val result = IntArray(last - first + 1)
|
||||
var index = 0
|
||||
for (element in this)
|
||||
result[index++] = element
|
||||
return result
|
||||
}
|
||||
|
||||
fun Int.asItem() : Item {
|
||||
return Item(this)
|
||||
}
|
||||
|
||||
fun Collection<IntArray>.toIntArray() : IntArray {
|
||||
val list = ArrayList<Int>()
|
||||
this.forEach { arr -> arr.forEach { list.add(it) } }
|
||||
return list.toIntArray()
|
||||
}
|
||||
|
|
@ -129,7 +129,7 @@ fun amountInEquipment(player: Player, id: Int): Int{
|
|||
* @param container the Container to remove the items from. An enum exists for this in the api package called Container. Ex: api.Container.BANK
|
||||
*/
|
||||
|
||||
fun <T> removeItem(player: Player, item: T, container: Container): Boolean {
|
||||
fun <T> removeItem(player: Player, item: T, container: Container = Container.INVENTORY): Boolean {
|
||||
item ?: return false
|
||||
val it = when (item) {
|
||||
is Item -> item
|
||||
|
|
@ -153,7 +153,43 @@ fun <T> removeItem(player: Player, item: T, container: Container): Boolean {
|
|||
*/
|
||||
|
||||
fun addItem(player: Player, id: Int, amount: Int = 1): Boolean{
|
||||
return player.inventory.add(Item(id,amount))
|
||||
return addItem(player, id, amount)
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an item to the given player's given container
|
||||
* @param player the player whose container to modify
|
||||
* @param id the ID of the item to add
|
||||
* @param amount the amount of the item to add
|
||||
* @param container the Container to modify
|
||||
* @return true if the item was successfully added
|
||||
*/
|
||||
fun addItem(player: Player, id: Int, amount: Int = 1, container: Container = Container.INVENTORY): Boolean {
|
||||
val cont = when(container){
|
||||
Container.INVENTORY -> player.inventory
|
||||
Container.BANK -> player.bank
|
||||
Container.EQUIPMENT -> player.equipment
|
||||
}
|
||||
|
||||
return cont.add(Item(id, amount))
|
||||
}
|
||||
|
||||
/**
|
||||
* Replaces the item in the given slot in the given container with the given item.
|
||||
* @param player the player whose container to modify
|
||||
* @param slot the slot to use
|
||||
* @param item the item to replace the slot with
|
||||
* @param container the Container to modify
|
||||
* @return the item that was previously in the slot, or null if none.
|
||||
*/
|
||||
fun replaceSlot(player: Player, slot: Int, item: Item, container: Container = Container.INVENTORY): Item? {
|
||||
val cont = when(container) {
|
||||
Container.INVENTORY -> player.inventory
|
||||
Container.EQUIPMENT -> player.equipment
|
||||
Container.BANK -> player.bank
|
||||
}
|
||||
|
||||
return cont.replace(item, slot)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -755,8 +791,9 @@ fun heal(entity: Entity, amount: Int){
|
|||
* @param value the value to set the varbit to
|
||||
*/
|
||||
|
||||
fun setVarbit(player: Player, varpIndex: Int, offset: Int, value: Int){
|
||||
fun setVarbit(player: Player, varpIndex: Int, offset: Int, value: Int, save: Boolean = false){
|
||||
player.varpManager.get(varpIndex).setVarbit(offset,value).send(player)
|
||||
if(save) player.varpManager.flagSave(varpIndex)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -832,6 +869,13 @@ fun getItemFromEquipment(player: Player, slot: EquipmentSlot): Item? {
|
|||
return player.equipment.get(slot.ordinal)
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a list of all valid children IDs for a given scenery ID
|
||||
*/
|
||||
fun getChildren(scenery: Int): IntArray {
|
||||
return SceneryDefinition.forId(scenery).getChildrenIds().filter { it != -1 }.toIntArray()
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjusts the charge for the given node.
|
||||
* @param node the node to adjust the charge of
|
||||
|
|
|
|||
|
|
@ -0,0 +1,33 @@
|
|||
package rs09.game.interaction.item.withitem
|
||||
|
||||
import api.*
|
||||
import org.rs09.consts.Items
|
||||
import rs09.game.interaction.InteractionListener
|
||||
|
||||
class ChiselOnGranite : InteractionListener() {
|
||||
override fun defineListeners() {
|
||||
val granite = intArrayOf(Items.GRANITE_5KG_6983, Items.GRANITE_2KG_6981)
|
||||
|
||||
onUseWith(ITEM, granite, Items.CHISEL_1755) {player, used, _ ->
|
||||
if (freeSlots(player) < 3) {
|
||||
sendMessage(player, "You need four inventory slots to do this.")
|
||||
} else {
|
||||
if(removeItem(player, used, Container.INVENTORY)) {
|
||||
when (used.id) {
|
||||
Items.GRANITE_5KG_6983 -> {
|
||||
sendMessage(player, "You chisel the 5kg granite into four smaller pieces.")
|
||||
addItemOrDrop(player, Items.GRANITE_2KG_6981, 2)
|
||||
addItemOrDrop(player, Items.GRANITE_500G_6979, 2)
|
||||
}
|
||||
|
||||
Items.GRANITE_2KG_6981 -> {
|
||||
sendMessage(player, "You chisel the 2kg granite into four smaller pieces.")
|
||||
addItemOrDrop(player, Items.GRANITE_500G_6979, 4)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
package rs09.game.interaction.item.withitem
|
||||
|
||||
import api.addItem
|
||||
import api.removeItem
|
||||
import api.runTask
|
||||
import api.sendMessage
|
||||
import org.rs09.consts.Items
|
||||
import rs09.game.interaction.InteractionListener
|
||||
|
||||
class ClaySoftener : InteractionListener() {
|
||||
override fun defineListeners() {
|
||||
val sources = intArrayOf(Items.JUG_OF_WATER_1937, Items.BUCKET_OF_WATER_1929, Items.BOWL_OF_WATER_1921)
|
||||
|
||||
onUseWith(ITEM, sources, Items.CLAY_434){player, used, with ->
|
||||
val returnItem = when(used.id){
|
||||
Items.JUG_OF_WATER_1937 -> Items.EMPTY_JUG_3732
|
||||
Items.BUCKET_OF_WATER_1929 -> Items.EMPTY_BUCKET_3727
|
||||
else -> Items.BOWL_1923
|
||||
}
|
||||
|
||||
runTask(player, 2){
|
||||
if(removeItem(player, used.asItem()) && removeItem(player, with.asItem())){
|
||||
addItem(player, Items.SOFT_CLAY_1761)
|
||||
addItem(player, returnItem)
|
||||
sendMessage(player, "You mix the clay and water. You now have some soft, workable clay.")
|
||||
}
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package rs09.game.interaction.item.withitem
|
||||
|
||||
import org.rs09.consts.Items
|
||||
import rs09.game.interaction.InteractionListener
|
||||
import api.*
|
||||
|
||||
class CombineCrystalKey : InteractionListener() {
|
||||
override fun defineListeners() {
|
||||
onUseWith(ITEM, Items.LOOP_HALF_OF_A_KEY_987, Items.TOOTH_HALF_OF_A_KEY_985){player, used, with ->
|
||||
if(removeItem(player, used, Container.INVENTORY) && removeItem(player,with,Container.INVENTORY)) {
|
||||
addItem(player, Items.CRYSTAL_KEY_989)
|
||||
sendMessage(player, "You join the loop half of a key and the tooth half of a key to make a crystal key.")
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,55 @@
|
|||
package rs09.game.interaction.item.withitem
|
||||
|
||||
import api.*
|
||||
import core.game.node.item.Item
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.Items.LEMON_CHUNKS_2104
|
||||
import org.rs09.consts.Items.LIME_2120
|
||||
import org.rs09.consts.Items.LIME_CHUNKS_2122
|
||||
import org.rs09.consts.Items.LIME_SLICES_2124
|
||||
import rs09.game.content.dialogue.DialogueFile
|
||||
import rs09.game.interaction.InteractionListener
|
||||
|
||||
class FruitSlicing : InteractionListener() {
|
||||
|
||||
override fun defineListeners() {
|
||||
val fruits = Fruit.values().map { it.base.id } .toIntArray()
|
||||
|
||||
onUseWith(ITEM, fruits, Items.KNIFE_946) {player, used, with ->
|
||||
val fruit = Fruit.forBase(used.id) ?: return@onUseWith false
|
||||
|
||||
if ((fruit == Fruit.BANANA || fruit == Fruit.LEMON)) {
|
||||
if (removeItem(player, used.asItem(), Container.INVENTORY)) {
|
||||
lock(player, 2)
|
||||
animate(player, 1192)
|
||||
addItem(player, fruit.sliced.id, fruit.sliced.amount)
|
||||
sendMessage(player, "You deftly chop the " + fruit.name.toLowerCase() + " into slices.")
|
||||
}
|
||||
} else {
|
||||
//TODO: Below Dialogue is still located in FruitCuttingDialogue.java. Convert to DialogueFile and make this not so garbage.
|
||||
openDialogue(player,31237434, fruit)
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
}
|
||||
|
||||
enum class Fruit(val base: Item, val diced: Item?, val sliced: Item) {
|
||||
PINEAPPLE(Item(2114), Item(2116), Item(2118, 4)),
|
||||
BANANA(Item(1963), null, Item(3162)),
|
||||
LEMON(Item(2102), Item(LEMON_CHUNKS_2104), Item(2106)),
|
||||
LIME(Item(LIME_2120), Item(LIME_CHUNKS_2122), Item(LIME_SLICES_2124)),
|
||||
ORANGE(Item(2108), Item(2110), Item(2112));
|
||||
|
||||
companion object {
|
||||
val fruitMap = values().map { it.base.id to it }.toMap()
|
||||
/**
|
||||
* Method used to get the fruit for the base item.
|
||||
* @param item the item.
|
||||
* @return the fruit.
|
||||
*/
|
||||
fun forBase(item: Int): Fruit? {
|
||||
return fruitMap[item]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package rs09.game.interaction.item.withitem
|
||||
|
||||
import api.*
|
||||
import core.tools.StringUtils
|
||||
import org.rs09.consts.Items
|
||||
import rs09.game.interaction.InteractionListener
|
||||
|
||||
class HiltOnBlade : InteractionListener() {
|
||||
override fun defineListeners() {
|
||||
val HILTS = intArrayOf(Items.ARMADYL_HILT_11702, Items.ZAMORAK_HILT_11708, Items.BANDOS_HILT_11704, Items.SARADOMIN_HILT_11706)
|
||||
|
||||
onUseWith(ITEM, HILTS, Items.GODSWORD_BLADE_11690) {player, used, with ->
|
||||
if (removeItem(player, used.asItem(), Container.INVENTORY) && removeItem(player, with.asItem(), Container.INVENTORY)) {
|
||||
val godsword = if(used.id > 11690) used.id - 8 else with.id - 8
|
||||
addItem(player, godsword)
|
||||
sendMessage(player, "You attach the hilt to the blade and make a ${if(StringUtils.isPlusN(getItemName(godsword))) "an" else "a"} ${getItemName(godsword)}.")
|
||||
}
|
||||
|
||||
return@onUseWith true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,22 @@
|
|||
package rs09.game.interaction.item.withitem
|
||||
|
||||
import api.*
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.Scenery
|
||||
import rs09.game.interaction.InteractionListener
|
||||
|
||||
class KeyOnPirateChest : InteractionListener() {
|
||||
override fun defineListeners() {
|
||||
onUseWith(SCENERY, Items.CHEST_KEY_432, Scenery.CHEST_2079){player, used, with ->
|
||||
val scenery = with as core.game.node.scenery.Scenery
|
||||
if(removeItem(player, used, Container.INVENTORY)){
|
||||
replaceScenery(scenery, 2080, 3)
|
||||
addItemOrDrop(player, Items.PIRATE_MESSAGE_433)
|
||||
sendMessage(player, "You unlock the chest.")
|
||||
sendMessage(player, "All that's in the chest is a message...")
|
||||
sendMessage(player, "You take the message from the chest.")
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
package rs09.game.interaction.item.withitem
|
||||
|
||||
import api.*
|
||||
import core.game.node.entity.player.Player
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.Scenery
|
||||
import rs09.game.interaction.InteractionListener
|
||||
|
||||
class OilStillListeners : InteractionListener() {
|
||||
override fun defineListeners() {
|
||||
val flowers = (Items.FLOWERS_2460..Items.FLOWERS_2477).toIntArray()
|
||||
val stills = intArrayOf(*getChildren(5908), 5909)
|
||||
val fillableItems = mapOf(
|
||||
Items.OIL_LAMP_4525 to Items.OIL_LAMP_4522,
|
||||
Items.OIL_LANTERN_4535 to Items.OIL_LANTERN_4537,
|
||||
Items.BULLSEYE_LANTERN_4546 to Items.BULLSEYE_LANTERN_4548,
|
||||
Items.SAPPHIRE_LANTERN_4700 to Items.SAPPHIRE_LANTERN_4701
|
||||
)
|
||||
|
||||
onUseWith(ITEM, flowers, Items.ANCHOVY_OIL_11264) { player, used, with ->
|
||||
if (removeItem(player, used, Container.INVENTORY)) {
|
||||
replaceSlot(player, with.asItem().slot, Items.IMP_REPELLENT_11262.asItem())
|
||||
sendMessage(player, "You mix the flower petals with the anchovy oil to make a very strange-smelling concoction.")
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
onUseWith(SCENERY, Items.SWAMP_TAR_1939, *stills) {player, used, _ ->
|
||||
if(checkStillEmpty(player)){
|
||||
removeItem(player, used)
|
||||
setVarbit(player, 425, 4, 2, save = true)
|
||||
sendMessage(player, "You refine some swamp tar into lamp oil.")
|
||||
} else {
|
||||
sendStillFull(player)
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
onUseWith(SCENERY, fillableItems.keys.toIntArray(), *stills){player, used, _ ->
|
||||
when {
|
||||
checkStillEmpty(player) -> sendMessage(player, "There is no oil in the sill.")
|
||||
getStillState(player) == 2 -> {
|
||||
val replacement = fillableItems[used.id]?.asItem() ?: return@onUseWith false
|
||||
replaceSlot(player, used.asItem().slot, replacement)
|
||||
setVarbit(player, 425, 4, 0)
|
||||
sendMessage(player, "You fill the ${replacement.name.toLowerCase()} with oil.")
|
||||
}
|
||||
else -> sendMessage(player, "There is refined imp repellent in this still, not lamp oil.")
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
onUseWith(SCENERY, Items.IMP_REPELLENT_11262, *stills){player, used, _ ->
|
||||
when {
|
||||
checkStillEmpty(player) -> {
|
||||
replaceSlot(player, used.asItem().slot, Items.VIAL_229.asItem())
|
||||
sendMessage(player, "You refine some imp repellent.")
|
||||
setVarbit(player, 425, 4, 4)
|
||||
}
|
||||
else -> sendStillFull(player)
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
onUseWith(SCENERY, Items.BUTTERFLY_JAR_10012, *stills){player, used, _ ->
|
||||
when {
|
||||
checkStillEmpty(player) -> sendMessage(player, "There is no refined imp repellent in the still.")
|
||||
getStillState(player) == 2 -> {
|
||||
replaceSlot(player, used.asItem().slot, Items.IMPLING_JAR_11260.asItem())
|
||||
setVarbit(player, 425, 4, 0)
|
||||
sendMessage(player, "You turn the butterfly jar into an impling jar.")
|
||||
}
|
||||
else -> sendMessage(player, "There is lamp oil in this still, not refined imp repellent.")
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
}
|
||||
|
||||
private fun checkStillEmpty(player: Player) : Boolean {
|
||||
val stillState = getStillState(player)
|
||||
return stillState == 0
|
||||
}
|
||||
|
||||
private fun sendStillFull(player: Player) {
|
||||
val stillState = getStillState(player)
|
||||
|
||||
if(stillState != 0) {
|
||||
when(stillState) {
|
||||
2 -> sendMessage(player, "There is already lamp oil in the still.")
|
||||
4 -> sendMessage(player, "There is already imp repellent in the still.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getStillState(player: Player): Int {
|
||||
return getVarbitValue(player, 425, 4)
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
package rs09.game.interaction.item.withitem
|
||||
|
||||
import api.*
|
||||
import core.game.node.item.Item
|
||||
import org.rs09.consts.Items
|
||||
import rs09.game.interaction.InteractionListener
|
||||
import kotlin.collections.toIntArray
|
||||
import kotlin.math.min
|
||||
|
||||
class PoisonedWeaponListeners : InteractionListener() {
|
||||
override fun defineListeners() {
|
||||
val poisons = intArrayOf(Items.WEAPON_POISON_187, Items.WEAPON_POISON_PLUS_5937, Items.WEAPON_POISON_PLUS_PLUS_5940)
|
||||
val poisonableItems = PoisonSets.itemMap.keys.toIntArray()
|
||||
val poisonedItems = PoisonSets.itemMap.values.toIntArray()
|
||||
|
||||
onUseWith(ITEM, poisons, *poisonableItems){player, used, with ->
|
||||
val index = poisons.indexOf(used.id)
|
||||
val product = PoisonSets.itemMap[with.id]!![index]
|
||||
val amt = min(5, with.asItem().amount)
|
||||
|
||||
if(removeItem(player, Item(with.id, amt))) {
|
||||
addItemOrDrop(player, product, amt)
|
||||
addItemOrDrop(player, Items.VIAL_229)
|
||||
sendMessage(player, "You poison the ${with.name.toLowerCase()}.")
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
onUseWith(ITEM, Items.CLEANING_CLOTH_3188, *poisonedItems) {player, _, with ->
|
||||
val base = PoisonSets.getBase(with.id) ?: return@onUseWith false
|
||||
val amt = min(5, with.asItem().amount)
|
||||
removeItem(player, Item(with.id, amt))
|
||||
addItemOrDrop(player, base, amt)
|
||||
return@onUseWith true
|
||||
}
|
||||
}
|
||||
|
||||
//below enum copied from old file, some data is probably wrong.
|
||||
internal enum class PoisonSets(val base: Int, val p: Int, val pp: Int, val ppp: Int){
|
||||
BRONZE_ARROW(882, 883, 5616, 883),
|
||||
IRON_ARROW(884, 885, 5617, 885),
|
||||
STEEL_ARROW(886, 887, 5618, 887),
|
||||
MITHRIL_ARROW(888, 889, 5619, 889),
|
||||
ADAMANT_ARROW(890, 891, 5620, 891),
|
||||
RUNE_ARROW(892, 893, 5621, 893),
|
||||
IRON_KNIFE(863, 871, 5655, 5662),
|
||||
RONZE_KNIFE(864, 870, 5654, 5661),
|
||||
STEEL_KNIFE(865, 872, 5656, 5663),
|
||||
MITHRIL_KNIFE(866, 873, 5657, 5664),
|
||||
ADAMANT_KNIFE(867, 875, 5659, 5666),
|
||||
RUNE_KNIFE(868, 876, 5660, 5667),
|
||||
BLACK_KNIFE(869, 874, 5658, 5665),
|
||||
BRONZE_DART(806, 812, 5628, 5635),
|
||||
IRON_DART(807, 813, 5629, 5636),
|
||||
STEEL_DART(808, 814, 5630, 5637),
|
||||
BLACK_DART(3093, 3094, 5631, 5638),
|
||||
MITHRIL_DART(809, 815, 5632, 5639),
|
||||
ADAMANT_DART(810, 816, 5633, 5640),
|
||||
RUNE_DART(811, 817, 5634, 5641),
|
||||
IRON_JAVELIN(825, 831, 5641, 5648),
|
||||
BRONZE_JAVELIN(826, 832, 5642, 5649),
|
||||
STEEL_JAVELIN(827, 833, 5643, 5650),
|
||||
MITHRIL_JAVELIN(828, 834, 5644, 5651),
|
||||
ADAMANT_JAVELIN(829, 835, 5645, 5652),
|
||||
RUNE_JAVELIN(830, 836, 5646, 5653),
|
||||
IRON_DAGGER(1203, 1219, 5668, 5686),
|
||||
BRONZE_DAGGER(1205, 1221, 5670, 5688),
|
||||
STEEL_DAGGER(1207, 1223, 5672, 5690),
|
||||
MITHRIL_DAGGER(1209, 1225, 5674, 5692),
|
||||
ADAMANT_DAGGER(1211, 1227, 5676, 5694),
|
||||
RUNE_DAGGER(1213, 1229, 5678, 5696),
|
||||
DRAGON_DAGGER(1215, 1231, 5680, 5698),
|
||||
BLACK_DAGGER(1217, 1233, 5682, 5700),
|
||||
BRONZE_SPEAR(1237, 1251, 5704, 5618),
|
||||
IRON_SPEAR(1239, 1253, 5706, 5620),
|
||||
STEEL_SPEAR(1241, 1255, 5708, 5622),
|
||||
MITHRIL_SPEAR(1243, 1257, 5710, 5624),
|
||||
ADAMANT_SPEAR(1245, 1259, 5712, 5626),
|
||||
RUNE_SPEAR(1247, 1261, 5714, 5628),
|
||||
DRAGON_SPEAR(1249, 1263, 5716, 5730),
|
||||
BLACK_SPEAR(4580, 4582, 5734, 5636);
|
||||
|
||||
companion object {
|
||||
val itemMap = values().map { it.base to intArrayOf(it.p,it.pp,it.ppp) }.toMap()
|
||||
|
||||
fun getBase(poisoned: Int) : Int? {
|
||||
for ((base,set) in itemMap.entries) {
|
||||
if (set.contains(poisoned)) return base
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package rs09.game.interaction.item.withitem
|
||||
|
||||
import api.addItem
|
||||
import api.removeItem
|
||||
import api.sendDialogue
|
||||
import org.rs09.consts.Items
|
||||
import rs09.game.interaction.InteractionListener
|
||||
|
||||
class SardineSeasoner : InteractionListener() {
|
||||
override fun defineListeners() {
|
||||
onUseWith(ITEM, Items.DOOGLE_LEAVES_1573, Items.RAW_SARDINE_327) {player, used, with ->
|
||||
if(removeItem(player, used.asItem()) && removeItem(player, with.asItem())){
|
||||
addItem(player, Items.DOOGLE_SARDINE_1552)
|
||||
sendDialogue(player, "You rub the doogle leaves over the sardine.")
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package rs09.game.interaction.item.withitem
|
||||
|
||||
import api.asItem
|
||||
import api.replaceSlot
|
||||
import api.sendMessage
|
||||
import org.rs09.consts.Items
|
||||
import rs09.game.interaction.InteractionListener
|
||||
|
||||
class SilkRumListener : InteractionListener() {
|
||||
override fun defineListeners() {
|
||||
onUseWith(ITEM, Items.KARAMJAN_RUM_431, Items.SILK_950){player, _, with ->
|
||||
replaceSlot(player, with.asItem().slot, Items.CLEANING_CLOTH_3188.asItem())
|
||||
sendMessage(player, "You pour some of the Karamjan rum over the silk.")
|
||||
return@onUseWith true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,35 @@
|
|||
package rs09.game.interaction.item.withitem
|
||||
|
||||
import api.addItem
|
||||
import api.removeItem
|
||||
import api.sendDialogue
|
||||
import org.rs09.consts.Items
|
||||
import rs09.game.interaction.InteractionListener
|
||||
|
||||
class SkullSceptreCombiner : InteractionListener() {
|
||||
override fun defineListeners() {
|
||||
onUseWith(ITEM, Items.LEFT_SKULL_HALF_9008, Items.RIGHT_SKULL_HALF_9007) {player, used, with ->
|
||||
if(removeItem(player, used.asItem()) && removeItem(player, with.asItem())){
|
||||
addItem(player, Items.STRANGE_SKULL_9009)
|
||||
sendDialogue(player, "The two halves of the skull fit perfectly.")
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
onUseWith(ITEM, Items.BOTTOM_OF_SCEPTRE_9011, Items.TOP_OF_SCEPTRE_9010) {player, used, with ->
|
||||
if(removeItem(player, used.asItem()) && removeItem(player, with.asItem())){
|
||||
addItem(player, Items.RUNED_SCEPTRE_9012)
|
||||
sendDialogue(player, "The two halves of the sceptre fit perfectly.")
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
onUseWith(ITEM, Items.RUNED_SCEPTRE_9012, Items.STRANGE_SKULL_9009) {player, used, with ->
|
||||
if(removeItem(player, used.asItem()) && removeItem(player, with.asItem())){
|
||||
addItem(player, Items.SKULL_SCEPTRE_9013)
|
||||
sendDialogue(player,"The skull fits perfectly on top of the sceptre.")
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue