diff --git a/plugin-playground/src/main/kotlin/KondoKit/.DS_Store b/plugin-playground/src/main/kotlin/KondoKit/.DS_Store index c7862e6..a55bac8 100644 Binary files a/plugin-playground/src/main/kotlin/KondoKit/.DS_Store and b/plugin-playground/src/main/kotlin/KondoKit/.DS_Store differ diff --git a/plugin-playground/src/main/kotlin/KondoKit/XPTable.kt b/plugin-playground/src/main/kotlin/KondoKit/XPTable.kt deleted file mode 100644 index 78138fe..0000000 --- a/plugin-playground/src/main/kotlin/KondoKit/XPTable.kt +++ /dev/null @@ -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 = 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 { - 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 - } -} diff --git a/plugin-playground/src/main/kotlin/KondoKit/plugin.kt b/plugin-playground/src/main/kotlin/KondoKit/plugin.kt index e2cf637..08fec9f 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/plugin.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/plugin.kt @@ -1,18 +1,22 @@ package KondoKit -import KondoKit.Helpers.getSpriteId -import KondoKit.Helpers.showAlert +import KondoKit.util.Helpers.getSpriteId +import KondoKit.util.Helpers.showAlert import KondoKit.views.* -import KondoKit.views.OnUpdateCallback -import KondoKit.views.OnDrawCallback -import KondoKit.views.OnXPUpdateCallback -import KondoKit.views.OnKillingBlowNPCCallback -import KondoKit.views.OnPostClientTickCallback -import KondoKit.SpriteToBufferedImage.getBufferedImageFromSprite -import KondoKit.Themes.Theme -import KondoKit.Themes.ThemeType -import KondoKit.Themes.getTheme -import KondoKit.components.ScrollablePanel +import KondoKit.ui.OnUpdateCallback +import KondoKit.ui.OnDrawCallback +import KondoKit.ui.OnXPUpdateCallback +import KondoKit.ui.OnKillingBlowNPCCallback +import KondoKit.ui.OnPostClientTickCallback +import KondoKit.util.AltCanvas +import KondoKit.util.SpriteToBufferedImage.getBufferedImageFromSprite +import KondoKit.util.ImageCanvas +import KondoKit.util.setFixedSize +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.api.* import plugin.api.API.* @@ -29,6 +33,8 @@ import java.awt.event.ActionListener import java.awt.event.MouseAdapter import java.awt.event.MouseEvent import javax.swing.* +import KondoKit.ui.View +import KondoKit.util.Helpers @Target(AnnotationTarget.FIELD) diff --git a/plugin-playground/src/main/kotlin/KondoKit/pluginmanager/GitLabPluginFetcher.kt b/plugin-playground/src/main/kotlin/KondoKit/pluginmanager/GitLabPluginFetcher.kt index c0cea5a..bb7a417 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/pluginmanager/GitLabPluginFetcher.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/pluginmanager/GitLabPluginFetcher.kt @@ -1,14 +1,16 @@ 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 java.io.BufferedReader import java.io.InputStreamReader import java.net.HttpURLConnection import java.util.concurrent.* import javax.swing.SwingUtilities -import KondoKit.network.HttpFetcher -import KondoKit.pluginmanager.GitLabConfig -import KondoKit.util.JsonParser object GitLabPluginFetcher { diff --git a/plugin-playground/src/main/kotlin/KondoKit/pluginmanager/PluginDownloadManager.kt b/plugin-playground/src/main/kotlin/KondoKit/pluginmanager/PluginDownloadManager.kt index 64f810d..067a6b6 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/pluginmanager/PluginDownloadManager.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/pluginmanager/PluginDownloadManager.kt @@ -1,5 +1,8 @@ package KondoKit.pluginmanager +import KondoKit.pluginmanager.GitLabPlugin +import KondoKit.util.HttpFetcher +import KondoKit.pluginmanager.GitLabConfig import KondoKit.views.ReflectiveEditorView import plugin.PluginRepository import java.awt.EventQueue @@ -10,8 +13,6 @@ import java.util.concurrent.* import java.util.zip.ZipEntry import java.util.zip.ZipInputStream import javax.swing.SwingUtilities -import KondoKit.pluginmanager.GitLabConfig -import KondoKit.network.HttpFetcher /** * Manages downloading and installing plugins from GitLab with concurrent support diff --git a/plugin-playground/src/main/kotlin/KondoKit/pluginmanager/GitLabDataModels.kt b/plugin-playground/src/main/kotlin/KondoKit/pluginmanager/PluginModels.kt similarity index 99% rename from plugin-playground/src/main/kotlin/KondoKit/pluginmanager/GitLabDataModels.kt rename to plugin-playground/src/main/kotlin/KondoKit/pluginmanager/PluginModels.kt index 22bbd4f..adf92af 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/pluginmanager/GitLabDataModels.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/pluginmanager/PluginModels.kt @@ -27,4 +27,4 @@ data class PluginInfoWithStatus( val needsUpdate: Boolean, val isDownloading: Boolean = false, val downloadProgress: Int = 0 -) \ No newline at end of file +) diff --git a/plugin-playground/src/main/kotlin/KondoKit/ReflectiveEditorPlugin.kt b/plugin-playground/src/main/kotlin/KondoKit/pluginmanager/ReflectiveEditorPlugin.kt similarity index 97% rename from plugin-playground/src/main/kotlin/KondoKit/ReflectiveEditorPlugin.kt rename to plugin-playground/src/main/kotlin/KondoKit/pluginmanager/ReflectiveEditorPlugin.kt index 2d0944b..9403ded 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/ReflectiveEditorPlugin.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/pluginmanager/ReflectiveEditorPlugin.kt @@ -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 plugin.Plugin import plugin.PluginInfo @@ -201,7 +205,7 @@ class ReflectiveEditorPlugin : Plugin() { val disabledDir = File(pluginsDirectory, "disabled") val pluginDir = File(disabledDir, pluginName) if (pluginDir.exists() && pluginDir.isDirectory) { - if (deleteRecursively(pluginDir)) { + if (FileUtils.deleteRecursively(pluginDir)) { needsReload = true } } @@ -228,7 +232,7 @@ class ReflectiveEditorPlugin : Plugin() { if (pluginDir.exists() && pluginDir.isDirectory) { // Recursively delete the directory - if (deleteRecursively(pluginDir)) { + if (FileUtils.deleteRecursively(pluginDir)) { Helpers.showToast(mainPanel, "Plugin deleted successfully", JOptionPane.INFORMATION_MESSAGE) // 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 private fun isKondoKit(pluginName: String): Boolean { return pluginName == "KondoKit" @@ -470,4 +462,4 @@ class ReflectiveEditorPlugin : Plugin() { fun setReloadPlugins(reload: Boolean) { reloadPlugins = reload } -} \ No newline at end of file +} diff --git a/plugin-playground/src/main/kotlin/KondoKit/views/BaseView.kt b/plugin-playground/src/main/kotlin/KondoKit/ui/BaseView.kt similarity index 89% rename from plugin-playground/src/main/kotlin/KondoKit/views/BaseView.kt rename to plugin-playground/src/main/kotlin/KondoKit/ui/BaseView.kt index 4479f1b..01e5df5 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/views/BaseView.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/ui/BaseView.kt @@ -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.setFixedSize +import KondoKit.util.setFixedSize import javax.swing.BorderFactory import javax.swing.Box import javax.swing.BoxLayout diff --git a/plugin-playground/src/main/kotlin/KondoKit/views/View.kt b/plugin-playground/src/main/kotlin/KondoKit/ui/View.kt similarity index 52% rename from plugin-playground/src/main/kotlin/KondoKit/views/View.kt rename to plugin-playground/src/main/kotlin/KondoKit/ui/View.kt index 38275b8..672a53a 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/views/View.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/ui/View.kt @@ -1,12 +1,15 @@ -package KondoKit.views +package KondoKit.ui import javax.swing.JPanel +/** + * Contract implemented by UI views; kept in a dedicated UI package to avoid tangling with concrete implementations. + */ interface View { val name: String val iconSpriteId: Int val panel: JPanel - + fun createView() fun registerFunctions() -} \ No newline at end of file +} diff --git a/plugin-playground/src/main/kotlin/KondoKit/views/ViewCallbacks.kt b/plugin-playground/src/main/kotlin/KondoKit/ui/ViewCallbacks.kt similarity index 93% rename from plugin-playground/src/main/kotlin/KondoKit/views/ViewCallbacks.kt rename to plugin-playground/src/main/kotlin/KondoKit/ui/ViewCallbacks.kt index d76f9ff..52a4e5d 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/views/ViewCallbacks.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/ui/ViewCallbacks.kt @@ -1,4 +1,4 @@ -package KondoKit.views +package KondoKit.ui interface OnUpdateCallback { fun onUpdate() @@ -18,4 +18,4 @@ interface OnKillingBlowNPCCallback { interface OnPostClientTickCallback { fun onPostClientTick() -} \ No newline at end of file +} diff --git a/plugin-playground/src/main/kotlin/KondoKit/ViewConstants.kt b/plugin-playground/src/main/kotlin/KondoKit/ui/ViewConstants.kt similarity index 89% rename from plugin-playground/src/main/kotlin/KondoKit/ViewConstants.kt rename to plugin-playground/src/main/kotlin/KondoKit/ui/ViewConstants.kt index 233af6e..49e5162 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/ViewConstants.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/ui/ViewConstants.kt @@ -1,4 +1,4 @@ -package KondoKit +package KondoKit.ui import java.awt.Color import java.awt.Dimension @@ -6,19 +6,15 @@ import java.awt.Font /** * 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 { - - // Common Fonts 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_PLAIN_16 = Font("RuneScape Small", Font.PLAIN, 16) val FONT_RUNESCAPE_SMALL_BOLD_16 = Font("RuneScape Small", Font.BOLD, 16) val FONT_ARIAL_PLAIN_14 = Font("Arial", Font.PLAIN, 14) val FONT_ARIAL_BOLD_12 = Font("Arial", Font.BOLD, 12) - - // Common Dimensions + val DIMENSION_SMALL_ICON = Dimension(12, 12) val DIMENSION_LARGE_ICON = Dimension(30, 30) val DEFAULT_WIDGET_SIZE = Dimension(234, 50) @@ -37,18 +33,15 @@ object ViewConstants { val NUMBER_LABEL_SIZE = Dimension(20, 20) val PROGRESS_BAR_SIZE = Dimension(220, 16) val TOGGLE_SWITCH_SIZE = Dimension(32, 20) - - // Common Colors + val COLOR_WHITE = Color.WHITE val COLOR_BLACK = Color.BLACK val COLOR_DARK_GRAY = Color.DARK_GRAY val COLOR_RED = Color.RED 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) - - // Sprite IDs + const val COMBAT_LVL_SPRITE = 168 const val IRONMAN_SPRITE = 4 const val MAG_SPRITE = 1423 diff --git a/plugin-playground/src/main/kotlin/KondoKit/components/ButtonPanel.kt b/plugin-playground/src/main/kotlin/KondoKit/ui/components/ButtonPanel.kt similarity index 87% rename from plugin-playground/src/main/kotlin/KondoKit/components/ButtonPanel.kt rename to plugin-playground/src/main/kotlin/KondoKit/ui/components/ButtonPanel.kt index b397fc7..fdf0954 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/components/ButtonPanel.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/ui/components/ButtonPanel.kt @@ -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.WIDGET_COLOR import KondoKit.plugin.Companion.secondaryColor -import KondoKit.components.UiStyler.button -import KondoKit.components.UiStyler.ButtonDefaults +import KondoKit.ui.components.UiStyler.button +import KondoKit.ui.components.UiStyler.ButtonDefaults import java.awt.* import javax.swing.* diff --git a/plugin-playground/src/main/kotlin/KondoKit/components/IconComponent.kt b/plugin-playground/src/main/kotlin/KondoKit/ui/components/IconComponent.kt similarity index 91% rename from plugin-playground/src/main/kotlin/KondoKit/components/IconComponent.kt rename to plugin-playground/src/main/kotlin/KondoKit/ui/components/IconComponent.kt index c695976..2e4aee5 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/components/IconComponent.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/ui/components/IconComponent.kt @@ -1,8 +1,8 @@ -package KondoKit.components +package KondoKit.ui.components -import KondoKit.ImageCanvas -import KondoKit.SpriteToBufferedImage -import KondoKit.setFixedSize +import KondoKit.util.ImageCanvas +import KondoKit.util.SpriteToBufferedImage +import KondoKit.util.setFixedSize import KondoKit.plugin.Companion.WIDGET_COLOR import KondoKit.plugin.Companion.primaryColor import KondoKit.plugin.Companion.secondaryColor diff --git a/plugin-playground/src/main/kotlin/KondoKit/components/LabelComponent.kt b/plugin-playground/src/main/kotlin/KondoKit/ui/components/LabelComponent.kt similarity index 89% rename from plugin-playground/src/main/kotlin/KondoKit/components/LabelComponent.kt rename to plugin-playground/src/main/kotlin/KondoKit/ui/components/LabelComponent.kt index c0a80cb..f6809bd 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/components/LabelComponent.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/ui/components/LabelComponent.kt @@ -1,7 +1,7 @@ -package KondoKit.components +package KondoKit.ui.components -import KondoKit.Helpers.formatHtmlLabelText -import KondoKit.ViewConstants +import KondoKit.util.Helpers.formatHtmlLabelText +import KondoKit.ui.ViewConstants import KondoKit.plugin.Companion.primaryColor import KondoKit.plugin.Companion.secondaryColor import java.awt.Font @@ -33,4 +33,4 @@ class LabelComponent( fun setAsHeader() { font = ViewConstants.FONT_RUNESCAPE_SMALL_16.deriveFont(Font.BOLD) } -} \ No newline at end of file +} diff --git a/plugin-playground/src/main/kotlin/KondoKit/components/PopupMenuComponent.kt b/plugin-playground/src/main/kotlin/KondoKit/ui/components/PopupMenuComponent.kt similarity index 83% rename from plugin-playground/src/main/kotlin/KondoKit/components/PopupMenuComponent.kt rename to plugin-playground/src/main/kotlin/KondoKit/ui/components/PopupMenuComponent.kt index 4126898..f324a97 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/components/PopupMenuComponent.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/ui/components/PopupMenuComponent.kt @@ -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 javax.swing.JMenuItem import javax.swing.JPopupMenu diff --git a/plugin-playground/src/main/kotlin/KondoKit/components/ProgressBar.kt b/plugin-playground/src/main/kotlin/KondoKit/ui/components/ProgressBar.kt similarity index 97% rename from plugin-playground/src/main/kotlin/KondoKit/components/ProgressBar.kt rename to plugin-playground/src/main/kotlin/KondoKit/ui/components/ProgressBar.kt index 0d0ab63..430f485 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/components/ProgressBar.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/ui/components/ProgressBar.kt @@ -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.secondaryColor import java.awt.Canvas diff --git a/plugin-playground/src/main/kotlin/KondoKit/components/ScrollablePanel.kt b/plugin-playground/src/main/kotlin/KondoKit/ui/components/ScrollablePanel.kt similarity index 99% rename from plugin-playground/src/main/kotlin/KondoKit/components/ScrollablePanel.kt rename to plugin-playground/src/main/kotlin/KondoKit/ui/components/ScrollablePanel.kt index fbe0e99..319fb53 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/components/ScrollablePanel.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/ui/components/ScrollablePanel.kt @@ -1,4 +1,4 @@ -package KondoKit.components +package KondoKit.ui.components import KondoKit.plugin.Companion.SCROLL_BAR_COLOR import KondoKit.plugin.Companion.VIEW_BACKGROUND_COLOR diff --git a/plugin-playground/src/main/kotlin/KondoKit/components/SearchField.kt b/plugin-playground/src/main/kotlin/KondoKit/ui/components/SearchField.kt similarity index 97% rename from plugin-playground/src/main/kotlin/KondoKit/components/SearchField.kt rename to plugin-playground/src/main/kotlin/KondoKit/ui/components/SearchField.kt index be21524..642b7d7 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/components/SearchField.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/ui/components/SearchField.kt @@ -1,9 +1,9 @@ -package KondoKit.components +package KondoKit.ui.components -import KondoKit.ImageCanvas -import KondoKit.ViewConstants -import KondoKit.SpriteToBufferedImage -import KondoKit.setFixedSize +import KondoKit.util.ImageCanvas +import KondoKit.ui.ViewConstants +import KondoKit.util.SpriteToBufferedImage +import KondoKit.util.setFixedSize import KondoKit.plugin.Companion.WIDGET_COLOR import KondoKit.plugin.Companion.secondaryColor import KondoKit.plugin.StateManager.focusedView diff --git a/plugin-playground/src/main/kotlin/KondoKit/components/SettingsPanel.kt b/plugin-playground/src/main/kotlin/KondoKit/ui/components/SettingsPanel.kt similarity index 98% rename from plugin-playground/src/main/kotlin/KondoKit/components/SettingsPanel.kt rename to plugin-playground/src/main/kotlin/KondoKit/ui/components/SettingsPanel.kt index 6fe212e..a16ab08 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/components/SettingsPanel.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/ui/components/SettingsPanel.kt @@ -1,10 +1,10 @@ -package KondoKit.components +package KondoKit.ui.components -import KondoKit.Helpers -import KondoKit.Helpers.FieldNotifier -import KondoKit.ViewConstants -import KondoKit.components.UiStyler -import KondoKit.setFixedSize +import KondoKit.util.Helpers +import KondoKit.util.Helpers.FieldNotifier +import KondoKit.ui.ViewConstants +import KondoKit.ui.components.UiStyler +import KondoKit.util.setFixedSize import KondoKit.plugin.Companion.WIDGET_COLOR import KondoKit.plugin.Companion.primaryColor import KondoKit.plugin.Companion.secondaryColor @@ -134,7 +134,7 @@ class SettingsPanel(private val plugin: Plugin) : JPanel() { // Add apply button for non-HashMap editors val applyButton = UiStyler.button( - text = "\u2714", + text = "=>", onClick = { try { val newValue = when (inputComponent) { @@ -398,9 +398,7 @@ class SettingsPanel(private val plugin: Plugin) : JPanel() { ) } } - ).apply { - setFixedSize(120, 30) - } + ) buttonsPanel.add(addButton) buttonsPanel.add(removeButton) diff --git a/plugin-playground/src/main/kotlin/KondoKit/components/ToggleSwitch.kt b/plugin-playground/src/main/kotlin/KondoKit/ui/components/ToggleSwitch.kt similarity index 97% rename from plugin-playground/src/main/kotlin/KondoKit/components/ToggleSwitch.kt rename to plugin-playground/src/main/kotlin/KondoKit/ui/components/ToggleSwitch.kt index 3a53bd7..5371dca 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/components/ToggleSwitch.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/ui/components/ToggleSwitch.kt @@ -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.WIDGET_COLOR import KondoKit.plugin.Companion.primaryColor import KondoKit.plugin.Companion.secondaryColor -import KondoKit.setFixedSize +import KondoKit.util.setFixedSize import java.awt.* import java.awt.event.MouseAdapter import java.awt.event.MouseEvent diff --git a/plugin-playground/src/main/kotlin/KondoKit/components/UiStyler.kt b/plugin-playground/src/main/kotlin/KondoKit/ui/components/UiStyler.kt similarity index 95% rename from plugin-playground/src/main/kotlin/KondoKit/components/UiStyler.kt rename to plugin-playground/src/main/kotlin/KondoKit/ui/components/UiStyler.kt index dd9fadc..d20f068 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/components/UiStyler.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/ui/components/UiStyler.kt @@ -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_FOREGROUND import KondoKit.plugin.Companion.TITLE_BAR_COLOR @@ -53,7 +53,7 @@ object UiStyler { return JButton().apply { text?.let { this.text = it } icon?.let { this.icon = it } - isOpaque = true + isOpaque = false applyDefaults(defaults, onClick) } } diff --git a/plugin-playground/src/main/kotlin/KondoKit/components/ViewHeader.kt b/plugin-playground/src/main/kotlin/KondoKit/ui/components/ViewHeader.kt similarity index 89% rename from plugin-playground/src/main/kotlin/KondoKit/components/ViewHeader.kt rename to plugin-playground/src/main/kotlin/KondoKit/ui/components/ViewHeader.kt index ced0a75..2045073 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/components/ViewHeader.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/ui/components/ViewHeader.kt @@ -1,7 +1,7 @@ -package KondoKit.components +package KondoKit.ui.components -import KondoKit.ViewConstants -import KondoKit.setFixedSize +import KondoKit.ui.ViewConstants +import KondoKit.util.setFixedSize import KondoKit.plugin.Companion.TITLE_BAR_COLOR import KondoKit.plugin.Companion.secondaryColor import java.awt.* diff --git a/plugin-playground/src/main/kotlin/KondoKit/components/WidgetPanel.kt b/plugin-playground/src/main/kotlin/KondoKit/ui/components/WidgetPanel.kt similarity index 93% rename from plugin-playground/src/main/kotlin/KondoKit/components/WidgetPanel.kt rename to plugin-playground/src/main/kotlin/KondoKit/ui/components/WidgetPanel.kt index 99b0e0d..443e933 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/components/WidgetPanel.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/ui/components/WidgetPanel.kt @@ -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.setFixedSize +import KondoKit.util.setFixedSize import java.awt.BorderLayout import java.awt.Dimension import javax.swing.BorderFactory diff --git a/plugin-playground/src/main/kotlin/KondoKit/ui/components/XPWidget.kt b/plugin-playground/src/main/kotlin/KondoKit/ui/components/XPWidget.kt new file mode 100644 index 0000000..d8f67e0 --- /dev/null +++ b/plugin-playground/src/main/kotlin/KondoKit/ui/components/XPWidget.kt @@ -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 +) diff --git a/plugin-playground/src/main/kotlin/KondoKit/Themes.kt b/plugin-playground/src/main/kotlin/KondoKit/ui/theme/Themes.kt similarity index 99% rename from plugin-playground/src/main/kotlin/KondoKit/Themes.kt rename to plugin-playground/src/main/kotlin/KondoKit/ui/theme/Themes.kt index 1b7988d..5937248 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/Themes.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/ui/theme/Themes.kt @@ -1,4 +1,4 @@ -package KondoKit +package KondoKit.ui.theme import java.awt.Color @@ -75,7 +75,6 @@ object Themes { } } - data class Theme( val widgetColor: Color, val titleBarColor: Color, diff --git a/plugin-playground/src/main/kotlin/KondoKit/AltCanvas.kt b/plugin-playground/src/main/kotlin/KondoKit/util/AltCanvas.kt similarity index 99% rename from plugin-playground/src/main/kotlin/KondoKit/AltCanvas.kt rename to plugin-playground/src/main/kotlin/KondoKit/util/AltCanvas.kt index af5c01d..62607fd 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/AltCanvas.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/util/AltCanvas.kt @@ -1,4 +1,4 @@ -package KondoKit +package KondoKit.util import KondoKit.plugin.Companion.FIXED_HEIGHT import KondoKit.plugin.Companion.FIXED_WIDTH @@ -163,4 +163,4 @@ class AltCanvas : Canvas() { dispose() } } -} \ No newline at end of file +} diff --git a/plugin-playground/src/main/kotlin/KondoKit/ComponentExtensions.kt b/plugin-playground/src/main/kotlin/KondoKit/util/ComponentExtensions.kt similarity index 95% rename from plugin-playground/src/main/kotlin/KondoKit/ComponentExtensions.kt rename to plugin-playground/src/main/kotlin/KondoKit/util/ComponentExtensions.kt index 23d05f2..721ab53 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/ComponentExtensions.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/util/ComponentExtensions.kt @@ -1,4 +1,4 @@ -package KondoKit +package KondoKit.util import java.awt.Component import java.awt.Container @@ -6,6 +6,7 @@ import java.awt.Dimension import java.awt.event.MouseAdapter import java.awt.event.MouseEvent import javax.swing.JPopupMenu +import KondoKit.util.Helpers fun T.setFixedSize(width: Int, height: Int): T = setFixedSize(Dimension(width, height)) diff --git a/plugin-playground/src/main/kotlin/KondoKit/util/FileUtils.kt b/plugin-playground/src/main/kotlin/KondoKit/util/FileUtils.kt new file mode 100644 index 0000000..930ac97 --- /dev/null +++ b/plugin-playground/src/main/kotlin/KondoKit/util/FileUtils.kt @@ -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() + } +} diff --git a/plugin-playground/src/main/kotlin/KondoKit/util/GEPriceService.kt b/plugin-playground/src/main/kotlin/KondoKit/util/GEPriceService.kt index f3e7eff..2d64a43 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/util/GEPriceService.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/util/GEPriceService.kt @@ -1,6 +1,6 @@ package KondoKit.util -import KondoKit.network.HttpFetcher +import KondoKit.util.HttpFetcher /** * Shared loader for GE price JSON from remote or bundled sources. diff --git a/plugin-playground/src/main/kotlin/KondoKit/Helpers.kt b/plugin-playground/src/main/kotlin/KondoKit/util/Helpers.kt similarity index 99% rename from plugin-playground/src/main/kotlin/KondoKit/Helpers.kt rename to plugin-playground/src/main/kotlin/KondoKit/util/Helpers.kt index dfca49f..a849771 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/Helpers.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/util/Helpers.kt @@ -1,5 +1,6 @@ -package KondoKit +package KondoKit.util +import KondoKit.plugin import rt4.GameShell import java.awt.* import java.awt.image.BufferedImage @@ -12,7 +13,6 @@ import java.lang.reflect.Type import java.util.* import java.util.Timer import javax.swing.* -import KondoKit.setFixedSize object Helpers { // Convenience helper for loading resources relative to the KondoKit plugin class diff --git a/plugin-playground/src/main/kotlin/KondoKit/network/HttpFetcher.kt b/plugin-playground/src/main/kotlin/KondoKit/util/HttpFetcher.kt similarity index 98% rename from plugin-playground/src/main/kotlin/KondoKit/network/HttpFetcher.kt rename to plugin-playground/src/main/kotlin/KondoKit/util/HttpFetcher.kt index fc90e56..d4fcacc 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/network/HttpFetcher.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/util/HttpFetcher.kt @@ -1,4 +1,4 @@ -package KondoKit.network +package KondoKit.util import java.io.IOException import java.net.HttpURLConnection diff --git a/plugin-playground/src/main/kotlin/KondoKit/ImageCanvas.kt b/plugin-playground/src/main/kotlin/KondoKit/util/ImageCanvas.kt similarity index 97% rename from plugin-playground/src/main/kotlin/KondoKit/ImageCanvas.kt rename to plugin-playground/src/main/kotlin/KondoKit/util/ImageCanvas.kt index 3a9a9f3..5ff600f 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/ImageCanvas.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/util/ImageCanvas.kt @@ -1,4 +1,4 @@ -package KondoKit +package KondoKit.util import KondoKit.plugin.Companion.WIDGET_COLOR import java.awt.Canvas @@ -35,4 +35,4 @@ class ImageCanvas(private val image: BufferedImage) : Canvas() { override fun getPreferredSize(): Dimension { return Dimension(image.width, image.height) } -} \ No newline at end of file +} diff --git a/plugin-playground/src/main/kotlin/KondoKit/SpriteToBufferedImage.kt b/plugin-playground/src/main/kotlin/KondoKit/util/SpriteToBufferedImage.kt similarity index 99% rename from plugin-playground/src/main/kotlin/KondoKit/SpriteToBufferedImage.kt rename to plugin-playground/src/main/kotlin/KondoKit/util/SpriteToBufferedImage.kt index 0258838..5bc04fa 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/SpriteToBufferedImage.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/util/SpriteToBufferedImage.kt @@ -1,4 +1,4 @@ -package KondoKit +package KondoKit.util import rt4.GlIndexedSprite import rt4.GlSprite @@ -196,4 +196,4 @@ object SpriteToBufferedImage { else -> BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB) // Default empty image for unsupported types } } -} \ No newline at end of file +} diff --git a/plugin-playground/src/main/kotlin/KondoKit/util/XPTable.kt b/plugin-playground/src/main/kotlin/KondoKit/util/XPTable.kt new file mode 100644 index 0000000..0eee492 --- /dev/null +++ b/plugin-playground/src/main/kotlin/KondoKit/util/XPTable.kt @@ -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 { + 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] + } +} diff --git a/plugin-playground/src/main/kotlin/KondoKit/views/HiscoresView.kt b/plugin-playground/src/main/kotlin/KondoKit/views/HiscoresView.kt index 78560a7..505db54 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/views/HiscoresView.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/views/HiscoresView.kt @@ -1,13 +1,15 @@ package KondoKit.views -import KondoKit.Helpers.getSpriteId -import KondoKit.Helpers.showToast -import KondoKit.ImageCanvas -import KondoKit.ViewConstants -import KondoKit.SpriteToBufferedImage.getBufferedImageFromSprite -import KondoKit.components.LabelComponent -import KondoKit.components.WidgetPanel -import KondoKit.components.SearchField +import KondoKit.util.Helpers.getSpriteId +import KondoKit.util.Helpers.showToast +import KondoKit.util.ImageCanvas +import KondoKit.ui.BaseView +import KondoKit.ui.ViewConstants +import KondoKit.ui.View +import KondoKit.util.SpriteToBufferedImage.getBufferedImageFromSprite +import KondoKit.ui.components.LabelComponent +import KondoKit.ui.components.WidgetPanel +import KondoKit.ui.components.SearchField import KondoKit.views.ViewLayoutHelpers.createSearchFieldSection import KondoKit.plugin.Companion.WIDGET_COLOR import KondoKit.plugin.Companion.VIEW_BACKGROUND_COLOR @@ -19,8 +21,8 @@ import KondoKit.util.JsonParser import plugin.api.API import rt4.Sprites import java.awt.* -import KondoKit.network.HttpFetcher -import KondoKit.network.HttpStatusException +import KondoKit.util.HttpFetcher +import KondoKit.util.HttpStatusException import java.net.SocketTimeoutException import javax.swing.* import javax.swing.border.MatteBorder @@ -108,7 +110,7 @@ object HiscoresView : View { } } - val numberLabel = JLabel("", JLabel.RIGHT).apply { + val numberLabel = JLabel(" ", JLabel.RIGHT).apply { name = "skillLabel_$i" foreground = POPUP_FOREGROUND font = ViewConstants.FONT_RUNESCAPE_SMALL_16 @@ -133,7 +135,7 @@ object HiscoresView : View { widgetHeight = ViewConstants.TOTAL_COMBAT_PANEL_SIZE.height, addDefaultPadding = false ).apply { - layout = FlowLayout(FlowLayout.LEFT, 0, 0) + layout = FlowLayout(FlowLayout.CENTER, 0, 0) background = WIDGET_COLOR } @@ -145,7 +147,7 @@ object HiscoresView : View { size = ViewConstants.DIMENSION_LARGE_ICON } - val totalLevelLabel = JLabel("").apply { + val totalLevelLabel = JLabel(" ").apply { name = "totalLevelLabel" foreground = POPUP_FOREGROUND font = ViewConstants.FONT_ARIAL_BOLD_12 @@ -156,9 +158,10 @@ object HiscoresView : View { val totalLevelPanel = WidgetPanel( widgetWidth = ViewConstants.TOTAL_COMBAT_PANEL_SIZE.width / 2, widgetHeight = ViewConstants.TOTAL_COMBAT_PANEL_SIZE.height, - addDefaultPadding = false + addDefaultPadding = false, + paddingLeft = 45 ).apply { - layout = FlowLayout(FlowLayout.LEFT, 5, 0) + layout = FlowLayout(FlowLayout.LEFT, 5, 5) background = WIDGET_COLOR add(totalLevelIcon) add(totalLevelLabel) @@ -185,7 +188,7 @@ object HiscoresView : View { widgetHeight = ViewConstants.TOTAL_COMBAT_PANEL_SIZE.height, addDefaultPadding = false ).apply { - layout = FlowLayout(FlowLayout.LEFT, 5, 0) + layout = FlowLayout(FlowLayout.LEFT, 5, 6) background = WIDGET_COLOR add(combatLevelIcon) add(combatLevelLabel) diff --git a/plugin-playground/src/main/kotlin/KondoKit/views/LootTrackerView.kt b/plugin-playground/src/main/kotlin/KondoKit/views/LootTrackerView.kt index aaed8b1..5801b2f 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/views/LootTrackerView.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/views/LootTrackerView.kt @@ -1,16 +1,21 @@ package KondoKit.views -import KondoKit.Helpers -import KondoKit.Helpers.formatHtmlLabelText -import KondoKit.ImageCanvas -import KondoKit.SpriteToBufferedImage.getBufferedImageFromSprite -import KondoKit.ViewConstants -import KondoKit.setFixedSize -import KondoKit.attachPopupMenu +import KondoKit.util.Helpers +import KondoKit.util.Helpers.formatHtmlLabelText +import KondoKit.util.ImageCanvas +import KondoKit.util.SpriteToBufferedImage.getBufferedImageFromSprite +import KondoKit.ui.BaseView +import KondoKit.ui.OnKillingBlowNPCCallback +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.components.PopupMenuComponent -import KondoKit.components.ProgressBar -import KondoKit.components.WidgetPanel +import KondoKit.ui.components.PopupMenuComponent +import KondoKit.ui.components.ProgressBar +import KondoKit.ui.components.WidgetPanel import KondoKit.plugin.Companion.TITLE_BAR_COLOR import KondoKit.plugin.Companion.TOOLTIP_BACKGROUND import KondoKit.plugin.Companion.TOTAL_XP_WIDGET_SIZE @@ -513,18 +518,4 @@ object LootTrackerView : View, OnPostClientTickCallback, OnKillingBlowNPCCallbac data class GroundSnapshot(val items: Set, val location: Pair, var age: 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 - ) } diff --git a/plugin-playground/src/main/kotlin/KondoKit/views/ReflectiveEditorView.kt b/plugin-playground/src/main/kotlin/KondoKit/views/ReflectiveEditorView.kt index f9f30a7..9715597 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/views/ReflectiveEditorView.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/views/ReflectiveEditorView.kt @@ -1,23 +1,24 @@ package KondoKit.views -import KondoKit.Helpers -import KondoKit.components.* -import KondoKit.ViewConstants -import KondoKit.views.ViewLayoutHelpers.createSearchFieldSection -import KondoKit.setFixedSize -import KondoKit.attachPopupMenu -import KondoKit.ReflectiveEditorPlugin +import KondoKit.pluginmanager.ReflectiveEditorPlugin +import KondoKit.util.attachPopupMenu +import KondoKit.ui.components.* import KondoKit.pluginmanager.GitLabPlugin -import KondoKit.pluginmanager.GitLabPluginFetcher -import KondoKit.pluginmanager.PluginDownloadManager -import KondoKit.pluginmanager.PluginProperties import KondoKit.pluginmanager.PluginInfoWithStatus -import KondoKit.Helpers.showToast +import KondoKit.pluginmanager.PluginProperties import KondoKit.plugin.Companion.TOOLTIP_BACKGROUND import KondoKit.plugin.Companion.VIEW_BACKGROUND_COLOR import KondoKit.plugin.Companion.WIDGET_COLOR import KondoKit.plugin.Companion.WRENCH_ICON 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.PluginInfo import plugin.PluginRepository @@ -805,18 +806,6 @@ object ReflectiveEditorView : View { 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 private fun resetScrollablePanel(scrollablePanel: ScrollablePanel) { // Access the content panel and reset its position diff --git a/plugin-playground/src/main/kotlin/KondoKit/views/ViewLayoutHelpers.kt b/plugin-playground/src/main/kotlin/KondoKit/views/ViewLayoutHelpers.kt index 47b7f0a..69e3779 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/views/ViewLayoutHelpers.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/views/ViewLayoutHelpers.kt @@ -1,8 +1,8 @@ package KondoKit.views -import KondoKit.ViewConstants -import KondoKit.components.SearchField -import KondoKit.components.WidgetPanel +import KondoKit.ui.ViewConstants +import KondoKit.ui.components.SearchField +import KondoKit.ui.components.WidgetPanel import KondoKit.plugin.Companion.VIEW_BACKGROUND_COLOR import java.awt.Color import java.awt.Component diff --git a/plugin-playground/src/main/kotlin/KondoKit/views/XPTrackerView.kt b/plugin-playground/src/main/kotlin/KondoKit/views/XPTrackerView.kt index 38c9a33..2439925 100644 --- a/plugin-playground/src/main/kotlin/KondoKit/views/XPTrackerView.kt +++ b/plugin-playground/src/main/kotlin/KondoKit/views/XPTrackerView.kt @@ -1,18 +1,23 @@ package KondoKit.views -import KondoKit.Helpers -import KondoKit.Helpers.formatHtmlLabelText -import KondoKit.Helpers.formatNumber -import KondoKit.Helpers.getProgressBarColor -import KondoKit.Helpers.getSpriteId -import KondoKit.SpriteToBufferedImage.getBufferedImageFromSprite -import KondoKit.ViewConstants -import KondoKit.setFixedSize -import KondoKit.attachPopupMenu -import KondoKit.XPTable -import KondoKit.components.PopupMenuComponent -import KondoKit.components.ProgressBar -import KondoKit.components.WidgetPanel +import KondoKit.util.Helpers +import KondoKit.util.Helpers.formatHtmlLabelText +import KondoKit.util.Helpers.formatNumber +import KondoKit.util.Helpers.getProgressBarColor +import KondoKit.util.Helpers.getSpriteId +import KondoKit.util.SpriteToBufferedImage.getBufferedImageFromSprite +import KondoKit.ui.BaseView +import KondoKit.ui.OnUpdateCallback +import KondoKit.ui.OnXPUpdateCallback +import KondoKit.ui.ViewConstants +import KondoKit.ui.View +import KondoKit.util.setFixedSize +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.LVL_ICON import KondoKit.plugin.Companion.TOTAL_XP_WIDGET_SIZE @@ -460,17 +465,3 @@ object XPTrackerView : View, OnUpdateCallback, OnXPUpdateCallback { 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 -)