PDA

View Full Version : skill/summoning.simba



Le Jingle
10-25-2012, 06:42 AM
An include file I'd written up a while ago, remembered it only now because of double experience weekend.

Thought I'd post it here instead of trying to commit it on git, as I've no time to update it. (IIRC, there's some other ideas at the top + I think the big function case needs to not be a variant)

So yeah, feel free to help make it worthy (maybe) of being updated and added.

Cheers,
Lj
:)

Edit: Updated it. Should work fine for functions included in the file. I'll see if I can figure out how to get coh3n to see it on git to approve/disapprove.

Coh3n
10-25-2012, 10:02 PM
Skill files (with the exception of magic.simba) are better in the snippets section. This is because they easily get forgotten about, or they're not used. For SRL-6 we won't have any skill files (magic.simba will be under gametab/).

I'll move this to snippets as I'm sure there are people that will find it useful. :)

Le Jingle
10-27-2012, 02:46 AM
Skill files (with the exception of magic.simba) are better in the snippets section. This is because they easily get forgotten about, or they're not used. For SRL-6 we won't have any skill files (magic.simba will be under gametab/).

I'll move this to snippets as I'm sure there are people that will find it useful. :)

Ah! okay cool, I didn't know that, but do indeed like the sounds of that :)

Cheers,
Lj

Brandon
10-27-2012, 03:34 AM
Ahh Nice..

Here's my snippets from a while back which I was planning on using for an all-in-one Script (10+ in one).

Might be a bit outdated.. Useful.Simba LOL. You might find it useful? Iunno. One or two are written by others.


{$IFNDEF SIMBA}
{$I SRL/SRL.Simba}
{$ENDIF}

{$I SRL/SRL/Skill/Fighting.simba}

type
RCAltar = (ALTAR_NATURE, ALTAR_ASTRAL, ALTAR_BLOOD, ALTAR_DEATH, ALTAR_AIR, ALTAR_FIRE, ALTAR_EARTH, ALTAR_WATER, ALTAR_MIND, ALTAR_ZMI);
HybridArmour = (HYBRID_BATTLEMAGE, HYBRID_TRICKSTER, HYBRID_VANGUARD);

var
AirRuneDTM, AstralRuneDTM, CosmicRuneDTM, LawRuneDTM, RuneRepairDTM, WaitFight_Shield, WaitFight_Damage: Integer;
SmallPouch, MediumPouch, LargePouch, GiantPouch, EssenceDTM, RingDTM, RingCount, GraahkDTM, SummoningPotion: Integer;


Procedure ShutdownScript(Reason: String);
begin
if BankScreen then
CloseBank;
Logout;
writeln('~Shutdown~ ' + Reason);
TerminateScript;
end;

Function CountColorSpeed(Color, Tolerance: Integer; Area: TBox; Speed: TExtendedArray): Integer;
var
CTS: Integer;
begin
if (Length(Speed) < 2) then
Exit;
CTS:= GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Speed[0], Speed[1]);
Result:= CountColorTolerance(Color, Area.X1, Area.Y1, Area.X2, Area.Y2, Tolerance);
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
end;

Function UnderAttack(FightTimer: Integer): Boolean;
Var
Time, X, Y: integer;
begin
if (Not InFight) then
begin
Result:= False;
Exit;
end;

MarkTime(Time);
repeat
Wait(50+Random(50));
if(FindDTM(WaitFight_Shield, X, Y, MSCX - 60, MSCY - 70, MSCX + 60, MSCY + 70)) or (FindDTM(WaitFight_Damage, X, Y, MSCX - 60, MSCY - 70, MSCX + 60, MSCY + 70)) then
begin
Result:= True;
Break;
end;
until(TimeFromMark(Time) > FightTimer);
end;

Function FindObjectMS(Color, Tolerance: Integer; Speed: TExtendedArray): TPointArray;
var
CTS: Integer;
TPA: TPointArray;
begin
if (Length(Speed) < 2) then
Exit;
CTS:= GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Speed[0], Speed[1]);
FindColorsTolerance(TPA, Color, MSX1, MSY1, MSX2, MSY2, Tolerance);
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.02, 0.02);
Result:= TPA;
end;

Function FindObjectInObject(TPA: TPointArray; Color, Width, Height, Tolerance: Integer; Speed: TExtendedArray): TPointArray;
var
CTS, L, I: Integer;
TPACopy: TPointArray;
ATPA, ATPA2: T2DPointArray;
B: TBox;
begin
if (Length(Speed) < 2) then
Exit;
CTS:= GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(Speed[0], Speed[1]);

if (Length(TPA) < 1) then
Exit;

TPACopy:= TPA;//CopyTPA(TPA);
if (Length(TPACopy) < 1) then
Exit;

ATPA:= TPAToATPAEx(TPACopy, Width, Height);
SortATPASize(ATPA, True);
L := High(ATPA);
SetArrayLength(ATPA2, L+1);

For I:= 0 To L do
begin
B := GetTPABounds(ATPA[I]);
with B do
begin
FindColorsTolerance(ATPA2[I], Color, B.X1, B.Y1, B.X2, B.Y2, Tolerance);
if (Length(ATPA2[I]) < 1) then
Continue;
end;
end;
if (Length(ATPA2) > 0) then
Result:= MergeATPA(ATPA2)
else
Result:= [];

ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.02, 0.02);
end;

Function FoundSymbol(Symbol: Integer; var Point: TPoint; var Dist: Integer): Boolean;
var
CTS, I, L: Integer;
TPA, ColorTPA: TPointArray;
ATPA: T2DPointArray;
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
FindColorsTolerance(TPA, 12632256, MMX1, MMY1, MMX2, MMY2, 5);
FilterPointsPie(TPA, 0.01, 360.0, 0.0, 75.0, MMCX, MMCY);
ColorToleranceSpeed(CTS);
If Length(TPA) < 1 then
Exit;

ATPA:= TPAToATPAEx(TPA, 10, 10);
L:= High(ATPA);
For I:= 0 To L Do
begin
Case Symbol Of
1: ColorTPA:= FindObjectInObject(TPA, 1260388, 10, 10, 5, [0.2, 0.2]); //Mining Symbol.
2: ColorTPA:= FindObjectInObject(TPA, 2413294, 10, 10, 5, [0.2, 0.2]); //Bank Symbol.
3: ColorTPA:= FindObjectInObject(TPA, 1600233, 10, 10, 5, [0.2, 0.2]); //Transport Symbol.
4: ColorTPA:= FindObjectInObject(TPA, 2369228, 10, 10, 5, [0.2, 0.2]); //Minigame Symbol.
5: ColorTPA:= FindObjectInObject(TPA, 9002045, 10, 10, 5, [0.2, 0.2]); //Summoning Symbol.
6: ColorTPA:= FindObjectInObject(TPA, 5526617, 10, 10, 5, [0.2, 0.2]); //Hunting Symbol.
7: ColorTPA:= FindObjectInObject(TPA, 608765, 10, 10, 5, [0.2, 0.2]); //Runecrafting Symbol.
end;
Result := (Length(ColorTPA) > 0);
If Result then
begin
Point:= MiddleTPA(ColorTPA);
Dist := Distance(MMCX, MMCY, Point.X, Point.Y);
Exit;
end;
end;
end;

Function Location(Where: String): Boolean;
var
Dist: Integer;
P: TPoint;
begin
MakeCompass('N');
Case LowerCase(Where) Of
'cw':
Result := (FoundSymbol(2, P, Dist) OR FoundSymbol(4, P, Dist));
'naturejungle':
Result := (FoundSymbol(3, P, Dist) AND FoundSymbol(6, P, Dist));
'altar':
Result := (FoundSymbol(3, P, Dist) AND (NOT FoundSymbol(6, P, Dist)));
'ruins':
Result := FoundSymbol(7, P, Dist);
else
writeln('Invalid Location');
end;
end;

Function WaitAmount(Item, Amount, TimeToWait: Integer; CountStacks: Boolean): Integer;
var
T, Count: integer;
begin
Count:= 0; Result:= 0;
T := (GetSystemTime + TimeToWait);
while (GetSystemTime < t) do
begin
if CountStacks then
Count:= ItemAmount('inv', 'dtm', Item, [])
else
Count:= CountItemsIn('inv', 'dtm', Item, []);
if (Count >= Amount) then
begin
Result:= Count;
Break;
end;
Wait(50);
end;
end;

Function WaitGameTab(Tab, TimeToWait: Integer; ActivateTab: Boolean): Boolean;
Var
T: Integer;
begin
Result := False;
T := GetSystemTime + TimeToWait;
while (GetSystemTime < T) do
begin
If ActivateTab then
GameTab(Tab);
if (GetCurrentTab = Tab) then
begin
Result := True;
Exit;
end;
Wait(20 + Random(10));
end;
end;

Function CountMultiOptions(Search: TStringArray): Integer;
var
I, J, L, H, Found: Integer;
Options: Array Of TOptions;
begin
Found:= 0;
Options:= GetChooseOptions('All');
if (Length(Options) < 1) then
Exit;

H:= High(Options);
L:= High(Search);

For I:= 0 To L do
For J:= 0 To H do
if (Pos(LowerCase(Search[I]), LowerCase(Options[J].Str)) > 0) then
Inc(Found);

Result:= Found;
end;

Function WaitFindNPCOptionsMulti(Texts: TStringArray; Action: Fnct_ActionOptions; TimeToWait: Integer): Boolean;
var
T: Integer;
begin
T := (GetSystemTime + TimeToWait);
while (GetSystemTime < t) do
begin
if (FindNPCChatTextMulti(Texts, Action)) then
begin
Result:= True;
Break;
end;
Wait(50);
end;
end;

Function GetNPCTextMulti(Color, Tolerance: Integer): TStringArray;
var
I, L, Y1, Y2: Integer;
begin
Y1:= 382; Y2:= 393;

If ((Not FindColorTolerance(I, I, Color, 141, 382, 495, 453, Tolerance)) or (Not AreTalking)) then
Exit;

SetLength(Result, 8); L:= 7;
For I:= 0 To 3 Do
begin
Result[I]:= GetTextAtExWrap(141, Y1, 495, Y2, 0, 5, 2, Color, Tolerance, 'UpChars');
Replace(Result[I], '?', '.');
Result[I]:= Trim(Result[I]);
IncEx(Y1, 15); IncEx(Y2, 15);
end;

Y1:= 390; Y2:= 406;
For I:= 4 To 7 Do
begin
Result[I]:= GetTextAtExWrap(141, Y1, 495, Y2, 0, 5, 2, Color, Tolerance, 'UpChars');
Replace(Result[I], '?', '.');
Result[I]:= Trim(Result[I]);
IncEx(Y1, 15); IncEx(Y2, 15);
end;

For I:= 0 To L Do
While ((L > -1) and ((Not ExecRegExpr('[A-Za-z0-9]', Result[I])) or ExecRegExpr('!!|,,|,\.|\.,|"|\^\.', Result[I]))) Do
begin
DeleteValueInStrArray(Result, I);
I:= 0; L:= High(Result);
end;
end;

Function AppendStringArrays(Texts, ToAppend: TStringArray): TStringArray;
var
I, J, K: Integer;
begin
J:= High(ToAppend);
K:= Length(Texts);
Setlength(Texts, J + K + 1);
For I:= 0 to J do
Texts[I + K] := ToAppend[I];

Result:= Texts;
end;

Function NPCTextsContain(Texts: TStringArray; TextColor, ColourTolerance: Integer): Boolean;
var
NPCTexts: TStringArray;
I, J, K, L: Integer;
begin
NPCTexts:= GetNPCTextMulti(TextColor, ColourTolerance);
If (Length(NPCTexts) < 1) then
Exit;

L:= High(NPCTexts);
K:= High(Texts);
For I:= 0 To K Do
For J:= 0 To L Do
If (Pos(Texts[I], NPCTexts[J]) > 0) Then
begin
Result:= True;
Exit;
end;
end;

Function WaitFindNPCTextMulti(Texts: TStringArray; Converse: Boolean; TimeToWait: Integer): Boolean;
var
T: Integer;
begin
T := (GetSystemTime + TimeToWait);
while (GetSystemTime < t) do
begin
if NPCTextsContain(Texts, clBlack, 10) then
begin
if Converse then
DoConversation('', False);
Result:= True;
Break;
end;
Wait(50);
end;
end;

Function FindMountedGlory: Boolean;
var
X, Y, GloryRotated, GloryNorth: Integer;
Bool: Boolean;
begin
GloryNorth := DTMFromString('mggAAAHicY2NgYGAGYg4g5mJAAFYozQKVYw JiNqja+d1ZKLgh3RJMSwLlsGFGHBgCAJIeCdg=');
GloryRotated := DTMFromString('mggAAAHicY2NgYFADYg0gVgZiRSDWgvKDgT gMiMOBOATK9wPi+d1ZDNNkToBpZCwJlMOGGXFgCAAArVoM2g== ');
Bool:= FindDTM(GloryNorth, X, Y, MSX1, MSY1, MSX2, MSY2) or FindDTM(GloryRotated, X, Y, MSX1, MSY1, MSX2, MSY2);
FreeDTM(GloryNorth);
FreeDTM(GloryRotated);

if Bool then
begin
MMouse(X, Y, 0, 0);
if WaitUptextMulti(['ub', 'lor', 'Glo', 'amu', 'let', 'mul', 'ule', 'lory', 'ory'], 600) then
begin
ClickMouse2(MOUSE_RIGHT);
if (Not WaitOptionMulti(['ub', 'ub Amu', 'Rub', 'ub Am'], 600)) then
MouseBox(MSX1, MSY1, MSX2, MSY2, 3)
else
begin
Fflag(0);
Result:= WaitFindNPCOptionsMulti(['Ed', 'dge', 'vill', 'Edgeville'], CLICKLEFT, 2500);
end;
end;
end;
end;

Function GetMinimapImage: Integer;
var
TPA, Draw: TPointArray;
TIA: TIntegerArray;
I, BMP: Integer;
begin
BMP:= CreateBitmap(MMX2 - MMX1 + 1, MMY2 - MMY1 + 1);
TPA:= TPAFromBox(MMBox);
FilterPointsPie(TPA, 0.0, 360.0, 0.0, 75.0, MMCX, MMCY);
TIA:= GetColors(TPA);

TPA:= TPAFromBox(IntToBox(0, 0, MMX2 - MMX1, MMY2 - MMY1));
DrawTPABitmap(BMP, TPA, 16777215);
FilterPointsPie(TPA, 0.0, 360.0, 0.0, 75.0, (MMX2 - MMX1)/2, (MMY2 - MMY1)/2);

For I:= 0 To High(TPA) do
begin
SetLength(DRAW, 1);
Draw[0]:= TPA[I];
DrawTPABitmap(BMP, Draw, TIA[I]);
end;
Result:= CopyBitmap(BMP);
FreeBitmap(BMP);
end;

Function TPAInTPABounds(Search, EntireTPA: TPointArray): Boolean;
var
I, L: Integer;
bounds:TBox;
begin
result := true;
bounds := GetTPABounds(EntireTPA);
L:= High(Search);
for I:= 0 To L do
if (PointInBox(Search[I], bounds)) then
Exit;
result := false;
end;

Function FilterTPAFromATPA(TPA: TPointArray; ATPA: T2DPointArray): T2DPointArray;
var
I, II, III, J, L: Integer;
begin
J:= High(TPA);
L:= High(ATPA);

For I:= 0 To L do
For II:= 0 To High(ATPA[I]) do
For III:= 0 To J do
begin
if (ATPA[I][II] = TPA[III]) then
DeleteValueInTPA(ATPA[I], II);
end;
Result:= ATPA;
end;

Function OpenBankZanaris :Boolean;
var
B: TBox;
TPA: TPointArray;
ATPA, ATPA2: T2DPointArray;
CTS, L, X, Y, I, T: Integer;
begin
Result := (LoggedIn and BankScreen);
if (Result) then
Exit;

if (Length(Players) > 0) then
if ((PinScreen) and (Players[CurrentPlayer].Pin <> '')) then
InPin(Players[CurrentPlayer].Pin);

CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.15, 0.50);
FindColorsTolerance(TPA, 9872045, MSX1, MSY1, MSX2, MSY2, 5); //Bank Booth color..
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);

if Length(TPA) < 1 then
Exit;
ATPA := TPAtoATPAEx(TPA, 20, 20);
L := High(ATPA);
SetArrayLength(ATPA2, L+1);
for i := 0 to L do
begin
B := GetTPABounds(ATPA[I]);
with B do
begin
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.02, 3.08);
FindColorsTolerance(ATPA2[I], 7920871, B.X1, B.Y1, B.X2, B.Y2, 9); //Yellow Colour on booth..
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.02, 0.02);

Result := (Length(ATPA2[i]) > 0);
if Result then
begin
MiddleTPAEx(ATPA2[i], X, Y);
MMouse(X, Y, 0, 0);
wait(500);

if isUptextMultiCustom(['Bank', 'Booth', 'ank', 'ooth']) then
begin
ClickMouse2(MOUSE_RIGHT);
ChooseOptionMulti(['ank Bank booth', 'ank Ba', 'ank Bank bo']);
t := (GetSystemTime + 5000);
repeat
if (BankScreen) or (PinScreen) then
begin
Result := true;
Break;
end;
Wait(50);
until(GetSystemTime > t);

if (Length(Players) > 0) then
if ((PinScreen) and (Players[CurrentPlayer].Pin <> '')) then
InPin(Players[CurrentPlayer].Pin);

Result := (BankScreen) or (PinScreen);
end;
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.02, 0.02);
Exit;
end;
end;
end;
end;

Function OpenAnyBank(Location: Variant): Boolean;
var
Tries: Integer;
begin
Result := (LoggedIn and BankScreen);
if (Result) then
Exit;

if (Length(Players) > 0) then
if ((PinScreen) and (Players[CurrentPlayer].Pin <> '')) then
InPin(Players[CurrentPlayer].Pin);

Case Location Of
SRL_BANK_CW, SRL_BANK_SW,
SRL_BANK_B, SRL_BANK_GG:
while (Not OpenBankChest(Location)) do
begin
if (OpenBankChest(Location)) then
break;
Inc(Tries);
if (Tries > 5) then
Exit;
end;
else
while (Not OpenBankFast(Location)) do
begin
if (OpenBankFast(Location)) then
break;
Inc(Tries);
if (Tries > 5) then
Exit;
end;
end;

if (Length(Players) > 0) then
if ((PinScreen) and (Players[CurrentPlayer].Pin <> '')) then
InPin(Players[CurrentPlayer].Pin);

Result := (BankScreen) or (PinScreen);
end;

Function WithdrawDTMEx(Item, HowMany: Integer; ItemUptext: TStringArray): Boolean;
var
X, Y, T, ItemCount: Integer;
Options: Array Of TOptions;
begin
if (Not BankScreen) then
Exit;

if (WaitFindDTMEx(Item, X, Y, MBX1, MBY1, MBX2, MBY2, 50, 1500)) then
begin
MMouse(X, Y, 5, 5);
if WaitUptextMulti(ItemUptext, 600) then
begin
if (HowMany = 1) then
ClickMouse2(MOUSE_LEFT)
else if (HowMany = -1) then
begin
ClickMouse2(MOUSE_RIGHT);
WaitOptionMulti(['w-A', 'draw-All'], 600);
end else
begin
ClickMouse2(MOUSE_RIGHT);
Options:= GetChooseOptions('All');
if WaitOptionMultiEx(['w-' + IntToStr(HowMany) + ' ', 'draw-' + IntToStr(HowMany) + ' '], 'All', Nothing, 600) then
ChooseOptionMulti(['w-' + IntToStr(HowMany) + ' ', 'draw-' + IntToStr(HowMany) + ' '])
else
if WaitOptionMulti(['w-X', 'draw-X'], 600) then
begin
if (Not BankScreen) then
Exit;
T:= GetSystemTime + 10000;
while (T >= GetSystemTime) and (not (InRange(CountColor(0, 250, 396, 307, 410), 155, 165))) do
Wait(50);
TypeSend(ToStr(HowMany - ItemCount));
end;
end;
end;
end;
Result:= (WaitAmount(Item, HowMany, 2500) >= HowMany);

if (HowMany = -1) then
Result:= WaitFindDTM(X, Y, Item, 2500);
end;

Function WithdrawDTM(ItemDTM, HowMany, MaxTries: Integer; Uptexts: TStringArray): Boolean;
var
Tries, X, Y, ItemCount: Integer;
begin
Tries:= 0;
ItemCount:= ItemAmount('inv', 'dtm', ItemDTM, []);
if ((ItemCount >= HowMany) and (HowMany <> -1)) then
begin
Result:= True;
Exit;
end;

If (HowMany <> 0) then
begin
If FindDTM(ItemDTM, X, Y, MBX1, MBY1, MBX2, MBY2) then
While (Tries < MaxTries) do
begin
Result:= WithdrawDTMEx(ItemDTM, HowMany, Uptexts);
if Result then
break;
Inc(Tries);
if (Tries > (MaxTries - 1)) then
writeln('~WithdrawDTM~ Failed To Withdraw Item');
end;
end else
Result:= True;
end;

Function HybridScreen: Boolean;
var
BMP, X, Y: Integer;
begin
Result := False;

BMP := BitmapFromString(39, 11, 'meJxjYICCPQ9eIyMGGgNMi+hgL6' +
'YVtLaUSPNxhTxcBE/UoEUckTGIrAZrROCJGlzq8VuKP/DJkx05ltL' +
'OWGIsJTIxEMzRBPXiSlf4kz0eK/CIIHsQAFKhZGs=');

Result := FindBitmapToleranceIn(BMP, X, Y, MSX1, MSY1, MSX2, MSY2, 20);
FreeBitmap(BMP);
end;

Function ChooseHybrid(Which: HybridArmour): Boolean;
var
X: Integer;
begin
if (Not HybridScreen) then
Exit;

Case Which Of
HYBRID_BATTLEMAGE: X:= 150;
HYBRID_TRICKSTER: X:= 240;
HYBRID_VANGUARD: X:= 330;
else
Result:= False;
end;

MMouse(X, 240, 5, 5);
ClickMouse2(True);
Result := True;
end;

Function SummoningPoints: Integer;
var
ColourString: String;
begin
Result:= GetMMLevels('summon', ColourString);
end;

Function ItemSelected(Item: Integer): Boolean;
var
X, Y, Slot: Integer;
begin
if (WaitFindDTM(X, Y, Item, 500)) then
begin
Slot:= CoordsToItem(X, Y);
Result:= ItemActivated(Slot);
end;
end;

Function AnyItemSelected: Integer;
var
I: Integer;
begin
Result:= 0;
For I:= 1 To 28 do
begin
if (ItemActivated(I)) then
begin
Result:= I;
break;
end;
end;
end;

Function WaitItemSelected(Item, TimeToWait: Integer): Boolean;
var
T: integer;
begin
T := (GetSystemTime + TimeToWait);
while (GetSystemTime < t) do
begin
if (ItemSelected(Item)) then
begin
Result:= True;
Break;
end;
Wait(50);
end;
end;

Function DeselectItem(Slot: Integer): Boolean;
var
SlotPoint: TPoint;
begin
if (Slot <> 0) then
begin
SlotPoint:= ItemCoords(Slot);
MMouse(SlotPoint.X, SlotPoint.Y, 5, 5);
ClickMouse2(MOUSE_LEFT);
end;

Result:= (AnyItemSelected = NULL);
end;

Function UsingFamiliarFS: Boolean;
var
CTS: Integer;
TPA: TPointArray;
begin
CTS:= GetColorToleranceSpeed;
SetColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.18, 0.88);
Result:= FindColorsTolerance(TPA, 8763221, 692, 130, 721, 160, 21);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
end;

Function UsingFamiliar: Boolean;
Var
X, Y, Tries: Integer;
begin
Result := UsingFamiliarFS or FindColorTolerance(X, Y, 11192179, 695, 130, 720, 155, 20);
if (Not Result) then
begin
if FindColorTolerance(X, Y, 3426817, 695, 130, 720, 155, 20) then
begin
Result:= False;
exit;
end;

MMouse(708, 144, 5, 5);
Repeat
Inc(Tries);
GetMousePos(X, Y);
Wait(500);
If (Tries > 7) then
break;
Until(PointInBox(Point(X, Y), IntToBox(691, 131, 720, 159)));

Result:= (Not WaitUptextMulti(['elect', 'lect'], 500));
end;
end;

Function InteractFamiliar(Options: TStringArray): Boolean;
begin
If ((Not LoggedIn) or (Length(Options) < 1)) then
Exit;
If UsingFamiliar then
begin
MouseBox(695, 140, 740, 155, MOUSE_MOVE);
if ((Options[0] = '') or WaitUptextMulti(Options, 600)) then
begin
ClickMouse2(MOUSE_LEFT);
Result := True;
end else
begin
ClickMouse2(MOUSE_RIGHT);
if WaitOptionMulti(Options, 400) then
Result := True
else
srl_Warn('InteractFamiliar', 'Incorrect option', warn_AllVersions);
end;
end else
srl_Warn('InteractFamiliar', 'No familiar present!', warn_AllVersions);
end;

Function GetRingCount: Integer;
var
Rings: String;
begin
If BankScreen then
CloseWindow;
GameTab(TAB_EQUIP);
if WearingItem(11) then
begin
MouseEquippedItem('ring', 3);
Wait(RandomRange(175, 350));
Rings := GetUpText;
Rings:= Between('(', ')', Rings);
if (Rings = '') then
begin
Result:= 1;
Exit;
end;
Result := StrToIntDef(Rings, 8);
end else
Result := 0;
end;

Function WearRing(RingDTM, MaxRingValue: Integer): Boolean;
var
X, Y: Integer;
begin
if WaitFindDTM(X, Y, RingDTM, 1000) then
begin
MMouse(X, Y, 3, 3);
if (Not BankScreen) then
begin
ClickMouse2(MOUSE_LEFT);
Result:= True;
end else
begin
ClickMouse2(MOUSE_RIGHT);
Result:= WaitOptionMulti(['wear', 'ear'], 1200);
end;
end else
Result:= False;
if Result then RingCount:= MaxRingValue;
end;

Function PouchRepair(BankName: Variant; AstralRuneDTM, CosmicRuneDTM, LawRuneDTM, RuneRepairDTM: Integer): Boolean;
var
Box: TBox;
PouchPoint: TPoint;
CTS, W, H, I, L: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
GameTab(TAB_INV);
CTS:= GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.36, 0.11);
FindColorsTolerance(TPA, 2698544, MIX1, MIY1, MIX2, MIY2, 8);
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (Length(TPA) < 1) then
begin
Result:= True;
Exit;
end;

Box:= InvBox(1);
W:= Box.X2 - Box.X1;
H:= Box.Y2 - Box.Y1;

ATPA:= TPAToATPAEx(TPA, W, H);
L:= High(ATPA);
For I:= 0 To L Do
RAASTPAEx(ATPA[I], W, H);

L:= High(ATPA);
If OpenAnyBank(BankName) then
For I:= 0 To L Do
If (WithdrawDTM(AstralRuneDTM, 2, 3, ['une', 'ral ru']) and WithdrawDTM(CosmicRuneDTM, 1, 3, ['une', 'mic ru']) and WithdrawDTM(LawRuneDTM, 1, 3, ['une', 'aw ru'])) then
begin
If BankScreen then
CloseWindow;

GameTab(TAB_MAGIC);
If WaitFindDTM(PouchPoint.X, PouchPoint.Y, RuneRepairDTM, 600) then
begin
MMouse(PouchPoint.X, PouchPoint.Y, 0, 0);
if WaitUptextMulti(['ast Rep', 'epair', 'pair'], 600) then
begin
ClickMouse2(MOUSE_LEFT);

PouchPoint:= MiddleTPA(ATPA[I]);
MMouse(PouchPoint.X, PouchPoint.Y, 0, 0);
If WaitUptextMulti(['ouch ->', '->', 'ast', 'ast Rep'], 600) then
ClickMouse2(MOUSE_LEFT);
end;
end;
end;
Result:= True;
end;

Function DTMsToTPAs(DTMs: TIntegerArray): TPointArray;
var
X, Y, I, L: Integer;
begin
if (Length(DTMs) < 1) then
Exit;
SetLength(Result, Length(DTMs));
L:= High(DTMs);
For I:= 0 To L do
begin
if (FindDTM(DTMs[I], X, Y, MIX1, MIY1, MIX2, MIY2)) then
Result[I]:= Point(X, Y)
else
Result[I]:= Point(-1, -1);
end;
end;

Function DepositFamiliar: Boolean;
var
Bool: Boolean;
DTM, X, Y: Integer;
begin
if (Not UsingFamiliar) then
Exit;

DTM := DTMFromString('mrAAAAHic42BgYEhhZmDwB+JCII4F4nlQdh gzRO4LIwPDayB+A8QMTAwMz4H0XyD+BcWz1p8ASjBiYIc7rgw7 95xg4ALy8GFMnagYBgA3cRAj');
Bool:= WaitFindDTMEx(DTM, X, Y, MBX1, MBY1, MBX2, MBY2, 50, 1500);
FreeDTM(DTM);

if Bool then
begin
MMouse(X, Y, 5, 5);
if (WaitUptextMulti(['Deposit beast', 'eposit beast', 'east of bur', 'den inv', 'inventory'], 600)) then
begin
ClickMouse2(MOUSE_LEFT);
Result:= True;
end;
end;
end;

Function DismissFamiliar(TimeOut: Integer): Boolean;
begin
Result:= (Not UsingFamiliar);
if (Result) then
Exit;
if InteractFamiliar(['ismiss', 'miss', 'Dismiss', 'ism']) then
WaitFindNPCOptionsMulti(['es', 'Yes'], ClickLeft, TimeOut);
Result:= (Not UsingFamiliar);
end;

Function SummoningRenew(BankName: Variant; PouchDTM, PotionDTM: Integer; PouchUptext: TStringArray; Bank, Dismiss: Boolean): Boolean;
var
X, Y: Integer;
begin
X:= -1; Y:= -1;
if (UsingFamiliar) then
begin
Result:= True;
Exit;
end;

if Bank then
if OpenAnyBank(BankName) then
begin
If InvFull then
begin
InvMouse(RandomRange(20, 28), MOUSE_RIGHT);
WaitOptionMulti(['eposit-1 Pu', '-1 Pu'], 600);
Wait(500);
InvMouse(RandomRange(20, 28), MOUSE_RIGHT);
WaitOptionMulti(['eposit-1', '-1 Pu'], 600);
end;

if (SummoningPoints < 10) then
if (Not WithdrawDTM(PotionDTM, 1, 3, ['ummoning', 'potion'])) then
Exit;

if DepositFamiliar then
MouseTBox(IntToBox(426, 296, 458, 318), MOUSE_LEFT);

if (Not WaitFindDTM(X, Y, PouchDTM, 1000)) then
if (Not WithdrawDTM(PouchDTM, 1, 3, PouchUptext)) then
Exit;
end;

if (SummoningPoints <= 10) then
if (WaitFindDTM(X, Y, PotionDTM, 1000)) then
begin
If BankScreen then
CloseWindow;
MMouse(X, Y + 5, 0, 0);
ClickMouse2(MOUSE_RIGHT);
WaitOptionMulti(['rink', 'Drink', 'rink Summoning', 'Drink Summoning'], RandomRange(400, 500));
end else
Exit;

if (Not WaitFindDTM(X, Y, PouchDTM, 1000)) then
Exit;

if (Dismiss) then
DismissFamiliar(1000);

if (Not UsingFamiliar) then
begin
If BankScreen then
CloseWindow;

MMouse(X, Y, 5, 5);
if (WaitUptextMulti(['Use'], 500)) then
begin
ClickMouse2(MOUSE_RIGHT);
WaitOptionMulti(['ummon', 'Summon', 'mmon'], 600);
end;
end;
Wait(1000);
Result:= UsingFamiliar;
end;

Function InteractRuins(Altar: RCAltar; Inner: Boolean; Actions: TStringArray): Boolean;
var
CTS, T, Dist: Integer;
RuinsPoint, SymbolPoint: TPoint;
Background, Glow: TPointArray;
begin
Case Altar Of
ALTAR_NATURE:
begin
If (Not Inner) then
If FoundSymbol(3, SymbolPoint, Dist) then
begin
Result:= True;
Exit;
end;

CTS:= GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.53, 0.33);
FindColorsTolerance(Background, 5595749, MSX1, MSY1, MSX2, MSY2, 21);
ColorToleranceSpeed(CTS);
SetColorSpeed2Modifiers(0.2, 0.2);
If (Length(Background) < 1) then
Exit;

If Inner then
Glow:= FindObjectInObject(Background, 6051931, 34, 30, 2, [2.09, 0.04])
else
Glow:= FindObjectInObject(Background, 6016407, 68, 31, 17, [0.05, 2.62]);
end;
End;

If (Length(Glow) < 1) then
Exit;

RuinsPoint:= MiddleTPA(Glow);
MMouse(RuinsPoint.X, RuinsPoint.Y, 5, 5);
Result:= WaitUptextMulti(Actions, 500);
If Result then
ClickMouse2(MOUSE_LEFT)
else
If WaitUptextMulti(['ruins', 'uins', 'yster', 'Mysterious', 'ysterious', 'terious'], 500) then
begin
ClickMouse2(MOUSE_RIGHT);
Result:= WaitOptionMulti(Actions, 500);
end;

Case Altar Of
ALTAR_NATURE:
begin
While (IsMoving) Do
Wait(500);
FFlag(5);
If (Not Result) then
Exit;
MarkTime(T);
Repeat
If FoundSymbol(3, SymbolPoint, Dist) then
break;

If (TimeFromMark(T) > 5000) then
Exit;
Until(False);
Result:= True;
end;
end;
end;

Procedure FillPouches(BankName: Variant);
var
I, L: Integer;
Pouches: TPointArray;
begin
if (Not OpenAnyBank(BankName)) then
Exit;
If (Not WithdrawDTM(EssenceDTM, -1, 2, ['ssence', 'sence', 'Pure es', 'ess', 'ence'])) then
Exit;

Pouches:= DTMsToTPAs([SmallPouch, MediumPouch, LargePouch, GiantPouch]);
if (Length(Pouches) < 1) then
Exit;
L:= High(Pouches);

For I:= L DownTo (L - 1) do
begin
if (Pouches[I] = Point(-1, -1)) then
Continue;

MMouse(Pouches[I].X, Pouches[I].Y, 3, 3);
if WaitUptextMulti(['pouch', 'ouch', 'uch'], 600) then
begin
ClickMouse2(MOUSE_RIGHT);
WaitOptionMulti(['Fill', 'ill', 'll'], 600);
end;
end;

if WithdrawDTM(EssenceDTM, -1, 2, ['ssence', 'sence', 'Pure es', 'ess', 'ence']) then
For I:= (L - I - 1) DownTo 0 do
begin
if (Pouches[I] = Point(-1, -1)) then
Continue;

MMouse(Pouches[I].X, Pouches[I].Y, 3, 3);
if WaitUptextMulti(['pouch', 'ouch', 'uch'], 600) then
begin
ClickMouse2(MOUSE_RIGHT);
WaitOptionMulti(['Fill', 'ill', 'll'], 600);
end;
end;

WithdrawDTM(EssenceDTM, -1, 2, ['ssence', 'sence', 'Pure es', 'ess', 'ence']);
end;

Procedure EmptyPouches(Altar: RCAltar);
var
I, L: Integer;
Pouches: TPointArray;
begin
GameTab(TAB_INV);
Pouches:= DTMsToTPAs([SmallPouch, MediumPouch, LargePouch, GiantPouch]);
If (Length(Pouches) < 1) then
Exit;
L:= High(Pouches);

For I:= L DownTo (L - 1) do
begin
If (Pouches[I] = Point(-1, -1)) then
Continue;

MMouse(Pouches[I].X, Pouches[I].Y, 3, 3);
If WaitUptextMulti(['Empty', 'mpty', 'pty'], 600) then
begin
ClickMouse2(MOUSE_LEFT);
Wait(RandomRange(500, 700));
end;
end;

If (WaitAmount(EssenceDTM, 1, 500) > 0) then
If InteractRuins(Altar, True, ['aft']) then
begin
Wait(750);
For I:= (L - I - 1) DownTo 0 do
begin
if (Pouches[I] = Point(-1, -1)) then
Continue;

MMouse(Pouches[I].X, Pouches[I].Y, 3, 3);
if WaitUptextMulti(['Empty', 'mpty', 'pty'], 600) then
begin
ClickMouse2(MOUSE_LEFT);
Wait(RandomRange(500, 750));
end;
end;
end;

If (WaitAmount(EssenceDTM, 1, 500) > 0) then
InteractRuins(Altar, True, ['aft']);
end;

Function InfuseInterfaceUp: Boolean;
var
Text: String;
begin
Text:= GetTextAtExWrap(257, 31, 438, 51, 0, 5, 2, 2070783, 15, 'UpCharsEx');
Result:= ExecRegExpr('ummon', Text);
end;

Function HerbloreMixingInterface: Boolean;
var
Text: String;
Bool: Boolean;
begin
Text:= GetTextAtExWrap(41, 345, 278, 362, 0, 5, 2, 16777215, 10, 'SmallChars');
Bool:= ExecRegExpr('make', Text) or ExecRegExpr('wish to make', Text) or ExecRegExpr('wish | to | make', Text);

If (Bool) then
begin
MouseBox(207, 398, 314, 460, MOUSE_MOVE);
if (WaitUptextMulti(['ake', 'All', 'ke A'], 600)) then
begin
ClickMouse2(MOUSE_LEFT);
Result:= True;
end;
end;
end;

Function WaitHerbloreMixingInterface(TimeToWait: Integer): Boolean;
var
T: integer;
begin
T := (GetSystemTime + TimeToWait);
while (GetSystemTime < t) do
begin
if (HerbloreMixingInterface) then
begin
Result:= True;
Break;
end;
Wait(50);
end;
end;

Function InfuseInterfaceEmpty: Boolean;
var
X, Y: Integer;
begin
Result:= Not FindColorTolerance(X, Y, 39166, 26, 58, 439, 186, 25);
end;

Function WaitInfuseInterface(TimeToWait: Integer): Boolean;
var
T: integer;
begin
T := (GetSystemTime + TimeToWait);
while (GetSystemTime < t) do
begin
if (InfuseInterfaceUp) then
begin
Result:= True;
Break;
end;
Wait(50);
end;
end;

Function InfuseQuickEnable: Boolean;
var
X, Y, Tries: Integer;
begin
Result:= FindColorTolerance(X, Y, 105157, 201, 42, 210, 46, 10);
if Result then
exit;

Tries:= 0;
Repeat
if (Not FindColorTolerance(X, Y, 105157, 201, 42, 210, 46, 10)) then
begin
MMouse(X, Y, 0, 0);
ClickMouse2(MOUSE_LEFT);
MMouse(215, 50, 0, 0);
Result:= FindColorTolerance(X, Y, 105157, 201, 42, 210, 46, 10);
end;
Inc(Tries);
Until(Result or (Tries > 10));
end;

Function FindOrangeObelisk: boolean;
var
Obelisk, X, Y, Tries: Integer;
begin
Result:= InfuseInterfaceUp;
if Result then
exit;
Tries:= 0;
Obelisk:= DTMFromString('mlwAAAHicY2dgYJBhhGBpKFYEYisg/guU+wjEL4D4ARAzAsVOMEDEjwNxq5c2Q0GCEUN3lR9DjrsAQ5G 3IENeoh3D9lnpDCJAeRjmQmKDMCMeDAUAjBgPSQ==');
Repeat
Result:= FindDTM(Obelisk, X, Y, MSX1, MSY1, MSX2, MSY2);
if (Result) then
MMouse(X, Y, 0, 0);
if (isUptext('ouch')) then
Result:= True;
if (Result) then
break;
Inc(Tries);
Until(WaitUptext('ouch', 100) or (Tries > 20));
FreeDTM(Obelisk);

if (Result) then
begin
ClickMouse2(MOUSE_RIGHT);
ChooseOptionMulti(['fuse', 'fuse-pou', 'lisk', 'belisk', 'ouch Obe']);
Result:= WaitInfuseInterface(1000);
end;
end;

Function CastleWarsEndScreen: Boolean;
var
Text: String;
begin
if (Not Location('CW')) then
Exit;
Text:= GetTextAtExWrap(270, 56, 377, 72, 0, 5, 2, 3381759, 10, 'UpCharsEx');
Result:= ExecRegExpr('lue|Blue|eam|team|score', Text);
end;

Function InCastleWarsPortal: Boolean;
var
Text: String;
begin
Text:= GetTextAtExWrap(159, 47, 362, 65, 0, 5, 2, clWhite, 10, 'UpCharsEx');
Result:= ExecRegExpr('game|until|Time|next', Text);
end;

Function InCastleWarsSpawnRoom: Boolean;
var
Text: String;
begin
Text:= GetTextAtExWrap(114, 122, 394, 138, 0, 5, 2, 65535, 10, 'SmallChars');
Result:= ExecRegExpr('have|two|minutes|leave|respawn|room', Text);
end;

Function InCastleWarsGame: Boolean;
var
TPA, FlagSymbol: TPointArray;
begin
if (Location('CW') or InCastleWarsPortal or CastleWarsEndScreen) then
Exit;

FindColorsTolerance(TPA, 12352360, 11, 37, 26, 60, 25);
if (Length(TPA) < 1) then
Exit;

FlagSymbol:= FindObjectInObject(TPA, 11586764, 10, 10, 50, [0.2, 0.2]);
Result:= (Length(FlagSymbol) > 1);
end;

Function MousePotions(PotionDTM: Integer; Uptext: TStringArray; Drink: Boolean): Boolean;
var
X, Y: Integer;
TPA: TPointArray;
ATPA: T2DPointArray;
begin
If (FindDTMs(PotionDTM, TPA, MIX1, MIY1, MIX2, MIY2)) then
begin
ATPA:= TPAToATPAEx(TPA, 24, 35);
SortATPASize(ATPA, False);
if (Length(ATPA) < 1) then
Exit;
MiddleTPAEx(ATPA[0], X, Y);
MMouse(X, Y, 0, 0);
if (WaitUptextMulti(Uptext, 600)) then
begin
if (Drink) then
ClickMouse2(MOUSE_LEFT);
Result:= True;
Wait(1000);
end;
end;
end;

Function FindDTMSlot(var P: TPoint; DTM, Slot: Integer): Boolean;
Var
Bounds: TBox;
begin
Bounds:= InvBox(Slot);
Result:= FindDTM(DTM, P.X, P.Y, Bounds.X1, Bounds.Y1, Bounds.X2, Bounds.Y2);
end;

Function FindDTMBox(var P: TPoint; DTM: Integer; Box: TBox): Boolean;
begin
Result:= FindDTM(DTM, P.X, P.Y, Box.X1, Box.Y1, Box.X2, Box.Y2);
end;

Function PrayerLevel: Integer;
var
ColourString: String;
begin
Result:= GetMMLevels('Prayer', ColourString);
end;

Function IsPrayerOn: Boolean;
var
TPA: TPointArray;
CTS: Integer;
begin
if (PrayerLevel < 2) then
Result:= False
else
begin
CTS:= GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.11, 1.02);
Result:= FindColorsSpiralTolerance(723, 70, TPA, 8767378, 708, 53, 737, 85, 27);
SetToleranceSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
end;
end;

Function OutOfPrayer: Boolean;
var
TPA: TPointArray;
CTS: Integer;
begin
CTS:= GetColorToleranceSpeed;
ColorToleranceSpeed(2);

if (PrayerLevel = 0) then
Result:= True
else
Result:= Not(FindColorsSpiralTolerance(723, 70, TPA, 6236988, 706, 55, 739, 81, 26) or IsPrayerOn);

ColorToleranceSpeed(CTS);
end;

Function TurnQuickPrayerOff(MaxTries: Integer): Boolean;
var
Tries: Integer;
begin
if (GetCurrentTab <> Tab_Inv) then
GameTab(Tab_Inv);
wait(1000);

if (Not IsPrayerOn) then
exit;
repeat
Inc(Tries);
if OutOfPrayer Then
break;
if PrayerLevel < 3 then
break;
MouseBox(706, 55, 739, 87, MOUSE_LEFT);
wait(1500);
If (Tries > MaxTries) Then
Exit;
Until(Not IsPrayerOn);
Result:= (Not IsPrayerOn);
end;

Function TurnQuickPrayerOn(MaxTries: Integer): Boolean;
var
Tries: Integer;
begin
if (GetCurrentTab <> Tab_Inv) then
GameTab(Tab_Inv);
wait(1000);

if IsPrayerOn then
Exit;

repeat
Inc(Tries);
if OutOfPrayer Then
break;
if PrayerLevel < 3 then
break;
MouseBox(706, 55, 739, 87, 1);
wait(1500);
if (Tries > MaxTries) then
Exit;
Until(IsPrayerOn);
Result:= IsPrayerOn;
end;

Procedure RandomCheck;
begin
FindNormalRandoms;
If ((Not LoggedIn) or LobbyScreen) then
LoginPlayer;
end;

Function RoundEx(Number: Extended; Places: LongInt): Extended;
begin
Result := Round((Number * Pow(10, Places))/(Pow(10, Places)));
end;

Function MidPoint(A, B: TPoint): TPoint;
begin
Result:= Point(((A.X + B.X) div 2), ((A.Y + B.Y) div 2));
end;

Function StringContains(Search, What: String): Boolean;
begin
Result:= (Pos(LowerCase(What), LowerCase(Search)) > 0);
end;

Function StringArrayContains(Search: TStringArray; What: String): Boolean;
var
I, L: Integer;
begin
Result:= False;
L:= High(Search);
For I:= 0 To L do
if (LowerCase(Search[I]) = LowerCase(What)) then
begin
Result:= True;
break;
end;
end;

procedure DeleteValueInBox(var Arr: TBoxArray; ValuePosition: Integer);
var
ArrLen, I: Integer;
begin
ArrLen := High(Arr);
For I := ValuePosition To ArrLen - 1 do
Swap(Arr[I], Arr[I + 1]);
SetArrayLength(Arr, ArrLen);
end;

Procedure LoadAllUseful;
begin
{$IFNDEF FightOnly}
AirRuneDTM := DTMFromString('mAAEAAHiclclBCkBQAIThYSmRKLLgPq+cQx FJFnLIt3Ycf7wFZfOmvqZpYklZIFUoUaBB67pGjgQxIgx6zFiw YkKPHYezYcRp7YcU/uqMuf+U5SPw9M4FLBwUTQ==');
AstralRuneDTM := DTMFromString('m6wAAAHic42ZgYNgFxNuBeC+U3gnEB4H4OB AfhbJ3A/FWIJ4GxNOBeCYQzwHiyVAxEH8+EC8B4mVQfHTVUQzcWF0NlGHC wPxAkljMSAJGAgDFxhwQ');
CosmicRuneDTM := DTMFromString('mFQEAAHic42VgYNgBxJuBeB8U7wHiw0B8CI h3AfEWID4OxEeBeC8QbwXiaUA8FYgnA/EMIJ6LRC8G4nlAPB2IFwDxMii+fVMeA0+b0M/Q2dLMEOjryxAVFgZUxYSC+YEkqZiRDIwCAGKnILs=');
LawRuneDTM := DTMFromString('mAAEAAHic42FgYOiF4i4g7gfiSUA8G4pnAP FUIJ6IpGYaVG4uEM8D4ulQsTlAvBCIlwDxMiBeCqXllG9jYAYG Jgzs5uwMpvmBJCmYkUSMDAA6nxVs');
RuneRepairDTM := DTMFromString('m1gAAAHic42JgYIhkYmCIAuI4II4B4kQmiF gQEIcBcSgQxwKxPSMDgyUjhHYGYkcgdoXyraFiNkBsIsjMUOSv A6Yr4tyBNjDC8em9q+Dy/EARYjAjkRgBAPD8DMc=');
SmallPouch := DTMFromString('mrAAAAHic42BgYMhlYmAoAOIcIC4B4kIgzo Dyk4H4GVDNSyC+xwBhv0fCb4HYzcGMISjQj0FPVQTIY8LA/EASH2YkgGEAAIOYDWk=');
MediumPouch := DTMFromString('mrAAAAHic42BgYJjGxMAwiwlCzwPi+UA8G8 qfCMQvgGqeAfEDKP0KiD8A8UcoHeRtzxAWGsSQnZUO5DFhYH4g iQ8zEsAwAAC4Iw/M');
LargePouch := DTMFromString('mwQAAAHic42RgYNjPBMFHgPgEEJ8G4lNAfA iIdwPxNiB+CVT3EIifAfFTIH4NxB+A+BMUg9j+HrYM6WnJDP5+ PkAeE1bMDyQJYUYiMBwAAIqjErs=');
GiantPouch := DTMFromString('m1gAAAHic42JgYHBiYmDwBmJ/IA4EYh8oGyTuBsTWUMzNyMDAxQih+YCYDYhFgFgCiIWAWBiIxY E4ItCFIToynEFPSxloOhMKDvK2Z0iM9Aaz+YEkMZiRSIwAAKz8 CIk=');
EssenceDTM := DTMFromString('mkwEAAHicrY7rCoNQDIPjjvPGxOFeTUREwc tkKuhAhbG3t0cCOthPCx+Epk37AGAKvmAJCr/lCVf6dyFkT3Fea5soYgguPYf7F+bp/UC4sW8zx+Ifx/td88R3mVHmGdI4RhJFm37VFT7TxNQdPa/9pizw7nsMbYt5HDcd8O4ZGCfyp1af9BQb');
RingDTM := DTMFromString('mWAAAAHicY2FgYGAFYk4GCOACYg4omweKXV wcGESnSzKsmCDBUJ0lyGAEFEPGjGgYBADTGwTc');
GraahkDTM := DTMFromString('mWAAAAHicY2FgYBBggAAeIJYBYlYg5kQSP1 RoCySZ4FgESDLiwSAAAGfpAew=');
SummoningPotion := DTMFromString('mWAAAAHicY2FgYHBigmBXIPYEYn1GBgYrIL aE4vz8Ega5a3cZZC/dBKpmYkgBkuxImBENgwAAgewHaA==');
{$ELSE}
AirRuneDTM := -1; AstralRuneDTM := -1; CosmicRuneDTM := -1; LawRuneDTM := -1; RuneRepairDTM := -1; SmallPouch := -1;
MediumPouch := -1; LargePouch := -1; GiantPouch := -1; EssenceDTM := -1; RingDTM := -1; GraahkDTM := -1; SummoningPotion := -1;
{$ENDIF}
WaitFight_Shield := DTMFromString('mrAAAAHic42BgYOAFYgEg5gdiHiBmB2I+IG aBijECMRMQs0LlQOJcUBqkl9XUCS8mBBgJYBgAAK0nBH8=');
WaitFight_Damage := DTMFromString('mbQAAAHicY2VgYNBmhGAdINYDYn0glgZiBS BWBmI5IJYA4nQ2NoYEPj4wns3DA6a5gPrRMSMWDAYAIPEEVA== ');
end;

Procedure FreeAllUseful;
begin
{$IFNDEF FightOnly}
FreeDTM(AirRuneDTM);
FreeDTM(AstralRuneDTM);
FreeDTM(CosmicRuneDTM);
FreeDTM(LawRuneDTM);
FreeDTM(RuneRepairDTM);
FreeDTM(SmallPouch);
FreeDTM(MediumPouch);
FreeDTM(LargePouch);
FreeDTM(GiantPouch);
FreeDTM(EssenceDTM);
FreeDTM(RingDTM);
FreeDTM(GraahkDTM);
FreeDTM(SummoningPotion);
{$ENDIF}
FreeDTM(WaitFight_Shield);
FreeDTM(WaitFight_Damage);
end;

Procedure SetupUseful;
begin
LoadAllUseful;
AddOnTerminate('FreeAllUseful');
end;