40 private final static int[] ANCIENT_STAFFS = {21006, 4675, 4710, 11791, 12904, 6914};
41 private final static int[] NO_AUTOCAST = {12899, 11907, 11908};
43 public static boolean clickButton(
Player player,
int button) {
54 if (!player.isAutocast()) {
55 Item weapon = player.equipment.getWeapon();
58 sendSelectionInterface(player, weapon.getId());
69 setAutocast(player, 1152);
73 setAutocast(player, 1154);
77 setAutocast(player, 1156);
81 setAutocast(player, 1158);
87 setAutocast(player, 1160);
91 setAutocast(player, 1163);
95 setAutocast(player, 1166);
99 setAutocast(player, 1169);
105 setAutocast(player, 1172);
109 setAutocast(player, 1175);
113 setAutocast(player, 1177);
117 setAutocast(player, 1181);
123 setAutocast(player, 1183);
127 setAutocast(player, 1185);
131 setAutocast(player, 1188);
135 setAutocast(player, 1189);
140 setAutocast(player, 40140);
143 setAutocast(player, 40150);
146 setAutocast(player, 40170);
149 setAutocast(player, 40190);
155 setAutocast(player, 12939);
160 setAutocast(player, 12963);
165 setAutocast(player, 12951);
170 setAutocast(player, 12975);
176 setAutocast(player, 12987);
181 setAutocast(player, 13011);
186 setAutocast(player, 12999);
191 setAutocast(player, 13023);
197 setAutocast(player, 12901);
202 setAutocast(player, 12919);
207 setAutocast(player, 12911);
212 setAutocast(player, 12929);
218 setAutocast(player, 12861);
223 setAutocast(player, 12881);
228 setAutocast(player, 12871);
233 setAutocast(player, 12891);
239 public static void reset(
Player player) {
240 if (player.isAutocast()) {
241 player.setAutocast(
null);
247 private static void sendSelectionInterface(
Player player,
int weaponId) {
248 for (
int id : NO_AUTOCAST) {
249 if (weaponId ==
id) {
250 player.send(
new SendMessage(
"You can't autocast with this weapon!"));
255 if (player.spellbook ==
null) {
259 switch (player.spellbook) {
261 if (!player.equipment.
containsAny(ANCIENT_STAFFS)) {
262 if (!player.equipment.hasWeapon()) {
266 String def = player.equipment.getWeapon().getName().toLowerCase();
267 player.send(
new SendMessage(
"You can't autocast ancient magicks with " +
StringUtils.getAOrAn(def) +
" " + def +
"."));
273 player.send(
new SendMessage(
"You can't autocast lunar magicks!"));
276 if (player.equipment.contains(4675)) {
277 player.send(
new SendMessage(
"You can't autocast normal magicks with this staff!"));
285 private static void setAutocast(
Player player,
int id) {
294 player.send(
new SendMessage(
"You don't have the runes required for this spell!"));
298 player.setAutocast(spell);