March 26, 201510 yr I wrote this after realizing that calling @getMap().canReach(...) is really expensive. package org.bjornkrols.events; import java.util.HashMap; import java.util.Map; import org.bjornkrols.script.BotreMethodProvider; import org.osbot.rs07.api.filter.Filter; import org.osbot.rs07.api.map.Position; import org.osbot.rs07.api.model.RS2Object; import org.osbot.rs07.script.Script; /** * @author Bjorn Krols (Botre) * @version 0.2 * @since March 26, 2015 */ public class TreeFilter implements Filter<RS2Object> { /** * The script instance. */ private final Script script; /** * The tree's name. */ private String name; /** * The chop radius's center. */ private Position chopCenter; /** * The chop radius. */ private int chopRadius; /** * <Position, reachable && in range> */ private Map<Position, Boolean> validityMap; public TreeFilter(final Script script) { this.script = script; validityMap = new HashMap<Position, Boolean>(); } @Override public boolean match(RS2Object o) { if (!BotreMethodProvider.isValid(o)) return false; if (!o.hasAction("Chop down")) return false; if (!o.getName().equals(name)) return false; Position p = o.getPosition(); if (validityMap.containsKey(p)) return validityMap.get(p); validityMap.put(p, chopCenter.distance(o) < chopRadius && script.getMap().canReach(o)); return validityMap.get(p); } public String getName() { return name; } public void setName(String name) { this.name = name; } public Position getChopCenter() { return chopCenter; } public void setChopCenter(Position chopCenter) { this.chopCenter = chopCenter; } public int getChopRadius() { return chopRadius; } public void setChopRadius(int chopRadius) { this.chopRadius = chopRadius; } }
March 26, 201510 yr looking good m9 edit; hope to see u with a blue name soon, it will match your profile pic too ;p Edited March 26, 201510 yr by Czar
March 26, 201510 yr Author return true; sendMessage(getBrochachos(CoolestBrochachos.APAEC), "no"); edit; hope to see u with a blue name soon, it will match your profile pic too ;p Such coincidence
March 26, 201510 yr looking good m9 edit; hope to see u with a blue name soon, it will match your profile pic too ;p What's the difference between the two? Other than the color :P
March 26, 201510 yr Author What's the difference between the two? Other than the color One looks good with my logo, the other not so much Edited March 26, 201510 yr by Botre
March 26, 201510 yr One looks good with my logo, the other not so much Silly How'd it go with your region problem?
March 27, 201510 yr notsureifsrs.png no i really am. As far as i know they dont get any benifits, but the rank is harder to get
Create an account or sign in to comment