mirror of
https://github.com/chev2/RoR2-Mods.git
synced 2026-04-22 02:32:32 +00:00
RoR2-SacrificeDropRate Initial Commit
This commit is contained in:
parent
2def986d97
commit
78f42a71b4
3 changed files with 75 additions and 0 deletions
25
RoR2-SacrificeDropRate/RoR2-SacrificeDropRate.sln
Normal file
25
RoR2-SacrificeDropRate/RoR2-SacrificeDropRate.sln
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30204.135
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RoR2-SacrificeDropRate", "RoR2-SacrificeDropRate\RoR2-SacrificeDropRate.csproj", "{85B9C64B-B9FD-474F-89B4-9590529E677F}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{85B9C64B-B9FD-474F-89B4-9590529E677F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{85B9C64B-B9FD-474F-89B4-9590529E677F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{85B9C64B-B9FD-474F-89B4-9590529E677F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{85B9C64B-B9FD-474F-89B4-9590529E677F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {10D54B89-E06E-428E-AE42-911FF165AE02}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
using BepInEx;
|
||||
using BepInEx.Configuration;
|
||||
using RoR2;
|
||||
using UnityEngine;
|
||||
using Mono.Cecil.Cil;
|
||||
using MonoMod.Cil;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace ChevRoR
|
||||
{
|
||||
[BepInDependency("com.bepis.r2api")]
|
||||
[BepInPlugin("com.ChevRoR.AlteredSacrificeArtifactRate", "Sacrifice Artifact Drop Rate Changer", "1.0.0")]
|
||||
public class AlteredSacrificeArtifactRate : BaseUnityPlugin
|
||||
{
|
||||
private static ConfigFile ASARConfig = new ConfigFile(Paths.ConfigPath + "\\SacrificeArtifactRate.cfg", true);
|
||||
public static ConfigEntry<bool> ModEnabled { get; set; }
|
||||
public static ConfigEntry<float> DropRateModifier { get; set; }
|
||||
|
||||
public void Awake()
|
||||
{
|
||||
ModEnabled = Config.Bind<bool>("Main", "ModEnabled", true, "Changes whether or not the mod is enabled.");
|
||||
DropRateModifier = Config.Bind<float>("Main", "SacrificeArtifactDropRate", 5f, "The modifier used for drop rate. 1 is 1% drop rate, 100 is 100%, etc.");
|
||||
|
||||
if (!ModEnabled.Value)
|
||||
return;
|
||||
|
||||
IL.RoR2.Artifacts.SacrificeArtifactManager.OnServerCharacterDeath += (il) =>
|
||||
{
|
||||
ILCursor c = new ILCursor(il);
|
||||
c.GotoNext(
|
||||
x => x.MatchLdloc(0),
|
||||
x => x.MatchLdcR4(0),
|
||||
x => x.MatchLdnull()
|
||||
); // find location
|
||||
c.Next.OpCode = OpCodes.Ldc_R4; // change from local variable to float32
|
||||
c.Next.Operand = DropRateModifier.Value; // set to config value
|
||||
};
|
||||
|
||||
Console.print("\'Sacrifice Artifact Drop Rate Changer\' mod loaded");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<RootNamespace>RoR2_SacrificeDropRate</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
Loading…
Add table
Reference in a new issue