Add night rider

This commit is contained in:
2024-12-31 13:46:32 +01:00
parent 3c7b9f7360
commit 983aaa68e6
9 changed files with 316 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
{
"dotnet.preferCSharpExtension": true
}

View File

@@ -0,0 +1,35 @@
using System.Linq;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using HarmonyLib.Tools;
namespace CykaRaider {
[BepInPlugin(pluginGuid, pluginName, pluginVersion)]
public class Main : BaseUnityPlugin {
private const string pluginGuid = "CykaRaider";
private const string pluginName = "CykaRaider";
private const string pluginVersion = "1.0.0";
public static ConfigEntry<int> lootTimeAdder;
public static ConfigEntry<float> maxStackMultiplier;
public static ConfigEntry<bool> debugMode;
public void Awake() {
debugMode = Config.Bind("General", "Debug Mode", false, new ConfigDescription("Debug Mode"));
lootTimeAdder = Config.Bind("General", "Loot Time Adder", 0, new ConfigDescription("Loot Time Adder"));
maxStackMultiplier = Config.Bind("General", "Max Stack Multiplier", 1f, new ConfigDescription("Max Stack Multiplier"));
Logger.LogInfo("Cyka mod loaded");
HarmonyFileLog.Enabled = true;
Harmony harmony = new Harmony(pluginGuid);
harmony.PatchAll();
var originalMethods = harmony.GetPatchedMethods();
Logger.LogInfo("Patched " + originalMethods.Count() + " methods");
foreach (var method in originalMethods) {
Logger.LogInfo("Patched " + method.Name);
}
}
}
}

View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<GAME_DIR>C:/Games/NightRaider</GAME_DIR>
<GAME_MANAGED>$(GAME_DIR)/NightRaider_Data/Managed</GAME_MANAGED>
<GAME_BEPINEX>$(GAME_DIR)/BepInEx</GAME_BEPINEX>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CykaRaider</RootNamespace>
<AssemblyName>CykaRaider</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Compile Include="Class1.cs" />
<Compile Include="Patches.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<Reference Include="0Harmony">
<HintPath>$(GAME_BEPINEX)/core/0Harmony.dll</HintPath>
</Reference>
<Reference Include="BepInEx">
<HintPath>$(GAME_BEPINEX)/core/BepInEx.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>$(GAME_MANAGED)/UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>$(GAME_MANAGED)/UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="XRL">
<HintPath>$(GAME_MANAGED)/Assembly-CSharp.dll</HintPath>
</Reference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CykaRaider", "CykaRaider.csproj", "{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EE5EFB7F-A4DC-44F0-967B-F71ECA2D46AE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,7 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/Environment/Hierarchy/Build/BuildTool/AutoDownloadSdk/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/DotNetCliExePath/@EntryValue">C:\Users\Administrator\scoop\apps\dotnet-sdk\current\dotnet.exe</s:String>
<s:Int64 x:Key="/Default/Environment/Hierarchy/Build/BuildTool/MsBuildSolutionLoadingNodeCount/@EntryValue">16</s:Int64>
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/CustomBuildToolPath/@EntryValue">C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe</s:String>
<s:Int64 x:Key="/Default/Environment/Hierarchy/Build/BuildTool/MsbuildVersion/@EntryValue">1048576</s:Int64>
<s:Boolean x:Key="/Default/Environment/Hierarchy/Build/BuildTool/RecentBuildToolPaths/=C_003A_005CUsers_005CAdministrator_005Cscoop_005Capps_005Cvsbuildtools2019_005Ccurrent_005Cvs_005CMSBuild_005CCurrent_005CBin_005Camd64_005CMSBuild_002Eexe/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -0,0 +1,7 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/Environment/Hierarchy/Build/BuildTool/AutoDownloadSdk/@EntryValue">False</s:Boolean>
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/DotNetCliExePath/@EntryValue">C:\Users\Administrator\scoop\apps\dotnet-sdk\current\dotnet.exe</s:String>
<s:Int64 x:Key="/Default/Environment/Hierarchy/Build/BuildTool/MsBuildSolutionLoadingNodeCount/@EntryValue">16</s:Int64>
<s:String x:Key="/Default/Environment/Hierarchy/Build/BuildTool/CustomBuildToolPath/@EntryValue">C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe</s:String>
<s:Int64 x:Key="/Default/Environment/Hierarchy/Build/BuildTool/MsbuildVersion/@EntryValue">1048576</s:Int64>
<s:Boolean x:Key="/Default/Environment/Hierarchy/Build/BuildTool/RecentBuildToolPaths/=C_003A_005CUsers_005CAdministrator_005Cscoop_005Capps_005Cvsbuildtools2019_005Ccurrent_005Cvs_005CMSBuild_005CCurrent_005CBin_005Camd64_005CMSBuild_002Eexe/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -0,0 +1,152 @@
using System;
using HarmonyLib;
namespace CykaRaider
{
[HarmonyPatch]
public class Patches
{
[HarmonyPostfix]
[HarmonyPatch(typeof(GameManager), "FixedUpdate")]
static void lootTimeAdder(GameManager __instance) {
var trav = Traverse.Create(__instance);
var lootTime = trav.Field("lootTime").GetValue<int>();
if (lootTime > 0) {
if (Main.debugMode.Value)
Console.WriteLine("CykaRaider: FixedUpdate: Old lootTime {0}", lootTime);
lootTime += Main.lootTimeAdder.Value;
if (Main.debugMode.Value)
Console.WriteLine("CykaRaider: FixedUpdate: New lootTime {0}", lootTime);
trav.Field("lootTime").SetValue(lootTime);
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(DataHub), "GetFixedData")]
static void xpMultiplier(DataHub __instance) {
for (int i = 0; i < __instance.itemDataDic.Count; i++) {
var itemData = __instance.itemDataDic[i];
if (itemData.maxStack > 0) {
if (Main.debugMode.Value)
Console.WriteLine("CykaRaider: GetFixedData: Old maxStack {0}", itemData.maxStack);
itemData.maxStack = (int)(itemData.maxStack * Main.maxStackMultiplier.Value);
if (Main.debugMode.Value)
Console.WriteLine("CykaRaider: GetFixedData: New maxStack {0}", itemData.maxStack);
}
}
}
// [HarmonyPrefix]
// [HarmonyPatch(typeof(XRL.World.Parts.Experience), "HandleEvent")]
// static void xpMultiplier(ref AwardedXPEvent E) {
// if (Main.debugMode.Value)
// Console.WriteLine("CykaRaider: AwardedXPEvent: Old XP {0}", E.Amount);
// E.Amount = (int)(E.Amount * Main.xpMultiplier.Value);
// if (Main.debugMode.Value)
// Console.WriteLine("CykaRaider: AwardedXPEvent: New XP {0}", E.Amount);
// }
//
// [HarmonyPrefix]
// [HarmonyPatch(typeof(XRL.World.Parts.Leveler), "AddHitpoints")]
// static void hitpointsPerLevelMultiplier(StringBuilder sb, ref int HPGain) {
// if (Main.debugMode.Value)
// Console.WriteLine("CykaRaider: AddHitpoints: Old HP for level {0}", HPGain);
// if (HPGain == 0)
// HPGain = 1;
// HPGain = (int)(HPGain * Main.hitpointsPerLevelMultiplier.Value);
// if (Main.debugMode.Value)
// Console.WriteLine("CykaRaider: AddHitpoints: New HP for level {0}", HPGain);
// }
//
// [HarmonyPrefix]
// [HarmonyPatch(typeof(XRL.World.Parts.Leveler), "AddSkillPoints")]
// static void skillPointsPerLevelMultiplier(StringBuilder sb, ref int SPGain) {
// if (Main.debugMode.Value)
// Console.WriteLine("CykaRaider: AddSkillPoints: Old SP for level {0}", SPGain);
// if (SPGain == 0)
// SPGain = 1;
// SPGain = (int)(SPGain * Main.skillPointsPerLevelMultiplier.Value);
// if (Main.debugMode.Value)
// Console.WriteLine("CykaRaider: AddSkillPoints: New SP for level {0}", SPGain);
// }
//
// [HarmonyPrefix]
// [HarmonyPatch(typeof(XRL.World.Parts.Leveler), "AddMutationPoints")]
// static void mutationPointsPerLevelMultiplier(StringBuilder sb, ref int MPGain) {
// if (Main.debugMode.Value)
// Console.WriteLine("CykaRaider: AddMutationPoints: Old MP for level {0}", MPGain);
// if (MPGain == 0)
// MPGain = 1;
// MPGain = (int)(MPGain * Main.mutationPointsPerLevelMultiplier.Value);
// if (Main.debugMode.Value)
// Console.WriteLine("CykaRaider: AddMutationPoints: New MP for level {0}", MPGain);
// }
//
// [HarmonyPrefix]
// [HarmonyPatch(typeof(XRL.World.Parts.Leveler), "AddAttributePoints")]
// static void attributePointsPerLevelMultiplier(StringBuilder sb, ref int APGain) {
// if (Main.debugMode.Value)
// Console.WriteLine("CykaRaider: AddAttributePoints: Old AP for level {0}", APGain);
// if (APGain == 0)
// APGain = 1;
// APGain = (int)(APGain * Main.attributePointsPerLevelMultiplier.Value);
// if (Main.debugMode.Value)
// Console.WriteLine("CykaRaider: AddAttributePoints: New AP for level {0}", APGain);
// }
//
// [HarmonyPrefix]
// [HarmonyPatch(typeof(XRL.World.Parts.Leveler), "AddAttributeBonus")]
// static void attributeBonusPerLevelMultiplier(StringBuilder sb, ref int ABGain) {
// if (Main.debugMode.Value)
// Console.WriteLine("CykaRaider: AddAttributeBonus: Old AB for level {0}", ABGain);
// ABGain = (int)(ABGain * Main.attributeBonusPerLevelMultiplier.Value);
// if (ABGain == 0)
// ABGain = 2;
// if (Main.debugMode.Value)
// Console.WriteLine("CykaRaider: AddAttributeBonus: New AB for level {0}", ABGain);
// }
//
// [HarmonyPrefix]
// [HarmonyPatch(typeof(XRL.World.Parts.BitLocker), "AddBits")]
// static void disassemblyBonusMultiplier(ref string Bits) {
// if (Main.debugMode.Value)
// Console.WriteLine("CykaRaider: AddBits: Old {0}", Bits);
//
// StringBuilder output = new StringBuilder();
// foreach (char c in Bits) {
// output.Append(new string(c, (int)Math.Ceiling(Main.disassemblyBonusMultiplier.Value)));
// }
//
// Bits = output.ToString();
//
// if (Main.debugMode.Value)
// Console.WriteLine("CykaRaider: AddBits: New {0}", Bits);
// }
//
// [HarmonyPostfix]
// [HarmonyPatch(typeof(GetTinkeringBonusEvent), nameof(GetTinkeringBonusEvent.GetFor),
// new Type[] {
// typeof(GameObject), typeof(GameObject), typeof(string), typeof(int), typeof(int), typeof(int),
// typeof(bool), typeof(bool), typeof(bool), typeof(bool)
// },
// new ArgumentType[] {
// ArgumentType.Normal, ArgumentType.Normal, ArgumentType.Normal, ArgumentType.Normal, ArgumentType.Normal,
// ArgumentType.Out, ArgumentType.Out, ArgumentType.Out, ArgumentType.Normal, ArgumentType.Normal
// })]
// static void reverseEngineerChanceMultiplier(GameObject Actor, GameObject Item, string Type, int BaseRating,
// int Bonus, ref int SecondaryBonus, ref bool Interrupt, ref bool PsychometryApplied, bool Interruptable,
// bool ForSifrah, ref int __result) {
// if (Main.debugMode.Value)
// Console.WriteLine(
// "CykaRaider: GetFor: Actor {0} Item {1} Type {2} BaseRating {3} Bonus {4} SecondaryBonus {5} Interrupt {6} PsychometryApplied {7} Interruptable {8} ForSifrah {9} Result {10}",
// Actor.ID, Item.ID, Type, BaseRating, Bonus, SecondaryBonus, Interrupt, PsychometryApplied,
// Interruptable, ForSifrah, __result);
// __result = (int)(__result * Main.reverseEngineerChanceMultiplier.Value);
// __result += Main.reverseEngineerChanceAdditional.Value;
// if (__result > 100)
// __result = 100;
// if (Main.debugMode.Value)
// Console.WriteLine("CykaRaider: GetFor: New Result {0}", __result);
// }
// }
}
}

View File

@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Regiments")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Regiments")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("DA9D274E-486F-4F82-84FF-CD9388CB0B09")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1 @@
bin/Release/CykaRaider.dll,"C:/Games/NightRaider/BepInEx/plugins/CykaRaider.dll"