Fix nitpicks in Woodcutting plugin

This commit is contained in:
Major
2018-03-28 01:21:12 +01:00
parent 45a0b43eee
commit 173623b76b
3 changed files with 73 additions and 105 deletions
+20 -15
View File
@@ -1,23 +1,28 @@
package org.apollo.game.plugin.skills.woodcutting
import org.apollo.game.model.Animation;
import org.apollo.game.model.Animation
import org.apollo.game.model.entity.Player
import org.apollo.game.plugin.api.woodcutting
//Animation IDs thanks to Deadly A G S at rune-server.ee
enum class Axe(val id: Int, val level: Int, val animation: Animation, val pulses: Int) {
RUNE(1359, 41, Animation(867), 3),
ADAMANT(1357, 31, Animation(869), 4),
MITHRIL(1355, 21, Animation(871), 5),
BLACK(1361, 11, Animation(873), 6),
STEEL(1353, 6, Animation(875), 6),
IRON(1349, 1, Animation(877), 7),
BRONZE(1351, 1, Animation(879), 8);
enum class Axe(val id: Int, val level: Int, animation: Int, val pulses: Int) {
BRONZE(id = 1351, level = 1, animation = 879, pulses = 8),
IRON(id = 1349, level = 1, animation = 877, pulses = 7),
STEEL(id = 1353, level = 6, animation = 875, pulses = 6),
BLACK(id = 1361, level = 11, animation = 873, pulses = 6),
MITHRIL(id = 1355, level = 21, animation = 871, pulses = 5),
ADAMANT(id = 1357, level = 31, animation = 869, pulses = 4),
RUNE(id = 1359, level = 41, animation = 867, pulses = 3);
val animation = Animation(animation)
companion object {
private val AXES = Axe.values()
fun getAxes(): Array<Axe> {
return AXES
private val AXES = Axe.values().sortedByDescending { it.level }
fun bestFor(player: Player): Axe? {
return AXES.asSequence()
.filter { it.level <= player.woodcutting.current }
.filter { player.equipment.contains(it.id) || player.inventory.contains(it.id) }
.firstOrNull()
}
}
}