diff --git a/README.md b/README.md index 567bf8388..f3f3b3e6c 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,7 @@ ยท Bug Board

+

NOTE: Do not report issues if you are running your own server. Chances are, the fault lies in your misconfiguration of the server or the issue has already long been fixed on live. Essentially: Your server. Your issues. We have enough to worry about with our own server.

ATTENTION: Starting October 5th, 2020 the development team will no longer be providing support for setting up your own server. Do not ping or private message Developers asking how to build the project. This in-depth guide will be continually updated if the building process changes. We are focusing all of our efforts on the development of features and bugfixes for the live server.

diff --git a/Server/data/configs/drop_tables.json b/Server/data/configs/drop_tables.json index 8cd30ce40..a2b457b08 100644 --- a/Server/data/configs/drop_tables.json +++ b/Server/data/configs/drop_tables.json @@ -2393,15 +2393,15 @@ "main": [ { "minAmount": "1", - "weight": "50.0", - "id": "1315", + "weight": "25.0", + "id": "1369", "maxAmount": "1" }, { - "minAmount": "20", + "minAmount": "1", "weight": "50.0", - "id": "828", - "maxAmount": "20" + "id": "1315", + "maxAmount": "1" }, { "minAmount": "1", @@ -2423,10 +2423,16 @@ }, { "minAmount": "1", - "weight": "25.0", - "id": "1369", + "weight": "10.0", + "id": "1303", "maxAmount": "1" }, + { + "minAmount": "20", + "weight": "50.0", + "id": "828", + "maxAmount": "20" + }, { "minAmount": "4", "weight": "25.0", @@ -2439,12 +2445,6 @@ "id": "811", "maxAmount": "8" }, - { - "minAmount": "1", - "weight": "25.0", - "id": "1303", - "maxAmount": "1" - }, { "minAmount": "4", "weight": "25.0", @@ -2483,7 +2483,7 @@ }, { "minAmount": "1", - "weight": "50.0", + "weight": "25.0", "id": "205", "maxAmount": "1" }, @@ -2531,7 +2531,7 @@ }, { "minAmount": "30", - "weight": "50.0", + "weight": "100.0", "id": "995", "maxAmount": "690" }, @@ -2555,13 +2555,13 @@ }, { "minAmount": "1", - "weight": "5.0", + "weight": "15.8", "id": "31", "maxAmount": "1" }, { "minAmount": "1", - "weight": "100.0", + "weight": "150.0", "id": "0", "maxAmount": "1" } @@ -2816,7 +2816,7 @@ { "minAmount": "1", "weight": "25.0", - "id": "1355", + "id": "1069", "maxAmount": "1" }, { @@ -2828,19 +2828,7 @@ { "minAmount": "1", "weight": "25.0", - "id": "1211", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "5.0", - "id": "1213", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "50.0", - "id": "1069", + "id": "1355", "maxAmount": "1" }, { @@ -2849,15 +2837,33 @@ "id": "1197", "maxAmount": "1" }, + { + "minAmount": "1", + "weight": "25.0", + "id": "1245", + "maxAmount": "1" + }, { "minAmount": "1", "weight": "25.0", "id": "1161", "maxAmount": "1" }, + { + "minAmount": "1", + "weight": "5.0", + "id": "1213", + "maxAmount": "1" + }, + { + "minAmount": "1", + "weight": "5.0", + "id": "1247", + "maxAmount": "1" + }, { "minAmount": "75", - "weight": "50.0", + "weight": "25.0", "id": "555", "maxAmount": "75" }, @@ -2880,10 +2886,10 @@ "maxAmount": "3" }, { - "minAmount": "5", - "weight": "5.0", - "id": "560", - "maxAmount": "5" + "minAmount": "8", + "weight": "25.0", + "id": "565", + "maxAmount": "8" }, { "minAmount": "1", @@ -2905,7 +2911,7 @@ }, { "minAmount": "1", - "weight": "50.0", + "weight": "25.0", "id": "205", "maxAmount": "1" }, @@ -2947,15 +2953,21 @@ }, { "minAmount": "1", - "weight": "5.0", + "weight": "25.0", "id": "217", "maxAmount": "1" }, { - "minAmount": "11", + "minAmount": "320", "weight": "50.0", "id": "995", - "maxAmount": "454" + "maxAmount": "320" + }, + { + "minAmount": "440", + "weight": "50.0", + "id": "995", + "maxAmount": "440" }, { "minAmount": "1", @@ -2977,13 +2989,13 @@ }, { "minAmount": "1", - "weight": "5.0", + "weight": "15.0", "id": "31", "maxAmount": "1" }, { "minAmount": "1", - "weight": "100.0", + "weight": "150.0", "id": "0", "maxAmount": "1" } @@ -61785,27 +61797,21 @@ }, { "minAmount": "1", - "weight": "25.0", + "weight": "15.0", "id": "1185", "maxAmount": "1" }, { "minAmount": "1", - "weight": "1.0", + "weight": "5.0", "id": "1333", "maxAmount": "1" }, { "minAmount": "1", - "weight": "5.0", - "id": "1165", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "50.0", + "weight": "25.0", "id": "560", - "maxAmount": "15" + "maxAmount": "20" }, { "minAmount": "1", @@ -61815,9 +61821,9 @@ }, { "minAmount": "1", - "weight": "50.0", + "weight": "25.0", "id": "554", - "maxAmount": "65" + "maxAmount": "58" }, { "minAmount": "1", @@ -61825,6 +61831,12 @@ "id": "565", "maxAmount": "16" }, + { + "minAmount": "1", + "weight": "25.0", + "id": "564", + "maxAmount": "5" + }, { "minAmount": "1", "weight": "25.0", @@ -61959,39 +61971,33 @@ }, { "minAmount": "1", - "weight": "25.0", + "weight": "50.0", "id": "450", "maxAmount": "1" }, - { - "minAmount": "1", - "weight": "25.0", - "id": "1623", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "25.0", - "id": "1621", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "5.0", - "id": "1619", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "5.0", - "id": "1617", - "maxAmount": "1" - }, { "minAmount": "5", + "weight": "25.0", + "id": "995", + "maxAmount": "5" + }, + { + "minAmount": "100", "weight": "50.0", "id": "995", - "maxAmount": "493" + "maxAmount": "500" + }, + { + "minAmount": "1", + "weight": "25.0", + "id": "6004", + "maxAmount": "2" + }, + { + "minAmount": "1", + "weight": "5.0", + "id": "229", + "maxAmount": "1" }, { "minAmount": "1", @@ -62001,13 +62007,7 @@ }, { "minAmount": "1", - "weight": "25.0", - "id": "2841", - "maxAmount": "1" - }, - { - "minAmount": "1", - "weight": "5.0", + "weight": "6.0", "id": "31", "maxAmount": "1" } diff --git a/Server/data/configs/npc_spawns.json b/Server/data/configs/npc_spawns.json index 231db13bb..71007e5e0 100644 --- a/Server/data/configs/npc_spawns.json +++ b/Server/data/configs/npc_spawns.json @@ -6081,7 +6081,7 @@ }, { "npc_id": "4250", - "loc_data": "{3302,3492,0,1,3}" + "loc_data": "{3302,3492,0,1,6}" }, { "npc_id": "4251", diff --git a/Server/src/main/java/core/game/interaction/inter/GrandExchangeInterface.java b/Server/src/main/java/core/game/interaction/inter/GrandExchangeInterface.java index 822dc8b1a..87ab55a33 100644 --- a/Server/src/main/java/core/game/interaction/inter/GrandExchangeInterface.java +++ b/Server/src/main/java/core/game/interaction/inter/GrandExchangeInterface.java @@ -335,11 +335,14 @@ public class GrandExchangeInterface extends ComponentPlugin { setOfferAmount(player, offer, amount + 1000); return true; case 170: // value x - ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> { + ContentAPI.sendInputDialogue(player, false, "Enter the amount:", (value) -> { if (player.getInterfaceManager().getChatbox().getId() == 389) { player.getPlayerGrandExchange().openSearch(); } - setOfferAmount(player, offer, (int) value); + String s = value.toString(); + s = s.replace("k","000"); + s = s.replace("K","000"); + setOfferAmount(player, offer, Integer.parseInt(s)); return Unit.INSTANCE; }); return false; @@ -368,11 +371,14 @@ public class GrandExchangeInterface extends ComponentPlugin { player.getPacketDispatch().sendMessage("Please select an offer first."); return true; } - ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> { + ContentAPI.sendInputDialogue(player, false, "Enter the amount:", (value) -> { if (player.getInterfaceManager().getChatbox().getId() == 389) { player.getPlayerGrandExchange().openSearch(); } - setOfferValue(player, offer, (int) value); + String s = value.toString(); + s = s.replace("k","000"); + s = s.replace("K","000"); + setOfferValue(player, offer, Integer.parseInt(s)); return Unit.INSTANCE; }); return false; diff --git a/Server/src/main/java/core/game/interaction/inter/ShoppingPlugin.java b/Server/src/main/java/core/game/interaction/inter/ShoppingPlugin.java index 72fcdca46..298c44972 100644 --- a/Server/src/main/java/core/game/interaction/inter/ShoppingPlugin.java +++ b/Server/src/main/java/core/game/interaction/inter/ShoppingPlugin.java @@ -1,5 +1,6 @@ package core.game.interaction.inter; +import api.ContentAPI; import core.game.component.Component; import core.game.component.ComponentDefinition; import core.game.component.ComponentPlugin; diff --git a/Server/src/main/java/core/game/interaction/inter/TradeInterfacePlugin.java b/Server/src/main/java/core/game/interaction/inter/TradeInterfacePlugin.java index 21925d0db..4b1702fb1 100644 --- a/Server/src/main/java/core/game/interaction/inter/TradeInterfacePlugin.java +++ b/Server/src/main/java/core/game/interaction/inter/TradeInterfacePlugin.java @@ -68,8 +68,12 @@ public final class TradeInterfacePlugin extends ComponentPlugin { module.getContainer().withdraw(slot, module.getContainer().getAmount(module.getContainer().get(slot))); break; case 234: - ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> { - module.getContainer().withdraw(slot, (int) value); + ContentAPI.sendInputDialogue(player, false, "Enter the amount:", (value) -> { + String s = value.toString(); + s = s.replace("k","000"); + s = s.replace("K","000"); + int val = Integer.parseInt(s); + module.getContainer().withdraw(slot, val); return Unit.INSTANCE; }); break; @@ -96,8 +100,12 @@ public final class TradeInterfacePlugin extends ComponentPlugin { module.getContainer().offer(slot, player.getInventory().getAmount(player.getInventory().get(slot))); break; case 234: - ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> { - module.getContainer().offer(slot, (int) value); + ContentAPI.sendInputDialogue(player, false, "Enter the amount:", (value) -> { + String s = value.toString(); + s = s.replace("k","000"); + s = s.replace("K","000"); + int val = Integer.parseInt(s); + module.getContainer().offer(slot, val); return Unit.INSTANCE; }); break; diff --git a/Server/src/main/java/core/game/interaction/item/withitem/FruitCuttingPlugin.java b/Server/src/main/java/core/game/interaction/item/withitem/FruitCuttingPlugin.java index cab2950db..51f27f988 100644 --- a/Server/src/main/java/core/game/interaction/item/withitem/FruitCuttingPlugin.java +++ b/Server/src/main/java/core/game/interaction/item/withitem/FruitCuttingPlugin.java @@ -222,8 +222,12 @@ public final class FruitCuttingPlugin extends UseWithHandler { amount = 5; break; case 4: - ContentAPI.sendInputDialogue(player, true, "Enter the amount:", (value) -> { - cut(player, (int) value, slice); + ContentAPI.sendInputDialogue(player, false, "Enter the amount:", (value) -> { + String s = value.toString(); + s = s.replace("k","000"); + s = s.replace("K","000"); + int val = Integer.parseInt(s); + cut(player, val, slice); return Unit.INSTANCE; }); return true; diff --git a/Server/src/main/java/core/game/interaction/item/withobject/SmithingPlugin.java b/Server/src/main/java/core/game/interaction/item/withobject/SmithingPlugin.java index a2d5c2fb5..e62516b42 100644 --- a/Server/src/main/java/core/game/interaction/item/withobject/SmithingPlugin.java +++ b/Server/src/main/java/core/game/interaction/item/withobject/SmithingPlugin.java @@ -13,6 +13,7 @@ import core.game.node.item.Item; import core.game.node.object.Scenery; import core.plugin.Plugin; import core.plugin.Initializable; +import rs09.game.node.entity.skill.skillcapeperks.SkillcapePerks; import rs09.plugin.PluginManager; /** @@ -70,7 +71,7 @@ public final class SmithingPlugin extends UseWithHandler { player.getDialogueInterpreter().sendDialogue("Property of Doric the Dwarf."); return true; } - if (!player.getInventory().contains(2347, 1)) { + if (!player.getInventory().contains(2347, 1) && !SkillcapePerks.isActive(SkillcapePerks.BAREFISTED_SMITHING,player)) { player.getDialogueInterpreter().sendDialogue("You need a hammer to work the metal with."); return true; } else { diff --git a/Server/src/main/java/core/game/interaction/object/BankingPlugin.java b/Server/src/main/java/core/game/interaction/object/BankingPlugin.java index 0a1951460..c841b6ffd 100644 --- a/Server/src/main/java/core/game/interaction/object/BankingPlugin.java +++ b/Server/src/main/java/core/game/interaction/object/BankingPlugin.java @@ -372,9 +372,13 @@ public final class BankingPlugin extends OptionHandler { amount = p.getBank().getLastAmountX(); break; case 234: - ContentAPI.sendInputDialogue(p, true, "Enter the amount:", (value) -> { - p.getBank().takeItem(slot, (int) value); - p.getBank().updateLastAmountX((int) value); + ContentAPI.sendInputDialogue(p, false, "Enter the amount:", (value) -> { + String s = value.toString(); + s = s.replace("k","000"); + s = s.replace("K","000"); + int val = Integer.parseInt(s); + p.getBank().takeItem(slot, val); + p.getBank().updateLastAmountX(val); return Unit.INSTANCE; }); break; @@ -446,9 +450,13 @@ public final class BankingPlugin extends OptionHandler { p.getBank().addItem(slot, p.getBank().getLastAmountX()); break; case 234: - ContentAPI.sendInputDialogue(p, true, "Enter the amount:", (value) -> { - p.getBank().addItem(slot, (int) value); - p.getBank().updateLastAmountX((int) value); + ContentAPI.sendInputDialogue(p, false, "Enter the amount:", (value) -> { + String s = value.toString(); + s = s.replace("k","000"); + s = s.replace("K","000"); + int val = Integer.parseInt(s); + p.getBank().addItem(slot, val); + p.getBank().updateLastAmountX(val); return Unit.INSTANCE; }); break; @@ -512,8 +520,12 @@ public final class BankingPlugin extends OptionHandler { }); return true; case 234: - ContentAPI.sendInputDialogue(p, true, "Enter the amount:", (value) -> { - p.getBank().addItem(slot, (int) value); + ContentAPI.sendInputDialogue(p, false, "Enter the amount:", (value) -> { + String s = value.toString(); + s = s.replace("k","000"); + s = s.replace("K","000"); + int val = Integer.parseInt(s); + p.getBank().addItem(slot, val); InterfaceContainer.generateItems(p, p.getInventory().toArray(), new String[]{"Examine", "Deposit-X", "Deposit-All", "Deposit-10", "Deposit-5", "Deposit-1",}, 11, 15, 5, 7); return Unit.INSTANCE; }); diff --git a/Server/src/main/java/core/game/node/entity/combat/equipment/WeaponInterface.java b/Server/src/main/java/core/game/node/entity/combat/equipment/WeaponInterface.java index a969f72be..78c7bdf86 100644 --- a/Server/src/main/java/core/game/node/entity/combat/equipment/WeaponInterface.java +++ b/Server/src/main/java/core/game/node/entity/combat/equipment/WeaponInterface.java @@ -464,6 +464,7 @@ public final class WeaponInterface extends Component { Component component = new Component(id); component.getDefinition().setTabIndex(0); component.getDefinition().setType(InterfaceType.TAB); + player.setAttribute("autocast_component",component); player.getInterfaceManager().openTab(component); } diff --git a/Server/src/main/java/core/game/node/entity/combat/spell/BindSpell.java b/Server/src/main/java/core/game/node/entity/combat/spell/BindSpell.java index 7c8e9b61d..322b156ce 100644 --- a/Server/src/main/java/core/game/node/entity/combat/spell/BindSpell.java +++ b/Server/src/main/java/core/game/node/entity/combat/spell/BindSpell.java @@ -110,14 +110,12 @@ public final class BindSpell extends CombatSpell { if (state.getEstimatedHit() == -1) { return; } - int tick = 0; + int tick = 9; if (getType() == SpellType.BIND) { state.setEstimatedHit(-2); } - if (state.getSpell().getSpellId() == 12) { - tick = 8; - } else if (state.getSpell().getSpellId() == 30) { - tick = 16; + if (state.getSpell().getSpellId() == 30) { + tick = 17; } else if (state.getSpell().getSpellId() == 56) { tick = 25; } diff --git a/Server/src/main/java/core/game/node/entity/player/link/SkullManager.java b/Server/src/main/java/core/game/node/entity/player/link/SkullManager.java index 60d0f3756..5a6ec9efa 100644 --- a/Server/src/main/java/core/game/node/entity/player/link/SkullManager.java +++ b/Server/src/main/java/core/game/node/entity/player/link/SkullManager.java @@ -76,6 +76,7 @@ public final class SkullManager { return; } skullCauses.add(o); + player.clearState("skull"); player.registerState("skull").init(); } diff --git a/Server/src/main/java/core/game/node/entity/skill/construction/HouseManager.java b/Server/src/main/java/core/game/node/entity/skill/construction/HouseManager.java index ed39f3893..c343257dd 100644 --- a/Server/src/main/java/core/game/node/entity/skill/construction/HouseManager.java +++ b/Server/src/main/java/core/game/node/entity/skill/construction/HouseManager.java @@ -267,6 +267,9 @@ public final class HouseManager { int diffX = player.getLocation().getX() - r.getBaseLocation().getX(); int diffY = player.getLocation().getY() - r.getBaseLocation().getY(); int diffZ = player.getLocation().getZ() - r.getBaseLocation().getZ(); + RegionManager.getRegionCache().remove(r); + region.flagInactive(); + dungeon.flagInactive(); region = null; dungeon = null; enter(player, buildingMode, false); @@ -378,7 +381,8 @@ public final class HouseManager { Region.load(from, true); RegionChunk defaultChunk = from.getPlanes()[style.getPlane()].getRegionChunk(1, 0); ZoneBorders borders = DynamicRegion.reserveArea(8, 8); - region = new DynamicRegion(-1, borders.getSouthWestX() >> 6, borders.getSouthWestY() >> 6); + //region = DynamicRegion.create(from.getRegionId()); + region = new DynamicRegion(from.getRegionId(), borders.getSouthWestX() >> 6, borders.getSouthWestY() >> 6); region.setBorders(borders); region.setUpdateAllPlanes(true); RegionManager.addRegion(region.getId(), region); diff --git a/Server/src/main/java/core/game/node/entity/skill/construction/HouseZone.java b/Server/src/main/java/core/game/node/entity/skill/construction/HouseZone.java index 9d578623d..fc630513b 100644 --- a/Server/src/main/java/core/game/node/entity/skill/construction/HouseZone.java +++ b/Server/src/main/java/core/game/node/entity/skill/construction/HouseZone.java @@ -3,6 +3,7 @@ package core.game.node.entity.skill.construction; import core.game.node.entity.Entity; import core.game.node.entity.player.Player; +import core.game.world.map.RegionManager; import core.game.world.map.zone.MapZone; import core.game.world.map.zone.ZoneRestriction; @@ -70,6 +71,11 @@ public final class HouseZone extends MapZone { if (e instanceof Player) { Player p = (Player) e; HouseManager.leave(p); + if(house.getRegion() == p.getHouseManager().getRegion()){ + house.getRegion().flagActive(); + house.getDungeonRegion().flagActive(); + RegionManager.getRegionCache().remove(house.getRegion()); + } return true; } } diff --git a/Server/src/main/java/core/game/node/entity/skill/thieving/PickableDoorHandler.java b/Server/src/main/java/core/game/node/entity/skill/thieving/PickableDoorHandler.java index 1ba80400d..a6e826b84 100644 --- a/Server/src/main/java/core/game/node/entity/skill/thieving/PickableDoorHandler.java +++ b/Server/src/main/java/core/game/node/entity/skill/thieving/PickableDoorHandler.java @@ -48,6 +48,7 @@ public class PickableDoorHandler extends OptionHandler { pickableDoors.add(new PickableDoor(new Location[]{Location.create(3190, 3957, 0)}, 32, 25, true)); pickableDoors.add(new PickableDoor(new Location[]{Location.create(2565, 3356, 0)}, 46, 37.5)); pickableDoors.add(new PickableDoor(new Location[]{Location.create(2579, 3286, 1)}, 61, 50)); + pickableDoors.add(new PickableDoor(new Location[]{Location.create(2579, 3307, 1)}, 61, 50)); pickableDoors.add(new PickableDoor(new Location[]{Location.create(3018, 3187, 0)}, 1, 0.0)); pickableDoors.add(new PickableDoor(new Location[]{Location.create(2601, 9482, 0)}, 82, 0.0, true)); return this; diff --git a/Server/src/main/java/core/game/world/map/zone/MapZone.java b/Server/src/main/java/core/game/world/map/zone/MapZone.java index 30efb7340..66d828336 100644 --- a/Server/src/main/java/core/game/world/map/zone/MapZone.java +++ b/Server/src/main/java/core/game/world/map/zone/MapZone.java @@ -245,7 +245,7 @@ public abstract class MapZone implements Zone { /** * Configures this map zone. */ - public abstract void configure(); + public void configure(){}; /** * Cleans items from a players inventory, equipment and bank. diff --git a/Server/src/main/kotlin/api/ContentAPI.kt b/Server/src/main/kotlin/api/ContentAPI.kt index 28dcd8de0..8322b0b57 100644 --- a/Server/src/main/kotlin/api/ContentAPI.kt +++ b/Server/src/main/kotlin/api/ContentAPI.kt @@ -25,6 +25,9 @@ import core.game.system.task.Pulse import core.game.world.map.Location import core.game.world.map.RegionManager import core.game.world.map.path.Pathfinder +import core.game.world.map.zone.MapZone +import core.game.world.map.zone.ZoneBorders +import core.game.world.map.zone.ZoneBuilder import core.game.world.update.flag.context.Animation import core.game.world.update.flag.context.Graphics import core.tools.RandomFunction @@ -956,8 +959,25 @@ object ContentAPI { */ @JvmStatic fun sendInputDialogue(player: Player, numeric: Boolean, prompt: String, handler: (value: Any) -> Unit){ - player.dialogueInterpreter.sendInput(!numeric, prompt) - player.setAttribute("runscript",handler) //Handled in RunScriptPacketHandler + if(numeric) sendInputDialogue(player, InputType.NUMERIC, prompt, handler) + else sendInputDialogue(player, InputType.STRING_SHORT, prompt, handler) + } + + /** + * Send input dialogues based on type. Some dialogues are special and can't be covered by the other sendInputDialogue method + * @param player the player to send the input dialogue to + * @param type the input type to send - an enum is available for this called InputType + * @param prompt what to prompt the player + * @param handler the method that handles the value from the input dialogue + */ + @JvmStatic + fun sendInputDialogue(player: Player, type: InputType, prompt: String, handler: (value: Any) -> Unit){ + when(type){ + InputType.NUMERIC, InputType.STRING_SHORT -> player.dialogueInterpreter.sendInput(type != InputType.NUMERIC, prompt) + InputType.STRING_LONG -> player.dialogueInterpreter.sendLongInput(prompt) + InputType.MESSAGE -> player.dialogueInterpreter.sendMessageInput(prompt) + } + player.setAttribute("runscript", handler) } /** @@ -1005,4 +1025,15 @@ object ContentAPI { fun sceneryDefinition(id: Int): SceneryDefinition{ return SceneryDefinition.forId(id) } + + /** + * Register a map zone + * @param zone the zone to register + * @param borders the ZoneBorders that compose the zone + */ + @JvmStatic + fun registerMapZone(zone: MapZone, borders: ZoneBorders){ + ZoneBuilder.configure(zone) + zone.register(borders) + } } \ No newline at end of file diff --git a/Server/src/main/kotlin/api/InputType.kt b/Server/src/main/kotlin/api/InputType.kt new file mode 100644 index 000000000..139060cfc --- /dev/null +++ b/Server/src/main/kotlin/api/InputType.kt @@ -0,0 +1,8 @@ +package api + +enum class InputType { + NUMERIC, + STRING_SHORT, + STRING_LONG, + MESSAGE +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/interaction/InteractionListeners.kt b/Server/src/main/kotlin/rs09/game/interaction/InteractionListeners.kt index 413ae4eea..ce32d75e9 100644 --- a/Server/src/main/kotlin/rs09/game/interaction/InteractionListeners.kt +++ b/Server/src/main/kotlin/rs09/game/interaction/InteractionListeners.kt @@ -2,6 +2,7 @@ package rs09.game.interaction import core.game.interaction.DestinationFlag import core.game.interaction.MovementPulse +import core.game.interaction.Option import core.game.node.Node import core.game.node.entity.player.Player import core.game.world.map.Location @@ -171,6 +172,8 @@ object InteractionListeners { else -> DestinationFlag.OBJECT } + if(player.zoneMonitor.interact(node, Option(option, 0))) return true + if(player.locks.isInteractionLocked) return false val method = get(id,type,option) ?: get(option,type) ?: return false diff --git a/Server/src/main/kotlin/rs09/game/interaction/object/VarrockGuardSignpost.kt b/Server/src/main/kotlin/rs09/game/interaction/object/VarrockGuardSignpost.kt new file mode 100644 index 000000000..8d212864c --- /dev/null +++ b/Server/src/main/kotlin/rs09/game/interaction/object/VarrockGuardSignpost.kt @@ -0,0 +1,33 @@ +package rs09.game.interaction.`object` + +import api.ContentAPI +import core.game.interaction.Option +import core.game.node.Node +import core.game.node.entity.Entity +import core.game.world.map.zone.MapZone +import core.game.world.map.zone.ZoneBorders +import rs09.game.interaction.InteractionListener + +class VarrockGuardSignpost : InteractionListener() { + override fun defineListeners() { + val zone = object : MapZone("Varrock Guards", true){ + var pickpocketCounter = 0 + override fun interact(e: Entity?, target: Node?, option: Option?): Boolean { + if(option != null && option.name.toLowerCase().contains("pickpocket") && target != null && target.name.toLowerCase().contains("guard")){ + pickpocketCounter++ + } + return false + } + } + + ContentAPI.registerMapZone(zone, ZoneBorders(3225,3445,3198,3471)) + ContentAPI.registerMapZone(zone, ZoneBorders(3222,3375,3199,3387)) + ContentAPI.registerMapZone(zone, ZoneBorders(3180,3420,3165,3435)) + ContentAPI.registerMapZone(zone, ZoneBorders(3280,3422,3266,3435)) + + on(31298, SCENERY, "read"){player, node -> + ContentAPI.sendDialogue(player, "Guards in the Varrock Palace are on full alert due to increasing levels of pickpocketing. So far today, ${zone.pickpocketCounter} guards have had their money pickpocketed in the palace or at the city gates.") + return@on true + } + } +} \ No newline at end of file diff --git a/Server/src/main/kotlin/rs09/game/node/entity/combat/CombatSwingHandler.kt b/Server/src/main/kotlin/rs09/game/node/entity/combat/CombatSwingHandler.kt index 1b1d5edd9..146453e8d 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/combat/CombatSwingHandler.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/combat/CombatSwingHandler.kt @@ -1,5 +1,6 @@ package rs09.game.node.entity.combat +import core.game.component.Component import core.game.container.Container import core.game.container.impl.EquipmentContainer import core.game.node.Node @@ -7,8 +8,7 @@ import core.game.node.entity.Entity import core.game.node.entity.combat.BattleState import core.game.node.entity.combat.CombatStyle import core.game.node.entity.combat.InteractionType -import core.game.node.entity.combat.equipment.ArmourSet -import core.game.node.entity.combat.equipment.DegradableEquipment +import core.game.node.entity.combat.equipment.* import core.game.node.entity.npc.NPC import core.game.node.entity.player.Player import core.game.node.entity.player.link.audio.Audio @@ -219,6 +219,20 @@ abstract class CombatSwingHandler(var type: CombatStyle?) { * @return `True` if so. */ open fun isAttackable(entity: Entity, victim: Entity): InteractionType? { + val comp = entity.getAttribute("autocast_component",null) as Component? + if((comp != null || type == CombatStyle.MAGIC) && (entity.properties.autocastSpell == null || entity.properties.autocastSpell.spellId == 0) && entity is Player){ + val weapEx = entity.getExtension(WeaponInterface::class.java) as WeaponInterface? + if(comp != null){ + entity.interfaceManager.close(comp) + entity.interfaceManager.openTab(weapEx) + entity.properties.combatPulse.stop() + entity.attack(victim) + entity.removeAttribute("autocast_component") + } + weapEx?.setAttackStyle(1) + weapEx?.updateInterface() + entity.debug("Adjusting attack style") + } if (entity.location == victim.location) { return if (entity.index < victim.index && victim.properties.combatPulse.getVictim() === entity) { InteractionType.STILL_INTERACT diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/CompostBin.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/CompostBin.kt index 887f047c5..f7a430719 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/CompostBin.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/CompostBin.kt @@ -1,6 +1,8 @@ package rs09.game.node.entity.skill.farming +import api.ContentAPI import core.game.node.entity.player.Player +import core.game.node.entity.skill.Skills import core.game.node.item.Item import core.tools.RandomFunction import org.json.simple.JSONArray @@ -44,6 +46,8 @@ class CompostBin(val player: Player, val bin: CompostBins) { isClosed = false } updateBit() + if(isSuperCompost) ContentAPI.rewardXP(player, Skills.FARMING, 8.5) + else ContentAPI.rewardXP(player, Skills.FARMING, 4.5) return Item(item) } diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/UseWithPatchHandler.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/UseWithPatchHandler.kt index be2ae30ab..1d45b2b70 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/UseWithPatchHandler.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/farming/UseWithPatchHandler.kt @@ -1,5 +1,6 @@ package rs09.game.node.entity.skill.farming +import api.ContentAPI import core.game.interaction.NodeUsageEvent import core.game.node.entity.skill.Skills import core.game.node.item.Item @@ -123,6 +124,7 @@ object UseWithPatchHandler{ override fun pulse(): Boolean { if(player.inventory.remove(event.usedItem,false)){ p.compost = if(usedItem.id == Items.SUPERCOMPOST_6034) CompostType.SUPER else CompostType.NORMAL + if(p.compost == CompostType.SUPER) ContentAPI.rewardXP(player, Skills.FARMING, 26.0) else ContentAPI.rewardXP(player, Skills.FARMING, 18.5) if(p.plantable != null){ p.harvestAmt += if(p.compost == CompostType.NORMAL) 1 else if(p.compost == CompostType.SUPER) 2 else 0 } diff --git a/Server/src/main/kotlin/rs09/game/node/entity/skill/skillcapeperks/SkillcapePerks.kt b/Server/src/main/kotlin/rs09/game/node/entity/skill/skillcapeperks/SkillcapePerks.kt index 3b7b5091f..12c75b817 100644 --- a/Server/src/main/kotlin/rs09/game/node/entity/skill/skillcapeperks/SkillcapePerks.kt +++ b/Server/src/main/kotlin/rs09/game/node/entity/skill/skillcapeperks/SkillcapePerks.kt @@ -110,6 +110,7 @@ enum class SkillcapePerks(val attribute: String, val effect: ((Player) -> Unit)? if(!isActive(this,player)){ player.setAttribute("/save:$attribute",true) } + player.debug("Activated ${this.name}") if(this == CONSTANT_GLOW) DarkZone.checkDarkArea(player) } diff --git a/Server/src/main/kotlin/rs09/game/system/command/sets/MiscCommandSet.kt b/Server/src/main/kotlin/rs09/game/system/command/sets/MiscCommandSet.kt index 94dc2bf74..f9142922b 100644 --- a/Server/src/main/kotlin/rs09/game/system/command/sets/MiscCommandSet.kt +++ b/Server/src/main/kotlin/rs09/game/system/command/sets/MiscCommandSet.kt @@ -1,6 +1,7 @@ package rs09.game.system.command.sets import api.ContentAPI +import api.InputType import core.cache.def.impl.ItemDefinition import core.cache.def.impl.NPCDefinition import core.cache.def.impl.SceneryDefinition @@ -201,7 +202,7 @@ class MiscCommandSet : CommandSet(Command.Privilege.ADMIN){ if (player.attributes.containsKey("replyTo")) { player.setAttribute("keepDialogueAlive", true) val replyTo = player.getAttribute("replyTo", "").replace("_".toRegex(), " ") - ContentAPI.sendInputDialogue(player, false ,StringUtils.formatDisplayName(replyTo)){value -> + ContentAPI.sendInputDialogue(player, InputType.MESSAGE ,StringUtils.formatDisplayName(replyTo)){ value -> CommunicationInfo.sendMessage(player, replyTo.toLowerCase(), value as String) player.removeAttribute("keepDialogueAlive") } diff --git a/Server/src/main/kotlin/rs09/game/system/config/NPCConfigParser.kt b/Server/src/main/kotlin/rs09/game/system/config/NPCConfigParser.kt index f7fef7961..88e5ece5c 100644 --- a/Server/src/main/kotlin/rs09/game/system/config/NPCConfigParser.kt +++ b/Server/src/main/kotlin/rs09/game/system/config/NPCConfigParser.kt @@ -255,6 +255,7 @@ NPCConfigParser { "aggressive", "poisonous", "poison_immune", + "facing_booth", "water_npc"-> configs.put(it.key.toString(), it.value.toString().toBoolean()) else -> SystemLogger.logWarn("Unhandled key for npc config: ${it.key.toString()}") } diff --git a/Server/src/main/kotlin/rs09/game/system/config/NPCSpawner.kt b/Server/src/main/kotlin/rs09/game/system/config/NPCSpawner.kt index 22cf9015d..69a11a2c3 100644 --- a/Server/src/main/kotlin/rs09/game/system/config/NPCSpawner.kt +++ b/Server/src/main/kotlin/rs09/game/system/config/NPCSpawner.kt @@ -31,6 +31,9 @@ class NPCSpawner { npc.isWalks = tokens[3].trim { it <= ' ' } == "1" npc.direction = Direction.values()[Integer.valueOf(tokens[4].trim { it <= ' ' })] npc.setAttribute("spawned:npc", true) + if(npc.definition.getConfiguration("facing_booth",false)){ + npc.setAttribute("facing_booth",true) + } npc.init() count++ } diff --git a/Server/src/main/kotlin/rs09/worker/MajorUpdateWorker.kt b/Server/src/main/kotlin/rs09/worker/MajorUpdateWorker.kt index 05a2eea46..79cf109fb 100644 --- a/Server/src/main/kotlin/rs09/worker/MajorUpdateWorker.kt +++ b/Server/src/main/kotlin/rs09/worker/MajorUpdateWorker.kt @@ -25,7 +25,7 @@ import kotlin.collections.ArrayList class MajorUpdateWorker { var started = false val sequence = UpdateSequence() - val sdf = SimpleDateFormat("HH") + val sdf = SimpleDateFormat("HHmm") fun start() = GlobalScope.launch { started = true while(true){