Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program MahoganyPlankMaker;
- {$DEFINE SMART}
- {$i SRL\SRL.scar}
- {$i Reflection\Reflection.Simba}
- {$i SRL\SRL\Misc\Stats.Simba}
- const
- S_Mems = True; //Members?
- S_World = 38; //Smart world
- S_Signed = True; //Signed client?
- Stats_User = ''; //SRL Stats username
- Stats_Pass = ''; //SRL Stats password
- ColorRandoms = False; //True for Color antirandoms, False for Reflection
- procedure DeclarePlayers;
- begin
- HowManyPlayers := 1;
- NumberOfPlayers(HowManyPlayers);
- CurrentPlayer := 0;
- with Players[0] do
- begin
- Name := '';
- Pass := '';
- Nick := '';
- Pin := '';
- Active := True;
- end;
- end;
- const
- {Progress report info}
- TimesCasted = 0;
- Levels = 1;
- PlanksMade = 2;
- procedure Antiban;
- begin
- case (49) of
- 0..4: MakeCompass(rs_GetCompassAngleDegrees - 40 + Random(80));
- 5..6: HoverSkill(SKILL_MAGIC, False);
- 7..8: PickUpMouse;
- 9: RandomRClick;
- end;
- end;
- procedure Die(Reason: string; Active: Boolean);
- begin
- if (Players[CurrentPlayer].Status <> '') then
- Exit;
- Writeln('Player ' + IntToStr(CurrentPlayer) + ' died because: ' + Reason);
- Players[CurrentPlayer].Status := Reason;
- Players[CurrentPlayer].Active := Active;
- if BankScreen then
- CloseBank;
- Logout;
- end;
- procedure FRans;
- begin
- if ColorRandoms then
- FindNonInventoryRandoms
- else
- R_FindRandoms;
- end;
- function AttemptFuncion(func: function: Boolean; Attempts, WaitPer: Integer; RandomMovement: Boolean): Boolean;
- var
- i, w, h: Integer;
- begin
- for i := 1 to Attempts do
- begin
- if func() then
- begin
- Result := True;
- Exit;
- end;
- if RandomMovement then
- begin
- GetClientDimensions(w, h);
- MMouse(0, 0, w, h);
- end;
- Wait(WaitPer);
- FRans;
- end;
- end;
- function AttemptAndSwivel(func: function: Boolean; Attempts, SwivelPer: Integer): Boolean;
- var
- i: Integer;
- begin
- for i := 1 to Attempts do
- begin
- if func() then
- begin
- Result := True;
- Exit;
- end;
- FRans;
- MakeCompass(rs_GetCompassAngleDegrees + (SwivelPer + Random(10) - Random(10)));
- Wait(800 + Random(80));
- end;
- end;
- function FixLunarBook: Boolean;
- var
- i: Integer;
- begin
- if not(LoggedIn) or not(GameTab(tab_Magic)) then
- Exit;
- for i := 0 to 3 do //Actually click buttons
- begin
- if (i < 3) then
- if (GetColor(589 + (i * 26), 442) <> 16711422) then
- begin
- Mouse(589 + (i * 26), 442, 15, 15, True);
- Wait(950 + Random(600));
- end;
- if (i = 3) then //"Sort by Level" button
- if (GetColor(675, 442) <> 16711422) then
- begin
- Mouse(675, 442, 15, 15, True);
- Wait(950 + Random(600));
- end;
- end;
- for i := 0 to 3 do //Making sure buttons were clicked
- begin
- if (i < 3) then
- if (GetColor(589 + (i * 26), 442) <> 16711422) then
- Exit;
- if (i = 3) then
- if (GetColor(675, 442) = 16711422) then
- Result := True;
- end;
- end;
- function PlankMakeActive: Boolean;
- begin
- if not(LoggedIn) or not(GameTab(tab_Magic) or not(FixLunarBook)) then
- Exit;
- Result := (CountColorTolerance(7784661, 700, 335, 722, 357, 32) > 25);
- end;
- function CountLogs: Integer;
- var
- i, x, y, LogDTM: Integer;
- Box: TBox;
- begin
- if not(LoggedIn) then
- Exit;
- LogDTM := DTMFromString('mggAAAHicY2NgYDjExMCwD4g3AfEOID4OxKeAuJSRgSEXiMuAuB6Ia4G4CIg7i32BupgwsByQxIYZcWAIAACWWAln');
- for i := 1 to 28 do
- begin
- Box := InvBox(i);
- if FindDTM(LogDTM, x, y, Box.X1, Box.Y1, Box.X2, Box.Y2) then
- Inc(Result);
- end;
- FreeDTM(LogDTM);
- end;
- function OpenVWB: Boolean;
- var
- TPA: TPointArray;
- ATPA: T2DPointArray;
- i, x, y, CTS: Integer;
- HueMod, SatMod: Extended;
- begin
- if not(LoggedIn) then
- Exit;
- CTS := GetColorToleranceSpeed;
- SetColorToleranceSpeed(2);
- GetColorspeed2Modifiers(HueMod, SatMod);
- SetColorspeed2Modifiers(0.13, 0.45);
- FindColorsTolerance(TPA, 2707293, MSX1, MSY1, MSX2, MSY2, 2);
- SetColorToleranceSpeed(CTS);
- SetColorspeed2Modifiers(HueMod, SatMod);
- if (Length(TPA) < 1) then
- Exit;
- ATPA := TPAtoATPA(TPA, 30);
- SortATPAFrom(ATPA, Point(MSCX, MSCY));
- for i := 0 to High(ATPA) do
- begin
- if (Length(ATPA[i]) < 30) then
- Continue;
- MiddleTPAEx(ATPA[i], x, y);
- if (PointInBox(Point(x, y), IntToBox(MSCX - 15, MSCY - 15, MSCX + 15, MSCY + 15))) then
- Continue;
- MMouse(x - 4, y - 4, 8, 8);
- if WaitUptextMulti(['nk bo', 'e Bank b', 'booth'], 900) then
- begin
- ClickMouse2(False);
- Result := WaitOptionMulti(['uickl', '-qui', 'e-quic', 'ckly'], 1800);
- end;
- if Result then
- Break;
- end;
- if Result then
- begin
- Result := WaitFunc(@BankScreen, 10 + Random(10), 8000);
- end;
- end;
- function WithdrawLogs: Boolean;
- var
- i, LogDTM, Index, x, y, T: Integer;
- Box: TBox;
- begin
- if not(LoggedIn) or not(BankScreen) then
- Exit;
- FixBank;
- LogDTM := DTMFromString('mggAAAHicY2NgYDjExMCwD4g3AfEOID4OxKeAuJSRgSEXiMuAuB6Ia4G4CIg7i32BupgwsByQxIYZcWAIAACWWAln');
- for i := 1 to 40 do
- begin
- Box := BankIndexToMSBox(i);
- if FindDTM(LogDTM, x, y, Box.X1, Box.Y1, Box.X2, Box.Y2) then
- begin
- Index := i;
- Break;
- end;
- end;
- FreeDTM(LogDTM);
- if (Index = 0) then
- Exit;
- Box := BankIndexToMSBox(Index);
- MouseBox(Box.X1, Box.Y1, Box.X2, Box.Y2, 3);
- if WaitUpTextMulti(['gany', 'y lo', 'ahog'], 1600) then
- begin
- ClickMouse2(False);
- Result := WaitOptionMulti(['ll Ma', 'All M'], 1500);
- end;
- T := GetSystemTime + 2000;
- while (GetSystemTime < T) do
- if (CountLogs > 0) then
- begin
- Result := True;
- Exit;
- end;
- end;
- function WaitTab(Tab, MaxTime: Integer): Boolean;
- var
- T: Integer;
- begin
- if not(LoggedIn) then
- Exit;
- T := GetSystemTime + MaxTime;
- while (GetSystemTime < T) do
- begin
- if (GetCurrentTab = Tab) then
- begin
- Result := True;
- Exit;
- end;
- WaitNone;
- end;
- end;
- function CastPlankMake: Boolean;
- begin
- if not(LoggedIn and PlankMakeActive) then
- Exit;
- MMouse(705, 334, 19, 19);
- if WaitUptextMulti(['t Pl', 'nk M', 'ast P', 'lank M'], 2000) then
- begin
- ClickMouse2(True);
- Result := WaitTab(tab_Inv, 2400);
- end;
- end;
- function ClickMahogany: Boolean;
- var
- i, MahoganyDTM, LogSlot, x, y: Integer;
- Box: TBox;
- begin
- if not(LoggedIn) or (GetCurrentTab <> tab_Inv) then
- Exit;
- MahoganyDTM := DTMFromString('mggAAAHicY2NgYDjExMCwD4g3AfEOID4OxKeAuJSRgSEXiMuAuB6Ia4G4CIg7i32BupgwsByQxIYZcWAIAACWWAln');
- for i := 4 to 28 do //slot 1 = runes, slot 2 = runes, slot 3 = cash, slots 3-28 = logs
- begin
- Box := InvBox(i);
- if FindDTM(MahoganyDTM, x, y, Box.X1, Box.Y1, Box.X2, Box.Y2) then
- begin
- LogSlot := i;
- Break;
- end;
- end;
- FreeDTM(MahoganyDTM);
- if (LogSlot = 0) then
- for i := 4 to 28 do
- begin
- Box := InvBox(i);
- MouseBox(Box.X1, Box.Y1, Box.X2, Box.Y2, 3);
- if WaitUptextMulti(['> M', 'e -> Ma'], 1600) then
- begin
- x := Round(Distance(Box.X1, Box.Y1, Box.X2, Box.Y1)/2) + Box.X1;
- y := Round(Distance(Box.X1, Box.Y1, Box.X1, Box.Y2)/2) + Box.Y1;
- Break;
- end;
- end;
- MMouse(x - 8, y - 8, 16, 16);
- if WaitUptextMulti(['> M', 'e -> Ma'], 1600) then
- begin
- ClickMouse2(True);
- Result := WaitTab(tab_Magic, 2400);
- end;
- end;
- function CountPlanks: Integer; //Call while bank screen is open
- var
- PlankDTM, i, x, y: Integer;
- Box: TBox;
- begin
- if not(LoggedIn) then
- Exit;
- PlankDTM := DTMFromString('mggAAAHicY2NgYJjOxMAwE4inAvECIO4F4ilArM3IwCAPxJZArAjE5kCsAcSuJupAXUwYWI4BO2DEgSEAADqWBXA=');
- for i := 4 to 28 do
- begin
- Box := InvBox(i);
- if FindDTM(PlankDTM, x, y, Box.X1, Box.Y1, Box.X2, Box.Y2) then
- Inc(Result);
- end;
- FreeDTM(PlankDTM);
- end;
- procedure Report;
- var
- i: Integer;
- begin
- Writeln('+---------------------------------------------+');
- Writeln('| TomTuff''s Mahogonay Plank Maker |');
- Writeln('+---------------------------------------------+');
- for i := 0 to High(Players) do
- begin
- Writeln('| Player ' + IntToStr(i) + '(' + Players[i].Nick + ')');
- writeln('| Worked: ' + MsToTime(PlayerWorked(i), time_Abbrev));
- writeln('| Times Casted: ' + IntToStr(Players[i].Integers[TimesCasted]));
- Writeln('| EXP: ' + IntToStr(Players[i].Integers[TimesCasted] * 90));
- if (Players[i].Integers[Levels] > 0) then
- Writeln('| Levels gained: ' + IntToStr(Players[i].Integers[Levels]));
- Writeln('+---------------------------------------------+');
- end;
- end;
- procedure CheckSRLStats;
- var
- i: Integer;
- begin
- if (Stats_User = '') or (Stats_Pass = '') then
- begin
- Writeln('Please get SRL Stats to avoid this 15 second wait.');
- for i := 15 downto 1 do
- begin
- Writeln(IntToStr(i) + '...');
- Wait(1000);
- end;
- end;
- end;
- procedure MainLoop;
- var
- RemainingLogs: Integer;
- begin
- Smart_Members := S_Mems;
- Smart_Server := S_World;
- Smart_Signed := S_Signed;
- Smart_SuperDetail := False;
- SetupSRL;
- SetupSRLStats(40, Stats_User, Stats_Pass);
- DeclarePlayers;
- if not(LoggedIn) then
- begin
- LogInPlayer;
- Wait(8000 + Random(2000));
- end;
- CheckSRLStats;
- repeat
- SetAngle(True);
- repeat
- RemainingLogs := 0;
- FRans;
- if AttemptAndSwivel(@OpenVWB, 8, 45) then
- begin
- Wait(1200 + Random(600));
- stats_IncVariable('Mahogany Planks Made', CountPlanks);
- IncEx(Players[CurrentPlayer].Integers[PlanksMade], CountPlanks);
- Deposit(4, 28, True);
- if AttemptFuncion(@WithdrawLogs, 5, 1200 + Random(800), True) then
- begin
- if CloseBank then
- begin
- stats_IncVariable('Times Banked', 1);
- Inc(Players[CurrentPlayer].Banked);
- Wait(800 + Random(400));
- end else Die('could not close the bank', False);
- end else Die('could not withdraw logs', False);
- end else Die('could not open VWB', False);
- Antiban;
- repeat
- FRans;
- if AttemptFuncion(@CastPlankMake, 4, 1200 + Random(800), True) then
- begin
- Wait(200 + Random(200));
- RemainingLogs := 0;
- RemainingLogs := CountLogs;
- FRans;
- if AttemptFuncion(@ClickMahogany, 5, 1500 + Random(800), True) then
- begin
- stats_IncVariable('Total EXP Gained', 90);
- stats_IncVariable('Plank Makes Casted', 1);
- Inc(Players[CurrentPlayer].Integers[TimesCasted]);
- Wait(900 + Random(300)); //1 cast = 3 game ticks
- if LevelUp then
- begin
- stats_IncVariable('Total Levels Gained', 1);
- Inc(Players[CurrentPlayer].Integers[Levels]);
- end;
- end else Die('could not click the logs in the inventory', False);
- end else Die('could not cast plank make', False);
- until (RemainingLogs = 1) or not(LoggedIn);
- Report;
- stats_Commit;
- until(not(LoggedIn));
- NextPlayer(Players[CurrentPlayer].Active);
- Report;
- until(AllPlayersInactive);
- Report;
- end;
- begin
- MainLoop;
- Writeln('****** FINAL REPORT ******');
- Report;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement