Code:
program Iron_Ore_pro; { Version: 2.3 }
{$i AeroLib/AeroLib.Simba}
const
UseAntiBan = True; //Set True if you wish to use antiban (Highly recommended!!!)
MinesOreAmount = 999999; //How many ores to mine? 1 ore = 35 exp
MouseStyle = 1; //0 = Accurate (straighter), 1 = Random line path
MAX_MINE_TIME = 5400; {Maximum time it takes for you to mine an ore
if it disappaers right as you start mining it lower
this value to 1800. If the script tries to mine another
rock before the current one is finished increase this
value by 1200 till that's no longer an issue.}
type
TExpLabel = Integer;
TExperience = record
Start, Last : TExpLabel;
OreDropped : TExpLabel;
BeforeMining: TExpLabel;
end;
TOreInt = Integer;
TOrePoint = TPoint;
TOreTPA = TPointArray;
TOreATPA = Array of TOreTPA;
TOre = record
tCol : TColEx;
ToDrop : TOreInt;
Failures: TOreInt;
Dropping: Boolean;
Point : TOrePoint;
MSPoints: TOreTPA;
TPA : TOreTPA;
ATPA : TOreATPA;
end;
var
Experience: TExperience;
Ore: TOre;
Fails: Integer;
timerProggy: Timer;
const
VERSION = 23;
procedure ClassicMouse(x, y, ranx, rany: Integer);
begin
case MouseStyle of
0: accurateMMouse(Point(x+Random(ranx), y+Random(rany)),0,0);
1: humanmmouse(Point(x+Random(ranx), y+Random(rany)),0,0);
end;
end;
function timerProggy.Ready: Boolean;
begin
Result := timerProggy.timeElapsed > 60000;
end;
function TExperience.Bar: Integer;
begin
Result := getXPBarAmount;
end;
procedure TExpLabel.setBar;
begin
Self := TExperience.Bar;
end;
function TExpLabel.BarDifference: Integer;
begin
Result := TExperience.Bar - Self;
end;
function TExpLabel.MoreThanBar: Boolean;
begin
Result := Self > Experience.Bar;
end;
function TExpLabel.LessThanBar: Boolean;
begin
Result := Self < Experience.Bar;
end;
function TExperience.Gained: Integer;
begin
Result := Experience.Start.BarDifference;
end;
function TExperience.PerHour: Integer;
begin
Result := Floor((Experience.Gained/((GetTimeRunning)/1000))*3600);
end;
procedure ReportLog;
var
h, m, s: Integer;
begin
if GetTimeRunning > 5000 then
begin
ConvertTime(GetTimeRunning, h, m, s);
Writeln('---------------- Iron Ore Pro ----------------');
Writeln('| Script Has Run For : ',h,':',m,':',s);
Writeln('| Iron Ore Mined : ',Experience.Gained/35);
Writeln('| Experience Gained : ',Experience.Gained);
Writeln('| Experience Per Hour: ',Experience.PerHour);
Writeln('--------------------- End --------------------');
end;
end;
procedure StopScript(Reason: String);
begin
ReportLog;
Writeln('====== '+(TheTime)+': Script stopped. Reason: '+Reason+' ======');
logoutPlayer;
TerminateScript;
end;
procedure TOreInt.Reset;
begin
Self := 1;
end;
function TOreInt.Present: Boolean;
begin
Result := itemInSlot(Self);
end;
function TOreInt.Present(Slot: Integer): Boolean; Overload;
begin
Result := itemInSlot(Slot);
end;
procedure TOreInt.Flip;
begin
Case Self of
1: Self := 5;
5: Self := 1;
end;
end;
procedure TOreTPA.Clear;
begin
SetLength(Self, 0);
end;
procedure TOreATPA.Clear;
begin
SetLength(Self, 0);
end;
procedure TOre.Init();
begin
Self.tCol.create(1713728, 12, 0.12, 0.78);
Self.ToDrop.Reset;
end;
function TOre.Find: Boolean;
var
TempATPA: T2DPointArray;
i,ii,tmpCTS: Integer;
begin
Self.ATPA.Clear;
Self.TPA.Clear;
Self.tCol.findAllIn(AREA_MS, Ore.TPA);
if Length(Ore.TPA) = 0 then
begin
Exit(False);
end;
Result := True;
TempATPA := ClusterTPA(Self.TPA,12);
for i := 0 to High(TempATPA) do
if Length(TempATPA[i]) > 1000 then
Self.ATPA := Self.ATPA + TempATPA[i];
end;
function TOreTPA.getPoint: TPoint;
var
RandomPoint, MidPoint: TPoint;
begin
if Length(Self) < 1 then
Exit;
MidPoint := MiddleTPA(Self);
RandomPoint := Self[Random(0,High(Self))];
case MidPoint.X > RandomPoint.X of
True : RandomPoint.X := Random(RandomPoint.X, MidPoint.X)-Random(2);
False: RandomPoint.X := Random(MidPoint.X, RandomPoint.X)+Random(2);
end;
case MidPoint.Y > RandomPoint.Y of
True : RandomPoint.Y := Random(RandomPoint.Y, MidPoint.Y)-Random(2);
False: RandomPoint.Y := Random(MidPoint.Y, RandomPoint.Y)+Random(2);
end;
Result := RandomPoint;
end;
procedure TOre.setMSPoints;
var
i: Integer;
begin
if Self.Find then
begin
SortATPASize(Self.ATPA, True);
Self.MSPoints.Clear;
for i := 0 to High(Ore.ATPA) do
Self.MSPoints := Self.MSPoints + Self.ATPA[i].getPoint;
end else
Self.MSPoints.Clear;
end;
function Ore.Mined: Boolean;
var
Timerrr: Timer;
begin
Result := False;
if isInvFull then
Exit(True);
Timerrr.start;
repeat
if Experience.BeforeMining.LessThanBar then
Result := True
else
Wait(50+Random(50));
until((Result) or (Timerrr.timeElapsed > MAX_MINE_TIME));
if Result then
Ore.Dropping := Ore.ToDrop.Present(5);
Result := True;
end;
procedure Randombreak;
begin
case Random(1000) of
889: Wait(Random(10,100));
725..730: Wait(Random(10,800));
555..565: Wait(Random(1000,2000));
end;
end;
procedure RandomMouse;
begin
case Random(1000) of
889: pickUpMouse();
725..730: MMouseOffClient('random');
555..565: pickUpMouse();
end;
end;
procedure AntiBan;
begin
if not UseAntiBan then
Exit;
case Random(4000) of
889: Wait(Random(800,3000));
725..730: MMouseOffClient('random');
555..565: Wait(Random(1000,40000));
end;
end;
procedure itemuse;
var
pnt:Tpoint;
begin
if waitUpTextMulti(['->'],1) then
begin
pnt := [540, 223];
HumanMMouse(pnt, 5, 5);
fastClick(Mouse_Left);
wait(random(1000, 2000));
end else
exit;
end;
procedure Ore.DropSingle(Slot: Integer);
begin
if not Ore.ToDrop.Present then
Exit;
mouseSpeed := random(25, 85);
interactSlot(Slot, Mouse_Move);
if waitUpTextMulti(['Iron',' ore','cut'],1200) then
begin
Antiban;
Randombreak;
Wait(Random(5,210));
KeyDown(VK_SHIFT);
Randombreak;
Wait(Random(5,300));
fastClick(Mouse_Left);
Wait(Random(1,120));
KeyUp(VK_SHIFT);
Antiban;
RandomMouse;
sleepAndMoveMouse(100 + random(500));
//Ore.ToDrop.Reset;
end;
end;
procedure Ore.Drop;
begin
if not Ore.ToDrop.Present then
begin
while(not(Ore.Mined)) do
Wait(10+Random(10));
Exit;
end;
Ore.Dropping := Ore.ToDrop.Present(5);
interactSlot(Ore.ToDrop, Mouse_Move);
if waitUpTextMulti(['Iron',' ore','cut'],1200) then
begin
antiban;
while(not(Ore.Mined)) do
Wait(10+Random(10));
if (Ore.Dropping) and (Experience.OreDropped.LessThanBar) then
begin
Ore.DropSingle(Ore.ToDrop);
Ore.ToDrop.Flip;
Experience.OreDropped.setBar;
Ore.Failures := 0;
end;
end else
if itemInSlot(Ore.ToDrop) then
//StopScript('Move unknown item from slots 1 & 5 inventory');
end;
function Ore.Mine: Boolean;
var
i, RanI: Integer;
OrePoints: TPointArray;
RandomOrePoint: TPoint;
begin
Result := False;
Ore.Dropping := Ore.ToDrop.Present(5);
Ore.setMSPoints;
OrePoints := Ore.MSPoints;
if Length(OrePoints) > 0 then
begin
antiban;
for i := 0 to High(OrePoints) do
begin
RanI := I+(Random(High(OrePoints)-I));
RandomOrePoint := OrePoints[Rani];
mouseSpeed := random(25, 85);
ClassicMouse(RandomOrePoint.x-1, RandomOrePoint.y-1, 3, 3);
Wait(Random(100,180));
itemuse;
if waitUpTextMulti(['Mine','ine R', ' ocks'],600) then
begin
Antiban;
Experience.BeforeMining.setBar;
fastClick(Mouse_Left);
Wait(Random(1,100));
Antiban;
RandomMouse;
sleepAndMoveMouse(100 + random(500));
Exit(True);
end else
begin
Inc(Ore.Failures);
Ore.setMSPoints;
OrePoints := Ore.MSPoints;
end;
end;
end else
if Ore.Failures > 30 then
StopScript('Failed to find ores after 30 tries.');
end;
procedure Checks;
begin
Antiban;
if not isLoggedIn then
StopScript('We are not logged in');
if Experience.Start.BarDifference / 35 >= MinesOreAmount then
StopScript('Mined desired number of iron ore');
if Fails >= 15 then
StopScript('Too many failures detetcted');
if timerProggy.Ready then
begin
ReportLog;
if Experience.Last >= Experience.Bar then
//StopScript('We have not gained any experience in a whole minute.')
else
Experience.Last.setBar;
timerProggy.start;
end;
end;
procedure SetupScript;
begin
initAL;
mouseSpeed := 30;
ActivateClient;
if not isLoggedIn then
StopScript('We are not logged in');
timerProggy.start;
Experience.Start.setBar;
Experience.Last := Experience.Start;
Experience.OreDropped := Experience.Start;
Ore.Init;
Ore.setMSPoints;
while not isInvFull do
if Ore.Mine then
while(not(Ore.Mined)) do
Wait(Random(125,250));
if isInvFull then
Ore.DropSingle(5);
end;
begin
SetupScript;
repeat
if clickContinueEx(False) then
Ore.DropSingle(5);
if Ore.Mine then
Ore.Drop;
Checks;
until(False);
end.