Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.ItemID;
import net.runelite.client.plugins.microbot.Microbot;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.ItemID;
import net.runelite.client.plugins.microbot.Microbot;
Expand Down Expand Up @@ -44,6 +48,16 @@ public boolean run()
Microbot.enableAutoRunOn = true;
startTime = Instant.now();
mainScheduledFuture = scheduledExecutorService.scheduleWithFixedDelay(() -> {

try {
if (!super.run()) {
return;
}

if (BreakHandlerScript.breakIn > 0 && BreakHandlerScript.breakIn < 60) {
status = "Preparing for break";
Rs2GrandExchange.closeExchange();

try
{
if (!super.run())
Expand All @@ -62,28 +76,44 @@ public boolean run()
Rs2GrandExchange.closeExchange();
Rs2GrandExchange.close();


sleep(2000);
return;
}

if (itemPool.isEmpty() || Rs2Random.betweenInclusive(0, 100) < 5) {
refreshItemPool();
}

if (!Rs2Bank.isOpen() && Rs2Inventory.hasItem(ItemID.COINS_995)) {

if (itemPool.isEmpty() || Rs2Random.betweenInclusive(0, 100) < 5)
{
refreshItemPool();
}

if (!Rs2Bank.isOpen() && Rs2Inventory.hasItem(ItemID.COINS_995))
{

flipLoop();
}

overlay.updateOverlay(getProfit(), getStatus(), getRuntime());

} catch (Exception e) {
log.error("Error in flip loop", e);
status = "Error - retrying";
}
}, 0, 600, TimeUnit.MILLISECONDS);

}
catch (Exception e)
{
log.error("Error in flip loop", e);
status = "Error - retrying";
}
}, 0, 600, java.util.concurrent.TimeUnit.MILLISECONDS);

return true;
}

Expand Down Expand Up @@ -133,8 +163,10 @@ private void flipLoop()
{
if (Rs2GrandExchange.getAvailableSlot() == null)


if (!Rs2GrandExchange.hasFreeSlot())


{
break;
}
Expand All @@ -149,6 +181,7 @@ private void flipLoop()
}



Rs2Mouse.setSpeed(50, 90);

Rs2GrandExchange.buyItem(itemId, quantity, buyPrice);
Expand All @@ -160,6 +193,7 @@ private void flipLoop()
{
collectProfit();


sleepUntil(() -> Rs2GrandExchange.hasOffer(itemId), 3000);
lastFlipped.put(itemId, System.currentTimeMillis());
}
Expand All @@ -169,6 +203,7 @@ private void flipLoop()
Rs2GrandExchange.collectToInventory();
calculateProfit();


}
}

Expand All @@ -185,10 +220,12 @@ private void collectProfit()
int coinsAfter = Rs2Inventory.count(ItemID.COINS_995);
long profit = coinsAfter - coinsBefore;


private void calculateProfit()
{
long profit = Rs2GrandExchange.getLastProfit();


if (profit > 0)
{
totalProfit += profit;
Expand Down
Loading