Merge pull request 'new-exp' (#1) from new-exp into main

This implements the scaled EXP options:

Basically if you select the scaled options, you will start off playing 1x

    if you select the scaled 10x, your exp multiplier will increase proportional to the exp you gain in the skill until you reach 99, after which it will be capped at 10x
    if you select the scaled 5x, your exp multiplier will increase proportional to the exp you gain in the skill until you reach 99, after which it will be capped at 5x

I also brought back HCIM mode!
This commit is contained in:
emo 2025-03-04 23:05:13 +00:00
commit c7db36d9b6
4 changed files with 97 additions and 59 deletions

View File

@ -8,12 +8,12 @@ import core.game.interaction.InterfaceListener
object RulesAndInfo { object RulesAndInfo {
val RULES = arrayOf( val RULES = arrayOf(
"<col=ffffff>1. Basically just don't be an asshole</col>", "<col=ffffff>1. Basically just don't be an asshole</col>",
" -No spamming, harassment, or other disruptive behaviors", " -No spamming, harassment, or other",
" behaviors disruptive behaviors", " disruptive behaviors",
"<col=ffffff>2. No exploitation of bugs.</col>", "<col=ffffff>2. No exploitation of bugs.</col>",
" -Zero tolerance. Can result in account deletion.", " -Zero tolerance. Can result in account deletion.",
" -If you discover a bug, report it to Emo/admins.", " -If you discover a bug, report it to Emo/admins.",
"<col=ffffff>3. Do not discuss or advertise.</col>", "<col=ffffff>3. Discuss or Advertising.</col>",
" -Discussion of the live jagex games is fine.", " -Discussion of the live jagex games is fine.",
" -Discussion of open source projects is fine.", " -Discussion of open source projects is fine.",
" -No advertising of non-open source RSPSs.", " -No advertising of non-open source RSPSs.",

View File

@ -1,22 +1,22 @@
package content.region.misc.tutisland.dialogue package content.region.misc.tutisland.dialogue
import content.global.handlers.iface.RulesAndInfo
import content.region.misc.tutisland.handlers.* import content.region.misc.tutisland.handlers.*
import core.ServerConstants
import core.api.* import core.api.*
import core.game.node.entity.npc.NPC import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.node.entity.player.link.IronmanMode import core.game.node.entity.player.link.IronmanMode
import core.game.node.entity.player.link.TeleportManager import core.game.node.entity.player.link.TeleportManager
import core.game.node.item.Item import core.game.node.item.Item
import core.game.world.GameWorld
import core.game.world.map.Location import core.game.world.map.Location
import core.plugin.Initializable import core.plugin.Initializable
import core.tools.END_DIALOGUE
import core.worker.ManagementEvents
import org.rs09.consts.Items import org.rs09.consts.Items
import org.rs09.consts.NPCs import org.rs09.consts.NPCs
import proto.management.JoinClanRequest 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 * Handles the magic tutor's dialogue
@ -44,20 +44,29 @@ class TutorialMagicTutorDialogue(player: Player? = null) : core.game.dialogue.Di
Item(557, 4), Item(557, 4),
Item(559, 2) 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 { override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin {
return TutorialMagicTutorDialogue(player) return TutorialMagicTutorDialogue(player)
} }
override fun open(vararg args: Any?): Boolean { override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC 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.") 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.") 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.") 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.AIR_RUNE_556, 15)
addItem(player, Items.MIND_RUNE_558, 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 { override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(getAttribute(player, "tutorial:stage", 0)) when(getAttribute(player, "tutorial:stage", 0)) {
{
67 -> when(stage++){ 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.") 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 -> { 1 -> {
@ -92,43 +100,45 @@ class TutorialMagicTutorDialogue(player: Player? = null) : core.game.dialogue.Di
TutorialStage.load(player, 70) TutorialStage.load(player, 70)
} }
} }
71 -> when(stage){ 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(
1 -> when(buttonId){ "Set Ironman Mode (current: ${player.ironmanManager.mode.name})",
1 -> options("None","Standard","Ultimate","Nevermind.").also { stage = 10 } "Change XP Rate (current: ${xpRateText(player.skills.experienceMultiplier)})",
2 -> options("1.0x","2.5x","5.0x").also { stage = 20 } "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 } 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 -> { 10 -> {
stage = 0 stage = 0
if(buttonId < 5) if(buttonId < 5) {
{ val mode = IronmanMode.values()[buttonId - 1]
val mode = when (buttonId - 1)
{
0 -> IronmanMode.NONE
1 -> IronmanMode.STANDARD
2 -> IronmanMode.ULTIMATE
else -> IronmanMode.NONE
}
if (mode != IronmanMode.NONE) stage = 11
player.dialogueInterpreter.sendDialogue("You set your ironman mode to: ${mode.name}.") player.dialogueInterpreter.sendDialogue("You set your ironman mode to: ${mode.name}.")
player.ironmanManager.mode = mode player.ironmanManager.mode = mode
if (player.skills.experienceMultiplier == 10.0) player.skills.experienceMultiplier = 5.0 if (player.skills.experienceMultiplier == 10.0 && mode != IronmanMode.HARDCORE)
} player.skills.experienceMultiplier = 5.0
else } else {
{
handle(interfaceId, 0) 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 } 22 -> {
val rates = arrayOf(1.0, 2.5, 5.0, 10.0)
20 -> {
val rates = arrayOf(1.0,2.5,5.0)
val rate = rates[buttonId - 1] val rate = rates[buttonId - 1]
if(rate == 10.0) { if(rate == 10.0 && player.ironmanManager.mode != IronmanMode.HARDCORE) {
player.dialogueInterpreter.sendDialogue("10.0x is no longer available!") player.dialogueInterpreter.sendDialogue("10.0x is only available to Hardcore Ironmen!")
player.skills.experienceMultiplier = 5.0
stage = 0 stage = 0
return true return true
} }
@ -136,14 +146,24 @@ class TutorialMagicTutorDialogue(player: Player? = null) : core.game.dialogue.Di
player.skills.experienceMultiplier = rate player.skills.experienceMultiplier = rate
stage = 0 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++ } 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 } 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 } 2 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "I'm not quite ready to go yet, thank you.").also { stage = END_DIALOGUE }
} }
40 -> { 40 -> {
setAttribute(player, "/save:tutorial:complete", true) setAttribute(player, "/save:tutorial:complete", true)
setVarbit(player, 3756, 0) setVarbit(player, 3756, 0)
@ -159,14 +179,13 @@ class TutorialMagicTutorDialogue(player: Player? = null) : core.game.dialogue.Di
player.inventory.add(*STARTER_PACK) player.inventory.add(*STARTER_PACK)
player.bank.add(*STARTER_BANK) 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 player.skills.experienceMultiplier = 5.0
} }
//This overwrites the stuck dialogue after teleporting to Lumbridge for some reason // Overwrites the stuck dialogue after teleporting to Lumbridge
//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.
interpreter.sendDialogue( interpreter.sendDialogue(
"Welcome to Lumbridge! To get more help, simply click on the", "Welcome to Lumbridge! To get more help, simply click on the",
"Lumbridge Guide or one of the Tutors - these can be found by looking", "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()) ManagementEvents.publish(clanJoin.build())
} }
} }
12 -> { 12 -> {
player.setAttribute("close_c_", true) player.setAttribute("close_c_", true)
end() end()
@ -207,5 +225,4 @@ class TutorialMagicTutorDialogue(player: Player? = null) : core.game.dialogue.Di
override fun getIds(): IntArray { override fun getIds(): IntArray {
return intArrayOf(NPCs.MAGIC_INSTRUCTOR_946) return intArrayOf(NPCs.MAGIC_INSTRUCTOR_946)
} }
} }

View File

@ -41,7 +41,7 @@ public final class Skills {
/** /**
* Represents the constant modifier of experience. * 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. * The maximum experience multiplier.
@ -287,9 +287,30 @@ public final class Skills {
* @return The experience mod. * @return The experience mod.
*/ */
private double getExperienceMod(int slot, double experience, boolean playerMod, boolean multiplyer) { 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 //Keywords for people ctrl + Fing the project
//xprate xp rate xp multiplier skilling rate //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)) { /*if (!(entity instanceof Player)) {
return 1.0; return 1.0;
} }

View File

@ -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. #The limit on how many different accounts a player can log into per day.
daily_accounts_per_ip = 3 daily_accounts_per_ip = 3
watchdog_enabled = true watchdog_enabled = true
connectivity_check_url = "https://duckduckgo.com,https://emoscape.org" connectivity_check_url = "https://google.com,https://emoscape.org"
connectivity_timeout = 500 connectivity_timeout = 500
[database] [database]
database_name = "global" database_name = "global"
database_username = "root" database_username = "scape"
database_password = "" database_password = "TestPass"
database_address = "127.0.0.1" database_address = "127.0.0.1"
database_port = "3306" database_port = "3306"