Nice first attempt.
There is a huge amount of repeated code in there, each case of the switch statement is basically the same code. One way you could simplify this is by storing a map of Skills & their corresponding WidgetChild Ids, then you can grab the child widget id as a variable and pass it into the widget interaction block.
static Map<Skill, Integer> SKILL_WIDGETID_MAP = new HashMap<>(){{
put(Skill.ATTACK, 2);
put(Skill.STRENGTH, 3);
put(Skill.RANGED, 4);
//TODO: Add all other skills here
}};
public void SolveGeniLamp(Skill skill) {
Item item = Inventory.get(it-> it.getName().equals("Lamp") && it.hasAction("Rub"));
if (item == null) {
return; // Return early, nothing to do.
}
if (item.interact("Rub")) {
Sleep.sleep(1000, 1500); /
Widget chooseSkillWidget = Widgets.getWidget(240);
if (chooseSkillWidget != null && chooseSkillWidget.isVisible()){
Integer childId = SKILL_WIDGETID_MAP.get(skill);
if (childId == null) {
Logger.error("Unknown Child Widget id for Skill " + skill.toString());
return;
}
WidgetChild wig = Widgets.getChildWidget(240, childId);
WidgetChild widg = Widgets.getChildWidget(240, 26);
if (wig != null && wig.isVisible()) {
if (wig.interact()) {
Sleep.sleep(500,1200);
widg.interact();
}
} else {
Widgets.closeAll();
}
}
}
}