From daf312ce6beb21712e4b3020a13965fae3de0df3 Mon Sep 17 00:00:00 2001 From: randy Date: Wed, 12 Mar 2025 08:31:22 -0600 Subject: [PATCH] Fixes related to ironman mode and exp rates Default exp rate is now 1.0, Restored the option to select 10x (no longer limited to hardcore ironmen) Restored option to select hardcore ironman mode. Permadeath now properly clears the custom satchels. Ironmen can no longer trade (custom feature allow untradebale items to be traded was allowing ironmen to trade all items with a warning) Implemented option to select Boosted mode --- .../dialogue/TutorialMagicTutorDialogue.kt | 36 +++++++++++++++---- Server/src/main/core/api/utils/Permadeath.kt | 8 +++++ .../player/info/login/PlayerSaveParser.kt | 2 ++ .../link/request/trade/TradeContainer.java | 12 +++++-- .../core/game/node/entity/skill/Skills.java | 2 +- Server/worldprops/default.conf | 5 +-- 6 files changed, 52 insertions(+), 13 deletions(-) diff --git a/Server/src/main/content/region/misc/tutisland/dialogue/TutorialMagicTutorDialogue.kt b/Server/src/main/content/region/misc/tutisland/dialogue/TutorialMagicTutorDialogue.kt index a92d70916..540382e1f 100644 --- a/Server/src/main/content/region/misc/tutisland/dialogue/TutorialMagicTutorDialogue.kt +++ b/Server/src/main/content/region/misc/tutisland/dialogue/TutorialMagicTutorDialogue.kt @@ -93,11 +93,12 @@ class TutorialMagicTutorDialogue(player: Player? = null) : core.game.dialogue.Di } } 71 -> when(stage){ - 0 -> options("Set Ironman Mode (current: ${player.ironmanManager.mode.name})", "Change XP Rate (current: ${player.skills.experienceMultiplier}x)", "I'm ready now.").also { stage++ } + 0 -> options("Set Ironman Mode (current: ${player.ironmanManager.mode.name})", "Change XP Rate (current: ${player.skills.experienceMultiplier}x)", "Toggle Boosted mode (current: ${if (getAttribute(player, "snowscape:boostedmode", false)) "Enabled" else "Disabled"})", "I'm ready now.").also { stage++ } 1 -> when(buttonId){ - 1 -> options("None","Standard","Ultimate","Nevermind.").also { stage = 10 } - 2 -> options("1.0x","2.5x","5.0x").also { stage = 20 } - 3 -> npcl(core.game.dialogue.FacialExpression.FRIENDLY, "Well, you're all finished here now. I'll give you a reasonable number of starting items when you leave.").also { stage = 30 } + 1 -> options("None","Standard (No trading)","Ultimate (No trading and no bank)","Hardcore (No trading and PERMADEATH!)","Nevermind.").also { stage = 10 } + 2 -> options("1.0x","2.5x","5.0x","10.0x").also { stage = 20 } + 3 -> options("Enable", "Disable").also { stage = 25 } + 4 -> npcl(core.game.dialogue.FacialExpression.FRIENDLY, "Well, you're all finished here now. I'll give you a reasonable number of starting items when you leave.").also { stage = 30 } } 10 -> { @@ -109,12 +110,15 @@ class TutorialMagicTutorDialogue(player: Player? = null) : core.game.dialogue.Di 0 -> IronmanMode.NONE 1 -> IronmanMode.STANDARD 2 -> IronmanMode.ULTIMATE + 3 -> IronmanMode.HARDCORE else -> IronmanMode.NONE } if (mode != IronmanMode.NONE) stage = 11 player.dialogueInterpreter.sendDialogue("You set your ironman mode to: ${mode.name}.") player.ironmanManager.mode = mode +/* if (player.skills.experienceMultiplier == 10.0) player.skills.experienceMultiplier = 5.0 +*/ } else { @@ -124,19 +128,32 @@ class TutorialMagicTutorDialogue(player: Player? = null) : core.game.dialogue.Di 11 -> player.dialogueInterpreter.sendPlainMessage(false, *splitLines("WARNING: You have selected an ironman mode. This is an uncompromising mode that WILL completely restrict your ability to trade. This MAY leave you unable to complete certain content, including quests.")).also { stage = 0 } 20 -> { - val rates = arrayOf(1.0,2.5,5.0) + val rates = arrayOf(1.0,2.5,5.0,10.0) val rate = rates[buttonId - 1] +/* if(rate == 10.0) { player.dialogueInterpreter.sendDialogue("10.0x is no longer available!") player.skills.experienceMultiplier = 5.0 stage = 0 return true } +*/ player.dialogueInterpreter.sendDialogue("You set your XP rate to: ${rate}x.") player.skills.experienceMultiplier = rate stage = 0 } + 25 -> { + when(buttonId) { + 1 -> setAttribute(player, "/save:snowscape:boostedmode", true) + 2 -> removeAttribute(player, "snowscape:boostedmode") + } + val currentMode = getAttribute(player, "snowscape:boostedmode", false) + //setAttribute(player, "/save:snowscape:boostedmode", !currentMode) + player.dialogueInterpreter.sendPlainMessage(false, *splitLines("You have ${if (currentMode) "Enabled" else "Disabled"} Boosted mode. Boosted mode makes some custom features much more powerful, which will bypass many game-balance obstacles and lead to easier progression. Not recommended if you want a more traditional experience.")).also { stage = 0 } + + } + 30 -> player.dialogueInterpreter.sendOptions("Leave Tutorial Island?", "Yes, I'm ready.", "No, not yet.").also { stage++ } 31 -> when(buttonId) { @@ -148,7 +165,7 @@ class TutorialMagicTutorDialogue(player: Player? = null) : core.game.dialogue.Di setAttribute(player, "/save:tutorial:complete", true) setVarbit(player, 3756, 0) setVarp(player, 281, 1000, true) - teleport(player, Location.create(3233, 3230), TeleportManager.TeleportType.NORMAL) + teleport(player, ServerConstants.HOME_LOCATION!!, TeleportManager.TeleportType.NORMAL) closeOverlay(player) player.inventory.clear() @@ -159,10 +176,15 @@ class TutorialMagicTutorDialogue(player: Player? = null) : core.game.dialogue.Di player.inventory.add(*STARTER_PACK) player.bank.add(*STARTER_BANK) + if(player.ironmanManager.mode == IronmanMode.HARDCORE){ + setAttribute(player, "/save:permadeath", true) + } +/* if(player.skills.experienceMultiplier == 10.0) { player.skills.experienceMultiplier = 5.0 } +*/ //This overwrites the stuck dialogue after teleporting to Lumbridge for some reason //Dialogue from 2007 or thereabouts @@ -182,7 +204,7 @@ class TutorialMagicTutorDialogue(player: Player? = null) : core.game.dialogue.Di player.unhook(TutorialUseWithReceiver) player.unhook(TutorialInteractionReceiver) player.unhook(TutorialButtonReceiver) - RulesAndInfo.openFor(player) + //RulesAndInfo.openFor(player) if (GameWorld.settings!!.enable_default_clan) { player.communication.currentClan = ServerConstants.SERVER_NAME.toLowerCase() diff --git a/Server/src/main/core/api/utils/Permadeath.kt b/Server/src/main/core/api/utils/Permadeath.kt index c7e5069f4..1e7f13e9f 100644 --- a/Server/src/main/core/api/utils/Permadeath.kt +++ b/Server/src/main/core/api/utils/Permadeath.kt @@ -42,6 +42,14 @@ fun permadeath(target: Player) { target.saveVarp.clear() target.timers.clearTimers() + //Snowscape custom data + target.plainSatchel.clear() + target.greenSatchel.clear() + target.redSatchel.clear() + target.goldSatchel.clear() + target.runeSatchel.clear() + target.blackSatchel.clear() + // Skills target.skills = Skills(target) diff --git a/Server/src/main/core/game/node/entity/player/info/login/PlayerSaveParser.kt b/Server/src/main/core/game/node/entity/player/info/login/PlayerSaveParser.kt index 4f9d57e44..cb0e151f4 100644 --- a/Server/src/main/core/game/node/entity/player/info/login/PlayerSaveParser.kt +++ b/Server/src/main/core/game/node/entity/player/info/login/PlayerSaveParser.kt @@ -331,6 +331,7 @@ class PlayerSaveParser(val player: Player) { player.skills.parse(skillData) player.skills.experienceGained = saveFile!!["totalEXP"].toString().toDouble() player.skills.experienceMultiplier = saveFile!!["exp_multiplier"].toString().toDouble() +/* Snowscape: removing this function since it causes the default exp rate to override player selection, and not allow 10x or higher multipliers if (GameWorld.settings?.default_xp_rate != 5.0) { player.skills.experienceMultiplier = GameWorld.settings?.default_xp_rate!! } @@ -339,6 +340,7 @@ class PlayerSaveParser(val player: Player) { divisor = player.skills.experienceMultiplier / 5.0 player.skills.correct(divisor) } +*/ if (saveFile!!.containsKey("milestone")) { val milestone: JSONObject = saveFile!!["milestone"] as JSONObject player.skills.combatMilestone = (milestone.get("combatMilestone")).toString().toInt() diff --git a/Server/src/main/core/game/node/entity/player/link/request/trade/TradeContainer.java b/Server/src/main/core/game/node/entity/player/link/request/trade/TradeContainer.java index f71eafabc..b2ce8da3a 100644 --- a/Server/src/main/core/game/node/entity/player/link/request/trade/TradeContainer.java +++ b/Server/src/main/core/game/node/entity/player/link/request/trade/TradeContainer.java @@ -49,9 +49,8 @@ public final class TradeContainer extends Container { return; } if (!tradeable(item) && !GameWorld.getSettings().isDevMode()) { - player.getPacketDispatch().sendMessage("This item is not normally tradeable. Be careful not to break any quests!"); //player.getPacketDispatch().sendMessage("You can't trade this item."); - //return; + return; } Item remove = new Item(item.getId(), amount); remove.setAmount(stabalizeAmount(remove, amount, player.getInventory())); @@ -167,8 +166,10 @@ public final class TradeContainer extends Container { return true; } if (player.getIronmanManager().isIronman() || target != null && target.getIronmanManager().isIronman()) { + sendMessage(player,"Cannot trade that item to or from an Ironman."); return false; } +/* Snowscape: removing this section. Not that we use bots, but the IP for every account is 0.0.0.0 so it fails the check every time) if ((playerIsBot || targetIsBot) && (playerIP.equals(targetIP) || playerMac.equals(targetMac) || playerHost.equals(targetHost))){ sendMessage(player, colorize("%RYou can not trade items with your own bot accounts.")); return false; @@ -176,7 +177,12 @@ public final class TradeContainer extends Container { if (item.getName().equals("Coins") && item.getId() != 995) { return false; } - return definition.isTradeable(); +*/ + if (!definition.isTradeable()) { + sendMessage(player, "This item is not normally tradeable. Be careful not to break any quests!"); + } + return true; + //return definition.isTradeable(); } /** 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 a97be4b00..d94ccebb1 100644 --- a/Server/src/main/core/game/node/entity/skill/Skills.java +++ b/Server/src/main/core/game/node/entity/skill/Skills.java @@ -41,7 +41,7 @@ public final class Skills { /** * Represents the constant modifier of experience. */ - public double experienceMultiplier = 5.0; + public double experienceMultiplier = 1.0; /** * The maximum experience multiplier. diff --git a/Server/worldprops/default.conf b/Server/worldprops/default.conf index 37ca25c6c..511ab41c6 100644 --- a/Server/worldprops/default.conf +++ b/Server/worldprops/default.conf @@ -58,8 +58,9 @@ members = true #activity as displayed on the world list activity = "SnowScape" pvp = false -#any default_xp_rate other than 5.0 will override player selection -default_xp_rate = 5.0 +#Snowscape: this used to force player xp rate to match this number if set to anything other than 5.0, but that has been disabled +#now it does nothing, as the default exp rate is actually set by Skills.java when a new player is created. +default_xp_rate = 1.0 allow_slayer_reroll = false #enables a default clan for players to join automatically. Should be an account with the same name as @name, with a clan set up already. enable_default_clan = true