Ahh in that case, I got something working for SMART.. I tested it.. Works using signatures and would allow you to call functions based solely on strings (so Simba can send them to SMART's socket).. IE:
Simba Code:smartPushMethodParam(0);
smartInvokeMethod('y.z', 'I'); //auto pop's the params.
smartPushMethodParam(50);
smartPushMethodParam(200);
smartPushMethodParam('HELLO');
smartPushMethodParam(true);
smartInvokeMethod('eos.Main.test', 'IILjava/lang/String;Z');
Not sure if I like the above.. it does seem annoying the way parameters would be sent to SMART but I can't think of any other way at this moment..
The java code works already though:
Java Code:/**
*
* @author Brandon
*/
public class Main {
static final HashMap<String, Class> map = new HashMap<>();
static {
map.put("V", void.class);
map.put("I", int.class);
map.put("J", long.class);
map.put("F", float.class);
map.put("D", double.class);
map.put("Z", boolean.class);
map.put("C", char.class);
map.put("B", byte.class);
map.put("S", short.class);
map.put(".V", void.class);
map.put(".I", int.class);
map.put(".J", long.class);
map.put(".F", float.class);
map.put(".D", double.class);
map.put(".Z", boolean.class);
map.put(".C", char.class);
map.put(".B", byte.class);
map.put(".S", short.class);
map.put("[I", int[].class);
map.put("[J", long[].class);
map.put("[F", float[].class);
map.put("[D", double[].class);
map.put("[Z", boolean[].class);
map.put("[C", char[].class);
map.put("[B", byte[].class);
map.put("[S", short[].class);
map.put("[[I", int[][].class);
map.put("[[J", long[][].class);
map.put("[[F", float[][].class);
map.put("[[D", double[][].class);
map.put("[[Z", boolean[][].class);
map.put("[[C", char[][].class);
map.put("[[B", byte[][].class);
map.put("[[S", short[][].class);
map.put("[[[I", int[][][].class);
map.put("[[[J", long[][][].class);
map.put("[[[F", float[][][].class);
map.put("[[[D", double[][][].class);
map.put("[[[Z", boolean[][][].class);
map.put("[[[C", char[][][].class);
map.put("[[[B", byte[][][].class);
map.put("[[[S", short[][][].class);
}
public Class[] buildClassParameters(ClassLoader loader, String params) throws ClassNotFoundException {
if (params == null) {
return null;
}
final String regex = "(L(?!L)[A-z/]+;)|(\\[\\[\\[[A-z])|(\\[\\[[A-z])|(\\[[A-z])|(\\.[A-z])|([A-z])";
Matcher m = Pattern.compile(regex).matcher(params);
ArrayList<Class> result = new ArrayList<>();
while(m.find()) {
if (map.containsKey(m.group(0))) {
result.add(map.get(m.group(0)));
} else {
result.add(Class.forName(m.group(0).replaceAll("^L|;", "").replace('/', '.'), false, loader));
}
}
if (!result.isEmpty()) {
return result.toArray((Class[])java.lang.reflect.Array.newInstance(Class.class, result.size()));
}
return null;
}
public Method findMethodFromPath(ClassLoader loader, String path, String signature) throws Exception {
int idx = path.lastIndexOf(".");
String[] parts = new String[] {path.substring(0, idx), path.substring(idx + 1)}; //allows you to invoke even SMART's internal functions..
Class cls = loader.loadClass(parts[0]);
if (cls != null) {
Method m = cls.getDeclaredMethod(parts[1], buildClassParameters(loader, signature));
m.setAccessible(true);
return m;
}
return null;
}
public Object invokeMethodWithPath(ClassLoader loader, String path, String signature, Object[] params) throws Exception {
return findMethodFromPath(loader, path, signature).invoke(params);
}
public void test(String[] args) {
//...
//...
//...
ClassLoader loader = applet.getClassLoader();
Object me = getMe(loader); //get my player.. client.hj
Method m = findMethodFromPath(loader, "y.a", null); //find "y.a" method.
Method m2 = findMethodFromPath(loader, "y.z", "I"); //find "y.z" method. This method is "protected"!
Method m3 = findMethodFromPath(loader, "y.n", null); //find "y.n" method.
System.out.println(getModelVertexCount(loader, m.invoke(me))); //prints 628
System.out.println(getModelVertexCount(loader, m2.invoke(me))); //prints 628
System.out.println(getModelVertexCount(loader, m3.invoke(me))); //prints 628
Method m = findMethodFromPath(loader, "eos.Main.testSignatureParser", "IILjava/lang/String;Z"); //find my own class method
System.out.println(m.invoke(null, 50, 200, "HELLO", true)); //prints "50200HELLOtrue".
}
public static String testSignatureParser(int A, int B, String C, boolean D) {
return new StringBuilder().append(A).append(B).append(C).append(D).toString();
}
public static void main(String[] args) {
new Main().test(args);
}
}
Last edited by Brandon; 07-05-2014 at 01:52 PM.
I am Ggzz..
Hackintosher
Looks good. So this can be used for NPC? Or are the methods player local?
I'm almost 100 percent positive models can be grabbed without invoking the in class methods.
Yeh @tls, they can. You can grab the static model from the cache, but you then have to manually rotate them and animate them which would take an age using simba's speed :/
I think its possible to have banking reflection done, do you think you guys can do it? I'd do it myself but i have no experience in developing reflection with hooks, widgets, multipliers etc.
Also when a Random NPC comes on screen, the whole script stops to a halt and never runs again until you force restart it. idk if its still lingering but it was yesterday..EDIT: NVM its fixed...
Also one more thing, is it possible to do equipment reflection? To see if you have the axe wielded, etc.
However frogSolver is giving a math error....
Shows SRL-OSR/SRL/Core/math.simbaCode:[Reflection Anti-Randoms] Frog random detected! Solving... Math error at line 1512 The following DTMs were not freed: [SRL - Lamp bitmap, SRL - Book of Knowledge, 2, 3] The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Minimap Mask bitmap, 3, 4]
I did some inventory functions for hoodz, I think they are in his fighter, alternatively they might be in the reflection include, if not you can find some inventory functions in F_AntiRandoms.simba. Getting item column and row in the bank is also quite easy.
Simba Code:function R_BankScreen: Boolean;
begin
Result := (Pos('Bank of Rune', R_GetWidgetText(R_GetWidget(12, 2))) > 0);
end;
type
TInventoryItem = record
ID, Quantity, Slot: Integer;
end;
TInventoryItemArray = Array of TInventoryItem;
function R_GetInventoryItems: TInventoryItemArray;
var
_Inventory, _InventorySlot, _ItemID, _ItemQuantity: Integer;
begin
_Inventory := R_GetWidget(149, 0);
SetLength(Result, 28);
for _InventorySlot := 0 to 27 do begin
_ItemID := SmartGetFieldArrayInt(SmartCurrentTarget, _Inventory, Widget_getItems, _InventorySlot);
if (_ItemID > 0) then begin
_ItemQuantity := SmartGetFieldArrayInt(SmartCurrentTarget, _Inventory, Widget_getStackSizes, _InventorySlot);
with Result[_InventorySlot] do begin
ID := _ItemID;
Quantity := _ItemQuantity;
Slot := _InventorySlot + 1;
end;
end;
end;
SmartFreeObject(SmartCurrentTarget, _Inventory);
end;
There are some I found.
There used to be something meaningful here.
Equipment is easy, a wrapper class is made for the widget much like you would do with bank or inventory. The wrapper class then holds the functions related to it.
Banking is very easy as well, as long as widgets work, then the only slightly hard bit of banking is the scrolling however, that can be done easily by pressing the up and down arrows on the scroll bar (not as efficient as clicking on the scroll bar but I could never get that perfect :/)
This was fixed yesterday.. Replace the whole include https://code.google.com/p/osrreflection/source/browse/ and post again if you're still having a problem.
@Brandon
Here are the methods you can test if you want to test your invoker:
And some hooks to test the received objects:Code:Methods ---> (II)Lau; 'getItemComposite' returns 'aj.z' [STATIC] ---> (IB)Lan; 'getNPCComposite' returns 'u.z' [STATIC] ---> (II)Lav; 'getObjectComposite' returns 'cs.z' [STATIC]
The first parameter is the ID. The second parameter is a dummy so just pass 0 to itSimba Code:{* NPCDefinition - 4 Hooks *}
NPCDefinition = 'an';
NPCDefinition_Actions = 'v';
NPCDefinition_ID = 'r';
NPCDefinition_ID_Multiplier = -563242523;
NPCDefinition_Level = 'p';
NPCDefinition_Level_Multiplier = -545532659;
NPCDefinition_Name = 'e';
{* ObjectDefinition - 2 Hooks *}
ObjectDefinition = 'av';
ObjectDefinition_Actions = 'af';
ObjectDefinition_Name = 'i';
{* ItemDefinition - 9 Hooks *}
ItemDefinition = 'au';
ItemDefinition_GroundActions = 'l';
ItemDefinition_ModelColours = 'f';
ItemDefinition_ModelSizeX = 'ay';
ItemDefinition_ModelSizeX_Multiplier = 836976809;
ItemDefinition_ModelSizeY = 'am';
ItemDefinition_ModelSizeY_Multiplier = 1785188107;
ItemDefinition_ModelSizeZ = 'az';
ItemDefinition_ModelSizeZ_Multiplier = 1752736447;
ItemDefinition_Name = 'a';
ItemDefinition_NewModelColours = 'o';
ItemDefinition_InventoryActions = 'w';
ItemDefinition_isMembers = 'p';
I'm getting the
Exception in Script: Operator expected at line 446, column 3 in file "C:\Simba\Includes\SRL-OSR\SRL\Reflection\Core\Tiles.simba"
error, I downloaded the latest version
Simba Code:function R_BankScreen : boolean;
begin
result := R_GetWidgetText(R_GetWidget(12, 15)) = 'Swap';
end;
is a better way of doing it, just because if a certain tab is open, "Bank of runescape" doesn't show up
That's the problemAs far as I know, we can't read the names of the widgets, which would help out a ton with banking/ equipment. We also need to be able to get the components of a child. Of couse if I'm missing something, please point me to the right direction
Last edited by Awkwardsaw; 07-06-2014 at 10:31 PM.
<TViYH> i had a dream about you again awkwardsaw
Malachi 2:3
Names are a faff. I have them hooked but it took a god-damn age. Using actions to identify widgets is the best method in my opinion =)
For equipment, there is a separate widget for each slot. This is the same for bank =)
bankViewport = Widgets.getWidgets()[12][10];
slotWidget = viewport.getComponent(slotIndex);
Item bankItem = new Item(client, client.getItemDef(slotWidget.getItemID()), slotWidget.getItemID(), slotWidget.getItemStack());
That is my Java code for getting an item within a bank.
Simba Code:Procedure Money;
var
i:integer;
begin
i:= (R_InventoryContainsCount([880, 333]));
Writeln('Approx. Money: ' + inttostr(i) + ' K');
end;
This isn't working for some reason...Approx. Money: 0 K
Simba Code:function R_InventoryContainsCount(IDs: TIntegerArray): Integer;
var
I: Integer;
_Items: TInventoryItemArray;
begin
_Items := R_GetInventoryItems;
for I := 0 to High(_items) do begin
if (InIntArray(IDs, _Items[I].ID)) then begin
inc(result);
end;
end;
end;
It counts the items found in inventory, so you are using it wrong to begin with.
You need to useto do what you want.Simba Code:function R_GetInventoryItems: TInventoryItemArray;
There used to be something meaningful here.
well, this isn't working either...
Simba Code:Procedure Money;
var
InvItems:TInventoryItemArray;
i,j:integer;
begin
InvItems := R_GetInventoryItems;
if (length(InvItems) = 0)then
exit;
for i:= 0 to high(InvItems) do
if(InvItems[i].ID = 890)then
J := ((InvItems[i].Quantity) * 135);
WriteLn('Approx. Money: ' + inttostr(j) + ' K');
end;
well, this isn't working either...
Simba Code:Procedure Money;
var
InvItems:TInventoryItemArray;
i,j:integer;
begin
InvItems := R_GetInventoryItems;
if (length(InvItems) = 0)then
exit;
for i:= 0 to high(InvItems) do
if(InvItems[i].ID = 890)then
J := ((InvItems[i].Quantity) * 135);
WriteLn('Approx. Money: ' + inttostr(j) + ' K');
end;
Approx. Money: 0 K
I just found that math error again while using frogsolve.. It was caused by R_BlindWalkEx's use of TPABetweenPoints.
Update:
Fixed part of the frog solver which wouldn't update the npc list when the player entered the cave.
Added some more precautions to R_BlindWalkEx
Seems like you're the only one still motivated to keeping the OSRS reflection include updated nowadays.So thank you for that.
I've been busy with some personal things lately but PM me if you want some help with anything (although you already know I can't do much due to my lack of knowledge).
Solar from RiD.
Time to make waves!
Started a brand new updater today.
The plan is for this one to use control flow deob, unlike my previous ones.
Already have a better foundation than my previous one.
Oh yeah, @Krazy_Meerkat will be joining me in the production of this updater so it should be decent this time.![]()
Last edited by NKN; 07-27-2014 at 05:02 AM.
There are currently 1 users browsing this thread. (0 members and 1 guests)