Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts.scripts.dropPartyLooter;
- import java.awt.*;
- import java.util.Set;
- import org.tribot.api.General;
- import org.tribot.api2007.Player;
- import org.tribot.api2007.Projection;
- import org.tribot.api2007.types.RSCharacter;
- import org.tribot.script.Script;
- import org.tribot.script.ScriptManifest;
- import org.tribot.script.interfaces.Ending;
- import org.tribot.script.interfaces.Painting;
- import scripts.scripts.dropPartyLooter.util.ItemSpawn;
- import scripts.scripts.dropPartyLooter.util.TileControl;
- @ScriptManifest(authors = {"Dorkinator"}, name = "dp looter", description = "", version = 1.0, category = "money making")
- public class DropPartyLooter extends Script implements Painting, Ending {
- private TileControl tc;
- private Thread t;
- private RSCharacter c;
- @Override
- public void run() {
- setLoginBotState(false);
- setAutoResponderState(false);
- setRandomSolverState(false);
- setPinBotState(false);
- General.useAntiBanCompliance(false);
- Set<Thread> threadSet = Thread.getAllStackTraces().keySet();
- for (Thread s : threadSet) {
- System.out.println(s.getName());
- if(s.getName().toLowerCase().contains("anti")) {
- s.suspend();
- }
- }
- if (c == null)
- c = Player.getRSPlayer().getInteractingCharacter();
- if (c != null) {
- tc = new TileControl(c);
- t = new Thread(tc);
- t.start();
- }else{
- System.out.println("Start the script while following the player who is dropping the items.");
- return;
- }
- while (true) {
- General.sleep(50);
- }
- }
- @Override
- public void onPaint(Graphics g) {
- g.setColor(new Color(0, 1, 0, 0.3f));
- int tID = 1;
- for (ItemSpawn i : tc.getItemList())
- if (i != null) {
- int tCD = Math.abs(i.cd() - 10);
- tID++;
- Polygon tile = Projection.getTileBoundsPoly(i.getTile(), 0);
- if(tCD > 0 && tCD < 10) {
- g.fillPolygon(tile);
- g.drawString(tID+":"+tCD,tile.xpoints[0],tile.ypoints[0]);
- }
- }
- g.setColor(new Color(0, 0, 1, 0.1f));
- g.fillPolygon(Projection.getTileBoundsPoly(c.getPosition(), 0));
- }
- @Override
- public void onEnd() {
- t.interrupt();
- }
- }
- --------------------------------------------------------------------------------------------------------------------------
- package scripts.scripts.dropPartyLooter.util;
- import java.util.Vector;
- import org.tribot.api.types.generic.Condition;
- import org.tribot.api2007.types.RSCharacter;
- import org.tribot.api2007.types.RSTile;
- import scripts.lib.generic.Timing;
- public class TileControl implements Runnable {
- private Vector<ItemSpawn> itemList;
- private RSCharacter target;
- public TileControl(RSCharacter c) {
- itemList = new Vector<ItemSpawn>();
- this.target = c;
- }
- @Override
- public void run() {
- while (true) {
- if (!isMoving(target)) {
- ItemSpawn i = new ItemSpawn(target);
- Timing.waitFor(new Condition() {
- @Override
- public boolean active() {
- return isMoving(target);
- }
- }, 15000);
- i.setLeaveTime();
- if (i.getTimeOn() > 99)
- itemList.add(i);
- }
- sleep(50);
- }
- }
- @SuppressWarnings("unchecked")
- public Vector<ItemSpawn> getItemList() {
- return (Vector<ItemSpawn>) itemList.clone();
- }
- private void sleep(long mil) {
- try {
- Thread.sleep(mil);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- /**
- * Checks if the target player is moving
- *
- * @param target target player
- * @return true if they're moving false otherwise
- */
- private boolean isMoving(RSCharacter target) {
- if (target == null)
- return false;
- final RSTile tmp = target.getAnimablePosition();
- final RSTile tile = new RSTile(tmp.getX(), tmp.getY(), tmp.getPlane());
- return Timing.waitFor(new Condition() {
- @Override
- public boolean active() {
- return (tmp.getX() != tile.getX() || tmp.getY() != tile.getY());
- }
- }, 100);
- }
- }
- -------------------------------------------------------------------------------------------------------------------------
- package scripts.scripts.dropPartyLooter.util;
- import org.tribot.api2007.types.RSCharacter;
- import org.tribot.api2007.types.RSTile;
- public class ItemSpawn {
- private long enterTime;
- private long leaveTime = 0;
- private RSTile tile;
- public ItemSpawn(RSCharacter tar) {
- this.enterTime = System.currentTimeMillis();
- this.tile = new RSTile(tar.getPosition().getX(), tar.getPosition().getY(), tar.getPosition().getPlane());
- }
- public void setLeaveTime() {
- this.leaveTime = System.currentTimeMillis();
- }
- public int getTimeOn() {
- return (int) (leaveTime - enterTime);
- }
- public boolean hasSpawned() {
- return System.currentTimeMillis() >= (enterTime + (58000));
- }
- public boolean drawSquare() {
- return System.currentTimeMillis() >= (enterTime + (50000));
- }
- public int cd(){
- return (int)(System.currentTimeMillis() - (enterTime + 58000))/1000;
- }
- public boolean shouldLeave() {
- return System.currentTimeMillis() >= (leaveTime + (60000));
- }
- public RSTile getTile() {
- return this.tile;
- }
- public boolean hover() {
- if (tile.hover())
- return true;
- return false;
- }
- public boolean leftSet() {
- return leaveTime > 0;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement