using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LobbyCompatibility.Enums;
using LobbyCompatibility.Features;
using Microsoft.CodeAnalysis;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UpturnedVariety.Defs.Items;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("UpturnedVariety")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Includes some assets from The Upturned for vanilla-friendly variety")]
[assembly: AssemblyFileVersion("2.1.0.0")]
[assembly: AssemblyInformationalVersion("2.1.0+4063e8ec2709d617d8123634f7fa83b8882240f8")]
[assembly: AssemblyProduct("UpturnedVariety")]
[assembly: AssemblyTitle("UpturnedVariety")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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 UpturnedVariety
{
internal static class LobbyCompatibility
{
internal static void Init()
{
PluginHelper.RegisterPlugin("butterystancakes.lethalcompany.upturnedvariety", Version.Parse("2.1.0"), (CompatibilityLevel)0, (VersionStrictness)0);
}
}
[BepInPlugin("butterystancakes.lethalcompany.upturnedvariety", "Upturned Variety", "2.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
internal const string PLUGIN_GUID = "butterystancakes.lethalcompany.upturnedvariety";
internal const string PLUGIN_NAME = "Upturned Variety";
internal const string PLUGIN_VERSION = "2.1.0";
internal static ManualLogSource Logger;
private const string GUID_LOBBY_COMPATIBILITY = "BMX.LobbyCompatibility";
internal static ConfigEntry<bool> configBoombox;
internal static AudioClip boombox;
private void Awake()
{
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
Logger = ((BaseUnityPlugin)this).Logger;
if (Chainloader.PluginInfos.ContainsKey("BMX.LobbyCompatibility"))
{
Logger.LogInfo((object)"CROSS-COMPATIBILITY - Lobby Compatibility detected");
LobbyCompatibility.Init();
}
configBoombox = ((BaseUnityPlugin)this).Config.Bind<bool>("Items", "Boombox", true, "Enables alternate models for the \"Boombox\" item.");
SkinManager.LoadAllConfigs(((BaseUnityPlugin)this).Config);
try
{
AssetBundle obj = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "upturnedvariety"));
boombox = obj.LoadAsset<AudioClip>("Boombox");
SkinManager.LoadAllSkins(obj);
obj.Unload(false);
}
catch
{
Logger.LogError((object)"Encountered some error loading asset bundle. Did you install the plugin correctly?");
return;
}
new Harmony("butterystancakes.lethalcompany.upturnedvariety").PatchAll();
Logger.LogInfo((object)"Upturned Variety v2.1.0 loaded");
}
}
[HarmonyPatch]
internal class UpturnedVarietyPatches
{
private static readonly Color SHINY_BOOMBOX = new Color(0.5799929f, 0.5799929f, 0.5799929f);
private static StartMatchLever _startMatchLever;
private static StartMatchLever StartMatchLever
{
get
{
if ((Object)(object)_startMatchLever == (Object)null)
{
_startMatchLever = Object.FindAnyObjectByType<StartMatchLever>();
}
return _startMatchLever;
}
}
[HarmonyPatch(typeof(StartOfRound), "Awake")]
[HarmonyPostfix]
private static void StartOfRound_Post_Awake(StartOfRound __instance)
{
if ((Object)(object)Plugin.boombox != (Object)null)
{
Item val = ((IEnumerable<Item>)__instance.allItemsList.itemsList).FirstOrDefault((Func<Item, bool>)((Item item) => ((Object)item).name == "Boombox" && item.itemId == 9));
if ((Object)(object)val != (Object)null)
{
BoomboxItem component = val.spawnPrefab.GetComponent<BoomboxItem>();
if (Array.IndexOf(component.musicAudios, Plugin.boombox) < 0)
{
component.musicAudios = new List<AudioClip>(component.musicAudios) { Plugin.boombox }.ToArray();
Plugin.Logger.LogDebug((object)"Loaded Upturned track into Boombox");
}
}
}
SkinManager.Reset();
}
[HarmonyPatch(typeof(RoundManager), "SyncScrapValuesClientRpc")]
[HarmonyPostfix]
private static void RoundManager_Post_SyncScrapValuesClientRpc(NetworkObjectReference[] spawnedScrap)
{
SkinManager.ApplySkinsToItems(spawnedScrap);
}
[HarmonyPatch(typeof(GrabbableObject), "Start")]
[HarmonyPostfix]
private static void GrabbableObject_Post_Start(GrabbableObject __instance)
{
if (((Object)__instance.itemProperties).name == "FishTestProp" && (Object)(object)__instance.mainObjectRenderer != (Object)null)
{
SkinManager.fish.Add((Renderer)(object)__instance.mainObjectRenderer);
}
}
[HarmonyPatch(typeof(GrabbableObject), "SetControlTipsForItem")]
[HarmonyPostfix]
private static void GrabbableObject_Post_SetControlTipsForItem(GrabbableObject __instance)
{
SubstituteItemName substituteItemName = default(SubstituteItemName);
if (((Component)__instance).TryGetComponent<SubstituteItemName>(ref substituteItemName))
{
((TMP_Text)HUDManager.Instance.controlTipLines[0]).SetText(((TMP_Text)HUDManager.Instance.controlTipLines[0]).text.Replace(__instance.itemProperties.itemName, substituteItemName.subName), true);
}
}
[HarmonyPatch(typeof(BoomboxItem), "Start")]
[HarmonyPostfix]
private static void BoomboxItem_Post_Start(BoomboxItem __instance)
{
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
NetworkObject val = default(NetworkObject);
if (Plugin.configBoombox.Value && !((Object)(object)((GrabbableObject)__instance).mainObjectRenderer == (Object)null) && !((Object)(object)StartMatchLever == (Object)null) && StartMatchLever.leverHasBeenPulled && ((Component)__instance).TryGetComponent<NetworkObject>(ref val) && new Random(StartOfRound.Instance.randomMapSeed * (int)val.NetworkObjectId).NextDouble() >= 0.5)
{
Material[] materials = ((Renderer)((GrabbableObject)__instance).mainObjectRenderer).materials;
materials[3].SetColor("_Color", SHINY_BOOMBOX);
materials[3].SetColor("_BaseColor", SHINY_BOOMBOX);
materials[3].SetFloat("_Metallic", 0.6833333f);
materials[3].SetFloat("_Smoothness", 0.275f);
((Renderer)((GrabbableObject)__instance).mainObjectRenderer).materials = materials;
}
}
}
internal class SkinManager
{
private static readonly List<IUpturnedItem> allSkinnedItems = new List<IUpturnedItem>(10)
{
new UpturnedGiftBox(),
new UpturnedCandy(),
new UpturnedPerfume(),
new UpturnedPills(),
new UpturnedMug(),
new UpturnedControlPad(),
new UpturnedFish(),
new UpturnedSteeringWheel(),
new UpturnedPickles(),
new UpturnedLamp()
};
private static HashSet<ulong> cache = new HashSet<ulong>();
private static Random random;
internal static List<Renderer> fish = new List<Renderer>();
internal static void LoadAllConfigs(ConfigFile cfg)
{
foreach (IUpturnedItem allSkinnedItem in allSkinnedItems)
{
allSkinnedItem.LoadConfigs(cfg);
}
}
internal static void LoadAllSkins(AssetBundle bundle)
{
foreach (IUpturnedItem allSkinnedItem in allSkinnedItems)
{
allSkinnedItem.LoadSkins(bundle);
}
}
internal static void Reset()
{
cache.Clear();
fish.Clear();
}
internal static void ApplySkinsToItems(NetworkObjectReference[] netRefs)
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
random = new Random(StartOfRound.Instance.randomMapSeed + 32322);
NetworkObject val2 = default(NetworkObject);
GrabbableObject item = default(GrabbableObject);
for (int i = 0; i < netRefs.Length; i++)
{
NetworkObjectReference val = netRefs[i];
if (!((NetworkObjectReference)(ref val)).TryGet(ref val2, (NetworkManager)null) || !cache.Add(val2.NetworkObjectId) || !((Component)val2).TryGetComponent<GrabbableObject>(ref item))
{
continue;
}
IUpturnedItem upturnedItem = allSkinnedItems.FirstOrDefault((IUpturnedItem skin) => skin.GetItemName() == ((Object)item.itemProperties).name);
if (upturnedItem != null)
{
int[] randomData = upturnedItem.GetRandomData();
int[] array = new int[randomData.Length];
for (int j = 0; j < randomData.Length; j++)
{
array[j] = random.Next(randomData[j]);
}
if (upturnedItem.MatchToVanillaItem(item))
{
upturnedItem.ApplySkin(item, array);
}
}
}
}
internal static bool IsThereABanana()
{
bool flag = false;
bool result = false;
for (int i = 0; i < fish.Count; i++)
{
if ((Object)(object)fish[i] == (Object)null)
{
flag = true;
}
else if (fish[i].sharedMaterials != null && fish[i].sharedMaterials.Length == 3)
{
result = true;
}
}
if (flag)
{
fish.RemoveAll((Renderer x) => x == null);
}
return result;
}
}
public class SubstituteItemName : MonoBehaviour
{
public string subName;
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "UpturnedVariety";
public const string PLUGIN_NAME = "UpturnedVariety";
public const string PLUGIN_VERSION = "2.1.0";
}
}
namespace UpturnedVariety.Defs.Items
{
internal interface IUpturnedItem
{
internal string GetItemName();
internal int[] GetRandomData();
internal void LoadConfigs(ConfigFile cfg);
internal void LoadSkins(AssetBundle bundle);
internal bool MatchToVanillaItem(GrabbableObject item);
internal void ApplySkin(GrabbableObject item, int[] rand);
}
internal class UpturnedCandy : IUpturnedItem
{
private static ConfigEntry<bool> enableTextures;
private static ConfigEntry<bool> enableMeshes;
private static Material lollyPop;
private static Material lightWood;
private static Material candyPink;
private static Mesh cylinder;
private static Mesh sucker;
public string GetItemName()
{
return "Candy";
}
public int[] GetRandomData()
{
return new int[2] { 2, 2 };
}
public void LoadConfigs(ConfigFile cfg)
{
enableTextures = cfg.Bind<bool>("Items", "Perfume", true, "Enables alternate palettes for the \"Candy\" item.");
enableMeshes = cfg.Bind<bool>("Items", "PerfumeModels", true, "Enables alternate models for the \"Candy\" item.");
}
public void LoadSkins(AssetBundle bundle)
{
lollyPop = bundle.LoadAsset<Material>("LollyPop");
lightWood = bundle.LoadAsset<Material>("LightWood");
candyPink = bundle.LoadAsset<Material>("CandyPink");
cylinder = bundle.LoadAsset<Mesh>("Cylinder.001");
sucker = bundle.LoadAsset<Mesh>("Sucker");
if ((Object)(object)lollyPop == (Object)null || (Object)(object)lightWood == (Object)null || (Object)(object)candyPink == (Object)null || (Object)(object)cylinder == (Object)null || (Object)(object)sucker == (Object)null)
{
throw new Exception("Failed to load assets for \"Candy\" item");
}
}
public bool MatchToVanillaItem(GrabbableObject item)
{
MeshRenderer mainObjectRenderer = item.mainObjectRenderer;
if (((mainObjectRenderer != null) ? ((Renderer)mainObjectRenderer).sharedMaterials : null) != null && ((Renderer)item.mainObjectRenderer).sharedMaterials.Length == 2)
{
return ((Object)((Renderer)item.mainObjectRenderer).sharedMaterials[0]).name.StartsWith("LollyPop");
}
return false;
}
public void ApplySkin(GrabbableObject item, int[] rand)
{
if (enableTextures.Value && rand[0] == 1)
{
((Renderer)item.mainObjectRenderer).materials = (Material[])(object)new Material[2] { lollyPop, lightWood };
Plugin.Logger.LogDebug((object)$"Candy #{((Component)item).GetComponent<NetworkObject>().NetworkObjectId} using alternate texture");
if (rand[1] == 0)
{
((Component)item.mainObjectRenderer).GetComponent<MeshFilter>().mesh = cylinder;
}
}
if (enableMeshes.Value && rand[1] == 1)
{
((Component)item.mainObjectRenderer).GetComponent<MeshFilter>().mesh = sucker;
Plugin.Logger.LogDebug((object)$"Candy #{((Component)item).GetComponent<NetworkObject>().NetworkObjectId} using alternate model");
if (rand[0] == 0)
{
((Renderer)item.mainObjectRenderer).materials = (Material[])(object)new Material[2]
{
candyPink,
((Renderer)item.mainObjectRenderer).sharedMaterials[1]
};
}
}
}
}
internal class UpturnedControlPad : IUpturnedItem
{
private static ConfigEntry<bool> enableTextures;
private static Texture arcadeControlPanel2;
public string GetItemName()
{
return "ControlPad";
}
public int[] GetRandomData()
{
return new int[1] { 2 };
}
public void LoadConfigs(ConfigFile cfg)
{
enableTextures = cfg.Bind<bool>("Items", "ControlPad", true, "Enables alternate palettes for the \"Control pad\" item.");
}
public void LoadSkins(AssetBundle bundle)
{
arcadeControlPanel2 = bundle.LoadAsset<Texture>("ArcadeControlPanel2");
if ((Object)(object)arcadeControlPanel2 == (Object)null)
{
throw new Exception("Failed to load assets for \"Control pad\" item");
}
}
public bool MatchToVanillaItem(GrabbableObject item)
{
Renderer val = default(Renderer);
if (((Component)item).TryGetComponent<Renderer>(ref val) && (Object)(object)val.sharedMaterial != (Object)null)
{
return ((Object)val.sharedMaterial).name.StartsWith("ArcadeControlPanel");
}
return false;
}
public void ApplySkin(GrabbableObject item, int[] rand)
{
if (enableTextures.Value && rand[0] == 1)
{
((Component)item).GetComponent<Renderer>().material.mainTexture = arcadeControlPanel2;
Plugin.Logger.LogDebug((object)$"Controller #{((Component)item).GetComponent<NetworkObject>().NetworkObjectId} using alternate texture");
}
}
}
internal class UpturnedFish : IUpturnedItem
{
private static readonly Color YELLOW_FISH = new Color(0.773024f, 0.8392157f, 0.3692549f);
private static readonly Color SILVER_FISH = new Color(0.5019608f, 0.1780566f, 0.1556078f);
private static readonly Color YELLOW_RUBBER = new Color(0.44f, 0.4296874f, 0.2028124f);
private static readonly Color MATERIAL_001 = new Color(0.3799999f, 0.243271f, 0.1527103f);
private static ConfigEntry<bool> enableMeshes;
private static Mesh fish2;
private static Mesh sardine;
private static Mesh sardine001;
public string GetItemName()
{
return "FishTestProp";
}
public int[] GetRandomData()
{
return new int[2] { 4, 3 };
}
public void LoadConfigs(ConfigFile cfg)
{
enableMeshes = cfg.Bind<bool>("Items", "Fish", true, "Enables alternate models for the \"Plastic fish\" item.");
}
public void LoadSkins(AssetBundle bundle)
{
fish2 = bundle.LoadAsset<Mesh>("Fish2");
sardine = bundle.LoadAsset<Mesh>("Sardine");
sardine001 = bundle.LoadAsset<Mesh>("Sardine.001");
if ((Object)(object)fish2 == (Object)null || (Object)(object)sardine == (Object)null || (Object)(object)sardine001 == (Object)null)
{
throw new Exception("Failed to load assets for \"Plastic fish\" item");
}
}
public bool MatchToVanillaItem(GrabbableObject item)
{
MeshRenderer mainObjectRenderer = item.mainObjectRenderer;
if (((mainObjectRenderer != null) ? ((Renderer)mainObjectRenderer).sharedMaterials : null) != null && ((Renderer)item.mainObjectRenderer).sharedMaterials.Length == 2)
{
return ((Object)((Renderer)item.mainObjectRenderer).sharedMaterials[0]).name.StartsWith("Eye");
}
return false;
}
public void ApplySkin(GrabbableObject item, int[] rand)
{
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
if (!enableMeshes.Value)
{
return;
}
int num = rand[0];
if (num == 3 && SkinManager.IsThereABanana())
{
num = rand[1];
}
if (num > 0)
{
MeshFilter component = ((Component)item.mainObjectRenderer).GetComponent<MeshFilter>();
switch (num)
{
case 1:
{
component.mesh = fish2;
Material val4 = ((Renderer)item.mainObjectRenderer).materials[1];
val4.SetColor("_Color", YELLOW_FISH);
val4.SetColor("_BaseColor", YELLOW_FISH);
((Renderer)item.mainObjectRenderer).materials = (Material[])(object)new Material[2]
{
val4,
((Renderer)item.mainObjectRenderer).sharedMaterials[0]
};
break;
}
case 2:
{
component.mesh = sardine;
Material val3 = ((Renderer)item.mainObjectRenderer).materials[1];
val3.SetColor("_Color", SILVER_FISH);
val3.SetColor("_BaseColor", SILVER_FISH);
((Renderer)item.mainObjectRenderer).materials = (Material[])(object)new Material[2]
{
((Renderer)item.mainObjectRenderer).sharedMaterials[0],
val3
};
break;
}
case 3:
{
component.mesh = sardine001;
Material val = ((Renderer)item.mainObjectRenderer).materials[1];
Material val2 = Object.Instantiate<Material>(val);
val.SetColor("_Color", YELLOW_RUBBER);
val.SetColor("_BaseColor", YELLOW_RUBBER);
val2.SetColor("_Color", MATERIAL_001);
val2.SetColor("_BaseColor", MATERIAL_001);
((Renderer)item.mainObjectRenderer).materials = (Material[])(object)new Material[3]
{
((Renderer)item.mainObjectRenderer).sharedMaterials[0],
val,
val2
};
break;
}
}
Plugin.Logger.LogDebug((object)$"Fish #{((Component)item).GetComponent<NetworkObject>().NetworkObjectId} using alternate model");
}
}
}
internal class UpturnedGiftBox : IUpturnedItem
{
private static ConfigEntry<bool> enableTextures;
private static Texture giftBoxTex2;
public string GetItemName()
{
return "GiftBox";
}
public int[] GetRandomData()
{
return new int[1] { 2 };
}
public void LoadConfigs(ConfigFile cfg)
{
enableTextures = cfg.Bind<bool>("Items", "Gift", true, "Enables alternate palettes for the \"Gift box\" item.");
}
public void LoadSkins(AssetBundle bundle)
{
giftBoxTex2 = bundle.LoadAsset<Texture>("GiftBoxTex2");
if ((Object)(object)giftBoxTex2 == (Object)null)
{
throw new Exception("Failed to load assets for \"Gift box\" item");
}
}
public bool MatchToVanillaItem(GrabbableObject item)
{
if (item is GiftBoxItem)
{
return item.itemProperties.itemId == 152767;
}
return false;
}
public void ApplySkin(GrabbableObject item, int[] rand)
{
if (enableTextures.Value && rand[0] == 1)
{
((Component)item).GetComponent<Renderer>().material.mainTexture = giftBoxTex2;
Plugin.Logger.LogDebug((object)$"Gift #{((Component)item).GetComponent<NetworkObject>().NetworkObjectId} using alternate texture");
}
}
}
internal class UpturnedLamp : IUpturnedItem
{
private static readonly Color LAMP_STAND_UPTURNED = new Color(0.2395526f, 0.2213185f, 0.1565525f);
private static readonly Color RUBBER_HANDLE_UPTURNED = new Color(0.01842319f, 0.01562534f, 0.01562534f);
private static readonly Color DARK_STEEL_UPTURNED = new Color(0.2547169f, 0.2547169f, 0.2547169f);
private static readonly Color LAMPSHADE_LETHAL = new Color(0.513327f, 0.4134762f, 0.3871232f);
private static readonly Color LAMP_STAND_LETHAL = new Color(0.5266604f, 0.5077859f, 0.4321852f);
private static readonly Color DARK_STEEL_LETHAL = new Color(0.1733264f, 0.1733264f, 0.1733264f);
private static ConfigEntry<bool> enableMeshes;
private static Material lampshade;
private static Mesh cylinder;
public string GetItemName()
{
return "FancyLamp";
}
public int[] GetRandomData()
{
return new int[2] { 2, 2 };
}
public void LoadConfigs(ConfigFile cfg)
{
enableMeshes = cfg.Bind<bool>("Items", "Lamp", true, "Enables alternate models for the \"Fancy lamp\" item.");
}
public void LoadSkins(AssetBundle bundle)
{
lampshade = bundle.LoadAsset<Material>("Lampshade");
cylinder = bundle.LoadAsset<Mesh>("Cylinder.000");
if ((Object)(object)lampshade == (Object)null || (Object)(object)cylinder == (Object)null)
{
throw new Exception("Failed to load assets for \"Fancy lamp\" item");
}
}
public bool MatchToVanillaItem(GrabbableObject item)
{
MeshRenderer mainObjectRenderer = item.mainObjectRenderer;
if ((Object)(object)((mainObjectRenderer != null) ? ((Renderer)mainObjectRenderer).sharedMaterial : null) != (Object)null)
{
return ((Object)((Renderer)item.mainObjectRenderer).sharedMaterial).name.StartsWith("FancyLampTex");
}
return false;
}
public void ApplySkin(GrabbableObject item, int[] rand)
{
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_0271: Unknown result type (might be due to invalid IL or missing references)
//IL_0283: Unknown result type (might be due to invalid IL or missing references)
//IL_02b9: Unknown result type (might be due to invalid IL or missing references)
//IL_02cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f0: 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_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
if (enableMeshes.Value && rand[1] == 1)
{
((Component)item.mainObjectRenderer).GetComponent<MeshFilter>().mesh = cylinder;
Plugin.Logger.LogDebug((object)$"Lamp #{((Component)item).GetComponent<NetworkObject>().NetworkObjectId} using alternate model");
Material val = Object.Instantiate<Material>(((Renderer)item.mainObjectRenderer).sharedMaterial);
val.SetTexture("_MainTex", (Texture)null);
val.SetTexture("_BaseColorMap", (Texture)null);
Material[] array = (Material[])(object)new Material[4]
{
default(Material),
val,
Object.Instantiate<Material>(val),
Object.Instantiate<Material>(val)
};
Light componentInChildren = ((Component)item.mainObjectRenderer).GetComponentInChildren<Light>();
((Component)componentInChildren).transform.localPosition = new Vector3(((Component)componentInChildren).transform.localPosition.x, ((Component)componentInChildren).transform.localPosition.y, 1.626763f);
if (rand[0] == 0)
{
array[0] = lampshade;
array[1].SetColor("_Color", LAMP_STAND_UPTURNED);
array[1].SetColor("_BaseColor", LAMP_STAND_UPTURNED);
array[1].SetFloat("_Metallic", 0.7f);
array[1].SetFloat("_Smoothness", 0.5f);
array[2].SetColor("_Color", RUBBER_HANDLE_UPTURNED);
array[2].SetColor("_BaseColor", RUBBER_HANDLE_UPTURNED);
array[2].SetFloat("_Metallic", 0f);
array[2].SetFloat("_Smoothness", 0.5f);
array[3].SetColor("_Color", DARK_STEEL_UPTURNED);
array[3].SetColor("_BaseColor", DARK_STEEL_UPTURNED);
array[3].SetFloat("_Metallic", 0.724f);
array[3].SetFloat("_Smoothness", 0.5f);
componentInChildren.colorTemperature = 4846f;
}
else
{
array[0] = Object.Instantiate<Material>(val);
array[0].SetColor("_Color", LAMPSHADE_LETHAL);
array[0].SetColor("_BaseColor", LAMPSHADE_LETHAL);
array[0].SetFloat("_Metallic", 0f);
array[0].SetFloat("_Smoothness", 0.5f);
array[1].SetColor("_Color", LAMP_STAND_LETHAL);
array[1].SetColor("_BaseColor", LAMP_STAND_LETHAL);
array[1].SetFloat("_Metallic", 0.4583333f);
array[1].SetFloat("_Smoothness", 0.5f);
array[2].SetColor("_Color", Color.black);
array[2].SetColor("_BaseColor", Color.black);
array[2].SetFloat("_Metallic", 0f);
array[2].SetFloat("_Smoothness", 0.0916667f);
array[3].SetColor("_Color", DARK_STEEL_LETHAL);
array[3].SetColor("_BaseColor", DARK_STEEL_LETHAL);
array[3].SetFloat("_Metallic", 0.3416667f);
array[3].SetFloat("_Smoothness", 0.55f);
componentInChildren.colorTemperature = 4412f;
}
((Renderer)item.mainObjectRenderer).sharedMaterials = array;
}
}
}
internal class UpturnedMug : IUpturnedItem
{
private static ConfigEntry<bool> enableTextures;
private static Material coffeeMug6;
public string GetItemName()
{
return "Mug";
}
public int[] GetRandomData()
{
return new int[1] { 6 };
}
public void LoadConfigs(ConfigFile cfg)
{
enableTextures = cfg.Bind<bool>("Items", "Mug", true, "Enables alternate palettes for the \"Mug\" item.");
}
public void LoadSkins(AssetBundle bundle)
{
coffeeMug6 = bundle.LoadAsset<Material>("CoffeeMug6");
if ((Object)(object)coffeeMug6 == (Object)null)
{
throw new Exception("Failed to load assets for \"Mug\" item");
}
}
public bool MatchToVanillaItem(GrabbableObject item)
{
MeshRenderer mainObjectRenderer = item.mainObjectRenderer;
if ((Object)(object)((mainObjectRenderer != null) ? ((Renderer)mainObjectRenderer).sharedMaterial : null) != (Object)null)
{
return ((Object)((Renderer)item.mainObjectRenderer).sharedMaterial).name.StartsWith("CoffeeMug");
}
return false;
}
public void ApplySkin(GrabbableObject item, int[] rand)
{
if (enableTextures.Value && rand[0] == 5)
{
((Renderer)item.mainObjectRenderer).material = coffeeMug6;
Plugin.Logger.LogDebug((object)$"Mug #{((Component)item).GetComponent<NetworkObject>().NetworkObjectId} using alternate texture");
}
}
}
internal class UpturnedPerfume : IUpturnedItem
{
private static readonly Color RED = new Color(0.9f, 0.3922666f, 0.324f, 0.6313726f);
private static readonly Color RED_TRANS = new Color(1f, 0.4f, 0.4f);
private static readonly Color BLUE = new Color(0.4509091f, 0.416f, 0.8f, 0.6313726f);
private static readonly Color BLUE_TRANS = new Color(0.59f, 0.6241666f, 1f);
private static readonly Color BLACK = new Color(0.01f, 0.01f, 0.01f, 0.6313726f);
private static readonly Color BLACK_TRANS = new Color(0.48f, 0.48f, 0.48f);
private static ConfigEntry<bool> enableTextures;
private static ConfigEntry<bool> enableMeshes;
private static Mesh[] meshes;
public string GetItemName()
{
return "PerfumeBottle";
}
public int[] GetRandomData()
{
return new int[2] { 4, 6 };
}
public void LoadConfigs(ConfigFile cfg)
{
enableTextures = cfg.Bind<bool>("Items", "Perfume", true, "Enables alternate palettes for the \"Perfume bottle\" item.");
enableMeshes = cfg.Bind<bool>("Items", "PerfumeModels", true, "Enables alternate models for the \"Perfume bottle\" item.");
}
public void LoadSkins(AssetBundle bundle)
{
meshes = (Mesh[])(object)new Mesh[5]
{
bundle.LoadAsset<Mesh>("PerfumeBottle_001"),
bundle.LoadAsset<Mesh>("PerfumeBottle_002"),
bundle.LoadAsset<Mesh>("PerfumeBottle_003"),
bundle.LoadAsset<Mesh>("PerfumeBottle_004"),
bundle.LoadAsset<Mesh>("PerfumeBottle_005")
};
if (meshes.Any((Mesh mesh) => mesh == null))
{
throw new Exception("Failed to load assets for \"Perfume bottle\" item");
}
}
public bool MatchToVanillaItem(GrabbableObject item)
{
MeshRenderer mainObjectRenderer = item.mainObjectRenderer;
if (((mainObjectRenderer != null) ? ((Renderer)mainObjectRenderer).sharedMaterials : null) != null && ((Renderer)item.mainObjectRenderer).sharedMaterials.Length == 2)
{
return ((Object)((Renderer)item.mainObjectRenderer).sharedMaterials[0]).name.StartsWith("Material.004");
}
return false;
}
public void ApplySkin(GrabbableObject item, int[] rand)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
if (enableTextures.Value && rand[0] > 0)
{
Color val = default(Color);
Color val2 = default(Color);
switch (rand[0])
{
case 1:
val = RED;
val2 = RED_TRANS;
break;
case 2:
val = BLUE;
val2 = BLUE_TRANS;
break;
case 3:
val = BLACK;
val2 = BLACK_TRANS;
break;
}
Material val3 = ((Renderer)item.mainObjectRenderer).materials[0];
val3.SetColor("_Color", val);
val3.SetColor("_BaseColor", val);
val3.SetColor("_TransmittanceColor", val2);
((Renderer)item.mainObjectRenderer).materials = (Material[])(object)new Material[2]
{
val3,
((Renderer)item.mainObjectRenderer).sharedMaterials[1]
};
Plugin.Logger.LogDebug((object)$"Perfume #{((Component)item).GetComponent<NetworkObject>().NetworkObjectId} using alternate color");
}
if (enableMeshes.Value && rand[1] > 0 && rand[1] <= meshes.Length)
{
((Component)item.mainObjectRenderer).GetComponent<MeshFilter>().mesh = meshes[rand[1] - 1];
Plugin.Logger.LogDebug((object)$"Perfume #{((Component)item).GetComponent<NetworkObject>().NetworkObjectId} using alternate model");
}
}
}
internal class UpturnedPickles : IUpturnedItem
{
private static ConfigEntry<bool> enableMeshes;
private static Material glassCase;
private static Material displayCasePlastic;
private static Mesh glassJar;
private static GameObject candyGlob;
public string GetItemName()
{
return "PickleJar";
}
public int[] GetRandomData()
{
return new int[1] { 2 };
}
public void LoadConfigs(ConfigFile cfg)
{
enableMeshes = cfg.Bind<bool>("Items", "Pickles", true, "Enables alternate models for the \"Jar of pickles\" item.");
}
public void LoadSkins(AssetBundle bundle)
{
glassJar = bundle.LoadAsset<Mesh>("GlassJar");
glassCase = bundle.LoadAsset<Material>("GlassCase");
displayCasePlastic = bundle.LoadAsset<Material>("DisplayCasePlastic");
candyGlob = bundle.LoadAsset<GameObject>("CandyGlob");
if ((Object)(object)glassJar == (Object)null || (Object)(object)glassCase == (Object)null || (Object)(object)displayCasePlastic == (Object)null || (Object)(object)candyGlob == (Object)null)
{
throw new Exception("Failed to load assets for \"Jar of pickles\" item");
}
}
public bool MatchToVanillaItem(GrabbableObject item)
{
Renderer val = default(Renderer);
if (((Component)item).TryGetComponent<Renderer>(ref val) && val.sharedMaterials != null && val.sharedMaterials.Length == 2 && ((Object)val.sharedMaterials[0]).name.StartsWith("JarGlass"))
{
return (Object)(object)((Component)item).transform.Find("Pickles.001") != (Object)null;
}
return false;
}
public void ApplySkin(GrabbableObject item, int[] rand)
{
if (enableMeshes.Value && rand[0] == 1)
{
((Component)((Component)item).transform.Find("Pickles.001")).gameObject.SetActive(false);
((Component)item).GetComponent<MeshFilter>().mesh = glassJar;
((Component)item).GetComponent<Renderer>().materials = (Material[])(object)new Material[2] { glassCase, displayCasePlastic };
Object.Instantiate<GameObject>(candyGlob, ((Component)item).transform);
ScanNodeProperties componentInChildren = ((Component)item).GetComponentInChildren<ScanNodeProperties>();
if ((Object)(object)componentInChildren != (Object)null)
{
componentInChildren.headerText = "Candy filled jar";
}
((Component)item).gameObject.AddComponent<SubstituteItemName>().subName = "Candy jar";
Plugin.Logger.LogDebug((object)$"Pickles #{((Component)item).GetComponent<NetworkObject>().NetworkObjectId} is alternate");
}
}
}
internal class UpturnedPills : IUpturnedItem
{
private static ConfigEntry<bool> enableTextures;
private static Texture pillBottleTextureB2;
public string GetItemName()
{
return "PillBottle";
}
public int[] GetRandomData()
{
return new int[1] { 2 };
}
public void LoadConfigs(ConfigFile cfg)
{
enableTextures = cfg.Bind<bool>("Items", "Pills", true, "Enables alternate palettes for the \"Pill bottle\" item.");
}
public void LoadSkins(AssetBundle bundle)
{
pillBottleTextureB2 = bundle.LoadAsset<Texture>("PillBottleTextureB2");
if ((Object)(object)pillBottleTextureB2 == (Object)null)
{
throw new Exception("Failed to load assets for \"Pill bottle\" item");
}
}
public bool MatchToVanillaItem(GrabbableObject item)
{
MeshRenderer mainObjectRenderer = item.mainObjectRenderer;
if ((Object)(object)((mainObjectRenderer != null) ? ((Renderer)mainObjectRenderer).sharedMaterial : null) != (Object)null)
{
return ((Object)((Renderer)item.mainObjectRenderer).sharedMaterial).name.StartsWith("Material.002");
}
return false;
}
public void ApplySkin(GrabbableObject item, int[] rand)
{
if (enableTextures.Value && rand[0] == 1)
{
((Renderer)item.mainObjectRenderer).material.mainTexture = pillBottleTextureB2;
Plugin.Logger.LogDebug((object)$"Pills #{((Component)item).GetComponent<NetworkObject>().NetworkObjectId} using alternate texture");
}
}
}
internal class UpturnedSteeringWheel : IUpturnedItem
{
private static ConfigEntry<bool> enableTextures;
private static Material darkPlastic;
public string GetItemName()
{
return "SteeringWheel";
}
public int[] GetRandomData()
{
return new int[1] { 2 };
}
public void LoadConfigs(ConfigFile cfg)
{
enableTextures = cfg.Bind<bool>("Items", "SteeringWheel", true, "Enables alternate palettes for the \"Steering wheel\" item.");
}
public void LoadSkins(AssetBundle bundle)
{
darkPlastic = bundle.LoadAsset<Material>("DarkPlastic");
if ((Object)(object)darkPlastic == (Object)null)
{
throw new Exception("Failed to load assets for \"Steering wheel\" item");
}
}
public bool MatchToVanillaItem(GrabbableObject item)
{
if ((Object)(object)item.mainObjectRenderer != (Object)null && (Object)(object)((Renderer)item.mainObjectRenderer).sharedMaterial != (Object)null)
{
return ((Object)((Renderer)item.mainObjectRenderer).sharedMaterial).name.StartsWith("DirtySmoothSteel");
}
return false;
}
public void ApplySkin(GrabbableObject item, int[] rand)
{
if (enableTextures.Value && rand[0] == 1)
{
((Renderer)item.mainObjectRenderer).material = darkPlastic;
Plugin.Logger.LogDebug((object)$"Wheel #{((Component)item).GetComponent<NetworkObject>().NetworkObjectId} using alternate texture");
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}