iutils: Spells fix
This commit is contained in:
parent
68903bafde
commit
6a53a4d141
|
@ -23,7 +23,7 @@
|
|||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
version = "4.2.5"
|
||||
version = "4.2.6"
|
||||
|
||||
project.extra["PluginName"] = "iUtils"
|
||||
project.extra["PluginDescription"] = "Illumine - Utils required for plugins to function with added automation"
|
||||
|
|
|
@ -91,7 +91,6 @@ public class InterfaceUtils {
|
|||
}
|
||||
|
||||
public Widget getSpellWidget(String spell) {
|
||||
assert client.isClientThread();
|
||||
return client.getWidget(Spells.getWidget(spell));
|
||||
}
|
||||
|
||||
|
|
|
@ -37,6 +37,7 @@ public class CombatStyles {
|
|||
|
||||
public void setStyle(CombatStyle style) {
|
||||
if (currentStyle() != style) {
|
||||
game.openInterface(0);
|
||||
switch (style) {
|
||||
case ACCURATE:
|
||||
game.widget(593, 4).interact(0);
|
||||
|
@ -52,8 +53,8 @@ public class CombatStyles {
|
|||
game.widget(593, 16).interact(0);
|
||||
break;
|
||||
}
|
||||
|
||||
game.waitUntil(() -> currentStyle() == style);
|
||||
game.openInterface(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -205,21 +205,33 @@ public enum Spells {
|
|||
|
||||
private final String name;
|
||||
private final WidgetInfo info;
|
||||
private static final Map<String, WidgetInfo> map;
|
||||
|
||||
static {
|
||||
ImmutableMap.Builder<String, WidgetInfo> builder = ImmutableMap.builder();
|
||||
|
||||
for (Spells spells : values()) {
|
||||
System.out.println("Building: " + spells.getName() + " " + spells.getInfo());
|
||||
builder.put(spells.getName(), spells.getInfo());
|
||||
// private static final Map<String, WidgetInfo> map;
|
||||
|
||||
// static {
|
||||
// ImmutableMap.Builder<String, WidgetInfo> builder = ImmutableMap.builder();
|
||||
//
|
||||
// for (Spells spells : values()) {
|
||||
// System.out.println("Building: " + spells.getName() + " " + spells.getInfo());
|
||||
// builder.put(spells.getName(), spells.getInfo());
|
||||
// }
|
||||
//
|
||||
// map = builder.build();
|
||||
// }
|
||||
//
|
||||
// @Nullable
|
||||
// public static WidgetInfo getWidget(String spell) {
|
||||
// return values().
|
||||
// }
|
||||
|
||||
public static WidgetInfo getWidget(String spellName) {
|
||||
for (Spells spell : Spells.values()) {
|
||||
if (spell.name.equalsIgnoreCase(spellName)) {
|
||||
return spell.getInfo();
|
||||
}
|
||||
}
|
||||
|
||||
map = builder.build();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static WidgetInfo getWidget(String spell) {
|
||||
return map.getOrDefault(spell, null);
|
||||
System.out.println("Spell: " + spellName + " not found");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
Binary file not shown.
Loading…
Reference in New Issue