diff --git a/Client/src/main/kotlin/org/rs09/SlayerTracker.kt b/Client/src/main/kotlin/org/rs09/SlayerTracker.kt index 48b160efa..b0f2154e4 100644 --- a/Client/src/main/kotlin/org/rs09/SlayerTracker.kt +++ b/Client/src/main/kotlin/org/rs09/SlayerTracker.kt @@ -13,7 +13,7 @@ object SlayerTracker { const val textX = 7 const val textY = 50 const val spriteY = 30 - val boxColor = GameConfig.slayerTrackerColor.toInt(16) + val boxColor = GameConfig.slayerTrackerColor.toIntOrNull(16) ?: 6116423 @JvmField var lastUpdate = 0L diff --git a/Client/src/main/kotlin/org/rs09/client/config/GameConfig.kt b/Client/src/main/kotlin/org/rs09/client/config/GameConfig.kt index fd9ca0fd0..971a87e32 100644 --- a/Client/src/main/kotlin/org/rs09/client/config/GameConfig.kt +++ b/Client/src/main/kotlin/org/rs09/client/config/GameConfig.kt @@ -50,20 +50,32 @@ class GameConfig { @JvmField var RCM_BG_COLOR = 6116423 - @JvmField + @JvmStatic var RCM_BG_OPACITY = 255 + set(value) { + if(value > 255 || value < 0) field = 255 + else field = value + } @JvmField var RCM_TITLE_COLOR = 0 - @JvmField + @JvmStatic var RCM_TITLE_OPACITY = 255 + set(value) { + if(value > 255 || value < 0) field = 255 + else field = value + } @JvmField var RCM_BORDER_COLOR = 0 - @JvmField + @JvmStatic var RCM_BORDER_OPACITY = 255 + set(value) { + if(value > 255 || value < 0) field = 255 + else field = value + } @JvmField var RCM_TITLE = "Choose Option" @@ -131,8 +143,12 @@ class GameConfig { @JvmField var slayerTrackerColor = "#635a38" - @JvmField + @JvmStatic var slayerTrackerOpacity = 180 + set(value) { + if(value > 255 || value < 0) field = 255 + else field = value + } @JvmField var slayerTaskID = 0 @@ -179,7 +195,7 @@ class GameConfig { //background if(rcm.containsKey("background")){ val bg = rcm["background"] as JSONObject - if(bg.containsKey("color")) RCM_BG_COLOR = bg["color"].toString().replace("#", "").toInt(16) //convert hex -> deci + if(bg.containsKey("color")) RCM_BG_COLOR = bg["color"].toString().replace("#", "").toIntOrNull(16) ?: 6116423//convert hex -> deci if(bg.containsKey("opacity")) RCM_BG_OPACITY = bg["opacity"].toString().toInt() } @@ -187,14 +203,14 @@ class GameConfig { if(rcm.containsKey("title_bar")){ val tb = rcm["title_bar"] as JSONObject if(tb.containsKey("font_color")) RCM_TITLE = RCM_TITLE.replace("0", tb["font_color"].toString().replace("#", "")) - if(tb.containsKey("color")) RCM_TITLE_COLOR = tb["color"].toString().replace("#", "").toInt(16) //convert hex -> deci + if(tb.containsKey("color")) RCM_TITLE_COLOR = tb["color"].toString().replace("#", "").toIntOrNull(16) ?: 6116423//convert hex -> deci if(tb.containsKey("opacity")) RCM_TITLE_OPACITY = tb["opacity"].toString().toInt() } //border if(rcm.containsKey("border")){ val border = rcm["border"] as JSONObject - if(border.containsKey("color")) RCM_BORDER_COLOR = border["color"].toString().replace("#", "").toInt(16) //convert hex -> deci + if(border.containsKey("color")) RCM_BORDER_COLOR = border["color"].toString().replace("#", "").toIntOrNull(16) ?: 6116423 //convert hex -> deci if(border.containsKey("opacity")) RCM_BORDER_OPACITY = border["opacity"].toString().toInt() }