SRL Archive - Devs' Corner

Reflection Patch for Rev 73


Nava2

2010-05-31 18:29:35

APPLY THIS OR *something equivalent to dieing, but less offensive*

Index: Antirandoms/Molly.Simba
===================================================================
--- Antirandoms/Molly.Simba (revision 73)
+++ Antirandoms/Molly.Simba (working copy)
@@ -230,11 +230,11 @@
FindNPC(TwinID, Twin);
B := (ClawTile.x = Twin.Tile.x) and (ClawTile.y = Twin.Tile.y);
end;
- s := LastChatMessage('all');
+ s := LastChatMessage(CHAT_TYPE_ALL);
Mouse(693, 416, 10, 10, True);
- while s = LastChatMessage('all') do
+ while s = LastChatMessage(CHAT_TYPE_ALL) do
Wait(100);
- Result := Pos('caught', LastChatMessage('all')) <> 0;
+ Result := Pos('caught', LastChatMessage(CHAT_TYPE_ALL)) <> 0;
end;
while not ValidInterface(241) do
Wait(100);
Index: Characters.Simba
===================================================================
--- Characters.Simba (revision 73)
+++ Characters.Simba (working copy)
@@ -1,30 +1,4 @@
-type
-{ type TNPC;
- Description: Holds information related to an NPC. }
- TNPC = record
- Index, ID, Level, Animation, Height, HPRatio,
- Orientation: integer;// SOUTH = 0; NORTH = 180; CLOCKWISE.
- Tile: TTile;
- Name: String;
- Actions: TStringArray;
- Moving, Fighting: boolean;
- end;
-{ type TMe;
- Description: Holds information related to your character. }
- TMe = record
- Tile: TTile;
- MS: TPoint;
- Animation, Speed, LoginIndex: Integer;
- HPRatio, Height, Level, Combat, TurnDirection: Integer;
- Name: string;
- InFight: boolean;
- Experience, Levels: array[0..23] of Integer;
- Equipment: TIntegerArray;
- Orientation: Integer; // SOUTH = 0; NORTH = 180; CLOCKWISE.
- end;

- TNPCArray = array of TNPC;
-
{*******************************************************************************
Function GetAnimation: Integer;
By: lordsaturn
@@ -67,16 +41,19 @@
*******************************************************************************}
function GetNPCActionArray(NPCDef: integer): TStringArray;
var
- i, bytes: integer;
+ i, c, bytes: integer;
begin
+ SetLength(Result, 11);
+ c := 0;
for i := 0 to 10 do
begin
bytes := SmartGetFieldArrayObject(NPCDef, hook_npcdef_GetActions, i);
if(bytes > 0)then
begin
- SetArrayLength(Result, Length(Result)+1);
- Result[High(Result)] := GetJavaString(bytes, 255)
+ Result[c] := GetJavaString(bytes, 255);
+ inc(c);
end;
+ SmartFreeObject(bytes);
end;
end;

@@ -158,25 +135,33 @@
*******************************************************************************}
function GetNPCsBy(TheVar: Variant): TNPCArray;
var
- vType, i: Integer;
+ vType, i, resCounter: Integer;
NPCs: TNPCArray;
b: boolean;
begin
+ {
+ Initialize the result array, setup for looping.
+ }
NPCs := GetNPCs;
+ SetLength(Result, Length(NPCs));
vType := VarType(TheVar);
- for i := 0 to High(NPCs) do
+ if (vType = varString) then
+ TheVar := LowerCase(Trim(TheVar));
+
+ for i := High(NPCs) downto 0 do
begin
- if vType = 256 then TheVar := LowerCase(Trim(TheVar));
case vType of
- 3: B := NPCs[i].ID = TheVar;
- 256: B := (Pos(TheVar, LowerCase(Trim(NPCs[i].Name))) > 0);
+ varInteger: B := NPCs[i].ID = TheVar;
+ varString: B := (Pos(TheVar, LowerCase(Trim(NPCs[i].Name))) > 0);
else Exit;
end;
if not B then
Continue;
- SetLength(Result, Length(Result)+1);
- Result[High(Result)] := NPCs[i];
+ Result[resCounter] := NPCs[i];
+ inc(resCounter);
end;
+
+ SetLength(Result, resCounter);
end;

{*******************************************************************************
@@ -184,17 +169,29 @@
By: Drags111
Description: Stores all the loaded NPCs into an array of TNPC;
*******************************************************************************}
-function GetNPCByIndex(Idx : integer):TNPC;
+function GetNPC(theVar: Variant):TNPC;
var
NPCs: TNPCArray;
- i: integer;
+ i, vType: Integer;
+ B: Boolean;
begin
+ Result := NULL_NPC;
+ vType := VarType(TheVar);
+ if (vType = varString) then
+ TheVar := LowerCase(TheVar);
NPCs := GetNPCs;
- for i := 0 to High(NPCs) do
+ for i := High(NPCs) downto 0 do
begin
- if not (NPCs[i].Index = Idx) then
- Continue;
- Result := NPCs[i];
+ case (vType) of
+ varInteger: B := NPCs[i].ID = TheVar;
+ varString: B := (Pos(TheVar, LowerCase(NPCs[i].Name)) > 0);
+ else Continue;
+ end;
+ if (B) then
+ begin
+ Result := NPCs[i];
+ Exit;
+ end;
end;
end;

@@ -232,6 +229,7 @@
var
NPCs: TNPCArray;
begin
+ NPC := NULL_NPC;
NPCs := SortNPCs(GetNPCsBy(TheVar));
result := GetArrayLength(NPCs)<>0;
if not result then
@@ -249,11 +247,12 @@
NPCs: TNPCArray;
i, Hi: integer;
begin
+ NPC := NULL_NPC;
NPCs := SortNPCs(GetNPCsBy(TheVar));
Hi := High(NPCs);
if Hi < 0 then Exit;
for i := 0 to Hi do
- if not NPCs[i].Fighting then
+ if (not NPCs[i].Fighting) then
begin
Result := True;
NPC := NPCs[i];
@@ -285,7 +284,7 @@

{*******************************************************************************
function GetMe: TMe;
-By: Widget edited by lordsaturn and drags111
+By: Widget, lordsaturn, Drags111
Description: Returns you
*******************************************************************************}
function GetMe: TMe; // Sounds funny =P
@@ -313,15 +312,3 @@
end;
end;

-
-
-
-
-
-
-
-
-
-
-
-
Index: Chat.Simba
===================================================================
--- Chat.Simba (revision 73)
+++ Chat.Simba (working copy)
@@ -10,27 +10,27 @@
'black', 'message': Black chat messages
'all': All of the above
*******************************************************************************}
-function GetChatMessages(ChatType: string; Visible, NoName: Boolean): TStringArray;

+function GetChatMessages(ChatType: Integer; Visible, NoName: Boolean): TStringArray;
var
I, L: integer;
FindStr, tmp, s: string;
-
begin
- case Lowercase(ChatType) of
- 'chat', 'normal': FindStr := '<col=0000ff>';
- 'pm', 'private': FindStr := '<col=800000>';
- 'trade': FindStr := '<col=800080>';
- 'black', 'message': FindStr := 'blk';
- 'all': FindStr := 'all';
+ Result := [];
+ case (ChatType) of
+ CHAT_TYPE_NORMAL: FindStr := '<col=0000ff>';
+ CHAT_TYPE_CHATTER: FindStr := '<col=800000>';
+ CHAT_TYPE_PRIVATE: FindStr := '<col=800080>';
+ CHAT_TYPE_SYSTEM: FindStr := 'blk';
+ CHAT_TYPE_ALL: FindStr := 'all';
else
begin
- srl_Warn('GetChatMessages', ChatType+' is not a valid chat type.', warn_AllVersions);
- SetArrayLength(Result, 0);
+ srl_Warn('GetChatMessages', ToStr(ChatType)+' is not a valid chat type.',
+ warn_AllVersions);
Exit;
end;
end;
- SetArrayLength(Result, 100);
+ SetArrayLength(Result, 102);
for I := 282 downto 180 do
begin
s := GetInterfaceText(137, I);
@@ -53,12 +53,12 @@
end;

{*******************************************************************************
-function ChatBoxTextExists(ChatType, Text: string): Boolean;
+function ChatBoxTextExists(ChatType: Integer; Text: string): Boolean;
By: lordsaturn
Description: Returns true if text exists and is visible in the chatbox according
to 'ChatType'.
*******************************************************************************}
-function ChatBoxTextExists(ChatType, Text: string): Boolean;
+function ChatBoxTextExists(ChatType: Integer; Text: string): Boolean;
var
s : TStringArray;
I, H : integer;
@@ -88,17 +88,17 @@
srl_Warn('GetChatBoxLine', 'The paramater ''Line'' must be between 1 and 8.', warn_AllVersions);
Exit;
end;
- s := GetChatMessages('all', True, False);
+ s := GetChatMessages(CHAT_TYPE_ALL, True, False);
Result := s[8-line];
end;

{*******************************************************************************
-function LastChatMessage(ChatType: string): string;
+function LastChatMessage(ChatType: Integer): string;
By: lordsaturn
Description: Gets last chat message loaded according to 'ChatType'. (see
GetChatMessages for a list of chat types)
*******************************************************************************}
-function LastChatMessage(ChatType: string): string;
+function LastChatMessage(ChatType: Integer): string;

var
S : TStringArray;
@@ -116,13 +116,11 @@
Description: Gets the last loaded player to talk.
*******************************************************************************}
function R_LastChatter: string;
-
var
S : TStringArray;
P : integer;
-
begin
- S := GetChatMessages('chat', False, False);
+ S := GetChatMessages(CHAT_TYPE_CHATTER, False, False);
try
Result := S[0];
except
Index: Constants.Simba
===================================================================
--- Constants.Simba (revision 73)
+++ Constants.Simba (working copy)
@@ -1,3 +1,11 @@
+{
+ NULL_* Constants.
+ Used to compare whether a value was correctly created.
+}
+const
+ NULL_INT = -1;
+ NULL_STRING = '';
+
{ Constants for Random Reporting }
const
{ const RandomCount;
@@ -11,36 +19,245 @@
{Global Variables for Random Reporting}
var
RSolved, RFailed : array [1..RandomCount] of Integer;
- R_RandomsDetected: integer;
+ // R_RandomsDetected: integer;

const
+// feel free to explain these better..
//--------Interface Constants---------\\
- INTERFACE_INVENTORY = 149;
- INTERFACE_INVENTORY_BANKOPEN = 763;
+ INTERFACE_INVENTORY = 149;
+ INTERFACE_INVENTORY_BANKOPEN = 763;

- INTERFACE_EQUIPMENT = 387;
+ INTERFACE_EQUIPMENT = 387;

- INTERFACE_BANK = 762;
- INTERFACE_BANK_PIN = 13;
- INTERFACE_BANK_BUTTON_CLOSE = 42;
- INTERFACE_BANK_BUTTON_DEPOSIT_BEAST_INVENTORY = 36;
- INTERFACE_BANK_BUTTON_DEPOSIT_CARRIED_ITEMS = 32;
- INTERFACE_BANK_BUTTON_DEPOSIT_WORN_ITEMS = 34;
- INTERFACE_BANK_BUTTON_HELP = 43;
- INTERFACE_BANK_BUTTON_INSERT = 15;
- INTERFACE_BANK_BUTTON_ITEM = 19;
- INTERFACE_BANK_BUTTON_NOTE = 19;
- INTERFACE_BANK_BUTTON_SEARCH = 17;
- INTERFACE_BANK_BUTTON_SWAP = 15;
- INTERFACE_BANK_INVENTORY = 92;
- INTERFACE_BANK_ITEM_FREE_COUNT = 23;
- INTERFACE_BANK_ITEM_FREE_MAX = 24;
- INTERFACE_BANK_ITEM_MEMBERS_COUNT = 25;
- INTERFACE_BANK_ITEM_MEMBERS_MAX = 26;
- INTERFACE_BANK_SCROLLBAR = 114;
+ INTERFACE_BANK = 762;
+ INTERFACE_BANK_PIN = 13;
+ INTERFACE_BANK_BUTTON_CLOSE = 42;
+ INTERFACE_BANK_BUTTON_DEPOSIT_BEAST_INVENTORY = 36;
+ INTERFACE_BANK_BUTTON_DEPOSIT_CARRIED_ITEMS = 32;
+ INTERFACE_BANK_BUTTON_DEPOSIT_WORN_ITEMS = 34;
+ INTERFACE_BANK_BUTTON_HELP = 43;
+ INTERFACE_BANK_BUTTON_INSERT = 15;
+ INTERFACE_BANK_BUTTON_ITEM = 19;
+ INTERFACE_BANK_BUTTON_NOTE = 19;
+ INTERFACE_BANK_BUTTON_SEARCH = 17;
+ INTERFACE_BANK_BUTTON_SWAP = 15;
+ INTERFACE_BANK_INVENTORY = 92;
+ INTERFACE_BANK_ITEM_FREE_COUNT = 23;
+ INTERFACE_BANK_ITEM_FREE_MAX = 24;
+ INTERFACE_BANK_ITEM_MEMBERS_COUNT = 25;
+ INTERFACE_BANK_ITEM_MEMBERS_MAX = 26;
+ INTERFACE_BANK_SCROLLBAR = 114;

-//--------Object Constants--------\\
- INTERACTABLE = 0;
- WALLOBJECT = 1;
- WALLDECOR = 2;
- FLOORDECOR = 3;
+{
+ Chat Constants:
+}
+const
+ CHAT_TYPE_NORMAL = 0;
+ CHAT_TYPE_CHATTER = 1;
+ // Private
+ CHAT_TYPE_PRIVATE = 2;
+ // Trade
+ CHAT_TYPE_TRADE = 3;
+ // Black/System
+ CHAT_TYPE_SYSTEM = 4;
+ // Includes all the former Types
+ CHAT_TYPE_ALL = 5;
+
+{
+ Records:
+}
+
+{*******************************************************************************
+TRenderData - Stores the rotation matrix used by the client to render to
+ the main screen, along with offsets.
+TRender - Stores information about the rendered world including ranges
+ for acceptable values, and scaling factors.
+TTile - equivlent to a TPoint, but signifies a global tile position in the
+ Runescape client. Not to be used for any other purpose.
+*******************************************************************************}
+type
+ TRenderData = record
+ xOff,xX,xY,xZ : extended;
+ yOff,yX,yY,yZ : extended;
+ zOff,zX,zY,zZ : extended;
+ end;
+ TRender = record
+ xScale,yScale : extended;
+ xMin,xMax : extended;
+ yMin,ymax : extended;
+ zMax,zMin : extended;
+ end;
+
+ TTile = TPoint;
+ function Tile(x, y: integer): TTile;
+ begin
+ Result.x := x;
+ Result.y := y;
+ end;
+ function NULL_TILE: TTile;
+ begin
+ Result := Tile(NULL_INT, NULL_INT);
+ end;
+
+
+type
+ TTileArray = array of TTile;
+
+type
+{ type TNPC;
+ Description: Holds information related to an NPC. }
+ TNPC = record
+ Index, ID, Level, Animation, Height, HPRatio,
+ Orientation: integer;// SOUTH = 0; NORTH = 180; CLOCKWISE.
+ Tile: TTile;
+ Name: String;
+ Actions: TStringArray;
+ Moving, Fighting: boolean;
+ end;
+
+ function NULL_NPC: TNPC;
+ begin
+ Result.Index := NULL_INT;
+ Result.ID := NULL_INT;
+ Result.Name := NULL_STRING;
+ Result.Actions := [];
+ Result.Tile := NULL_TILE;
+ Result.Moving := False;
+ Result.Animation := NULL_INT;
+ Result.Height := NULL_INT;
+ Result.HPRatio := NULL_INT;
+ Result.Fighting := False;
+ Result.Orientation := NULL_INT;
+ Result.Level := NULL_INT;
+ end;
+
+{ type TMe;
+ Description: Holds information related to your character. }
+type
+ TMe = record
+ Tile: TTile;
+ MS: TPoint;
+ Animation, Speed, LoginIndex: Integer;
+ HPRatio, Height, Level, Combat, TurnDirection: Integer;
+ Name: string;
+ InFight: boolean;
+ Experience, Levels: array[0..23] of Integer;
+ Equipment: TIntegerArray;
+ Orientation: Integer; // SOUTH = 0; NORTH = 180; CLOCKWISE.
+ end;
+
+{ type TNPCArray;
+ Description: Container for NPC array. }
+type
+ TNPCArray = array of TNPC;
+
+
+{
+ Equiptment information:
+}
+
+{
+ Constants associated with the position in the array of the TEquiptmentSet.
+}
+const
+ EQUIPMENT_HELMET = 0;
+ EQUIPMENT_CAPE = 1;
+ EQUIPMENT_NECKLACE = 2;
+ EQUIPMENT_WEAPON = 3;
+ EQUIPMENT_TORSO = 4;
+ EQUIPMENT_SHIELD = 5;
+ EQUIPMENT_LEGS = 6;
+ EQUIPMENT_GLOVES = 7;
+ EQUIPMENT_BOOTS = 8;
+ EQUIPMENT_RING = 9;
+ EQUIPMENT_AMMO = 10;
+
+{ type TEquipment;
+ Description: Holds information about an equipment slot. }
+type
+ TEquipment = record
+ ID: Integer;
+ Name: String;
+ IsAmmo: Boolean;
+ Count: Integer;
+ Actions: TStringArray;
+ end;
+
+ function NULL_EQUIPMENT: TEquipment;
+ begin
+ with result do
+ begin
+ ID := NULL_INT;
+ Name := NULL_STRING;
+ IsAmmo := False;
+ Count := Null_INT;
+ Actions := [];
+ end;
+ end;
+
+{ type TEquiptmentSet;
+ Description: Container for TEquiptment records. }
+type
+ TEquipmentSet = record
+ Items: array [0..10] of TEquipment;
+ AmmoCount: Integer;
+ end;
+
+{
+ Inventory Constants:
+}
+{ type TInvItem;
+ Description: Holds information pertaining to an inventory slot. }
+type
+ TInvItem = record
+ ID, StackSize, Slot: integer;
+ Name: String;
+ Actions: TStringArray;
+ end;
+
+ function NULL_INVITEM: TInvItem;
+ begin
+ Result.ID := NULL_INT;
+ Result.StackSize := NULL_INT;
+ Result.Slot := NULL_INT;
+ Result.Name := NULL_STRING;
+ Result.Actions := [];
+ end;
+
+{ type TInvItemArray;
+ Description: Container for TInvItem. }
+type
+ TInvItemArray = array of TInvItem;
+
+{
+ Objects
+}
+const
+ {
+ Object Types:
+ }
+ OBJECT_TYPE_INTERACTABLE = 0;
+ OBJECT_TYPE_WALLOBJECT = 1;
+ OBJECT_TYPE_WALLDECOR = 2;
+ OBJECT_TYPE_FLOORDECOR = 3;
+
+type
+{ type TRSObject;
+ Description: Contains informations pertaining to Objects. }
+ TRSObject = record
+ objType: integer;
+ ID: Integer;
+ Tile: TTile;
+ end;
+
+ function NULL_RSOBJECT: TRSObject;
+ begin
+ Result.ID := NULL_INT;
+ Result.objType := NULL_INT;
+ Result.Tile := NULL_TILE;
+ end;
+
+{ type TRSObjectArray;
+ Description: Container for TRSObjects. }
+type
+ TRSObjectArray = array of TRSObject;
Index: Core.simba
===================================================================
--- Core.simba (revision 73)
+++ Core.simba (working copy)
@@ -39,29 +39,6 @@
math for converting a Tile into a "minimap" coordinate is provided in TileToMM.
==============================================================================}

-{*******************************************************************************
-TRenderData - Stores the rotation matrix used by the client to render to
- the main screen, along with offsets.
-TRender - Stores information about the rendered world including ranges
- for acceptable values, and scaling factors.
-TTile - equivlent to a TPoint, but signifies a global tile position in the
- Runescape client. Not to be used for any other purpose.
-*******************************************************************************}
-type
- TRenderData = record
- xOff,xX,xY,xZ : extended;
- yOff,yX,yY,yZ : extended;
- zOff,zX,zY,zZ : extended;
- end;
- TRender = record
- xScale,yScale : extended;
- xMin,xMax : extended;
- yMin,ymax : extended;
- zMax,zMin : extended;
- end;
- TTile = TPoint;
- TTileArray = array of TTile;
-
{*******************************************************************
Function LoginIndex: Integer;
By:
@@ -240,25 +217,13 @@
end;

{*******************************************************************************
-function Tile(x, y: integer): TTile;
-By: Nava2
-Description: Converts x-y ints to a TTile.
-*******************************************************************************}
-function Tile(x, y: integer): TTile;
-begin
- Result.x := x;
- Result.y := y;
-end;
-
-{*******************************************************************************
function PointToTile(P: TPoint): TTile;
By: Drags111
Description: Converts a TPoint to a TTile.
*******************************************************************************}
function PointToTile(P: TPoint): TTile;
begin
- Result.x := P.x;
- Result.y := P.y;
+ Result := Tile(p.x, p.y);
end;

{*******************************************************************************
@@ -268,8 +233,7 @@
*******************************************************************************}
function TileToPoint(T: TTile): TPoint;
begin
- Result.x := T.x;
- Result.y := T.y;
+ Result := Point(T.x, T.y);
end;

{*******************************************************************************
@@ -418,7 +382,7 @@
{*******************************************************************************
procedure GetJavaString(javaString: integer; var pascalString: string; maxLength: integer);
By: BenLand100
-Description: Returns a string from a javaString with a specified maxLenght. Do
+Description: Returns a string from a javaString with a specified maxLength. Do
not let it overflow, bad things will happen.
*******************************************************************************}
function GetJavaString(javaString: integer; maxLength: integer): string;
@@ -473,8 +437,9 @@
result[count-1]:= TrimHTML(item);
last:= next;
next:= SmartGetFieldObject(last, hook_node_Next);
+ SmartFreeObject(last);
count:= count - 1;
- until count = 0;
+ until (count = 0);
SmartFreeObject(next);
SmartFreeObject(head);
SmartFreeObject(nodeList);
@@ -507,9 +472,9 @@
//Writeln('MenuY: '+ToStr(SmartGetFieldInt(0, hook_static_MenuY)));
MenuOptions := GetMenuText;

- for i := 0 to High(MenuOptions) do
+ for i := High(MenuOptions) downto 0 do
begin
- for i2 := 0 to High(Options) do
+ for i2 := High(Options) downto 0 do
begin
if(Pos(Lowercase(Options[i2]), Lowercase(MenuOptions[i])) <> 0)then
begin
@@ -557,7 +522,7 @@
MenuOptions: TStringArray;
begin
MenuOptions := GetMenuText;
- for i := 0 to High(MenuOptions) do
+ for i := High(MenuOptions) downto 0 do
begin
Result := (Pos(Option, MenuOptions[i]) > 0);
if Result then Exit;
Index: Equipment.Simba
===================================================================
--- Equipment.Simba (revision 73)
+++ Equipment.Simba (working copy)
@@ -1,26 +1,4 @@
-{************************************
-This include gets information about
-equipment your character is wielding.
-The slots are as followed:
- 0: Helm
- 1: Cape
- 2: Neck
- 3: Weapon
- 4: Body
- 5: Shield
- 6: Legs
- 7: Gloves
- 8: Boots
- 9: Ring
- 10: Ammo
-*************************************}

-type
- TEquipmentSet = record
- Ids: array[0..10] of Integer;
- Names: array[0..10] of String;
- AmmoCount: Integer;
- end;

{*******************************************************************************
function GetEquippedItemAt(Slot: Integer): TInvItem;
@@ -28,13 +6,14 @@
Description: Returns a TInvItem of the item in the specified equipment slot.
(see chart at top of page.)
*******************************************************************************}
-function GetEquippedItemAt(Slot: Integer): TInvItem;
+function GetEquippedItemAt(Slot: Integer): TEquipment;
var
Inter, child, textbytes, ID, acts: integer;
begin
- Result := NullInvItem;
+ Result := NULL_EQUIPMENT;
+
if not ValidInterface(INTERFACE_EQUIPMENT)then exit;
- GameTab(26);
+ GameTab(TAB_EQUIP);

try
inter := SmartGetFieldArrayObject(0, hook_static_GetInterfaces, INTERFACE_EQUIPMENT);
@@ -48,8 +27,9 @@
begin
Result.Id := ID;
Result.Name := TrimItemName(GetJavaString(textbytes, 255));
- Result.StackSize := SmartGetFieldInt(child, hook_interface_GetStack);
+ Result.Count := SmartGetFieldInt(child, hook_interface_GetStack);
Result.Actions := GetActionList(child, acts);
+ Result.IsAmmo := (Result.Count > 1);
end;

finally
@@ -67,25 +47,29 @@
*******************************************************************************}
function GetEquipment: TEquipmentSet;
var
- Inter, child, textbytes, i, ID: integer;
+ Inter, child, textbytes, i: integer;
begin
- if not ValidInterface(387)then exit;
- GameTab(26);
+ if not ValidInterface(INTERFACE_EQUIPMENT)then exit; // const..
+ GameTab(TAB_EQUIP);
try
- inter := SmartGetFieldArrayObject(0, hook_static_GetInterfaces, 387);
+ inter := SmartGetFieldArrayObject(0,
+ hook_static_GetInterfaces,
+ INTERFACE_EQUIPMENT);
for i := 0 to 10 do
begin
- Result.Ids[i] := 0;
- Result.Names[i] := '';
+ Result.Items[i] := NULL_EQUIPMENT;

child := SmartGetFieldArrayObject(inter, '', (i*3)+8);
- ID := SmartGetFieldInt(child, hook_interface_GetID);
textbytes := SmartGetFieldObject(child, hook_interface_GetName);
- Result.Ids[i] := ID;
- Result.Names[i] := TrimItemName(GetJavaString(textbytes, 255));
- if(i = 10)then
- Result.AmmoCount := SmartGetFieldInt(child, hook_interface_GetStack);

+ Result.Items[i].ID := SmartGetFieldInt(child, hook_interface_GetID);
+ Result.Items[i].Name := TrimItemName(GetJavaString(textbytes, 255));
+ Result.Items[i].Count := SmartGetFieldInt(child, hook_interface_GetStack);
+ Result.Items[i].isAmmo := (Result.Items[i].Count > 1);
+
+ if (Result.Items[i].isAmmo) then
+ Result.AmmoCount := Result.AmmoCount + Result.Items[i].Count;
+
SmartFreeObject(textbytes);
SmartFreeObject(child);
end;
@@ -101,27 +85,38 @@
By: Drags111
Description: Returns a the ID of the item in the slot.
*******************************************************************************}
-function GetEquppedIDAt(spot: integer): Integer;
+function GetEquippedIDAt(spot: integer): Integer;
var
- Equipmnt: TEquipmentSet;
+ inter, child: Integer;
begin
- Equipmnt := GetEquipment;
- Result := Equipmnt.IDs[spot];
+ if not ValidInterface(INTERFACE_EQUIPMENT)then exit; // const..
+ GameTab(TAB_EQUIP);
+ try
+ inter := SmartGetFieldArrayObject(0,
+ hook_static_GetInterfaces,
+ INTERFACE_EQUIPMENT);
+ child := SmartGetFieldArrayObject(inter, '', (spot*3)+8);
+
+ Result := SmartGetFieldInt(child, hook_interface_GetID);
+ finally
+ SmartFreeObject(child);
+ SmartFreeObject(inter);
+ end;
end;

{*******************************************************************************
-function GetEquppedNameAt(spot: integer): String;
+function GetEquippedNameAt(spot: integer): String;
By: Drags111
Description: Returns a the Name of the item in the slot.
*******************************************************************************}
-function GetEquppedNameAt(spot: integer): String;
+function GetEquippedNameAt(spot: integer): String;
var
Equipmnt: TEquipmentSet;
begin
Equipmnt := GetEquipment;
- if(Equipmnt.Ids[spot] <= 0)then
+ if(Equipmnt.Items[spot] = NULL_EQUIPMENT)then
Exit;
- Result := Equipmnt.Names[spot];
+ Result := Equipmnt.Items[spot].name;
end;

{*******************************************************************************
@@ -129,12 +124,12 @@
By: Drags111
Description: Returns true if there is an item equipped at the slot.
*******************************************************************************}
-function HasItemEquipped(spot: integer): boolean;
+function HasItemEquipped(spot: integer): boolean; // rename..
var
Equipmnt: TEquipmentSet;
begin
Equipmnt := GetEquipment;
- Result := (Equipmnt.IDs[spot] > 0);
+ Result := (Equipmnt.Items[spot].ID <> NULL_INT);
end;

{*******************************************************************************
@@ -144,17 +139,18 @@
*******************************************************************************}
function IsEquippedIDEx(IDs: TIntegerArray): boolean;
var
- Equipmnt: TEquipmentSet;
- i: integer;
+ Equipment: TEquipmentSet;
+ i, ii: integer;
begin
Result := False;
- Equipmnt := GetEquipment;
- for i := 0 to High(IDs) do
- if(InIntArray(Equipmnt.Ids, IDs[i]))then
- begin
- Result := true;
- Exit;
- end;
+ Equipment := GetEquipment;
+ for i := High(IDs) downto 0 do
+ for ii := 10 downto 0 do
+ if (IDs[i] = Equipment.Items[i].ID) then
+ begin
+ Result := True;
+ Exit;
+ end;
end;

{*******************************************************************************
@@ -174,16 +170,16 @@
*******************************************************************************}
function IsEquippedNameEx(Names: TStringArray): boolean;
var
- Equipmnt: TEquipmentSet;
+ Equipment: TEquipmentSet;
i, z: integer;
begin
Result := False;
- Equipmnt := GetEquipment;
+ Equipment := GetEquipment;
for i := 0 to 10 do
- for z := 0 to High(Names) do
- if (Pos(Trim(Lowercase(Names[z])), Trim(Lowercase(Equipmnt.Names[i]))) > 0)then
+ for z := High(Names) downto 0 do
+ if (Pos(Names[z], Equipment.Items[i].Name) > 0) then
begin
- Result := true;
+ Result := True;
Exit;
end;
end;
@@ -205,8 +201,8 @@
*******************************************************************************}
function R_GetAmmoCount: integer;
var
- Equipmnt: TEquipmentSet;
+ Slot: TEquipment;
begin
- Equipmnt := GetEquipment;
- Result := Equipmnt.AmmoCount;
+ Slot := GetEquippedItemAt(EQUIPMENT_AMMO);
+ Result := Slot.Count;
end;
Index: Interfaces.simba
===================================================================
--- Interfaces.simba (revision 73)
+++ Interfaces.simba (working copy)
@@ -39,7 +39,7 @@
begin
Child := GetInterface(ParentI, ChildI);
Text := SmartGetFieldObject(Child, hook_interface_GetText);
- Result := GetJavaString(Text, 256);
+ Result := GetJavaString(Text, 255);
SmartFreeObject(Text);
SmartFreeObject(Child);
end;
Index: Inventory.Simba
===================================================================
--- Inventory.Simba (revision 73)
+++ Inventory.Simba (working copy)
@@ -1,24 +1,18 @@
-type
- TInvItem = record
- ID, StackSize, Slot: integer;
- Name: String;
- Actions: TStringArray;
- end;

- TInvItemArray = array of TInvItem;
-
{*******************************************************************************
-function NullInvItem: TInvItem;
+function getInventoryInterface: Integer;
By: Drags111
-Description: Returns a "null" inventory item.
+Description: Gets the correct ID of the Inventory Interface.
*******************************************************************************}
-function NullInvItem: TInvItem;
+function getInventoryInterface: Integer;
begin
- Result.ID := 0;
- Result.StackSize := 0;
- Result.Slot := 0;
- Result.Name := '';
- Result.Actions := [];
+ Result := NULL_INT;
+ if not (ValidInterface(INTERFACE_INVENTORY_BANKOPEN) or
+ ValidInterface(INTERFACE_INVENTORY))then
+ Exit;
+ Result := INTERFACE_INVENTORY;
+ if(ValidInterface(INTERFACE_INVENTORY_BANKOPEN))then //If the bank is open, the inventory interface
+ Result := INTERFACE_INVENTORY_BANKOPEN; //is 763. Otherwise, it's 149.
end;

{*******************************************************************************
@@ -39,24 +33,28 @@
*******************************************************************************}
function GetActionList(Itm, Actions: integer): TStringArray;
var
- i, l, temp: integer;
+ i, l, resCounter, temp: integer;
str: string;
begin
l := (SmartGetFieldArraySize(Actions, '', 1));
+ SetLength(Result, l);
+
for i := 0 to l-1 do
begin
try
temp := SmartGetFieldArrayObject(Itm, hook_interface_GetActions, i);
str := GetJavaString(temp, 255);
- if not(str = '')then
+ if (not str = NULL_STRING)then
begin
- SetLength(Result, Length(Result)+1);
- Result[High(Result)] := str;
+ Result[resCounter] := str;
+ Inc(resCounter);
end;
finally
SmartFreeObject(temp);
end;
end;
+
+ SetLength(Result, resCounter);
end;

{*******************************************************************************
@@ -67,30 +65,27 @@
*******************************************************************************}
function GetInvItemAt(slot: integer): TInvItem;
var
- Inv, Itm, Name, acts, IFACEINDEX: integer;
+ Inv, Itm, Name, acts, IFACEINDEX, ID: integer;
begin
- if not (ValidInterface(INTERFACE_INVENTORY_BANKOPEN) or
- ValidInterface(INTERFACE_INVENTORY))then exit;
- IFACEINDEX := INTERFACE_INVENTORY;
- if(ValidInterface(INTERFACE_INVENTORY_BANKOPEN))then //If the bank is open, the inventory interface
- IFACEINDEX := INTERFACE_INVENTORY_BANKOPEN; //is 763. Otherwise, it's 149.
- if ValidInterface(INTERFACE_INVENTORY) then
- GameTab(25);
+ Result := NULL_INVITEM;
+
+ IFACEINDEX := getInventoryInterface;
+
try
Inv := GetInterface(IFACEINDEX, 0);
Itm := SmartGetFieldArrayObject(Inv, hook_interface_GetChildren, slot-1);
Name := SmartGetFieldObject(Itm, hook_interface_GetName);
acts := SmartGetFieldObject(Itm, hook_interface_GetActions);

- Result.ID := SmartGetFieldInt(Itm, hook_interface_GetID);
- if(Result.ID > 0)then
+ ID := SmartGetFieldInt(Itm, hook_interface_GetID);
+ if(ID > 0)then
begin
+ Result.ID := ID;
Result.StackSize := SmartGetFieldInt(Itm, hook_interface_GetStack);
Result.Slot := slot;
Result.Name := TrimItemName(GetJavaString(Name, 255));
Result.Actions := GetActionList(Itm, acts);
- end else
- Result := NullInvItem;
+ end;
finally
SmartFreeObject(Inv);
SmartFreeObject(Itm);
@@ -105,17 +100,24 @@
Description: Returns an array of all of the inv items in the inventory.
*******************************************************************************}
function GetInventoryItems: TInvItemArray;
+// should be rewritten, thus only gets the inv interface once.
var
- i: integer;
+ i, resCount: integer;
+ tempInvItem: TInvItem;
begin
+ SetLength(Result, 28);
+
for i := 1 to 28 do
begin
- if not(GetInvItemAt(i) = NullInvItem)then
+ tempInvItem := getInvItemAt(i);
+ if not(tempInvItem = NULL_INVITEM)then
begin
- SetLength(Result, Length(Result)+1);
- Result[High(Result)] := GetInvItemAt(i);
+ Result[resCount] := tempInvItem;
+ Inc(resCount);
end;
end;
+
+ SetLength(Result, resCount);
end;

{*******************************************************************************
@@ -159,12 +161,36 @@

{*******************************************************************************
function R_InvCount: integer;
-By: Drags111
+By: Nava2
Description: Counts the number of items in the inventory.
*******************************************************************************}
function R_InvCount: integer;
+var
+ Inv, Itm, IFACEINDEX, ID, i: integer;
begin
- Result := Length(GetInventoryItems);
+ Result := 0;
+
+ IFACEINDEX := getInventoryInterface;
+
+ if ValidInterface(INTERFACE_INVENTORY) then
+ GameTab(25); // what is this tab.. :s
+
+ try
+ Inv := GetInterface(IFACEINDEX, 0);
+ for i := 0 to 27 do
+ begin
+ Itm := SmartGetFieldArrayObject(Inv, hook_interface_GetChildren, i);
+
+ ID := SmartGetFieldInt(Itm, hook_interface_GetID);
+ if (ID > 0) then
+ inc(Result);
+
+ SmartFreeObject(Itm);
+ end;
+ finally
+ SmartFreeObject(Inv);
+ SmartFreeObject(Itm);
+ end;
end;

{*******************************************************************************
@@ -174,7 +200,7 @@
*******************************************************************************}
function R_InvEmpty : Boolean;
begin
- Result := R_InvCount = 0;
+ Result := (R_InvCount = 0);
end;

{*******************************************************************************
@@ -184,7 +210,7 @@
*******************************************************************************}
function R_InvFull : Boolean;
begin
- Result := R_InvCount = 28;
+ Result := (R_InvCount = 28);
end;

{*******************************************************************************
@@ -203,7 +229,7 @@
Description: Returns true if one of the IDs is found at least once in the inventory.
Also returns all of the items found into the var Items.
*******************************************************************************}
-function R_ItemIDExistsEx(var Items: TInvItemArray; IDs: TIntegerArray): boolean;
+function R_ItemIDExistsEx(IDs: TIntegerArray; out Items: TInvItemArray): boolean;
var
i: integer;
begin
@@ -230,7 +256,7 @@
var
Items: TInvItemArray;
begin
- Result := R_ItemIDExistsEx(Items, [ID]);
+ Result := R_ItemIDExistsEx([ID], Items);
if Result then
Item := Items[0];
end;
@@ -313,7 +339,7 @@
Result := 0;
for i := 1 to 28 do
for z := 0 to High(Names) do
- if (Pos(Trim(Lowercase(Names[z])), Trim(Lowercase(GetItemNameAt(i)))) > 0)then
+ if (Pos(Lowercase(Names[z]), Lowercase(GetItemNameAt(i))) > 0)then
begin
Inc(Result);
break;
@@ -345,7 +371,7 @@
begin
Result := false;
Item := GetInvItemAt(slot);
- if(Item = NullInvItem)then Exit;
+ if(Item = NULL_INVITEM)then Exit;
if left then
begin
MouseItem(slot, true);
@@ -566,9 +592,9 @@
for i := 0 to High(Items)do
begin
Writeln('Slot: '+ToStr(Items[i].Slot));
- Writeln(' '+Items[i].Name);
- Writeln(' ID:'+ToStr(Items[i].ID));
- Writeln(' Stack Size:'+ToStr(Items[i].ID));
- Writeln(' Actions:'+ToStr(Items[i].Actions));
+ Writeln(' Name: '+Items[i].Name);
+ Writeln(' ID: '+ToStr(Items[i].ID));
+ Writeln(' Stack Size: '+ToStr(Items[i].ID));
+ Writeln(' Actions: '+ToStr(Items[i].Actions));
end;
end;
Index: MMWalk.simba
===================================================================
--- MMWalk.simba (revision 73)
+++ MMWalk.simba (working copy)
@@ -59,7 +59,7 @@
Description: MakesCompass to degress set (Degress or n, e, s, w).
Uses reflection.
*******************************************************************************}
-function R_MakeCompass(Dir: string): Boolean;
+function R_MakeCompass(setAngle: Variant): Boolean;
var
StartAngle, Angle, DirectionDeg, i: Extended;
Bool : Boolean;
@@ -70,15 +70,18 @@
Writeln(R_LoggedIn);
if(StartAngle < 0)Or(Not R_LoggedIn)then
Exit;
- try
- DirectionDeg := FixD(StrToFloat(Dir));
- except
- case (LowerCase(Dir)) of
- 'n': DirectionDeg := -1;
- 'w': DirectionDeg := 90;
- 's': DirectionDeg := 180;
- 'e': DirectionDeg := 270;
+ case varType(setAngle) of
+ varString:
+ begin
+ case (LowerCase(setAngle)) of
+ 'n': DirectionDeg := -1;
+ 'w': DirectionDeg := 90;
+ 's': DirectionDeg := 180;
+ 'e': DirectionDeg := 270;
+ end;
end;
+ varDouble, varSingle:
+ DirectionDeg := setAngle;
end;
if((MinE(Abs(StartAngle - DirectionDeg), MinE(Abs(StartAngle - (DirectionDeg + 360)), Abs((StartAngle + 360) - DirectionDeg)))) <= 8.0)then
begin
@@ -90,10 +93,10 @@
KeyDown(VK_LEFT)
else
KeyDown(VK_RIGHT);
- Wait(10);
+ Wait(Random(40));
MarkTime(Mark);
repeat
- Wait(1);
+ Wait(16);
Angle := GetMinimapAngleDeg;
If ((TimeFromMark(Mark) > 6000) and (i < 1.0)) or
((TimeFromMark(Mark) > 10000) and (i < 2.0)) or
@@ -106,7 +109,7 @@
KeyUp(VK_Left)
else
KeyUp(VK_Right);
- Wait(10);
+ Wait(Random(100) + 40);
Result := ((MinE(Abs(Angle - DirectionDeg), MinE(Abs(Angle - (DirectionDeg + 360)), Abs((Angle + 360) - DirectionDeg)))) <= (7.0 + i));
end;

@@ -139,7 +142,7 @@
begin
Speed := GetSpeed;
if GetSystemTime - a > Timeout then Exit;
- Wait(100);
+ Wait(100 + Random(50));
end;
Result := True;
end;
@@ -211,7 +214,7 @@
begin
if not (GetSpeed > 0) then Exit;
Inc(m);
- Wait(100);
+ Wait(100 + Random(30));
if SRL_Procs[SRL_AntiBan] <> nil then
SRL_Procs[SRL_AntiBan]();
if (Random(100) = 0) then IdleTime(500, 1000, 0.01);
@@ -253,7 +256,7 @@

{*******************************************************************************
Function WalkToTile(Tile: TPoint; Randomness, FlagD: Integer): Boolean;
-By: Wizzup and TheGuyWhoGotOn and Drags111
+By: Wizzup, TheGuyWhoGotOn, and Drags111
Description: Walks to the tile using minimap.
*******************************************************************************}
function WalkToTile(TheTile: TTile; Randomness, FlagD: Integer): Boolean;
@@ -277,11 +280,3 @@
R_FFlag(FlagD);
Result := (GetSystemTime - t) < 60000;
end;
-
-
-
-
-
-
-
-
Index: Objects.Simba
===================================================================
--- Objects.Simba (revision 73)
+++ Objects.Simba (working copy)
@@ -1,28 +1,6 @@
-Type
- TRSObject = record
- objType: integer;
- ID: Integer;
- Tile: TTile;
- end;

- TRSObjectArray = array of TRSObject;

{*******************************************************************************
-function NullObject: TRSObject;
-By: Drags111
-Description: Returns a "null" object.
- Uses:
- Result := NullObject;...
- If(GetObjectBlah() = NullObject)then... etc
-*******************************************************************************}
-function NullObject: TRSObject;
-begin
- Result.ID := -1;
- Result.objType := -1;
- Result.Tile := Tile(-1, -1);
-end;
-
-{*******************************************************************************
function NewObject(ID, objType, Tile): TRSObject;
By: Drags111
Description: Returns a new TRSObject with the specified values.
@@ -63,7 +41,7 @@
var
Plane, Ground, Node, Obj, ID, LX, LY: integer;
begin
- Result := NullObject;
+ Result := NULL_RSOBJECT;

try
LX := T.X - SmartGetFieldInt(0, hook_static_BaseX);
@@ -78,19 +56,20 @@
if(Obj <> 0)then
begin
ID := SmartGetFieldShort(Obj, hook_InteractiveObject_GetID);
- if((ID = -1) or ((ID and $FFFF) = 65535))then
+ if((ID = -1) or ((ID and $FFFF) = 65535))then // const
Exit;
- Result := NewObject(ID and $FFFF, INTERACTABLE, T);
+ Result := NewObject(ID and $FFFF, OBJECT_TYPE_INTERACTABLE, T);
Exit;
end;
SmartFreeObject(obj);
+ SmartFreeObject(Node);
Node := SmartGetFieldObject(Node, hook_AnimableNode_GetNext);
end;

finally
+ SmartFreeObject(Ground);
SmartFreeObject(Obj);
SmartFreeObject(Node);
- SmartFreeObject(Ground);
end;
end;

@@ -104,7 +83,7 @@
var
Plane, Ground, Obj, ID, LX, LY: integer;
begin
- Result := NullObject;
+ Result := NULL_RSOBJECT;

try
LX := T.X - SmartGetFieldInt(0, hook_static_BaseX);
@@ -114,13 +93,16 @@

Obj := SmartGetFieldObject(Ground, hook_ground_WallObject1);
if(Obj = 0)then
+ begin
+ SmartFreeObject(Obj);
Obj := SmartGetFieldObject(Ground, hook_ground_WallObject2);
+ end;
if(Obj <> 0)then
begin
ID := SmartGetFieldShort(Obj, hook_wallobjectdata_GetID);
if((ID = -1) or ((ID and $FFFF) = 65535))then
Exit;
- Result := NewObject(ID and $FFFF, WALLOBJECT, T);
+ Result := NewObject(ID and $FFFF, OBJECT_TYPE_WALLOBJECT, T);
end;

finally
@@ -138,7 +120,7 @@
var
Plane, Ground, Obj, ID, LX, LY: integer;
begin
- Result := NullObject;
+ Result := NULL_RSOBJECT;

try
LX := T.X - SmartGetFieldInt(0, hook_static_BaseX);
@@ -148,13 +130,16 @@

Obj := SmartGetFieldObject(Ground, hook_ground_WallDecoration1);
if(Obj = 0)then
- Obj := SmartGetFieldObject(Ground, hook_ground_WallDecoration1);
+ begin
+ SmartFreeObject(Obj);
+ Obj := SmartGetFieldObject(Ground, hook_ground_WallDecoration2);
+ end;
if(Obj <> 0)then
begin
ID := SmartGetFieldShort(Obj, hook_WallDecorationData_GetID);
if((ID = -1) or ((ID and $FFFF) = 65535))then
Exit;
- Result := NewObject(ID and $FFFF, WALLDECOR, T);
+ Result := NewObject(ID and $FFFF, OBJECT_TYPE_WALLDECOR, T);
end;

finally
@@ -172,7 +157,7 @@
var
Plane, Ground, Obj, ID, LX, LY: integer;
begin
- Result := NullObject;
+ Result := NULL_RSOBJECT;

try
LX := T.X - SmartGetFieldInt(0, hook_static_BaseX);
@@ -186,7 +171,7 @@
ID := SmartGetFieldShort(Obj, hook_FloorDecorationData_GetID);
if((ID = -1) or ((ID and $FFFF) = 65535))then
Exit;
- Result := NewObject(ID and $FFFF, FLOORDECOR, T);
+ Result := NewObject(ID and $FFFF, OBJECT_TYPE_FLOORDECOR, T);
end;

finally
@@ -201,18 +186,15 @@
Description: Returns the object at the specified tile, with the type of objType.
*******************************************************************************}
function GetObjectAt(T: TTile; objType: Integer): TRSObject;
+var
+ objFuncts: array [0..3] of function(T: TTile):TRSObject;
begin
- Result := NullObject;
- case objType of
- 0: if not(GetInteractableAt(T) = NullObject)then
- Result := GetInteractableAt(T);
- 1: if not(GetWallObjectAt(T) = NullObject)then
- Result := GetWallObjectAt(T);
- 2: if not(GetWallDecorAt(T) = NullObject)then
- Result := GetWallDecorAt(T);
- 3: if not(GetFloorDecorAt(T) = NullObject)then
- Result := GetFloorDecorAt(T);
- end;
+ Result := NULL_RSOBJECT;
+
+ objFuncts[0] := @GetInteractableAt; objFuncts[1] := @GetWallObjectAt;
+ objFuncts[2] := @GetWallDecorAt; objFuncts[3] := @GetFloorDecorAt;
+
+ Result := objFuncts[objType](T);
end;

{*******************************************************************************
@@ -223,23 +205,23 @@
*******************************************************************************}
function GetAllObjects(objType: Integer): TRSObjectArray;
var
- bx, by, x, y: integer;
+ bx, by, x, y, resCount: integer;
Temp: TRSObject;
begin
- SetLength(Result, 0);
+ SetLength(Result, 104*104);
+ resCount := 0;
bx := SmartGetFieldInt(0, hook_static_BaseX);
by := SmartGetFieldInt(0, hook_static_BaseY);
for x := bx to (104 + bx) do
- begin
for y := by to (104 + by) do
begin
Temp := GetObjectAt(Tile(x, y), objType);
- if (Temp = NullObject) then
+ if (Temp = NULL_RSOBJECT) then
continue;
- SetLength(Result, Length(Result)+1);
- Result[High(Result)] := Temp;
+ Result[resCount] := Temp;
+ Inc(resCount);
end;
- end;
+ setLength(Result, resCount);
end;

{*******************************************************************************
@@ -253,11 +235,12 @@
*******************************************************************************}
function GetObjectsByID(IDs: TIntegerArray; objType, MaxDist: Integer): TRSObjectArray;
var
- Dir, tLength, f, X, Y: Integer;
+ Dir, tLength, f, X, Y, resCount: Integer;
TP: TTile;
TileObject: TRSObject;
begin
- SetLength(Result, 0);
+ SetLength(Result, 104*104);
+ resCount := 0;
TP := GetMyPos;
X := TP.X;
Y := TP.Y;
@@ -274,10 +257,10 @@
3: Dec(X);
end;
TileObject := GetObjectAt(Tile(x, y), objType);
- if ((not(TileObject = NullObject)) and (InIntArray(IDs, TileObject.ID)))then
+ if (not (TileObject = NULL_RSOBJECT) and InIntArray(IDs, TileObject.ID))then
begin
- SetLength(Result, Length(Result)+1);
- Result[High(Result)] := TileObject;
+ Result[resCount] := TileObject;
+ Inc(resCount);
end;
end;
Inc(Dir);
@@ -319,7 +302,7 @@
3: Dec(X);
end;
TileObject := GetObjectAt(Tile(x, y), objType);
- if not(TileObject = NullObject)then
+ if (not (TileObject = NULL_RSOBJECT) and InIntArray(IDs, TileObject.ID)) then
begin
Result := TileObject;
Exit;
@@ -343,7 +326,7 @@
*******************************************************************************}
function GetObjectByID(ID: Integer; objType, MaxDist: Integer): TRSObject;
begin
- Result := GetObjectByIDEx([ID], INTERACTABLE, MaxDist);
+ Result := GetObjectByIDEx([ID], OBJECT_TYPE_INTERACTABLE, MaxDist);
end;

{*******************************************************************************
@@ -359,18 +342,3 @@
Temp := GetObjectAt(Obj.Tile, Obj.objType);
Result := (Obj = Temp);
end;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: Reflection.simba
===================================================================
--- Reflection.simba (revision 73)
+++ Reflection.simba (working copy)
@@ -1,22 +1,25 @@
{$define smart}
-{$i srl\srl.scar}

-{$i srl\srl\Reflection\Constants.simba}
-{$i srl\srl\Reflection\Hooks.simba}
-{$i srl\srl\Reflection\Core.simba}
-{$i srl\srl\Reflection\MMWalk.simba}
-{$i srl\srl\Reflection\Characters.simba}
-{$i srl\srl\Reflection\Login.simba}
-{$i srl\srl\Reflection\Objects.simba}
-{$i srl\srl\Reflection\Interfaces.simba}
-{$i srl\srl\Reflection\Inventory.simba}
-{$i srl\srl\Reflection\Equipment.simba}
-{$i srl\srl\Reflection\Bank.simba}
-{$i srl\srl\Reflection\Chat.simba}
+// THIS IS BAD. VERY VERY BAD.
+//{$i srl\srl.scar}

-{$i srl\srl\Reflection\Antirandoms\Molly.simba}
-{$i srl\srl\Reflection\Antirandoms\Antirandoms.simba}

+{$i Constants.simba}
+{$i Hooks.simba}
+{$i Core.simba}
+{$i MMWalk.simba}
+{$i Characters.simba}
+{$i Login.simba}
+{$i Objects.simba}
+{$i Interfaces.simba}
+{$i Inventory.simba}
+{$i Equipment.simba}
+{$i Bank.simba}
+{$i Chat.simba}
+
+{$i Antirandoms\Molly.simba}
+{$i Antirandoms\Antirandoms.simba}
+
{*******************************************************************************
procedure SetupReflectionEx(World: Integer; Signed, Members, Term: Boolean);
By: Drags111
@@ -31,7 +34,7 @@
Smart_Server := World;
Smart_Signed := Signed;
Smart_SuperDetail := false;
- SetupSRL;
+ //SetupSRL;
Result := true;
if(SmartGetFieldInt(0, hook_static_LoginIndex) = -1) then
begin
@@ -45,7 +48,9 @@
end;
end;

-procedure SetupReflection;
+
+{ BAD BAD BAD BAD BAD }
+{procedure SetupReflection;
begin
SetupReflectionEx(32, true, false, true);
-end;
+end; }

I spent about 4h tonight setting this all up.. Now, I consider reflection, for the most part… clean.

Oh, and this will break scripts.. but there aren't that many currently reliant so its probably a good time to do it..

E: Attached as a .patch.

Drakan

2010-05-31 21:35:01

Nava2, if you're going to make such drastic changes, and force me to remove srl from reflection, then can you at least make a patch that compiles? I'm not going to go through and remake srl functions, constants, etc, just to change some 'standards'.

I really do appreciate the hard work, but if your making a mess, can you at least help smooth the transition?

You tell me that you want me to remove dependencies of srl out of reflection, but you leave me hanging without a solution.

Nava2

2010-05-31 21:56:14

That patch compiles directly from rev 73…

Drakan

2010-05-31 21:57:18

Can you get on the IRC…
And not without dependencies of SRL.