From 718d7e39e148d91cd55cad64fbd8b74c131f1ca1 Mon Sep 17 00:00:00 2001 From: randy Date: Wed, 5 Feb 2025 21:32:27 -0700 Subject: [PATCH 1/3] Cracking safes the the Rogue's Den now repeats The repetition will stop if you move away, get low health, or run out of inventory space. --- .../handlers/scenery/ThievingGuidePlugin.java | 40 ++++++++++++------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/Server/src/main/content/global/handlers/scenery/ThievingGuidePlugin.java b/Server/src/main/content/global/handlers/scenery/ThievingGuidePlugin.java index 71efac4a5..4d306fc5e 100644 --- a/Server/src/main/content/global/handlers/scenery/ThievingGuidePlugin.java +++ b/Server/src/main/content/global/handlers/scenery/ThievingGuidePlugin.java @@ -81,24 +81,33 @@ public class ThievingGuidePlugin extends OptionHandler { player.getDialogueInterpreter().sendDialogues(2266, null, "And where do you think you're going? A little too eager", "I think. Come and talk to me before you go wandering", "around in there."); break; case "crack": - if (player.getSkills().getLevel(Skills.THIEVING) < 50) { - player.getPacketDispatch().sendMessage("You need to be level " + level + " thief to crack this safe."); - return true; - } - if (player.getInventory().freeSlots() == 0) { - player.getPacketDispatch().sendMessage("Not enough inventory space."); - return true; - } - final boolean success = success(player, Skills.THIEVING); - player.lock(4); - player.getPacketDispatch().sendMessage("You start cracking the safe."); - player.animate(animations[success ? 1 : 0]); + GameWorld.getPulser().submit(new Pulse(3, player) { @Override public boolean pulse() { + if (player.getSkills().getLevel(Skills.THIEVING) < 50) { + player.getPacketDispatch().sendMessage("You need to be level " + level + " thief to crack this safe."); + return true; + } + if (player.getInventory().freeSlots() == 0) { + player.getPacketDispatch().sendMessage("Not enough inventory space."); + return true; + } + if (player.getSkills().getLifepoints() <= 6) { + player.getPacketDispatch().sendMessage("You're too injured to be dealing with traps right now."); + return true; + } + if (player.getLocation().getDistance(node.getLocation()) >= 1) { + return true; + } + + final boolean success = success(player, Skills.THIEVING); + //player.lock(4); + player.getPacketDispatch().sendMessage("You start cracking the safe."); + player.animate(animations[success ? 1 : 0]); if (success) { handleSuccess(player, (Scenery) node); - return true; + return false; } final boolean trapped = RandomFunction.random(3) == 1; if (trapped) { @@ -109,11 +118,12 @@ public class ThievingGuidePlugin extends OptionHandler { @Override public boolean pulse() { player.animate(new Animation(-1, Priority.HIGH)); - return true; + return false; } }); } - return true; + + return false; } }); break; From 8e822234fb014479da82d10274e082ec56c5b095 Mon Sep 17 00:00:00 2001 From: randy Date: Fri, 7 Feb 2025 16:40:10 -0700 Subject: [PATCH 2/3] Implemented shared banks aka clan banks Players can talk to a banker to enable clan banks. When enabled, any banking function will use the primary bank of the owner of the clan chat the player is in. This only works while the bank owner is online; if they are offline the player will fallback to their own bank. --- .../content/global/dialogue/BankerDialogue.kt | 60 +++++++++++++++---- .../game/container/impl/BankContainer.java | 20 +++++++ .../core/game/node/entity/player/Player.java | 11 +++- 3 files changed, 78 insertions(+), 13 deletions(-) diff --git a/Server/src/main/content/global/dialogue/BankerDialogue.kt b/Server/src/main/content/global/dialogue/BankerDialogue.kt index e913ce4f0..7b857da7d 100644 --- a/Server/src/main/content/global/dialogue/BankerDialogue.kt +++ b/Server/src/main/content/global/dialogue/BankerDialogue.kt @@ -45,18 +45,7 @@ class BankerDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin 2 -> showTopics( Topic(core.game.dialogue.FacialExpression.FRIENDLY, "I'd like to access my bank account, please.", 10), - IfTopic( - core.game.dialogue.FacialExpression.FRIENDLY, - "I'd like to switch to my ${getBankAccountName(player, true)} bank account.", - 13, - hasActivatedSecondaryBankAccount(player) - ), - IfTopic( - core.game.dialogue.FacialExpression.FRIENDLY, - "I'd like to open a secondary bank account.", - 20, - !hasActivatedSecondaryBankAccount(player) - ), + Topic(core.game.dialogue.FacialExpression.FRIENDLY, "I'd like to switch my default bank account.", 7), Topic(core.game.dialogue.FacialExpression.FRIENDLY, "I'd like to check my PIN settings.", 11), Topic(core.game.dialogue.FacialExpression.FRIENDLY, "I'd like to collect items.", 12), Topic(core.game.dialogue.FacialExpression.ASKING, "What is this place?", 3), @@ -78,6 +67,53 @@ class BankerDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin "Leave your valuables with us if you want to keep them safe." ).also { stage = END_DIALOGUE } + 7 -> showTopics( + IfTopic( + core.game.dialogue.FacialExpression.FRIENDLY, + "I'd like to turn on the Clan bank, please.", + 8, + !(player.getAttribute("clanbank:enabled",false)) + ), + IfTopic( + core.game.dialogue.FacialExpression.FRIENDLY, + "I'd like to turn off the Clan bank, please.", + 9, + player.getAttribute("clanbank:enabled",false) + ), + IfTopic( + core.game.dialogue.FacialExpression.FRIENDLY, + "I'd like to switch to my ${getBankAccountName(player, true)} bank account.", + 13, + hasActivatedSecondaryBankAccount(player) + ), + IfTopic( + core.game.dialogue.FacialExpression.FRIENDLY, + "I'd like to open a secondary bank account.", + 20, + !hasActivatedSecondaryBankAccount(player) + ), + ) + + 8 -> { + player.setAttribute("/save:clanbank:enabled", true) + + npcl( + core.game.dialogue.FacialExpression.FRIENDLY, + "The Clan bank has been enabled. " + + "If the Clan owner is online, you will access their primary bank account instead of your own." + ).also { stage = 2 } + } + + 9 -> { + player.removeAttribute("clanbank:enabled") + + npcl( + core.game.dialogue.FacialExpression.FRIENDLY, + "The Clan bank has been disabled. " + + "You will now always open your personal bank account." + ).also { stage = 2 } + } + 10 -> { openBankAccount(player) end() diff --git a/Server/src/main/core/game/container/impl/BankContainer.java b/Server/src/main/core/game/container/impl/BankContainer.java index f8f994d4d..42421e0eb 100644 --- a/Server/src/main/core/game/container/impl/BankContainer.java +++ b/Server/src/main/core/game/container/impl/BankContainer.java @@ -43,6 +43,11 @@ public final class BankContainer extends Container { */ private Player player; + /** + * Snowscape. The player reference. + */ + private Player owner; + /** * The bank listener. */ @@ -76,6 +81,7 @@ public final class BankContainer extends Container { super(SIZE, ContainerType.ALWAYS_STACK, SortType.HASH); super.register(listener = new BankListener(player)); this.player = player; + this.owner = player; } /** @@ -110,6 +116,18 @@ public final class BankContainer extends Container { ); } + /** + * Snowscape custom. Sets the current player. Used for clan banks. + * @param newplayer The new player assigned to the bank. + */ + public void setPlayer(Player newPlayer) { + // Only modify if the bank is not open, otherwise the player who is accessing it will suddenly be unable to deposit/withdraw + if (!isOpen()) { + this.player = newPlayer; + this.listener.player = newPlayer; + } + } + /** * Open the bank. */ @@ -195,6 +213,8 @@ public final class BankContainer extends Container { player.getInterfaceManager().closeSingleTab(); player.removeAttribute("search"); player.getPacketDispatch().sendRunScript(571, ""); + //Snowscape. Set the player back to the owner of the account. + setPlayer(this.owner); } /** diff --git a/Server/src/main/core/game/node/entity/player/Player.java b/Server/src/main/core/game/node/entity/player/Player.java index a23d472c7..8a09b46ac 100644 --- a/Server/src/main/core/game/node/entity/player/Player.java +++ b/Server/src/main/core/game/node/entity/player/Player.java @@ -1048,11 +1048,20 @@ public class Player extends Entity { return equipment; } - /** + /** Snowscape modifications: Added check for clan bank * Gets the current active bank. * @return Current active bank. */ public BankContainer getBank() { + if (getAttribute("clanbank:enabled",false)) { + Player target = Repository.getPlayerByName(this.getCommunication().getCurrentClan()); + if (target != null) { + target.getBankPrimary().setPlayer(this); + return target.getBankPrimary(); + } + } + //The primary bank.player is changed back to the owner when a player closes it, but if something else, like dialogue, runs a getbank() function then it's never changed back. So this manually changes it when checking our own bank. + bank.setPlayer(this); return useSecondaryBank ? bankSecondary : bank; } From 389c5858d04a57cc2cc2147d4c0c7543b03d9645 Mon Sep 17 00:00:00 2001 From: randy Date: Tue, 11 Feb 2025 10:23:06 -0700 Subject: [PATCH 3/3] Reverting sliding scale exp multiplier Reverting manually instead of doing a git revert because this version of gitea has an error when attempting reverts. I still like how it reduced the early game boost, however it has some disadvantages. It's impossible to calculate the needed number of actions for a certain level, quest and minigame rewards get more valuable the longer you put them off, and some skills have no early game content and are a bit of a slog. Setting it back to a static multiplier. --- Server/src/main/core/game/node/entity/skill/Skills.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Server/src/main/core/game/node/entity/skill/Skills.java b/Server/src/main/core/game/node/entity/skill/Skills.java index fc3ed9191..482d2e12f 100644 --- a/Server/src/main/core/game/node/entity/skill/Skills.java +++ b/Server/src/main/core/game/node/entity/skill/Skills.java @@ -290,12 +290,7 @@ public final class Skills { private double getExperienceMod(int slot, double experience, boolean playerMod, boolean multiplyer) { //Keywords for people ctrl + Fing the project //xprate xp rate xp multiplier skilling rate - - //Snowscape Custom: experience multiplier starts at 1x and scales to the selected multiplier as level incrceases - double perLevel = (experienceMultiplier-1)/100; - double finalMult = staticLevels[slot]*perLevel+1; - return finalMult; - //return experienceMultiplier; + return experienceMultiplier; /*if (!(entity instanceof Player)) { return 1.0;