LordVGames-NoShardsFromEmpyreans icon

NoShardsFromEmpyreans

Makes empyrean elites in the Starstorm 2 BETA not drop shard(s) on death.

Last updated 3 weeks ago
Total downloads 29
Total rating 0 
Categories Mods Tweaks
Dependency string LordVGames-NoShardsFromEmpyreans-1.0.0
Dependants 0 other packages depend on this package

This mod requires the following mods to function

bbepis-BepInExPack-5.4.2117 icon
bbepis-BepInExPack

Unified BepInEx all-in-one modding pack - plugin framework, detour library

Preferred version: 5.4.2117
RiskofThunder-HookGenPatcher-1.2.5 icon
RiskofThunder-HookGenPatcher

MMHOOK generation at runtime.

Preferred version: 1.2.5

README

NoShardsFromEmpyreans

Really small mod to make empyrean elites not drop shard(s) on death in the beta version of Starstorm 2. They still drop a random item, it's just the shard drops that were removed.

This mod's so small that I didn't bother making a github repository for it, since this is all the relevant code for the harmony IL patch:

IL patch code
[HarmonyPatch(typeof(SS2.Components.Empyrean), nameof(SS2.Components.Empyrean.MakeElite))]
[HarmonyILManipulator]
public static void DoPatch(ILContext il)
{
    ILCursor c = new(il);
    ILLabel skipSettingShardDrops = il.DefineLabel();


    if (!c.TryGotoNext(MoveType.AfterLabel,
        x => x.MatchLdarg(1),
        x => x.MatchCallvirt<Component>("get_gameObject"),
        x => x.MatchCallvirt<GameObject>("AddComponent")
    ))
    {
        Log.Error("COULD NOT IL HOOK SS2.Components.Empyrean.MakeElite PART 1");
        Log.Warning($"il is {il}");
    }
    c.Emit(OpCodes.Br, skipSettingShardDrops);


    if (!c.TryGotoNext(MoveType.AfterLabel,
        x => x.MatchLdarg(1),
        x => x.MatchLdloca(4),
        x => x.MatchCallvirt<Component>("TryGetComponent")
    ))
    {
        Log.Error("COULD NOT IL HOOK SS2.Components.Empyrean.MakeElite PART 2");
        Log.Warning($"il is {il}");
    }
    c.MarkLabel(skipSettingShardDrops);
}