Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts;
- import java.awt.Color;
- import java.awt.Font;
- import java.awt.Graphics;
- import org.tribot.api.DynamicClicking;
- import org.tribot.api.General;
- import org.tribot.api.Timing;
- import org.tribot.api.input.Mouse;
- import org.tribot.api.types.generic.Condition;
- import org.tribot.api2007.Camera;
- import org.tribot.api2007.GameTab;
- import org.tribot.api2007.GameTab.TABS;
- import org.tribot.api2007.Login;
- import org.tribot.api2007.NPCs;
- import org.tribot.api2007.Player;
- import org.tribot.api2007.Screen;
- import org.tribot.api2007.Skills;
- import org.tribot.api2007.Walking;
- import org.tribot.api2007.types.RSNPC;
- import org.tribot.api2007.types.RSTile;
- import org.tribot.script.Script;
- import org.tribot.script.ScriptManifest;
- import org.tribot.script.interfaces.Painting;
- import org.tribot.script.interfaces.Pausing;
- @ScriptManifest(authors = { "Okokokok" }, category = "ok_StarterPack", name = "ok_StarterThiever")
- public class ok_StarterThiever extends Script implements Painting, Pausing {
- private final double version = 1.00;
- boolean paused;
- public RSArea thievingArea = new RSArea(new RSTile(3213, 3206, 0), new RSTile(3232, 3232, 0));
- private final String manName = "Man",
- manThief = "Pickpocket";
- // MISC METHODS
- public boolean waitFor(Condition c, long timeout) {
- Timer t = new Timer(timeout);
- while (t.isRunning()) {
- if (c.active()) {
- return true;
- }
- sleep(60, 80);
- }
- return false;
- }
- public boolean loggedOut() {
- return (Login.getLoginState() == Login.STATE.LOGINSCREEN)
- && (!Screen.getColorAt(100, 200).equals(new Color(0, 0, 0)));
- }
- public boolean logout() {
- if (Login.getLoginState() == Login.STATE.INGAME)
- {
- Login.logout();
- for(int x = 0; x < 6; x++)
- {
- if(loggedOut())
- {
- return true;
- }
- sleep(490,510);
- }
- }
- return false;
- }
- public void antiBan(int rotation) {
- int number = General.random(1, 500);
- sleep(200);
- switch (number) {
- case 1:
- case 2:
- case 3:
- case 4:
- case 5:
- Camera.setCameraRotation(Camera.getCameraRotation() + rotation);
- break;
- case 20:
- case 21:
- case 22:
- case 23:
- case 24:
- case 25:
- case 26:
- case 27:
- case 28:
- case 29:
- case 30:
- case 31:
- Camera.setCameraRotation(Camera.getCameraRotation() + rotation);
- sleep(200);
- break;
- case 50:
- GameTab.open(TABS.INVENTORY);
- sleep(200);
- break;
- case 75:
- case 76:
- break;
- case 89:
- case 90:
- case 91:
- case 92:
- case 93:
- case 94:
- Camera.setCameraAngle(Camera.getCameraRotation() + rotation);
- sleep(200, 400);
- break;
- case 95:
- case 96:
- case 97:
- case 98:
- case 99:
- case 100:
- Camera.setCameraAngle(Camera.getCameraRotation() + rotation);
- sleep(200, 400);
- break;
- }
- }
- // THIEVING METHOD
- private boolean findManOnscreen(){
- RSNPC[] man = NPCs.findNearest(manName);
- return man != null && man.length > 0 && man[0].isOnScreen();
- }
- private RSTile manTile(){
- RSNPC[] man = NPCs.findNearest(manName);
- if (man != null && man.length > 0){
- return man[0].getPosition();
- }
- return null;
- }
- private boolean distanceMan(){
- RSTile myPos = Player.getPosition();
- if (!findManOnscreen()){
- if (myPos.distanceTo(manTile()) > 8){
- return true;
- }
- }
- return false;
- }
- private void walkMan(){
- RSNPC[] man = NPCs.findNearest(manName);
- if (man != null && man.length > 0){
- if (!distanceMan() && thievingArea.contains(manTile())){
- Walking.walkTo(manTile());
- }
- }
- }
- private void handleStunned(){
- if (isStunned()){
- sleep (4000, 4400);
- }
- }
- public void thiefMethod(){
- RSNPC[] man = NPCs.findNearest(manName);
- if (man != null && man.length > 0 && man[0].isOnScreen() && !isStunned() && !Player.isMoving()){
- if (DynamicClicking.clickRSNPC(man[0], manThief)){
- waitFor(new Condition(){
- @Override
- public boolean active(){
- return Player.getAnimation() == -1 || isStunned();
- }
- }, 10000);
- }
- }
- }
- // CHECK METHODS
- private boolean isStunned(){
- return Player.getAnimation() == 388;
- }
- private static final long startTime = System.currentTimeMillis();
- Font font = new Font("Calibri", Font.BOLD, 16);
- private State SCRIPT_STATE = getState();
- @SuppressWarnings("deprecation")
- private final int startXP = Skills.getXP("thieving");
- private int START_XP;
- @SuppressWarnings("deprecation")
- @Override
- public void onPaint(Graphics g) {
- RSTile myPos = Player.getPosition();
- long timeRan = System.currentTimeMillis() - startTime;
- double multiplier = timeRan / 3600000D;
- int currentLvl = Skills.getActualLevel("thieving");
- int xpToNextLvl = Skills.getXPToNextLevel("thieving");
- int xpGained = Skills.getXP("thieving") - START_XP;
- int pickpockets = xpGained / 8;
- g.setFont(font);
- g.setColor(new Color(255, 255, 255));
- g.drawString("ok_StarterThiever V" + version, 558, 220);
- g.drawString("Action: " + SCRIPT_STATE, 558, 235);
- g.drawString("Time running: " + Timing.msToString(timeRan), 558, 250);
- g.drawString("XP Gained p/h: " + (int) (xpGained / multiplier), 558, 265);
- g.drawString("XP Gained: " + (int) xpGained, 558, 280);
- g.drawString("Current level: " + currentLvl, 558, 295);
- g.drawString("XP to Next Level: " + xpToNextLvl, 558, 310);
- if (thievingArea.contains(myPos)){
- g.drawString("Pickpockets p/h: " + (int)(pickpockets / multiplier), 558, 325);
- g.drawString("Pickpockets done: " + pickpockets, 558, 340);
- }
- }
- public enum State{
- PICKPOCKETING, WALKING_TO_MAN,
- STUNNED, LOGING_OUT,
- PAUSING;
- }
- private State getState(){
- RSTile myPos = Player.getPosition();
- if (paused){
- return State.PAUSING;
- }
- if (thievingArea.contains(myPos)){
- if (findManOnscreen() && !isStunned()){
- return State.PICKPOCKETING;
- }
- if (findManOnscreen() && isStunned()){
- return State.STUNNED;
- }
- if (!findManOnscreen() && !isStunned()){
- return State.WALKING_TO_MAN;
- }
- }
- return State.LOGING_OUT;
- }
- @SuppressWarnings("deprecation")
- @Override
- public void run() {
- START_XP = startXP;
- super.setRandomSolverState(true);
- Walking.setControlClick(true);
- while(true){
- if (loggedOut()) {
- super.setLoginBotState(active);
- } else {
- while (!loggedOut()) {
- SCRIPT_STATE = getState();
- int mSpeed = General.random(180, 200);
- Mouse.setSpeed(mSpeed);
- Walking.setControlClick(true);
- switch (SCRIPT_STATE) {
- case STUNNED:
- handleStunned();
- break;
- case LOGING_OUT:
- logout();
- stopScript();
- break;
- case PICKPOCKETING:
- int rotation = General.random(90, 200);
- antiBan(rotation);
- thiefMethod();
- break;
- case WALKING_TO_MAN:
- walkMan();
- break;
- case PAUSING:
- sleep(100, 200);
- }
- }
- }
- }
- }
- @Override
- public void onPause() {
- paused = true;
- while (paused){
- sleep(200, 300);
- }
- }
- @Override
- public void onResume() {
- paused = false;
- sleep(18000, 20000);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement