SRL Archive - Senior News and General

RsBot Hook converter.


Naike

2009-12-12 18:59:40

After four hours of hard work, and some random talking from YoHoJo, Cohen and Widget I've come to the phase where I think it's working to the standards that we can start fixing reflection again..

Basically what it does..
  • Converts the RsBot hooks to Hooks.scar
  • Gives you the output in the TMemo



Simple as that.

There are some bugs in it, which I couldn't be cared to fix, as it's waaay too late for me to care. I'm going to write a tutorial on this tomorrow morning which I hope at least someone reads, so I don't have to update this myself, each time.

With this, you can update reflection in max 30 minutes, with the decompiled rs.jar and RsBot-(RsBuild).jar files.

Note: I haven't tried all of these hooks, highly doubt any are not working though.

Input:

public final int[] getRSNPCIndexArray()
{
return hb.B;
}

public final RSNPC[] getRSNPCArray()
{
return jf.x;
}

public final int getRSNPCCount()
{
return rp.h;
}

public final RSPlayer[] getRSPlayerArray()
{
return mn.A;
}

public final int[] getRSPlayerIndexArray()
{
return to.f;
}

public final int getRSPlayerCount()
{
return ss.K;
}

public final int getBaseX()
{
return ok.p;
}

public final RSPlayer getMyRSPlayer()
{
return sh.j;
}

public final int getBaseY()
{
return qr.t;
}

public final int getPublicChatMode()
{
return ae.x;
}

public final int getLoopCycle()
{
return va.g;
}

public final int getSelfInteracting()
{
return ok.p;
}

public final byte[][][] getGroundByteArray()
{
return vn.g;
}

public final int getPlane()
{
return gn.n;
}

public final int getCamPosX()
{
return ok.n;
}

public final int getCamPosY()
{
return hd.V;
}

public final int getCamPosZ()
{
return te.e;
}

public final int getCameraPitch()
{
return rr.m;
}

public final int getCameraYaw()
{
return ij.c;
}

public final Rectangle[] getRSInterfaceBoundsArray()
{
return r.b;
}

public final boolean[] getValidRSInterfaceArray()
{
return pr.S;
}

public final String getCurrentUsername()
{
return ag.H;
}

public final String getCurrentPassword()
{
return le.d;
}

public final Mouse getMouse()
{
return rf.W;
}

public final Keyboard getKeyboard()
{
return pd.f;
}

public final MouseWheel getMouseWheel()
{
return ld.c;
}

public final Callback getCallback()
{
return callback;
}

public final void setCallback(Callback arg0)
{
callback = arg0;
}

public final int getLoginIndex()
{
return ho.J;
}

public final int[] getSkillExperiencesMax()
{
return lt.u;
}

public final int getMinimapScale()
{
return li.r;
}

public final int[] getCURVECOS()
{
return an.s;
}

public final int[] getCURVESIN()
{
return an.m;
}

public final int getMinimapSetting()
{
return sj.N;
}

public final int getMinimapAngle()
{
return nt.b;
}

public final float getMinimapOffset()
{
return wi.K;
}

public final boolean isSpellSelected()
{
return et.u;
}

public final int isItemSelected()
{
return nf.r;
}

public final String getSelectedItemName()
{
return bi.r;
}

public final NodeCache getRSItemNodeCache()
{
return tf.m;
}

public final StatusNodeList getRSInteractingDefList()
{
return gi.h;
}

public final RSGround[][][] getRSGroundArray()
{
return bf.o;
}

public final int getMenuOptionsCount()
{
return lt.w;
}

public final boolean isMenuOpen()
{
return di.B;
}

public final int getMenuX()
{
return et.m;
}

public final int getMenuY()
{
return bu.G;
}

public final NodeList getActionDataList()
{
return ui.k;
}

public final Signlink getSignlink()
{
return tj.d;
}

public final boolean isFlagged()
{
return o.k;
}

public final RSItemDefFactory getRSItemDefFactory()
{
return pc.P;
}

public final int getDestX()
{
return kg.P;
}

public final int getDestY()
{
return ea.a;
}

public final TileData[] getTileData()
{
return mt.I;
}

public final DetailInfo getDetailInfo()
{
return ke.b;
}

public final RSGroundData[] getRSGroundDataArray()
{
return ol.W;
}

public final String[] getChatMessages()
{
return qd.b;
}

public final String[] getChatNames()
{
return qd.b;
}

public final int[] getChatTypes()
{
return rt.a;
}

public final int[] getSkillLevels()
{
return uo.j;
}

public final int[] getSkillExperiences()
{
return es.a;
}

public final int[] getSkillLevelMaxes()
{
return ig.F;
}

public final Settings getSettingArray()
{
return mu.c;
}

public final NodeCache getRSInterfaceNC()
{
return ba.g;
}

public final int getGUIRSInterfaceIndex()
{
return ub.n;
}

public final RSInterface[][] getRSInterfaceCache()
{
return hh.f;
}

public final String getMessage()
{
return Ab;
}

public final int isMoving()
{
return lc;
}

public final int getAnimation()
{
return X;
}

public final int[] getLocationY()
{
return ic;
}

public final int[] getLocationX()
{
return hc;
}

public final int getLoopCycleStatus()
{
return pb;
}

public final int getHPRatio()
{
return Cb;
}

public final int getHeight()
{
return C;
}

public final int getInteracting()
{
return ub;
}

public final int getX()
{
return o;
}

public final int getY()
{
return j;
}

public final RSNPCDef getRSNPCDef()
{
return mc;
}

public final boolean isMembers()
{
return v;
}


public final String getName()
{
return S;
}

public final int getType()
{
return gb;
}

public final int getLevel()
{
return k;
}

public final String getPlayerName()
{
return mc;
}

public final int getCombatLevel()
{
return bd;
}

public final String getMenuOption()
{
return u;
}

public final String getMenuAction()
{
return s;
}

public final int getRsItemID()
{
return p;
}

public final int getStackSize()
{
return this.n;
}


Output:
//------------------------------------------------------------------\\
//-- Scar Non-Standard Resource Library --||
//-- Reflection Routines - Hooks --||
//------------------------------------------------------------------//


const
// Build number
RsBuild = 575;

// NPC
NPCDef = 'mc';

// Player
CharName = 'mc';
CharLevel = 'bd';

// Client
NPCIndexArray = 'hb.B';
NPCArray = 'jf.x';
NPCCount = 'rp.h';

PlayerIndexArray = 'to.f';
PlayerArray = 'mn.A';
PlayerCount = 'ss.K';
MyPlayer = 'sh.j';

BaseX = 'ok.p';
BaseY = 'qr.t';

LoopCycle = 'va.g';

GroundHeights = '';
GroundSettings = 'vn.g';
BaseLayer = 'gn.n';

CamX = 'ok.n';
CamY = 'hd.V';
CamZ = 'te.e';
CamPitch = 'rr.m';
CamYaw = 'ij.c';

LoginIndex = 'ho.J';

SettingsArray = 'mu.c';

IsMembers = 'v';

MaxLevels = 'ig.F';
CurrentLevels = 'uo.j';
Experiences = 'lt.u';

MapOffsetAngle = 'nt.b';
CompassAngle = 'wi.K';

ChatMessages = 'qd.b';
ChatTypes = 'rt.a';
ChatNames = 'qd.b';

MenuOptionsCount = 'lt.w';
MenuOpen = 'di.B';
MenuX = 'et.m';
MenuY = 'bu.G';
MenuOption = 'u';
MenuAction = 's';

SelectedItemName = 'bi.r';

FlagX = 'kg.P';
FlagY = 'ea.a';

// Character
CharAnim = 'X';
CharMotion = 'lc';
CurrentX = 'o';
CurrentY = 'j';
LoopCycleStatus = 'pb';
CharHPRatio = 'Cb';
CharHeight = 'C';
TurnDirection = '';
CharInteracting = 'ub';

SelfInteracting = 'ok.p';

// NPCDef
NPCName = 'S';
NPCType = 'gb';
NPCLevel = 'k';

// Ground Item Finding
GroundItemArray = '';
GroundItemHead = '';
NextGroundItem = '';
GroundItem = '';
GroundItemID = '';
GroundItemStackSize = '';

GroundArray = 'bf.o';

// Object Hooks
Object1 = '';
Object2 = '';
Object3 = '';
Object4 = '';
Object5Array = '';

ObjectUID1 = '';
ObjectUID2 = '';
ObjectUID3 = '';
ObjectUID4 = '';
ObjectUID5 = '';

// Interface Hooks
// General
InterfaceCache = 'hh.f';
ValidInterfaceArray = '';
InterfaceChildren = '';
InterfaceText = '';
TextColor = '';
SelectedModelID = '';
NotSelectedModelID = '';
SelectedModelType = '';
NotSelectedModelType = '';
ModelZoom = '';

// Bank
BankItemID = '';
BankItemStackSize = '';
BankItemName = '';
BankItemIndex = '';

// Inventory
InventoryItemIDs = 'p';
InventoryItemStackSizes = 'n';

// Ground Data
GroundDataArray = '';
GroundDataBlocks = '';

The stuff being empty, I eaither didn't find, or didn't think was important enough to find. With help from the more experienced people on here, it can possibly be found.

Source:

program HookRipper;
{.Include SRL/SRL/Reflection/Hooks.scar}

Const
RsBuildUpdate = 575;
NameForEmpty = '';

var
frmDesign : TForm;
Txt : TMemo;
Button : Array [0..2] of TButton;

PosHooks: TStringArray;
CurHooks: TStringArray;

Function RsBotHookIs(HookName: String): String;
begin
Case LowerCase(HookName) of
'getrsnpcdef': Result := 'NPCDef';
'getrsnpcindexarray': Result := 'NPCIndexArray';
'getrsnpcarray': Result := 'NPCArray';
'getrsnpccount': Result := 'NPCCount';

'getrsplayerindexarray': Result := 'PlayerIndexArray';
'getrsplayerarray': Result := 'PlayerArray';

'getbasex': Result := 'BaseX';
'getbasey': Result := 'BaseY';
'getmyrsplayer': Result := 'MyPlayer';
'getrsplayercount': Result := 'PlayerCount';

'getplane': Result := 'BaseLayer';
'getx': Result := 'CurrentX';
'gety': Result := 'CurrentY';
'getloopcyclestatus': Result := 'LoopCycleStatus';
'ismoving': Result := 'CharMotion';
'getanimation': Result := 'CharAnim';
'getinteracting': Result := 'CharInteracting';

'getheight': Result := 'CharHeight';
'gethpratio': Result := 'CharHPRatio';

'getloopcycle': Result := 'LoopCycle';
'getselfinteracting': Result := 'SelfInteracting';
'getgroundbytearray': Result := 'GroundSettings';
'getgroundIntarray': Result := 'GroundHeights';

'getplane': Result := 'BaseLayer';
'getvalidrsinterfaceArray': Result := 'ValidInterfaceArray';
'getrsinterfacecache': Result := 'InterfaceCache';
'getloginindex': Result := 'LoginIndex';
'getsettingarray': Result := 'SettingsArray';

'getminimapangle': Result := 'MapOffsetAngle';
'getminimapoffset': Result := 'CompassAngle';
'getrsgroundarray': Result := 'GroundArray';

'getchatmessages': Result := 'ChatMessages';
'getchatnames': Result := 'ChatNames';
'getchattypes': Result := 'ChatTypes';

'getmenuoption': Result := 'MenuOption';
'getmenuoptionscount': Result := 'MenuOptionsCount';
'ismenuopen': Result := 'MenuOpen';
'getmenux': Result := 'MenuX';
'getmenuy': Result := 'MenuY';
'getmenuaction': Result := 'MenuAction';

'getdestx': Result := 'FlagX';
'getdesty': Result := 'FlagY';

'getrsGrounddataarray': Result := 'GroundDataArray';
'getselecteditemname': Result := 'SelectedItemName';

'getskillexperiences': Result := 'Experiences';
'getskilllevels': Result := 'CurrentLevels';
'getskilllevelmaxes': Result := 'MaxLevels';

'ismembers': Result := 'IsMembers';

'getcamposx': Result := 'CamX';
'getcamposy': Result := 'CamY';
'getcamposz': Result := 'CamZ';
'getcamerapitch': Result := 'CamPitch';
'getcamerayaw': Result := 'CamYaw';

'getlevel': Result := 'NPCLevel';
'getname': Result := 'NPCName';
'gettype': Result := 'NPCType';

'getplayername': Result := 'CharName';
'getcombatlevel': Result := 'CharLevel';

'getrsitemid': Result := 'InventoryItemIDs';
'getstacksize': Result := 'InventoryItemStackSizes';
//'': Result := '';

end;
end;

Function GetHookName(Index: Integer): String;
begin
Case Index of
0: Result := 'NPCDef';
1: Result := 'CharName';
2: Result := 'CharLevel';
3: Result := 'NPCIndexArray';
4: Result := 'NPCArray';
5: Result := 'NPCCount';
6: Result := 'PlayerIndexArray';
7: Result := 'PlayerArray';
8: Result := 'PlayerCount';
9: Result := 'MyPlayer';
10: Result := 'BaseX';
11: Result := 'BaseY';
12: Result := 'LoopCycle';
13: Result := 'GroundHeights';
14: Result := 'GroundSettings';
15: Result := 'BaseLayer';
16: Result := 'CamX';
17: Result := 'CamY';
18: Result := 'CamZ';
19: Result := 'CamPitch';
20: Result := 'CamYaw';
21: Result := 'LoginIndex';
22: Result := 'SettingsArray';
23: Result := 'IsMembers';
24: Result := 'MaxLevels';
25: Result := 'CurrentLevels';
26: Result := 'Experiences';
27: Result := 'MapOffsetAngle';
28: Result := 'CompassAngle';
29: Result := 'ChatMessages';
30: Result := 'ChatTypes';
31: Result := 'ChatNames';
32: Result := 'MenuOptionsCount';
33: Result := 'MenuOpen';
34: Result := 'MenuX';
35: Result := 'MenuY';
36: Result := 'MenuOption';
37: Result := 'MenuAction';
38: Result := 'SelectedItemName';
39: Result := 'FlagX';
40: Result := 'FlagY';
41: Result := 'CharAnim';
42: Result := 'CharMotion';
43: Result := 'CurrentX';
44: Result := 'CurrentY';
45: Result := 'LoopCycleStatus';
46: Result := 'CharHPRatio';
47: Result := 'CharHeight';
48: Result := 'TurnDirection';
49: Result := 'CharInteracting';
50: Result := 'SelfInteracting';
51: Result := 'NPCName';
52: Result := 'NPCType';
53: Result := 'NPCLevel';
54: Result := 'GroundItemArray';
55: Result := 'GroundItemHead';
56: Result := 'NextGroundItem';
57: Result := 'GroundItem';
58: Result := 'GroundItemID';
59: Result := 'GroundItemStackSize';
60: Result := 'GroundArray';
61: Result := 'Object1';
62: Result := 'Object2';
63: Result := 'Object3';
64: Result := 'Object4';
65: Result := 'Object5Array';
66: Result := 'ObjectUID1';
67: Result := 'ObjectUID2';
68: Result := 'ObjectUID3';
69: Result := 'ObjectUID4';
70: Result := 'ObjectUID5';
71: Result := 'InterfaceCache';
72: Result := 'ValidInterfaceArray';
73: Result := 'InterfaceChildren';
74: Result := 'InterfaceText';
75: Result := 'TextColor';
76: Result := 'SelectedModelID';
77: Result := 'NotSelectedModelID';
78: Result := 'SelectedModelType';
79: Result := 'NotSelectedModelType';
80: Result := 'ModelZoom';
81: Result := 'BankItemID';
82: Result := 'BankItemStackSize';
83: Result := 'BankItemName';
84: Result := 'BankItemIndex';
85: Result := 'InventoryItemIDs';
86: Result := 'InventoryItemStackSizes';
87: Result := 'GroundDataArray';
88: Result := 'GroundDataBlocks';
end;
end;

procedure ConvertIt(Sender: TObject);
var
I, F, II: Integer;
S, Temp: String;
UnkHooks, Com: TStringArray;
Cor: Boolean;
begin
S := Txt.Text;
If S = '' then
Exit;

SetArrayLength(UnkHooks, GetArrayLength(PosHooks));
SetArrayLength(CurHooks, 89);

Txt.Text := '';
For I:=0 to High(PosHooks) do
begin
F := Pos(LowerCase(PosHooks[I]), LowerCase(S));
If Not (F > 0) then
Continue;

Temp := Copy(S, F, PosEx('}', LowerCase(S), F));
Temp := Copy(Temp, Pos('return ', Temp)+7, 10);
If (Pos('this.', Temp) > 0) then
Delete(Temp, 1, 5);

Delete(Temp, Pos(';', Temp), 1000);
Writeln(PosHooks[I] + ' = ' + Temp);

UnkHooks[I] := Temp;
end;

For I:=0 to High(CurHooks)do
begin
S := LowerCase(GetHookName(I));
If I=36 then
Writeln(S);
Temp := NameForEmpty;
For II:=0 to High(PosHooks)do
If LowerCase(S) = LowerCase(RsBotHookIs(PosHooks[II]))then
begin
Temp := UnkHooks[II];
If I=36 then
begin
Writeln(Temp);
Writeln(LowerCase(RsBotHookIs(PosHooks[II])));
Writeln(PosHooks[II]);
end;
Break;
end;
CurHooks[I] := Temp;
end;

Txt.Lines.Add('//------------------------------------------------------------------\\');
Txt.Lines.Add('//-- Scar Non-Standard Resource Library --||');
Txt.Lines.Add('//-- Reflection Routines - Hooks --||');
Txt.Lines.Add('//------------------------------------------------------------------//');
Txt.Lines.Add('');
Txt.Lines.Add('');
Txt.Lines.Add('const');
Txt.Lines.Add(' // Build number');
Txt.Lines.Add(' RsBuild = ' + IntToStr(RsBuildUpdate) + ';');
Txt.Lines.Add('');
Txt.Lines.Add(' // NPC');
Txt.Lines.Add(' NPCDef = ''' + CurHooks[0] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add(' // Player');
Txt.Lines.Add(' CharName = ''' + CurHooks[1] + ''';');
Txt.Lines.Add(' CharLevel = ''' + CurHooks[2] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add('// Client');
Txt.Lines.Add(' NPCIndexArray = ''' + CurHooks[3] + ''';');
Txt.Lines.Add(' NPCArray = ''' + CurHooks[4] + ''';');
Txt.Lines.Add(' NPCCount = ''' + CurHooks[5] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add(' PlayerIndexArray = ''' + CurHooks[6] + ''';');
Txt.Lines.Add(' PlayerArray = ''' + CurHooks[7] + ''';');
Txt.Lines.Add(' PlayerCount = ''' + CurHooks[8] + ''';');
Txt.Lines.Add(' MyPlayer = ''' + CurHooks[9] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add(' BaseX = ''' + CurHooks[10] + ''';');
Txt.Lines.Add(' BaseY = ''' + CurHooks[11] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add(' LoopCycle = ''' + CurHooks[12] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add(' GroundHeights = ''' + CurHooks[13] + ''';');
Txt.Lines.Add(' GroundSettings = ''' + CurHooks[14] + ''';');
Txt.Lines.Add(' BaseLayer = ''' + CurHooks[15] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add(' CamX = ''' + CurHooks[16] + ''';');
Txt.Lines.Add(' CamY = ''' + CurHooks[17] + ''';');
Txt.Lines.Add(' CamZ = ''' + CurHooks[18] + ''';');
Txt.Lines.Add(' CamPitch = ''' + CurHooks[19] + ''';');
Txt.Lines.Add(' CamYaw = ''' + CurHooks[20] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add(' LoginIndex = ''' + CurHooks[21] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add(' SettingsArray = ''' + CurHooks[22] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add(' IsMembers = ''' + CurHooks[23] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add(' MaxLevels = ''' + CurHooks[24] + ''';');
Txt.Lines.Add(' CurrentLevels = ''' + CurHooks[25] + ''';');
Txt.Lines.Add(' Experiences = ''' + CurHooks[26] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add(' MapOffsetAngle = ''' + CurHooks[27] + ''';');
Txt.Lines.Add(' CompassAngle = ''' + CurHooks[28] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add(' ChatMessages = ''' + CurHooks[29] + ''';');
Txt.Lines.Add(' ChatTypes = ''' + CurHooks[30] + ''';');
Txt.Lines.Add(' ChatNames = ''' + CurHooks[31] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add(' MenuOptionsCount = ''' + CurHooks[32] + ''';');
Txt.Lines.Add(' MenuOpen = ''' + CurHooks[33] + ''';');
Txt.Lines.Add(' MenuX = ''' + CurHooks[34] + ''';');
Txt.Lines.Add(' MenuY = ''' + CurHooks[35] + ''';');
Txt.Lines.Add(' MenuOption = ''' + CurHooks[36] + ''';');
Txt.Lines.Add(' MenuAction = ''' + CurHooks[37] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add(' SelectedItemName = ''' + CurHooks[38] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add(' FlagX = ''' + CurHooks[39] + ''';');
Txt.Lines.Add(' FlagY = ''' + CurHooks[40] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add('// Character');
Txt.Lines.Add(' CharAnim = ''' + CurHooks[41] + ''';');
Txt.Lines.Add(' CharMotion = ''' + CurHooks[42] + ''';');
Txt.Lines.Add(' CurrentX = ''' + CurHooks[43] + ''';');
Txt.Lines.Add(' CurrentY = ''' + CurHooks[44] + ''';');
Txt.Lines.Add(' LoopCycleStatus = ''' + CurHooks[45] + ''';');
Txt.Lines.Add(' CharHPRatio = ''' + CurHooks[46] + ''';');
Txt.Lines.Add(' CharHeight = ''' + CurHooks[47] + ''';');
Txt.Lines.Add(' TurnDirection = ''' + CurHooks[48] + ''';');
Txt.Lines.Add(' CharInteracting = ''' + CurHooks[49] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add(' SelfInteracting = ''' + CurHooks[50] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add('// NPCDef');
Txt.Lines.Add(' NPCName = ''' + CurHooks[51] + ''';');
Txt.Lines.Add(' NPCType = ''' + CurHooks[52] + ''';');
Txt.Lines.Add(' NPCLevel = ''' + CurHooks[53] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add('// Ground Item Finding');
Txt.Lines.Add(' GroundItemArray = ''' + CurHooks[54] + ''';');
Txt.Lines.Add(' GroundItemHead = ''' + CurHooks[55] + ''';');
Txt.Lines.Add(' NextGroundItem = ''' + CurHooks[56] + ''';');
Txt.Lines.Add(' GroundItem = ''' + CurHooks[57] + ''';');
Txt.Lines.Add(' GroundItemID = ''' + CurHooks[58] + ''';');
Txt.Lines.Add(' GroundItemStackSize = ''' + CurHooks[59] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add(' GroundArray = ''' + CurHooks[60] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add('// Object Hooks');
Txt.Lines.Add(' Object1 = ''' + CurHooks[61] + ''';');
Txt.Lines.Add(' Object2 = ''' + CurHooks[62] + ''';');
Txt.Lines.Add(' Object3 = ''' + CurHooks[63] + ''';');
Txt.Lines.Add(' Object4 = ''' + CurHooks[64] + ''';');
Txt.Lines.Add(' Object5Array = ''' + CurHooks[65] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add(' ObjectUID1 = ''' + CurHooks[66] + ''';');
Txt.Lines.Add(' ObjectUID2 = ''' + CurHooks[67] + ''';');
Txt.Lines.Add(' ObjectUID3 = ''' + CurHooks[68] + ''';');
Txt.Lines.Add(' ObjectUID4 = ''' + CurHooks[69] + ''';');
Txt.Lines.Add(' ObjectUID5 = ''' + CurHooks[70] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add('// Interface Hooks');
Txt.Lines.Add('// General');
Txt.Lines.Add(' InterfaceCache = ''' + CurHooks[71] + ''';');
Txt.Lines.Add(' ValidInterfaceArray = ''' + CurHooks[72] + ''';');
Txt.Lines.Add(' InterfaceChildren = ''' + CurHooks[73] + ''';');
Txt.Lines.Add(' InterfaceText = ''' + CurHooks[74] + ''';');
Txt.Lines.Add(' TextColor = ''' + CurHooks[75] + ''';');
Txt.Lines.Add(' SelectedModelID = ''' + CurHooks[76] + ''';');
Txt.Lines.Add(' NotSelectedModelID = ''' + CurHooks[77] + ''';');
Txt.Lines.Add(' SelectedModelType = ''' + CurHooks[78] + ''';');
Txt.Lines.Add(' NotSelectedModelType = ''' + CurHooks[79] + ''';');
Txt.Lines.Add(' ModelZoom = ''' + CurHooks[80] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add('// Bank');
Txt.Lines.Add(' BankItemID = ''' + CurHooks[81] + ''';');
Txt.Lines.Add(' BankItemStackSize = ''' + CurHooks[82] + ''';');
Txt.Lines.Add(' BankItemName = ''' + CurHooks[83] + ''';');
Txt.Lines.Add(' BankItemIndex = ''' + CurHooks[84] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add('// Inventory');
Txt.Lines.Add(' InventoryItemIDs = ''' + CurHooks[85] + ''';');
Txt.Lines.Add(' InventoryItemStackSizes = ''' + CurHooks[86] + ''';');
Txt.Lines.Add('');
Txt.Lines.Add('// Ground Data');
Txt.Lines.Add(' GroundDataArray = ''' + CurHooks[87] + ''';');
Txt.Lines.Add(' GroundDataBlocks = ''' + CurHooks[88] + ''';');
end;

procedure CheckMatchs(Sender: TObject);
var
I, II, F, Matches: Integer;
S, Temp: String;
begin
S := Txt.Text;
For I:=0 to High(PosHooks) do
begin
F := Pos(LowerCase(PosHooks[I]), LowerCase(S));
If Not (F > 0) then
Continue;

Temp := Copy(S, F, PosEx('}', LowerCase(S), F));
Temp := Copy(Temp, Pos('return ', Temp)+7, 10);
Delete(Temp, Pos(';', Temp), 1000);

For II:=0 to High(CurHooks)do
If (LowerCase(CurHooks[II]) = LowerCase(Temp)) then
begin
Writeln(PosHooks[I] + ' = ' + GetHookName(II) + ' // ' + Temp);
Inc(Matches);
end;
end;
Writeln('Found ' + IntToStr(Matches) + '/' + IntToStr(GetArrayLength(CurHooks)));
end;

procedure InitForm;
var
I: Integer;
S: TStringArray;
begin
frmDesign := CreateForm;
frmDesign.Left := 250;
frmDesign.Top := 114;
frmDesign.Width := 407;
frmDesign.Height := 535;
frmDesign.Caption := 'Hook Converter';
frmDesign.Font.Style := [];
frmDesign.Visible := False;
frmDesign.BorderStyle := bsSingle;
frmDesign.BorderIcons := [biMinimize,biSystemMenu];
frmDesign.Position:= poScreenCenter;

Txt := TMemo.Create(frmDesign);
Txt.Parent := frmDesign;
Txt.Left := 0;
Txt.Top := 0;
Txt.Width := 401;
Txt.Height := 441;
Txt.DragMode := dmManual;
Txt.ScrollBars := ssVertical;

For I:=0 to 2 do
begin
Button[I] := TButton.Create(frmDesign);
Button[I].Parent := frmDesign;
Button[I].Left := 64+(I*96);
Button[I].Top := 456;
Button[I].Width := 72;
Button[I].Height := 25;
end;

Button[0].Caption := 'Convert It';

Button[0].OnClick := @ConvertIt;
Button[1].OnClick := @CheckMatchs;
Button[1].Enabled := False;
Button[2].Enabled := False;
end;

procedure SafeInitForm;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('InitForm', v);
end;

procedure ShowFormModal;
begin
frmDesign.ShowModal;
end;

procedure SafeShowFormModal;
var
v: TVariantArray;
begin
setarraylength(V, 0);
ThreadSafeCall('ShowFormModal', v);
end;

begin
ClearDebug;

PosHooks := ['getRSNPCIndexArray',
'getRSNPCArray',
'getRSNPCCount',
'getRSPlayerIndexArray',
'getRSPlayerArray',
'getRSPlayerCount',
'getBaseX',
'getBaseY',
'getMyRSPlayer',
'getPublicChatMode',
'getLoopCycle',
'getSelfInteracting',
'getGroundByteArray',
'getGroundIntArray',
'getPlane',
'getCamPosX',
'getCamPosY',
'getCamPosZ',
'getCameraPitch',
'getCameraYaw',
'getRSInterfaceBoundsArray',
'getValidRSInterfaceArray',
'getCurrentUsername',
'getCurrentPassword',
'getRSInterfaceCache',
'getMouseWheel',
'getKeyboard',
'getMouse',
'getLoginIndex',
'getSettingArray',
'getSkillExperiencesMax',
'getMinimapScale',
'getCURVECOS',
'getCURVESIN',
'getMinimapSetting',
'getMinimapAngle',
'getMinimapOffset',
'isSpellSelected',
'isItemSelected',
'getSelectedItemName',
'getRSItemNodeCache',
'getRSInteractingDefList',
'getRSGroundArray',
'getChatMessages',
'getChatNames',
'getChatTypes',
'getMenuOption',
'getMenuOptionsCount',
'getMenuAction',
'isMenuOpen',
'getMenuX',
'getMenuY',
'getActionDataList',
'getSignlink',
'isFlagged',
'getRSItemDefMRUNodes',
'isMembers',
'getRSObjectDefMRUNodes',
'getDestX',
'getDestY',
'getDetailLevel',
'getTileData',
'getRSGroundDataArray',
'getSkillLevels',
'getSkillExperiences',
'getSkillLevelMaxes',
'getRSInterfaceNC',
'getGUIRSInterfaceIndex',
'getMessage',
'isMoving',
'getAnimation',
'getLocationY',
'getLocationX',
'getLoopCycleStatus',
'getHPRatio',
'getHeight',
'getInteracting',
'getX',
'getY',
'getRSNPCDef',
'getLevel',
'getName',
'getType',
'getCombatLevel',
'getPlayerName', // getName in RSPlayer
'getInteracting',
'getRsItemID', // getID in RSItem
'getStackSize'{,
'',
'',
'',
'',
''}];

SafeInitForm;
SafeShowFormModal;


end.

I know, it's messy, and hard to understand. But after the tutorial it'll all be much clearer.

Notes:
One of the bugs are that the "MenuOption" hook results the same as "MenuOptionsCount". Therefor, if you try it, make sure you change "MenuOption" to "u".

Reflection is still not working, as runetek made a big mess some stuff will be needed to be rewritten.

Nava2

2009-12-12 19:05:56

Try tossing in a " " after MenuOption? I'm not sure if that might help.

Wanted

2009-12-12 19:14:34

Great work, only question is why wasn't this done sooner?

YoHoJo

2009-12-12 19:15:24

From: IceFire908
Great work, only question is why wasn't this done sooner?


Done now. So be happy. :D

Method

2009-12-12 19:15:29

From: IceFire908
Great work, only question is why wasn't this done sooner?


wat

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

Bobarkinator

2009-12-12 20:46:53

From: Method
wat

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


I worked on it a little bit today. It's just the finding of the different named hooks is the problem. Have most of them working just need a little more work. I was writing my own that would load RSBot's accessors and use those to strip every hook from it. But then I realized they have a lot of hooks that we could never use/wouldn't need.

Method

2009-12-12 20:51:25

From: Bobarkinator
I worked on it a little bit today. It's just the finding of the different named hooks is the problem. Have most of them working just need a little more work. I was writing my own that would load RSBot's accessors and use those to strip every hook from it. But then I realized they have a lot of hooks that we could never use/wouldn't need.


If you guys need help figuring out the names and functions of fields, feel free to ask me. I'm not opposed at all to helping out, I just don't want to rebuild my updater.

Bobarkinator

2009-12-12 21:28:49

What does GroundSettings convert to in rsbot? I'm not even sure if it exists anymore

Method

2009-12-12 21:30:37

From: Bobarkinator
What does GroundSettings convert to in rsbot? I'm not even sure if it exists anymore


GroundSettings is probably the field in the getGroundByteArray method, but the GroundHeights field isn't used in the same way in rt5.

Bobarkinator

2009-12-12 21:39:25

From: Method
GroundSettings is probably the field in the getGroundByteArray method, but the GroundHeights field isn't used in the same way in rt5.


Oh ok, thanks. I had GroundHeights set to the GroundByteArray so yeah. I plan on reading through RSBot to see how they use some of the hooks that I don't know about so I'll know how to use in our include.
I've had decent experience with the client so I know my way around a little bit whch helps.

Sir R. M8gic1an

2009-12-13 05:18:02

From: Method
GroundSettings is probably the field in the getGroundByteArray method, but the GroundHeights field isn't used in the same way in rt5.


Release it?

~RM

Freddy1990

2009-12-13 08:10:20

You could use regexes to do this, but unfortunatly SCAR's regex system isn't implemented that well =/ So it's case sensitive and a bit messy, but, it does work:
const
s = ' public final int[] getRSNPCIndexArray()'#13#10 +
'{'#13#10 +
' return hb.B;'#13#10 +
'}'#13#10 +
''#13#10 +
'public final RSNPC[] getRSNPCArray()'#13#10 +
'{'#13#10 +
' return jf.x;'#13#10 +
'}'#13#10 +
''#13#10 +
'public final int getRSNPCCount()'#13#10 +
'{'#13#10 +
' return rp.h;'#13#10 +
'}'#13#10 +
''#13#10 +
'public final RSPlayer[] getRSPlayerArray()'#13#10 +
'{'#13#10 +
' return mn.A;'#13#10 +
'}'#13#10 +
''#13#10 +
'public final int[] getRSPlayerIndexArray()'#13#10 +
'{'#13#10 +
' return to.f;'#13#10 +
'}'#13#10 +
''#13#10 +
'public final int getRSPlayerCount()'#13#10 +
'{'#13#10 +
' return ss.K;'#13#10 +
'}';

function GetHook(RSBotHooks, Name: string): string;
begin
Result := FindRegex(s, Name + '\(\)[^r]+return [^;]+');
Result := ReplaceRegex(Result, Name + '\(\)[^r]+return ([^;]+)', '$1');
end;

begin
WriteLn(GetHook(s, 'getRSPlayerArray'));
end.

Method

2009-12-13 10:41:40

From: Rasta Magician
Release it?

~RM


Release what??

Sir R. M8gic1an

2009-12-13 11:05:40

From: Method
Release what??


Quoted wrong post >.>

Your updater :p

If people are already going through RSBot's, might as well just have your updater and update it

~RM

Bobarkinator

2009-12-13 14:08:06

From: Rasta Magician
Quoted wrong post >.>

Your updater :p

If people are already going through RSBot's, might as well just have your updater and update it

~RM


It's broke, really no use in having
it except the base. You still have to rewrite all the methods to get the hooks.

Sir R. M8gic1an

2009-12-13 15:01:25

From: Bobarkinator
It's broke, really no use in having
it except the base. You still have to rewrite all the methods to get the hooks.


I guess the base is already some use, as it'll avoid another person having to re-code it.

The need for having our own updater will come again, just like it came, if we were satisfied with just stealing RSBot's hooks no one would've developed their own updater.

~RM