Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program Reflect_Smelter;
- {$DEFINE SMART}
- {$I Reflection\Reflection.simba}
- Const
- NAME = '';
- PASSWORD = '';
- HEALBETWEEN = [23, 40];
- Var
- LocPlayer : TReflectLocalPlayer;
- Tiles, midTiles : TPointArray;
- Tile : TPoint;
- Heal, xpInt, WaitCoffeeI, WaitEatI, WaitFapI, WaitSleepI, antibans : Integer;
- runTime, WaitCoffee, WaitEat, WaitFap, WaitSleep : TReflectTimer;
- Procedure Terminate(s : string);
- Begin
- WriteLn(s);
- TerminateScript();
- End;
- Procedure setVars();
- Begin
- LocPlayer.Username := NAME;
- LocPlayer.Password := PASSWORD;
- Tiles := [Point(3009, 3518), Point(3008, 3517), Point(3008, 3516), Point(3008, 3515), Point(3008, 3514), Point(3009, 3517), Point(3009, 3516), Point(3009, 3515), Point(3009, 3514), Point(3009, 3513), Point(3010, 3513), Point(3010, 3514), Point(3010, 3517), Point(3010, 3518), Point(3011, 3518), Point(3011, 3517), Point(3011, 3514), Point(3011, 3513), Point(3012, 3514), Point(3012, 3515), Point(3012, 3516), Point(3012, 3517), Point(3013, 3516), Point(3013, 3515), Point(3013, 3514), Point(3014, 3515), Point(3014, 3516), Point(3015, 3515), Point(3015, 3516), Point(3016, 3515), Point(3016, 3516), Point(3017, 3515), Point(3017, 3516), Point(3018, 3516), Point(3018, 3515), Point(3019, 3513), Point(3019, 3514), Point(3019, 3515), Point(3019, 3516), Point(3019, 3517)];
- midTiles := [Point(3014, 3515), Point(3014, 3516), Point(3015, 3515), Point(3015, 3516), Point(3016, 3515), Point(3016, 3516), Point(3017, 3515), Point(3017, 3516)];
- Heal := RandomRange(HEALBETWEEN[0], HEALBETWEEN[1]);
- xpInt := locPlayer.GetSkillExp(SKILL_HITPOINTS);
- WaitCoffee.Start;
- WaitFap.start;
- WaitEat.start;
- WaitSleep.start;
- WaitCoffeeI := (RandomRange(11, 40) * 1000 * 60) + Random(60000);
- WaitFapI := (RandomRange(180, 800) * 1000 * 60) + Random(60000);
- WaitEatI := (RandomRange(218, 402) * 1000 * 60) + Random(60000);
- WaitSleepI := (RandomRange(680, 890) * 1000 * 60) + Random(60000);
- End;
- Procedure paint();
- Begin
- Reflect.Smart.Graphics.Clear;
- Reflect.Smart.Graphics.DrawClippedText('XP/H: ' + ToStr(Round((locPlayer.GetSkillExp(SKILL_HITPOINTS)-xpInt) * (3600000/getTimeRunning) * 4)), 'SmallChars07', Point(20, 20));
- Reflect.Smart.Graphics.DrawClippedText('Time run: ' + Reflect.Time.MsToTime(getTimeRunning, Time_Short), 'SmallChars07', Point(20, 40));
- Reflect.Smart.Graphics.DrawClippedText('XP Gained: ' + toStr((locPlayer.GetSkillExp(SKILL_HITPOINTS)-xpInt) * 4), 'SmallChars07', Point(20, 60));
- End;
- Procedure RotateRandom();
- Begin
- Case Random(46) Of
- 0..24:
- Begin
- KeyDown(VK_LEFT);
- Wait(RandomRange(138, 364));
- If Random(5) < 3 then
- Reflect.Antiban.HumanRandomMouse();
- Wait(RandomRange(242, 441));
- KeyUp(VK_LEFT);
- End;
- 25..46:
- Begin
- KeyDown(VK_RIGHT);
- Wait(RandomRange(138, 364));
- If Random(5) < 3 then
- Reflect.Antiban.HumanRandomMouse();
- Wait(RandomRange(242, 441));
- KeyUp(VK_RIGHT);
- End;
- End;
- End;
- Function PntOutsideBox(Box : TBox; maxDist : integer) : TPoint;
- Begin
- If Random(30) > 22 Then
- Result.X := (Box.X2 + 1) + Random(maxDist) Else
- Result.X := (Box.X1 - 1) - Random(maxDist);
- If Random(20) > 13 Then
- Result.Y := (Box.Y1 - 1) - Random(maxDist) Else
- Result.Y := (Box.Y2 + 1) + Random(maxDist);
- End;
- function TReflectionMouse.DidClick(Red: Boolean; MaxTime: Integer = 1000): override;
- var
- T: Integer;
- begin
- T := GetSystemTime() + MaxTime;
- self.Click(MOUSE_LEFT);
- while (GetSystemTime() < T) and (not Result) do
- case Red of
- True: Result := Reflect.Smart.GetFieldInt(0, Client_CrossHairColor) = 2;
- False: Result := Reflect.Smart.GetFieldInt(0, Client_CrossHairColor) = 1;
- end;
- end;
- Procedure MOffClient();
- var
- time : Integer;
- Begin
- time := abs(Reflect.Math.iGaussRange(-20000, 31245));
- Reflect.Mouse.Move(PntOutsideBox(intToBox(0, 0, 766, 506), 99), 0, 0);
- Wait(time);
- Reflect.Mouse.Move(MSX1, MSY1, MSX2, MSY2);
- End;
- Procedure MOffClient(time : Integer); overload;
- Begin
- Reflect.Mouse.Move(PntOutsideBox(intToBox(0, 0, 766, 506), 99), 0, 0);
- Wait(time);
- Reflect.Mouse.Move(MSX1, MSY1, MSX2, MSY2);
- End;
- Procedure AfterClick();
- Var
- msp : Integer;
- Begin
- msp := Reflect.mouseSpeed;
- Reflect.mouseSpeed := RandomRange(19, 25);
- Wait(Random(47, 93));
- Case Random(170) Of
- 0..7: Reflect.Antiban.SleepAndMoveMouse(RandomRange(200, 500));
- 8..29: Reflect.Antiban.pickUpMouse;
- 30..41: Reflect.Mouse.Move(105, 205, 430, 382);
- 42..48: Reflect.Mouse.Move(535, 206, 739, 465);
- End;
- Reflect.mouseSpeed := msp;
- End;
- function TReflectionTiles.RotateCameraToTile(Tile: TTile): Boolean; override;
- var
- Angle: Extended;
- Me: TPoint;
- begin
- Me:= Reflect.Tiles.GetGlobalTile;
- Angle:= (Degrees(ArcTan2(Tile.Y - Me.Y, Tile.X - Me.X))) - 90;
- Angle := Angle + RandomRange(-90, 90);
- if (Angle < 0) then
- Angle:= 360 + angle;
- Angle:= 360 - angle;
- Result:= Reflect.Compass.Make(angle);
- end;
- Procedure checkReport();
- Var
- widg : TReflectWidget;
- Begin
- If widg.isValid(553, 4) Then
- Begin
- Reflect.Mouse.Move(Point(485, 32), 5, 5, Mouse_Left);
- Wait(1000 + Random(500));
- End;
- widg.free;
- End;
- Procedure antiBanHandler();
- var
- i : integer;
- Begin
- i := Random(5263);
- Case i Of
- 0..9:
- Begin
- Reflect.Gametab.Open(Gametab_Stats);
- Reflect.Mouse.Move(Point(644, 222), 10, 5);
- Wait(randomRange(1425, 2124));
- Reflect.Gametab.Open(Gametab_Inventory);
- Wait(randomRange(140, 235));
- AfterClick();
- End;
- 7..12: Reflect.Antiban.SleepAndMoveMouse(RandomRange(124, 430));
- 11..15: Reflect.Antiban.pickUpMouse;
- 18..24: rotateRandom();
- 25..26: MOffClient();
- End;
- If i < 27 Then
- Begin
- inc(antibans);
- writeLn(toStr(antibans) + ' ' + toStr(i));
- End;
- End;
- Procedure WaitHandler();
- Var
- Break1, Break2, Break3, Break4 : Integer;
- Begin
- If WaitCoffee.elapsedTime > WaitCoffeeI Then
- Begin
- Break1 := (RandomRange(1, 5) * 60 * 1000) + Random(60000);
- WriteLn('Breaking for ' + Reflect.time.MsToTime(Break1, Time_Short));
- If Random(10) < 7 Then
- MOffClient(Break1) Else
- Wait(Break1);
- WaitCoffeeI := (RandomRange(11, 40) * 1000 * 60) + Random(60000);
- WaitCoffee.restart;
- End;
- If WaitFap.elapsedTime > WaitFapI Then
- Begin
- Break2 := (RandomRange(14, 26) * 60 * 1000) + Random(60000);
- WriteLn('Breaking for ' + Reflect.time.MsToTime(Break2, Time_Short));
- If Random(10) < 7 Then
- MOffClient(Break2) Else
- Wait(Break2);
- WaitFapI := (RandomRange(180, 800) * 1000 * 60) + Random(60000);
- WaitFap.restart;
- End;
- If WaitEat.elapsedTime > WaitEatI Then
- Begin
- Break3 := (RandomRange(12, 41) * 60 * 1000) + Random(60000);
- WriteLn('Breaking for ' + Reflect.time.MsToTime(Break3, Time_Short));
- If Random(10) < 7 Then
- MOffClient(Break3) Else
- Wait(Break3);
- WaitEatI := (RandomRange(218, 402) * 1000 * 60) + Random(60000);
- WaitEat.restart;
- End;
- If WaitSleep.elapsedTime > WaitSleepI Then
- Begin
- Break4 := (RandomRange(480, 642) * 60 * 1000) + Random(60000);
- WriteLn('Breaking for ' + Reflect.time.MsToTime(Break4, Time_Short));
- If Random(10) < 7 Then
- MOffClient(Break4) Else
- Wait(Break4);
- WaitSleepI := (RandomRange(680, 890) * 1000 * 60) + Random(60000);
- WaitSleep.restart;
- End;
- End;
- Procedure pickUpBones();
- Var
- i : integer;
- gItem : TReflectGroundItem;
- intArr : TIntegerArray;
- Begin
- For I := 0 To Random(Random(10)) Do
- Begin
- checkReport();
- If Reflect.Inv.count = 28 Then
- Exit();
- If Not(gItem.Find('Bones', 8)) Then
- Exit();
- If gItem.isOnMS Then
- Begin
- Reflect.Mouse.Move(gItem.getMSPoint, 5, 5);
- If Reflect.Text.IsUpText('Bones', Random(73, 128)) Then
- Begin
- Reflect.Mouse.Click(Mouse_Left);
- Wait(Random(400, 700));
- locPlayer.WaitWhileMoving(Random(100, 200), Random(4000, 5000));
- Wait(Random(400, 700));
- End Else
- If Not(Reflect.Text.isUpText('Walk here', RandomRange(73, 126))) And (Length(Reflect.Text.getUpText) > 0) Then
- Begin
- Reflect.Mouse.Click(Mouse_Right);
- Wait(Random(50, 100));
- Reflect.Text.ChooseOption('Take Bones', Random(200, 400));
- Wait(Random(400, 700));
- locPlayer.WaitWhileMoving(Random(100, 200), Random(4000, 5000));
- Wait(Random(400, 700));
- End;
- End;
- End;
- End;
- Procedure makePeaches();
- Var
- i, count, Pos : Integer;
- inv : TReflectInvItemArray;
- gItem : TReflectGroundItem;
- hasBones : Boolean;
- Begin
- if Not(LocPlayer.isloggedIn) Then
- Exit();
- inv.GetAll;
- For I := 0 To High(inv) Do
- If inv[i].getName = 'Peach' Then
- Exit();
- While Reflect.Inv.Count < 28 Do
- Begin
- checkReport();
- if Not(LocPlayer.isloggedIn) Then
- Exit();
- gItem.Find('Bones', 8);
- If gItem.isOnMS Then
- Begin
- Reflect.Mouse.Move(gItem.getMSPoint, 5, 5, Mouse_Left);
- Wait(Random(400, 700));
- locPlayer.WaitWhileMoving(Random(100, 200), Random(4000, 5000));
- Wait(Random(400, 700));
- End;
- End;
- inv.GetAll;
- For I := 0 To High(inv) Do
- Begin
- checkReport();
- If inv[i].getName = 'Bones' Then
- hasBones := True Else
- If inv[i].getName = 'Bones to peaches' Then
- pos := i;
- End;
- If hasBones Then
- Begin
- Reflect.Mouse.Move(inv[pos].getMSPoint, 5, 5, Mouse_Left);
- Wait(Random(2300, 3000));
- End Else
- Terminate('Ran out of B2P. Ran: ' + toStr(runTime.elapsedTime));
- End;
- Procedure checkHP();
- Label
- retry;
- Label
- redo;
- Var
- Inv : TReflectInvItemArray;
- I, x, y, tries : Integer;
- TPA : TPointArray;
- Begin
- if Not(LocPlayer.isloggedIn) Then
- Exit();
- redo:
- If (locPlayer.GetHealth < Heal) And Not(FindColor(x, y, 65280, 524, 55, 540, 68)) Then
- Begin
- checkReport();
- inv.GetAll();
- For I := 0 To High(inv) Do
- If inv[i].getName = 'Peach' Then
- Begin
- setLength(TPA, Length(TPA) + 1);
- TPA[High(TPA)] := inv[i].getMSPoint;
- End;
- If Length(TPA) = 0 Then
- Begin
- makePeaches();
- goto redo;
- End;
- I := Random(Random(Random(Random(Length(TPA)))));
- retry:
- inc(tries);
- if tries > 5 then
- Begin
- makePeaches();
- exit();
- End;
- Reflect.Mouse.Move(TPA[i], 5, 5);
- If Reflect.Text.IsUpText('Peach', RandomRange(182, 293)) Then
- Reflect.Mouse.Click(Mouse_Left) Else goto retry;
- If Random(252) < 100 Then
- Reflect.Antiban.SleepAndMoveMouse(RandomRange(200, 500));
- Wait(RandomRange(164, 293));
- End;
- End;
- Function filterPoint(Pnt : TPoint; TPA : TPointArray) : TPointArray;
- var
- i : integer;
- Begin
- for i := 0 to High(TPA) do
- If not((TPA[i].x = Pnt.x) and (TPA[i].y = Pnt.y)) Then
- Begin
- setLength(result, length(result) + 1);
- result[high(result)] := TPA[i];
- End;
- End;
- Function mouseUpText(Pnt : TPoint; upText : String; maxWait : Integer) : Boolean;
- Var
- Timer : TReflectTimer;
- Begin
- result := true;
- Reflect.Mouse.Move(Pnt, 5, 5);
- If Reflect.Text.IsUpText(upText, maxWait) Then
- Reflect.Mouse.Click(Mouse_Left) Else
- result := false;
- End;
- Function goBackIn() : boolean;
- Label
- retry;
- Var //Laga checker om man är upstairs eller ute eller i hemliga underjordiska rummet.
- inv : TReflectInvItemArray;
- str, Action : String;
- i, tries : integer;
- Pnt, PntEx, PntExt, Pnt1, Pnt2, Pnt3 : TPoint;
- SecretRoom : TPointArray;
- Begin
- checkReport();
- Wait(RandomRange(5000, 7000));
- if Not(LocPlayer.isloggedIn) Then
- Exit();
- SecretRoom := [Point(3016, 3517), Point(3016, 3518), Point(3015, 3517), Point(3015, 3518)];
- Wait(RandomRange(200, 700));
- If Reflect.tiles.GetPlane > 0 Then
- Begin
- Str := 'upstairs';
- Action := 'Climb-down';
- End Else
- If PointInTPA(Reflect.tiles.getGlobalTile, SecretRoom) Then
- Begin
- Str := 'secret';
- Action := 'Push';
- End Else
- Begin
- Str := 'outside';
- Action := 'Open';
- End;
- Case Str Of
- 'outside':
- Begin
- PntEx := Reflect.Tiles.TileToMS(Point(3016, 3514));
- PntExt := Reflect.Tiles.TileToMS(Point(3016, 3515));
- Pnt := Point(Round((PntEx.x+PntExt.x)/2), Round((PntEx.Y+PntExt.Y)/2));
- End;
- 'upstairs': Pnt := Reflect.Tiles.tileToMS(Point(3011, 3515));
- 'secret':
- Begin
- PntEx := Reflect.Tiles.TileToMS(Point(3016, 3517));
- PntExt := Reflect.Tiles.TileToMS(Point(3016, 3516));
- Pnt := Point(Round((PntEx.x+PntExt.x)/2), Round((PntEx.Y+PntExt.Y)/2));
- End;
- End;
- If not(PointInBox(Pnt, IntToBox(msx1, msy1, msx2, msy2))) Then
- exit();
- If Str = 'outside' Then
- Begin
- Inv.GetAll;
- For I := 0 To High(inv) Do
- Case inv[i].getName Of
- 'Bronze med helm':
- Begin
- Pnt1 := inv[i].getMSPoint;
- Reflect.Mouse.Move(Pnt1, 5, 5, Mouse_Left);
- Wait(RandomRange(500, 700));
- End;
- 'Iron chainbody':
- Begin
- Pnt2 := inv[i].getMSPoint;
- Reflect.Mouse.Move(Pnt2, 5, 5, Mouse_Left);
- Wait(RandomRange(500, 700));
- End;
- 'Bronze sq shield':
- Begin
- Pnt3 := inv[i].getMSPoint;
- Reflect.Mouse.Move(Pnt3, 5, 5, Mouse_Left);
- Wait(RandomRange(500, 700));
- End;
- End;
- retry:
- inc(tries);
- If tries > 5 Then
- Exit(false);
- Wait(RandomRange(200, 300));
- End;
- Case str Of
- 'outside': If Not(mouseUpText(Pnt, Action, Random(400, 700))) Then
- Begin
- Reflect.Mouse.click(Mouse_Right);
- If not(Reflect.Text.ChooseOption(Action, Random(400, 700))) Then
- goto retry;
- End;
- 'upstairs': If Not(mouseUpText(Pnt, Action, Random(400, 700))) Then
- Begin
- Reflect.Mouse.click(Mouse_Right);
- If not(Reflect.Text.ChooseOption(Action, Random(400, 700))) Then
- goto retry;
- End;
- 'secret': If Not(mouseUpText(Pnt, Action, Random(400, 700))) Then
- Begin
- Reflect.Mouse.click(Mouse_Right);
- If not(Reflect.Text.ChooseOption(Action, Random(400, 700))) Then
- goto retry;
- End;
- End;
- Wait(RandomRange(4000, 6000));
- If not(PointInTPA(Reflect.tiles.getGlobalTile, Tiles)) Then
- Exit(False);
- If Str = 'outside' Then
- Begin
- Reflect.Mouse.Move(Pnt1, 5, 5, Mouse_Left);
- Wait(RandomRange(400, 700));
- Reflect.Mouse.Move(Pnt2, 5, 5, Mouse_Left);
- Wait(RandomRange(400, 700));
- Reflect.Mouse.Move(Pnt3, 5, 5, Mouse_Left);
- Wait(RandomRange(400, 700));
- End;
- Exit(True);
- End;
- Procedure WhileFighting();
- Var
- NPC : TReflectNPC;
- Timer : TReflectTimer;
- Begin
- if Not(LocPlayer.isloggedIn) Then
- Exit();
- Timer.Start;
- Repeat
- checkReport();
- If Timer.ElapsedTime > RandomRange(3200, 4500) Then
- Exit();
- Wait(100 + Random(92));
- Until LocPlayer.IsUnderAttack Or LocPlayer.IsAnimating Or LocPlayer.isMoving;
- Timer.Restart;
- Repeat
- checkReport();
- If Timer.ElapsedTime > RandomRange(5200, 6500) Then
- Exit();
- Wait(100 + Random(92));
- Until Not(LocPlayer.isMoving);
- Wait(2600 + Random(960));
- LocPlayer.GetInteractingNpc(NPC);
- While NPC.GetHealth > 0 Do
- Begin
- checkReport();
- if Not(LocPlayer.isloggedIn) Then
- Exit();
- checkHP();
- Tile := NPC.getTile;
- Wait(300 + Random(200));
- antiBanHandler();
- End;
- Wait(randomRange(50, 200));
- End;
- Procedure Attack();
- Label
- redo;
- Var
- x, y, i : integer;
- Knights : TReflectNPCArray;
- TPA : TPointArray;
- Pnt : TPoint;
- Begin
- if Not(LocPlayer.isloggedIn) Then
- Exit();
- redo:
- Wait(Random(36, 100));
- Knights.GetAll;
- For I := 0 To High(Knights) Do
- If PointInTPA(Knights[i].getTile, Tiles) And (Knights[i].getName = 'Fortress Guard') And Knights[i].isOnMs And Not(Knights[i].isUnderAttack) Then
- Begin
- SetLength(TPA, Length(TPA) + 1);
- TPA[High(TPA)] := Knights[I].GetTile;
- End;
- TPA := filterPoint(Tile, TPA);
- If Length(TPA) = 0 Then
- Begin
- Case Random(30) Of
- 0..2: Reflect.Tiles.RotateCameraToTile(midTiles[Random(Length(midTiles))]);
- 3..5: LocPlayer.WalkToTileMS(midTiles[Random(Length(midTiles))]);
- End;
- Exit();
- End;
- SortTPAFrom(TPA, LocPlayer.GetTile);
- Pnt := Reflect.Tiles.TileToMS(TPA[Reflect.Math.GaussRandom(Length(TPA))]);
- If Not(PointInBox(Pnt, intToBox(4, 6, 515, 336))) Then
- Exit();
- Reflect.Mouse.Move(Pnt, 5, 5);
- If Reflect.Text.IsUpText('Fortress Guard', RandomRange(73, 126)) Then
- Begin
- If Random(19) > 1 Then
- Begin
- If Reflect.Mouse.DidClick(True, RandomRange(956, 1472)) Then
- Begin
- afterClick;
- WhileFighting;
- Exit();
- End Else goto redo;
- End Else
- Begin
- Reflect.Mouse.Click(Mouse_Right);
- Wait(randomRange(50, 90));
- If Random(32) > 0 Then
- Begin
- If Reflect.Text.ChooseOption('Attack Fortress Guard') Then
- Begin
- afterClick;
- WhileFighting;
- Exit();
- End;
- End Else
- If Reflect.Text.ChooseOption('Talk-to') Then goto redo;
- End;
- End Else
- If (Not(Reflect.Text.isUpText('Walk here', RandomRange(173, 226)))) And (Length(Reflect.Text.getUpText) > 0) And (Not(Reflect.Text.IsUpText('Take', Random(73, 126)))) Then
- Begin
- Reflect.Mouse.Click(Mouse_Right);
- Wait(randomRange(50, 90));
- If Random(32) > 0 Then
- Begin
- If Reflect.Text.ChooseOption('Attack Fortress Guard') Then
- Begin
- afterClick;
- WhileFighting;
- Exit();
- End;
- End Else
- If Reflect.Text.ChooseOption('Talk-to') Then goto redo;
- End Else Exit();
- End;
- Procedure LogicHandler();
- Begin
- Reflect.Gametab.Open(Gametab_Inventory);
- checkHP();
- checkReport();
- Wait(Random(50, 200));
- If Not(PointInTPA(Reflect.tiles.getGlobalTile, Tiles)) Or (Reflect.Tiles.getPlane > 0) Then
- If Not(GoBackIn()) Then
- Terminate('Somehow got lost, terminating. Ran: ' + Reflect.Time.MsToTime(runTime.elapsedTime, Time_Formal));
- checkReport();
- Wait(Random(40, 80));
- antiBanHandler();
- wait(Random(40, 80));
- Attack();
- Wait(Random(50, 100));
- checkReport();
- {If Random(4) = 0 Then
- PickupBones();}
- Wait(Random(50, 100));
- End;
- Begin
- Reflect.Setup;
- SetVars();
- Reflect.Smart.Graphics.clear;
- Reflect.MouseSpeed := RandomRange(58, 72);
- LocPlayer.Create;
- LocPlayer.Active := True;
- runTime.start;
- While locPlayer.Active Do
- Begin
- antiBanHandler;
- waitHandler();
- Wait(Random(50, 100));
- LocPlayer.Login;
- LogicHandler();
- Paint();
- Wait(RandomRange(100, 150));
- End;
- End.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement