Jump to content

Search the Community

Showing results for tags 'spell'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Tribot
    • News and Announcements
    • Premium Scripts
    • Help and Guidance
    • Support Tickets
    • Community Scripts
  • Community
    • Discussion
    • Programming
    • Feedback
    • Scripting
  • Market
    • Private Script Shops
    • Gold Market
    • Account Market
    • Services
    • Graphics
    • Vouch Threads

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


About Me

Found 1 result

  1. I wrote these so you can recover if you need to cast a spell that is being filtered. Hope it's helpful 🙂 import lombok.AllArgsConstructor; import lombok.val; import org.tribot.script.sdk.GameState; import org.tribot.script.sdk.Magic; import org.tribot.script.sdk.Waiting; import org.tribot.script.sdk.WidgetAddress; import org.tribot.script.sdk.query.Query; import org.tribot.script.sdk.types.Widget; import java.util.Arrays; public class SpellFilter { private static final WidgetAddress spellFilters = WidgetAddress.create(() -> Query.widgets().inRoots(218).isDepth(2).textEquals("Spell Filters").isVisible().findFirst()); private static final int SPELL_FILTERS_ROOT = 218; private static final WidgetAddress spellFilterButton = WidgetAddress.create(() -> Query.widgets().inRoots(SPELL_FILTERS_ROOT).isDepth(3).textEquals("Filters").isVisible().findFirst()); /** * Checks if any spell filter is enabled * * @return true if a spell filter is enabled, false otherwise */ public static boolean isSpellsFiltered() { return Arrays.stream(Filter.values()).anyMatch(Filter::isFiltered); } /** * Opens the spell filters widget * * @return true if the spell filters widget is opened, false otherwise */ public static boolean openSpellFilters() { if (Magic.isSpellFiltersOpen()) { return true; } if (!org.tribot.script.sdk.GameTab.MAGIC.open()) { return false; } if (!Magic.isSpellFiltersOpen() && !spellFilterButton.lookup().map(Widget::click).orElse(false)) { return false; } return Waiting.waitUntil(4000, Magic::isSpellFiltersOpen); } /** * Toggles the specified spell filter * * @param filter the filter to toggle * @return true if the filter is toggled, false otherwise */ public static boolean toggleFilter(Filter filter) { if(!openSpellFilters()){ return false; } val priorState = filter.isFiltered(); if(!spellFilters.lookup().flatMap(i -> i.getChild(filter.widgetIndex)).map(i -> i.click("Change")).orElse(false)){ return false; } return Waiting.waitUntil(4000, ()-> filter.isFiltered() != priorState); } @AllArgsConstructor public enum Filter { COMBAT_SPELLS(6605, 0), TELEPORT_SPELLS(6609, 1), UTILITY_SPELLS(6606, 2), MISSING_LEVEL(6607, 3), MISSING_RUNES(6608, 4), MISSING_REQUIREMENTS(12137, 5), ICON_RESIZING(6548, 6); private final int varbit; private final int widgetIndex; public boolean isFiltered() { return GameState.getVarbit(varbit) == 1; } } } I also have the varbits and an isFiltered method for prayer, I didn't get as far as making a toggle, but I could if anyone needs it 🙂 @AllArgsConstructor public enum Filter { LOWER_TIERS(6574), LOWER_TIERS_MULTISKILL(6575), RAPID_HEALING(6576), MISSING_LEVEL(6577), MISSING_REQUIREMENTS(6578); private final int varbit; public boolean isFiltered() { return GameState.getVarbit(varbit) == 1; } }
×
×
  • Create New...