using System; using System.ComponentModel; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; 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("JuJoJiDev.GigaBong")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.2.0")] [assembly: AssemblyInformationalVersion("1.0.2")] [assembly: AssemblyProduct("JuJoJiDev.GigaBong")] [assembly: AssemblyTitle("GigaBong")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.2.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Embedded] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] [Embedded] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace Microsoft.CodeAnalysis { [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace GigaBong { [BepInPlugin("JuJoJiDev.GigaBong", "GigaBong", "1.0.2")] public class Plugin : BaseUnityPlugin { private readonly Harmony _harmony = new Harmony("JuJoJiDev.GigaBong"); public const string Id = "JuJoJiDev.GigaBong"; internal static ManualLogSource Log { get; private set; } public static string Name => "GigaBong"; public static string Version => "1.0.2"; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; _harmony.PatchAll(); Log.LogInfo((object)("Plugin " + Name + " is loaded!")); } private void OnDestroy() { _harmony.UnpatchSelf(); Log.LogInfo((object)("Plugin " + Name + " is unloaded!")); } } } namespace GigaBong.Patches { [HarmonyPatch(typeof(BackpackWheel))] internal class BackPackWheelPatch { [HarmonyPatch("InitWheel")] [HarmonyPostfix] internal static void InitWheelPatch(BackpackWheel __instance, ref BackpackReference bp, ref int slotCount) { if (((Behaviour)__instance.currentlyHeldItem).enabled) { ref ItemTags itemTags = ref Character.localCharacter.data.currentItem.itemTags; object obj = (object)(ItemTags)16; if (((object)Unsafe.As(ref itemTags)/*cast due to .constrained prefix*/).Equals(obj)) { __instance.currentlyHeldItem.texture = (Texture)(object)InventoryItemUIPatch.icon; Plugin.Log.LogInfo((object)"Icon for inventory replaced"); } } } [HarmonyPatch("Hover")] [HarmonyPostfix] internal static void HoverPostfix(BackpackWheel __instance, ref SliceData sliceData) { Item currentItem = Character.localCharacter.data.currentItem; ItemSlot val = ((BackpackReference)(ref __instance.backpack)).GetData().itemSlots[sliceData.slotID]; if (Object.op_Implicit((Object)(object)currentItem)) { ref ItemTags itemTags = ref currentItem.itemTags; object obj = (object)(ItemTags)16; if (((object)Unsafe.As(ref itemTags)/*cast due to .constrained prefix*/).Equals(obj)) { if (sliceData.isStashSlice) { ((TMP_Text)__instance.chosenItemText).text = LocalizedText.GetText("STASHITEM", true).Replace("#", "GIGA BONG"); AddCookingReference(__instance.chosenItemText, currentItem); } else if (sliceData.isJetpackFuelSlice) { ((TMP_Text)__instance.chosenItemText).text = LocalizedText.GetText("CONVERTITEM", true).Replace("#", "GIGA BONG"); AddCookingReference(__instance.chosenItemText, currentItem); } else if (val.IsEmpty() && Object.op_Implicit((Object)(object)Character.localCharacter.data.currentItem)) { ref ItemTags itemTags2 = ref Character.localCharacter.data.currentItem.itemTags; object obj2 = (object)(ItemTags)16; if (((object)Unsafe.As(ref itemTags2)/*cast due to .constrained prefix*/).Equals(obj2)) { ((TMP_Text)__instance.chosenItemText).text = LocalizedText.GetText("STASHITEM", true).Replace("#", "GIGA BONG"); AddCookingReference(__instance.chosenItemText, currentItem); } } return; } } Item prefab = val.prefab; if (Object.op_Implicit((Object)(object)prefab)) { ref ItemTags itemTags3 = ref prefab.itemTags; object obj3 = (object)(ItemTags)16; if (((object)Unsafe.As(ref itemTags3)/*cast due to .constrained prefix*/).Equals(obj3)) { ((TMP_Text)__instance.chosenItemText).text = LocalizedText.GetText("TAKEITEM", true).Replace("#", "GIGA BONG"); AddCookingReference(__instance.chosenItemText, prefab, val.data); } } } public static void AddCookingReference(TextMeshProUGUI text, Item currentItem, ItemInstanceData data = null) { int num = 0; IntItemData val = default(IntItemData); if (data == null) { num = currentItem.GetData((DataEntryKey)1).Value; } else if (data.TryGetDataEntry((DataEntryKey)1, ref val)) { num = val.Value; } if (num < 4) { switch (num) { case 3: ((TMP_Text)text).text = ((TMP_Text)text).text + LocalizedText.GetText("COOKED_BURNT", true).Substring(1); break; case 2: ((TMP_Text)text).text = ((TMP_Text)text).text + LocalizedText.GetText("COOKED_WELLDONE", true).Substring(1); break; case 1: ((TMP_Text)text).text = ((TMP_Text)text).text + LocalizedText.GetText("COOKED_COOKED", true).Substring(1); break; } } else { ((TMP_Text)text).text = ((TMP_Text)text).text + LocalizedText.GetText("COOKED_INCINERATED", true).Substring(1); } } } [HarmonyPatch(typeof(BackpackWheelSlice))] internal class BackpackWheelSlicePatch { [HarmonyPatch("SetItemIcon")] [HarmonyPostfix] internal static void SetItemIconPostfix(BackpackWheelSlice __instance, Item iconHolder, ItemInstanceData itemInstanceData) { if (Object.op_Implicit((Object)(object)iconHolder)) { ref ItemTags itemTags = ref iconHolder.itemTags; object obj = (object)(ItemTags)16; if (((object)Unsafe.As(ref itemTags)/*cast due to .constrained prefix*/).Equals(obj) && Object.op_Implicit((Object)(object)InventoryItemUIPatch.icon)) { __instance.image.texture = (Texture)(object)InventoryItemUIPatch.icon; Plugin.Log.LogInfo((object)"Backpack wheel slice changed!"); } } } } [HarmonyPatch(typeof(Item))] internal class BingBongPatch { private static Texture2D newTexture; private static Mesh newCube; private static Mesh newTopLip; private static Mesh newTopBottom; private static bool resourcesLoaded; private static Material newMaterial; internal static bool LoadResources() { if (resourcesLoaded) { return true; } string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "gigabongmodbundle"); if (!File.Exists(text)) { Plugin.Log.LogError((object)(" Plugin GigaBong couldn't find assetbundle in " + text)); return false; } AssetBundle val = AssetBundle.LoadFromFile(text); if (!val.Contains("Cube")) { return false; } newCube = val.LoadAsset("Cube"); if (!val.Contains("Lip_Top")) { return false; } newTopLip = val.LoadAsset("Lip_Top"); if (!val.Contains("Lip_Bottom")) { return false; } newTopBottom = val.LoadAsset("Lip_Bottom"); if (!val.Contains("gigabong")) { return false; } newTexture = val.LoadAsset("gigabong"); resourcesLoaded = true; val.Unload(false); return true; } [HarmonyPatch(typeof(Item), "Awake")] [HarmonyPostfix] private static void ChangeModel(Item __instance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown if ((int)__instance.itemTags != 16) { return; } Plugin.Log.LogInfo((object)"Loading asset bundle"); if (!LoadResources()) { Plugin.Log.LogError((object)(__instance.GetName() + " couldn't load resources, Bing Bong will remain normal")); return; } Plugin.Log.LogInfo((object)"Asset bundle loaded"); Plugin.Log.LogInfo((object)"Finding transforms"); Transform val = __instance.GetTransform().Find("Holder/Bing Bong Plush"); Transform val2 = val.Find("Cube"); Transform val3 = val.Find("Lip Top"); Transform val4 = val.Find("Lip Bottom"); Plugin.Log.LogInfo((object)"Cloning material"); if ((Object)(object)newMaterial == (Object)null) { newMaterial = new Material(((Renderer)((Component)val2).GetComponent()).material); newMaterial.mainTexture = (Texture)(object)newTexture; } Plugin.Log.LogInfo((object)"Changing Parts"); ChangePart(val2, newMaterial, newCube); ChangePart(val3, newMaterial, newTopLip); ChangePart(val4, newMaterial, newTopBottom); ((Component)val3).transform.localPosition = new Vector3(-0.3f, -0.03f, 0.15f); ((Component)val4).transform.localPosition = new Vector3(-0.3f, -0.05f, 0.14f); Plugin.Log.LogInfo((object)"Bing Bong transformed into Giga Bong"); } internal static void ChangePart(Transform part, Material newMaterial, Mesh newMesh) { ((Component)part).GetComponent().mesh = newMesh; ((Renderer)((Component)part).GetComponent()).material = newMaterial; } } [HarmonyPatch(typeof(GUIManager))] internal class GUIManagerPatch { [HarmonyPatch("RefreshInteractablePrompt")] [HarmonyPostfix] private static void UpdateGUIName(GUIManager __instance) { IInteractible currentHovered = Interaction.instance.currentHovered; Item val = (Item)(object)((currentHovered is Item) ? currentHovered : null); if (val != null) { ref ItemTags itemTags = ref val.itemTags; object obj = (object)(ItemTags)16; if (((object)Unsafe.As(ref itemTags)/*cast due to .constrained prefix*/).Equals(obj)) { ((TMP_Text)__instance.interactNameText).text = "GIGA BONG"; BackPackWheelPatch.AddCookingReference(__instance.interactNameText, val); } } } } [HarmonyPatch(typeof(InventoryItemUI))] internal class InventoryItemUIPatch { public static Texture2D icon; private static bool done; [HarmonyPatch("Start")] [HarmonyPostfix] private static void LoadBundle() { if (!done) { Plugin.Log.LogInfo((object)"Loading bundle for icon"); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(directoryName, "gigabongmodbundle"); if (!File.Exists(text)) { Plugin.Log.LogError((object)(" Plugin GigaBong couldn't find assetbundle in " + text)); } AssetBundle val = AssetBundle.LoadFromFile(text); icon = val.LoadAsset("gigabongIcon"); Plugin.Log.LogInfo((object)"Icon for inventory loaded"); done = true; } } [HarmonyPatch("SetItem")] [HarmonyPostfix] private static void UpdateGigaBongUI(InventoryItemUI __instance, ref ItemSlot slot) { if (slot != null && !slot.IsEmpty()) { ref ItemTags itemTags = ref slot.prefab.itemTags; object obj = (object)(ItemTags)16; if (((object)Unsafe.As(ref itemTags)/*cast due to .constrained prefix*/).Equals(obj)) { ((TMP_Text)__instance.nameText).text = "GIGA BONG"; BackPackWheelPatch.AddCookingReference(__instance.nameText, slot.prefab, __instance._itemData); __instance.icon.texture = (Texture)(object)icon; } } } } } namespace System.Diagnostics.CodeAnalysis { [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ConstantExpectedAttribute : Attribute { public object? Min { get; set; } public object? Max { get; set; } } [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ExperimentalAttribute : Attribute { public string DiagnosticId { get; } public string? UrlFormat { get; set; } public ExperimentalAttribute(string diagnosticId) { DiagnosticId = diagnosticId; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullAttribute : Attribute { public string[] Members { get; } public MemberNotNullAttribute(string member) { Members = new string[1] { member }; } public MemberNotNullAttribute(params string[] members) { Members = members; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property, Inherited = false, AllowMultiple = true)] [ExcludeFromCodeCoverage] internal sealed class MemberNotNullWhenAttribute : Attribute { public bool ReturnValue { get; } public string[] Members { get; } public MemberNotNullWhenAttribute(bool returnValue, string member) { ReturnValue = returnValue; Members = new string[1] { member }; } public MemberNotNullWhenAttribute(bool returnValue, params string[] members) { ReturnValue = returnValue; Members = members; } } [AttributeUsage(AttributeTargets.Constructor, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SetsRequiredMembersAttribute : Attribute { } [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class StringSyntaxAttribute : Attribute { public const string CompositeFormat = "CompositeFormat"; public const string DateOnlyFormat = "DateOnlyFormat"; public const string DateTimeFormat = "DateTimeFormat"; public const string EnumFormat = "EnumFormat"; public const string GuidFormat = "GuidFormat"; public const string Json = "Json"; public const string NumericFormat = "NumericFormat"; public const string Regex = "Regex"; public const string TimeOnlyFormat = "TimeOnlyFormat"; public const string TimeSpanFormat = "TimeSpanFormat"; public const string Uri = "Uri"; public const string Xml = "Xml"; public string Syntax { get; } public object?[] Arguments { get; } public StringSyntaxAttribute(string syntax) { Syntax = syntax; Arguments = new object[0]; } public StringSyntaxAttribute(string syntax, params object?[] arguments) { Syntax = syntax; Arguments = arguments; } } [AttributeUsage(AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class UnscopedRefAttribute : Attribute { } } namespace System.Runtime.Versioning { [AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Delegate, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiresPreviewFeaturesAttribute : Attribute { public string? Message { get; } public string? Url { get; set; } public RequiresPreviewFeaturesAttribute() { } public RequiresPreviewFeaturesAttribute(string? message) { Message = message; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CallerArgumentExpressionAttribute : Attribute { public string ParameterName { get; } public CallerArgumentExpressionAttribute(string parameterName) { ParameterName = parameterName; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CollectionBuilderAttribute : Attribute { public Type BuilderType { get; } public string MethodName { get; } public CollectionBuilderAttribute(Type builderType, string methodName) { BuilderType = builderType; MethodName = methodName; } } [AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class CompilerFeatureRequiredAttribute : Attribute { public const string RefStructs = "RefStructs"; public const string RequiredMembers = "RequiredMembers"; public string FeatureName { get; } public bool IsOptional { get; set; } public CompilerFeatureRequiredAttribute(string featureName) { FeatureName = featureName; } } [AttributeUsage(AttributeTargets.Parameter, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerArgumentAttribute : Attribute { public string[] Arguments { get; } public InterpolatedStringHandlerArgumentAttribute(string argument) { Arguments = new string[1] { argument }; } public InterpolatedStringHandlerArgumentAttribute(params string[] arguments) { Arguments = arguments; } } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class InterpolatedStringHandlerAttribute : Attribute { } [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal static class IsExternalInit { } [AttributeUsage(AttributeTargets.Method, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class ModuleInitializerAttribute : Attribute { } [AttributeUsage(AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class OverloadResolutionPriorityAttribute : Attribute { public int Priority { get; } public OverloadResolutionPriorityAttribute(int priority) { Priority = priority; } } [AttributeUsage(AttributeTargets.Parameter, Inherited = true, AllowMultiple = false)] [ExcludeFromCodeCoverage] internal sealed class ParamCollectionAttribute : Attribute { } [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class RequiredMemberAttribute : Attribute { } [AttributeUsage(AttributeTargets.Parameter, Inherited = false)] [EditorBrowsable(EditorBrowsableState.Never)] [ExcludeFromCodeCoverage] internal sealed class RequiresLocationAttribute : Attribute { } [AttributeUsage(AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Event | AttributeTargets.Interface, Inherited = false)] [ExcludeFromCodeCoverage] internal sealed class SkipLocalsInitAttribute : Attribute { } }