The Bytecode Club
help editing code in Net Reflector - Printable Version

+- The Bytecode Club (https://the.bytecode.club)
+-- Forum: Lobby (https://the.bytecode.club/forumdisplay.php?fid=1)
+--- Forum: Programming (https://the.bytecode.club/forumdisplay.php?fid=86)
+--- Thread: help editing code in Net Reflector (/showthread.php?tid=45426)



help editing code in Net Reflector - newbreedsoftware - 12-23-2016

I am trying to modify some code in .Net Reflector for an Android game and could use some assistance as I am still learning. As you can see in the attached screenshot the sub I am trying to edit is called 'DealDamage'. I would like to make the critAttack boolean always true, AimType always to be head (0) and no damage taken. Below is the section I believe needs to be edited with my notes added.

dropbox.com/s/s8q9to7wafdbs3f/tysworkss.jpg?dl=0

0 ldarg.3
1 brfalse -> (5) ldarg.0
2 ldarg.0
3 ldc.i4.1
4 stfld System.Boolean Actor::critAttack
5 ldarg.0 <do I chanage this to ldarg.1 to make critAttack always True?
6 ldarg.s -> (3) aim (Actor/AimType)
7 stfld Actor/AimType Actor::attackAim
8 ldarg.2 <do I change this to ldarg.0 for always headshot? AimType is 0 = Head, 1 = Torso, 2 = Legs
9 ldnull
10 call System.Boolean UnityEngine.Object::op_Inequality(UnityEngine.Object,UnityEngine.Object)
11 brfalse -> (25) ldarg.0
12 ldarg.0
13 callvirt System.Single Actor::get_Health()
14 ldarg.1
15 conv.r4
16 sub <do I change this to add to increase health instead of decreasing?
17 ldc.r4 0
18 bgt.un -> (25) ldarg.0
19 ldarg.0
20 ldarg.2
21 stfld Weapon Actor::killedBy
22 ldarg.2
23 ldarg.0
24 callvirt System.Void Weapon::DoForcefulHitEffect(Actor)
25 ldarg.0
26 dup
27 callvirt System.Single Actor::get_health()
28 ldarg.1
29 conv.r4
30 sub
31 callvirt System.Void Actor:Worryet_Health(System.Single)
32 ldarg.1 <do I change this to idc4.1 999,999 ?
33 ldc.i4.0
34 bgt -> (146) ret
35 ldarg.2
36 ldnull


RE: help editing code in Net Reflector - SKiLLa - 02-10-2017

If you use dnSpy; you have to option to try, edit and recompile VB.Net or C# code as well, besides the 'manual IL code' editing that doesn't require recompilation. Judging from your screenshot, it doesn't have obfuscated class- and function-names, should the 'edit in C# or VB' should work.
But I guess you already fixed it by now Smile