Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program new;
- {$DEFINE SRL_USE_REMOTEINPUT}
- {$I SRL/osr.simba}
- const
- USERNAME = '';
- PASSWORD = '';
- var
- current: TPoint;
- FastMouse: TMouse := Mouse;
- FishingSites: TCircleArray;
- fishing_xp, hunter_xp: single;
- const
- P2P_WORLDS = [302,303,304,305,306,307,309,310,311,312,313,314,315,317,318,319,320];
- procedure TSRL.MouseOffClient(direction: Byte);
- var
- W,H: Int32;
- pt: TPoint;
- begin
- GetClientDimensions(W, H);
- pt := Mouse.Position();
- if (pt.X < 0) or (pt.X > W) or (pt.Y < 0) or (pt.Y > H) then
- Exit();
- if (direction >= 4) then
- direction := Random(0,3);
- case direction of
- 0: Mouse.Move(Box(-300, -300, W, 0)); // top
- 1: Mouse.Move(Box(0, H, W, H+300)); // bottom
- 2: Mouse.Move(Box(-300, 0, 0, H)); // left
- 3: Mouse.Move(Box(W, 0, W+300, H)); // right
- end;
- end;
- procedure TAntiban.RandomPOVTask;
- begin
- case Random(7) of
- 0: Self.AdjustZoom;
- else Self.RandomRotate;
- end;
- end;
- procedure TAntiban.LoseFocus(); override;
- begin
- if Random() < 0.5 then
- srl.MouseOffClient(srl.SkewedRand(3,0,3));
- Antiban.LoseFocus(srl.SkewedRand(1000,500,30000));
- end;
- procedure DoAntiban(CheckBreaks: Boolean = True; CheckSleeps: Boolean = True);
- begin
- Antiban.DoAntiban(CheckBreaks, CheckSleeps);
- if not RSClient.IsLoggedIn() then
- login.LoginPlayer();
- end;
- function FindFish(): TCircleArray;
- var
- TPA: TPointArray;
- ATPA: T2DPointArray;
- i: Int32;
- c: TCircle;
- begin
- srl.FindColors(TPA, CTS2(11634814, 8, 0.13, 0.99), MainScreen.Bounds);
- if Length(TPA) = 0 then Exit;
- ATPA := TPA.Cluster(5);
- ATPA.SortByMiddle(Mouse.Position());
- if Length(ATPA) = 0 then Exit;
- if not ATPA[0].Bounds().Contains(Mouse.Position) then
- ATPA.SortByMiddle(MainScreen.Center);
- for i:=0 to High(ATPA) do
- begin
- if Length(TPA) < 100 then continue;
- c := ATPA[i].MinAreaCircle();
- if c.Radius > 8 then
- Result += c;
- end;
- RSClient.Image.Clear();
- for i:=0 to High(result) do
- RSClient.Image.DrawCircle(Result[i].Mean(), Result[i].Radius, 1);
- end;
- function MouseNext(): Boolean;
- var i: Int32;
- begin
- FishingSites := FindFish();
- for i:=0 to High(FishingSites) do
- if not FishingSites[i].Contains(current) then
- begin
- FastMouse.Move(FishingSites[i].Mean, FishingSites[i].Radius);
- break;
- end;
- end;
- function TrackBird(DbgColor: Int32 = 0; offset: TPoint=[0,0]): TPoint;
- var
- TPA,wat,line: TPointArray;
- ATPA: T2DPointArray;
- i,n: Int32;
- m: TPoint;
- b: TBox;
- begin
- m := current;
- line := TPAFromLine(m, MainScreen.Center);
- b := line.Bounds().Expand(50);
- b.LimitTo(MainScreen.Bounds);
- n := 0;
- repeat
- srl.FindColors(TPA, CTS2(5064528, 12, 2.74, 0.48), b);
- TPA := TPA.PointsInRangeOf(line, 0, 50);
- ATPA := TPA.Cluster(10);
- ATPA.FilterSize(30,200);
- TPA := ATPA.Means();
- TPA.SortFromLine(m, MainScreen.Center);
- if DbgColor <> 0 then
- begin
- RSClient.Image.Clear(b);
- if Length(TPA) > 0 then
- RSClient.Image.DrawCircle(TPA[0]+offset, 8, DbgColor);
- end;
- n += 1;
- until Length(TPA) > 0;
- TPA.Sort(MainScreen.Center);
- Result := TPA[0];
- end;
- function WaitBird(dist: Single): Boolean;
- var
- a,b,o: TPoint;
- return: Boolean;
- slot: Int32;
- t: TCountDown;
- function Dbgoff(a,b: TPoint): TPoint;
- var t: Single;
- begin
- if a.DistanceTo(b) < 10 then Exit(Point(0,0));
- t := ArcTan2(b.y-a.y, b.x-a.x);
- Result := [Round(6*cos(t)), Round(6*sin(t))];
- end;
- begin
- // this is the point where the bird starts to return, furthest away!
- // we can drop a fish right here!
- while not return do
- begin
- a := TrackBird();
- t.Init(70);
- while not t.IsFinished() do begin
- b := TrackBird($FF, o);
- Sleep(1);
- end;
- o := Dbgoff(a,b);
- if (a.DistanceTo(b) <= 5) then break; //Exit(True);
- return := False;
- if a.DistanceTo(MainScreen.Center) > b.DistanceTo(MainScreen.Center)+10 then
- return := True;
- end;
- Result := WaitUntil(MainScreen.Center.DistanceTo(TrackBird($00FF00, Dbgoff(a,b))) < dist, 10, 2000);
- MouseNext();
- end;
- function WaitLiftoff(): Boolean;
- begin
- Result := WaitUntil(
- (TrackBird($00FF00) <> Point(0,0)) and (MainScreen.Center.DistanceTo(TrackBird($00FF00)) > 25),
- 10, 2000
- );
- end;
- function IsBirdAway(dist: single): Boolean;
- var
- t: TCountDown;
- b: TPoint;
- begin
- t.Init(100);
- while not t.IsFinished() do
- begin
- b := TrackBird($00FF00);
- Exit(MainScreen.Center.DistanceTo(b) > dist);
- end;
- end;
- procedure DebugXP(baseXp: Int32);
- var
- gained: Int32;
- begin
- gained := XPBar.Read() - baseXp;
- WriteLn('---------------------------------------');
- WriteLn('Time running: ', srl.TimeRunning());
- WriteLn('Gained XP: ', gained);
- WriteLn('Gained Fishing XP: ', srl.FormatNumber(fishing_xp));
- WriteLn('Gained Hunter XP: ', srl.FormatNumber(hunter_xp));
- //WriteLn('Gained Cooking XP: ', srl.FormatNumber(cooking_xp));
- WriteLn('Fishing XP/H: ', srl.FormatNumber((fishing_xp) / GetTimeRunning() * 1000 * 60 * 60));
- WriteLn('Hunter XP/H: ', srl.FormatNumber((hunter_xp) / GetTimeRunning() * 1000 * 60 * 60));
- //WriteLn('Cooking XP/H: ', srl.FormatNumber((caught * 3.5) / GetTimeRunning() * 1000 * 60 * 60));
- WriteLn('---------------------------------------');
- end;
- procedure Setup();
- begin
- Login.AddPlayer(USERNAME, PASSWORD, '', P2P_WORLDS);
- Antiban.Skills := [ERSSkill.HUNTER, ERSSkill.FISHING];
- Antiban.MaxZoom := 40;
- Antiban.MinZoom := 20;
- //Antiban.AddTask(5 * ONE_MINUTE, @Antiban.HoverPlayer);
- Antiban.AddTask(6 * ONE_MINUTE, @Antiban.RandomPOVTask);
- Antiban.AddTask(8 * ONE_MINUTE, @Antiban.RandomRightClick);
- Antiban.AddTask(8 * ONE_MINUTE, @Antiban.Swivel);
- Antiban.AddTask(9 * ONE_MINUTE, @Antiban.HoverSkills);
- Antiban.AddTask(10 * ONE_MINUTE, @Antiban.LoseFocus);
- Antiban.AddTask(12 * ONE_MINUTE, @Antiban.RandomTab);
- Antiban.AddBreak(25 * ONE_MINUTE, 1 * ONE_MINUTE, 0.33, 0.01);
- Antiban.AddBreak(55 * ONE_MINUTE, 2 * ONE_MINUTE, 0.33, 0.02);
- Antiban.AddBreak(80 * ONE_MINUTE, 5 * ONE_MINUTE, 0.33, 0.15);
- Antiban.AddBreak(100 * ONE_MINUTE, 10 * ONE_MINUTE, 0.33, 0.75);
- Antiban.AddBreak(150 * ONE_MINUTE, 30 * ONE_MINUTE, 0.33, 0.85);
- //Antiban.AddSleep('00:00', 8, 1, 1.0);
- end;
- procedure FastDrop1();
- var
- slots: TIntegerArray;
- catch: string;
- begin
- if Inventory.FindItems(['Bluegill', 'Common tench'], slots) then
- begin
- FastMouse.Move(Inventory.GetSlotBox(slots[0]));
- ChooseOption.Open();
- catch := ChooseOption.GetOptions()[1].Text
- //Inventory.ShiftDrop([slot]);
- //if Inventory.IsSlotSelected(slot) then
- //begin
- // Inventory.ClickSlot(slot);
- if catch.Pos('Bluegill') > 0 then
- begin
- hunter_xp += 16.5;
- fishing_xp += 11.5;
- end;
- if catch.Pos('Common') > 0 then
- begin
- hunter_xp += 45;
- fishing_xp += 40;
- end;
- if not ChooseOption.Select('Drop') then
- ChooseOption.Close();
- //end;
- end;
- end;
- procedure Main();
- var
- i: Int32;
- xp: Int32;
- begin
- xp := XPBar.Read();
- while True do
- begin
- Mouse.Speed := Random(16,21);
- Mouse.CanIdle := Random() > 0.75;
- FastMouse.CanIdle := Random() > 0.95;
- FastMouse.Speed := Random(22,30);
- if Inventory.IsFull() then
- begin
- Inventory.Use('Knife', 'Bluegill');
- WaitUntil(Inventory.CountItem('Bluegill') <= 0, 50, 40000);
- Inventory.Use('Knife', 'Common tench' );
- WaitUntil(Inventory.CountItem('Common tench' ) <= 0, 50, 40000);
- end;
- // ensure bird has returned
- if IsBirdAway(130) then
- begin
- Wait(30,100);
- continue;
- end;
- WriteLn('> Find fish!');
- FishingSites := FindFish();
- if Length(FishingSites) = 0 then continue;
- for i:=0 to High(FishingSites) do
- begin
- current := FishingSites[i].Mean();
- Mouse.Move(current, FishingSites[i].Radius);
- Wait(50,100);
- if MainScreen.IsUpText('Catch') then
- begin
- Mouse.Click(MOUSE_LEFT);
- if MainScreen.DidRedClick() then
- begin
- //Drop1: XX uomment to collect and use knife
- FastMouse.Move(Inventory.GetSlotBox(4).Expand(20));
- // not drop 1..
- WriteLn('> Wait for liftoff');
- WaitLiftoff();
- //Drop1: XX comment to collect and use knife
- FastDrop1();
- MouseNext();
- RSClient.Image.Clear();
- end;
- end;
- break; // only really care about first, because
- // spots only last so long.
- end;
- WriteLn('> Wait for bird to return');
- WaitBird(130);
- DoAntiban();
- // xp...
- DebugXP(xp);
- if Inventory.CountStack(0) < 100 then
- TerminateScript;
- end;
- end;
- begin
- Main();
- end;
Add Comment
Please, Sign In to add comment