Simba Code:
program new;
{$i ogLib/lib/core/core.simba}
type
siphonSpot = record
name: String;
ID: uInt32;
lvl: int32;
xp: extended;
end;
const
_x2 = 575;
_y2 = 464;
RCLevel = 80;
var
vCharArray: glCharArray;
vModelArray: glModelArray;
vTextureArray: glTextureArray;
lastSiphon_ID, bestSiphonID: integer;
siphonableSpots: array of siphonSpot;
startingSpot: TPoint;
modelIDList: array of integer;
procedure setupSiphonOptions();
var
i: integer;
siphonSpots: array of siphonSpot;
begin
SetLength(siphonSpots, 12);
SetLength(siphonableSpots, 12);
with siphonSpots[0] do
begin
name := 'Chaotic cloud';
ID := 3134921782;
xp := 61.6;
lvl := 35;
end;
with siphonSpots[1] do
begin
name := 'Nebula';
ID := 1874237583;
xp := 74.7;
lvl := 40;
end;
with siphonSpots[2] do
begin
name := 'Shifter';
ID := 2929715345;
xp := 86.8;
lvl := 44;
end;
with siphonSpots[3] do
begin
name := 'Jumper';
ID := 1966863770;
xp := 107.8;
lvl := 54;
end;
with siphonSpots[4] do
begin
name := 'Death esswraith';
ID := 2533163227;
xp := 60;
lvl := 65;
end;
with siphonSpots[5] do
begin
name := 'Skulls';
ID := 1304649452;
xp := 120;
lvl := 65;
end;
with siphonSpots[6] do
begin
name := 'Blood esswraith';
ID := 4009427976;
xp := 73.1;
lvl := 77;
end;
with siphonSpots[7] do
begin
name := 'Blood pool';
ID := 2566560352;
xp := 146.3;
lvl := 77;
end;
with siphonSpots[8] do
begin
name := 'Bloody skulls';
ID := 1895117757;
xp := 159.75;
lvl := 83;
end;
with siphonSpots[9] do
begin
name := 'Soul esswraith';
ID := 1218560579;
xp := 106.5;
lvl := 90;
end;
with siphonSpots[10] do
begin
name := 'Living soul';
ID := 4055789841;
xp := 213;
lvl := 90;
end;
with siphonSpots[11] do
begin
name := 'Undead soul';
ID := 3400103031;
xp := 199.75;
lvl := 95;
end;
siphonableSpots := Copy(siphonSpots);
writeln(length(siphonableSpots));
for i := 0 to high(siphonableSpots) do
if (siphonableSpots[i].lvl > RCLevel) or (siphonableSpots[i].ID < 1) then
begin
setLength(siphonableSpots, i);
break;
end;
setLength(modelIDList, length(siphonableSpots));
for i := 0 to high(siphonableSpots) do
modelIDList[i] := siphonableSpots[i].ID;
end;
function expFromModelID(modID: integer): integer;
var
i, h: integer;
begin
h := high(siphonableSpots);
for i := 0 to h do
if (siphonableSpots[i].ID = modID) then exit(round(siphonableSpots[i].xp));
end;
function sortSiphonsByEXP: glModel;
var
siphonM: glModelArray;
siphons: TPointArray;
i, h, tmpXP: integer;
bestEXP : TPoint;//X holds XP, Y holds array index
begin
siphonM := vModelArray.getModels(modelIDList, IntToBox(0, 0,_x2,_y2));
if length(siphonM) = 0 then exit;
writeln();
writeln('We''ve found:');
for i := 0 to high(siphonM) do
for h := 0 to high(siphonableSpots) do
if siphonM[i].ID = siphonableSpots[h].ID then writeln(siphonableSpots[h].name+':'
+ toString(siphonableSpots[h].xp) );
h := high(siphonM);
for i := 0 to h do
begin
tmpXP := expFromModelID(siphonM[i].ID);
if tmpXP > bestEXP.X then
begin
bestEXP.X := tmpXP;
bestEXP.Y := i;
end;
end;
bestSiphonID := siphonM[bestEXP.Y].ID;
writeln('We choose:');
for i := 0 to high(siphonableSpots) do
if siphonM[bestEXP.Y].ID = siphonableSpots[i].ID then writeln(siphonableSpots[i].name+':'
+ toString(siphonableSpots[i].xp) );
exit(siphonM[bestEXP.Y]);
end;
function isSiphoning(): boolean;
begin
if not ogl.getModels([1512564864, 3097344728],tBox([0, 0,_x2,_y2])).isEmpty() then
begin
sortSiphonsByEXP;
exit(lastSiphon_ID=bestSiphonID);
end;
end;
function siphon(): boolean;
var
thisModel: glModel;
modelPoint: TPoint;
begin
if isSiphoning then exit(true);
status('siphon()');
thisModel := sortSiphonsByEXP;
modelPoint := Point(thisModel.x, thisModel.y);
if not PointInBox(modelPoint, IntToBox(1, 1, _x2, _y2)) then exit(false);
result := tmouse.rightClickOption(thisModel.randomizePointEllipse(15),['Siphon'],random(155, 800));
if result then lastSiphon_ID := bestSiphonID;
end;
function waitToSiphon(): boolean;
var
t: integer := GetSystemTime + RandomRange(3123, 7212);
begin
if isSiphoning then exit(true);
status('waitToSiphon()');
while t > GetSystemTime do
begin
if isSiphoning then exit(true);
wait(243+random(1000));
end;
end;
procedure waitWhileSiphoning();
begin
status('waitWhileSiphoning()');
wait(randomRange(1231,3421));
end;
procedure islandCheck();
var
chatttter: TStringArray;
myPos: TPoint;
begin
chatttter := tchat.getChat();
if length(chatttter) < 1 then exit();
if (Pos('You can''t reach that.', chatttter[0]) > 0) then
begin
myPos := tMinimap.getLocalPosition();
if Distance(myPos.X, myPos.Y, startingSpot.X, startingSpot.Y) > 3 then
begin
tMinimap.ClickLocalPosition(startingSpot.randomizePointEllipse(3));
wait(randomRange(5000, 12000));
writeln('walked to start spot');
end;
end;
end;
procedure mainLoop();
var
siphonM: glModelArray;
siphons: TPointArray;
i: integer;
begin
smart.__Graphics.Clear();
vCharArray := ogl.getChars();
vModelArray := ogl.getModels();
vTextureArray := ogl.getTextures();
siphonM := vModelArray.getModels(modelIDList, IntToBox(0, 0,_x2,_y2));
if (length(siphonM) > 0 )then
begin
siphons := siphonM.toPointArray();
for i := 0 to high(siphons) do try
smart.__Graphics.DrawCircle(siphons[i], 15, clRed, false);
except end;
end;
islandCheck;
if siphon then if waitToSiphon then waitWhileSiphoning;
wait(100+ random(333));
end;
function TSmart.GetParams(useParameters: boolean): TStringArray; override;
var
funcExcludeList:tIntegerArray=[13,47,55,75,90,93,94,95,101,102,107,109,110,111,112,113,118,121,122,125,126,127,128,129,130,131,132,133];
funcRandom:int32;
page : String;
params : TStringArray;
begin
if useParameters then
begin
page := getPage('http://www.runescape.com/game.ws?j=1');
result := explode(',', between('worldLink=''', '''', page));
result[0]:='http://world205.runescape.com/';
exit;
end;
while true do
if not funcExcludeList.contains(funcRandom:=random(1,141)) then
begin
result:=['http://world'+intToStr(funcRandom)+'.runescape.com/',''];
break;
end;
end;
var
a: integer = 0;
b: integer = 0;
c: integer = _x2;
d: integer = _y2;
begin
ogl.setup(800,600);
glxviewport(a, b, c, d);
smart.__Graphics.Clear();
ogl.setDebugMode('none');
startingSpot := tMinimap.getLocalPosition();
setupSiphonOptions;
writeln(siphonableSpots);
writeln(modelIDList);
repeat
mainLoop();
until (execRegExpr('(?i).*Oh dear.*',ogl.getChars().toString()));
writeln('exit main loop');
writeln(GetTimeRunning);
end.