Quickmarch
2009-05-27 15:34:47
Sets the fight mode using integers and strings:
Probably can be shortened.
function SetFightMode(oFightMode: Variant): Boolean;
var
i, x, y, r: Integer;
b: TBox;
begin
if not(Loggedin)then Exit;
GameTab(1);
Wait(200 + Random(777));
case VarType(oFightMode) of
3: case oFightMode of
1: b := IntToBox(575, 255, 630, 290);
2: b := IntToBox(660, 255, 710, 290);
3: b := IntToBox(575, 310, 630, 345);
4: begin
r := 4;
b := IntToBox(660, 310, 710, 345);
end;
end;
256: case Lowercase(oFightMode) of
'attack': b := IntToBox(575, 255, 630, 290);
'strength': b := IntToBox(660, 255, 710, 290);
'defence': begin
b := IntToBox(660, 310, 710, 345);
r := 4;
end;
'multi': b := IntToBox(575, 310, 630, 345);
end;
end;
while (i < 4) and (not FindColorTolerance(x, y, 1777020, b.x1, b.y1, b.x2, b.y2, 2)) do
begin
Mouse(RandomRange(b.x1, b.x2), RandomRange(b.y1, b.y2), 0, 0, True);
Wait(200 + Random(300));
Inc(i);
end;
Result := FindColorTolerance(x, y, 1777020, b.x1, b.y1, b.x2, b.y2, 2);
if (not Result) and (r = 4) then
SetFightMode(3);
end;
Probably can be shortened.