diff --git a/Server/src/main/content/global/handlers/iface/RulesAndInfo.kt b/Server/src/main/content/global/handlers/iface/RulesAndInfo.kt index 2004766..023d86b 100644 --- a/Server/src/main/content/global/handlers/iface/RulesAndInfo.kt +++ b/Server/src/main/content/global/handlers/iface/RulesAndInfo.kt @@ -8,12 +8,12 @@ import core.game.interaction.InterfaceListener object RulesAndInfo { val RULES = arrayOf( "1. Basically just don't be an asshole", - " -No spamming, harassment, or other disruptive behaviors", - " behaviors disruptive behaviors", + " -No spamming, harassment, or other", + " disruptive behaviors", "2. No exploitation of bugs.", " -Zero tolerance. Can result in account deletion.", " -If you discover a bug, report it to Emo/admins.", - "3. Do not discuss or advertise.", + "3. Discuss or Advertising.", " -Discussion of the live jagex games is fine.", " -Discussion of open source projects is fine.", " -No advertising of non-open source RSPSs.", 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 a92d709..1e48f2d 100644 --- a/Server/src/main/content/region/misc/tutisland/dialogue/TutorialMagicTutorDialogue.kt +++ b/Server/src/main/content/region/misc/tutisland/dialogue/TutorialMagicTutorDialogue.kt @@ -1,22 +1,22 @@ package content.region.misc.tutisland.dialogue -import content.global.handlers.iface.RulesAndInfo import content.region.misc.tutisland.handlers.* -import core.ServerConstants import core.api.* import core.game.node.entity.npc.NPC import core.game.node.entity.player.Player import core.game.node.entity.player.link.IronmanMode import core.game.node.entity.player.link.TeleportManager import core.game.node.item.Item -import core.game.world.GameWorld import core.game.world.map.Location import core.plugin.Initializable -import core.tools.END_DIALOGUE -import core.worker.ManagementEvents import org.rs09.consts.Items import org.rs09.consts.NPCs import proto.management.JoinClanRequest +import core.ServerConstants +import content.global.handlers.iface.RulesAndInfo +import core.game.world.GameWorld +import core.tools.END_DIALOGUE +import core.worker.ManagementEvents /** * Handles the magic tutor's dialogue @@ -44,20 +44,29 @@ class TutorialMagicTutorDialogue(player: Player? = null) : core.game.dialogue.Di Item(557, 4), Item(559, 2) ) - private val STARTER_BANK = arrayOf(Item(995, 25)) - + private val STARTER_BANK = arrayOf(Item(995, 2500)) + // Helper function to convert a numeric XP rate to a descriptive string. + private fun xpRateText(rate: Double): String { + return when(rate) { + 1.0 -> "Normal (100%)" + 2.5 -> "2.5x" + 5.0 -> "5x" + 10.0 -> "10x" + 0.1 -> "Scale up to 10x at level 99" + 0.2 -> "Scale up to 5x at level 99" + else -> "${rate}x" + } + } override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin { return TutorialMagicTutorDialogue(player) } override fun open(vararg args: Any?): Boolean { npc = args[0] as NPC - when(getAttribute(player, "tutorial:stage", 0)) - { + when(getAttribute(player, "tutorial:stage", 0)) { 67 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "Hello.") 69 -> npcl(core.game.dialogue.FacialExpression.FRIENDLY, "Good. This is a list of your spells. Currently you can only cast one offensive spell called Wind Strike. Let's try it out on one of those chickens.") - 70 -> if(!inInventory(player, Items.AIR_RUNE_556) && !inInventory(player, Items.MIND_RUNE_558)) - { + 70 -> if(!inInventory(player, Items.AIR_RUNE_556) && !inInventory(player, Items.MIND_RUNE_558)) { player.dialogueInterpreter.sendDoubleItemMessage(Items.AIR_RUNE_556, Items.MIND_RUNE_558, "You receive some spare runes.") addItem(player, Items.AIR_RUNE_556, 15) addItem(player, Items.MIND_RUNE_558, 15) @@ -70,8 +79,7 @@ class TutorialMagicTutorDialogue(player: Player? = null) : core.game.dialogue.Di } override fun handle(interfaceId: Int, buttonId: Int): Boolean { - when(getAttribute(player, "tutorial:stage", 0)) - { + when(getAttribute(player, "tutorial:stage", 0)) { 67 -> when(stage++){ 0 -> npcl(core.game.dialogue.FacialExpression.FRIENDLY, "Good day, newcomer. My name is Terrova. I'm here to tell you about Magic. Let's start by opening your spell list.") 1 -> { @@ -92,43 +100,45 @@ class TutorialMagicTutorDialogue(player: Player? = null) : core.game.dialogue.Di TutorialStage.load(player, 70) } } - 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++ } - 1 -> when(buttonId){ - 1 -> options("None","Standard","Ultimate","Nevermind.").also { stage = 10 } - 2 -> options("1.0x","2.5x","5.0x").also { stage = 20 } + 71 -> when(stage) { + 0 -> options( + "Set Ironman Mode (current: ${player.ironmanManager.mode.name})", + "Change XP Rate (current: ${xpRateText(player.skills.experienceMultiplier)})", + "I'm ready now." + ).also { stage++ } + 1 -> when(buttonId) { + 1 -> options("None", "Standard", "Hardcore (Permadeath!)", "Ultimate", "Nevermind.").also { stage = 10 } + 2 -> options("Flat XP Rate Multiplier", "Scaled XP Rate Multiplier", "Back").also { stage = 21 } 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 } } - + // Modified submenu branch for XP rate options + 21 -> when(buttonId) { + 1 -> options("1.0x", "2.5x", "5.0x", "10x").also { stage = 22 } + 2 -> options("1.0x", "Scale to 10x", "Scale to 5x").also { stage = 23 } + 3 -> options( + "Set Ironman Mode (current: ${player.ironmanManager.mode.name})", + "Change XP Rate (current: ${xpRateText(player.skills.experienceMultiplier)})", + "I'm ready now." + ).also { stage = 1 } + else -> return false + } 10 -> { stage = 0 - if(buttonId < 5) - { - val mode = when (buttonId - 1) - { - 0 -> IronmanMode.NONE - 1 -> IronmanMode.STANDARD - 2 -> IronmanMode.ULTIMATE - else -> IronmanMode.NONE - } - if (mode != IronmanMode.NONE) stage = 11 + if(buttonId < 5) { + val mode = IronmanMode.values()[buttonId - 1] 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 - { + if (player.skills.experienceMultiplier == 10.0 && mode != IronmanMode.HARDCORE) + player.skills.experienceMultiplier = 5.0 + } else { handle(interfaceId, 0) } } - 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) + 22 -> { + 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 + if(rate == 10.0 && player.ironmanManager.mode != IronmanMode.HARDCORE) { + player.dialogueInterpreter.sendDialogue("10.0x is only available to Hardcore Ironmen!") stage = 0 return true } @@ -136,14 +146,24 @@ class TutorialMagicTutorDialogue(player: Player? = null) : core.game.dialogue.Di player.skills.experienceMultiplier = rate stage = 0 } - + 23 -> { + val rates = arrayOf(1.0, 0.1, 0.2) + val rate = rates[buttonId - 1] + if(rate == 0.1) { + player.dialogueInterpreter.sendDialogue("You set your XP rate to scale to be 10x at level 99.") + } else if (rate == 0.2) { + player.dialogueInterpreter.sendDialogue("You set your XP rate to scale to be 5x at level 99.") + } else { + player.dialogueInterpreter.sendDialogue("You set your XP rate to: ${rate}x.") + } + player.skills.experienceMultiplier = rate + stage = 0 + } 30 -> player.dialogueInterpreter.sendOptions("Leave Tutorial Island?", "Yes, I'm ready.", "No, not yet.").also { stage++ } - 31 -> when(buttonId) - { + 31 -> when(buttonId) { 1 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "I'm ready to go now, thank you.").also { stage = 40 } 2 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "I'm not quite ready to go yet, thank you.").also { stage = END_DIALOGUE } } - 40 -> { setAttribute(player, "/save:tutorial:complete", true) setVarbit(player, 3756, 0) @@ -159,14 +179,13 @@ class TutorialMagicTutorDialogue(player: Player? = null) : core.game.dialogue.Di player.inventory.add(*STARTER_PACK) player.bank.add(*STARTER_BANK) - if(player.skills.experienceMultiplier == 10.0) - { + if(player.ironmanManager.mode == IronmanMode.HARDCORE) { + setAttribute(player, "/save:permadeath", true) + } else 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 - //Original is five lines, but if the same is done here it will break. Need to find another way of showing all this information. + // Overwrites the stuck dialogue after teleporting to Lumbridge interpreter.sendDialogue( "Welcome to Lumbridge! To get more help, simply click on the", "Lumbridge Guide or one of the Tutors - these can be found by looking", @@ -194,7 +213,6 @@ class TutorialMagicTutorDialogue(player: Player? = null) : core.game.dialogue.Di ManagementEvents.publish(clanJoin.build()) } } - 12 -> { player.setAttribute("close_c_", true) end() @@ -207,5 +225,4 @@ class TutorialMagicTutorDialogue(player: Player? = null) : core.game.dialogue.Di override fun getIds(): IntArray { return intArrayOf(NPCs.MAGIC_INSTRUCTOR_946) } - } 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 19debcc..abe83c2 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 = 0.1; // Note in EmoScape this sets the default to be the scaling to 10x at 99 /** * The maximum experience multiplier. @@ -287,9 +287,30 @@ public final class Skills { * @return The experience mod. */ private double getExperienceMod(int slot, double experience, boolean playerMod, boolean multiplyer) { + // Emo has hijacked this method to enable the scaling of the exp multiplier //Keywords for people ctrl + Fing the project //xprate xp rate xp multiplier skilling rate - return experienceMultiplier; + if (experienceMultiplier == 0.1) { // exp multiplier placeholder for 10x at 100 + double mult = (1 + ((this.experience[slot] * 9) / 13034431)); // 13034431 is the exp for 99, meaning this formula hits 10x at 99 + if (mult < 1.0) { + return 1.0; + } else if (mult > 10.0) { + return 10.0; + } else { + return mult; + } + } else if (experienceMultiplier == 0.2) { // exp multiplier placeholder for 5x at 100 + double mult = (1 + ((this.experience[slot] * 4) / 13034431)); // 13034431 is the exp for 99, meaning this formula hits 5x at 99 + if (mult < 1.0) { + return 1.0; + } else if (mult > 5.0) { + return 5.0; + } else { + return mult; + } + } else { + return experienceMultiplier; + } /*if (!(entity instanceof Player)) { return 1.0; } diff --git a/Server/worldprops/default.conf b/Server/worldprops/default.conf index ea574da..5eea69e 100644 --- a/Server/worldprops/default.conf +++ b/Server/worldprops/default.conf @@ -23,13 +23,13 @@ noauth_default_admin = false #NOTE: If we are not using auth, this determines wh #The limit on how many different accounts a player can log into per day. daily_accounts_per_ip = 3 watchdog_enabled = true -connectivity_check_url = "https://duckduckgo.com,https://emoscape.org" +connectivity_check_url = "https://google.com,https://emoscape.org" connectivity_timeout = 500 [database] database_name = "global" -database_username = "root" -database_password = "" +database_username = "scape" +database_password = "TestPass" database_address = "127.0.0.1" database_port = "3306"