diff --git a/SchummelPartie/SchummelPartie.csproj b/SchummelPartie/SchummelPartie.csproj index bc841de..49e7d05 100644 --- a/SchummelPartie/SchummelPartie.csproj +++ b/SchummelPartie/SchummelPartie.csproj @@ -353,6 +353,10 @@ + + + + diff --git a/SchummelPartie/module/ModuleManager.cs b/SchummelPartie/module/ModuleManager.cs index 7bfbcf5..dcf38be 100644 --- a/SchummelPartie/module/ModuleManager.cs +++ b/SchummelPartie/module/ModuleManager.cs @@ -34,6 +34,10 @@ public static void Init() Modules.Add(new ModuleTanks()); Modules.Add(new ModuleSidestepSlope()); Modules.Add(new ModuleSpeedySpotlights()); + Modules.Add(new ModuleDaringDogfight()); + Modules.Add(new ModuleElementalMages()); + Modules.Add(new ModuleCrownCapture()); + Modules.Add(new ModuleExplosiveExchange()); Modules.Add(new ModuleGUI()); // Code to generate markdown for the modules // StringBuilder markdown = new StringBuilder(); diff --git a/SchummelPartie/module/modules/ModuleBomber.cs b/SchummelPartie/module/modules/ModuleBomber.cs index 005fc83..3c2055d 100644 --- a/SchummelPartie/module/modules/ModuleBomber.cs +++ b/SchummelPartie/module/modules/ModuleBomber.cs @@ -10,7 +10,7 @@ public override void OnUpdate() { if (Enabled) { - if (GameManager.Minigame is BattyBatterController bomberController) + if (GameManager.Minigame is BomberController bomberController) { foreach (var player in bomberController.players) { diff --git a/SchummelPartie/module/modules/ModuleCrownCapture.cs b/SchummelPartie/module/modules/ModuleCrownCapture.cs new file mode 100644 index 0000000..27b1946 --- /dev/null +++ b/SchummelPartie/module/modules/ModuleCrownCapture.cs @@ -0,0 +1,55 @@ +using System.Linq; +using System.Reflection; +using SchummelPartie.setting.settings; + +namespace SchummelPartie.module.modules; + +public class ModuleCrownCapture : ModuleMinigame +{ + + public SettingSwitch NoStun; + public SettingSwitch AlwaysCrown; + + public ModuleCrownCapture() : base("Crown Capture", "No Punch Interval, No Stun, Always Crown") + { + NoStun = new(Name, "No Stun", false); + AlwaysCrown = new(Name, "Always Crown", false); + } + + public override void OnUpdate() + { + if (Enabled) + { + if (GameManager.Minigame is BombKingController bombKingController) + { + foreach (var player in bombKingController.players) + { + if (player is BombKingPlayer bombKingPlayer) + { + if (player.IsMe()) + { + if ((bool) NoStun.GetValue()) + { + bombKingPlayer.Stunned = false; + } + if ((bool) AlwaysCrown.GetValue()) + { + if (!bombKingPlayer.HoldingCrown) + { + foreach (var p in bombKingController.players) + { + if (p is BombKingPlayer enemy && enemy.HoldingCrown) + { + enemy.HoldingCrown = false; + } + } + bombKingPlayer.HoldingCrown = true; + } + } + } + } + } + } + } + } +} diff --git a/SchummelPartie/module/modules/ModuleDaringDogfight.cs b/SchummelPartie/module/modules/ModuleDaringDogfight.cs new file mode 100644 index 0000000..82b2143 --- /dev/null +++ b/SchummelPartie/module/modules/ModuleDaringDogfight.cs @@ -0,0 +1,103 @@ +using System; +using System.Linq; +using System.Reflection; +using MelonLoader; +using SchummelPartie.render; +using SchummelPartie.setting.settings; +using UnityEngine; + +namespace SchummelPartie.module.modules; + +public class ModuleDaringDogfight : ModuleMinigame +{ + public SettingSwitch GodMode; + public SettingSwitch KillAll; + public SettingSwitch BurstShot; + public SettingSwitch ESP; + + public ModuleDaringDogfight() : base("Daring Dogfight", "God Mode, Kill All, Burst Shot, ESP.") + { + GodMode = new(Name, "God Mode", false); + KillAll = new(Name, "Kill All", false); + BurstShot = new(Name, "Burst Shot", false); + ESP = new(Name, "Extra Sensory Perception", false); + } + + public override void OnUpdate() + { + if (Enabled && ((bool) GodMode.GetValue() || (bool) KillAll.GetValue())) + { + if (GameManager.Minigame is PlanesController planesController) + { + foreach (var player in planesController.players) + { + if (player is PlanesPlayer planesPlayer) + { + if (player.IsMe()) + { + if ((bool) GodMode.GetValue()) + { + planesPlayer.Health = 5; + } + + if ((bool) KillAll.GetValue()) + { + foreach (var enemy in planesController.players) + { + if (enemy is PlanesPlayer planesEnemy && !enemy.IsDead && !enemy.IsMe()) + { + planesController.TryDamagePlayer(planesPlayer, planesEnemy, enemy.GetPlayerPosition()); + } + } + } + + if ((bool) BurstShot.GetValue()) + { + typeof(PlanesPlayer).GetField("m_fireCooldown", BindingFlags.NonPublic | BindingFlags.Instance).SetValue(planesPlayer, 0f); + } + } + } + } + } + } + } + + public override void OnGUI() + { + base.OnGUI(); + if (Enabled && (bool) ESP.GetValue()) + { + try + { + if (GameManager.Minigame is PlanesController planesController && GameManager.Minigame.Playable) + { + var me = planesController.players.First(player => player.IsMe()); + if (Camera.current != null && me.transform != null) + { + Vector3 mePos = Camera.current.WorldToScreenPoint(me.transform.position); + if (planesController.players is { Count: > 0 }) + { + foreach (var player in planesController.players) + { + if (player is PlanesPlayer && player.transform != null) + { + if (!player.IsDead && (!player.IsOwner || player.GamePlayer.IsAI)) + { + Vector3 playerPos = + Camera.current.WorldToScreenPoint(player.transform.position); + Render.DrawESP(playerPos, 50f, 100f, Color.red, me: mePos, + name: $"[{player.GamePlayer.Name}]"); + } + } + } + } + } + } + } + catch (Exception e) + { + MelonLogger.Error(e.ToString()); + } + } + } +} \ No newline at end of file diff --git a/SchummelPartie/module/modules/ModuleElementalMages.cs b/SchummelPartie/module/modules/ModuleElementalMages.cs new file mode 100644 index 0000000..48163d4 --- /dev/null +++ b/SchummelPartie/module/modules/ModuleElementalMages.cs @@ -0,0 +1,70 @@ +using System; +using System.Reflection; +using MelonLoader; +using SchummelPartie.setting.settings; + +namespace SchummelPartie.module.modules; + +public class ModuleElementalMages : ModuleMinigame +{ + public SettingSwitch InstantPickupCrystal; + public SettingSwitch NoCameraShake; + + public ModuleElementalMages() : base("Elemental Mages", "Instantly pick up crystals and disable camera shake.") + { + InstantPickupCrystal = new(Name, "Instant Pickup Crystal", false); + NoCameraShake = new(Name, "No Camera Shake", false); + } + + public override void OnUpdate() + { + if (Enabled && ((bool) InstantPickupCrystal.GetValue() || (bool) NoCameraShake.GetValue())) + { + if (GameManager.Minigame is ElementalMagesController elementalMagesController) + { + foreach (var player in elementalMagesController.players) + { + if (player is ElementalMagesPlayer elementalMagesPlayer) + { + if (player.IsMe()) + { + if ((bool) InstantPickupCrystal.GetValue()) + { + try + { + foreach (var crystal in elementalMagesController.crystals) + { + elementalMagesController.RPCDespawnCrystal(null, crystal.id, (byte) player.OwnerSlot); + } + } + catch (Exception) + { + // ignored + } + } + + if ((bool) NoCameraShake.GetValue()) + { + FieldInfo cameraShakeField = elementalMagesPlayer.GetType().GetField("cameraShake", + BindingFlags.NonPublic | BindingFlags.Instance); + if (cameraShakeField != null) + { + CameraShake cameraShake = (CameraShake)cameraShakeField.GetValue(elementalMagesPlayer); + if (cameraShake != null) + { + cameraShake.enabled = false; + } + } + else + { + MelonLogger.Error( + $"[{Name}] Could not find field cameraShake in BarnBrawlPlayer."); + } + } + } + } + } + } + } + } +} \ No newline at end of file diff --git a/SchummelPartie/module/modules/ModuleExplosiveExchange.cs b/SchummelPartie/module/modules/ModuleExplosiveExchange.cs new file mode 100644 index 0000000..4df7b8d --- /dev/null +++ b/SchummelPartie/module/modules/ModuleExplosiveExchange.cs @@ -0,0 +1,50 @@ +using System.Linq; +using System.Reflection; +using SchummelPartie.setting.settings; + +namespace SchummelPartie.module.modules; + +public class ModuleExplosiveExchange : ModuleMinigame +{ + + public SettingSwitch NoStun; + public SettingSwitch NoBomb; + + public ModuleExplosiveExchange() : base("Explosive Exchange", "No Punch Interval, No Stun, Always Crown") + { + NoStun = new(Name, "No Stun", false); + NoBomb = new(Name, "No Bomb", false); + } + + public override void OnUpdate() + { + if (Enabled) + { + if (GameManager.Minigame is PassTheBombController passTheBombController) + { + foreach (var player in passTheBombController.players) + { + if (player is PassTheBombPlayer passTheBombPlayer) + { + if (player.IsMe()) + { + if ((bool) NoStun.GetValue()) + { + passTheBombPlayer.Stunned = false; + } + if ((bool) NoBomb.GetValue()) + { + PassTheBombPlayer enemy = (PassTheBombPlayer) passTheBombController.players.FirstOrDefault(p => !p.IsMe() && !p.IsDead); + if (enemy != null) + { + enemy.HoldingBomb = true; + } + passTheBombPlayer.HoldingBomb = false; + } + } + } + } + } + } + } +} diff --git a/SchummelPartie/module/modules/ModuleForcePresent.cs b/SchummelPartie/module/modules/ModuleForcePresent.cs index 95220d8..f07eb79 100644 --- a/SchummelPartie/module/modules/ModuleForcePresent.cs +++ b/SchummelPartie/module/modules/ModuleForcePresent.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Reflection; using HarmonyLib; using MelonLoader; using SchummelPartie.setting.settings; @@ -12,7 +13,7 @@ public class ModuleForcePresent : Module public SettingDropDown ActionID; - public ModuleForcePresent() : base("Force Present", "Forces the present to be the one you want.") + public ModuleForcePresent() : base("Force Present", "Forces the present to be the one you want. (NOT TESTED)") { Instance = this; ActionID = new(Name, "Action ID", new Dictionary @@ -30,13 +31,16 @@ public static class PresentItemPatch [HarmonyPrefix] internal static bool Prefix(PresentItem __instance, ref byte actionID) { - if (ModuleForcePresent.Instance.Enabled) + GamePlayer player = ((GamePlayer) typeof(PresentItem).GetField("player", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(__instance)); + if (player.BoardObject.IsOwner && !player.IsAI) { - MelonLogger.Msg( - $"[{ModuleForcePresent.Instance.Name}] [Client] Force Present ID: {ModuleForcePresent.Instance.ActionID}"); - actionID = (byte) (int) ModuleForcePresent.Instance.ActionID.GetValue(); + if (ModuleForcePresent.Instance.Enabled) + { + MelonLogger.Msg( + $"[{ModuleForcePresent.Instance.Name}] [Client] Force Present ID: {ModuleForcePresent.Instance.ActionID.GetValue()}"); + actionID = (byte) (int) ModuleForcePresent.Instance.ActionID.GetValue(); + } } - return true; } } @@ -45,15 +49,17 @@ internal static bool Prefix(PresentItem __instance, ref byte actionID) public static class NetBehaviourPatch { [HarmonyPrefix] - internal static bool Prefix(string method, NetRPCDelivery delivery, params object[] parameters) + internal static bool Prefix(NetBehaviour __instance, string method, NetRPCDelivery delivery, params object[] parameters) { - if (ModuleForcePresent.Instance.Enabled && method == "RPCOpenPresent") + if (__instance.IsOwner) { - MelonLogger.Msg( - $"[{ModuleForcePresent.Instance.Name}] [Server] Force Present ID: {ModuleForcePresent.Instance.ActionID}"); - parameters[0] = ModuleForcePresent.Instance.ActionID; + if (ModuleForcePresent.Instance.Enabled && method == "RPCOpenPresent") + { + MelonLogger.Msg( + $"[{ModuleForcePresent.Instance.Name}] [Server] Force Present ID: {ModuleForcePresent.Instance.ActionID.GetValue()}"); + parameters[0] = (byte) (int) ModuleForcePresent.Instance.ActionID.GetValue(); + } } - return true; } } \ No newline at end of file diff --git a/SchummelPartie/module/modules/ModuleRythm.cs b/SchummelPartie/module/modules/ModuleRythm.cs index 842d893..57b1bcd 100644 --- a/SchummelPartie/module/modules/ModuleRythm.cs +++ b/SchummelPartie/module/modules/ModuleRythm.cs @@ -56,7 +56,6 @@ internal static bool Prefix(RhythmPlayer __instance) { MelonLogger.Error(e.ToString()); } - } } } diff --git a/SchummelPartie/module/modules/ModuleSwiftShooters.cs b/SchummelPartie/module/modules/ModuleSwiftShooters.cs index 4f75cb7..5635d43 100644 --- a/SchummelPartie/module/modules/ModuleSwiftShooters.cs +++ b/SchummelPartie/module/modules/ModuleSwiftShooters.cs @@ -25,7 +25,7 @@ public static class SwiftShootersPlayerPatch [HarmonyPrefix] internal static bool Prefix(SwiftShootersPlayer __instance) { - if (ModuleSpookySpikes.Instance.Enabled) + if (ModuleSwiftShooters.Instance.Enabled) { if (__instance.IsMe()) { @@ -53,7 +53,7 @@ internal static bool Prefix(SwiftShootersPlayer __instance) [HarmonyPrefix] internal static bool Postfix(SwiftShootersPlayer __instance) { - if (ModuleSpookySpikes.Instance.Enabled) + if (ModuleSwiftShooters.Instance.Enabled) { if (__instance.IsMe()) {