12-23-2016, 07:09 AM
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:et_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
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:et_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