From f74c9f74ba8765d4a18876583c75dda172a6f04d Mon Sep 17 00:00:00 2001 From: Ceikry Date: Wed, 10 Mar 2021 20:59:50 -0600 Subject: [PATCH 1/3] magic carpet + save template fix --- .../content/dialogue/RugMerchantDialogue.java | 21 +++++++++++++++---- .../player/info/login/PlayerParser.java | 3 +++ .../entity/skill/agility/AgilityHandler.java | 11 +++++++--- .../system/command/sets/MiscCommandSet.kt | 2 ++ 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/Server/src/main/java/Server/core/game/content/dialogue/RugMerchantDialogue.java b/Server/src/main/java/Server/core/game/content/dialogue/RugMerchantDialogue.java index 4dcfc3a95..f271cb2f8 100644 --- a/Server/src/main/java/Server/core/game/content/dialogue/RugMerchantDialogue.java +++ b/Server/src/main/java/Server/core/game/content/dialogue/RugMerchantDialogue.java @@ -1,6 +1,7 @@ package core.game.content.dialogue; import core.cache.def.impl.NPCDefinition; +import core.game.container.impl.EquipmentContainer; import core.plugin.Initializable; import core.game.node.entity.skill.agility.AgilityHandler; import core.game.interaction.OptionHandler; @@ -14,6 +15,9 @@ import core.game.world.map.Location; import core.game.world.update.flag.context.Animation; import core.plugin.Plugin; import core.plugin.PluginManager; +import core.tools.Items; + +import static core.tools.stringtools.StringToolsKt.colorize; /** * The dialogue plugin used for the rug merchant. @@ -147,8 +151,12 @@ public final class RugMerchantDialogue extends DialoguePlugin { return; } destination = options.length == 1 ? options[0] : options[buttonId - 1]; - if (player.getInventory().remove(new Item(995, 200))) { - destination.travel(current, player); + if(player.getEquipment().get(EquipmentContainer.SLOT_WEAPON) != null){ + player.sendMessage(colorize("%RYou must unequip all your weapons before you can fly on a carpet.")); + } else { + if (player.getInventory().remove(new Item(995, 200))) { + destination.travel(current, player); + } } end(); break; @@ -272,6 +280,9 @@ public final class RugMerchantDialogue extends DialoguePlugin { player.lock(); player.getConfigManager().set(499, 0); player.getImpactHandler().setDisabledTicks(GameWorld.getTicks() + 200); + player.getInterfaceManager().hideTabs(0,1,2,3,4,5,6,7,8,9,10,11,12,13); + player.getEquipment().replace(new Item(Items.MAGIC_CARPET_5614),EquipmentContainer.SLOT_WEAPON); + player.getPacketDispatch().sendInterfaceConfig(548,69,true); GameWorld.getPulser().submit(new Pulse(1, player) { int count; int index; @@ -300,11 +311,13 @@ public final class RugMerchantDialogue extends DialoguePlugin { break; case 4: player.getConfigManager().set(499, 1); - player.animate(FLOATING_ANIMATION); break; case 200: break; case 901: + player.getEquipment().replace(null,EquipmentContainer.SLOT_WEAPON); + player.getInterfaceManager().restoreTabs(); + player.getPacketDispatch().sendInterfaceConfig(548,69,false); player.getImpactHandler().setDisabledTicks(0); player.unlock(); player.animate(new Animation(-1)); @@ -319,7 +332,7 @@ public final class RugMerchantDialogue extends DialoguePlugin { break; } if (index == 0 || player.getLocation().equals(locs[index - 1])) { - AgilityHandler.forceWalk(player, -1, player.getLocation(), locs[index++], FLOATING_ANIMATION, 40, 0.0, null); + AgilityHandler.walk(player,-1,player.getLocation(),locs[index++],null,0.0,null,true); } return false; } diff --git a/Server/src/main/java/Server/core/game/node/entity/player/info/login/PlayerParser.java b/Server/src/main/java/Server/core/game/node/entity/player/info/login/PlayerParser.java index 574bebeaa..613d4dbc4 100644 --- a/Server/src/main/java/Server/core/game/node/entity/player/info/login/PlayerParser.java +++ b/Server/src/main/java/Server/core/game/node/entity/player/info/login/PlayerParser.java @@ -30,6 +30,9 @@ public final class PlayerParser { if (JSON.exists()) { //parse the new JSON type. new PlayerSaveParser(player).parse(); } else { //Create new save + if(!(new File(ServerConstants.PLAYER_SAVE_PATH + "template/template.json")).exists()){ + return true; + } makeFromTemplate(player); new PlayerSaveParser(player).parse(); } diff --git a/Server/src/main/java/Server/core/game/node/entity/skill/agility/AgilityHandler.java b/Server/src/main/java/Server/core/game/node/entity/skill/agility/AgilityHandler.java index dab3c73f5..a57aacbb8 100644 --- a/Server/src/main/java/Server/core/game/node/entity/skill/agility/AgilityHandler.java +++ b/Server/src/main/java/Server/core/game/node/entity/skill/agility/AgilityHandler.java @@ -225,6 +225,10 @@ public final class AgilityHandler { }); } + public static void walk(final Player player, final int courseIndex, final Location start, final Location end, final Animation animation, final double experience, final String message){ + walk(player,courseIndex,start,end,animation,experience,message,false); + } + /** * Uses the walking queue to walk across an obstacle. * @param player The player. @@ -236,19 +240,19 @@ public final class AgilityHandler { * @param experience The agility experience. * @param message The message to send upon completion. */ - public static void walk(final Player player, final int courseIndex, final Location start, final Location end, final Animation animation, final double experience, final String message) { + public static void walk(final Player player, final int courseIndex, final Location start, final Location end, final Animation animation, final double experience, final String message, final boolean infiniteRun) { if (!player.getLocation().equals(start)) { player.getPulseManager().run(new MovementPulse(player, start) { @Override public boolean pulse() { - walk(player, courseIndex, start, end, animation, experience, message); + walk(player, courseIndex, start, end, animation, experience, message, infiniteRun); return true; } }, "movement"); return; } player.getWalkingQueue().reset(); - player.getWalkingQueue().addPath(end.getX(), end.getY(), true); + player.getWalkingQueue().addPath(end.getX(), end.getY(), !infiniteRun); int ticks = player.getWalkingQueue().getQueue().size(); player.getImpactHandler().setDisabledTicks(ticks); player.lock(1 + ticks); @@ -259,6 +263,7 @@ public final class AgilityHandler { if (animation != null) { player.getAppearance().setAnimations(animation); } + player.getSettings().setRunEnergy(100.0); GameWorld.getPulser().submit(new Pulse(ticks, player) { @Override public boolean pulse() { diff --git a/Server/src/main/java/Server/core/game/system/command/sets/MiscCommandSet.kt b/Server/src/main/java/Server/core/game/system/command/sets/MiscCommandSet.kt index 984a068d8..5ef218150 100644 --- a/Server/src/main/java/Server/core/game/system/command/sets/MiscCommandSet.kt +++ b/Server/src/main/java/Server/core/game/system/command/sets/MiscCommandSet.kt @@ -5,6 +5,7 @@ import core.cache.def.impl.ItemDefinition import core.cache.def.impl.ObjectDefinition import core.cache.def.impl.VarbitDefinition import core.game.component.Component +import core.game.container.impl.EquipmentContainer import core.game.node.`object`.GameObject import core.game.node.entity.player.info.Rights import core.game.node.entity.player.link.RunScript @@ -26,6 +27,7 @@ import core.game.ge.OfferState import core.game.node.entity.skill.Skills import core.game.node.entity.state.newsys.states.FarmingState import core.tools.Components +import core.tools.Items import core.tools.stringtools.colorize import java.awt.Toolkit import java.awt.datatransfer.StringSelection From 0b50bc5866619dfcd7d4a5ad05ad40863ed92b06 Mon Sep 17 00:00:00 2001 From: Ceikry Date: Wed, 10 Mar 2021 21:17:55 -0600 Subject: [PATCH 2/3] Corrected defence potion from marrentill base to ranarr --- .../core/game/node/entity/skill/herblore/FinishedPotion.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server/src/main/java/Server/core/game/node/entity/skill/herblore/FinishedPotion.java b/Server/src/main/java/Server/core/game/node/entity/skill/herblore/FinishedPotion.java index 573623d39..b0ddfeae8 100644 --- a/Server/src/main/java/Server/core/game/node/entity/skill/herblore/FinishedPotion.java +++ b/Server/src/main/java/Server/core/game/node/entity/skill/herblore/FinishedPotion.java @@ -12,7 +12,7 @@ public enum FinishedPotion { STRENGTH_POTION(UnfinishedPotion.TARROMIN, new Item(225), 12, 50, new Item(115)), RESTORE_POTION(UnfinishedPotion.HARRALANDER, new Item(223), 22, 62.5, new Item(127)), ENERGY_POTION(UnfinishedPotion.HARRALANDER, new Item(1975), 26, 67.5, new Item(3010)), - DEFENCE_POTION(UnfinishedPotion.MARRENTILL, new Item(6814), 30, 45, new Item(133)), + DEFENCE_POTION(UnfinishedPotion.RANARR, new Item(6814), 30, 45, new Item(133)), AGILITY_POTION(UnfinishedPotion.TOADFLAX, new Item(2152), 34, 80, new Item(3034)), COMBAT_POTION(UnfinishedPotion.HARRALANDER, new Item(9736), 36, 84, new Item(9741)), PRAYER_POTION(UnfinishedPotion.RANARR, new Item(231), 38, 87.5, new Item(139)), From a99350948c07fefddc689dacdcbcd5ddaadb5f27 Mon Sep 17 00:00:00 2001 From: Ceikry Date: Wed, 10 Mar 2021 21:38:20 -0600 Subject: [PATCH 3/3] empty antipoisons :DDD --- .../Server/core/game/interaction/item/EmptyOptionPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server/src/main/java/Server/core/game/interaction/item/EmptyOptionPlugin.java b/Server/src/main/java/Server/core/game/interaction/item/EmptyOptionPlugin.java index a31bd7543..5093dfd90 100644 --- a/Server/src/main/java/Server/core/game/interaction/item/EmptyOptionPlugin.java +++ b/Server/src/main/java/Server/core/game/interaction/item/EmptyOptionPlugin.java @@ -21,7 +21,7 @@ public final class EmptyOptionPlugin extends OptionHandler { public static final String BUCKET_EMPTY_MSG = "You empty the contents of the bucket onto the floor."; @Override public boolean handle(Player player, Node node, String option) { - if (node.getName().contains("potion")) { + if (node.getName().contains("potion") || node.getName().toLowerCase().contains("antipoison")) { player.getInventory().remove(node.asItem()); player.getInventory().add(EmptyItem.getEmpty(91)); return true;