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.Serialization.Formatters.Binary;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using JuicesMod.Properties;
using LethalLib.Extras;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Shlygly.JuicesMod.NetcodePatcher;
using Unity.Collections;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Shlygly.JuicesMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: AssemblyInformationalVersion("1.4.0+cc5b837848b4392953060dd09981af30e4256a7c")]
[assembly: AssemblyProduct("JuicesMod")]
[assembly: AssemblyTitle("Shlygly.JuicesMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.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]
[Microsoft.CodeAnalysis.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]
[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 JuicesMod
{
internal class Config : SyncedInstance<Config>
{
[CompilerGenerated]
private static class <>O
{
public static HandleNamedMessageDelegate <0>__OnRequestSync;
public static HandleNamedMessageDelegate <1>__OnReceiveSync;
}
public readonly ConfigEntry<int> cartonsRarity;
public readonly ConfigEntry<int> premiumsRarity;
public readonly ConfigEntry<int> packRarity;
public readonly ConfigEntry<int> canRarity;
public Config(ConfigFile configFile)
{
InitInstance(this);
configFile.SaveOnConfigSet = false;
cartonsRarity = configFile.Bind<int>("Items.Rarity", "CartonsRarity", 60, "How likely cartons juices spawn (between 1 and 100)");
premiumsRarity = configFile.Bind<int>("Items.Rarity", "PremiumRarity", 40, "How likely premiums juices spawn (between 1 and 100)");
packRarity = configFile.Bind<int>("Items.Rarity", "PackRarity", 20, "How likely six pack juices spawn (between 1 and 100)");
canRarity = configFile.Bind<int>("Items.Rarity", "CanRarity", 50, "How likely cans juices spawn (between 1 and 100)");
ClearOrphanedEntries(configFile);
configFile.Save();
configFile.SaveOnConfigSet = true;
}
private static void ClearOrphanedEntries(ConfigFile configFile)
{
PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries");
Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(configFile);
dictionary.Clear();
}
public static void RequestSync()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
if (!SyncedInstance<Config>.IsClient)
{
return;
}
FastBufferWriter val = default(FastBufferWriter);
((FastBufferWriter)(ref val))..ctor(SyncedInstance<Config>.IntSize, (Allocator)2, -1);
try
{
SyncedInstance<Config>.MessageManager.SendNamedMessage("ModName_OnRequestConfigSync", 0uL, val, (NetworkDelivery)3);
}
finally
{
((IDisposable)(FastBufferWriter)(ref val)).Dispose();
}
}
public static void OnRequestSync(ulong clientId, FastBufferReader _)
{
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
if (!SyncedInstance<Config>.IsHost)
{
return;
}
Plugin.Logger.LogInfo((object)$"Config sync request received from client: {clientId}");
byte[] array = SyncedInstance<Config>.SerializeToBytes(SyncedInstance<Config>.Instance);
int num = array.Length;
FastBufferWriter val = default(FastBufferWriter);
((FastBufferWriter)(ref val))..ctor(num + SyncedInstance<Config>.IntSize, (Allocator)2, -1);
try
{
((FastBufferWriter)(ref val)).WriteValueSafe<int>(ref num, default(ForPrimitives));
((FastBufferWriter)(ref val)).WriteBytesSafe(array, -1, 0);
SyncedInstance<Config>.MessageManager.SendNamedMessage("ModName_OnReceiveConfigSync", clientId, val, (NetworkDelivery)3);
}
catch (Exception arg)
{
Plugin.Logger.LogInfo((object)$"Error occurred syncing config with client: {clientId}\n{arg}");
}
finally
{
((IDisposable)(FastBufferWriter)(ref val)).Dispose();
}
}
public static void OnReceiveSync(ulong _, FastBufferReader reader)
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
if (!((FastBufferReader)(ref reader)).TryBeginRead(SyncedInstance<Config>.IntSize))
{
Plugin.Logger.LogError((object)"Config sync error: Could not begin reading buffer.");
return;
}
int num = default(int);
((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref num, default(ForPrimitives));
if (!((FastBufferReader)(ref reader)).TryBeginRead(num))
{
Plugin.Logger.LogError((object)"Config sync error: Host could not sync.");
return;
}
byte[] data = new byte[num];
((FastBufferReader)(ref reader)).ReadBytesSafe(ref data, num, 0);
SyncedInstance<Config>.SyncInstance(data);
Plugin.Logger.LogInfo((object)"Successfully synced config with host.");
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
public static void InitializeLocalPlayer()
{
//IL_0060: 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_006b: Expected O, but got Unknown
//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)
//IL_0030: Expected O, but got Unknown
if (SyncedInstance<Config>.IsHost)
{
CustomMessagingManager messageManager = SyncedInstance<Config>.MessageManager;
object obj = <>O.<0>__OnRequestSync;
if (obj == null)
{
HandleNamedMessageDelegate val = OnRequestSync;
<>O.<0>__OnRequestSync = val;
obj = (object)val;
}
messageManager.RegisterNamedMessageHandler("JuicesMod_OnRequestConfigSync", (HandleNamedMessageDelegate)obj);
SyncedInstance<Config>.Synced = true;
return;
}
SyncedInstance<Config>.Synced = false;
CustomMessagingManager messageManager2 = SyncedInstance<Config>.MessageManager;
object obj2 = <>O.<1>__OnReceiveSync;
if (obj2 == null)
{
HandleNamedMessageDelegate val2 = OnReceiveSync;
<>O.<1>__OnReceiveSync = val2;
obj2 = (object)val2;
}
messageManager2.RegisterNamedMessageHandler("JuicesMod_OnReceiveConfigSync", (HandleNamedMessageDelegate)obj2);
RequestSync();
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GameNetworkManager), "StartDisconnect")]
public static void PlayerLeave()
{
SyncedInstance<Config>.RevertSync();
}
}
public class JuicesBuilder
{
private readonly AssetBundle bundle;
private Dictionary<Item, Tuple<FruitProperty, JuiceTypeProperty>> juices = new Dictionary<Item, Tuple<FruitProperty, JuiceTypeProperty>>();
private Dictionary<JuiceTypeProperty, Item> multifruits = new Dictionary<JuiceTypeProperty, Item>();
public Item[] Juices
{
get
{
Dictionary<Item, Tuple<FruitProperty, JuiceTypeProperty>>.KeyCollection keys = juices.Keys;
int num = 0;
Item[] array = (Item[])(object)new Item[keys.Count];
foreach (Item item in keys)
{
array[num] = item;
num++;
}
return array;
}
}
public JuicesBuilder(AssetBundle bundle)
{
this.bundle = bundle;
}
public void registerJuice(FruitProperty fruit, JuiceTypeProperty type, LevelTypes levelType = -1)
{
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
try
{
Item val = bundle.LoadAsset<Item>($"Assets/JuicesMod/Juices/{type.Name}s/{fruit.Name}Juice{type.Index:000}Item.asset");
val.minValue = type.MinValue;
val.maxValue = type.MaxValue;
NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
Utilities.FixMixerGroups(val.spawnPrefab);
Items.RegisterScrap(val, type.Rarity, levelType);
juices.Add(val, new Tuple<FruitProperty, JuiceTypeProperty>(fruit, type));
Plugin.Logger.LogInfo((object)("Registered juice : " + fruit.Name + " juice in " + type.Name + " format"));
}
catch (Exception)
{
Plugin.Logger.LogError((object)("Can't register " + fruit.Name + " juice in " + type.Name + " format !"));
}
}
public void registerMultifruitJuice(JuiceTypeProperty type)
{
try
{
Item val = bundle.LoadAsset<Item>($"Assets/JuicesMod/Juices/{type.Name}s/MultifruitJuice{type.Index:000}Item.asset");
NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
Utilities.FixMixerGroups(val.spawnPrefab);
Items.RegisterScrap(val, 0, (LevelTypes)1);
multifruits.Add(type, val);
Plugin.Logger.LogInfo((object)("Registered juice : Multifruit juice in " + type.Name + " format"));
}
catch (Exception)
{
Plugin.Logger.LogError((object)("Can't register Multifruit juice in " + type.Name + " format !"));
}
}
public bool hasJuiceProperty(GrabbableObject item)
{
return juices.ContainsKey(item.itemProperties);
}
public JuiceProperty getJuiceProperty(GrabbableObject item)
{
if (hasJuiceProperty(item))
{
Tuple<FruitProperty, JuiceTypeProperty> tuple = juices[item.itemProperties];
return new JuiceProperty(tuple.Item1, tuple.Item2, item.scrapValue);
}
throw new ArgumentException("Unable to find juice property for item \"" + ((Object)item).name + "\". Did you miss a check with \"hasJuiceProperty\" ?");
}
public bool isMultifruit(GrabbableObject item)
{
return multifruits.ContainsValue(item.itemProperties);
}
public Item getMultifruit(JuiceTypeProperty type)
{
if (multifruits.ContainsKey(type))
{
return multifruits[type];
}
return multifruits.Values.FirstOrDefault();
}
}
[BepInPlugin("Shlygly.JuicesMod", "JuicesMod", "1.4.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public static Plugin instance;
internal static ManualLogSource Logger;
internal static Config BoundConfig { get; private set; }
public JuicesBuilder JuicesBuilder { get; private set; } = null;
public UnlockablesBuilder UnlockablesBuilder { get; private set; } = null;
public Item VitaminDetector { get; private set; } = null;
private void Awake()
{
instance = this;
Logger = ((BaseUnityPlugin)this).Logger;
BoundConfig = new Config(((BaseUnityPlugin)this).Config);
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "juicesmod");
AssetBundle val = AssetBundle.LoadFromFile(text);
RegisterRPCs();
JuiceTypeProperty.Initialize();
JuicesBuilder = new JuicesBuilder(val);
UnlockablesBuilder = new UnlockablesBuilder(val);
foreach (JuiceTypeProperty value in JuiceTypeProperty.JUICE_TYPES.Values)
{
FruitProperty[] fRUITS = FruitProperty.FRUITS;
foreach (FruitProperty fruit in fRUITS)
{
JuicesBuilder.registerJuice(fruit, value, (LevelTypes)(-1));
}
JuicesBuilder.registerMultifruitJuice(value);
}
UnlockablesBuilder.register("JuiceBlender", 80, (StoreType)1);
UnlockablesBuilder.register("Neons/Sapik", 24, (StoreType)1);
UnlockablesBuilder.register("Neons/Cedhou", 24, (StoreType)1);
UnlockablesBuilder.register("Neons/Saifrai", 24, (StoreType)1);
try
{
VitaminDetector = val.LoadAsset<Item>("Assets/JuicesMod/VitaminDetectorItem.asset");
NetworkPrefabs.RegisterNetworkPrefab(VitaminDetector.spawnPrefab);
Utilities.FixMixerGroups(VitaminDetector.spawnPrefab);
TerminalNode val2 = ScriptableObject.CreateInstance<TerminalNode>();
val2.clearPreviousText = true;
val2.displayText = "A radar that detects nearby fruit juices.\n\n";
Items.RegisterShopItem(VitaminDetector, (TerminalNode)null, (TerminalNode)null, val2, 74);
Logger.LogInfo((object)"Registered Vitamin Detector");
}
catch (Exception)
{
Logger.LogError((object)"Can't register Vitamin Detector !");
}
Logger.LogInfo((object)"Juices Mod Loaded");
}
private void RegisterRPCs()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
}
[Serializable]
public class SyncedInstance<T>
{
[NonSerialized]
protected static int IntSize = 4;
internal static CustomMessagingManager MessageManager => NetworkManager.Singleton.CustomMessagingManager;
internal static bool IsClient => NetworkManager.Singleton.IsClient;
internal static bool IsHost => NetworkManager.Singleton.IsHost;
public static T Default { get; private set; }
public static T Instance { get; private set; }
public static bool Synced { get; internal set; }
protected void InitInstance(T instance)
{
Default = instance;
Instance = instance;
IntSize = 4;
}
internal static void SyncInstance(byte[] data)
{
Instance = DeserializeFromBytes(data);
Synced = true;
}
internal static void RevertSync()
{
Instance = Default;
Synced = false;
}
public static byte[] SerializeToBytes(T val)
{
BinaryFormatter binaryFormatter = new BinaryFormatter();
using MemoryStream memoryStream = new MemoryStream();
try
{
binaryFormatter.Serialize(memoryStream, val);
return memoryStream.ToArray();
}
catch (Exception arg)
{
Plugin.Logger.LogError((object)$"Error serializing instance: {arg}");
return null;
}
}
public static T DeserializeFromBytes(byte[] data)
{
BinaryFormatter binaryFormatter = new BinaryFormatter();
using MemoryStream serializationStream = new MemoryStream(data);
try
{
return (T)binaryFormatter.Deserialize(serializationStream);
}
catch (Exception arg)
{
Plugin.Logger.LogError((object)$"Error deserializing instance: {arg}");
return default(T);
}
}
}
public class UnlockablesBuilder
{
private readonly AssetBundle bundle;
public UnlockablesBuilder(AssetBundle bundle)
{
this.bundle = bundle;
}
public void register(string assetName, int price, StoreType storeType)
{
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
try
{
UnlockableItemDef val = bundle.LoadAsset<UnlockableItemDef>("Assets/JuicesMod/Unlockables/" + assetName + "/UnlockableItemDef.asset");
NetworkPrefabs.RegisterNetworkPrefab(val.unlockable.prefabObject);
Utilities.FixMixerGroups(val.unlockable.prefabObject);
Unlockables.RegisterUnlockable(val, price, storeType);
Plugin.Logger.LogInfo((object)("Registered unlockable : " + assetName));
}
catch (Exception)
{
Plugin.Logger.LogError((object)("Can't register " + assetName + " !"));
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Shlygly.JuicesMod";
public const string PLUGIN_NAME = "JuicesMod";
public const string PLUGIN_VERSION = "1.4.0";
}
}
namespace JuicesMod.Properties
{
public struct FruitProperty : INetworkSerializable
{
[ES3NonSerializable]
public static FruitProperty[] FRUITS = new FruitProperty[6]
{
new FruitProperty("Orange", new Color(1f, 0.5882353f, 0f)),
new FruitProperty("Apple", new Color(0.78039217f, 0.5568628f, 11f / 85f)),
new FruitProperty("Pineapple", new Color(1f, 0.8784314f, 0.5137255f)),
new FruitProperty("Tomato", new Color(47f / 51f, 0f, 0f)),
new FruitProperty("Prune", new Color(0.44313726f, 0f, 29f / 51f)),
new FruitProperty("Banana", new Color(0.9490196f, 76f / 85f, 0.6156863f))
};
public string Name;
public Color Color;
public FruitProperty(string name, Color color)
{
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
Name = name;
Color = color;
}
public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
{
serializer.SerializeValue(ref Name, false);
serializer.SerializeValue(ref Color);
}
}
public struct JuiceProperty : INetworkSerializable
{
public FruitProperty Fruit;
public JuiceTypeProperty Type;
public int ScrapValue;
public JuiceProperty(FruitProperty fruit, JuiceTypeProperty type, int scrapValue)
{
Fruit = fruit;
Type = type;
ScrapValue = scrapValue;
}
public unsafe void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
Fruit.NetworkSerialize<T>(serializer);
Type.NetworkSerialize<T>(serializer);
((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref ScrapValue, default(ForPrimitives));
}
}
public struct JuiceTypeProperty : INetworkSerializable
{
[ES3NonSerializable]
public static Dictionary<string, JuiceTypeProperty> JUICE_TYPES = new Dictionary<string, JuiceTypeProperty>();
public string Name;
public int Index;
public float Multiplier;
public int MinValue;
public int MaxValue;
public int Rarity;
public static void Initialize()
{
JUICE_TYPES.Add("Carton", new JuiceTypeProperty("Carton", 1, 1.2f, 20, 40, SyncedInstance<Config>.Instance.cartonsRarity.Value));
JUICE_TYPES.Add("Premium", new JuiceTypeProperty("Premium", 2, 1.5f, 30, 60, SyncedInstance<Config>.Instance.premiumsRarity.Value));
JUICE_TYPES.Add("Pack", new JuiceTypeProperty("Pack", 3, 1.3f, 80, 140, SyncedInstance<Config>.Instance.packRarity.Value));
JUICE_TYPES.Add("Can", new JuiceTypeProperty("Can", 4, 1.1f, 10, 30, SyncedInstance<Config>.Instance.canRarity.Value));
}
public JuiceTypeProperty(string name, int index, float multiplier, int minValue, int maxValue, int rarity)
{
Name = name;
Index = index;
Multiplier = multiplier;
MinValue = (int)Mathf.Ceil((float)minValue / 0.4f);
MaxValue = (int)Mathf.Ceil((float)maxValue / 0.4f);
Rarity = rarity;
}
public unsafe void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: 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_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: 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_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
serializer.SerializeValue(ref Name, false);
((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref Index, default(ForPrimitives));
((BufferSerializer<float>*)(&serializer))->SerializeValue<float>(ref Multiplier, default(ForPrimitives));
((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref MinValue, default(ForPrimitives));
((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref MaxValue, default(ForPrimitives));
((BufferSerializer<int>*)(&serializer))->SerializeValue<int>(ref Rarity, default(ForPrimitives));
}
}
}
namespace JuicesMod.Behaviours
{
public class ShipJuiceBlenderBehaviour : NetworkBehaviour
{
public bool isPowered = false;
public bool hasBeenMixed = false;
private List<JuiceProperty> juiceContent = new List<JuiceProperty>();
private float _juiceLevel = 0f;
public Animator bladeAnimator;
public Animator speedSwitchAnimator;
public AudioSource audioSource;
public List<Renderer> juiceRenderers = new List<Renderer>();
public InteractTrigger powerButtonTrigger;
public InteractTrigger addJuiceTrigger;
public GameObject juiceSpawnFX;
public void Awake()
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
if (ES3.KeyExists("JuicesMod_JuiceBlender_Content", GameNetworkManager.Instance.currentSaveFileName))
{
juiceContent = ES3.Load<JuiceProperty[]>("JuicesMod_JuiceBlender_Content", GameNetworkManager.Instance.currentSaveFileName).ToList();
for (int i = 0; i < juiceContent.Count; i++)
{
juiceRenderers[i].material.color = juiceContent[i].Fruit.Color;
}
}
if (!audioSource.isPlaying)
{
audioSource.Play();
}
audioSource.pitch = 0f;
}
public void Update()
{
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_024e: Unknown result type (might be due to invalid IL or missing references)
//IL_0255: Unknown result type (might be due to invalid IL or missing references)
//IL_025a: Unknown result type (might be due to invalid IL or missing references)
addJuiceTrigger.disabledHoverTip = (isPowered ? "Can't add juice while blending" : "Blender is full");
addJuiceTrigger.interactable = !isPowered && juiceContent.Count < 4;
powerButtonTrigger.interactable = juiceContent.Count > 0;
if (isPowered)
{
AudioSource obj = audioSource;
obj.pitch += (1f - audioSource.pitch) * 1f / 4f;
}
else
{
AudioSource obj2 = audioSource;
obj2.pitch += (0.5f - audioSource.pitch) * 1f / 16f;
}
audioSource.volume = Mathf.Pow(2f * audioSource.pitch - 1f, 0.25f);
_juiceLevel += ((float)juiceContent.Count - _juiceLevel) / 2f;
Color val = default(Color);
foreach (var item in juiceRenderers.Select((Renderer value, int index) => new { index, value }))
{
Color color;
if ((isPowered || hasBeenMixed) && juiceContent.Count > 0)
{
((Color)(ref val))..ctor(juiceRenderers.Take(juiceContent.Count).Average((Renderer r) => r.material.color.r), juiceRenderers.Take(juiceContent.Count).Average((Renderer r) => r.material.color.g), juiceRenderers.Take(juiceContent.Count).Average((Renderer r) => r.material.color.b));
color = Color.Lerp(item.value.material.color, val, 0.1f);
}
else
{
color = item.value.material.color;
}
color.a = Mathf.Clamp(_juiceLevel - (float)item.index, 0f, 1f);
item.value.material.color = color;
}
}
public void SaveState()
{
ES3.Save<JuiceProperty[]>("JuicesMod_JuiceBlender_Content", juiceContent.ToArray(), GameNetworkManager.Instance.currentSaveFileName);
}
public void DebugSpawnJuices()
{
//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_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: 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)
HUDManager.Instance.DisplayTip("Spawning juices !", "16 random juices gonna be spawn !", false, false, "LC_Tip1");
for (int i = 0; i < 16; i++)
{
Item val = Plugin.instance.JuicesBuilder.Juices[Random.RandomRangeInt(0, Plugin.instance.JuicesBuilder.Juices.Length)];
GameObject val2 = Object.Instantiate<GameObject>(val.spawnPrefab, ((Component)this).gameObject.transform.position + Vector3.left * (float)i / 2f, Quaternion.identity, StartOfRound.Instance.propsContainer);
((GrabbableObject)val2.GetComponent<PhysicsProp>()).SetScrapValue((int)Random.Range((float)val.minValue * 0.4f, (float)val.maxValue * 0.4f));
val2.GetComponent<GrabbableObject>().fallTime = 0f;
val2.GetComponent<NetworkObject>().Spawn(false);
}
}
public void EarlyToggleSwitch()
{
if (!isPowered)
{
powerButtonTrigger.timeToHold = 3f;
JuiceTypeProperty type = juiceContent.Find((JuiceProperty j) => j.Type.Multiplier == juiceContent.Min((JuiceProperty j2) => j2.Type.Multiplier)).Type;
int num = juiceContent.Sum((JuiceProperty j) => j.ScrapValue);
float num2 = Mathf.Lerp(1f, type.Multiplier, (float)(juiceContent.Count - 1) / 3f);
HUDManager.Instance.DisplayTip(type.Name + " multifruit", $"Mixing these {juiceContent.Count} juices will produce a {type.Name.ToLower()} multifuit with a x{num2:0.##} bonus worth {(float)num * num2:0.00}.", false, false, "LC_Tip1");
}
else
{
powerButtonTrigger.timeToHold = 0.5f;
}
}
public void ToggleSwitch(PlayerControllerB player)
{
SetBlendingStateServerRpc(!isPowered);
}
[ServerRpc(RequireOwnership = false)]
public void SetBlendingStateServerRpc(bool state)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: 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_01b7: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2905137838u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref state, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2905137838u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost))
{
return;
}
if (!state)
{
JuiceTypeProperty type = juiceContent.Find((JuiceProperty j) => j.Type.Multiplier == juiceContent.Min((JuiceProperty j2) => j2.Type.Multiplier)).Type;
GameObject val3 = Object.Instantiate<GameObject>(Plugin.instance.JuicesBuilder.getMultifruit(type).spawnPrefab, ((Component)this).transform.position + Vector3.up + ((Component)this).transform.forward * 0.5f, ((Component)this).transform.rotation, RoundManager.Instance.spawnedScrapContainer);
int scrapValue = (int)Mathf.Ceil((float)juiceContent.Sum((JuiceProperty j) => j.ScrapValue) * type.Multiplier);
val3.GetComponent<GrabbableObject>().fallTime = 0f;
val3.GetComponent<NetworkObject>().Spawn(false);
StopBlendingClientRpc(NetworkObjectReference.op_Implicit(val3), scrapValue);
}
else
{
StartBlendingClientRpc();
}
}
[ClientRpc]
public void StartBlendingClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1829654523u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1829654523u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
ApplyBlendingState(state: true);
}
}
}
[ClientRpc]
public void StopBlendingClientRpc(NetworkObjectReference multifruit, int scrapValue)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//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_0083: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3335357439u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref multifruit, default(ForNetworkSerializable));
BytePacker.WriteValueBitPacked(val2, scrapValue);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3335357439u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
((GrabbableObject)NetworkObjectReference.op_Implicit(multifruit).GetComponent<PhysicsProp>()).SetScrapValue(scrapValue);
juiceContent.Clear();
GameObject val3 = Object.Instantiate<GameObject>(juiceSpawnFX, NetworkObjectReference.op_Implicit(multifruit).transform.position, Quaternion.identity, NetworkObjectReference.op_Implicit(multifruit).transform);
AudioSource component = val3.GetComponent<AudioSource>();
if ((Object)(object)component != (Object)null && !component.isPlaying)
{
component.Play();
}
ApplyBlendingState(state: false);
SaveState();
}
}
private void ApplyBlendingState(bool state)
{
isPowered = state;
hasBeenMixed = true;
speedSwitchAnimator.SetBool("power", isPowered);
bladeAnimator.SetBool("power", isPowered);
}
public void AddJuice(PlayerControllerB player)
{
if (juiceContent.Count < 4)
{
GrabbableObject currentlyHeldObjectServer = player.currentlyHeldObjectServer;
if ((Object)(object)currentlyHeldObjectServer != (Object)null && Plugin.instance.JuicesBuilder.hasJuiceProperty(currentlyHeldObjectServer))
{
AddingJuiceServerRpc(Plugin.instance.JuicesBuilder.getJuiceProperty(currentlyHeldObjectServer));
player.DespawnHeldObject();
}
}
}
[ServerRpc(RequireOwnership = false)]
public void AddingJuiceServerRpc(JuiceProperty juice)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(20618528u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<JuiceProperty>(ref juice, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 20618528u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
AddingJuiceClientRpc(juice);
}
}
}
[ClientRpc]
public void AddingJuiceClientRpc(JuiceProperty juice)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3953458859u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<JuiceProperty>(ref juice, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3953458859u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
ApplyAddingJuice(juice);
}
}
}
public void ApplyAddingJuice(JuiceProperty juice)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
hasBeenMixed = false;
juiceContent.Add(juice);
juiceRenderers[juiceContent.Count - 1].material.color = juice.Fruit.Color;
SaveState();
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_ShipJuiceBlenderBehaviour()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(2905137838u, new RpcReceiveHandler(__rpc_handler_2905137838));
NetworkManager.__rpc_func_table.Add(1829654523u, new RpcReceiveHandler(__rpc_handler_1829654523));
NetworkManager.__rpc_func_table.Add(3335357439u, new RpcReceiveHandler(__rpc_handler_3335357439));
NetworkManager.__rpc_func_table.Add(20618528u, new RpcReceiveHandler(__rpc_handler_20618528));
NetworkManager.__rpc_func_table.Add(3953458859u, new RpcReceiveHandler(__rpc_handler_3953458859));
}
private static void __rpc_handler_2905137838(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool blendingStateServerRpc = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref blendingStateServerRpc, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((ShipJuiceBlenderBehaviour)(object)target).SetBlendingStateServerRpc(blendingStateServerRpc);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1829654523(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)2;
((ShipJuiceBlenderBehaviour)(object)target).StartBlendingClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3335357439(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
NetworkObjectReference multifruit = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref multifruit, default(ForNetworkSerializable));
int scrapValue = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref scrapValue);
target.__rpc_exec_stage = (__RpcExecStage)2;
((ShipJuiceBlenderBehaviour)(object)target).StopBlendingClientRpc(multifruit, scrapValue);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_20618528(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
JuiceProperty juice = default(JuiceProperty);
((FastBufferReader)(ref reader)).ReadValueSafe<JuiceProperty>(ref juice, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)1;
((ShipJuiceBlenderBehaviour)(object)target).AddingJuiceServerRpc(juice);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3953458859(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
JuiceProperty juice = default(JuiceProperty);
((FastBufferReader)(ref reader)).ReadValueSafe<JuiceProperty>(ref juice, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)2;
((ShipJuiceBlenderBehaviour)(object)target).AddingJuiceClientRpc(juice);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "ShipJuiceBlenderBehaviour";
}
}
public class ShipNeonAnimation : NetworkBehaviour
{
public List<Material> materials = new List<Material>();
public float minIntensity = 0f;
public float maxIntensity = 1f;
public NeonAnimation animation = NeonAnimation.Blink;
public float animationSpeed = 1f;
private Color[] originalColors;
public void Awake()
{
originalColors = materials.Select((Material c) => c.GetColor("_EmissiveColor")).ToArray();
}
public void Update()
{
//IL_01b8: 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: Unknown result type (might be due to invalid IL or missing references)
int num = ((animation == NeonAnimation.Blink) ? 2 : ((animation == NeonAnimation.AppearBlinkDisapear) ? ((materials.Count + 5) * 2) : ((animation == NeonAnimation.OneByOne) ? materials.Count : 0)));
float[] array = materials.Select((Material m) => 1f).ToArray();
float animationFrame = Time.time / animationSpeed % (float)num;
if (animation == NeonAnimation.Blink)
{
array = array.Select((float l) => (animationFrame % 2f < 1f) ? 1f : 0f).ToArray();
}
else if (animation == NeonAnimation.AppearBlinkDisapear)
{
array = ((animationFrame < (float)materials.Count) ? array.Select((float l, int i) => (animationFrame - 1f > (float)i) ? 1f : 0f).ToArray() : ((!(animationFrame < (float)(materials.Count + 10))) ? array.Select((float l, int i) => ((float)((materials.Count + 5) * 2) - animationFrame > (float)i) ? 1f : 0f).ToArray() : array.Select((float l) => (animationFrame % 1f < 0.5f) ? 1f : 0f).ToArray()));
}
else if (animation == NeonAnimation.OneByOne)
{
array = array.Select((float l, int i) => (Mathf.FloorToInt(animationFrame) == i) ? 1f : 0f).ToArray();
}
float num2 = Random.Range(minIntensity, maxIntensity);
for (int j = 0; j < materials.Count; j++)
{
materials[j].SetColor("_EmissiveColor", originalColors[j] * array[j] * num2);
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "ShipNeonAnimation";
}
}
public enum NeonAnimation
{
Blink,
AppearBlinkDisapear,
OneByOne
}
public class ShipNeonFlickering : NetworkBehaviour
{
public List<Material> materials = new List<Material>();
public float minIntensity = 0f;
public float maxIntensity = 1f;
private Color[] originalColors;
public void Awake()
{
originalColors = materials.Select((Material c) => c.GetColor("_EmissiveColor")).ToArray();
}
public void Update()
{
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
float num = Random.Range(minIntensity, maxIntensity);
for (int i = 0; i < materials.Count; i++)
{
materials[i].SetColor("_EmissiveColor", originalColors[i] * num);
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "ShipNeonFlickering";
}
}
public class VitaminDetectorBehaviour : PhysicsProp
{
public float RadarMinDistance = 0f;
public float RadarMaxDistance = 50f;
public ParticleSystem RadarParticle;
public AudioSource RadarAudio;
public AudioSource ItemAudio;
public AudioClip PowerOnClip;
public AudioClip PowerOffClip;
public AudioClip OutOfBatteriesClip;
private bool activated = false;
public override void Start()
{
((GrabbableObject)this).Start();
((GrabbableObject)this).insertedBattery.charge = 1f;
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
ToggleState(!activated);
if (activated)
{
RadarParticle.Play();
}
else
{
RadarParticle.Stop();
}
}
public override void UseUpBatteries()
{
((GrabbableObject)this).UseUpBatteries();
ToggleState(state: false);
ItemAudio.PlayOneShot(OutOfBatteriesClip);
}
public void ToggleState(bool state)
{
activated = state;
ItemAudio.PlayOneShot(activated ? PowerOnClip : PowerOffClip);
}
public override void Update()
{
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_0266: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).Update();
GrabbableObject[] array = (GrabbableObject[])(object)(from juice in Object.FindObjectsOfType<PhysicsProp>()
where Plugin.instance.JuicesBuilder.hasJuiceProperty((GrabbableObject)(object)juice) || Plugin.instance.JuicesBuilder.isMultifruit((GrabbableObject)(object)juice)
select juice).ToArray();
GrabbableObject[] source = array;
if (!RadarParticle.isPlaying && activated && ((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null || (Object)(object)((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer == (Object)(object)this))
{
RadarParticle.Play();
}
else if (RadarParticle.isPlaying && (!activated || ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null && (Object)(object)((GrabbableObject)this).playerHeldBy.currentlyHeldObjectServer != (Object)(object)this)))
{
RadarParticle.Stop();
}
if (!RadarAudio.isPlaying && activated)
{
RadarAudio.Play();
}
else if (RadarAudio.isPlaying && !activated)
{
RadarAudio.Stop();
}
if (activated)
{
float num = (Mathf.Clamp((from juice in source
where !juice.isPocketed
select Vector3.Distance(((Component)this).transform.position, ((Component)juice).transform.position) into dist
orderby dist
select dist).DefaultIfEmpty(RadarMaxDistance).First(), RadarMinDistance, RadarMaxDistance) - RadarMinDistance) / (RadarMaxDistance - RadarMinDistance);
EmissionModule emission = RadarParticle.emission;
((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(Mathf.Lerp(4f, 0.25f, num));
RadarAudio.pitch = Mathf.Lerp(4f, 0.25f, num);
Material material = ((Renderer)((Component)RadarParticle).GetComponent<ParticleSystemRenderer>()).material;
material.SetColor("_EmissionColor", Color.Lerp(new Color(0f, 1.9766746f, 0f, 1f), new Color(1.9766746f, 0f, 0f, 1f), num));
}
}
protected override void __initializeVariables()
{
((PhysicsProp)this).__initializeVariables();
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "VitaminDetectorBehaviour";
}
}
}
namespace Shlygly.JuicesMod.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}