NCDS
2010-10-21 16:10:44
Ok, so there are a few things that needed updating…
There is a spell called 'Wind Rush' that currently is not included in SRL's Magic.scar.
Applied then tested with:
Output:
DefCastIs also needed to be updated as the color was old. All the other colors were updated but this one?
Applied then tested with:
Output:
The colors in ScrollSpellBook were also outdated.
Fixed and tested with:
Also, I changed the 'Exp' arrays from Integer arrays to Extended arrays for accuracy purposes as some spells give *.5 exp per cast.
Applied and tested with:
Output:
The scroll bar detection color in SpellAvailable has also been updated and tested to work successfully.
Updated Magic.Scar:
Patch:
Everything should now be in working order.
There is a spell called 'Wind Rush' that currently is not included in SRL's Magic.scar.
Applied then tested with:
program new;
{.include SRL/SRL.scar}
{.include SRL/SRL/Skill/Magic.scar}
var
Box: TBox;
begin
SetupSRL;
ActivateClient;
if SpellAvailable(Box, 'wind rush') then
if Cast('wind rush', False) then
begin
Writeln('Success');
Writeln('Box.x1 = '+IntToStr(Box.x1)+';');
Writeln('Box.y1 = '+IntToStr(Box.y1)+';');
Writeln('Box.x2 = '+IntToStr(Box.x2)+';');
Writeln('Box.y2 = '+IntToStr(Box.y2)+';');
end;
end.
Yes, I'm aware Cast calls SpellAvailable. It was simply for testing purposes.Output:
Compiled succesfully in 764 ms.
SRL Compiled in 16 msec
Success
Box.x1 = 589;
Box.y1 = 217;
Box.x2 = 604;
Box.y2 = 232;
Successfully executed.
DefCastIs also needed to be updated as the color was old. All the other colors were updated but this one?
Applied then tested with:
program new;
{.include SRL/SRL.scar}
{.include SRL/SRL/Skill/Magic.scar}
var
Box: TBox;
begin
SetupSRL;
ActivateClient;
if DefCastIs then
Writeln('Success');
end.
Output:
Compiled succesfully in 624 ms.
SRL Compiled in 0 msec
Success
Successfully executed.
The colors in ScrollSpellBook were also outdated.
Fixed and tested with:
program new;
{.include SRL/SRL.scar}
{.include SRL/SRL/Skill/Magic.scar}
var
Box: TBox;
begin
SetupSRL;
ActivateClient;
ScrollSpellBook(True);
end.
Clearly there is no output for this, but it was tested both ways (up and down) successfully. (yes it was tested for false positives as well)Also, I changed the 'Exp' arrays from Integer arrays to Extended arrays for accuracy purposes as some spells give *.5 exp per cast.
Applied and tested with:
program new;
{.include SRL/SRL.scar}
{.include SRL/SRL/Skill/Magic.scar}
var
Box: TBox;
begin
SetupSRL;
ActivateClient;
DebugSpellVars(SpellMode_Combat);
end.
Output:
Compiled succesfully in 639 ms.
SRL Compiled in 16 msec
Spell: wind rush - Level needed: 1 - EXP per cast: 3.5 - AutoCast: True
Spell: wind strike - Level needed: 1 - EXP per cast: 5.5 - AutoCast: False
Spell: confuse - Level needed: 3 - EXP per cast: 13 - AutoCast: False
Spell: water strike - Level needed: 5 - EXP per cast: 7.5 - AutoCast: True
Spell: earth strike - Level needed: 9 - EXP per cast: 9.5 - AutoCast: True
Spell: weaken - Level needed: 11 - EXP per cast: 21 - AutoCast: False
Spell: fire strike - Level needed: 13 - EXP per cast: 11.5 - AutoCast: True
Spell: wind bolt - Level needed: 17 - EXP per cast: 13.5 - AutoCast: True
Spell: curse - Level needed: 19 - EXP per cast: 29 - AutoCast: False
Spell: bind - Level needed: 20 - EXP per cast: 30 - AutoCast: False
Spell: water bolt - Level needed: 23 - EXP per cast: 16.5 - AutoCast: True
Spell: earth bolt - Level needed: 29 - EXP per cast: 19.5 - AutoCast: True
Spell: fire bolt - Level needed: 35 - EXP per cast: 22.5 - AutoCast: True
Spell: crumble undead - Level needed: 39 - EXP per cast: 24.5 - AutoCast: True
Spell: wind blast - Level needed: 41 - EXP per cast: 25.5 - AutoCast: True
Spell: water blast - Level needed: 47 - EXP per cast: 28.5 - AutoCast: True
Spell: iban blast - Level needed: 50 - EXP per cast: 30 - AutoCast: True
Spell: snare - Level needed: 50 - EXP per cast: 60 - AutoCast: False
Spell: magic dart - Level needed: 50 - EXP per cast: 30 - AutoCast: True
Spell: earth blast - Level needed: 53 - EXP per cast: 31.5 - AutoCast: True
Spell: fire blast - Level needed: 59 - EXP per cast: 34.5 - AutoCast: True
Spell: saradomin strike - Level needed: 60 - EXP per cast: 35 - AutoCast: True
Spell: claws of guthix - Level needed: 60 - EXP per cast: 35 - AutoCast: True
Spell: flames of zamorak - Level needed: 60 - EXP per cast: 35 - AutoCast: True
Spell: wind wave - Level needed: 62 - EXP per cast: 36 - AutoCast: True
Spell: water wave - Level needed: 65 - EXP per cast: 37.5 - AutoCast: True
Spell: vulnerability - Level needed: 66 - EXP per cast: 76 - AutoCast: False
Spell: earth wave - Level needed: 70 - EXP per cast: 40 - AutoCast: True
Spell: enfeeble - Level needed: 73 - EXP per cast: 83 - AutoCast: False
Spell: fire wave - Level needed: 75 - EXP per cast: 42.5 - AutoCast: True
Spell: entangle - Level needed: 79 - EXP per cast: 89 - AutoCast: False
Spell: stun - Level needed: 80 - EXP per cast: 90 - AutoCast: False
Spell: charge - Level needed: 80 - EXP per cast: 180 - AutoCast: False
Spell: wind surge - Level needed: 81 - EXP per cast: 75 - AutoCast: True
Spell: teleport block - Level needed: 85 - EXP per cast: 80 - AutoCast: False
Spell: water surge - Level needed: 85 - EXP per cast: 80 - AutoCast: True
Spell: earth surge - Level needed: 90 - EXP per cast: 85 - AutoCast: True
Spell: fire surge - Level needed: 95 - EXP per cast: 90 - AutoCast: True
Successfully executed.
The scroll bar detection color in SpellAvailable has also been updated and tested to work successfully.
Updated Magic.Scar:
//-----------------------------------------------------------------//
//-- Scar Standard Resource Library --//
//-- Magic routines --//
//-----------------------------------------------------------------//
// * procedure SetupSpells; // by N1ke!
// * procedure DebugSpellVars(SpellMode: Integer); // by N1ke!
// * function GetSpellInfo(Spell: string): TSpell; // by N1ke!
// * function SpellIsSort(Spell: string): Integer; // by N1ke!
// * function SpellsAvaible: TBooleanArray; // by N1ke!, modified by marpis, fix by Cigue
// * procedure ClickSpellMode(Which: Integer); // by N1ke!
// * procedure SetSpellMode(Combat, Teleport, Misc, Skill: Boolean); // by N1ke!
// * function BookSortedBy: Integer; // by N1ke!
// * procedure SortBook(By: Integer); // by N1ke!
// * function DefCastIs: Boolean; // by N1ke!
// * procedure ToggleDefCast(SetTo: Boolean); // by N1ke!
// * procedure ScrollSpellBook(Up: Boolean); // by N1ke!
// * function SpellAvailable(var Coords: TBox; Spell: string): Boolean; // by N1ke!
// * function Cast(Spell: string; AutoCast: Boolean): Boolean; // by N1ke!
// * procedure SetupMagic; // by SRL
{ type TSpell;
Description: Contains info about a certain spell. }
type
TSpell = record
Name: string;
Level: Integer;
AutoCast: Boolean;
Exp: Extended;
end;
{ type SpellMode;
Description: An array of TSpell }
SpellMode = array of TSpell;
var
{ var SpellModes
Description: Stores all the spells, after using SetupSpells.
Use as SpellModes[SpellMode_Combat][I] example..}
SpellModes: array of SpellMode;
{ var SpellSetUp
Description: Is set to true if the spells are setup}
SpellSetUp: Boolean;
Const
{ const TotalSpells
Description: Number of spells in your spellbook}
TotalSpells = 64;
{ const SpellMode_
Description: consts for the in-game spellmodes
note: SpellMode_All stands for all of them}
SpellMode_Combat = 0;
SpellMode_Teleport = 1;
SpellMode_Misc = 2;
SpellMode_Skill = 3;
SpellMode_All = 10;
{ const BookSort_
Description: consts for the in-game magic book sorts}
BookSort_Level = 0;
BookSort_Combat = 1;
BookSort_Teleport = 2;
{*******************************************************************************
procedure SetupSpells;
By: N1ke!
Rev: 39
Date: 12 Sep 09
Description: Sets the SpellModes var to match the runescape spells.
*******************************************************************************}
procedure SetupSpells;
var
I, H: Integer;
Names: TstringArray;
Exps: TExtendedArray;
Levels, AutoCasts: TIntegerArray;
begin
SetArrayLength(SpellModes, 4);
{SpellMode_Combat}
Names := ['wind rush', 'wind strike', 'confuse', 'water strike', 'earth strike',
'weaken', 'fire strike', 'wind bolt', 'curse', 'bind',
'water bolt', 'earth bolt', 'fire bolt', 'crumble undead',
'wind blast', 'water blast', 'iban blast', 'snare',
'magic dart', 'earth blast', 'fire blast', 'saradomin strike',
'claws of guthix', 'flames of zamorak', 'wind wave',
'water wave', 'vulnerability', 'earth wave',
'enfeeble', 'fire wave', 'entangle', 'stun', 'charge',
'wind surge', 'teleport block', 'water surge', 'earth surge',
'fire surge'];
Levels := [1, 1, 3, 5, 9, 11, 13, 17, 19, 20, 23, 29, 35, 39,
41, 47, 50, 50, 50, 53, 59, 60, 60, 60, 62, 65,
66, 70, 73, 75, 79, 80, 80, 81, 85, 85, 90, 95];
Exps := [3.5, 5.5, 13, 7.5, 9.5, 21, 11.5, 13.5, 29, 30, 16.5, 19.5, 22.5, 24.5,
25.5, 28.5, 30, 60, 30, 31.5, 34.5, 35, 35, 35, 36, 37.5, 76,
40, 83, 42.5, 89, 90, 180, 75, 80, 80, 85, 90];
AutoCasts := [1, 2, 5, 8, 9, 17, 26, 28, 30, 31, 32, 34];
SetArrayLength(SpellModes[SpellMode_Combat], GetArrayLength(Names));
H := High(Names);
for I:=0 to H do
begin
SpellModes[SpellMode_Combat][I].Name := Names[I];
SpellModes[SpellMode_Combat][I].Level := Levels[I];
SpellModes[SpellMode_Combat][I].Exp := Exps[I];
SpellModes[SpellMode_Combat][I].AutoCast := (not InIntArray(AutoCasts, I));
end;
{SpellMode_Teleport}
Names := ['lumbridge home teleport', 'mobilising armies teleport',
'varrock teleport', 'lumbridge teleport',
'falador teleport', 'teleport to house',
'camelot teleport', 'ardougne teleport', 'watchtower teleport',
'trollheim teleport', 'teleport to ape atoll',
'teleother lumbridge', 'teleother falador',
'teleother camelot'];
Levels := [0, 10, 25, 31, 37, 40, 45, 51, 58, 61, 64, 74, 82, 90];
Exps := [0, 19, 35, 41, 48, 30, 55.5, 61, 68, 68, 74, 84, 92, 100];
SetArrayLength(SpellModes[SpellMode_Teleport], GetArrayLength(Names));
H := High(Names);
for I:=0 to High(Names)do
begin
SpellModes[SpellMode_Teleport][I].Name := Names[I];
SpellModes[SpellMode_Teleport][I].Level := Levels[I];
SpellModes[SpellMode_Teleport][I].Exp := Exps[I];
end;
{SpellMode_Misc}
Names := ['bones to bananas', 'low level alchemy', 'telekinetic grab',
'high level alchemy', 'bones to peaches'];
Levels := [15, 21, 33, 55, 60];
Exps := [25, 31, 43, 65, 35.5];
SetArrayLength(SpellModes[SpellMode_Misc], GetArrayLength(Names));
H := High(Names);
for I:=0 to High(Names)do
begin
SpellModes[SpellMode_Misc][I].Name := Names[I];
SpellModes[SpellMode_Misc][I].Level := Levels[I];
SpellModes[SpellMode_Misc][I].Exp := Exps[I];
end;
{SpellMode_Skill}
Names := ['enchant crossbow bolt', 'lvl-1 enchant', 'lvl-2 enchant',
'superheat item', 'lvl-3 enchant', 'charge water orb',
'lvl-4 enchant', 'charge earth orb', 'charge fire orb',
'charge air orb', 'lvl-5 enchant', 'lvl-6 enchant'];
Levels := [4, 7, 27, 43, 49, 56, 57, 60, 63, 66, 68, 87];
Exps := [0, 17.5, 37, 53, 59, 66, 67, 70, 73, 76, 78, 97];
SetArrayLength(SpellModes[SpellMode_Skill], GetArrayLength(Names));
H := High(Names);
for I:=0 to High(Names) do
with SpellModes[SpellMode_Skill][I] do
begin
SpellModes[SpellMode_Skill][I].Name := Names[I];
SpellModes[SpellMode_Skill][I].Level := Levels[I];
SpellModes[SpellMode_Skill][I].Exp := Exps[I];
end;
SpellSetUp := True;
end;
{*******************************************************************************
procedure DebugSpellVars(SpellMode: Integer);
By: N1ke!
Rev: 39
Date: 12 Sep 09
Description: Prints out the SpellModes var.
Valid parameters are
SpellMode_Combat
SpellMode_Teleport
SpellMode_Misc
SpellMode_Skill
SpellMode_All
for example, DebugSpellVars(SpellMode_Combat); would only
print out the combat spells.
*******************************************************************************}
procedure DebugSpellVars(SpellMode: Integer);
var
I, II, Total: Integer;
S: TstringArray;
begin
if not SpellSetUp then
SetupSpells;
if SpellMode = SpellMode_All then
begin
S := ['Combat', 'Teleport', 'Misc', 'Skill'];
for I := 0 to High(SpellModes) do
begin
Writeln('** Spellmode_' + S[I] + '**');
for II := 0 to High(SpellModes[I]) do
begin
Writeln('Spell: ' + Padr(SpellModes[I][II].Name + ' ', 27) + ' - Level needed: ' + Padr(IntToStr(SpellModes[I][II].Level) + ' ', 2) + ' - EXP per cast: ' + Padr(FloatToStr(SpellModes[I][II].Exp) + ' ', 2) + ' - AutoCast: ' + BoolToStr(SpellModes[I][II].AutoCast));
Inc(Total);
end;
Writeln('');
end;
Writeln('A total of ' + IntToStr(Total) + ' Spells.');
Exit;
end;
for I:=0 to High(SpellModes[SpellMode]) do
Writeln('Spell: ' + Padr(SpellModes[SpellMode][I].Name + ' ', 27) +
' - Level needed: ' + Padr(IntToStr(SpellModes[SpellMode][I].Level) +
' ', 2) + ' - EXP per cast: ' + Padr(FloatToStr(SpellModes[SpellMode][I].Exp) +
' ', 2) + ' - AutoCast: ' + BoolToStr(SpellModes[SpellMode][I].AutoCast));
end;
{*******************************************************************************
function GetSpellInfo(Spell: string): TSpell;
By: N1ke!
Rev: 39
Date: 12 Sep 09
Description: Gets a spells info from the SpellModes var and results
in a TSpell type.
*******************************************************************************}
function GetSpellInfo(Spell: string): TSpell;
var
I, II: Integer;
begin
if not SpellSetUp then
SetupSpells;
for I := 0 to 3 do
for II := 0 to High(SpellModes[I])do
if (Lowercase(Spell) = SpellModes[I][II].Name) then
begin
Result := SpellModes[I][II];
Exit;
end;
end;
{*******************************************************************************
function SpellIsSort(Spell: string): Integer;
By: N1ke!
Rev: 39
Date: 12 Sep 09
Description: Results what kind of sort the spell is..
Example of use - if (SpellIsSort('water strike') = SpellMode_Combat)then
*******************************************************************************}
function SpellIsSort(Spell: string): Integer;
var
II: Integer;
begin
for Result:=0 to High(SpellModes)do
for II:=0 to High(SpellModes[Result])do
if (Lowercase(Spell) = SpellModes[Result][II].Name)then
Exit;
end;
{*******************************************************************************
Function SpellsAvailable: TBooleanArray;
By: N1ke!
Rev: 39
Date: 12 Sep 09
Description: Results which sort of spells are available.
Result[0] = SpellMode_Combat
Result[1] = SpellMode_Teleport
Result[2] = SpellMode_Misc
Result[3] = SpellMode_Skill
*******************************************************************************}
function SpellsAvailable: TBooleanArray;
var
I: Integer;
begin
if not GameTab(Tab_Magic)then
Exit;
SetArrayLength(Result, 4);
for I := 0 to 3 do
if (GetColor(592+(I*20), 441) = 16711422) then //16777215 OLD COLOR
Result[I] := True;
end;
{*******************************************************************************
procedure ClickSpellMode(Which: Integer);
By: N1ke!
Rev: 39
Date: 12 Sep 09
Description: Clicks the given parameter.
Valid parameters are
SpellMode_Combat
SpellMode_Teleport
SpellMode_Misc
SpellMode_Skill
*******************************************************************************}
procedure ClickSpellMode(Which: Integer);
begin
if not GameTab(Tab_Magic)then
Exit;
Mouse(583+(Which*21), 441, 12, 16, True);
Wait(70+Random(70));
end;
{*******************************************************************************
Procedure SetSpellMode(Combat, Teleport, Misc, Skill: Boolean);
By: N1ke!
Rev: 39
Date: 12 Sep 09
Description: Sets the spellmodes on and off for each mode.
*******************************************************************************}
procedure SetSpellMode(Combat, Teleport, Misc, Skill: Boolean);
var
I: Integer;
BoolArr: array [0..1] of TBooleanArray;
begin
BoolArr[0] := SpellsAvailable;
BoolArr[1] := [Combat, Teleport, Misc, Skill];
for I:=0 to High(BoolArr[0]) do
if not (BoolArr[0][I] = BoolArr[1][I]) then
ClickSpellMode(I);
end;
{*******************************************************************************
function BookSortedBy: Integer;
By: N1ke!
Rev: 39
Date: 12 Sep 09
Description: Results how the book is sorted.
Possible results are
BookSort_Level = 0
BookSort_Combat = 1
BookSort_Teleport = 2
*******************************************************************************}
function BookSortedBy: Integer;
begin
Result := -1;
if not GameTab(Tab_Magic) then
Exit;
for Result := 0 to 2 do
if (GetColor(676+(Result*19), 441) = 16711422) then //16777215 OLD COLOR
Exit;
end;
{*******************************************************************************
procedure SortBook(By: Integer);
By: N1ke!
Rev: 39
Date: 12 Sep 09
Description: Sorts the book from given parameter.
Valid parameters are
BookSort_Level = 0
BookSort_Combat = 1
BookSort_Teleport = 2
*******************************************************************************}
procedure SortBook(By: Integer);
begin
if (not GameTab(Tab_Magic)) or (BookSortedBy = By) then
Exit;
Mouse(676+(By*19), 441, 12, 16, True);
end;
{*******************************************************************************
Function DefCastIs: Boolean;
By: N1ke!
Rev: 39
Date: 12 Sep 09
Description: Results if defensive casting is enabled.
*******************************************************************************}
function DefCastIs: Boolean;
begin
if not Gametab(tab_Magic) then
Exit;
Result := (LoggedIn) and (GetColor(563, 441) = 16711422);
end;
{*******************************************************************************
procedure ToggleDefCast(SetTo: Boolean);
By: N1ke!
Rev: 39
Date: 12 Sep 09
Description: Turns defensive casting on/off.
*******************************************************************************}
procedure ToggleDefCast(SetTo: Boolean);
begin
if (not Gametab(tab_Magic)) or (DefCastIs = SetTo) then
Exit;
Mouse(556, 443, 12, 14, True);
Wait(70+Random(70));
end;
{*******************************************************************************
procedure ScrollSpellBook(Up: Boolean);
By: N1ke!
Rev: 39
Date: 12 Sep 09
Description: Scrolls the spellbook, up or down.
*******************************************************************************}
procedure ScrollSpellBook(Up: Boolean);
var
iTime, X, Y: Integer;
SBox, CBox: TPoint;
begin
if (not GameTab(tab_Magic))then
Exit;
if Up then
begin
CBox := Point(728, 223);
SBox := Point(722, 209);
end else
begin
CBox := Point(729, 415);
SBox := Point(723, 421);
end;
if not (GetColor(CBox.X, CBox.Y) = 2041131)then //2106924
Exit;
MMouse(SBox.X, SBox.Y, 8, 8);
GetMousePos(X, Y);
HoldMouse(X, Y, mouseaction(True));
iTime := GetSystemTime + 3000;
while (GetColor(CBox.X, CBox.Y) = 2041131) do
begin
Wait(140+Random(100));
if (GetSystemTime > iTime) then
Break;
end;
ReleaseMouse(X, Y, MouseAction(True));
Wait(200+Random(100));
end;
{*******************************************************************************
function SpellAvailable(var Coords: TBox; Spell: string): Boolean;
By: N1ke! modified by marpis, fixed by Cigue (8th July 2010)
Rev: 40
Date: 12 Sep 09
Description: Results true if the given spell is available and can be
casted. Also stores coords in a TBox var where the spell is located.
Will work however the spells are sorted, visable or not(Will enable
the spells sort if not enabled).
*******************************************************************************}
function SpellAvailable(var Coords: TBox; Spell: string): Boolean;
var
t_spArr: TstringArray;
I, II, P, CTS, X, Y, T, Fail: Integer;
Lum, H, S, L: Extended;
CurSet: TBooleanArray;
colArr: TIntegerArray;
ScrollB: Boolean;
begin
if not LoggedIn then
Exit;
if not SpellSetUp then
SetupSpells;
{
if (FindColor(X, Y, 2070783, MIX1, MIY1, MIX2, MIY2)) then
begin
MouseBox(MMX1, MMY1, MMX2, MMY2, 3);
Wait(100+Random(300));
end;
}
for I := 0 to 1 do
begin
case BookSortedBy of
BookSort_Level:
t_spArr := ['lumbridge home teleport', 'wind rush', 'wind strike', 'confuse', 'enchant crossbow bolt', 'water strike', 'lvl-1 enchant',
'earth strike', 'mobilising armies teleport', 'weaken', 'fire strike', 'bones to bananas', 'wind bolt', 'curse', 'bind', 'low level alchemy',
'water bolt', 'varrock teleport', 'lvl-2 enchant', 'earth bolt', 'lumbridge teleport', 'telekinetic grab',
'fire bolt', 'falador teleport', 'crumble undead', 'teleport to house', 'wind blast', 'superheat item', 'camelot teleport',
'water blast', 'lvl-3 enchant', 'iban blast', 'snare', 'magic dart', 'ardougne teleport', 'earth blast', 'high level alchemy',
'charge water orb', 'lvl-4 enchant', 'watchtower teleport', 'fire blast', 'charge earth orb', 'bones to peaches',
'saradomin strike', 'claws of guthix', 'flames of zamorak', 'trollheim teleport', 'wind wave', 'charge fire orb',
'teleport to ape atoll', 'water wave', 'charge air orb', 'vulnerability', 'lvl-5 enchant', 'earth wave', 'enfeeble',
'teleother lumbridge', 'fire wave', 'entangle', 'stun', 'charge', 'wind surge', 'teleother falador', 'teleport block', 'water surge',
'lvl-6 enchant', 'earth surge', 'teleother camelot', 'fire surge'];
BookSort_Combat:
t_spArr := ['wind rush', 'wind strike', 'water strike', 'earth strike', 'fire strike', 'confuse', 'weaken', 'curse', 'wind bolt', 'water bolt',
'earth bolt', 'fire bolt', 'bind', 'crumble undead', 'wind blast', 'water blast', 'earth blast', 'fire blast', 'iban blast',
'snare', 'magic dart', 'wind wave', 'water wave', 'earth wave', 'fire wave', 'saradomin strike', 'claws of guthix',
'flames of zamorak', 'wind surge', 'water surge', 'earth surge', 'fire surge', 'vulnerability', 'enfeeble', 'entangle', 'stun', 'charge', 'teleport block', 'lvl-1 enchant',
'lvl-2 enchant', 'lvl-3 enchant', 'lvl-4 enchant', 'lvl-5 enchant', 'lvl-6 enchant', 'enchant crossbow bolt', 'superheat item', 'charge water orb',
'charge earth orb', 'charge fire orb', 'charge air orb', 'low level alchemy', 'high level alchemy', 'telekinetic grab', 'bones to bananas',
'bones to peaches', 'lumbridge home teleport', 'mobilising armies teleport', 'varrock teleport', 'lumbridge teleport', 'falador teleport',
'teleport to house', 'camelot teleport', 'ardougne teleport', 'watchtower teleport', 'trollheim teleport', 'teleport to ape atoll',
'teleother lumbridge', 'teleother falador', 'teleother camelot'];
BookSort_Teleport:
t_spArr := ['lumbridge home teleport', 'mobilising armies teleport', 'varrock teleport', 'lumbridge teleport', 'falador teleport',
'teleport to house', 'camelot teleport', 'ardougne teleport', 'watchtower teleport', 'trollheim teleport', 'teleport to ape atoll',
'teleother lumbridge', 'teleother falador', 'teleother camelot', 'low level alchemy', 'high level alchemy', 'telekinetic grab', 'bones to bananas',
'bones to peaches', 'lvl-1 enchant', 'lvl-2 enchant', 'lvl-3 enchant', 'lvl-4 enchant', 'lvl-5 enchant', 'lvl-6 enchant', 'enchant crossbow bolt', 'superheat item',
'charge water orb', 'charge earth orb', 'charge fire orb', 'charge air orb', 'wind strike', 'water strike', 'earth strike', 'fire strike', 'confuse',
'weaken', 'curse', 'wind bolt', 'water bolt', 'earth bolt', 'fire bolt', 'bind', 'crumble undead', 'wind blast', 'water blast', 'earth blast',
'fire blast', 'iban blast', 'snare', 'magic dart', 'wind wave', 'water wave', 'earth wave', 'fire wave', 'saradomin strike', 'claws of guthix',
'flames of zamorak', 'wind surge', 'water surge', 'earth surge', 'fire surge', 'vulnerability', 'enfeeble', 'entangle', 'stun', 'charge', 'teleport block'];
else
begin
Inc(Fail);
MouseBox(MIX1, MIY2-30, MIX2, MIY2-20, 3);
Wait(200 + random(100));
if (Fail = 2) then
begin
SRL_Warn('Cast', 'Invalid BookSort', warn_AllVersions);
Exit;
end;
end;
end; // case
if (Fail = 0) then Break;
end; //for-loop
if not InStrArr(Spell, t_spArr, False)then
begin
srl_Warn('Cast', 'Incorrect spell', warn_AllVersions);
Exit;
end;
if not InIntArray([SpellMode_Combat, SpellMode_Teleport,
SpellMode_Misc, SpellMode_Skill], SpellIsSort(Spell))then
begin
srl_Warn('Cast', 'Incorrect spellkind', warn_AllVersions);
Exit;
end;
if BookSortedBy = BookSort_Level then
SortBook(BookSort_Level);
CurSet := SpellsAvailable;
I := SpellIsSort(Spell);
if not CurSet[I] then
begin
CurSet[I] := True;
SetSpellMode(CurSet[SpellMode_Combat], CurSet[SpellMode_Teleport], CurSet[SpellMode_Misc], CurSet[SpellMode_Skill]);
end;
for I:=0 to 3 do
if not CurSet[I] then
for II:=0 to High(SpellModes[I])do
if InStrArrEx(SpellModes[I][II].Name, t_spArr, P)then
DeleteValueInStrArray(t_spArr, P);
if not InStrArrEx(Spell, t_spArr, P)then
begin
srl_Warn('Cast', 'Cast function error', warn_AllVersions);
Exit;
end;
if InStrArrEx('enchant crossbow bolt', t_spArr, II)then
if (P > II)then
begin
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.02, 0.70);
if (CountColorTolerance(1147846, MIX1, MIY1, MIX2, MIY2, 13) < 14) then
Dec(P);
ColorToleranceSpeed(CTS);
SetToleranceSpeed2Modifiers(2, 2);
end;
ScrollB := (GetColor(734, 207) = 5794936); // True if scrollbar is present
if (ScrollB) then
begin
Coords.X1 := P mod 6 * 24 + 565;
Coords.Y1 := P div 6 * 24 + 217;
Coords.X2 := Coords.X1 + 15;
Coords.Y2 := Coords.Y1 + 15;
end else
begin
Coords.X1 := P mod 7 * 24 + 562;
Coords.Y1 := P div 7 * 24 + 217;
Coords.X2 := Coords.X1 + 15;
Coords.Y2 := Coords.Y1 + 15;
end;
if (ScrollB)and(P > 53)then
begin
ScrollSpellBook(False);
Coords.Y1 := Coords.Y1 - 80;
Coords.Y2 := Coords.Y1 + 15;
end else
ScrollSpellBook(True);
MouseBox(Coords.X1, Coords.Y1, Coords.X2, Coords.Y2, 3);
T := GetSystemTime + 2000;
while (GetSystemTime < T) do
if FindColor(X, Y, 2070783, MIX1, MIY1, MIX2, MIY2) then
Break;
colArr := GetColors(TPAFromBox(Coords));
ClearSameIntegers(colArr);
CTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.72, 1.05);
for II := 0 to High(colArr) do
begin
if (SimilarColors(colArr[II], 3292228, 3)) then Continue;
ColorToHSL(colArr[II], H, S, L);
Lum := MaxE(Lum, L);
end;
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(CTS);
Result := (Lum > 40.0);
end;
{*******************************************************************************
Function Cast(Spell: string; AutoCast: Boolean): Boolean;
By: N1ke!
Rev: 39
Date: 12 Sep 09
Description: Results true if the spell given is clicked.
if Autocast is true, it'll toggle the spell to autocast.
Will work however the spells are sorted, visable or not(Will enable
the spells sort if not enabled).
*******************************************************************************}
function Cast(Spell: string; AutoCast: Boolean): Boolean;
var
X, Y: Integer;
B: TBox;
SInfo: TSpell;
begin
if not LoggedIn then
Exit;
SInfo := GetSpellInfo(Spell);
if AutoCast then
if not SInfo.AutoCast then
begin
srl_Warn('Cast', Spell + ' is not autocast-able', warn_AllVersions);
Exit;
end;
if not SpellAvailable(B, Spell) then
Exit;
// Mousebox(B.X1, B.Y1, B.X2, B.Y2, 3);
GetMousePos(X, Y);
if AutoCast then
begin
if not WaitUpText('Autocast', 120+Random(100)) then
Exit;
if not(CountColor(16711422, B.X1-10, B.Y1-10, B.X2+10, B.Y2+10) > 50) then
begin
Mouse(X, Y, 0, 0, True);
Result := True;
end;
Exit;
end;
Mouse(X, Y, 0, 0, not SInfo.AutoCast);
if SInfo.AutoCast then
Result := WaitOption('Cast', 120+Random(100))
else
Result := WaitUpText('Cast', 120+Random(100));
end;
{*******************************************************************************
procedure SetupMagic;
By: SRL
Description: Declares Global Bitmaps.
*******************************************************************************}
procedure SetupMagic;
begin
end;
Patch:
Index: magic.scar
===================================================================
--- magic.scar (revision 641)
+++ magic.scar (working copy)
@@ -23,8 +23,9 @@
type
TSpell = record
Name: string;
- Level, Exp: Integer;
+ Level: Integer;
AutoCast: Boolean;
+ Exp: Extended;
end;
{ type SpellMode;
@@ -74,12 +75,13 @@
var
I, H: Integer;
Names: TstringArray;
- Levels, Exps, AutoCasts: TIntegerArray;
+ Exps: TExtendedArray;
+ Levels, AutoCasts: TIntegerArray;
begin
SetArrayLength(SpellModes, 4);
{SpellMode_Combat}
- Names := ['wind strike', 'confuse', 'water strike', 'earth strike',
+ Names := ['wind rush', 'wind strike', 'confuse', 'water strike', 'earth strike',
'weaken', 'fire strike', 'wind bolt', 'curse', 'bind',
'water bolt', 'earth bolt', 'fire bolt', 'crumble undead',
'wind blast', 'water blast', 'iban blast', 'snare',
@@ -90,15 +92,15 @@
'wind surge', 'teleport block', 'water surge', 'earth surge',
'fire surge'];
- Levels := [1, 3, 5, 9, 11, 13, 17, 19, 20, 23, 29, 35, 39,
+ Levels := [1, 1, 3, 5, 9, 11, 13, 17, 19, 20, 23, 29, 35, 39,
41, 47, 50, 50, 50, 53, 59, 60, 60, 60, 62, 65,
66, 70, 73, 75, 79, 80, 80, 81, 85, 85, 90, 95];
- Exps := [6, 13, 8, 10, 21, 12, 14, 29, 30, 17, 20, 23, 25,
- 26, 29, 43, 61, 30, 32, 35, 35, 35, 35, 36, 38, 76,
- 40, 83, 43, 91, 90, 180, 75, 80, 80, 85, 90];
+ Exps := [3.5, 5.5, 13, 7.5, 9.5, 21, 11.5, 13.5, 29, 30, 16.5, 19.5, 22.5, 24.5,
+ 25.5, 28.5, 30, 60, 30, 31.5, 34.5, 35, 35, 35, 36, 37.5, 76,
+ 40, 83, 42.5, 89, 90, 180, 75, 80, 80, 85, 90];
- AutoCasts := [1, 4, 7, 8, 16, 25, 27, 29, 30, 31, 33];
+ AutoCasts := [1, 2, 5, 8, 9, 17, 26, 28, 30, 31, 32, 34];
SetArrayLength(SpellModes[SpellMode_Combat], GetArrayLength(Names));
H := High(Names);
@@ -122,7 +124,7 @@
Levels := [0, 10, 25, 31, 37, 40, 45, 51, 58, 61, 64, 74, 82, 90];
- Exps := [0, 19, 35, 41, 48, 30, 56, 61, 68, 68, 74, 84, 92, 100];
+ Exps := [0, 19, 35, 41, 48, 30, 55.5, 61, 68, 68, 74, 84, 92, 100];
SetArrayLength(SpellModes[SpellMode_Teleport], GetArrayLength(Names));
H := High(Names);
@@ -140,7 +142,7 @@
Levels := [15, 21, 33, 55, 60];
- Exps := [25, 31, 43, 65, 36];
+ Exps := [25, 31, 43, 65, 35.5];
SetArrayLength(SpellModes[SpellMode_Misc], GetArrayLength(Names));
H := High(Names);
@@ -160,7 +162,7 @@
Levels := [4, 7, 27, 43, 49, 56, 57, 60, 63, 66, 68, 87];
- Exps := [0, 18, 37, 53, 59, 66, 67, 70, 73, 76, 78, 97];
+ Exps := [0, 17.5, 37, 53, 59, 66, 67, 70, 73, 76, 78, 97];
SetArrayLength(SpellModes[SpellMode_Skill], GetArrayLength(Names));
H := High(Names);
@@ -208,7 +210,7 @@
Writeln('** Spellmode_' + S[I] + '**');
for II := 0 to High(SpellModes[I]) do
begin
- Writeln('Spell: ' + Padr(SpellModes[I][II].Name + ' ', 27) + ' - Level needed: ' + Padr(IntToStr(SpellModes[I][II].Level) + ' ', 2) + ' - EXP per cast: ' + Padr(IntToStr(SpellModes[I][II].Exp) + ' ', 2) + ' - AutoCast: ' + BoolToStr(SpellModes[I][II].AutoCast));
+ Writeln('Spell: ' + Padr(SpellModes[I][II].Name + ' ', 27) + ' - Level needed: ' + Padr(IntToStr(SpellModes[I][II].Level) + ' ', 2) + ' - EXP per cast: ' + Padr(FloatToStr(SpellModes[I][II].Exp) + ' ', 2) + ' - AutoCast: ' + BoolToStr(SpellModes[I][II].AutoCast));
Inc(Total);
end;
Writeln('');
@@ -220,7 +222,7 @@
for I:=0 to High(SpellModes[SpellMode]) do
Writeln('Spell: ' + Padr(SpellModes[SpellMode][I].Name + ' ', 27) +
' - Level needed: ' + Padr(IntToStr(SpellModes[SpellMode][I].Level) +
- ' ', 2) + ' - EXP per cast: ' + Padr(IntToStr(SpellModes[SpellMode][I].Exp) +
+ ' ', 2) + ' - EXP per cast: ' + Padr(FloatToStr(SpellModes[SpellMode][I].Exp) +
' ', 2) + ' - AutoCast: ' + BoolToStr(SpellModes[SpellMode][I].AutoCast));
end;
@@ -378,7 +380,7 @@
begin
if not Gametab(tab_Magic) then
Exit;
- Result := (LoggedIn) and (GetColor(563, 441) = 16777215);
+ Result := (LoggedIn) and (GetColor(563, 441) = 16711422);
end;
{*******************************************************************************
@@ -422,14 +424,14 @@
SBox := Point(723, 421);
end;
- if not (GetColor(CBox.X, CBox.Y) = 2106924)then
+ if not (GetColor(CBox.X, CBox.Y) = 2041131)then //2106924
Exit;
MMouse(SBox.X, SBox.Y, 8, 8);
GetMousePos(X, Y);
HoldMouse(X, Y, mouseaction(True));
iTime := GetSystemTime + 3000;
- while (GetColor(CBox.X, CBox.Y) = 2106924) do
+ while (GetColor(CBox.X, CBox.Y) = 2041131) do
begin
Wait(140+Random(100));
if (GetSystemTime > iTime) then
@@ -475,7 +477,7 @@
begin
case BookSortedBy of
BookSort_Level:
- t_spArr := ['lumbridge home teleport', 'wind strike', 'confuse', 'enchant crossbow bolt', 'water strike', 'lvl-1 enchant',
+ t_spArr := ['lumbridge home teleport', 'wind rush', 'wind strike', 'confuse', 'enchant crossbow bolt', 'water strike', 'lvl-1 enchant',
'earth strike', 'mobilising armies teleport', 'weaken', 'fire strike', 'bones to bananas', 'wind bolt', 'curse', 'bind', 'low level alchemy',
'water bolt', 'varrock teleport', 'lvl-2 enchant', 'earth bolt', 'lumbridge teleport', 'telekinetic grab',
'fire bolt', 'falador teleport', 'crumble undead', 'teleport to house', 'wind blast', 'superheat item', 'camelot teleport',
@@ -487,7 +489,7 @@
'lvl-6 enchant', 'earth surge', 'teleother camelot', 'fire surge'];
BookSort_Combat:
- t_spArr := ['wind strike', 'water strike', 'earth strike', 'fire strike', 'confuse', 'weaken', 'curse', 'wind bolt', 'water bolt',
+ t_spArr := ['wind rush', 'wind strike', 'water strike', 'earth strike', 'fire strike', 'confuse', 'weaken', 'curse', 'wind bolt', 'water bolt',
'earth bolt', 'fire bolt', 'bind', 'crumble undead', 'wind blast', 'water blast', 'earth blast', 'fire blast', 'iban blast',
'snare', 'magic dart', 'wind wave', 'water wave', 'earth wave', 'fire wave', 'saradomin strike', 'claws of guthix',
'flames of zamorak', 'wind surge', 'water surge', 'earth surge', 'fire surge', 'vulnerability', 'enfeeble', 'entangle', 'stun', 'charge', 'teleport block', 'lvl-1 enchant',
@@ -572,7 +574,7 @@
SetToleranceSpeed2Modifiers(2, 2);
end;
- ScrollB := (GetColor(734, 207) = 5860729); // True if scrollbar is present
+ ScrollB := (GetColor(734, 207) = 5794936); // True if scrollbar is present
if (ScrollB) then
begin
Everything should now be in working order.