Fitta
2015-01-19 15:53:05
If it breaks just PM me, usually I already got a fix.
Range tanks the wyverns using food of your choice.
Features
http://2007.runescape.wikia.com/wiki/Skeletal_Wyvern/Strategies

Range tanks the wyverns using food of your choice.
Features
- Randomized walking
- Creates distance if too close
- Picks up all possible drops
- Banks(duh)
- Start at clan wars bank chest
- Have ring of duelling, house tab and food visable in bank
- Have your house located in rimmington
- Make sure you have enough bolts on you
http://2007.runescape.wikia.com/wiki/Skeletal_Wyvern/Strategies

program Wyverns;
{$DEFINE SMART} {Defining SMART, as we are using reflection we need SMART}
{$i AeroLib/AeroLib.Simba} {Defining AeroLib}
{$i AeroLib/Reflection/Reflection.simba} {Defining AeroLib}
Const
{- - - - - - - - - - - - - - - Login information - - - - - - - - - - - - - - - -}
Loginname = ''; {Login name, will determine Me.Name in setupVars}
Password = ''; {Password, will determine Me.Pass in setupVars}
Pin = ''; {BankPin, will determine Me.Pin in setupVars}
{- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -}
{- - - - - - - - - - - - - - - Bank information - - - - - - - - - - - - - - - - }
Bank_Spot_Food = 1; {Where is food located in bank?}
Bank_Spot_Rings = 2; {Where is ring of dueling located in bank?}
Bank_Spot_Teletabs = 3; {Where is food teletabs in bank?}
{- - - - - - - - - - - - - - - General settings - - - - - - - - - - - - - - - -}
FoodID = 7946; {Food ID?}
FoodAmount = 21; {Amount of food to withdraw from the bank?}
RandomFood = 0; {Randomness added to the FoodAmount (17+Random(4) in this case)}
FoodName = 'Monkfish'; {Full name of food, case sensetive!}
EatAtHP = 50;
RandomHP = 20;
AmmoID = 0;
WorldInt = 312; {World you'd wish to begin in?}
SkipBreaks = False; {Skip taking breaks?}
{- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -}
{
The type "Me" has three handy variables
Integer
Boolean
String
The constants helps me keep track of what where in the arrays
storing what.
Example
Me.Integers[Int_StartSkill] = Starting XP in range in this case.
Me.Integers[Int_CurSkill] = Current XP in range.
Me.Bool[Bool_NewRing] = Should we equip a new ring?
}
Int_StartSkill = 0;
Int_CurSkill = 1;
Int_StartHP = 2;
Int_CurHP = 3;
Int_Breaks = 4;
Int_Trips = 5;
Int_EatAt = 6;
Bool_NewRing = 0;
Bool_OutOfFood = 1;
ID_DuelRing = 2552;
ID_TeleportTAB = 8013;
ID_SteelArrow = 886;
ID_wyvernBones = 6812;
var
Failed: Boolean;
BreakList, DropsCount: TIntegerArray;
Limit, DoneRound, CurIndex: Integer;
locPlayer: TReflectLocalPlayer;
ProgressTimer: Timer;
Areas: TBoxArray;
Solutions: TPointArray;
Drops: TStringArray;
procedure Debug_screen(log: string);
begin
if (not directoryExists(ScriptPath + 'debug\')) then
forceDirectories(ScriptPath + 'debug\');
try
saveScreenshot(ScriptPath + 'debug\' + theDate(DATE_FORMAL) + ', ' + log + '.png');
except
Writeln('Failed to save screenshot of: ' + log);
end;
end;
Procedure Debug(Comment: String; Error: Boolean);
var
S: String;
begin
Failed := Error;
If Error then
begin
Debug_screen(Comment);
S := '[ERROR] ';
end else
S := '[' + msToTime(GetTimeRunning, TIME_SHORT) + '] ';
Writeln(S + Comment);
end;
Procedure BreakSetup;
var
I: Integer;
S: String;
begin
BreakList := [3+Random(7), 2+Random(7), 1+Random(7), 1+Random(7), 1+Random(7), 1+Random(7)];
For I:=0 to High(BreakList)do
begin
S := S + ToStr(BreakList[I]) + ' > ';
IncEx(Limit, BreakList[I]);
end;
S := S + 'End of script';
Debug('Total for this run is ' + ToStr(Limit), False);
Debug('BreakList: ' + S, False);
end;
Procedure setupVars;
begin
SetLength(Me.Integers, 100);
SetLength(Me.Strings, 100);
SetLength(Me.Booleans, 100);
Me.Name := Loginname;
Me.Pass := Password;
Me.Pin := Pin;
Me.Active := True;
Me.Integers[Int_EatAt] := EatAtHP+Random(RandomHP);
Drops := ['Wyvern bones',
'Rune axe',
'Rune battleaxe',
'Earth battlestaff',
'Rune warhammer',
'Rune kiteshield',
'Rune full helm',
'Dragon platelegs',
'Dragon plateskirt',
'Granite legs',
'Soul rune',
'Blood rune',
'Pure essence',
'Death rune',
'Law rune',
'Chaos rune',
'Adamant bolts',
'Runite bolts',
'Rune arrow',
'Ranarr seed',
'Snapdragon seed',
'Magic logs',
'Adamantite bar',
'Prayer potion(4)',
'Battlestaff',
'Lobster',
'Unpowered orb',
'Iron ore',
'Uncut ruby',
'Uncut diamond',
'Runite crossbow (u)',
'Clue scroll(elite)',
'Draconic visage',
'Nature rune',
'Tooth half of key',
'Loop half of key',
'Runite bar',
'Rune spear',
'Rune 2h sword',
'Rune sq shield',
'Rune arrow',
'Dragonstone',
'Dragon med helm',
'Dragon spear',
'Shield left half'];
SetLength(DropsCount, Length(Drops));
Areas := [IntToBox(3024, 9551, 3039, 9558),
IntToBox(3029, 9548, 3036, 9550),
IntToBox(3024, 9547, 3033, 9542),
IntToBox(3035, 9538, 3040, 9548),
IntToBox(3041, 9539, 3047, 9549),
IntToBox(3048, 9542, 3053, 9549),
IntToBox(3054, 9538, 3061, 9545),
IntToBox(3043, 9550, 3057, 9558),
IntToBox(3062, 9538, 3069, 9545),
IntToBox(3058, 9546, 3069, 9558)];
Solutions := [Point(3031, 9543),
Point(3031, 9541),
Point(3031, 9555),
Point(3048, 9545),
Point(3052, 9546),
Point(3041, 9545),
Point(3048, 9546),
Point(3050, 9543),
Point(3053, 9543),
Point(3066, 9540)];
end;
function TReflectionTiles.TileOnMS(Tile: TPoint): Boolean;
var
Point: TPoint;
begin
Point := Reflect.Tiles.TileToMS(Tile);
Result := PointInBox(Point, intToBox(MSX1, MSY1, MSX2, MSY2));
end;
function containsIDs(IDs: TIntegerArray): boolean;
var
I: Integer;
RItems: TReflectInvItemArray;
begin
Result := False;
RItems.GetAll;
for I := 0 to High(RItems) do
if InIntArray(IDs, RItems[I].ID) then
Exit(True);
end;
function perHour(I: Integer): integer;
begin
Result := Round((3600*(I))/(GetTimeRunning/1000));
end;
Procedure getStats;
begin
If Not isLoggedIn then
Exit;
If Me.Integers[Int_StartSkill] = 0 then
begin
Me.Integers[Int_StartSkill] := locPlayer.GetSkillExp(SKILL_RANGE);
Me.Integers[Int_StartHP] := locPlayer.GetSkillExp(SKILL_HITPOINTS);
end else
begin
Me.Integers[Int_CurSkill] := locPlayer.GetSkillExp(SKILL_RANGE);
Me.Integers[Int_CurHP] := locPlayer.GetSkillExp(SKILL_HITPOINTS);
end;
end;
function TillLevel(CurrentXP: Integer): Integer;
begin
Result := ConvertLvlToXP(ConvertXpToLvl(CurrentXP))-CurrentXP;
end;
procedure randomCompass;
var
Keys: TIntegerArray;
I: Integer;
begin
If (Not isLoggedIn)or(Failed)then
Exit;
Keys := [VK_RIGHT, VK_LEFT];
I := Random(2);
Wait(100 + random(50));
KeyDown(Keys[I]);
Wait(500 + random(1000));
KeyUp(Keys[I]);
Wait(200 + random(350));
end;
procedure dropTable;
var
Graphic: TGraphics;
S: TStringArray;
BreakString, ZapperString: String;
I, ind: Integer;
begin
SetLength(S, Length(Drops));
For I:=0 to High(S)do
if DropsCount[I] > -1 then
begin
S[I] := Drops[I] + ': ' + ToStr(DropsCount[I]);
ind := ind + 1;
end;
graphic := OS_Smart.Graphics;
graphic.clearArea(MCX1, MCY1, MCX2, MCY2);
Graphic.DrawBox(MCX1, MCY1, MCX2, MCY2, True, 3818059);
For I:=0 to High(S) do
Graphic.DrawClippedText(S[I], 'StatChars', Point(9+((I div 13)*120), 344+((I mod 13)*10)), clYellow);
Graphic.DrawClippedText('Made by', 'BigChars', Point(370, 418), clYellow);
Graphic.DrawClippedText('Fitta', 'BigChars', Point(415, 445), clYellow);
end;
Procedure Progress;
var
Graphic: TGraphics;
S: TStringArray;
BreakString, ZapperString: String;
I: Integer;
begin
If (ProgressTimer.timeElapsed < 10000) then
Exit;
getStats;
If SkipBreaks then
BreakString := 'Breaks disabled'
else
BreakString := 'Next break in ' + ToStr(BreakList[Me.Integers[Int_Breaks]] - DoneRound) + ' trips';
S := ['Time running: ' + msToTime(GetTimeRunning, TIME_SHORT),
'Entered wyverns cave ' + ToStr(Me.Integers[Int_Trips]) + ' time(s)',
'Total breaks made: ' + ToStr(Me.Integers[Int_Breaks]),
BreakString,
'',
'XP: ' + ToStr(Me.Integers[Int_CurSkill]-Me.Integers[Int_StartSkill]) + ' - p/h: ' + ToStr(perHour(Me.Integers[Int_CurSkill]-Me.Integers[Int_StartSkill])),
'HP XP: ' + ToStr(Me.Integers[Int_CurHP]-Me.Integers[Int_StartHP]) + ' - p/h: ' + ToStr(perHour(Me.Integers[Int_CurHP]-Me.Integers[Int_StartHP])),
'',
'Till Level: ' + ToStr(TillLevel(Me.Integers[Int_CurSkill])),
'Till HP Level: ' + ToStr(TillLevel(Me.Integers[Int_CurHP]))];
graphic := OS_Smart.Graphics;
graphic.clearArea(0, 0, 230, 250);
For I:=0 to High(S) do
Graphic.DrawClippedText(S[I], 'UpChars07', Point(10, 100+(I*14)), clYellow);
ProgressTimer.start;
end;
procedure mouseHandle(B: TBox; mouse_type: Integer);
begin
If Not mouseInBox(B)then
MouseBox(B, mouse_Type)
else
if Random(2) = 0 then
fastClick(mouse_Type)
else
MouseBox(B, mouse_Type);
end;
procedure handle_Run;
begin
if locPlayer.GetRunEnergy > 10 then
toggleRunning(True);
end;
{Simulates a mixture of clicking a tab and using the F keys}
function Tab(i: integer): boolean;
begin
If (Not isLoggedIn)or(Failed) then
Exit;
Case Random(8)of
0: Result := FTab(I);
1..7: Result := gameTab(I);
end;
end;
{Checks if mouse on screen}
function MouseOnScreen: boolean;
begin
Result := PointInBox(getMousePnt, IntToBox(0, 0, 760, 500));
end;
{Mouse off screen, if not already}
procedure mouseOffScreen;
begin
If MouseOnScreen then
MMouseOffClient('rand');
end;
Procedure mightOffScreen;
begin
If Random(10) = 0 then
mouseOffScreen;
end;
procedure beHuman(i: Integer);
begin
If Not MouseOnScreen then
Exit;
Case Random(I)of
0..3: mouseOffScreen;
4..9: randomCompass;
10: randomFKeys(True);
11: Tab(TAB_STATS);
12..16: SleepAndMoveMouse(200+Random(2000));
17: randomRClick;
end;
end;
procedure afterClick;
begin
Case Random(20)of
4..9: randomCompass;
12..15: SleepAndMoveMouse(200+Random(2000));
16..19: mouseOffScreen;
end;
end;
procedure waitDistance(Tile: TPoint; Dist: Integer);
begin
repeat
beHuman(800);
handle_Run;
Wait(100+Random(200));
until(Not locPlayer.IsMoving)or(Reflect.Tiles.DistanceFromTile(Tile) <= Dist);
end;
procedure waitWalking;
var
I: Integer;
begin
repeat
beHuman(400);
Wait(100+Random(200));
until(Not locPlayer.IsMoving);
For I:=0 to 2 do
begin
Wait(100+Random(50));
beHuman(400);
end;
end;
function walkTowards(Tile: TTile; Dist: Integer): Boolean;
var
I, Tries: Integer;
OurTile, DestTile: TTile;
CTRLPoints: TTileArray;
begin
If (Not isLoggedIn)or(Failed)then
Exit;
repeat
OurTile := Reflect.Internals.GetGlobalTile;
CtrlPoints := Reflect.Internals.WindPath(OurTile.x, OurTile.y, Tile.x, Tile.y, 5.0, 2.5, 0.0, 0.0, 1.5, 1.0);
Inc(Tries);
if(Tries > 20)then
Exit;
for I:= High(CtrlPoints) downto 0 do
if TReflectLocalPlayer.WalkToTileMM(CtrlPoints[I]) then
begin
afterClick;
waitDistance(CtrlPoints[I], 2+Random(3));
Result := Reflect.Tiles.DistanceFromTile(Tile) < Dist;
Break;
end;
until(Result);
end;
function walkControlPoints(ControlPoints: TPointArray; MaxRange: Integer): boolean;
var
Ind: Integer;
begin
If (Not isLoggedIn)or(Failed)then
Exit;
repeat
If Length(ControlPoints) = Ind then
Exit(True);
If not (Reflect.Tiles.DistanceFromTile(ControlPoints[Ind]) > MaxRange) then
begin
If walkTowards(ControlPoints[Ind], 8)then
Ind := Ind + 1
else
Exit(False);
end else
Exit(False);
until(Result);
end;
function toPortal: boolean;
begin
Result := walkControlPoints([Point(3354, 3163)], 150);
waitWalking;
end;
function toBank: boolean;
begin
Result := walkControlPoints([Point(3370, 3169)], 150);
waitWalking;
end;
function interact(B: TBox; UpText, Option: String; clickType: Integer): boolean;
begin
If (Not isLoggedIn)or(Failed) then
Exit;
mouseHandle(B, MOUSE_MOVE);
If Reflect.Text.IsUpText(UpText, 200+Random(100))then
begin
Debug('Looked for "' + UpText + '" in "' + Reflect.Text.GetUpText + '" -> Uptext was correct', False);
If clickType = MOUSE_MOVE then
Exit(True);
Mouse(getMousePnt, 0, 0, clickType);
If (clickType = mouse_Right)and(Reflect.Text.ChooseOption(Option, 200+Random(100)))then
Exit(True) else
If (clickType = mouse_Left)then
Exit(True);
end else
begin
Debug('Looked for "' + UpText + '" in "' + Reflect.Text.GetUpText + '" -> Trying to right click..', False);
Mouse(getMousePnt, 0, 0, Mouse_Right);
Result := Reflect.Text.ChooseOption(Option, 200+Random(100));
end;
end;
function interactTileOnce(Tile: TPoint; UpText, Option: String; Volume, clickType: Integer; XOffSet: Integer = 0; YOffset: Integer = 0; ZOffset: Integer = 0): boolean;
var
P: TPoint;
begin
If (Not isLoggedIn)or(Failed)or(Not TReflectionMap.TileOnMM(Tile))then
Exit;
If Not TReflectionTiles.TileOnMS(Tile)then
begin
Debug('Tile not on MS -> Walking..', False);
If C > 1 then
randomCompass;
locPlayer.WalkToTileMM(Tile);
Wait(250+Random(200));
waitDistance(Tile, 1);
WaitWalking;
end;
P := TReflectionTiles.TileToMS(Tile, XOffset, YOffset, ZOffSet);
If interact(IntToBox(P.X - Volume, P.Y - Volume, P.X + Volume, P.Y + Volume), UpText, Option, clickType)then
begin
Exit(True);
afterClick;
end;
end;
function interactTile(Tile: TPoint; UpText, Option: String; Volume, clickType: Integer; XOffset: Integer = 0; YOffset: Integer = 0; ZOffset: Integer = 0): boolean;
var
P: TPoint;
C: Integer;
begin
If (Not isLoggedIn)or(Failed)or(Not TReflectionMap.TileOnMM(Tile))then
Exit;
repeat
If interactTileOnce(Tile, UpText, Option, Volume, clickType, XOffset, YOffset, ZOffset)then
Exit(True)
else
randomCompass;
Inc(C);
until(C > 10);
end;
function interactInv(IDs: TIntegerArray; Option: String): boolean;
var
Inv: TReflectInvItemArray;
I: Integer;
begin
If (Not isLoggedIn)or(Failed)then
Exit;
Inv.GetAll;
For I:=0 to High(Inv)do
If InIntArray(IDs, Inv[I].ID)then
begin
Debug('Correct ID found', False);
If Not Tab(TAB_INV)then
Exit;
if Interact(invBox(Inv[I].InvSlot), Option, Option, mouse_Left)then
Exit(True);
end;
end;
procedure handle_Ring;
var
I: Integer;
begin
If (Not isLoggedIn)or(Failed)then
Exit;
For I:=1 to 8 do
If Pos('crumbles', getChatBoxText(I, 16711807)) > 0 then
begin
Me.Booleans[Bool_NewRing] := True;
Exit;
end;
end;
function findBank: boolean;
var
Bank: TPoint;
CT: Timer;
timeOut: Integer;
begin
If (Not isLoggedIn)or(Failed) then
Exit;
If IsBankOpen then
Exit(True);
If not TReflectionTiles.NearTile(Point(3369, 3171), 7) then
begin
Debug('Distance is too high @ Bank', False);
If Not toBank then
begin
Debug('Failed walking to bank?', True);
Exit;
end;
end;
if interactTile(Point(3369, 3171), 'Use Bank chest', 'Use Bank chest', 8, mouse_Left, 0, 0, 50+Random(50))then
begin
Debug('interact -> Bank Booth', False);
CT.start;
timeOut := 8000+Random(4000);
repeat
Wait(300+Random(200));
Result := (isBankOpen)or(inPin(Pin));
until(Result)or(CT.timeElapsed > timeOut);
end else
randomCompass;
end;
function insideClanWars: boolean;
begin
Result := (Reflect.Tiles.NearTile(Point(3327, 4751), 300));
end;
function EnterPortal: boolean;
var
T: Timer;
C: Integer;
begin
If (Not isLoggedIn)or(Failed)then
Exit;
repeat
Inc(C);
If InteractTile(Point(3351, 3164), 'Enter Free', 'Enter Free', 5, mouse_Left, -47, -47, 40+Random(160))then
begin
Debug('Clicked portal -> Entering for restore stats', False);
T.start;
repeat
Wait(200+Random(200));
beHuman(400);
until(InsideClanWars)or(T.timeElapsed > 5000);
Result := InsideClanWars;
end;
until(C > 2)or(Result);
end;
function ExitPortal: boolean;
var
T: Timer;
C: Integer;
begin
If (Not isLoggedIn)or(Failed)then
Exit;
repeat
Inc(C);
If InteractTile(Point(3328, 4751), 'Exit Portal', 'Exit Portal', 5, mouse_Left, -96, -175, 40+Random(160))then
begin
Debug('Clicked portal -> Exiting', False);
T.start;
repeat
Wait(200+Random(200));
beHuman(400);
until(Not InsideClanWars)or(T.timeElapsed > 5000);
Result := (Not InsideClanWars);
end;
until(C > 2)or(Result);
end;
function getBankSupplyPoint(Index: Integer): TPoint;
begin
Result := Point(88+(Index-1)*49, 101);
end;
procedure handle_Restock;
var
T: Timer;
begin
If (Not isLoggedIn)or(Failed)then
Exit;
If not findBank then
begin
Debug('Failed banking?', True);
Exit;
end;
If Not isBankOpen then
Exit;
If getInvCount > 0 then
quickDeposit('inventory');
fixBank;
If Not withdrawPoint(getBankSupplyPoint(Bank_Spot_Food), FoodAmount+Random(RandomFood))then
begin
Debug('Failed withdrawing food?', True);
Exit;
end;
If Me.Booleans[Bool_NewRing] then
If Not withdrawPoint(getBankSupplyPoint(Bank_Spot_Rings), 1)then
begin
Debug('Failed withdrawing food?', True);
Exit;
end;
If Not withdrawPoint(getBankSupplyPoint(Bank_Spot_Teletabs), 1)then
begin
Debug('Failed withdrawing food?', True);
Exit;
end;
closeInterface;
If Me.Booleans[Bool_NewRing] then
begin
Debug('Equip -> Duel ring', False);
if Not interactInv([ID_DuelRing], 'Wear Ring of dueling')then
begin
Debug('Failed Equip -> Duel ring', True);
Exit;
end;
Me.Booleans[Bool_NewRing] := False;
end;
end;
function waitForHouse: boolean;
var
T: Timer;
begin
If (Not isLoggedIn)or(Failed)then
Exit;
T.start;
repeat
wait(200+Random(100));
until(GetColor(139, 257) = 66050)or(T.timeElapsed > 10000);
If t.timeElapsed > 10000 then
Exit;
Debug('There''s no placec like home...', False);
T.start;
repeat
wait(200+Random(100));
until(Not (GetColor(139, 257) = 66050))or(T.timeElapsed > 10000);
Result := (T.timeElapsed < 10000);
end;
function clickTeleport: boolean;
begin
Result := interactInv([ID_TeleportTAB], 'Break');
end;
function outsideHouse: boolean;
begin
Result := Reflect.Tiles.NearTile(Point(2955, 3223), 50);
end;
function exitHouse: boolean;
var
P: TPoint;
T: Timer;
begin
If (Not isLoggedIn)or(Failed)then
Exit;
P := Reflect.Internals.GetGlobalTile;
repeat
Inc(C);
If InteractTile(Point(P.X+1, P.Y), 'Enter Portal', 'Enter Portal', 5, mouse_Left, -96, -175, 40+Random(160))then
begin
Debug('Clicked portal -> Exiting', False);
T.start;
repeat
Wait(200+Random(200));
beHuman(400);
until(outsideHouse)or(T.timeElapsed > 5000);
Result := outsideHouse;
end;
until(C > 2)or(Result);
end;
function atClanWars: boolean;
begin
Result := Reflect.Tiles.NearTile(Point(3369, 3170), 200);
end;
function teleportRing: boolean;
begin
If (Not isLoggedIn)or(Not Tab(TAB_EQUIP))or(Failed)then
Exit;;
If Interact(IntToBox(687, 372, 706, 394), 'Ring of dueling', 'Clan Wars', Mouse_Right)then
begin
Debug('Teleported back into safe area..', False);
repeat
wait(200+Random(400));
until(atClanWars);
Result := atClanWars;
end;
end;
procedure setupPlayer;
begin
if not isLoggedIn then
begin
If Not selectWorld(WorldInt)then
begin
Debug('Can''t select W' + ToStr(WorldInt) +'?', True);
TerminateScript;
end;
loginPlayer(False);
end;
locPlayer.Create;
getStats;
setAngle(ANGLE_HIGH);
If Random(3) = 0 then
randomCompass;
end;
procedure resetStats;
begin
If (Not isLoggedIn)or(Failed)then
Exit;
If Not atClanWars then
begin
Debug('We are not at clan wars?', True);
Exit;
end;
If Not toPortal then
begin
Debug('Failed walking to portal?', True);
Exit;
end;
If not EnterPortal then
begin
Debug('Failed entering portal?', True);
Exit;
end;
Wait(200+Random(300));
If not ExitPortal then
begin
Debug('Failed exiting portal?', True);
Exit;
end;
Wait(200+Random(300));
end;
function toLadder: boolean;
var
Paths: T2DPointArray;
Ind: Integer;
begin
Paths := [[Point(2969, 3196), Point(2986, 3191), Point(3010, 3149)],
[Point(2973, 3217), Point(2988, 3191), Point(3003, 3182), Point(3010, 3150)]];
Result := walkControlPoints(Paths[Random(2)], 300);
end;
function insideCave: boolean;
begin
Result := Reflect.Tiles.NearTile(Point(3009, 9550), 400);
end;
procedure waitCave;
var
T: Timer;
begin
T.start;
repeat
Wait(150+Random(100));
if T.timeElapsed > 8000 then
Exit;
until(insideCave);
end;
function downTrapdoor: boolean;
var
T: Timer;
begin
T.start;
repeat
Wait(150+Random(100));
if T.timeElapsed > 25000 then
Exit;
If interactTile(Point(3008, 3150), 'Climb-down', 'Climb-down', 10, mouse_Left, 0, 0, 0)then
waitCave;
until(insideCave);
Result := insideCave;
end;
function toCave: boolean;
begin
If Not clickTeleport then
begin
Debug('Failed teleporting to House?', True);
Exit;
end;
If not waitForHouse then
begin
Debug('Failed waiting for house?', True);
Exit;
end;
beHuman(200);
if not exitHouse then
begin
Debug('Exiting house failed?', True);
Exit;
end;
If not toLadder then
begin
Debug('Failed walking to cave?', True);
Exit;
end else
Wait(1000+Random(1000));
If Not downTrapdoor then
begin
Debug('Failed at trapdoor?', True);
Exit;
end;
Result := True;
end;
function toEntrance: boolean;
begin
Result := walkControlPoints([Point(2994, 9559), Point(3001, 9579), Point(3036, 9581), Point(3056, 9564)], 500);
end;
function detectWarning: boolean;
begin
Result := InRange(CountColor(0, 25, 372, 497, 438), 1175, 1215);
end;
Procedure waitWarning;
var
T: Timer;
begin
T.start;
repeat
Wait(300+Random(200));
until(T.timeElapsed > 10000)or(detectWarning);
end;
function clickEntrance: boolean;
var
T: Timer;
begin
T.start;
repeat
Wait(150+Random(100));
If interactTile(Point(3056, 9560), 'Enter Icy', 'Enter Icy', 10, mouse_Left, 0, 0, 30+Random(40))then
waitWarning;
until(detectWarning)or(T.timeElapsed > 60000);
Result := detectWarning;
end;
function insideWyverns: boolean;
var
P: TPoint;
begin
P := Reflect.Internals.GetGlobalTile;
Result := (insideCave)and(P.Y < 9562)and(P.X > 3013);
end;
function handle_Warning: boolean;
var
T: Timer;
C: Integer;
begin
repeat
C := C + 1;
clickToContinue;
If InRange(CountColor(128, 202, 361, 319, 379), 200, 260)then
begin
Debug('Detected last click until inside wyverns..', False);
If Not Interact(IntToBox(164, 396, 357, 409), 'Continue', 'Continue', mouse_Left)then
begin
Debug('Failed at last click?', True);
Exit;
end;
T.start;
repeat
Wait(200+Random(100));
until(insideWyverns)or(T.timeElapsed > 10000)or(C > 5);
end;
until(insideWyverns)or(C > 5);
Result := insideWyverns;
end;
function EnterWyverns: Boolean;
begin
If Not ClickEntrance then
begin
Debug('Failed entering cave?', True);
Exit;
end;
If not handle_Warning then
begin
Debug('Failed handling warning?', True);
Exit;
end;
Result := insideWyverns;
end;
function handle_ToWyverns: boolean;
begin
If Not toCave then
Exit;
If Not toEntrance then
begin
Debug('Failed walking inside the cave?', True);
//teleportRing;
Exit;
end;
If not EnterWyverns then
Exit;
Result := insideCave;
end;
procedure updateWyvern;
var
NPC: TReflectNPC;
G: TGraphics;
S: TStringArray;
I, tInt: Integer;
begin
locPlayer.GetInteractingNpc(NPC);
G := OS_Smart.Graphics;
G.ClearArea(380, 276, 516, 339);
If Not (NPC.Index > 1) then
Exit;
G.DrawBox(400, 290, 500, 330, True, 65536);
S := ['Index: ' + ToStr(NPC.Index), 'Wyvern health'];
For I:=0 to High(S) do
G.DrawClippedText(S[I], 'SmallChars07', Point(412, 292+(I*10)), clYellow);
If (NPC.Health > 0)then
tInt := (Round(100*(NPC.Health / NPC.MaxHealth)));
If InRange(tInt, 0, 101)then
begin
G.DrawBox(400, 320, 500, 330, True, clRed);
G.DrawBox(400, 320, 400+tInt, 330, True, 65280);
end;
end;
function interactedWith: boolean;
var
NPCs: TReflectNPCArray;
I, myIndex: Integer;
begin
NPCs.GetAll;
If Length(NPCs) = 0 then
Exit;
myIndex := locPlayer.GetPlayerIndex;
For I:=0 to High(NPCs)do
If NPCs[I].InteractingIndex = myIndex then
Exit(True);
end;
function distanceFromWyvern: integer;
var
NPC: TReflectNPC;
begin
Result := 8;
If (Not InteractedWith) then
Exit;
locPlayer.GetInteractingNpc(NPC);
If NPC.Index > 1 then
begin
Result := Reflect.Tiles.DistanceFromTile(NPC.Tile);
CurIndex := NPC.Index;
end;
end;
procedure handle_Health;
var
tInt: Integer;
begin
If Me.Booleans[Bool_OutOfFood] then
Exit;
tInt := locPlayer.GetSkillLevel(SKILL_HP);
If (tInt < Me.Integers[Int_EatAt])then
begin
Debug('Low HP(' + ToStr(tInt) + ') -> Eating', False);
Me.Booleans[Bool_OutOfFood] := (Not interactInv([FoodID, 379], 'Eat'));
afterClick;
Me.Integers[Int_EatAt] := EatAtHP+Random(RandomHP);
Wait(200+Random(100));
end;
If Me.Booleans[Bool_OutOfFood]then
Debug('Out of food!', False);
end;
procedure handle_WyvernSpace;
var
NPC: TReflectNPC;
I: Integer;
begin
NPC.GetIndex(CurIndex);
For I:=0 to High(Areas)do
If PointInBox(NPC.Tile, Areas[I])then
begin
Debug('Found Wyvern area, creating distance', False);
If walkTowards(Solutions[I], 100)then
Debug('Walked toward solution tile..', False)
else
begin
Debug('We have a problem.', False);
end;
end;
end;
procedure handle_Distance;
begin
If distanceFromWyvern < 7 then
handle_WyvernSpace;
end;
function handle_MakeSpace(Item: TReflectGroundItem): boolean;
var
Inv: TReflectInvItemArray;
Stackable: TStringArray;
begin
inv.GetAll;
If not Inv.IsFull then
Exit;
Debug('Inventory is full -> trying to clear space for ' + Item.Name, False);
Stackable := ['Pure essence',
'Chaos rune',
'Law rune',
'Blood rune',
'Soul rune'
'Death rune',
'Adamant bolts',
'Runite bolts',
'Rune arrow',
'Ranarr seed',
'Snapdragon seed',
'Magic logs',
'Adamant bar',
'Battlestaff',
'Unpowered orb',
'Iron ore',
'Uncut ruby',
'Uncut diamond',
'Nature rune',
'Silver ore'];
If InStrArr(Item.Name, Stackable, True)then
If containsIDs([Item.ID])then
begin
Debug(Item.Name + ' is stackable with the current ones in your inventory!', False);
Exit;
end;
If interactInv([ID_SteelArrow], 'Drop')then
begin
Debug('Dropped Steel arrows generated from ava''s device!', False);
Exit;
end;
If interactInv([FoodID, 379], 'Eat')then
begin
Debug('Ate a food for space!', False);
Exit;
end;
If InStrArr(Item.Name, ['Clue scroll (elite)', 'Draconic visage', 'Dragon platelegs', 'Dragon plateskirt', 'Granite legs'], True)then
If interactInv([ID_wyvernBones, 379], 'Drop')then
begin
Debug('Dropping bones for space!', False);
Exit;
end;
Result := True;
end;
procedure handle_pickUp;
var
Pile: TReflectGroundItemArray;
I, Ind: Integer;
myPos: TPoint;
B: Boolean;
begin
Pile.GetAll(15);
If Length(Pile) = 0 then
Exit;
For I:=0 to High(Pile)do
If InStrArrEx(Pile[I].Name, Drops, ind)then
begin
handle_Health;
if handle_MakeSpace(Pile[I]) then
Continue;
Debug('Drop: ' + Pile[I].Name + ' > Loc: ' + ToStr(Pile[I].Tile), False);
handle_Health;
If InteractTileOnce(Pile[I].Tile, 'Take ' + Pile[I].Name, 'Take ' + Pile[I].Name, 5, Mouse_Left, 0, 0, 0)then
begin
DropsCount[Ind] := DropsCount[Ind] + Pile[I].Quantity;
Wait(400+random(200));
waitDistance(Pile[I].Tile, 0);
B := True;
end;
end;
If B then
begin
afterClick;
dropTable;
end;
end;
procedure handle_Fight;
var
NPCs: TReflectNPCArray;
NPC: TReflectNPC;
P: TPoint;
I: Integer;
T: Timer;
begin
If locPlayer.UnderAttack then
Exit;
NPCs.Get('Skeletal Wyvern');
If Length(NPCs) = 0 then
Exit;
If locPlayer.UnderAttack then
Exit;
For I:=0 to High(NPCs)do
begin
If locPlayer.UnderAttack then
Exit;
If NPCs[I].InteractingIndex > 0 then
Continue;
If Not Reflect.Tiles.TileOnMS(NPCs[I].Tile)then
begin
locPlayer.WalkToTileMM(NPCs[I].Tile);
Wait(250+Random(200));
waitDistance(NPCs[I].Tile, 1);
afterClick;
T.start;
repeat
locPlayer.GetInteractingNpc(NPC);
wait(50+Random(50));
until(NPC.Index > 0)or(T.timeElapsed > 2500);
Exit;
end;
P := TReflectionTiles.TileToMS(NPCs[I].Tile, 0, 0, 50+Random(35));
If Not PointInBox(P, IntToBox(0, 0, MSX2, MSY2))then
Exit;
if interact(IntToBox(P.X - 8, P.Y - 8, P.X + 8, P.Y + 8), 'Attack', 'Attack', Mouse_Left)then
begin
Debug('Clicked wyvern!', False);
afterClick;
T.start;
repeat
locPlayer.GetInteractingNpc(NPC);
wait(50+Random(50));
until(NPC.Index > 0)or(T.timeElapsed > 3500);
end;
end;
end;
procedure wyvernLoop;
var
T: Timer;
B: Boolean;
begin
Me.Booleans[Bool_OutOfFood] := False;
Me.Integers[Int_Trips] := Me.Integers[Int_Trips] + 1;
DoneRound := DoneRound + 1;
repeat
Progress;
handle_Health;
beHuman(400);
CurIndex := 0;
handle_pickUp;
handle_Distance;
If not locPlayer.UnderAttack then
begin
handle_pickUp;
handle_Fight;
end;
updateWyvern;
handle_pickUp;
until(Me.Booleans[Bool_OutOfFood])or(Not insideCave);
If Not insideCave then
Debug('Not inside cave?', False);
if not teleportRing then
begin
Debug('Teleporting failed?', True);
Exit;
end;
updateWyvern;
end;
procedure breakCheck;
var
bTime: Integer;
sleepT: Timer;
begin
If (Not isLoggedIn)or(Failed)or(BreakList[Me.Integers[Int_Breaks]] > DoneRound)or(SkipBreaks) then
Exit;
Debug('Time to break!', False);
logoutPlayer;
Me.Integers[Int_Breaks] := Me.Integers[Int_Breaks] + 1;
DoneRound := 0;
if (Me.Integers[Int_Breaks] = 2)or(Me.Integers[Int_Breaks] = 5)or(Me.Integers[Int_Breaks] = 7)or(Me.Integers[Int_Breaks] = 9)then
bTime := 1000*60*(200+Random(500))
else
bTime := 1000*60*(3+Random(200));
sleepT.start;
repeat
Progress;
Debug('Total breaktime is ' + msToTime(bTime, TIME_SHORT) + ' Time left is ' + msToTime(bTime-sleepT.timeElapsed, TIME_SHORT), False);
Wait(1000+Random(1000));
ClearDebug;
until(sleepT.timeElapsed > bTime);
loginPlayer(False);
SetupPlayer;
end;
begin
InitAL;
SetupReflection;
setupVars;
BreakSetup;
setupPlayer;
repeat
dropTable;
Progress;
If atClanWars then
begin
If not (locPlayer.GetSkillLevel(SKILL_HITPOINTS) = locPlayer.GetMaxSkillLevel(SKILL_HITPOINTS))or
not (locPlayer.GetSkillLevel(SKILL_Prayer) = locPlayer.GetMaxSkillLevel(SKILL_Prayer))then
begin
Debug('Reset stats -> Portal', False);
resetStats;
end;
handle_Ring;
breakCheck;
if not containsIDs([ID_TeleportTAB])then
handle_Restock;
end;
If insideCave then
wyvernLoop
else
If handle_ToWyverns then
wyvernLoop;
until(Not Me.Active)or(Failed)or(Limit = Me.Integers[Int_Trips]);
end.