Skip to content
This repository has been archived by the owner on Dec 20, 2024. It is now read-only.

Commit

Permalink
(🛠): BepInEx5 integration
Browse files Browse the repository at this point in the history
  • Loading branch information
mzonski committed May 6, 2023
1 parent 1c14ecd commit 4c7b399
Show file tree
Hide file tree
Showing 47 changed files with 609 additions and 88 deletions.
5 changes: 5 additions & 0 deletions CheatMod.BepInEx5/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
bin/
obj/
/packages/
riderModule.iml
/_ReSharper.Caches/
120 changes: 120 additions & 0 deletions CheatMod.BepInEx5/CheatMod.BepInEx5.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<?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>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AssemblyName>CheatMod.BepInEx5</AssemblyName>
<RootNamespace>CheatMod.BepInEx5</RootNamespace>
<Description>My first plugin</Description>
<Version>1.0.0</Version>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>latest</LangVersion>
<RestoreAdditionalProjectSources>
https://api.nuget.org/v3/index.json;
https://nuget.bepinex.dev/v3/index.json;
https://nuget.samboy.dev/v3/index.json
</RestoreAdditionalProjectSources>
</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>
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all" />
<PackageReference Include="BepInEx.Core" Version="5.*" />
<PackageReference Include="BepInEx.PluginInfoProps" Version="2.*" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework.TrimEnd(`0123456789`))' == 'net'">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.2" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
<Compile Include="CheatMod.cs" />
<Compile Include="Patches\EasyFishing.cs" />
<Compile Include="Patches\FreezeTime.cs" />
<Compile Include="Patches\InfiniteFlute.cs" />
<Compile Include="Patches\InfiniteSeeds.cs" />
<Compile Include="Patches\InfiniteStamina.cs" />
<Compile Include="Patches\InfiniteWaterTool.cs" />
<Compile Include="Patches\PlayerSpeed.cs" />
<Compile Include="Patches\SkipDisclaimer.cs" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\CheatMod.Core\CheatMod.Core.csproj">
<Project>{fef26936-3aab-408c-87e6-1f32caf17d3a}</Project>
<Name>CheatMod.Core</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

<ItemGroup>
<Reference Include="0Harmony">
<HintPath>D:\Steam\steamapps\common\Roots of Pacha\MelonLoader\net35\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>D:\Steam\steamapps\common\Roots of Pacha\Roots of Pacha_Data\Managed\Assembly-CSharp.dll</HintPath>
</Reference>
<Reference Include="MamboJamboStudios.UnityAtomsCore.Runtime">
<HintPath>D:\Steam\steamapps\common\Roots of Pacha\Roots of Pacha_Data\Managed\MamboJamboStudios.UnityAtomsCore.Runtime.dll</HintPath>
</Reference>
<Reference Include="PhotonRealtime">
<HintPath>D:\Steam\steamapps\common\Roots of Pacha\Roots of Pacha_Data\Managed\PhotonRealtime.dll</HintPath>
</Reference>
<Reference Include="PhotonUnityNetworking">
<HintPath>D:\Steam\steamapps\common\Roots of Pacha\Roots of Pacha_Data\Managed\PhotonUnityNetworking.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UniTask">
<HintPath>D:\Steam\steamapps\common\Roots of Pacha\Roots of Pacha_Data\Managed\UniTask.dll</HintPath>
</Reference>
<Reference Include="UnityEngine">
<HintPath>D:\Steam\steamapps\common\Roots of Pacha\Roots of Pacha_Data\Managed\UnityEngine.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.CoreModule">
<HintPath>D:\Steam\steamapps\common\Roots of Pacha\Roots of Pacha_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.IMGUIModule">
<HintPath>D:\Steam\steamapps\common\Roots of Pacha\Roots of Pacha_Data\Managed\UnityEngine.IMGUIModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.InputLegacyModule">
<HintPath>D:\Steam\steamapps\common\Roots of Pacha\Roots of Pacha_Data\Managed\UnityEngine.InputLegacyModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.TextRenderingModule">
<HintPath>D:\Steam\steamapps\common\Roots of Pacha\Roots of Pacha_Data\Managed\UnityEngine.TextRenderingModule.dll</HintPath>
</Reference>
<Reference Include="UnityEngine.UI">
<HintPath>D:\Steam\steamapps\common\Roots of Pacha\Roots of Pacha_Data\Managed\UnityEngine.UI.dll</HintPath>
</Reference>
</ItemGroup>


<Target Name="AfterBuild">
<Copy SourceFiles="$(TargetDir)\CheatMod.BepInEx5.dll" DestinationFolder="D:\Steam\steamapps\common\Roots of Pacha\BepInEx\plugins" />
<Copy SourceFiles="$(TargetDir)\CheatMod.Core.dll" DestinationFolder="D:\Steam\steamapps\common\Roots of Pacha\BepInEx\plugins" />
</Target>
</Project>
2 changes: 2 additions & 0 deletions CheatMod.BepInEx5/CheatMod.BepInEx5.csproj.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<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/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=patches/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
40 changes: 40 additions & 0 deletions CheatMod.BepInEx5/CheatMod.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using BepInEx;
using CheatMod.Core;
using CheatMod.Core.UI;
using HarmonyLib;
using SodaDen.Pacha;
using UnityEngine;

namespace CheatMod.BepInEx5;

[BepInPlugin(MyPluginInfo.PLUGIN_GUID, CheatModBuildInfo.Name, CheatModBuildInfo.Version)]
[BepInProcess("Roots of Pacha")]
public partial class CheatMod : BaseUnityPlugin
{
private static readonly PachaManager PachaManager = new(new CheatConfiguration(), new PachaItemDb());
private static readonly PachaCheatUI CheatUI = new(PachaManager);

private void Awake()
{
Logger.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} is loaded!");
Harmony.CreateAndPatchAll(typeof(CheatMod));
}

private void Update()
{
if (Input.GetKeyDown(KeyCode.F12)) PachaCheats.ForceRegenerateHittableResources();

if (Input.GetKeyDown(KeyCode.F2)) PachaManager.Config.DrawUI = !PachaManager.Config.DrawUI;

if (Input.GetKeyDown(KeyCode.F3)) PachaCheats.AddDayBuff(PlayerStatBuffType.Charisma, 5);

if (Input.GetKeyDown(KeyCode.F4)) PachaUtils.GetPlayerCurrentCoords();

if (Input.GetKeyDown(KeyCode.F5)) PachaCheats.GrowCrops();
}

public void OnGUI()
{
CheatUI.Draw();
}
}
16 changes: 16 additions & 0 deletions CheatMod.BepInEx5/Patches/EasyFishing.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
using HarmonyLib;
using SodaDen.Pacha;

namespace CheatMod.BepInEx5;

public partial class CheatMod
{
[HarmonyPatch(typeof(FishingHitMode), "FocusRise", MethodType.Getter)]
[HarmonyPrefix]
private static bool EasyFishingPatch(ref float __result)
{
if (!PachaManager.Config.IsEasyFishingEnabled) return true;
__result = 1000f;
return false;
}
}
15 changes: 15 additions & 0 deletions CheatMod.BepInEx5/Patches/FreezeTime.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System.Reflection;
using HarmonyLib;
using SodaDen.Pacha;

namespace CheatMod.BepInEx5;

public partial class CheatMod
{
[HarmonyPatch(typeof(Session), "AdvanceTime")]
[HarmonyPrefix]
private static bool FreezeTimePatch()
{
return !PachaManager.Config.IsFreezeTimeEnabled;
}
}
18 changes: 18 additions & 0 deletions CheatMod.BepInEx5/Patches/InfiniteFlute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using HarmonyLib;
using SodaDen.Pacha;

namespace CheatMod.BepInEx5;

public partial class CheatMod
{
[HarmonyPatch(typeof(FluteToolItem), "Use")]
[HarmonyPrefix]
private static bool InfiniteFlutePatch(FluteToolItem __instance, PlayerEntity player, InventoryEntity entity,
float stamina)
{
if (PachaManager.Config.IsInfiniteFluteEnabled)
__instance.ToolPropertyWithData(entity).Level = __instance.MaxLevel;

return true;
}
}
14 changes: 14 additions & 0 deletions CheatMod.BepInEx5/Patches/InfiniteSeeds.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using HarmonyLib;
using SodaDen.Pacha;

namespace CheatMod.BepInEx5;

public partial class CheatMod
{
[HarmonyPatch(typeof(SeedInventoryEntity), "RemoveItem")]
[HarmonyPrefix]
private static bool InfiniteSeedsPatch()
{
return !PachaManager.Config.IsInfiniteSeedsEnabled;
}
}
17 changes: 17 additions & 0 deletions CheatMod.BepInEx5/Patches/InfiniteStamina.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using HarmonyLib;
using SodaDen.Pacha;

namespace CheatMod.BepInEx5;

public partial class CheatMod
{
[HarmonyPatch(typeof(PlayerStateController), "CheckIfAllowedAction")]
[HarmonyPrefix]
private static bool InfiniteStaminaPatch(PlayerStateController __instance)
{
if (PachaManager.Config.IsInfiniteStaminaEnabled)
__instance.PlayerEntity.Stats.SetStamina(__instance.PlayerEntity.Stats.MaxStamina);

return true;
}
}
17 changes: 17 additions & 0 deletions CheatMod.BepInEx5/Patches/InfiniteWaterTool.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using HarmonyLib;
using SodaDen.Pacha;

namespace CheatMod.BepInEx5;

public partial class CheatMod
{
[HarmonyPatch(typeof(WaterToolItem), "Use")]
[HarmonyPrefix]
private static bool InfiniteWaterToolPatch(WaterToolItem __instance, InventoryEntity entity)
{
if (PachaManager.Config.IsInfiniteWaterToolEnabled)
__instance.ToolPropertyWithData(entity).Level = __instance.MaxLevel;

return true;
}
}
26 changes: 26 additions & 0 deletions CheatMod.BepInEx5/Patches/PlayerSpeed.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using HarmonyLib;
using SodaDen.Pacha;

namespace CheatMod.BepInEx5;

public partial class CheatMod
{
[HarmonyPatch(typeof(PlayerStateController), "MaxSpeed", MethodType.Getter)]
[HarmonyPrefix]
private static bool PlayerStateMaxSpeedPatch(ref float? __result)
{
if (!PachaManager.Config.IsMovementSpeedEnabled) return true;
__result = 100f;
return false;
}


[HarmonyPatch(typeof(PlayerStateController), "Speed", MethodType.Getter)]
[HarmonyPrefix]
private static bool PlayerStateSpeedPatch(ref float __result)
{
if (!PachaManager.Config.IsMovementSpeedEnabled) return true;
__result = PachaManager.Config.PlayerMovementSpeed;
return false;
}
}
26 changes: 26 additions & 0 deletions CheatMod.BepInEx5/Patches/SkipDisclaimer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using CheatMod.Core;
using UnityEngine.SceneManagement;

namespace CheatMod.BepInEx5;

public partial class CheatMod
{
// Sometimes work, sometimes don't. Don't have time to solve it now
// private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
// {
// if (scene.name == "Scn_Disclaimer")
// {
// PachaUtils.SkipDisclaimerIntros();
// }
// }
//
// private void OnEnable()
// {
// SceneManager.sceneLoaded += OnSceneLoaded;
// }
//
// void OnDisable()
// {
// SceneManager.sceneLoaded -= OnSceneLoaded;
// }
}
13 changes: 13 additions & 0 deletions CheatMod.BepInEx5/Plugin.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using BepInEx;

namespace CheatMod.BepInEx5;

[BepInPlugin(MyPluginInfo.PLUGIN_GUID, MyPluginInfo.PLUGIN_NAME, MyPluginInfo.PLUGIN_VERSION)]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
// Plugin startup logic
Logger.LogInfo($"Plugin {MyPluginInfo.PLUGIN_GUID} is loaded!");
}
}
5 changes: 5 additions & 0 deletions CheatMod.Core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
bin/
obj/
/packages/
riderModule.iml
/_ReSharper.Caches/
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace RootsOfPachaCheatMod;
namespace CheatMod.Core;

public class CheatConfiguration
{
Expand Down
Loading

0 comments on commit 4c7b399

Please sign in to comment.