Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Program ClutchFireRunes;
- {$DEFINE SMART}
- {$i AeroLib/AeroLib.Simba}
- {$i Reflection/Reflection.Simba}
- const
- USERNAME = '';
- PASSWORD = '';
- PIN = '';
- DEBUG = '0';
- const
- scriptVersion = '1.0';
- var
- myPlayer: TReflectLocalPlayer;
- invItem: TReflectInvItem;
- StartingRunecraftingXP, startingRunes, ring: Integer;
- InGameTimer: TReflectTimer;
- {PROCEDURE -- ClutchDebug
- Purpose: Custom console debugging procedure.
- Comments: By Clarity.}
- procedure ClutchDebug(message: string);
- begin
- if DEBUG = '1' then
- writeln('ClutchFireRunes v' + scriptVersion + ' || ' + Reflect.Time.MsToTime((InGameTimer.ElapsedTime()), 3) + ' || ' + message)
- else
- exit;
- end;
- Procedure ClutchReport;
- var
- RunecraftingXP: Integer;
- XPGained: Integer;
- Rune: TReflectInvItem;
- begin
- if DEBUG = '1' then
- begin
- exit;
- end
- else
- XPGained := MyPlayer.GetSkillExp(Skill_Runecrafting) - StartingRunecraftingXP;
- clearDebug;
- writeln('ClutchFireRunes v' + scriptVersion + ' || ' + Reflect.Time.MsToTime((InGameTimer.ElapsedTime()), 3) + ' || ' + 'Please leave enhancement requests, complaints, and progress reports on the forums!');
- writeln('XP Gained: ' + ToStr(XPGained));
- writeln('XP per hour: ' + ToStr(XPGained / (InGameTimer.ElapsedTime() / 3600000)));
- writeln('Rings used: ' + ToStr(ring));
- writeln('Rings used per hour: ' + ToStr(ring / (InGameTimer.ElapsedTime() / 3600000)));
- end;
- function R_TileOnMS(Tile : TPoint; var OutputPoint : TPoint; x : integer = 0; y : integer = 0; z : integer = 0):boolean;
- var
- tempB : TBox;
- begin
- OutputPoint := TReflectionTiles.TileToMS(Tile, x, y, z);
- tempB := intToBox(MSX1, MSY1, MSX2, MSY2);
- result := PointInBox(OutputPoint, tempB);
- end;
- procedure randomMouseInput(pnt:Tpoint; ranx, rany:integer);
- begin
- case random(3) of
- 0:humanMMouse(pnt, ranx, rany);
- 1:missMouse(pnt, ranx, rany);
- 2:mouse(pnt, ranx, rany, mouse_move);
- end;
- end;
- function R_InteractTile(tile:Tpoint; action:string; x:integer = 0; y:integer = 0; z:integer = 0):boolean;
- var
- RSTile : TPoint;
- begin
- if R_TileOnMS(Tile, RSTile, x, y, z) then begin
- randomMouseInput(rsTile, 3, 3);
- if(Reflect.Text.IsUpText(action)) then
- begin
- FastClick(mouse_left);
- result := didClick(true, 1000);
- end
- else
- begin
- if TReflectionText.optionExists(action) then
- begin
- FastClick(mouse_right);
- result := Reflect.Text.chooseOption(action);
- end;
- if not result then
- randomMouseInput(Point(MSCX, MSCY), 500, 500);
- end;
- end;
- end;
- Procedure getTile;
- var
- ourTile : TPoint;
- begin
- ourTile := Reflect.Tiles.getGlobalTile;
- clutchDebug('Point('+ IntToStr(OurTile.x) + ',' + IntToStr(OurTile.y) +')');
- end;
- Function R_Click(textstr : string): boolean;
- begin
- FastClick(Mouse_Right);
- if ChooseOption(textstr) then
- begin
- FFlag(0);
- result := true;
- end else
- result := false;
- end;
- function dismissAllRandoms : boolean;
- var
- i, j, me_indice:integer;
- _npcs:TReflectNPCArray;
- randoms:tstringarray;
- begin
- randoms := ['dunce', 'molly', 'niles', 'miles', 'giles', 'sandwich lady','drunken dwarf',
- 'highwayman', 'dr jekyll', 'cap''n hand', 'security guard', 'rick turpentine',
- 'mysterious old man', 'frog', 'null', 'mime', 'sergeant damien', 'freaky forester',
- 'strange plant', 'postie pete', 'tilt', 'flippa', 'leo', 'pillory guard', 'evil bob'];
- _npcs.GetAll;
- me_indice := TReflectLocalPlayer.GetPlayerIndex;
- for i:=0 to high(_npcs) do begin
- if (_npcs[i].getInteractingIndex = me_indice) then begin
- for j:=0 to high(randoms) do begin
- if (pos(randoms[j], lowercase(_npcs[i].getName)) > 0) then begin
- if R_InteractTile(_npcs[i].getTile, 'Dismiss', 0, 0, 50) then begin
- FFlag(0);
- sleep(500+random(2000));
- clutchDebug('Dismissed random: '+_npcs[i].getname+' Time Running: '+TimeRunning);
- result := True;
- end;
- end;
- end;
- end;
- end;
- end;
- procedure AntiBanned;
- begin
- Reflect.Logger.Debug('Starting Antiban');
- case Random(8000) of
- 1: Reflect.Antiban.SleepAndMoveMouse(RandomRange(500, 2500));
- 2: Reflect.Antiban.RandomMovement();
- 3: Reflect.Antiban.CompassMovement(0, 360, False);
- 4: Reflect.Antiban.BoredHuman();
- 5: Wait(RandomRange(500, 5000));
- 6: Reflect.Antiban.ExamineInv();
- 7: Reflect.Antiban.PickUpMouse();
- 8: Reflect.Antiban.SleepAndMoveMouse(5000);
- end;
- end;
- Procedure waitShort;
- begin
- wait(randomRange(100, 600));
- end;
- Procedure waitLong;
- begin
- wait(randomRange(900,1200));
- end;
- Function waitMove(c: Integer): boolean;
- var
- d : integer;
- Begin
- clutchDebug('Player is busy');
- antiBanned;
- random(4000);
- dismissAllRandoms;
- FFlag(0);
- (d = (c/5));
- wait(c+random(d));
- while myPlayer.IsAnimating or myPlayer.IsMoving do
- wait(c-random(d));
- end;
- procedure TryLogin();
- var
- Timer: TReflectTimer;
- RandomTime: Integer;
- begin
- Timer.Restart();
- Reflect.Logger.Status('Trying to login');
- RandomTime := RandomRange(120000, 150000);
- while (not MyPlayer.IsLoggedIn()) do
- begin
- MyPlayer.Login();
- MyPlayer.Active := True;
- waitLong;
- if (Timer.ElapsedTime() > RandomTime) then
- begin
- Reflect.Logger.Fatal('Unable to Login');
- terminateScript();
- end
- end
- MyPlayer.Create();
- end;
- Procedure teleArena;
- begin
- if myPlayer.isAnimating then
- exit;
- if itemInSlot(2) then
- begin
- interactSlot(2, mouse_right);
- Reflect.Text.ChooseOption('Rub');
- waitLong;
- sendKeys('1', 60, 0);
- waitLong;
- end
- else
- begin
- if getCurrentTab():=4 then
- begin
- typeByte(VK_F4);
- end
- begin
- TReflectionMouse.Move(700, 370, 710, 390, mouse_right);
- Reflect.Text.ChooseOption('Duel Arena');
- clutchDebug('teleported to Castle Wars');
- waitLong;
- if getCurrentTab():=5 then
- typeByte(VK_ESCAPE);
- end;
- end;
- antiBanned();
- end;
- Procedure teleCW;
- begin
- if myPlayer.isAnimating then
- exit;
- if itemInSlot(2) then
- begin
- interactSlot(2, mouse_right);
- Reflect.Text.ChooseOption('Rub');
- waitLong;
- sendKeys('2', 60, 0);
- waitLong;
- end
- else
- begin
- if getCurrentTab():=4 then
- begin
- typeByte(VK_F4);
- end
- begin
- TReflectionMouse.Move(700, 370, 710, 390, mouse_right);
- Reflect.Text.ChooseOption('Castle Wars');
- clutchDebug('teleported to Castle Wars');
- waitLong;
- if getCurrentTab():=5 then
- typeByte(VK_ESCAPE);
- end;
- end;
- end;
- Function OpenBank :boolean;
- var
- Bank: TReflectObject;
- begin
- clutchDebug('Opening Bank');
- waitMove(300);
- if TReflectionBank.IsOpen then
- begin
- exit;
- end;
- FFlag(0);
- if Bank.Find(objGame, 'Bank chest', 5) then
- begin
- Reflect.Mouse.Move(Bank.GetMSPoint, 5, 5);
- waitShort;
- R_Click('Use Bank chest');
- FFlag(0);
- end;
- end;
- procedure WithdrawItems(item: String; amount: Integer; Result: Boolean);
- var
- iitem: TReflectBankItem;
- begin
- if iitem.Find(item) then
- begin
- waitMove(250);
- iitem.Withdraw(amount);
- waitLong;
- result := true;
- end
- else if not invItem.Find(item) then
- begin
- logoutPlayer;
- terminatescript;
- result := false;
- end;
- end;
- function withDraw: Boolean;
- begin
- clutchDebug('Withdrawing Items');
- if invItem.Find('Ring of dueling(1)') then
- depositItem(2,1,100);
- if not itemInSlot(2) then
- begin
- clutchDebug('Withdrawing new ring');
- WithdrawItems('Ring of dueling(8)', 1, true);
- inc(ring);
- end;
- if not invitem.Find('Pure essence') then
- WithdrawItems('Pure essence', 28, true);
- Reflect.Bank.Close;
- teleArena;
- end;
- Function cRuins(C: Integer): boolean;
- begin
- if Reflect.Tiles.DistanceFromTile(Point(3309,3251)) < C then
- begin
- if myPlayer.IsAnimating or myPlayer.IsMoving then
- begin
- exit;
- end;
- if R_InteractTile(Point(3312+RandomRange(0,2),3254+RandomRange(0,2)), 'Mysterious ruins', 1, 1, C) then
- begin
- clutchDebug('Clicking Ruins');
- waitLong;
- result := true;
- end;
- end;
- waitLong;
- end;
- Function cAltar(C: Integer): boolean;
- begin
- if Reflect.Tiles.DistanceFromTile(Point(2585,4838)) < C then
- begin
- if myPlayer.IsAnimating or myPlayer.IsMoving then
- begin
- exit;
- end;
- if not TReflectionInventory.isFull() then
- begin
- teleCW;
- exit;
- end;
- if R_InteractTile(Point(2585+RandomRange(0,2),4838+RandomRange(0,2)), 'Craft-rune Altar', 1, 1, C) then
- begin
- clutchDebug('Crafting runes');
- waitLong;
- result := true;
- end;
- end;
- end;
- Procedure WalkBank;
- begin
- if myPlayer.IsAnimating or myPlayer.IsMoving then
- begin
- exit;
- end;
- if(getRunEnergy >= (40 +random(40))) and not isUsingRun then
- begin
- toggleRunning(true);
- end;
- if Reflect.Tiles.DistanceFromTile(Point(2444,3083)) > 15 then
- begin
- exit;
- end;
- if Reflect.Tiles.DistanceFromTile(Point(2444,3083)) > 3 then
- begin
- myPlayer.BlindWalkMM (Point(2444+RandomRange(0, 2),3083+RandomRange(0, 2)),2);
- clutchDebug('Walking to Bank');
- waitShort;
- end;
- end;
- Procedure WalkAltar;
- begin
- if myPlayer.IsAnimating or myPlayer.IsMoving then
- begin
- exit;
- end;
- if(getRunEnergy >= (40 +random(40))) and not isUsingRun then
- begin
- toggleRunning(true);
- end;
- if Reflect.Tiles.DistanceFromTile(Point(2584,4840)) > 20 then
- begin
- exit;
- end;
- if Reflect.Tiles.DistanceFromTile(Point(2584,4840)) > 5 then
- begin
- myPlayer.BlindWalkMM (Point(2584+RandomRange(0, 2),4840+RandomRange(0, 2)),2);
- clutchDebug('Walking to Altar');
- waitShort;
- end;
- end;
- Procedure WalkRuins;
- begin
- if myPlayer.IsAnimating or myPlayer.IsMoving then
- begin
- exit;
- end;
- if(getRunEnergy >= (40 +random(40))) and not isUsingRun then
- begin
- toggleRunning(true);
- end;
- if Reflect.Tiles.DistanceFromTile(Point(3311,3253)) > 30 then
- begin
- exit;
- end;
- if Reflect.Tiles.DistanceFromTile(Point(3311,3253)) > 5 then
- begin
- myPlayer.BlindWalkMM (Point(3311+RandomRange(0, 1),3253+RandomRange(0, 1)),2);
- clutchDebug('Walking to Ruins');
- waitShort;
- end;
- end;
- Procedure mainLoop;
- begin
- if myPlayer.isMoving or myPlayer.isAnimating then
- waitMove(60)
- else if TReflectionBank.isOpen then
- withdraw
- else if Reflect.Tiles.DistanceFromTile(Point(2444,3083)) < 3 then
- openBank
- else if Reflect.Tiles.DistanceFromTile(Point(3311,3253)) < 5 then
- cRuins(15)
- else if Reflect.Tiles.DistanceFromTile(Point(2584,4840)) < 5 then
- cAltar(15)
- else if not invItem.Find('Pure essence') then
- walkBank
- else if Reflect.Tiles.DistanceFromTile(Point(3312,3252)) < 30 and TReflectionInventory.IsFull() then
- walkRuins
- else if Reflect.Tiles.DistanceFromTile(Point(2584,4840)) < 30 and TReflectionInventory.IsFull() then
- walkAltar;
- end;
- begin
- initAL;
- Reflect.Setup;
- myPlayer.Username := USERNAME;
- myPlayer.Password := PASSWORD;
- myPlayer.Pin := PIN;
- myPlayer.Active := True;
- SMART_ShowConsole := false;
- tryLogin();
- setCompass('Random');
- setAngle(ANGLE_HIGH);
- StartingRunecraftingXP := myPlayer.GetSkillExp(SKILL_RUNECRAFTING);
- InGameTimer.Start();
- begin
- repeat
- mainLoop;
- ClutchReport;
- until (false);
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement