Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Anth_Herblore;
- {$DEFINE SMART}
- {$i AeroLib/AeroLib.Simba}
- {$i Reflection/Reflection.Simba}
- type
- EPotType = (guam, mrntl, tmin, hldr, rnrr, tdflx, irit,
- avnt, kwrm, snpdr, cdtne, lntdme, dwarf, trstl); // Cheers Olly
- const
- P_USERNAME = '';
- P_PASSWORD = '';
- P_PIN = '';
- POT_TO_MAKE = rnrr; // One above ^^^
- CLEAN = 'yes'; // {yes, no, only}
- BANKTYPE = 'chest';
- // (booth, npc, chest, cellar}
- ScriptVersion = '1.1';
- // BREAK SETTINGS - Thank you Flight!
- USEBREAKS = true;
- cBREAK_IN = 120; // How long before we take a break? (minutes)
- cBREAK_FOR = 15; // How long will we break for? (minutes)
- cR_BREAK_IN = 25; // Random minutes to add/subtract from how long until we break
- cR_BREAK_FOR = 15; // Random minutes to add/subjtract from break duraction
- type
- TPotInfo = record
- toClean: String;
- Cleaned: String;
- UnfPot: String;
- XP: Extended;
- end;
- TPotInfoArray = array of TPotInfo;
- const
- PotInfo: TPotInfoArray = [
- ['Grimy guam leaf', 'Guam leaf', 'Guam potion (unf)', 2.5],
- ['Grimy marentill', 'Marrentill', 'Marrentill potion (unf)', 3.8],
- ['Grimy tarromin', 'Tarromin', 'Tarromin potion (unf)', 5],
- ['Grimy harralander', 'Harralander', 'Harralander potion (unf)', 6.3],
- ['Grimy ranarr weed', 'Ranarr weed', 'Ranarr potion (unf)', 7.5],
- ['Grimy toadflax', 'Toadflax', 'Toadflax potion (unf)', 8],
- ['Grimy irit leaf', 'Irit leaf', 'Irit potion (unf)', 8.8],
- ['Grimy avantoe', 'Avantoe', 'Avantoe potion (unf)', 10],
- ['Grimy kwuarm', 'Kwuarm', 'Kwuarm potion (unf)', 11.3],
- ['Grimy snapdragon', 'Snapdragon', 'Snapdragon potion (unf)', 11.8],
- ['Grimy cadantine', 'Cadantine', 'Cadantine potion (unf)', 12.5],
- ['Grimy lantadyme', 'Lantadyme', 'Lantadyme potion (unf)', 13.1],
- ['Grimy dwarf weed', 'Dwarf weed', 'Dwarf weed potion (unf)', 13.8],
- ['Grimy torstol', 'Torstol', 'Torstol potion (unf)', 15]];
- var
- info: TPotInfo;
- LocP: TReflectLocalPlayer;
- VialB, GHerbB, CHerbB: TReflectBankItem;
- VialI, GHerbI, CHerbI, PotI: TReflectInvItem;
- Grimies: TReflectInvItemArray;
- TotalDone, TotalCleaned, x, y: Integer;
- XP: Extended;
- ToClean, Cleaned, UnfPot: string;
- pnt: TPoint;
- T: TReflectTimer;
- procedure declarePlayer();
- begin
- Me.Name := P_USERNAME;
- Me.Pass := P_PASSWORD;
- Me.Pin := P_PIN;
- Me.Nick := '';
- Me.Active := True;
- Me.Member := True;
- end;
- procedure Draw(text: string);
- var
- DonePH, XPPH, CleanedPH: integer;
- TillBreak, BreakNo, DoingBreak: string;
- FillBox: TBox;
- begin
- DonePH := Round(((TotalDone) * 3600) / (GetTimeRunning / 1000));
- XPPH := Round(((TotalCleaned * XP) * 3600) / (GetTimeRunning / 1000));
- CleanedPH := Round(((TotalCleaned) * 3600) / (GetTimeRunning / 1000));
- TillBreak := 'Time until break: ' + msToTime(getTimeUntilBreak(), Time_Bare);
- DoingBreak := 'Time breaking for: ' + msToTime(break_RealTime, Time_Bare);
- BreakNo := 'Breaks Taken: ' + IntToStr(break_Count);
- FillBox := InttoBox(5, 345, 515, 502);
- OS_Smart.__Graphics.Clear;
- OS_Smart.__Graphics.DrawBox(FillBox, True, clNavy);
- OS_Smart.__Graphics.DrawClippedText('Status : ' + text, 'SmallChars', point(350, 365), clGray);
- OS_Smart.__Graphics.DrawClippedText('AHerblore - Version. ' + ScriptVersion, 'SmallChars', point(10, 365), clGray);
- OS_Smart.__Graphics.DrawClippedText('Run Time : ' + TimeRunning, 'SmallChars', point(10, 385), clGray);
- OS_Smart.__Graphics.DrawClippedText(IntToStr(TotalDone) + ' Total Done ', 'SmallChars', point(10, 405), clGray);
- OS_Smart.__Graphics.DrawClippedText(IntToStr(DonePH) + ' Done (P/H)', 'SmallChars', point(350, 405), clGray);
- OS_Smart.__Graphics.DrawClippedText(IntToStr(TotalCleaned) + ' Total Cleaned ', 'SmallChars', point(10, 425), clGray);
- OS_Smart.__Graphics.DrawClippedText(IntToStr(CleanedPH) + ' Cleaned (P/H) ', 'SmallChars', point(350, 425), clGray);
- OS_Smart.__Graphics.DrawClippedText(Floattostr(TotalCleaned * XP) + ' Herblore exp gained.', 'SmallChars', point(10, 445), clGray);
- OS_Smart.__Graphics.DrawClippedText(IntToStr(XPPH) + ' Herblore XP (P/H)', 'SmallChars', point(350, 445), clGray);
- OS_Smart.__Graphics.DrawClippedText(TillBreak, 'SmallChars', point(10, 465), clGray);
- OS_Smart.__Graphics.DrawClippedText(DoingBreak, 'SmallChars', point(10, 485), clGray);
- OS_Smart.__Graphics.DrawClippedText(BreakNo, 'SmallChars', point(350, 485), clGray);
- end;
- procedure setupPlayer();
- begin
- Draw('Logging In');
- if (not isLoggedIn()) then
- loginPlayer(false);
- if (isLoggedIn()) then
- begin
- setAngle(ANGLE_HIGH);
- LocP.Active := True;
- LocP.Create;
- end;
- end;
- procedure setup();
- begin
- setupPlayer();
- mouseSpeed := Random(18, 25);
- writeln('MouseSpeed set at: ' + intToStr(mouseSpeed));
- setupBreak(cBREAK_IN, cBREAK_FOR, cR_BREAK_IN, cR_BREAK_FOR);
- info := PotInfo[Ord(POT_TO_MAKE)];
- end;
- procedure customMouse(point: TPoint);
- begin
- case random(0, 6) of
- 0..2: BrakeMMouse(point, random(2), random(2), true);
- 3: BrakeMMouse(point, random(2), random(2), false);
- 4..5: MissMouse(point, random(2), random(2));
- 6: HumanMMouse(point, random(2), random(2));
- end;
- end;
- procedure beHuman(i: Integer);
- begin
- if not (pointInBox(getMousePnt(), intToBox(1, 1, 765, 500))) then
- exit;
- case Random(I) of
- 0..3: MMouseoffClient('rand');
- 4..5: hoverSkill(SKILL_HERBLORE, false);
- 5..20: SleepAndMoveMouse(200 + Random(2000));
- end;
- end;
- procedure L_Click();
- begin
- sleep(20 + random(100));
- FastClick(Mouse_Left);
- end;
- procedure R_Click(upstr: string; upwait: integer; textstr: string; waiti: integer);
- begin
- if (waitUptext(upstr, upwait)) then
- begin
- sleep(20 + random(30));
- fastClick(MOUSE_RIGHT);
- WaitOption(textstr, waiti);
- end;
- end;
- procedure C_Click(upstr: string; upwait: integer; textstr: string; waiti: integer);
- begin
- case random(0, 12) of
- 0..11: L_Click;
- 12: R_Click(upstr, upwait, textstr, waiti);
- end;
- end;
- function findObject(COL, TOL, PIXELS: Integer; HUE, SAT: Extended): Boolean;
- var
- WhatEver: TColEx;
- TPA: TPointArray;
- ATPA: T2DPointArray;
- I: Integer;
- box: TBox;
- x, y: Integer;
- begin
- WhatEver.Create(Col, Tol, Hue, Sat);
- if not WhatEver.FindAllIn(Area_MS, TPA) then
- Exit(False);
- ATPA := ClusterTPA(TPA, 10);
- SortATPAFromMidPoint(ATPA, Point(MSCX, MSCY));
- if (length(ATPA) <= 0) then
- begin
- result := False;
- exit;
- end;
- for I := 0 to high(ATPA) do
- begin
- if (length(ATPA[I]) >= PIXELS) then
- begin
- box := intToBox(ATPA[I].getBounds().X1, ATPA[I].getBounds().Y1 - 25, ATPA[I].getBounds().X2, ATPA[I].getBounds().Y2);
- if (box.x1 < 0) then
- box.x1 := 0;
- if (box.y1 < 0) then
- box.y1 := 0;
- pnt := MiddleTPA(ATPA[I]);
- result := True;
- exit;
- end;
- end;
- result := False;
- end;
- procedure openBank();
- var
- Bank: TReflectObject;
- BankChest: TReflectObject;
- BankNPC: TReflectNPC;
- TPA: TPointArray;
- ATPA: T2DPointArray;
- tCol: TColEx;
- begin
- if (isBankOpen()) then
- exit;
- if (Interfaces[PINSCREEN].isVisible()) then
- inPin(P_PIN);
- T.Restart;
- begin
- if (BANKTYPE = 'chest') then
- begin
- BankChest.Find(objGame, 'Bank chest', 10);
- Draw('Found Bank');
- Reflect.Mouse.Move(Bank.GetMSPoint, 5, 5);
- Draw('Opening Bank');
- C_Click('est', 250, 'Use Bank Chest', 300);
- end;
- if (BANKTYPE = 'booth') then
- begin
- Bank.Find(objGame, 'Bank booth', 10);
- Draw('Found Bank');
- Reflect.Mouse.Move(Bank.GetMSPoint, 5, 5);
- Draw('Opening Bank');
- R_Click('ooth', 250, 'Bank booth', 300);
- end;
- if (BANKTYPE = 'npc') then
- begin
- BankNPC.Find('Banker');
- Reflect.Mouse.Move(BankNPC.GetMSPoint, 3, 3);
- Pnt := BankNPC.GetMSpoint;
- customMouse(Pnt);
- R_Click('anker', 250, 'ank Bank', 300);
- Draw('Opening Bank');
- end;
- if (BANKTYPE = 'cellar') then
- begin
- if (findObject(660063, 4, 20, 0.08, 0.85)) then
- ; customMouse(pnt);
- R_Click('est', 250, 'ank', 300);
- Draw('Opening Bank');
- end;
- end;
- if (not isBankOpen()) then
- repeat
- sleep(250 + random(200));
- until (isBankOpen()) or (T.ElapsedTime > 5000);
- end;
- procedure doBank();
- begin
- if getInvCount > 0 then
- begin
- Draw('Depositing');
- quickDeposit('inv');
- end;
- if (CLEAN = 'only') then
- begin
- if not GHerbB.Find(info.toClean) then
- begin
- Draw('Low on materials!');
- closeinterface;
- logoutplayer;
- TerminateScript;
- end
- else
- begin
- Draw('Withdrawing');
- GHerbB.Find(info.toClean);
- GHerbB.Withdraw( - 1);
- end;
- end;
- if (CLEAN = 'yes') then
- begin
- if not GHerbB.Find(info.ToClean) or not VialB.Find('Vial of water') then
- begin
- Draw('Low on materials!');
- closeinterface;
- logoutplayer;
- TerminateScript;
- end
- else
- begin
- Draw('Withdrawing');
- case random(0, 1) of
- 0:
- begin
- GHerbB.Find(info.ToClean);
- GHerbB.Withdraw( - 14);
- VialB.Find('Vial of water');
- VialB.Withdraw( - 1);
- end;
- 1:
- begin
- VialB.Find('Vial of water');
- VialB.Withdraw( - 14);
- GHerbB.Find(info.ToClean);
- GHerbB.Withdraw( - 1);
- end;
- end;
- end;
- end;
- if (CLEAN = 'no') then
- begin
- if not CHerbB.Find(info.Cleaned) or not VialB.Find('Vial of water') then
- begin
- Draw('Low on materials!');
- closeinterface;
- logoutplayer;
- TerminateScript;
- end
- else
- begin
- Draw('Withdrawing');
- case random(0, 1) of
- 0:
- begin
- CHerbB.Find(info.Cleaned);
- CHerbB.Withdraw( - 14);
- VialB.Find('Vial of water');
- VialB.Withdraw( - 1);
- end;
- 1:
- begin
- VialB.Find('Vial of water');
- VialB.Withdraw( - 14);
- CHerbB.Find(info.Cleaned);
- CHerbB.Withdraw( - 1);
- end;
- end;
- end;
- end;
- closeInterface;
- Draw('Closing Bank');
- end;
- procedure CleanHerbs;
- var
- strArr: TStringArray;
- id, I: Integer;
- begin
- Grimies.GetAll;
- setArrayLength(strArr, 1);
- strArr := [info.ToClean] for I := 0 to High(Grimies) do
- if inStrArrEx(Grimies[I].GetName, strArr, id) then
- begin
- pnt := Grimies[I].GetPoint;
- customMouse(pnt);
- L_Click;
- sleep(randomRange(20, 200));
- Draw('Cleaning Herbs');
- end;
- end;
- procedure Make;
- begin
- if (CLEAN = 'only') then
- begin
- cleanHerbs;
- TotalCleaned += 28;
- end;
- if (CLEAN = 'yes') then
- begin
- CleanHerbs;
- while GHerbI.Find(info.ToClean) do wait(randomRange(50,500));
- case random(0, 1) of
- 0:
- begin
- if CHerbI.Find(info.Cleaned) then
- begin
- Pnt := CHerbI.GetPoint;
- customMouse(pnt);
- L_Click;
- end;
- if VialI.Find('Vial of water') then
- begin
- Pnt := VialI.GetPoint;
- customMouse(pnt);
- L_Click;
- end;
- end;
- 1:
- begin
- if VialI.Find('Vial of water') then
- begin
- Pnt := VialI.GetPoint;
- customMouse(pnt);
- L_Click;
- end;
- if CHerbI.Find(info.Cleaned) then
- begin
- Pnt := CHerbI.GetPoint;
- customMouse(pnt);
- L_Click;
- end;
- end;
- end;
- begin
- waitChatChange();
- Wait(randomRange(100,300)); // Human reaction time
- gaussMouseBox(105, 385, 420, 440, Mouse_Move);
- if (waitUptext('ake', 870)) then
- begin
- fastClick(MOUSE_RIGHT);
- waitOption('Make All', 300);
- end;
- Draw('Making Potions');
- T.Restart;
- wait(randomRange(2000, 4000));
- repeat
- beHuman(500);
- wait(randomRange(1000, 2000));
- if not PotI.Find(info.UnfPot) then
- exit;
- until (getInvCount = 14) or (T.ElapsedTime > 15000);
- if not VialI.Find('Vial of water') then
- TotalDone += 14;
- TotalCleaned += 14;
- end;
- end;
- if (CLEAN = 'no') then
- begin
- case random(0, 1) of
- 0:
- begin
- if CHerbI.Find(info.Cleaned) then
- begin
- Pnt := CHerbI.GetPoint;
- customMouse(pnt);
- L_Click;
- end;
- if VialI.Find('Vial of water') then
- begin
- Pnt := VialI.GetPoint;
- customMouse(pnt);
- L_Click;
- end;
- end;
- 1:
- begin
- if VialI.Find('Vial of water') then
- begin
- Pnt := VialI.GetPoint;
- customMouse(pnt);
- L_Click;
- end;
- if CHerbI.Find(info.Cleaned) then
- begin
- Pnt := CHerbI.GetPoint;
- customMouse(pnt);
- L_Click;
- end;
- end;
- end;
- begin
- waitChatChange();
- Wait(randomRange(100,300)); // Human reaction time
- gaussMouseBox(105, 385, 420, 440, Mouse_Move);
- if (waitUptext('ake', 870)) then
- begin
- fastClick(MOUSE_RIGHT);
- waitOption('Make All', 300);
- end;
- Draw('Making Potions');
- T.Restart;
- wait(randomRange(2000, 4000));
- repeat
- beHuman(500);
- Wait(randomRange(1000, 2000));
- if not PotI.Find(info.UnfPot) then
- exit;
- until (getInvCount = 14) or (T.ElapsedTime > 15000);
- if not VialI.Find('Vial of water') then
- TotalDone += 14;
- end;
- end;
- end;
- function getState(): Integer;
- begin
- if (getTimeRunning >= getTimeUntilBreak) and (USEBREAKS) then
- exit(5);
- if (not isLoggedIn()) then
- exit(0);
- if ((getCurrentTab <> TAB_INV) and (not isBankOpen())) then
- exit(1);
- if (not isInvFull()) and (not isBankOpen()) then
- exit(2);
- if (isBankOpen()) then
- exit(3)
- if (isInvFull()) and (not LocP.isAnimating) then
- exit(4);
- end;
- procedure executeState(State: Integer);
- begin
- case (State) of
- 0: setupPlayer();
- 1: gameTab(TAB_INV);
- 2: openBank();
- 3: doBank();
- 4: Make();
- 5: breakHandler();
- end;
- sleep(Random(50, 100));
- end;
- begin
- declarePlayer();
- InitAL();
- Reflect.Setup;
- setup;
- repeat
- executeState(getState());
- until (false);
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement