Repository reorganisation
Unified kotlin and java into just src/main Unified the rs09 and core packages Took all content out of the core package, and placed it into the new content package Reorganised all source code relating to content to be easier to find and explore
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
package content.global.skill.cooking;
|
||||
|
||||
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 plugin used to make a cake.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class CakeMakingPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Represents the bucket of milk item.
|
||||
*/
|
||||
private static final Item BUCKET_OF_MILK = new Item(1927);
|
||||
|
||||
/**
|
||||
* Represents the egg item.
|
||||
*/
|
||||
private static final Item EGG = new Item(1944);
|
||||
|
||||
/**
|
||||
* Represents the cake tin item.
|
||||
*/
|
||||
private static final Item CAKE_TIN = new Item(1887);
|
||||
|
||||
/**
|
||||
* Represents the pot of flour item.
|
||||
*/
|
||||
private static final Item POT_OF_FLOUR = new Item(1933);
|
||||
|
||||
/**
|
||||
* Represents the uncooked cake item.
|
||||
*/
|
||||
private static final Item UNCOOKED_CAKE = new Item(1889);
|
||||
|
||||
/**
|
||||
* Constructs a new {@code CakeMakingPlugin} {@code Object}.
|
||||
*/
|
||||
public CakeMakingPlugin() {
|
||||
super(1933);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(1887, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
if (event.getUsedItem().getId() == 1887 && ((Item) event.getUsedWith()).getId() == 1933 || event.getUsedWith().getName().equalsIgnoreCase("cake tin") && ((Item) event.getUsedItem()).getName().equalsIgnoreCase("pot of flour")) {
|
||||
if (event.getPlayer().getInventory().contains(1933, 1) && event.getPlayer().getInventory().contains(1927, 1) && event.getPlayer().getInventory().contains(1944, 1)) {
|
||||
if (event.getPlayer().getInventory().remove(BUCKET_OF_MILK, EGG, CAKE_TIN, POT_OF_FLOUR)) {
|
||||
event.getPlayer().getInventory().add(UNCOOKED_CAKE);
|
||||
event.getPlayer().getPacketDispatch().sendMessage("You mix the milk, flour and egg together to make a raw cake mix.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package content.global.skill.cooking
|
||||
|
||||
import core.game.interaction.NodeUsageEvent
|
||||
import core.game.interaction.UseWithHandler
|
||||
import core.game.node.item.Item
|
||||
import core.game.system.task.Pulse
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.plugin.Initializable
|
||||
import core.plugin.Plugin
|
||||
import org.rs09.consts.Items
|
||||
|
||||
@Initializable
|
||||
class ChocolateBarCutter : UseWithHandler(946){
|
||||
override fun newInstance(arg: Any?): Plugin<Any> {
|
||||
addHandler(1973, ITEM_TYPE, this)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun handle(event: NodeUsageEvent?): Boolean {
|
||||
event ?: return false
|
||||
val player = event.player
|
||||
player.pulseManager.run(object : Pulse(1){
|
||||
val cut_animation = Animation(1989)
|
||||
override fun pulse(): Boolean {
|
||||
super.setDelay(4)
|
||||
val amount = player.inventory.getAmount(Items.CHOCOLATE_BAR_1973)
|
||||
if(amount > 0) player.inventory.remove(Item(1973)).also { player.animator.animate(cut_animation); player.inventory.add(Item(1975)) }
|
||||
return amount <= 0
|
||||
}
|
||||
})
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package content.global.skill.cooking;
|
||||
|
||||
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 make a coconut.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class CoconutMakePlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Represents the items related to coconut making plugin.
|
||||
*/
|
||||
private static final Item[] ITEMS = new Item[] { new Item(5974, 1), new Item(5976, 1), new Item(229), new Item(5935, 1), new Item(5978) };
|
||||
|
||||
/**
|
||||
* Constructs a new {@code CoconutMakePlugin} {@code Object}.
|
||||
*/
|
||||
public CoconutMakePlugin() {
|
||||
super(5974, 5976);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(2347, ITEM_TYPE, this);
|
||||
addHandler(229, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
final Item usedWith = (Item) event.getUsedWith();
|
||||
if (usedWith.getId() == 5974 && event.getUsedItem().getId() == 2347 || usedWith.getId() == 2347 && event.getUsedItem().getId() == 5974) {
|
||||
player.getInventory().remove(ITEMS[0]);
|
||||
player.getInventory().add(ITEMS[1]);
|
||||
player.getPacketDispatch().sendMessage("You crush the coconut with a hammer.");
|
||||
}
|
||||
if (usedWith.getId() == 5976 && event.getUsedItem().getId() == 229 || usedWith.getId() == 229 && event.getUsedItem().getId() == 5976) {
|
||||
player.getInventory().remove(ITEMS[1]);
|
||||
player.getInventory().remove(ITEMS[2]);
|
||||
player.getInventory().add(ITEMS[3]);
|
||||
player.getInventory().add(ITEMS[4]);
|
||||
player.getPacketDispatch().sendMessage("You overturn the coconut into a vial.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,153 @@
|
||||
package content.global.skill.cooking;
|
||||
|
||||
import org.rs09.consts.Items;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public enum CookableItems {
|
||||
/** meats */
|
||||
CHICKEN(2140,2138,2144,1,30,34,128,512),
|
||||
UGTHANKI(2140,2138,2144,1,40,100,0,512),
|
||||
RABBIT(3228,3226,7222,1,30,34,128,512),
|
||||
CRAB(7521, 7518, 7520,21, 100, 62,85,438),
|
||||
|
||||
/** fish */
|
||||
CRAYFISH(13433, 13435, 13437,1, 30, 34,128,512),
|
||||
SHRIMP(315, 317, 7954,1, 30, 34,128,512),
|
||||
KARAMBWANJI(3151, 3150, 592,1, 10, 28,128,512),
|
||||
SARDINE(325, 327, 369,1, 40, 38,118,492),
|
||||
ANCHOVIES(319, 321, 323,1, 30, 34,128,512),
|
||||
HERRING(347, 345, 357,5, 50, 41,108,472),
|
||||
MACKEREL(355, 353, 357,10, 60, 45,98,452),
|
||||
TROUT(333, 335, 343,15, 70, 50,88,432),
|
||||
COD(339, 341, 343,18, 75, 52,74,420),
|
||||
PIKE(351, 349, 343,20, 80, 53,78,412),
|
||||
SALMON(329, 331, 343,25, 90, 58,68,392),
|
||||
SLIMY_EEL(3381, 3379, 3383,28, 95, 58,72,406),
|
||||
TUNA(361, 359, 367,30, 100, 65,58,372),
|
||||
RAINBOW_FISH(10136, 10138, 10140,35, 110, 60,48,387),
|
||||
CAVE_EEL(5003, 5001, 5002,38, 115, 74,42,386),
|
||||
LOBSTER(379, 377, 381,40, 120, 74,38,332),
|
||||
BASS(365, 363, 367,43, 130, 79,28,312),
|
||||
SWORDFISH(373, 371, 375,45, 140, 86,18,292),
|
||||
LAVA_EEL(2149, 2148, 3383,53, 30, 53,12,282),
|
||||
MONKFISH(7946, 7944, 7948,62, 150, 92,11,275),
|
||||
SHARK(385, 383, 387,80, 210, 100,0,202),
|
||||
SEA_TURTLE(397, 395, 399,82, 212, 100,0,202),
|
||||
MANTA_RAY(391, 389, 393,91, 216, 100,0,202),
|
||||
KARAMBWAN(3144, 3142, 3146,30, 190, 100,0,255),
|
||||
|
||||
/** snails */
|
||||
THIN_SNAIL(3369, 3363, 3375,12, 70, 47,109,502),
|
||||
LEAN_SNAIL(3371, 3365, 3375,17, 80, 50,100,486),
|
||||
FAT_SNAIL(3373, 3367, 3375,22, 95, 56,95,456),
|
||||
|
||||
//Bread
|
||||
BREAD(2309, 2307, 2311,1,40,37,118,492),
|
||||
|
||||
//Cake
|
||||
CAKE(1891, 1889, 1903, 40, 180, 74,38,332),
|
||||
|
||||
//Beef(s) (Rat, Bear, Cow, Yak)
|
||||
BEEF(2142,2132,2146,1,30,34,128,512),
|
||||
RAT_MEAT(2142,2134,2146,1,30,34,128,512),
|
||||
BEAR_MEAT(2142,2136,2146,1,30,34,128,512),
|
||||
YAK_MEAT(2142,10816,2146,1,30,34,128,512),
|
||||
|
||||
//Skewered foods
|
||||
SKEWER_ROAST_BEAST(9988, 9986, 9990,21, 99, 82,108,496),
|
||||
SKEWER_CHOMPY(2878, 2876, 7226,30, 140, 99,85,476),
|
||||
SKEWER_JUBBLY(7568, 7566, 7570,41, 160, 140,75,456),
|
||||
SKEWER_ROAST_BIRD(9980, 9984, 9982,11, 62, 99,115,502),
|
||||
SKEWER_ROAST_RABBIT(7223, 7224, 7222,16, 72, 99,113,499),
|
||||
|
||||
//Pies
|
||||
PIE_REDBERRY(2325, 2321, 2329, 10, 78, 50,78,412),
|
||||
PIE_MEAT(2327, 2319, 2329, 20, 110, 53,78,412),
|
||||
PIE_MUD(7170, 7168, 2329, 29,128,63,78,412),
|
||||
PIE_APPLE(2323,2317,2329,30,130,63,78,412),
|
||||
GARDEN_PIE(7178,7176,2329,34,138, 68,78,412),
|
||||
FISH_PIE(7188,7186,2329,47,164,74,78,412),
|
||||
ADMIRAL_PIE(7198,7196,2329,70,210,94,78,412),
|
||||
WILD_PIE(7208,7206,2329,85,240,140,78,412),
|
||||
SUMMER_PIE(7218,7216,2329,95,260,160,78,412),
|
||||
|
||||
//Pizzas
|
||||
PIZZA_PLAIN(2289, 2287,2305, 35, 143, 68,48,352),
|
||||
|
||||
//Bowl foods
|
||||
BOWL_STEW(2003, 2001, 2005,25, 117, 58,68,392),
|
||||
BOWL_NETTLE(4239, 4237, 4239,20, 52, 1,68,392),
|
||||
BOWL_EGG(7078, 7076, 7090,13, 50, 48,68,392),
|
||||
BOWL_ONION(7084, 1871, 7092,43, 60, 77,68,392),
|
||||
BOWL_MUSHROOM(7082, 7080, 7094,46, 60, 90,68,392),
|
||||
|
||||
/* Vegetables */
|
||||
BAKED_POTATO(6701, 1942, 6699, 7, 15, 41, 108, 472),
|
||||
SWEETCORN(5988, 5986, 5990, 28, 104, 54, 90, 424),
|
||||
|
||||
//Miscellaneous
|
||||
RAW_OOMLIE(Items.RAW_OOMLIE_2337, 0, Items.BURNT_OOMLIE_2426, 50, 0, 999,0,0), // always burns
|
||||
OOMLIE_WRAP(Items.COOKED_OOMLIE_WRAP_2343, Items.WRAPPED_OOMLIE_2341, Items.BURNT_OOMLIE_WRAP_2345, 50, 110, 999,0,0),
|
||||
SEAWEED(Items.SEAWEED_401,0,Items.SODA_ASH_1781,0,0,999,0,0),
|
||||
/**
|
||||
* Sinew gets overridden by BEEF in this enum, due to values being looked up by the items RAW id.
|
||||
* This gets corrected in {@link SinewCookingPulse}
|
||||
*/
|
||||
SINEW(Items.SINEW_9436,Items.RAW_BEEF_2132,Items.SINEW_9436,0,3,0,0,0);
|
||||
|
||||
public final static HashMap<Integer,CookableItems>cookingMap = new HashMap<>();
|
||||
public final static HashMap<Integer, CookableItems>intentionalBurnMap = new HashMap<>();
|
||||
public final int raw,cooked,level,burnLevel,burnt;
|
||||
public final double experience;
|
||||
double low,high;
|
||||
CookableItems(int cooked, int raw, int burnt, int level, double experience, int burnLevel, double low, double high){
|
||||
this.raw = raw;
|
||||
this.cooked = cooked;
|
||||
this.burnt = burnt;
|
||||
this.level = level;
|
||||
this.experience = experience;
|
||||
this.burnLevel = burnLevel;
|
||||
this.low = low;
|
||||
this.high = high;
|
||||
}
|
||||
|
||||
static{
|
||||
CookableItems[] cookableItems = values();
|
||||
int cookableItemsLength = cookableItems.length;
|
||||
for(int x = 0; x < cookableItemsLength; x++){
|
||||
CookableItems item = cookableItems[x];
|
||||
cookingMap.putIfAbsent(item.raw,item);
|
||||
intentionalBurnMap.putIfAbsent(item.cooked,item);
|
||||
}
|
||||
}
|
||||
|
||||
public static CookableItems forId(int id){
|
||||
return cookingMap.get(id);
|
||||
}
|
||||
|
||||
public static Item getCooked(int id){
|
||||
return new Item(cookingMap.get(id).cooked);
|
||||
}
|
||||
|
||||
public static Item getBurnt(int id){
|
||||
return new Item(cookingMap.get(id).burnt);
|
||||
}
|
||||
|
||||
public static Item getRaw(int id){
|
||||
return new Item(cookingMap.get(id).raw);
|
||||
}
|
||||
|
||||
public static boolean intentionalBurn(int id){
|
||||
return (intentionalBurnMap.get(id) != null);
|
||||
}
|
||||
|
||||
public static Item getIntentionalBurn(int id){
|
||||
return new Item(intentionalBurnMap.get(id).burnt);
|
||||
}
|
||||
|
||||
public static int getBurnLevel(int id){
|
||||
return cookingMap.get(id).burnLevel;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
package content.global.skill.cooking
|
||||
|
||||
import core.api.*
|
||||
import core.cache.def.impl.ItemDefinition
|
||||
import core.game.node.scenery.Scenery
|
||||
import content.global.skill.cooking.CookableItems
|
||||
import content.global.skill.cooking.CookingRewrite.Companion.cook
|
||||
import core.net.packet.PacketRepository
|
||||
import core.net.packet.context.ChildPositionContext
|
||||
import core.net.packet.out.RepositionChild
|
||||
import org.rs09.consts.Items
|
||||
import core.game.dialogue.DialogueFile
|
||||
import core.tools.START_DIALOGUE
|
||||
|
||||
/**
|
||||
* @author Ceikry
|
||||
* @author bushtail - fixing it up
|
||||
*/
|
||||
|
||||
class CookingDialogue(vararg val args: Any) : DialogueFile(){
|
||||
var initial = 0
|
||||
var product = 0
|
||||
var `object`: Scenery? = null
|
||||
var sinew = false
|
||||
var itemid = 0
|
||||
override fun handle(componentID: Int, buttonID: Int) {
|
||||
when(stage){
|
||||
START_DIALOGUE -> {
|
||||
when (args.size) {
|
||||
2 -> {
|
||||
initial = args.get(0) as Int
|
||||
if (CookableItems.intentionalBurn(initial)) { // checks intentional burning
|
||||
product = CookableItems.getIntentionalBurn(initial).id
|
||||
} else {
|
||||
product = CookableItems.forId(initial).cooked
|
||||
}
|
||||
`object` = args.get(1) as Scenery
|
||||
}
|
||||
5 -> {
|
||||
initial = args.get(0) as Int
|
||||
product = args.get(1) as Int
|
||||
sinew = args.get(2) as Boolean
|
||||
`object` = args.get(3) as Scenery
|
||||
itemid = args.get(4) as Int
|
||||
if (sinew) {
|
||||
options(
|
||||
"Dry the meat into sinew",
|
||||
"Cook the meat"
|
||||
)
|
||||
stage = 100
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
display()
|
||||
}
|
||||
|
||||
1 -> {
|
||||
end()
|
||||
val amount = getAmount(buttonID)
|
||||
when (amount) {
|
||||
-1 -> sendInputDialogue(player!!, true, "Enter the amount:") { value ->
|
||||
if (value is String) {
|
||||
cook(player!!, `object`, initial, product, value.toInt())
|
||||
} else {
|
||||
cook(player!!, `object`, initial, product, value as Int)
|
||||
}
|
||||
}
|
||||
|
||||
else -> {
|
||||
end()
|
||||
cook(player!!, `object`, initial, product, amount)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
100 -> {
|
||||
when (buttonID) {
|
||||
1 -> {
|
||||
product = Items.SINEW_9436
|
||||
display(Items.COOKED_MEAT_2142)
|
||||
}
|
||||
2 -> {
|
||||
product = CookableItems.forId(initial).cooked
|
||||
display()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun getAmount(buttonId: Int): Int {
|
||||
when (buttonId) {
|
||||
5 -> return 1
|
||||
4 -> return 5
|
||||
3 -> return -1
|
||||
2 -> return player!!.inventory.getAmount(initial)
|
||||
}
|
||||
return -1
|
||||
}
|
||||
|
||||
fun display(vararg args : Int) {
|
||||
player!!.interfaceManager.openChatbox(307)
|
||||
PacketRepository.send(RepositionChild::class.java, ChildPositionContext(player, 307, 3, 60, 90))
|
||||
PacketRepository.send(RepositionChild::class.java, ChildPositionContext(player, 307, 2, 208, 20))
|
||||
player!!.packetDispatch.sendItemZoomOnInterface(if(args.size == 1) args[0] else product, 160, 307, 2)
|
||||
player!!.packetDispatch.sendString(ItemDefinition.forId(product).name, 307, 3)
|
||||
stage = 1
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
/*
|
||||
package core.game.node.entity.skill.cooking;
|
||||
|
||||
import core.game.dialogue.DialoguePlugin;
|
||||
import org.crandor.game.content.global.consumable.Consumables;
|
||||
import org.crandor.game.content.global.consumable.Food;
|
||||
import core.game.node.entity.skill.cooking.CookableItems;
|
||||
import core.game.node.entity.skill.cooking.CookingPulse;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.entity.player.link.RunScript;
|
||||
import org.crandor.game.node.item.Item;
|
||||
import org.crandor.game.node.object.GameObject;
|
||||
import org.crandor.net.packet.PacketRepository;
|
||||
import org.crandor.net.packet.context.ChildPositionContext;
|
||||
import org.crandor.net.packet.out.RepositionChild;
|
||||
import org.crandor.plugin.InitializablePlugin;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the dialogue used to handle the amount to make of a cookable item.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*//*
|
||||
|
||||
@InitializablePlugin
|
||||
public final class CookingDialoguePlugin extends DialoguePlugin {
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the cooking dialogue id.
|
||||
*//*
|
||||
|
||||
public static final int DIALOGUE_ID = 43989;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the sinew item.
|
||||
*//*
|
||||
|
||||
private static final Item SINEW = new Item(9436);
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the meat item.
|
||||
*//*
|
||||
|
||||
private static final Item MEAT = new Item(2142);
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the food we're cooking.
|
||||
*//*
|
||||
|
||||
private int food;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the obejct we're cooking on.
|
||||
*//*
|
||||
|
||||
private GameObject object;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Constructs a new {@code CookingDialoguePlugin} {@code Object}.
|
||||
*//*
|
||||
|
||||
public CookingDialoguePlugin() {
|
||||
*/
|
||||
/**
|
||||
* empty.
|
||||
*//*
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* Constructs a new {@code CookingDialoguePlugin} {@code Object}.
|
||||
* @param player the player.
|
||||
*//*
|
||||
|
||||
public CookingDialoguePlugin(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new CookingDialoguePlugin(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
food = ((int) args[0]);
|
||||
object = ((GameObject) args[1]);
|
||||
if (args.length == 3) {
|
||||
interpreter.sendOptions("Select an Option", "Dry the meat into sinew.", "Cook the meat.");
|
||||
stage = 100;
|
||||
return true;
|
||||
}
|
||||
if (player.getInventory().getAmount(CookableItems.forId(food).raw) == 1) {
|
||||
end();
|
||||
cook(player,object,food,1);
|
||||
return true;
|
||||
}
|
||||
display();
|
||||
stage = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
switch (stage) {
|
||||
case 0:
|
||||
end();
|
||||
int amount = getAmount(buttonId);
|
||||
if (amount == -1) {
|
||||
player.setAttribute("runscript", new RunScript() {
|
||||
@Override
|
||||
public boolean handle() {
|
||||
int amount = (int) value;
|
||||
cook(player, object, food, amount);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
player.getDialogueInterpreter().sendInput(false, "Enter the amount:");
|
||||
} else if (amount == 28) {
|
||||
player.setAttribute("runscript", new RunScript() {
|
||||
@Override
|
||||
public boolean handle() {
|
||||
cook(player, object, food, amount);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
cook(player, object, food, amount);
|
||||
break;
|
||||
*/
|
||||
/*case 100:
|
||||
switch (buttonId) {
|
||||
case 1:
|
||||
food = Consumables.forFood(SINEW);
|
||||
display();
|
||||
break;
|
||||
case 2:
|
||||
food = Consumables.forFood(MEAT);
|
||||
display();
|
||||
break;
|
||||
}
|
||||
break;*//*
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { DIALOGUE_ID };
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* Method used to display the content food.
|
||||
*//*
|
||||
|
||||
public void display() {
|
||||
player.getInterfaceManager().openChatbox(307);
|
||||
PacketRepository.send(RepositionChild.class, new ChildPositionContext(player, 307, 3, 60, 79));
|
||||
player.getPacketDispatch().sendItemZoomOnInterface(CookableItems.getRaw(food).getId(), 160, 307, 2);
|
||||
player.getPacketDispatch().sendString(CookableItems.getRaw(food).getName(), 307, 3);
|
||||
stage = 0;
|
||||
}
|
||||
|
||||
public void cook(Player player, GameObject object, int food, int amount){
|
||||
player.getPulseManager().run(new CookingPulse(player,object,food,amount));
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* Method used to get the amount to make based off the button id.
|
||||
* @param buttonId the button id.
|
||||
* @return the amount to make.
|
||||
*//*
|
||||
|
||||
private final int getAmount(final int buttonId) {
|
||||
switch (buttonId) {
|
||||
case 5:
|
||||
return 1;
|
||||
case 4:
|
||||
return 5;
|
||||
case 3:
|
||||
return -1;
|
||||
case 2:
|
||||
return 28;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,263 @@
|
||||
/*
|
||||
package core.game.node.entity.skill.cooking;
|
||||
|
||||
import org.crandor.cache.def.impl.ItemDefinition;
|
||||
import core.game.dialogue.DialoguePlugin;
|
||||
import org.crandor.game.content.global.consumable.Consumables;
|
||||
import org.crandor.game.content.global.consumable.Food;
|
||||
import core.game.node.entity.skill.cooking.CookableItems;
|
||||
import core.game.node.entity.skill.cooking.CookingPulse;
|
||||
import org.crandor.game.interaction.NodeUsageEvent;
|
||||
import org.crandor.game.interaction.UseWithHandler;
|
||||
import org.crandor.game.node.Node;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.entity.player.link.RunScript;
|
||||
import org.crandor.game.node.item.Item;
|
||||
import org.crandor.game.node.object.GameObject;
|
||||
import org.crandor.game.world.map.Direction;
|
||||
import org.crandor.game.world.map.Location;
|
||||
import org.crandor.net.packet.PacketRepository;
|
||||
import org.crandor.net.packet.context.ChildPositionContext;
|
||||
import org.crandor.net.packet.out.RepositionChild;
|
||||
import org.crandor.plugin.InitializablePlugin;
|
||||
import org.crandor.plugin.Plugin;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Handles the interaction of a raw food (or if intentionally burning cooked food)
|
||||
* with a range/fire.
|
||||
* @author ceik
|
||||
*//*
|
||||
|
||||
@InitializablePlugin
|
||||
public class CookingPlugin extends UseWithHandler {
|
||||
|
||||
public static int DIALOGUE_ID = 43989;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the objects allowed to cook {@code Food} on.
|
||||
*//*
|
||||
|
||||
public static final int[] OBJECTS = new int[] { 21302, 13528, 13529, 13533, 13531, 13536, 13539, 13542, 2728, 2729, 2730, 2731, 2732, 2859, 3038, 3039, 3769, 3775, 4265, 4266, 5249, 5499, 5631, 5632, 5981, 9682, 10433, 11404, 11405, 11406, 12102, 12796, 13337, 13881, 14169, 14919, 15156, 20000, 20001, 21620, 21792, 22713, 22714, 23046, 24283, 24284, 25155, 25156, 25465, 25730, 27297, 29139, 30017, 32099, 33500, 34495, 34546, 36973, 37597, 37629, 37726, 114, 4172, 5275, 8750, 16893, 22154, 34410, 34565, 114, 9085, 9086, 9087, 12269, 15398, 25440, 25441, 2724, 2725, 2726, 4618, 4650, 5165, 6093, 6094, 6095, 6096, 8712, 9439, 9440, 9441, 10824, 17640, 17641, 17642, 17643, 18039, 21795, 24285, 24329, 27251, 33498, 35449, 36815, 36816, 37426, 40110 };
|
||||
|
||||
*/
|
||||
/**
|
||||
* Constructs a new {@code CookingPlugin} {@code Object}.
|
||||
*//*
|
||||
|
||||
public CookingPlugin() {
|
||||
super(2140, 1861, 3228, 7521, 3151, 325, 319, 347, 355, 333, 339, 351, 329, 3381, 361, 10136, 5003, 379, 365, 373, 2149, 7946, 385, 397, 391, 3369, 3371, 3373, 1893, 1895, 1897, 1899, 1901, 1963, 2102, 2120, 2108, 5972, 5504, 1982, 1965, 1957, 5988, 1781, 6701, 6703, 6705, 7056, 7058, 7060, 1933, 1783, 1927, 1929, 6032, 6034, 2011, 227, 1921, 1937, 7934, 7086, 4239, 7068, 7086, 2003, 7078, 7072, 4239, 7062, 7064, 7084, 1871, 7082, 2309, 1891, 1967, 1971, 2142, 9436, 2142, 2142, 2325, 2333, 2327, 2331, 7170, 2323, 2335, 7178, 7180, 7188, 7190, 7198, 7200, 7208, 7210, 7218, 7220, 2289, 2291, 2293, 2295, 2297, 2299, 2301, 2303, 315, 9988, 2878, 7568, 9980, 7223, 5982, 598, 4293, 10816, 2138, 2134, 3142, 2136, 1859, 3226, 7518, 3150, 327, 321, 345, 353, 335, 341, 349, 331, 3379, 359, 10138, 5001, 377, 363, 371, 2148, 7944, 383, 395, 389, 3363, 3365, 3367, 5986, 401, 1942, 4237, 2001, 7076, 1871, 7080, 2307, 1889, 2132, 2132, 2132, 2132, 2321, 2319, 7168, 2317, 7176, 7186, 7196, 7206, 7216, 2287, 317, 9986, 2876, 7566, 9984, 7224);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
new CookingDialoguePlugin().init();
|
||||
for (int object : OBJECTS) {
|
||||
addHandler(object, OBJECT_TYPE, this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final GameObject object = (GameObject) event.getUsedWith();
|
||||
final int food = event.getUsedItem().getId();
|
||||
//handles intentional burning (deprecates BurnMeatPlugin)
|
||||
if(CookableItems.intentionalBurn(food)){
|
||||
event.getPlayer().getPulseManager().run(new CookingPulse(event.getPlayer(),object,event.getUsedItem().getId(),true));
|
||||
return true;
|
||||
}
|
||||
event.getPlayer().getDialogueInterpreter().open(DIALOGUE_ID, food, event.getUsedWith());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Location getDestination(final Player player, final Node node) {
|
||||
if (node.getName().toLowerCase().equals("fire")) {
|
||||
return player.getLocation().getY() > node.getLocation().getY() ? node.getLocation().transform(0, 1, 0) : player.getLocation().getX() < node.getLocation().getX() ? node.getLocation().transform(-1, 0, 0) : player.getLocation().getX() > node.getLocation().getX() ? node.getLocation().transform(1, 0, 0) : node.getLocation().transform(0, -1, 0);
|
||||
} else {
|
||||
Direction direction = node.getDirection();
|
||||
if (direction == Direction.NORTH) {
|
||||
return node.getLocation().transform(1, 1, 0);
|
||||
} else if (direction == Direction.SOUTH) {
|
||||
return node.getLocation().transform(-1, 0, 0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public final class CookingDialoguePlugin extends DialoguePlugin {
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the sinew item.
|
||||
*//*
|
||||
|
||||
private final Item SINEW = new Item(9436);
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the meat item.
|
||||
*//*
|
||||
|
||||
private final Item MEAT = new Item(2142);
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the food we're cooking.
|
||||
*//*
|
||||
|
||||
private int food;
|
||||
|
||||
private int product;
|
||||
|
||||
private boolean nonFood = false;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Represents the obejct we're cooking on.
|
||||
*//*
|
||||
|
||||
private GameObject object;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Constructs a new {@code CookingDialoguePlugin} {@code Object}.
|
||||
*//*
|
||||
|
||||
public CookingDialoguePlugin() {
|
||||
*/
|
||||
/**
|
||||
* empty.
|
||||
*//*
|
||||
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* Constructs a new {@code CookingDialoguePlugin} {@code Object}.
|
||||
* @param player the player.
|
||||
*//*
|
||||
|
||||
public CookingDialoguePlugin(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new CookingDialoguePlugin(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
food = ((int) args[0]);
|
||||
if (args.length == 3){
|
||||
nonFood = true;
|
||||
stage = 0;
|
||||
product = (int)args[1];
|
||||
display();
|
||||
return true;
|
||||
}
|
||||
if (player.getInventory().getAmount(CookableItems.forId(food).raw) == 1) {
|
||||
end();
|
||||
cook(player,object,food,1);
|
||||
return true;
|
||||
}
|
||||
display();
|
||||
stage = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
switch (stage) {
|
||||
case 0:
|
||||
end();
|
||||
int amount = getAmount(buttonId);
|
||||
if (amount == -1) {
|
||||
player.setAttribute("runscript", new RunScript() {
|
||||
@Override
|
||||
public boolean handle() {
|
||||
int amount = (int) value;
|
||||
if(nonFood){
|
||||
cookNonFood(player,food,product,amount);
|
||||
return false;
|
||||
}
|
||||
cook(player, object, food, amount);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
player.getDialogueInterpreter().sendInput(false, "Enter the amount:");
|
||||
} else if (amount == 28) {
|
||||
player.setAttribute("runscript", new RunScript() {
|
||||
@Override
|
||||
public boolean handle() {
|
||||
if(nonFood){
|
||||
cookNonFood(player,food,product,amount);
|
||||
}
|
||||
cook(player, object, food, amount);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
if(nonFood){
|
||||
cookNonFood(player,food,product,amount);
|
||||
break;
|
||||
}
|
||||
cook(player, object, food, amount);
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { DIALOGUE_ID };
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* Method used to display the content food.
|
||||
*//*
|
||||
|
||||
public void display() {
|
||||
player.getInterfaceManager().openChatbox(307);
|
||||
PacketRepository.send(RepositionChild.class, new ChildPositionContext(player, 307, 3, 60, 79));
|
||||
player.getPacketDispatch().sendItemZoomOnInterface(nonFood ? product : CookableItems.getCooked(food).getId(), 160, 307, 2);
|
||||
player.getPacketDispatch().sendString(nonFood ? ItemDefinition.forId(product).getName() : CookableItems.getCooked(food).getName(), 307, 3);
|
||||
stage = 0;
|
||||
}
|
||||
|
||||
public void cookNonFood(Player player, int food, int product, int amount){
|
||||
player.getPulseManager().run(new CookingPulse(player,food,amount,product,false));
|
||||
}
|
||||
|
||||
public void cook(Player player, GameObject object, int food, int amount){
|
||||
player.getPulseManager().run(new CookingPulse(player,object,food,amount));
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* Method used to get the amount to make based off the button id.
|
||||
* @param buttonId the button id.
|
||||
* @return the amount to make.
|
||||
*//*
|
||||
|
||||
private final int getAmount(final int buttonId) {
|
||||
switch (buttonId) {
|
||||
case 5:
|
||||
return 1;
|
||||
case 4:
|
||||
return 5;
|
||||
case 3:
|
||||
return -1;
|
||||
case 2:
|
||||
return 28;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,244 @@
|
||||
/*
|
||||
package core.game.node.entity.skill.cooking;
|
||||
|
||||
import org.crandor.game.content.global.SkillcapePerks;
|
||||
import plugin.tutorial.TutorialSession;
|
||||
import plugin.tutorial.TutorialStage;
|
||||
import core.game.node.entity.skill.SkillPulse;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import org.crandor.game.node.entity.impl.Animator;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.entity.player.link.audio.Audio;
|
||||
import org.crandor.game.node.entity.player.link.diary.DiaryType;
|
||||
import org.crandor.game.node.item.Item;
|
||||
import org.crandor.game.node.object.GameObject;
|
||||
import org.crandor.game.system.task.Pulse;
|
||||
import org.crandor.game.world.update.flag.context.Animation;
|
||||
|
||||
import static org.crandor.tools.RandomFunction.RANDOM;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Pulse for cooking
|
||||
* @author ceik
|
||||
*//*
|
||||
|
||||
public final class CookingPulse extends Pulse {
|
||||
private static Player player;
|
||||
|
||||
private static GameObject node;
|
||||
|
||||
private static boolean intentionalBurn = false;
|
||||
|
||||
//range animation
|
||||
private static final Animation RANGE_ANIMATION = new Animation(883, Animator.Priority.HIGH);
|
||||
|
||||
//fire animation
|
||||
private static final Animation FIRE_ANIMATION = new Animation(897, Animator.Priority.HIGH);
|
||||
|
||||
//Cooking sound
|
||||
public static final Audio SOUND = new Audio(2393, 1, 1);
|
||||
|
||||
//food's ID
|
||||
private final int food;
|
||||
|
||||
//amount to cook
|
||||
private int amount;
|
||||
|
||||
//whether or not we are cooking food
|
||||
private boolean isFood = true;
|
||||
|
||||
*/
|
||||
/**
|
||||
* Constructs a new {@code CookingPulse} {@code Object}.
|
||||
* @param player the player.
|
||||
* @param node the object node (fire/range)
|
||||
* @param food the food to cook.
|
||||
* @param amount the amount to cook
|
||||
*//*
|
||||
|
||||
public CookingPulse(Player player, GameObject node, final int food, final int amount) {
|
||||
this.player = player;
|
||||
this.node = node;
|
||||
this.food = food;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* Another constructor for the Cooking Pulse, this time flags it as an intentional burn
|
||||
* @param player the player cooking
|
||||
* @param node the object being used to cook (range/fire)
|
||||
* @param food the item being cooked
|
||||
* @param intentionalBurn whether or not it's an intentional burn
|
||||
*//*
|
||||
|
||||
public CookingPulse(Player player, GameObject node, final int food, final boolean intentionalBurn) {
|
||||
this.player = player;
|
||||
this.food = food;
|
||||
this.amount = 1;
|
||||
this.intentionalBurn = intentionalBurn;
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* handler for cooking non-food items
|
||||
* @param player the player cooking
|
||||
* @param item the item being cooked
|
||||
* @param amount the amount the player has
|
||||
* @param isFood whether we are cooking food
|
||||
*//*
|
||||
|
||||
public CookingPulse(Player player, final int item, int amount, int product, final boolean isFood){
|
||||
this.player = player;
|
||||
this.food = item;
|
||||
this.amount = amount;
|
||||
this.isFood = isFood;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
if (intentionalBurn || checkRequirements()) {
|
||||
super.start();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
if(intentionallyBurn(food) || !checkRequirements()){
|
||||
return true;
|
||||
}
|
||||
return reward();
|
||||
}
|
||||
|
||||
public boolean checkRequirements() { //check if the player has the requirements
|
||||
if (!node.isActive()) {
|
||||
return true;
|
||||
}
|
||||
//handle cook's assistant range
|
||||
if(node.getId() == 114 && !player.getQuestRepository().isComplete("Cook's Assistant")){
|
||||
player.getPacketDispatch().sendMessage("You need to have completed the Cook's Assistant quest in order to use that range.");
|
||||
return false;
|
||||
}
|
||||
if (player.getSkills().getLevel(Skills.COOKING) < CookableItems.forId(food).level) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a cooking level of " + CookableItems.forId(food).level + " to cook this.");
|
||||
return false;
|
||||
}
|
||||
int inventoryAmount = player.getInventory().getAmount(CookableItems.forId(food).raw);
|
||||
if (amount > inventoryAmount) {
|
||||
amount = inventoryAmount;
|
||||
}
|
||||
if (amount < 1) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void animate() {
|
||||
player.animate(getAnimation(node));
|
||||
}
|
||||
|
||||
public boolean reward() {
|
||||
if (getDelay() == 1) {
|
||||
setDelay(node.getName().toLowerCase().equals("range") ? 5 : 4);
|
||||
return false;
|
||||
}
|
||||
//handle tutorial stuff
|
||||
if(!TutorialSession.getExtension(player).finished()){
|
||||
updateTutorial(player);
|
||||
amount --;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (cook(player,node,isBurned(player,node,food),food)) {
|
||||
amount--;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return amount < 1;
|
||||
}
|
||||
|
||||
public boolean cook(final Player player, final GameObject object, final boolean burned, final int food) {
|
||||
Item item = CookableItems.getRaw(food);
|
||||
if(intentionalBurn){ //stops the cook function from being ran if we burning on purpose
|
||||
return false;
|
||||
}
|
||||
//lumbridge diary
|
||||
if (CookableItems.forId(food) != null && player.getInventory().remove(item)) {
|
||||
if (!burned) {
|
||||
player.getInventory().add(CookableItems.getCooked(food));
|
||||
} else {
|
||||
player.getInventory().add(CookableItems.getBurnt(food));
|
||||
}
|
||||
player.getSkills().addExperience(Skills.COOKING, burned ? 0 : CookableItems.forId(food).experience, true);
|
||||
player.getPacketDispatch().sendMessage(getMessage(item, burned));
|
||||
player.getAudioManager().send(SOUND);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean intentionallyBurn(int food){
|
||||
if(intentionalBurn && player.getInventory().remove(new Item(food))){ //only runs if it's flagged as intentional burning
|
||||
player.getInventory().add(CookableItems.getIntentionalBurn(food));
|
||||
player.getPacketDispatch().sendMessage("You deliberately burn the perfectly good piece of meat.");
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public String getMessage(Item food, boolean burned){
|
||||
if(!burned) {
|
||||
return "You manage to cook some " + food.getName().replace("Raw ", "");
|
||||
} else {
|
||||
return "You accidentally burn some " + food.getName().replace("Raw ","");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isBurned(final Player player, final GameObject object, int food) {
|
||||
double burn_stop = (double)CookableItems.getBurnLevel(food);
|
||||
if (SkillcapePerks.hasSkillcapePerk(player, SkillcapePerks.COOKING)) {
|
||||
return false;
|
||||
}
|
||||
if (player.getSkills().getLevel(Skills.COOKING) > burn_stop) {
|
||||
return false;
|
||||
}
|
||||
double burn_chance = 60.0 + (object.getName().equals("fire") ? 1.00 : 0) - (object.getId() == 114 ? 1.00 : 0);
|
||||
double cook_level = (double) player.getSkills().getLevel(Skills.COOKING);
|
||||
double lev_needed = (double) CookableItems.forId(food).level;
|
||||
double multi_a = (burn_stop - lev_needed);
|
||||
double burn_dec = (burn_chance / multi_a);
|
||||
double multi_b = (cook_level - lev_needed);
|
||||
burn_chance -= (multi_b * burn_dec);
|
||||
double randNum = RANDOM.nextDouble() * 100.0;
|
||||
return !(burn_chance <= randNum);
|
||||
}
|
||||
|
||||
public boolean updateTutorial(Player player){
|
||||
if (TutorialSession.getExtension(player).getStage() == 14) {
|
||||
TutorialStage.load(player, 15, false);
|
||||
return cook(player, node,true, food);
|
||||
} else if (TutorialSession.getExtension(player).getStage() == 15) {
|
||||
TutorialStage.load(player, 16, false);
|
||||
return cook(player, node, false, food);
|
||||
}
|
||||
if (TutorialSession.getExtension(player).getStage() == 20) {
|
||||
TutorialStage.load(player, 21, false);
|
||||
return cook(player, node, false, food);
|
||||
}
|
||||
return cook(player, node, isBurned(player,node,food),food);
|
||||
}
|
||||
|
||||
*/
|
||||
/**
|
||||
* Gets the animation to use based on the interacting object.
|
||||
* @param object the object.
|
||||
* @return the animation.
|
||||
*//*
|
||||
|
||||
private final Animation getAnimation(final GameObject object) {
|
||||
return !object.getName().toLowerCase().equals("fire") ? RANGE_ANIMATION : FIRE_ANIMATION;
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -0,0 +1,132 @@
|
||||
package content.global.skill.cooking;
|
||||
|
||||
import content.global.skill.cooking.recipe.Recipe;
|
||||
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.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
import core.game.dialogue.SkillDialogueHandler.SkillDialogue;
|
||||
import core.game.dialogue.SkillDialogueHandler;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a cooking recipe plugin. This is used to handle the multiple
|
||||
* recipes used in cooking these recipes can range from making a pizza or making
|
||||
* a pie.
|
||||
* @author 'Vexia
|
||||
* @version 1.9
|
||||
*/
|
||||
@Initializable
|
||||
public final class CookingRecipePlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code CookingRecipePlugin} {@code Object}.
|
||||
*/
|
||||
public CookingRecipePlugin() {
|
||||
super(getAllowedNodes());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
for (Recipe recipe : Recipe.RECIPES) {
|
||||
for (Item ingredient : recipe.getIngredients()) {
|
||||
addHandler(ingredient.getId(), ITEM_TYPE, this);
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
Recipe recipe = null;
|
||||
// TODO: Transitioning to a Listener would save an O(n) pass through the recipes list on every use-with
|
||||
for (Recipe temp : Recipe.RECIPES) {
|
||||
if (temp.isSingular()) {
|
||||
if (temp.getBase().getId() == event.getUsedItem().getId() || temp.getBase().getId() == event.getBaseItem().getId()) {
|
||||
for (Item ingredient : temp.getIngredients()) {
|
||||
if (ingredient.getId() == event.getBaseItem().getId() || ingredient.getId() == event.getUsedItem().getId()) {
|
||||
recipe = temp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Item part = null;
|
||||
Item ingredient = null;
|
||||
for (int k = 0; k < temp.getParts().length; k++) {
|
||||
for (int i = 0; i < temp.getIngredients().length; i++) {
|
||||
part = temp.getParts()[k];
|
||||
ingredient = temp.getIngredients()[i];
|
||||
if (part.getId() == event.getUsedItem().getId() && ingredient.getId() == event.getBaseItem().getId() || part.getId() == event.getBaseItem().getId() && ingredient.getId() == event.getUsedItem().getId()) {
|
||||
if (k == i) {// represents that this ingredient can
|
||||
// mix with the other.
|
||||
recipe = temp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (recipe != null) {
|
||||
final Player player = event.getPlayer();
|
||||
final Recipe recipe_ = recipe;
|
||||
SkillDialogueHandler handler = new SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, recipe.getProduct()) {
|
||||
@Override
|
||||
public void create(final int amount, int index) {
|
||||
player.getPulseManager().run(new Pulse(2) {
|
||||
int count = 0;
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
recipe_.mix(player, event);
|
||||
return ++count >= amount;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAll(int index) {
|
||||
return player.getInventory().getAmount(recipe_.getBase());
|
||||
}
|
||||
};
|
||||
if (player.getInventory().getAmount(recipe.getBase()) == 1) {
|
||||
recipe_.mix(player, event);
|
||||
} else {
|
||||
handler.open();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to get the allowed nodes for this plugin.
|
||||
* @return the allowed nodes.
|
||||
*/
|
||||
private final static int[] getAllowedNodes() {
|
||||
List<Integer> bases = new ArrayList<>(10);
|
||||
for (Recipe recipe : Recipe.RECIPES) {
|
||||
for (Item base : recipe.getParts()) {
|
||||
if (bases.contains(base.getId())) {
|
||||
continue;
|
||||
}
|
||||
bases.add(base.getId());
|
||||
}
|
||||
if (bases.contains(recipe.getBase().getId())) {
|
||||
continue;
|
||||
}
|
||||
bases.add(recipe.getBase().getId());
|
||||
}
|
||||
int[] baseArray = new int[bases.size()];
|
||||
for (int i = 0; i < bases.size(); i++) {
|
||||
baseArray[i] = bases.get(i);
|
||||
}
|
||||
return baseArray;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package content.global.skill.cooking
|
||||
|
||||
import core.game.interaction.IntType
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.item.Item
|
||||
import core.game.node.scenery.Scenery
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.Items.BREAD_DOUGH_2307
|
||||
import org.rs09.consts.Items.RAW_BEAR_MEAT_2136
|
||||
import org.rs09.consts.Items.RAW_BEEF_2132
|
||||
import org.rs09.consts.Items.SEAWEED_401
|
||||
import org.rs09.consts.Items.UNCOOKED_CAKE_1889
|
||||
|
||||
/**
|
||||
* @author Ceikry
|
||||
* @author bushtail - added bear meat for sinew making
|
||||
*/
|
||||
class CookingRewrite : InteractionListener {
|
||||
|
||||
val RAW_FOODS: IntArray
|
||||
|
||||
init {
|
||||
val list = CookableItems.values().map { it.raw }.toMutableList()
|
||||
list.add(Items.COOKED_MEAT_2142)
|
||||
list.add(RAW_BEEF_2132)
|
||||
list.add(RAW_BEAR_MEAT_2136)
|
||||
list.add(SEAWEED_401)
|
||||
RAW_FOODS = list.toIntArray()
|
||||
}
|
||||
|
||||
override fun defineListeners() {
|
||||
|
||||
onUseWith(IntType.SCENERY,RAW_FOODS, *COOKING_OBJs){ player, used, with ->
|
||||
val item = used.asItem()
|
||||
val obj = with.asScenery()
|
||||
val range = obj.name.toLowerCase().contains("range")
|
||||
when (item.id) {
|
||||
RAW_BEEF_2132, RAW_BEAR_MEAT_2136 -> if (range) {
|
||||
player.dialogueInterpreter.open(CookingDialogue(item.id,9436,true,obj,item.id))
|
||||
return@onUseWith true
|
||||
}
|
||||
BREAD_DOUGH_2307, UNCOOKED_CAKE_1889 -> if (!range) {
|
||||
player.packetDispatch.sendMessage("You need to cook this on a range.")
|
||||
return@onUseWith false
|
||||
}
|
||||
}
|
||||
|
||||
//cook a standard item
|
||||
player.dialogueInterpreter.open(CookingDialogue(item.id,obj))
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
companion object {
|
||||
val COOKING_OBJs = intArrayOf(24313,21302, 13528, 13529, 13533, 13531, 13536, 13539, 13542, 2728, 2729, 2730, 2731, 2732, 2859, 3038, 3039, 3769, 3775, 4265, 4266, 5249, 5499, 5631, 5632, 5981, 9682, 10433, 11404, 11405, 11406, 12102, 12796, 13337, 13881, 14169, 14919, 15156, 20000, 20001, 21620, 21792, 22713, 22714, 23046, 24283, 24284, 25155, 25156, 25465, 25730, 27297, 29139, 30017, 32099, 33500, 34495, 34546, 36973, 37597, 37629, 37726, 114, 4172, 5275, 8750, 16893, 22154, 34410, 34565, 114, 9085, 9086, 9087, 12269, 15398, 25440, 25441, 2724, 2725, 2726, 4618, 4650, 5165, 6093, 6094, 6095, 6096, 8712, 9374, 9439, 9440, 9441, 10824, 17640, 17641, 17642, 17643, 18039, 21795, 24285, 24329, 27251, 33498, 35449, 36815, 36816, 37426, 40110, 10377)
|
||||
|
||||
@JvmStatic
|
||||
fun cook(player: Player, `object`: Scenery?, initial: Int, product: Int, amount: Int) {
|
||||
val food = Item(initial)
|
||||
if (food.name.toLowerCase().contains("pizza")) {
|
||||
player.pulseManager.run(PizzaCookingPulse(player, `object`, initial, product, amount))
|
||||
} else if (food.name.toLowerCase().contains("pie")) {
|
||||
player.pulseManager.run(PieCookingPulse(player, `object`, initial, product, amount))
|
||||
} else if (CookableItems.intentionalBurn(initial)) {
|
||||
player.pulseManager.run(IntentionalBurnPulse(player, `object`, initial, product, amount))
|
||||
} else {
|
||||
player.pulseManager.run(StandardCookingPulse(player, `object`, initial, product, amount))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package content.global.skill.cooking
|
||||
|
||||
import core.api.*
|
||||
import core.game.event.ResourceProducedEvent
|
||||
import core.game.node.entity.skill.Skills
|
||||
import core.game.node.item.Item
|
||||
import org.rs09.consts.Items
|
||||
import core.game.dialogue.DialogueFile
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.interaction.IntType
|
||||
|
||||
class DoughMakingListener : InteractionListener {
|
||||
companion object {
|
||||
private val FULL_WATER_CONTAINERS_TO_EMPTY_CONTAINERS = hashMapOf(
|
||||
Items.BUCKET_OF_WATER_1929 to Items.BUCKET_1925,
|
||||
Items.BOWL_OF_WATER_1921 to Items.BOWL_1923,
|
||||
Items.JUG_OF_WATER_1937 to Items.JUG_1935
|
||||
)
|
||||
}
|
||||
|
||||
override fun defineListeners() {
|
||||
onUseWith(
|
||||
IntType.ITEM,
|
||||
FULL_WATER_CONTAINERS_TO_EMPTY_CONTAINERS.keys.toIntArray(),
|
||||
Items.POT_OF_FLOUR_1933
|
||||
) { player, waterContainer, flourContainer ->
|
||||
openDialogue(player, DoughMakeDialogue(waterContainer.asItem(), flourContainer.asItem()))
|
||||
return@onUseWith true
|
||||
}
|
||||
}
|
||||
|
||||
private class DoughMakeDialogue(val waterContainer: Item, val flourContainer: Item) : DialogueFile() {
|
||||
companion object {
|
||||
private const val STAGE_PRESENT_OPTIONS = 0
|
||||
private const val STAGE_PROCESS_OPTION = 1
|
||||
|
||||
private enum class DoughProduct(val itemId: Int, val itemName: String, val requiredCookingLevel: Int) {
|
||||
BREAD_DOUGH(Items.BREAD_DOUGH_2307, getItemName(Items.BREAD_DOUGH_2307), 1),
|
||||
PASTRY_DOUGH(Items.PASTRY_DOUGH_1953, getItemName(Items.PASTRY_DOUGH_1953), 1),
|
||||
PIZZA_DOUGH(Items.PIZZA_BASE_2283, getItemName(Items.PIZZA_BASE_2283), 35),
|
||||
PITTA_DOUGH(Items.PITTA_DOUGH_1863, getItemName(Items.PITTA_DOUGH_1863), 58),
|
||||
}
|
||||
}
|
||||
|
||||
override fun handle(componentID: Int, buttonID: Int) {
|
||||
when (stage) {
|
||||
STAGE_PRESENT_OPTIONS -> {
|
||||
player!!.dialogueInterpreter.sendOptions(
|
||||
"What do you wish to make?",
|
||||
*(DoughProduct.values().map { "${it.itemName}." }.toTypedArray())
|
||||
).also { stage++ }
|
||||
}
|
||||
STAGE_PROCESS_OPTION -> runTask(player!!, 1) {
|
||||
end()
|
||||
val selectedDoughProduct = DoughProduct.values()[buttonID - 1]
|
||||
if (hasLevelDyn(player!!, Skills.COOKING, selectedDoughProduct.requiredCookingLevel)) {
|
||||
if (freeSlots(player!!) < 1) {
|
||||
sendMessage(
|
||||
player!!,
|
||||
"Not enough space in your inventory."
|
||||
)
|
||||
return@runTask
|
||||
}
|
||||
|
||||
if (removeItem(player!!, waterContainer) && removeItem(player!!, flourContainer)) {
|
||||
addItem(player!!, selectedDoughProduct.itemId)
|
||||
player!!.dispatch(ResourceProducedEvent(selectedDoughProduct.itemId, 1, player!!))
|
||||
|
||||
val emptyWaterContainerId = FULL_WATER_CONTAINERS_TO_EMPTY_CONTAINERS[waterContainer.id]!!
|
||||
addItem(player!!, emptyWaterContainerId)
|
||||
|
||||
addItem(player!!, Items.EMPTY_POT_1931)
|
||||
|
||||
sendMessage(
|
||||
player!!,
|
||||
"You mix the flower and the water to make some ${selectedDoughProduct.itemName.toLowerCase()}."
|
||||
)
|
||||
}
|
||||
} else {
|
||||
sendDialogue(
|
||||
player!!,
|
||||
"You need a Cooking level of at least ${selectedDoughProduct.requiredCookingLevel} in order to make ${selectedDoughProduct.itemName.toLowerCase()}."
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package content.global.skill.cooking;
|
||||
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the plugin used for the fire pottery object.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class FireOptionPotteryPlugin extends OptionHandler {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
SceneryDefinition.forId(2643).getHandlers().put("option:fire", this);
|
||||
SceneryDefinition.forId(4308).getHandlers().put("option:fire", this);
|
||||
SceneryDefinition.forId(11601).getHandlers().put("option:fire", this);
|
||||
SceneryDefinition.forId(34802).getHandlers().put("option:fire", this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
player.faceLocation(node.getLocation());
|
||||
player.getDialogueInterpreter().open(99843, true, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package content.global.skill.cooking;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.scenery.Scenery;
|
||||
|
||||
public class IntentionalBurnPulse extends StandardCookingPulse {
|
||||
int initial,product,amount;
|
||||
Player player;
|
||||
Scenery object;
|
||||
IntentionalBurnPulse(Player player, Scenery object, int initial, int product, int amount){
|
||||
super(player,object,initial,product,amount);
|
||||
this.initial = initial;
|
||||
this.product = product;
|
||||
this.amount = amount;
|
||||
this.player = player;
|
||||
this.object = object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkRequirements() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reward() {
|
||||
if (getDelay() == 1) {
|
||||
setDelay(object.getName().toLowerCase().equals("range") ? 5 : 4);
|
||||
return false;
|
||||
}
|
||||
if(cook(player,null,false,initial,product)) {
|
||||
amount--;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
// we are always one off a normal cooking pulse because
|
||||
// the first tick is handled outside of this class.
|
||||
return amount <= 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean cook(Player player, Scenery object, boolean burned, int initial, int product) {
|
||||
super.animate();
|
||||
Item initialItem = new Item(initial);
|
||||
Item productItem = new Item(product);
|
||||
|
||||
if (player.getInventory().remove(initialItem)) {
|
||||
player.getInventory().add(productItem);
|
||||
player.getPacketDispatch().sendMessage(getMessage(initialItem, productItem, burned));
|
||||
player.getAudioManager().send(SOUND);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package content.global.skill.cooking;
|
||||
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the stew plugin.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public class MakeStewPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code MakeStewPlugin} {@code Object}.
|
||||
*/
|
||||
public MakeStewPlugin() {
|
||||
super(2001);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(114, OBJECT_TYPE, this);
|
||||
addHandler(2728, OBJECT_TYPE, this);
|
||||
addHandler(2729, OBJECT_TYPE, this);
|
||||
addHandler(2730, OBJECT_TYPE, this);
|
||||
addHandler(2731, OBJECT_TYPE, this);
|
||||
addHandler(2859, OBJECT_TYPE, this);
|
||||
addHandler(3039, OBJECT_TYPE, this);
|
||||
addHandler(4172, OBJECT_TYPE, this);
|
||||
addHandler(5275, OBJECT_TYPE, this);
|
||||
addHandler(8750, OBJECT_TYPE, this);
|
||||
addHandler(9682, OBJECT_TYPE, this);
|
||||
addHandler(12102, OBJECT_TYPE, this);
|
||||
addHandler(14919, OBJECT_TYPE, this);
|
||||
addHandler(16893, OBJECT_TYPE, this);
|
||||
addHandler(21792, OBJECT_TYPE, this);
|
||||
addHandler(22154, OBJECT_TYPE, this);
|
||||
addHandler(22713, OBJECT_TYPE, this);
|
||||
addHandler(22714, OBJECT_TYPE, this);
|
||||
addHandler(24283, OBJECT_TYPE, this);
|
||||
addHandler(24284, OBJECT_TYPE, this);
|
||||
addHandler(25730, OBJECT_TYPE, this);
|
||||
addHandler(33500, OBJECT_TYPE, this);
|
||||
addHandler(34410, OBJECT_TYPE, this);
|
||||
addHandler(34495, OBJECT_TYPE, this);
|
||||
addHandler(34546, OBJECT_TYPE, this);
|
||||
addHandler(34565, OBJECT_TYPE, this);
|
||||
addHandler(36973, OBJECT_TYPE, this);
|
||||
addHandler(37629, OBJECT_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
event.getPlayer().getDialogueInterpreter().open(43989, event.getUsedItem().getId(), "stew");
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package content.global.skill.cooking;
|
||||
|
||||
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 create nettle tea in a cup.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class NettleTeaPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Represents the empty cup item.
|
||||
*/
|
||||
private static final Item EMPTY_CUP = new Item(1980, 1);
|
||||
|
||||
/**
|
||||
* Represents the nettle tea item.
|
||||
*/
|
||||
private static final Item NETTLE_TEA = new Item(4239, 1);
|
||||
|
||||
/**
|
||||
* Represents the bowl item.
|
||||
*/
|
||||
private static final Item BOWL = new Item(1923);
|
||||
|
||||
/**
|
||||
* Represents the cup of tea item.
|
||||
*/
|
||||
private static final Item CUP_OF_TEA = new Item(4242, 1);
|
||||
|
||||
/**
|
||||
* Constructs a new {@code NettleTeaPlugin} {@code Object}.
|
||||
*/
|
||||
public NettleTeaPlugin() {
|
||||
super(1980);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(4239, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
if (player.getInventory().remove(EMPTY_CUP) && player.getInventory().remove(NETTLE_TEA)) {
|
||||
player.getInventory().add(BOWL);
|
||||
player.getInventory().add(CUP_OF_TEA);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package content.global.skill.cooking;
|
||||
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author Adam
|
||||
*/
|
||||
@Initializable
|
||||
public class NettleWaterPlugin extends UseWithHandler {
|
||||
|
||||
public NettleWaterPlugin() {
|
||||
super(1921);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
player.getInventory().remove(new Item(1921, 1));
|
||||
player.getInventory().remove(new Item(4241, 1));
|
||||
player.getInventory().add(new Item(4237, 1));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(4241, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package content.global.skill.cooking;
|
||||
|
||||
import core.cache.def.impl.ItemDefinition;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.scenery.Scenery;
|
||||
|
||||
public class PieCookingPulse extends StandardCookingPulse {
|
||||
private Scenery object;
|
||||
private Player player;
|
||||
public PieCookingPulse(Player player, Scenery object, int initial, int product, int amount){
|
||||
super(player,object,initial,product,amount);
|
||||
this.object = object;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkRequirements() {
|
||||
if(!object.getName().toLowerCase().contains("range")){
|
||||
player.getPacketDispatch().sendMessage("This can only be cooked on a range.");
|
||||
return false;
|
||||
}
|
||||
return super.checkRequirements();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage(Item food, Item product, boolean burned) {
|
||||
if(burned){
|
||||
return "You accidentally burn the pie.";
|
||||
} else {
|
||||
return "You successfully bake a delicious " + ItemDefinition.forId(product.getId()).getName().toLowerCase() + ".";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package content.global.skill.cooking;
|
||||
|
||||
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 pie shell making plugin.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class PieShellPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Represents the pie sell item.
|
||||
*/
|
||||
private static final Item PIE_SHELL = new Item(2315, 1);
|
||||
|
||||
/**
|
||||
* Represents the pie dish item.
|
||||
*/
|
||||
private static final Item PIE_DISH = new Item(2313, 1);
|
||||
|
||||
/**
|
||||
* Represents the pastry dough item.
|
||||
*/
|
||||
private static final Item PASTRY_DOUGH = new Item(1953, 1);
|
||||
|
||||
/**
|
||||
* Constructs a new {@code PieMakingPlugin} {@code Object}.
|
||||
*/
|
||||
public PieShellPlugin() {
|
||||
super(1953);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(2313, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
if (player.getInventory().remove(PASTRY_DOUGH, PIE_DISH)) {
|
||||
player.getInventory().add(PIE_SHELL);
|
||||
player.getPacketDispatch().sendMessage("You put the pastry dough into the pie dish to make a pie shell.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package content.global.skill.cooking;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.scenery.Scenery;
|
||||
|
||||
public class PizzaCookingPulse extends StandardCookingPulse {
|
||||
Scenery object;
|
||||
Player player;
|
||||
|
||||
PizzaCookingPulse(Player player, Scenery object, int initial, int product, int amount){
|
||||
super(player,object,initial,product,amount);
|
||||
this.object = object;
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkRequirements() {
|
||||
if(!object.getName().toLowerCase().contains("range")){
|
||||
player.getPacketDispatch().sendMessage("This can only be cooked on a range.");
|
||||
return false;
|
||||
}
|
||||
return super.checkRequirements();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage(Item food, Item product, boolean burned) {
|
||||
if(burned){
|
||||
return "You accidentally burn the pizza.";
|
||||
} else {
|
||||
return "You cook a delicious looking pizza.";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package content.global.skill.cooking
|
||||
|
||||
|
||||
import core.api.*
|
||||
|
||||
import org.rs09.consts.Items
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.game.interaction.IntType
|
||||
|
||||
|
||||
/**
|
||||
* @author bushtail
|
||||
* That's-a spicy kebab!
|
||||
*/
|
||||
class SaucyKebabListener : InteractionListener {
|
||||
val sauce = Items.RED_HOT_SAUCE_4610
|
||||
val kebabArr = intArrayOf(
|
||||
Items.KEBAB_1971,
|
||||
Items.UGTHANKI_KEBAB_1883,
|
||||
Items.UGTHANKI_KEBAB_1885
|
||||
)
|
||||
|
||||
override fun defineListeners() {
|
||||
onUseWith(IntType.ITEM, kebabArr, sauce) { player, used, with ->
|
||||
if(removeItem(player, used.asItem()) && removeItem(player, with.asItem())) {
|
||||
return@onUseWith addItem(player, Items.SUPER_KEBAB_4608)
|
||||
}
|
||||
return@onUseWith false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package content.global.skill.cooking;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.scenery.Scenery;
|
||||
|
||||
/**
|
||||
* Fixes the half assed previous implementation of cooking Sinew.
|
||||
* @author Woah
|
||||
*/
|
||||
public class SinewCookingPulse extends StandardCookingPulse {
|
||||
|
||||
public SinewCookingPulse(Player player, Scenery object, int initial, int product, int amount) {
|
||||
super(player, object, initial, product, amount);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkRequirements() {
|
||||
properties = CookableItems.SINEW;
|
||||
return super.checkRequirements();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBurned(Player player, Scenery object, int food) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMessage(Item food, Item product, boolean burned) {
|
||||
return "You dry a piece of beef and extract the sinew.";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
package content.global.skill.cooking;
|
||||
|
||||
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.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the plugin used to make skwered items.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
@Initializable
|
||||
public class SkeweredFoodPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Represents the level required.
|
||||
*/
|
||||
private final int LEVEL = 20;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code SkeweredFoodPlugin} {@code Object}.
|
||||
*/
|
||||
public SkeweredFoodPlugin() {
|
||||
super(7225);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
for (SkeweredSet set : SkeweredSet.values()) {
|
||||
addHandler(set.getRaw().getId(), ITEM_TYPE, this);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
if (player.getSkills().getLevel(Skills.FIREMAKING) < LEVEL) {
|
||||
player.getPacketDispatch().sendMessage("You meed a Firemaking level of at least " + LEVEL + " in order to do this.");
|
||||
return true;
|
||||
}
|
||||
final SkeweredSet set = SkeweredSet.forItem(event.getBaseItem().getId() == 7225 ? event.getUsedItem() : event.getBaseItem());
|
||||
if (player.getInventory().remove(event.getBaseItem()) && player.getInventory().remove(event.getUsedItem())) {
|
||||
player.getInventory().add(set.getProduct());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Represents a set of skwered items.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public enum SkeweredSet {
|
||||
RABBIT(new Item(3226), new Item(7224)), CHOMPY(new Item(2876), new Item(7230)), BIRD(new Item(9978), new Item(9984)), BEAST(new Item(9986), new Item(9992));
|
||||
|
||||
/**
|
||||
* Represents the raw item.
|
||||
*/
|
||||
private final Item raw;
|
||||
|
||||
/**
|
||||
* Represents the product item.
|
||||
*/
|
||||
private final Item product;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code SkeweredFoodPlugin} {@code Object}.
|
||||
* @param raw the raw item.
|
||||
* @param product the product.
|
||||
*/
|
||||
private SkeweredSet(Item raw, Item product) {
|
||||
this.raw = raw;
|
||||
this.product = product;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the raw.
|
||||
* @return The raw.
|
||||
*/
|
||||
public Item getRaw() {
|
||||
return raw;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the product.
|
||||
* @return The product.
|
||||
*/
|
||||
public Item getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the skwered set.
|
||||
* @param item the item.
|
||||
* @return the set.
|
||||
*/
|
||||
public static SkeweredSet forItem(final Item item) {
|
||||
for (SkeweredSet set : values()) {
|
||||
if (set.getRaw().getId() == item.getId()) {
|
||||
return set;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,196 @@
|
||||
package content.global.skill.cooking;
|
||||
|
||||
import content.global.skill.skillcapeperks.SkillcapePerks;
|
||||
import core.game.event.ResourceProducedEvent;
|
||||
import core.game.node.entity.impl.Animator;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.audio.Audio;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.item.GroundItemManager;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.node.scenery.Scenery;
|
||||
import core.game.system.task.Pulse;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.tools.RandomFunction;
|
||||
import org.rs09.consts.Items;
|
||||
|
||||
public class StandardCookingPulse extends Pulse {
|
||||
//range animation
|
||||
private static final Animation RANGE_ANIMATION = new Animation(883, Animator.Priority.HIGH);
|
||||
|
||||
//fire animation
|
||||
private static final Animation FIRE_ANIMATION = new Animation(897, Animator.Priority.HIGH);
|
||||
|
||||
//Cooking sound
|
||||
public static final Audio SOUND = new Audio(2577, 1, 1);
|
||||
|
||||
private final int initial;
|
||||
private final int product;
|
||||
private int amount;
|
||||
private final Scenery object;
|
||||
private final Player player;
|
||||
private double experience;
|
||||
private boolean burned = false;
|
||||
public CookableItems properties;
|
||||
|
||||
public StandardCookingPulse(Player player, Scenery object, int initial, int product, int amount) {
|
||||
this.player = player;
|
||||
this.object = object;
|
||||
this.initial = initial;
|
||||
this.product = product;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
properties = CookableItems.forId(initial);
|
||||
if (checkRequirements()) {
|
||||
super.start();
|
||||
cook(player, object, CookableItems.cookingMap.get(initial) != null && isBurned(player, object, initial), initial, product);
|
||||
amount--;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
if (amount < 1 || !checkRequirements()) {
|
||||
return true;
|
||||
}
|
||||
return reward();
|
||||
}
|
||||
|
||||
public void animate() {
|
||||
player.animate(getAnimation(object));
|
||||
}
|
||||
|
||||
public boolean checkRequirements() {
|
||||
this.experience = 0;
|
||||
if (properties != null) {
|
||||
// Handle Cook's Assistant range
|
||||
if (object.getId() == 114 && !player.getQuestRepository().isComplete("Cook's Assistant")) {
|
||||
player.getPacketDispatch().sendMessage("You need to have completed the Cook's Assistant quest in order to use that range.");
|
||||
return false;
|
||||
}
|
||||
|
||||
//check level
|
||||
if (player.getSkills().getLevel(Skills.COOKING) < properties.level) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a cooking level of " + properties.level + " to cook this.");
|
||||
return false;
|
||||
}
|
||||
|
||||
this.experience = properties.experience;
|
||||
this.burned = isBurned(player, object, initial);
|
||||
}
|
||||
if (amount < 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return object.isActive();
|
||||
}
|
||||
|
||||
public boolean reward() {
|
||||
if (getDelay() == 1) {
|
||||
int delay = object.getName().toLowerCase().equals("range") ? 5 : 4;
|
||||
if(SkillcapePerks.isActive(SkillcapePerks.HASTY_COOKING, player)) {
|
||||
delay -= 1;
|
||||
}
|
||||
setDelay(delay);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (cook(player, object, burned, initial, product)) {
|
||||
amount--;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
return amount < 1;
|
||||
}
|
||||
|
||||
public boolean isBurned(final Player player, final Scenery object, int food) {
|
||||
boolean hasGauntlets = player.getEquipment().containsItem(new Item(Items.COOKING_GAUNTLETS_775));
|
||||
double burn_stop = (double) CookableItems.getBurnLevel(food);
|
||||
int effectiveCookingLevel = player.getSkills().getLevel(Skills.COOKING);
|
||||
if(SkillcapePerks.isActive(SkillcapePerks.HASTY_COOKING, player)) {
|
||||
effectiveCookingLevel -= 5;
|
||||
}
|
||||
int gauntlets_boost = 0;
|
||||
CookableItems item = CookableItems.forId(food);
|
||||
if (hasGauntlets && (food == Items.RAW_SWORDFISH_371 || food == Items.RAW_LOBSTER_377 || food == Items.RAW_MONKFISH_7944 || food == Items.RAW_SHARK_383)) {
|
||||
burn_stop -= 6;
|
||||
gauntlets_boost += 6;
|
||||
}
|
||||
if (effectiveCookingLevel >= burn_stop) {
|
||||
return false;
|
||||
}
|
||||
int cook_level = effectiveCookingLevel + gauntlets_boost;
|
||||
double host_ratio = RandomFunction.randomDouble(100.0);
|
||||
double low = item.low + (object.getName().contains("fire") ? 0 : (0.1 * item.low));
|
||||
double high = item.high + (object.getName().contains("fire") ? 0 : (0.1 * item.high));
|
||||
double client_ratio = RandomFunction.getSkillSuccessChance(low,high,cook_level);
|
||||
return host_ratio > client_ratio;
|
||||
}
|
||||
|
||||
public boolean cook(final Player player, final Scenery object, final boolean burned, final int initial, final int product) {
|
||||
Item initialItem = new Item(initial);
|
||||
Item productItem = new Item(product);
|
||||
animate();
|
||||
|
||||
//handle special cooking results (spits, cake, etc) that don't justify separate plugin
|
||||
switch (initial) {
|
||||
case Items.RAW_BEAST_MEAT_9986:
|
||||
case Items.RAW_CHOMPY_2876:
|
||||
case Items.RAW_JUBBLY_7566:
|
||||
case Items.SKEWERED_BIRD_MEAT_9984:
|
||||
case Items.RAW_RABBIT_3226: // Iron spits
|
||||
case Items.IRON_SPIT_7225:
|
||||
if (RandomFunction.random(15) == 5) {
|
||||
player.getPacketDispatch().sendMessage("Your iron spit seems to have broken in the process.");
|
||||
} else {
|
||||
if (!player.getInventory().add(new Item(Items.IRON_SPIT_7225))) {
|
||||
GroundItemManager.create(new Item(Items.IRON_SPIT_7225), player.getLocation(), player);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Items.UNCOOKED_CAKE_1889: //cake
|
||||
if (!player.getInventory().add(new Item(Items.CAKE_TIN_1887))) {
|
||||
GroundItemManager.create(new Item(Items.CAKE_TIN_1887), player);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (player.getInventory().remove(initialItem)) {
|
||||
if (!burned) {
|
||||
player.getInventory().add(productItem);
|
||||
player.dispatch(new ResourceProducedEvent(productItem.getId(), 1, object, initialItem.getId()));
|
||||
player.getSkills().addExperience(Skills.COOKING, experience, true);
|
||||
} else {
|
||||
player.dispatch(new ResourceProducedEvent(CookableItems.getBurnt(initial).getId(), 1, object, initialItem.getId()));
|
||||
player.getInventory().add(CookableItems.getBurnt(initial));
|
||||
}
|
||||
player.getPacketDispatch().sendMessage(getMessage(initialItem, productItem, burned));
|
||||
player.getAudioManager().send(SOUND);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public String getMessage(Item food, Item product, boolean burned) {
|
||||
if (food.getId() == Items.RAW_OOMLIE_2337) {
|
||||
return "The meat is far too delicate to cook like this. Perhaps you should wrap something around it to protect it from the heat.";
|
||||
}
|
||||
if (product.getId() == Items.SODA_ASH_1781) {
|
||||
return "You burn the seaweed into soda ash.";
|
||||
}
|
||||
if (CookableItems.intentionalBurn(food.getId())) {
|
||||
return "You deliberately burn the perfectly good piece of meat.";
|
||||
}
|
||||
if (!burned) {
|
||||
return "You manage to cook some " + food.getName().replace("Raw ", "");
|
||||
} else {
|
||||
return "You accidentally burn some " + food.getName().replace("Raw ", "");
|
||||
}
|
||||
}
|
||||
|
||||
private Animation getAnimation(final Scenery object) {
|
||||
return !object.getName().equalsIgnoreCase("fire") ? RANGE_ANIMATION : FIRE_ANIMATION;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package content.global.skill.cooking;
|
||||
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.interaction.UseWithHandler;
|
||||
import core.game.node.item.GroundItemManager;
|
||||
import core.game.node.item.Item;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the plugin used to slice a watermelon.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class WatermelonSlicePlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Represents the knife item.
|
||||
*/
|
||||
private static final Item KNIFE = new Item(946);
|
||||
|
||||
/**
|
||||
* Represents the watermelon item.
|
||||
*/
|
||||
private static final Item WATERMELON = new Item(5982);
|
||||
|
||||
/**
|
||||
* Represents the watermelon slice item.
|
||||
*/
|
||||
private static final Item WATERMELON_SLICE = new Item(5984);
|
||||
|
||||
/**
|
||||
* Constructs a new {@code WatermelonSlicePlugin.java} {@code Object}.
|
||||
*/
|
||||
public WatermelonSlicePlugin() {
|
||||
super(KNIFE.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(5982, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
if (event.getPlayer().getInventory().remove(WATERMELON)) {
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (!event.getPlayer().getInventory().add(WATERMELON_SLICE)) {
|
||||
GroundItemManager.create(WATERMELON_SLICE, event.getPlayer());
|
||||
}
|
||||
}
|
||||
event.getPlayer().getPacketDispatch().sendMessage("You slice the watermelon into three slices.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package content.global.skill.cooking;
|
||||
|
||||
import core.plugin.Initializable;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import content.global.skill.cooking.fermenting.WineFermentingPulse;
|
||||
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.GameWorld;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the plugin used to ferment wine.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class WineFermentPlugin extends UseWithHandler {
|
||||
|
||||
/**
|
||||
* Represents the grapes item.
|
||||
*/
|
||||
private static final Item GRAPES = new Item(1987, 1);
|
||||
|
||||
/**
|
||||
* Represents the jug of water item.
|
||||
*/
|
||||
private static final Item JUG_OF_WATER = new Item(1937, 1);
|
||||
|
||||
/**
|
||||
* Represents the unfermented wine item.
|
||||
*/
|
||||
private static final Item UNFERMENTED_WINE = new Item(1995, 1);
|
||||
|
||||
/**
|
||||
* Constructs a new {@code WineFermentPlugin} {@code Object}.
|
||||
*/
|
||||
public WineFermentPlugin() {
|
||||
super(1937);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
addHandler(1987, ITEM_TYPE, this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(NodeUsageEvent event) {
|
||||
final Player player = event.getPlayer();
|
||||
if (player.getSkills().getLevel(Skills.COOKING) < 35) {
|
||||
player.getPacketDispatch().sendMessage("You need a cooking level of 35 to do this.");
|
||||
return true;
|
||||
}
|
||||
if (player.getInventory().remove(GRAPES, JUG_OF_WATER)) {
|
||||
player.getInventory().add(UNFERMENTED_WINE);
|
||||
GameWorld.getPulser().submit(new WineFermentingPulse(1, player));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
package content.global.skill.cooking.dairy;
|
||||
|
||||
import core.game.component.Component;
|
||||
import core.game.dialogue.DialoguePlugin;
|
||||
import core.plugin.Initializable;
|
||||
import org.rs09.consts.Items;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the dairy churn dialogue.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class DairyChurnDialogue extends DialoguePlugin {
|
||||
|
||||
/**
|
||||
* Represents the item array.
|
||||
*/
|
||||
private static final Item[] ITEMS = new Item[] {
|
||||
new Item(Items.BUCKET_OF_MILK_1927, 1),
|
||||
new Item(Items.POT_OF_CREAM_2130, 1),
|
||||
new Item(Items.PAT_OF_BUTTER_6697, 1)
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs a new {@code DairyChurnDialogue} {@code Object}.
|
||||
*/
|
||||
public DairyChurnDialogue() {
|
||||
/**
|
||||
* empty.
|
||||
*/
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new {@code DairyChurnDialogue} {@code Object}.
|
||||
* @param player the player.
|
||||
*/
|
||||
public DairyChurnDialogue(Player player) {
|
||||
super(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DialoguePlugin newInstance(Player player) {
|
||||
return new DairyChurnDialogue(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean open(Object... args) {
|
||||
player.getInterfaceManager().openChatbox(new Component(74));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(int interfaceId, int buttonId) {
|
||||
DairyProduct product = null;
|
||||
int amount = 0;
|
||||
switch (buttonId) {
|
||||
case 6:
|
||||
product = DairyProduct.POT_OF_CREAM;
|
||||
amount = 1;
|
||||
break;
|
||||
case 5:
|
||||
product = DairyProduct.POT_OF_CREAM;
|
||||
amount = 5;
|
||||
break;
|
||||
case 4:
|
||||
product = DairyProduct.POT_OF_CREAM;
|
||||
amount = 10;
|
||||
break;
|
||||
case 9:
|
||||
product = DairyProduct.PAT_OF_BUTTER;
|
||||
amount = 1;
|
||||
break;
|
||||
case 8:
|
||||
product = DairyProduct.PAT_OF_BUTTER;
|
||||
amount = 5;
|
||||
break;
|
||||
case 7:
|
||||
product = DairyProduct.PAT_OF_BUTTER;
|
||||
amount = 10;
|
||||
break;
|
||||
case 12:
|
||||
product = DairyProduct.CHEESE;
|
||||
amount = 1;
|
||||
break;
|
||||
case 11:
|
||||
product = DairyProduct.CHEESE;
|
||||
amount = 5;
|
||||
break;
|
||||
case 10:
|
||||
product = DairyProduct.CHEESE;
|
||||
amount = 10;
|
||||
break;
|
||||
}
|
||||
player.getPulseManager().run(new DairyChurnPulse(player, ITEMS[0], product, amount));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { 984374 };
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package content.global.skill.cooking.dairy;
|
||||
|
||||
import core.cache.def.impl.SceneryDefinition;
|
||||
import core.game.interaction.OptionHandler;
|
||||
import core.game.node.Node;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.plugin.Initializable;
|
||||
import core.plugin.Plugin;
|
||||
|
||||
/**
|
||||
* Represents the plugin used to handle dairy churning executing.
|
||||
* @author 'Vexia
|
||||
* @version 1.0
|
||||
*/
|
||||
@Initializable
|
||||
public final class DairyChurnOptionPlugin extends OptionHandler {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
SceneryDefinition.forId(10093).getHandlers().put("option:churn", this);
|
||||
SceneryDefinition.forId(10094).getHandlers().put("option:churn", this);
|
||||
SceneryDefinition.forId(25720).getHandlers().put("option:churn", this);
|
||||
SceneryDefinition.forId(34800).getHandlers().put("option:churn", this);
|
||||
SceneryDefinition.forId(35931).getHandlers().put("option:churn", this);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handle(Player player, Node node, String option) {
|
||||
if (!player.getInventory().contains(1927, 1) && !player.getInventory().contains(2130, 1) && !player.getInventory().contains(6697, 1)) {
|
||||
player.getPacketDispatch().sendMessage("You need some milk, cream or butter to use in the churn.");
|
||||
return true;
|
||||
}
|
||||
player.getDialogueInterpreter().open(984374);
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package content.global.skill.cooking.dairy;
|
||||
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.entity.player.link.diary.DiaryType;
|
||||
import core.game.node.entity.skill.SkillPulse;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.item.GroundItemManager;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.world.map.Location;
|
||||
import core.game.world.update.flag.context.Animation;
|
||||
import core.tools.StringUtils;
|
||||
import org.rs09.consts.Items;
|
||||
|
||||
/**
|
||||
* Represents the skill pulse used to make a dairy product.
|
||||
* @author 'Vexia
|
||||
*/
|
||||
public final class DairyChurnPulse extends SkillPulse<Item> {
|
||||
|
||||
/**
|
||||
* Represents the animation.
|
||||
*/
|
||||
private static final Animation ANIMATION = new Animation(2793);
|
||||
|
||||
/**
|
||||
* Represents the bucket of milk item.
|
||||
*/
|
||||
private static final Item BUCKET_OF_MILK = new Item(1927, 1);
|
||||
|
||||
/**
|
||||
* Represents the bucket item.
|
||||
*/
|
||||
private static final Item BUCKET = new Item(1925, 1);
|
||||
|
||||
/**
|
||||
* Represents the dairy product we're making.
|
||||
*/
|
||||
private final DairyProduct dairy;
|
||||
|
||||
/**
|
||||
* Represent the amount to make.
|
||||
*/
|
||||
private int amount;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code DairyChurnPulse} {@code Object}.
|
||||
* @param player the player.
|
||||
* @param item the item.
|
||||
* @param product the product.
|
||||
* @param amount the amount.
|
||||
*/
|
||||
public DairyChurnPulse(Player player, Item item, DairyProduct product, int amount) {
|
||||
super(player, item);
|
||||
super.setDelay(8);
|
||||
this.amount = amount;
|
||||
this.dairy = product;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkRequirements() {
|
||||
player.getInterfaceManager().closeChatbox();
|
||||
boolean hasAnyInput = false;
|
||||
for(Item input : dairy.getInputs()) {
|
||||
if(player.getInventory().containsItem(input)) {
|
||||
hasAnyInput = true;
|
||||
node = input;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!hasAnyInput) {
|
||||
player.getPacketDispatch().sendMessage("You need a bucket of milk.");
|
||||
return false;
|
||||
}
|
||||
if (player.getSkills().getLevel(Skills.COOKING) < dairy.getLevel()) {
|
||||
player.getPacketDispatch().sendMessage("You need a cooking level of " + dairy.getLevel() + " to cook this.");
|
||||
return false;
|
||||
}
|
||||
if (amount > player.getInventory().getAmount(node)) {
|
||||
amount = player.getInventory().getAmount(node);
|
||||
}
|
||||
if (amount < 1) {
|
||||
return false;
|
||||
}
|
||||
animate();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void animate() {
|
||||
player.animate(ANIMATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean reward() {
|
||||
amount--;
|
||||
for(Item input : dairy.getInputs()) {
|
||||
if (player.getInventory().remove(input)) {
|
||||
// Since we've just removed the input, there's always enough room for the primary output
|
||||
player.getInventory().add(dairy.getProduct());
|
||||
// But if we were churning milk, we might need to drop the bucket on the floor if there isn't enough space
|
||||
if(input.getId() == Items.BUCKET_OF_MILK_1927) {
|
||||
if(!player.getInventory().add(BUCKET)) {
|
||||
// https://runescape.wiki/w/Pat_of_butter?oldid=2043294
|
||||
// "using milk with a full inventory will auto-drop the buckets"
|
||||
GroundItemManager.create(BUCKET, player);
|
||||
}
|
||||
}
|
||||
player.getPacketDispatch().sendMessage("You make " + (StringUtils.isPlusN(dairy.getProduct().getName().toLowerCase()) ? "an" : "a") + " " + dairy.getProduct().getName().toLowerCase() + ".");
|
||||
player.getSkills().addExperience(Skills.COOKING, dairy.getExperience(), true);
|
||||
|
||||
// Seers village diary
|
||||
if (player.getLocation().withinDistance(new Location(2730, 3578, 0))
|
||||
&& !player.getAchievementDiaryManager().getDiary(DiaryType.SEERS_VILLAGE).isComplete(0,8)) {
|
||||
player.getAchievementDiaryManager().getDiary(DiaryType.SEERS_VILLAGE).updateTask(player,0,8,true);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return amount < 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package content.global.skill.cooking.dairy;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import core.game.node.item.Item;
|
||||
import org.rs09.consts.Items;
|
||||
|
||||
/**
|
||||
* Represents an enumeration of dairy products.
|
||||
* @author 'Vexia
|
||||
*/
|
||||
public enum DairyProduct {
|
||||
POT_OF_CREAM(21, 18, new Item(Items.POT_OF_CREAM_2130, 1), new Integer[] { Items.BUCKET_OF_MILK_1927 }),
|
||||
PAT_OF_BUTTER(38, 40.5, new Item(Items.PAT_OF_BUTTER_6697, 1), new Integer[] { Items.BUCKET_OF_MILK_1927, Items.POT_OF_CREAM_2130 }),
|
||||
CHEESE(48, 64, new Item(Items.CHEESE_1985, 1), new Integer[] { Items.BUCKET_OF_MILK_1927, Items.POT_OF_CREAM_2130, Items.PAT_OF_BUTTER_6697 });
|
||||
|
||||
/**
|
||||
* The prodct <code>Item</code>.
|
||||
*/
|
||||
private Item product;
|
||||
|
||||
/**
|
||||
* The level required.
|
||||
*/
|
||||
private int level;
|
||||
|
||||
/**
|
||||
* /** The experience gained.
|
||||
*/
|
||||
private double experience;
|
||||
|
||||
/**
|
||||
* The possible inputs for making this dairy product
|
||||
*/
|
||||
private Item[] inputs;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code DairyProduct.java} {@code Object}.
|
||||
* @param level
|
||||
* @param experience
|
||||
* @param product
|
||||
*/
|
||||
DairyProduct(int level, double experience, Item product, Integer[] inputs) {
|
||||
this.level = level;
|
||||
this.experience = experience;
|
||||
this.product = product;
|
||||
this.inputs = Arrays.stream(inputs).map(id -> new Item(id, 1)).toArray(len -> new Item[len]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the product.
|
||||
*/
|
||||
public Item getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the level.
|
||||
*/
|
||||
public int getLevel() {
|
||||
return level;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the experience.
|
||||
*/
|
||||
public double getExperience() {
|
||||
return experience;
|
||||
}
|
||||
|
||||
public Item[] getInputs() {
|
||||
return inputs;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package content.global.skill.cooking.fermenting;
|
||||
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
import core.game.system.task.Pulse;
|
||||
import core.tools.RandomFunction;
|
||||
|
||||
/**
|
||||
* Represents a pulse used to ferment wine.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public final class WineFermentingPulse extends Pulse {
|
||||
|
||||
/**
|
||||
* Represents the player instance.
|
||||
*/
|
||||
private final Player player;
|
||||
|
||||
/**
|
||||
* Represents a counter used to time when to ferment.
|
||||
*/
|
||||
private int count;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code WineFermentingPulse} {@Code Object}
|
||||
* @param delay the delay.
|
||||
*/
|
||||
public WineFermentingPulse(int delay, final Player player) {
|
||||
super(delay);
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
if (count++ >= 16) {
|
||||
int rand = RandomFunction.random(1, 3);
|
||||
switch (rand) {
|
||||
case 1:
|
||||
if (player.getInventory().contains(1995, 1)) {
|
||||
player.getInventory().replace(new Item(1991, 1), player.getInventory().getSlot(new Item(1995, 1)));
|
||||
} else if (player.getBank().contains(1995, 1)) {
|
||||
player.getBank().replace(new Item(1991, 1), player.getBank().getSlot(new Item(1995, 1)));
|
||||
}
|
||||
return true;
|
||||
case 2:
|
||||
if (player.getInventory().contains(1995, 1)) {
|
||||
player.getInventory().replace(new Item(1993, 1), player.getInventory().getSlot(new Item(1995, 1)));
|
||||
player.getSkills().addExperience(Skills.COOKING, 200, true);
|
||||
} else if (player.getBank().contains(1995, 1)) {
|
||||
player.getBank().replace(new Item(1993, 1), player.getBank().getSlot(new Item(1995, 1)));
|
||||
player.getSkills().addExperience(Skills.COOKING, 200);
|
||||
}
|
||||
return true;
|
||||
case 3:
|
||||
if (player.getInventory().contains(1995, 1)) {
|
||||
player.getInventory().replace(new Item(1993, 1), player.getInventory().getSlot(new Item(1995, 1)));
|
||||
player.getSkills().addExperience(Skills.COOKING, 200);
|
||||
} else if (player.getBank().contains(1995, 1)) {
|
||||
player.getBank().replace(new Item(1993, 1), player.getBank().getSlot(new Item(1995, 1)));
|
||||
player.getSkills().addExperience(Skills.COOKING, 200);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
count++;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the player.
|
||||
* @return the player.
|
||||
*/
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package content.global.skill.cooking.recipe;
|
||||
|
||||
import org.rs09.consts.Items;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* @author afaroutdude
|
||||
*/
|
||||
public class OomlieWrap extends Recipe {
|
||||
|
||||
private static final Item OOMLIE_WRAP = new Item(Items.WRAPPED_OOMLIE_2341);
|
||||
private static final Item RAW_OOMLIE = new Item(Items.RAW_OOMLIE_2337);
|
||||
private static final Item PALM_LEAF = new Item(Items.PALM_LEAF_2339);
|
||||
|
||||
@Override
|
||||
public void mix(final Player player, final NodeUsageEvent event) {
|
||||
if (player.getSkills().getLevel(Skills.COOKING) < 50) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a Cooking level of 50 in order to do that.");
|
||||
return;
|
||||
}
|
||||
super.mix(player, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getBase() {
|
||||
return RAW_OOMLIE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return OOMLIE_WRAP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { PALM_LEAF };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMixMessage(NodeUsageEvent event) {
|
||||
return "You wrap the raw oomlie in the palm leaf.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
package content.global.skill.cooking.recipe;
|
||||
|
||||
import content.global.skill.cooking.recipe.pie.impl.*;
|
||||
import content.global.skill.cooking.recipe.pizza.impl.AnchovyPizza;
|
||||
import content.global.skill.cooking.recipe.pizza.impl.MeatPizza;
|
||||
import content.global.skill.cooking.recipe.pizza.impl.PineapplePizza;
|
||||
import content.global.skill.cooking.recipe.pizza.impl.PlainPizza;
|
||||
import content.global.skill.cooking.recipe.potato.impl.*;
|
||||
import content.global.skill.cooking.recipe.stew.CurryRecipe;
|
||||
import content.global.skill.cooking.recipe.stew.StewRecipe;
|
||||
import content.global.skill.cooking.recipe.topping.impl.*;
|
||||
import content.global.skill.cooking.recipe.cake.ChocolateCake;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents a cooking recipe, this is dynamic that can range from a pie to a
|
||||
* pizza.
|
||||
* @author 'Vexia
|
||||
* @date 21/12/2013
|
||||
*/
|
||||
public abstract class Recipe {
|
||||
|
||||
/**
|
||||
* Represents the array of active recipes in Keldagrim..
|
||||
*/
|
||||
// TODO:
|
||||
// - Making this an enum would drastically save on file/line count, since the recipes seem to mostly be plain-old-data classes
|
||||
// - Making pie shells a recipe would make make-x for them just work
|
||||
// - Making pineapple cutting a recipe would probably fix their make-x making all with any option
|
||||
public static final Recipe[] RECIPES = new Recipe[] {
|
||||
new RedberryPie(), new MeatPie(), new ApplePie(), new MudPie(), new GardenPie(), new FishPie(), new AdmiralPie(), new WildPie(), new SummerPie(),
|
||||
new StewRecipe(), new CurryRecipe(),
|
||||
new PlainPizza(), new MeatPizza(), new AnchovyPizza(), new PineapplePizza(),
|
||||
new ChocolateCake(),
|
||||
new ButterPotato(), new ChilliPotato(), new CheesePotato(), new EggPotato(), new MushroomPotato(), new TunaPotato(),
|
||||
new SpicySauce(), new ChilliConCarne(), new UncookedEgg(), new EggAndTomato(), new MushroomAndOnion(), new ChoppedOnion(), new SlicedMushroom(), new ChoppedTuna(), new TunaAndCorn(), new OomlieWrap()
|
||||
};
|
||||
|
||||
/**
|
||||
* Method used to get the base item.
|
||||
* @return the item.
|
||||
*/
|
||||
public abstract Item getBase();
|
||||
|
||||
/**
|
||||
* Method used to get the product item.
|
||||
* @return the product item.
|
||||
*/
|
||||
public abstract Item getProduct();
|
||||
|
||||
/**
|
||||
* Method used to get the ingredients in this recipe.
|
||||
* @return the ingredients.
|
||||
*/
|
||||
public abstract Item[] getIngredients();
|
||||
|
||||
/**
|
||||
* Method used to get the part items made from ingredients.
|
||||
* @return the part items.
|
||||
*/
|
||||
public abstract Item[] getParts();
|
||||
|
||||
/**
|
||||
* Method used to get the mixing message.
|
||||
* @param event the node usage event.
|
||||
* @return the message used to mix.
|
||||
*/
|
||||
public abstract String getMixMessage(final NodeUsageEvent event);
|
||||
|
||||
/**
|
||||
* Method used to check if this is a singular one step recipe.
|
||||
* @return <code>True</code> if so.
|
||||
*/
|
||||
public abstract boolean isSingular();
|
||||
|
||||
/**
|
||||
* Method used to mix this recipes ingredients.
|
||||
* @param player the player.
|
||||
* @param event the event.
|
||||
*/
|
||||
public void mix(final Player player, final NodeUsageEvent event) {
|
||||
if (getIngredients().length == 1) {
|
||||
singleMix(player, event);
|
||||
} else {
|
||||
multipleMix(player, event);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to handle a single mixing.
|
||||
* @param player the player.
|
||||
* @param event the event.
|
||||
*/
|
||||
public void singleMix(final Player player, final NodeUsageEvent event) {
|
||||
if (player.getInventory().remove(event.getBaseItem()) && player.getInventory().remove(event.getUsedItem())) {
|
||||
player.getInventory().add(getProduct());
|
||||
String message = getMixMessage(event);
|
||||
if (message != null) {
|
||||
player.getPacketDispatch().sendMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to handle mixing multiple item recipes.
|
||||
* @param player the player.
|
||||
* @param event the event.
|
||||
*/
|
||||
public void multipleMix(final Player player, final NodeUsageEvent event) {
|
||||
Item item = null;
|
||||
int index = -1;
|
||||
for (int counter = 0; counter < getIngredients().length; counter++) {
|
||||
item = getIngredients()[counter];
|
||||
if (item.getId() == event.getUsedItem().getId() || item.getId() == event.getBaseItem().getId()) {
|
||||
index = counter;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (index != -1) {
|
||||
if (player.getInventory().remove(event.getBaseItem()) && player.getInventory().remove(event.getUsedItem())) {
|
||||
player.getInventory().add(getParts()[index + 1]);
|
||||
String message = getMixMessage(event);
|
||||
if (message != null) {
|
||||
player.getPacketDispatch().sendMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package content.global.skill.cooking.recipe.cake;
|
||||
|
||||
import content.global.skill.cooking.recipe.Recipe;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the chocolate cake recipe. This recipe consists of adding a
|
||||
* chocolate bar to a cake.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public class ChocolateCake extends Recipe {
|
||||
|
||||
/**
|
||||
* Represents the cake item.
|
||||
*/
|
||||
private static final Item CAKE = new Item(1891);
|
||||
|
||||
/**
|
||||
* Represents the chocolate cake item.
|
||||
*/
|
||||
private static final Item CHOCOLATE_CAKE = new Item(1897);
|
||||
|
||||
/**
|
||||
* Represents the chocolate bar item.
|
||||
*/
|
||||
private static final Item CHOCOLATE_BAR = new Item(1973);
|
||||
|
||||
@Override
|
||||
public void mix(final Player player, final NodeUsageEvent event) {
|
||||
if (player.getSkills().getLevel(Skills.COOKING) < 50) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a Cooking level of 50 in order to do that.");
|
||||
return;
|
||||
}
|
||||
super.mix(player, event);
|
||||
player.getSkills().addExperience(Skills.COOKING, 30, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getBase() {
|
||||
return CAKE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return CHOCOLATE_CAKE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { CHOCOLATE_BAR };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMixMessage(NodeUsageEvent event) {
|
||||
return "You add chocolate to the cake.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package content.global.skill.cooking.recipe.pie;
|
||||
|
||||
import content.global.skill.cooking.recipe.Recipe;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the generic recipe for a pie.
|
||||
* @author 'Vexia
|
||||
* @date 21/12/2013
|
||||
*/
|
||||
public abstract class PieRecipe extends Recipe {
|
||||
|
||||
/**
|
||||
* Represents the pie shell item.
|
||||
*/
|
||||
protected static final Item PIE_SHELL = new Item(2315);
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getBase() {
|
||||
return PIE_SHELL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMixMessage(final NodeUsageEvent event) {
|
||||
return "You fill the pie with " + (event.getBaseItem().getId() == 2315 ? event.getUsedItem().getName().toLowerCase() : event.getBaseItem().getName().toLowerCase()) + ".";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package content.global.skill.cooking.recipe.pie.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.pie.PieRecipe;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the admiral pie recipe. This recipe conists of pixing a salmon,
|
||||
* tuna and potato together.
|
||||
* @author 'Vexia
|
||||
* @date 21/12/2013
|
||||
*/
|
||||
public class AdmiralPie extends PieRecipe {
|
||||
|
||||
/**
|
||||
* Represents the uncooked redberry pie.
|
||||
*/
|
||||
private static final Item UNCOOKED_PIE = new Item(7196);
|
||||
|
||||
/**
|
||||
* Represents the salmon ingredient item.
|
||||
*/
|
||||
private static final Item SALMON = new Item(329);
|
||||
|
||||
/**
|
||||
* Represents the tuna ingredient item.
|
||||
*/
|
||||
private static final Item TUNA = new Item(361);
|
||||
|
||||
/**
|
||||
* Represents the potato item.
|
||||
*/
|
||||
private static final Item POTATO = new Item(1942);
|
||||
|
||||
/**
|
||||
* Represents the part one pie item.
|
||||
*/
|
||||
private static final Item PART_ONE = new Item(7192);
|
||||
|
||||
/**
|
||||
* Represents the part two pie item.
|
||||
*/
|
||||
private static final Item PART_TWO = new Item(7194);
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return UNCOOKED_PIE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { SALMON, TUNA, POTATO };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] { PIE_SHELL, PART_ONE, PART_TWO, UNCOOKED_PIE };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package content.global.skill.cooking.recipe.pie.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.pie.PieRecipe;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the apple pie recipe. This recipe consists of cooking apples and a
|
||||
* pie shell.
|
||||
* @author 'Vexia
|
||||
* @date 21/12/2013
|
||||
*/
|
||||
public class ApplePie extends PieRecipe {
|
||||
|
||||
/**
|
||||
* Represents the uncooked redberry pie.
|
||||
*/
|
||||
private static final Item UNCOOKED_PIE = new Item(2317);
|
||||
|
||||
/**
|
||||
* Represents the cooking apple item.
|
||||
*/
|
||||
private static final Item COOKING_APPLE = new Item(1955);
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return UNCOOKED_PIE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { COOKING_APPLE };
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package content.global.skill.cooking.recipe.pie.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.pie.PieRecipe;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the garden pie recipe. This pie consists of mixing, tomato, onion,
|
||||
* and cabbage together.
|
||||
* @author 'Vexia
|
||||
* @date 21/12/2013
|
||||
*/
|
||||
public class FishPie extends PieRecipe {
|
||||
|
||||
/**
|
||||
* Represents the uncooked redberry pie.
|
||||
*/
|
||||
private static final Item UNCOOKED_PIE = new Item(7186);
|
||||
|
||||
/**
|
||||
* Represents the trout item ingredient.
|
||||
*/
|
||||
private static final Item TROUT = new Item(333);
|
||||
|
||||
/**
|
||||
* Represents the cod item ingredient.
|
||||
*/
|
||||
private static final Item COD = new Item(339);
|
||||
|
||||
/**
|
||||
* Represents the potato item.
|
||||
*/
|
||||
private static final Item POTATO = new Item(1942);
|
||||
|
||||
/**
|
||||
* Represents the part one pie item.
|
||||
*/
|
||||
private static final Item PART_ONE = new Item(7182);
|
||||
|
||||
/**
|
||||
* Represents the part two pie item.
|
||||
*/
|
||||
private static final Item PART_TWO = new Item(7184);
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return UNCOOKED_PIE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { TROUT, COD, POTATO };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] { PIE_SHELL, PART_ONE, PART_TWO, UNCOOKED_PIE };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package content.global.skill.cooking.recipe.pie.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.pie.PieRecipe;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the garden pie recipe. This pie consists of mixing, tomato, onion,
|
||||
* and cabbage together.
|
||||
* @author 'Vexia
|
||||
* @date 21/12/2013
|
||||
*/
|
||||
public class GardenPie extends PieRecipe {
|
||||
|
||||
/**
|
||||
* Represents the uncooked redberry pie.
|
||||
*/
|
||||
private static final Item UNCOOKED_PIE = new Item(7176);
|
||||
|
||||
/**
|
||||
* Represents the tomato ingredient item.
|
||||
*/
|
||||
private static final Item TOMATO = new Item(1982);
|
||||
|
||||
/**
|
||||
* Represents the onion ingredient item.
|
||||
*/
|
||||
private static final Item ONION = new Item(1957);
|
||||
|
||||
/**
|
||||
* Represents the cabbage ingredient item.
|
||||
*/
|
||||
private static final Item CABBAGE = new Item(1965);
|
||||
|
||||
/**
|
||||
* Represents the part one pie item.
|
||||
*/
|
||||
private static final Item PART_ONE = new Item(7172);
|
||||
|
||||
/**
|
||||
* Represents the part two pie item.
|
||||
*/
|
||||
private static final Item PART_TWO = new Item(7174);
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return UNCOOKED_PIE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { TOMATO, ONION, CABBAGE };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] { PIE_SHELL, PART_ONE, PART_TWO, UNCOOKED_PIE };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package content.global.skill.cooking.recipe.pie.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.pie.PieRecipe;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the meat pie recipe.
|
||||
* @author 'Vexia
|
||||
* @date 21/12/2013
|
||||
*/
|
||||
public class MeatPie extends PieRecipe {
|
||||
|
||||
/**
|
||||
* Represents the uncooked redberry pie.
|
||||
*/
|
||||
private static final Item UNCOOKED_PIE = new Item(2319);
|
||||
|
||||
/**
|
||||
* Represents the cooked meat item.
|
||||
*/
|
||||
private static final Item COOKED_MEAT = new Item(2142);
|
||||
|
||||
/**
|
||||
* Represents the cooked chicken item.
|
||||
*/
|
||||
private static final Item COOKED_CHICKEN = new Item(2140);
|
||||
|
||||
/**
|
||||
* Represents the cooked rabbit.
|
||||
*/
|
||||
private static final Item COOKED_RABBIT = new Item(3228);
|
||||
|
||||
@Override
|
||||
public void mix(final Player player, final NodeUsageEvent event) {
|
||||
if (player.getInventory().remove(event.getUsedItem()) && player.getInventory().remove(event.getBaseItem())) {
|
||||
player.getInventory().add(getProduct());
|
||||
player.getPacketDispatch().sendMessage(getMixMessage(event));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return UNCOOKED_PIE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { COOKED_MEAT, COOKED_CHICKEN, COOKED_RABBIT };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMixMessage(final NodeUsageEvent event) {
|
||||
return "You fill the pie with meat.";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package content.global.skill.cooking.recipe.pie.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.pie.PieRecipe;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the mud pie recipe. A mud pie consists of mixing compost, water
|
||||
* and clay together.
|
||||
* @author 'Vexia
|
||||
* @date 21/12/2013
|
||||
*/
|
||||
public class MudPie extends PieRecipe {
|
||||
|
||||
/**
|
||||
* Represents the uncooked redberry pie.
|
||||
*/
|
||||
private static final Item UNCOOKED_PIE = new Item(7168);
|
||||
|
||||
/**
|
||||
* Represents the compost item.
|
||||
*/
|
||||
private static final Item COMPOST = new Item(6032);
|
||||
|
||||
/**
|
||||
* Represents the bucket of water item.
|
||||
*/
|
||||
private static final Item BUCKET_OF_WATER = new Item(1929);
|
||||
|
||||
/**
|
||||
* Represents the clay item.
|
||||
*/
|
||||
private static final Item CLAY = new Item(434);
|
||||
|
||||
/**
|
||||
* Represents the part one pie item.
|
||||
*/
|
||||
private static final Item PART_ONE = new Item(7164);
|
||||
|
||||
/**
|
||||
* Represents the part two pie item.
|
||||
*/
|
||||
private static final Item PART_TWO = new Item(7166);
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return UNCOOKED_PIE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { COMPOST, BUCKET_OF_WATER, CLAY };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] { PIE_SHELL, PART_ONE, PART_TWO, UNCOOKED_PIE };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package content.global.skill.cooking.recipe.pie.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.pie.PieRecipe;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents a redberry pie recipe.
|
||||
* @author 'Vexia
|
||||
* @date 21/12/2013
|
||||
*/
|
||||
public class RedberryPie extends PieRecipe {
|
||||
|
||||
/**
|
||||
* Represents the uncooked redberry pie.
|
||||
*/
|
||||
private static final Item UNCOOKED_PIE = new Item(2321);
|
||||
|
||||
/**
|
||||
* Represents the redberries pie.
|
||||
*/
|
||||
private static final Item REDBERRIES = new Item(1951);
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return UNCOOKED_PIE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { REDBERRIES };
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package content.global.skill.cooking.recipe.pie.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.pie.PieRecipe;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the summer pie recipe. This recipe consists of mixing stawberry,
|
||||
* watermelon, and an apple.
|
||||
* @author 'Vexia
|
||||
* @date 21/12/2013
|
||||
*/
|
||||
public class SummerPie extends PieRecipe {
|
||||
|
||||
/**
|
||||
* Represents the uncooked redberry pie.
|
||||
*/
|
||||
private static final Item UNCOOKED_PIE = new Item(7216);
|
||||
|
||||
/**
|
||||
* Represents the strawberry item.
|
||||
*/
|
||||
private static final Item STRAWBERRY = new Item(5504);
|
||||
|
||||
/**
|
||||
* Represents the watermelon item.
|
||||
*/
|
||||
private static final Item WATERMELON = new Item(5982);
|
||||
|
||||
/**
|
||||
* Represents the cooking apple item.
|
||||
*/
|
||||
private static final Item COOKING_APPLE = new Item(1955);
|
||||
|
||||
/**
|
||||
* Represents the part one pie item.
|
||||
*/
|
||||
private static final Item PART_ONE = new Item(7212);
|
||||
|
||||
/**
|
||||
* Represents the part two pie item.
|
||||
*/
|
||||
private static final Item PART_TWO = new Item(7214);
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return UNCOOKED_PIE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { STRAWBERRY, WATERMELON, COOKING_APPLE };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] { PIE_SHELL, PART_ONE, PART_TWO, UNCOOKED_PIE };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package content.global.skill.cooking.recipe.pie.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.pie.PieRecipe;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the wild pie recipe. This recipe consists of mixing raw beat meat,
|
||||
* raw chomp, and raw rabbit into a pie shell.
|
||||
* @author 'Vexia
|
||||
* @date 21/12/2013
|
||||
*/
|
||||
public class WildPie extends PieRecipe {
|
||||
|
||||
/**
|
||||
* Represents the uncooked redberry pie.
|
||||
*/
|
||||
private static final Item UNCOOKED_PIE = new Item(7206);
|
||||
|
||||
/**
|
||||
* Represents the raw bear meat item.
|
||||
*/
|
||||
private static final Item BEAR_MEAT = new Item(2136);
|
||||
|
||||
/**
|
||||
* Represents the raw chompy meat item.
|
||||
*/
|
||||
private static final Item CHOMPY_MEAT = new Item(2876);
|
||||
|
||||
/**
|
||||
* Represents the raw rabbit meat item.
|
||||
*/
|
||||
private static final Item RABBIT_MEAT = new Item(3226);
|
||||
|
||||
/**
|
||||
* Represents the part one pie item.
|
||||
*/
|
||||
private static final Item PART_ONE = new Item(7202);
|
||||
|
||||
/**
|
||||
* Represents the part two pie item.
|
||||
*/
|
||||
private static final Item PART_TWO = new Item(7204);
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return UNCOOKED_PIE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { BEAR_MEAT, CHOMPY_MEAT, RABBIT_MEAT };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] { PIE_SHELL, PART_ONE, PART_TWO, UNCOOKED_PIE };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package content.global.skill.cooking.recipe.pizza;
|
||||
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import content.global.skill.cooking.recipe.Recipe;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the generic recipe for a pizza.
|
||||
* @author ceikry
|
||||
*/
|
||||
public abstract class PizzaRecipe extends Recipe {
|
||||
|
||||
/**
|
||||
* Represents the plain pizza.
|
||||
*/
|
||||
protected static final Item PLAIN_PIZZA = new Item(2289);
|
||||
|
||||
/**
|
||||
* Method used to get the experience gained from adding the final
|
||||
* ingredient.
|
||||
* @return the experience.
|
||||
*/
|
||||
public abstract double getExperience();
|
||||
|
||||
/**
|
||||
* Method used to get the level required.
|
||||
* @return the level required.
|
||||
*/
|
||||
public abstract int getLevel();
|
||||
|
||||
@Override
|
||||
public void mix(final Player player, final NodeUsageEvent event) {
|
||||
if (player.getSkills().getLevel(Skills.COOKING) < getLevel()) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a Cooking level of at least " + getLevel() + " in order to do this.");
|
||||
return;
|
||||
}
|
||||
super.singleMix(player, event);
|
||||
player.getSkills().addExperience(Skills.COOKING, getExperience(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getBase() {
|
||||
return PLAIN_PIZZA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMixMessage(final NodeUsageEvent event) {
|
||||
return "You add " + event.getBaseItem().getName().toLowerCase() + " to the pizza.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package content.global.skill.cooking.recipe.pizza.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.pizza.PizzaRecipe;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the anchovy pizza. This recipe consists of adding anchovies to a
|
||||
* plain pizza.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public class AnchovyPizza extends PizzaRecipe {
|
||||
|
||||
/**
|
||||
* Represents the anchovy pizza item.
|
||||
*/
|
||||
private static final Item ANCHOVY_PIZZA = new Item(2297);
|
||||
|
||||
/**
|
||||
* Represents the anchovies item.
|
||||
*/
|
||||
private static final Item ANCHOVIES = new Item(319);
|
||||
|
||||
@Override
|
||||
public double getExperience() {
|
||||
return 39;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return ANCHOVY_PIZZA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { ANCHOVIES };
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevel() {
|
||||
return 55;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package content.global.skill.cooking.recipe.pizza.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.pizza.PizzaRecipe;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the meat pizza recipe. This recipe consists of adding cooked meat
|
||||
* to a plain pizza.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public class MeatPizza extends PizzaRecipe {
|
||||
|
||||
/**
|
||||
* Represents the meat pizza item.
|
||||
*/
|
||||
private static final Item MEAT_PIZZA = new Item(2293);
|
||||
|
||||
/**
|
||||
* Represents the cooked meat item.
|
||||
*/
|
||||
private static final Item COOKED_MEAT = new Item(2142);
|
||||
|
||||
/**
|
||||
* Represents the cooked chicken item.
|
||||
*/
|
||||
private static final Item COOKED_CHICKEN = new Item(2140);
|
||||
|
||||
@Override
|
||||
public double getExperience() {
|
||||
return 26;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevel() {
|
||||
return 45;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return MEAT_PIZZA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { COOKED_MEAT, COOKED_CHICKEN };
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package content.global.skill.cooking.recipe.pizza.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.pizza.PizzaRecipe;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the pineapple pizza recipe. This recipe consists of mixing either
|
||||
* pineapple chunks or pineapple rings.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public class PineapplePizza extends PizzaRecipe {
|
||||
|
||||
/**
|
||||
* Represents the pineapple pizza item.
|
||||
*/
|
||||
private static final Item PINEAPPLE_PIZZA = new Item(2301);
|
||||
|
||||
/**
|
||||
* Represents the pineapple ring item.
|
||||
*/
|
||||
private static final Item PINEAPPLE_RING = new Item(2118);
|
||||
|
||||
/**
|
||||
* Represents the pineapple chunk item.
|
||||
*/
|
||||
private static final Item PINEAPPLE_CHUNKS = new Item(2116);
|
||||
|
||||
@Override
|
||||
public double getExperience() {
|
||||
return 52;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevel() {
|
||||
return 65;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return PINEAPPLE_PIZZA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { PINEAPPLE_CHUNKS, PINEAPPLE_RING };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMixMessage(NodeUsageEvent event) {
|
||||
return "You add the " + event.getBaseItem().getName().toLowerCase() + " to the pizza.";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package content.global.skill.cooking.recipe.pizza.impl;
|
||||
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import content.global.skill.cooking.recipe.Recipe;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the plain pizza recipe. This recipe consists of mixing tomato, and
|
||||
* cheese to a pizza base.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public class PlainPizza extends Recipe {
|
||||
|
||||
/**
|
||||
* Represents the pizza base.
|
||||
*/
|
||||
private static final Item PIZZA_BASE = new Item(2283);
|
||||
|
||||
/**
|
||||
* Represents the uncooked pizza.
|
||||
*/
|
||||
private static final Item UNCOOKED_PIZZA = new Item(2287);
|
||||
|
||||
/**
|
||||
* Represents the incomplete pizza.
|
||||
*/
|
||||
private static final Item INCOMPLETE_PIZZA = new Item(2285);
|
||||
|
||||
/**
|
||||
* Represents the tomato ingredient item.
|
||||
*/
|
||||
private static final Item TOMATO = new Item(1982);
|
||||
|
||||
/**
|
||||
* Represents the cheese item.
|
||||
*/
|
||||
private static final Item CHEESE = new Item(1985);
|
||||
|
||||
@Override
|
||||
public void mix(final Player player, final NodeUsageEvent event) {
|
||||
if (player.getSkills().getLevel(Skills.COOKING) < 35) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a Cooking level of at least " + 35 + " in order to do this.");
|
||||
return;
|
||||
}
|
||||
super.mix(player, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getBase() {
|
||||
return PIZZA_BASE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return UNCOOKED_PIZZA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { TOMATO, CHEESE };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] { PIZZA_BASE, INCOMPLETE_PIZZA, UNCOOKED_PIZZA };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMixMessage(NodeUsageEvent event) {
|
||||
return "You add the " + event.getBaseItem().getName().toLowerCase() + " to the pizza.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package content.global.skill.cooking.recipe.potato;
|
||||
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import content.global.skill.cooking.recipe.Recipe;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents a generic potato topping recipe.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public abstract class PotatoRecipe extends Recipe {
|
||||
|
||||
/**
|
||||
* Represents the potato with butter.
|
||||
*/
|
||||
private static final Item POTATO_WITH_BUTTER = new Item(6703);
|
||||
|
||||
/**
|
||||
* Represents the bowl item.
|
||||
*/
|
||||
protected static final Item BOWL = new Item(1923);
|
||||
|
||||
@Override
|
||||
public void mix(final Player player, final NodeUsageEvent event) {
|
||||
if (player.getSkills().getLevel(Skills.COOKING) < getLevel()) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a Cooking level of at least " + getLevel() + " in order to do this.");
|
||||
return;
|
||||
}
|
||||
super.singleMix(player, event);
|
||||
if (isTopping()) {
|
||||
player.getInventory().add(BOWL);
|
||||
}
|
||||
player.getSkills().addExperience(Skills.COOKING, getExperience(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getBase() {
|
||||
return POTATO_WITH_BUTTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMixMessage(NodeUsageEvent event) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to check if it is a topping recipe.
|
||||
* @return <code>True</code> if it is a topping.
|
||||
*/
|
||||
public abstract boolean isTopping();
|
||||
|
||||
/**
|
||||
* Method used to get the level required.
|
||||
* @return the level.
|
||||
*/
|
||||
public abstract int getLevel();
|
||||
|
||||
/**
|
||||
* Method used to get the experience gained.
|
||||
* @return the experience.
|
||||
*/
|
||||
public abstract double getExperience();
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package content.global.skill.cooking.recipe.potato.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.Recipe;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the butter potato recipe. This recipe consists of adding a pat of
|
||||
* butter to a potato.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public class ButterPotato extends Recipe {
|
||||
|
||||
/**
|
||||
* Represents the baked potato.
|
||||
*/
|
||||
private static final Item BAKED_POTATO = new Item(6701);
|
||||
|
||||
/**
|
||||
* Represents the potato with butter.
|
||||
*/
|
||||
private static final Item POTATO_WITH_BUTTER = new Item(6703);
|
||||
|
||||
/**
|
||||
* Represents the pat of butter.
|
||||
*/
|
||||
private static final Item PAT_OF_BUTTER = new Item(6697);
|
||||
|
||||
@Override
|
||||
public void mix(final Player player, final NodeUsageEvent event) {
|
||||
if (player.getSkills().getLevel(Skills.COOKING) < 39) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a Cooking level of at least " + 39 + " in order to do this.");
|
||||
return;
|
||||
}
|
||||
super.singleMix(player, event);
|
||||
player.getSkills().addExperience(Skills.COOKING, 40.5, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getBase() {
|
||||
return BAKED_POTATO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return POTATO_WITH_BUTTER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { PAT_OF_BUTTER };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMixMessage(NodeUsageEvent event) {
|
||||
return "You add a pat of butter to the potato.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package content.global.skill.cooking.recipe.potato.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.potato.PotatoRecipe;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the cheese potato. This recipe consists of mixing cheese witha
|
||||
* baked potato.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public class CheesePotato extends PotatoRecipe {
|
||||
|
||||
/**
|
||||
* Represents the cheese potato.
|
||||
*/
|
||||
private static final Item CHEESE_POTATO = new Item(6705);
|
||||
|
||||
/**
|
||||
* Represents the cheese item.
|
||||
*/
|
||||
private static final Item CHEESE = new Item(1985);
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return CHEESE_POTATO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { CHEESE };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTopping() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevel() {
|
||||
return 47;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getExperience() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package content.global.skill.cooking.recipe.potato.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.potato.PotatoRecipe;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the chilli potato recipe. This recipe consists of adding chilli
|
||||
* con carne to a baked butter potato.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public class ChilliPotato extends PotatoRecipe {
|
||||
|
||||
/**
|
||||
* Represents the chilli potato item.
|
||||
*/
|
||||
private static final Item CHILLI_POTATO = new Item(7054);
|
||||
|
||||
/**
|
||||
* Represents the chilli con carne item/
|
||||
*/
|
||||
private static final Item CHILLI_CON_CARNE = new Item(7062);
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return CHILLI_POTATO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { CHILLI_CON_CARNE };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTopping() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevel() {
|
||||
return 41;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getExperience() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package content.global.skill.cooking.recipe.potato.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.potato.PotatoRecipe;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the egg potato recipe. This recipe consists of mixing a egg and a
|
||||
* tomato.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public class EggPotato extends PotatoRecipe {
|
||||
|
||||
/**
|
||||
* Represents the egg potato.
|
||||
*/
|
||||
private static final Item EGG_POTATO = new Item(7056);
|
||||
|
||||
/**
|
||||
* Represents the topping item.
|
||||
*/
|
||||
private static final Item TOPPING = new Item(7064);
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return EGG_POTATO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { TOPPING };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTopping() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevel() {
|
||||
return 51;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getExperience() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package content.global.skill.cooking.recipe.potato.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.potato.PotatoRecipe;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the mushrrom potato. This recipe consists of mixing a baked potato
|
||||
* with mushroom and onion toppings.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public class MushroomPotato extends PotatoRecipe {
|
||||
|
||||
/**
|
||||
* Represents the egg potato.
|
||||
*/
|
||||
private static final Item MUSHROOM_POTATO = new Item(7058);
|
||||
|
||||
/**
|
||||
* Represents the topping item.
|
||||
*/
|
||||
private static final Item TOPPING = new Item(7066);
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return MUSHROOM_POTATO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { TOPPING };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTopping() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevel() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getExperience() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package content.global.skill.cooking.recipe.potato.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.potato.PotatoRecipe;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the tuna potato recipe. This recipe consists of mixing tuna and
|
||||
* corn toppings.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public class TunaPotato extends PotatoRecipe {
|
||||
|
||||
/**
|
||||
* Represents the tuna potato.
|
||||
*/
|
||||
private static final Item TUNA_POTATO = new Item(7060);
|
||||
|
||||
/**
|
||||
* Represents the topping item.
|
||||
*/
|
||||
private static final Item TOPPING = new Item(7068);
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return TUNA_POTATO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { TOPPING };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTopping() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevel() {
|
||||
return 68;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getExperience() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,89 @@
|
||||
package content.global.skill.cooking.recipe.stew;
|
||||
|
||||
import content.global.skill.cooking.recipe.Recipe;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the curry recipe. This recipe consists of mixing 3 curry leaves or
|
||||
* a spice into a stew.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public class CurryRecipe extends Recipe {
|
||||
|
||||
/**
|
||||
* Represents the uncooked curry item.
|
||||
*/
|
||||
private static final Item UNCOOKED_CURRY = new Item(2009);
|
||||
|
||||
/**
|
||||
* Represents the uncooked stew item.
|
||||
*/
|
||||
private static final Item UNCOOKED_STEW = new Item(2001);
|
||||
|
||||
/**
|
||||
* Represents the spice item.
|
||||
*/
|
||||
private static final Item SPICE = new Item(2007);
|
||||
|
||||
/**
|
||||
* Represents the curry leaf.
|
||||
*/
|
||||
private static final Item CURRY_LEAF = new Item(5970);
|
||||
|
||||
@Override
|
||||
public void mix(Player player, NodeUsageEvent event) {
|
||||
if (event.getBaseItem().getId() == CURRY_LEAF.getId() || event.getUsedItem().getId() == CURRY_LEAF.getId()) {
|
||||
Item stew = event.getBaseItem().getId() == UNCOOKED_STEW.getId() ? event.getBaseItem() : event.getUsedItem();
|
||||
if (stew.getCharge() == 1000) {
|
||||
stew.setCharge(1);
|
||||
}
|
||||
int charge = stew.getCharge();
|
||||
if (charge < 3) {
|
||||
player.getInventory().remove(CURRY_LEAF);
|
||||
stew.setCharge(charge + 1);
|
||||
} else {
|
||||
if (player.getInventory().remove(stew) && player.getInventory().remove(CURRY_LEAF)) {
|
||||
player.getInventory().add(UNCOOKED_CURRY);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (player.getInventory().remove(event.getBaseItem()) && player.getInventory().remove(event.getUsedItem())) {
|
||||
player.getInventory().add(getProduct());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getBase() {
|
||||
return UNCOOKED_STEW;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return UNCOOKED_CURRY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { SPICE, CURRY_LEAF };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] { UNCOOKED_STEW };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMixMessage(NodeUsageEvent event) {
|
||||
return "You mix the spice with the stew.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package content.global.skill.cooking.recipe.stew;
|
||||
|
||||
import content.global.skill.cooking.recipe.Recipe;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the stew recipe. This recipe consists of mixing meat and a raw
|
||||
* potato in a bowl of water.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public class StewRecipe extends Recipe {
|
||||
|
||||
/**
|
||||
* Represents the uncooked stew item.
|
||||
*/
|
||||
private static final Item UNCOOKED_STEW = new Item(2001);
|
||||
|
||||
/**
|
||||
* Represents the bowl of water item.
|
||||
*/
|
||||
private static final Item BOWL_OF_WATER = new Item(1921);
|
||||
|
||||
/**
|
||||
* Represents the meat item.
|
||||
*/
|
||||
private static final Item MEAT = new Item(2142);
|
||||
|
||||
/**
|
||||
* Represents the potato item.
|
||||
*/
|
||||
private static final Item POTATO = new Item(1942);
|
||||
|
||||
/**
|
||||
* Represents the incomplete stew.
|
||||
*/
|
||||
private static final Item INCOMPLETE_STEW = new Item(1997);
|
||||
|
||||
/**
|
||||
* Represents the second incomplete stew.
|
||||
*/
|
||||
private static final Item INCOMPLETE_STEW2 = new Item(1999);
|
||||
|
||||
@Override
|
||||
public void mix(Player player, NodeUsageEvent event) {
|
||||
Item first = event.getUsedItem();
|
||||
Item second = event.getBaseItem();
|
||||
if(first != null && second != null) {
|
||||
if (player.getInventory().remove(first) && player.getInventory().remove(second)) {
|
||||
if (first.getId() == BOWL_OF_WATER.getId() || second.getId() == BOWL_OF_WATER.getId()) {
|
||||
player.getInventory().add(first.getId() == POTATO.getId() ? INCOMPLETE_STEW : first.getId() == MEAT.getId() ? INCOMPLETE_STEW2 : second.getId() == POTATO.getId() ? INCOMPLETE_STEW : second.getId() == MEAT.getId() ? INCOMPLETE_STEW2 : null);
|
||||
} else {
|
||||
player.getInventory().add(UNCOOKED_STEW);
|
||||
}
|
||||
player.getPacketDispatch().sendMessage(getMixMessage(event));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getBase() {
|
||||
return BOWL_OF_WATER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return UNCOOKED_STEW;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { MEAT, POTATO, MEAT, POTATO };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] { BOWL_OF_WATER, BOWL_OF_WATER, INCOMPLETE_STEW, INCOMPLETE_STEW2 };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMixMessage(NodeUsageEvent event) {
|
||||
return "You cut up the " + (event.getUsedItem().getName().toLowerCase().contains("incomplete") ? event.getBaseItem().getName().toLowerCase() : event.getUsedItem().getName().toLowerCase().replace("cooked", "").trim()) + " and put it into the stew.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package content.global.skill.cooking.recipe.topping;
|
||||
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import content.global.skill.cooking.recipe.Recipe;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents a generic topping recipe.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public abstract class ToppingRecipe extends Recipe {
|
||||
|
||||
/**
|
||||
* Represents the bowl item.
|
||||
*/
|
||||
protected static final Item BOWL = new Item(1923);
|
||||
|
||||
@Override
|
||||
public void mix(final Player player, final NodeUsageEvent event) {
|
||||
if (player.getSkills().getLevel(Skills.COOKING) < getLevel()) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a Cooking level of at least " + getLevel() + " in order to do this.");
|
||||
return;
|
||||
}
|
||||
super.mix(player, event);
|
||||
player.getSkills().addExperience(Skills.COOKING, getExperience(), true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getBase() {
|
||||
return BOWL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMixMessage(NodeUsageEvent event) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used to get the level required.
|
||||
* @return the level.
|
||||
*/
|
||||
public abstract int getLevel();
|
||||
|
||||
/**
|
||||
* Method used to get the experience gained.
|
||||
* @return the experience.
|
||||
*/
|
||||
public abstract double getExperience();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package content.global.skill.cooking.recipe.topping.impl;
|
||||
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import content.global.skill.cooking.recipe.Recipe;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the chilli con carne recipe. This recipe consists of using spicy
|
||||
* sauce with cooked meat.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public class ChilliConCarne extends Recipe {
|
||||
|
||||
/**
|
||||
* Represents the bowl item.
|
||||
*/
|
||||
private static final Item SPICY_SAUCE = new Item(7072);
|
||||
|
||||
/**
|
||||
* Represents the chilli con carne item.
|
||||
*/
|
||||
private static final Item CHILLI_CON_CARNE = new Item(7062);
|
||||
|
||||
/**
|
||||
* Represents the cooked meat item.
|
||||
*/
|
||||
private static final Item COOKED_MEAT = new Item(2142);
|
||||
|
||||
/**
|
||||
* Represents the knife item.
|
||||
*/
|
||||
private static final Item KNIFE = new Item(946);
|
||||
|
||||
@Override
|
||||
public void mix(final Player player, final NodeUsageEvent event) {
|
||||
if (player.getSkills().getLevel(Skills.COOKING) < 9) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a Cooking level of at least " + 9 + " in order to do this.");
|
||||
return;
|
||||
}
|
||||
if (!player.getInventory().containsItem(KNIFE)) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a knife in order to cut up the meat.");
|
||||
return;
|
||||
}
|
||||
super.mix(player, event);
|
||||
player.getSkills().addExperience(Skills.COOKING, 25, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getBase() {
|
||||
return SPICY_SAUCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return CHILLI_CON_CARNE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { COOKED_MEAT };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMixMessage(NodeUsageEvent event) {
|
||||
return "You put the cut up meat into the bowl.";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package content.global.skill.cooking.recipe.topping.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.topping.ToppingRecipe;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the chopped onion recipe. This recipe consists of using an onion
|
||||
* on a bowl with a knife.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public class ChoppedOnion extends ToppingRecipe {
|
||||
|
||||
/**
|
||||
* Represents the chopped onion product item.
|
||||
*/
|
||||
private static final Item CHOPPED_ONION = new Item(1871);
|
||||
|
||||
/**
|
||||
* Represents the knife used to cut the onion.
|
||||
*/
|
||||
private static final Item KNIFE = new Item(946);
|
||||
|
||||
/**
|
||||
* Represents the onion item.
|
||||
*/
|
||||
private static final Item ONION = new Item(1957);
|
||||
|
||||
@Override
|
||||
public void mix(final Player player, final NodeUsageEvent event) {
|
||||
if (!player.getInventory().containsItem(KNIFE)) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a knife in order to slice up the onion.");
|
||||
return;
|
||||
}
|
||||
super.mix(player, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevel() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getExperience() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return CHOPPED_ONION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { ONION };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package content.global.skill.cooking.recipe.topping.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.topping.ToppingRecipe;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the chopped tuna recipe. This recipe consists of adding tuna to a
|
||||
* bowl with a knife.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public class ChoppedTuna extends ToppingRecipe {
|
||||
|
||||
/**
|
||||
* Represents the chopped tuna item.
|
||||
*/
|
||||
private static final Item CHOPPED_TUNA = new Item(7086);
|
||||
|
||||
/**
|
||||
* Represents the tuna item.
|
||||
*/
|
||||
private static final Item TUNA = new Item(361);
|
||||
|
||||
/**
|
||||
* Represents the knife item.
|
||||
*/
|
||||
private static final Item KNIFE = new Item(946);
|
||||
|
||||
@Override
|
||||
public void mix(final Player player, final NodeUsageEvent event) {
|
||||
if (!player.getInventory().containsItem(KNIFE)) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a knife in order to slice up the tuna.");
|
||||
return;
|
||||
}
|
||||
super.mix(player, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevel() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getExperience() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return CHOPPED_TUNA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { TUNA };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package content.global.skill.cooking.recipe.topping.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.Recipe;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the egg and tomato recipe. This recipe consists of mixing a tomato
|
||||
* with a scrambled egg.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public class EggAndTomato extends Recipe {
|
||||
|
||||
/**
|
||||
* Represents the egg and tomato.
|
||||
*/
|
||||
private static final Item EGG_AND_TOMATO = new Item(7064);
|
||||
|
||||
/**
|
||||
* Represents the scrambled egg item.
|
||||
*/
|
||||
private static final Item SCRAMBLED_EGG = new Item(7078);
|
||||
|
||||
/**
|
||||
* epresents the tomato item.
|
||||
*/
|
||||
private static final Item TOMATO = new Item(1982);
|
||||
|
||||
@Override
|
||||
public void mix(final Player player, final NodeUsageEvent event) {
|
||||
if (player.getSkills().getLevel(Skills.COOKING) < 23) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a Cooking level of at least " + 23 + " in order to do this.");
|
||||
return;
|
||||
}
|
||||
super.mix(player, event);
|
||||
player.getSkills().addExperience(Skills.COOKING, 50, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getBase() {
|
||||
return SCRAMBLED_EGG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return EGG_AND_TOMATO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { TOMATO };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMixMessage(NodeUsageEvent event) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package content.global.skill.cooking.recipe.topping.impl;
|
||||
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import content.global.skill.cooking.recipe.Recipe;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the mushroom and onion recipe. This recipe consists of using a
|
||||
* fried mushroom with a friend onion.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public class MushroomAndOnion extends Recipe {
|
||||
|
||||
/**
|
||||
* Represents the mushroom and onion item.
|
||||
*/
|
||||
private static final Item MUSHROOM_AND_ONION = new Item(7066);
|
||||
|
||||
/**
|
||||
* Represents the fried onions item.
|
||||
*/
|
||||
private static final Item FRIED_ONIONS = new Item(7084);
|
||||
|
||||
/**
|
||||
* Represents the fried mushrooms item.
|
||||
*/
|
||||
private static final Item FRIED_MUSHROOMS = new Item(7082);
|
||||
|
||||
@Override
|
||||
public void mix(final Player player, final NodeUsageEvent event) {
|
||||
if (player.getSkills().getLevel(Skills.COOKING) < 57) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a Cooking level of at least " + 57 + " in order to do this.");
|
||||
return;
|
||||
}
|
||||
super.mix(player, event);
|
||||
player.getSkills().addExperience(Skills.COOKING, 120, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getBase() {
|
||||
return FRIED_MUSHROOMS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return MUSHROOM_AND_ONION;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { FRIED_ONIONS };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMixMessage(NodeUsageEvent event) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package content.global.skill.cooking.recipe.topping.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.topping.ToppingRecipe;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the fried mushroom recipe. This recipe consists of using a
|
||||
* mushroom on a bowl.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public final class SlicedMushroom extends ToppingRecipe {
|
||||
|
||||
/**
|
||||
* Represents the sliced mushrooms item.
|
||||
*/
|
||||
private static final Item SLICED_MUSHROOMS = new Item(7080);
|
||||
|
||||
/**
|
||||
* Represents the mushroom item.
|
||||
*/
|
||||
private static final Item MUSHROOM = new Item(6004);
|
||||
|
||||
/**
|
||||
* Represents the knife item.
|
||||
*/
|
||||
private static final Item KNIFE = new Item(946);
|
||||
|
||||
@Override
|
||||
public void mix(final Player player, final NodeUsageEvent event) {
|
||||
if (!player.getInventory().containsItem(KNIFE)) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a knife in order to slice up the mushrooms.");
|
||||
return;
|
||||
}
|
||||
super.mix(player, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLevel() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getExperience() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return SLICED_MUSHROOMS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { MUSHROOM };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
package content.global.skill.cooking.recipe.topping.impl;
|
||||
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import content.global.skill.cooking.recipe.Recipe;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the spicy sauce recipe. This recipe consists of mixing gnome spice
|
||||
* and garlic together.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public class SpicySauce extends Recipe {
|
||||
|
||||
/**
|
||||
* Represents the spicy sauce item.
|
||||
*/
|
||||
private static final Item SPICY_SAUCE = new Item(7072);
|
||||
|
||||
/**
|
||||
* Represents the bowl item.
|
||||
*/
|
||||
private static final Item BOWL = new Item(1923);
|
||||
|
||||
/**
|
||||
* Represents the garlic item.
|
||||
*/
|
||||
private static final Item GARLIC = new Item(1550);
|
||||
|
||||
/**
|
||||
* Represents the chopped garlic item.
|
||||
*/
|
||||
private static final Item CHOPPED_GARLIC = new Item(7074);
|
||||
|
||||
/**
|
||||
* Represents the gnome spice item.
|
||||
*/
|
||||
private static final Item GNOME_SPICE = new Item(2169);
|
||||
|
||||
@Override
|
||||
public void mix(final Player player, final NodeUsageEvent event) {
|
||||
if (player.getSkills().getLevel(Skills.COOKING) < 9) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a Cooking level of at least " + 9 + " in order to do this.");
|
||||
return;
|
||||
}
|
||||
super.mix(player, event);
|
||||
if (event.getBaseItem().getId() == GNOME_SPICE.getId() || event.getUsedItem().getId() == GNOME_SPICE.getId()) {
|
||||
player.getSkills().addExperience(Skills.COOKING, 25, true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getBase() {
|
||||
return BOWL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return SPICY_SAUCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { GARLIC, GNOME_SPICE };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] { BOWL, CHOPPED_GARLIC, SPICY_SAUCE };
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMixMessage(NodeUsageEvent event) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package content.global.skill.cooking.recipe.topping.impl;
|
||||
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import content.global.skill.cooking.recipe.Recipe;
|
||||
import core.game.interaction.NodeUsageEvent;
|
||||
import core.game.node.entity.player.Player;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the tuna and corn recipe. This recipe consists of adding cooked
|
||||
* sweetcorn to a bowl of chopped tuna.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public final class TunaAndCorn extends Recipe {
|
||||
|
||||
/**
|
||||
* Represents the chopped tuna item.
|
||||
*/
|
||||
private static final Item CHOPPED_TUNA = new Item(7086);
|
||||
|
||||
/**
|
||||
* Represents the cooked corn item.
|
||||
*/
|
||||
private static final Item COOKED_CORN = new Item(5988);
|
||||
|
||||
/**
|
||||
* Represents the tuna and corn item.
|
||||
*/
|
||||
private static final Item TUNA_AND_CORN = new Item(7068);
|
||||
|
||||
@Override
|
||||
public void mix(final Player player, final NodeUsageEvent event) {
|
||||
if (player.getSkills().getLevel(Skills.COOKING) < 67) {
|
||||
player.getDialogueInterpreter().sendDialogue("You need a Cooking level of at least " + 57 + " in order to do this.");
|
||||
return;
|
||||
}
|
||||
super.mix(player, event);
|
||||
player.getSkills().addExperience(Skills.COOKING, 204, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getBase() {
|
||||
return CHOPPED_TUNA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return TUNA_AND_CORN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { COOKED_CORN };
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] {};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getMixMessage(NodeUsageEvent event) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package content.global.skill.cooking.recipe.topping.impl;
|
||||
|
||||
import content.global.skill.cooking.recipe.topping.ToppingRecipe;
|
||||
import core.game.node.item.Item;
|
||||
|
||||
/**
|
||||
* Represents the uncooked egg recipe. This recipe consists of adding an
|
||||
* uncooked egg into a bowl.
|
||||
* @author 'Vexia
|
||||
* @date 22/12/2013
|
||||
*/
|
||||
public final class UncookedEgg extends ToppingRecipe {
|
||||
|
||||
/**
|
||||
* Represents the egg item.
|
||||
*/
|
||||
private static final Item EGG = new Item(1944);
|
||||
|
||||
/**
|
||||
* Represents the uncooked egg product.
|
||||
*/
|
||||
private static final Item UNCOOKED_EGG = new Item(7076);
|
||||
|
||||
@Override
|
||||
public int getLevel() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getExperience() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getProduct() {
|
||||
return UNCOOKED_EGG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getIngredients() {
|
||||
return new Item[] { EGG };
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingular() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item[] getParts() {
|
||||
return new Item[] {};
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user