diff --git a/Server/data/configs/drop_tables.json b/Server/data/configs/drop_tables.json index dc0d9663b..8cd30ce40 100644 --- a/Server/data/configs/drop_tables.json +++ b/Server/data/configs/drop_tables.json @@ -34934,8 +34934,8 @@ "main": [ { "minAmount": "1", - "weight": "25.0", - "id": "1319", + "weight": "50.0", + "id": "1367", "maxAmount": "1" }, { @@ -34944,30 +34944,12 @@ "id": "1313", "maxAmount": "1" }, - { - "minAmount": "1", - "weight": "50.0", - "id": "1367", - "maxAmount": "1" - }, { "minAmount": "1", "weight": "25.0", "id": "1361", "maxAmount": "1" }, - { - "minAmount": "1", - "weight": "5.0", - "id": "1373", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "5.0", - "id": "11235", - "maxAmount": "1" - }, { "minAmount": "1", "weight": "50.0", @@ -34982,28 +34964,10 @@ }, { "minAmount": "1", - "weight": "5.0", + "weight": "25.0", "id": "1163", "maxAmount": "1" }, - { - "minAmount": "1", - "weight": "5.0", - "id": "1185", - "maxAmount": "1" - }, - { - "minAmount": "10", - "weight": "50.0", - "id": "562", - "maxAmount": "10" - }, - { - "minAmount": "7", - "weight": "50.0", - "id": "565", - "maxAmount": "7" - }, { "minAmount": "47", "weight": "25.0", @@ -35011,16 +34975,22 @@ "maxAmount": "47" }, { - "minAmount": "3", + "minAmount": "10", "weight": "25.0", - "id": "560", - "maxAmount": "5" + "id": "562", + "maxAmount": "10" + }, + { + "minAmount": "7", + "weight": "25.0", + "id": "565", + "maxAmount": "7" }, { "minAmount": "3", "weight": "25.0", - "id": "563", - "maxAmount": "3" + "id": "560", + "maxAmount": "5" }, { "minAmount": "1", @@ -35064,6 +35034,12 @@ "id": "211", "maxAmount": "2" }, + { + "minAmount": "1", + "weight": "25.0", + "id": "213", + "maxAmount": "2" + }, { "minAmount": "1", "weight": "25.0", @@ -35076,12 +35052,6 @@ "id": "2485", "maxAmount": "2" }, - { - "minAmount": "1", - "weight": "25.0", - "id": "213", - "maxAmount": "2" - }, { "minAmount": "1", "weight": "25.0", @@ -35090,16 +35060,28 @@ }, { "minAmount": "64", - "weight": "50.0", + "weight": "25.0", "id": "995", "maxAmount": "64" }, { "minAmount": "95", - "weight": "50.0", + "weight": "25.0", "id": "995", "maxAmount": "95" }, + { + "minAmount": "152", + "weight": "25.0", + "id": "995", + "maxAmount": "152" + }, + { + "minAmount": "220", + "weight": "25.0", + "id": "995", + "maxAmount": "220" + }, { "minAmount": "1", "weight": "25.0", @@ -35138,13 +35120,19 @@ }, { "minAmount": "1", - "weight": "5.0", + "weight": "26.6", "id": "31", "maxAmount": "1" }, { "minAmount": "1", - "weight": "100.0", + "weight": "2.13", + "id": "11235", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "150.0", "id": "0", "maxAmount": "1" } @@ -45624,30 +45612,48 @@ "ids": "5363", "description": "", "main": [ + { + "minAmount": "20", + "weight": "25.0", + "id": "810", + "maxAmount": "20" + }, { "minAmount": "1", - "weight": "50.0", + "weight": "25.0", "id": "1373", "maxAmount": "1" }, - { - "minAmount": "14", - "weight": "50.0", - "id": "811", - "maxAmount": "14" - }, - { - "minAmount": "8", - "weight": "50.0", - "id": "830", - "maxAmount": "8" - }, { "minAmount": "1", "weight": "25.0", "id": "1432", "maxAmount": "1" }, + { + "minAmount": "1", + "weight": "25.0", + "id": "1147", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "25.0", + "id": "1163", + "maxAmount": "1" + }, + { + "minAmount": "14", + "weight": "25.0", + "id": "811", + "maxAmount": "14" + }, + { + "minAmount": "8", + "weight": "25.0", + "id": "830", + "maxAmount": "12" + }, { "minAmount": "10", "weight": "25.0", @@ -45664,29 +45670,11 @@ "minAmount": "8", "weight": "25.0", "id": "892", - "maxAmount": "42" - }, - { - "minAmount": "1", - "weight": "25.0", - "id": "1163", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "25.0", - "id": "1247", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "1.0", - "id": "1149", - "maxAmount": "1" + "maxAmount": "8" }, { "minAmount": "27", - "weight": "50.0", + "weight": "25.0", "id": "565", "maxAmount": "27" }, @@ -45697,10 +45685,22 @@ "maxAmount": "10" }, { - "minAmount": "4", - "weight": "5.0", - "id": "563", - "maxAmount": "4" + "minAmount": "1", + "weight": "25.0", + "id": "11429", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "25.0", + "id": "11443", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "25.0", + "id": "11457", + "maxAmount": "1" }, { "minAmount": "1", @@ -45709,10 +45709,10 @@ "maxAmount": "1" }, { - "minAmount": "283", + "minAmount": "600", "weight": "50.0", "id": "995", - "maxAmount": "8441" + "maxAmount": "3000" }, { "minAmount": "1", @@ -45722,7 +45722,7 @@ }, { "minAmount": "1", - "weight": "5.0", + "weight": "25.0", "id": "11359", "maxAmount": "1" }, @@ -45734,43 +45734,37 @@ }, { "minAmount": "1", - "weight": "5.0", + "weight": "25.0", "id": "11338", "maxAmount": "1" }, { - "minAmount": "2", - "weight": "5.0", + "minAmount": "1", + "weight": "25.0", "id": "2363", "maxAmount": "2" }, { "minAmount": "1", - "weight": "1.0", - "id": "995", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "5.0", + "weight": "25.0", "id": "31", "maxAmount": "1" }, { "minAmount": "1", - "weight": "0.05", + "weight": "0.15", "id": "11286", "maxAmount": "1" }, { "minAmount": "1", - "weight": "0.05", + "weight": "0.0235", "id": "11335", "maxAmount": "1" }, { "minAmount": "1", - "weight": "100.0", + "weight": "150.0", "id": "0", "maxAmount": "1" } @@ -52085,199 +52079,157 @@ "main": [ { "minAmount": "1", - "weight": "500.0", - "id": "1319", + "weight": "25.0", + "id": "1289", "maxAmount": "1" }, { "minAmount": "1", - "weight": "200.0", - "id": "224", - "maxAmount": "36" - }, - { - "minAmount": "1", - "weight": "150.0", - "id": "6050", - "maxAmount": "24" - }, - { - "minAmount": "1", - "weight": "100.0", - "id": "6052", - "maxAmount": "16" - }, - { - "minAmount": "1", - "weight": "200.0", - "id": "244", - "maxAmount": "40" - }, - { - "minAmount": "1", - "weight": "150.0", - "id": "246", - "maxAmount": "24" - }, - { - "minAmount": "1", - "weight": "150.0", - "id": "3139", - "maxAmount": "40" - }, - { - "minAmount": "1", - "weight": "150.0", - "id": "248", - "maxAmount": "32" - }, - { - "minAmount": "1", - "weight": "100.0", - "id": "6694", - "maxAmount": "24" - }, - { - "minAmount": "1", - "weight": "125.0", - "id": "6019", - "maxAmount": "24" - }, - { - "minAmount": "1", - "weight": "250.0", + "weight": "25.0", "id": "1303", "maxAmount": "1" }, { "minAmount": "1", - "weight": "250.0", - "id": "1275", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "500.0", - "id": "1127", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "16.0", - "id": "11724", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "16.0", - "id": "11726", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "19.0", - "id": "11728", - "maxAmount": "1" - }, - { - "minAmount": "60", - "weight": "250.0", - "id": "561", - "maxAmount": "70" - }, - { - "minAmount": "15", - "weight": "500.0", - "id": "450", - "maxAmount": "20" - }, - { - "minAmount": "115", - "weight": "500.0", - "id": "454", - "maxAmount": "120" - }, - { - "minAmount": "19902", - "weight": "500.0", - "id": "995", - "maxAmount": "21000" - }, - { - "minAmount": "1", - "weight": "500.0", - "id": "5300", - "maxAmount": "1" - }, - { - "minAmount": "15", - "weight": "250.0", - "id": "1514", - "maxAmount": "20" - }, - { - "minAmount": "3", - "weight": "250.0", - "id": "3024", - "maxAmount": "3" - }, - { - "minAmount": "3", - "weight": "250.0", - "id": "3052", - "maxAmount": "3" - }, - { - "minAmount": "1", - "weight": "250.0", - "id": "10976", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "1.0", - "id": "10977", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "8.0", - "id": "11710", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "8.0", - "id": "11712", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "8.0", - "id": "11714", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "12.0", - "id": "11704", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "10.0", - "id": "2741", + "weight": "25.0", + "id": "1373", "maxAmount": "1" }, { "minAmount": "1", "weight": "50.0", + "id": "1319", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "50.0", + "id": "1127", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "25.0", + "id": "1275", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "2.1", + "id": "11724", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "2.1", + "id": "11726", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "2.1", + "id": "11728", + "maxAmount": "1" + }, + { + "minAmount": "40", + "weight": "50.0", + "id": "561", + "maxAmount": "70" + }, + { + "minAmount": "115", + "weight": "25.0", + "id": "454", + "maxAmount": "120" + }, + { + "minAmount": "15", + "weight": "25.0", + "id": "450", + "maxAmount": "20" + }, + { + "minAmount": "3000", + "weight": "50.0", + "id": "995", + "maxAmount": "21000" + }, + { + "minAmount": "1", + "weight": "50.0", + "id": "5300", + "maxAmount": "1" + }, + { + "minAmount": "15", + "weight": "25.0", + "id": "1514", + "maxAmount": "20" + }, + { + "minAmount": "3", + "weight": "25.0", + "id": "3024", + "maxAmount": "3" + }, + { + "minAmount": "3", + "weight": "25.0", + "id": "3052", + "maxAmount": "3" + }, + { + "minAmount": "1", + "weight": "8.0", + "id": "10976", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "8.0", + "id": "10977", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "1.0", + "id": "11710", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "1.0", + "id": "11712", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "1.0", + "id": "11714", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "1.25", + "id": "11704", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "25.0", + "id": "2741", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "25.0", "id": "31", "maxAmount": "1" }, { "minAmount": "1", - "weight": "100.0", + "weight": "75.0", "id": "0", "maxAmount": "1" } diff --git a/Server/data/configs/npc_configs.json b/Server/data/configs/npc_configs.json index c606ab41b..8cf86f417 100644 --- a/Server/data/configs/npc_configs.json +++ b/Server/data/configs/npc_configs.json @@ -30631,7 +30631,8 @@ "strength_level": "1", "id": "3296", "range_level": "1", - "attack_level": "1" + "attack_level": "1", + "water_npc": true, }, { "examine": "Keeps this magic area tidy.", diff --git a/Server/src/main/java/core/game/content/activity/pyramidplunder/PyramidOptionHandler.java b/Server/src/main/java/core/game/content/activity/pyramidplunder/PyramidOptionHandler.java index e3c9e8d13..ed646888d 100644 --- a/Server/src/main/java/core/game/content/activity/pyramidplunder/PyramidOptionHandler.java +++ b/Server/src/main/java/core/game/content/activity/pyramidplunder/PyramidOptionHandler.java @@ -1,5 +1,6 @@ package core.game.content.activity.pyramidplunder; +import api.ContentAPI; import core.cache.def.impl.NPCDefinition; import core.cache.def.impl.SceneryDefinition; import core.game.content.global.action.ClimbActionHandler; @@ -9,6 +10,7 @@ import core.game.node.entity.npc.NPC; import core.game.node.entity.player.Player; import core.game.node.object.Scenery; import core.game.system.task.Pulse; +import kotlin.Unit; import rs09.game.world.GameWorld; import core.game.world.map.Location; import core.game.world.update.flag.context.Animation; @@ -84,12 +86,10 @@ public final class PyramidOptionHandler extends OptionHandler { if(entrance == currentEntrance && willBePushed){ player.lock(); player.animate(new Animation(7299)); - player.getImpactHandler().setDisabledTicks(4); - GameWorld.getPulser().submit(new Pulse(4, player) { + ContentAPI.submitWorldPulse(new Pulse(4, player){ @Override public boolean pulse() { player.unlock(); - player.getAnimator().reset(); return true; } }); diff --git a/Server/src/main/java/core/game/content/activity/pyramidplunder/PyramidPlunderActivity.java b/Server/src/main/java/core/game/content/activity/pyramidplunder/PyramidPlunderActivity.java index dbd7eabe7..c190933f5 100644 --- a/Server/src/main/java/core/game/content/activity/pyramidplunder/PyramidPlunderActivity.java +++ b/Server/src/main/java/core/game/content/activity/pyramidplunder/PyramidPlunderActivity.java @@ -48,7 +48,10 @@ public final class PyramidPlunderActivity extends ActivityPlugin { public boolean leave(Entity e, boolean logout) { if (e instanceof Player) { ((Player) e).getInterfaceManager().closeOverlay(); - ((PlunderSession) ((Player) e).getAttribute("plunder-session",null)).setActive(false); + PlunderSession session = (PlunderSession) e.asPlayer().getAttribute("plunder-session",null); + if(session != null){ + session.setActive(false); + } ((Player) e).removeAttribute("plunder-session"); } return super.leave(e, logout); diff --git a/Server/src/main/java/core/game/content/global/Bones.java b/Server/src/main/java/core/game/content/global/Bones.java deleted file mode 100644 index fc29a2b64..000000000 --- a/Server/src/main/java/core/game/content/global/Bones.java +++ /dev/null @@ -1,152 +0,0 @@ -package core.game.content.global; - -import core.game.node.item.Item; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; - -/** - * Represents the type of bones. - * @author Apache Ah64 - */ -public enum Bones { - - BONES(2530, 4.5), - BONES_2(526,4.5), - WOLF_BONES(2859, 4.5), - BURNST_BONES(528, 4.5), - MONKEY_BONES(3183, 5), - MONKEY_BONES2(3179, 5), - BAT_BONES(530, 5.3), - BIG_BONES(532, 15), - JOGRE_BONES(3125, 15), - ZOGRE_BONES(4812, 12.5), - SHAIKAHAN_BONES(3123, 25), - BABY_DRAGON_BONES(534, 30), - WYVERN_BONES(6812, 50), - DRAGON_BONES(536, 72), - FAYRG(4830, 84), - RAURG_BONES(4832, 96), - DAGANNOTH(6729, 125), - OURG_BONES(4834, 140), - LAVA_DRAGON_BONES(14693, 85); - - /** - * Holds all bones. - */ - private static HashMap bones = new HashMap(); - - - /** - * The bone item id. - */ - private int itemId; - - /** - * The experience given by burying the bone. - */ - private double experience; - - /** - * Construct a new {@code Bones} {@code Object}. - * @param itemId The item id. - * @param experience The experience given by burying the bone. - */ - private Bones(int itemId, double experience) { - this.itemId = itemId; - this.experience = experience; - } - - /** - * Gets the bone meal item. - * @return the item. - */ - public Item getBoneMeal() { - return new Item(4255 + ordinal()); - } - - /** - * Get the bone experience given when you bury the bone. - * @return The experience. - */ - public double getExperience() { - return experience; - } - - public int getItemId() { - return itemId; - } - - /** - * Gets the bones for the bone meal. - * @param itemId the item. - * @return the bones. - */ - public static Bones forBoneMeal(int itemId) { - for (Bones bone : Bones.values()) { - if (bone.getBoneMeal().getId() == itemId) { - return bone; - } - } - return null; - } - - /** - * Gets the config value for the bone. - * @param value the value. - * @param hopper hopper. - * @return {@code True} if so. - */ - public static Bones forConfigValue(int value, boolean hopper) { - for (Bones bone : Bones.values()) { - if (bone.getConfigValue(hopper) == value) { - return bone; - } - } - return null; - } - - /** - * Gets the config value for the bone type. - * @param hopper the hopper. - * @return the value. - */ - public int getConfigValue(boolean hopper) { - return (this == BONES_2 ? ordinal() : ordinal() - 1) | (hopper ? 4 : 8) << 16; - } - - /** - * Gets the bone ids. - * @return the ids. - */ - public static int[] getArray() { - List list = new ArrayList<>(20); - for (int i : bones.keySet()) { - list.add(i); - } - int[] array = new int[list.size()]; - for (int i = 0; i < list.size(); i++) { - array[i] = list.get(i); - } - return array; - } - - /** - * Get the bone. - * @param itemId The item id. - * @return The bone. - */ - public static Bones forId(int itemId) { - return bones.get(itemId); - } - - /** - * Construct the bones. - */ - static { - for (Bones bone : Bones.values()) { - bones.put(bone.itemId, bone); - } - } -} \ No newline at end of file diff --git a/Server/src/main/java/core/game/content/global/Bones.kt b/Server/src/main/java/core/game/content/global/Bones.kt new file mode 100644 index 000000000..8bdb2f183 --- /dev/null +++ b/Server/src/main/java/core/game/content/global/Bones.kt @@ -0,0 +1,146 @@ +package core.game.content.global + +import core.game.content.global.Bones +import core.game.node.item.Item +import java.util.ArrayList +import java.util.HashMap + +/** + * Represents the type of bones. + * @author Apache Ah64 + */ +enum class Bones +/** + * Construct a new `Bones` `Object`. + * @param itemId The item id. + * @param experience The experience given by burying the bone. + */( + /** + * The bone item id. + */ + val itemId: Int, + /** + * The experience given by burying the bone. + */ + val experience: Double) { + BONES(2530, 4.5), + BONES_2(526, 4.5), + WOLF_BONES(2859, 4.5), + BURNST_BONES(528, 4.5), + MONKEY_BONES(3183, 5.0), + MONKEY_BONES2(3179, 5.0), + BAT_BONES(530, 5.3), + BIG_BONES(532, 15.0), + JOGRE_BONES(3125, 15.0), + ZOGRE_BONES(4812, 12.5), + SHAIKAHAN_BONES(3123, 25.0), + BABY_DRAGON_BONES(534, 30.0), + WYVERN_BONES(6812, 50.0), + DRAGON_BONES(536, 72.0), + FAYRG(4830, 84.0), + RAURG_BONES(4832, 96.0), + DAGANNOTH(6729, 125.0), + OURG_BONES(4834, 140.0), + LAVA_DRAGON_BONES(14693, 85.0); + /** + * Get the bone experience given when you bury the bone. + * @return The experience. + */ + + /** + * Gets the bone meal item. + * @return the item. + */ + val boneMeal: Item + get() { + return when(this){ + FAYRG -> Item(4852) + RAURG_BONES -> Item(4853) + OURG_BONES -> Item(4854) + else -> Item(4255 + ordinal) + } + } + + /** + * Gets the config value for the bone type. + * @param hopper the hopper. + * @return the value. + */ + fun getConfigValue(hopper: Boolean): Int { + return (if (this == BONES_2) ordinal else ordinal - 1) or (if (hopper) 4 else 8) shl 16 + } + + companion object { + /** + * Holds all bones. + */ + private val bones = HashMap() + + /** + * Gets the bones for the bone meal. + * @param itemId the item. + * @return the bones. + */ + @JvmStatic + fun forBoneMeal(itemId: Int): Bones? { + for (bone in values()) { + if (bone.boneMeal.id == itemId) { + return bone + } + } + return null + } + + /** + * Gets the config value for the bone. + * @param value the value. + * @param hopper hopper. + * @return `True` if so. + */ + @JvmStatic + fun forConfigValue(value: Int, hopper: Boolean): Bones? { + for (bone in values()) { + if (bone.getConfigValue(hopper) == value) { + return bone + } + } + return null + } + + /** + * Gets the bone ids. + * @return the ids. + */ + val array: IntArray + @JvmStatic get() { + val list: MutableList = ArrayList(20) + for (i in bones.keys) { + list.add(i) + } + val array = IntArray(list.size) + for (i in list.indices) { + array[i] = list[i] + } + return array + } + + /** + * Get the bone. + * @param itemId The item id. + * @return The bone. + */ + @JvmStatic + fun forId(itemId: Int): Bones? { + return bones[itemId] + } + + /** + * Construct the bones. + */ + init { + for (bone in values()) { + bones[bone.itemId] = bone + } + } + } +} \ No newline at end of file diff --git a/Server/src/main/java/core/game/interaction/item/withobject/WaterSourcePlugin.java b/Server/src/main/java/core/game/interaction/item/withobject/WaterSourcePlugin.java index 9cae233b0..4d1f9377f 100644 --- a/Server/src/main/java/core/game/interaction/item/withobject/WaterSourcePlugin.java +++ b/Server/src/main/java/core/game/interaction/item/withobject/WaterSourcePlugin.java @@ -1,5 +1,6 @@ package core.game.interaction.item.withobject; +import api.ContentAPI; import core.plugin.Initializable; import org.rs09.consts.Items; import core.game.interaction.NodeUsageEvent; @@ -11,6 +12,7 @@ import core.game.node.object.Scenery; import core.game.system.task.Pulse; import core.game.world.update.flag.context.Animation; import core.plugin.Plugin; +import rs09.game.system.SystemLogger; /** * Represents the plugin used to fill a bucket. @@ -40,6 +42,9 @@ public final class WaterSourcePlugin extends UseWithHandler { @Override public Plugin newInstance(Object arg) throws Throwable { for (int i : OBJECTS) { + if(ContentAPI.sceneryDefinition(i).getName().toLowerCase().contains("well")){ + continue; + } addHandler(i, OBJECT_TYPE, this); } return this; diff --git a/Server/src/main/java/core/game/node/entity/skill/construction/decoration/chapel/BoneOfferPlugin.java b/Server/src/main/java/core/game/node/entity/skill/construction/decoration/chapel/BoneOfferPlugin.java index 57a7dced9..8cccb5592 100644 --- a/Server/src/main/java/core/game/node/entity/skill/construction/decoration/chapel/BoneOfferPlugin.java +++ b/Server/src/main/java/core/game/node/entity/skill/construction/decoration/chapel/BoneOfferPlugin.java @@ -1,6 +1,7 @@ package core.game.node.entity.skill.construction.decoration.chapel; +import api.ContentAPI; import core.cache.def.impl.SceneryDefinition; import core.game.content.global.Bones; import core.game.node.entity.skill.Skills; @@ -86,7 +87,7 @@ public class BoneOfferPlugin extends UseWithHandler { return; } final Location start = player.getLocation(); - GameWorld.getPulser().submit(new Pulse(1) { + ContentAPI.submitIndividualPulse(player, new Pulse(1) { int counter = 0; @Override diff --git a/Server/src/main/java/core/game/node/entity/skill/herblore/GrindingItem.java b/Server/src/main/java/core/game/node/entity/skill/herblore/GrindingItem.java index e7278fce4..df50f81ca 100644 --- a/Server/src/main/java/core/game/node/entity/skill/herblore/GrindingItem.java +++ b/Server/src/main/java/core/game/node/entity/skill/herblore/GrindingItem.java @@ -23,6 +23,7 @@ public enum GrindingItem { GARLIC(new Item[] { new Item(1550) }, new Item(4668)), DRAGON_SCALE(new Item[] { new Item(243) }, new Item(241)), ANCHOVIES(new Item[] { new Item(319) }, new Item(11266)), + CHOCOLATE_BAR(new Item[] {new Item(Items.CHOCOLATE_BAR_1973)}, new Item(Items.CHOCOLATE_DUST_1975)), GUAM_LEAF(new Item[] { new Item(Items.CLEAN_GUAM_249) }, new Item(Items.GROUND_GUAM_6681)); /** diff --git a/Server/src/main/java/core/game/world/map/zone/impl/WildernessZone.java b/Server/src/main/java/core/game/world/map/zone/impl/WildernessZone.java index 507ef5cad..36973173d 100644 --- a/Server/src/main/java/core/game/world/map/zone/impl/WildernessZone.java +++ b/Server/src/main/java/core/game/world/map/zone/impl/WildernessZone.java @@ -172,10 +172,6 @@ public final class WildernessZone extends MapZone { GroundItemManager.create(reward, e.asNpc().getDropLocation(), killer.asPlayer()); Repository.sendNews(killer.getUsername() + " has received " + reward.getName().toLowerCase() + " from a " + e.asNpc().getName() + "!"); } - e.asNpc().getDefinition().getDropTables().drop(e.asNpc(), killer); - if (((NPC) e).getTask() != null && ((Player) killer).getSlayer().getTask() == e.asNpc().getTask()) { - ((Player) killer).getSlayer().finalizeDeath(killer.asPlayer(), e.asNpc()); - } int combatLevel = e.asNpc().getDefinition().getCombatLevel(); int dropRate = getNewDropRate(combatLevel); @@ -196,6 +192,10 @@ public final class WildernessZone extends MapZone { } if (e instanceof NPC) { + e.asNpc().getDefinition().getDropTables().drop(e.asNpc(), killer); + if (((NPC) e).getTask() != null && ((Player) killer).getSlayer().getTask() == e.asNpc().getTask()) { + ((Player) killer).getSlayer().finalizeDeath(killer.asPlayer(), e.asNpc()); + } e.asNpc().setRespawnTick(GameWorld.getTicks() + e.asNpc().getDefinition().getConfiguration(NPCConfigParser.RESPAWN_DELAY, 17)); if (!e.asNpc().isRespawn()) { e.asNpc().clear(); diff --git a/Server/src/main/kotlin/api/ContentAPI.kt b/Server/src/main/kotlin/api/ContentAPI.kt index b04703066..28dcd8de0 100644 --- a/Server/src/main/kotlin/api/ContentAPI.kt +++ b/Server/src/main/kotlin/api/ContentAPI.kt @@ -1,6 +1,7 @@ package api import core.cache.def.impl.ItemDefinition +import core.cache.def.impl.SceneryDefinition import core.game.component.Component import core.game.content.dialogue.FacialExpression import core.game.node.Node @@ -994,4 +995,14 @@ object ContentAPI { fun getQP(player: Player): Int{ return player.questRepository.points } + + /** + * Gets a scenery definition from the given ID + * @param id the ID of the scenery to get the definition for. + * @return the scenery definition + */ + @JvmStatic + fun sceneryDefinition(id: Int): SceneryDefinition{ + return SceneryDefinition.forId(id) + } } \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/ServerConstants.kt b/Server/src/main/kotlin/rs09/ServerConstants.kt index a2082b60d..35c1d5c83 100644 --- a/Server/src/main/kotlin/rs09/ServerConstants.kt +++ b/Server/src/main/kotlin/rs09/ServerConstants.kt @@ -173,6 +173,9 @@ class ServerConstants { @JvmField var MODULUS = BigInteger("96982303379631821170939875058071478695026608406924780574168393250855797534862289546229721580153879336741968220328805101128831071152160922518190059946555203865621183480223212969502122536662721687753974815205744569357388338433981424032996046420057284324856368815997832596174397728134370577184183004453899764051") + @JvmField + var DAILY_RESTART = false + /** * Parses a JSONObject and retrieves the values for all settings in this file. * @author Ceikry @@ -211,6 +214,10 @@ class ServerConstants { DATABASE_PORT = data["database_port"].toString() DATABASE = Database(DATABASE_ADDRESS, DATABASE_NAME, DATABASE_USER, DATABASE_PASS) + + if(data.containsKey("daily_restart")){ + DAILY_RESTART = data["daily_restart"] as Boolean + } } } } \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/content/dialogue/OttoGodblessedDialogue.kt b/Server/src/main/kotlin/rs09/game/content/dialogue/OttoGodblessedDialogue.kt index a842fd11e..3487805fa 100644 --- a/Server/src/main/kotlin/rs09/game/content/dialogue/OttoGodblessedDialogue.kt +++ b/Server/src/main/kotlin/rs09/game/content/dialogue/OttoGodblessedDialogue.kt @@ -6,6 +6,7 @@ import core.game.node.entity.npc.NPC import core.game.node.entity.player.Player import core.game.node.item.Item import core.plugin.Initializable +import rs09.tools.END_DIALOGUE /** * Represents the dialogue plugin used for Otto @@ -32,56 +33,14 @@ class OttoGodblessedDialogue(player: Player? = null) : DialoguePlugin(player) { override fun handle(interfaceId: Int, buttonId: Int): Boolean { when (stage) { - -1 -> options("Ask about hastas","Ask about barbarian training").also { stage++ } + -1 -> options("Ask about barbarian training", "Nevermind.").also { stage++ } 0 -> when(buttonId){ - 1 -> player("Can you help me with Zamorakian weapons?").also { stage++ } - 2 -> player("Is there anything you can teach me?").also { stage = 20 } + 1 -> player("Is there anything you can teach me?").also { stage = 20 } + 2 -> stage++ } - 1 -> { - npc("Yes, I can convert a Zamorakian spear into a hasta.", "The spirits require me to request 300,000 coins from", "you for this service.") - stage = 2 - } - 2 -> { - interpreter.sendOptions("Select an Option", "Spear into hasta", "Hasta back to spear") - stage = 3 - } - 3 -> when (buttonId) { - 1 -> if (player.inventory.contains(11716, 1) && player.inventory.contains(995, 300000)) { - interpreter.sendOptions("Convert your spear?", "Yes", "No") - stage = 4 - } else { - player.sendMessage("You need a Zamorakian Spear and 300,000 coins to proceed.") - end() - } - 2 -> if (player.inventory.contains(14662, 1)) { - interpreter.sendOptions("Revert back to spear?", "Yes", "No") - stage = 5 - } else { - player.sendMessage("You need a Zamorakian Hasta to proceed.") - end() - } - } - 4 -> when (buttonId) { - 1 -> if (player.inventory.remove(Item(11716, 1), Item(995, 300000))) { - player.inventory.add(Item(14662)) - interpreter.sendItemMessage(14662, "Otto converts your spear into a hasta.") - stage = 6 - } else { - end() - } - 2 -> end() - } - 5 -> when (buttonId) { - 1 -> if (player.inventory.remove(Item(14662, 1))) { - player.inventory.add(Item(11716)) - interpreter.sendItemMessage(11716, "Otto converts your hasta back into a spear.") - stage = 6 - } else { - end() - } - 2 -> end() - } - 6 -> end() + + 1 -> stage = END_DIALOGUE + 20 -> npc("I can teach you how to fish.").also { stage++ } 21 -> player("Oh, that's pretty underwhelming. But uhhh, okay!").also { stage++ } diff --git a/Server/src/main/kotlin/rs09/game/interaction/InteractionListeners.kt b/Server/src/main/kotlin/rs09/game/interaction/InteractionListeners.kt index 25ce5f44c..413ae4eea 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/InteractionListeners.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/InteractionListeners.kt @@ -126,9 +126,9 @@ object InteractionListeners { @JvmStatic fun run(id: Int, player: Player, node: Node, isEquip: Boolean): Boolean{ if(isEquip){ - return equipListeners["equip:$id"]?.invoke(player,node)!! + return equipListeners["equip:$id"]?.invoke(player,node) ?: true } else { - return equipListeners["unequip:$id"]?.invoke(player,node)!! + return equipListeners["unequip:$id"]?.invoke(player,node) ?: true } } diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withobject/FishEasterEgg.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withobject/FishEasterEgg.kt new file mode 100644 index 000000000..7646b98a5 --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withobject/FishEasterEgg.kt @@ -0,0 +1,25 @@ +package rs09.game.interaction.item.withobject + +import api.ContentAPI +import core.game.node.entity.skill.gather.woodcutting.WoodcuttingNode +import org.rs09.consts.Items +import rs09.game.interaction.InteractionListener + +class FishEasterEgg : InteractionListener() { + val TREE_IDs = WoodcuttingNode.values().map { it.id }.toIntArray() + + val fish = intArrayOf(Items.RAW_HERRING_345, Items.HERRING_347) + val doors = intArrayOf(1967,1968) + + override fun defineListeners() { + onUseWith(SCENERY, fish, *TREE_IDs){player, _, _ -> + ContentAPI.sendMessage(player, "This is not the mightiest tree in the forest.") + return@onUseWith true + } + + onUseWith(SCENERY, fish, *doors){player, _, _ -> + ContentAPI.sendMessage(player, "It can't be done!") + return@onUseWith true + } + } +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/interaction/item/withobject/HatStand.kt b/Server/src/main/kotlin/rs09/game/interaction/item/withobject/HatStand.kt new file mode 100644 index 000000000..72603cd32 --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/interaction/item/withobject/HatStand.kt @@ -0,0 +1,20 @@ +package rs09.game.interaction.item.withobject + +import api.ContentAPI +import api.EquipmentSlot +import core.cache.def.impl.ItemDefinition +import rs09.game.interaction.InteractionListener +import rs09.game.system.SystemLogger + +class HatStand : InteractionListener() { + + val hats = ItemDefinition.getDefinitions().values.filter { it.getConfiguration("equipment_slot",0) == EquipmentSlot.HAT.ordinal }.map { it.id }.toIntArray() + val hat_stand = 374 + + override fun defineListeners() { + onUseWith(SCENERY, hats, hat_stand){player, used, with -> + ContentAPI.sendDialogue(player, "It'd probably fall off if I tried to do that.") + return@onUseWith true + } + } +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/interaction/object/WizardGuildPortals.kt b/Server/src/main/kotlin/rs09/game/interaction/object/WizardGuildPortals.kt new file mode 100644 index 000000000..d12e0e634 --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/interaction/object/WizardGuildPortals.kt @@ -0,0 +1,29 @@ +package rs09.game.interaction.`object` + +import api.ContentAPI +import core.game.world.map.Location +import rs09.game.interaction.InteractionListener + +class WizardGuildPortals : InteractionListener() { + + val WTOWER_PORTAL = 2156 + val DWTOWER_PORTAL = 2157 + val SORC_TOWER_PORTAL = 2158 + + override fun defineListeners() { + on(WTOWER_PORTAL, SCENERY, "enter"){player, _ -> + ContentAPI.teleport(player, Location.create(3114, 3171, 0)) + return@on true + } + + on(DWTOWER_PORTAL, SCENERY, "enter"){player, _ -> + ContentAPI.teleport(player, Location.create(2916, 3335, 0)) + return@on true + } + + on(SORC_TOWER_PORTAL, SCENERY, "enter"){player, _ -> + ContentAPI.teleport(player, Location.create(2701, 3395, 0)) + return@on true + } + } +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/worker/MajorUpdateWorker.kt b/Server/src/main/kotlin/rs09/worker/MajorUpdateWorker.kt index 13929fd2f..05a2eea46 100644 --- a/Server/src/main/kotlin/rs09/worker/MajorUpdateWorker.kt +++ b/Server/src/main/kotlin/rs09/worker/MajorUpdateWorker.kt @@ -1,14 +1,22 @@ package rs09.worker +import api.ContentAPI +import core.game.system.SystemManager +import core.game.system.SystemState import core.game.system.task.Pulse import core.plugin.CorePluginTypes.Managers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.delay import kotlinx.coroutines.launch import rs09.Server +import rs09.ServerConstants import rs09.game.world.GameWorld import rs09.game.world.repository.Repository import rs09.game.world.update.UpdateSequence +import rs09.tools.stringtools.colorize +import java.text.SimpleDateFormat +import java.util.* +import kotlin.collections.ArrayList /** * Handles the running of pulses and writing of masks, etc @@ -17,6 +25,7 @@ import rs09.game.world.update.UpdateSequence class MajorUpdateWorker { var started = false val sequence = UpdateSequence() + val sdf = SimpleDateFormat("HH") fun start() = GlobalScope.launch { started = true while(true){ @@ -46,6 +55,24 @@ class MajorUpdateWorker { //tick all manager plugins Managers.tick() Server.heartbeat() + + //Handle daily restart if enabled + if(ServerConstants.DAILY_RESTART && sdf.format(Date()).toInt() == 0){ + Repository.sendNews(colorize("%RSERVER GOING DOWN FOR DAILY RESTART IN 5 MINUTES!")) + ServerConstants.DAILY_RESTART = false + ContentAPI.submitWorldPulse(object : Pulse(100) { + var counter = 0 + override fun pulse(): Boolean { + counter++ + if(counter == 5){ + SystemManager.flag(SystemState.TERMINATED) + return true + } + Repository.sendNews(colorize("%RSERVER GOING DOWN FOR DAILY RESTART IN ${5 - counter} MINUTE${if(counter < 4) "S" else ""}!")) + return false + } + }) + } } } } \ No newline at end of file