This should be everything related.
getSpell().getSpriteIndex() returns 71 like it should, but spellWidget returns null for some reason.
private Spell spell;
public void onStart() throws InterruptedException {
spell = gui.getSelectedSpell();
}
public MagicSpell getSpell() {
try {
return Spells.NormalSpells.valueOf(spell.toString());
} catch (IllegalArgumentException e) {
return null;
}
}
private boolean canCast() throws InterruptedException {
return getMagic().canCast(Spells.NormalSpells.valueOf(spell.toString()), false);
}
private void selectSpell() throws InterruptedException {
RS2Widget spellWidget = getWidgets().getWidgetContainingSprite(201, getSpell().getSpriteIndex());
log("Widget: " + spellWidget + ".");
log("Sprite index: " + getSpell().getSpriteIndex() + ".");
if (spellWidget != null && spellWidget.isVisible()) {
log("Spell widget is visible.");
spellWidget.interact();
Sleep.sleepUntil(() -> widgets.isVisible(593), 5000);
} else {
log("[Error] Spell widget not visible.");
}
}