Jump to content

Search the Community

Showing results for tags 'get bank'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • OSBot
    • News & Announcements
    • Community Discussion
    • Bot Manager
    • Support Section
    • Mirror Client VIP
    • Script Factory
  • Scripts
    • Official OSBot Scripts
    • Script Factory
    • Unofficial Scripts & Applications
    • Script Requests
  • Market
    • OSBot Official Voucher Shop
    • Currency
    • Accounts
    • Services
    • Other & Membership Codes
    • Disputes
  • Graphics
    • Graphics
  • Archive

Product Groups

  • Premium Scripts
    • Combat & Slayer
    • Money Making
    • Minigames
    • Others
    • Plugins
    • Agility
    • Mining & Smithing
    • Woodcutting & Firemaking
    • Fishing & Cooking
    • Fletching & Crafting
    • Farming & Herblore
    • Magic & Prayer
    • Hunter
    • Thieving
    • Construction
    • Runecrafting
  • Donations
  • OSBot Membership
  • Backup

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


MSN


Website URL


ICQ


Yahoo


Skype


Location:


Interests

Found 1 result

  1. I was having troubles for a little bit trying to get the closest bank, then stumbled upon Chris's post on how getting the closest bank works. So all credits go to him for this one. All I did was modified the coding a little bit to make it compatible with task usage. Code: import java.util.HashMap; import java.util.LinkedHashMap; import java.util.Map; import java.util.stream.Stream; import org.osbot.rs07.api.map.Area; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.script.MethodProvider; public enum WebBank { GRAND_EXCHANGE(new Area(new Position(3161, 3493, 0), new Position(3168, 3486, 0))), VARROCK_EAST(new Area(new Position(3250, 3423, 0), new Position(3257, 3416, 0))), VARROCK_WEST(new Area(new Position(3180, 3447, 0), new Position(3185, 3433, 0))), EDGEVILLE(new Area(new Position(3091, 3499, 0), new Position(3098, 3487, 0))); private final Area area; WebBank(Area area) { this.area = area; } public static Area closestTo(MethodProvider e) { HashMap<WebBank, Integer> distMap = new HashMap<WebBank, Integer>(); for (WebBank b : WebBank.values()) { distMap.put(b, e.myPosition().distance(b.area.getRandomPosition())); } HashMap<Integer, WebBank> distMapSorted = sortByDistance(distMap); Area cBank = distMapSorted.values().toArray(new WebBank[WebBank.values().length])[0].area; return cBank; } private static <K, V extends Comparable<? super V>> HashMap<V, K> sortByDistance(Map<K, V> map) { HashMap<V, K> result = new LinkedHashMap<>(); Stream<Map.Entry<K, V>> st = map.entrySet().stream(); st.sorted(Map.Entry.comparingByValue()).forEachOrdered(e -> result.put(e.getValue(), e.getKey())); return result; } } Usage: import org.osbot.rs07.event.WebWalkEvent; import org.osbot.rs07.event.webwalk.PathPreferenceProfile; import org.osbot.rs07.script.MethodProvider; public class DropTask extends Task { public DropTask(MethodProvider api) { super(api); } @Override public void startBankWalk() { WebWalkEvent webEvent = new WebWalkEvent(WebBank.closestTo(api)); webEvent.useSimplePath(); PathPreferenceProfile ppp = new PathPreferenceProfile(); ppp.setAllowObstacles(true); webEvent.setPathPreferenceProfile(ppp); api.execute(webEvent); return; } }
×
×
  • Create New...