mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-15 11:00:19 -07:00
fix up remaining spacing issues
This commit is contained in:
parent
3392d61d9e
commit
5bb81c7bd3
39 changed files with 244 additions and 271 deletions
BIN
plugin-playground/src/main/kotlin/KondoKit/.DS_Store
vendored
BIN
plugin-playground/src/main/kotlin/KondoKit/.DS_Store
vendored
Binary file not shown.
|
|
@ -1,66 +0,0 @@
|
||||||
package KondoKit
|
|
||||||
|
|
||||||
import plugin.api.API
|
|
||||||
import rt4.IntNode
|
|
||||||
import rt4.Node
|
|
||||||
|
|
||||||
object XPTable {
|
|
||||||
|
|
||||||
private const val MAX_LEVEL = 99
|
|
||||||
private const val INVALID_LEVEL = -1
|
|
||||||
private const val SKILLS_XP_TABLE = 716
|
|
||||||
|
|
||||||
private var xpTable: MutableList<Int> = mutableListOf()
|
|
||||||
|
|
||||||
// Lazily load the XP table from the API if it's empty
|
|
||||||
private fun loadXpTable() {
|
|
||||||
if (xpTable.isEmpty()) {
|
|
||||||
// Add the initial entry for key 1 = 0
|
|
||||||
xpTable.add(0)
|
|
||||||
|
|
||||||
// Fetch XP table from the API
|
|
||||||
API.GetDataMap(SKILLS_XP_TABLE).table.nodes.forEach { bucket ->
|
|
||||||
var currentNode: Node = bucket.nextNode
|
|
||||||
while (currentNode !== bucket) {
|
|
||||||
if (currentNode is IntNode) {
|
|
||||||
xpTable.add(currentNode.value)
|
|
||||||
}
|
|
||||||
currentNode = currentNode.nextNode
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getXpRequiredForLevel(level: Int): Int {
|
|
||||||
loadXpTable()
|
|
||||||
if (level in 1..xpTable.size) {
|
|
||||||
return xpTable[level - 1]
|
|
||||||
}
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getLevelForXp(xp: Int): Pair<Int, Int> {
|
|
||||||
loadXpTable()
|
|
||||||
var lowIndex = 0
|
|
||||||
var highIndex = xpTable.size - 1
|
|
||||||
|
|
||||||
if (xp >= xpTable[highIndex]) {
|
|
||||||
return Pair(MAX_LEVEL, xp - xpTable[highIndex]) // Level is max or above, return the highest level
|
|
||||||
}
|
|
||||||
|
|
||||||
while (lowIndex <= highIndex) {
|
|
||||||
val midIndex = (lowIndex + highIndex) / 2
|
|
||||||
when {
|
|
||||||
xp < xpTable[midIndex] -> highIndex = midIndex - 1
|
|
||||||
xp >= xpTable[midIndex + 1] -> lowIndex = midIndex + 1
|
|
||||||
else -> {
|
|
||||||
val currentLevel = midIndex + 1
|
|
||||||
val xpGained = xp - xpTable[midIndex]
|
|
||||||
return Pair(currentLevel, xpGained)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Pair(INVALID_LEVEL, 0) // If xp is below all defined levels
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,18 +1,22 @@
|
||||||
package KondoKit
|
package KondoKit
|
||||||
|
|
||||||
import KondoKit.Helpers.getSpriteId
|
import KondoKit.util.Helpers.getSpriteId
|
||||||
import KondoKit.Helpers.showAlert
|
import KondoKit.util.Helpers.showAlert
|
||||||
import KondoKit.views.*
|
import KondoKit.views.*
|
||||||
import KondoKit.views.OnUpdateCallback
|
import KondoKit.ui.OnUpdateCallback
|
||||||
import KondoKit.views.OnDrawCallback
|
import KondoKit.ui.OnDrawCallback
|
||||||
import KondoKit.views.OnXPUpdateCallback
|
import KondoKit.ui.OnXPUpdateCallback
|
||||||
import KondoKit.views.OnKillingBlowNPCCallback
|
import KondoKit.ui.OnKillingBlowNPCCallback
|
||||||
import KondoKit.views.OnPostClientTickCallback
|
import KondoKit.ui.OnPostClientTickCallback
|
||||||
import KondoKit.SpriteToBufferedImage.getBufferedImageFromSprite
|
import KondoKit.util.AltCanvas
|
||||||
import KondoKit.Themes.Theme
|
import KondoKit.util.SpriteToBufferedImage.getBufferedImageFromSprite
|
||||||
import KondoKit.Themes.ThemeType
|
import KondoKit.util.ImageCanvas
|
||||||
import KondoKit.Themes.getTheme
|
import KondoKit.util.setFixedSize
|
||||||
import KondoKit.components.ScrollablePanel
|
import KondoKit.ui.ViewConstants
|
||||||
|
import KondoKit.ui.theme.Themes.Theme
|
||||||
|
import KondoKit.ui.theme.Themes.ThemeType
|
||||||
|
import KondoKit.ui.theme.Themes.getTheme
|
||||||
|
import KondoKit.ui.components.ScrollablePanel
|
||||||
import plugin.Plugin
|
import plugin.Plugin
|
||||||
import plugin.api.*
|
import plugin.api.*
|
||||||
import plugin.api.API.*
|
import plugin.api.API.*
|
||||||
|
|
@ -29,6 +33,8 @@ import java.awt.event.ActionListener
|
||||||
import java.awt.event.MouseAdapter
|
import java.awt.event.MouseAdapter
|
||||||
import java.awt.event.MouseEvent
|
import java.awt.event.MouseEvent
|
||||||
import javax.swing.*
|
import javax.swing.*
|
||||||
|
import KondoKit.ui.View
|
||||||
|
import KondoKit.util.Helpers
|
||||||
|
|
||||||
|
|
||||||
@Target(AnnotationTarget.FIELD)
|
@Target(AnnotationTarget.FIELD)
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,16 @@
|
||||||
package KondoKit.pluginmanager
|
package KondoKit.pluginmanager
|
||||||
|
|
||||||
|
import KondoKit.pluginmanager.GitLabPlugin
|
||||||
|
import KondoKit.pluginmanager.PluginProperties
|
||||||
|
import KondoKit.util.HttpFetcher
|
||||||
|
import KondoKit.pluginmanager.GitLabConfig
|
||||||
|
import KondoKit.util.JsonParser
|
||||||
import com.google.gson.JsonObject
|
import com.google.gson.JsonObject
|
||||||
import java.io.BufferedReader
|
import java.io.BufferedReader
|
||||||
import java.io.InputStreamReader
|
import java.io.InputStreamReader
|
||||||
import java.net.HttpURLConnection
|
import java.net.HttpURLConnection
|
||||||
import java.util.concurrent.*
|
import java.util.concurrent.*
|
||||||
import javax.swing.SwingUtilities
|
import javax.swing.SwingUtilities
|
||||||
import KondoKit.network.HttpFetcher
|
|
||||||
import KondoKit.pluginmanager.GitLabConfig
|
|
||||||
import KondoKit.util.JsonParser
|
|
||||||
|
|
||||||
object GitLabPluginFetcher {
|
object GitLabPluginFetcher {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,8 @@
|
||||||
package KondoKit.pluginmanager
|
package KondoKit.pluginmanager
|
||||||
|
|
||||||
|
import KondoKit.pluginmanager.GitLabPlugin
|
||||||
|
import KondoKit.util.HttpFetcher
|
||||||
|
import KondoKit.pluginmanager.GitLabConfig
|
||||||
import KondoKit.views.ReflectiveEditorView
|
import KondoKit.views.ReflectiveEditorView
|
||||||
import plugin.PluginRepository
|
import plugin.PluginRepository
|
||||||
import java.awt.EventQueue
|
import java.awt.EventQueue
|
||||||
|
|
@ -10,8 +13,6 @@ import java.util.concurrent.*
|
||||||
import java.util.zip.ZipEntry
|
import java.util.zip.ZipEntry
|
||||||
import java.util.zip.ZipInputStream
|
import java.util.zip.ZipInputStream
|
||||||
import javax.swing.SwingUtilities
|
import javax.swing.SwingUtilities
|
||||||
import KondoKit.pluginmanager.GitLabConfig
|
|
||||||
import KondoKit.network.HttpFetcher
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages downloading and installing plugins from GitLab with concurrent support
|
* Manages downloading and installing plugins from GitLab with concurrent support
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
package KondoKit
|
package KondoKit.pluginmanager
|
||||||
|
|
||||||
import KondoKit.pluginmanager.*
|
import KondoKit.pluginmanager.GitLabPlugin
|
||||||
|
import KondoKit.pluginmanager.PluginInfoWithStatus
|
||||||
|
import KondoKit.pluginmanager.PluginProperties
|
||||||
|
import KondoKit.util.FileUtils
|
||||||
|
import KondoKit.util.Helpers
|
||||||
import KondoKit.views.ReflectiveEditorView
|
import KondoKit.views.ReflectiveEditorView
|
||||||
import plugin.Plugin
|
import plugin.Plugin
|
||||||
import plugin.PluginInfo
|
import plugin.PluginInfo
|
||||||
|
|
@ -201,7 +205,7 @@ class ReflectiveEditorPlugin : Plugin() {
|
||||||
val disabledDir = File(pluginsDirectory, "disabled")
|
val disabledDir = File(pluginsDirectory, "disabled")
|
||||||
val pluginDir = File(disabledDir, pluginName)
|
val pluginDir = File(disabledDir, pluginName)
|
||||||
if (pluginDir.exists() && pluginDir.isDirectory) {
|
if (pluginDir.exists() && pluginDir.isDirectory) {
|
||||||
if (deleteRecursively(pluginDir)) {
|
if (FileUtils.deleteRecursively(pluginDir)) {
|
||||||
needsReload = true
|
needsReload = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -228,7 +232,7 @@ class ReflectiveEditorPlugin : Plugin() {
|
||||||
|
|
||||||
if (pluginDir.exists() && pluginDir.isDirectory) {
|
if (pluginDir.exists() && pluginDir.isDirectory) {
|
||||||
// Recursively delete the directory
|
// Recursively delete the directory
|
||||||
if (deleteRecursively(pluginDir)) {
|
if (FileUtils.deleteRecursively(pluginDir)) {
|
||||||
Helpers.showToast(mainPanel, "Plugin deleted successfully", JOptionPane.INFORMATION_MESSAGE)
|
Helpers.showToast(mainPanel, "Plugin deleted successfully", JOptionPane.INFORMATION_MESSAGE)
|
||||||
|
|
||||||
// If we deleted a loaded plugin, schedule plugin reload
|
// If we deleted a loaded plugin, schedule plugin reload
|
||||||
|
|
@ -252,18 +256,6 @@ class ReflectiveEditorPlugin : Plugin() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper method to recursively delete a directory
|
|
||||||
private fun deleteRecursively(file: File): Boolean {
|
|
||||||
if (file.isDirectory) {
|
|
||||||
file.listFiles()?.forEach { child ->
|
|
||||||
if (!deleteRecursively(child)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return file.delete()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper function to check if a plugin is the KondoKit plugin
|
// Helper function to check if a plugin is the KondoKit plugin
|
||||||
private fun isKondoKit(pluginName: String): Boolean {
|
private fun isKondoKit(pluginName: String): Boolean {
|
||||||
return pluginName == "KondoKit"
|
return pluginName == "KondoKit"
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package KondoKit.views
|
package KondoKit.ui
|
||||||
|
|
||||||
import KondoKit.ViewConstants
|
import KondoKit.ui.ViewConstants
|
||||||
import KondoKit.plugin.Companion.VIEW_BACKGROUND_COLOR
|
import KondoKit.plugin.Companion.VIEW_BACKGROUND_COLOR
|
||||||
import KondoKit.setFixedSize
|
import KondoKit.util.setFixedSize
|
||||||
import javax.swing.BorderFactory
|
import javax.swing.BorderFactory
|
||||||
import javax.swing.Box
|
import javax.swing.Box
|
||||||
import javax.swing.BoxLayout
|
import javax.swing.BoxLayout
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
package KondoKit.views
|
package KondoKit.ui
|
||||||
|
|
||||||
import javax.swing.JPanel
|
import javax.swing.JPanel
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contract implemented by UI views; kept in a dedicated UI package to avoid tangling with concrete implementations.
|
||||||
|
*/
|
||||||
interface View {
|
interface View {
|
||||||
val name: String
|
val name: String
|
||||||
val iconSpriteId: Int
|
val iconSpriteId: Int
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package KondoKit.views
|
package KondoKit.ui
|
||||||
|
|
||||||
interface OnUpdateCallback {
|
interface OnUpdateCallback {
|
||||||
fun onUpdate()
|
fun onUpdate()
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package KondoKit
|
package KondoKit.ui
|
||||||
|
|
||||||
import java.awt.Color
|
import java.awt.Color
|
||||||
import java.awt.Dimension
|
import java.awt.Dimension
|
||||||
|
|
@ -6,11 +6,8 @@ import java.awt.Font
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shared constants for fonts, dimensions, and colors across the entire KondoKit plugin.
|
* Shared constants for fonts, dimensions, and colors across the entire KondoKit plugin.
|
||||||
* This helps avoid repeated initialization of common elements and provides better consistency.
|
|
||||||
*/
|
*/
|
||||||
object ViewConstants {
|
object ViewConstants {
|
||||||
|
|
||||||
// Common Fonts
|
|
||||||
val FONT_RUNESCAPE_SMALL_16 = Font("RuneScape Small", Font.TRUETYPE_FONT, 16)
|
val FONT_RUNESCAPE_SMALL_16 = Font("RuneScape Small", Font.TRUETYPE_FONT, 16)
|
||||||
val FONT_RUNESCAPE_SMALL_14 = Font("RuneScape Small", Font.PLAIN, 14)
|
val FONT_RUNESCAPE_SMALL_14 = Font("RuneScape Small", Font.PLAIN, 14)
|
||||||
val FONT_RUNESCAPE_SMALL_PLAIN_16 = Font("RuneScape Small", Font.PLAIN, 16)
|
val FONT_RUNESCAPE_SMALL_PLAIN_16 = Font("RuneScape Small", Font.PLAIN, 16)
|
||||||
|
|
@ -18,7 +15,6 @@ object ViewConstants {
|
||||||
val FONT_ARIAL_PLAIN_14 = Font("Arial", Font.PLAIN, 14)
|
val FONT_ARIAL_PLAIN_14 = Font("Arial", Font.PLAIN, 14)
|
||||||
val FONT_ARIAL_BOLD_12 = Font("Arial", Font.BOLD, 12)
|
val FONT_ARIAL_BOLD_12 = Font("Arial", Font.BOLD, 12)
|
||||||
|
|
||||||
// Common Dimensions
|
|
||||||
val DIMENSION_SMALL_ICON = Dimension(12, 12)
|
val DIMENSION_SMALL_ICON = Dimension(12, 12)
|
||||||
val DIMENSION_LARGE_ICON = Dimension(30, 30)
|
val DIMENSION_LARGE_ICON = Dimension(30, 30)
|
||||||
val DEFAULT_WIDGET_SIZE = Dimension(234, 50)
|
val DEFAULT_WIDGET_SIZE = Dimension(234, 50)
|
||||||
|
|
@ -38,17 +34,14 @@ object ViewConstants {
|
||||||
val PROGRESS_BAR_SIZE = Dimension(220, 16)
|
val PROGRESS_BAR_SIZE = Dimension(220, 16)
|
||||||
val TOGGLE_SWITCH_SIZE = Dimension(32, 20)
|
val TOGGLE_SWITCH_SIZE = Dimension(32, 20)
|
||||||
|
|
||||||
// Common Colors
|
|
||||||
val COLOR_WHITE = Color.WHITE
|
val COLOR_WHITE = Color.WHITE
|
||||||
val COLOR_BLACK = Color.BLACK
|
val COLOR_BLACK = Color.BLACK
|
||||||
val COLOR_DARK_GRAY = Color.DARK_GRAY
|
val COLOR_DARK_GRAY = Color.DARK_GRAY
|
||||||
val COLOR_RED = Color.RED
|
val COLOR_RED = Color.RED
|
||||||
val COLOR_GRAY = Color.GRAY
|
val COLOR_GRAY = Color.GRAY
|
||||||
|
|
||||||
// Skill display order
|
|
||||||
val SKILL_DISPLAY_ORDER = arrayOf(0, 3, 14, 2, 16, 13, 1, 15, 10, 4, 17, 7, 5, 12, 11, 6, 9, 8, 20, 18, 19, 22, 21, 23)
|
val SKILL_DISPLAY_ORDER = arrayOf(0, 3, 14, 2, 16, 13, 1, 15, 10, 4, 17, 7, 5, 12, 11, 6, 9, 8, 20, 18, 19, 22, 21, 23)
|
||||||
|
|
||||||
// Sprite IDs
|
|
||||||
const val COMBAT_LVL_SPRITE = 168
|
const val COMBAT_LVL_SPRITE = 168
|
||||||
const val IRONMAN_SPRITE = 4
|
const val IRONMAN_SPRITE = 4
|
||||||
const val MAG_SPRITE = 1423
|
const val MAG_SPRITE = 1423
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package KondoKit.components
|
package KondoKit.ui.components
|
||||||
|
|
||||||
import KondoKit.ViewConstants
|
import KondoKit.ui.ViewConstants
|
||||||
import KondoKit.plugin.Companion.TITLE_BAR_COLOR
|
import KondoKit.plugin.Companion.TITLE_BAR_COLOR
|
||||||
import KondoKit.plugin.Companion.WIDGET_COLOR
|
import KondoKit.plugin.Companion.WIDGET_COLOR
|
||||||
import KondoKit.plugin.Companion.secondaryColor
|
import KondoKit.plugin.Companion.secondaryColor
|
||||||
import KondoKit.components.UiStyler.button
|
import KondoKit.ui.components.UiStyler.button
|
||||||
import KondoKit.components.UiStyler.ButtonDefaults
|
import KondoKit.ui.components.UiStyler.ButtonDefaults
|
||||||
import java.awt.*
|
import java.awt.*
|
||||||
import javax.swing.*
|
import javax.swing.*
|
||||||
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package KondoKit.components
|
package KondoKit.ui.components
|
||||||
|
|
||||||
import KondoKit.ImageCanvas
|
import KondoKit.util.ImageCanvas
|
||||||
import KondoKit.SpriteToBufferedImage
|
import KondoKit.util.SpriteToBufferedImage
|
||||||
import KondoKit.setFixedSize
|
import KondoKit.util.setFixedSize
|
||||||
import KondoKit.plugin.Companion.WIDGET_COLOR
|
import KondoKit.plugin.Companion.WIDGET_COLOR
|
||||||
import KondoKit.plugin.Companion.primaryColor
|
import KondoKit.plugin.Companion.primaryColor
|
||||||
import KondoKit.plugin.Companion.secondaryColor
|
import KondoKit.plugin.Companion.secondaryColor
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package KondoKit.components
|
package KondoKit.ui.components
|
||||||
|
|
||||||
import KondoKit.Helpers.formatHtmlLabelText
|
import KondoKit.util.Helpers.formatHtmlLabelText
|
||||||
import KondoKit.ViewConstants
|
import KondoKit.ui.ViewConstants
|
||||||
import KondoKit.plugin.Companion.primaryColor
|
import KondoKit.plugin.Companion.primaryColor
|
||||||
import KondoKit.plugin.Companion.secondaryColor
|
import KondoKit.plugin.Companion.secondaryColor
|
||||||
import java.awt.Font
|
import java.awt.Font
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package KondoKit.components
|
package KondoKit.ui.components
|
||||||
|
|
||||||
import KondoKit.components.UiStyler.menuItem
|
import KondoKit.ui.components.UiStyler.menuItem
|
||||||
import KondoKit.plugin.Companion.POPUP_BACKGROUND
|
import KondoKit.plugin.Companion.POPUP_BACKGROUND
|
||||||
import javax.swing.JMenuItem
|
import javax.swing.JMenuItem
|
||||||
import javax.swing.JPopupMenu
|
import javax.swing.JPopupMenu
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package KondoKit.components
|
package KondoKit.ui.components
|
||||||
|
|
||||||
import KondoKit.ViewConstants
|
import KondoKit.ui.ViewConstants
|
||||||
import KondoKit.plugin.Companion.PROGRESS_BAR_FILL
|
import KondoKit.plugin.Companion.PROGRESS_BAR_FILL
|
||||||
import KondoKit.plugin.Companion.secondaryColor
|
import KondoKit.plugin.Companion.secondaryColor
|
||||||
import java.awt.Canvas
|
import java.awt.Canvas
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package KondoKit.components
|
package KondoKit.ui.components
|
||||||
|
|
||||||
import KondoKit.plugin.Companion.SCROLL_BAR_COLOR
|
import KondoKit.plugin.Companion.SCROLL_BAR_COLOR
|
||||||
import KondoKit.plugin.Companion.VIEW_BACKGROUND_COLOR
|
import KondoKit.plugin.Companion.VIEW_BACKGROUND_COLOR
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
package KondoKit.components
|
package KondoKit.ui.components
|
||||||
|
|
||||||
import KondoKit.ImageCanvas
|
import KondoKit.util.ImageCanvas
|
||||||
import KondoKit.ViewConstants
|
import KondoKit.ui.ViewConstants
|
||||||
import KondoKit.SpriteToBufferedImage
|
import KondoKit.util.SpriteToBufferedImage
|
||||||
import KondoKit.setFixedSize
|
import KondoKit.util.setFixedSize
|
||||||
import KondoKit.plugin.Companion.WIDGET_COLOR
|
import KondoKit.plugin.Companion.WIDGET_COLOR
|
||||||
import KondoKit.plugin.Companion.secondaryColor
|
import KondoKit.plugin.Companion.secondaryColor
|
||||||
import KondoKit.plugin.StateManager.focusedView
|
import KondoKit.plugin.StateManager.focusedView
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
package KondoKit.components
|
package KondoKit.ui.components
|
||||||
|
|
||||||
import KondoKit.Helpers
|
import KondoKit.util.Helpers
|
||||||
import KondoKit.Helpers.FieldNotifier
|
import KondoKit.util.Helpers.FieldNotifier
|
||||||
import KondoKit.ViewConstants
|
import KondoKit.ui.ViewConstants
|
||||||
import KondoKit.components.UiStyler
|
import KondoKit.ui.components.UiStyler
|
||||||
import KondoKit.setFixedSize
|
import KondoKit.util.setFixedSize
|
||||||
import KondoKit.plugin.Companion.WIDGET_COLOR
|
import KondoKit.plugin.Companion.WIDGET_COLOR
|
||||||
import KondoKit.plugin.Companion.primaryColor
|
import KondoKit.plugin.Companion.primaryColor
|
||||||
import KondoKit.plugin.Companion.secondaryColor
|
import KondoKit.plugin.Companion.secondaryColor
|
||||||
|
|
@ -134,7 +134,7 @@ class SettingsPanel(private val plugin: Plugin) : JPanel() {
|
||||||
|
|
||||||
// Add apply button for non-HashMap editors
|
// Add apply button for non-HashMap editors
|
||||||
val applyButton = UiStyler.button(
|
val applyButton = UiStyler.button(
|
||||||
text = "\u2714",
|
text = "=>",
|
||||||
onClick = {
|
onClick = {
|
||||||
try {
|
try {
|
||||||
val newValue = when (inputComponent) {
|
val newValue = when (inputComponent) {
|
||||||
|
|
@ -398,9 +398,7 @@ class SettingsPanel(private val plugin: Plugin) : JPanel() {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
).apply {
|
)
|
||||||
setFixedSize(120, 30)
|
|
||||||
}
|
|
||||||
|
|
||||||
buttonsPanel.add(addButton)
|
buttonsPanel.add(addButton)
|
||||||
buttonsPanel.add(removeButton)
|
buttonsPanel.add(removeButton)
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
package KondoKit.components
|
package KondoKit.ui.components
|
||||||
|
|
||||||
import KondoKit.ViewConstants
|
import KondoKit.ui.ViewConstants
|
||||||
import KondoKit.plugin.Companion.PROGRESS_BAR_FILL
|
import KondoKit.plugin.Companion.PROGRESS_BAR_FILL
|
||||||
import KondoKit.plugin.Companion.WIDGET_COLOR
|
import KondoKit.plugin.Companion.WIDGET_COLOR
|
||||||
import KondoKit.plugin.Companion.primaryColor
|
import KondoKit.plugin.Companion.primaryColor
|
||||||
import KondoKit.plugin.Companion.secondaryColor
|
import KondoKit.plugin.Companion.secondaryColor
|
||||||
import KondoKit.setFixedSize
|
import KondoKit.util.setFixedSize
|
||||||
import java.awt.*
|
import java.awt.*
|
||||||
import java.awt.event.MouseAdapter
|
import java.awt.event.MouseAdapter
|
||||||
import java.awt.event.MouseEvent
|
import java.awt.event.MouseEvent
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package KondoKit.components
|
package KondoKit.ui.components
|
||||||
|
|
||||||
import KondoKit.ViewConstants
|
import KondoKit.ui.ViewConstants
|
||||||
import KondoKit.plugin.Companion.POPUP_BACKGROUND
|
import KondoKit.plugin.Companion.POPUP_BACKGROUND
|
||||||
import KondoKit.plugin.Companion.POPUP_FOREGROUND
|
import KondoKit.plugin.Companion.POPUP_FOREGROUND
|
||||||
import KondoKit.plugin.Companion.TITLE_BAR_COLOR
|
import KondoKit.plugin.Companion.TITLE_BAR_COLOR
|
||||||
|
|
@ -53,7 +53,7 @@ object UiStyler {
|
||||||
return JButton().apply {
|
return JButton().apply {
|
||||||
text?.let { this.text = it }
|
text?.let { this.text = it }
|
||||||
icon?.let { this.icon = it }
|
icon?.let { this.icon = it }
|
||||||
isOpaque = true
|
isOpaque = false
|
||||||
applyDefaults(defaults, onClick)
|
applyDefaults(defaults, onClick)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
package KondoKit.components
|
package KondoKit.ui.components
|
||||||
|
|
||||||
import KondoKit.ViewConstants
|
import KondoKit.ui.ViewConstants
|
||||||
import KondoKit.setFixedSize
|
import KondoKit.util.setFixedSize
|
||||||
import KondoKit.plugin.Companion.TITLE_BAR_COLOR
|
import KondoKit.plugin.Companion.TITLE_BAR_COLOR
|
||||||
import KondoKit.plugin.Companion.secondaryColor
|
import KondoKit.plugin.Companion.secondaryColor
|
||||||
import java.awt.*
|
import java.awt.*
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package KondoKit.components
|
package KondoKit.ui.components
|
||||||
|
|
||||||
import KondoKit.ViewConstants
|
import KondoKit.ui.ViewConstants
|
||||||
import KondoKit.plugin.Companion.WIDGET_COLOR
|
import KondoKit.plugin.Companion.WIDGET_COLOR
|
||||||
import KondoKit.setFixedSize
|
import KondoKit.util.setFixedSize
|
||||||
import java.awt.BorderLayout
|
import java.awt.BorderLayout
|
||||||
import java.awt.Dimension
|
import java.awt.Dimension
|
||||||
import javax.swing.BorderFactory
|
import javax.swing.BorderFactory
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package KondoKit.ui.components
|
||||||
|
|
||||||
|
import java.awt.Container
|
||||||
|
import javax.swing.JLabel
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shared widget state used by XP-related features so the structure isn't duplicated.
|
||||||
|
*/
|
||||||
|
data class XPWidget(
|
||||||
|
val container: Container,
|
||||||
|
val skillId: Int,
|
||||||
|
val xpGainedLabel: JLabel,
|
||||||
|
val xpLeftLabel: JLabel,
|
||||||
|
val xpPerHourLabel: JLabel,
|
||||||
|
val actionsRemainingLabel: JLabel,
|
||||||
|
val progressBar: ProgressBar,
|
||||||
|
var totalXpGained: Int = 0,
|
||||||
|
var startTime: Long = System.currentTimeMillis(),
|
||||||
|
var previousXp: Int = 0
|
||||||
|
)
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package KondoKit
|
package KondoKit.ui.theme
|
||||||
|
|
||||||
import java.awt.Color
|
import java.awt.Color
|
||||||
|
|
||||||
|
|
@ -75,7 +75,6 @@ object Themes {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
data class Theme(
|
data class Theme(
|
||||||
val widgetColor: Color,
|
val widgetColor: Color,
|
||||||
val titleBarColor: Color,
|
val titleBarColor: Color,
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package KondoKit
|
package KondoKit.util
|
||||||
|
|
||||||
import KondoKit.plugin.Companion.FIXED_HEIGHT
|
import KondoKit.plugin.Companion.FIXED_HEIGHT
|
||||||
import KondoKit.plugin.Companion.FIXED_WIDTH
|
import KondoKit.plugin.Companion.FIXED_WIDTH
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package KondoKit
|
package KondoKit.util
|
||||||
|
|
||||||
import java.awt.Component
|
import java.awt.Component
|
||||||
import java.awt.Container
|
import java.awt.Container
|
||||||
|
|
@ -6,6 +6,7 @@ import java.awt.Dimension
|
||||||
import java.awt.event.MouseAdapter
|
import java.awt.event.MouseAdapter
|
||||||
import java.awt.event.MouseEvent
|
import java.awt.event.MouseEvent
|
||||||
import javax.swing.JPopupMenu
|
import javax.swing.JPopupMenu
|
||||||
|
import KondoKit.util.Helpers
|
||||||
|
|
||||||
fun <T : Component> T.setFixedSize(width: Int, height: Int): T =
|
fun <T : Component> T.setFixedSize(width: Int, height: Int): T =
|
||||||
setFixedSize(Dimension(width, height))
|
setFixedSize(Dimension(width, height))
|
||||||
19
plugin-playground/src/main/kotlin/KondoKit/util/FileUtils.kt
Normal file
19
plugin-playground/src/main/kotlin/KondoKit/util/FileUtils.kt
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
package KondoKit.util
|
||||||
|
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
/**
|
||||||
|
* File-related helpers shared across the plugin to avoid ad-hoc copies.
|
||||||
|
*/
|
||||||
|
object FileUtils {
|
||||||
|
fun deleteRecursively(file: File): Boolean {
|
||||||
|
if (file.isDirectory) {
|
||||||
|
file.listFiles()?.forEach { child ->
|
||||||
|
if (!deleteRecursively(child)) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return file.delete()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package KondoKit.util
|
package KondoKit.util
|
||||||
|
|
||||||
import KondoKit.network.HttpFetcher
|
import KondoKit.util.HttpFetcher
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Shared loader for GE price JSON from remote or bundled sources.
|
* Shared loader for GE price JSON from remote or bundled sources.
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package KondoKit
|
package KondoKit.util
|
||||||
|
|
||||||
|
import KondoKit.plugin
|
||||||
import rt4.GameShell
|
import rt4.GameShell
|
||||||
import java.awt.*
|
import java.awt.*
|
||||||
import java.awt.image.BufferedImage
|
import java.awt.image.BufferedImage
|
||||||
|
|
@ -12,7 +13,6 @@ import java.lang.reflect.Type
|
||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.Timer
|
import java.util.Timer
|
||||||
import javax.swing.*
|
import javax.swing.*
|
||||||
import KondoKit.setFixedSize
|
|
||||||
|
|
||||||
object Helpers {
|
object Helpers {
|
||||||
// Convenience helper for loading resources relative to the KondoKit plugin class
|
// Convenience helper for loading resources relative to the KondoKit plugin class
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package KondoKit.network
|
package KondoKit.util
|
||||||
|
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.net.HttpURLConnection
|
import java.net.HttpURLConnection
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package KondoKit
|
package KondoKit.util
|
||||||
|
|
||||||
import KondoKit.plugin.Companion.WIDGET_COLOR
|
import KondoKit.plugin.Companion.WIDGET_COLOR
|
||||||
import java.awt.Canvas
|
import java.awt.Canvas
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
package KondoKit
|
package KondoKit.util
|
||||||
|
|
||||||
import rt4.GlIndexedSprite
|
import rt4.GlIndexedSprite
|
||||||
import rt4.GlSprite
|
import rt4.GlSprite
|
||||||
31
plugin-playground/src/main/kotlin/KondoKit/util/XPTable.kt
Normal file
31
plugin-playground/src/main/kotlin/KondoKit/util/XPTable.kt
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
package KondoKit.util
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility for mapping XP values to levels and vice versa.
|
||||||
|
*/
|
||||||
|
object XPTable {
|
||||||
|
private val xpForLevels: IntArray = IntArray(100)
|
||||||
|
|
||||||
|
init {
|
||||||
|
var points = 0.0
|
||||||
|
for (level in 1..99) {
|
||||||
|
points += Math.floor(level + 300.0 * Math.pow(2.0, level / 7.0))
|
||||||
|
xpForLevels[level] = Math.floor(points / 4).toInt()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getLevelForXp(xp: Int): Pair<Int, Int> {
|
||||||
|
for (i in 1..99) {
|
||||||
|
if (xp < xpForLevels[i]) {
|
||||||
|
return Pair(i - 1, xp - xpForLevels[i - 1])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Pair(99, 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getXpRequiredForLevel(level: Int): Int {
|
||||||
|
if (level <= 0) return 0
|
||||||
|
if (level >= 99) return xpForLevels[99]
|
||||||
|
return xpForLevels[level]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
package KondoKit.views
|
package KondoKit.views
|
||||||
|
|
||||||
import KondoKit.Helpers.getSpriteId
|
import KondoKit.util.Helpers.getSpriteId
|
||||||
import KondoKit.Helpers.showToast
|
import KondoKit.util.Helpers.showToast
|
||||||
import KondoKit.ImageCanvas
|
import KondoKit.util.ImageCanvas
|
||||||
import KondoKit.ViewConstants
|
import KondoKit.ui.BaseView
|
||||||
import KondoKit.SpriteToBufferedImage.getBufferedImageFromSprite
|
import KondoKit.ui.ViewConstants
|
||||||
import KondoKit.components.LabelComponent
|
import KondoKit.ui.View
|
||||||
import KondoKit.components.WidgetPanel
|
import KondoKit.util.SpriteToBufferedImage.getBufferedImageFromSprite
|
||||||
import KondoKit.components.SearchField
|
import KondoKit.ui.components.LabelComponent
|
||||||
|
import KondoKit.ui.components.WidgetPanel
|
||||||
|
import KondoKit.ui.components.SearchField
|
||||||
import KondoKit.views.ViewLayoutHelpers.createSearchFieldSection
|
import KondoKit.views.ViewLayoutHelpers.createSearchFieldSection
|
||||||
import KondoKit.plugin.Companion.WIDGET_COLOR
|
import KondoKit.plugin.Companion.WIDGET_COLOR
|
||||||
import KondoKit.plugin.Companion.VIEW_BACKGROUND_COLOR
|
import KondoKit.plugin.Companion.VIEW_BACKGROUND_COLOR
|
||||||
|
|
@ -19,8 +21,8 @@ import KondoKit.util.JsonParser
|
||||||
import plugin.api.API
|
import plugin.api.API
|
||||||
import rt4.Sprites
|
import rt4.Sprites
|
||||||
import java.awt.*
|
import java.awt.*
|
||||||
import KondoKit.network.HttpFetcher
|
import KondoKit.util.HttpFetcher
|
||||||
import KondoKit.network.HttpStatusException
|
import KondoKit.util.HttpStatusException
|
||||||
import java.net.SocketTimeoutException
|
import java.net.SocketTimeoutException
|
||||||
import javax.swing.*
|
import javax.swing.*
|
||||||
import javax.swing.border.MatteBorder
|
import javax.swing.border.MatteBorder
|
||||||
|
|
@ -133,7 +135,7 @@ object HiscoresView : View {
|
||||||
widgetHeight = ViewConstants.TOTAL_COMBAT_PANEL_SIZE.height,
|
widgetHeight = ViewConstants.TOTAL_COMBAT_PANEL_SIZE.height,
|
||||||
addDefaultPadding = false
|
addDefaultPadding = false
|
||||||
).apply {
|
).apply {
|
||||||
layout = FlowLayout(FlowLayout.LEFT, 0, 0)
|
layout = FlowLayout(FlowLayout.CENTER, 0, 0)
|
||||||
background = WIDGET_COLOR
|
background = WIDGET_COLOR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -156,9 +158,10 @@ object HiscoresView : View {
|
||||||
val totalLevelPanel = WidgetPanel(
|
val totalLevelPanel = WidgetPanel(
|
||||||
widgetWidth = ViewConstants.TOTAL_COMBAT_PANEL_SIZE.width / 2,
|
widgetWidth = ViewConstants.TOTAL_COMBAT_PANEL_SIZE.width / 2,
|
||||||
widgetHeight = ViewConstants.TOTAL_COMBAT_PANEL_SIZE.height,
|
widgetHeight = ViewConstants.TOTAL_COMBAT_PANEL_SIZE.height,
|
||||||
addDefaultPadding = false
|
addDefaultPadding = false,
|
||||||
|
paddingLeft = 45
|
||||||
).apply {
|
).apply {
|
||||||
layout = FlowLayout(FlowLayout.LEFT, 5, 0)
|
layout = FlowLayout(FlowLayout.LEFT, 5, 5)
|
||||||
background = WIDGET_COLOR
|
background = WIDGET_COLOR
|
||||||
add(totalLevelIcon)
|
add(totalLevelIcon)
|
||||||
add(totalLevelLabel)
|
add(totalLevelLabel)
|
||||||
|
|
@ -185,7 +188,7 @@ object HiscoresView : View {
|
||||||
widgetHeight = ViewConstants.TOTAL_COMBAT_PANEL_SIZE.height,
|
widgetHeight = ViewConstants.TOTAL_COMBAT_PANEL_SIZE.height,
|
||||||
addDefaultPadding = false
|
addDefaultPadding = false
|
||||||
).apply {
|
).apply {
|
||||||
layout = FlowLayout(FlowLayout.LEFT, 5, 0)
|
layout = FlowLayout(FlowLayout.LEFT, 5, 6)
|
||||||
background = WIDGET_COLOR
|
background = WIDGET_COLOR
|
||||||
add(combatLevelIcon)
|
add(combatLevelIcon)
|
||||||
add(combatLevelLabel)
|
add(combatLevelLabel)
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,21 @@
|
||||||
package KondoKit.views
|
package KondoKit.views
|
||||||
|
|
||||||
import KondoKit.Helpers
|
import KondoKit.util.Helpers
|
||||||
import KondoKit.Helpers.formatHtmlLabelText
|
import KondoKit.util.Helpers.formatHtmlLabelText
|
||||||
import KondoKit.ImageCanvas
|
import KondoKit.util.ImageCanvas
|
||||||
import KondoKit.SpriteToBufferedImage.getBufferedImageFromSprite
|
import KondoKit.util.SpriteToBufferedImage.getBufferedImageFromSprite
|
||||||
import KondoKit.ViewConstants
|
import KondoKit.ui.BaseView
|
||||||
import KondoKit.setFixedSize
|
import KondoKit.ui.OnKillingBlowNPCCallback
|
||||||
import KondoKit.attachPopupMenu
|
import KondoKit.ui.OnPostClientTickCallback
|
||||||
|
import KondoKit.ui.ViewConstants
|
||||||
|
import KondoKit.ui.View
|
||||||
|
import KondoKit.util.attachPopupMenu
|
||||||
|
import KondoKit.ui.components.XPWidget
|
||||||
|
import KondoKit.util.setFixedSize
|
||||||
import KondoKit.views.XPTrackerView.wrappedWidget
|
import KondoKit.views.XPTrackerView.wrappedWidget
|
||||||
import KondoKit.components.PopupMenuComponent
|
import KondoKit.ui.components.PopupMenuComponent
|
||||||
import KondoKit.components.ProgressBar
|
import KondoKit.ui.components.ProgressBar
|
||||||
import KondoKit.components.WidgetPanel
|
import KondoKit.ui.components.WidgetPanel
|
||||||
import KondoKit.plugin.Companion.TITLE_BAR_COLOR
|
import KondoKit.plugin.Companion.TITLE_BAR_COLOR
|
||||||
import KondoKit.plugin.Companion.TOOLTIP_BACKGROUND
|
import KondoKit.plugin.Companion.TOOLTIP_BACKGROUND
|
||||||
import KondoKit.plugin.Companion.TOTAL_XP_WIDGET_SIZE
|
import KondoKit.plugin.Companion.TOTAL_XP_WIDGET_SIZE
|
||||||
|
|
@ -513,18 +518,4 @@ object LootTrackerView : View, OnPostClientTickCallback, OnKillingBlowNPCCallbac
|
||||||
|
|
||||||
data class GroundSnapshot(val items: Set<Item>, val location: Pair<Int, Int>, var age: Int)
|
data class GroundSnapshot(val items: Set<Item>, val location: Pair<Int, Int>, var age: Int)
|
||||||
data class Item(val id: Int, val quantity: Int)
|
data class Item(val id: Int, val quantity: Int)
|
||||||
|
|
||||||
// XPWidget data class for loot tracking
|
|
||||||
data class XPWidget(
|
|
||||||
val container: Container,
|
|
||||||
val skillId: Int,
|
|
||||||
val xpGainedLabel: JLabel,
|
|
||||||
val xpLeftLabel: JLabel,
|
|
||||||
val xpPerHourLabel: JLabel,
|
|
||||||
val actionsRemainingLabel: JLabel,
|
|
||||||
val progressBar: ProgressBar,
|
|
||||||
var totalXpGained: Int = 0,
|
|
||||||
var startTime: Long = System.currentTimeMillis(),
|
|
||||||
var previousXp: Int = 0
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,23 +1,24 @@
|
||||||
package KondoKit.views
|
package KondoKit.views
|
||||||
|
|
||||||
import KondoKit.Helpers
|
import KondoKit.pluginmanager.ReflectiveEditorPlugin
|
||||||
import KondoKit.components.*
|
import KondoKit.util.attachPopupMenu
|
||||||
import KondoKit.ViewConstants
|
import KondoKit.ui.components.*
|
||||||
import KondoKit.views.ViewLayoutHelpers.createSearchFieldSection
|
|
||||||
import KondoKit.setFixedSize
|
|
||||||
import KondoKit.attachPopupMenu
|
|
||||||
import KondoKit.ReflectiveEditorPlugin
|
|
||||||
import KondoKit.pluginmanager.GitLabPlugin
|
import KondoKit.pluginmanager.GitLabPlugin
|
||||||
import KondoKit.pluginmanager.GitLabPluginFetcher
|
|
||||||
import KondoKit.pluginmanager.PluginDownloadManager
|
|
||||||
import KondoKit.pluginmanager.PluginProperties
|
|
||||||
import KondoKit.pluginmanager.PluginInfoWithStatus
|
import KondoKit.pluginmanager.PluginInfoWithStatus
|
||||||
import KondoKit.Helpers.showToast
|
import KondoKit.pluginmanager.PluginProperties
|
||||||
import KondoKit.plugin.Companion.TOOLTIP_BACKGROUND
|
import KondoKit.plugin.Companion.TOOLTIP_BACKGROUND
|
||||||
import KondoKit.plugin.Companion.VIEW_BACKGROUND_COLOR
|
import KondoKit.plugin.Companion.VIEW_BACKGROUND_COLOR
|
||||||
import KondoKit.plugin.Companion.WIDGET_COLOR
|
import KondoKit.plugin.Companion.WIDGET_COLOR
|
||||||
import KondoKit.plugin.Companion.WRENCH_ICON
|
import KondoKit.plugin.Companion.WRENCH_ICON
|
||||||
import KondoKit.plugin.Companion.secondaryColor
|
import KondoKit.plugin.Companion.secondaryColor
|
||||||
|
import KondoKit.pluginmanager.GitLabPluginFetcher
|
||||||
|
import KondoKit.pluginmanager.PluginDownloadManager
|
||||||
|
import KondoKit.util.setFixedSize
|
||||||
|
import KondoKit.ui.BaseView
|
||||||
|
import KondoKit.ui.View
|
||||||
|
import KondoKit.ui.ViewConstants
|
||||||
|
import KondoKit.util.Helpers.showToast
|
||||||
|
import KondoKit.views.ViewLayoutHelpers.createSearchFieldSection
|
||||||
import plugin.Plugin
|
import plugin.Plugin
|
||||||
import plugin.PluginInfo
|
import plugin.PluginInfo
|
||||||
import plugin.PluginRepository
|
import plugin.PluginRepository
|
||||||
|
|
@ -805,18 +806,6 @@ object ReflectiveEditorView : View {
|
||||||
reflectiveEditorPlugin.deletePlugin(pluginName, isDisabled, mainPanel ?: JPanel())
|
reflectiveEditorPlugin.deletePlugin(pluginName, isDisabled, mainPanel ?: JPanel())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper method to recursively delete a directory
|
|
||||||
private fun deleteRecursively(file: File): Boolean {
|
|
||||||
if (file.isDirectory) {
|
|
||||||
file.listFiles()?.forEach { child ->
|
|
||||||
if (!deleteRecursively(child)) {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return file.delete()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper method to reset a ScrollablePanel to the top
|
// Helper method to reset a ScrollablePanel to the top
|
||||||
private fun resetScrollablePanel(scrollablePanel: ScrollablePanel) {
|
private fun resetScrollablePanel(scrollablePanel: ScrollablePanel) {
|
||||||
// Access the content panel and reset its position
|
// Access the content panel and reset its position
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
package KondoKit.views
|
package KondoKit.views
|
||||||
|
|
||||||
import KondoKit.ViewConstants
|
import KondoKit.ui.ViewConstants
|
||||||
import KondoKit.components.SearchField
|
import KondoKit.ui.components.SearchField
|
||||||
import KondoKit.components.WidgetPanel
|
import KondoKit.ui.components.WidgetPanel
|
||||||
import KondoKit.plugin.Companion.VIEW_BACKGROUND_COLOR
|
import KondoKit.plugin.Companion.VIEW_BACKGROUND_COLOR
|
||||||
import java.awt.Color
|
import java.awt.Color
|
||||||
import java.awt.Component
|
import java.awt.Component
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,23 @@
|
||||||
package KondoKit.views
|
package KondoKit.views
|
||||||
|
|
||||||
import KondoKit.Helpers
|
import KondoKit.util.Helpers
|
||||||
import KondoKit.Helpers.formatHtmlLabelText
|
import KondoKit.util.Helpers.formatHtmlLabelText
|
||||||
import KondoKit.Helpers.formatNumber
|
import KondoKit.util.Helpers.formatNumber
|
||||||
import KondoKit.Helpers.getProgressBarColor
|
import KondoKit.util.Helpers.getProgressBarColor
|
||||||
import KondoKit.Helpers.getSpriteId
|
import KondoKit.util.Helpers.getSpriteId
|
||||||
import KondoKit.SpriteToBufferedImage.getBufferedImageFromSprite
|
import KondoKit.util.SpriteToBufferedImage.getBufferedImageFromSprite
|
||||||
import KondoKit.ViewConstants
|
import KondoKit.ui.BaseView
|
||||||
import KondoKit.setFixedSize
|
import KondoKit.ui.OnUpdateCallback
|
||||||
import KondoKit.attachPopupMenu
|
import KondoKit.ui.OnXPUpdateCallback
|
||||||
import KondoKit.XPTable
|
import KondoKit.ui.ViewConstants
|
||||||
import KondoKit.components.PopupMenuComponent
|
import KondoKit.ui.View
|
||||||
import KondoKit.components.ProgressBar
|
import KondoKit.util.setFixedSize
|
||||||
import KondoKit.components.WidgetPanel
|
import KondoKit.util.attachPopupMenu
|
||||||
|
import KondoKit.util.XPTable
|
||||||
|
import KondoKit.ui.components.PopupMenuComponent
|
||||||
|
import KondoKit.ui.components.ProgressBar
|
||||||
|
import KondoKit.ui.components.WidgetPanel
|
||||||
|
import KondoKit.ui.components.XPWidget
|
||||||
import KondoKit.plugin.Companion.IMAGE_SIZE
|
import KondoKit.plugin.Companion.IMAGE_SIZE
|
||||||
import KondoKit.plugin.Companion.LVL_ICON
|
import KondoKit.plugin.Companion.LVL_ICON
|
||||||
import KondoKit.plugin.Companion.TOTAL_XP_WIDGET_SIZE
|
import KondoKit.plugin.Companion.TOTAL_XP_WIDGET_SIZE
|
||||||
|
|
@ -460,17 +465,3 @@ object XPTrackerView : View, OnUpdateCallback, OnXPUpdateCallback {
|
||||||
return outerPanel
|
return outerPanel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
data class XPWidget(
|
|
||||||
val container: Container,
|
|
||||||
val skillId: Int,
|
|
||||||
val xpGainedLabel: JLabel,
|
|
||||||
val xpLeftLabel: JLabel,
|
|
||||||
val xpPerHourLabel: JLabel,
|
|
||||||
val actionsRemainingLabel: JLabel,
|
|
||||||
val progressBar: ProgressBar,
|
|
||||||
var totalXpGained: Int = 0,
|
|
||||||
var startTime: Long = System.currentTimeMillis(),
|
|
||||||
var previousXp: Int = 0
|
|
||||||
)
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue