Fixed exception thrown when invalid fairy ring codes are entered

Fixed unhandled hairdresser button that lead to OOB exception
Fixed oversight in ::loc that causes exceptions to be thrown in headless environments
This commit is contained in:
Ceikry 2022-06-27 14:21:50 +00:00 committed by Ryan
parent 95414bc02b
commit e429b15911
4 changed files with 14 additions and 6 deletions

View file

@ -14,7 +14,6 @@ import core.game.world.update.flag.context.Animation
import org.rs09.consts.Items
import rs09.game.content.dialogue.DialogueFile
import rs09.game.interaction.InteractionListener
import rs09.tools.stringtools.RED
class SeersHouseListeners : InteractionListener {

View file

@ -108,7 +108,10 @@ class FairyRingInterface : InterfaceListener{
val ring2index = player.getAttribute("fr:ring2",0)
val ring3index = player.getAttribute("fr:ring3",0)
val code = "${RING_1[ring1index]}${RING_2[ring2index]}${RING_3[ring3index]}"
val ring: FairyRing? = FairyRing.valueOf(code.toUpperCase())
val ring: FairyRing? = try {
FairyRing.valueOf(code.uppercase())
} catch (e: Exception) { null }
var tile = ring?.tile
if(ring == FairyRing.CIP){
sendDialogue(player, "The ring seems to reject you.")

View file

@ -174,7 +174,7 @@ class HairDresserInterface : ComponentPlugin(){
when(button){
199 -> player.setAttribute("beard-setting",false)
200 -> player.setAttribute("beard-setting",true)
68,196 -> pay(player)
68,196,274 -> pay(player)
else -> when(component?.id){
592 -> { //Female
if(femaleColorButtonRange.contains(button)){

View file

@ -31,6 +31,7 @@ import rs09.game.system.command.CommandMapping
import rs09.game.system.command.Privilege
import rs09.game.world.repository.Repository
import rs09.tools.stringtools.colorize
import java.awt.HeadlessException
import java.awt.Toolkit
import java.awt.datatransfer.StringSelection
import java.util.*
@ -76,9 +77,14 @@ class MiscCommandSet : CommandSet(Privilege.ADMIN){
SystemLogger.logInfo("Viewport: " + l.getSceneX(player.playerFlags.lastSceneGraph) + "," + l.getSceneY(player.playerFlags.lastSceneGraph))
val loc = "Location.create(" + l.x + ", " + l.y + ", " + l.z + ")"
SystemLogger.logInfo(loc + "; " + player.playerFlags.lastSceneGraph + ", " + l.localX + ", " + l.localY)
val stringSelection = StringSelection(loc)
val clpbrd = Toolkit.getDefaultToolkit().systemClipboard
clpbrd.setContents(stringSelection, null)
try {
val stringSelection = StringSelection(loc)
val clpbrd = Toolkit.getDefaultToolkit().systemClipboard
clpbrd.setContents(stringSelection, null)
notify(player, "Coordinates copied to clipboard.")
} catch (e: HeadlessException) {
reject(player, "NOTE: Paste will not be available due to remote server.")
}
}
/**