Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Guffs Mod Pack v1.0.0
plugins/ClassicTroopers/ClassicTroopers.dll
Decompiled 4 days agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using ModelReplacement; using ModelReplacement.AvatarBodyUpdater; using PinkGhoulTrooper; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] namespace PinkGhoulTrooper { public sealed class FloorAlignedAvatarUpdater : AvatarUpdater { public override void AssignModelReplacement(GameObject player, GameObject replacement) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) ((AvatarUpdater)this).AssignModelReplacement(player, replacement); base.rootPositionOffset = Vector3.zero; } protected override void UpdateModel() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) ((AvatarUpdater)this).UpdateModel(); Transform avatarTransformFromBoneName = ((AvatarUpdater)this).GetAvatarTransformFromBoneName("spine"); Transform avatarTransformFromBoneName2 = ((AvatarUpdater)this).GetAvatarTransformFromBoneName("toe.L"); Transform avatarTransformFromBoneName3 = ((AvatarUpdater)this).GetAvatarTransformFromBoneName("toe.R"); Transform playerTransformFromBoneName = ((AvatarUpdater)this).GetPlayerTransformFromBoneName("toe.L"); Transform playerTransformFromBoneName2 = ((AvatarUpdater)this).GetPlayerTransformFromBoneName("toe.R"); if (!((Object)(object)avatarTransformFromBoneName == (Object)null) && !((Object)(object)avatarTransformFromBoneName2 == (Object)null) && !((Object)(object)avatarTransformFromBoneName3 == (Object)null) && !((Object)(object)playerTransformFromBoneName == (Object)null) && !((Object)(object)playerTransformFromBoneName2 == (Object)null)) { float num = (playerTransformFromBoneName.position.y + playerTransformFromBoneName2.position.y) * 0.5f; float num2 = (avatarTransformFromBoneName2.position.y + avatarTransformFromBoneName3.position.y) * 0.5f; avatarTransformFromBoneName.position += Vector3.up * (num - num2); } } } } namespace ClassicTroopers { [BepInPlugin("clair.classictroopers", "Classic Troopers Suits", "0.1.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { internal static AssetBundle Bundle; internal static AssetBundle FixedRaiderBundle; private void Awake() { try { Bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "classictroopers")); if (!Object.op_Implicit((Object)(object)Bundle)) { throw new InvalidOperationException("Classic Troopers bundle failed to load"); } FixedRaiderBundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "renegadehairfix")); if (!Object.op_Implicit((Object)(object)FixedRaiderBundle) || !Object.op_Implicit((Object)(object)FixedRaiderBundle.LoadAsset<GameObject>("Assets/Generated/RenegadeRaider.prefab"))) { throw new InvalidOperationException("Missing corrected Renegade bundle"); } string[] array = new string[3] { "AerialAssaultTrooper", "PurpleSkullTrooper", "RenegadeRaider" }; foreach (string text in array) { if (!Object.op_Implicit((Object)(object)Bundle.LoadAsset<GameObject>("Assets/Generated/" + text + ".prefab"))) { throw new InvalidOperationException("Missing character: " + text); } } ModelReplacementAPI.RegisterSuitModelReplacement("Aerial Assault Trooper", typeof(AerialReplacement)); ModelReplacementAPI.RegisterSuitModelReplacement("Purple Skull Trooper", typeof(SkullReplacement)); ModelReplacementAPI.RegisterSuitModelReplacement("Renegade Raider", typeof(RaiderReplacement)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Three Classic Troopers suit models registered; Pink Ghoul is supplied by its preserved 1.0.3 plugin."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)ex); } } } public abstract class TrooperReplacement : BodyReplacementBase { protected abstract string Key { get; } protected override GameObject LoadAssetsAndReturnModel() { return ((Key == "RenegadeRaider") ? Plugin.FixedRaiderBundle : Plugin.Bundle).LoadAsset<GameObject>("Assets/Generated/" + Key + ".prefab"); } protected override AvatarUpdater GetAvatarUpdater() { return (AvatarUpdater)(object)new FloorAlignedAvatarUpdater(); } } public sealed class AerialReplacement : TrooperReplacement { protected override string Key => "AerialAssaultTrooper"; } public sealed class SkullReplacement : TrooperReplacement { protected override string Key => "PurpleSkullTrooper"; } public sealed class RaiderReplacement : TrooperReplacement { protected override string Key => "RenegadeRaider"; } }
plugins/GuffsCarry.dll
Decompiled 4 days agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("GuffsCarry")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("GuffsCarry")] [assembly: AssemblyTitle("GuffsCarry")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace GuffsCarry { [BepInPlugin("guff.guffscarry", "GuffsCarry", "1.0.0")] [BepInProcess("Lethal Company.exe")] public class Plugin : BaseUnityPlugin { internal static ManualLogSource Log; internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<bool> MultipleTwoHanded; internal static ConfigEntry<bool> Weightless; private void Awake() { //IL_0070: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Master switch."); MultipleTwoHanded = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "MultipleTwoHanded", true, "Carry several two-handed items, and switch slots / pick things up while holding one."); Weightless = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Weightless", true, "Carry weight never slows you, drains stamina or lowers your jump."); new Harmony("guff.guffscarry").PatchAll(typeof(Patches)); Log.LogInfo((object)"GuffsCarry 1.0.0 loaded"); } } internal static class Patches { private static bool IsLocal(PlayerControllerB p) { if ((Object)(object)p != (Object)null && (Object)(object)GameNetworkManager.Instance != (Object)null) { return (Object)(object)p == (Object)(object)GameNetworkManager.Instance.localPlayerController; } return false; } private static bool TwoOn(PlayerControllerB p) { if (Plugin.Enabled.Value && Plugin.MultipleTwoHanded.Value) { return IsLocal(p); } return false; } private static bool WeightOn(PlayerControllerB p) { if (Plugin.Enabled.Value && Plugin.Weightless.Value) { return IsLocal(p); } return false; } private static void ClearTwoHanded(PlayerControllerB __instance) { if (TwoOn(__instance)) { __instance.twoHanded = false; } } [HarmonyPatch(typeof(PlayerControllerB), "BeginGrabObject")] [HarmonyPrefix] private static void BeginGrab(PlayerControllerB __instance) { ClearTwoHanded(__instance); } [HarmonyPatch(typeof(PlayerControllerB), "Interact_performed")] [HarmonyPrefix] private static void Interact(PlayerControllerB __instance) { ClearTwoHanded(__instance); } [HarmonyPatch(typeof(PlayerControllerB), "ScrollMouse_performed")] [HarmonyPrefix] private static void Scroll(PlayerControllerB __instance) { ClearTwoHanded(__instance); } [HarmonyPatch(typeof(PlayerControllerB), "SetHoverTipAndCurrentInteractTrigger")] [HarmonyPrefix] private static void Hover(PlayerControllerB __instance) { ClearTwoHanded(__instance); } [HarmonyPatch(typeof(PlayerControllerB), "SwitchToItemSlot")] [HarmonyPostfix] private static void Switched(PlayerControllerB __instance) { ClearTwoHanded(__instance); } [HarmonyPatch(typeof(PlayerControllerB), "GrabObjectClientRpc")] [HarmonyPostfix] private static void Grabbed(PlayerControllerB __instance) { ClearTwoHanded(__instance); } private static void WeightPre(PlayerControllerB p, out float state) { state = float.NaN; if (WeightOn(p)) { state = p.carryWeight; p.carryWeight = 1f; } } private static void WeightPost(PlayerControllerB p, float state) { if (!float.IsNaN(state)) { float num = p.carryWeight - 1f; p.carryWeight = Mathf.Max(1f, state + num); } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPrefix] [HarmonyPriority(800)] private static void UpdPre(PlayerControllerB __instance, out float __state) { ClearTwoHanded(__instance); WeightPre(__instance, out __state); } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] [HarmonyPriority(0)] private static void UpdPost(PlayerControllerB __instance, float __state) { WeightPost(__instance, __state); } [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] [HarmonyPrefix] [HarmonyPriority(800)] private static void LatePre(PlayerControllerB __instance, out float __state) { WeightPre(__instance, out __state); } [HarmonyPatch(typeof(PlayerControllerB), "LateUpdate")] [HarmonyPostfix] [HarmonyPriority(0)] private static void LatePost(PlayerControllerB __instance, float __state) { WeightPost(__instance, __state); } [HarmonyPatch(typeof(PlayerControllerB), "Jump_performed")] [HarmonyPrefix] [HarmonyPriority(800)] private static void JumpPre(PlayerControllerB __instance, out float __state) { WeightPre(__instance, out __state); } [HarmonyPatch(typeof(PlayerControllerB), "Jump_performed")] [HarmonyPostfix] [HarmonyPriority(0)] private static void JumpPost(PlayerControllerB __instance, float __state) { WeightPost(__instance, __state); } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPrefix] private static void PJPre(object __instance, out float __state) { WeightPre(Traverse.Create(__instance).Field("<>4__this").GetValue<PlayerControllerB>(), out __state); } [HarmonyPatch(/*Could not decode attribute arguments.*/)] [HarmonyPostfix] private static void PJPost(object __instance, float __state) { PlayerControllerB value = Traverse.Create(__instance).Field("<>4__this").GetValue<PlayerControllerB>(); if ((Object)(object)value != (Object)null) { WeightPost(value, __state); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "guff.guffscarry"; public const string PLUGIN_NAME = "GuffsCarry"; public const string PLUGIN_VERSION = "1.0.0"; } }
plugins/GuffsCasinoPeek.dll
Decompiled 4 days agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalCasino; using LethalCasino.Config; using LethalCasino.Custom; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("GuffsCasinoPeek")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("GuffsCasinoPeek")] [assembly: AssemblyTitle("GuffsCasinoPeek")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace GuffsCasinoPeek { internal class PeekController : MonoBehaviour { private static readonly Type TBlackjack = AccessTools.TypeByName("LethalCasino.Custom.Blackjack"); private static readonly Type TSlot = AccessTools.TypeByName("LethalCasino.Custom.SlotMachine"); private static readonly Type TRoulette = AccessTools.TypeByName("LethalCasino.Custom.Roulette"); private static readonly Type TWheel = AccessTools.TypeByName("LethalCasino.Custom.TheWheel"); private static readonly Type TCustomPlayer = AccessTools.TypeByName("LethalCasino.Custom.CustomPlayerController"); private static readonly FieldInfo BjDeck = F(TBlackjack, "deck"); private static readonly FieldInfo BjDealerCards = F(TBlackjack, "dealerCards"); private static readonly FieldInfo BjPlayerCards = F(TBlackjack, "playerCards"); private static readonly FieldInfo BjPlayers = F(TBlackjack, "gamblingPlayers"); private static readonly FieldInfo BjInProgress = F(TBlackjack, "gameInProgress"); private static readonly FieldInfo BjDealerTurn = F(TBlackjack, "isDealerTurn"); private static readonly FieldInfo BjCompleted = F(TBlackjack, "playerCompletedTurn"); private static readonly FieldInfo SlGamble = F(TSlot, "gambleInProgress"); private static readonly FieldInfo SlOutcome = F(TSlot, "resultOutcome"); private static readonly FieldInfo SlPlayer = F(TSlot, "gamblingPlayer"); private static readonly FieldInfo RoSpinning = F(TRoulette, "isWheelSpinning"); private static readonly FieldInfo RoResult = F(TRoulette, "resultNumber"); private static readonly FieldInfo RoBetNumbers = F(TRoulette, "gambledScrapNumbers"); private static readonly FieldInfo RoBetOwners = F(TRoulette, "gambledScrapOwners"); private static readonly FieldInfo WhSpinning = F(TWheel, "isWheelSpinning"); private static readonly FieldInfo WhTarget = F(TWheel, "targetWheelRotation"); private static readonly FieldInfo WhSlices = F(TWheel, "wheelSlices"); private static readonly FieldInfo WhPlayer = F(TWheel, "gamblingPlayer"); private static readonly FieldInfo CpLuck = F(TCustomPlayer, "luckiness"); private const float WheelSliceDeg = 16.363636f; private static readonly HashSet<int> RedNumbers = new HashSet<int> { 1, 3, 5, 7, 9, 12, 14, 16, 18, 19, 21, 23, 25, 27, 30, 32, 34, 36 }; private readonly List<Component> _blackjacks = new List<Component>(); private readonly List<Component> _slots = new List<Component>(); private readonly List<Component> _roulettes = new List<Component>(); private readonly List<Component> _wheels = new List<Component>(); private float _nextScan; private string _text = ""; private GUIStyle _style; private GUIStyle _box; private bool _warnedMissing; private static bool IsHost { get { if ((Object)(object)NetworkManager.Singleton != (Object)null) { return NetworkManager.Singleton.IsServer; } return false; } } private static FieldInfo F(Type t, string name) { if (!(t == null)) { return AccessTools.Field(t, name); } return null; } private static T Get<T>(FieldInfo f, object o, T fallback = default(T)) { try { if (f == null || o == null) { return fallback; } return (f.GetValue(o) is T val) ? val : fallback; } catch { return fallback; } } private void Update() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) Keyboard current = Keyboard.current; if (current != null && (int)Plugin.ToggleKey.Value != 0) { try { if (((ButtonControl)current[Plugin.ToggleKey.Value]).wasPressedThisFrame && !TypingOrMenu()) { Plugin.ShowOverlay.Value = !Plugin.ShowOverlay.Value; } } catch { } } if (!_warnedMissing && (TBlackjack == null || TSlot == null || TRoulette == null || TWheel == null)) { _warnedMissing = true; Plugin.Log.LogWarning((object)"Some LethalCasino types were not found; this LethalCasino version may be unsupported (built for 1.1.3)."); } if (!Plugin.ShowOverlay.Value) { _text = ""; return; } if (Time.unscaledTime >= _nextScan) { _nextScan = Time.unscaledTime + 1f; Scan(TBlackjack, _blackjacks); Scan(TSlot, _slots); Scan(TRoulette, _roulettes); Scan(TWheel, _wheels); } try { _text = BuildText(); } catch (Exception ex) { _text = ""; Plugin.Log.LogDebug((object)ex); } } private static bool TypingOrMenu() { PlayerControllerB val = LocalPlayer(); if ((Object)(object)val == (Object)null) { return false; } if (!val.isTypingChat && !val.inTerminalMenu) { if ((Object)(object)val.quickMenuManager != (Object)null) { return val.quickMenuManager.isMenuOpen; } return false; } return true; } private static void Scan(Type t, List<Component> list) { list.Clear(); if (t == null) { return; } Object[] array = Object.FindObjectsOfType(t); foreach (Object obj in array) { Component val = (Component)(object)((obj is Component) ? obj : null); if (val != null && (Object)(object)val != (Object)null) { list.Add(val); } } } private static PlayerControllerB LocalPlayer() { GameNetworkManager instance = GameNetworkManager.Instance; if (!((Object)(object)instance != (Object)null)) { return null; } return instance.localPlayerController; } private static Vector3? ViewPos(PlayerControllerB local) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)local == (Object)null) { return null; } if (local.isPlayerDead && (Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)StartOfRound.Instance.activeCamera != (Object)null) { return ((Component)StartOfRound.Instance.activeCamera).transform.position; } return ((Component)local).transform.position; } private string BuildText() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB local = LocalPlayer(); Vector3? val = ViewPos(local); if (!val.HasValue) { return ""; } float value = Plugin.Range.Value; StringBuilder stringBuilder = new StringBuilder(); if (Plugin.PeekBlackjack.Value) { foreach (Component item in Near(_blackjacks, val.Value, value)) { BlackjackPanel(stringBuilder, item, local); } } if (Plugin.PeekSlots.Value) { List<Component> list = Near(_slots, val.Value, value).ToList(); if (list.Count > 0) { SlotsPanel(stringBuilder, list, local); } } if (Plugin.PeekRoulette.Value) { foreach (Component item2 in Near(_roulettes, val.Value, value)) { RoulettePanel(stringBuilder, item2, local); } } if (Plugin.PeekWheel.Value) { foreach (Component item3 in Near(_wheels, val.Value, value)) { WheelPanel(stringBuilder, item3, local); } } if (stringBuilder.Length == 0) { return ""; } stringBuilder.Insert(0, string.Format("<b>Casino Peek</b> <color=#888888>({0} · {1} hides)</color>\n", IsHost ? "host" : "client", Plugin.ToggleKey.Value)); return stringBuilder.ToString().TrimEnd(); } private static IEnumerable<Component> Near(List<Component> list, Vector3 pos, float range) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return from c in list where (Object)(object)c != (Object)null && Vector3.Distance(c.transform.position, pos) <= range orderby Vector3.Distance(c.transform.position, pos) select c; } private static string CardStr(Card c) { if (c == null) { return "?"; } return string.Concat(str1: c.suit switch { "Hearts" => "<color=#ff6666>♥</color>", "Diamonds" => "<color=#ff6666>♦</color>", "Spades" => "♠", "Clubs" => "♣", _ => c.suit, }, str0: c.face); } private static int HandValue(IEnumerable<Card> cards) { int num = 0; bool flag = false; foreach (Card card in cards) { int minValue = card.GetMinValue(); num += minValue; if (minValue == 1) { flag = true; } } if (!flag || num + 10 > 21) { return num; } return num + 10; } private static string Hand(List<Card> cards) { if (cards != null && cards.Count != 0) { return string.Join(" ", cards.Select(CardStr)) + $" = <b>{HandValue(cards)}</b>"; } return "-"; } private void BlackjackPanel(StringBuilder sb, Component bj, PlayerControllerB local) { sb.AppendLine("<b><color=#ffd24d>BLACKJACK</color></b>"); bool num = Get(BjInProgress, bj, fallback: false); List<Card> list = Get<List<Card>>(BjDealerCards, bj); PlayerControllerB[] array = Get<PlayerControllerB[]>(BjPlayers, bj); List<Card>[] array2 = Get<List<Card>[]>(BjPlayerCards, bj); bool[] array3 = Get<bool[]>(BjCompleted, bj); bool flag = Get(BjDealerTurn, bj, fallback: false); List<Card> list2 = Get<List<Card>>(BjDeck, bj); if (!num || list == null || list.Count == 0) { sb.AppendLine(" Waiting for Deal. The deck is shuffled on the host when Deal is pressed."); sb.AppendLine(); return; } sb.AppendLine(" Dealer: " + Hand(list) + ((list.Count >= 1 && !flag) ? " <color=#aaaaaa>(hole card revealed)</color>" : "")); int num2 = -1; int num3 = 0; if (array != null) { for (int i = 0; i < array.Length; i++) { if (!((Object)(object)array[i] == (Object)null)) { if ((Object)(object)array[i] == (Object)(object)local) { num2 = i; } else if (array3 == null || i >= array3.Length || !array3[i]) { num3++; } } } } List<Card> list3 = ((num2 >= 0 && array2 != null && num2 < array2.Length) ? array2[num2] : null); if (list3 != null) { sb.AppendLine(" You: " + Hand(list3)); } if (list2 == null || list2.Count <= 0) { sb.AppendLine(" <color=#aaaaaa>Next cards: only visible when you are the host.</color>"); sb.AppendLine(); return; } int num4 = Mathf.Min(Plugin.NextCardsShown.Value, list2.Count); if (num4 > 0) { List<string> list4 = new List<string>(); for (int j = 0; j < num4; j++) { list4.Add(CardStr(list2[list2.Count - 1 - j])); } sb.AppendLine(" Next cards: " + string.Join(", ", list4)); } if (flag) { var (v, list5) = SimDealer(list, list2, 0); sb.AppendLine(" Dealer will draw " + ((list5.Count == 0) ? "nothing" : string.Join(" ", list5.Select(CardStr))) + " → <b>" + Fmt(v) + "</b>"); } else if (list3 != null && list3.Count > 0 && (array3 == null || num2 >= array3.Length || !array3[num2])) { PlanForMe(sb, list3, list, list2, local); if (num3 > 0) { sb.AppendLine($" <color=#ffaa55>{num3} other player(s) still playing: any card they take first shifts these predictions.</color>"); } } sb.AppendLine(); } private static string Fmt(int v) { if (v <= 21) { return v.ToString(); } return $"{v} BUST"; } private static (int final, List<Card> draws) SimDealer(List<Card> dealer, List<Card> deck, int skip) { List<Card> list = new List<Card>(dealer); List<Card> list2 = new List<Card>(); int num = deck.Count - 1 - skip; while (HandValue(list) < 17 && num >= 0) { list.Add(deck[num]); list2.Add(deck[num]); num--; } return (final: HandValue(list), draws: list2); } private void PlanForMe(StringBuilder sb, List<Card> myHand, List<Card> dealer, List<Card> deck, PlayerControllerB local) { string text = null; int num = -1; List<Card> list = new List<Card>(myHand); for (int i = 0; i <= 5 && i <= deck.Count; i++) { if (i > 0) { list.Add(deck[deck.Count - i]); } int num2 = HandValue(list); string text2 = ((i == 0) ? "Stand now" : string.Format("Hit {0}× ({1})", i, string.Join(" ", list.Skip(myHand.Count).Select(CardStr)))); if (num2 > 21) { string arg = LuckNote(local); sb.AppendLine($" {text2}: you {num2} <color=#ff5555>BUST</color>{arg}"); break; } int item = SimDealer(dealer, deck, i).final; string text3; int num3; if (item > 21 || num2 > item) { text3 = "<color=#55ff55>WIN</color>"; num3 = 2; } else if (num2 == item) { text3 = "<color=#ffff55>PUSH</color>"; num3 = 1; } else { text3 = "<color=#ff5555>LOSE</color>"; num3 = 0; } sb.AppendLine($" {text2}: you {num2} vs dealer {Fmt(item)} → {text3}"); if (num3 > num) { num = num3; text = text2; } } if (text != null) { sb.AppendLine(" <b>Best: " + text + "</b>"); } } private static string LuckNote(PlayerControllerB local) { try { Dictionary<string, float> dictionary = Plugin.configFile?.configValues; if (dictionary == null) { return ""; } float value; float num = (dictionary.TryGetValue(Constants.BLACKJACK_LUCKINESS, out value) ? value : 0f); float value2; float num2 = (dictionary.TryGetValue(Constants.PIPE_LUCKINESS, out value2) ? value2 : 0f); float num3 = 0f; if (TCustomPlayer != null && (Object)(object)local != (Object)null) { Component component = ((Component)local).GetComponent(TCustomPlayer); if ((Object)(object)component != (Object)null) { num3 = Get(CpLuck, component, 0f); } } float num4 = num + num3 * 2f * num2 / 100f; return (num4 > 0f) ? $" <color=#aaaaaa>({num4:0.#}% luck chance to swap in a safe card)</color>" : ""; } catch { return ""; } } private static string SlotOutcome(string o) { return o switch { "three_sevens" => "<color=#55ff55>THREE 7s → x10</color>", "three_bars" => "<color=#55ff55>THREE BARS → x3</color>", "three_bells" => "<color=#55ff55>THREE BELLS → x3</color>", "three_fruits" => "<color=#55ff55>THREE FRUITS → x2</color>", "two_match" => "<color=#ffff55>PAIR → x1.5</color>", "no_matches" => "<color=#ff9955>NO MATCH → x0.5</color>", "three_skulls" => "<color=#ff5555>THREE SKULLS → lose all</color>", _ => o ?? "?", }; } private void SlotsPanel(StringBuilder sb, List<Component> slots, PlayerControllerB local) { sb.AppendLine("<b><color=#ffd24d>SLOTS</color></b>"); int num = 1; foreach (Component slot in slots) { if (Get(SlGamble, slot, fallback: false)) { PlayerControllerB val = Get<PlayerControllerB>(SlPlayer, slot); string arg = (((Object)(object)val == (Object)null) ? "" : (((Object)(object)val == (Object)(object)local) ? " (you)" : (" (" + val.playerUsername + ")"))); sb.AppendLine($" Machine {num}{arg}: {SlotOutcome(Get<string>(SlOutcome, slot))}"); } else { sb.AppendLine($" Machine {num}: idle"); } num++; } sb.AppendLine(" <color=#aaaaaa>Rolled on the host at the moment you pull. All machines have the same odds; result shows as soon as the reels start.</color>"); sb.AppendLine(); } private void RoulettePanel(StringBuilder sb, Component r, PlayerControllerB local) { sb.AppendLine("<b><color=#ffd24d>ROULETTE</color></b>"); if (!Get(RoSpinning, r, fallback: false)) { sb.AppendLine(" Not spinning. The number is picked on the host when Spin is pressed."); sb.AppendLine(); return; } int num = Get(RoResult, r, 0); string arg = ((num == 0) ? "<color=#55ff55>green</color>" : (RedNumbers.Contains(num) ? "<color=#ff5555>red</color>" : "black")); sb.AppendLine($" Ball will land on <b>{num}</b> ({arg})"); IDictionary dictionary = Get<IDictionary>(RoBetNumbers, r); IDictionary dictionary2 = Get<IDictionary>(RoBetOwners, r); if (dictionary != null && dictionary2 != null && dictionary.Count > 0) { int num2 = 0; int num3 = 0; foreach (DictionaryEntry item in dictionary) { if (!dictionary2.Contains(item.Key)) { continue; } object? obj = dictionary2[item.Key]; PlayerControllerB val = (PlayerControllerB)((obj is PlayerControllerB) ? obj : null); if (val != null && !((Object)(object)val != (Object)(object)local)) { if (item.Value is int[] source && source.Contains(num)) { num2++; } else { num3++; } } } if (num2 + num3 > 0) { sb.AppendLine($" Your bets: <color=#55ff55>{num2} win</color>, <color=#ff5555>{num3} lose</color>"); } } sb.AppendLine(); } private void WheelPanel(StringBuilder sb, Component w, PlayerControllerB local) { sb.AppendLine("<b><color=#ffd24d>THE WHEEL</color></b>"); if (!Get(WhSpinning, w, fallback: false)) { sb.AppendLine(" Not spinning. The slice is picked on the host when you spin."); sb.AppendLine(); return; } float num = Get(WhTarget, w, 0f); string[] array = Get<string[]>(WhSlices, w); int num2 = ((array != null) ? array.Length : 22); int num3 = Mathf.FloorToInt(((num % 360f + 360f) % 360f + 8.181818f) / 16.363636f) % num2; string text = ((array != null && num3 >= 0 && num3 < array.Length) ? array[num3] : $"slice {num3}"); PlayerControllerB val = Get<PlayerControllerB>(WhPlayer, w); string text2 = (((Object)(object)val == (Object)null) ? "" : (((Object)(object)val == (Object)(object)local) ? " (you)" : (" (" + val.playerUsername + ")"))); object obj; switch (text) { default: obj = "#ffff55"; break; case "+500": case "+250": obj = "#55ff55"; break; case "+0": obj = "#ff5555"; break; } string text3 = (string)obj; sb.AppendLine(" Will land on <b><color=" + text3 + ">" + text + "</color></b>" + text2); sb.AppendLine(); } private void OnGUI() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) if (!string.IsNullOrEmpty(_text) && Plugin.ShowOverlay.Value) { if (_style == null || _style.fontSize != Plugin.FontSize.Value) { _style = new GUIStyle(GUI.skin.label) { richText = true, fontSize = Plugin.FontSize.Value, wordWrap = true }; _style.normal.textColor = Color.white; _box = new GUIStyle(GUI.skin.box); } float num = Mathf.Min(560f, (float)Screen.width - Plugin.PanelX.Value - 10f); GUIContent val = new GUIContent(_text); float num2 = _style.CalcHeight(val, num - 20f); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(Plugin.PanelX.Value, Plugin.PanelY.Value, num, num2 + 16f); Color color = GUI.color; GUI.color = new Color(0f, 0f, 0f, 0.75f); GUI.Box(val2, GUIContent.none, _box); GUI.color = color; GUI.Label(new Rect(((Rect)(ref val2)).x + 10f, ((Rect)(ref val2)).y + 8f, num - 20f, num2), val, _style); } } } [BepInPlugin("guff.guffscasinopeek", "GuffsCasinoPeek", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInProcess("Lethal Company.exe")] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "guff.guffscasinopeek"; public const string PluginName = "GuffsCasinoPeek"; public const string PluginVersion = "1.0.0"; public const string LethalCasinoGuid = "mrgrm7.LethalCasino"; internal static ManualLogSource Log; internal static ConfigEntry<bool> ShowOverlay; internal static ConfigEntry<Key> ToggleKey; internal static ConfigEntry<float> Range; internal static ConfigEntry<int> NextCardsShown; internal static ConfigEntry<bool> PeekBlackjack; internal static ConfigEntry<bool> PeekSlots; internal static ConfigEntry<bool> PeekRoulette; internal static ConfigEntry<bool> PeekWheel; internal static ConfigEntry<float> PanelX; internal static ConfigEntry<float> PanelY; internal static ConfigEntry<int> FontSize; private void Awake() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Expected O, but got Unknown //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Expected O, but got Unknown //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Expected O, but got Unknown //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; ShowOverlay = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowOverlay", true, "Overlay is visible (toggled in game with ToggleKey; remembered)."); ToggleKey = ((BaseUnityPlugin)this).Config.Bind<Key>("General", "ToggleKey", (Key)101, "Show/hide the overlay. Unity Input System key name."); Range = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Range", 7f, new ConfigDescription("Show a game's panel when you are within this many meters of it.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 50f), Array.Empty<object>())); NextCardsShown = ((BaseUnityPlugin)this).Config.Bind<int>("Blackjack", "NextCardsShown", 6, new ConfigDescription("How many upcoming deck cards to list (host only).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 20), Array.Empty<object>())); PeekBlackjack = ((BaseUnityPlugin)this).Config.Bind<bool>("Games", "Blackjack", true, "Show the Blackjack panel."); PeekSlots = ((BaseUnityPlugin)this).Config.Bind<bool>("Games", "Slots", true, "Show the slot machine panel."); PeekRoulette = ((BaseUnityPlugin)this).Config.Bind<bool>("Games", "Roulette", true, "Show the Roulette panel."); PeekWheel = ((BaseUnityPlugin)this).Config.Bind<bool>("Games", "TheWheel", true, "Show The Wheel panel."); PanelX = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "PanelX", 20f, "Panel left edge in pixels."); PanelY = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "PanelY", 160f, "Panel top edge in pixels."); FontSize = ((BaseUnityPlugin)this).Config.Bind<int>("UI", "FontSize", 16, new ConfigDescription("Overlay font size.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 40), Array.Empty<object>())); GameObject val = new GameObject("GuffsCasinoPeek"); Object.DontDestroyOnLoad((Object)val); ((Object)val).hideFlags = (HideFlags)61; val.AddComponent<PeekController>(); Log.LogInfo((object)string.Format("{0} {1} loaded (read-only peek; toggle {2}).", "GuffsCasinoPeek", "1.0.0", ToggleKey.Value)); } } }
plugins/GuffsFullbright.dll
Decompiled 4 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("GuffsFullbright")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.2.0.0")] [assembly: AssemblyInformationalVersion("1.2.0")] [assembly: AssemblyProduct("GuffsFullbright")] [assembly: AssemblyTitle("GuffsFullbright")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace GuffsFullbright { internal class FullbrightController : MonoBehaviour { private int _level; private int _lastLevel; private GameObject _lightObj; private Light _light; private HDAdditionalLightData _hdLight; private Camera _attachedCam; private GameObject _fogObj; private Volume _fogVolume; private string _msg; private float _msgTime = -100f; private const float MsgDuration = 2f; private GUIStyle _style; private float _nextFogScan; private LocalVolumetricFog[] _localFogs; private bool _fogErrLogged; private bool Active => _level > 0; private void Start() { int num = Mathf.Max(1, Plugin.Levels.Value); if (Plugin.RememberChanges.Value) { _level = Mathf.Clamp(Plugin.Level.Value, 0, num); _lastLevel = Mathf.Clamp(Plugin.LastLevel.Value, 0, num); } else { _level = 0; _lastLevel = 0; } CreateFogVolume(); } private float CurrentIntensity() { int num = Mathf.Max(1, Plugin.Levels.Value); if (_level <= 0) { return 0f; } float num2 = Mathf.Max(1f, Plugin.Level1Intensity.Value); float num3 = Mathf.Max(num2, Plugin.MaxIntensity.Value); if (num == 1) { return num3; } float num4 = ((float)Mathf.Clamp(_level, 1, num) - 1f) / ((float)num - 1f); return num2 * Mathf.Pow(num3 / num2, num4); } private static PlayerControllerB LocalPlayer() { GameNetworkManager instance = GameNetworkManager.Instance; if (!((Object)(object)instance != (Object)null)) { return null; } return instance.localPlayerController; } private static Camera TargetCamera(PlayerControllerB local) { if ((Object)(object)local == (Object)null) { return null; } if (local.isPlayerDead) { StartOfRound instance = StartOfRound.Instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.spectateCamera != (Object)null) { return instance.spectateCamera; } } return local.gameplayCamera; } private static bool InputBlocked(PlayerControllerB local) { if ((Object)(object)local == (Object)null) { return false; } if (local.isTypingChat || local.inTerminalMenu) { return true; } if ((Object)(object)local.quickMenuManager != (Object)null && local.quickMenuManager.isMenuOpen) { return true; } return false; } private static bool Pressed(Keyboard kb, Key key) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) if ((int)key == 0) { return false; } try { return ((ButtonControl)kb[key]).wasPressedThisFrame; } catch { return false; } } private void Update() { PlayerControllerB local = LocalPlayer(); HandleInput(local); UpdateLight(local); KillFog(local); } private void LateUpdate() { KillFog(LocalPlayer()); } private void KillFog(PlayerControllerB local) { try { if (RenderSettings.fog) { RenderSettings.fog = false; } if ((Object)(object)_fogVolume == (Object)null) { CreateFogVolume(); } if ((Object)(object)_fogVolume != (Object)null) { _fogVolume.weight = 1f; _fogVolume.priority = 100000f; if (!_fogObj.activeSelf) { _fogObj.SetActive(true); } if (!((Behaviour)_fogVolume).enabled) { ((Behaviour)_fogVolume).enabled = true; } MatchVolumeLayer(TargetCamera(local)); MatchVolumeLayer(Camera.main); } if (Time.unscaledTime >= _nextFogScan) { _nextFogScan = Time.unscaledTime + 0.25f; _localFogs = Object.FindObjectsOfType<LocalVolumetricFog>(true); } if (_localFogs == null) { return; } LocalVolumetricFog[] localFogs = _localFogs; foreach (LocalVolumetricFog val in localFogs) { if ((Object)(object)val != (Object)null && ((Behaviour)val).enabled) { ((Behaviour)val).enabled = false; } } } catch (Exception ex) { if (!_fogErrLogged) { _fogErrLogged = true; Plugin.Log.LogWarning((object)("Fog removal error: " + ex.Message)); } } } private void HandleInput(PlayerControllerB local) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) Keyboard current = Keyboard.current; if (current == null || !Application.isFocused || InputBlocked(local)) { return; } int num = Mathf.Max(1, Plugin.Levels.Value); bool flag = false; if (Pressed(current, Plugin.ToggleKey.Value)) { if (_level > 0) { _lastLevel = _level; _level = 0; } else { _level = ((_lastLevel <= 0) ? 1 : Mathf.Min(_lastLevel, num)); } flag = true; } if (Pressed(current, Plugin.BrighterKey.Value) || Pressed(current, (Key)80)) { _level = Mathf.Min(num, _level + 1); flag = true; } if (Pressed(current, Plugin.DimmerKey.Value) || Pressed(current, (Key)81)) { _level = Mathf.Max(0, _level - 1); flag = true; } if (flag) { if (_level > 0) { _lastLevel = _level; } if (Plugin.RememberChanges.Value) { Plugin.Level.Value = _level; Plugin.LastLevel.Value = _lastLevel; } _msg = (Active ? $"Fullbright ON — level {_level}/{num}" : "Fullbright: normal (game default)"); _msgTime = Time.unscaledTime; Plugin.Log.LogInfo((object)_msg); } } private void UpdateLight(PlayerControllerB local) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) Camera val = (Active ? TargetCamera(local) : null); if ((Object)(object)val == (Object)null) { if ((Object)(object)_lightObj != (Object)null) { _lightObj.SetActive(false); } return; } if ((Object)(object)_lightObj == (Object)null) { CreateLight(); } if ((Object)(object)_attachedCam != (Object)(object)val || (Object)(object)_lightObj.transform.parent != (Object)(object)((Component)val).transform) { _lightObj.transform.SetParent(((Component)val).transform, false); _lightObj.transform.localPosition = Vector3.zero; _lightObj.transform.localRotation = Quaternion.identity; _attachedCam = val; } if (!_lightObj.activeSelf) { _lightObj.SetActive(true); } float num = CurrentIntensity(); float value = Plugin.Range.Value; if (!Mathf.Approximately(_light.intensity, num)) { _light.intensity = num; } if (!Mathf.Approximately(_light.range, value)) { _light.range = value; if ((Object)(object)_hdLight != (Object)null) { _hdLight.range = value; } } } private void CreateLight() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) _lightObj = new GameObject("GuffsFullbrightLight"); _lightObj.SetActive(false); _light = _lightObj.AddComponent<Light>(); _light.type = (LightType)2; _light.shadows = (LightShadows)0; _light.color = Color.white; _light.range = Plugin.Range.Value; _hdLight = _lightObj.AddComponent<HDAdditionalLightData>(); try { _hdLight.EnableShadows(false); _hdLight.affectsVolumetric = false; _hdLight.volumetricDimmer = 0f; _hdLight.fadeDistance = 100000f; _hdLight.range = Plugin.Range.Value; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Couldn't set HDRP light options: " + ex.Message)); } _light.intensity = CurrentIntensity(); _attachedCam = null; } private void CreateFogVolume() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown try { _fogObj = new GameObject("GuffsFullbrightFogVolume"); Object.DontDestroyOnLoad((Object)(object)_fogObj); ((Object)_fogObj).hideFlags = (HideFlags)61; _fogVolume = _fogObj.AddComponent<Volume>(); _fogVolume.isGlobal = true; _fogVolume.priority = 1000f; _fogVolume.weight = 1f; VolumeProfile val = ScriptableObject.CreateInstance<VolumeProfile>(); Fog obj = val.Add<Fog>(false); ((VolumeParameter<bool>)(object)obj.enabled).Override(false); ((VolumeParameter<bool>)(object)obj.enableVolumetricFog).Override(false); _fogVolume.sharedProfile = val; } catch (Exception ex) { Plugin.Log.LogWarning((object)("Fog override unavailable: " + ex.Message)); _fogVolume = null; } } private void MatchVolumeLayer(Camera cam) { if ((Object)(object)_fogObj == (Object)null || (Object)(object)cam == (Object)null) { return; } HDAdditionalCameraData component = ((Component)cam).GetComponent<HDAdditionalCameraData>(); if ((Object)(object)component == (Object)null) { return; } int value = ((LayerMask)(ref component.volumeLayerMask)).value; if ((value & (1 << _fogObj.layer)) != 0) { return; } for (int i = 0; i < 32; i++) { if ((value & (1 << i)) != 0) { _fogObj.layer = i; break; } } } private void OnGUI() { //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown if (!Plugin.ShowFeedback.Value || string.IsNullOrEmpty(_msg)) { return; } float num = Time.unscaledTime - _msgTime; if (!(num > 2f)) { float num2 = ((num < 1.5f) ? 1f : Mathf.Clamp01((2f - num) / 0.5f)); if (_style == null) { _style = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = Mathf.Max(18, Screen.height / 40), fontStyle = (FontStyle)1 }; } Rect val = default(Rect); ((Rect)(ref val))..ctor(0f, (float)Screen.height * 0.12f, (float)Screen.width, 40f); Color color = GUI.color; GUI.color = new Color(0f, 0f, 0f, 0.8f * num2); GUI.Label(new Rect(((Rect)(ref val)).x + 2f, ((Rect)(ref val)).y + 2f, ((Rect)(ref val)).width, ((Rect)(ref val)).height), _msg, _style); GUI.color = new Color(1f, 0.95f, 0.6f, num2); GUI.Label(val, _msg, _style); GUI.color = color; } } private void OnDestroy() { if ((Object)(object)_lightObj != (Object)null) { Object.Destroy((Object)(object)_lightObj); } if ((Object)(object)_fogObj != (Object)null) { Object.Destroy((Object)(object)_fogObj); } } } [BepInPlugin("guff.guffsfullbright", "GuffsFullbright", "1.2.0")] [BepInProcess("Lethal Company.exe")] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "guff.guffsfullbright"; public const string PluginName = "GuffsFullbright"; public const string PluginVersion = "1.2.0"; internal static ManualLogSource Log; private const int CurrentConfigVersion = 3; internal static ConfigEntry<int> Level; internal static ConfigEntry<int> LastLevel; internal static ConfigEntry<bool> RememberChanges; internal static ConfigEntry<int> Levels; internal static ConfigEntry<float> Level1Intensity; internal static ConfigEntry<float> MaxIntensity; internal static ConfigEntry<float> Range; internal static ConfigEntry<Key> ToggleKey; internal static ConfigEntry<Key> BrighterKey; internal static ConfigEntry<Key> DimmerKey; internal static ConfigEntry<bool> ShowFeedback; private ConfigEntry<int> _configVersion; private void Awake() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Expected O, but got Unknown //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Expected O, but got Unknown //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; RememberChanges = ((BaseUnityPlugin)this).Config.Bind<bool>("State", "RememberChanges", false, "false (default): every launch starts at level 0 = the normal game look. true: the level you pick with the hotkeys is saved and used next launch."); Level = ((BaseUnityPlugin)this).Config.Bind<int>("State", "Level", 0, new ConfigDescription("Starting level, ONLY used when RememberChanges = true (then it's updated automatically). 0 = normal game look, 1..Levels = brighter.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 50), Array.Empty<object>())); LastLevel = ((BaseUnityPlugin)this).Config.Bind<int>("State", "LastLevel", 0, new ConfigDescription("Last non-zero level, used by the toggle key (only saved when RememberChanges = true). 0 = none yet (toggle goes to level 1).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 50), Array.Empty<object>())); Levels = ((BaseUnityPlugin)this).Config.Bind<int>("Brightness", "Levels", 20, new ConfigDescription("Number of brightness levels above 0 (level 0 is always the normal game look).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 50), Array.Empty<object>())); Level1Intensity = ((BaseUnityPlugin)this).Config.Bind<float>("Brightness", "Level1Intensity", 133f, new ConfigDescription("Light intensity at level 1 (a subtle boost; the game's own helmet night-vision light is ~367). Levels scale geometrically from this up to MaxIntensity.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10000000f), Array.Empty<object>())); MaxIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Brightness", "MaxIntensity", 100000f, new ConfigDescription("Light intensity at the top level.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10000000f), Array.Empty<object>())); Range = ((BaseUnityPlugin)this).Config.Bind<float>("Brightness", "Range", 1000f, new ConfigDescription("How far (in meters) the fullbright light reaches from your camera.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 100000f), Array.Empty<object>())); ToggleKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Keybinds", "ToggleKey", (Key)28, "Switch between level 0 (normal game look) and your last level. Uses Unity Input System key names (e.g. N, F6, Backquote)."); BrighterKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Keybinds", "BrighterKey", (Key)14, "Go up one level (the =/+ key). Numpad + also works."); DimmerKey = ((BaseUnityPlugin)this).Config.Bind<Key>("Keybinds", "DimmerKey", (Key)13, "Go down one level, down to 0 = normal game look (the -/_ key). Numpad - also works."); ShowFeedback = ((BaseUnityPlugin)this).Config.Bind<bool>("UI", "ShowFeedback", true, "Show a short on-screen message when you change fullbright settings."); _configVersion = ((BaseUnityPlugin)this).Config.Bind<int>("Internal", "ConfigVersion", 0, "Used by the mod to upgrade old config files. Don't edit."); MigrateConfig(); GameObject val = new GameObject("GuffsFullbright"); Object.DontDestroyOnLoad((Object)val); ((Object)val).hideFlags = (HideFlags)61; val.AddComponent<FullbrightController>(); Log.LogInfo((object)string.Format("{0} {1} loaded. RememberChanges={2}. Toggle={3}, Brighter={4}, Dimmer={5}. Fog is always off. Client-side only.", "GuffsFullbright", "1.2.0", RememberChanges.Value, ToggleKey.Value, BrighterKey.Value, DimmerKey.Value)); } private void MigrateConfig() { //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Expected O, but got Unknown //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Expected O, but got Unknown if (_configVersion.Value >= 3) { return; } bool saveOnConfigSet = ((BaseUnityPlugin)this).Config.SaveOnConfigSet; ((BaseUnityPlugin)this).Config.SaveOnConfigSet = false; try { if (_configVersion.Value < 2) { Level.Value = 0; LastLevel.Value = 0; RememberChanges.Value = false; } if (_configVersion.Value < 3) { Levels.Value = (int)((ConfigEntryBase)Levels).DefaultValue; Level1Intensity.Value = (float)((ConfigEntryBase)Level1Intensity).DefaultValue; MaxIntensity.Value = (float)((ConfigEntryBase)MaxIntensity).DefaultValue; } try { if (AccessTools.Property(typeof(ConfigFile), "OrphanedEntries")?.GetValue(((BaseUnityPlugin)this).Config) is Dictionary<ConfigDefinition, string> dictionary) { dictionary.Remove(new ConfigDefinition("State", "Enabled")); dictionary.Remove(new ConfigDefinition("Brightness", "MinIntensity")); dictionary.Remove(new ConfigDefinition("Fog", "DisableFog")); dictionary.Remove(new ConfigDefinition("Keybinds", "FogToggleKey")); } } catch (Exception ex) { Log.LogDebug((object)("Couldn't prune old config keys: " + ex.Message)); } int value = _configVersion.Value; _configVersion.Value = 3; Log.LogInfo((object)$"Config upgraded (version {value} -> {3}). Fog is now always off."); } finally { ((BaseUnityPlugin)this).Config.SaveOnConfigSet = saveOnConfigSet; ((BaseUnityPlugin)this).Config.Save(); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "guff.guffsfullbright"; public const string PLUGIN_NAME = "GuffsFullbright"; public const string PLUGIN_VERSION = "1.2.0"; } }
plugins/GuffsReach.dll
Decompiled 4 days agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("GuffsReach")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("GuffsReach")] [assembly: AssemblyTitle("GuffsReach")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace GuffsReach { [BepInPlugin("guff.guffsreach", "GuffsReach", "1.0.0")] [BepInProcess("Lethal Company.exe")] public class Plugin : BaseUnityPlugin { internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<float> ReachMultiplier; private void Awake() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Master switch."); ReachMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ReachMultiplier", 3f, new ConfigDescription("Grab/interact reach = normal reach x this.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 20f), Array.Empty<object>())); new Harmony("guff.guffsreach").PatchAll(typeof(Patches)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"GuffsReach 1.0.0 loaded"); } } internal static class Patches { private static PlayerControllerB _p; private static float _base = -1f; [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPrefix] private static void Pre(PlayerControllerB __instance) { GameNetworkManager instance = GameNetworkManager.Instance; if (!((Object)(object)instance == (Object)null) && !((Object)(object)__instance != (Object)(object)instance.localPlayerController)) { if ((Object)(object)__instance != (Object)(object)_p) { _p = __instance; _base = __instance.grabDistance; } if (_base <= 0f) { _base = __instance.grabDistance; } __instance.grabDistance = (Plugin.Enabled.Value ? (_base * Plugin.ReachMultiplier.Value) : _base); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "guff.guffsreach"; public const string PLUGIN_NAME = "GuffsReach"; public const string PLUGIN_VERSION = "1.0.0"; } }
plugins/GuffsStamina.dll
Decompiled 4 days agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using GuffsStamina.Patches; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("GuffsStamina")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("GuffsStamina")] [assembly: AssemblyTitle("GuffsStamina")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace GuffsStamina { [BepInPlugin("guff.guffsstamina", "GuffsStamina", "1.0.0")] [BepInProcess("Lethal Company.exe")] public class Plugin : BaseUnityPlugin { public const string PluginGuid = "guff.guffsstamina"; public const string PluginName = "GuffsStamina"; public const string PluginVersion = "1.0.0"; internal static ManualLogSource Log; internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<float> StaminaMultiplier; internal static ConfigEntry<float> RegenMultiplier; private Harmony _harmony; private void Awake() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown Log = ((BaseUnityPlugin)this).Logger; Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Master switch. When false the mod does nothing and stamina is vanilla."); StaminaMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "StaminaMultiplier", 10f, new ConfigDescription("How many times more stamina you have. Every stamina loss (sprinting, walking while hindered, jumping) is divided by this value. 10 = the meter drains 10x slower. 1 = vanilla.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1000f), Array.Empty<object>())); RegenMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "RegenMultiplier", 5f, new ConfigDescription("How many times faster stamina recharges. Every stamina gain is multiplied by this value. 5 = refills 5x faster. 1 = vanilla.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 1000f), Array.Empty<object>())); _harmony = new Harmony("guff.guffsstamina"); _harmony.PatchAll(typeof(PlayerStaminaPatches)); Log.LogInfo((object)(string.Format("{0} {1} loaded (Enabled={2}, ", "GuffsStamina", "1.0.0", Enabled.Value) + $"StaminaMultiplier={StaminaMultiplier.Value}, RegenMultiplier={RegenMultiplier.Value}). " + "Client-side: affects only your own player.")); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "guff.guffsstamina"; public const string PLUGIN_NAME = "GuffsStamina"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace GuffsStamina.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal static class PlayerStaminaPatches { private const float ExhaustionClearThreshold = 0.3f; private static bool IsLocalPlayer(PlayerControllerB player) { if ((Object)(object)player == (Object)null) { return false; } GameNetworkManager instance = GameNetworkManager.Instance; if ((Object)(object)instance != (Object)null && (Object)(object)instance.localPlayerController != (Object)null) { return player == instance.localPlayerController; } if (((NetworkBehaviour)player).IsOwner) { return player.isPlayerControlled; } return false; } private static bool Active(PlayerControllerB player) { if (Plugin.Enabled != null && Plugin.Enabled.Value) { return IsLocalPlayer(player); } return false; } private static void Rescale(PlayerControllerB player, float old) { float num = player.sprintMeter - old; if (num != 0f && !float.IsNaN(num)) { if (num < 0f) { float num2 = Mathf.Max(0.1f, Plugin.StaminaMultiplier.Value); player.sprintMeter = Mathf.Clamp(old + num / num2, 0f, 1f); } else { float num3 = Mathf.Max(0.1f, Plugin.RegenMultiplier.Value); player.sprintMeter = Mathf.Clamp(old + num * num3, 0f, 1f); } } } [HarmonyPatch("Update")] [HarmonyPrefix] private static void UpdatePrefix(PlayerControllerB __instance, out float __state) { __state = (((Object)(object)__instance != (Object)null) ? __instance.sprintMeter : 0f); } [HarmonyPatch("Update")] [HarmonyPostfix] private static void UpdatePostfix(PlayerControllerB __instance, float __state) { if (Active(__instance)) { Rescale(__instance, __state); if (__instance.isExhausted && !__instance.isSprinting && __instance.sprintMeter >= 0.3f) { __instance.isExhausted = false; } } } [HarmonyPatch("LateUpdate")] [HarmonyPrefix] private static void LateUpdatePrefix(PlayerControllerB __instance, out float __state) { __state = (((Object)(object)__instance != (Object)null) ? __instance.sprintMeter : 0f); } [HarmonyPatch("LateUpdate")] [HarmonyPostfix] private static void LateUpdatePostfix(PlayerControllerB __instance, float __state) { if (Active(__instance)) { Rescale(__instance, __state); } } [HarmonyPatch("Jump_performed")] [HarmonyPrefix] private static void JumpPrefix(PlayerControllerB __instance, out float __state) { __state = (((Object)(object)__instance != (Object)null) ? __instance.sprintMeter : 0f); } [HarmonyPatch("Jump_performed")] [HarmonyPostfix] private static void JumpPostfix(PlayerControllerB __instance, float __state) { if (Active(__instance) && __instance.sprintMeter < __state) { Rescale(__instance, __state); } } } }
plugins/HaloScrap/HaloScrap.dll
Decompiled 4 days agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using HarmonyLib; using LethalLib.Modules; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyVersion("1.1.2.3")] namespace HaloScrap; [BepInPlugin("Clair.HaloScrap", "Halo Scrap SHIP PREVIEW TEST FIX1", "1.1.2")] [BepInDependency("evaisa.lethallib", "1.2.0")] public sealed class Plugin : BaseUnityPlugin { internal sealed class Definition { public string Key; public string Name; public int Value; public int Rarity; public int Cap; public float Size; public Item Item; public Definition(string key, string name, int value, int rarity, int cap, float size) { Key = key; Name = name; Value = value; Rarity = rarity; Cap = cap; Size = size; } } [HarmonyPatch(typeof(GameNetworkManager), "Start")] private static class Registration { [HarmonyPrefix] private static void Prefix() { Initialize(); } } [HarmonyPatch(typeof(StartOfRound), "Start")] private static class PreviewStart { [HarmonyPostfix] private static void Postfix(StartOfRound __instance) { if (((NetworkBehaviour)__instance).IsServer && !Object.op_Implicit((Object)(object)((Component)__instance).GetComponent<ShipPreviewSpawner>())) { ((Component)__instance).gameObject.AddComponent<ShipPreviewSpawner>(); } } } [HarmonyPatch(typeof(GrabbableObject), "Start")] private static class PreviewValue { [HarmonyPostfix] private static void Postfix(GrabbableObject __instance) { Definition definition = Find(__instance.itemProperties); if (definition != null) { __instance.SetScrapValue(definition.Value); } } } [HarmonyPatch(typeof(GrabbableObject), "SetScrapValue")] private static class ExactValue { [HarmonyPrefix] private static void Prefix(GrabbableObject __instance, ref int setValueTo) { Definition definition = Find(__instance.itemProperties); if (definition != null) { setValueTo = definition.Value; } } } internal static Plugin Instance; private static AssetBundle bundle; private static bool initialized; internal static readonly Definition[] Definitions = new Definition[7] { new Definition("FusionCoil", "Fusion Coil", 170, 28, int.MaxValue, 0.65f), new Definition("MA5C", "MA5C Assault Rifle", 65, 65, 3, 0.85f), new Definition("Warthog", "Warthog", 120, 8, int.MaxValue, 0.32f), new Definition("Claws", "Custom Halo Energy Claws", 120, 8, int.MaxValue, 0.65f), new Definition("EnergySword", "Halo 3 Energy Sword", 300, 1, 1, 1.05f), new Definition("SMG", "Halo 2 Anniversary SMG", 45, 65, 3, 0.55f), new Definition("ReconHelmet", "Recon Helmet", 70, 16, 2, 0.3f) }; private void Awake() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) Instance = this; bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "haloscrap")); if (!Object.op_Implicit((Object)(object)bundle)) { throw new FileNotFoundException("Halo Scrap visual bundle missing or incompatible"); } new Harmony("Clair.HaloScrap").PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Halo Scrap SHIP PREVIEW TEST loaded. Disable the regular build; this test creates ship scrap. Host and every player must install this version. Gameplay/multiplayer testing is user-performed."); } private static void BindGameMaterials(GameObject visual, Item template) { //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Expected O, but got Unknown //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_02b7: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) Material val = template.spawnPrefab.GetComponentsInChildren<Renderer>(true).SelectMany((Renderer r) => r.sharedMaterials).FirstOrDefault((Func<Material, bool>)((Material m) => Object.op_Implicit((Object)(object)m) && Object.op_Implicit((Object)(object)m.shader) && ((Object)m.shader).name == "HDRP/Lit" && m.shader.isSupported)); if (!Object.op_Implicit((Object)(object)val)) { val = (from i in Resources.FindObjectsOfTypeAll<Item>() where Object.op_Implicit((Object)(object)i.spawnPrefab) && i.isScrap select i).SelectMany((Item i) => i.spawnPrefab.GetComponentsInChildren<Renderer>(true)).SelectMany((Renderer r) => r.sharedMaterials).FirstOrDefault((Func<Material, bool>)((Material m) => Object.op_Implicit((Object)(object)m) && Object.op_Implicit((Object)(object)m.shader) && ((Object)m.shader).name == "HDRP/Lit" && m.shader.isSupported && !((Object)m).name.StartsWith("HaloScrap_"))); } if (!Object.op_Implicit((Object)(object)val)) { throw new InvalidOperationException("No supported game-owned HDRP/Lit scrap material found. Refusing to create pink Halo Scrap."); } Renderer[] componentsInChildren = visual.GetComponentsInChildren<Renderer>(true); foreach (Renderer val2 in componentsInChildren) { Material[] sharedMaterials = val2.sharedMaterials; for (int num2 = 0; num2 < sharedMaterials.Length; num2++) { Material val3 = sharedMaterials[num2]; if (!Object.op_Implicit((Object)(object)val3)) { throw new InvalidDataException("Missing Halo material data"); } Texture val4 = (val3.HasProperty("_MainTex") ? val3.GetTexture("_MainTex") : val3.GetTexture("_BaseColorMap")); if (!Object.op_Implicit((Object)(object)val4)) { throw new InvalidDataException("Missing Halo albedo: " + ((Object)val3).name); } bool flag = ((Object)val3).name.StartsWith("HALO_EMISSIVE_"); Material val5 = new Material(val) { name = "HaloScrap_" + ((Object)val3).name }; val5.SetTexture("_BaseColorMap", val4); val5.SetColor("_BaseColor", Color.white); string[] array = new string[6] { "_NormalMap", "_MaskMap", "_DetailMap", "_BentNormalMap", "_HeightMap", "_CoatMaskMap" }; foreach (string text in array) { if (val5.HasProperty(text)) { val5.SetTexture(text, (Texture)null); } } val5.SetFloat("_Metallic", 0.25f); val5.SetFloat("_Smoothness", 0.3f); val5.SetColor("_EmissiveColor", flag ? (new Color(0.05f, 0.4f, 1f) * 2f) : Color.black); val5.SetTexture("_EmissiveColorMap", flag ? val4 : null); if (flag) { val5.EnableKeyword("_EMISSIVE_COLOR_MAP"); } else { val5.DisableKeyword("_EMISSIVE_COLOR_MAP"); } sharedMaterials[num2] = val5; } val2.sharedMaterials = sharedMaterials; } ((BaseUnityPlugin)Instance).Logger.LogInfo((object)("Material FIX1: " + ((Object)visual).name + " uses game-owned " + ((Object)val.shader).name + "; supported=" + val.shader.isSupported)); } internal static Definition Find(Item item) { return Definitions.FirstOrDefault((Definition x) => (Object)(object)x.Item == (Object)(object)item); } internal static void Initialize() { //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_035f: Expected O, but got Unknown //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03c9: Unknown result type (might be due to invalid IL or missing references) if (initialized) { return; } Item[] source = Resources.FindObjectsOfTypeAll<Item>(); Item val = ((IEnumerable<Item>)source).FirstOrDefault((Func<Item, bool>)((Item x) => x.isScrap && Object.op_Implicit((Object)(object)x.spawnPrefab) && (Object)(object)x.spawnPrefab.GetComponent<PhysicsProp>() != (Object)null)); if (!Object.op_Implicit((Object)(object)val)) { throw new InvalidOperationException("No vanilla PhysicsProp scrap template is loaded. Cannot register Halo Scrap safely."); } Definition[] definitions = Definitions; foreach (Definition definition in definitions) { GameObject val2 = bundle.LoadAsset<GameObject>("Assets/Generated/" + definition.Key + ".prefab"); if (!Object.op_Implicit((Object)(object)val2)) { throw new InvalidDataException("Missing prefab " + definition.Key); } Item val3 = Object.Instantiate<Item>(val); ((Object)val3).name = "HaloScrap_" + definition.Key; val3.itemName = definition.Name; val3.isScrap = true; val3.minValue = definition.Value; val3.maxValue = definition.Value; val3.creditsWorth = definition.Value; val3.itemIcon = bundle.LoadAsset<Sprite>("Assets/Generated/" + definition.Key + "Icon.png"); if (!Object.op_Implicit((Object)(object)val3.itemIcon)) { throw new InvalidDataException("Missing unique model icon: " + definition.Key); } val3.weight = 1.05f; val3.twoHanded = false; val3.twoHandedAnimation = false; val3.requiresBattery = false; val3.isDefensiveWeapon = false; val3.itemSpawnsOnGround = true; val3.toolTips = new string[0]; val3.meshVariants = (Mesh[])(object)new Mesh[0]; val3.materialVariants = (Material[])(object)new Material[0]; val3.canBeInspected = false; val3.saveItemVariable = false; val3.rotationOffset = Vector3.zero; val3.positionOffset = new Vector3(0f, 0f, 0.1f); val3.restingRotation = Vector3.zero; val3.verticalOffset = 0.04f; val3.floorYOffset = 0; GameObject val4 = NetworkPrefabs.CreateNetworkPrefab("HaloScrap_" + definition.Key); val4.layer = LayerMask.NameToLayer("Props"); val4.tag = "PhysicsProp"; GameObject val5 = Object.Instantiate<GameObject>(val2, val4.transform); ((Object)val5).name = "HaloVisual"; BindGameMaterials(val5, val); Transform[] componentsInChildren = val5.GetComponentsInChildren<Transform>(true); foreach (Transform val6 in componentsInChildren) { ((Component)val6).gameObject.layer = val4.layer; } MeshRenderer[] componentsInChildren2 = val5.GetComponentsInChildren<MeshRenderer>(true); Bounds bounds = ((Renderer)componentsInChildren2[0]).bounds; MeshRenderer[] array = componentsInChildren2; foreach (MeshRenderer val7 in array) { ((Bounds)(ref bounds)).Encapsulate(((Renderer)val7).bounds); } BoxCollider val8 = val4.AddComponent<BoxCollider>(); val8.center = val4.transform.InverseTransformPoint(((Bounds)(ref bounds)).center); val8.size = ((Bounds)(ref bounds)).size; PhysicsProp val9 = val4.AddComponent<PhysicsProp>(); ((GrabbableObject)val9).itemProperties = val3; ((GrabbableObject)val9).grabbable = true; ((GrabbableObject)val9).grabbableToEnemies = true; ((GrabbableObject)val9).mainObjectRenderer = componentsInChildren2[0]; GameObject val10 = new GameObject("ScanNode"); val10.transform.SetParent(val4.transform, false); val10.transform.localPosition = val8.center; val10.layer = 22; if (LayerMask.NameToLayer("ScanNode") != 22) { throw new InvalidOperationException("Unexpected game ScanNode layer"); } BoxCollider val11 = val10.AddComponent<BoxCollider>(); val11.size = Vector3.one * 0.35f; ((Collider)val11).isTrigger = false; ScanNodeProperties val12 = val10.AddComponent<ScanNodeProperties>(); val12.headerText = definition.Name; val12.subText = "Value: $" + definition.Value; val12.scrapValue = definition.Value; val12.nodeType = 2; val12.minRange = 0; val12.maxRange = 13; val12.requiresLineOfSight = true; val12.creatureScanID = -1; val3.spawnPrefab = val4; definition.Item = val3; Items.RegisterItem(val3); ((BaseUnityPlugin)Instance).Logger.LogInfo((object)("Registered " + definition.Name + " value=" + definition.Value + " rarity=" + definition.Rarity + " cap=" + definition.Cap)); } initialized = true; } internal static void Log(string text) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)text); } } public sealed class ShipPreviewSpawner : MonoBehaviour { private bool attempted; private IEnumerator Start() { StartOfRound round = ((Component)this).GetComponent<StartOfRound>(); for (int frame = 0; frame < 1800; frame++) { if (!Object.op_Implicit((Object)(object)round) || !((NetworkBehaviour)round).IsServer) { yield break; } if (((NetworkBehaviour)round).IsSpawned && Object.op_Implicit((Object)(object)NetworkManager.Singleton) && NetworkManager.Singleton.IsListening && Object.op_Implicit((Object)(object)round.elevatorTransform) && Object.op_Implicit((Object)(object)round.shipInnerRoomBounds) && Object.op_Implicit((Object)(object)RoundManager.Instance) && Object.op_Implicit((Object)(object)RoundManager.Instance.mapPropsContainer) && Plugin.Definitions.All((Plugin.Definition definition) => (Object)(object)definition.Item != (Object)null)) { break; } if (frame == 1799) { Plugin.Log("SHIP PREVIEW: ship setup was not ready; no items spawned. Rehost to retry."); yield break; } yield return null; } yield return null; yield return null; if (attempted || !Object.op_Implicit((Object)(object)round) || !((NetworkBehaviour)round).IsServer) { yield break; } attempted = true; int created = 0; int reused = 0; GrabbableObject[] existing = Object.FindObjectsOfType<GrabbableObject>(); Vector3 anchor = (Object.op_Implicit((Object)(object)round.middleOfShipNode) ? round.middleOfShipNode.position : round.playerSpawnPositions[0].position); Collider room = round.shipInnerRoomBounds; Bounds bounds = room.bounds; Vector3 flatCenter = ((Bounds)(ref bounds)).center; anchor.x = flatCenter.x; anchor.z = flatCenter.z; RaycastHit floor = default(RaycastHit); for (int i = 0; i < Plugin.Definitions.Length; i++) { Plugin.Definition d = Plugin.Definitions[i]; float across = ((i % 2 == 0) ? (-0.75f) : 0.75f); float along = ((float)(i / 2) - 1.5f) * 1.25f; Vector3 position = anchor + round.elevatorTransform.right * across + round.elevatorTransform.forward * along; Vector3 probe = position + Vector3.up * 0.5f; Vector3 constrained = room.ClosestPoint(probe); position.x = constrained.x; position.z = constrained.z; if (Physics.Raycast(position + Vector3.up * 0.8f, Vector3.down, ref floor, 3f, round.collidersAndRoomMask, (QueryTriggerInteraction)1)) { position.y = ((RaycastHit)(ref floor)).point.y + 0.06f; } else { position.y = anchor.y + 0.06f; } GrabbableObject prop = ((IEnumerable<GrabbableObject>)existing).FirstOrDefault((Func<GrabbableObject, bool>)delegate(GrabbableObject g) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) int result; if ((Object)(object)g.itemProperties == (Object)(object)d.Item) { if (!g.isInShipRoom && !g.isInElevator) { Bounds bounds2 = room.bounds; result = (((Bounds)(ref bounds2)).Contains(((Component)g).transform.position) ? 1 : 0); } else { result = 1; } } else { result = 0; } return (byte)result != 0; }); if (Object.op_Implicit((Object)(object)prop)) { reused++; continue; } GameObject go = Object.Instantiate<GameObject>(d.Item.spawnPrefab, position, round.elevatorTransform.rotation, round.elevatorTransform); prop = go.GetComponent<GrabbableObject>(); prop.isInElevator = true; prop.isInShipRoom = true; prop.isInFactory = false; prop.scrapPersistedThroughRounds = true; prop.fallTime = 0f; prop.SetScrapValue(d.Value); go.GetComponent<NetworkObject>().Spawn(false); created++; floor = default(RaycastHit); } Plugin.Log("SHIP PREVIEW: spawned " + created + " items on the host; reused " + reused + " matching ship items. One preview setup per lobby; moon transitions do not respawn the set."); } }
plugins/PinkGhoulTrooper/PinkGhoulTrooper.dll
Decompiled 4 days agousing System; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using BepInEx; using ModelReplacement; using ModelReplacement.AvatarBodyUpdater; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyVersion("0.0.0.0")] namespace PinkGhoulTrooper; [BepInPlugin("clair.pinkghoultrooper", "Pink Ghoul Trooper", "1.0.2")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { internal static GameObject Prefab; private void Awake() { try { string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "pinkghoultrooper"); AssetBundle obj = AssetBundle.LoadFromFile(text); if ((Object)(object)obj == (Object)null) { throw new InvalidOperationException("Unable to load character asset bundle: " + text); } Prefab = obj.LoadAsset<GameObject>("Assets/Generated/PinkGhoulTrooper.prefab"); if ((Object)(object)Prefab == (Object)null) { throw new InvalidOperationException("PinkGhoulTrooper prefab is missing"); } ModelReplacementAPI.RegisterSuitModelReplacement("Pink Ghoul Trooper", typeof(GhoulReplacement)); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Pink Ghoul Trooper ready. Select its suit on the ship's rack."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)ex); } } } public sealed class GhoulReplacement : BodyReplacementBase { protected override GameObject LoadAssetsAndReturnModel() { return Plugin.Prefab; } protected override AvatarUpdater GetAvatarUpdater() { return (AvatarUpdater)(object)new FloorAlignedAvatarUpdater(); } } public sealed class FloorAlignedAvatarUpdater : AvatarUpdater { public override void AssignModelReplacement(GameObject player, GameObject replacement) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) ((AvatarUpdater)this).AssignModelReplacement(player, replacement); base.rootPositionOffset = Vector3.zero; } protected override void UpdateModel() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) ((AvatarUpdater)this).UpdateModel(); Transform avatarTransformFromBoneName = ((AvatarUpdater)this).GetAvatarTransformFromBoneName("spine"); Transform avatarTransformFromBoneName2 = ((AvatarUpdater)this).GetAvatarTransformFromBoneName("toe.L"); Transform avatarTransformFromBoneName3 = ((AvatarUpdater)this).GetAvatarTransformFromBoneName("toe.R"); Transform playerTransformFromBoneName = ((AvatarUpdater)this).GetPlayerTransformFromBoneName("toe.L"); Transform playerTransformFromBoneName2 = ((AvatarUpdater)this).GetPlayerTransformFromBoneName("toe.R"); if (!((Object)(object)avatarTransformFromBoneName == (Object)null) && !((Object)(object)avatarTransformFromBoneName2 == (Object)null) && !((Object)(object)avatarTransformFromBoneName3 == (Object)null) && !((Object)(object)playerTransformFromBoneName == (Object)null) && !((Object)(object)playerTransformFromBoneName2 == (Object)null)) { float num = (playerTransformFromBoneName.position.y + playerTransformFromBoneName2.position.y) * 0.5f; float num2 = (avatarTransformFromBoneName2.position.y + avatarTransformFromBoneName3.position.y) * 0.5f; avatarTransformFromBoneName.position += Vector3.up * (num - num2); } } }