sometimes it is impossible to recompile unless text is altered example: a debugging line like [global::System.Diagnostics.DebuggerBrowsable(global::System.Diagnostics.DebuggerBrowsableState.Never)] need to be excluded like //[global::System.Diagnostics.DebuggerBrowsable(global::System.Diagnostics.DebuggerBrowsableState.Never)]
when the recompiler is confused about using a unity function or a common function it is better to tell the recompiler to use unity function
when the recompiler is confused about vector 3 or 2, i solved the problem adding (Vector2) before the confusing point. this. something + new Vector 2 something else becomes (Vector2)this.something + new Vector 2 something else
--- usually i modify class to be able to alter the code, in rare cases i am forced to modify method when the compiler refuses to recompile altered code.
---
take the standard bullet weapon:
Peashooter + Mega Blast: WeaponProperties LevelWeaponPeashot Basic *** public static readonly float damage = 4f; into public static readonly float damage = 6f; *** WeaponProperties LevelWeaponPeashot Ex *** public static readonly float damage = 8.334f; public static readonly float maxDamage = 25f;
into
public static readonly float damage = 11.112f; public static readonly float maxDamage = 37.5f; ***
you expand Assembly-CSharp.dll expand - and you see a long list of words... one of them is WeaponProperties you expand and see all charms and all super arts and all weapons used in the game...
this is the starting weapon LevelWeaponPeashot you can alter basic damage, and its ex damage.
in my case i changed 4f into 6f +50% damage
--- there is a search utility that helps you find code to alter... if you place inside this word: CalculateHealthMax then it takes you to the place that decide how much hearts you gain.
that part is under
{} PlayerStatsManager CalculateHealthMax
the code says: this.HealthMax = 3; and you can change to this.HealthMax = 4; this way cuphead and mugmen starts with 4 hearts, miss chalice with 5 (infact later it is also written: if 1 heart charm is used, +1 health... if 2 hearts charm is used +2 hearts... if miss chalice +1 heart)
Yes I understand the work with classes, just how do I add lines of code in dnSpy, I just do not know the sequence of actions in the program, it would be nice if you send an example with increasing damage, just I click on compile and gives errors with syntax, maybe not there add lines of code
using System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Security; using System.Security.Permissions;
Error CS1585 The member modifier "public" must be specified before the member type and name. main.cs 13 Error CS0116 A namespace cannot directly include members such as fields or methods.main.cs 13
Crackshot + P. Turret WeaponProperties LevelWeaponCrackshot Basic *** public static readonly float initialDamage = 10.56f; public static readonly float crackedDamage = 6.7f; into public static readonly float initialDamage = 15.84f; public static readonly float crackedDamage = 10.05f; ***
just changing 10.56f into 15.84f and recompiling should give no error... then you should do: file, save module
on my left i have the "assembly explorer" with WeaponProperties i expand WeaponProperties and find inside LevelWeaponCrackshot i expand LevelWeaponCrackshot and find Basic and Ex i click Basic and on the right side i get the text to modify
i move my mouse cursor on the number 10.56f, right click and select "modify class c#", i change the number, then click the button compile.
then file, save module
************** plz notice the very often it is better to use "right click, modify class c#" exactly in the point that you want to modify if you select the big file that contains all function within you risk to get many recompile errors....
if you carefully use the "modify class c#" on the text you want to change, you will get no serious error... at worse you can try "modify method c#"
11 comments
mod tested on gog version 1.3.4 with dlc installed
you need to substitute the dll file...
download: dnSpy-netcore-win64.zip
file, open, c:\GOG Games\Cuphead\Cuphead_Data\Managed\Assembly-CSharp.dll
sometimes it is impossible to recompile unless text is altered
example:
a debugging line like [global::System.Diagnostics.DebuggerBrowsable(global::System.Diagnostics.DebuggerBrowsableState.Never)]
need to be excluded like //[global::System.Diagnostics.DebuggerBrowsable(global::System.Diagnostics.DebuggerBrowsableState.Never)]
when the recompiler is confused about using a unity function or a common function it is better to tell the recompiler to use unity function
when the recompiler is confused about vector 3 or 2, i solved the problem adding (Vector2) before the confusing point.
this. something + new Vector 2 something else becomes (Vector2)this.something + new Vector 2 something else
---
usually i modify class to be able to alter the code, in rare cases i am forced to modify method when the compiler refuses to recompile altered code.
---
take the standard bullet weapon:
Peashooter + Mega Blast:
WeaponProperties
LevelWeaponPeashot
Basic
***
public static readonly float damage = 4f;
into
public static readonly float damage = 6f;
***
WeaponProperties
LevelWeaponPeashot
Ex
***
public static readonly float damage = 8.334f;
public static readonly float maxDamage = 25f;
into
public static readonly float damage = 11.112f;
public static readonly float maxDamage = 37.5f;
***
you expand Assembly-CSharp.dll
expand - and you see a long list of words... one of them is WeaponProperties
you expand and see all charms and all super arts and all weapons used in the game...
this is the starting weapon LevelWeaponPeashot
you can alter basic damage, and its ex damage.
in my case i changed 4f into 6f +50% damage
---
there is a search utility that helps you find code to alter...
if you place inside this word: CalculateHealthMax then it takes you to the place that decide how much hearts you gain.
that part is under
{}
PlayerStatsManager
CalculateHealthMax
the code says: this.HealthMax = 3; and you can change to this.HealthMax = 4; this way cuphead and mugmen starts with 4 hearts, miss chalice with 5 (infact later it is also written: if 1 heart charm is used, +1 health... if 2 hearts charm is used +2 hearts... if miss chalice +1 heart)
which weapon do u want to mod ?
edit:
right click on text,
select modify class or modify method
change text
click compile
if error, solve error and compile
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
[assembly: AssemblyVersion("0.0.0.0")]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
WeaponProperties.LevelWeaponCrackshot.Basic
public static readonly float initialDamage = 15.84f;
public static readonly float crackedDamage = 10.05f;
Error CS1585 The member modifier "public" must be specified before the member type and name. main.cs 13
Error CS0116 A namespace cannot directly include members such as fields or methods.main.cs 13
i made these changes:
Crackshot + P. Turret
WeaponProperties
LevelWeaponCrackshot
Basic
***
public static readonly float initialDamage = 10.56f;
public static readonly float crackedDamage = 6.7f;
into
public static readonly float initialDamage = 15.84f;
public static readonly float crackedDamage = 10.05f;
***
just changing 10.56f into 15.84f and recompiling should give no error... then you should do: file, save module
on my left i have the "assembly explorer" with WeaponProperties
i expand WeaponProperties and find inside LevelWeaponCrackshot
i expand LevelWeaponCrackshot and find Basic and Ex
i click Basic and on the right side i get the text to modify
i move my mouse cursor on the number 10.56f, right click and select "modify class c#", i change the number, then click the button compile.
then file, save module
**************
plz notice the very often it is better to use "right click, modify class c#" exactly in the point that you want to modify
if you select the big file that contains all function within you risk to get many recompile errors....
if you carefully use the "modify class c#" on the text you want to change, you will get no serious error... at worse you can try "modify method c#"