///////////////////////////////////////////////////////////////////////
// //
// READ THE DIRECTIONS IN THE OP FIRST OR ELSE //
// Make sure you have setup your player file //
// Under SRL>PlayerManager //
// Press Play //
// //
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
program AshamanIvy;
{$DEFINE SMART}
{$I SRL-6/SRL.Simba}
{$i srl-6/lib/misc/srlplayerform.simba}
const
ScriptVersion = '1.03';
BIR = 13;
BFR = 8;
var
startingXP, direction, w, x, y, z, breakRounds, realBTime, totalBreaks, scriptPaintBMP: integer;
timeout, currentBTime: TTimeMarker;
XPH, XP: Extended;
ivyData: TColorData = [3970906, 14, [2, [0.22, 0.85]]];
procedure declarePlayers();
var
i,j: integer;
begin
players.setup(playerForm.playerNames, playerForm.playerFile); // load the SPF players from the SRL Player Manager
currentPlayer := 0; // player to use first
// set player attributes based on the settings from the form
for i := 0 to high(players) do
with players[i] do
begin
// convert the integers
integers[0] := strToInt(playerForm.players[i].settings[0]); //minutes until break
integers[1] := strToInt(playerForm.players[i].settings[1]); //minutes to break
World := strToInt(playerForm.players[i].settings[2]); //world
ismember:=true;
Case playerForm.players[i].settings[7] Of
'NORTH': Direction := 0;
'SOUTH': Direction := 180;
'EAST': Direction := 90;
'WEST': Direction := 270;
End;
if (playerForm.players[i].settings[3] = '') then
begin
writeln('No UserAgent detected. Opening up webpage to get userAgent');
openWebPage('http://whatsmyuseragent.com/');
writeln('Copy your useragent text and paste it into the form');
writeln('Restart script');
terminateScript;
end else
smartUserAgent := playerForm.players[i].settings[3]; //useragent
// booleans
booleans[0] := strToBool(playerForm.players[i].settings[4]);//take breaks
booleans[1] := strToBool(playerForm.players[i].settings[5]); //switch worlds
FindMod := strToBool(playerForm.players[i].settings[6]);
end;
end;
// initiates the SRL player form (you aren't restricted to the procedure name; it can be whatever you want)
procedure initPlayerForm();
begin
with playerForm do
begin
name := 'AshamanIvy v'+toStr(ScriptVersion); // the title of the SPF, usually the name of your script
editBoxLabels := ['Minutes until Break', '# of Minutes to Break', 'World', 'Client UserAgent']; // edit boxes are created for each array element
editBoxDefaults := ['600', '15', '0', '']; // optional default values for each edit box; array length must equal editBoxLabel length
editBoxHints := ['How many minutes do you want to run the script before you break?',
'How many minutes do you want to break for?',
'Which world do you want to login to? 0 is random',
'If you don''t know this, a popup will walk you through it after you hit start'];
checkBoxLabels := ['Take Breaks', 'Switch Worlds (After Break)', 'Logout if Mod is near']; // same as editBoxLabels but for check boxes
checkBoxDefaults := ['True','True','True'];
checkBoxHints := ['Do you want to take breaks?',
'Do you want to switch worlds after you break?',
'Do you want to logout if a jmod is detected near you?'];
comboBoxLabels := ['Direction']; // same as editBoxLabels but for combo boxes (drop down boxes)
comboBoxDefaults := ['NORTH'];
comboBoxHints := ['Which direction to rotate camera so you are facing Ivy'];
// this needs to be done for every element in the comboBoxLabels array
setLength(comboBoxItems, length(comboBoxLabels));
comboBoxItems[0] := ['NORTH','SOUTH','EAST','WEST']; // all the options available for the first combo box
end;
end;
function getRandomWords: string;
var
stringLeft, stringRight, word, text, text2: string;
begin
stringLeft := '>
';
stringRight := '
';
word := getPage('http://www.randomlists.com/random-words');
text := between(stringLeft, stringRight, word);
word := getPage('http://www.randomlists.com/random-words');
Text2 := Between(stringLeft, stringRight, word);
text := capitalize(trim(text));
text2 := capitalize(trim(text2));
result := (text + ' ' + text2);
end;
procedure notifyMyPhone(title, message: string);
const
TOKEN = 'aY3eNb21zg5XSwnH1585YPQwo8z2nT';
USER = 'uLWa2b66PHfdYf89vnpPQ7KFhBQLmk';
DEVICE = 'phone';
var
c: integer;
begin
c := initializeHTTPClient(false);
PostHTTPPage(c, 'http://api.pushover.net/1/messages.json', 'token=' + TOKEN + '&user=' + USER + '&device=' + DEVICE + '&title=' + title + '&message=' + message);
freeHTTPClient(c);
end;
function grabPaint: boolean;
var
paintLink: string; //Map Locations
paintName: String; //Map Names
paintFile: LongInt;
begin
paintName := scriptPath + 'prog.png';
paintLink := 'http://puu.sh/d6D0A/df2e730c75.png';
if (not fileExists(paintName)) then
begin
writeln('No file, downloading');
paintFile := createFile(paintName);
closeFile(paintFile);
paintFile := rewriteFile(paintName, false);
writeFileString(paintFile, getPage(paintLink));
closeFile(paintFile);
end;
result:= (fileExists(scriptPath + 'prog.png'));
end;
{*******************************************************************************
Function AutoupdateMe;
By: Shuttleu
Edited By: Ashaman88
Description: Autoupdates Script.
*******************************************************************************}
Procedure autoUpdateMe;
Var
Neifile: Integer;
OnlineVersion, NewScript, NeiFeilNennen: String;
Begin
Writeln('Checking for script updates...');
OnlineVersion := GetPage('http://static.frement.net/proxy.php?u=https://raw.githubusercontent.com/ashaman88/AshamanIvy/master/Version.txt');
Writeln('Online Version: '+ToStr(OnlineVersion));
Writeln('Local Version: '+ToStr(ScriptVersion));
If (trim(OnlineVersion) > ScriptVersion) Then
Begin
WriteLn('Newer script version online!');
WriteLn('Autoupdating to newer version.');
NewScript := GetPage('http://static.frement.net/proxy.php?u=https://raw.githubusercontent.com/ashaman88/AshamanIvy/master/AshamanIvy.simba');
NeiFeilNennen := ScriptPath+ 'AshamanIvy V'+OnlineVersion+'.simba';
Neifile := Rewritefile(NeiFeilNennen, true);
Try
WriteFileString(Neifile, NewScript);
Except
Begin
WriteLn('Fatal error writing to '+NeiFeilNennen+'!!');
Terminatescript;
End;
End;
CloseFile(Neifile);
WriteLn('New script downloaded to '+NeiFeilNennen+'!! Please use this one!!');
TerminateScript;
End Else
WriteLn('You have the latest version of the script!');
End;
Function breakHandler(BreakIn, BreakFor, randBreakIn, randBreakFor: Integer): Boolean;
Var
H,M,S: Integer;
Begin
If Not IsLoggedIn Then
Exit;
If (GetTimeRunning < ((W) + (Y) + BreakRounds)) Then
Exit Else
If (GetTimeRunning > ((W) + (Y) + BreakRounds)) Then
Begin
RealBTime := Round((X+Z)/60000);
Writeln('Taking a break for about ' + IntToStr(RealBTime) + ' minutes.');
Players[CurrentPlayer].Logout;
CurrentBTime.Start;
Repeat
Wait(21000);
ConvertTime((X+Z)-CurrentBTime.GetTime,H,M,S);
Writeln('Breaktime left: '+IntToStr(H)+':'+IntToStr(M)+':'+IntToStr(S));
Until(CurrentBTime.GetTime>(X+Z));
Writeln('Logging in.');
If Players[CurrentPlayer].booleans[1] Then
Players[CurrentPlayer].World := 0;
Players[CurrentPlayer].Login;
Wait(4000);
Timeout.Start;
Result := IsLoggedIn;
Minimap.SetAngle(direction);
MainScreen.SetAngle(MS_ANGLE_HIGH);
mainScreen.setZoom(false);
IncEx(BreakRounds, (W) + (X));
Inc(TotalBreaks);
Writeln('The next break will occur in about ' + IntToStr(BreakIn) + ' minutes.');
W := (BreakIn * 60000);
X := (BreakFor * 60000);
Y := RandomRange(-BIR * 60000, BIR * 60000);
Z := RandomRange(-BFR * 60000, BFR * 60000);
End;
End;
procedure findNormalRandoms;
begin
exitTreasure;
claimSpinTicket;
end;
procedure antiban;
var
i: integer;
Begin
i := random(2000);
case i of
1..5:
begin
hoverSkill(Skill_woodcutting);
wait(gaussRangeInt(1200, 2000));
end;
5..200: sleepAndMoveMouse(randomRange(400, 1500));
201..500:
begin
mouseOffClient(4);
wait(randomRange(2000, 2500));
end;
end;
wait(GaussRangeInt(0, 4000));
End;
function findIvy: boolean;
var
i : integer;
TPA : TPointArray;
ATPA: T2DPointArray;
t, t2: TTimeMarker;
begin
if not isLoggedIn then
exit;
t.start;
t2.start;
repeat
wait(randomrange(250, 500));
if ivyData.gatherIn(tpa, mainscreen.getBounds) then
break;
if (not isLoggedIn) then
exit;
if (t2.getTime > 10000) then
begin
mainscreen.setZoom(false);
t2.start;
end;
until (t.getTime > 20000);
atpa := tpa.toATPA(80, 60);
atpa.sortFromMidPoint(mainscreen.playerPoint);
atpa.filterBetween(0, 15);
try
smartImage.debugATPA(ATPA);
except
end;
for i := 0 to high(ATPA) do
begin
mouse(middleTPA(ATPA[i]), MOUSE_RIGHT);
if chooseoption.select(['p Ivy', 'Chop I'],1000) then
begin
timeout.start;
exit(true);
end;
end;
end;
function ivyPresent: boolean;
var
time: integer;
tpa: TPointArray;
t: TTimeMarker;
coords: TBox = [257,151,316,181];
begin
smartImage.clearArea(mainScreen.getBounds);
smartImage.drawBox(coords);
t.start;
time := randomRange(2000, 5000);
repeat
if not ivyData.gatherIn(tpa, coords) then
exit;
wait(100 + random(50));
result := length(tpa) > 50;
until result or t.getTime > time;
setLength(tpa, 0);
end;
procedure waitWhileChopping;
var
origXP, idleTime: integer;
t: TTimeMarker;
begin
if not isLoggedIn then
exit;
idleTime := randomrange(250000, 270000);
origXP := chatBox.getXPBar;
t.start;
repeat
wait(randomRange(1500, 2000));
if not ivyPresent then
begin
Writeln('Ivy Gone bye bye!');
exit;
end;
if (t.getTime > idleTime) then
begin
writeln('Too much time has passed, finding new ivy!');
break;
end;
if chatBox.getXPBar > origXP then
begin
timeout.start;
origXP := chatBox.getXPBar;
end;
if not isLoggedIn then
exit;
antiban;
until false;
end;
procedure proggy;
var
TTB, tempXP: integer;
begin
if not isLoggedIn then
exit;
clearDebug;
TTB := (((W) + (Y) + BreakRounds)-GetTimeRunning);
tempXP := (ChatBox.GetXPbar - StartingXP);
if tempXP > 0 then
XP := tempXP;
XPH := Round(XP * (3600.0 / (GetTimeRunning / 1000.0)));
writeln('|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|');
writeln('| AshamanIvy v'+PadR(toStr(ScriptVersion), 26), '|');
writeln('|=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=|');
writeln(PadR('| Running For: '+TimeRunning, 60)+'|');
writeln(PadR('| Exp Earned: ' + GroupDigits(XP,','), 40) + padR('Exp/Hour: ' + GroupDigits(XPH,','), 20) + '|');
writeln('|___________________________________________________________|');
writeln('|___________________________________________________________|');
if players[currentPlayer].booleans[0] then
writeln('Time until break: '+ msToTime(TTB, Time_Bare));
smartImage.clear;
smartImage.drawBitmap(scriptPaintBMP, Point(6, 393));
smartImage.drawText(TimeRunning, Point(186, 468), 'smallChars', true, clWhite);
smartImage.drawText(groupDigits(XP,','), Point(124, 508), 'smallChars', true, clWhite);
smartImage.drawText(groupDigits(XPH,','), Point(88, 546), 'smallChars', true, clWhite);
case random(50) of
0: disguise(getRandomWords);
end;
end;
procedure terminate;
begin
notifyMyPhone('AshamanIvy','Time Running: ' + ToStr(TimeRunning) + ' XP: ' + groupDigits(XP, ',') + ' XPH: ' + groupDigits(XPH, ','));
end;
procedure mainLoop;
var
i: integer;
begin
if not isLoggedIn then
begin
writeln('Attempting to log back in');
disableSRLDebug := false;
repeat
currentPlayer := 0;
try
players[currentPlayer].login;
inc(i);
except
end;
if (i = -1) then
terminateScript;
until isLoggedIn;
disableSRLDebug := true;
minimap.setAngle(direction);
mainScreen.setAngle(MS_ANGLE_HIGH);
mainScreen.setZoom(false);
timeout.start;
end;
findNormalRandoms;
if findIvy then
begin
waitWhileChopping;
proggy;
end;
if (timeout.getTime > 600000) then
begin
writeln('Nothing has happened for too long!');
SaveScreenshot(ScriptPath + timeRunning() + '_' + 'IvyFail.png');
terminateScript;
end;
if players[currentPlayer].booleans[0] then
breakHandler(players[currentPlayer].integers[0], players[currentPlayer].integers[1], BIR, BFR);
end;
procedure setup;
begin
autoUpdateMe;
initPlayerForm(); // initiate your settings
runPlayerForm(); // run the form
// use this so the script doesn't continue if the user exits out of the form
if (not playerForm.isScriptReady) then
terminatescript;
SRL_Events[EVENT_ANTIBAN] := @Antiban;
smartEnableDrawing := true ;
smartShowConsole := false;
disableIPScreenshots:= true;
disableSRLLog := true;
disableSRLDebug := true;
smartResetAttempts := -1;
mouseSpeed:= randomRange(29, 32);
disguise(getRandomWords);
grabPaint;
scriptPaintBMP := loadBitmap(scriptPath + 'prog.png');
declarePlayers;
setupSRL;
if not isLoggedIn then
begin
if not players[currentPlayer].login then
terminateScript;
writeln('Just loggedin, waiting a bit');
wait(randomRange(1000, 2000));
end;
startingXP := chatbox.getxpbar;
minimap.setAngle(direction);
mainScreen.setAngle(MS_ANGLE_HIGH);
case MessageBox('Did you zoom in all the way already?', 'IvySetup', 3) of
6: writeln('if your sure lets do this');
else
begin Writeln('Ok zooming in!'); mainScreen.setZoom(false); end;
end;
findNormalRandoms;
timeout.start;
W := (Players[CurrentPlayer].Integers[0] * 60000);
X := (Players[CurrentPlayer].Integers[1] * 60000);
Y := RandomRange(-BIR * 60000, BIR * 60000);
Z := RandomRange(-BFR * 60000, BFR * 60000);
if fileExists(scriptPath + 'Version.txt') then
begin
writeln('you must be ashaman');
addOnTerminate('terminate');
end;
end;
begin
setup;
while (players.getActive() > 0) do
mainLoop;
end.