Fix nitpicks in emote plugin

This commit is contained in:
Major
2018-04-01 22:49:26 +01:00
parent 8394a035c7
commit 81e019ca93
2 changed files with 44 additions and 47 deletions
+4 -47
View File
@@ -1,50 +1,7 @@
import org.apollo.game.message.impl.ButtonMessage
import org.apollo.game.model.Animation
val ANGRY_EMOTE = Animation(859)
val BECKON_EMOTE = Animation(864)
val BLOW_KISS_EMOTE = Animation(1368)
val BOW_EMOTE = Animation(858)
val CHEER_EMOTE = Animation(862)
val CLAP_EMOTE = Animation(865)
val CLIMB_ROPE_EMOTE = Animation(1130)
val CRY_EMOTE = Animation(860)
val DANCE_EMOTE = Animation(866)
val GLASS_BOX_EMOTE = Animation(1131)
val GLASS_WALL_EMOTE = Animation(1128)
val GOBLIN_BOW_EMOTE = Animation(2127)
val GOBLIN_DANCE_EMOTE = Animation(2128)
val HEAD_BANG_EMOTE = Animation(2108)
val JIG_EMOTE = Animation(2106)
val JOY_JUMP_EMOTE = Animation(2109)
val LAUGH_EMOTE = Animation(861)
val LEAN_EMOTE = Animation(1129)
val NO_EMOTE = Animation(856)
val PANIC_EMOTE = Animation(2105)
val RASPBERRY_EMOTE = Animation(2110)
val SALUTE_EMOTE = Animation(2112)
val SHRUG_EMOTE = Animation(2113)
val SPIN_EMOTE = Animation(2107)
val THINKING_EMOTE = Animation(857)
val WAVE_EMOTE = Animation(863)
val YAWN_EMOTE = Animation(2111)
val YES_EMOTE = Animation(855)
val EMOTE_MAP = mapOf<Int, Animation>(
162 to THINKING_EMOTE, 6_503 to CLIMB_ROPE_EMOTE, 169 to NO_EMOTE,
164 to BOW_EMOTE, 13_384 to GOBLIN_DANCE_EMOTE, 161 to CRY_EMOTE,
170 to LAUGH_EMOTE, 171 to CHEER_EMOTE, 163 to WAVE_EMOTE,
167 to BECKON_EMOTE, 3_362 to PANIC_EMOTE, 172 to CLAP_EMOTE,
166 to DANCE_EMOTE, 13_363 to JIG_EMOTE, 13_364 to SPIN_EMOTE,
13_365 to HEAD_BANG_EMOTE, 6_506 to LEAN_EMOTE, 165 to ANGRY_EMOTE,
13_368 to YAWN_EMOTE, 13_366 to JOY_JUMP_EMOTE, 667 to GLASS_BOX_EMOTE,
13_367 to RASPBERRY_EMOTE, 13_369 to SALUTE_EMOTE, 13_370 to SHRUG_EMOTE,
11_100 to BLOW_KISS_EMOTE, 666 to GLASS_WALL_EMOTE, 168 to YES_EMOTE,
13_383 to GOBLIN_BOW_EMOTE
)
on { ButtonMessage::class }
.where { widgetId in EMOTE_MAP }
.then {
it.playAnimation(EMOTE_MAP[widgetId])
}
.where { widgetId in Emote.MAP }
.then { player ->
player.playAnimation(Emote.fromButton(widgetId)!!.animation)
}
+40
View File
@@ -0,0 +1,40 @@
import org.apollo.game.model.Animation
enum class Emote(val button: Int, animation: Int) {
ANGRY_EMOTE(button = 165, animation = 859),
BECKON_EMOTE(button = 167, animation = 864),
BLOW_KISS_EMOTE(button = 11_100, animation = 1368),
BOW_EMOTE(button = 164, animation = 858),
CHEER_EMOTE(button = 171, animation = 862),
CLAP_EMOTE(button = 172, animation = 865),
CLIMB_ROPE_EMOTE(button = 6503, animation = 1130),
CRY_EMOTE(button = 161, animation = 860),
DANCE_EMOTE(button = 166, animation = 866),
GLASS_BOX_EMOTE(button = 667, animation = 1131),
GLASS_WALL_EMOTE(button = 666, animation = 1128),
GOBLIN_BOW_EMOTE(button = 13_383, animation = 2127),
GOBLIN_DANCE_EMOTE(button = 13_384, animation = 2128),
HEAD_BANG_EMOTE(button = 13_365, animation = 2108),
JIG_EMOTE(button = 13_363, animation = 2106),
JOY_JUMP_EMOTE(button = 13_366, animation = 2109),
LAUGH_EMOTE(button = 170, animation = 861),
LEAN_EMOTE(button = 6_506, animation = 1129),
NO_EMOTE(button = 169, animation = 856),
PANIC_EMOTE(button = 3_362, animation = 2105),
RASPBERRY_EMOTE(button = 13_367, animation = 2110),
SALUTE_EMOTE(button = 13_369, animation = 2112),
SHRUG_EMOTE(button = 13_370, animation = 2113),
SPIN_EMOTE(button = 13_364, animation = 2107),
THINKING_EMOTE(button = 162, animation = 857),
WAVE_EMOTE(button = 163, animation = 863),
YAWN_EMOTE(button = 13_368, animation = 2111),
YES_EMOTE(button = 168, animation = 855);
val animation = Animation(animation)
companion object {
internal val MAP = Emote.values().associateBy { it.button }
fun fromButton(button: Int): Emote? = MAP[button]
}
}