Skip to content

Commit

Permalink
Updated to 3.9.0 and added script for stamina changes (disabled)
Browse files Browse the repository at this point in the history
  • Loading branch information
CWXDEV committed Jul 6, 2024
1 parent c15d29e commit 691279a
Show file tree
Hide file tree
Showing 15 changed files with 60 additions and 39 deletions.
8 changes: 4 additions & 4 deletions src/CWX-MegaMod/CWX-MegaMod.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<Reference Include="0Harmony">
<HintPath>..\..\shared\0Harmony.dll</HintPath>
</Reference>
<Reference Include="Aki.Common">
<HintPath>..\..\shared\Aki.Common.dll</HintPath>
<Reference Include="spt-Common">
<HintPath>..\..\shared\spt-Common.dll</HintPath>
</Reference>
<Reference Include="Aki.Reflection">
<HintPath>..\..\shared\Aki.Reflection.dll</HintPath>
<Reference Include="spt-Reflection">
<HintPath>..\..\shared\spt-Reflection.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp">
<HintPath>..\..\shared\Assembly-CSharp.dll</HintPath>
Expand Down
26 changes: 26 additions & 0 deletions src/CWX-MegaMod/ChadMode/StaminaScript.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
using Comfort.Common;
using EFT;
using EFT.HealthSystem;
using HarmonyLib;
using UnityEngine;

namespace CWX_MegaMod.ChadMode
{
public class StaminaScript : MonoBehaviour
{
private BackendConfigSettingsClass backendConfigSettingsClass;

private void Awake()
{
backendConfigSettingsClass = Singleton<BackendConfigSettingsClass>.Instance;
}

public void StartTask()
{
if (backendConfigSettingsClass != null)
{
// backendConfigSettingsClass.Stamina
}
}
}
}
4 changes: 2 additions & 2 deletions src/CWX-MegaMod/InventoryViewer/InventoryViewerPatch.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Aki.Reflection.Patching;
using EFT.InventoryLogic;
using EFT.InventoryLogic;
using HarmonyLib;
using System.Reflection;
using SPT.Reflection.Patching;

namespace CWX_MegaMod.InventoryViewer
{
Expand Down
11 changes: 10 additions & 1 deletion src/CWX-MegaMod/MegaMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace CWX_MegaMod
{
[BepInPlugin("CWX.MegaMod", "CWX-MegaMod", "1.2.4")]
[BepInPlugin("CWX.MegaMod", "CWX-MegaMod", "1.3.0")]
public class MegaMod : BaseUnityPlugin
{
internal new static ManualLogSource Logger { get; private set; }
Expand All @@ -27,6 +27,10 @@ public class MegaMod : BaseUnityPlugin
internal static ConfigEntry<bool> FogRemover { get; private set; }
internal static ConfigEntry<bool> WeatherDebug { get; private set; }
internal static ConfigEntry<bool> ReserveAlarmChanger { get; private set; }
// internal static ConfigEntry<bool> ChadMode { get; private set; }
// internal static ConfigEntry<bool> ChadModeStamJiggle { get; private set; }
// internal static ConfigEntry<bool> ChadModeCamRock { get; private set; }
// internal static ConfigEntry<bool> ChadModeBreathing { get; private set; }

public void Awake()
{
Expand All @@ -48,6 +52,7 @@ public void Awake()
private void InitConfig()
{
// Higher order number comes first
//ChadMode = Config.Bind("All Mods", "ChadMode - On/Off", false, new ConfigDescription("Enable ChadMode - Sets stamina drain to 0", tags: new ConfigurationManagerAttributes() { Order = 12 }));
ReserveAlarmChanger = Config.Bind("All Mods", "ReserveAlarmChanger - On/Off", false, new ConfigDescription("Enable Reserve Alarm Changer - changes alarm sound to file on plugin folder (ONLY RUNS ON RAID START)", tags: new ConfigurationManagerAttributes() { Order = 11 }));
BushWhacker = Config.Bind("All Mods", "BushWhacker - On/Off", false, new ConfigDescription("Enable BushWhacker - removes slowdown from bushes", tags: new ConfigurationManagerAttributes() { Order = 10 }));
GrassCutter = Config.Bind("All Mods", "GrassCutter - On/Off", false, new ConfigDescription("Enable GrassCutter - removes grass", tags: new ConfigurationManagerAttributes() { Order = 9 }));
Expand All @@ -61,6 +66,10 @@ private void InitConfig()
FogRemover = Config.Bind("All Mods", "FogRemover - On/Off", false, new ConfigDescription("Enable FogRemover - Removes fog", tags: new ConfigurationManagerAttributes() { Order = 1 }));

MasterKeyToUse = Config.Bind("MasterKey", "MasterKeyToUse", EMasterKeys.Yellow, new ConfigDescription("This will be set to all unlockable doors", tags: new ConfigurationManagerAttributes() { Order = 1 }));

//ChadModeStamJiggle = Config.Bind("ChadMode", "Disable Exhaustion Jiggle", false, new ConfigDescription("Disable Exhaustion Jiggle", tags: new ConfigurationManagerAttributes() { Order = 3 }));
//ChadModeCamRock = Config.Bind("ChadMode", "Disable Exhaustion CameraRock", false, new ConfigDescription("Disable Exhaustion CameraRock", tags: new ConfigurationManagerAttributes() { Order = 2 }));
//ChadModeBreathing = Config.Bind("ChadMode", "Disable Exhaustion Breathing", false, new ConfigDescription("Disable Exhaustion Breathing", tags: new ConfigurationManagerAttributes() { Order = 1 }));
}

public static void LogToScreen(string message = "", EMessageType eMessageType = EMessageType.info)
Expand Down
2 changes: 1 addition & 1 deletion src/CWX-MegaMod/MegaModPatch.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Reflection;
using Aki.Reflection.Patching;
using SPT.Reflection.Patching;
using Comfort.Common;
using EFT;
using HarmonyLib;
Expand Down
5 changes: 5 additions & 0 deletions src/CWX-MegaMod/MegaModScript.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Comfort.Common;
using CWX_MegaMod.AlarmChanger;
using CWX_MegaMod.BushWhacker;
using CWX_MegaMod.ChadMode;
using CWX_MegaMod.EnvironmentEnjoyer;
using CWX_MegaMod.GrassCutter;
using CWX_MegaMod.MasterKey;
Expand All @@ -21,6 +22,7 @@ public class MegaModScript : MonoBehaviour
public EnvironmentEnjoyerScript _environmentEnjoyerScript;
public WeatherPatcherScript _weatherPatcherScript;
public AlarmChangerScript _alarmChangerScript;
// public StaminaScript _staminaScript;

private void Awake()
{
Expand Down Expand Up @@ -61,6 +63,7 @@ private void SetupMegaModScripts()
_environmentEnjoyerScript = _gameWorld.gameObject.AddComponent<EnvironmentEnjoyerScript>();
_weatherPatcherScript = _gameWorld.gameObject.AddComponent<WeatherPatcherScript>();
_alarmChangerScript = _gameWorld.gameObject.AddComponent<AlarmChangerScript>();
// _staminaScript = _gameWorld.gameObject.AddComponent<StaminaScript>();
}

private void RunFirstTime()
Expand All @@ -70,6 +73,7 @@ private void RunFirstTime()
_masterKeyScript.StartTask();
_environmentEnjoyerScript.StartTask();
_weatherPatcherScript.StartTask();
// _staminaScript.StartTask();
}

private void SetupMegaModEvents()
Expand All @@ -81,6 +85,7 @@ private void SetupMegaModEvents()
MegaMod.EnvironmentEnjoyer.SettingChanged += (a, b) => _environmentEnjoyerScript.StartTask();
MegaMod.FogRemover.SettingChanged += (a, b) => _weatherPatcherScript.StartTask();
MegaMod.WeatherDebug.SettingChanged += (a, b) => _weatherPatcherScript.StartTask();
// MegaMod.ChadMode.SettingChanged += (a, b) => _staminaScript.StartTask();
}
}
}
4 changes: 2 additions & 2 deletions src/CWX-MegaMod/PainkillerDesat/PainkillerDesatPatch1.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Reflection;
using Aki.Reflection.Patching;
using SPT.Reflection.Patching;
using HarmonyLib;

namespace CWX_MegaMod.PainkillerDesat
Expand All @@ -8,7 +8,7 @@ public class PainkillerDesatScript1 : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(EffectsController.Class572), nameof(EffectsController.Class572.method_2));
return AccessTools.Method(typeof(EffectsController.Class582), nameof(EffectsController.Class582.method_2));
}

[PatchPrefix] // removes the sharpen/desat effect from some painkillers
Expand Down
4 changes: 2 additions & 2 deletions src/CWX-MegaMod/PainkillerDesat/PainkillerDesatPatch2.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Reflection;
using Aki.Reflection.Patching;
using SPT.Reflection.Patching;
using HarmonyLib;

namespace CWX_MegaMod.PainkillerDesat
Expand All @@ -8,7 +8,7 @@ public class PainkillerDesatScript2 : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(EffectsController.Class572), nameof(EffectsController.Class572.method_1));
return AccessTools.Method(typeof(EffectsController.Class582), nameof(EffectsController.Class582.method_1));
}

[PatchPrefix] // removes the sharpen/desat effect from some painkillers
Expand Down
4 changes: 2 additions & 2 deletions src/CWX-MegaMod/PainkillerDesat/PainkillerDesatPatch3.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Reflection;
using Aki.Reflection.Patching;
using SPT.Reflection.Patching;
using HarmonyLib;

namespace CWX_MegaMod.PainkillerDesat
Expand All @@ -8,7 +8,7 @@ public class PainkillerDesatScript3 : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(EffectsController.Class577), nameof(EffectsController.Class577.Toggle));
return AccessTools.Method(typeof(EffectsController.Class587), nameof(EffectsController.Class587.Toggle));
}

[PatchPrefix] // removes the wiggle effect from some painkillers
Expand Down
4 changes: 2 additions & 2 deletions src/CWX-MegaMod/PainkillerDesat/PainkillerDesatPatch4.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Reflection;
using Aki.Reflection.Patching;
using SPT.Reflection.Patching;
using HarmonyLib;

namespace CWX_MegaMod.PainkillerDesat
Expand All @@ -8,7 +8,7 @@ public class PainkillerDesatScript4 : ModulePatch
{
protected override MethodBase GetTargetMethod()
{
return AccessTools.Method(typeof(EffectsController.Class568), nameof(EffectsController.Class568.Toggle));
return AccessTools.Method(typeof(EffectsController.Class578), nameof(EffectsController.Class578.Toggle));
}

[PatchPrefix] // removes the double vision effect from some painkillers
Expand Down
2 changes: 1 addition & 1 deletion src/CWX-MegaMod/SpaceUser/SpaceUserFleaPatch.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Linq;
using System.Reflection;
using Aki.Reflection.Patching;
using SPT.Reflection.Patching;
using EFT.UI;
using HarmonyLib;
using UnityEngine;
Expand Down
2 changes: 1 addition & 1 deletion src/CWX-MegaMod/SpaceUser/SpaceUserSplitPatch.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Reflection;
using Aki.Reflection.Patching;
using SPT.Reflection.Patching;
using EFT.UI;
using HarmonyLib;
using UnityEngine;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Reflection;
using Aki.Reflection.Patching;
using SPT.Reflection.Patching;
using Comfort.Common;
using EFT.UI;
using EFT.UI.DragAndDrop;
Expand Down
9 changes: 1 addition & 8 deletions src/CWX-MegaMod/WeathePatcher/WeatherPatcherScopePatch.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Reflection;
using Aki.Reflection.Patching;
using SPT.Reflection.Patching;
using EFT.CameraControl;
using HarmonyLib;

Expand All @@ -17,22 +17,15 @@ public static void PatchPostfix(ref OpticComponentUpdater __instance)
{
if (!WeatherPatcherScript.ScopeRunOnce)
{
WeatherPatcherScript.ScopeGlobalFog = __instance.gameObject.GetComponent<CustomGlobalFog>();
WeatherPatcherScript.ScopeScattering = __instance.gameObject.GetComponent<TOD_Scattering>();
WeatherPatcherScript.ScopeMboit = __instance.gameObject.GetComponent<MBOIT_Scattering>();

MegaMod.LogToScreen($"ScopeGlobalFog was null? {WeatherPatcherScript.ScopeGlobalFog == null}");
MegaMod.LogToScreen($"ScopeScattering was null? {WeatherPatcherScript.ScopeScattering == null}");
MegaMod.LogToScreen($"ScopeMboit was null? {WeatherPatcherScript.ScopeMboit == null}");

WeatherPatcherScript.ScopeRunOnce = true;
}

if (WeatherPatcherScript.ScopeGlobalFog != null)
{
WeatherPatcherScript.ScopeGlobalFog.enabled = !MegaMod.FogRemover.Value;
}

if (WeatherPatcherScript.ScopeScattering != null)
{
WeatherPatcherScript.ScopeScattering.enabled = !MegaMod.FogRemover.Value;
Expand Down
12 changes: 0 additions & 12 deletions src/CWX-MegaMod/WeathePatcher/WeatherPatcherScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,9 @@ public class WeatherPatcherScript : MonoBehaviour
private CameraClass camera;
private WeatherController weatherController;
private float debugFogFloat = 0f;
private CustomGlobalFog globalFog = null;
private TOD_Scattering scattering = null;
private MBOIT_Scattering mboit = null;
public static bool ScopeRunOnce = false;
public static CustomGlobalFog ScopeGlobalFog = null;
public static TOD_Scattering ScopeScattering = null;
public static MBOIT_Scattering ScopeMboit = null;

Expand All @@ -28,22 +26,13 @@ private void Awake()

if (camera.Camera != null)
{
globalFog = camera.Camera.gameObject.GetComponentInChildren<CustomGlobalFog>();
scattering = camera.Camera.gameObject.GetComponentInChildren<TOD_Scattering>();
mboit = camera.Camera.gameObject.GetComponentInChildren<MBOIT_Scattering>();
}
}

public void StartTask()
{
// fog related


if (globalFog != null)
{
globalFog.enabled = !MegaMod.FogRemover.Value;
}

if (scattering != null)
{
scattering.enabled = !MegaMod.FogRemover.Value;
Expand Down Expand Up @@ -80,7 +69,6 @@ public void StartTask()
public void OnDestroy()
{
ScopeRunOnce = false;
ScopeGlobalFog = null;
ScopeScattering = null;
ScopeMboit = null;
}
Expand Down

0 comments on commit 691279a

Please sign in to comment.