diff --git a/Server/data/configs/item_configs.json b/Server/data/configs/item_configs.json index bf79f32e1..c67803975 100644 --- a/Server/data/configs/item_configs.json +++ b/Server/data/configs/item_configs.json @@ -20859,8 +20859,10 @@ { "ge_buy_limit": "200", "grand_exchange_price": "177", + "examine": "I need to add some meat too.", "durability": null, "name": "Incomplete stew", + "tradeable": "true", "archery_ticket_price": "0", "id": "1997" }, @@ -20876,8 +20878,10 @@ { "ge_buy_limit": "200", "grand_exchange_price": "210", + "examine": "I need to add some potato too.", "durability": null, "name": "Incomplete stew", + "tradeable": "true", "archery_ticket_price": "0", "id": "1999" }, @@ -64514,7 +64518,7 @@ }, { "ge_buy_limit": "10000", - "examine": "Raw sweetcorn.", + "examine": "A bowl of cooked sweetcorn.", "grand_exchange_price": "110", "durability": null, "name": "Sweetcorn", diff --git a/Server/src/main/content/data/consumables/Consumables.java b/Server/src/main/content/data/consumables/Consumables.java index 58143afc0..92c71fe18 100644 --- a/Server/src/main/content/data/consumables/Consumables.java +++ b/Server/src/main/content/data/consumables/Consumables.java @@ -118,6 +118,8 @@ public enum Consumables { EGG_AND_TOMATO(new Food(new int[] {7064, 1923}, new HealingEffect(8))), SWEET_CORN(new Food(new int[] {5988}, new MultiEffect(new HealingEffect(1), new PercentageHealthEffect(10)))), SWEETCORN_BOWL(new Food(new int[] {7088, 1923}, new MultiEffect(new HealingEffect(1), new PercentageHealthEffect(10)))), + CHOPPED_TUNA(new Food(new int[] {7086, 1923}, new HealingEffect(10))), + CHOPPED_ONION(new Food(new int[] {1871, 1923}, new HealingEffect(1))), POTATO_WITH_BUTTER(new Food(new int[] {6703}, new HealingEffect(7))), CHILLI_POTATO(new Food(new int[] {7054}, new HealingEffect(14))), FRIED_ONIONS(new Food(new int[] {7084, 1923}, new HealingEffect(5))), diff --git a/Server/src/main/content/global/skill/cooking/CakeListener.kt b/Server/src/main/content/global/skill/cooking/CakeListener.kt new file mode 100644 index 000000000..f5538371f --- /dev/null +++ b/Server/src/main/content/global/skill/cooking/CakeListener.kt @@ -0,0 +1,37 @@ +package content.global.skill.cooking + +import core.api.* +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import core.game.node.entity.skill.Skills +import org.rs09.consts.Items + +class CakeListener : InteractionListener { + val cakeArr = intArrayOf( + Items.EGG_1944, + Items.BUCKET_OF_MILK_1927, + Items.POT_OF_FLOUR_1933 + ) + + override fun defineListeners() { + onUseWith(IntType.ITEM, cakeArr, Items.CAKE_TIN_1887) { player, _, _ -> + if (getDynLevel(player, Skills.COOKING) < 40) { + sendMessage(player, "You need a Cooking level of at least 40 in order to do this.") + return@onUseWith true + } + + if(inInventory(player, Items.EGG_1944) && inInventory(player, Items.BUCKET_OF_MILK_1927) && inInventory(player, Items.POT_OF_FLOUR_1933) && inInventory(player, Items.CAKE_TIN_1887)) { + removeItem(player, Items.EGG_1944) + removeItem(player, Items.BUCKET_OF_MILK_1927) + removeItem(player, Items.POT_OF_FLOUR_1933) + removeItem(player, Items.CAKE_TIN_1887) + addItem(player, Items.EMPTY_POT_1931) + addItem(player, Items.UNCOOKED_CAKE_1889) + addItem(player, Items.BUCKET_1925) + sendMessage(player, "You mix the milk, flour and egg together to make a raw cake mix.") + return@onUseWith true + } + return@onUseWith false + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/cooking/CakeMakingPlugin.java b/Server/src/main/content/global/skill/cooking/CakeMakingPlugin.java deleted file mode 100644 index 084abf4c4..000000000 --- a/Server/src/main/content/global/skill/cooking/CakeMakingPlugin.java +++ /dev/null @@ -1,69 +0,0 @@ -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 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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/CoconutListener.kt b/Server/src/main/content/global/skill/cooking/CoconutListener.kt new file mode 100644 index 000000000..5f7da66d4 --- /dev/null +++ b/Server/src/main/content/global/skill/cooking/CoconutListener.kt @@ -0,0 +1,31 @@ +package content.global.skill.cooking + +import core.api.addItem +import core.api.removeItem +import core.api.sendMessage +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import org.rs09.consts.Items + +class CoconutListener : InteractionListener { + + override fun defineListeners() { + onUseWith(IntType.ITEM, Items.COCONUT_5974, Items.HAMMER_2347) { player, used, _ -> + if(removeItem(player, used.id)) { + addItem(player, Items.COCONUT_5976) + sendMessage(player, "You crush the coconut with a hammer.") + return@onUseWith true + } + return@onUseWith false + } + onUseWith(IntType.ITEM, Items.COCONUT_5976, Items.VIAL_229) { player, used, with -> + if(removeItem(player, used.id) && removeItem(player, with.id)) { + addItem(player, Items.COCONUT_SHELL_5978) + addItem(player, Items.COCONUT_MILK_5935) + sendMessage(player, "You overturn the coconut into a vial.") + return@onUseWith true + } + return@onUseWith false + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/cooking/CoconutMakePlugin.java b/Server/src/main/content/global/skill/cooking/CoconutMakePlugin.java deleted file mode 100644 index 7520ff115..000000000 --- a/Server/src/main/content/global/skill/cooking/CoconutMakePlugin.java +++ /dev/null @@ -1,56 +0,0 @@ -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 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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/CookingRecipePlugin.java b/Server/src/main/content/global/skill/cooking/CookingRecipePlugin.java deleted file mode 100644 index 067217358..000000000 --- a/Server/src/main/content/global/skill/cooking/CookingRecipePlugin.java +++ /dev/null @@ -1,134 +0,0 @@ -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 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; - Item part = null; - // TODO: Transitioning to a Listener would save an O(n) pass through the recipes list on every use-with - recipeloop: - 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 recipeloop; - } - } - } - } else { - for (int k = 0; k < temp.getParts().length; k++) { - for (int i = 0; i < temp.getIngredients().length; i++) { - Item tempPart = temp.getParts()[k]; - Item ingredient = temp.getIngredients()[i]; - if (tempPart.getId() == event.getUsedItem().getId() && ingredient.getId() == event.getBaseItem().getId() || tempPart.getId() == event.getBaseItem().getId() && ingredient.getId() == event.getUsedItem().getId()) { - if (k == i) {// represents that this ingredient can - // mix with the other. - recipe = temp; - part = tempPart; - break recipeloop; - } - } - } - } - } - } - if (recipe != null) { - final Player player = event.getPlayer(); - final Recipe recipe_ = recipe; - final Item part_ = part; - 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(part_ != null ? part_ : 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 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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/PieShellPlugin.java b/Server/src/main/content/global/skill/cooking/PieShellPlugin.java deleted file mode 100644 index 4278836e8..000000000 --- a/Server/src/main/content/global/skill/cooking/PieShellPlugin.java +++ /dev/null @@ -1,56 +0,0 @@ -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 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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/SkeweredFoodListener.kt b/Server/src/main/content/global/skill/cooking/SkeweredFoodListener.kt new file mode 100644 index 000000000..f170eb421 --- /dev/null +++ b/Server/src/main/content/global/skill/cooking/SkeweredFoodListener.kt @@ -0,0 +1,38 @@ +package content.global.skill.cooking + +import core.api.* +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import core.game.node.entity.skill.Skills +import org.rs09.consts.Items + +class SkeweredFoodListener : InteractionListener { + val skewerMap = hashMapOf( + Items.RAW_CHOMPY_2876 to Items.SKEWERED_CHOMPY_7230, + Items.RAW_RABBIT_3226 to Items.SKEWERED_RABBIT_7224, + Items.RAW_BIRD_MEAT_9978 to Items.SKEWERED_BIRD_MEAT_9984, + Items.RAW_BEAST_MEAT_9986 to Items.SKEWERED_BEAST_9992 + ) + + override fun defineListeners() { + onUseWith(IntType.ITEM, skewerMap.keys.toIntArray(), Items.IRON_SPIT_7225) { player, used, with -> + val level = when (used.id) { + Items.RAW_BIRD_MEAT_9978 -> 11 + Items.RAW_RABBIT_3226 -> 16 + Items.RAW_BEAST_MEAT_9986 -> 21 + Items.RAW_CHOMPY_2876 -> 30 + else -> 0 + } + + if (getDynLevel(player, Skills.COOKING) < level) { + sendMessage(player, "You need a Cooking level of at least $level in order to do this.") + return@onUseWith true + } + if(removeItem(player, used.id) && removeItem(player, with.id)) { + skewerMap[used.id]?.let { addItem(player, it) } + return@onUseWith true + } + return@onUseWith false + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/cooking/SkeweredFoodPlugin.java b/Server/src/main/content/global/skill/cooking/SkeweredFoodPlugin.java deleted file mode 100644 index 8f02bfcb9..000000000 --- a/Server/src/main/content/global/skill/cooking/SkeweredFoodPlugin.java +++ /dev/null @@ -1,115 +0,0 @@ -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; -import org.rs09.consts.Items; - -/** - * 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 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 { - CHOMPY(new Item(Items.RAW_CHOMPY_2876), new Item(Items.SKEWERED_CHOMPY_7230)), - RABBIT(new Item(Items.RAW_RABBIT_3226), new Item(Items.SKEWERED_RABBIT_7224)), - BIRD(new Item(Items.RAW_BIRD_MEAT_9978), new Item(Items.SKEWERED_BIRD_MEAT_9984)), - BEAST(new Item(Items.RAW_BEAST_MEAT_9986), new Item(Items.SKEWERED_BEAST_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; - } - } -} diff --git a/Server/src/main/content/global/skill/cooking/WatermelonSliceListener.kt b/Server/src/main/content/global/skill/cooking/WatermelonSliceListener.kt new file mode 100644 index 000000000..12f1ee22d --- /dev/null +++ b/Server/src/main/content/global/skill/cooking/WatermelonSliceListener.kt @@ -0,0 +1,20 @@ +package content.global.skill.cooking + +import core.api.* +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import org.rs09.consts.Items + +class WatermelonSliceListener : InteractionListener { + + override fun defineListeners() { + onUseWith(IntType.ITEM, Items.WATERMELON_5982, Items.KNIFE_946) { player, used, _ -> + if(removeItem(player, used.asItem())) { + addItemOrDrop(player, Items.WATERMELON_SLICE_5984, 3) + sendMessage(player, "You slice the watermelon into three slices.") + return@onUseWith true + } + return@onUseWith false + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/cooking/WatermelonSlicePlugin.java b/Server/src/main/content/global/skill/cooking/WatermelonSlicePlugin.java deleted file mode 100644 index d8273968f..000000000 --- a/Server/src/main/content/global/skill/cooking/WatermelonSlicePlugin.java +++ /dev/null @@ -1,59 +0,0 @@ -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 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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/WineFermentListener.kt b/Server/src/main/content/global/skill/cooking/WineFermentListener.kt new file mode 100644 index 000000000..34241aa60 --- /dev/null +++ b/Server/src/main/content/global/skill/cooking/WineFermentListener.kt @@ -0,0 +1,30 @@ +package content.global.skill.cooking + +import content.global.skill.cooking.fermenting.WineFermentingPulse +import core.api.addItem +import core.api.getDynLevel +import core.api.removeItem +import core.api.sendMessage +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import core.game.node.entity.skill.Skills +import core.game.world.GameWorld.Pulser +import org.rs09.consts.Items + +class WineFermentListener : InteractionListener { + + override fun defineListeners() { + onUseWith(IntType.ITEM, Items.GRAPES_1987, Items.JUG_OF_WATER_1937) { player, used, with -> + if (getDynLevel(player, Skills.COOKING) < 35) { + sendMessage(player, "You need a cooking level of 35 to do this.") + return@onUseWith true + } + if(removeItem(player, used.id) && removeItem(player, with.id)) { + addItem(player, Items.UNFERMENTED_WINE_1995) + Pulser.submit(WineFermentingPulse(1, player)) + return@onUseWith true + } + return@onUseWith false + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/cooking/WineFermentPlugin.java b/Server/src/main/content/global/skill/cooking/WineFermentPlugin.java deleted file mode 100644 index b2e96678d..000000000 --- a/Server/src/main/content/global/skill/cooking/WineFermentPlugin.java +++ /dev/null @@ -1,63 +0,0 @@ -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 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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/ChocolateCakeListener.kt b/Server/src/main/content/global/skill/cooking/recipe/ChocolateCakeListener.kt new file mode 100644 index 000000000..0661c9417 --- /dev/null +++ b/Server/src/main/content/global/skill/cooking/recipe/ChocolateCakeListener.kt @@ -0,0 +1,31 @@ +package content.global.skill.cooking.recipe + +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import org.rs09.consts.Items + +class ChocolateCakeListener : InteractionListener { + + val chocolate = intArrayOf(Items.CHOCOLATE_BAR_1973, Items.CHOCOLATE_DUST_1975) + + override fun defineListeners() { + onUseWith(IntType.ITEM, Items.CAKE_1891, *chocolate) { player, used, with -> + val product = Items.CHOCOLATE_CAKE_1897 + val level = 50 + val experience = 30.0 + val message = "" + val failMessage = "You need a Cooking level of $level in order to do that." + + return@onUseWith standardMix( + player, + used.asItem(), + with.asItem(), + product, + level, + experience, + message, + failMessage + ) + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/cooking/recipe/CurryListener.kt b/Server/src/main/content/global/skill/cooking/recipe/CurryListener.kt new file mode 100644 index 000000000..b6be43bb4 --- /dev/null +++ b/Server/src/main/content/global/skill/cooking/recipe/CurryListener.kt @@ -0,0 +1,37 @@ +package content.global.skill.cooking.recipe + +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import core.game.node.item.Item +import org.rs09.consts.Items + +class CurryListener : InteractionListener { + + val added = intArrayOf(Items.CURRY_LEAF_5970, Items.SPICE_2007) + + override fun defineListeners() { + onUseWith(IntType.ITEM, Items.UNCOOKED_STEW_2001, *added) { player, used, with -> + val product = Items.UNCOOKED_CURRY_2009 + val amountAdded = when (with.id) { + Items.CURRY_LEAF_5970 -> 3 + Items.SPICE_2007 -> 1 + else -> 0 + } + val level = 60 + val experience = 0.0 + val message = "You mix the spice with the stew." + val failMessage = "You need a Cooking level of at least $level in order to do this." + + return@onUseWith standardMix( + player, + used.asItem(), + Item(with.id, amountAdded), + product, + level, + experience, + message, + failMessage + ) + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/cooking/recipe/MixHandler.kt b/Server/src/main/content/global/skill/cooking/recipe/MixHandler.kt new file mode 100644 index 000000000..d2c50ee6a --- /dev/null +++ b/Server/src/main/content/global/skill/cooking/recipe/MixHandler.kt @@ -0,0 +1,71 @@ +package content.global.skill.cooking.recipe + +import core.api.* +import core.game.dialogue.SkillDialogueHandler +import core.game.node.entity.player.Player +import core.game.node.entity.skill.Skills +import core.game.node.item.Item +import kotlin.math.min + +fun standardMix(player: Player, used: Item, with: Item, product: Int, level: Int, experience: Double, message: String, failMessage: String): Boolean { + // Avoids sending dialogue if not enough ingredients to create (relevant only for curry leaves) + if (amountInInventory(player, used.id) < used.amount || amountInInventory(player, with.id) < with.amount) { + return true + } + + // Avoids sending dialogue if only one can be created + if (amountInInventory(player, used.id) == used.amount || amountInInventory(player, with.id) == with.amount) { + if (getDynLevel(player, Skills.COOKING) < level) { + sendDialogue(player, failMessage) + return true + } + + if (removeItem(player, used) && removeItem(player, with)) { + sendMessage(player, message) + rewardXP(player, Skills.COOKING, experience) + addItem(player, product) + containerIngredient(player, used.id) + containerIngredient(player, with.id) + } + return true + } + + mixHandler( + player, + used, + with, + product, + level, + experience, + message, + failMessage + ).open() + return true +} + +private fun mixHandler(player: Player, used: Item, with: Item, product: Int, level: Int, experience: Double, message: String, failMessage: String): SkillDialogueHandler { + val handler: SkillDialogueHandler = + object : + SkillDialogueHandler(player, SkillDialogue.ONE_OPTION, product.asItem()) { + override fun create(amount: Int, index: Int) { + if (!playerMeetsInitialRequirements()) return + MixScript(player, used, with, product, amount, level, experience, message, failMessage).invoke() + } + + private fun playerMeetsInitialRequirements(): Boolean { + if (getDynLevel(player, Skills.COOKING) < level) { + sendDialogue(player, failMessage) + return false + } + return true + } + + override fun getAll(index: Int): Int { + return min( + amountInInventory(player, used.id)/used.amount, + amountInInventory(player, with.id)/with.amount + ) + } + } + return handler +} diff --git a/Server/src/main/content/global/skill/cooking/recipe/MixScript.kt b/Server/src/main/content/global/skill/cooking/recipe/MixScript.kt new file mode 100644 index 000000000..8d8dda982 --- /dev/null +++ b/Server/src/main/content/global/skill/cooking/recipe/MixScript.kt @@ -0,0 +1,57 @@ +package content.global.skill.cooking.recipe + +import core.api.* +import core.game.node.entity.player.Player +import core.game.node.entity.skill.Skills +import core.game.node.item.Item +import org.rs09.consts.Items + +class MixScript( + private val player: Player, + private val used: Item, + private val with: Item, + private val product: Int, + private val sets: Int, + private val level: Int, + private val experience: Double, + private val message: String, + private val failMessage: String +) { + + private val delay = 2 + + fun invoke() { + queueScript(player, delay) { stage -> Int + if (getDynLevel(player, Skills.COOKING) < level) { + sendDialogue(player, failMessage) + return@queueScript stopExecuting(player) + } + + if (inInventory(player, used.id, used.amount) && inInventory(player, with.id, with.amount)) { + removeItem(player, used) + removeItem(player, with) + sendMessage(player, message) + rewardXP(player, Skills.COOKING, experience) + addItem(player, product) + containerIngredient(player, used.id) + containerIngredient(player, with.id) + } else { + return@queueScript stopExecuting(player) + } + + if (stage >= sets - 1) { + return@queueScript stopExecuting(player) + } + + return@queueScript delayScript(player, delay) + } + } +} + +fun containerIngredient(player: Player, ingredient: Int): Boolean{ + return when (ingredient) { + Items.BUCKET_OF_WATER_1929, Items.COMPOST_6032 -> addItem(player, Items.BUCKET_1925) + Items.FRIED_MUSHROOMS_7082 -> addItem(player, Items.BOWL_1923) + else -> false + } +} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/cooking/recipe/OomlieWrap.java b/Server/src/main/content/global/skill/cooking/recipe/OomlieWrap.java deleted file mode 100644 index d5e8ee5f7..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/OomlieWrap.java +++ /dev/null @@ -1,57 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/OomlieWrapListener.kt b/Server/src/main/content/global/skill/cooking/recipe/OomlieWrapListener.kt new file mode 100644 index 000000000..79024be71 --- /dev/null +++ b/Server/src/main/content/global/skill/cooking/recipe/OomlieWrapListener.kt @@ -0,0 +1,29 @@ +package content.global.skill.cooking.recipe + +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import org.rs09.consts.Items + +class OomlieWrapListener : InteractionListener { + + override fun defineListeners() { + onUseWith(IntType.ITEM, Items.RAW_OOMLIE_2337, Items.PALM_LEAF_2339) { player, used, with -> + val product = Items.WRAPPED_OOMLIE_2341 + val level = 50 + val experience = 0.0 + val message = "You wrap the raw oomlie in the palm leaf." + val failMessage = "You need a Cooking level of at least $level in order to do that." + + return@onUseWith standardMix( + player, + used.asItem(), + with.asItem(), + product, + level, + experience, + message, + failMessage + ) + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/cooking/recipe/PieListener.kt b/Server/src/main/content/global/skill/cooking/recipe/PieListener.kt new file mode 100644 index 000000000..20ddd1fe6 --- /dev/null +++ b/Server/src/main/content/global/skill/cooking/recipe/PieListener.kt @@ -0,0 +1,79 @@ +package content.global.skill.cooking.recipe + +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import org.rs09.consts.Items + +class PieListener : InteractionListener { + + val base = PieProduct.values().map { it.base }.toIntArray() + val added = PieProduct.values().map { it.added }.toIntArray() + + override fun defineListeners() { + onUseWith(IntType.ITEM, base, *added) { player, used, with -> + val pie = PieProduct.productMap[used.id] ?: return@onUseWith true + + if (pie.added != with.id) { + return@onUseWith false + } + + val product = pie.product + val level = pie.minimumLevel + val experience = 0.0 + val message = "You fill the pie with ${pie.message}." + val failMessage = "You need a Cooking level of ${pie.minimumLevel} to make this." + + return@onUseWith standardMix( + player, + used.asItem(), + with.asItem(), + product, + level, + experience, + message, + failMessage + ) + } + } + + enum class PieProduct( + val base: Int, + val added: Int, + val product: Int, + val minimumLevel: Int, + val message: String, + ) { + REDBERRY_PIE(Items.REDBERRIES_1951, Items.PIE_SHELL_2315, Items.UNCOOKED_BERRY_PIE_2321, 10, "redberries"), + MEAT_PIE(Items.COOKED_MEAT_2142, Items.PIE_SHELL_2315, Items.UNCOOKED_MEAT_PIE_2319, 20, "meat"), + MUD_PIE_1(Items.COMPOST_6032, Items.PIE_SHELL_2315, Items.PART_MUD_PIE_7164, 29, "compost"), + MUD_PIE_2(Items.PART_MUD_PIE_7164, Items.BUCKET_OF_WATER_1929, Items.PART_MUD_PIE_7166, 29, "water"), + MUD_PIE_3(Items.PART_MUD_PIE_7166, Items.CLAY_434, Items.RAW_MUD_PIE_7168, 29, "clay"), + APPLE_PIE(Items.COOKING_APPLE_1955, Items.PIE_SHELL_2315, Items.UNCOOKED_APPLE_PIE_2317, 30, "cooking apple"), + GARDEN_PIE_1(Items.TOMATO_1982, Items.PIE_SHELL_2315, Items.PART_GARDEN_PIE_7172, 34, "tomato"), + GARDEN_PIE_2(Items.PART_GARDEN_PIE_7172, Items.ONION_1957, Items.PART_GARDEN_PIE_7174, 34, "onion"), + GARDEN_PIE_3(Items.PART_GARDEN_PIE_7174, Items.CABBAGE_1965, Items.RAW_GARDEN_PIE_7176, 34, "cabbage"), + FISH_PIE_1(Items.TROUT_333, Items.PIE_SHELL_2315, Items.PART_FISH_PIE_7182, 47, "trout"), + FISH_PIE_2(Items.PART_FISH_PIE_7182, Items.COD_339, Items.PART_FISH_PIE_7184, 47, "cod"), + FISH_PIE_3(Items.PART_FISH_PIE_7184, Items.POTATO_1942, Items.RAW_FISH_PIE_7186, 47, "potato"), + ADMIRAL_PIE_1(Items.SALMON_329, Items.PIE_SHELL_2315, Items.PART_ADMIRAL_PIE_7192, 70, "salmon"), + ADMIRAL_PIE_2(Items.PART_ADMIRAL_PIE_7192, Items.TUNA_361, Items.PART_ADMIRAL_PIE_7194, 70, "tuna"), + ADMIRAL_PIE_3(Items.PART_ADMIRAL_PIE_7194, Items.POTATO_1942, Items.RAW_ADMIRAL_PIE_7196, 70, "potato"), + WILD_PIE_1(Items.RAW_BEAR_MEAT_2136, Items.PIE_SHELL_2315, Items.PART_WILD_PIE_7202, 85, "raw bear meat"), + WILD_PIE_2(Items.PART_WILD_PIE_7202, Items.RAW_CHOMPY_2876, Items.PART_WILD_PIE_7204, 85, "raw chompy"), + WILD_PIE_3(Items.PART_WILD_PIE_7204, Items.RAW_RABBIT_3226, Items.RAW_WILD_PIE_7206, 85, "raw rabbit"), + SUMMER_PIE_1(Items.STRAWBERRY_5504, Items.PIE_SHELL_2315, Items.PART_SUMMER_PIE_7212, 95, "strawberry"), + SUMMER_PIE_2(Items.PART_SUMMER_PIE_7212, Items.WATERMELON_5982, Items.PART_SUMMER_PIE_7214, 95, "watermelon"), + SUMMER_PIE_3(Items.PART_SUMMER_PIE_7214, Items.COOKING_APPLE_1955, Items.RAW_SUMMER_PIE_7216, 95, "apple"), + ; + + companion object { + val productMap = HashMap() + + init { + for (pie in PieProduct.values()) { + productMap[pie.base] = pie + } + } + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/cooking/recipe/PieShellListener.kt b/Server/src/main/content/global/skill/cooking/recipe/PieShellListener.kt new file mode 100644 index 000000000..b0e075575 --- /dev/null +++ b/Server/src/main/content/global/skill/cooking/recipe/PieShellListener.kt @@ -0,0 +1,29 @@ +package content.global.skill.cooking.recipe + +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import org.rs09.consts.Items + +class PieShellListener : InteractionListener { + + override fun defineListeners() { + onUseWith(IntType.ITEM, Items.PIE_DISH_2313, Items.PASTRY_DOUGH_1953) { player, used, with -> + val product = Items.PIE_SHELL_2315 + val level = 1 + val experience = 0.0 + val message = "You put the pastry dough into the pie dish to make a pie shell." + val failMessage = "" + + return@onUseWith standardMix( + player, + used.asItem(), + with.asItem(), + product, + level, + experience, + message, + failMessage + ) + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/cooking/recipe/PizzaListener.kt b/Server/src/main/content/global/skill/cooking/recipe/PizzaListener.kt new file mode 100644 index 000000000..f70c32f35 --- /dev/null +++ b/Server/src/main/content/global/skill/cooking/recipe/PizzaListener.kt @@ -0,0 +1,66 @@ +package content.global.skill.cooking.recipe + +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import org.rs09.consts.Items + +class PizzaListener : InteractionListener { + + val base = PizzaProduct.values().map { it.base }.toIntArray() + val added = PizzaProduct.values().map { it.added }.toIntArray() + + override fun defineListeners() { + onUseWith(IntType.ITEM, base, *added) { player, used, with -> + val pizza = PizzaProduct.productMap[used.id] ?: return@onUseWith true + + if (pizza.added != with.id) { + return@onUseWith false + } + + val product = pizza.product + val level = pizza.minimumLevel + val experience = pizza.experience + val message = "You add the ${pizza.message} to the pizza." + val failMessage = "You need a Cooking level of at least ${pizza.minimumLevel} in order to do this." + + return@onUseWith standardMix( + player, + used.asItem(), + with.asItem(), + product, + level, + experience, + message, + failMessage + ) + } + } + + enum class PizzaProduct( + val base: Int, + val added: Int, + val product: Int, + val minimumLevel: Int, + val experience: Double, + val message: String, + ) { + PIZZA_1(Items.TOMATO_1982, Items.PIZZA_BASE_2283, Items.INCOMPLETE_PIZZA_2285, 35, 0.0,"tomato"), + PIZZA_2(Items.CHEESE_1985, Items.INCOMPLETE_PIZZA_2285, Items.UNCOOKED_PIZZA_2287, 35, 0.0, "cheese"), + MEAT_PIZZA_1(Items.COOKED_MEAT_2142, Items.PLAIN_PIZZA_2289, Items.MEAT_PIZZA_2293, 45, 26.0, "meat"), + MEAT_PIZZA_2(Items.COOKED_CHICKEN_2140, Items.PLAIN_PIZZA_2289, Items.MEAT_PIZZA_2293, 45, 26.0, "cooked chicken"), + ANCHOVY_PIZZA(Items.ANCHOVIES_319, Items.PLAIN_PIZZA_2289, Items.ANCHOVY_PIZZA_2297, 55, 39.0, "anchovies"), + PINEAPPLE_PIZZA_1(Items.PINEAPPLE_CHUNKS_2116, Items.PLAIN_PIZZA_2289, Items.PINEAPPLE_PIZZA_2301, 65, 52.0, "pineapple"), + PINEAPPLE_PIZZA_2(Items.PINEAPPLE_RING_2118, Items.PLAIN_PIZZA_2289, Items.PINEAPPLE_PIZZA_2301, 65, 52.0, "pineapple"), + ; + + companion object { + val productMap = HashMap() + + init { + for (pizza in PizzaProduct.values()) { + productMap[pizza.base] = pizza + } + } + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/cooking/recipe/PotatoListener.kt b/Server/src/main/content/global/skill/cooking/recipe/PotatoListener.kt new file mode 100644 index 000000000..6e2cd5b5c --- /dev/null +++ b/Server/src/main/content/global/skill/cooking/recipe/PotatoListener.kt @@ -0,0 +1,77 @@ +package content.global.skill.cooking.recipe + +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import org.rs09.consts.Items + +class PotatoListener : InteractionListener { + + val added = PotatoProduct.values().map { it.added }.toIntArray() + + override fun defineListeners() { + onUseWith(IntType.ITEM, Items.BAKED_POTATO_6701, Items.PAT_OF_BUTTER_6697) { player, used, with -> + val product = Items.POTATO_WITH_BUTTER_6703 + val level = 39 + val experience = 40.5 + val message = "You add a pat of butter to the potato." + val failMessage = "You need a Cooking level of at least $level in order to do this." + + return@onUseWith standardMix( + player, + used.asItem(), + with.asItem(), + product, + level, + experience, + message, + failMessage + ) + } + + onUseWith(IntType.ITEM, added, Items.POTATO_WITH_BUTTER_6703) { player, used, with -> + val topping = PotatoProduct.productMap[used.id] ?: return@onUseWith true + + val product = topping.product + val level = topping.minimumLevel + val experience = topping.experience + val message = "" + val failMessage = "You need a Cooking level of at least $level in order to do this." + + return@onUseWith standardMix( + player, + used.asItem(), + with.asItem(), + product, + level, + experience, + message, + failMessage + ) + } + } + + enum class PotatoProduct( + val added: Int, + val product: Int, + val minimumLevel: Int, + val experience: Double, + val message: String + ) { + CHEESE_POTATO(Items.CHEESE_1985, Items.POTATO_WITH_CHEESE_6705, 47, 10.0, ""), + CHILLI_POTATO(Items.CHILLI_CON_CARNE_7062, Items.CHILLI_POTATO_7054, 41, 15.0, ""), + EGG_POTATO(Items.EGG_AND_TOMATO_7064, Items.EGG_POTATO_7056, 51, 50.0, ""), + TUNA_POTATO(Items.TUNA_AND_CORN_7068, Items.TUNA_POTATO_7060, 68, 10.0, ""), + MUSHROOM_POTATO(Items.MUSHROOM_AND_ONION_7066, Items.MUSHROOM_POTATO_7058, 64, 55.0, ""), + ; + + companion object { + val productMap = HashMap() + + init { + for (topping in PotatoProduct.values()) { + productMap[topping.added] = topping + } + } + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/cooking/recipe/Recipe.java b/Server/src/main/content/global/skill/cooking/recipe/Recipe.java deleted file mode 100644 index 3e2eff513..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/Recipe.java +++ /dev/null @@ -1,134 +0,0 @@ -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 2009Scape. - */ - // 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 True 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().containItems(event.getBaseItem().getId(), event.getUsedItem().getId())) { - return; - } - 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); - } - } - } - } -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/StewListener.kt b/Server/src/main/content/global/skill/cooking/recipe/StewListener.kt new file mode 100644 index 000000000..312aedcf0 --- /dev/null +++ b/Server/src/main/content/global/skill/cooking/recipe/StewListener.kt @@ -0,0 +1,62 @@ +package content.global.skill.cooking.recipe + +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import org.rs09.consts.Items + +class StewListener : InteractionListener { + + val base = StewProduct.values().map { it.base }.toIntArray() + val added = StewProduct.values().map { it.added }.toIntArray() + + override fun defineListeners() { + onUseWith(IntType.ITEM, base, *added) { player, used, with -> + val stew = StewProduct.productMap[used.id] ?: return@onUseWith true + + if (stew.added != with.id) { + return@onUseWith false + } + + val product = stew.product + val level = stew.minimumLevel + val experience = 0.0 + val message = "You cut up the ${stew.message} and put it into the stew." + val failMessage = "You need a Cooking level of at least ${stew.minimumLevel} in order to do this." + + return@onUseWith standardMix( + player, + used.asItem(), + with.asItem(), + product, + level, + experience, + message, + failMessage + ) + } + } + + enum class StewProduct( + val base: Int, + val added: Int, + val product: Int, + val minimumLevel: Int, + val message: String, + ) { + STEW_1(Items.POTATO_1942, Items.BOWL_OF_WATER_1921, Items.INCOMPLETE_STEW_1997, 25, "potato"), + STEW_2(Items.INCOMPLETE_STEW_1997, Items.COOKED_MEAT_2142, Items.UNCOOKED_STEW_2001, 25, "meat"), + STEW_3(Items.COOKED_MEAT_2142, Items.BOWL_OF_WATER_1921, Items.INCOMPLETE_STEW_1999, 25, "meat"), + STEW_4(Items.INCOMPLETE_STEW_1999, Items.POTATO_1942, Items.UNCOOKED_STEW_2001, 25, "potato"), + ; + + companion object { + val productMap = HashMap() + + init { + for (stew in StewProduct.values()) { + productMap[stew.base] = stew + } + } + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/cooking/recipe/ToppingListener.kt b/Server/src/main/content/global/skill/cooking/recipe/ToppingListener.kt new file mode 100644 index 000000000..68e5c55bb --- /dev/null +++ b/Server/src/main/content/global/skill/cooking/recipe/ToppingListener.kt @@ -0,0 +1,84 @@ +package content.global.skill.cooking.recipe + +import core.api.inInventory +import core.api.sendDialogue +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import org.rs09.consts.Items + +class ToppingListener : InteractionListener { + + val base = ToppingProduct.values().map { it.base }.toIntArray() + val added = ToppingProduct.values().map { it.added }.toIntArray() + + override fun defineListeners() { + onUseWith(IntType.ITEM, base, *added) { player, used, with -> + val topping = ToppingProduct.productMap[used.id] ?: return@onUseWith true + val verb = if (with.id == Items.COOKED_MEAT_2142) "cut" else "slice" + + if (topping.added != with.id) { + return@onUseWith false + } + + if (topping.cut_name != "" && !inInventory(player, Items.KNIFE_946)) { + sendDialogue(player, "You need a knife in order to $verb up the ${topping.cut_name}.") + return@onUseWith true + } + + val product = topping.product + val level = topping.minimumLevel + val experience = topping.experience + val message = topping.message + val failMessage = "You need a Cooking level of at least ${topping.minimumLevel} in order to do this." + + return@onUseWith standardMix( + player, + used.asItem(), + with.asItem(), + product, + level, + experience, + message, + failMessage + ) + } + } + + enum class ToppingProduct( + val base: Int, + val added: Int, + val product: Int, + val minimumLevel: Int, + val experience: Double, + val message: String, + val cut_name: String + ) { + //Tuna and Corn: https://www.youtube.com/watch?v=wAavERc9p2c + //Uncooked Egg: https://www.youtube.com/watch?v=LiLq6PhCc2M + //Bowl of sweetcorn (OSRS source is only I could find) https://www.youtube.com/watch?v=pz8epXjkKYE + + UNCOOKED_EGG(Items.EGG_1944, Items.BOWL_1923, Items.UNCOOKED_EGG_7076, 1, 0.0, "You carefully break the egg into the bowl.", ""), + BOWL_OF_SWEETCORN(Items.COOKED_SWEETCORN_5988, Items.BOWL_1923, Items.SWEETCORN_7088, 1, 0.0, "You put the cooked sweetcorn into the bowl.", ""), + SLICED_MUSHROOM(Items.MUSHROOM_6004, Items.BOWL_1923, Items.SLICED_MUSHROOMS_7080, 1, 0.0, "You chop the mushrooms into the bowl.", "mushrooms"), + CHOPPED_TUNA(Items.TUNA_361, Items.BOWL_1923, Items.CHOPPED_TUNA_7086, 1, 0.0, "You chop the tuna into the bowl.", "tuna"), + CHOPPED_ONION(Items.ONION_1957, Items.BOWL_1923, Items.CHOPPED_ONION_1871, 1, 0.0, "You chop the onion into the bowl.", "onion"), + CHOPPED_GARLIC(Items.GARLIC_1550, Items.BOWL_1923, Items.CHOPPED_GARLIC_7074, 1, 0.0, "You chop the garlic into the bowl.", "garlic"), + SPICY_SAUCE(Items.CHOPPED_GARLIC_7074, Items.GNOME_SPICE_2169, Items.SPICY_SAUCE_7072, 9, 25.0, "You mix the ingredients to make the topping.", ""), //inauthentic, used generic mixing message + CHILLI_CON_CARNE(Items.SPICY_SAUCE_7072, Items.COOKED_MEAT_2142, Items.CHILLI_CON_CARNE_7062, 9, 0.0, "You mix the ingredients to make the topping.", "meat"), //inauthentic, used generic mixing message + EGG_AND_TOMATO(Items.TOMATO_1982, Items.SCRAMBLED_EGG_7078, Items.EGG_AND_TOMATO_7064, 23, 50.0, "You mix the ingredients to make the topping.", ""), + MUSHROOM_AND_ONION(Items.FRIED_MUSHROOMS_7082, Items.FRIED_ONIONS_7084, Items.MUSHROOM_AND_ONION_7066, 57, 120.0, "You mix the ingredients to make the topping.", ""), + TUNA_AND_CORN_1(Items.CHOPPED_TUNA_7086, Items.COOKED_SWEETCORN_5988, Items.TUNA_AND_CORN_7068, 67, 204.0, "You mix the ingredients to make the topping.", ""), + TUNA_AND_CORN_2(Items.SWEETCORN_7088, Items.TUNA_361, Items.TUNA_AND_CORN_7068, 67, 204.0, "You mix the ingredients to make the topping.", "tuna"), + ; + + companion object { + val productMap = HashMap() + + init { + for (topping in ToppingProduct.values()) { + productMap[topping.base] = topping + } + } + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/cooking/recipe/cake/ChocolateCake.java b/Server/src/main/content/global/skill/cooking/recipe/cake/ChocolateCake.java deleted file mode 100644 index 97ef11d88..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/cake/ChocolateCake.java +++ /dev/null @@ -1,72 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/pie/PieRecipe.java b/Server/src/main/content/global/skill/cooking/recipe/pie/PieRecipe.java deleted file mode 100644 index 878a3333f..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/pie/PieRecipe.java +++ /dev/null @@ -1,38 +0,0 @@ -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; - } -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/pie/impl/AdmiralPie.java b/Server/src/main/content/global/skill/cooking/recipe/pie/impl/AdmiralPie.java deleted file mode 100644 index 9cc6a98eb..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/pie/impl/AdmiralPie.java +++ /dev/null @@ -1,64 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/pie/impl/ApplePie.java b/Server/src/main/content/global/skill/cooking/recipe/pie/impl/ApplePie.java deleted file mode 100644 index e44917445..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/pie/impl/ApplePie.java +++ /dev/null @@ -1,34 +0,0 @@ -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 }; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/pie/impl/FishPie.java b/Server/src/main/content/global/skill/cooking/recipe/pie/impl/FishPie.java deleted file mode 100644 index 7a1dad02f..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/pie/impl/FishPie.java +++ /dev/null @@ -1,64 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/pie/impl/GardenPie.java b/Server/src/main/content/global/skill/cooking/recipe/pie/impl/GardenPie.java deleted file mode 100644 index 90fbe7e23..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/pie/impl/GardenPie.java +++ /dev/null @@ -1,64 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/pie/impl/MeatPie.java b/Server/src/main/content/global/skill/cooking/recipe/pie/impl/MeatPie.java deleted file mode 100644 index 1edb223fd..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/pie/impl/MeatPie.java +++ /dev/null @@ -1,58 +0,0 @@ -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."; - } -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/pie/impl/MudPie.java b/Server/src/main/content/global/skill/cooking/recipe/pie/impl/MudPie.java deleted file mode 100644 index 64a542f46..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/pie/impl/MudPie.java +++ /dev/null @@ -1,64 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/pie/impl/RedberryPie.java b/Server/src/main/content/global/skill/cooking/recipe/pie/impl/RedberryPie.java deleted file mode 100644 index 6ebbd04f6..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/pie/impl/RedberryPie.java +++ /dev/null @@ -1,33 +0,0 @@ -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 }; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/pie/impl/SummerPie.java b/Server/src/main/content/global/skill/cooking/recipe/pie/impl/SummerPie.java deleted file mode 100644 index 14996852a..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/pie/impl/SummerPie.java +++ /dev/null @@ -1,64 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/pie/impl/WildPie.java b/Server/src/main/content/global/skill/cooking/recipe/pie/impl/WildPie.java deleted file mode 100644 index 3b4decaa2..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/pie/impl/WildPie.java +++ /dev/null @@ -1,64 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/pizza/PizzaRecipe.java b/Server/src/main/content/global/skill/cooking/recipe/pizza/PizzaRecipe.java deleted file mode 100644 index 5a1385a35..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/pizza/PizzaRecipe.java +++ /dev/null @@ -1,63 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/pizza/impl/AnchovyPizza.java b/Server/src/main/content/global/skill/cooking/recipe/pizza/impl/AnchovyPizza.java deleted file mode 100644 index 4a70625ff..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/pizza/impl/AnchovyPizza.java +++ /dev/null @@ -1,44 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/pizza/impl/MeatPizza.java b/Server/src/main/content/global/skill/cooking/recipe/pizza/impl/MeatPizza.java deleted file mode 100644 index b79096137..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/pizza/impl/MeatPizza.java +++ /dev/null @@ -1,49 +0,0 @@ -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 }; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/pizza/impl/PineapplePizza.java b/Server/src/main/content/global/skill/cooking/recipe/pizza/impl/PineapplePizza.java deleted file mode 100644 index 7e4746e2f..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/pizza/impl/PineapplePizza.java +++ /dev/null @@ -1,55 +0,0 @@ -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."; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/pizza/impl/PlainPizza.java b/Server/src/main/content/global/skill/cooking/recipe/pizza/impl/PlainPizza.java deleted file mode 100644 index 8d624dca3..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/pizza/impl/PlainPizza.java +++ /dev/null @@ -1,81 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/potato/PotatoRecipe.java b/Server/src/main/content/global/skill/cooking/recipe/potato/PotatoRecipe.java deleted file mode 100644 index c2640a8bc..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/potato/PotatoRecipe.java +++ /dev/null @@ -1,76 +0,0 @@ -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 True 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(); -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/potato/impl/ButterPotato.java b/Server/src/main/content/global/skill/cooking/recipe/potato/impl/ButterPotato.java deleted file mode 100644 index b382a5029..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/potato/impl/ButterPotato.java +++ /dev/null @@ -1,72 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/potato/impl/CheesePotato.java b/Server/src/main/content/global/skill/cooking/recipe/potato/impl/CheesePotato.java deleted file mode 100644 index f111ed950..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/potato/impl/CheesePotato.java +++ /dev/null @@ -1,49 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/potato/impl/ChilliPotato.java b/Server/src/main/content/global/skill/cooking/recipe/potato/impl/ChilliPotato.java deleted file mode 100644 index 88c5ed146..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/potato/impl/ChilliPotato.java +++ /dev/null @@ -1,49 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/potato/impl/EggPotato.java b/Server/src/main/content/global/skill/cooking/recipe/potato/impl/EggPotato.java deleted file mode 100644 index c616591fd..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/potato/impl/EggPotato.java +++ /dev/null @@ -1,49 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/potato/impl/MushroomPotato.java b/Server/src/main/content/global/skill/cooking/recipe/potato/impl/MushroomPotato.java deleted file mode 100644 index d7bfa1c2c..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/potato/impl/MushroomPotato.java +++ /dev/null @@ -1,49 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/potato/impl/TunaPotato.java b/Server/src/main/content/global/skill/cooking/recipe/potato/impl/TunaPotato.java deleted file mode 100644 index 645d5ed2e..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/potato/impl/TunaPotato.java +++ /dev/null @@ -1,49 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/stew/CurryRecipe.java b/Server/src/main/content/global/skill/cooking/recipe/stew/CurryRecipe.java deleted file mode 100644 index 4ea78825d..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/stew/CurryRecipe.java +++ /dev/null @@ -1,89 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/stew/StewRecipe.java b/Server/src/main/content/global/skill/cooking/recipe/stew/StewRecipe.java deleted file mode 100644 index 4073bcc0e..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/stew/StewRecipe.java +++ /dev/null @@ -1,92 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/topping/ToppingRecipe.java b/Server/src/main/content/global/skill/cooking/recipe/topping/ToppingRecipe.java deleted file mode 100644 index 5c2cacb15..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/topping/ToppingRecipe.java +++ /dev/null @@ -1,58 +0,0 @@ -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(); - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/topping/impl/ChilliConCarne.java b/Server/src/main/content/global/skill/cooking/recipe/topping/impl/ChilliConCarne.java deleted file mode 100644 index 4085d149b..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/topping/impl/ChilliConCarne.java +++ /dev/null @@ -1,81 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/topping/impl/ChoppedOnion.java b/Server/src/main/content/global/skill/cooking/recipe/topping/impl/ChoppedOnion.java deleted file mode 100644 index 5a30107c1..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/topping/impl/ChoppedOnion.java +++ /dev/null @@ -1,69 +0,0 @@ -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; - } -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/topping/impl/ChoppedTuna.java b/Server/src/main/content/global/skill/cooking/recipe/topping/impl/ChoppedTuna.java deleted file mode 100644 index 4723c61ff..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/topping/impl/ChoppedTuna.java +++ /dev/null @@ -1,69 +0,0 @@ -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; - } -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/topping/impl/EggAndTomato.java b/Server/src/main/content/global/skill/cooking/recipe/topping/impl/EggAndTomato.java deleted file mode 100644 index dabf2db2b..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/topping/impl/EggAndTomato.java +++ /dev/null @@ -1,72 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/topping/impl/MushroomAndOnion.java b/Server/src/main/content/global/skill/cooking/recipe/topping/impl/MushroomAndOnion.java deleted file mode 100644 index 3b99200f7..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/topping/impl/MushroomAndOnion.java +++ /dev/null @@ -1,72 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/topping/impl/SlicedMushroom.java b/Server/src/main/content/global/skill/cooking/recipe/topping/impl/SlicedMushroom.java deleted file mode 100644 index 46f9d09f8..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/topping/impl/SlicedMushroom.java +++ /dev/null @@ -1,69 +0,0 @@ -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; - } -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/topping/impl/SpicySauce.java b/Server/src/main/content/global/skill/cooking/recipe/topping/impl/SpicySauce.java deleted file mode 100644 index 2b0a7e103..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/topping/impl/SpicySauce.java +++ /dev/null @@ -1,84 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/topping/impl/TunaAndCorn.java b/Server/src/main/content/global/skill/cooking/recipe/topping/impl/TunaAndCorn.java deleted file mode 100644 index 1e2c92a6f..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/topping/impl/TunaAndCorn.java +++ /dev/null @@ -1,72 +0,0 @@ -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; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/recipe/topping/impl/UncookedEgg.java b/Server/src/main/content/global/skill/cooking/recipe/topping/impl/UncookedEgg.java deleted file mode 100644 index 61ce50394..000000000 --- a/Server/src/main/content/global/skill/cooking/recipe/topping/impl/UncookedEgg.java +++ /dev/null @@ -1,54 +0,0 @@ -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[] {}; - } - -}