Where can I find the reflection api?
Printable View
Where can I find the reflection api?
Reflection V1: https://github.com/SRL/srl-reflection
Reflection V2: https://github.com/SRL/SRL-Reflection-2
I don't think there is an official API for 2007 reflection yet. Reflection support has been added though and you can manually create functions.
You can find hooks for all revisions on Javahacking.org. Currently at rev16: http://javahacking.org/forum/index.p...6/page__st__20
Thanks for the Info ! :)
Technically the API is exported from SMART and then used by the reflection include, thought that might be more detail than you are looking for. Methods are defined here https://github.com/BenLand100/SMART/...tRemote.h#L338
@J J is the challenge question for registering at javahacking.org a joke, by any chance?
Thanks for all the info !
I will look into this !
EDIT : I get an error while using the new smart 8.2 : [Error] C:\Simba\Includes\SRL-OSR/SRL/misc/SmartParams.Simba(229:203): Invalid number of parameters at line 228
Compiling failed.
How to fix this ?
I can't remember exactly what it was.. something about the main method in Java or something about reflection I believe? Atleast it was extremely easy to answer.
I checked out your Github link and somehow ended up at your wiki.
Pretty interesting read about SMART, also features some reflection info: http://blanddns.no-ip.org:81/index.php/SMART
SMART stats, never knew these existed: http://blanddns.no-ip.org:81/smart.php
Who knows what else BenLand has typed out somewhere.. :P
Extra parameter in SmartSpawnClient, empty string (unless you're using a SMART plugin), at the end. Check the 8.2 release thread for more info.
Keep trying and eventually it'll ask for the maximum value (which works as its supposed to). Someone over there goof'd on the minimum.
Now it asks for the minimum value of an unsigned 32 bit integer (sometimes), and the right answer is rejected. Quite annoying, really. And yea, apparantly no one ever clicks the image in my signature.. lol.
Not the only thing goof'd:
http://i.imgur.com/amOcRKW.png
Maybe I'm just unlucky then.
Thanks for the Advice Ben, but I'm have no more progress with maximum than I am minimum. No worries though, I suppose it's not worth the hassle just to view the current client revision hooks.
Edit:
Had to fix a couple of stupid typos. Ugh too much on my mind at the moment...
That's what I meant by having a brain ;)
Am confused here, are us noobs supposed to expect reflection official release/include anytime soon (next month?) and moreover would it actually include any useful hooks?.
Judging by some of the posts, the most essential hooks such as finding npcs/items/walking aren't going to be included, i really hope i misunderstood those posts and hope that is not the case..
Best course of action: expect nothing and figure out how to do it yourself. It's not hard. SMART's reflection API is here, along with a source of all of the hooks you could possibly want. But, if you wait, someone more motivated than you will get to it eventually and might share.
No one said anything about things not being included, so idk where that came from.
Thanks for the reply, cleared everything up for me. That's what am hoping for, am optimistic and patient.
And to be honest it would probably take someone like me several months or a year to even begin understanding reflection. Am not cut out for this stuff.. AM just a fanatic and an enthusiast;).
Thanks a lot for the reply Ben & Kevin. I appreciate it!
@J J and myself are making an updater for reflection, and @Awkwardsaw and myself are writing the actual include. Hold tight. :)
I know this is going to sound like I'm really stuck up and stuff but I don't really care. Whoever writes an include, be warned, I will probably rewrite it up to standards. I learned the long and annoying way that people like to take shortcuts when it comes to reflection and it ends up causing lots of problems with memory and cpu usage. Also, the old way we handled the smart object pointers was retarded and I still have a new framework saved on my hdd that I will probably implement when school starts again(gotta have something to do during class).
What exactly do you mean with "shortcuts"? Like for the NPC array there is another int array that holds the indices that are actuall used. So a shortcut would be to just loop through the npc array and check which entries are not null? Instead of using the indices found somewhere else.
EDIT: Also who are actually working on the include? Are there just random groups of people working or is there any official develop team..?
why not just help us with it in the first place? :) As far as I know we only have walking, player, and npc hooks
I have a git setup, and nkn was going to help with it. I just don't have access to most hooks, so it's not really worth it for me to but forth a bunch of effort just yet
This are plenty of hooks to make a solid core.. :P
Code:[ Actor ]
^ as implements com/bartoss/accessors/Actor
@ getAnimation() --> I as.ay * -1297342091
@ getQueueY() --> [I as.bs
@ getQueueX() --> [I as.ba
@ getOverheadText() --> Ljava/lang/String; as.am
@ isAnimating() --> Z as.h
@ getX() --> I as.z * -344898115
@ getY() --> I as.v * -331795885
@ getOrientation() --> I as.bf * -1984513445
@ getLoopCycle() --> I as.ah * -10790807
@ getInteractingIndex() --> I as.az * -695887265
@ getHealth() --> I as.au * -1737062295
@ getMaxHealth() --> I as.aw * 805425487
[ Boundary ]
^ dt implements com/bartoss/accessors/Boundary
@ getRenderable() --> Lcg; dt.j
@ getId() --> I dt.p * 1459198009
[ Cache ]
^ fu implements com/bartoss/accessors/Cache
@ getRemaining() --> I fu.d
@ getHashTable() --> Lfs; fu.k
@ getEmptyCacheableNode() --> Lfn; fu.y
@ getQueue() --> Lfz; fu.n
@ getSize() --> I fu.m
[ CacheableNode ]
^ fn implements com/bartoss/accessors/CacheableNode
@ getNext() --> Lfn; fn.cp
@ getPrevious() --> Lfn; fn.co
[ Canvas ]
^ bp implements com/bartoss/accessors/Canvas
@ getCanvas() --> Ljava/awt/Component; bp.m
[ ClassData ]
^ fp implements com/bartoss/accessors/ClassData
@ getFields() --> [Ljava/lang/reflect/Field; fp.s
@ getMethods() --> [Ljava/lang/reflect/Method; fp.b
@ getArgs() --> [[[B fp.m
[ Client ]
^ client implements com/bartoss/accessors/Client
@ getRegion() --> Lce; b.dw
@ getWidgets() --> [[Lfi; fi.m
@ getNpcs() --> [Lg; client.bs
@ getCollisionMaps() --> [Lfw; client.w
@ getPlayers() --> [Ld; client.ga
@ getTileBarriers() --> [[[I client.db
@ getFriends() --> [Lh; client.oo
@ getGroundItems() --> [[[Lfg; client.hv
@ getProjectiles() --> Lfg; client.he
@ getLocalPlayer() --> Ld; p.ho
@ getTileBytes() --> [[[B j.m
@ getCameraPitch() --> I da.fx * 39432791
@ getCameraZ() --> I fq.fb * -1357036389
@ getCameraX() --> I ca.fh * 1600266873
@ getCameraY() --> I l.ft * 1750131833
@ getCameraYaw() --> I dq.fw * -1896216087
@ getCompassAngle() --> I client.di * 1088432605
@ getMinimapOffset() --> I client.ej * -1054643523
@ getMinimapScale() --> I client.fv * -1381624831
@ getBaseX() --> I d.cy * 670470189
@ getBaseY() --> I r.cl * -1567957809
@ getWidgetNodes() --> Lfs; client.jg
@ getPlane() --> I n.hc * -550317133
@ getSkillLevelArray() --> [I client.ht
@ getSkillExpArray() --> [I client.hu
@ getRealSkillLevelArray() --> [I client.hb
@ getLoopCycle() --> I client.a * -374780141
@ getLoginIndex() --> I client.c * 1944893999
@ isMenuOpen() --> Z client.hw
@ getMenuX() --> I dq.hj * 519356221
@ getMenuY() --> I o.hg * 519356221
@ getMenuActions() --> [Ljava/lang/String; client.il
@ getMenuHeight() --> I ac.ie * 1822563045
@ getMenuWidth() --> I aa.hq * 1510992051
@ getMenuTargets() --> [Ljava/lang/String; client.ib
@ getMenuOptionCount() --> I client.iu * -19378345
@ getDestinationX() --> I client.ma * 1059776309
@ getDestinationY() --> I client.mq * -1519856356
@ getSettings() --> [I client.ka
@ getWidgetPositionsX() --> [I client.le
@ getWidgetPositionsY() --> [I client.lv
@ isItemSelected() --> Z client.iq
@ getSelectedItemName() --> Ljava/lang/String; client.it
@ getNpcIndices() --> [I client.bn
@ getPlayerIndices() --> [I client.lj
@ getValidWidgets() --> [Z fv.d
[ ClientShell ]
^ bs implements com/bartoss/accessors/ClientShell
@ getKillTime() --> J bs.ot
[ CollisionData ]
^ fw implements com/bartoss/accessors/CollisionData
@ getFlags() --> [[I fw.at
@ getOffsetX() --> I fw.av * -154974711
@ getOffsetY() --> I fw.ae * 1693595955
[ FileOnDisk ]
^ aj implements com/bartoss/accessors/FileOnDisk
@ getPosition() --> J aj.d
@ getLength() --> J aj.m
@ getRandomAccessFile() --> Ljava/io/RandomAccessFile; aj.y
[ FloorObject ]
^ dd implements com/bartoss/accessors/FloorObject
@ getRenderable() --> Lcg; dd.n
@ getId() --> I dd.m * 1167980405
[ FriendList ]
^ h implements com/bartoss/accessors/FriendList
[ GameObject ]
^ cc implements com/bartoss/accessors/GameObject
@ getRenderable() --> Lcg; cc.s
@ getId() --> I cc.r * 743640779
@ getOrientation() --> I cc.k * 1845366637
[ GameObjectComposite ]
^ ae implements com/bartoss/accessors/GameObjectComposite
@ getName() --> Ljava/lang/String; ae.i
@ getActions() --> [Ljava/lang/String; ae.aj
[ GraphicsBuffer ]
^ ca implements com/bartoss/accessors/GraphicsBuffer
@ getPixels() --> [I ca.d
@ getImage() --> Ljava/awt/Image; ca.s
[ HashTable ]
^ fs implements com/bartoss/accessors/HashTable
@ getBuckets() --> [Lfk; fs.m
@ getSize() --> I fs.y
[ Item ]
^ a implements com/bartoss/accessors/Item
@ getId() --> I a.y * -1007002963
@ getStackSize() --> I a.m * 1010389291
[ ItemComposite ]
^ ao implements com/bartoss/accessors/ItemComposite
@ getName() --> Ljava/lang/String; ao.p
@ getModelId() --> I ao.j * -808993659
@ isMembers() --> Z ao.h
@ getStackIds() --> [I ao.ab
@ getActions() --> [Ljava/lang/String; ao.g
@ getGroundActions() --> [Ljava/lang/String; ao.q
[ ItemLayer ]
^ cf implements com/bartoss/accessors/ItemLayer
[ LinkedList ]
^ fg implements com/bartoss/accessors/LinkedList
@ getHead() --> Lfk; fg.y
@ getCurrent() --> Lfk; fg.m
[ MinimapCurve ]
^ cr implements com/bartoss/accessors/MinimapCurve
@ getCurveY() --> [I cr.ae
@ getCurveX() --> [I cr.av
[ Model ]
^ dw implements com/bartoss/accessors/Model
@ getVerticesZ() --> [I dw.b
@ getVerticesX() --> [I dw.s
@ getVerticesY() --> [I dw.x
@ getIndicesX() --> [I dw.p
@ getIndicesY() --> [I dw.l
@ getIndicesZ() --> [I dw.i
[ Node ]
^ fk implements com/bartoss/accessors/Node
@ getNext() --> Lfk; fk.em
@ getPrevious() --> Lfk; fk.di
@ getId() --> J fk.dz
[ Npc ]
^ g implements com/bartoss/accessors/Npc
@ getComposite() --> Lav; g.y
[ NpcComposite ]
^ av implements com/bartoss/accessors/NpcComposite
@ getName() --> Ljava/lang/String; av.s
@ getActions() --> [Ljava/lang/String; av.v
@ getModelIds() --> [I av.av
[ Player ]
^ d implements com/bartoss/accessors/Player
@ getComposite() --> Lfx; d.m
@ getName() --> Ljava/lang/String; d.y
@ getModel() --> Ldw; d.r
@ getCombatLevel() --> I d.v * -331795885
@ getSkullIcon() --> I d.k * 680564603
@ getPrayerIcon() --> I d.d * -331014125
@ getTotalLevel() --> I d.s * -105857157
[ PlayerComposite ]
^ fx implements com/bartoss/accessors/PlayerComposite
@ isFemale() --> Z fx.d
@ getEquipment() --> [I fx.m
@ getNpcId() --> I fx.k * -1426665245
[ ProducingGraphicsBuffer ]
^ cb implements com/bartoss/accessors/ProducingGraphicsBuffer
@ getImageConsumer() --> Ljava/awt/image/ImageConsumer; cb.m
@ getColorModel() --> Ljava/awt/image/ColorModel; cb.y
[ Projectile ]
^ p implements com/bartoss/accessors/Projectile
@ getSpeedX() --> D p.f
@ getSpeedY() --> D p.a
@ getSpeedZ() --> D p.u
@ getScalarSpeed() --> D p.t
@ getHeight() --> D p.c
@ getComposite() --> Laq; p.h
@ isMoving() --> Z p.i
[ GenericComposite ]
^ aq implements com/bartoss/accessors/GenericComposite
@ isProjectileMoving() --> Z aq.i
[ Queue ]
^ fz implements com/bartoss/accessors/Queue
@ getHead() --> Lfn; fz.y
[ Region ]
^ ce implements com/bartoss/accessors/Region
@ getGameObjectCache() --> [Lcc; ce.ae
@ getTiles() --> [[[Lcn; ce.s
@ getGameObjects() --> [Lcc; ce.j
[ Renderable ]
^ cg implements com/bartoss/accessors/Renderable
@ getModelHeight() --> I cg.bv * 12333105
[ Socket ]
^ by implements com/bartoss/accessors/Socket
@ getOutputStream() --> Ljava/io/OutputStream; by.m
@ getSocket() --> Ljava/net/Socket; by.d
@ getInputStream() --> Ljava/io/InputStream; by.y
@ getBuffer() --> [B by.x
@ isDead() --> Z by.k
@ hasError() --> Z by.p
[ Stream ]
^ dp implements com/bartoss/accessors/Stream
@ getOffset() --> I dp.n * -1697142721
@ getPayload() --> [B dp.k
[ StringList ]
^ ei implements com/bartoss/accessors/StringList
[ Tile ]
^ cn implements com/bartoss/accessors/Tile
@ getWallDecoration() --> Lcy; cn.x
@ getBoundary() --> Ldt; cn.b
@ getFloorDecoration() --> Ldd; cn.j
@ getItemLayer() --> Lcf; cn.p
@ getGameObjects() --> [Lcc; cn.i
@ getX() --> I cn.m * 424561357
@ getY() --> I cn.d * -2002909643
@ getPlane() --> I cn.y * 129611707
[ WallObject ]
^ cy implements com/bartoss/accessors/WallObject
[ Widget ]
^ fi implements com/bartoss/accessors/Widget
@ getActions() --> [Ljava/lang/String; fi.bs
@ getSlotStackSizes() --> [I fi.dm
@ getName() --> Ljava/lang/String; fi.bc
@ getId() --> I fi.o * 1359690359
@ getHeight() --> I fi.w * 258121965
@ getX() --> I fi.af * 329286141
@ getTextureId() --> I fi.ac * 1751880407
@ getY() --> I fi.y * -438126995
@ getParentId() --> I fi.h * 207084995
@ getWidth() --> I fi.v * -573812283
@ getOpcodes() --> [[I fi.dt
@ getBorderThickness() --> I fi.ao * -65377649
@ getParent() --> Lfi; fi.ba
@ getChildren() --> [Lfi; fi.dg
@ getSlotContentIds() --> [I fi.db
@ getText() --> Ljava/lang/String; fi.bq
@ getRelativeX() --> I fi.u * 99091979
@ getModelId() --> I fi.af * 329286141
@ getRelativeY() --> I fi.x * -559211941
@ isHidden() --> Z fi.aa
@ getStaticPosition() --> I fi.dp * -12310965
@ getTooltip() --> Ljava/lang/String; fi.da
@ getIndex() --> I fi.c * 920826089
@ getScrollX() --> I fi.g * 652002735
@ getScrollY() --> I fi.e * -327656757
[ WidgetNode ]
^ k implements com/bartoss/accessors/WidgetNode
@ getId() --> I k.y
That's great, nice work. IMO what we have now (to my knowledge we have full Player & NPC hooks) is more than enough, but no body said it was up to me. Player-related hooks are very useful to have, while NPC and interface hooks would allow us to write random-solvers for what we're currently missing. I say let's go with what we have now and over time add to it should we feel the need to do so.
They are just ripped from Javahacking. But they are correct. Is it more than enough? I think reflection might aswell be expanded to cover everything. Scripters can choose whether they want to use reflection or not. And if they want to use it, they can choose what functions to use :P NPC and interface hooks will help for random solvers indeed. Walking does help aswell. Animation for dynamic waiting, etc.
Change the format if you like.. Don't exactly care or give a crap as long as it works.. I finally hooked NPC & Player array sizes as well as their indices.. Well.. I actually found it in the client manually. I still gotta write the pattern for it.
It isn't much but its all I got atm so it'll have to do until others decide to contribute and share when they have free time.. If they want to at all.. In fact, I'm not even sure my updater patterns are stable yet since I don't have older clients to test it on so next client update might break a lot of them :l Hopefully not.
If you know anything about reflection/updaters/injection, join mormanman's channel #SRLReflection on IRC.
Simba Code:const
ClientRevision = 16;
HookRevision = 1;
{* Static Hooks *}
Hook_Menu_Open = 'client.hw';
Hook_Local_Player = 'p.ho';
Hook_Skill_Levels = 'client.ht';
Hook_Skill_Exp = 'client.hu';
Hook_Camera_X = 'ca.fh';
Hook_Camera_Y = 'l.ft';
Hook_Camera_Z = 'fq.fb';
Hook_Camera_Yaw = 'dq.fw';
Hook_Camera_Pitch = 'da.fx';
Hook_Base_X = 'd.cy';
Hook_Base_Y = 'r.cl';
Hook_Destination_X = 'client.ma';
Hook_Destination_Y = 'client.mq';
Hook_Item_Selected_Name = 'client.it';
Hook_Item_IsSelected = 'client.iq';
Hook_Player_Array = 'client.ga';
Hook_Player_Array_Size = 'client.gu';
Hook_Player_Array_Indices = 'client.go';
Hook_NPC_Array = 'client.bs';
Hook_NPC_Array_Size = 'client.ba';
Hook_NPC_Array_Indices = 'client.bn';
{* Actor *}
Hook_Actor_Class = 'as';
Hook_Actor_SpokenText = 'am';
Hook_Actor_WalkingQueueX = 'bs';
Hook_Actor_WalkingQueueY = 'ba';
Hook_Actor_Animation = 'ay';
Hook_Actor_Orientation = 'bf';
Hook_Actor_Interacting = 'az';
Hook_Actor_GridX = 'z';
Hook_Actor_GridY = 'v';
{* Player *}
Hook_Player_Class = 'd';
Hook_Player_Name = 'y';
Hook_Player_CombatLevel = 'n';
Hook_Player_Def = 'm';
{* Player Definition *}
Hook_PlayerDef_Class = 'fx';
Hook_PlayerDef_Equipment = 'l';
{* NPC *}
Hook_NPC_Class = 'g';
Hook_NPC_Def = 'y';
{* NPC Definition *}
Hook_NPCDef_Class = 'av';
Hook_NPCDef_Name = 's';
Hook_NPCDef_ID = 'n';
Hook_NPCDef_Level = 'h';
Hook_NPCDef_Actions = 'v';
{* Node *}
Hook_Node_Class = 'fk';
Hook_Node_UID = 'dz';
Hook_Node_Next = 'em';
Hook_Node_Prev = 'di';
{* Stream *}
Hook_Stream_Class = 'dp';
{* Animable *}
Hook_Animable_Class = 'cg';
{* Cacheable Node *}
Hook_Cacheable_Node_Class = 'fn';
{* Multipliers *}
Multiplier_Player_Array_Size = -830762073;
Multiplier_NPC_Array_Size = -2108028599;
Multiplier_Camera_X = 1600266873;
Multiplier_Camera_Y = 1750131833;
Multiplier_Camera_Z = -1357036389;
Multiplier_Camera_Yaw = -1896216087;
Multiplier_Camera_Pitch = 39432791;
Multiplier_Base_X = 670470189;
Multiplier_Base_Y = -1567957809;
Multiplier_Destination_X = 1059776309;
Multiplier_Destination_Y = 3915003207;
Multiplier_Actor_Animation = -1297342091;
Multiplier_Actor_Orientation = 1172788427;
Multiplier_Actor_Interacting = -695887265;
Multiplier_Actor_GridX = -344898115;
Multiplier_Actor_GridY = -331795885;
Multiplier_Player_CombatLevel = -74898749;
Multiplier_NPCDef_ID = -1972562829;
Multiplier_NPCDef_Level = 610526779;
Test functions:
Simba Code:{$DEFINE SmartReflectionWrappers}
{$include_once GLX/Misc/OldSchoolSmart.Simba}
{$include_once GLX/Misc/Hooks.Simba}
var
Smart: TSmart;
type TPlayer = record
Name: String;
Level: Integer;
Tile: TPoint;
Animation: Integer;
WalkQueueX: Integer;
WalkQueueY: Integer;
Orientation: Integer;
OrientationStr: String;
Equipment: Array of Integer;
end;
type TNPC = record
ID: Integer;
Name: String;
Index: Integer;
Level: Integer;
Tile: TPoint;
Animation: Integer;
WalkQueueX: Integer;
WalkQueueY: Integer;
Orientation: Integer;
OrientationStr: String;
Actions: Array of String;
end;
function R_IsMenuOpen: Boolean;
begin
Result := Smart.GetFieldBoolean(0, Hook_Menu_Open);
end;
function R_GetName: String;
var
Player: Integer;
Begin
Player := Smart.GetFieldObject(0, Hook_Local_Player);
Result := Smart.GetFieldString(Player, Hook_Player_Name);
Smart.FreeObject(Player);
End;
function R_GetAnimation: Integer;
var
Me: Integer;
Begin
Me := Smart.GetFieldObject(0, Hook_Local_Player);
Result := Smart.GetFieldInt(Me, Hook_Actor_Animation) * Multiplier_Actor_Animation;
Smart.FreeObject(Me);
End;
function R_IsAnimating: Boolean;
Begin
Result := R_GetAnimation > -1;
End;
function R_GetSkillLevel(SkillConst: Integer): Integer;
Begin
Result := Smart.GetFieldArrayInt(0, Hook_Skill_Levels, SkillConst);
End;
function R_GetSkillExp(SkillConst: Integer): Integer;
Begin
Result := Smart.GetFieldArrayInt(0, Hook_Skill_Exp, SkillConst);
End;
function R_GetCombatLevel: Integer;
var
Me: Integer;
Begin
Me := Smart.GetFieldObject(0, Hook_Local_Player);
Result := Smart.GetFieldInt(Me, Hook_Player_CombatLevel) * Multiplier_Player_CombatLevel;
Smart.FreeObject(Me);
End;
function R_GetCameraX: Integer;
Begin
Result := Smart.GetFieldInt(0, Hook_Camera_X) * Multiplier_Camera_X;
End;
function R_GetCameraY: Integer;
Begin
Result := Smart.GetFieldInt(0, Hook_Camera_Y) * Multiplier_Camera_Y;
End;
function R_GetCameraZ: Integer;
Begin
Result := Smart.GetFieldInt(0, Hook_Camera_Z) * Multiplier_Camera_Z;
End;
function R_GetCameraYaw: Integer;
Begin
Result := Smart.GetFieldInt(0, Hook_Camera_Yaw) * Multiplier_Camera_Yaw;
End;
function R_GetCameraPitch: Integer;
Begin
Result := Smart.GetFieldInt(0, Hook_Camera_Pitch) * Multiplier_Camera_Pitch;
End;
function R_GetCompassAngle: Integer;
Begin
Result := round(R_GetCameraYaw / 5.67777);
End;
function R_GetDirection: Integer;
var
Me: Integer;
Begin
Me := Smart.GetFieldObject(0, Hook_Local_Player);
Result := Smart.GetFieldInt(Me, Hook_Actor_Orientation) * Multiplier_Actor_Orientation;
Smart.FreeObject(Me);
End;
function R_GetTileGlobal: TPoint;
var
Me: Integer;
Begin
Me := Smart.GetFieldObject(0, Hook_Local_Player);
Result.X := (Smart.GetFieldInt(0, Hook_Base_X) * Multiplier_Base_X) + (Smart.GetFieldInt(Me, Hook_Actor_GridX) * Multiplier_Actor_GridX) div 128;
Result.Y := (Smart.GetFieldInt(0, Hook_Base_Y) * Multiplier_Base_Y) - (Smart.GetFieldInt(Me, Hook_Actor_GridY) * Multiplier_Actor_GridY) div 128;
Smart.FreeObject(Me);
End;
function R_GetTileLocal: TPoint;
var
Me: Integer;
Begin
Me := Smart.GetFieldObject(0, Hook_Local_Player);
Result.X := ((Smart.GetFieldInt(Me, Hook_Actor_GridX) * Multiplier_Actor_GridX) - (Smart.GetFieldInt(0, Hook_Base_X) * Multiplier_Base_X)) div 128; //shr(7);
Result.Y := ((Smart.GetFieldInt(Me, Hook_Actor_GridY) * Multiplier_Actor_GridY) - (Smart.GetFieldInt(0, Hook_Base_Y) * Multiplier_Base_Y)) div 128;
Smart.FreeObject(Me);
End;
function R_GetDirectionString(Orientation: Integer): String; //TODO: Fix this for angles inbetween the below.. NE, SE, NW, SW, etc..
var
Dir: Integer;
Begin
Result := 'NIL';
case Orientation of
0: Result := 'S';
512: Result := 'W';
1024: Result := 'N';
1536: Result := 'E';
end;
End;
Function R_GetDestination: TPoint;
Begin
Result.X := (Smart.GetFieldInt(0, Hook_Base_X) * Multiplier_Base_X) + (Smart.GetFieldInt(0, Hook_Destination_X) * Multiplier_Destination_X);
Result.Y := (Smart.GetFieldInt(0, Hook_Base_X) * Multiplier_Base_Y) - (Smart.GetFieldInt(0, Hook_Destination_Y) * Multiplier_Destination_Y);
End;
function R_TileToMM(tile: TPoint): TPoint;
var
angle, x, y: extended;
temp: TPoint;
Begin
angle:= -Radians(R_GetCompassAngle);
temp := R_GetTileGlobal;
x:= (tile.x - temp.x) * 4 - 2;
y:= (temp.y - tile.y) * 4 - 2;
result.x:= round(x*cos(angle) + y*sin(angle)) + 645;
result.y:= round(y*cos(angle) - x*sin(angle)) + 85;
End;
function R_GetSelectedItemName: String;
Begin
Result := Smart.GetFieldString(0, Hook_Item_Selected_Name)
End;
function R_IsItemSelected: Boolean;
Begin
Result := Smart.GetFieldBoolean(0, Hook_Item_IsSelected);
End;
function R_GetMySpokenText: String;
var
Me: Integer;
Begin
Me := Smart.GetFieldObject(0, Hook_Local_Player);
Result := Smart.GetFieldString(Me, Hook_Actor_SpokenText);
Smart.FreeObject(Me);
End;
function R_GetPlayerEquipment(PlayerDef: Integer): TIntegerArray;
var
i, c: integer;
temp: integer;
begin
SetLength(Result, 11);
c := 0;
for i := 0 to 10 do
begin
temp := Smart.GetFieldArrayInt(PlayerDef, Hook_PlayerDef_Equipment, i);
if((temp <> -1) and (temp <= 11))then
begin
Result[c] := temp;
inc(c);
end;
end;
SetLength(Result, c);
End;
function R_GetPlayers: Array of TPlayer;
var
Player, I, J, DEF, Size, Index: Integer;
Begin
Size := Smart.GetFieldInt(0, Hook_Player_Array_Size) * Multiplier_Player_Array_Size;
SetLength(Result, Size);
For I := 0 To Size - 1 Do
begin
Index := Smart.GetFieldArrayInt(0, Hook_Player_Array_Indices, I);
Player := Smart.GetFieldArrayObject(0, Hook_Player_Array, Index);
If (Player <> 0) Then
Begin
DEF := Smart.GetFieldObject(Player, Hook_Player_Def);
Result[J].Name := Smart.GetFieldString(Player, Hook_Player_Name);
Result[J].Level := Smart.GetFieldInt(Player,Hook_Player_CombatLevel) * Multiplier_Player_CombatLevel;
Result[J].Animation := Smart.GetFieldInt(Player, Hook_Actor_Animation) * Multiplier_Actor_Animation;
Result[J].Orientation := Smart.GetFieldInt(Player, Hook_Actor_Orientation) * Multiplier_Actor_Orientation;
Result[J].OrientationStr := R_GetDirectionString(Result[J].Orientation);
Result[J].WalkQueueX := Smart.GetFieldArrayInt(Player, Hook_Actor_WalkingQueueX, 0);
Result[J].WalkQueueY := Smart.GetFieldArrayInt(Player, Hook_Actor_WalkingQueueY, 0);
Result[J].Tile.X := (Smart.GetFieldInt(0, Hook_Base_X) * Multiplier_Base_X) + (Smart.GetFieldInt(Player, Hook_Actor_GridX) * Multiplier_Actor_GridX) div 128;
Result[J].Tile.Y := (Smart.GetFieldInt(0, Hook_Base_Y) * Multiplier_Base_Y) - (Smart.GetFieldInt(Player, Hook_Actor_GridY) * Multiplier_Actor_GridY) div 128;
Result[J].Equipment := R_GetPlayerEquipment(DEF);
Smart.FreeObject(DEF);
Inc(J);
End;
Smart.FreeObject(Player);
end;
SetLength(Result, J);
End;
function R_GetNPCActionArray(NPCDef: integer): TStringArray;
var
i, c: integer;
temp: String;
begin
SetLength(Result, 11);
c := 0;
for i := 0 to 10 do
begin
temp := Smart.GetFieldArrayString(NPCDef, Hook_NPCDef_Actions, i);
if(temp <> '')then
begin
Result[c] := temp;
inc(c);
end;
end;
SetLength(Result, c);
end;
function R_GetNPCs: Array of TNPC;
var
Name: String;
I, J, NPC, DEF, Size, Index: Integer;
Begin
J := 0;
Size := Smart.GetFieldInt(0, Hook_NPC_Array_Size) * Multiplier_NPC_Array_Size;
SetLength(Result, Size);
For I := 0 To Size - 1 do
begin
Index := Smart.GetFieldArrayInt(0, Hook_NPC_Array_Indices, I);
NPC := Smart.GetFieldArrayObject(0, Hook_NPC_Array, Index);
if (NPC <> 0) then
begin
DEF := Smart.GetFieldObject(NPC, Hook_NPC_Def);
Name := Smart.GetFieldString(DEF, Hook_NPCDef_Name);
If (Name <> 'null') then
begin
Result[J].Name := Name;
Result[J].ID := Smart.GetFieldInt(DEF, Hook_NPCDef_ID) * Multiplier_NPCDef_ID;
Result[J].Level := Smart.GetFieldInt(DEF, Hook_NPCDef_Level) * Multiplier_NPCDef_Level;
Result[J].Index := Smart.GetFieldInt(NPC, Hook_Actor_Interacting) * Multiplier_Actor_Interacting;
Result[J].Animation := Smart.GetFieldInt(NPC, Hook_Actor_Animation) * Multiplier_Actor_Animation;
Result[J].Orientation := Smart.GetFieldInt(NPC, Hook_Actor_Orientation) * Multiplier_Actor_Orientation;
Result[J].OrientationStr := R_GetDirectionString(Result[J].Orientation);
Result[J].WalkQueueX := Smart.GetFieldArrayInt(NPC, Hook_Actor_WalkingQueueX, 0);
Result[J].WalkQueueY := Smart.GetFieldArrayInt(NPC, Hook_Actor_WalkingQueueY, 0);
Result[J].Tile.X := (Smart.GetFieldInt(0, Hook_Base_X) * Multiplier_Base_X) + (Smart.GetFieldInt(NPC, Hook_Actor_GridX) * Multiplier_Actor_GridX) div 128;
Result[J].Tile.Y := (Smart.GetFieldInt(0, Hook_Base_X) * Multiplier_Base_Y) - (Smart.GetFieldInt(NPC, Hook_Actor_GridY) * Multiplier_Actor_GridY) div 128;
Result[J].Actions := R_GetNPCActionArray(DEF);
Inc(J);
end;
Smart.FreeObject(DEF);
end;
Smart.FreeObject(NPC);
end;
SetLength(Result, J);
End;
//Loop Cycle: client.a * -374780141 //Might be wrong.
//Player Loop Cycle: ah * -10790807 //Might be wrong.
var
I: Integer;
Players: Array of TNPC;
begin
ClearDebug;
Smart.Create(765, 503);
Players := R_GetNPCs;
For I := 0 To High(Players) do
writeln(Players[I]);
TerminateScript();
end.
Simba Code:function R_IsPlayerInCombat: boolean;
var
MyPlayer, LoopCycle, CombatEndCycle : integer;
begin
if (not loggedin) then
begin
result := false;
end
else
begin
MyPlayer := SmartGetFieldObject(0, 'p.ho');
CombatEndCycle := SmartGetFieldInt(myplayer, 'as.ah') * -10790807;
LoopCycle := SmartGetFieldInt(0, 'client.a') -374780141;
if (LoopCycle < CombatEndCycle) then
Result := true;
SmartFreeObject(MyPlayer);
end;
end;
might be wrong(idk) but maybe:
//Loop Cycle: client.a * -374780141 //Might be wrong.
//Player Loop Cycle: ah * -10790807 //Might be wrong.
is wrong, it always returns something random. - i know it MIGHT be wrong but if this code is correctly it doesnt work (got this from srl reflection 1)
since the hooks are updated/changed, i tried to fix them.
i didnt made these functions, i only changed the hooks!
Code:function R_GetSkillExp(SkillConst: Integer): Integer;
begin
Result := SmartGetFieldArrayInt(0, 'client.hl', SkillConst);
end;
function R_GetTileGlobal: TPoint;
var
Me: Integer;
Begin
Me := SmartGetFieldObject(0, 'de.hn');
Result.X := (SmartGetFieldInt(0, 'v.cz') * -667048033) + (SmartGetFieldInt(Me, 'j') * -859472679) div 128;
Result.Y := (SmartGetFieldInt(0, 'cx.ct') * 2033541983) + (SmartGetFieldInt(Me, 'h') * -687896143) div 128;
SmartFreeObject(Me);
End;
function R_GetAnimation: Integer;
var
Me: Integer;
begin
Me := SmartGetFieldObject(0, 'de.hn');
Result := SmartGetFieldInt(me, 'az') * -746279083;
SmartFreeObject(Me);
end;
function R_IsAnimating: Boolean;
begin
Result := R_GetAnimation > - 1;
end;
function WaitForAnimation(timeout: integer): boolean;
var
t: integer;
begin
Result := false;
MarkTime(t);
while R_GetAnimation = - 1 do
begin
if (TimeFromMark(t) >= timeout) then
Exit;
end;
Result := true;
end;
function R_TileToMM(tile: TPoint): TPoint;
var
yaw: Integer;
angle, x, y: extended;
temp: TPoint;
begin
yaw := SmartGetFieldInt(0, 'cp.fn') * -1609550035;
angle := - Radians(round(yaw / 5.67777));
temp := R_GetTileGlobal;
x := (tile.x - temp.x) * 4 - 2;
y := (temp.y - tile.y) * 4 - 2;
result.x := round(x * cos(angle) + y * sin(angle)) + 645;
result.y := round(y * cos(angle) - x * sin(angle)) + 85;
end;
function walkPath(Path: TPointArray): boolean;
var
I, H, T, D, Fails, lP: integer;
P, MM, MMF: TPoint;
begin
ColorToleranceSpeed(1);
H := High(Path);
T := GetSystemTime + 10000 + Random(2000);
Fails := 0;
lP := 0;
while (not Result) and (GetSystemTime < T) and (Fails < 5) do
begin
if (not LoggedIn()) then
Exit;
P := R_GetTileGlobal;
for I := H downto 0 do
begin
if ((I - lP) > 3) then
Continue
else
lP := I;
MM := R_TileToMM(Path[I]);
if MM = MMF then
Inc(Fails);
D := Distance(MM.X, MM.Y, MMCX, MMCY);
if (D < 10) then
break
else if (D < 70) then
begin
AL_MissMouse(MM, 0, 0);
AL_FastClick(mouse_left);
WaitFunc(@ AL_playerWalking, 10, 500);
MMF := MM;
if (I = H) then
FFlag(5)
else
FFlag(25);
T := getSystemTime + 7000 + Random(1000);
Break;
end;
end;
Result := (I = H);
end;
FFlag(5);
end;
function BlindWalk(P: TPoint): Boolean;
var
Tries: Integer;
M: TPoint;
ctrlPoints: TPointArray;
begin
repeat
if (not LoggedIn()) then
Exit;
M := R_GetTileGlobal;
if (M.X = - 1) then
Continue;
if (Length(ctrlPoints) = 0) then
ctrlPoints := TPABetweenPoints(M, P, 5 + Random(2), 2);
Inc(Tries);
if (Tries > 20) then
Exit;
Result := walkPath(ctrlPoints);
until (Result);
end;
function R_inPolygon(Area: TPointArray): Boolean;
var
xnew, ynew, xold, yold, x1, y1, x2, y2: Cardinal;
i, numpoints, inside, X, Y: Integer;
begin
numpoints := Length(Area);
X := R_GetTileGlobal.x Y := R_GetTileGlobal.y if (numpoints < 3) then
Exit;
xold := Area[numpoints - 1].X;
yold := Area[numpoints - 1].Y;
for i := 0 to (numpoints - 1) do
begin
xnew := Area[i].X;
ynew := Area[i].Y;
if (xnew > xold) then
begin
x1 := xold;
x2 := xnew;
y1 := yold;
y2 := ynew;
end
else
begin
x1 := xnew;
x2 := xold;
y1 := ynew;
y2 := yold;
end;
if (((xnew < X) = (X <= xold)) and ((Y - y1) * (x2 - x1) < (y2 - y1) * (X - x1))) then
inside := not inside;
xold := xnew;
yold := ynew;
end;
Result := inside <> 0;
end;