SRL Archive - Client Hacking

#639


pyroryan

2011-02-21 15:37:01


const
ClientVersion = 639;
HookRev = 10;


{Static Hooks}
hook_static_LoginIndex = 'tn.U';
hook_static_getFriendsList = 'eea.K';
hook_static_getFriendsWorlds = 'jca.c';
hook_static_CameraYaw = 'jj.P';
hook_static_MyPlayer = 'hh.j';
hook_static_BaseX = 'vh.m';
hook_static_BaseY = 'gu.D';
hook_static_NPCIndexArray = 'rd.g';
hook_static_LoopCycle = 'du.u';
hook_static_NPCNodes = 'aa.e';
hook_static_NPCCount = 'jc.M';
hook_static_GroundSettingsArray = 'ha.g';
hook_static_LoadedPlane = 'gd.h';
hook_static_PlaneArray = 'gu.C';
hook_static_Toolkit = 'fm.b';
hook_static_MenuOptionCount = 'qh.b';
hook_static_MenuCollapsedOptionsCount = 'via.d';
hook_static_MenuX = 'av.R';
hook_static_MenuY = 'dca.z';
hook_static_MenuWidth = 'of.e';
hook_static_MenuHeight = 'rd.e';
hook_static_MenuX2 = 'gu.E';
hook_static_MenuY2 = 'vt.Gb';
hook_static_MenuWidth2 = 'ke.H';
hook_static_MenuHeight2 = 'qea.q';
hook_static_MenuNodeList = 'kr.b';
hook_static_MenuOpen = 'cga.F';
hook_static_GetInterfaces = 'vga.i';
hook_static_ValidInterfaces = 'we.w';
hook_static_IsMenuTabbed = 'fp.p';
hook_static_getCollapsedMenuItems = 'vfa.g';
hook_static_getNPCNC = 'mi.k';
hook_static_getItemDefLoader = 'jo.ib';
hook_static_GetSettings = 'kca.b';
hook_static_getObjectDefLoader = 'kea.d';
hook_static_GroundItemCache = 'ma.I';
hook_static_GetSkillExperiences = 'qb.c';
hook_static_GetSkillLevels = 'in.n';
hook_static_MapAngle = 'kf.q';
hook_static_DestX = 'dj.o';
hook_static_DestY = 'bn.k';
hook_static_PlayerCount = 'sr.c';
hook_static_PlayerIndexArray = 'tk.E';
hook_static_GetPlayers = 'aj.m';
hook_static_CamPosX = 'pd.c';
hook_static_CamPosY = 'sl.f';
hook_static_GroundTiles = 'jv.l';
hook_static_GetCrossHairColor = 'wfa.d';

{Class Animable}
class_Animable = 'vs';
hook_animable_PixelX = 'p';
hook_animable_PixelY = 'u';
hook_animable_Plane = 'v';

{Class Player}
class_Player = 'bs';
hook_player_GetLevel = 'Id';
hook_player_GetName = 'xd';
hook_player_GetTeam = 'Sd';
hook_player_PlayerDef = 'fd';

{Class Character}
class_Character = 'ns';
hook_character_GetHitDamges = 'ic';
hook_character_Animation = 'hc';
hook_character_Motion = 'Rc';
hook_character_WalkQueueX = 'Uc';
hook_character_WalkQueueY = 'ad';
hook_character_GetHeight = 'Fb';
hook_character_LoopCycleStatus = 'S';
hook_character_HPRatio = 'yc';
hook_character_GetInteracting = 'Mc';
hook_character_Orientation = 'Yb';

{Class AnimableNode}
class_AnimableNode = 'lr';
hook_AnimableNode_GetAnimable = 'k';
hook_AnimableNode_GetNext = 'f';

{Class AnimableEntity}
class_AnimableEntity = 'oda';
hook_animableentity_getAreaX1 = 'F';
hook_animableentity_getAreaX2 = 'J';
hook_animableentity_getAreaY1 = 'D';
hook_animableentity_getAreaY2 = 'B';

{Class PlayerDef}
class_PlayerDef = 'ah';
hook_playerdef_GetEquipment = 'r';

{Class NPC}
class_NPC = 'kd';
hook_npc_NPCDef = 'Bd';

{Class NPCDef}
class_NPCDef = 'ow';
hook_npcdef_GetActions = 'F';
hook_npcdef_GetName = 'W';
hook_npcdef_GetLevel = 'p';
hook_npcdef_GetID = 'R';

{Class NPCNode}
class_NPCNode = 'uba';
hook_npcnode_GetNPC = 'm';

{Class GroundTile}
class_GroundTile = 'ffa';

{Class Plane}
class_Plane = 's';

{Class RSInteractable}
class_RSInteractable = 'gda';

{Class Toolkit}
class_Toolkit = 'ha';

{Class Viewport}
class_Viewport = 'ql';

{Class SDViewport}
class_SDViewport = 'iv';
hook_sdviewport_xOff = 'o';
hook_sdviewport_xX = 'l';
hook_sdviewport_xY = 'g';
hook_sdviewport_xZ = 'J';
hook_sdviewport_yOff = 'I';
hook_sdviewport_yX = 'K';
hook_sdviewport_yY = 'w';
hook_sdviewport_yZ = 'H';
hook_sdviewport_zOff = 'A';
hook_sdviewport_zX = 'e';
hook_sdviewport_zY = 'f';
hook_sdviewport_zZ = 'r';

{Class SDToolkit}
class_SDToolkit = 'iw';
hook_sdtoolkit_Viewport = 'M';
hook_sdtoolkit_xMin = 'K';
hook_sdtoolkit_xMax = 'nb';
hook_sdtoolkit_yMin = 'hb';
hook_sdtoolkit_yMax = 'E';
hook_sdtoolkit_zMin = 'Y';
hook_sdtoolkit_zMax = 'lb';
hook_sdtoolkit_xScale = 'O';
hook_sdtoolkit_yScale = 'mb';

{Class SDPlane}
class_SDPlane = 's';
hook_sdplane_TileHeights = 'p';

{Class SDModel}
class_SDModel = 'pt';
hook_sdmodel_getIndices1 = 'y';
hook_sdmodel_getIndices2 = 'Q';
hook_sdmodel_getIndices3 = 'Xb';
hook_sdmodel_getPointsX = 'J';
hook_sdmodel_getPointsY = 'nb';
hook_sdmodel_getPointsZ = 'zb';

{Class NodeListCache}
class_NodeListCache = 'se';
hook_nodelistcache_GetNodeList = 'm';

{Class NodeList}
class_NodeList = 'ada';
hook_nodelist_Current = 'm';
hook_nodelist_Head = 'e';

{Class Node}
class_Node = 'efa';
hook_node_Next = 'd';
hook_node_GetID = 'b';
hook_node_Previous = 'k';

{Class MenuGroupNode}
class_MenuGroupNode = 'k';
hook_MenuGroupNode_getNodeSubListItems = 'F';

{Class NodeSubList}
class_NodeSubList = 're';
hook_nodesublist_getHead = 'a';

{Class NodeSub}
class_NodeSub = 'we';
hook_nodesub_Next = 'r';

{Class Menu}
class_Menu = 'cs';
hook_menu_Option = 'K';
hook_menu_Action = 'G';

{Class ObjectInterface}
class_ObjectInterface = 'sca';
hook_interface_GetActions = 'Ub';
hook_interface_GetX = 'ad';
hook_interface_GetY = 'Ac';
hook_interface_GetWidth = 'K';
hook_interface_GetHeight = 'jb';
hook_interface_GetText = 'Lc';
hook_interface_GetTextureID = 'qc';
hook_interface_GetTextColor = 'Bb';
hook_interface_GetModelID = 'kd';
hook_interface_GetModelZoom = 'rd';
hook_interface_GetName = 'Vb';
hook_interface_GetChildren = 'ec';
hook_interface_GetID = 'sd';
hook_interface_GetStack = 'X';
hook_interface_GetParentID = 'S';
hook_interface_IsHidden = 'nd';

{Class NodeCache}
class_NodeCache = 'he';
hook_nodecache_GetNodes = 'b';

{Class Item}
class_Item = 'dv';
hook_item_GetID = 'p';
hook_item_GetStack = 'm';

{Class ItemDefLoader}
class_ItemDefLoader = 'hp';
hook_itemdefloader_getMRUNodes = 'o';

{Class ItemDef}
class_ItemDef = 'uo';
hook_itemdef_getLoader = 'z';
hook_itemdef_getGroundActions = 'M';
hook_itemdef_getActions = 'hb';

{Class MRUNodes}
class_MRUNodes = 'jt';
hook_mrunodes_getNodeCache = 'c';

{Class SettingArray}
class_SettingArray = 'rm';
hook_settingarray_GetData = 'a';

{Class ObjectDefLoader}
class_ObjectDefLoader = 'mk';
hook_objectdefloader_getMRUNodes = 'f';

{Class Ground}
class_Ground = 'ffa';
hook_ground_AnimableList = 'b';
hook_ground_WallObject1 = 'm';
hook_ground_WallObject2 = 'f';
hook_ground_WallDecoration1 = 'd';
hook_ground_WallDecoration2 = 'g';
hook_ground_FloorDecoration = 'p';

{Class WallObjectData}
class_WallObjectData = 'tq';
hook_WallObjectData_GetID = 'lb';
hook_WallObjectData_GetModel = 'db';
hook_WallObjectData_GetOrientation = 'Q';

{Class WallDecorationData}
class_WallDecorationData = 'gs';
hook_WallDecorationData_GetID = 'Q';
hook_WallDecorationData_GetModel = 'ib';
hook_WallDecorationData_GetOrientation = 'S';

{Class FloorDecorationData}
class_FloorDecorationData = 'rh';
hook_FloorDecorationData_GetID = 'K';
hook_FloorDecorationData_GetModel = 'nb';
hook_FloorDecorationData_GetOrientation = 'X';

{Class InteractiveObject}
class_InteractiveObject = 'dda';
hook_interactiveobject_GetID = 'cb';
hook_interactiveobject_GetModel = 'nb';
hook_interactiveobject_GetOrientation = 'ob';

{Class InteractiveObject2}
class_InteractiveObject2 = 'ww';
hook_interactiveobject2_GetObjectData = 'cb';

{Class SecondLevelObject}
class_SecondLevelObject = 'qea';
hook_secondlevelobject_GetID = 't';
hook_secondlevelobject_GetModel = 'u';
hook_secondlevelobject_GetOrientation = 'g';

{Class WallObjectSub2}
class_WallObjectSub2 = 'bda';
hook_wallobjectsub2_getComposite = 'Y';

{Class WallDecorationSub2}
class_WallDecorationSub2 = 'dha';
hook_walldecorationsub2_getComposite = 'cb';

{Class FloorDecorationSub2}
class_FloorDecorationSub2 = 'qc';
hook_floordecorationsub2_getComposite = 'P';
Final version.

Edit: Revision 8: Updated Object Orientation hooks.

Bobzilla69

2011-02-21 15:38:17

I love you!!!!

edit: i am sure i typed that all caps

IPwnz

2011-02-21 15:41:45

I'm not sure if this is related to the hooks, but the right click choose menu options are off (I'm using 639).

Update: Bank choosing options seem to work fine and my original post related to Harry's Karamja Fisher, and it looks like he uses r_WaitOption for right click option finding.

pyroryan

2011-02-21 15:42:39

From: IPwnz
I'm not sure if this is related to the hooks, but the right click choose menu options are off (I'm using 639).


Will look at in a minute. Thanks for the report.

Edit:
Try rev 4.

IPwnz

2011-02-21 15:54:05

From: pyroryan
Will look at in a minute. Thanks for the report.

Edit:
Try rev 4.


Rev 4 fixed the issue, thanks for the work you put into the update. :)

pyroryan

2011-02-21 16:49:08

Revision 6 is basically the final version. All thats left are in-game tests :). Please report any issues here so I see them :).

grats

2011-02-21 16:58:48

Running ratinator x4 with a few accounts on each, running way better than last one a lot less lag while walking.. actually now there's no lag.


yea zero problems with it, it's done about everything it does by now..

I'll be testing some other members scripts that use reflection in a bit



wow yea.. idk if these updates are what smoothes out smart fps & scripts or if jagex's update contributes but it's running extremely smooth and a lot less load on CPU

Mr Macro

2011-02-21 17:24:23

….

Flight

2011-02-21 19:09:36

Would this be an automatic update to reflection or do we manually replace this ourselves?

IPwnz

2011-02-21 19:12:12

From: Flight
Would this be an automatic update to reflection or do we manually replace this ourselves?


Automatic, it should show up as #283 in the Simba updater.

grats

2011-02-21 20:06:25

Would the hooks be responsible for miss-clicks that didn't happen till now? Sorry I don't know much about it

pyroryan

2011-02-21 20:41:16

From: grats
Would the hooks be responsible for miss-clicks that didn't happen till now? Sorry I don't know much about it


Elaborate please.

grats

2011-02-21 20:44:09

From: pyroryan
Elaborate please.


http://villavu.com/forum/showthread.php?t=60085

It sometimes clicks the Dark Kebbit's now accidentally.. maybe once or twice then goes after the one it's supposed to

it never did that before, for hours of running it


Players[0].Strings[0] := 'Spotted'; // Kebbit's name (e.g. 'Dark', 'Dashing', 'Spotted' or 'Auto')

that's my line

TRiLeZ

2011-02-23 18:04:38

NPCDef.getLevel() -> NPC.getLevel()… you should update your updater accordingly.

Someone should also update reflection… since I don't have commit access… yet.


//------------------------------------------------------------------\\
//-- Simba Reflection Library --||
//-- NPCs Routines --||
//------------------------------------------------------------------//

//--- Records --//
type
{Holds information related to an NPC}
TNPC = record
Index, ID, Level, Animation, Height, HPRatio, Interacting,
Orientation: integer;// SOUTH = 0; NORTH = 180; CLOCKWISE.
Tile, RealTile: TTile;
Pixel: TPoint;//Pixel position on tile
Name: String;
Actions: TStringArray;
Moving, Fighting: boolean;
end;

{Array of TNPC}
TNPCArray = array of TNPC;


{*******************************************************************************
function NULL_NPC: TNPC;
Description: Nulls a TNPC
*******************************************************************************}
function NULL_NPC: TNPC;
begin
Result.Index := NULL_INT;
Result.ID := NULL_INT;
Result.Name := NULL_STRING;
Result.Actions := [];
Result.Tile := NULL_TILE;
Result.RealTile := 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;
Result.Interacting := NULL_INT;
end;

{*******************************************************************************
function _GetNPCActionArray(NPCDef: integer): TStringArray;
By: Drags111
Description: Gets the Action (String) Array according to the NPC Def.
Used in GetNPC functions
*******************************************************************************}
function _GetNPCActionArray(NPCDef: integer): TStringArray;
var
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
Result[c] := GetJavaString(bytes, 255);
inc(c);
end;
SmartFreeObject(bytes);
end;
SetLength(Result, c);
end;

{*******************************************************************************
Function SortNPCs(NPCs:array of TNPC):array of TNPC;
By: Widget edited by lordsaturn
Description: Sorts NPCs by distance from you.
*******************************************************************************}
function SortNPCs(NPCs:array of TNPC): TNPCArray;
var
i,i2, L: integer;
tpa: TPointArray;
begin
L := GetArrayLength(NPCs);
if L < 1 then Exit;
SetArrayLength(TPA, L);
SetArrayLength(Result, L);
for i := 0 to L-1 do
TPA[i] := NPCs[i].Tile;
SortTPAFrom(TPA, GetMyPos);
for i := 0 to L-1 do
for i2 := 0 to L-1 do
if (TPA[i].x=NPCs[i2].Tile.x) and (TPA[i].y=NPCs[i2].Tile.y) then
Result[i] := NPCs[i2];
end;

{*******************************************************************************
function GetNPCs(Null: Boolean): TNPCArray;
By: Drags111
Description: Stores all the loaded NPCs into an array of TNPC. If Null = True
then it will include Null NPCs.
*******************************************************************************}
function GetAllNPCs(Null: Boolean):array of TNPC;
var
i, c, NumNPCs, Index, TheNPC, TheNPCDef, TheBytes, TheNPCNode: integer;
Base: TTile;
begin
NumNPCs := SmartGetFieldInt(0,hook_static_NPCCount);
if (NumNPCs < 1) then Exit;
SetArrayLength(Result,NumNPCs);
for i := 0 to (NumNPCs-1) do
try
Index := SmartGetFieldArrayInt(0, hook_static_NPCIndexArray, i);
TheNPCNode := SmartGetFieldArrayObject(0, hook_static_NPCNodes, i);
TheNPC := SmartGetFieldObject(TheNPCNode, hook_npcnode_GetNPC);
TheNPCDef := SmartGetFieldObject(TheNPC, hook_npc_NPCDef);
TheBytes := SmartGetFieldObject(TheNPCDef, hook_npcdef_GetName);

if((not Null) and (lowercase(trim(GetJavaString(TheBytes, 255))) = 'null'))then
continue;
Result[c].Index := Index;
Result[c].ID := SmartGetFieldInt(TheNPCDef, hook_npcdef_GetID);
Result[c].Name := GetJavaString(TheBytes, 255);
Result[c].Actions := _GetNPCActionArray(TheNPCDef);
Base.X := SmartGetFieldInt(0, hook_static_BaseX);
Base.Y := SmartGetFieldInt(0, hook_static_BaseY)
Result[c].Tile.X := (Base.X + (SmartGetFieldInt(TheNPC, hook_animable_PixelX) / 512));
Result[c].Tile.Y := (Base.Y + (SmartGetFieldInt(TheNPC, hook_animable_PixelY) / 512));
Result[c].RealTile.X := (Base.X + (SmartGetFieldInt(TheNPC, hook_animable_PixelX) / 512));
Result[c].RealTile.Y := (Base.Y + (SmartGetFieldInt(TheNPC, hook_animable_PixelY) / 512));
Result[c].Pixel.X := SmartGetFieldInt(TheNPC, hook_animable_PixelX) mod 512;
Result[c].Pixel.Y := SmartGetFieldInt(TheNPC, hook_animable_PixelY) mod 512;
Result[c].Moving := (SmartGetFieldInt(TheNPC, hook_character_Motion)>0);
Result[c].Animation := SmartGetFieldInt(TheNPC, hook_character_Animation);
Result[c].Height := iabs(SmartGetFieldInt(TheNPC, hook_character_GetHeight));
Result[c].HPRatio := SmartGetFieldInt(TheNPC, hook_character_HPRatio) * 100 / $FF;
Result[c].Fighting := (SmartGetFieldInt(TheNPC, hook_character_LoopCycleStatus) >
SmartGetFieldInt(0, hook_static_LoopCycle));
Result[c].Orientation := Round(FixD(180 + (SmartGetFieldInt(TheNPC, hook_character_Orientation)* 45) / 2048));
Result[c].Level := SmartGetFieldInt(TheNPCDef, hook_npcdef_GetLevel);
Result[c].Interacting := SmartGetFieldInt(TheNPC, hook_character_GetInteracting);
Inc(c);

finally
SmartFreeObject(TheNPCNode);
SmartFreeObject(TheNPC);
SmartFreeObject(TheNPCDef);
SmartFreeObject(TheBytes);
end;
SetLength(Result, c);
end;

{*******************************************************************************
function GetNullNPCsByMulti(TheVarArr: TVariantArray):TNPCArray;
: Drags111/Naike/mormonman
Description: Returns the npc array by TheVarArr(IDs and names). Includes Null
npcs.
*******************************************************************************}
function GetNullNPCsMulti(TheVarArr: TVariantArray):TNPCArray;
var
vType, i, resCounter, Hi, Hig, h: Integer;
NPCs: TNPCArray;
b: boolean;
begin
NPCs := SortNPCs(GetAllNPCs(True));
SetLength(Result, Length(NPCs));
Hig := High(TheVarArr);
Hi := High(NPCs);
for i := 0 to Hi do
for h := 0 to Hig do
begin
vType := VarType(TheVarArr[h]);
if (vType = varString) then
TheVarArr[h] := LowerCase(Trim(TheVarArr[h]));
case vType of
varInteger: B := NPCs[i].ID = TheVarArr[h];
varString: B := (Pos(TheVarArr[h], LowerCase(Trim(NPCs[i].Name))) > 0);
else Exit;
end;
if not B then
Continue;
Result[resCounter] := NPCs[i];
inc(resCounter);
end;

SetLength(Result, resCounter);
end;

{*******************************************************************************
function GetNullNPCs(TheVar: Variant):TNPCArray;
By: Drags111/Naike/mormonman
Description: Returns the npc array by TheVar(ID or name). Includes Null npcs.
*******************************************************************************}
function GetNullNPCs(TheVar: Variant):TNPCArray;
begin
Result := GetNullNPCsMulti([TheVar]);
end;

{*******************************************************************************
function GetNullNPCMulti(TheVarArr: TVariantArray):TNPC;
By: Drags111/Naike/mormonman
Description: Returns the npc by TheVarArr(IDs or names). Includes Null npcs.
*******************************************************************************}
function GetNullNPCMulti(TheVarArr: TVariantArray):TNPC;
var
NPCs: TNPCArray;
begin
Result := NULL_NPC;
NPCs := GetNullNPCsMulti(TheVarArr);
if Length(NPCs) < 1 then Exit;
Result := NPCs[0];
end;

{*******************************************************************************
function GetNullNPC(TheVar: Variant):TNPC;
By: Drags111/Naike/mormonman
Description: Returns the npc by TheVar(ID or name). Includes Null npcs.
*******************************************************************************}
function GetNullNPC(TheVar: Variant):TNPC;
begin
Result := GetNullNPCMulti([TheVar]);
end;

{*******************************************************************************
function GetNPCsMulti(TheVarArr: TVariantArray): TNPCArray;
By: Widget, lordsaturn, Narcle, Nava2 and mormonman
Description: Returns all the currently loaded NPCs using TheVarArr, which will
take either strings or Integers. The String is a part of the NPC
name, and an Integer is the NPCType (ID).
*******************************************************************************}
function GetNPCsMulti(TheVarArr: TVariantArray): TNPCArray;
var
vType, i, resCounter, Hi, Hig, h: Integer;
NPCs: TNPCArray;
b: boolean;
begin
{
Initialize the result array, setup for looping.
}
NPCs := SortNPCs(GetAllNPCs(False));
SetLength(Result, Length(NPCs));
Hig := High(TheVarArr);
Hi := High(NPCs);
for i := 0 to Hi do
for h := 0 to Hig do
begin
vType := VarType(TheVarArr[h]);
if (vType = varString) then
TheVarArr[h] := LowerCase(Trim(TheVarArr[h]));
case vType of
varInteger: B := NPCs[i].ID = TheVarArr[h];
varString: B := (Pos(TheVarArr[h], LowerCase(Trim(NPCs[i].Name))) > 0);
else Exit;
end;
if not B then
Continue;
Result[resCounter] := NPCs[i];
inc(resCounter);
end;

SetLength(Result, resCounter);
end;

{*******************************************************************************
function GetNPCs(TheVar: Variant): TNPCArray;
By: Widget, lordsaturn, Narcle, Nava2 and mormonman
Description: Returns all the currently loaded NPCs using TheVar, which will
take either a string or an Integer. The String is a part of the NPC
name, and an Integer is the NPCType (ID).
*******************************************************************************}
function GetNPCs(TheVar: Variant): TNPCArray;
begin
Result := GetNPCsMulti([TheVar]);
end;

{*******************************************************************************
function GetNPCMulti(TheVarArr: TVariantArray):TNPC;
By: Drags111/mormonman
Description: Returns the npc by TheVarArr (names or IDs).
*******************************************************************************}
function GetNPCMulti(TheVarArr: TVariantArray):TNPC;
var
NPCs: TNPCArray;
begin
Result := NULL_NPC;
NPCs := GetNPCsMulti(TheVarArr);
if Length(NPCs) < 1 then Exit;
Result := NPCs[0];
end;

{*******************************************************************************
function GetNPC(TheVar: Variant):TNPC;
By: Drags111/mormonman
Description: Returns the npc by TheVar (name or ID).
*******************************************************************************}
function GetNPC(TheVar: Variant):TNPC;
begin
Result := GetNPCMulti([TheVar]);
end;

{*******************************************************************************
function GetNPCsAt(T: TTile): TNPCArray;
By:
Description: Returns an array of the NPCs at the given tile
*******************************************************************************}
function GetNPCsAt(T: TTile): TNPCArray;
var
i, h, c: Integer;
Index, TheNPCNode, TheNPC, TheNPCDef, TheBytes: Integer;
tmp_tile : TTile;
begin
h := SmartGetFieldInt(0, hook_static_NPCCount);
SetLength(Result, h);
Dec(h);
for i := 0 to h do
try
Index := SmartGetFieldArrayInt(0, hook_static_NPCIndexArray, i);
TheNPCNode := SmartGetFieldArrayObject(0, hook_static_NPCNodes, i);
TheNPC := SmartGetFieldObject(TheNPCNode, hook_npcnode_GetNPC);
tmp_tile := Tile(
SmartGetFieldInt(0,hook_static_BaseX) +
SmartGetFieldInt(TheNPC, hook_animable_PixelX) / 512,
SmartGetFieldInt(0,hook_static_BaseY) +
SmartGetFieldInt(TheNPC, hook_animable_PixelY) / 512);

if (tmp_tile = t) then
begin
TheNPCDef := SmartGetFieldObject(TheNPC, hook_npc_NPCDef);
TheBytes := SmartGetFieldObject(TheNPCDef, hook_npcdef_GetName);
Result[c].Index := Index;
Result[c].ID := SmartGetFieldInt(TheNPCDef, hook_npcdef_GetID);
Result[c].Name := GetJavaString(TheBytes, 255);
Result[c].Actions := _GetNPCActionArray(TheNPCDef);
Result[c].Tile.X := (SmartGetFieldInt(0, hook_static_BaseX) + (SmartGetFieldInt(TheNPC, hook_animable_PixelX) / 512));
Result[c].Tile.Y := (SmartGetFieldInt(0, hook_static_BaseY) + (SmartGetFieldInt(TheNPC, hook_animable_PixelY) / 512));
Result[c].Moving := (SmartGetFieldInt(TheNPC, hook_character_Motion)>0);
Result[c].Animation := SmartGetFieldInt(TheNPC, hook_character_Animation);
Result[c].Height := iabs(SmartGetFieldInt(TheNPC, hook_character_GetHeight));
Result[c].HPRatio := SmartGetFieldInt(TheNPC, hook_character_HPRatio) * 100 / $FF;
Result[c].Fighting := (SmartGetFieldInt(TheNPC, hook_character_LoopCycleStatus) >
SmartGetFieldInt(0, hook_static_LoopCycle));
Result[c].Orientation := Round(FixD(180 + (SmartGetFieldInt(TheNPC, hook_character_Orientation)* 45) / 2048));
Result[c].Level := SmartGetFieldInt(TheNPC, hook_npc_GetLevel);
Result[c].Interacting := SmartGetFieldInt(TheNPC, hook_character_GetInteracting);
Inc(c);
end;
finally
SmartFreeObject(TheNPCNode);
SmartFreeObject(TheNPC);
end;
SetLength(Result, c);
end;

{*******************************************************************************
function FindNPCsMulti(TheVarArr: Variant; var NPCs: TNPCArray): Boolean;
By: lordsaturn/mormonman
Description: If any NPC is found according to TheVarArr, the NPCs are placed in
the NPCs array. Results true if found; false otherwise.
*******************************************************************************}
function FindNPCsMulti(TheVarArr: TVariantArray; var NPCs: TNPCArray): Boolean;
begin
NPCs := GetNPCsMulti(TheVarArr);
if Length(NPCs) < 1 then Exit;
Result := NPCs[0].ID > -1;
end;

{*******************************************************************************
function FindNPCs(TheVar: Variant; var NPCs: TNPCArray): Boolean;
By: lordsaturn/mormonman
Description: If the NPC is found according to TheVar, the NPC is placed in the
NPCs array. Results true if found; false otherwise.
*******************************************************************************}
function FindNPCs(TheVar: Variant; var NPCs: TNPCArray): Boolean;
begin
Result := FindNPCsMulti([TheVar], NPCs);
end;

{*******************************************************************************
function FindNPCMulti(TheVarArr: Variant; var NPC: TNPC): Boolean;
By: lordsaturn/mormonman
Description: If the NPC is found according to TheVarArr, the NPC is placed in
the NPC variable. Results true if found; false otherwise.
*******************************************************************************}
function FindNPCMulti(TheVarArr: TVariantArray; var NPC: TNPC): Boolean;
begin
NPC := GetNPCMulti(TheVarArr);
Result := NPC.ID > -1;
end;

{*******************************************************************************
function FindNPC(TheVar: Variant; var NPC: TNPC): Boolean;
By: lordsaturn/mormonman
Description: If the NPC is found according to TheVar, the NPC is placed in the
NPC variable. Results true if found; false otherwise.
*******************************************************************************}
function FindNPC(TheVar: Variant; var NPC: TNPC): Boolean;
begin
Result := FindNPCMulti([TheVar], NPC);
end;

{*******************************************************************************
function ValidNullNPCMulti(TheVarArr: TVariantArray): Boolean;
By: Drags111/Naike/mormonman
Description: Returns true if npc designated by TheVarArr(names or IDs) is found.
*******************************************************************************}
function ValidNullNPCMulti(TheVarArr: TVariantArray): Boolean;
var
vType, i, Hi, Hig, h: Integer;
NPCs: TNPCArray;
begin
NPCs := SortNPCS(GetAllNPCs(True));
Hi := High(NPCs);
Hig := High(TheVarArr);
for i := 0 to Hi do
for h := 0 to Hig do
begin
vType := VarType(TheVarArr[h]);
if (vType = varString) then
TheVarArr[h] := LowerCase(Trim(TheVarArr[h]));
case vType of
varInteger: Result := NPCs[i].ID = TheVarArr[h];
varString: Result := (Pos(TheVarArr[h], LowerCase(Trim(NPCs[i].Name))) > 0);
else Exit;
end;
if Result then Exit;
end;
end;

{*******************************************************************************
function ValidNullNPC(ID: Integer): Boolean;
By: Drags111/Naike/mormonman
Description: Returns true if npc designated by TheVar(name or ID) is found.
*******************************************************************************}
function ValidNullNPC(TheVar: Variant): Boolean;
begin
Result := ValidNullNPCMulti([TheVar]);
end;

{*******************************************************************************
function ValidNPC(TheVar: Variant): Boolean;
By: lordsaturn
Description: Results true if the npc is found
*******************************************************************************}
function ValidNPC(TheVar: Variant): Boolean;
var
NPC: TNPC;
begin
Result := FindNPC(TheVar, NPC);
end;

{*******************************************************************************
procedure DumpNPCs(NPCs: TNPCArray);
By: Drags111
Description: Prints out the array of NPCs. Mainly for debugging purposes.
*******************************************************************************}
procedure DumpNPCs(NPCs: TNPCArray);
var
i, Hi: integer;
begin
Hi := High(NPCs);
for i := 0 to Hi do
begin
Writeln('NPC: '+NPCs[i].Name);
Writeln(' '+'Index: '+ ToStr(NPCs[i].Index));
Writeln(' '+'ID: '+ToStr(NPCs[i].ID));
Writeln(' '+'Actions: '+ ToStr(NPCs[i].Actions));
Writeln(' '+'Tile: '+ ToStr(NPCs[i].Tile));
Writeln(' '+'RealTile: '+ ToStr(NPCs[i].RealTile));
Writeln(' '+'Animation: '+ ToStr(NPCs[i].Animation));
Writeln(' '+'Height: '+ ToStr(NPCs[i].Height));
Writeln(' '+'Fighting: '+ ToStr(NPCs[i].Fighting));
Writeln(' '+'IsMoving: '+ ToStr(NPCs[i].Moving));
Writeln(' '+'HPRatio: '+ ToStr(NPCs[i].HPRatio));
Writeln(' '+'Level: '+ ToStr(NPCs[i].Level));
Writeln(' '+'Orientation: '+ ToStr(NPCs[i].Orientation));
Writeln(' '+'Interacting: '+ ToStr(NPCs[i].Interacting));
end;
end;


const
ClientVersion = 639;
HookRev = 9;


{Static Hooks}
hook_static_LoginIndex = 'tn.U';
hook_static_getFriendsList = 'eea.K';
hook_static_getFriendsWorlds = 'jca.c';
hook_static_CameraYaw = 'jj.P';
hook_static_MyPlayer = 'hh.j';
hook_static_BaseX = 'vh.m';
hook_static_BaseY = 'gu.D';
hook_static_NPCIndexArray = 'rd.g';
hook_static_LoopCycle = 'du.u';
hook_static_NPCNodes = 'aa.e';
hook_static_NPCCount = 'jc.M';
hook_static_GroundSettingsArray = 'ha.g';
hook_static_LoadedPlane = 'gd.h';
hook_static_PlaneArray = 'gu.C';
hook_static_Toolkit = 'fm.b';
hook_static_MenuOptionCount = 'qh.b';
hook_static_MenuCollapsedOptionsCount = 'via.d';
hook_static_MenuX = 'av.R';
hook_static_MenuY = 'dca.z';
hook_static_MenuWidth = 'of.e';
hook_static_MenuHeight = 'rd.e';
hook_static_MenuX2 = 'gu.E';
hook_static_MenuY2 = 'vt.Gb';
hook_static_MenuWidth2 = 'ke.H';
hook_static_MenuHeight2 = 'qea.q';
hook_static_MenuNodeList = 'kr.b';
hook_static_MenuOpen = 'cga.F';
hook_static_GetInterfaces = 'vga.i';
hook_static_ValidInterfaces = 'we.w';
hook_static_IsMenuTabbed = 'fp.p';
hook_static_getCollapsedMenuItems = 'vfa.g';
hook_static_getNPCNC = 'mi.k';
hook_static_getItemDefLoader = 'jo.ib';
hook_static_GetSettings = 'kca.b';
hook_static_getObjectDefLoader = 'kea.d';
hook_static_GroundItemCache = 'ma.I';
hook_static_GetSkillExperiences = 'qb.c';
hook_static_GetSkillLevels = 'in.n';
hook_static_MapAngle = 'kf.q';
hook_static_DestX = 'dj.o';
hook_static_DestY = 'bn.k';
hook_static_PlayerCount = 'sr.c';
hook_static_PlayerIndexArray = 'tk.E';
hook_static_GetPlayers = 'aj.m';
hook_static_CamPosX = 'pd.c';
hook_static_CamPosY = 'sl.f';
hook_static_GroundTiles = 'jv.l';
hook_static_GetCrossHairColor = 'wfa.d';

{Class Animable}
class_Animable = 'vs';
hook_animable_PixelX = 'p';
hook_animable_PixelY = 'u';
hook_animable_Plane = 'vs';

{Class Player}
class_Player = 'bs';
hook_player_GetLevel = 'Id';
hook_player_GetName = 'xd';
hook_player_GetTeam = 'Sd';
hook_player_PlayerDef = 'fd';

{Class Character}
class_Character = 'ns';
hook_character_GetHitDamges = 'ic';
hook_character_Animation = 'hc';
hook_character_Motion = 'Rc';
hook_character_WalkQueueX = 'Uc';
hook_character_WalkQueueY = 'ad';
hook_character_GetHeight = 'Fb';
hook_character_LoopCycleStatus = 'S';
hook_character_HPRatio = 'yc';
hook_character_GetInteracting = 'Mc';
hook_character_Orientation = 'Yb';

{Class AnimableNode}
class_AnimableNode = 'lr';
hook_AnimableNode_GetAnimable = 'k';
hook_AnimableNode_GetNext = 'f';

{Class AnimableEntity}
class_AnimableEntity = 'oda';
hook_animableentity_getAreaX1 = 'F';
hook_animableentity_getAreaX2 = 'J';
hook_animableentity_getAreaY1 = 'D';
hook_animableentity_getAreaY2 = 'B';

{Class PlayerDef}
class_PlayerDef = 'ah';
hook_playerdef_GetEquipment = 'r';

{Class NPC}
class_NPC = 'kd';
hook_npc_NPCDef = 'Bd';
hook_npc_GetLevel = 'Cd';

{Class NPCDef}
class_NPCDef = 'ow';
hook_npcdef_GetActions = 'F';
hook_npcdef_GetName = 'W';
hook_npcdef_GetID = 'R';

{Class NPCNode}
class_NPCNode = 'uba';
hook_npcnode_GetNPC = 'm';

{Class GroundTile}
class_GroundTile = 'ffa';

{Class Plane}
class_Plane = 's';

{Class RSInteractable}
class_RSInteractable = 'gda';

{Class Toolkit}
class_Toolkit = 'ha';

{Class Viewport}
class_Viewport = 'ql';

{Class SDViewport}
class_SDViewport = 'iv';
hook_sdviewport_xOff = 'o';
hook_sdviewport_xX = 'l';
hook_sdviewport_xY = 'g';
hook_sdviewport_xZ = 'J';
hook_sdviewport_yOff = 'I';
hook_sdviewport_yX = 'K';
hook_sdviewport_yY = 'w';
hook_sdviewport_yZ = 'H';
hook_sdviewport_zOff = 'A';
hook_sdviewport_zX = 'e';
hook_sdviewport_zY = 'f';
hook_sdviewport_zZ = 'r';

{Class SDToolkit}
class_SDToolkit = 'iw';
hook_sdtoolkit_Viewport = 'M';
hook_sdtoolkit_xMin = 'K';
hook_sdtoolkit_xMax = 'nb';
hook_sdtoolkit_yMin = 'hb';
hook_sdtoolkit_yMax = 'E';
hook_sdtoolkit_zMin = 'Y';
hook_sdtoolkit_zMax = 'lb';
hook_sdtoolkit_xScale = 'O';
hook_sdtoolkit_yScale = 'mb';

{Class SDPlane}
class_SDPlane = 's';
hook_sdplane_TileHeights = 'p';

{Class SDModel}
class_SDModel = 'pt';
hook_sdmodel_getIndices1 = 'y';
hook_sdmodel_getIndices2 = 'Q';
hook_sdmodel_getIndices3 = 'Xb';
hook_sdmodel_getPointsX = 'J';
hook_sdmodel_getPointsY = 'nb';
hook_sdmodel_getPointsZ = 'zb';

{Class NodeListCache}
class_NodeListCache = 'se';
hook_nodelistcache_GetNodeList = 'm';

{Class NodeList}
class_NodeList = 'ada';
hook_nodelist_Current = 'm';
hook_nodelist_Head = 'e';

{Class Node}
class_Node = 'efa';
hook_node_Next = 'd';
hook_node_GetID = 'b';
hook_node_Previous = 'k';

{Class MenuGroupNode}
class_MenuGroupNode = 'k';
hook_MenuGroupNode_getNodeSubListItems = 'F';

{Class NodeSubList}
class_NodeSubList = 're';
hook_nodesublist_getHead = 'a';

{Class NodeSub}
class_NodeSub = 'we';
hook_nodesub_Next = 'r';

{Class Menu}
class_Menu = 'cs';
hook_menu_Option = 'K';
hook_menu_Action = 'G';

{Class ObjectInterface}
class_ObjectInterface = 'sca';
hook_interface_GetActions = 'Ub';
hook_interface_GetX = 'ad';
hook_interface_GetY = 'Ac';
hook_interface_GetWidth = 'K';
hook_interface_GetHeight = 'jb';
hook_interface_GetText = 'Lc';
hook_interface_GetTextureID = 'qc';
hook_interface_GetTextColor = 'Bb';
hook_interface_GetModelID = 'kd';
hook_interface_GetModelZoom = 'rd';
hook_interface_GetName = 'Vb';
hook_interface_GetChildren = 'ec';
hook_interface_GetID = 'sd';
hook_interface_GetStack = 'X';
hook_interface_GetParentID = 'S';
hook_interface_IsHidden = 'nd';

{Class NodeCache}
class_NodeCache = 'he';
hook_nodecache_GetNodes = 'b';

{Class Item}
class_Item = 'dv';
hook_item_GetID = 'p';
hook_item_GetStack = 'm';

{Class ItemDefLoader}
class_ItemDefLoader = 'hp';
hook_itemdefloader_getMRUNodes = 'o';

{Class ItemDef}
class_ItemDef = 'uo';
hook_itemdef_getLoader = 'z';
hook_itemdef_getGroundActions = 'M';
hook_itemdef_getActions = 'hb';

{Class MRUNodes}
class_MRUNodes = 'jt';
hook_mrunodes_getNodeCache = 'c';

{Class SettingArray}
class_SettingArray = 'rm';
hook_settingarray_GetData = 'a';

{Class ObjectDefLoader}
class_ObjectDefLoader = 'mk';
hook_objectdefloader_getMRUNodes = 'f';

{Class Ground}
class_Ground = 'ffa';
hook_ground_AnimableList = 'b';
hook_ground_WallObject1 = 'm';
hook_ground_WallObject2 = 'ffa';
hook_ground_WallDecoration1 = 'd';
hook_ground_WallDecoration2 = 'g';
hook_ground_FloorDecoration = 'p';

{Class WallObjectData}
class_WallObjectData = 'tq';
hook_WallObjectData_GetID = 'lb';
hook_WallObjectData_GetModel = 'db';
hook_WallObjectData_GetOrientation = 'Q';

{Class WallDecorationData}
class_WallDecorationData = 'gs';
hook_WallDecorationData_GetID = 'Q';
hook_WallDecorationData_GetModel = 'ib';
hook_WallDecorationData_GetOrientation = 'S';

{Class FloorDecorationData}
class_FloorDecorationData = 'rh';
hook_FloorDecorationData_GetID = 'K';
hook_FloorDecorationData_GetModel = 'nb';
hook_FloorDecorationData_GetOrientation = 'X';

{Class InteractiveObject}
class_InteractiveObject = 'dda';
hook_interactiveobject_GetID = 'cb';
hook_interactiveobject_GetModel = 'nb';
hook_interactiveobject_GetOrientation = 'ob';

{Class InteractiveObject2}
class_InteractiveObject2 = 'ww';
hook_interactiveobject2_GetObjectData = 'cb';

{Class SecondLevelObject}
class_SecondLevelObject = 'qea';
hook_secondlevelobject_GetID = 't';
hook_secondlevelobject_GetModel = 'u';
hook_secondlevelobject_GetOrientation = 'g';

{Class WallObjectSub2}
class_WallObjectSub2 = 'bda';
hook_wallobjectsub2_getComposite = 'Y';

{Class WallDecorationSub2}
class_WallDecorationSub2 = 'dha';
hook_walldecorationsub2_getComposite = 'cb';

{Class FloorDecorationSub2}
class_FloorDecorationSub2 = 'qc';
hook_floordecorationsub2_getComposite = 'P';

^ Fix

Train

2011-02-23 19:51:17

Fork the repository and submit a pull request.

pyroryan

2011-02-23 21:32:30

As discussed on MSN. There seems to be two fields carrying the information. "ow.p" is the one in definition.