mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-20 05:20:24 -07:00
comment pruning
This commit is contained in:
parent
0c1e445a95
commit
f61852660a
15 changed files with 32 additions and 278 deletions
|
|
@ -43,8 +43,6 @@ annotation class Exposed(val description: String = "")
|
|||
|
||||
class plugin : Plugin() {
|
||||
companion object {
|
||||
val WIDGET_SIZE = ViewConstants.DEFAULT_WIDGET_SIZE
|
||||
val TOTAL_XP_WIDGET_SIZE = ViewConstants.TOTAL_XP_WIDGET_SIZE
|
||||
val IMAGE_SIZE = Dimension(25, 23)
|
||||
|
||||
// Default Theme Colors
|
||||
|
|
@ -142,7 +140,6 @@ class plugin : Plugin() {
|
|||
}
|
||||
|
||||
override fun Init() {
|
||||
// Disable Font AA
|
||||
System.setProperty("sun.java2d.opengl", "false")
|
||||
System.setProperty("awt.useSystemAAFontSettings", "off")
|
||||
System.setProperty("swing.aatext", "false")
|
||||
|
|
@ -150,8 +147,6 @@ class plugin : Plugin() {
|
|||
|
||||
override fun OnLogin() {
|
||||
if (lastLogin != "" && lastLogin != Player.usernameInput.toString()) {
|
||||
// if we logged in with a new character
|
||||
// we need to reset the trackers
|
||||
XPTrackerView.xpTrackerView?.let { XPTrackerView.resetXPTracker(it) }
|
||||
}
|
||||
lastLogin = Player.usernameInput.toString()
|
||||
|
|
@ -162,15 +157,12 @@ class plugin : Plugin() {
|
|||
for ((index, entry) in currentEntries.withIndex()) {
|
||||
if (entry.type == MiniMenuType.PLAYER && index == currentEntries.size - 1) {
|
||||
val input = entry.subject
|
||||
// Trim spaces, clean up tags, and remove the level info
|
||||
val cleanedInput = input
|
||||
.trim() // Remove any leading/trailing spaces
|
||||
.replace(Regex("<col=[0-9a-fA-F]{6}>"), "") // Remove color tags
|
||||
.replace(Regex("<img=\\d+>"), "") // Remove image tags
|
||||
.replace(Regex("\\(level: \\d+\\)"), "") // Remove level text e.g. (level: 44)
|
||||
.trim() // Trim again to remove extra spaces after removing level text
|
||||
|
||||
// Proceed with the full cleaned username
|
||||
.trim()
|
||||
.replace(Regex("<col=[0-9a-fA-F]{6}>"), "")
|
||||
.replace(Regex("<img=\\d+>"), "")
|
||||
.replace(Regex("\\(level: \\d+\\)"), "")
|
||||
.trim()
|
||||
InsertMiniMenuEntry("Lookup", entry.subject, searchHiscore(cleanedInput))
|
||||
}
|
||||
}
|
||||
|
|
@ -201,7 +193,6 @@ class plugin : Plugin() {
|
|||
frame.revalidate()
|
||||
frame.repaint()
|
||||
|
||||
// Rebuild the reflective editor UI on the EDT and in one batch
|
||||
ReflectiveEditorView.addPlugins(ReflectiveEditorView.panel)
|
||||
}
|
||||
pluginsReloaded = true
|
||||
|
|
@ -210,7 +201,6 @@ class plugin : Plugin() {
|
|||
}
|
||||
|
||||
override fun OnXPUpdate(skillId: Int, xp: Int) {
|
||||
// Call registered XP update callbacks
|
||||
xpUpdateCallbacks.forEach { callback ->
|
||||
callback.onXPUpdate(skillId, xp)
|
||||
}
|
||||
|
|
@ -223,7 +213,6 @@ class plugin : Plugin() {
|
|||
}
|
||||
|
||||
if (pluginsReloaded) {
|
||||
// Rebuild the reflective editor UI on the EDT and in one batch
|
||||
SwingUtilities.invokeLater {
|
||||
ReflectiveEditorView.addPlugins(ReflectiveEditorView.panel)
|
||||
}
|
||||
|
|
@ -237,14 +226,12 @@ class plugin : Plugin() {
|
|||
|
||||
accumulatedTime += timeDelta
|
||||
if (accumulatedTime >= TICK_INTERVAL) {
|
||||
// Call registered post client tick callbacks
|
||||
postClientTickCallbacks.forEach { callback ->
|
||||
callback.onPostClientTick()
|
||||
}
|
||||
accumulatedTime = 0L
|
||||
}
|
||||
|
||||
// Call registered draw callbacks
|
||||
drawCallbacks.forEach { callback ->
|
||||
callback.onDraw(timeDelta)
|
||||
}
|
||||
|
|
@ -282,25 +269,22 @@ class plugin : Plugin() {
|
|||
} else {
|
||||
moveCanvasToFront()
|
||||
}
|
||||
altCanvas?.updateGameImage() // Update the game image as needed
|
||||
altCanvas?.updateGameImage()
|
||||
}
|
||||
|
||||
override fun Update() {
|
||||
// Call registered update callbacks
|
||||
updateCallbacks.forEach { callback ->
|
||||
callback.onUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
override fun OnKillingBlowNPC(npcID: Int, x: Int, z: Int) {
|
||||
// Call registered killing blow NPC callbacks
|
||||
killingBlowNPCCallbacks.forEach { callback ->
|
||||
callback.onKillingBlowNPC(npcID, x, z)
|
||||
}
|
||||
}
|
||||
|
||||
private fun allSpritesLoaded() : Boolean {
|
||||
// Check all skill sprites
|
||||
try{
|
||||
for (i in 0 until 24) {
|
||||
if(!js5Archive8.isFileReady(getSpriteId(i))){
|
||||
|
|
@ -481,31 +465,27 @@ class plugin : Plugin() {
|
|||
|
||||
cardLayout = CardLayout()
|
||||
mainContentPanel = JPanel(cardLayout).apply {
|
||||
border = BorderFactory.createEmptyBorder(0, 0, 0, 0) // Removes any default border or padding
|
||||
border = BorderFactory.createEmptyBorder(0, 0, 0, 0)
|
||||
background = VIEW_BACKGROUND_COLOR
|
||||
preferredSize = Dimension(MAIN_CONTENT_WIDTH, frame.height)
|
||||
isOpaque = true
|
||||
}
|
||||
|
||||
// Register Views
|
||||
val xpTrackerView = XPTrackerView
|
||||
val hiscoresView = HiscoresView
|
||||
val lootTrackerView = LootTrackerView
|
||||
val reflectiveEditorView = ReflectiveEditorView
|
||||
|
||||
// Create views
|
||||
xpTrackerView.createView()
|
||||
hiscoresView.createView()
|
||||
lootTrackerView.createView()
|
||||
reflectiveEditorView.createView()
|
||||
|
||||
// Register views
|
||||
views.add(xpTrackerView)
|
||||
views.add(hiscoresView)
|
||||
views.add(lootTrackerView)
|
||||
views.add(reflectiveEditorView)
|
||||
|
||||
// Register view functions
|
||||
xpTrackerView.registerFunctions()
|
||||
hiscoresView.registerFunctions()
|
||||
lootTrackerView.registerFunctions()
|
||||
|
|
@ -636,7 +616,6 @@ class plugin : Plugin() {
|
|||
}
|
||||
}
|
||||
|
||||
// ImageCanvas with forced size
|
||||
val imageCanvas = ImageCanvas(bufferedImageSprite).apply {
|
||||
background = WIDGET_COLOR
|
||||
setFixedSize(imageSize)
|
||||
|
|
@ -663,7 +642,6 @@ class plugin : Plugin() {
|
|||
|
||||
add(imageCanvasWrapper, gbc)
|
||||
|
||||
// Hover and click behavior
|
||||
val hoverListener = object : MouseAdapter() {
|
||||
override fun mouseEntered(e: MouseEvent?) {
|
||||
background = WIDGET_COLOR.darker()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue