Simba Code:
{=~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=|
|=----------------------------------------------------------------------------=|
|= =|
|= Daemonheim Superheater v0.45 =|
|= =|
|= by: Runaway =|
|= =|
|=----------------------------------------------------------------------------=|
|= =|
|= This script superheats ores into bars at the Daemonheim bank. It =|
|= uses the unlimited teleports supplied by the dungeoneering ring =|
|= to return to the bank if anything goes wrong. =|
|= =|
|= How to use: =|
|= =|
|= 1) Fill out the setup below. =|
|= =|
|= 2) Place your character anywhere. =|
|= =|
|= 3) Equip: =|
|= - Ring of kinship =|
|= - Staff of fire =|
|= =|
|= 4) Place nature runes in the first slot of your inventory. =|
|= =|
|= 5) If using a coal bag, place it in the second slot of your =|
|= inventory. =|
|= =|
|= 6) Make sure the ores you're superheating are visible in =|
|= your bank. =|
|= =|
|= 7) Sort your spellbook by level and have all spells on. =|
|= =|
|= 8) Hit run! =|
|= =|
|= Requirements: =|
|= =|
|= 1) 43 Magic =|
|= =|
|=----------------------------------------------------------------------------=|
|=~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=}
program DaemonheimSuperheater;
{$DEFINE SMART}
{$i SRL/SRL.simba}
{$i SRL/SRL/skill/magic.simba}
var
DungToBank: array[0..1] of array[0..1] of array of Integer;
SteelColor, MithrilColor, AdamantColor, RuneColor: array[0..1] of array of Integer;
OreColor: array of array of Integer;
Uptext, Option: array of array of String;
NPC, BankerColor, NatureColor, CoalBagColor, IronColor, CoalColor, GoldColor: array of Integer;
BankOre: TPointArray;
NPCColor, Superheated, KinColor, StaffColor, SpellColor, RockColor, SmithLevel, MaxCount,
MaxNum, hBank, hUptext, BankFilter, Bag, BagInv, Loop, Mems, t, cx, cy: Integer;
Previous, HeatTime, BankTime, Aligned, Heated, BagDone: Boolean;
BarXP: Extended;
{=~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=|
|=-------------------------------=BEGIN-SETUP=--------------------------------=|
|=~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=}
const
BarToSmelt = 'steel'; // Valid choices: iron, steel, gold, mithril, adamant, rune
UseCoalBag = False; // Valid with: steel, mithril, adamant, rune
UserPin = ''; // Leave blank if not using a pin
TimeToRun = 720; // Minutes to run the script for (0 to run until stopped)
P2P = False;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
with Players[0] do
begin
Name := ''; // Player username
Pass := ''; // Player password
BoxRewards := ['XP', 'ostume', 'mote', 'oins', 'une', 'ssence'];
LampSkill := Skill_SMITHING;
Active := True;
end;
end;
procedure DeclareColors;
begin
// Only update if NPCs cannot be located \\
NPC := [2162687, 1900543, 1783370, 1702399, 1701113, 1505535, 1437694, 1374705, 1372665, 1244415, 1179647, 1179644, 1043199, 981753, 916991, 786430, 783103, 777964, 773595, 720883, 718847, 717815, 717567, 654579, 653311, 651775, 648667, 645348, 640979, 589823, 589311, 588280, 587000, 584957, 584171, 583916, 579817, 579802, 578776, 575448, 574407, 522732, 458751, 450798, 393210, 391151, 327667, 326911, 326385, 325112, 323558, 322788, 319972, 318418, 317648, 315603, 314049, 313279, 257009, 255470, 196604, 127367, 65522, 65233, 63478, 61670, 61439, 61150, 60651, 59355, 56781, 55511, 55014, 53474, 51142, 50645, 49105, 47302];
{=~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=|
|=-------------------------------=END-SETUP=----------------------------------=|
|=~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~=}
BankerColor := [2968144, 5408402, 8609098]; // Main color first
NatureColor := [1342225, 7631993];
CoalBagColor := [5402771, 3890564];
RockColor := 3559010;
IronColor := [1515317, RockColor];
CoalColor := [1976104, RockColor];
SteelColor[0] := IronColor;
SteelColor[1] := CoalColor;
GoldColor := [1608365, RockColor];
MithrilColor[0] := [5453623, RockColor];
MithrilColor[1] := CoalColor;
AdamantColor[0] := [4015933, RockColor];
AdamantColor[1] := CoalColor;
RuneColor[0] := [5722435, RockColor];
RuneColor[1] := CoalColor;
DungToBank[0][0] := [15198705, 10132641, 13619672, 15461616]; // Colors
DungToBank[0][1] := [638, 38]; // Sort point
DungToBank[1][0] := [15920097, 15922418, 13223098];
DungToBank[1][1] := [619, 36];
KinColor := 3162439;
StaffColor := 1911757;
SpellColor := 228588;
MMBox := IntToBox(MMX1, MMY1, MMX2, MMY2);
MSBox := IntToBox(MSX1, MSY1, MSX2, MSY2);
end;
const
Version = '0.45';
WalkTol = 30;
WalkMaxDist = 25;
WalkFilter = 25;
WalkTrim = 1000;
procedure ProgressReport; forward;
procedure Currently(Doing: String);
begin
Status(Doing);
DebugLn(Doing);
end;
procedure Error(Reason: String);
begin
Currently(Reason);
WriteLn('ERROR: '+ Reason);
Logout;
TerminateScript;
end;
procedure SetupVars;
var
LevelReq, i: Integer;
begin
Currently('Gathering data...');
LevelReq := 0;
if (BarToSmelt = '') then
Error('Enter the bar you want to superheat!');
case Lowercase(BarToSmelt) of
'iron':
begin
LevelReq := 15; BarXP := 12.5; MaxCount := 28; MaxNum := 28;
SetLength(OreColor, 1); SetLength(Uptext, 2); SetLength(Option, 1);
OreColor[0] := IronColor;
Uptext[0] := ['ir', 'ron', 'on']; Option[0] := ['ll b', 'but', 'one'];
Uptext[1] := ['ir', 'ron', 'on', 'ba', 'ar'];
end;
'steel':
begin
LevelReq := 30; BarXP := 17.5;
if UseCoalBag then
begin
MaxCount := 28; MaxNum := 19;
SetLength(Option, 2); BagInv := 1;
Option[0] := ['17']; Option[1] := ['ll b', 'but', 'one'];
end else
begin
MaxCount := 28; MaxNum := 10;
SetLength(Option, 2); BagInv := 0;
Option[0] := ['9']; Option[1] := ['ll b', 'but', 'one'];
end;
SetLength(OreColor, 2); SetLength(Uptext, 3);
OreColor[0] := SteelColor[0]; OreColor[1] := SteelColor[1];
Uptext[0] := ['ir', 'ron', 'on'];
Uptext[1] := ['oa', 'oal', 'al'];
Uptext[2] := ['st', 'tee', 'el', 'ba', 'ar'];
end;
'gold':
begin
LevelReq := 40; BarXP := 22.5; MaxCount := 28; MaxNum := 28;
SetLength(OreColor, 1); SetLength(Uptext, 2); SetLength(Option, 1);
OreColor[0] := GoldColor;
Uptext[0] := ['ol', 'old', 'ld']; Option[0] := ['ll b', 'but', 'one'];
Uptext[1] := ['ol', 'old', 'ld', 'ba', 'ar'];
end;
'mithril':
begin
LevelReq := 50; BarXP := 30;
if UseCoalBag then
begin
MaxCount := 28; MaxNum := 12;
SetLength(Option, 2); BagInv := 2;
Option[0] := ['10']; Option[1] := ['ll b', 'but', 'one'];
end else
begin
MaxCount := 26; MaxNum := 6;
SetLength(Option, 2); BagInv := 0;
Option[0] := ['5']; Option[1] := ['20'];
end;
SetLength(OreColor, 2); SetLength(Uptext, 3);
OreColor[0] := MithrilColor[0]; OreColor[1] := MithrilColor[1];
Uptext[0] := ['ith', 'thr', 'ril'];
Uptext[1] := ['oa', 'oal', 'al'];
Uptext[2] := ['ith', 'thr', 'ril', 'ba', 'ar'];
end;
'adamant':
begin
LevelReq := 70; BarXP := 37.5;
if UseCoalBag then
begin
MaxCount := 28; MaxNum := 9;
SetLength(Option, 2); BagInv := 3;
Option[0] := ['7']; Option[1] := ['ll b', 'but', 'one'];
end else
begin
MaxCount := 22; MaxNum := 4;
SetLength(Option, 2); BagInv := 0;
Option[0] := ['3']; Option[1] := ['18'];
end;
SetLength(OreColor, 2); SetLength(Uptext, 3);
OreColor[0] := AdamantColor[0]; OreColor[1] := AdamantColor[1];
Uptext[0] := ['dam', 'man', 'tit'];
Uptext[1] := ['oa', 'oal', 'al'];
Uptext[2] := ['dam', 'man', 'tit', 'ba', 'ar'];
end;
'rune':
begin
LevelReq := 85; BarXP := 50;
if UseCoalBag then
begin
MaxCount := 28; MaxNum := 7;
SetLength(Option, 2); BagInv := 6;
Option[0] := ['5']; Option[1] := ['ll b', 'but', 'one'];
end else
begin
MaxCount := 28; MaxNum := 4;
SetLength(Option, 2); BagInv := 0;
Option[0] := ['3']; Option[1] := ['ll b', 'but', 'one'];
end;
SetLength(OreColor, 2); SetLength(Uptext, 3);
OreColor[0] := RuneColor[0]; OreColor[1] := RuneColor[1];
Uptext[0] := ['un', 'ni', 'ite'];
Uptext[1] := ['oa', 'oal', 'al'];
Uptext[2] := ['un', 'ni', 'ite', 'ba', 'ar'];
end;
end;
if (LevelReq = 0) then
Error('Invalid bar entered!');
if (SmithLevel < LevelReq) then
Error('Not a high enough level to superheat '+ BarToSmelt +' bars!');
Bag := 0;
Mems := 0;
if UseCoalBag then
Bag := 1;
if P2P then
Mems := 24;
SetLength(BankOre, (Length(OreColor) + 1));
hBank := High(BankOre);
for i := 0 to hBank do
BankOre[i] := Point(MSCX, MSCY);
hUptext := High(Uptext);
end;
function ColorWait(WaitTime, Color, Tol: Integer; Box: TBox): Boolean;
var
i, x, y: Integer;
begin
if not LoggedIn then Exit;
Result := False;
MarkTime(i);
repeat
Result := FindColorTolerance(x, y, Color, Box.x1, Box.y1, Box.x2, Box.y2, Tol);
if Result then
Break;
Wait(100+Random(50));
until(TimeFromMark(i) > WaitTime);
end;
function ColorWaitMulti(WaitTime: Integer; Colors: TIntegerArray; Box: TBoxArray; Strict: Boolean): Boolean;
var
hColors, Res, i: Integer;
begin
if not LoggedIn then Exit;
Result := False;
Res := 0;
hColors := High(Colors);
for i := 0 to hColors do
begin
if ColorWait(WaitTime, Colors[i], 15, Box[i]) then
Inc(Res);
end;
if Strict then
begin
if (Res > hColors) then
Result := True;
end else
begin
if (Res > 0) then
Result := True;
end;
end;
procedure WaitLoggedIn(WaitTime: Integer);
var
HPBox: TBox;
begin
HPBox := IntToBox(695, 19, 718, 42);
while not ColorWait(WaitTime, 143319, 10, HPBox) do
Wait(WaitTime);
end;
function FindTPointCluster(Colors: TIntegerArray; Tol: Integer; SortFrom: TPoint; Filter, Trim, MaxDist: Integer; Box: TBox): TPointArray;
var
aPoints: T2DPointArray;
TPA: TPointArray;
hPoints, hColors: Integer;
cError, Len, Match: Integer;
t, r, i, ii: Integer;
begin
MarkTime(t);
SetLength(aPoints, Length(Colors));
hColors := High(Colors);
cError := 0;
r := 0;
for i := 0 to hColors do
begin
if (FindColorsTolerance(TPA, Colors[i], Box.x1, Box.y1, Box.x2, Box.y2, Tol)) then
begin
SortTPAFrom(TPA, SortFrom);
if (Filter <> -1) then
FilterPointsDist(TPA, 0, Filter, SortFrom.x, SortFrom.y);
if (Trim <> -1) and (Length(TPA) > Trim) then
SetLength(TPA, Trim);
aPoints[i - cError] := TPA;
end else
begin
Len := Length(aPoints) - 1;
SetLength(aPoints, Len);
Inc(cError);
end;
if (cError >= 1) then
Exit;
end;
hPoints := High(aPoints);
for i := 0 to High(aPoints[0]) do
begin
Match := 0;
for ii := 1 to hPoints do
begin
if NearbyPointInArray(aPoints[0][i], MaxDist, aPoints[ii]) then
begin
Inc(Match);
if (Match >= hPoints) then
begin
SetLength(Result, r + 1);
Result[r] := aPoints[0][i];
Inc(r);
end;
end else
Break;
end;
end;
SortTPAFrom(Result, SortFrom);
end;
function CheckInvColor(Color: TIntegerArray; Slot, Tol: Integer): Boolean;
var
TPA: TPointArray;
tSlot: TBox;
begin
if not LoggedIn then Exit;
Result := False;
tSlot := InvBox(Slot);
if ExistsItem(Slot) then
begin
TPA := FindTPointCluster(Color, Tol, Point(tSlot.x1, tSlot.y1), -1, -1, 20, tSlot);
Result := (Length(TPA) > 0);
end;
end;
function TabWait(WaitTime, Tab: Integer): Boolean;
var
i: Integer;
begin
if not LoggedIn then Exit;
Result := False;
MarkTime(i);
repeat
Result := (GetCurrentTab = Tab);
if Result then
Break;
Wait(100+Random(50));
until(TimeFromMark(i) > WaitTime);
end;
function GetInvData: Boolean;
begin
if not LoggedIn then Exit;
GameTab(tab_INV);
TabWait(1000, tab_INV);
Result := False;
HeatTime := False;
BankTime := False;
Result := CheckInvColor(OreColor[0], MaxNum, 5);
if Result then
HeatTime := True
else
BankTime := True;
end;
procedure Calibrate;
begin
if not LoggedIn then Exit;
ClickNorth(2);
KeyDown(VK_UP);
Wait(450+Random(100));
KeyUp(VK_UP);
end;
function Antiban: Boolean;
begin
if not LoggedIn then Exit;
Result := False;
FindNormalRandoms;
case Random(1600) of
1: begin Currently('Antiban...'); PickUpMouse; end;
2: begin Result := True; Currently('Antiban...'); BoredHuman; Calibrate; end;
3: begin Result := True; Currently('Antiban...'); RandomAngle(1); Calibrate; end;
4: begin Currently('Antiban...'); Wait(1000+Random(2500)); end;
5,6: begin Currently('Antiban...'); Wait(4000+Random(1000)); end;
7,8,9,10: begin Result := True; Currently('Antiban...'); RandomMovement; Calibrate; end;
end;
end;
procedure SetupPlay;
var
StaffBox, KinBox: TBox;
begin
if not LoggedIn then Exit;
StaffBox := IntToBox(572, 291, 600, 318);
KinBox := IntToBox(683, 371, 713, 386);
Currently('Setting up player...');
GameTab(tab_EQUIP);
TabWait(1000, tab_EQUIP);
if ColorWaitMulti(1000, [StaffColor, KinColor], [StaffBox, KinBox], True) then
Currently('Found staff of fire and ring of kinship!')
else
Error('Equip staff of fire and ring of kinship!');
GameTab(tab_STATS);
TabWait(1000, tab_STATS);
SmithLevel := GetSkillLevel(SKILL_SMITHING);
GameTab(tab_Magic);
TabWait(1000, tab_MAGIC);
SetSpellMode(True, True, True, True);
SortBook(BOOKSORT_LEVEL);
GameTab(tab_INV);
TabWait(1000, tab_INV);
if CheckInvColor(NatureColor, 1, 5) then
Currently('Found nature runes in first slot!')
else
Error('Place nature runes in first slot of inventory!');
if UseCoalBag then
begin
if CheckInvColor(CoalBagColor, 2, 10) then
Currently('Found coal bag in second slot!')
else
Error('Place coal bag in second slot of inventory!');
end;
end;
function Teleport(Which: String; Tries: Integer): Boolean;
var
CoordBox, ClanBox: TBox;
Color, i, x, y: Integer;
Area: String;
Clan: Boolean;
begin
if not LoggedIn then Exit;
case Lowercase(Which) of
'dung':
begin
Color := KinColor; CoordBox := IntToBox(683, 371, 713, 386); Clan := False;
Area := 'daemonheim';
end;
end;
i := 0;
repeat
AntiBan;
Currently('Teleporting to '+ Area +': Attempt '+ IntToStr(i + 1) +'...');
GameTab(tab_EQUIP);
TabWait(1000, tab_EQUIP);
if ColorWait(2000, Color, 10, CoordBox) then
begin
MouseTBox(CoordBox, mouse_right);
Result := WaitOptionMulti(['ele','port'], 2000);
if Result then
begin
{if Clan then
begin
ClanBox := IntToBox(223, 402, 298, 411);
if ColorWait(2000, 2169874, 10, ClanBox) then
MouseTBox(ClanBox, mouse_left);
Break;
end;}
Break;
end else
begin
GetMousePos(x, y);
MMouse((x+RandomRange(-30,30)), (y-50-Random(50)), 5, 5);
Wait(250+Random(250));
end;
end;
Inc(i);
until(i > Tries);
GameTab(tab_INV);
if Result then
Currently('Teleported to '+ Area +'!')
else
Currently('Failed to teleport to '+ Area +'!');
end;
function AtArea(Which: String; WaitTime: Integer): Boolean;
var
aTPA: T2DPointArray;
TPA: TPointArray;
Color: array of Integer;
t, i: Integer;
Area: String;
begin
if not LoggedIn then Exit;
case Lowercase(Which) of
'dung':
begin
Color := [6251366, 15525876, 10986156, 13550787];
Area := 'daemonheim';
end;
'bank':
begin
Color := [15526372, 14144976, 5263951, 2413294, 9002045, 262643];
Area := 'the bank';
end;
end;
MarkTime(i);
repeat
for t := 20 to 30 do
begin
Currently('Searching for '+ Area +': Tolerance is '+ IntToStr(t) +'...');
TPA := FindTPointCluster(Color, t, Point(MMCX, MMCY), -1, -1, 100, MMBox);
aTPA := SplitTPA(TPA, 100);
if (Length(aTPA) > 0) then
begin
Result := True;
Currently('At '+ Area +'!');
Break;
end;
Wait(200+Random(50));
end;
until(i > WaitTime);
end;
procedure WaitMoving(WaitTime: Integer);
var
t: Integer;
begin
MarkTime(t);
while IsMoving or FlagPresent do
begin
if (TimeFromMark(t) > WaitTime) then
Exit;
Wait(200);
end;
end;
function GetNPCDotColor: Boolean;
var
aTPA: T2DPointArray;
TPA: TPointArray;
Color: array of Integer;
i: Integer;
begin
if not LoggedIn then Exit;
Currently('Grabbing NPC dot color...');
Result := False;
for i := 0 to High(NPC) do
begin
Color := [NPC[i], 65536];
TPA := FindTPointCluster(Color, 5, Point(MMCX, MMCY), -1, -1, 5, MMBox);
aTPA := SplitTPA(TPA, 10);
if (Length(aTPA) > 0) then
begin
Result := True;
NPCColor := NPC[i];
Break;
end;
end;
if Result then
Currently('Found NPC color: '+ IntToStr(NPCColor))
else
Error('NPC color not found! See thread for fix.');
end;
procedure AlignWalking(Which: String; WaitTime: Integer);
var
aTPA: T2DPointArray;
TPA: TPointArray;
CustomMMBox: TBox;
Color, Points: array of Integer;
ArrFilter, i, x, y: Integer;
begin
if not LoggedIn then Exit;
case Lowercase(Which) of
'bank':
begin
Color := [NPCColor, 65536]; Points := [627, 69];
ArrFilter := -1;
end;
end;
CustomMMBox := IntToBox(MMX1, (MMCY - 40), (MMCX + 12), MMY2);
Currently('Aligning walk path...');
Aligned := False;
MarkTime(i);
repeat
TPA := FindTPointCluster(Color, 10, Point(MMCX, MMCY), ArrFilter, -1, 20, CustomMMBox);
aTPA := SplitTPA(TPA, 10);
if (Length(aTPA) > 0) then
begin
x := MiddleTPA(aTPA[0]).x;
y := MiddleTPA(aTPA[0]).y;
cx := Points[0] - x;
cy := Points[1] - y;
Currently('Altered walk path by: ('+IntToStr(cx)+', '+IntToStr(cy)+')');
Aligned := True;
Break;
end;
until(TimeFromMark(i) > WaitTime);
end;
function WalkTo(Which: String): Boolean;
var
Arr: array of array of array of Integer;
aTPA: T2DPointArray;
TPA: TPointArray;
P: TPoint;
hArr, c, i, t, h: integer;
Current: Boolean;
Area: String;
begin
if not LoggedIn then Exit;
h := 0;
case Lowercase(Which) of
'bank':
begin
SetLength(Arr, Length(DungToBank));
for i := 0 to High(Arr) do
begin
SetLength(Arr[i], 2);
Arr[i][0] := DungToBank[i][0];
if Aligned then
h := 17;
Arr[i][1] := [DungToBank[i][1][0] - cx + h, DungToBank[i][1][1] - cy];
cx := 0;
cy := 0;
end;
Area := 'bank';
end;
end;
hArr := High(Arr);
MakeCompass('n');
for c := 0 to hArr do
begin
Current := False;
for i := 0 to 10 do
begin
Currently('Walking to '+ Area +' ('+ IntToStr(c + 1) +' of '+ IntToStr(Length(Arr)) +'): Tolerance is '+ IntToStr(WalkTol + i) +'...');
TPA := FindTPointCluster(Arr[c][0], (WalkTol + i), Point(Arr[c][1][0], Arr[c][1][1]), WalkFilter, WalkTrim, WalkMaxDist, MMBox);
aTPA := SplitTPA(TPA, WalkMaxDist);
if (Length(aTPA) > 0) then
begin
for t := 0 to High(aTPA) do
begin
P := MiddleTPA(aTPA[t]);
if (not rs_OnMinimap(P.x, P.y)) then
Continue;
Mouse(P.x, P.y, 3, 3, mouse_left);
Wait(1000+Random(500));
WaitMoving(15000);
if (c = hArr) then
begin
Result := True;
Exit;
end;
Current := True;
Break;
end;
if Current then
Break;
end;
Wait(100+Random(50));
end;
AntiBan;
end;
end;
function BankOpened: Boolean;
var
Box: TBox;
begin
if not LoggedIn then Exit;
Box := IntToBox(464, 28, 477, 42);
Result := ColorWait(2000, 5005673, 10, Box);
end;
procedure BankAdjust(Min: Integer);
var
TPA: TPointArray;
SymbolColor: array of Integer;
P, Diff, Mid: TPoint;
Dist: Integer;
begin
if not LoggedIn then Exit;
SymbolColor := [2413294, 12632256, 65536];
TPA := FindTPointCluster(SymbolColor, 10, Point(MMCX, MMCY), -1, -1, 10, MMBox);
if (Length(TPA) >= Min) then
begin
P := MiddleTPA(TPA);
Dist := Distance(P.x, P.y, MMCX, MMCY);
if (Dist > 20) then
begin
Diff := Point(P.x - MMCX, P.y - MMCY);
Mid := Point(((Diff.x / 2) + MMCX), ((Diff.y / 2) + MMCY));
Mouse(Mid.x, Mid.y, 2, 2, mouse_left);
Currently('Moving closer to bank...');
Wait(500+Random(500));
WaitMoving(5000);
Exit;
end else
begin
Currently('Close enough to bank...');
Exit;
end;
end else
Currently('Could not find bank symbol...');
end;
function OpenDungBank: Boolean;
var
aTPA: T2DPointArray;
TPA: TPointArray;
P: TPoint;
CustomMSBox: TBox;
c, t, i: Integer;
begin
if not LoggedIn then Exit;
CustomMSBox := IntToBox(MSX1, MSY1, MSCX + 110, MSY2);
BankAdjust(4);
TabWait(1000, tab_INV);
for c := 25 to 35 do
begin
Currently('Opening bank: Tolerance is '+ IntToStr(c) +'...');
TPA := FindTPointCluster(BankerColor, c, BankOre[hBank], 180, -1, 50, CustomMSBox);
aTPA := TPAToATPA(TPA, 60);
if (Length(aTPA) > 0) then
begin
SortATPAFromMidPoint(aTPA, Point((MSCX - 150), MSCY));
for t := 0 to High(aTPA) do
begin
P := MiddleTPA(aTPA[t]);
MMouse(P.x, P.y, 3, 3);
Wait(300+Random(100));
if WaitUptextMulti(['remen', 'nnik', 'anker'], 500) then
begin
ClickMouse2(mouse_right);
if WaitOption('ank Fr', 1000) then
begin
Wait(500+Random(500));
MarkTime(i);
repeat
Result := BankOpened or PinScreen;
if Result then
begin
BankOre[hBank] := Point(P.x, P.y);
Break;
end;
Wait(200+Random(50));
until(TimeFromMark(i) > 5000);
if Result then
begin
Currently('Bank opened!');
Exit;
end else
Currently('Failed to open bank!');
end;
end;
if (t >= 2) then
Break;
end;
end;
end;
if not Result then
Currently('Failed to open bank!');
end;
function HandleCoalBag: Boolean;
var
aTPA: T2DPointArray;
TPA: TPointArray;
Time, x, y, t, i: Integer;
Slot: TBox;
begin
if not LoggedIn then Exit;
Result := False;
Currently('Filling coal bag...');
MarkTime(Time);
repeat
TPA := FindTPointCluster(OreColor[1], 10, BankOre[1], BankFilter, -1, 15, MSBox);
aTPA := SplitTPA(TPA, 20);
if (Length(aTPA) > 0) then
begin
for t := 0 to High(aTPA) do
begin
x := MiddleTPA(aTPA[t]).x;
y := MiddleTPA(aTPA[t]).y;
MMouse(x, y, 3, 3);
Wait(300+Random(100));
if WaitUptextMulti(Uptext[1], 400) then
begin
Mouse(x, y, 0, 0, mouse_right);
if WaitOptionMulti(Option[1], 1000) then
begin
BankOre[1] := Point(x, y);
Result := True;
Wait(400+Random(300));
Break;
end;
end else
begin
if (BankOre[1] <> Point(MSCX, MSCY)) then
begin
Mouse(x, y, 0, 0, mouse_right);
if WaitOptionMulti(Option[1], 1000) then
begin
BankOre[1] := Point(x, y);
Result := True;
Wait(400+Random(300));
Break;
end;
end;
end;
end;
end;
if Result then
begin
Slot := InvBox(2);
MouseBox(Slot.x1, Slot.y1, Slot.x2, Slot.y2, mouse_right);
if WaitOption('ill', 1000) then
begin
Currently('Coal bag filled!');
Wait(400+Random(300));
BagDone := True;
Break;
end;
end;
until(TimeFromMark(Time) > (20 * 1000));
Currently('Depositing excess coal...');
for i := (2 + Bag) to 28 do
begin
if (InvCount < (2 + Bag + BagInv)) then
Break;
if ExistsItem(i) then
begin
Slot := InvBox(i);
MouseBox(Slot.x1, Slot.y1, Slot.x2, Slot.y2, mouse_move);
if WaitUptextMulti(Uptext[hUptext], 200) then
begin
ClickMouse2(mouse_right);
WaitOptionMulti(['ll', 'epo', 'osit'], 1000);
Wait(150+Random(150));
end else
begin
if (i <= MaxNum) then
begin
ClickMouse2(mouse_right);
WaitOptionMulti(['ll', 'epo', 'osit'], 1000);
Wait(150+Random(150));
end else
ClickMouse2(mouse_left);
end;
Wait(400+Random(400));
end;
end;
Currently('Excess coal deposited!');
if not BagDone then
Currently('Failed to fill coal bag...');
end;
function DoBanking: array of Boolean;
var
Tries, hOre, Time1, Time2, h, r, t, i, x, y: Integer;
aTPA: T2DPointArray;
TPA: TPointArray;
tSlot: TBox;
Primary: Boolean;
begin
if not LoggedIn then Exit;
BagDone := False;
if (PinScreen and (UserPin <> '')) then
InPin(UserPin);
if BankOpened then
begin
r := 0;
Primary := False;
SetLength(Result, Length(OreColor));
Currently('Depositing '+ BarToSmelt +' bars...');
MarkTime(Time1);
repeat
if (InvCount < (2 + Bag + BagInv)) then
Break
else
begin
for i := (2 + Bag) to 28 do
begin
if (InvCount < (2 + Bag + BagInv)) then
Break;
if ExistsItem(i) then
begin
tSlot := InvBox(i);
MouseTBox(tSlot, mouse_move);
if WaitUptextMulti(Uptext[hUptext], 200) then
begin
ClickMouse2(mouse_right);
WaitOptionMulti(['ll', 'epo', 'osit'], 1000);
Wait(150+Random(150));
end else
begin
if (i <= MaxNum) then
begin
ClickMouse2(mouse_right);
WaitOptionMulti(['ll', 'epo', 'osit'], 1000);
Wait(150+Random(150));
end else
MouseTBox(tSlot, mouse_left);
end;
Wait(400+Random(400));
end;
end;
end;
until((InvCount < (2 + Bag + BagInv)) or (TimeFromMark(Time1) > (30 * 1000)));
Wait(500+Random(250));
if (InvCount < (2 + Bag + BagInv)) then
Currently('Deposited '+ BarToSmelt +' bars!')
else
Error('Failed to bank '+ BarToSmelt +' bars!');
r := 0;
Currently('Withdrawing ores...');
MarkTime(Time2);
hOre := High(OreColor);
repeat
if (UseCoalBag and not BagDone) then
HandleCoalBag;
for h := 0 to hOre do
begin
Result[h] := False;
if ((h > 0) and not Primary) then
Break;
if ((h = 0) and Primary) then
Break;
TPA := FindTPointCluster(OreColor[h], 5, BankOre[h], BankFilter, -1, 15, MSBox);
aTPA := SplitTPA(TPA, 20);
if (Length(aTPA) > 0) then
begin
for t := 0 to High(aTPA) do
begin
x := MiddleTPA(aTPA[t]).x;
y := MiddleTPA(aTPA[t]).y;
MMouse(x, y, 3, 3);
Wait(300+Random(100));
if WaitUptextMulti(Uptext[h], 400) then
begin
if ((Option[h][0] = '3') and (MaxCount < 28)) then
begin
Tries := 0;
repeat
ClickMouse2(mouse_left);
Wait(400+Random(400));
if CheckInvColor(OreColor[0], MaxNum, 5) then
begin
Result[h] := True;
BankOre[h] := Point(x, y);
if (h = 0) then
Primary := True;
Break;
end else
Inc(Tries);
until(Tries > 4);
end else
begin
ClickMouse2(mouse_right);
if WaitOptionMulti(Option[h], 1000) then
begin
Result[h] := True;
BankOre[h] := Point(x, y);
if (h = 0) then
Primary := True;
Wait(400+Random(300));
if Result[hOre] then
Break;
end else
begin
Mouse(x, y, 0, 0, mouse_right);
if WaitOption('X', 1000) then
begin
Wait(1500+Random(1000));
TypeSendEx(Option[h][0], True);
Result[h] := True;
BankOre[h] := Point(x, y);
if (h = 0) then
Primary := True;
Wait(400+Random(300));
Break;
end;
end;
end;
end else
begin
if (BankOre[h] <> Point(MSCX, MSCY)) then
begin
ClickMouse2(mouse_right);
if WaitOptionMulti(Option[h], 1000) then
begin
Result[h] := True;
BankOre[h] := Point(x, y);
if (h = 0) then
Primary := True;
Wait(400+Random(300));
if Result[hOre] then
Break;
end;
end;
end;
end;
TPA := [];
end;
if Result[hOre] then
Break;
end;
if (InvCount >= MaxCount) then
begin
if CheckInvColor(OreColor[0], (2 + Bag), 5) and
CheckInvColor(OreColor[0], MaxNum, 5) and
CheckInvColor(OreColor[hOre], MaxCount, 5) then
begin
Break;
end else
begin
for i := (2 + Bag) to 28 do
begin
if ExistsItem(i) then
begin
tSlot := InvBox(i);
MouseTBox(tSlot, mouse_right);
if WaitOptionMulti(['ll', 'epo', 'osit'], 1000) then
begin
Wait(300+Random(100));
Continue;
end;
end;
end;
Primary := False;
end;
end;
until(TimeFromMark(Time2) > (30 * 1000));
Wait(500+Random(250));
if (InvCount >= MaxCount) then
begin
if not CheckInvColor(OreColor[hOre], MaxCount, 5) then
Error('Not enough ores!');
Currently('Withdrew ores!');
CloseBank;
end else
Error('Not enough ores!');
if (BankOre[h] <> Point(MSCX, MSCY)) then
BankFilter := 25;
end;
end;
function ChooseSpell: Boolean;
var
Time: Integer;
SpellBox: TBox;
begin
if not LoggedIn then Exit;
Result := False;
SpellBox := IntToBox(616 + Mems, 322, 627 + Mems, 332);
MarkTime(Time);
repeat
if not TabWait(2000, tab_MAGIC) then
GameTab(tab_MAGIC);
if ColorWait(2000, SpellColor, 10, SpellBox) then
begin
Wait(150+Random(50));
MouseTBox(SpellBox, mouse_left);
Result := True;
Break;
end;
until(TimeFromMark(Time) > 5000);
end;
function Superheat(Slot: Integer): Boolean;
var
Tries: Integer;
tSlot: TBox;
begin
if not LoggedIn then Exit;
Tries := 0;
Result := False;
if Previous then
begin
if not ChooseSpell then
Error('Out of nature runes!');
Wait(225+Random(100));
end;
repeat
if (Antiban and not Heated) then
ChooseSpell;
if CheckInvColor(OreColor[0], Slot, 5) then
begin
tSlot := InvBox(MaxNum);
Currently('Superheating: Slot '+ IntToStr(Slot) +'...');
MouseTBox(tSlot, mouse_left);
if (Slot = MaxNum) then
Heated := True;
Result := True;
Previous := True;
Wait(225+Random(100));
Exit;
end else
Inc(Tries);
until(Tries > 1);
if (Tries > 1) then
Previous := False;
end;
procedure HeatProc;
var
i: Integer;
begin
if HeatTime then
begin
for i := (2 + Bag) to MaxNum do
begin
if Heated then
Break;
if Superheat(i) then
begin
Inc(Superheated);
ProgressReport;
end;
end;
Wait(300+Random(100));
GameTab(tab_INV);
TabWait(1000, tab_INV);
if CheckInvColor(OreColor[0], MaxNum, 5) then
Heated := False;
end;
end;
procedure BankProc;
var
c, t, i: Integer;
begin
if BankTime then
begin
if AtArea('bank', 5000) then
begin
MarkTime(c);
repeat
if OpenDungBank then
begin
DoBanking;
Heated := False;
Previous := True;
end else
begin
Wait(500+Random(500));
Antiban;
end;
GetInvData;
until(HeatTime or (TimeFromMark(c) > (20 * 1000)));
end else
begin
if Teleport('dung', 2) then
begin
MarkTime(t);
Wait(6000+Random(3000));
repeat
if AtArea('dung', 1000) then
Break;
Wait(500+Random(250));
Antiban;
until(TimeFromMark(t) > 12000);
end;
if AtArea('dung', 2000) then
begin
Calibrate;
GetNPCDotColor;
AlignWalking('bank', 5000);
WalkTo('bank');
MarkTime(i);
repeat
if AtArea('bank', 1000) then
Break;
Wait(500+Random(250));
Antiban;
until(TimeFromMark(i) > 5000);
BankOre[hBank] := Point(MSCX, MSCY);
end;
end;
end;
end;
procedure HeatLoop(Tries: Integer);
var
i: Integer;
begin
i := 0;
repeat
if (i > 0) then
begin
if Heated then Exit;
Currently('Trying again...');
end;
GetInvData;
if BankTime then
Exit;
HeatProc;
GetInvData;
Inc(i);
until(BankTime or (i > Tries));
if (HeatTime or (not BankTime)) then
Error('Superheating messed up!');
end;
procedure BankLoop(Tries: Integer);
var
i: Integer;
begin
i := 0;
repeat
if (i > 0) then
begin
Currently('Trying again...');
Calibrate;
end;
GetInvData;
if HeatTime then
Exit;
BankProc;
GetInvData;
Inc(i);
until(HeatTime or (i > Tries));
if (BankTime or (not HeatTime)) then
Error('Banking messed up!');
end;
procedure ProgressReport;
begin
ClearDebug;
WriteLn(' Runaways v'+ Version +'!');
WriteLn('<=----------- Daemonheim Superheater ----------=>');
WriteLn('| Running for: '+ TimeRunning);
WriteLn('| Superheated: '+ IntToStr(Superheated) +' '+ BarToSmelt +' bars');
WriteLn('| Magic XP gained: '+ IntToStr(Superheated * 53) +' XP');
WriteLn('| Smithing XP gained: '+ IntToStr(Round(Superheated * BarXP)) +' XP');
WriteLn('<=---------------------------------------------=>');
end;
procedure SetupScript;
begin
ClearDebug;
Superheated := 0;
Previous := True;
Heated := False;
BankFilter := -1;
Currently('Setting up Script...');
{$IFDEF SIMBAMAJOR980}//<--- THIS
Smart_Server := 0;
Smart_Members := False;
Smart_Signed := True;
Smart_SuperDetail := False;
{$ELSE}//<--- THIS
SRL_SIXHOURFIX := TRUE;
SMART_FIXSPEED := TRUE;
{$ENDIF}
SetupSRL;
SetupMagic;
DeclarePlayers;
DeclareColors;
ActivateClient;
if not LoggedIn then
LoginPlayer;
WaitLoggedIn(2000);
ProgressReport;
end;
begin
SetupScript;
MouseSpeed := (14 + Random(6));
SetupPlay;
SetupVars;
GetInvData;
SetChat('hide', 1);
Calibrate;
Loop := 0;
MarkTime(t);
if BankTime then
BankLoop(2);
repeat
HeatLoop(2);
if (Loop >= 10) then
begin
Calibrate;
Loop := 0;
end;
BankLoop(2);
Inc(Loop);
until((TimeToRun <> 0) and (TimeFromMark(t) > (TimeToRun * (60 * 1000))));
end.