Simba Code:
program battlestaff_crafter;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
var
_bank_box, _inv_box, _pack_box: TBox;
const
orb_slot = 9;//1-10
staff_slot = 10;//1-10
orb_type = 'air';//water,earth,fire,air
procedure declarePlayers;
begin
setLength(players, 1);
with players[0] do
begin
bankPin := '1234';
isActive := true;
isMember := true;
world := -1;
end;
currentPlayer := 0;
end;
function FindBank: T2DPointArray;
var
searchArea: TBox;
bankChest: TPointArray;
begin
if findColorsTolerance(bankChest, 1053721, mainscreen.getBounds, 10) then
begin
result := bankChest.toATPA(31, 15);
result.sortBySize;
end;
end;
function OpenBank: boolean;
var
timely, i: integer;
boothSpots: T2DPointArray;
begin
if bankScreen.isOpen then exit(true);
timely := getSystemTime + randomRange(11000, 15000);
while (timely > getSystemTime) do
begin
wait(randomRange(50, 200));
if bankScreen.isOpen then exit(true);
boothSpots := FindBank;
if length(boothSpots) < 1 then continue;
boothSpots.sortFromMidPoint(mainscreen.playerPoint);
for i := 0 to high(boothSpots) do
begin
if not(inRange(length(boothSpots[i]), 200, 350)) then continue;
mouse(boothSpots[i].getMiddle, Mouse_Right);
if chooseOption.select(['Use Bank'], randomRange(2500,3500)) then
begin
wait(randomRange(1, 20));
if random(10)>0 then mouseBox(_pack_box, MOUSE_MOVE, MOUSE_HUMAN);
result := bankScreen.isOpen(randomRange(2500,3500));
if not(players[CurrentPlayer].bankPin = '') and not result then
if pinscreen.isOpen(randomRange(2500,3500)) then
begin
if not pinScreen.enter(players[CurrentPlayer].bankPin) then
exit else wait(randomRange(100,500));
end;
end;
end;
end;
end;
function doneButton: boolean;
var
bluePoints: TPointArray;
blueArea: TBox;
begin
blueArea := [244,197, 335, 223];
findColorsTolerance(bluePoints, 13278759, blueArea, 44);
result := length(bluePoints) > 145;
status('Done button: ' + toStr(result));
end;
procedure wait_crafting;
var
count, threshold: integer;
begin
wait(randomRange(1, 20));
if random(10)>0 then mouseBox(_bank_box, MOUSE_MOVE, MOUSE_HUMAN);
threshold := getSystemTime + randomRange(30000, 45000);
repeat
wait(randomRange(255, 555));
if doneButton then
begin
threshold := getSystemTime + randomRange(5000, 10000);
repeat
wait(randomRange(100, 200));
if not(doneButton) then exit;
until (getSystemTime > threshold);
exit;
end;
until (getSystemTime > threshold);
end;
function craft_option: boolean;
const
BORDER_COLOR = 1356525;
var
searchArea, choiceBox: TBox;
borderPoints: TPointArray;
t: integer;
begin
if not productionScreen.isOpen then exit;
searchArea := [51, 104, 242, 145];
choiceBox := intToBox(52, 105, 91, 144);
case orb_type of
'earth': choiceBox.edit(50, 0, 50, 0);
'fire': choiceBox.edit(100, 0, 100, 0);
'air': choiceBox.edit(150, 0, 150, 0);
end
t := getSystemTime + randomRange(5000, 1000);
while t > getSystemTime do
begin
if not findColors(borderPoints, BORDER_COLOR, searchArea) then
begin
writeln('Unable to select a produce. I think we''re out of supplies.');
writeln('Terminating');
terminateScript;
end;
if choiceBox.equals(borderPoints.getBounds) then exit(true);
mouseBox(choiceBox, MOUSE_LEFT, MOUSE_HUMAN);
wait(randomRange(125, 300));
end;
end;
function craft_inventory: boolean;
var
threshold: integer;
begin
wait(randomRange(1, 20));
if random(10)>0 then mouseBox(_inv_box, MOUSE_MOVE, MOUSE_HUMAN);
tabBackpack.waitWhileLocked;
wait(randomRange(1, 25));
if tabBackpack.mouseSlot(11, MOUSE_LEFT) then
if tabBackpack.mouseSlot(16, MOUSE_LEFT) then
begin
threshold := getSystemTime + randomRange(5000, 10000);
repeat
wait(randomRange(25, 100));
if getSystemTime > threshold then exit;
until productionscreen.isOpen;
if craft_option then if productionScreen.clickStart then result := true;
end;
end;
procedure mainLoop;
begin
if OpenBank then
begin
wait(randomRange(1, 100));
if bankscreen.quickDeposit(QUICK_DEPOSIT_INVENTORY) then
if bankscreen.withdraw(orb_slot, 14, ['']) then
if bankscreen.withdraw(staff_slot, 14, ['']) then
if bankscreen.close then
if craft_inventory then wait_crafting;
end;
end;
begin
smartEnableDrawing := true;
setupsrl;
declarePlayers;
_inv_box := tabBackpack.getSlotBox(11);
_bank_box := [265, 155, 310, 184];
_pack_box := [399, 565, 429, 586];
while isLoggedIn do mainLoop;
end.