Code:
program winegp;
{$DEFINE SMART}
{$I SRL-6/SRL.simba}
{$I SPS/lib/SPS-RS3.simba}
{$i srl-6/lib/misc/srlplayerform.simba}
var
waterJCount, wineJCount, emptyJCount, scriptPaintBMP, waterJPrice, wineJPrice, emptyJPrice,
waterJDTM, wineJDTM, emptyJDTM, breaksTaken, breakT, breakL, runT, antiBanP: integer;
ScriptTimer: TTimeMarker;
BreakTimer, ReloadTimer, depositTimer: TCountDown;
stillDrinking, paint: boolean;
toDo, qKey: string;
path, area: array [0..2] of TPointArray;
procedure initPlayerForm();
begin
with playerForm do
begin
name := 'Winegp';
scriptHelpThread := 'https://s-media-cache-ak0.pinimg.com/originals/22/53/da/2253daf01e83df2acc28df0d7f5f5135.png';
editBoxLabels := ['World', 'Break Timer', 'Break Length', 'Run Time', 'Antiban Percentage', 'What key to use to drink?'];
editBoxDefaults := ['0', '90', '1', '500000', '20', '1'];
checkBoxLabels := ['Display Debug', 'Display Paint'];
checkBoxDefaults := ['False', 'True'];
comboBoxLabels := ['What to do'];
comboBoxDefaults := ['Drink Only'];
comboBoxHints := ['What do you want the script to do?'];
setLength(comboBoxItems, length(comboBoxLabels));
comboBoxItems[0] := ['Drink Only'];
end;
end;
procedure declarePlayers();
var
i: Integer;
begin
players.setup(playerForm.players);
currentPlayer := 0;
for i := 0 to high(players) do
with players[i] do
begin
integers[0] := strToInt(playerForm.players[i].settings[0]);
integers[1] := strToInt(playerForm.players[i].settings[1]);
integers[2] := strToInt(playerForm.players[i].settings[2]);
integers[3] := strToInt(playerForm.players[i].settings[3]);
integers[4] := strToInt(playerForm.players[i].settings[4]);
booleans[0] := strToBool(playerForm.players[i].settings[6]);
booleans[1] := strToBool(playerForm.players[i].settings[7]);
strings[0] := playerForm.players[i].settings[8];
strings[1] := playerForm.players[i].settings[5];
world := integers[0];
breakT := integers[1];
breakL := integers[2];
runT := integers[3];
antiBanP := integers[4];
qKey := strings[1];
toDo := strings[0];
paint := booleans[1];
if not booleans[0] then
disableSRLDebug := true;
if paint then
begin
scriptPaintBMP := loadBitmap(appPath + 'Scripts/Winegp/Winegp.png');
fastReplaceColor(scriptPaintBMP, 0, 1);
end;
end;
end;
{*Check file procedure by Kevin, modified by Clarity*}
procedure checkForFiles(filePath, message, link: string);
var
progFile: longInt;
fileName: string;
begin
fileName := AppPath + filePath;
try
if not fileExists(fileName) then
begin
writeln('-- INSTALLATION STATUS: ' + message + ' does not exist - Downloading now.');
progFile := createFile(fileName);
end
else
begin
writeln('-- INSTALLATION STATUS: ' + message + ' exists.');
exit;
end;
closeFile(progFile);
progFile := rewriteFile(fileName, false);
writeFileString(progFile, getPage(link));
writeln('-- INSTALLATION STATUS: ' + message + ' has been downloaded.');
finally
if (progFile > 0) then
closeFile(progFile);
end;
end;
{*Determines whether files exist and dictates their installation*}
procedure installAssets;
begin
writeln('Please wait...now installing Jug Filler Wine Drinker image assets to your computer...');
if not directoryExists(appPath + 'Scripts/Winegp/') then
begin
try
createDirectory(appPath + 'Scripts/Winegp/');
writeln('Created a new folder in Simba/Scripts/');
except
end;
end;
checkForFiles('Scripts/Winegp/Winegp.png', 'Script Paint', 'http://i.imgur.com/xY6CkUS.png');
end;
procedure freeBMPs();
begin
freeBitmap(scriptPaintBMP);
end;
//Resources compilation
procedure loadResources();
begin
// SPS.setup('LUMBY_SPS_00', RUNESCAPE_OTHER);
// path[0] := [Point(257, 260), Point(220, 202), Point(199, 157), Point(186, 107)]; //Path back to tha bank from the lodestone
// path[1] := [Point(187, 105), Point(124, 147)]; //Path to the fountain
// path[2] := [Point(114, 151), Point(181, 113)]; //Path back to the bank
// area[0] := [Point(101, 135), Point(98, 169), Point(136, 167), Point(175, 140), Point(199, 113), Point(198, 87), Point(159, 90), Point(102, 136)]; //Area of the bank and the fountain combined
wineJDTM := DTMFromString('mggAAAHicY2NgYGhmYmBoAOIqKN0DxP1A7M/IwOABxGFAnALEiUAcDMR9xjpAXUwY2IgBO2DEgSEAAH9nBmU=');
waterJDTM := DTMFromString('mlwAAAHicY2dgYIhiYmAIAuJIIE4D4hQgjgBiPyCezgjBE4B4PhCvAOI1QLwIiNPStwJ1M2HF5gy4ASMeDAUAwT4IsQ==');
emptyJDTM := DTMFromString('mggAAAHicY2NgYIhiYmAIAuIAII4A4hQgTgDiEkYGhlwgrgLiDiBuBuJCII6NjATqYsLAXAzYASMODAEAWLcGMQ==');
waterJPrice := grandExchange.getPrice(1937);
wineJPrice := grandExchange.getPrice(1993);
emptyJPrice := grandExchange.getPrice(1935);
end;
procedure freeTheDTM();
begin
freeDTMs([wineJDTM, waterJDTM, emptyJDTM]);
end;
{*Antiban*}
procedure antiBan();
begin
if (randomRange(1, 500) <= antiBanP) then
case random(100) of
0..90: begin
writeLn('Initiating Minibreak..');
if randomRange(1, 100) <= 50 then
mouseOffClient(OFF_CLIENT_RANDOM)
else wait(randomrange(13209, 28910));
ScriptTimer.pause;
wait(randomRange(3000, 7000));
writeLn('Back from the Minibreak..');
ScriptTimer.start;
end;
96..99: begin
wait(randomrange(26022, 54000));
end;
end;
mouse(604, 413, 5, 3, Mouse_accurate);
end;
{*Handles the treasure chest, tickets, popups, and click to continue buttons *}
procedure findNormalRandoms();
begin
exitTreasure();
claimTicket();
closePopUp();
conversationBox.continue(true, true);
end;
{*To login*}
procedure logIn();
begin
if not isLoggedIn() then
players[currentPlayer].login();
writeLn('Successfully logged you in..');
wait(randomRange(3000, 5000)); //To wait for the lag to subside
// mainScreen.setAngle(MS_ANGLE_HIGH); //Sets your angle to the highest possible angle
// wait(randomrange(77, 109));
findNormalRandoms(); //Closes all screen interferences
end;
{*To take a break*}
procedure takeBreak();
var
onBreakTimer: TCountDown;
begin
if not BreakTimer.isFinished() then
exit;
ScriptTimer.pause();
if (random(3) >= 1) then
mouseOffClient(OFF_CLIENT_RANDOM)
else players[currentPlayer].logOut();
onBreakTimer.setTime((breakL * 60000) + (randomRange(-180, 301) * 1000));
repeat
smartImage.clearArea(mainScreen.getBounds());
smartImage.drawTextLines(['Taking a break', 'Time remaining: ' + msToTime(onBreakTimer.timeRemaining(), TIME_SHORT)], Point(5, 365), statChars, true, clAqua);
wait(1000);
until onBreakTimer.isFinished();
inc(BreaksTaken);
writeLn('Logging you back in..');
logIn();
ScriptTimer.start();
BreakTimer.setTime((breakT * 60000) + (randomRange(-180, 301) * 1000));
end;
{*Reload SMART*}
procedure reloadSmart();
begin
if not ReloadTimer.isFinished() then
exit;
ScriptTimer.pause();
writeLn('You''ve been running for over 8hrs now..');
writeLn('Reloading SMART..');
smartReloadClient(randomRange(5, 11) * 60000); //Waits 5 to 10 mins before reloading SMART
writeLn('Logging you back in..');
logIn();
ScriptTimer.start();
ReloadTimer.setTime((480 + randomRange(-30, 31)) * 60000);
end;
{*Simple Object Finder Function*
*From The Mayor's generic object finder*}
function renzanityFindObj(hue, sat: extended; W, H, colour, tolerance, clickType: integer; mouseOverText, chooseOptions: array of string): boolean;
var
i, x, y: integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
if (not isLoggedIn()) or (not findColorsSpiralTolerance(x, y, TPA, colour, mainScreen.getBounds(), tolerance, colorSetting(2, hue, sat))) then
exit(false);
mouseSpeed := gaussRangeInt(40, 50); //For a human-like mouse speed movements
ATPA := TPA.cluster(W, H);
ATPA.filterBetween(0, 3);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);
for i := 0 to high(ATPA) do
begin
case random(5) of
0..3: missMouse(ATPA[i].getBounds().getRandomPoint(), true)
else
mouse(ATPA[i].getBounds().getRandomPoint(), MOUSE_MOVE, MOUSE_HUMAN);
end;
if isMouseOverText(mouseOverText, 170) then
begin
fastClick(clickType);
if clickType = MOUSE_LEFT then
begin
if randomRange(1, 100) <= 50 then
begin
fastClick(clickType);
smallRandomMouse(5 + random(50));
end else smallRandomMouse(5 + random(50));
end;
if clickType = MOUSE_RIGHT then
chooseOption.select(chooseOptions);
smartImage.clearArea(mainScreen.getBounds());
exit(true);
end;
end;
end;
{*******************************************************************************
******************** CODE FOR THE SCRIPT STARTS HERE ********************
*******************************************************************************}
{*Progress Report*}
procedure pRep();
var
profit, profit1, profit2, profitPH: integer;
begin
if not isLoggedIn() then
exit;
waterJCount := (waterJCount + tabBackPack.countDTM(waterJDTM));
clearDebug;
writeLn('v6.2');
writeLn('/=========================================\');
writeLn('|==== Winegp ====|');
writeLn('|=========================================|');
writeLn(PadR('| Time Ran: ' + msToTime(ScriptTimer.getTime(), TIME_SHORT), 42) + '|');
writeLn(PadR('| No. of breaks taken: ' + intToStr(BreaksTaken), 42) + '|');
case toDo of
'Fill Jugs Only' : begin
profit := ((waterJCount * waterJPrice) - (waterJCount * emptyJPrice));
profitPH := round((profit * 60) / (ScriptTimer.getTime() / 60000));
writeLn(PadR('| No. of Jugs filled: ' + groupDigits(waterJCount, ',') + ' pcs', 42) + '|');
writeLn(PadR('| Estimated Total Profit: ' + groupDigits(profit, ',')+ ' gp', 42) + '|');
end;
'Drink Only' : begin
profit := ((emptyJCount * emptyJPrice) - (wineJCount * wineJPrice));
profitPH := round((profit * 60) / (ScriptTimer.getTime() / 60000));
writeLn(PadR('| No. of Wine drank: ' + groupDigits(wineJCount, ',') + ' pcs', 42) + '|');
writeLn(PadR('| Estimated Total Profit: ' + groupDigits(profit, ',')+ ' gp', 42) + '|');
end;
'Do Both' : begin
writeLn(PadR('| No. of Wine drank: ' + groupDigits(wineJCount, ',') + ' pcs', 42) + '|');
writeLn(PadR('| No. of Jugs filled: ' + groupDigits(waterJCount, ',') + ' pcs', 42) + '|');
if stillDrinking then
begin
profit1 := ((emptyJCount * emptyJPrice) - (wineJCount * wineJPrice));
profitPH := round((profit1 * 60) / (ScriptTimer.getTime() / 60000));
writeLn(PadR('| Estimated Total Profit: ' + groupDigits(profit1, ',')+ ' gp', 42) + '|');
end else
begin
profit2 := ((waterJCount * waterJPrice) - (wineJCount * wineJPrice));
profitPH := round((profit2 * 60) / (ScriptTimer.getTime() / 60000));
writeLn(PadR('| Estimated Total Profit: ' + groupDigits(profit2, ',')+ ' gp', 42) + '|');
end;
end;
end;
writeLn(PadR('| Estimated profit/hr: ' + groupDigits(profitPH, ',') + ' gp', 42) + '|');
writeLn('\=========================================/');
if paint then
begin
smartImage.clear;
smartImage.drawBitmap(scriptPaintBMP, Point(2, 462));
smartImage.drawText(msToTime(ScriptTimer.getTime(), TIME_SHORT), Point(111, 508), clSilver);
// smartImage.drawText(intToStr(BreaksTaken),Point(143, 525), clSilver);
smartImage.drawText((groupDigits(wineJCount, ',') + ' pcs'),Point(134, 542), clSilver);
// smartImage.drawText((groupDigits(waterJCount, ',') + ' pcs'),Point(124, 558), clSilver);
case toDo of
'Drink Only' : smartImage.drawText((groupDigits(profit, ',') + ' gp'),Point(84, 580), clSilver);
'Fill Jugs Only' : smartImage.drawText((groupDigits(profit, ',') + ' gp'),Point(87, 575), clSilver);
'Do Both' : if stillDrinking then
smartImage.drawText((groupDigits(profit1, ',') + ' gp'),Point(87, 575), clSilver)
else smartImage.drawText((groupDigits(profit2, ',') + ' gp'),Point(87, 575), clSilver);
end;
smartImage.drawText((groupDigits(profitPH, ',') + ' gp'),Point(277, 580), clSilver);
end;
end;
{*Failsafe for when your character wanders off the radar*}
procedure areaCheck();
begin
takeBreak();
reloadSmart();
if not isLoggedIn() then
logIn();
// if (not SPS.isInPolygon(area[0])) then
//begin
// writeLn('Initiating failsafe..');
// lodestoneScreen.teleportTo(LOCATION_LUMBRIDGE);
// wait(randomRange(19000, 20000)); //To wait for the screen to load..
// SPS.walkPath(path[0]);
// end else writeLn('You''re near the bank or the fountain..');
end;
{*Banking procedure*}
procedure toWithdraw();
begin
takeBreak();
reloadSmart();
if not isLoggedIn() then
logIn();
repeat
areaCheck();
until bankScreen.open(BANK_NPC_GREY) or (not isLoggedIn());
// BANK_NPC_GREY or BANK_CHEST_LUMBRIDGE
depositTimer.setTime(randomRange(10000, 15000)); //Failsafe for when you get stuck, trying to deposit empty jugs
repeat
case toDo of
'Fill Jugs Only': bankScreen.clickButton(BANK_BUTTON_PRESET_2);
'Drink Only' : bankScreen.clickButton(BANK_BUTTON_PRESET_1);
'Do Both' : if stillDrinking then
bankScreen.clickButton(BANK_BUTTON_PRESET_1, true)
else bankScreen.clickButton(BANK_BUTTON_PRESET_2, true);
end;
until (tabBackPack.waitWhileLocked()) or (depositTimer.isFinished()) or (not isLoggedIn());
if not stillDrinking then
emptyJCount := (emptyJCount + tabBackPack.countDTM(emptyJDTM));
end;
{*To drink wine*}
procedure drink();
var T2, T3, T4, T5: TPoint;
var find1, find2: Integer;
var num: Integer;
begin
mousespeed := 120;
T2.x := 763; //giveortake 5
T2.y := 329; //giveortake 3
mouse(T2.x+(random(5)), T2.y+(random(4)), mouse_Left, MOUSE_ACCURATE);
mouse(610, 444, 5, 3, Mouse_left);
wait(randomrange(552, 800));
repeat
//antiban();
fastclick(mouse_left);
wait(randomrange(612, 654));
fastclick(mouse_left);
wait(randomrange(1894, 2145));
inc(num);
until (num=3056);
end;
{*Mainloop*}
procedure mainLoop();
begin
case toDo of
'Fill Jugs Only' : repeat
//toWithdraw();
if not tabBackPack.isEmpty() then
wait(10) //nothing here
else terminateScript();
until (ScriptTimer.getTime() = (runT + randomRange(-5, 6) * 60000)) or (not isLoggedIn());
'Drink Only' : drink();
//toWithdraw();
// if not tabBackPack.isEmpty() then
// else terminateScript();
'Do Both' : begin
repeat
stillDrinking := true;
toWithdraw();
if not tabBackPack.isEmpty() then
drink()
else break;
until (ScriptTimer.getTime() = (runT + randomRange(-5, 6) * 60000)) or (not isLoggedIn());
repeat
stillDrinking := false;
toWithdraw();
if not tabBackPack.isEmpty() then
wait(10)
else terminateScript();
until (ScriptTimer.getTime() = (runT + randomRange(-5, 6) * 60000)) or (not isLoggedIn());
end;
end;
end;
{Setup}
begin
clearDebug();
smartEnableDrawing := true;
smartShowConsole := false;
disableIPScreenshots := true;
disableSRLLog := true;
mouseSpeed := gaussRangeInt(40, 50);
initPlayerForm();
runPlayerForm();
if (not playerForm.isScriptReady) then exit;
installAssets;
declarePlayers();
loadResources();
addOnTerminate('freeBMPs');
addOnTerminate('freeTheDTM');
setupSRL();
logIn();
ScriptTimer.start();
BreakTimer.setTime((breakT * 60000) + (randomRange(-180, 301) * 1000));
ReloadTimer.setTime((480 + randomRange(-30, 31)) * 60000);
mainLoop();
end.