Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package scripts.autoMerchanter;
- import org.tribot.api.General;
- import org.tribot.api.Timing;
- import org.tribot.api.types.generic.Condition;
- import org.tribot.api2007.Interfaces;
- import org.tribot.api2007.Inventory;
- import org.tribot.api2007.types.RSInterface;
- public class Clicker {
- private Check values;
- private Typer typer = new Typer(values);
- public Clicker(Check values) {
- this.values = values;
- }
- public void handleTradeScreen (boolean accept) {
- //*
- /* Handels trade screen based off if we are accepting the trade
- * and which trade screen is currently valid
- */
- switch (Interfaces.isInterfaceValid(335) ? 1 : 2) {
- case 1:
- if (accept && Interfaces.isInterfaceValid(335) && Interfaces.get(335, 17).click()) {
- Timing.waitCondition(new Condition() {
- @Override
- public boolean active() {
- return clickedAccept() || Interfaces.isInterfaceValid(334);
- }
- }, General.random(2600, 3300));
- }
- else if (Interfaces.isInterfaceValid(335) && Interfaces.get(335, 18).click()) {
- Timing.waitCondition(new Condition() {
- @Override
- public boolean active() {
- return !values.inTrade();
- }
- }, General.random(2600, 3300));
- }
- break;
- case 2:
- if(accept && Interfaces.isInterfaceValid(334) && Interfaces.get(334, 20).click()) {
- if (Timing.waitCondition(new Condition() {
- @Override
- public boolean active() {
- return clickedAccept() || values.inTrade();
- }
- }, General.random(2200, 3500))) {
- typer.successfulTrade();
- if (values.getStatus().equals("selling")) {
- values.nextGoldAmount = Inventory.getCount(995);
- values.profit = values.nextGoldAmount - values.initialCoins;
- values.itemsSold ++;
- }
- values.exchanges++;
- }
- }
- else if (Interfaces.isInterfaceValid(334) && Interfaces.get(334, 21).click()) {
- if (Timing.waitCondition(new Condition(){
- @Override
- public boolean active() {
- return !values.inTrade();
- }
- }, General.random(2300, 3000))) {
- typer.replyToScammer();
- }
- }
- values.totalTrades++;
- break;
- }
- }
- public boolean clickedAccept() {
- //*
- /* Reads the interface to see if it gives us
- * the waiting message
- */
- RSInterface accepted = Interfaces.get(Interfaces.isInterfaceValid(335) ? 335 : 334, Interfaces.isInterfaceValid(335) ? 56 : 33);
- if (accepted != null) {
- String text = accepted.getText();
- return text != null
- && (text.contains(values.WAITING_MESSAGE));
- }
- return false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement