Disabled the ability to create new HCIM accounts

Disabled the ability to select HCIM 10x xp rate
Existing HCIM will turn back to standard players after their next death (all permadeath rules still apply for that death)
Players on HCIM 10x will be reverted to 5x after their next death
If the player is in combat and disconnects via AFK timeout, then their forced logout timer has been reduced to 30 seconds from 15 minutes
If the player is in combat and x-logs or disconnects via network issues, then their forced logout timer has been reduced to 5 minutes from 15 minutes
This commit is contained in:
Ceikry
2025-02-01 13:48:18 +00:00
committed by Ryan
parent 0c8efbac7a
commit 6e9f3cb8b9
4 changed files with 32 additions and 21 deletions
@@ -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
@@ -95,8 +95,8 @@ class TutorialMagicTutorDialogue(player: Player? = null) : core.game.dialogue.Di
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("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 -> when(buttonId){
1 -> options("None","Standard","Hardcore (Permadeath!)","Ultimate","Nevermind.").also { stage = 10 } 1 -> options("None","Standard","Ultimate","Nevermind.").also { stage = 10 }
2 -> options("1.0x","2.5x","5.0x","10x").also { stage = 20 } 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 } 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 }
} }
@@ -104,22 +104,31 @@ class TutorialMagicTutorDialogue(player: Player? = null) : core.game.dialogue.Di
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 && mode != IronmanMode.HARDCORE) player.skills.experienceMultiplier = 5.0 if (player.skills.experienceMultiplier == 10.0) 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 }
20 -> { 20 -> {
val rates = arrayOf(1.0,2.5,5.0,10.0) val rates = arrayOf(1.0,2.5,5.0)
val rate = rates[buttonId - 1] val rate = rates[buttonId - 1]
if(rate == 10.0 && player.ironmanManager.mode != IronmanMode.HARDCORE) { if(rate == 10.0) {
player.dialogueInterpreter.sendDialogue("10.0x is only available to Hardcore Ironmen!") player.dialogueInterpreter.sendDialogue("10.0x is no longer available!")
player.skills.experienceMultiplier = 5.0
stage = 0 stage = 0
return true return true
} }
@@ -150,11 +159,7 @@ 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.ironmanManager.mode == IronmanMode.HARDCORE) if(player.skills.experienceMultiplier == 10.0)
{
setAttribute(player, "/save:permadeath", true)
}
else if(player.skills.experienceMultiplier == 10.0)
{ {
player.skills.experienceMultiplier = 5.0 player.skills.experienceMultiplier = 5.0
} }
@@ -130,6 +130,8 @@ public class Player extends Entity {
public HashMap<String,Function1<Player, Unit>> logoutListeners = new HashMap<>(); public HashMap<String,Function1<Player, Unit>> logoutListeners = new HashMap<>();
public Boolean isAfkLogout;
/** /**
* The inventory. * The inventory.
*/ */
@@ -4,11 +4,9 @@ import core.api.log
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.node.entity.player.info.login.PlayerParser import core.game.node.entity.player.info.login.PlayerParser
import core.game.system.task.TaskExecutor import core.game.system.task.TaskExecutor
import core.tools.SystemLogger
import core.game.world.GameWorld import core.game.world.GameWorld
import core.tools.Log import core.tools.Log
import java.util.* import core.tools.secondsToTicks
import java.util.concurrent.ConcurrentHashMap
/** /**
* Handles disconnecting players queuing. * Handles disconnecting players queuing.
@@ -37,7 +35,10 @@ class DisconnectionQueue {
else { else {
//Make sure there's no room for the disconnection queue to stroke out and leave someone logged in for 10 years. //Make sure there's no room for the disconnection queue to stroke out and leave someone logged in for 10 years.
queueTimers[it.key] = (queueTimers[it.key] ?: 0) + 3 queueTimers[it.key] = (queueTimers[it.key] ?: 0) + 3
if ((queueTimers[it.key] ?: Int.MAX_VALUE) >= 1500) { val isValidAFKLogout = it.value?.player?.isAfkLogout == true
val seconds = if (isValidAFKLogout) 30 else 5 * 60 //30 seconds for AFK logout, 5 minutes for normal logout
val ticksNeeded = secondsToTicks(seconds)
if ((queueTimers[it.key] ?: Int.MAX_VALUE) >= ticksNeeded) {
it.value?.player?.let { player -> it.value?.player?.let { player ->
player.finishClear() player.finishClear()
Repository.removePlayer(player) Repository.removePlayer(player)
@@ -308,7 +308,10 @@ object PacketProcessor {
} }
is Packet.TrackingAfkTimeout -> { is Packet.TrackingAfkTimeout -> {
if (pkt.player.details.rights != Rights.ADMINISTRATOR) if (pkt.player.details.rights != Rights.ADMINISTRATOR)
{
pkt.player.isAfkLogout = true
pkt.player.packetDispatch.sendLogout() pkt.player.packetDispatch.sendLogout()
}
} }
is Packet.TrackingCameraPos -> { is Packet.TrackingCameraPos -> {
//TODO Refactor the player monitor to be actually useful and log this //TODO Refactor the player monitor to be actually useful and log this