Code:
program IkovThievingBot;
const
FIRE_RUNE_COLOR = 12698050;
AIR_RUNE_COLOR = 14935014;
EARTH_RUNE_COLOR = 3370131;
CORNER_TOP_LEFT_X = 0;
CORNER_TOP_LEFT_Y = 0;
CORNER_BOTTOM_RIGHT_X = 764;
CORNER_BOTTOM_RIGHT_Y = 502;
SHIRT_COLOR_PRIMARY = 1557237;
SHIRT_COLOR_SECONDARY = 1557237;
STAFF_ITEM_POS_X = 580;
STAFF_ITEM_POS_Y = 262;
SELL_TEN_X = 560;
SELL_TEN_Y = 380;
CLOSE_STORE_X = 490;
CLOSE_STORE_Y = 75;
INPUT_DELAY = 125;
CONTINUE_X = 282;
CONTINUE_Y = 471;
function getDistance(x1, y1, x2, y2 : integer) : extended
var
distance : extended;
linea, lineb : integer;
begin
linea := y2 - y1;
lineb := x2 - x1;
linea := linea * linea;
lineb := lineb * lineb;
distance := sqrt(linea + lineb);
result := distance;
end
function getMidPoint2(a, b : TPoint) : TPoint
var
x, y : integer;
begin
x := a.x + b.x;
y := a.y + b.y;
Result := Point(Round(x / 2), Round(y / 2));
end;
function getMidPoint3(a, b, c : TPoint) : TPoint
var
x, y : integer;
begin
x := a.x + b.x + c.x;
y := a.y + b.y + c.y;
Result := Point(Round(x / 3), Round(y / 3));
end;
function getRuneTablePosition() : TPoint
const
tableColorDistance = 20;
tableColorTolerance = 0;
var
fireRunePoints : array of TPoint;
i, q, w, j, k : integer;
midpoint : TPoint;
begin
if FindColorTolerance(q,w, 9151924, 0, 0,764, 502,1) then
begin
midpoint:=Point(q,w);
Result:=midPoint;
end;
end;
procedure clickMagicTable
var
tablePos: TPoint;
begin
tablePos := getRuneTablePosition();
MoveMouse(tablePos.x, tablePos.y);
Wait(40);
ClickMouse(0, 0, 1);
end;
function getSellerPosition() : TPoint
const
shirtColorDistance = 5;
shirtColorTolerance = 3;
var
primaryShirtPoints : array of TPoint;
secondaryShirtPoints : array of TPoint;
i, j, x, y, Bank : integer;
midpoint : TPoint;
begin
Bank := DTMFromString('mbQAAAHicY2VgYBAEYkUgVmZAAH4gZgRiUSgGgTvrRBgKo/QZJhbbMNhaWIDZ2AAjFgwGAHGPBhk=');
FindDTM(Bank,x,y,0,0,764,502);
midpoint:=Point(x,y);
Result:=midpoint;
end;
procedure clickSeller
var
sellerPosition : TPoint;
o, e: Integer;
begin
sellerPosition := getSellerPosition();
MoveMouse(sellerPosition.x, sellerPosition.y);
Wait(1000);
ClickMouse(sellerPosition.x, sellerPosition.y, 0);
wait(4000);
FindColorTolerance(o,e, 1655412, 0, 0,764, 502,1);
MoveMouse(o,e);
ClickMouse(0,0,1);
end;
type
botState = (FirstStallClick, NormalStallClick, SellerClick, SellItem, CloseStore);
var
continue : boolean;
state : botState;
staffCount : integer;
loops : integer;
begin
continue := true;
state := FirstStallClick;
while not isKeyDown(27) do
begin
if (state = FirstStallClick) then
begin
clickMagicTable;
staffCount := 1;
wait(5000);
state := NormalStallClick;
end;
if (state = NormalStallClick) then
begin
clickMagicTable;
staffCount := staffCount + 1;
wait(3000);
if (staffCount >= 1) then
state := SellerClick;
end;
if (state = SellerClick) then
begin
clickSeller;
wait(4500);
state := SellItem;
end;
if (state = SellItem) then
begin
MoveMouse(STAFF_ITEM_POS_X, STAFF_ITEM_POS_Y);
Wait(1000);
ClickMouse(0, 0, 0);
Wait(100);
MoveMouse(SELL_TEN_X, SELL_TEN_Y);
Wait(100);
ClickMouse(0, 0, 1);
Wait(100);
state := CloseStore;
end;
if (state = CloseStore) then
begin
MoveMouse(CLOSE_STORE_X, CLOSE_STORE_Y);
Wait(100);
ClickMouse(0, 0, 1);
Wait(100);
state := FirstStallClick;
end;
end;
end.