package plugin.buttons.combat import com.rs2.event.EventContext import com.rs2.event.EventSubscriber import com.rs2.event.SubscribesTo import com.rs2.event.impl.ButtonActionEvent import com.rs2.game.players.Player @SubscribesTo(ButtonActionEvent::class) class CombatStyleButtonsPlugin : EventSubscriber { override fun test(event: ButtonActionEvent) = STYLE_BY_BUTTON.containsKey(event.button) override fun subscribe(context: EventContext, player: Player, event: ButtonActionEvent) { if (player.isDead) return player.fightMode = STYLE_BY_BUTTON.getValue(event.button) if (player.autocasting) { player.playerAssistant.resetAutocast() } } private companion object { val STYLE_BY_BUTTON = mapOf( // Attack / Accurate (0) 9125 to 0, 6221 to 0, 22228 to 0, 48010 to 0, 21200 to 0, 1080 to 0, 6168 to 0, 6236 to 0, 17102 to 0, 8234 to 0, 14218 to 0, 14221 to 0, // Defence / Defensive (1) 9126 to 1, 48008 to 1, 22229 to 1, 21201 to 1, 1078 to 1, 6169 to 1, 33019 to 1, 18078 to 1, 8235 to 1, 14219 to 1, // Strength / Aggressive / Rapid (2) 9128 to 2, 6220 to 2, 22230 to 2, 21203 to 2, 21202 to 2, 1079 to 2, 6171 to 2, 6170 to 2, 33020 to 2, 6235 to 2, 17101 to 2, 8237 to 2, 8236 to 2, 14220 to 2, // Controlled / Longrange (3) 9127 to 3, 48009 to 3, 33018 to 3, 6234 to 3, 6219 to 3, 18077 to 3, 18080 to 3, 18079 to 3, 17100 to 3 ) } }