From a4aa3e41a34a9c7a8ebc7d965490ed306346f5e8 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Mon, 16 Dec 2024 16:08:11 +0000 Subject: [PATCH 01/50] Add kettle as option to fill with water --- .../global/handlers/item/withobject/WaterSourceListener.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Server/src/main/content/global/handlers/item/withobject/WaterSourceListener.kt b/Server/src/main/content/global/handlers/item/withobject/WaterSourceListener.kt index 59a8e2049..b3ee9f8e1 100644 --- a/Server/src/main/content/global/handlers/item/withobject/WaterSourceListener.kt +++ b/Server/src/main/content/global/handlers/item/withobject/WaterSourceListener.kt @@ -129,6 +129,10 @@ class WaterSourceListener : InteractionListener { FISHBOWL( inputs = intArrayOf(Items.FISHBOWL_6667), output = Items.FISHBOWL_6668 + ), + KETTLE( + inputs = intArrayOf(Items.KETTLE_7688), + output = Items.FULL_KETTLE_7690 ); companion object From dd7162b4fe58a319b3022124d20b8bad8f446380 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Mon, 16 Dec 2024 16:08:24 +0000 Subject: [PATCH 02/50] Implement boiling a kettle --- .../decoration/kitchen/StoveInteraction.kt | 84 +++++++++++++++++++ 1 file changed, 84 insertions(+) create mode 100644 Server/src/main/content/global/skill/construction/decoration/kitchen/StoveInteraction.kt diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/StoveInteraction.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/StoveInteraction.kt new file mode 100644 index 000000000..e361d3775 --- /dev/null +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/StoveInteraction.kt @@ -0,0 +1,84 @@ +package content.global.skill.construction.decoration.kitchen + +import core.api.* +import core.game.interaction.InteractionListener +import core.game.interaction.QueueStrength +import org.rs09.consts.Scenery as SceneryConst +import org.rs09.consts.Items +import core.game.node.scenery.Scenery +import core.tools.secondsToTicks + + +class StoveInteraction : InteractionListener { + + // Imagine if these indexes incremented logically... + companion object{ + val valid_stoves = intArrayOf( + SceneryConst.FIREPIT_WITH_HOOK_13529, + SceneryConst.FIREPIT_WITH_POT_13531, + SceneryConst.SMALL_OVEN_13533, + SceneryConst.LARGE_OVEN_13536, + SceneryConst.STEEL_RANGE_13539, + SceneryConst.FANCY_RANGE_13542 + ) + val in_progress_stoves = intArrayOf( + SceneryConst.FIREPIT_WITH_HOOK_13530, + SceneryConst.FIREPIT_WITH_POT_13532, + SceneryConst.SMALL_OVEN_13534, + SceneryConst.LARGE_OVEN_13537, + SceneryConst.STEEL_RANGE_13541, + SceneryConst.FANCY_RANGE_13544 + + ) + val stoves_with_kettle = intArrayOf( + SceneryConst.FIREPIT_WITH_HOOK_13530, + SceneryConst.FIREPIT_WITH_POT_13532, + SceneryConst.SMALL_OVEN_13535, + SceneryConst.LARGE_OVEN_13538, + SceneryConst.STEEL_RANGE_13540, + SceneryConst.FANCY_RANGE_13543 + + ) + const val kettleBoiled = "kettle_boiled" + } + override fun defineListeners() { + onUseWith(SCENERY, Items.FULL_KETTLE_7690, *valid_stoves){ player, used, with -> + val idx = valid_stoves.indexOf(with.id) + if (removeItem(player, used)){ + replaceScenery(with as Scenery, in_progress_stoves[idx], -1) + sendMessage(player, "You place the kettle over the fire.") + queueScript(player, secondsToTicks(10), QueueStrength.STRONG){ _ -> + sendMessage(player, "The kettle boils.") + // Of course they changed how these items work so we need 2 different cases + setAttribute(player, kettleBoiled, true) + if (with.id in intArrayOf(SceneryConst.FIREPIT_WITH_HOOK_13529, SceneryConst.FIREPIT_WITH_POT_13531)) + return@queueScript stopExecuting(player) + else{ + getScenery(with.location)?.let { replaceScenery(it, stoves_with_kettle[idx], -1) } + return@queueScript stopExecuting(player) + } + } + } + return@onUseWith true + } + + + on(stoves_with_kettle, SCENERY, "take-kettle"){ player, node -> + if (!getAttribute(player, kettleBoiled, false)){ + sendMessage(player, "The kettle has not boiled yet.") + return@on false + } + if(addItem(player, Items.HOT_KETTLE_7691)){ + replaceScenery(node as Scenery, valid_stoves[stoves_with_kettle.indexOf(node.id)], -1) + setAttribute(player, kettleBoiled, false) + return@on true + } + else { + //todo get the authentic message + sendMessage(player, "You do not have space to do that.") + return@on false + } + } + } + +} From 0198febf9d314a8b4feb48dbf1039a50e22a0ddc Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Tue, 17 Dec 2024 17:43:23 +0000 Subject: [PATCH 03/50] Start adding tea making listeners --- .../global/skill/cooking/TeaInteraction.kt | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 Server/src/main/content/global/skill/cooking/TeaInteraction.kt diff --git a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt new file mode 100644 index 000000000..6eb2d3cf9 --- /dev/null +++ b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt @@ -0,0 +1,21 @@ +package content.global.skill.cooking + +import core.game.interaction.InteractionListener + +/** + * This deals with all tea mixtures + * cup of tea + * nettle tea + * nettle water + * nettle tea (cup) + * poh tea + * clay + * porcelain + * gold trim + */ +class TeaInteraction : InteractionListener { + override fun defineListeners() { + onUseWith(ITEM, ) + TODO("Not yet implemented") + } +} \ No newline at end of file From 8dd9cc0b2e39561ba7c693c6d7fcc77a25441dd4 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Wed, 18 Dec 2024 11:17:22 +0000 Subject: [PATCH 04/50] Add option to fill cup with water --- .../global/handlers/item/withobject/WaterSourceListener.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Server/src/main/content/global/handlers/item/withobject/WaterSourceListener.kt b/Server/src/main/content/global/handlers/item/withobject/WaterSourceListener.kt index b3ee9f8e1..6feffdba5 100644 --- a/Server/src/main/content/global/handlers/item/withobject/WaterSourceListener.kt +++ b/Server/src/main/content/global/handlers/item/withobject/WaterSourceListener.kt @@ -133,6 +133,10 @@ class WaterSourceListener : InteractionListener { KETTLE( inputs = intArrayOf(Items.KETTLE_7688), output = Items.FULL_KETTLE_7690 + ), + CUP( + inputs = intArrayOf(Items.EMPTY_CUP_1980), + output = Items.CUP_OF_WATER_4458 ); companion object From b6c4438233272f206e95fe9fb79cdf6abb2652fe Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Wed, 18 Dec 2024 11:40:56 +0000 Subject: [PATCH 05/50] Evaporate a cup of cold water in the desert --- Server/src/main/content/region/desert/handlers/DesertZone.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server/src/main/content/region/desert/handlers/DesertZone.java b/Server/src/main/content/region/desert/handlers/DesertZone.java index 070889206..3110c7233 100644 --- a/Server/src/main/content/region/desert/handlers/DesertZone.java +++ b/Server/src/main/content/region/desert/handlers/DesertZone.java @@ -39,7 +39,7 @@ public final class DesertZone extends MapZone implements Plugin { /** * Represents data of water vessils to dry up. */ - private static final int[][] VESSILS = new int[][] { { 1937, 1935 }, { 1929, 1925 }, { 1921, 1923 }, { 227, 229 } }; + private static final int[][] VESSILS = new int[][] { { 1937, 1935 }, { 1929, 1925 }, { 1921, 1923 }, { 227, 229 }, { 4458, 1980} }; /** * Represents the animation of drinking water. From 1b45a9ffb5e574f371a8dff7c9f6ac741630b3cd Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Wed, 18 Dec 2024 12:34:07 +0000 Subject: [PATCH 06/50] Add option to heat up bowl of water and implement milky tea --- .../global/skill/cooking/CookingRewrite.kt | 5 ++++ .../global/skill/cooking/TeaInteraction.kt | 30 +++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/Server/src/main/content/global/skill/cooking/CookingRewrite.kt b/Server/src/main/content/global/skill/cooking/CookingRewrite.kt index 7bc993a8b..329da92c9 100644 --- a/Server/src/main/content/global/skill/cooking/CookingRewrite.kt +++ b/Server/src/main/content/global/skill/cooking/CookingRewrite.kt @@ -28,6 +28,7 @@ class CookingRewrite : InteractionListener { list.add(RAW_BEEF_2132) list.add(RAW_BEAR_MEAT_2136) list.add(SEAWEED_401) + list.add(Items.BOWL_OF_WATER_1921) RAW_FOODS = list.toIntArray() } @@ -46,6 +47,10 @@ class CookingRewrite : InteractionListener { player.packetDispatch.sendMessage("You need to cook this on a range.") return@onUseWith false } + Items.BOWL_OF_WATER_1921 ->{ + cook(player, obj, Items.BOWL_OF_WATER_1921, Items.BOWL_OF_HOT_WATER_4456, 1) + return@onUseWith true + } } //cook a standard item diff --git a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt index 6eb2d3cf9..5b92b1daa 100644 --- a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt +++ b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt @@ -1,6 +1,9 @@ package content.global.skill.cooking +import core.api.addItem +import core.api.removeItem import core.game.interaction.InteractionListener +import org.rs09.consts.Items /** * This deals with all tea mixtures @@ -14,8 +17,29 @@ import core.game.interaction.InteractionListener * gold trim */ class TeaInteraction : InteractionListener { + private val teaMilkMap = mapOf( + Items.CUP_OF_TEA_4242 to Items.CUP_OF_TEA_4243, + Items.CUP_OF_TEA_4245 to Items.CUP_OF_TEA_4246, + Items.CUP_OF_TEA_7730 to Items.CUP_OF_TEA_7731, + Items.CUP_OF_TEA_7733 to Items.CUP_OF_TEA_7734, + Items.CUP_OF_TEA_7736 to Items.CUP_OF_TEA_7737, + ) + override fun defineListeners() { - onUseWith(ITEM, ) - TODO("Not yet implemented") + onUseWith(ITEM, teaMilkMap.keys.toIntArray(), Items.BUCKET_OF_MILK_1927){ player, used, with -> + if (removeItem(player, used) && removeItem(player, with)){ + addItem(player, teaMilkMap[used.id]!!) + addItem(player, Items.BUCKET_1925) + } + return@onUseWith true + } + + onUseWith(ITEM, Items.BOWL_OF_HOT_WATER_4456, Items.EMPTY_CUP_1980){ player, used, with -> + if (removeItem(player, used) && removeItem(player, with)) { + addItem(player, Items.CUP_OF_HOT_WATER_4460) + } + return@onUseWith true + } } -} \ No newline at end of file + +} From ed3bb48bbb2567ddf7c6a8c0150d334040ea1778 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Wed, 18 Dec 2024 15:13:06 +0000 Subject: [PATCH 07/50] Fix formatting --- .../handlers/item/withobject/WaterSourceListener.kt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Server/src/main/content/global/handlers/item/withobject/WaterSourceListener.kt b/Server/src/main/content/global/handlers/item/withobject/WaterSourceListener.kt index 6feffdba5..75652b75d 100644 --- a/Server/src/main/content/global/handlers/item/withobject/WaterSourceListener.kt +++ b/Server/src/main/content/global/handlers/item/withobject/WaterSourceListener.kt @@ -131,12 +131,12 @@ class WaterSourceListener : InteractionListener { output = Items.FISHBOWL_6668 ), KETTLE( - inputs = intArrayOf(Items.KETTLE_7688), - output = Items.FULL_KETTLE_7690 + inputs = intArrayOf(Items.KETTLE_7688), + output = Items.FULL_KETTLE_7690 ), CUP( - inputs = intArrayOf(Items.EMPTY_CUP_1980), - output = Items.CUP_OF_WATER_4458 + inputs = intArrayOf(Items.EMPTY_CUP_1980), + output = Items.CUP_OF_WATER_4458 ); companion object From fcec1e4e869d85e00c2bb3bf0a22a196b927df30 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Wed, 18 Dec 2024 16:09:09 +0000 Subject: [PATCH 08/50] Fix description of nettles and nettle tea --- Server/data/configs/item_configs.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Server/data/configs/item_configs.json b/Server/data/configs/item_configs.json index 34d0d7b90..93c7628ef 100644 --- a/Server/data/configs/item_configs.json +++ b/Server/data/configs/item_configs.json @@ -39175,7 +39175,7 @@ "id": "4237" }, { - "examine": "It's a bowl of (milky) nettle tea.", + "examine": "It's a bowl of nettle tea.", "durability": null, "name": "Nettle tea", "weight": "0.9", @@ -39191,7 +39191,7 @@ "id": "4240" }, { - "examine": "(In inventory) A handful of nettles (In ground) I better not get stung/I wouldn't like to get stung/I wish I could sting other people/Dock leaves at the ready/These may hurt/nettles sting my leggies(Draynor Village nettles)", + "examine": "A handful of nettles", "durability": null, "name": "Nettles", "archery_ticket_price": "0", From f9a3026fb383327dcfeeb1daea06c7146b7f0511 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Wed, 18 Dec 2024 16:09:25 +0000 Subject: [PATCH 09/50] Add nettle water as a drinkable thing --- Server/src/main/content/data/consumables/Consumables.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Server/src/main/content/data/consumables/Consumables.java b/Server/src/main/content/data/consumables/Consumables.java index 58143afc0..d1667b219 100644 --- a/Server/src/main/content/data/consumables/Consumables.java +++ b/Server/src/main/content/data/consumables/Consumables.java @@ -285,6 +285,7 @@ public enum Consumables { /** Tea */ CUP_OF_TEA(new Drink(new int[] {712, 1980}, new MultiEffect(new HealingEffect(3), new SkillEffect(Skills.ATTACK, 3, 0)), "Aaah, nothing like a nice cuppa tea!")), + NETTLE_WATER(new Drink(new int[] {Items.NETTLE_WATER_4237, Items.BOWL_1923}, new HealingEffect((1)))), CUP_OF_TEA_NETTLE(new Drink(new int[] {4242, 1980}, new EnergyEffect(10))), CUP_OF_TEA_MILKY_NETTLE(new Drink(new int[] {4243, 1980}, new EnergyEffect(10))), NETTLE_TEA(new Drink(new int[] {4239, 1923}, new NettleTeaEffect())), From dd444a2bf37662240e2b0e4dfd5efbba9e2cebe7 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Wed, 18 Dec 2024 16:09:59 +0000 Subject: [PATCH 10/50] Port NettleTeaPlugin.java and NettleWaterPlugin.java to TeaInteraction.kt --- .../global/skill/cooking/NettleTeaPlugin.java | 61 ------------------- .../skill/cooking/NettleWaterPlugin.java | 35 ----------- .../global/skill/cooking/TeaInteraction.kt | 30 ++++++++- 3 files changed, 27 insertions(+), 99 deletions(-) delete mode 100644 Server/src/main/content/global/skill/cooking/NettleTeaPlugin.java delete mode 100644 Server/src/main/content/global/skill/cooking/NettleWaterPlugin.java diff --git a/Server/src/main/content/global/skill/cooking/NettleTeaPlugin.java b/Server/src/main/content/global/skill/cooking/NettleTeaPlugin.java deleted file mode 100644 index 161c99991..000000000 --- a/Server/src/main/content/global/skill/cooking/NettleTeaPlugin.java +++ /dev/null @@ -1,61 +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 create nettle tea in a cup. - * @author 'Vexia - * @version 1.0 - */ -@Initializable -public final class NettleTeaPlugin extends UseWithHandler { - - /** - * Represents the empty cup item. - */ - private static final Item EMPTY_CUP = new Item(1980, 1); - - /** - * Represents the nettle tea item. - */ - private static final Item NETTLE_TEA = new Item(4239, 1); - - /** - * Represents the bowl item. - */ - private static final Item BOWL = new Item(1923); - - /** - * Represents the cup of tea item. - */ - private static final Item CUP_OF_TEA = new Item(4242, 1); - - /** - * Constructs a new {@code NettleTeaPlugin} {@code Object}. - */ - public NettleTeaPlugin() { - super(1980); - } - - @Override - public Plugin newInstance(Object arg) throws Throwable { - addHandler(4239, ITEM_TYPE, this); - return this; - } - - @Override - public boolean handle(NodeUsageEvent event) { - final Player player = event.getPlayer(); - if (player.getInventory().remove(EMPTY_CUP) && player.getInventory().remove(NETTLE_TEA)) { - player.getInventory().add(BOWL); - player.getInventory().add(CUP_OF_TEA); - } - return true; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/NettleWaterPlugin.java b/Server/src/main/content/global/skill/cooking/NettleWaterPlugin.java deleted file mode 100644 index e8dbeb385..000000000 --- a/Server/src/main/content/global/skill/cooking/NettleWaterPlugin.java +++ /dev/null @@ -1,35 +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; - -/** - * @author Adam - */ -@Initializable -public class NettleWaterPlugin extends UseWithHandler { - - public NettleWaterPlugin() { - super(1921); - } - - @Override - public boolean handle(NodeUsageEvent event) { - final Player player = event.getPlayer(); - player.getInventory().remove(new Item(1921, 1)); - player.getInventory().remove(new Item(4241, 1)); - player.getInventory().add(new Item(4237, 1)); - return true; - } - - @Override - public Plugin newInstance(Object arg) throws Throwable { - addHandler(4241, ITEM_TYPE, this); - return this; - } - -} diff --git a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt index 5b92b1daa..59d71a960 100644 --- a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt +++ b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt @@ -1,13 +1,16 @@ package content.global.skill.cooking import core.api.addItem +import core.api.getDynLevel import core.api.removeItem +import core.api.sendDialogue import core.game.interaction.InteractionListener +import core.game.node.entity.skill.Skills import org.rs09.consts.Items /** * This deals with all tea mixtures - * cup of tea + * cup of tea - done * nettle tea * nettle water * nettle tea (cup) @@ -18,6 +21,7 @@ import org.rs09.consts.Items */ class TeaInteraction : InteractionListener { private val teaMilkMap = mapOf( + Items.NETTLE_TEA_4239 to Items.NETTLE_TEA_4240, Items.CUP_OF_TEA_4242 to Items.CUP_OF_TEA_4243, Items.CUP_OF_TEA_4245 to Items.CUP_OF_TEA_4246, Items.CUP_OF_TEA_7730 to Items.CUP_OF_TEA_7731, @@ -25,6 +29,12 @@ class TeaInteraction : InteractionListener { Items.CUP_OF_TEA_7736 to Items.CUP_OF_TEA_7737, ) + private val teaCupMap = mapOf( + Items.NETTLE_TEA_4239 to Items.CUP_OF_TEA_4242, + Items.NETTLE_TEA_4240 to Items.CUP_OF_TEA_4246, + Items.BOWL_OF_HOT_WATER_4456 to Items.CUP_OF_HOT_WATER_4460 + ) + override fun defineListeners() { onUseWith(ITEM, teaMilkMap.keys.toIntArray(), Items.BUCKET_OF_MILK_1927){ player, used, with -> if (removeItem(player, used) && removeItem(player, with)){ @@ -34,12 +44,26 @@ class TeaInteraction : InteractionListener { return@onUseWith true } - onUseWith(ITEM, Items.BOWL_OF_HOT_WATER_4456, Items.EMPTY_CUP_1980){ player, used, with -> + onUseWith(ITEM, teaCupMap.keys.toIntArray(), Items.EMPTY_CUP_1980){ player, used, with -> + if (used.id != Items.BOWL_OF_HOT_WATER_4456){ + if (getDynLevel(player, Skills.COOKING) < 20){ + sendDialogue(player, "You need a cooking level of 20 to make tea.") + return@onUseWith false + } + } if (removeItem(player, used) && removeItem(player, with)) { - addItem(player, Items.CUP_OF_HOT_WATER_4460) + addItem(player, teaCupMap[used.id]!!) + addItem(player, Items.BOWL_1923) } return@onUseWith true + } + + onUseWith(ITEM, Items.BOWL_OF_WATER_1921, Items.NETTLES_4241) { player, used, with -> + if (removeItem(player, used) && removeItem(player, with)){ + addItem(player, Items.NETTLE_WATER_4237) } + return@onUseWith true + } } } From 4f8892c94ef7febb569bec13434eba4467fa8f1a Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Fri, 20 Dec 2024 17:04:32 +0000 Subject: [PATCH 11/50] Update tea effects to be accurate to 2009 not OSRS --- .../content/data/consumables/Consumables.java | 8 ++++---- .../consumables/effects/NettleTeaEffect.java | 20 ------------------- 2 files changed, 4 insertions(+), 24 deletions(-) delete mode 100644 Server/src/main/content/data/consumables/effects/NettleTeaEffect.java diff --git a/Server/src/main/content/data/consumables/Consumables.java b/Server/src/main/content/data/consumables/Consumables.java index d1667b219..77012524b 100644 --- a/Server/src/main/content/data/consumables/Consumables.java +++ b/Server/src/main/content/data/consumables/Consumables.java @@ -286,10 +286,10 @@ public enum Consumables { /** Tea */ CUP_OF_TEA(new Drink(new int[] {712, 1980}, new MultiEffect(new HealingEffect(3), new SkillEffect(Skills.ATTACK, 3, 0)), "Aaah, nothing like a nice cuppa tea!")), NETTLE_WATER(new Drink(new int[] {Items.NETTLE_WATER_4237, Items.BOWL_1923}, new HealingEffect((1)))), - CUP_OF_TEA_NETTLE(new Drink(new int[] {4242, 1980}, new EnergyEffect(10))), - CUP_OF_TEA_MILKY_NETTLE(new Drink(new int[] {4243, 1980}, new EnergyEffect(10))), - NETTLE_TEA(new Drink(new int[] {4239, 1923}, new NettleTeaEffect())), - NETTLE_TEA_MILKY(new Drink(new int[] {4240, 1980}, new NettleTeaEffect())), + CUP_OF_TEA_NETTLE(new Drink(new int[] {4242, 1980}, new HealingEffect(3))), + CUP_OF_TEA_MILKY_NETTLE(new Drink(new int[] {4243, 1980}, new HealingEffect(3))), + NETTLE_TEA(new Drink(new int[] {4239, 1923}, new HealingEffect(3))), + NETTLE_TEA_MILKY(new Drink(new int[] {4240, 1923}, new HealingEffect(3))), CUP_OF_TEA_CLAY(new Drink(new int[] {7730, 7728}, new SkillEffect(Skills.CONSTRUCTION, 1, 0), "You feel refreshed and ready for more building.")), CUP_OF_TEA_CLAY_MILKY(new Drink(new int[] {7731, 7728}, new SkillEffect(Skills.CONSTRUCTION, 1, 0))), CUP_OF_TEA_WHITE(new Drink(new int[] {7733, 7732}, new SkillEffect(Skills.CONSTRUCTION, 2, 0), "You feel refreshed and ready for more building.")), diff --git a/Server/src/main/content/data/consumables/effects/NettleTeaEffect.java b/Server/src/main/content/data/consumables/effects/NettleTeaEffect.java deleted file mode 100644 index 8f20e8c33..000000000 --- a/Server/src/main/content/data/consumables/effects/NettleTeaEffect.java +++ /dev/null @@ -1,20 +0,0 @@ -package content.data.consumables.effects; - -import core.game.consumable.ConsumableEffect; -import core.game.node.entity.player.Player; - -public class NettleTeaEffect extends ConsumableEffect { - - private final static int healing = 3; - - @Override - public void activate(Player p) { - final ConsumableEffect effect = p.getSkills().getLifepoints() < p.getSkills().getMaximumLifepoints() ? new MultiEffect(new HealingEffect(3), new EnergyEffect(5)) : new HealingEffect(3); - effect.activate(p); - } - - @Override - public int getHealthEffectValue(Player player) { - return healing; - } -} From 484f6e161429258b0b8e817ca5ee4585c6e682ab Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Fri, 20 Dec 2024 17:29:28 +0000 Subject: [PATCH 12/50] Add more cups of tea --- .../content/data/consumables/Consumables.java | 2 ++ .../global/skill/cooking/TeaInteraction.kt | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/Server/src/main/content/data/consumables/Consumables.java b/Server/src/main/content/data/consumables/Consumables.java index 77012524b..8fa3f5b96 100644 --- a/Server/src/main/content/data/consumables/Consumables.java +++ b/Server/src/main/content/data/consumables/Consumables.java @@ -288,6 +288,8 @@ public enum Consumables { NETTLE_WATER(new Drink(new int[] {Items.NETTLE_WATER_4237, Items.BOWL_1923}, new HealingEffect((1)))), CUP_OF_TEA_NETTLE(new Drink(new int[] {4242, 1980}, new HealingEffect(3))), CUP_OF_TEA_MILKY_NETTLE(new Drink(new int[] {4243, 1980}, new HealingEffect(3))), + CUP_OF_TEA_NETTLE_PORCELAIN(new Drink(new int[] {4245, 4244}, new HealingEffect(3))), + CUP_OF_TEA_MILKY_NETTLE_PORCELAIN(new Drink(new int[] {4246, 4244}, new HealingEffect(3))), NETTLE_TEA(new Drink(new int[] {4239, 1923}, new HealingEffect(3))), NETTLE_TEA_MILKY(new Drink(new int[] {4240, 1923}, new HealingEffect(3))), CUP_OF_TEA_CLAY(new Drink(new int[] {7730, 7728}, new SkillEffect(Skills.CONSTRUCTION, 1, 0), "You feel refreshed and ready for more building.")), diff --git a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt index 59d71a960..b0f550f0b 100644 --- a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt +++ b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt @@ -18,6 +18,7 @@ import org.rs09.consts.Items * clay * porcelain * gold trim + * Flask */ class TeaInteraction : InteractionListener { private val teaMilkMap = mapOf( @@ -31,10 +32,16 @@ class TeaInteraction : InteractionListener { private val teaCupMap = mapOf( Items.NETTLE_TEA_4239 to Items.CUP_OF_TEA_4242, - Items.NETTLE_TEA_4240 to Items.CUP_OF_TEA_4246, + Items.NETTLE_TEA_4240 to Items.CUP_OF_TEA_4243, Items.BOWL_OF_HOT_WATER_4456 to Items.CUP_OF_HOT_WATER_4460 ) + // This is specifically for the porcelain cup without a handle for Ghost Ahoy + private val teaCupPorcelainMap = mapOf( + Items.NETTLE_TEA_4239 to Items.CUP_OF_TEA_4245, + Items.NETTLE_TEA_4240 to Items.CUP_OF_TEA_4246 + ) + override fun defineListeners() { onUseWith(ITEM, teaMilkMap.keys.toIntArray(), Items.BUCKET_OF_MILK_1927){ player, used, with -> if (removeItem(player, used) && removeItem(player, with)){ @@ -64,6 +71,13 @@ class TeaInteraction : InteractionListener { } return@onUseWith true } + + onUseWith(ITEM, teaCupPorcelainMap.keys.toIntArray(), Items.PORCELAIN_CUP_4244){player, used, with -> + if(removeItem(player, used) && removeItem(player, with)){ + addItem(player, teaCupPorcelainMap[used.id]!!) + } + return@onUseWith true + } } } From 71abaf9e0355a536b49d50159577ce3f5a9dd263 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Fri, 20 Dec 2024 18:36:59 +0000 Subject: [PATCH 13/50] Add emptying all cups of tea --- .../global/handlers/item/EmptyOptionListener.kt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Server/src/main/content/global/handlers/item/EmptyOptionListener.kt b/Server/src/main/content/global/handlers/item/EmptyOptionListener.kt index b4ae28212..683bafcd8 100644 --- a/Server/src/main/content/global/handlers/item/EmptyOptionListener.kt +++ b/Server/src/main/content/global/handlers/item/EmptyOptionListener.kt @@ -50,6 +50,16 @@ class EmptyOptionListener : InteractionListener { NETTLE_TEA(Items.NETTLE_TEA_4239, Items.BOWL_1923, "You empty the contents of the bowl onto the floor.", Sounds.LIQUID_2401), NETTLE_WATER(Items.NETTLE_WATER_4237, Items.BOWL_1923, "You empty the contents of the bowl onto the floor.", Sounds.LIQUID_2401), NETTLE_TEA_MILKY(Items.NETTLE_TEA_4240, Items.BOWL_1923, "You empty the contents of the bowl onto the floor.", Sounds.LIQUID_2401), + NETTLE_TEA_CUP(Items.CUP_OF_TEA_4242, Items.EMPTY_CUP_1980, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401), + NETTLE_TEA_CUP_MILKY(Items.CUP_OF_TEA_4243, Items.EMPTY_CUP_1980, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401), + NETTLE_TEA_PORCELAIN(Items.CUP_OF_TEA_4245, Items.PORCELAIN_CUP_4244, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401), + NETTLE_TEA_PORCELAIN_MILKY(Items.CUP_OF_TEA_4246, Items.PORCELAIN_CUP_4244, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401), + BUILDERS_TEA1(Items.CUP_OF_TEA_7730, Items.EMPTY_CUP_7728, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401), + BUILDERS_TEA1_MILKY(Items.CUP_OF_TEA_7731, Items.EMPTY_CUP_7728, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401), + BUILDERS_TEA2(Items.CUP_OF_TEA_7733, Items.PORCELAIN_CUP_7732, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401), + BUILDERS_TEA2_MILKY(Items.CUP_OF_TEA_7734, Items.PORCELAIN_CUP_7732, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401), + BUILDERS_TEA3(Items.CUP_OF_TEA_7736, Items.PORCELAIN_CUP_7735, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401), + BUILDERS_TEA3_MILKY(Items.CUP_OF_TEA_7737, Items.PORCELAIN_CUP_7735, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401), BURNT_CURRY(Items.BURNT_CURRY_2013, Items.BOWL_1923, "You empty the contents of the bowl onto the floor.", Sounds.LIQUID_2401), BURNT_GNOMEBOWL(Items.BURNT_GNOMEBOWL_2175, Items.GNOMEBOWL_MOULD_2166, "You empty the contents of the gnomebowl onto the floor."), BURNT_EGG(Items.BURNT_EGG_7090, Items.BOWL_1923, "You empty the contents of the bowl onto the floor."), From e890f7412de369ad00d6976a66868141ee069c68 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Fri, 20 Dec 2024 18:37:16 +0000 Subject: [PATCH 14/50] Fix losing bowl --- Server/src/main/content/global/skill/cooking/TeaInteraction.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt index b0f550f0b..686226291 100644 --- a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt +++ b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt @@ -75,6 +75,7 @@ class TeaInteraction : InteractionListener { onUseWith(ITEM, teaCupPorcelainMap.keys.toIntArray(), Items.PORCELAIN_CUP_4244){player, used, with -> if(removeItem(player, used) && removeItem(player, with)){ addItem(player, teaCupPorcelainMap[used.id]!!) + addItem(player, Items.BOWL_1923) } return@onUseWith true } From 484100cddc02b5168a4fdb73597b2179160a4199 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Fri, 20 Dec 2024 22:31:51 +0000 Subject: [PATCH 15/50] You can now empty tea pots Not sure why you ever would want to --- .../global/handlers/item/EmptyOptionListener.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Server/src/main/content/global/handlers/item/EmptyOptionListener.kt b/Server/src/main/content/global/handlers/item/EmptyOptionListener.kt index 683bafcd8..d2b64a403 100644 --- a/Server/src/main/content/global/handlers/item/EmptyOptionListener.kt +++ b/Server/src/main/content/global/handlers/item/EmptyOptionListener.kt @@ -60,6 +60,18 @@ class EmptyOptionListener : InteractionListener { BUILDERS_TEA2_MILKY(Items.CUP_OF_TEA_7734, Items.PORCELAIN_CUP_7732, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401), BUILDERS_TEA3(Items.CUP_OF_TEA_7736, Items.PORCELAIN_CUP_7735, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401), BUILDERS_TEA3_MILKY(Items.CUP_OF_TEA_7737, Items.PORCELAIN_CUP_7735, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401), + CLAY_POT_OF_TEA4(Items.POT_OF_TEA_4_7692, Items.TEAPOT_7702, "You empty the contents of the pot onto the floor", Sounds.LIQUID_2401), + CLAY_POT_OF_TEA3(Items.POT_OF_TEA_3_7694, Items.TEAPOT_7702, "You empty the contents of the pot onto the floor", Sounds.LIQUID_2401), + CLAY_POT_OF_TEA2(Items.POT_OF_TEA_2_7696, Items.TEAPOT_7702, "You empty the contents of the pot onto the floor", Sounds.LIQUID_2401), + CLAY_POT_OF_TEA1(Items.POT_OF_TEA_1_7698, Items.TEAPOT_7702, "You empty the contents of the pot onto the floor", Sounds.LIQUID_2401), + PORCELAIN_POT_OF_TEA4(Items.POT_OF_TEA_4_7704, Items.TEAPOT_7714, "You empty the contents of the pot onto the floor", Sounds.LIQUID_2401), + PORCELAIN_POT_OF_TEA3(Items.POT_OF_TEA_3_7706, Items.TEAPOT_7714, "You empty the contents of the pot onto the floor", Sounds.LIQUID_2401), + PORCELAIN_POT_OF_TEA2(Items.POT_OF_TEA_2_7708, Items.TEAPOT_7714, "You empty the contents of the pot onto the floor", Sounds.LIQUID_2401), + PORCELAIN_POT_OF_TEA1(Items.POT_OF_TEA_1_7710, Items.TEAPOT_7714, "You empty the contents of the pot onto the floor", Sounds.LIQUID_2401), + GOLD_PORCELAIN_POT_OF_TEA4(Items.POT_OF_TEA_4_7716, Items.TEAPOT_7726, "You empty the contents of the pot onto the floor", Sounds.LIQUID_2401), + GOLD_PORCELAIN_POT_OF_TEA3(Items.POT_OF_TEA_3_7718, Items.TEAPOT_7726, "You empty the contents of the pot onto the floor", Sounds.LIQUID_2401), + GOLD_PORCELAIN_POT_OF_TEA2(Items.POT_OF_TEA_2_7720, Items.TEAPOT_7726, "You empty the contents of the pot onto the floor", Sounds.LIQUID_2401), + GOLD_PORCELAIN_POT_OF_TEA1(Items.POT_OF_TEA_1_7722, Items.TEAPOT_7726, "You empty the contents of the pot onto the floor", Sounds.LIQUID_2401), BURNT_CURRY(Items.BURNT_CURRY_2013, Items.BOWL_1923, "You empty the contents of the bowl onto the floor.", Sounds.LIQUID_2401), BURNT_GNOMEBOWL(Items.BURNT_GNOMEBOWL_2175, Items.GNOMEBOWL_MOULD_2166, "You empty the contents of the gnomebowl onto the floor."), BURNT_EGG(Items.BURNT_EGG_7090, Items.BOWL_1923, "You empty the contents of the bowl onto the floor."), From 7c553fbcad05bb78c608c4e3e3afa5e7538db0a6 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Fri, 20 Dec 2024 22:32:12 +0000 Subject: [PATCH 16/50] Add message to drinking milky builders tea --- Server/src/main/content/data/consumables/Consumables.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Server/src/main/content/data/consumables/Consumables.java b/Server/src/main/content/data/consumables/Consumables.java index 8fa3f5b96..54f1a0d2b 100644 --- a/Server/src/main/content/data/consumables/Consumables.java +++ b/Server/src/main/content/data/consumables/Consumables.java @@ -293,11 +293,11 @@ public enum Consumables { NETTLE_TEA(new Drink(new int[] {4239, 1923}, new HealingEffect(3))), NETTLE_TEA_MILKY(new Drink(new int[] {4240, 1923}, new HealingEffect(3))), CUP_OF_TEA_CLAY(new Drink(new int[] {7730, 7728}, new SkillEffect(Skills.CONSTRUCTION, 1, 0), "You feel refreshed and ready for more building.")), - CUP_OF_TEA_CLAY_MILKY(new Drink(new int[] {7731, 7728}, new SkillEffect(Skills.CONSTRUCTION, 1, 0))), + CUP_OF_TEA_CLAY_MILKY(new Drink(new int[] {7731, 7728}, new SkillEffect(Skills.CONSTRUCTION, 1, 0), "You feel refreshed and ready for more building.")), CUP_OF_TEA_WHITE(new Drink(new int[] {7733, 7732}, new SkillEffect(Skills.CONSTRUCTION, 2, 0), "You feel refreshed and ready for more building.")), - CUP_OF_TEA_WHITE_MILKY(new Drink(new int[] {7734, 7732}, new SkillEffect(Skills.CONSTRUCTION, 2, 0))), + CUP_OF_TEA_WHITE_MILKY(new Drink(new int[] {7734, 7732}, new SkillEffect(Skills.CONSTRUCTION, 2, 0), "You feel refreshed and ready for more building.")), CUP_OF_TEA_GOLD(new Drink(new int[] {7736, 7735}, new SkillEffect(Skills.CONSTRUCTION, 3, 0), "You feel refreshed and ready for more building.")), - CUP_OF_TEA_GOLD_MILKY(new Drink(new int[] {7737, 7735}, new SkillEffect(Skills.CONSTRUCTION, 3, 0))), + CUP_OF_TEA_GOLD_MILKY(new Drink(new int[] {7737, 7735}, new SkillEffect(Skills.CONSTRUCTION, 3, 0), "You feel refreshed and ready for more building.")), /** Miscellaneous */ CHOCOLATE_BAR(new Food(new int[] {1973}, new HealingEffect(3))), From 006dedec4b3da9169e8c24ff55d74c851853e05b Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Fri, 20 Dec 2024 22:32:47 +0000 Subject: [PATCH 17/50] Allow making and pouring of builders tea --- .../global/skill/cooking/TeaInteraction.kt | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt index 686226291..7507cad09 100644 --- a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt +++ b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt @@ -5,6 +5,8 @@ import core.api.getDynLevel import core.api.removeItem import core.api.sendDialogue import core.game.interaction.InteractionListener +import core.game.node.Node +import core.game.node.entity.player.Player import core.game.node.entity.skill.Skills import org.rs09.consts.Items @@ -42,6 +44,40 @@ class TeaInteraction : InteractionListener { Items.NETTLE_TEA_4240 to Items.CUP_OF_TEA_4246 ) + private val emptyTeaPot = intArrayOf( + Items.TEAPOT_7702, + Items.TEAPOT_7714, + Items.TEAPOT_7726 + ) + + private val leafTeaPot = intArrayOf( + Items.TEAPOT_WITH_LEAVES_7700, + Items.TEAPOT_WITH_LEAVES_7712, + Items.TEAPOT_WITH_LEAVES_7724 + ) + + private val t1teapot = intArrayOf( + Items.POT_OF_TEA_4_7692, + Items.POT_OF_TEA_3_7694, + Items.POT_OF_TEA_2_7696, + Items.POT_OF_TEA_1_7698, + ) + + private val t2teapot = intArrayOf( + Items.POT_OF_TEA_4_7704, + Items.POT_OF_TEA_3_7706, + Items.POT_OF_TEA_2_7708, + Items.POT_OF_TEA_1_7710, + ) + + private val t3teapot = intArrayOf( + Items.POT_OF_TEA_4_7716, + Items.POT_OF_TEA_3_7718, + Items.POT_OF_TEA_2_7720, + Items.POT_OF_TEA_1_7722, + ) + + override fun defineListeners() { onUseWith(ITEM, teaMilkMap.keys.toIntArray(), Items.BUCKET_OF_MILK_1927){ player, used, with -> if (removeItem(player, used) && removeItem(player, with)){ @@ -79,6 +115,39 @@ class TeaInteraction : InteractionListener { } return@onUseWith true } + + onUseWith(ITEM, emptyTeaPot, Items.TEA_LEAVES_7738) { player, used, with -> + if (removeItem(player, used) && removeItem(player, with)){ + addItem(player, used.id - 2) + } + return@onUseWith true + } + + onUseWith(ITEM, leafTeaPot, Items.HOT_KETTLE_7691) { player, used, with -> + if (removeItem(player, used) && removeItem(player, with)){ + addItem(player, Items.KETTLE_7688) + addItem(player, used.id - 8) + } + return@onUseWith true + } + + onUseWith(ITEM, t1teapot, Items.EMPTY_CUP_7728) { player, used, with -> + return@onUseWith fillBuildersTea(player, used, with) + } } + private fun fillBuildersTea(player: Player, used: Node, with: Node) : Boolean { + if (removeItem(player, used) && removeItem(player, with)){ + // Thanks tea pot with tea leaves + if (used.id + 4 in emptyTeaPot){ + addItem(player, used.id + 4) + } + else{ + addItem(player, used.id + 2) + } + addItem(player, with.id + 2) + return true + } + return false + } } From 6ea9151e1e61e8310ec8f3063e657abf93e94049 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Fri, 20 Dec 2024 23:20:44 +0000 Subject: [PATCH 18/50] Clean up comments --- Server/src/main/content/global/skill/cooking/TeaInteraction.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt index 7507cad09..598e17280 100644 --- a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt +++ b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt @@ -12,7 +12,7 @@ import org.rs09.consts.Items /** * This deals with all tea mixtures - * cup of tea - done + * cup of tea * nettle tea * nettle water * nettle tea (cup) From 0b721d2a786f347afca33ee493d72a9782759169 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Sat, 21 Dec 2024 19:51:24 +0000 Subject: [PATCH 19/50] Add filling tea for all tiers --- .../main/content/global/skill/cooking/TeaInteraction.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt index 598e17280..a71d6a6e8 100644 --- a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt +++ b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt @@ -134,6 +134,13 @@ class TeaInteraction : InteractionListener { onUseWith(ITEM, t1teapot, Items.EMPTY_CUP_7728) { player, used, with -> return@onUseWith fillBuildersTea(player, used, with) } + + onUseWith(ITEM, t2teapot, Items.PORCELAIN_CUP_7732) { player, used, with -> + return@onUseWith fillBuildersTea(player, used, with) + } + onUseWith(ITEM, t3teapot, Items.PORCELAIN_CUP_7735) { player, used, with -> + return@onUseWith fillBuildersTea(player, used, with) + } } private fun fillBuildersTea(player: Player, used: Node, with: Node) : Boolean { From 47157671f6fae382a4b07714358c1299b5589038 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Sat, 21 Dec 2024 23:59:59 +0000 Subject: [PATCH 20/50] Rebase --- .../global/skill/construction/HouseZone.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/Server/src/main/content/global/skill/construction/HouseZone.java b/Server/src/main/content/global/skill/construction/HouseZone.java index 83bbd1da2..8b6a89548 100644 --- a/Server/src/main/content/global/skill/construction/HouseZone.java +++ b/Server/src/main/content/global/skill/construction/HouseZone.java @@ -1,12 +1,15 @@ package content.global.skill.construction; +import core.api.Container; import core.game.node.entity.Entity; import core.game.node.entity.player.Player; import core.game.world.map.zone.MapZone; import core.game.world.map.RegionManager; import core.game.world.map.Region; import core.game.system.task.Pulse; +import org.rs09.consts.Items; +import core.game.world.map.zone.ZoneRestriction; import core.game.world.map.zone.ZoneType; import static core.api.ContentAPIKt.*; @@ -91,6 +94,7 @@ public final class HouseZone extends MapZone { public boolean leave(Entity e, boolean logout) { if (e instanceof Player) { Player p = (Player) e; + remove_items(p); // The below tears down the house if the owner was the one who left if (house == p.getHouseManager()) { house.expelGuests(p); @@ -121,4 +125,40 @@ public final class HouseZone extends MapZone { } return true; } + + private final int[] itemsToRemove = { + Items.POT_OF_TEA_4_7692, + Items.POT_OF_TEA_3_7694, + Items.POT_OF_TEA_2_7696, + Items.POT_OF_TEA_1_7698, + Items.POT_OF_TEA_4_7704, + Items.POT_OF_TEA_3_7706, + Items.POT_OF_TEA_2_7708, + Items.POT_OF_TEA_1_7710, + Items.POT_OF_TEA_4_7716, + Items.POT_OF_TEA_3_7718, + Items.POT_OF_TEA_2_7720, + Items.POT_OF_TEA_1_7722, + Items.TEAPOT_WITH_LEAVES_7700, + Items.TEAPOT_WITH_LEAVES_7712, + Items.TEAPOT_WITH_LEAVES_7724, + Items.TEAPOT_7702, + Items.TEAPOT_7714, + Items.TEAPOT_7726, + Items.EMPTY_CUP_7728, + Items.CUP_OF_TEA_7730, + Items.PORCELAIN_CUP_7732, + Items.CUP_OF_TEA_7733, + Items.CUP_OF_TEA_7734, + Items.PORCELAIN_CUP_7735, + Items.CUP_OF_TEA_7736, + Items.CUP_OF_TEA_7737, + }; + + private void remove_items(Player p) { + // todo check BoB + for (int item : itemsToRemove) { + removeItem(p, item, Container.INVENTORY); + } + } } From a7c1c510d8caddb93e75ed8827e617460e8b9042 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Sun, 22 Dec 2024 12:32:39 +0000 Subject: [PATCH 21/50] Implement clearing BoB inventory --- .../global/skill/construction/HouseZone.java | 4 ++-- Server/src/main/core/api/Container.kt | 3 ++- Server/src/main/core/api/ContentAPI.kt | 21 +++++++++++++++++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/Server/src/main/content/global/skill/construction/HouseZone.java b/Server/src/main/content/global/skill/construction/HouseZone.java index 8b6a89548..afa32bd02 100644 --- a/Server/src/main/content/global/skill/construction/HouseZone.java +++ b/Server/src/main/content/global/skill/construction/HouseZone.java @@ -156,9 +156,9 @@ public final class HouseZone extends MapZone { }; private void remove_items(Player p) { - // todo check BoB for (int item : itemsToRemove) { - removeItem(p, item, Container.INVENTORY); + removeAll(p, item, Container.INVENTORY); + removeAll(p, item, Container.BoB); } } } diff --git a/Server/src/main/core/api/Container.kt b/Server/src/main/core/api/Container.kt index 590d94a61..bdcfd4900 100644 --- a/Server/src/main/core/api/Container.kt +++ b/Server/src/main/core/api/Container.kt @@ -3,5 +3,6 @@ package core.api enum class Container { INVENTORY, BANK, - EQUIPMENT + EQUIPMENT, + BoB } \ No newline at end of file diff --git a/Server/src/main/core/api/ContentAPI.kt b/Server/src/main/core/api/ContentAPI.kt index ef1cfbad7..cca729909 100644 --- a/Server/src/main/core/api/ContentAPI.kt +++ b/Server/src/main/core/api/ContentAPI.kt @@ -340,6 +340,12 @@ fun removeItem(player: Player, item: T, container: Container = Container.INV Container.INVENTORY -> player.inventory.remove(it) Container.BANK -> player.bank.remove(it) || player.bankSecondary.remove(it) Container.EQUIPMENT -> player.equipment.remove(it) + Container.BoB -> { + if (player.familiarManager.hasFamiliar() && player.familiarManager.familiar.isBurdenBeast) + (player.familiarManager.familiar as BurdenBeast).container.remove(it) + else + false + } } } @@ -356,6 +362,12 @@ fun addItem(player: Player, id: Int, amount: Int = 1, container: Container = Con Container.INVENTORY -> player.inventory Container.BANK -> player.bank Container.EQUIPMENT -> player.equipment + Container.BoB -> { + if(player.familiarManager.hasFamiliar() && player.familiarManager.familiar.isBurdenBeast) + (player.familiarManager.familiar as BurdenBeast).container + else + return false + } } return cont.add(Item(id, amount)) @@ -375,6 +387,7 @@ fun replaceSlot(player: Player, slot: Int, item: Item, currentItem: Item? = null Container.INVENTORY -> player.inventory Container.EQUIPMENT -> player.equipment Container.BANK -> player.bank + Container.BoB -> (player.familiarManager.familiar as BurdenBeast).container } if (item.id == 65535 || item.amount <= 0) { @@ -1665,6 +1678,14 @@ fun removeAll(player: Player, item: T, container: Container = Container.INVE player.bank.remove(Item(it, amountInPrimary)) && player.bankSecondary.remove(Item(it, amountInSecondary)) } Container.INVENTORY -> player.inventory.remove(Item(it, amountInInventory(player, it))) + Container.BoB -> { + if (player.familiarManager.hasFamiliar() && player.familiarManager.familiar.isBurdenBeast){ + val cont = (player.familiarManager.familiar as BurdenBeast).container + cont.remove(Item(it, cont.getAmount(it))) + } + else + false + } } } From 8fea59e1ccd86def93ff13432dff24887925ed77 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Sun, 22 Dec 2024 13:18:18 +0000 Subject: [PATCH 22/50] Add level check and XP reward for builders tea --- .../content/global/skill/cooking/TeaInteraction.kt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt index a71d6a6e8..7b5ef4040 100644 --- a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt +++ b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt @@ -1,9 +1,6 @@ package content.global.skill.cooking -import core.api.addItem -import core.api.getDynLevel -import core.api.removeItem -import core.api.sendDialogue +import core.api.* import core.game.interaction.InteractionListener import core.game.node.Node import core.game.node.entity.player.Player @@ -124,9 +121,15 @@ class TeaInteraction : InteractionListener { } onUseWith(ITEM, leafTeaPot, Items.HOT_KETTLE_7691) { player, used, with -> + if (getDynLevel(player, Skills.COOKING) < 20){ + sendDialogue(player,"You need to be level 20 to make tea.") + return@onUseWith false + } if (removeItem(player, used) && removeItem(player, with)){ addItem(player, Items.KETTLE_7688) addItem(player, used.id - 8) + rewardXP(player, Skills.COOKING, 53.0) + } return@onUseWith true } From a0cd34a1afc95f7165590005c9cb8a210af5c82f Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Sun, 22 Dec 2024 16:55:05 +0000 Subject: [PATCH 23/50] Start working on implementing new shelves --- .../decoration/kitchen/ShelfListener.kt | 58 +++ .../decoration/kitchen/ShelfPlugin.java | 478 +++++++++--------- Server/src/main/core/api/ContentAPI.kt | 10 + 3 files changed, 307 insertions(+), 239 deletions(-) create mode 100644 Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt new file mode 100644 index 000000000..8c8d08de6 --- /dev/null +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt @@ -0,0 +1,58 @@ +package content.global.skill.construction.decoration.kitchen + +import core.api.* +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import core.game.node.entity.player.Player +import org.rs09.consts.Items +import org.rs09.consts.Scenery + +class ShelfListener : InteractionListener { + + companion object{ + + const val NEXT = 5 + const val PREV = -5 + + val woodshelf_1_items = listOf( + "Kettle" to Items.KETTLE_7688, + "Teapot" to Items.TEAPOT_7702, + "Clay Cup" to Items.EMPTY_CUP_7728 + ) + + val woodshelf_2_items = woodshelf_1_items + mapOf( + "Empty beer glass" to Items.BEER_GLASS_1919 + ) + + val shelves = mapOf( + Scenery.SHELVES_13545 to woodshelf_1_items + ) + } + override fun defineListeners() { + on(shelves.keys.toIntArray(), IntType.SCENERY, "Search") {player, node -> + searchShelf(player, node.id) + return@on true + } + } + + fun searchShelf(player : Player, shelf_id: Int, offset : Int = 0){ + val shelfItems = shelves[shelf_id]!!.slice(offset..offset+4) + val shelfItemsNames = shelfItems.map { it.first } + val shelfItemsIds = shelfItems.map { it.second } + sendDialogueOptions(player, "Select an Option", *shelfItemsNames.toTypedArray()) + addDialogueAction(player) { p, button -> + val item = shelfItemsIds[button] + if (item < 1000){ + searchShelf(player, shelf_id, offset+item) + } + else{ + if (hasSpaceFor(player, item, 1)){ + addItem(player, item) + } + else{ + sendMessage(player, "You need at least one free inventory space to take from the shelves.") + } + } + } + } +} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfPlugin.java b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfPlugin.java index 9fed7ebce..bf1523f71 100644 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfPlugin.java +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfPlugin.java @@ -1,239 +1,239 @@ -package content.global.skill.construction.decoration.kitchen; - - -import core.cache.def.impl.SceneryDefinition; -import core.game.dialogue.DialoguePlugin; -import core.game.interaction.OptionHandler; -import core.game.node.Node; -import core.game.node.entity.player.Player; -import core.game.node.item.Item; -import core.plugin.Initializable; -import core.plugin.Plugin; -import core.plugin.ClassScanner; -import org.rs09.consts.Items; - -/** - * Handles the shelves in the kitchen room. - * @author Splinter - */ -@Initializable -public final class ShelfPlugin extends OptionHandler { - - @Override - public Plugin newInstance(Object arg) throws Throwable { - ClassScanner.definePlugin(new ShelfDialogue()); - for (int i = 13545; i < 13552; i++) { - SceneryDefinition.forId(i).getHandlers().put("option:search", this); - } - return this; - } - - @Override - public boolean handle(Player player, Node node, String option) { - player.getDialogueInterpreter().open(778341, node.getId()); - return true; - } - - /** - * Dialogue options for the shelves, what a mess! - * @author Splinter - * @version 1.0 - */ - public final class ShelfDialogue extends DialoguePlugin { - - /** - * Constructs a new {@code ShelfDialogue} {@code Object}. - */ - public ShelfDialogue() { - /** - * empty. - */ - } - - /** - * Constructs a new {@code ShelfDialogue} {@code Object}. - * @param player the player. - */ - public ShelfDialogue(Player player) { - super(player); - } - - @Override - public DialoguePlugin newInstance(Player player) { - return new ShelfDialogue(player); - } - - @Override - public boolean open(Object... args) { - int id = (int) args[0]; - switch (id) { - case 13545:// wood 1 - interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Clay cup"); - stage = 1; - break; - case 13546:// wood 2 - interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Clay cup", "Empty beer glass"); - stage = 1; - break; - case 13547:// wood 3 - interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Clay cup", "Empty beer glass", "Cake tin"); - stage = 1; - break; - case 13548:// oak 1 - interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Clay cup", "Empty beer glass", "Bowl"); - stage = 2; - break; - case 13549:// oak 2 - interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Porcelain cup", "Empty beer glass", "More Options"); - stage = 3; - break; - case 13550:// teak 1 - case 13551: - interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Porcelain cup", "Empty beer glass", "More Options"); - stage = 5; - break; - } - return true; - } - - @Override - public boolean handle(int interfaceId, int buttonId) { - if (player.getInventory().freeSlots() < 1) { - player.sendMessage("You need at least one free inventory space to take from the shelves."); - end(); - return true; - } - switch (stage) { - case 1:// all wood shelves - switch (buttonId) { - case 1: - end(); - player.getInventory().add(new Item(Items.KETTLE_7688, 1)); - break; - case 2: - end(); - player.getInventory().add(new Item(Items.TEAPOT_7702, 1)); - break; - case 3: - end(); - player.getInventory().add(new Item(Items.EMPTY_CUP_7728, 1)); - break; - case 4: - end(); - player.getInventory().add(new Item(Items.BEER_GLASS_1919, 1)); - break; - case 5: - end(); - player.getInventory().add(new Item(Items.CAKE_TIN_1887, 1)); - break; - } - break; - case 2:// Oak shelf #1 - switch (buttonId) { - case 1: - end(); - player.getInventory().add(new Item(Items.KETTLE_7688, 1)); - break; - case 2: - end(); - player.getInventory().add(new Item(Items.TEAPOT_7702, 1)); - break; - case 3: - end(); - player.getInventory().add(new Item(Items.EMPTY_CUP_7728, 1)); - break; - case 4: - end(); - player.getInventory().add(new Item(Items.BEER_GLASS_1919, 1)); - break; - case 5: - end(); - player.getInventory().add(new Item(Items.BOWL_1923, 1)); - break; - } - break; - case 3:// Oak shelves #2 only - switch (buttonId) { - case 1: - end(); - player.getInventory().add(new Item(Items.KETTLE_7688, 1)); - break; - case 2: - end(); - player.getInventory().add(new Item(Items.TEAPOT_7702, 1)); - break; - case 3: - end(); - player.getInventory().add(new Item(Items.PORCELAIN_CUP_4244, 1)); - break; - case 4: - end(); - player.getInventory().add(new Item(Items.BEER_GLASS_1919, 1)); - break; - case 5: - interpreter.sendOptions("Select an Option", "Bowl", "Cake tin"); - stage = 4; - break; - } - break; - case 4:// Oak shelves #2 only - switch (buttonId) { - case 1: - end(); - player.getInventory().add(new Item(Items.BOWL_1923, 1)); - break; - case 2: - end(); - player.getInventory().add(new Item(Items.CAKE_TIN_1887, 1)); - break; - } - case 5:// teak shelves - switch (buttonId) { - case 1: - end(); - player.getInventory().add(new Item(Items.KETTLE_7688, 1)); - break; - case 2: - end(); - player.getInventory().add(new Item(Items.TEAPOT_7702, 1)); - break; - case 3: - end(); - player.getInventory().add(new Item(Items.PORCELAIN_CUP_7735, 1)); - break; - case 4: - end(); - player.getInventory().add(new Item(Items.BEER_GLASS_1919, 1)); - break; - case 5: - interpreter.sendOptions("Select an Option", "Bowl", "Pie dish", "Empty pot"); - stage = 6; - break; - } - break; - case 6:// teak shelves - switch (buttonId) { - case 1: - end(); - player.getInventory().add(new Item(Items.BOWL_1923, 1)); - break; - case 2: - end(); - player.getInventory().add(new Item(Items.PIE_DISH_2313, 1)); - break; - case 3: - end(); - player.getInventory().add(new Item(Items.EMPTY_POT_1931, 1)); - break; - } - break; - } - return true; - } - - @Override - public int[] getIds() { - return new int[] { 778341 }; - } - } -} \ No newline at end of file +// package content.global.skill.construction.decoration.kitchen; +// +// +// import core.cache.def.impl.SceneryDefinition; +// import core.game.dialogue.DialoguePlugin; +// import core.game.interaction.OptionHandler; +// import core.game.node.Node; +// import core.game.node.entity.player.Player; +// import core.game.node.item.Item; +// import core.plugin.Initializable; +// import core.plugin.Plugin; +// import core.plugin.ClassScanner; +// import org.rs09.consts.Items; +// +// /** +// * Handles the shelves in the kitchen room. +// * @author Splinter +// */ +// @Initializable +// public final class ShelfPlugin extends OptionHandler { +// +// @Override +// public Plugin newInstance(Object arg) throws Throwable { +// ClassScanner.definePlugin(new ShelfDialogue()); +// for (int i = 13545; i < 13552; i++) { +// SceneryDefinition.forId(i).getHandlers().put("option:search", this); +// } +// return this; +// } +// +// @Override +// public boolean handle(Player player, Node node, String option) { +// player.getDialogueInterpreter().open(778341, node.getId()); +// return true; +// } +// +// /** +// * Dialogue options for the shelves, what a mess! +// * @author Splinter +// * @version 1.0 +// */ +// public final class ShelfDialogue extends DialoguePlugin { +// +// /** +// * Constructs a new {@code ShelfDialogue} {@code Object}. +// */ +// public ShelfDialogue() { +// /** +// * empty. +// */ +// } +// +// /** +// * Constructs a new {@code ShelfDialogue} {@code Object}. +// * @param player the player. +// */ +// public ShelfDialogue(Player player) { +// super(player); +// } +// +// @Override +// public DialoguePlugin newInstance(Player player) { +// return new ShelfDialogue(player); +// } +// +// @Override +// public boolean open(Object... args) { +// int id = (int) args[0]; +// switch (id) { +// case 13545:// wood 1 +// interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Clay cup"); +// stage = 1; +// break; +// case 13546:// wood 2 +// interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Clay cup", "Empty beer glass"); +// stage = 1; +// break; +// case 13547:// wood 3 +// interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Clay cup", "Empty beer glass", "Cake tin"); +// stage = 1; +// break; +// case 13548:// oak 1 +// interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Clay cup", "Empty beer glass", "Bowl"); +// stage = 2; +// break; +// case 13549:// oak 2 +// interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Porcelain cup", "Empty beer glass", "More Options"); +// stage = 3; +// break; +// case 13550:// teak 1 +// case 13551: +// interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Porcelain cup", "Empty beer glass", "More Options"); +// stage = 5; +// break; +// } +// return true; +// } +// +// @Override +// public boolean handle(int interfaceId, int buttonId) { +// if (player.getInventory().freeSlots() < 1) { +// player.sendMessage("You need at least one free inventory space to take from the shelves."); +// end(); +// return true; +// } +// switch (stage) { +// case 1:// all wood shelves +// switch (buttonId) { +// case 1: +// end(); +// player.getInventory().add(new Item(Items.KETTLE_7688, 1)); +// break; +// case 2: +// end(); +// player.getInventory().add(new Item(Items.TEAPOT_7702, 1)); +// break; +// case 3: +// end(); +// player.getInventory().add(new Item(Items.EMPTY_CUP_7728, 1)); +// break; +// case 4: +// end(); +// player.getInventory().add(new Item(Items.BEER_GLASS_1919, 1)); +// break; +// case 5: +// end(); +// player.getInventory().add(new Item(Items.CAKE_TIN_1887, 1)); +// break; +// } +// break; +// case 2:// Oak shelf #1 +// switch (buttonId) { +// case 1: +// end(); +// player.getInventory().add(new Item(Items.KETTLE_7688, 1)); +// break; +// case 2: +// end(); +// player.getInventory().add(new Item(Items.TEAPOT_7702, 1)); +// break; +// case 3: +// end(); +// player.getInventory().add(new Item(Items.EMPTY_CUP_7728, 1)); +// break; +// case 4: +// end(); +// player.getInventory().add(new Item(Items.BEER_GLASS_1919, 1)); +// break; +// case 5: +// end(); +// player.getInventory().add(new Item(Items.BOWL_1923, 1)); +// break; +// } +// break; +// case 3:// Oak shelves #2 only +// switch (buttonId) { +// case 1: +// end(); +// player.getInventory().add(new Item(Items.KETTLE_7688, 1)); +// break; +// case 2: +// end(); +// player.getInventory().add(new Item(Items.TEAPOT_7702, 1)); +// break; +// case 3: +// end(); +// player.getInventory().add(new Item(Items.PORCELAIN_CUP_4244, 1)); +// break; +// case 4: +// end(); +// player.getInventory().add(new Item(Items.BEER_GLASS_1919, 1)); +// break; +// case 5: +// interpreter.sendOptions("Select an Option", "Bowl", "Cake tin"); +// stage = 4; +// break; +// } +// break; +// case 4:// Oak shelves #2 only +// switch (buttonId) { +// case 1: +// end(); +// player.getInventory().add(new Item(Items.BOWL_1923, 1)); +// break; +// case 2: +// end(); +// player.getInventory().add(new Item(Items.CAKE_TIN_1887, 1)); +// break; +// } +// case 5:// teak shelves +// switch (buttonId) { +// case 1: +// end(); +// player.getInventory().add(new Item(Items.KETTLE_7688, 1)); +// break; +// case 2: +// end(); +// player.getInventory().add(new Item(Items.TEAPOT_7702, 1)); +// break; +// case 3: +// end(); +// player.getInventory().add(new Item(Items.PORCELAIN_CUP_7735, 1)); +// break; +// case 4: +// end(); +// player.getInventory().add(new Item(Items.BEER_GLASS_1919, 1)); +// break; +// case 5: +// interpreter.sendOptions("Select an Option", "Bowl", "Pie dish", "Empty pot"); +// stage = 6; +// break; +// } +// break; +// case 6:// teak shelves +// switch (buttonId) { +// case 1: +// end(); +// player.getInventory().add(new Item(Items.BOWL_1923, 1)); +// break; +// case 2: +// end(); +// player.getInventory().add(new Item(Items.PIE_DISH_2313, 1)); +// break; +// case 3: +// end(); +// player.getInventory().add(new Item(Items.EMPTY_POT_1931, 1)); +// break; +// } +// break; +// } +// return true; +// } +// +// @Override +// public int[] getIds() { +// return new int[] { 778341 }; +// } +// } +// } \ No newline at end of file diff --git a/Server/src/main/core/api/ContentAPI.kt b/Server/src/main/core/api/ContentAPI.kt index cca729909..d09093879 100644 --- a/Server/src/main/core/api/ContentAPI.kt +++ b/Server/src/main/core/api/ContentAPI.kt @@ -684,6 +684,16 @@ fun hasSpaceFor(player: Player, item: Item): Boolean { return player.inventory.hasSpaceFor(item) } +/** + * Checks if a player has space for an item + * @param player the player whose inventory to check + * @param item the Item to check against + * @return true if the player's inventory has space for the item + */ +fun hasSpaceFor(player: Player, item: Int, amount: Int): Boolean { + return hasSpaceFor(player, Item(item, amount)) +} + /** * Get the number of ticks passed since server startup */ From 655d5f0e064b58235dc43d08fe90446473683957 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Sun, 22 Dec 2024 18:40:54 +0000 Subject: [PATCH 24/50] More work on the shelf listener --- .../decoration/kitchen/ShelfListener.kt | 92 +++++++++++++------ 1 file changed, 66 insertions(+), 26 deletions(-) diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt index 8c8d08de6..f7fbab423 100644 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt @@ -1,58 +1,98 @@ package content.global.skill.construction.decoration.kitchen import core.api.* +import core.game.dialogue.* import core.game.interaction.IntType import core.game.interaction.InteractionListener import core.game.node.entity.player.Player +import core.tools.END_DIALOGUE import org.rs09.consts.Items import org.rs09.consts.Scenery +import kotlin.math.min + class ShelfListener : InteractionListener { - companion object{ - - const val NEXT = 5 - const val PREV = -5 - - val woodshelf_1_items = listOf( - "Kettle" to Items.KETTLE_7688, - "Teapot" to Items.TEAPOT_7702, - "Clay Cup" to Items.EMPTY_CUP_7728 - ) - - val woodshelf_2_items = woodshelf_1_items + mapOf( - "Empty beer glass" to Items.BEER_GLASS_1919 - ) - - val shelves = mapOf( - Scenery.SHELVES_13545 to woodshelf_1_items - ) - } override fun defineListeners() { - on(shelves.keys.toIntArray(), IntType.SCENERY, "Search") {player, node -> + on(ShelfDialogue.shelves.keys.toIntArray(), IntType.SCENERY, "Search") {player, node -> searchShelf(player, node.id) return@on true } } - fun searchShelf(player : Player, shelf_id: Int, offset : Int = 0){ - val shelfItems = shelves[shelf_id]!!.slice(offset..offset+4) + private fun searchShelf(player : Player, shelfId: Int){ + openDialogue(player, ShelfDialogue(shelfId, 0)) + } + + class ShelfDialogue(val shelfId: Int, val offset: Int) : DialogueFile() { + + companion object{ + + const val NEXT = 5 + const val PREV = -5 + + private val woodshelf_1_items = listOf( + "Kettle" to Items.KETTLE_7688, + "Teapot" to Items.TEAPOT_7702, + "Clay Cup" to Items.EMPTY_CUP_7728 + ) + + private val woodshelf_2_items = woodshelf_1_items + listOf( + "Empty beer glass" to Items.BEER_GLASS_1919 + ) + + private val woodshelf_3_items = woodshelf_2_items + listOf( + "Cake tin" to Items.CAKE_TIN_1887 + ) + + private val oakshelf_1_items = woodshelf_2_items + listOf( + "More Options" to NEXT, + "Cake tin" to Items.CAKE_TIN_1887, + "Bowl" to Items.BOWL_1923, + "More Options" to PREV + ) + + val shelves = mapOf( + Scenery.SHELVES_13545 to woodshelf_1_items, + Scenery.SHELVES_13546 to woodshelf_2_items, + Scenery.SHELVES_13547 to woodshelf_3_items, + Scenery.SHELVES_13548 to oakshelf_1_items, + ) + } + + val end = min(shelves[shelfId]!!.size, 5) + val shelfItems = shelves[shelfId]!!.slice(offset until end) val shelfItemsNames = shelfItems.map { it.first } val shelfItemsIds = shelfItems.map { it.second } - sendDialogueOptions(player, "Select an Option", *shelfItemsNames.toTypedArray()) - addDialogueAction(player) { p, button -> + + fun checkItem(player: Player, shelfId: Int, offset: Int, button : Int){ val item = shelfItemsIds[button] if (item < 1000){ - searchShelf(player, shelf_id, offset+item) + openDialogue(player, ShelfDialogue(shelfId, offset+item)) } else{ if (hasSpaceFor(player, item, 1)){ addItem(player, item) + end() } else{ - sendMessage(player, "You need at least one free inventory space to take from the shelves.") + sendDialogue(player, "You need at least one free inventory space to take from the shelves.").also { stage = END_DIALOGUE } } } + } + + override fun handle(componentID: Int, buttonID: Int) { + println("Stage: $stage") + when(stage){ + 0 -> showTopics( + *shelfItemsNames.toTypedArray().mapIndexed { index, item -> Topic(item, index+1, skipPlayer = true) }.toTypedArray() + ) + in 1 .. 5 -> checkItem(player!!, shelfId, offset, stage - 1).also { stage = 6 } + else -> end() + } + } + + } } \ No newline at end of file From 932f1770ff74c4b0c4e011353945d075b07caa0d Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Sun, 22 Dec 2024 20:05:42 +0000 Subject: [PATCH 25/50] First draft at a procedural More options --- .../decoration/kitchen/ShelfListener.kt | 84 +++++++++++++------ 1 file changed, 58 insertions(+), 26 deletions(-) diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt index f7fbab423..57b38be55 100644 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt @@ -24,7 +24,7 @@ class ShelfListener : InteractionListener { openDialogue(player, ShelfDialogue(shelfId, 0)) } - class ShelfDialogue(val shelfId: Int, val offset: Int) : DialogueFile() { + class ShelfDialogue(shelfId: Int, val offset: Int) : DialogueFile() { companion object{ @@ -46,10 +46,7 @@ class ShelfListener : InteractionListener { ) private val oakshelf_1_items = woodshelf_2_items + listOf( - "More Options" to NEXT, - "Cake tin" to Items.CAKE_TIN_1887, "Bowl" to Items.BOWL_1923, - "More Options" to PREV ) val shelves = mapOf( @@ -60,35 +57,70 @@ class ShelfListener : InteractionListener { ) } - val end = min(shelves[shelfId]!!.size, 5) - val shelfItems = shelves[shelfId]!!.slice(offset until end) - val shelfItemsNames = shelfItems.map { it.first } - val shelfItemsIds = shelfItems.map { it.second } + private val shelfItemsNames = shelves[shelfId]!!.map { it.first } + private val shelfItemsIds = shelves[shelfId]!!.map { it.second } - fun checkItem(player: Player, shelfId: Int, offset: Int, button : Int){ - val item = shelfItemsIds[button] - if (item < 1000){ - openDialogue(player, ShelfDialogue(shelfId, offset+item)) + private fun checkItem(player: Player, idx : Int){ + val item = shelfItemsIds[idx] + if (hasSpaceFor(player, item, 1)){ + addItem(player, item) + end() } else{ - if (hasSpaceFor(player, item, 1)){ - addItem(player, item) - end() - } - else{ - sendDialogue(player, "You need at least one free inventory space to take from the shelves.").also { stage = END_DIALOGUE } - } + sendDialogue(player, "You need at least one free inventory space to take from the shelves.").also { stage = END_DIALOGUE } } - } + private fun createTopics(page: Int, itemsPerPage: Int): MutableList> { + val startIndex = (page - 1) * itemsPerPage + val endIndex = (startIndex + itemsPerPage).coerceAtMost(shelfItemsNames.size) + + val topics = shelfItemsNames.subList(startIndex, endIndex) + .mapIndexed { index, item -> Topic(item, startIndex + index + 1, skipPlayer = true) } + .toMutableList() + + // Add "More" button if there's another page or to loop back + if (endIndex < shelfItemsNames.size || page > 1) { + topics.add(Topic("More", endIndex + 1, skipPlayer = true)) + } + + return topics + } + + + override fun handle(componentID: Int, buttonID: Int) { - println("Stage: $stage") - when(stage){ - 0 -> showTopics( - *shelfItemsNames.toTypedArray().mapIndexed { index, item -> Topic(item, index+1, skipPlayer = true) }.toTypedArray() - ) - in 1 .. 5 -> checkItem(player!!, shelfId, offset, stage - 1).also { stage = 6 } + if (player!!.inventory.freeSlot() < 1) { + sendDialogue(player!!, "You need at least one free inventory space to take from the shelves.").also { stage = END_DIALOGUE } + return + } + val itemsPerPage = 4 + val totalPages = (shelfItemsNames.size + itemsPerPage - 1) / itemsPerPage // Total number of pages + + when (stage) { + 0, shelfItemsNames.size + 1 -> { // Initial stage or final more button clicked + val topics = createTopics(1, itemsPerPage) + showTopics(*topics.toTypedArray()).also { stage = 1 } + } + in 1..shelfItemsNames.size -> { // Specific stages for each page + val currentPage = stage / (itemsPerPage + 1) + val startIndex = currentPage * itemsPerPage + + if (buttonID == itemsPerPage + 1) { // "More" button clicked + if (currentPage < totalPages) { + val topics = createTopics(currentPage + 1, itemsPerPage) + showTopics(*topics.toTypedArray()).also { stage = currentPage*4 + 1 } + } else { // Last page, loop back to the first page + val topics = createTopics(1, itemsPerPage) + showTopics(*topics.toTypedArray()).also { stage = 1 } + } + } else { // Handle item selection + val itemIndex = startIndex + (buttonID - 1) + if (itemIndex < shelfItemsNames.size) { + checkItem(player!!, itemIndex) + } + } + } else -> end() } } From cbe3a04b5aa1f55ddad17e0e05e6dc35d7f06a65 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Sun, 22 Dec 2024 20:08:53 +0000 Subject: [PATCH 26/50] Remove unneeded code --- .../construction/decoration/kitchen/ShelfListener.kt | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt index 57b38be55..554257469 100644 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt @@ -95,7 +95,6 @@ class ShelfListener : InteractionListener { return } val itemsPerPage = 4 - val totalPages = (shelfItemsNames.size + itemsPerPage - 1) / itemsPerPage // Total number of pages when (stage) { 0, shelfItemsNames.size + 1 -> { // Initial stage or final more button clicked @@ -106,14 +105,9 @@ class ShelfListener : InteractionListener { val currentPage = stage / (itemsPerPage + 1) val startIndex = currentPage * itemsPerPage - if (buttonID == itemsPerPage + 1) { // "More" button clicked - if (currentPage < totalPages) { - val topics = createTopics(currentPage + 1, itemsPerPage) - showTopics(*topics.toTypedArray()).also { stage = currentPage*4 + 1 } - } else { // Last page, loop back to the first page - val topics = createTopics(1, itemsPerPage) - showTopics(*topics.toTypedArray()).also { stage = 1 } - } + if (buttonID == itemsPerPage + 1) { // "More" button clicked (but not the last one) + val topics = createTopics(currentPage + 1, itemsPerPage) + showTopics(*topics.toTypedArray()).also { stage = currentPage*4 + 1 } } else { // Handle item selection val itemIndex = startIndex + (buttonID - 1) if (itemIndex < shelfItemsNames.size) { From db43418b1e01c296c499e603a12d14e32d240209 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Sun, 22 Dec 2024 20:41:51 +0000 Subject: [PATCH 27/50] Clean up text. Fix bug with cake tin not appearing --- .../decoration/kitchen/ShelfListener.kt | 27 +++++++++++++++---- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt index 554257469..3559743ed 100644 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt @@ -31,29 +31,48 @@ class ShelfListener : InteractionListener { const val NEXT = 5 const val PREV = -5 + // Source for text https://www.youtube.com/watch?v=SNuqelEft3Y + private val woodshelf_1_items = listOf( "Kettle" to Items.KETTLE_7688, "Teapot" to Items.TEAPOT_7702, - "Clay Cup" to Items.EMPTY_CUP_7728 + "Cup" to Items.EMPTY_CUP_7728 ) private val woodshelf_2_items = woodshelf_1_items + listOf( - "Empty beer glass" to Items.BEER_GLASS_1919 + "Beer glass" to Items.BEER_GLASS_1919 ) private val woodshelf_3_items = woodshelf_2_items + listOf( "Cake tin" to Items.CAKE_TIN_1887 ) - private val oakshelf_1_items = woodshelf_2_items + listOf( + private val oakshelf_1_items = woodshelf_3_items + listOf( "Bowl" to Items.BOWL_1923, ) + private val oakshelf_2_items = oakshelf_1_items.map { (name, itemId) -> + if (name == "Cup") { "Porcelain cup" to Items.PORCELAIN_CUP_7732 } + else { name to itemId} + } + listOf( "Pie dish" to Items.PIE_DISH_2313 ) + + private val teakshelf_1_items = oakshelf_2_items + listOf( + "Pot" to Items.EMPTY_POT_1931 + ) + + private val teakshelf_2_items = teakshelf_1_items.map { (name, itemId) -> + if (name == "Porcelain cup") { "Porcelain cup" to Items.PORCELAIN_CUP_7735 } + else { name to itemId } + } + listOf( "Chef's Hat" to Items.CHEFS_HAT_1949 ) + val shelves = mapOf( Scenery.SHELVES_13545 to woodshelf_1_items, Scenery.SHELVES_13546 to woodshelf_2_items, Scenery.SHELVES_13547 to woodshelf_3_items, Scenery.SHELVES_13548 to oakshelf_1_items, + Scenery.SHELVES_13549 to oakshelf_2_items, + Scenery.SHELVES_13550 to teakshelf_1_items, + Scenery.SHELVES_13551 to teakshelf_2_items, ) } @@ -118,7 +137,5 @@ class ShelfListener : InteractionListener { else -> end() } } - - } } \ No newline at end of file From 0ade1f308c599b85c87b91846605ba04d5dc5b94 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Sun, 22 Dec 2024 22:16:53 +0000 Subject: [PATCH 28/50] Add missing teapot. Remove obsolete parameters Fix issue with 2nd More not working --- .../construction/decoration/kitchen/ShelfListener.kt | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt index 3559743ed..eb6482adf 100644 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt @@ -21,10 +21,10 @@ class ShelfListener : InteractionListener { } private fun searchShelf(player : Player, shelfId: Int){ - openDialogue(player, ShelfDialogue(shelfId, 0)) + openDialogue(player, ShelfDialogue(shelfId)) } - class ShelfDialogue(shelfId: Int, val offset: Int) : DialogueFile() { + class ShelfDialogue(shelfId: Int) : DialogueFile() { companion object{ @@ -53,6 +53,7 @@ class ShelfListener : InteractionListener { private val oakshelf_2_items = oakshelf_1_items.map { (name, itemId) -> if (name == "Cup") { "Porcelain cup" to Items.PORCELAIN_CUP_7732 } + else if (name == "Teapot") { "Teapot" to Items.TEAPOT_7714 } else { name to itemId} } + listOf( "Pie dish" to Items.PIE_DISH_2313 ) @@ -62,6 +63,7 @@ class ShelfListener : InteractionListener { private val teakshelf_2_items = teakshelf_1_items.map { (name, itemId) -> if (name == "Porcelain cup") { "Porcelain cup" to Items.PORCELAIN_CUP_7735 } + else if (name == "Teapot") { "Teapot" to Items.TEAPOT_7726 } else { name to itemId } } + listOf( "Chef's Hat" to Items.CHEFS_HAT_1949 ) @@ -120,13 +122,13 @@ class ShelfListener : InteractionListener { val topics = createTopics(1, itemsPerPage) showTopics(*topics.toTypedArray()).also { stage = 1 } } - in 1..shelfItemsNames.size -> { // Specific stages for each page - val currentPage = stage / (itemsPerPage + 1) + in 1..shelfItemsNames.size -> { + val currentPage = (stage-1) / itemsPerPage val startIndex = currentPage * itemsPerPage if (buttonID == itemsPerPage + 1) { // "More" button clicked (but not the last one) val topics = createTopics(currentPage + 1, itemsPerPage) - showTopics(*topics.toTypedArray()).also { stage = currentPage*4 + 1 } + showTopics(*topics.toTypedArray()).also { stage = currentPage*itemsPerPage + 1 } } else { // Handle item selection val itemIndex = startIndex + (buttonID - 1) if (itemIndex < shelfItemsNames.size) { From 32293edd1aaf82320cba3804f6834d0af7af18d5 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Sun, 22 Dec 2024 22:27:36 +0000 Subject: [PATCH 29/50] Replace if cascade with when --- .../decoration/kitchen/ShelfListener.kt | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt index eb6482adf..9c81b55ec 100644 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt @@ -52,9 +52,11 @@ class ShelfListener : InteractionListener { ) private val oakshelf_2_items = oakshelf_1_items.map { (name, itemId) -> - if (name == "Cup") { "Porcelain cup" to Items.PORCELAIN_CUP_7732 } - else if (name == "Teapot") { "Teapot" to Items.TEAPOT_7714 } - else { name to itemId} + when (name) { + "Cup" -> { "Porcelain cup" to Items.PORCELAIN_CUP_7732 } + "Teapot" -> { "Teapot" to Items.TEAPOT_7714 } + else -> { name to itemId} + } } + listOf( "Pie dish" to Items.PIE_DISH_2313 ) private val teakshelf_1_items = oakshelf_2_items + listOf( @@ -62,9 +64,11 @@ class ShelfListener : InteractionListener { ) private val teakshelf_2_items = teakshelf_1_items.map { (name, itemId) -> - if (name == "Porcelain cup") { "Porcelain cup" to Items.PORCELAIN_CUP_7735 } - else if (name == "Teapot") { "Teapot" to Items.TEAPOT_7726 } - else { name to itemId } + when (name) { + "Porcelain cup" -> { "Porcelain cup" to Items.PORCELAIN_CUP_7735 } + "Teapot" -> { "Teapot" to Items.TEAPOT_7726 } + else -> { name to itemId } + } } + listOf( "Chef's Hat" to Items.CHEFS_HAT_1949 ) val shelves = mapOf( From af02250f88e58506dea5b6ded395c70488e3574b Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Sun, 22 Dec 2024 22:30:24 +0000 Subject: [PATCH 30/50] Check size of shelf in a better way --- .../decoration/kitchen/ShelfListener.kt | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt index 9c81b55ec..7df0c7dfe 100644 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt @@ -82,8 +82,10 @@ class ShelfListener : InteractionListener { ) } - private val shelfItemsNames = shelves[shelfId]!!.map { it.first } - private val shelfItemsIds = shelves[shelfId]!!.map { it.second } + private val shelf = shelves[shelfId]!! + private val shelfItemsNames = shelf.map { it.first } + private val shelfItemsIds = shelf.map { it.second } + private val size = shelf.size private fun checkItem(player: Player, idx : Int){ val item = shelfItemsIds[idx] @@ -98,14 +100,14 @@ class ShelfListener : InteractionListener { private fun createTopics(page: Int, itemsPerPage: Int): MutableList> { val startIndex = (page - 1) * itemsPerPage - val endIndex = (startIndex + itemsPerPage).coerceAtMost(shelfItemsNames.size) + val endIndex = (startIndex + itemsPerPage).coerceAtMost(size) val topics = shelfItemsNames.subList(startIndex, endIndex) .mapIndexed { index, item -> Topic(item, startIndex + index + 1, skipPlayer = true) } .toMutableList() // Add "More" button if there's another page or to loop back - if (endIndex < shelfItemsNames.size || page > 1) { + if (endIndex < size || page > 1) { topics.add(Topic("More", endIndex + 1, skipPlayer = true)) } @@ -122,11 +124,11 @@ class ShelfListener : InteractionListener { val itemsPerPage = 4 when (stage) { - 0, shelfItemsNames.size + 1 -> { // Initial stage or final more button clicked + 0, size + 1 -> { // Initial stage or final more button clicked val topics = createTopics(1, itemsPerPage) showTopics(*topics.toTypedArray()).also { stage = 1 } } - in 1..shelfItemsNames.size -> { + in 1..size -> { val currentPage = (stage-1) / itemsPerPage val startIndex = currentPage * itemsPerPage @@ -135,7 +137,7 @@ class ShelfListener : InteractionListener { showTopics(*topics.toTypedArray()).also { stage = currentPage*itemsPerPage + 1 } } else { // Handle item selection val itemIndex = startIndex + (buttonID - 1) - if (itemIndex < shelfItemsNames.size) { + if (itemIndex < size) { checkItem(player!!, itemIndex) } } From 90be6cff968922c7e89e53bf5689e6f55ea0e64a Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Sun, 22 Dec 2024 23:06:26 +0000 Subject: [PATCH 31/50] Create AbstractContainer so that Shelf and Larder can use the same design --- .../decoration/kitchen/AbstractContainer.kt | 79 +++++++ .../decoration/kitchen/ShelfListener.kt | 193 +++++++----------- 2 files changed, 149 insertions(+), 123 deletions(-) create mode 100644 Server/src/main/content/global/skill/construction/decoration/kitchen/AbstractContainer.kt diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/AbstractContainer.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/AbstractContainer.kt new file mode 100644 index 000000000..cd3426c7a --- /dev/null +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/AbstractContainer.kt @@ -0,0 +1,79 @@ +package content.global.skill.construction.decoration.kitchen + +import core.api.addItem +import core.api.hasSpaceFor +import core.api.sendDialogue +import core.game.dialogue.DialogueFile +import core.game.dialogue.Topic +import core.game.node.entity.player.Player +import core.tools.END_DIALOGUE + +abstract class AbstractContainer(containerId: Int, containers: Map>>, private val containerName: String) : DialogueFile() { + + private val container = containers[containerId]!! + private val containerItemsNames = container.map { it.first } + private val containerItemsIds = container.map { it.second } + private val size = container.size + private val itemsPerPage = 4 + + private fun checkItem(player: Player, idx : Int){ + val item = containerItemsIds[idx] + if (hasSpaceFor(player, item, 1)){ + addItem(player, item) + end() + } + else{ + sendDialogue(player, "You need at least one free inventory space to take from the shelves.").also { stage = END_DIALOGUE } + } + } + + private fun createTopics(page: Int): MutableList> { + val startIndex = (page - 1) * itemsPerPage + val endIndex = (startIndex + itemsPerPage).coerceAtMost(size) + + val topics = containerItemsNames.subList(startIndex, endIndex) + .mapIndexed { index, item -> Topic(item, startIndex + index + 1, skipPlayer = true) } + .toMutableList() + + // Add "More" button if there's another page or to loop back + if (endIndex < size || page > 1) { + topics.add(Topic("More", endIndex + 1, skipPlayer = true)) + } + + return topics + } + + + + override fun handle(componentID: Int, buttonID: Int) { + if (player!!.inventory.freeSlot() < 1) { + sendDialogue(player!!, "You need at least one free inventory space to take from the $containerName.").also { stage = END_DIALOGUE } + return + } + val itemsPerPage = 4 + + when (stage) { + 0, size + 1 -> { // Initial stage or final more button clicked + val topics = createTopics(1) + showTopics(*topics.toTypedArray()).also { stage = 1 } + } + in 1..size -> { + val currentPage = (stage-1) / itemsPerPage + val startIndex = currentPage * itemsPerPage + + if (buttonID == itemsPerPage + 1) { // "More" button clicked (but not the last one) + val topics = createTopics(currentPage + 1) + showTopics(*topics.toTypedArray()).also { stage = currentPage*itemsPerPage + 1 } + } else { // Handle item selection + val itemIndex = startIndex + (buttonID - 1) + if (itemIndex < size) { + checkItem(player!!, itemIndex) + } + } + } + else -> end() + } + } + + +} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt index 7df0c7dfe..57761e0c6 100644 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt @@ -12,138 +12,85 @@ import kotlin.math.min class ShelfListener : InteractionListener { + companion object { + // Source for text https://www.youtube.com/watch?v=SNuqelEft3Y + + private val woodshelf_1_items = listOf( + "Kettle" to Items.KETTLE_7688, + "Teapot" to Items.TEAPOT_7702, + "Cup" to Items.EMPTY_CUP_7728 + ) + + private val woodshelf_2_items = woodshelf_1_items + listOf( + "Beer glass" to Items.BEER_GLASS_1919 + ) + + private val woodshelf_3_items = woodshelf_2_items + listOf( + "Cake tin" to Items.CAKE_TIN_1887 + ) + + private val oakshelf_1_items = woodshelf_3_items + listOf( + "Bowl" to Items.BOWL_1923, + ) + + private val oakshelf_2_items = oakshelf_1_items.map { (name, itemId) -> + when (name) { + "Cup" -> { + "Porcelain cup" to Items.PORCELAIN_CUP_7732 + } + + "Teapot" -> { + "Teapot" to Items.TEAPOT_7714 + } + + else -> { + name to itemId + } + } + } + listOf("Pie dish" to Items.PIE_DISH_2313) + + private val teakshelf_1_items = oakshelf_2_items + listOf( + "Pot" to Items.EMPTY_POT_1931 + ) + + private val teakshelf_2_items = teakshelf_1_items.map { (name, itemId) -> + when (name) { + "Porcelain cup" -> { + "Porcelain cup" to Items.PORCELAIN_CUP_7735 + } + + "Teapot" -> { + "Teapot" to Items.TEAPOT_7726 + } + + else -> { + name to itemId + } + } + } + listOf("Chef's Hat" to Items.CHEFS_HAT_1949) + + val shelves = mapOf( + Scenery.SHELVES_13545 to woodshelf_1_items, + Scenery.SHELVES_13546 to woodshelf_2_items, + Scenery.SHELVES_13547 to woodshelf_3_items, + Scenery.SHELVES_13548 to oakshelf_1_items, + Scenery.SHELVES_13549 to oakshelf_2_items, + Scenery.SHELVES_13550 to teakshelf_1_items, + Scenery.SHELVES_13551 to teakshelf_2_items, + ) + } override fun defineListeners() { - on(ShelfDialogue.shelves.keys.toIntArray(), IntType.SCENERY, "Search") {player, node -> + on(shelves.keys.toIntArray(), IntType.SCENERY, "Search") { player, node -> searchShelf(player, node.id) return@on true } } private fun searchShelf(player : Player, shelfId: Int){ - openDialogue(player, ShelfDialogue(shelfId)) + openDialogue(player, ShelfDialogue(shelfId, shelves)) } - class ShelfDialogue(shelfId: Int) : DialogueFile() { + class ShelfDialogue(shelfId: Int, shelves : Map>>) : AbstractContainer(shelfId, shelves, "shelf") - companion object{ - - const val NEXT = 5 - const val PREV = -5 - - // Source for text https://www.youtube.com/watch?v=SNuqelEft3Y - - private val woodshelf_1_items = listOf( - "Kettle" to Items.KETTLE_7688, - "Teapot" to Items.TEAPOT_7702, - "Cup" to Items.EMPTY_CUP_7728 - ) - - private val woodshelf_2_items = woodshelf_1_items + listOf( - "Beer glass" to Items.BEER_GLASS_1919 - ) - - private val woodshelf_3_items = woodshelf_2_items + listOf( - "Cake tin" to Items.CAKE_TIN_1887 - ) - - private val oakshelf_1_items = woodshelf_3_items + listOf( - "Bowl" to Items.BOWL_1923, - ) - - private val oakshelf_2_items = oakshelf_1_items.map { (name, itemId) -> - when (name) { - "Cup" -> { "Porcelain cup" to Items.PORCELAIN_CUP_7732 } - "Teapot" -> { "Teapot" to Items.TEAPOT_7714 } - else -> { name to itemId} - } - } + listOf( "Pie dish" to Items.PIE_DISH_2313 ) - - private val teakshelf_1_items = oakshelf_2_items + listOf( - "Pot" to Items.EMPTY_POT_1931 - ) - - private val teakshelf_2_items = teakshelf_1_items.map { (name, itemId) -> - when (name) { - "Porcelain cup" -> { "Porcelain cup" to Items.PORCELAIN_CUP_7735 } - "Teapot" -> { "Teapot" to Items.TEAPOT_7726 } - else -> { name to itemId } - } - } + listOf( "Chef's Hat" to Items.CHEFS_HAT_1949 ) - - val shelves = mapOf( - Scenery.SHELVES_13545 to woodshelf_1_items, - Scenery.SHELVES_13546 to woodshelf_2_items, - Scenery.SHELVES_13547 to woodshelf_3_items, - Scenery.SHELVES_13548 to oakshelf_1_items, - Scenery.SHELVES_13549 to oakshelf_2_items, - Scenery.SHELVES_13550 to teakshelf_1_items, - Scenery.SHELVES_13551 to teakshelf_2_items, - ) - } - - private val shelf = shelves[shelfId]!! - private val shelfItemsNames = shelf.map { it.first } - private val shelfItemsIds = shelf.map { it.second } - private val size = shelf.size - - private fun checkItem(player: Player, idx : Int){ - val item = shelfItemsIds[idx] - if (hasSpaceFor(player, item, 1)){ - addItem(player, item) - end() - } - else{ - sendDialogue(player, "You need at least one free inventory space to take from the shelves.").also { stage = END_DIALOGUE } - } - } - - private fun createTopics(page: Int, itemsPerPage: Int): MutableList> { - val startIndex = (page - 1) * itemsPerPage - val endIndex = (startIndex + itemsPerPage).coerceAtMost(size) - - val topics = shelfItemsNames.subList(startIndex, endIndex) - .mapIndexed { index, item -> Topic(item, startIndex + index + 1, skipPlayer = true) } - .toMutableList() - - // Add "More" button if there's another page or to loop back - if (endIndex < size || page > 1) { - topics.add(Topic("More", endIndex + 1, skipPlayer = true)) - } - - return topics - } - - - - override fun handle(componentID: Int, buttonID: Int) { - if (player!!.inventory.freeSlot() < 1) { - sendDialogue(player!!, "You need at least one free inventory space to take from the shelves.").also { stage = END_DIALOGUE } - return - } - val itemsPerPage = 4 - - when (stage) { - 0, size + 1 -> { // Initial stage or final more button clicked - val topics = createTopics(1, itemsPerPage) - showTopics(*topics.toTypedArray()).also { stage = 1 } - } - in 1..size -> { - val currentPage = (stage-1) / itemsPerPage - val startIndex = currentPage * itemsPerPage - - if (buttonID == itemsPerPage + 1) { // "More" button clicked (but not the last one) - val topics = createTopics(currentPage + 1, itemsPerPage) - showTopics(*topics.toTypedArray()).also { stage = currentPage*itemsPerPage + 1 } - } else { // Handle item selection - val itemIndex = startIndex + (buttonID - 1) - if (itemIndex < size) { - checkItem(player!!, itemIndex) - } - } - } - else -> end() - } - } - } } \ No newline at end of file From 3d587ca7ed87cda8e9f332985e2fd084183085e1 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Sun, 22 Dec 2024 23:27:50 +0000 Subject: [PATCH 32/50] Port Larder to kotlin --- .../decoration/kitchen/LarderListener.kt | 42 +++ .../decoration/kitchen/LarderPlugin.java | 149 ----------- .../decoration/kitchen/ShelfListener.kt | 9 +- .../decoration/kitchen/ShelfPlugin.java | 239 ------------------ 4 files changed, 44 insertions(+), 395 deletions(-) create mode 100644 Server/src/main/content/global/skill/construction/decoration/kitchen/LarderListener.kt delete mode 100644 Server/src/main/content/global/skill/construction/decoration/kitchen/LarderPlugin.java delete mode 100644 Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfPlugin.java diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/LarderListener.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/LarderListener.kt new file mode 100644 index 000000000..1bff6bc47 --- /dev/null +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/LarderListener.kt @@ -0,0 +1,42 @@ +package content.global.skill.construction.decoration.kitchen + +import core.api.openDialogue +import core.game.interaction.IntType +import core.game.interaction.InteractionListener +import org.rs09.consts.Items +import org.rs09.consts.Scenery + +class LarderListener : InteractionListener { + + companion object { + private val wooden_larder_items = listOf( + "Tea Leaves" to Items.TEA_LEAVES_7738, + "Bucket of Milk" to Items.BUCKET_OF_MILK_1927 + ) + private val oak_larder_items = wooden_larder_items + listOf( + "Eggs" to Items.EGG_1944, + "Pot of Flour" to Items.POT_OF_FLOUR_1933 + ) + private val teak_larder_items = oak_larder_items + listOf( + "Potatoes" to Items.POTATO_1942, + "Garlic" to Items.GARLIC_1550, + "Onions" to Items.ONION_1957, + "Cheese" to Items.CHEESE_1985 + ) + + val larders = mapOf( + Scenery.LARDER_13565 to wooden_larder_items, + Scenery.LARDER_13566 to oak_larder_items, + Scenery.LARDER_13567 to teak_larder_items + ) + } + + override fun defineListeners() { + on(larders.keys.toIntArray(), IntType.SCENERY, "Search") { player, node -> + openDialogue(player, LarderDialogue(node.id)) + return@on true + } + } + + class LarderDialogue(shelfId: Int) : AbstractContainer(shelfId, larders, "larder") +} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/LarderPlugin.java b/Server/src/main/content/global/skill/construction/decoration/kitchen/LarderPlugin.java deleted file mode 100644 index 9c3289cf2..000000000 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/LarderPlugin.java +++ /dev/null @@ -1,149 +0,0 @@ -package content.global.skill.construction.decoration.kitchen; - - -import core.cache.def.impl.SceneryDefinition; -import core.plugin.Initializable; -import core.game.dialogue.DialoguePlugin; -import core.game.interaction.OptionHandler; -import core.game.node.Node; -import core.game.node.entity.player.Player; -import core.game.node.item.Item; -import core.plugin.Plugin; -import core.plugin.ClassScanner; -import org.rs09.consts.Items; - -/** - * Handles the interactions for the three Larders. - * @author Splinter - */ -@Initializable -public final class LarderPlugin extends OptionHandler { - - @Override - public Plugin newInstance(Object arg) throws Throwable { - ClassScanner.definePlugin(new LarderDialogue()); - SceneryDefinition.forId(13565).getHandlers().put("option:search", this); - SceneryDefinition.forId(13566).getHandlers().put("option:search", this); - SceneryDefinition.forId(13567).getHandlers().put("option:search", this); - return this; - } - - @Override - public boolean handle(Player player, Node node, String option) { - player.getDialogueInterpreter().open(42048, node.getId()); - return true; - } - - /** - * Dialogue options for the Larders. - * @author Splinter - * @version 1.0 - */ - public final class LarderDialogue extends DialoguePlugin { - - /** - * Constructs a new {@code LarderDialogue} {@code Object}. - */ - public LarderDialogue() { - /** - * empty. - */ - } - - /** - * Constructs a new {@code LarderDialogue} {@code Object}. - * - * @param player - * the player. - */ - public LarderDialogue(Player player) { - super(player); - } - - @Override - public DialoguePlugin newInstance(Player player) { - return new LarderDialogue(player); - } - - @Override - public boolean open(Object... args) { - int id = (int) args[0]; - switch (id) { - case 13565: - interpreter.sendOptions("Select an Option", "Tea Leaves", "Bucket of Milk"); - stage = 1; - break; - case 13566: - interpreter.sendOptions("Select an Option", "Tea Leaves", "Bucket of Milk", "Eggs", "Pot of Flour"); - stage = 1; - break; - case 13567: - interpreter.sendOptions("Select an Option", "Tea Leaves", "Bucket of Milk", "Eggs", "Pot of Flour", "More Options"); - stage = 1; - break; - } - return true; - } - - @Override - public boolean handle(int interfaceId, int buttonId) { - if (player.getInventory().freeSlots() < 1) { - player.sendMessage("You need at least one free inventory space to take from the larder."); - end(); - return true; - } - switch (stage) { - case 1: - switch (buttonId) { - case 1: - player.getInventory().add(new Item(Items.TEA_LEAVES_7738, 1)); - end(); - break; - case 2: - player.getInventory().add(new Item(Items.BUCKET_OF_MILK_1927, 1)); - end(); - break; - case 3: - player.getInventory().add(new Item(Items.EGG_1944, 1)); - end(); - break; - case 4: - player.getInventory().add(new Item(Items.POT_OF_FLOUR_1933, 1)); - end(); - break; - case 5: - player.getDialogueInterpreter().sendOptions( - "Select an Option", "Potatoes", "Garlic", "Onions", "Cheese"); - stage = 2; - break; - } - break; - case 2: - switch (buttonId) { - case 1: - player.getInventory().add(new Item(Items.POTATO_1942, 1)); - end(); - break; - case 2: - player.getInventory().add(new Item(Items.GARLIC_1550, 1)); - end(); - break; - case 3: - player.getInventory().add(new Item(Items.ONION_1957, 1)); - end(); - break; - case 4: - player.getInventory().add(new Item(Items.CHEESE_1985, 1)); - end(); - break; - } - } - return true; - } - - @Override - public int[] getIds() { - return new int[] { 42048 }; - } - } -} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt index 57761e0c6..ac407f8ad 100644 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt @@ -82,15 +82,10 @@ class ShelfListener : InteractionListener { override fun defineListeners() { on(shelves.keys.toIntArray(), IntType.SCENERY, "Search") { player, node -> - searchShelf(player, node.id) + openDialogue(player, ShelfDialogue(node.id)) return@on true } } - private fun searchShelf(player : Player, shelfId: Int){ - openDialogue(player, ShelfDialogue(shelfId, shelves)) - } - - class ShelfDialogue(shelfId: Int, shelves : Map>>) : AbstractContainer(shelfId, shelves, "shelf") - + class ShelfDialogue(shelfId: Int) : AbstractContainer(shelfId, shelves, "shelf") } \ No newline at end of file diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfPlugin.java b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfPlugin.java deleted file mode 100644 index bf1523f71..000000000 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfPlugin.java +++ /dev/null @@ -1,239 +0,0 @@ -// package content.global.skill.construction.decoration.kitchen; -// -// -// import core.cache.def.impl.SceneryDefinition; -// import core.game.dialogue.DialoguePlugin; -// import core.game.interaction.OptionHandler; -// import core.game.node.Node; -// import core.game.node.entity.player.Player; -// import core.game.node.item.Item; -// import core.plugin.Initializable; -// import core.plugin.Plugin; -// import core.plugin.ClassScanner; -// import org.rs09.consts.Items; -// -// /** -// * Handles the shelves in the kitchen room. -// * @author Splinter -// */ -// @Initializable -// public final class ShelfPlugin extends OptionHandler { -// -// @Override -// public Plugin newInstance(Object arg) throws Throwable { -// ClassScanner.definePlugin(new ShelfDialogue()); -// for (int i = 13545; i < 13552; i++) { -// SceneryDefinition.forId(i).getHandlers().put("option:search", this); -// } -// return this; -// } -// -// @Override -// public boolean handle(Player player, Node node, String option) { -// player.getDialogueInterpreter().open(778341, node.getId()); -// return true; -// } -// -// /** -// * Dialogue options for the shelves, what a mess! -// * @author Splinter -// * @version 1.0 -// */ -// public final class ShelfDialogue extends DialoguePlugin { -// -// /** -// * Constructs a new {@code ShelfDialogue} {@code Object}. -// */ -// public ShelfDialogue() { -// /** -// * empty. -// */ -// } -// -// /** -// * Constructs a new {@code ShelfDialogue} {@code Object}. -// * @param player the player. -// */ -// public ShelfDialogue(Player player) { -// super(player); -// } -// -// @Override -// public DialoguePlugin newInstance(Player player) { -// return new ShelfDialogue(player); -// } -// -// @Override -// public boolean open(Object... args) { -// int id = (int) args[0]; -// switch (id) { -// case 13545:// wood 1 -// interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Clay cup"); -// stage = 1; -// break; -// case 13546:// wood 2 -// interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Clay cup", "Empty beer glass"); -// stage = 1; -// break; -// case 13547:// wood 3 -// interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Clay cup", "Empty beer glass", "Cake tin"); -// stage = 1; -// break; -// case 13548:// oak 1 -// interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Clay cup", "Empty beer glass", "Bowl"); -// stage = 2; -// break; -// case 13549:// oak 2 -// interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Porcelain cup", "Empty beer glass", "More Options"); -// stage = 3; -// break; -// case 13550:// teak 1 -// case 13551: -// interpreter.sendOptions("Select an Option", "Kettle", "Teapot", "Porcelain cup", "Empty beer glass", "More Options"); -// stage = 5; -// break; -// } -// return true; -// } -// -// @Override -// public boolean handle(int interfaceId, int buttonId) { -// if (player.getInventory().freeSlots() < 1) { -// player.sendMessage("You need at least one free inventory space to take from the shelves."); -// end(); -// return true; -// } -// switch (stage) { -// case 1:// all wood shelves -// switch (buttonId) { -// case 1: -// end(); -// player.getInventory().add(new Item(Items.KETTLE_7688, 1)); -// break; -// case 2: -// end(); -// player.getInventory().add(new Item(Items.TEAPOT_7702, 1)); -// break; -// case 3: -// end(); -// player.getInventory().add(new Item(Items.EMPTY_CUP_7728, 1)); -// break; -// case 4: -// end(); -// player.getInventory().add(new Item(Items.BEER_GLASS_1919, 1)); -// break; -// case 5: -// end(); -// player.getInventory().add(new Item(Items.CAKE_TIN_1887, 1)); -// break; -// } -// break; -// case 2:// Oak shelf #1 -// switch (buttonId) { -// case 1: -// end(); -// player.getInventory().add(new Item(Items.KETTLE_7688, 1)); -// break; -// case 2: -// end(); -// player.getInventory().add(new Item(Items.TEAPOT_7702, 1)); -// break; -// case 3: -// end(); -// player.getInventory().add(new Item(Items.EMPTY_CUP_7728, 1)); -// break; -// case 4: -// end(); -// player.getInventory().add(new Item(Items.BEER_GLASS_1919, 1)); -// break; -// case 5: -// end(); -// player.getInventory().add(new Item(Items.BOWL_1923, 1)); -// break; -// } -// break; -// case 3:// Oak shelves #2 only -// switch (buttonId) { -// case 1: -// end(); -// player.getInventory().add(new Item(Items.KETTLE_7688, 1)); -// break; -// case 2: -// end(); -// player.getInventory().add(new Item(Items.TEAPOT_7702, 1)); -// break; -// case 3: -// end(); -// player.getInventory().add(new Item(Items.PORCELAIN_CUP_4244, 1)); -// break; -// case 4: -// end(); -// player.getInventory().add(new Item(Items.BEER_GLASS_1919, 1)); -// break; -// case 5: -// interpreter.sendOptions("Select an Option", "Bowl", "Cake tin"); -// stage = 4; -// break; -// } -// break; -// case 4:// Oak shelves #2 only -// switch (buttonId) { -// case 1: -// end(); -// player.getInventory().add(new Item(Items.BOWL_1923, 1)); -// break; -// case 2: -// end(); -// player.getInventory().add(new Item(Items.CAKE_TIN_1887, 1)); -// break; -// } -// case 5:// teak shelves -// switch (buttonId) { -// case 1: -// end(); -// player.getInventory().add(new Item(Items.KETTLE_7688, 1)); -// break; -// case 2: -// end(); -// player.getInventory().add(new Item(Items.TEAPOT_7702, 1)); -// break; -// case 3: -// end(); -// player.getInventory().add(new Item(Items.PORCELAIN_CUP_7735, 1)); -// break; -// case 4: -// end(); -// player.getInventory().add(new Item(Items.BEER_GLASS_1919, 1)); -// break; -// case 5: -// interpreter.sendOptions("Select an Option", "Bowl", "Pie dish", "Empty pot"); -// stage = 6; -// break; -// } -// break; -// case 6:// teak shelves -// switch (buttonId) { -// case 1: -// end(); -// player.getInventory().add(new Item(Items.BOWL_1923, 1)); -// break; -// case 2: -// end(); -// player.getInventory().add(new Item(Items.PIE_DISH_2313, 1)); -// break; -// case 3: -// end(); -// player.getInventory().add(new Item(Items.EMPTY_POT_1931, 1)); -// break; -// } -// break; -// } -// return true; -// } -// -// @Override -// public int[] getIds() { -// return new int[] { 778341 }; -// } -// } -// } \ No newline at end of file From de98be077e45bfbc52269c4aac358d39c921648e Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Fri, 27 Dec 2024 13:25:24 +0000 Subject: [PATCH 33/50] Fix missing container name --- .../skill/construction/decoration/kitchen/AbstractContainer.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/AbstractContainer.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/AbstractContainer.kt index cd3426c7a..9468fc735 100644 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/AbstractContainer.kt +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/AbstractContainer.kt @@ -23,7 +23,7 @@ abstract class AbstractContainer(containerId: Int, containers: Map Date: Fri, 27 Dec 2024 13:25:45 +0000 Subject: [PATCH 34/50] Update doc string for hasSpaceFor and set amount to 1 by default --- Server/src/main/core/api/ContentAPI.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Server/src/main/core/api/ContentAPI.kt b/Server/src/main/core/api/ContentAPI.kt index d09093879..31f7fb02c 100644 --- a/Server/src/main/core/api/ContentAPI.kt +++ b/Server/src/main/core/api/ContentAPI.kt @@ -687,10 +687,11 @@ fun hasSpaceFor(player: Player, item: Item): Boolean { /** * Checks if a player has space for an item * @param player the player whose inventory to check - * @param item the Item to check against + * @param item the item ID to check against + * @param amount the amount of the item (default 1) to check for * @return true if the player's inventory has space for the item */ -fun hasSpaceFor(player: Player, item: Int, amount: Int): Boolean { +fun hasSpaceFor(player: Player, item: Int, amount: Int = 1): Boolean { return hasSpaceFor(player, Item(item, amount)) } From 58bc4833cb995fefa77281c8ba1cd1fa49aeda94 Mon Sep 17 00:00:00 2001 From: gregf36665 Date: Sat, 8 Feb 2025 18:33:19 +0000 Subject: [PATCH 35/50] Fix issue with cups of tea getting milky --- .../main/content/global/skill/cooking/TeaInteraction.kt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt index 7b5ef4040..6a5c6d75f 100644 --- a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt +++ b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt @@ -155,7 +155,13 @@ class TeaInteraction : InteractionListener { else{ addItem(player, used.id + 2) } - addItem(player, with.id + 2) + // Why do these cups have a noted form! + if (with.id == Items.EMPTY_CUP_7728){ + addItem(player, with.id + 2) + } + else{ + addItem(player, with.id + 1) + } return true } return false From 1b28a0c576cc3309ad3ea1f1e2bd18936f79f131 Mon Sep 17 00:00:00 2001 From: Syndromeramo Date: Wed, 11 Jun 2025 10:36:54 -0500 Subject: [PATCH 36/50] Bowl of Hot Water, Cup of Water, and Cup of Hot Water can be emptied. Further checks for items that cannot be taken out of POH. Wooden Shelves 3 now properly give porcelain cups, not regular cups. Teapot type has no bearing on if it can be poured into a teacup. --- .../handlers/item/EmptyOptionListener.kt | 3 +++ .../global/skill/construction/HouseZone.java | 5 ++++ .../decoration/kitchen/ShelfListener.kt | 26 ++++++++++++------- .../global/skill/cooking/TeaInteraction.kt | 22 +++++----------- 4 files changed, 31 insertions(+), 25 deletions(-) diff --git a/Server/src/main/content/global/handlers/item/EmptyOptionListener.kt b/Server/src/main/content/global/handlers/item/EmptyOptionListener.kt index d2b64a403..6f512a31b 100644 --- a/Server/src/main/content/global/handlers/item/EmptyOptionListener.kt +++ b/Server/src/main/content/global/handlers/item/EmptyOptionListener.kt @@ -43,6 +43,7 @@ class EmptyOptionListener : InteractionListener { BUCKET_OF_SLIME(Items.BUCKET_OF_SLIME_4286, Items.BUCKET_1925, "You empty the contents of the bucket on the floor.", Sounds.LIQUID_2401), VIAL_OF_WATER(Items.VIAL_OF_WATER_227, Items.VIAL_229, "You empty the vial.", Sounds.LIQUID_2401), BOWL_OF_WATER(Items.BOWL_OF_WATER_1921, Items.BOWL_1923, "You empty the contents of the bowl onto the floor.", Sounds.LIQUID_2401), + BOWL_OF_HOT_WATER(Items.BOWL_OF_HOT_WATER_4456, Items.BOWL_1923, "You empty the contents of the bowl onto the floor.", Sounds.LIQUID_2401), JUG_OF_WATER(Items.JUG_OF_WATER_1937, Items.JUG_1935, "You empty the contents of the jug onto the floor.", Sounds.LIQUID_2401), BURNT_PIE(Items.BURNT_PIE_2329, Items.PIE_DISH_2313, "You empty the pie dish."), POTION(Items.POTION_195, Items.VIAL_229, "You empty the vial.", Sounds.LIQUID_2401), @@ -52,6 +53,8 @@ class EmptyOptionListener : InteractionListener { NETTLE_TEA_MILKY(Items.NETTLE_TEA_4240, Items.BOWL_1923, "You empty the contents of the bowl onto the floor.", Sounds.LIQUID_2401), NETTLE_TEA_CUP(Items.CUP_OF_TEA_4242, Items.EMPTY_CUP_1980, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401), NETTLE_TEA_CUP_MILKY(Items.CUP_OF_TEA_4243, Items.EMPTY_CUP_1980, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401), + TEA_CUP_WATER(Items.CUP_OF_WATER_4458, Items.EMPTY_CUP_1980, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401), + TEA_CUP_HOT_WATER(Items.CUP_OF_HOT_WATER_4460, Items.EMPTY_CUP_1980, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401), NETTLE_TEA_PORCELAIN(Items.CUP_OF_TEA_4245, Items.PORCELAIN_CUP_4244, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401), NETTLE_TEA_PORCELAIN_MILKY(Items.CUP_OF_TEA_4246, Items.PORCELAIN_CUP_4244, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401), BUILDERS_TEA1(Items.CUP_OF_TEA_7730, Items.EMPTY_CUP_7728, "You empty the contents of the cup onto the floor.", Sounds.LIQUID_2401), diff --git a/Server/src/main/content/global/skill/construction/HouseZone.java b/Server/src/main/content/global/skill/construction/HouseZone.java index afa32bd02..ef8b588ca 100644 --- a/Server/src/main/content/global/skill/construction/HouseZone.java +++ b/Server/src/main/content/global/skill/construction/HouseZone.java @@ -147,12 +147,17 @@ public final class HouseZone extends MapZone { Items.TEAPOT_7726, Items.EMPTY_CUP_7728, Items.CUP_OF_TEA_7730, + Items.CUP_OF_TEA_7731, Items.PORCELAIN_CUP_7732, Items.CUP_OF_TEA_7733, Items.CUP_OF_TEA_7734, Items.PORCELAIN_CUP_7735, Items.CUP_OF_TEA_7736, Items.CUP_OF_TEA_7737, + Items.KETTLE_7688, + Items.FULL_KETTLE_7690, + Items.HOT_KETTLE_7691, + Items.TEA_LEAVES_7738, }; private void remove_items(Player p) { diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt index ac407f8ad..17c407b1f 100644 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt @@ -1,14 +1,10 @@ package content.global.skill.construction.decoration.kitchen import core.api.* -import core.game.dialogue.* import core.game.interaction.IntType import core.game.interaction.InteractionListener -import core.game.node.entity.player.Player -import core.tools.END_DIALOGUE import org.rs09.consts.Items import org.rs09.consts.Scenery -import kotlin.math.min class ShelfListener : InteractionListener { @@ -25,13 +21,23 @@ class ShelfListener : InteractionListener { "Beer glass" to Items.BEER_GLASS_1919 ) - private val woodshelf_3_items = woodshelf_2_items + listOf( - "Cake tin" to Items.CAKE_TIN_1887 - ) + private val woodshelf_3_items = woodshelf_2_items.map { (name, itemId) -> + when (name) { + "Cup" -> { + "Porcelain cup" to Items.PORCELAIN_CUP_7732 + } - private val oakshelf_1_items = woodshelf_3_items + listOf( - "Bowl" to Items.BOWL_1923, - ) + "Teapot" -> { + "Teapot" to Items.TEAPOT_7714 + } + + else -> { + name to itemId + } + } + } + listOf("Cake tin" to Items.CAKE_TIN_1887) + + private val oakshelf_1_items = woodshelf_2_items + listOf("Cake tin" to Items.CAKE_TIN_1887) + listOf("Bowl" to Items.BOWL_1923) private val oakshelf_2_items = oakshelf_1_items.map { (name, itemId) -> when (name) { diff --git a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt index 6a5c6d75f..98ca80c60 100644 --- a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt +++ b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt @@ -53,27 +53,26 @@ class TeaInteraction : InteractionListener { Items.TEAPOT_WITH_LEAVES_7724 ) - private val t1teapot = intArrayOf( + private val filledTeaPot = intArrayOf( Items.POT_OF_TEA_4_7692, Items.POT_OF_TEA_3_7694, Items.POT_OF_TEA_2_7696, Items.POT_OF_TEA_1_7698, - ) - - private val t2teapot = intArrayOf( Items.POT_OF_TEA_4_7704, Items.POT_OF_TEA_3_7706, Items.POT_OF_TEA_2_7708, Items.POT_OF_TEA_1_7710, - ) - - private val t3teapot = intArrayOf( Items.POT_OF_TEA_4_7716, Items.POT_OF_TEA_3_7718, Items.POT_OF_TEA_2_7720, Items.POT_OF_TEA_1_7722, ) + private val emptyBuilderCup = intArrayOf( + Items.EMPTY_CUP_7728, + Items.PORCELAIN_CUP_7732, + Items.PORCELAIN_CUP_7735 + ) override fun defineListeners() { onUseWith(ITEM, teaMilkMap.keys.toIntArray(), Items.BUCKET_OF_MILK_1927){ player, used, with -> @@ -134,14 +133,7 @@ class TeaInteraction : InteractionListener { return@onUseWith true } - onUseWith(ITEM, t1teapot, Items.EMPTY_CUP_7728) { player, used, with -> - return@onUseWith fillBuildersTea(player, used, with) - } - - onUseWith(ITEM, t2teapot, Items.PORCELAIN_CUP_7732) { player, used, with -> - return@onUseWith fillBuildersTea(player, used, with) - } - onUseWith(ITEM, t3teapot, Items.PORCELAIN_CUP_7735) { player, used, with -> + onUseWith(ITEM, filledTeaPot, *emptyBuilderCup) { player, used, with -> return@onUseWith fillBuildersTea(player, used, with) } } From ec284bf703d853b026d46a837c77666e48f8b425 Mon Sep 17 00:00:00 2001 From: Syndromeramo Date: Wed, 11 Jun 2025 12:57:27 -0500 Subject: [PATCH 37/50] Rename .java to .kt --- .../kitchen/{BeerBarrelPlugin.java => BeerBarrelInteraction.kt} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Server/src/main/content/global/skill/construction/decoration/kitchen/{BeerBarrelPlugin.java => BeerBarrelInteraction.kt} (100%) diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/BeerBarrelPlugin.java b/Server/src/main/content/global/skill/construction/decoration/kitchen/BeerBarrelInteraction.kt similarity index 100% rename from Server/src/main/content/global/skill/construction/decoration/kitchen/BeerBarrelPlugin.java rename to Server/src/main/content/global/skill/construction/decoration/kitchen/BeerBarrelInteraction.kt From 0e48ac43135b7ba65393a8e39ac5f975ada9e3a8 Mon Sep 17 00:00:00 2001 From: Syndromeramo Date: Wed, 11 Jun 2025 12:57:27 -0500 Subject: [PATCH 38/50] Refactor of Beer Barrels. POH Beer Glasses are separate objects from normal beer glasses, and cannot be taken out of the POH, nor any drinks received from the POH. The recipe to make it should use the normal drink, but it will only give a POH-specific version that cannot be taken out. --- .../content/data/consumables/Consumables.java | 6 + .../global/skill/construction/HouseZone.java | 7 + .../decoration/BeerBarrelPlugin.java | 76 ---------- .../kitchen/BeerBarrelInteraction.kt | 133 +++++++++--------- .../decoration/kitchen/ShelfListener.kt | 2 +- 5 files changed, 78 insertions(+), 146 deletions(-) delete mode 100644 Server/src/main/content/global/skill/construction/decoration/BeerBarrelPlugin.java diff --git a/Server/src/main/content/data/consumables/Consumables.java b/Server/src/main/content/data/consumables/Consumables.java index 54f1a0d2b..cabc65c19 100644 --- a/Server/src/main/content/data/consumables/Consumables.java +++ b/Server/src/main/content/data/consumables/Consumables.java @@ -201,6 +201,7 @@ public enum Consumables { /** Ales */ ASGOLDIAN_ALE(new FakeConsumable(7508, new String[] {"I don't think I'd like gold in beer thanks. Leave it for the dwarves."})), ASGARNIAN_ALE(new Drink(new int[] {1905, 1919}, new MultiEffect(new HealingEffect(2), new SkillEffect(Skills.STRENGTH, 2, 0), new SkillEffect(Skills.ATTACK, -4, 0)), "You drink the ale. You feel slightly reinvigorated...", "...and slightly dizzy too.")), + ASGARNIAN_ALE_POH(new Drink(new int[] {7744, 7742}, new MultiEffect(new HealingEffect(2), new SkillEffect(Skills.STRENGTH, 2, 0), new SkillEffect(Skills.ATTACK, -4, 0)), "You drink the ale. You feel slightly reinvigorated...", "...and slightly dizzy too.")), ASGARNIAN_ALE_KEG(new Drink(new int[] {5785, 5783, 5781, 5779, 5769}, new MultiEffect(new SkillEffect(Skills.STRENGTH, 2, 0), new SkillEffect(Skills.ATTACK, -4, 0)), new Animation(2289), "You drink the ale. You feel slightly reinvigorated...", "...and slightly dizzy too.")), ASGARNIAN_ALE_M(new Drink(new int[] {5739, 1919}, new MultiEffect(new SkillEffect(Skills.STRENGTH, 3, 0), new SkillEffect(Skills.ATTACK, -6, 0)))), ASGARNIAN_ALE_M_KEG(new Drink(new int[] {5865, 5863, 5861, 5859, 5769}, new MultiEffect(new SkillEffect(Skills.STRENGTH, 3, 0), new SkillEffect(Skills.ATTACK, -6, 0)), new Animation(2289))), @@ -210,17 +211,21 @@ public enum Consumables { AXEMANS_FOLLY_M_KEG(new Drink(new int[] {5905, 5903, 5901, 5899, 5769}, new MultiEffect(new SkillEffect(Skills.WOODCUTTING, 2, 0), new HealingEffect(2), new SkillEffect(Skills.STRENGTH, -4, 0), new SkillEffect(Skills.ATTACK, -4, 0)), new Animation(2289))), BANDITS_BREW(new Drink(new int[] {4627, 1919}, new MultiEffect(new SkillEffect(Skills.THIEVING, 1, 0), new SkillEffect(Skills.ATTACK, 1, 0), new SkillEffect(Skills.STRENGTH, -1, 0), new SkillEffect(Skills.DEFENCE, -6, 0), new HealingEffect(1)), "You drink the beer. You feel slightly reinvigorated...", "...and slightly dizzy too.")), BEER(new Drink(new int[] {1917, 1919}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.STRENGTH, 0, 0.04), new SkillEffect(Skills.ATTACK, 0, -0.07)), "You drink the beer. You feel slightly reinvigorated...", "...and slightly dizzy too.")), + BEER_POH(new Drink(new int[] {7740, 7742}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.STRENGTH, 0, 0.04), new SkillEffect(Skills.ATTACK, 0, -0.07)), "You drink the beer. You feel slightly reinvigorated...", "...and slightly dizzy too.")), BEER_TANKARD(new Drink(new int[] {3803, 3805}, new MultiEffect(new SkillEffect(Skills.ATTACK, -9, 0), new SkillEffect(Skills.STRENGTH, 4, 0)), "You quaff the beer. You feel slightly reinvigorated...", "...but very dizzy too.")), KEG_OF_BEER(new Drink(new int[] {3801}, new KegOfBeerEffect(), new Animation(1330), "You chug the keg. You feel reinvigorated...", "...but extremely drunk too.")), CHEFS_DELIGHT(new Drink(new int[] {5755, 1919}, new MultiEffect(new SkillEffect(Skills.COOKING, 1, 0.05), new HealingEffect(1), new SkillEffect(Skills.ATTACK, -2, 0), new SkillEffect(Skills.STRENGTH, -2, 0)))), + CHEFS_DELIGHT_POH(new Drink(new int[] {7754, 7742}, new MultiEffect(new SkillEffect(Skills.COOKING, 1, 0.05), new HealingEffect(1), new SkillEffect(Skills.ATTACK, -2, 0), new SkillEffect(Skills.STRENGTH, -2, 0)))), CHEFS_DELIGHT_KEG(new Drink(new int[] {5833, 5831, 5829, 5827, 5769}, new MultiEffect(new SkillEffect(Skills.COOKING, 1, 0.05), new HealingEffect(1), new SkillEffect(Skills.ATTACK, -2, 0), new SkillEffect(Skills.STRENGTH, -2, 0)), new Animation(2289))), CHEFS_DELIGHT_M(new Drink(new int[] {5757, 1919}, new MultiEffect(new SkillEffect(Skills.COOKING, 2, 0.05), new HealingEffect(2), new SkillEffect(Skills.ATTACK, -3, 0), new SkillEffect(Skills.STRENGTH, -3, 0)))), CHEFS_DELIGHT_M_KEG(new Drink(new int[] {5913, 5911, 5909, 5907, 5769}, new MultiEffect(new SkillEffect(Skills.COOKING, 2, 0.05), new HealingEffect(2), new SkillEffect(Skills.ATTACK, -3, 0), new SkillEffect(Skills.STRENGTH, -3, 0)), new Animation(2289))), CIDER(new Drink(new int[] {5763, 1919}, new MultiEffect(new MultiEffect(new HealingEffect(2), new SkillEffect(Skills.FARMING, 1, 0), new SkillEffect(Skills.ATTACK, -2, 0), new SkillEffect(Skills.STRENGTH, -2, 0))))), + CIDER_POH(new Drink(new int[] {7752, 7742}, new MultiEffect(new MultiEffect(new HealingEffect(2), new SkillEffect(Skills.FARMING, 1, 0), new SkillEffect(Skills.ATTACK, -2, 0), new SkillEffect(Skills.STRENGTH, -2, 0))))), CIDER_KEG(new Drink(new int[] {5849, 5847, 5845, 5843, 5769}, new MultiEffect(new MultiEffect(new HealingEffect(2), new SkillEffect(Skills.FARMING, 1, 0), new SkillEffect(Skills.ATTACK, -2, 0), new SkillEffect(Skills.STRENGTH, -2, 0))), new Animation(2289))), MATURE_CIDER(new Drink(new int[] {5765, 1919}, new MultiEffect(new MultiEffect(new HealingEffect(2), new SkillEffect(Skills.FARMING, 2, 0), new SkillEffect(Skills.ATTACK, -5, 0), new SkillEffect(Skills.STRENGTH, -5, 0))))), CIDER_M_KEG(new Drink(new int[] {5929, 5927, 5925, 5923, 5769}, new MultiEffect(new MultiEffect(new HealingEffect(2), new SkillEffect(Skills.FARMING, 2, 0), new SkillEffect(Skills.ATTACK, -5, 0), new SkillEffect(Skills.STRENGTH, -5, 0))), new Animation(2289))), DRAGON_BITTER(new Drink(new int[] {1911, 1919}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.STRENGTH, 2, 0), new SkillEffect(Skills.ATTACK, -4, 0)))), + DRAGON_BITTER_POH(new Drink(new int[] {7748, 7742}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.STRENGTH, 2, 0), new SkillEffect(Skills.ATTACK, -4, 0)))), DRAGON_BITTER_KEG(new Drink(new int[] {5809, 5807, 5805, 5803, 5769}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.STRENGTH, 2, 0), new SkillEffect(Skills.ATTACK, -4, 0)), new Animation(2289))), DRAGON_BITTER_M(new Drink(new int[] {5745, 1919}, new MultiEffect(new HealingEffect(2), new SkillEffect(Skills.STRENGTH, 3, 0), new SkillEffect(Skills.ATTACK, -6, 0)))), DRAGON_BITTER_M_KEG(new Drink(new int[] {5889, 5887, 5885, 5883, 5769}, new MultiEffect(new HealingEffect(2), new SkillEffect(Skills.STRENGTH, 3, 0), new SkillEffect(Skills.ATTACK, -6, 0)), new Animation(2289))), @@ -229,6 +234,7 @@ public enum Consumables { DWARVEN_STOUT_M(new Drink(new int[] {5747, 1919}, new MultiEffect(new SkillEffect(Skills.MINING, 2, 0), new SkillEffect(Skills.SMITHING, 2 ,0), new SkillEffect(Skills.ATTACK, -7, 0), new SkillEffect(Skills.STRENGTH, -7, 0), new SkillEffect(Skills.DEFENCE, -7, 0), new HealingEffect(1)))), DWARVEN_STOUT_M_KEG(new Drink(new int[] {5857, 5855, 5853, 5851, 5769}, new MultiEffect(new SkillEffect(Skills.MINING, 2, 0), new SkillEffect(Skills.SMITHING, 2 ,0), new SkillEffect(Skills.ATTACK, -7, 0), new SkillEffect(Skills.STRENGTH, -7, 0), new SkillEffect(Skills.DEFENCE, -7, 0), new HealingEffect(1)), new Animation(2289))), GREENMANS_ALE(new Drink(new int[] {1909, 1919}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.HERBLORE, 1, 0), new SkillEffect(Skills.ATTACK, -3, 0), new SkillEffect(Skills.STRENGTH, -3, 0), new SkillEffect(Skills.DEFENCE, -3, 0)))), + GREENMANS_ALE_POH(new Drink(new int[] {7746, 7742}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.HERBLORE, 1, 0), new SkillEffect(Skills.ATTACK, -3, 0), new SkillEffect(Skills.STRENGTH, -3, 0), new SkillEffect(Skills.DEFENCE, -3, 0)))), GREENMANS_ALE_KEG(new Drink(new int[] {5793, 5791, 5789, 5787, 5769}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.HERBLORE, 1, 0), new SkillEffect(Skills.ATTACK, -3, 0), new SkillEffect(Skills.STRENGTH, -3, 0), new SkillEffect(Skills.DEFENCE, -3, 0)), new Animation(2289))), GREENMANS_ALE_M(new Drink(new int[] {5743, 1919}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.HERBLORE, 2, 0), new SkillEffect(Skills.ATTACK, -2, 0), new SkillEffect(Skills.STRENGTH, -2, 0)))), GREENMANS_ALE_M_KEG(new Drink(new int[] {5873, 5871, 5869, 5867, 5769}, new MultiEffect(new HealingEffect(1), new SkillEffect(Skills.HERBLORE, 2, 0), new SkillEffect(Skills.ATTACK, -2, 0), new SkillEffect(Skills.STRENGTH, -2, 0)), new Animation(2289))), diff --git a/Server/src/main/content/global/skill/construction/HouseZone.java b/Server/src/main/content/global/skill/construction/HouseZone.java index ef8b588ca..c47638d90 100644 --- a/Server/src/main/content/global/skill/construction/HouseZone.java +++ b/Server/src/main/content/global/skill/construction/HouseZone.java @@ -158,6 +158,13 @@ public final class HouseZone extends MapZone { Items.FULL_KETTLE_7690, Items.HOT_KETTLE_7691, Items.TEA_LEAVES_7738, + Items.BEER_GLASS_7742, + Items.BEER_7740, + Items.CIDER_7752, + Items.ASGARNIAN_ALE_7744, + Items.GREENMANS_ALE_7746, + Items.DRAGON_BITTER_7748, + Items.CHEFS_DELIGHT_7754 }; private void remove_items(Player p) { diff --git a/Server/src/main/content/global/skill/construction/decoration/BeerBarrelPlugin.java b/Server/src/main/content/global/skill/construction/decoration/BeerBarrelPlugin.java deleted file mode 100644 index dce9b7cf9..000000000 --- a/Server/src/main/content/global/skill/construction/decoration/BeerBarrelPlugin.java +++ /dev/null @@ -1,76 +0,0 @@ -package content.global.skill.construction.decoration; - -import core.game.interaction.NodeUsageEvent; -import core.game.interaction.UseWithHandler; -import core.game.node.entity.player.Player; -import core.game.node.item.Item; -import core.game.node.scenery.Scenery; -import core.game.world.update.flag.context.Animation; -import core.plugin.Initializable; -import core.plugin.Plugin; -import org.rs09.consts.Items; - -/** - * Handles the Construction beer barrels. - * @author Splinter - */ -@Initializable -public class BeerBarrelPlugin extends UseWithHandler { - - /** - * The object ids - */ - private static final int[] OBJECTS = new int[] { - 13568, 13569, 13570, 13571, 13572, 13573 - }; - - /** - * Constructs a new {@Code BeerBarrelPlugin} {@Code Object} - */ - public BeerBarrelPlugin() { - super(1919); - } - - @Override - public Plugin newInstance(Object arg) throws Throwable { - for (int id : OBJECTS) { - addHandler(id, OBJECT_TYPE, this); - } - return this; - } - - @Override - public boolean handle(NodeUsageEvent event) { - Player player = event.getPlayer(); - final Scenery object = (Scenery) event.getUsedWith(); - - if (player.getInventory().remove(new Item(Items.BEER_GLASS_1919))) { - player.animate(Animation.create(833)); - player.sendMessage("You fill up your glass."); - player.getInventory().add(new Item(getReward(object.getId()), 1)); - } - return true; - } - - /** - * Get the beer reward based on the interaced barrel. - * @return the item to give. - */ - public int getReward(int barrelId) { - switch (barrelId) { - case 13568: - return 1917; - case 13569: - return 5763; - case 13570: - return 1905; - case 13571: - return 1909; - case 13572: - return 1911; - case 13573: - return 5755; - } - return 1917; - } -} diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/BeerBarrelInteraction.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/BeerBarrelInteraction.kt index eb6b3fe20..afd0bfa4c 100644 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/BeerBarrelInteraction.kt +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/BeerBarrelInteraction.kt @@ -1,77 +1,72 @@ -package content.global.skill.construction.decoration.kitchen; +package content.global.skill.construction.decoration.kitchen +import core.api.* +import core.game.interaction.InteractionListener +import org.rs09.consts.Items -import core.game.interaction.NodeUsageEvent; -import core.game.interaction.UseWithHandler; -import core.game.node.entity.player.Player; -import core.game.node.item.Item; -import core.game.node.scenery.Scenery; -import core.game.world.update.flag.context.Animation; -import core.plugin.Initializable; -import core.plugin.Plugin; -import org.rs09.consts.Items; +class BeerBarrelInteraction : InteractionListener { -/** - * Handles the Construction beer barrels. - * @author Splinter - */ -@Initializable -public class BeerBarrelPlugin extends UseWithHandler { + // Imagine if these indexes incremented logically... + companion object{ + private val barrelMap = mapOf( + org.rs09.consts.Scenery.BEER_BARREL_13568 to Items.BEER_7740, + org.rs09.consts.Scenery.CIDER_BARREL_13569 to Items.CIDER_7752, + org.rs09.consts.Scenery.ASGARNIAN_ALE_13570 to Items.ASGARNIAN_ALE_7744, + org.rs09.consts.Scenery.GREENMAN_S_ALE_13571 to Items.GREENMANS_ALE_7746, + org.rs09.consts.Scenery.DRAGON_BITTER_13572 to Items.DRAGON_BITTER_7748, + org.rs09.consts.Scenery.CHEF_S_DELIGHT_13573 to Items.CHEFS_DELIGHT_7754, + ) + } + override fun defineListeners() { + onUseWith(SCENERY, Items.BEER_GLASS_7742, *barrelMap.keys.toIntArray()){ player, used, with -> + val drinkName = with.name.lowercase().replace("barrel", "").trim()+"." + if (removeItem(player, used)){ + sendMessage(player, "You fill up your glass with $drinkName") + addItem(player, barrelMap[with.id]!!) + } + return@onUseWith true + } + } +} - /** - * The object ids - */ - private static final int[] OBJECTS = new int[] { - 13568, 13569, 13570, 13571, 13572, 13573 - }; +/* - /** - * Constructs a new {@Code BeerBarrelPlugin} {@Code Object} - */ - public BeerBarrelPlugin() { - super(1919); - } + override fun handle(event: NodeUsageEvent): Boolean { + val player = event.player + val `object` = event.usedWith as Scenery - @Override - public Plugin newInstance(Object arg) throws Throwable { - for (int id : OBJECTS) { - addHandler(id, OBJECT_TYPE, this); - } - return this; - } + if (player.inventory.remove(Item(BEER_GLASS_1919))) { + player.animate(Animation.create(3661 + (`object`.id - 13569))) + player.sendMessage( + "You fill up your glass with " + `object`.name.lowercase(Locale.getDefault()).replace("barrel", "") + .trim { it <= ' ' } + ".") + player.inventory.add(Item(getReward(`object`.id), 1)) + } + return true + } - @Override - public boolean handle(NodeUsageEvent event) { - Player player = event.getPlayer(); - final Scenery object = (Scenery) event.getUsedWith(); + /** + * Get the beer reward based on the interacted barrel. + * @return the item to give. + */ + fun getReward(barrelId: Int): Int { + when (barrelId) { + 13568 -> return 1917 + 13569 -> return 5763 + 13570 -> return 1905 + 13571 -> return 1909 + 13572 -> return 1911 + 13573 -> return 5755 + } + return 1917 + } - if (player.getInventory().remove(new Item(Items.BEER_GLASS_1919))) { - player.animate(Animation.create(3661 + (object.getId() - 13569))); - player.sendMessage("You fill up your glass with " + object.getName().toLowerCase().replace("barrel", "").trim() + "."); - player.getInventory().add(new Item(getReward(object.getId()), 1)); - } - return true; - } - - /** - * Get the beer reward based on the interacted barrel. - * @return the item to give. - */ - public int getReward(int barrelId) { - switch (barrelId) { - case 13568: - return 1917; - case 13569: - return 5763; - case 13570: - return 1905; - case 13571: - return 1909; - case 13572: - return 1911; - case 13573: - return 5755; - } - return 1917; - } -} \ No newline at end of file + companion object { + /** + * The object ids + */ + private val OBJECTS = intArrayOf( + 13568, 13569, 13570, 13571, 13572, 13573 + ) + } +}*/ \ No newline at end of file diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt index 17c407b1f..bf39a34dc 100644 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/ShelfListener.kt @@ -18,7 +18,7 @@ class ShelfListener : InteractionListener { ) private val woodshelf_2_items = woodshelf_1_items + listOf( - "Beer glass" to Items.BEER_GLASS_1919 + "Beer glass" to Items.BEER_GLASS_7742 ) private val woodshelf_3_items = woodshelf_2_items.map { (name, itemId) -> From 5bec36f8116f28c24bfbbcb97ead896d4956bfd9 Mon Sep 17 00:00:00 2001 From: Syndromeramo Date: Thu, 12 Jun 2025 04:11:06 -0500 Subject: [PATCH 39/50] Merge conflicts --- Server/src/main/content/global/skill/construction/HouseZone.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Server/src/main/content/global/skill/construction/HouseZone.java b/Server/src/main/content/global/skill/construction/HouseZone.java index c47638d90..52e52ffcd 100644 --- a/Server/src/main/content/global/skill/construction/HouseZone.java +++ b/Server/src/main/content/global/skill/construction/HouseZone.java @@ -2,6 +2,7 @@ package content.global.skill.construction; import core.api.Container; +import org.rs09.consts.Items; import core.game.node.entity.Entity; import core.game.node.entity.player.Player; import core.game.world.map.zone.MapZone; From 6a09c9873b373226ae9a421b718f206d8dbdcbbf Mon Sep 17 00:00:00 2001 From: Syndromeramo Date: Tue, 15 Jul 2025 12:01:54 -0500 Subject: [PATCH 40/50] Rebase cleanup. --- .../src/main/content/global/skill/construction/HouseZone.java | 2 -- .../construction/decoration/kitchen/BeerBarrelInteraction.kt | 1 - 2 files changed, 3 deletions(-) diff --git a/Server/src/main/content/global/skill/construction/HouseZone.java b/Server/src/main/content/global/skill/construction/HouseZone.java index 52e52ffcd..089ad4629 100644 --- a/Server/src/main/content/global/skill/construction/HouseZone.java +++ b/Server/src/main/content/global/skill/construction/HouseZone.java @@ -9,8 +9,6 @@ import core.game.world.map.zone.MapZone; import core.game.world.map.RegionManager; import core.game.world.map.Region; import core.game.system.task.Pulse; -import org.rs09.consts.Items; -import core.game.world.map.zone.ZoneRestriction; import core.game.world.map.zone.ZoneType; import static core.api.ContentAPIKt.*; diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/BeerBarrelInteraction.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/BeerBarrelInteraction.kt index afd0bfa4c..cde768a66 100644 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/BeerBarrelInteraction.kt +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/BeerBarrelInteraction.kt @@ -6,7 +6,6 @@ import org.rs09.consts.Items class BeerBarrelInteraction : InteractionListener { - // Imagine if these indexes incremented logically... companion object{ private val barrelMap = mapOf( org.rs09.consts.Scenery.BEER_BARREL_13568 to Items.BEER_7740, From 33776191013b9ba45029a469c0c22d11dedd165f Mon Sep 17 00:00:00 2001 From: Syndromeramo Date: Thu, 17 Jul 2025 11:08:35 -0500 Subject: [PATCH 41/50] Fixed typo in nettle examine text. --- Server/data/configs/item_configs.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server/data/configs/item_configs.json b/Server/data/configs/item_configs.json index 93c7628ef..35f5603e6 100644 --- a/Server/data/configs/item_configs.json +++ b/Server/data/configs/item_configs.json @@ -39191,7 +39191,7 @@ "id": "4240" }, { - "examine": "A handful of nettles", + "examine": "A handful of nettles.", "durability": null, "name": "Nettles", "archery_ticket_price": "0", From 355c359d3f09326aee3b0e3dd42a8a8708037a7c Mon Sep 17 00:00:00 2001 From: Syndromeramo Date: Thu, 17 Jul 2025 13:11:13 -0500 Subject: [PATCH 42/50] Populated examine texts, fixed trade of various teas. --- Server/data/configs/item_configs.json | 42 +++++++++++++-------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/Server/data/configs/item_configs.json b/Server/data/configs/item_configs.json index 35f5603e6..ee28b0561 100644 --- a/Server/data/configs/item_configs.json +++ b/Server/data/configs/item_configs.json @@ -39183,7 +39183,7 @@ "id": "4239" }, { - "examine": "It's a bowl of (milky) nettle tea.", + "examine": "It's a bowl of milky nettle tea.", "durability": null, "name": "Nettle tea", "weight": "0.9", @@ -39199,22 +39199,22 @@ }, { "shop_price": "10", - "examine": "A nice cup of tea.", + "examine": "A nice cup of nettle tea.", "grand_exchange_price": "30", "durability": null, "name": "Cup of tea", - "tradeable": "true", + "tradeable": "false", "weight": "0.1", "archery_ticket_price": "0", "id": "4242" }, { "shop_price": "10", - "examine": "A nice cup of tea.", + "examine": "A milky cup of nettle tea.", "grand_exchange_price": "30", "durability": null, "name": "Cup of tea", - "tradeable": "true", + "tradeable": "false", "weight": "0.1", "archery_ticket_price": "0", "id": "4243" @@ -39228,22 +39228,22 @@ }, { "shop_price": "10", - "examine": "A nice cup of tea.", + "examine": "Some nettle tea in a porcelain cup.", "grand_exchange_price": "30", "durability": null, "name": "Cup of tea", - "tradeable": "true", + "tradeable": "false", "weight": "0.1", "archery_ticket_price": "0", "id": "4245" }, { "shop_price": "10", - "examine": "A nice cup of tea.", + "examine": "Some milky nettle tea in a porcelain cup.", "grand_exchange_price": "30", "durability": null, "name": "Cup of tea", - "tradeable": "true", + "tradeable": "false", "weight": "0.1", "archery_ticket_price": "0", "id": "4246" @@ -70400,22 +70400,22 @@ }, { "shop_price": "10", - "examine": "A nice cup of tea.", + "examine": "A nice cup of nettle tea.", "grand_exchange_price": "30", "durability": null, "name": "Cup of tea", - "tradeable": "true", + "tradeable": "false", "weight": "0.1", "archery_ticket_price": "0", "id": "7730" }, { "shop_price": "10", - "examine": "A nice cup of tea.", + "examine": "A milky cup of nettle tea.", "grand_exchange_price": "30", "durability": null, "name": "Cup of tea", - "tradeable": "true", + "tradeable": "false", "weight": "0.1", "archery_ticket_price": "0", "id": "7731" @@ -70429,22 +70429,22 @@ }, { "shop_price": "10", - "examine": "A nice cup of tea.", + "examine": "Some nettle tea in a porcelain cup.", "grand_exchange_price": "30", "durability": null, "name": "Cup of tea", - "tradeable": "true", + "tradeable": "false", "weight": "0.1", "archery_ticket_price": "0", "id": "7733" }, { "shop_price": "10", - "examine": "A nice cup of tea.", + "examine": "Some milky nettle tea in a porcelain cup.", "grand_exchange_price": "30", "durability": null, "name": "Cup of tea", - "tradeable": "true", + "tradeable": "false", "weight": "0.1", "archery_ticket_price": "0", "id": "7734" @@ -70458,22 +70458,22 @@ }, { "shop_price": "10", - "examine": "A nice cup of tea.", + "examine": "Some nettle tea in a porcelain cup.", "grand_exchange_price": "30", "durability": null, "name": "Cup of tea", - "tradeable": "true", + "tradeable": "false", "weight": "0.1", "archery_ticket_price": "0", "id": "7736" }, { "shop_price": "10", - "examine": "A nice cup of tea.", + "examine": "Some milky nettle tea in a porcelain cup.", "grand_exchange_price": "30", "durability": null, "name": "Cup of tea", - "tradeable": "true", + "tradeable": "false", "weight": "0.1", "archery_ticket_price": "0", "id": "7737" From a5fae86f52d8c1b5034d69efeb86f8aafeedd843 Mon Sep 17 00:00:00 2001 From: Syndromeramo Date: Sat, 19 Jul 2025 22:46:43 -0500 Subject: [PATCH 43/50] Populated examine texts, fixed trade of various teas. --- Server/data/configs/item_configs.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server/data/configs/item_configs.json b/Server/data/configs/item_configs.json index ee28b0561..159fd4857 100644 --- a/Server/data/configs/item_configs.json +++ b/Server/data/configs/item_configs.json @@ -39199,7 +39199,7 @@ }, { "shop_price": "10", - "examine": "A nice cup of nettle tea.", + "examine": "A nice cup of nettle tea.", "grand_exchange_price": "30", "durability": null, "name": "Cup of tea", From 2db794a9d052608d295542587aa8822cf177192b Mon Sep 17 00:00:00 2001 From: Syndromeramo Date: Mon, 28 Jul 2025 10:32:29 -0500 Subject: [PATCH 44/50] Fixed check of free slots in AbstractContainer. Adjusted kettle boiling queue strength to soft. --- .../decoration/kitchen/AbstractContainer.kt | 3 ++- .../decoration/kitchen/StoveInteraction.kt | 13 +++++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/AbstractContainer.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/AbstractContainer.kt index 9468fc735..0e8639a42 100644 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/AbstractContainer.kt +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/AbstractContainer.kt @@ -1,6 +1,7 @@ package content.global.skill.construction.decoration.kitchen import core.api.addItem +import core.api.freeSlots import core.api.hasSpaceFor import core.api.sendDialogue import core.game.dialogue.DialogueFile @@ -46,7 +47,7 @@ abstract class AbstractContainer(containerId: Int, containers: Map + setAttribute(player, kettleBoiled, 1) + queueScript(player, secondsToTicks(10), QueueStrength.SOFT){ _ -> sendMessage(player, "The kettle boils.") // Of course they changed how these items work so we need 2 different cases - setAttribute(player, kettleBoiled, true) + setAttribute(player, kettleBoiled, 2) if (with.id in intArrayOf(SceneryConst.FIREPIT_WITH_HOOK_13529, SceneryConst.FIREPIT_WITH_POT_13531)) return@queueScript stopExecuting(player) else{ @@ -64,13 +65,17 @@ class StoveInteraction : InteractionListener { on(stoves_with_kettle, SCENERY, "take-kettle"){ player, node -> - if (!getAttribute(player, kettleBoiled, false)){ + if (getAttribute(player, kettleBoiled, 0) == 0){ + sendMessage(player, "This is not your kettle.") //inauthentic message + return@on false + } + else if (getAttribute(player, kettleBoiled, 0) == 1){ sendMessage(player, "The kettle has not boiled yet.") return@on false } if(addItem(player, Items.HOT_KETTLE_7691)){ replaceScenery(node as Scenery, valid_stoves[stoves_with_kettle.indexOf(node.id)], -1) - setAttribute(player, kettleBoiled, false) + setAttribute(player, kettleBoiled, 0) return@on true } else { From 11bc398d2d53c4ad6a4d2c8b44b76e492d6bef75 Mon Sep 17 00:00:00 2001 From: Syndromeramo Date: Mon, 28 Jul 2025 15:24:04 -0500 Subject: [PATCH 45/50] Nettle Tea now restores run energy. --- .../main/content/data/consumables/Consumables.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Server/src/main/content/data/consumables/Consumables.java b/Server/src/main/content/data/consumables/Consumables.java index cabc65c19..e16b6aa23 100644 --- a/Server/src/main/content/data/consumables/Consumables.java +++ b/Server/src/main/content/data/consumables/Consumables.java @@ -292,12 +292,12 @@ public enum Consumables { /** Tea */ CUP_OF_TEA(new Drink(new int[] {712, 1980}, new MultiEffect(new HealingEffect(3), new SkillEffect(Skills.ATTACK, 3, 0)), "Aaah, nothing like a nice cuppa tea!")), NETTLE_WATER(new Drink(new int[] {Items.NETTLE_WATER_4237, Items.BOWL_1923}, new HealingEffect((1)))), - CUP_OF_TEA_NETTLE(new Drink(new int[] {4242, 1980}, new HealingEffect(3))), - CUP_OF_TEA_MILKY_NETTLE(new Drink(new int[] {4243, 1980}, new HealingEffect(3))), - CUP_OF_TEA_NETTLE_PORCELAIN(new Drink(new int[] {4245, 4244}, new HealingEffect(3))), - CUP_OF_TEA_MILKY_NETTLE_PORCELAIN(new Drink(new int[] {4246, 4244}, new HealingEffect(3))), - NETTLE_TEA(new Drink(new int[] {4239, 1923}, new HealingEffect(3))), - NETTLE_TEA_MILKY(new Drink(new int[] {4240, 1923}, new HealingEffect(3))), + CUP_OF_TEA_NETTLE(new Drink(new int[] {4242, 1980}, new MultiEffect(new HealingEffect(3), new EnergyEffect(10)))), + CUP_OF_TEA_MILKY_NETTLE(new Drink(new int[] {4243, 1980}, new MultiEffect(new HealingEffect(3), new EnergyEffect(10)))), + CUP_OF_TEA_NETTLE_PORCELAIN(new Drink(new int[] {4245, 4244}, new MultiEffect(new HealingEffect(3), new EnergyEffect(10)))), + CUP_OF_TEA_MILKY_NETTLE_PORCELAIN(new Drink(new int[] {4246, 4244}, new MultiEffect(new HealingEffect(3), new EnergyEffect(10)))), + NETTLE_TEA(new Drink(new int[] {4239, 1923}, new MultiEffect(new HealingEffect(3), new EnergyEffect(10)))), + NETTLE_TEA_MILKY(new Drink(new int[] {4240, 1923}, new MultiEffect(new HealingEffect(3), new EnergyEffect(10)))), CUP_OF_TEA_CLAY(new Drink(new int[] {7730, 7728}, new SkillEffect(Skills.CONSTRUCTION, 1, 0), "You feel refreshed and ready for more building.")), CUP_OF_TEA_CLAY_MILKY(new Drink(new int[] {7731, 7728}, new SkillEffect(Skills.CONSTRUCTION, 1, 0), "You feel refreshed and ready for more building.")), CUP_OF_TEA_WHITE(new Drink(new int[] {7733, 7732}, new SkillEffect(Skills.CONSTRUCTION, 2, 0), "You feel refreshed and ready for more building.")), From 646b866dbcfeb39813bbf35609b85f1def1b7008 Mon Sep 17 00:00:00 2001 From: Syndromeramo Date: Mon, 28 Jul 2025 20:14:51 -0500 Subject: [PATCH 46/50] Noted house items can no longer be taken out of the PoH. House items are no longer tradable. --- Server/data/configs/item_configs.json | 115 +++++++++--------- .../global/skill/construction/HouseZone.java | 43 +------ 2 files changed, 61 insertions(+), 97 deletions(-) diff --git a/Server/data/configs/item_configs.json b/Server/data/configs/item_configs.json index 159fd4857..b9553778b 100644 --- a/Server/data/configs/item_configs.json +++ b/Server/data/configs/item_configs.json @@ -70069,13 +70069,14 @@ "examine": "The kettle is empty.", "durability": null, "name": "Kettle", + "tradeable": "false", "archery_ticket_price": "0", "id": "7688" }, { "durability": null, "name": "Kettle", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7689" }, @@ -70083,6 +70084,7 @@ "examine": "It's full of cold water.", "durability": null, "name": "Full kettle", + "tradeable": "false", "archery_ticket_price": "0", "id": "7690" }, @@ -70090,6 +70092,7 @@ "examine": "It's full of boiling water.", "durability": null, "name": "Hot kettle", + "tradeable": "false", "archery_ticket_price": "0", "id": "7691" }, @@ -70097,7 +70100,7 @@ "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (4)", - "tradeable": "true", + "tradeable": "false", "weight": "1.5", "archery_ticket_price": "0", "id": "7692" @@ -70105,7 +70108,7 @@ { "durability": null, "name": "Pot of tea (4)", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7693" }, @@ -70113,7 +70116,7 @@ "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (3)", - "tradeable": "true", + "tradeable": "false", "weight": "1.5", "archery_ticket_price": "0", "id": "7694" @@ -70121,7 +70124,7 @@ { "durability": null, "name": "Pot of tea (3)", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7695" }, @@ -70129,7 +70132,7 @@ "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (2)", - "tradeable": "true", + "tradeable": "false", "weight": "1.5", "archery_ticket_price": "0", "id": "7696" @@ -70137,7 +70140,7 @@ { "durability": null, "name": "Pot of tea (2)", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7697" }, @@ -70145,7 +70148,7 @@ "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (1)", - "tradeable": "true", + "tradeable": "false", "weight": "1.5", "archery_ticket_price": "0", "id": "7698" @@ -70153,7 +70156,7 @@ { "durability": null, "name": "Pot of tea (1)", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7699" }, @@ -70161,7 +70164,7 @@ "examine": "Add boiling water to make a tea.", "durability": null, "name": "Teapot with leaves", - "tradeable": "true", + "tradeable": "false", "weight": "1.5", "archery_ticket_price": "0", "id": "7700" @@ -70169,7 +70172,7 @@ { "durability": null, "name": "Teapot with leaves", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7701" }, @@ -70177,7 +70180,7 @@ "examine": "This teapot is empty.", "durability": null, "name": "Teapot", - "tradeable": "true", + "tradeable": "false", "weight": "0.4", "archery_ticket_price": "0", "id": "7702" @@ -70185,7 +70188,7 @@ { "durability": null, "name": "Teapot", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7703" }, @@ -70193,7 +70196,7 @@ "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (4)", - "tradeable": "true", + "tradeable": "false", "weight": "1.5", "archery_ticket_price": "0", "id": "7704" @@ -70201,7 +70204,7 @@ { "durability": null, "name": "Pot of tea (4)", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7705" }, @@ -70209,7 +70212,7 @@ "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (3)", - "tradeable": "true", + "tradeable": "false", "weight": "1.5", "archery_ticket_price": "0", "id": "7706" @@ -70217,7 +70220,7 @@ { "durability": null, "name": "Pot of tea (3)", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7707" }, @@ -70225,7 +70228,7 @@ "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (2)", - "tradeable": "true", + "tradeable": "false", "weight": "1.5", "archery_ticket_price": "0", "id": "7708" @@ -70233,7 +70236,7 @@ { "durability": null, "name": "Pot of tea (2)", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7709" }, @@ -70241,7 +70244,7 @@ "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (1)", - "tradeable": "true", + "tradeable": "false", "weight": "1.5", "archery_ticket_price": "0", "id": "7710" @@ -70249,7 +70252,7 @@ { "durability": null, "name": "Pot of tea (1)", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7711" }, @@ -70257,7 +70260,7 @@ "examine": "Add boiling water to make a tea.", "durability": null, "name": "Teapot with leaves", - "tradeable": "true", + "tradeable": "false", "weight": "1.5", "archery_ticket_price": "0", "id": "7712" @@ -70265,7 +70268,7 @@ { "durability": null, "name": "Teapot with leaves", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7713" }, @@ -70273,7 +70276,7 @@ "examine": "This teapot is empty.", "durability": null, "name": "Teapot", - "tradeable": "true", + "tradeable": "false", "weight": "0.4", "archery_ticket_price": "0", "id": "7714" @@ -70281,7 +70284,7 @@ { "durability": null, "name": "Teapot", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7715" }, @@ -70289,7 +70292,7 @@ "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (4)", - "tradeable": "true", + "tradeable": "false", "weight": "1.5", "archery_ticket_price": "0", "id": "7716" @@ -70297,7 +70300,7 @@ { "durability": null, "name": "Pot of tea (4)", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7717" }, @@ -70305,7 +70308,7 @@ "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (3)", - "tradeable": "true", + "tradeable": "false", "weight": "1.5", "archery_ticket_price": "0", "id": "7718" @@ -70313,7 +70316,7 @@ { "durability": null, "name": "Pot of tea (3)", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7719" }, @@ -70321,7 +70324,7 @@ "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (2)", - "tradeable": "true", + "tradeable": "false", "weight": "1.5", "archery_ticket_price": "0", "id": "7720" @@ -70329,7 +70332,7 @@ { "durability": null, "name": "Pot of tea (2)", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7721" }, @@ -70337,7 +70340,7 @@ "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (1)", - "tradeable": "true", + "tradeable": "false", "weight": "1.5", "archery_ticket_price": "0", "id": "7722" @@ -70345,7 +70348,7 @@ { "durability": null, "name": "Pot of tea (1)", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7723" }, @@ -70353,7 +70356,7 @@ "examine": "Add boiling water to make a tea.", "durability": null, "name": "Teapot with leaves", - "tradeable": "true", + "tradeable": "false", "weight": "1.5", "archery_ticket_price": "0", "id": "7724" @@ -70361,7 +70364,7 @@ { "durability": null, "name": "Teapot with leaves", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7725" }, @@ -70369,7 +70372,7 @@ "examine": "This teapot is empty.", "durability": null, "name": "Teapot", - "tradeable": "true", + "tradeable": "false", "weight": "0.4", "archery_ticket_price": "0", "id": "7726" @@ -70377,7 +70380,7 @@ { "durability": null, "name": "Teapot", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7727" }, @@ -70387,14 +70390,14 @@ "grand_exchange_price": "7", "durability": null, "name": "Empty cup", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7728" }, { "durability": null, "name": "Empty cup", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7729" }, @@ -70424,6 +70427,7 @@ "examine": "A porcelain cup.", "durability": null, "name": "Porcelain cup", + "tradeable": "false", "archery_ticket_price": "0", "id": "7732" }, @@ -70453,6 +70457,7 @@ "examine": "A porcelain cup.", "durability": null, "name": "Porcelain cup", + "tradeable": "false", "archery_ticket_price": "0", "id": "7735" }, @@ -70482,14 +70487,14 @@ "examine": "Mmm, how about a nice cup of tea?", "durability": null, "name": "Tea leaves", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7738" }, { "durability": null, "name": "Tea leaves", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7739" }, @@ -70498,7 +70503,7 @@ "grand_exchange_price": "151", "durability": null, "name": "Beer", - "tradeable": "true", + "tradeable": "false", "weight": "1", "archery_ticket_price": "0", "id": "7740" @@ -70506,7 +70511,7 @@ { "durability": null, "name": "Beer", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7741" }, @@ -70516,7 +70521,7 @@ "grand_exchange_price": "25", "durability": null, "name": "Beer glass", - "tradeable": "true", + "tradeable": "false", "weight": "0.05", "archery_ticket_price": "0", "id": "7742" @@ -70524,7 +70529,7 @@ { "durability": null, "name": "Beer glass", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7743" }, @@ -70534,14 +70539,14 @@ "grand_exchange_price": "131", "durability": null, "name": "Asgarnian ale", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7744" }, { "durability": null, "name": "Asgarnian ale", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7745" }, @@ -70551,14 +70556,14 @@ "grand_exchange_price": "569", "durability": null, "name": "Greenman's ale", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7746" }, { "durability": null, "name": "Greenman's ale", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7747" }, @@ -70568,7 +70573,7 @@ "grand_exchange_price": "523", "durability": null, "name": "Dragon bitter", - "tradeable": "true", + "tradeable": "false", "weight": "1", "archery_ticket_price": "0", "id": "7748" @@ -70576,7 +70581,7 @@ { "durability": null, "name": "Dragon bitter", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7749" }, @@ -70603,7 +70608,7 @@ "grand_exchange_price": "1539", "durability": null, "name": "Cider", - "tradeable": "true", + "tradeable": "false", "weight": "1", "archery_ticket_price": "0", "id": "7752" @@ -70611,7 +70616,7 @@ { "durability": null, "name": "Cider", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7753" }, @@ -70620,14 +70625,14 @@ "grand_exchange_price": "2371", "durability": null, "name": "Chef's delight", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7754" }, { "durability": null, "name": "Chef's delight", - "tradeable": "true", + "tradeable": "false", "archery_ticket_price": "0", "id": "7755" }, diff --git a/Server/src/main/content/global/skill/construction/HouseZone.java b/Server/src/main/content/global/skill/construction/HouseZone.java index 089ad4629..64165f49f 100644 --- a/Server/src/main/content/global/skill/construction/HouseZone.java +++ b/Server/src/main/content/global/skill/construction/HouseZone.java @@ -125,49 +125,8 @@ public final class HouseZone extends MapZone { return true; } - private final int[] itemsToRemove = { - Items.POT_OF_TEA_4_7692, - Items.POT_OF_TEA_3_7694, - Items.POT_OF_TEA_2_7696, - Items.POT_OF_TEA_1_7698, - Items.POT_OF_TEA_4_7704, - Items.POT_OF_TEA_3_7706, - Items.POT_OF_TEA_2_7708, - Items.POT_OF_TEA_1_7710, - Items.POT_OF_TEA_4_7716, - Items.POT_OF_TEA_3_7718, - Items.POT_OF_TEA_2_7720, - Items.POT_OF_TEA_1_7722, - Items.TEAPOT_WITH_LEAVES_7700, - Items.TEAPOT_WITH_LEAVES_7712, - Items.TEAPOT_WITH_LEAVES_7724, - Items.TEAPOT_7702, - Items.TEAPOT_7714, - Items.TEAPOT_7726, - Items.EMPTY_CUP_7728, - Items.CUP_OF_TEA_7730, - Items.CUP_OF_TEA_7731, - Items.PORCELAIN_CUP_7732, - Items.CUP_OF_TEA_7733, - Items.CUP_OF_TEA_7734, - Items.PORCELAIN_CUP_7735, - Items.CUP_OF_TEA_7736, - Items.CUP_OF_TEA_7737, - Items.KETTLE_7688, - Items.FULL_KETTLE_7690, - Items.HOT_KETTLE_7691, - Items.TEA_LEAVES_7738, - Items.BEER_GLASS_7742, - Items.BEER_7740, - Items.CIDER_7752, - Items.ASGARNIAN_ALE_7744, - Items.GREENMANS_ALE_7746, - Items.DRAGON_BITTER_7748, - Items.CHEFS_DELIGHT_7754 - }; - private void remove_items(Player p) { - for (int item : itemsToRemove) { + for (int item = Items.KETTLE_7688; item <= Items.CHEFS_DELIGHT_7755; item++) {//Removes all PoH versions of tea and beer barrel-related items removeAll(p, item, Container.INVENTORY); removeAll(p, item, Container.BoB); } From 69d07000654a29877521b1cde733e403c6041902 Mon Sep 17 00:00:00 2001 From: Syndromeramo Date: Wed, 30 Jul 2025 12:23:21 -0500 Subject: [PATCH 47/50] Fixed Nettle Tea XP. Changed Nettle Tea boost from inauthentic run restore to authentic +2 Attack Boost. POH Items in this MR are no longer bankable, to avoid exploitation by Winter Storage. --- Server/data/configs/item_configs.json | 66 +++++++++++++++++++ .../content/data/consumables/Consumables.java | 12 ++-- .../global/skill/cooking/CookableItems.java | 2 +- 3 files changed, 73 insertions(+), 7 deletions(-) diff --git a/Server/data/configs/item_configs.json b/Server/data/configs/item_configs.json index b9553778b..0d071ace8 100644 --- a/Server/data/configs/item_configs.json +++ b/Server/data/configs/item_configs.json @@ -70066,6 +70066,7 @@ "id": "7687" }, { + "bankable": "false", "examine": "The kettle is empty.", "durability": null, "name": "Kettle", @@ -70074,6 +70075,7 @@ "id": "7688" }, { + "bankable": "false", "durability": null, "name": "Kettle", "tradeable": "false", @@ -70081,6 +70083,7 @@ "id": "7689" }, { + "bankable": "false", "examine": "It's full of cold water.", "durability": null, "name": "Full kettle", @@ -70089,6 +70092,7 @@ "id": "7690" }, { + "bankable": "false", "examine": "It's full of boiling water.", "durability": null, "name": "Hot kettle", @@ -70097,6 +70101,7 @@ "id": "7691" }, { + "bankable": "false", "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (4)", @@ -70106,6 +70111,7 @@ "id": "7692" }, { + "bankable": "false", "durability": null, "name": "Pot of tea (4)", "tradeable": "false", @@ -70113,6 +70119,7 @@ "id": "7693" }, { + "bankable": "false", "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (3)", @@ -70122,6 +70129,7 @@ "id": "7694" }, { + "bankable": "false", "durability": null, "name": "Pot of tea (3)", "tradeable": "false", @@ -70129,6 +70137,7 @@ "id": "7695" }, { + "bankable": "false", "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (2)", @@ -70138,6 +70147,7 @@ "id": "7696" }, { + "bankable": "false", "durability": null, "name": "Pot of tea (2)", "tradeable": "false", @@ -70145,6 +70155,7 @@ "id": "7697" }, { + "bankable": "false", "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (1)", @@ -70154,6 +70165,7 @@ "id": "7698" }, { + "bankable": "false", "durability": null, "name": "Pot of tea (1)", "tradeable": "false", @@ -70161,6 +70173,7 @@ "id": "7699" }, { + "bankable": "false", "examine": "Add boiling water to make a tea.", "durability": null, "name": "Teapot with leaves", @@ -70170,6 +70183,7 @@ "id": "7700" }, { + "bankable": "false", "durability": null, "name": "Teapot with leaves", "tradeable": "false", @@ -70177,6 +70191,7 @@ "id": "7701" }, { + "bankable": "false", "examine": "This teapot is empty.", "durability": null, "name": "Teapot", @@ -70186,6 +70201,7 @@ "id": "7702" }, { + "bankable": "false", "durability": null, "name": "Teapot", "tradeable": "false", @@ -70193,6 +70209,7 @@ "id": "7703" }, { + "bankable": "false", "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (4)", @@ -70202,6 +70219,7 @@ "id": "7704" }, { + "bankable": "false", "durability": null, "name": "Pot of tea (4)", "tradeable": "false", @@ -70209,6 +70227,7 @@ "id": "7705" }, { + "bankable": "false", "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (3)", @@ -70218,6 +70237,7 @@ "id": "7706" }, { + "bankable": "false", "durability": null, "name": "Pot of tea (3)", "tradeable": "false", @@ -70225,6 +70245,7 @@ "id": "7707" }, { + "bankable": "false", "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (2)", @@ -70234,6 +70255,7 @@ "id": "7708" }, { + "bankable": "false", "durability": null, "name": "Pot of tea (2)", "tradeable": "false", @@ -70241,6 +70263,7 @@ "id": "7709" }, { + "bankable": "false", "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (1)", @@ -70250,6 +70273,7 @@ "id": "7710" }, { + "bankable": "false", "durability": null, "name": "Pot of tea (1)", "tradeable": "false", @@ -70257,6 +70281,7 @@ "id": "7711" }, { + "bankable": "false", "examine": "Add boiling water to make a tea.", "durability": null, "name": "Teapot with leaves", @@ -70266,6 +70291,7 @@ "id": "7712" }, { + "bankable": "false", "durability": null, "name": "Teapot with leaves", "tradeable": "false", @@ -70273,6 +70299,7 @@ "id": "7713" }, { + "bankable": "false", "examine": "This teapot is empty.", "durability": null, "name": "Teapot", @@ -70282,6 +70309,7 @@ "id": "7714" }, { + "bankable": "false", "durability": null, "name": "Teapot", "tradeable": "false", @@ -70289,6 +70317,7 @@ "id": "7715" }, { + "bankable": "false", "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (4)", @@ -70298,6 +70327,7 @@ "id": "7716" }, { + "bankable": "false", "durability": null, "name": "Pot of tea (4)", "tradeable": "false", @@ -70305,6 +70335,7 @@ "id": "7717" }, { + "bankable": "false", "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (3)", @@ -70314,6 +70345,7 @@ "id": "7718" }, { + "bankable": "false", "durability": null, "name": "Pot of tea (3)", "tradeable": "false", @@ -70321,6 +70353,7 @@ "id": "7719" }, { + "bankable": "false", "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (2)", @@ -70330,6 +70363,7 @@ "id": "7720" }, { + "bankable": "false", "durability": null, "name": "Pot of tea (2)", "tradeable": "false", @@ -70337,6 +70371,7 @@ "id": "7721" }, { + "bankable": "false", "examine": "I'd really like a nice cup of tea.", "durability": null, "name": "Pot of tea (1)", @@ -70346,6 +70381,7 @@ "id": "7722" }, { + "bankable": "false", "durability": null, "name": "Pot of tea (1)", "tradeable": "false", @@ -70353,6 +70389,7 @@ "id": "7723" }, { + "bankable": "false", "examine": "Add boiling water to make a tea.", "durability": null, "name": "Teapot with leaves", @@ -70362,6 +70399,7 @@ "id": "7724" }, { + "bankable": "false", "durability": null, "name": "Teapot with leaves", "tradeable": "false", @@ -70369,6 +70407,7 @@ "id": "7725" }, { + "bankable": "false", "examine": "This teapot is empty.", "durability": null, "name": "Teapot", @@ -70378,6 +70417,7 @@ "id": "7726" }, { + "bankable": "false", "durability": null, "name": "Teapot", "tradeable": "false", @@ -70385,6 +70425,7 @@ "id": "7727" }, { + "bankable": "false", "shop_price": "1", "examine": "An empty cup.", "grand_exchange_price": "7", @@ -70395,6 +70436,7 @@ "id": "7728" }, { + "bankable": "false", "durability": null, "name": "Empty cup", "tradeable": "false", @@ -70402,6 +70444,7 @@ "id": "7729" }, { + "bankable": "false", "shop_price": "10", "examine": "A nice cup of nettle tea.", "grand_exchange_price": "30", @@ -70413,6 +70456,7 @@ "id": "7730" }, { + "bankable": "false", "shop_price": "10", "examine": "A milky cup of nettle tea.", "grand_exchange_price": "30", @@ -70424,6 +70468,7 @@ "id": "7731" }, { + "bankable": "false", "examine": "A porcelain cup.", "durability": null, "name": "Porcelain cup", @@ -70432,6 +70477,7 @@ "id": "7732" }, { + "bankable": "false", "shop_price": "10", "examine": "Some nettle tea in a porcelain cup.", "grand_exchange_price": "30", @@ -70443,6 +70489,7 @@ "id": "7733" }, { + "bankable": "false", "shop_price": "10", "examine": "Some milky nettle tea in a porcelain cup.", "grand_exchange_price": "30", @@ -70454,6 +70501,7 @@ "id": "7734" }, { + "bankable": "false", "examine": "A porcelain cup.", "durability": null, "name": "Porcelain cup", @@ -70462,6 +70510,7 @@ "id": "7735" }, { + "bankable": "false", "shop_price": "10", "examine": "Some nettle tea in a porcelain cup.", "grand_exchange_price": "30", @@ -70473,6 +70522,7 @@ "id": "7736" }, { + "bankable": "false", "shop_price": "10", "examine": "Some milky nettle tea in a porcelain cup.", "grand_exchange_price": "30", @@ -70484,6 +70534,7 @@ "id": "7737" }, { + "bankable": "false", "examine": "Mmm, how about a nice cup of tea?", "durability": null, "name": "Tea leaves", @@ -70492,6 +70543,7 @@ "id": "7738" }, { + "bankable": "false", "durability": null, "name": "Tea leaves", "tradeable": "false", @@ -70499,6 +70551,7 @@ "id": "7739" }, { + "bankable": "false", "examine": "A glass of frothy ale.", "grand_exchange_price": "151", "durability": null, @@ -70509,6 +70562,7 @@ "id": "7740" }, { + "bankable": "false", "durability": null, "name": "Beer", "tradeable": "false", @@ -70516,6 +70570,7 @@ "id": "7741" }, { + "bankable": "false", "shop_price": "1", "examine": "I need to fill this with beer.", "grand_exchange_price": "25", @@ -70527,6 +70582,7 @@ "id": "7742" }, { + "bankable": "false", "durability": null, "name": "Beer glass", "tradeable": "false", @@ -70534,6 +70590,7 @@ "id": "7743" }, { + "bankable": "false", "shop_price": "3", "examine": "Probably the finest readily-available ale in Asgarnia.", "grand_exchange_price": "131", @@ -70544,6 +70601,7 @@ "id": "7744" }, { + "bankable": "false", "durability": null, "name": "Asgarnian ale", "tradeable": "false", @@ -70551,6 +70609,7 @@ "id": "7745" }, { + "bankable": "false", "shop_price": "2", "examine": "A glass of frothy ale.", "grand_exchange_price": "569", @@ -70561,6 +70620,7 @@ "id": "7746" }, { + "bankable": "false", "durability": null, "name": "Greenman's ale", "tradeable": "false", @@ -70568,6 +70628,7 @@ "id": "7747" }, { + "bankable": "false", "shop_price": "2", "examine": "A glass of bitter.", "grand_exchange_price": "523", @@ -70579,6 +70640,7 @@ "id": "7748" }, { + "bankable": "false", "durability": null, "name": "Dragon bitter", "tradeable": "false", @@ -70603,6 +70665,7 @@ "id": "7751" }, { + "bankable": "false", "shop_price": "2", "examine": "A glass of Cider", "grand_exchange_price": "1539", @@ -70614,6 +70677,7 @@ "id": "7752" }, { + "bankable": "false", "durability": null, "name": "Cider", "tradeable": "false", @@ -70621,6 +70685,7 @@ "id": "7753" }, { + "bankable": "false", "examine": "A fruity, full-bodied ale.", "grand_exchange_price": "2371", "durability": null, @@ -70630,6 +70695,7 @@ "id": "7754" }, { + "bankable": "false", "durability": null, "name": "Chef's delight", "tradeable": "false", diff --git a/Server/src/main/content/data/consumables/Consumables.java b/Server/src/main/content/data/consumables/Consumables.java index e16b6aa23..3385dd5cd 100644 --- a/Server/src/main/content/data/consumables/Consumables.java +++ b/Server/src/main/content/data/consumables/Consumables.java @@ -292,12 +292,12 @@ public enum Consumables { /** Tea */ CUP_OF_TEA(new Drink(new int[] {712, 1980}, new MultiEffect(new HealingEffect(3), new SkillEffect(Skills.ATTACK, 3, 0)), "Aaah, nothing like a nice cuppa tea!")), NETTLE_WATER(new Drink(new int[] {Items.NETTLE_WATER_4237, Items.BOWL_1923}, new HealingEffect((1)))), - CUP_OF_TEA_NETTLE(new Drink(new int[] {4242, 1980}, new MultiEffect(new HealingEffect(3), new EnergyEffect(10)))), - CUP_OF_TEA_MILKY_NETTLE(new Drink(new int[] {4243, 1980}, new MultiEffect(new HealingEffect(3), new EnergyEffect(10)))), - CUP_OF_TEA_NETTLE_PORCELAIN(new Drink(new int[] {4245, 4244}, new MultiEffect(new HealingEffect(3), new EnergyEffect(10)))), - CUP_OF_TEA_MILKY_NETTLE_PORCELAIN(new Drink(new int[] {4246, 4244}, new MultiEffect(new HealingEffect(3), new EnergyEffect(10)))), - NETTLE_TEA(new Drink(new int[] {4239, 1923}, new MultiEffect(new HealingEffect(3), new EnergyEffect(10)))), - NETTLE_TEA_MILKY(new Drink(new int[] {4240, 1923}, new MultiEffect(new HealingEffect(3), new EnergyEffect(10)))), + CUP_OF_TEA_NETTLE(new Drink(new int[] {4242, 1980}, new MultiEffect(new HealingEffect(3), new SkillEffect(Skills.ATTACK, 2, 0)))), + CUP_OF_TEA_MILKY_NETTLE(new Drink(new int[] {4243, 1980}, new MultiEffect(new HealingEffect(3), new SkillEffect(Skills.ATTACK, 2, 0)))), + CUP_OF_TEA_NETTLE_PORCELAIN(new Drink(new int[] {4245, 4244}, new MultiEffect(new HealingEffect(3), new SkillEffect(Skills.ATTACK, 2, 0)))), + CUP_OF_TEA_MILKY_NETTLE_PORCELAIN(new Drink(new int[] {4246, 4244}, new MultiEffect(new HealingEffect(3), new SkillEffect(Skills.ATTACK, 2, 0)))), + NETTLE_TEA(new Drink(new int[] {4239, 1923}, new MultiEffect(new HealingEffect(3), new SkillEffect(Skills.ATTACK, 2, 0)))), + NETTLE_TEA_MILKY(new Drink(new int[] {4240, 1923}, new MultiEffect(new HealingEffect(3), new SkillEffect(Skills.ATTACK, 2, 0)))), CUP_OF_TEA_CLAY(new Drink(new int[] {7730, 7728}, new SkillEffect(Skills.CONSTRUCTION, 1, 0), "You feel refreshed and ready for more building.")), CUP_OF_TEA_CLAY_MILKY(new Drink(new int[] {7731, 7728}, new SkillEffect(Skills.CONSTRUCTION, 1, 0), "You feel refreshed and ready for more building.")), CUP_OF_TEA_WHITE(new Drink(new int[] {7733, 7732}, new SkillEffect(Skills.CONSTRUCTION, 2, 0), "You feel refreshed and ready for more building.")), diff --git a/Server/src/main/content/global/skill/cooking/CookableItems.java b/Server/src/main/content/global/skill/cooking/CookableItems.java index cea0f356d..2c77f3acd 100644 --- a/Server/src/main/content/global/skill/cooking/CookableItems.java +++ b/Server/src/main/content/global/skill/cooking/CookableItems.java @@ -81,7 +81,7 @@ public enum CookableItems { // bowl foods BOWL_STEW(2003, 2001, 2005, 25, 117, 68, 392, 68, 392), BOWL_CURRY(2011, 2009, 2013, 60, 280, 38, 332, 38, 332), - BOWL_NETTLE(4239, 4237, 4239, 20, 52, 78, 412, 78, 412), + BOWL_NETTLE(4239, 4237, 4239, 20, 53, 78, 412, 78, 412), BOWL_EGG(7078, 7076, 7090, 13, 50, 0, 0, 90, 438), BOWL_ONION(7084, 1871, 7092, 43, 60, 36, 322, 36, 322), BOWL_MUSHROOM(7082, 7080, 7094, 46, 60, 16, 282, 16, 282), From dfc96046738124400833753c1f60a9bfbe8a0d4b Mon Sep 17 00:00:00 2001 From: Syndromeramo Date: Tue, 12 Aug 2025 11:42:40 -0500 Subject: [PATCH 48/50] Porcelain cup tea now checks for level requirements properly. --- .../src/main/content/global/skill/cooking/TeaInteraction.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt index 98ca80c60..5890ad372 100644 --- a/Server/src/main/content/global/skill/cooking/TeaInteraction.kt +++ b/Server/src/main/content/global/skill/cooking/TeaInteraction.kt @@ -105,6 +105,11 @@ class TeaInteraction : InteractionListener { } onUseWith(ITEM, teaCupPorcelainMap.keys.toIntArray(), Items.PORCELAIN_CUP_4244){player, used, with -> + if (getDynLevel(player, Skills.COOKING) < 20){ + sendDialogue(player, "You need a cooking level of 20 to make tea.") + return@onUseWith false + } + if(removeItem(player, used) && removeItem(player, with)){ addItem(player, teaCupPorcelainMap[used.id]!!) addItem(player, Items.BOWL_1923) From f64c765df39e15ca105413312e321137ea95b9dd Mon Sep 17 00:00:00 2001 From: Syndromeramo Date: Tue, 7 Oct 2025 14:13:49 -0500 Subject: [PATCH 49/50] Cleaned up logic and removed comments. --- .../decoration/kitchen/AbstractContainer.kt | 4 +- .../kitchen/BeerBarrelInteraction.kt | 44 +------------------ .../decoration/kitchen/StoveInteraction.kt | 3 +- 3 files changed, 3 insertions(+), 48 deletions(-) diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/AbstractContainer.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/AbstractContainer.kt index 0e8639a42..6086aff25 100644 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/AbstractContainer.kt +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/AbstractContainer.kt @@ -2,7 +2,6 @@ package content.global.skill.construction.decoration.kitchen import core.api.addItem import core.api.freeSlots -import core.api.hasSpaceFor import core.api.sendDialogue import core.game.dialogue.DialogueFile import core.game.dialogue.Topic @@ -19,8 +18,7 @@ abstract class AbstractContainer(containerId: Int, containers: Map return 1917 - 13569 -> return 5763 - 13570 -> return 1905 - 13571 -> return 1909 - 13572 -> return 1911 - 13573 -> return 5755 - } - return 1917 - } - - companion object { - /** - * The object ids - */ - private val OBJECTS = intArrayOf( - 13568, 13569, 13570, 13571, 13572, 13573 - ) - } -}*/ \ No newline at end of file +} \ No newline at end of file diff --git a/Server/src/main/content/global/skill/construction/decoration/kitchen/StoveInteraction.kt b/Server/src/main/content/global/skill/construction/decoration/kitchen/StoveInteraction.kt index 6298209cc..74b0c35f4 100644 --- a/Server/src/main/content/global/skill/construction/decoration/kitchen/StoveInteraction.kt +++ b/Server/src/main/content/global/skill/construction/decoration/kitchen/StoveInteraction.kt @@ -66,7 +66,7 @@ class StoveInteraction : InteractionListener { on(stoves_with_kettle, SCENERY, "take-kettle"){ player, node -> if (getAttribute(player, kettleBoiled, 0) == 0){ - sendMessage(player, "This is not your kettle.") //inauthentic message + sendMessage(player, "This is not your kettle.") return@on false } else if (getAttribute(player, kettleBoiled, 0) == 1){ @@ -79,7 +79,6 @@ class StoveInteraction : InteractionListener { return@on true } else { - //todo get the authentic message sendMessage(player, "You do not have space to do that.") return@on false } From ac283f803cccfbe08f2db278b3b293f53657e91d Mon Sep 17 00:00:00 2001 From: Syndromeramo Date: Tue, 7 Oct 2025 14:26:57 -0500 Subject: [PATCH 50/50] Removed redundant hasSpaceFor function. --- Server/src/main/core/api/ContentAPI.kt | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/Server/src/main/core/api/ContentAPI.kt b/Server/src/main/core/api/ContentAPI.kt index 31f7fb02c..cca729909 100644 --- a/Server/src/main/core/api/ContentAPI.kt +++ b/Server/src/main/core/api/ContentAPI.kt @@ -684,17 +684,6 @@ fun hasSpaceFor(player: Player, item: Item): Boolean { return player.inventory.hasSpaceFor(item) } -/** - * Checks if a player has space for an item - * @param player the player whose inventory to check - * @param item the item ID to check against - * @param amount the amount of the item (default 1) to check for - * @return true if the player's inventory has space for the item - */ -fun hasSpaceFor(player: Player, item: Int, amount: Int = 1): Boolean { - return hasSpaceFor(player, Item(item, amount)) -} - /** * Get the number of ticks passed since server startup */