mirror of
https://gitlab.com/2009scape/rt4-client.git
synced 2025-12-11 09:00:26 -07:00
Update to allow plugin metadata definition from annotations and load other classes in same folder as plugin.class.
This commit is contained in:
parent
9750195081
commit
3e12a9115d
15 changed files with 122 additions and 68 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package SlayerTrackerPlugin
|
||||
|
||||
import plugin.Plugin
|
||||
import plugin.annotations.PluginMeta
|
||||
import plugin.api.API
|
||||
import plugin.api.FontColor
|
||||
import plugin.api.FontType
|
||||
|
|
@ -9,10 +10,11 @@ import rt4.Sprite
|
|||
import java.awt.Color
|
||||
import java.lang.Exception
|
||||
|
||||
/**
|
||||
* Very simple slayer task tracker
|
||||
* @author Ceikry
|
||||
*/
|
||||
@PluginMeta(
|
||||
author = "Ceikry",
|
||||
description = "Draws a simple slayer task tracker onto the screen if one is active.",
|
||||
version = 1.0
|
||||
)
|
||||
class plugin : Plugin() {
|
||||
val boxColor = 6116423
|
||||
val posX = 5
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
AUTHOR='Ceikry'
|
||||
DESCRIPTION='Helps to keep track of kills remaining on a slayer task.'
|
||||
VERSION=1.1
|
||||
40
plugin-playground/src/main/kotlin/XPDropPlugin/XPSprites.kt
Normal file
40
plugin-playground/src/main/kotlin/XPDropPlugin/XPSprites.kt
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
package XPDropPlugin
|
||||
|
||||
import plugin.api.API
|
||||
import rt4.Sprite
|
||||
|
||||
object XPSprites {
|
||||
fun getSpriteForSkill(skillId: Int) : Sprite? {
|
||||
return API.GetSprite(getSpriteId(skillId))
|
||||
}
|
||||
|
||||
private fun getSpriteId(skillId: Int) : Int {
|
||||
return when (skillId) {
|
||||
0 -> 197
|
||||
1 -> 199
|
||||
2 -> 198
|
||||
3 -> 203
|
||||
4 -> 200
|
||||
5 -> 201
|
||||
6 -> 202
|
||||
7 -> 212
|
||||
8 -> 214
|
||||
9 -> 208
|
||||
10 -> 211
|
||||
11 -> 213
|
||||
12 -> 207
|
||||
13 -> 210
|
||||
14 -> 209
|
||||
15 -> 205
|
||||
16 -> 204
|
||||
17 -> 206
|
||||
18 -> 216
|
||||
19 -> 217
|
||||
20 -> 215
|
||||
21 -> 220
|
||||
22 -> 221
|
||||
23 -> 222
|
||||
else -> 222
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,14 +1,16 @@
|
|||
package XPDropPlugin;
|
||||
|
||||
import plugin.Plugin
|
||||
import plugin.annotations.PluginMeta
|
||||
import plugin.api.*
|
||||
import java.awt.Color
|
||||
import kotlin.math.ceil
|
||||
|
||||
/**
|
||||
* Displays some simple XP drops.
|
||||
* @author Ceikry
|
||||
*/
|
||||
@PluginMeta(
|
||||
author = "Ceikry",
|
||||
description = "Draws nice and clean experience drops onto the screen.",
|
||||
version = 1.2
|
||||
)
|
||||
class plugin : Plugin() {
|
||||
private val displayTimeout = 10000L // 10 seconds
|
||||
private val drawStart = 175
|
||||
|
|
@ -37,7 +39,7 @@ class plugin : Plugin() {
|
|||
removeList.add(gain)
|
||||
totalXp += gain.xp
|
||||
} else if (gain.currentPos <= drawStart){
|
||||
val sprite = API.GetSprite(getSpriteArchive(gain.skill))
|
||||
val sprite = XPSprites.getSpriteForSkill(skillId = gain.skill)
|
||||
sprite?.render(posX - 25, gain.currentPos - 20)
|
||||
API.DrawText(
|
||||
FontType.SMALL,
|
||||
|
|
@ -143,34 +145,4 @@ class plugin : Plugin() {
|
|||
}
|
||||
return newString.reversed()
|
||||
}
|
||||
|
||||
fun getSpriteArchive(skillId: Int): Int{
|
||||
return when(skillId) {
|
||||
0 -> 197
|
||||
1 -> 199
|
||||
2 -> 198
|
||||
3 -> 203
|
||||
4 -> 200
|
||||
5 -> 201
|
||||
6 -> 202
|
||||
7 -> 212
|
||||
8 -> 214
|
||||
9 -> 208
|
||||
10 -> 211
|
||||
11 -> 213
|
||||
12 -> 207
|
||||
13 -> 210
|
||||
14 -> 209
|
||||
15 -> 205
|
||||
16 -> 204
|
||||
17 -> 206
|
||||
18 -> 216
|
||||
19 -> 217
|
||||
20 -> 215
|
||||
21 -> 220
|
||||
22 -> 221
|
||||
23 -> 222
|
||||
else -> 222
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
AUTHOR='Ceikry'
|
||||
DESCRIPTION='Displays some pretty awesome XP drops :)'
|
||||
VERSION=1.1
|
||||
Loading…
Add table
Add a link
Reference in a new issue