using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("BitsAndBobsRadRedux")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("raddude")]
[assembly: AssemblyProduct("BitsAndBobsRadRedux")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("74247c43-4bc4-43d4-b6dc-e9786a045779")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
namespace BitsAndBobsRadRedux;
internal class InventorySlotLamp
{
[HarmonyPatch(typeof(GPButtonInventorySlot), "Awake")]
public class AddInventorySlotLampLighter
{
public static void Postfix(GPButtonInventorySlot __instance)
{
InventorySlotLampLighter inventorySlotLampLighter = ((Component)__instance).gameObject.AddComponent<InventorySlotLampLighter>();
inventorySlotLampLighter.InventorySlot = __instance;
}
}
}
internal class Setup
{
[CompilerGenerated]
private sealed class <AddMaleficSteam>d__19 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
private Transform <parent>5__1;
private GameObject <volcanoSteam>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <AddMaleficSteam>d__19(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<parent>5__1 = null;
<volcanoSteam>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitUntil((Func<bool>)(() => AssetLoader.AssetsLoaded));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if ((Object)(object)AssetLoader.VolcanoSteam == (Object)null)
{
BBRR_Plugin.LogError("VolcanoSteam prefab not loaded");
return false;
}
<parent>5__1 = ((IEnumerable<Transform>)((Component)((Component)Refs.islands[17]).transform).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name.Equals("Cube_001")));
<volcanoSteam>5__2 = Object.Instantiate<GameObject>(AssetLoader.VolcanoSteam, <parent>5__1);
<volcanoSteam>5__2.transform.localPosition = new Vector3(17.5f, 19f, 235f);
<volcanoSteam>5__2.transform.rotation = Quaternion.Euler(0f, 0f, 0f);
<volcanoSteam>5__2.AddComponent<VolcanoSteamAdjuster>();
VolcanoSteamGO = <volcanoSteam>5__2;
BBRR_Plugin.LogDebug("Volcano steam added");
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <AddMeteorShowers>d__18 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
private GameObject <meteorShowers>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <AddMeteorShowers>d__18(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<meteorShowers>5__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
//IL_0087: 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)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitUntil((Func<bool>)(() => AssetLoader.AssetsLoaded));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if ((Object)(object)AssetLoader.MeteorShower == (Object)null)
{
BBRR_Plugin.LogError("MeteorShower prefab not loaded");
return false;
}
<meteorShowers>5__1 = Object.Instantiate<GameObject>(AssetLoader.MeteorShower, ((Component)Camera.main).transform.position, AssetLoader.MeteorShower.transform.rotation);
<meteorShowers>5__1.AddComponent<MeteorShowerScheduler>();
MeteorShowerGO = <meteorShowers>5__1;
BBRR_Plugin.LogDebug("Meteor showers added");
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <SetPlayerLight>d__16 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SetPlayerLight>d__16(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitUntil((Func<bool>)(() => (Object)(object)((Component)Camera.main).GetComponent<Light>() != (Object)null));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
PlayerLight = ((Component)Camera.main).GetComponent<Light>();
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
internal static Light PlayerLight { get; private set; }
internal static List<GameObject> DCGateLampGOs { get; private set; }
internal static GameObject MeteorShowerGO { get; private set; }
internal static GameObject VolcanoSteamGO { get; private set; }
[IteratorStateMachine(typeof(<SetPlayerLight>d__16))]
internal static IEnumerator SetPlayerLight()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SetPlayerLight>d__16(0);
}
internal static void AddDCGateLights()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: 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_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
DCGateLampGOs = new List<GameObject>();
Vector3[] array = (Vector3[])(object)new Vector3[2]
{
new Vector3(0f, 3.35f, 3.1f),
new Vector3(0f, -3.35f, 3.1f)
};
GameObject val = GameObject.Find("island 9 E (dragon cliffs) scenery");
Transform val2 = ((IEnumerable<Transform>)((Component)val.transform).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name.Equals("east_gate (4)")));
Transform child = ((IEnumerable<Transform>)((Component)val.transform).GetComponentsInChildren<Transform>(true)).FirstOrDefault((Func<Transform, bool>)((Transform t) => ((Object)t).name.Equals("east_street_rope (1)"))).GetChild(0);
Vector3[] array2 = array;
foreach (Vector3 localPosition in array2)
{
GameObject val3 = Object.Instantiate<GameObject>(((Component)child).gameObject, val2);
val3.transform.localScale = new Vector3(1.33f, 1.33f, 1.33f);
val3.transform.localPosition = localPosition;
val3.transform.rotation = Quaternion.Euler(270f, 0f, 0f);
val3.GetComponent<Light>().range = 50f;
val3.GetComponent<Light>().intensity = 1.5f;
DCGateLampGOs.Add(val3);
}
BBRR_Plugin.LogDebug("Dragon Cliffs gate lamps added");
}
[IteratorStateMachine(typeof(<AddMeteorShowers>d__18))]
internal static IEnumerator AddMeteorShowers()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <AddMeteorShowers>d__18(0);
}
[IteratorStateMachine(typeof(<AddMaleficSteam>d__19))]
internal static IEnumerator AddMaleficSteam()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <AddMaleficSteam>d__19(0);
}
}
internal class InventorySlotLampLighter : MonoBehaviour
{
internal GPButtonInventorySlot InventorySlot { get; set; }
private void LateUpdate()
{
if (Configs.enableActivateInventoryLamp.Value && ((GoPointerButton)InventorySlot).IsLookedAt())
{
ShipItem currentItem = InventorySlot.currentItem;
if (currentItem is ShipItemLight && (GameInput.GetKeyDown((InputName)9) || Input.GetMouseButtonDown(1)))
{
((GoPointerButton)currentItem).OnAltActivate();
}
}
}
}
internal class AssetLoader
{
[CompilerGenerated]
private sealed class <LoadAssets>d__14 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
private string <bundlePath>5__1;
private AssetBundleCreateRequest <assetBundleRequest>5__2;
private AssetBundle <assetBundle>5__3;
private AssetBundleRequest <request>5__4;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LoadAssets>d__14(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<bundlePath>5__1 = null;
<assetBundleRequest>5__2 = null;
<assetBundle>5__3 = null;
<request>5__4 = null;
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
BBRR_Plugin.LogDebug("Loading assets");
<bundlePath>5__1 = FindAssetPath("bbrr_assets");
if (string.IsNullOrEmpty(<bundlePath>5__1))
{
BBRR_Plugin.LogError("Asset bundle not found");
return false;
}
<assetBundleRequest>5__2 = AssetBundle.LoadFromFileAsync(<bundlePath>5__1);
<>2__current = <assetBundleRequest>5__2;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<assetBundle>5__3 = <assetBundleRequest>5__2.assetBundle;
if ((Object)(object)<assetBundle>5__3 == (Object)null)
{
BBRR_Plugin.LogError("Failed to load " + <bundlePath>5__1);
return false;
}
<request>5__4 = <assetBundle>5__3.LoadAllAssetsAsync();
<>2__current = <request>5__4;
<>1__state = 2;
return true;
case 2:
{
<>1__state = -1;
Object? obj = ((IEnumerable<Object>)<request>5__4.allAssets).FirstOrDefault((Func<Object, bool>)((Object a) => a.name.Equals("MeteorShower")));
MeteorShower = (GameObject)(object)((obj is GameObject) ? obj : null);
Object? obj2 = ((IEnumerable<Object>)<request>5__4.allAssets).FirstOrDefault((Func<Object, bool>)((Object a) => a.name.Equals("VolcanoSteam")));
VolcanoSteam = (GameObject)(object)((obj2 is GameObject) ? obj2 : null);
AssetsLoaded = true;
return false;
}
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static readonly List<string> assetPaths = new List<string>
{
Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)BBRR_Plugin.Instance).Info.Location), "Assets"),
Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)BBRR_Plugin.Instance).Info.Location))
};
internal static GameObject MeteorShower { get; private set; }
internal static GameObject VolcanoSteam { get; private set; }
internal static bool AssetsLoaded { get; private set; } = false;
public static string FindAssetPath(string fileName)
{
foreach (string assetPath in assetPaths)
{
string text = Path.Combine(assetPath, fileName);
if (File.Exists(text))
{
return text;
}
}
return null;
}
[IteratorStateMachine(typeof(<LoadAssets>d__14))]
internal static IEnumerator LoadAssets()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LoadAssets>d__14(0);
}
}
internal class BlueTobacco
{
[HarmonyPatch(typeof(SaveablePrefab), "Start")]
private class SetBlueTobaccoType
{
public static void Postfix(SaveablePrefab __instance)
{
if (((Object)((Component)__instance).gameObject).name.StartsWith("318 tobacco blue"))
{
((Component)__instance).gameObject.GetComponent<ShipItemTobacco>().tobaccoType = 5;
}
}
}
[HarmonyPatch(typeof(PlayerTobacco), "Smoke")]
private class SetBlueTobaccoPotency
{
public static void Postfix(PlayerTobacco __instance, int tobaccoType)
{
if (tobaccoType == 5)
{
if (!Configs.enableBlueTobacco.Value)
{
__instance.green += Time.deltaTime * 2f;
PlayerNeeds.sleep -= Time.deltaTime * 0.11f;
}
else
{
__instance.green += Time.deltaTime * 2f * (float)Configs.bluePotencyMult.Value * 0.33f;
PlayerNeeds.sleep -= Time.deltaTime * 0.11f * (float)Configs.bluePotencyMult.Value;
}
}
}
}
}
[BepInPlugin("com.raddude82.bitsandbobsradredux", "BitsAndBobsRadRedux", "1.0.1")]
public class BBRR_Plugin : BaseUnityPlugin
{
public const string PLUGIN_GUID = "com.raddude82.bitsandbobsradredux";
public const string PLUGIN_NAME = "BitsAndBobsRadRedux";
public const string PLUGIN_VERSION = "1.0.1";
private const string OCEAN_SCENE = "the ocean";
internal const string DRAGON_CLIFFS_SCENE = "island 9 E Dragon Cliffs";
private static ManualLogSource s_logger;
internal static BBRR_Plugin Instance { get; private set; }
internal static void LogDebug(string message)
{
s_logger.LogDebug((object)message);
}
internal static void LogInfo(string message)
{
s_logger.LogInfo((object)message);
}
internal static void LogWarning(string message)
{
s_logger.LogWarning((object)message);
}
internal static void LogError(string message)
{
s_logger.LogError((object)message);
}
private void Awake()
{
if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
return;
}
Instance = this;
s_logger = ((BaseUnityPlugin)this).Logger;
((MonoBehaviour)this).StartCoroutine(AssetLoader.LoadAssets());
Configs.InitializeConfigs();
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "com.raddude82.bitsandbobsradredux");
((MonoBehaviour)this).StartCoroutine(Setup.SetPlayerLight());
SceneManager.sceneLoaded += SceneLoaded;
}
private void SceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
{
if (((Scene)(ref scene)).name.Equals("the ocean"))
{
((MonoBehaviour)this).StartCoroutine(Setup.AddMeteorShowers());
((MonoBehaviour)this).StartCoroutine(Setup.AddMaleficSteam());
}
if (((Scene)(ref scene)).name.Equals("island 9 E Dragon Cliffs"))
{
Setup.AddDCGateLights();
}
}
private void Update()
{
Configs.UpdateConfigs();
}
}
internal class MeteorShower
{
private readonly int _startDay;
private readonly int _peakDay;
private readonly int _endDay;
private readonly float _peakRate;
private const float SECONDS_IN_AN_HOUR = 3600f;
internal string Name { get; private set; }
internal float Declination { get; private set; }
internal float RightAscension { get; private set; }
internal static List<MeteorShower> MeteorShowers { get; private set; }
internal MeteorShower(string name, int startDay, int peakDay, int endDay, float peakHourlyRate, float declination, float rightAscension)
{
Name = name;
_startDay = startDay;
_peakDay = peakDay;
_endDay = endDay;
_peakRate = peakHourlyRate / 3600f;
Declination = declination;
RightAscension = rightAscension;
}
internal float GetRateForDay(int day)
{
if (day < _startDay || day > _endDay)
{
return 0f;
}
float num = ((day <= _peakDay) ? (_peakDay - _startDay) : (_endDay - _peakDay));
float num2 = 1f - (float)Mathf.Abs(day - _peakDay) / num;
return _peakRate * (1f - (1f - num2) * (1f - num2));
}
internal static void InitializeMeteorShowers()
{
MeteorShowers = new List<MeteorShower>
{
new MeteorShower("Quadrantids", 0, 3, 12, 120f, 50f, 232f),
new MeteorShower("Lyrids", 104, 112, 120, 18f, 33f, 272.5f),
new MeteorShower("Arietids", 142, 158, 175, 60f, 25f, 45.5f),
new MeteorShower("Perseids", 198, 224, 236, 100f, 58f, 48.25f),
new MeteorShower("Orionids", 275, 295, 316, 20f, 16f, 96f),
new MeteorShower("Leonids", 307, 321, 334, 15f, 21.6f, 154.25f),
new MeteorShower("Geminids", 335, 346, 351, 150f, 32f, 108.75f)
};
}
}
internal class MeteorShowerScheduler : MonoBehaviour
{
private EmissionModule _emission;
private ColorOverLifetimeModule _colorOverLifetime;
private Camera _mainCamera;
private bool _notified;
private const float BACKGROUND_RATE = 0.0014f;
private const float BACKGROUND_DECLINATION = 60f;
private const float BACKGROUND_RA = 350f;
private const float RADIUS_FROM_CAMERA = 2500f;
private const float START_HOUR = 17f;
private const float END_HOUR = 7f;
private const float EMISSION_MULT = 10f;
internal static MeteorShowerScheduler Instance { get; private set; }
private void Start()
{
//IL_003f: 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_004b: 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)
if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
return;
}
Instance = this;
ParticleSystem component = ((Component)this).GetComponent<ParticleSystem>();
_emission = component.emission;
_colorOverLifetime = component.colorOverLifetime;
_mainCamera = Camera.main;
_notified = false;
ConfigureParticleSystem();
MeteorShower.InitializeMeteorShowers();
}
private void LateUpdate()
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
float localTime = Sun.sun.localTime;
if ((!(localTime > 17f) || !(localTime <= 24f)) && (!(localTime >= 0f) || !(localTime < 7f)))
{
((EmissionModule)(ref _emission)).rateOverTime = MinMaxCurve.op_Implicit(0f);
_notified = false;
}
else
{
UpdateMeteorShower();
}
}
private void ConfigureParticleSystem()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: 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_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
GradientAlphaKey[] array = (GradientAlphaKey[])(object)new GradientAlphaKey[3]
{
new GradientAlphaKey(0f, 0f),
new GradientAlphaKey(1f, 0.5f),
new GradientAlphaKey(0f, 1f)
};
GradientColorKey[] array2 = (GradientColorKey[])(object)new GradientColorKey[1]
{
new GradientColorKey(Color.white, 0f)
};
Gradient val = new Gradient();
val.SetKeys(array2, array);
((ColorOverLifetimeModule)(ref _colorOverLifetime)).color = MinMaxGradient.op_Implicit(val);
}
private void UpdateMeteorShower()
{
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: 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_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: 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)
int day = GameState.day % 365;
float num = 0.0014f;
float declination = 60f;
float rightAscensionDegrees = 350f;
foreach (MeteorShower meteorShower in MeteorShower.MeteorShowers)
{
float rateForDay = meteorShower.GetRateForDay(day);
if (rateForDay > num)
{
num = rateForDay;
declination = meteorShower.Declination;
rightAscensionDegrees = meteorShower.RightAscension;
}
if (!_notified && meteorShower.GetRateForDay(day) > 0f)
{
BBRR_Plugin.LogDebug($"{meteorShower.Name} meteor shower tonight with a rate of {num * 10f:0.000} meteors per second");
_notified = true;
}
}
((EmissionModule)(ref _emission)).rateOverTime = MinMaxCurve.op_Implicit(num * 10f);
Vector3 relativePosition = GetRelativePosition(declination, rightAscensionDegrees);
((Component)this).transform.position = ((Component)_mainCamera).transform.position + relativePosition;
((Component)this).transform.LookAt(((Component)_mainCamera).transform.position);
}
private Vector3 GetRelativePosition(float declination, float rightAscensionDegrees)
{
//IL_0012: 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_0154: Unknown result type (might be due to invalid IL or missing references)
//IL_0158: Unknown result type (might be due to invalid IL or missing references)
float num = (float)Math.PI / 180f;
float num2 = ((Component)_mainCamera).transform.position.x / 9000f + 36f;
float num3 = Sun.sun.localTime / 24f * 360f - rightAscensionDegrees;
if (num3 < 0f)
{
num3 += 360f;
}
float num4 = Mathf.Sin(declination * num) * Mathf.Sin(num2 * num) + Mathf.Cos(declination * num) * Mathf.Cos(num2 * num) * Mathf.Cos(num3 * num);
float num5 = Mathf.Asin(num4) * 57.29578f;
float num6 = (Mathf.Sin(declination * num) - Mathf.Sin(num5 * num) * Mathf.Sin(num2 * num)) / (Mathf.Cos(num5 * num) * Mathf.Cos(num2 * num));
float num7 = Mathf.Acos(num6) * 57.29578f;
if (Mathf.Sin(num3 * num) >= 0f)
{
num7 = 360f - num7;
}
float num8 = 2500f * Mathf.Cos(num5 * num) * Mathf.Cos((0f - (num7 - 90f)) * num);
float num9 = 2500f * Mathf.Cos(num5 * num) * Mathf.Sin((0f - (num7 - 90f)) * num);
float num10 = 2500f * Mathf.Sin(num5 * num);
return new Vector3(num8, num10, num9);
}
}
internal class VolcanoSteamAdjuster : MonoBehaviour
{
private struct TimeColorTransition
{
public float startTime;
public float endTime;
public int startColorIndex;
public int endColorIndex;
}
private EmissionModule _emission;
private ForceOverLifetimeModule _forceLifetime;
private Material _material;
private Wind _wind;
private float _timer = 0f;
private readonly Color32[] _lightingColors = (Color32[])(object)new Color32[4]
{
new Color32((byte)29, (byte)28, (byte)27, (byte)238),
new Color32((byte)38, (byte)38, (byte)38, (byte)238),
new Color32((byte)214, (byte)186, (byte)132, (byte)238),
new Color32(byte.MaxValue, (byte)246, (byte)234, (byte)238)
};
private const float LOW_ACTIVITY_CHANCE = 0.33f;
private const float HIGH_ACTIVITY_CHANCE = 0.66f;
private const float PARTICLE_LIFETIME = 90f;
private const int MAX_PARTICLES = 1000;
private readonly TimeColorTransition[] _colorTransitions = new TimeColorTransition[6]
{
new TimeColorTransition
{
startTime = 4f,
endTime = 5f,
startColorIndex = 0,
endColorIndex = 1
},
new TimeColorTransition
{
startTime = 5f,
endTime = 6f,
startColorIndex = 1,
endColorIndex = 2
},
new TimeColorTransition
{
startTime = 6f,
endTime = 12f,
startColorIndex = 2,
endColorIndex = 3
},
new TimeColorTransition
{
startTime = 12f,
endTime = 18f,
startColorIndex = 3,
endColorIndex = 2
},
new TimeColorTransition
{
startTime = 18f,
endTime = 19f,
startColorIndex = 2,
endColorIndex = 1
},
new TimeColorTransition
{
startTime = 19f,
endTime = 20f,
startColorIndex = 1,
endColorIndex = 0
}
};
public void Start()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: 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_0050: Unknown result type (might be due to invalid IL or missing references)
ParticleSystem componentInChildren = ((Component)this).GetComponentInChildren<ParticleSystem>();
_emission = componentInChildren.emission;
_forceLifetime = componentInChildren.forceOverLifetime;
_material = ((Component)componentInChildren).GetComponent<Renderer>().material;
_material.renderQueue = 2999;
MainModule main = componentInChildren.main;
((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(90f);
((MainModule)(ref main)).maxParticles = 1000;
GameObject obj = GameObject.Find("wind");
_wind = ((obj != null) ? obj.GetComponent<Wind>() : null);
}
public void Update()
{
UpdateEmissionState();
UpdateWindForce();
UpdateDayNightColor();
}
private void UpdateEmissionState()
{
if (_timer <= 0f)
{
float num = Random.Range(0f, 1f);
bool flag = true;
if (Configs.mtMaleficActivity.Value == 0)
{
flag = num < 0.33f;
_timer = (flag ? Random.Range(60f, 120f) : Random.Range(300f, 900f));
}
else if (Configs.mtMaleficActivity.Value == 1)
{
flag = num < 0.66f;
_timer = (flag ? Random.Range(300f, 600f) : Random.Range(120f, 300f));
}
((EmissionModule)(ref _emission)).enabled = flag;
}
_timer -= Time.deltaTime;
}
private void UpdateWindForce()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: 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_004b: 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)
Vector3 val = _wind.outCurrentBaseWind * _wind.outCurrentMagnitude;
((ForceOverLifetimeModule)(ref _forceLifetime)).x = new MinMaxCurve(val.x * Time.deltaTime / 18f);
((ForceOverLifetimeModule)(ref _forceLifetime)).y = new MinMaxCurve((0f - val.z) * Time.deltaTime / 18f);
}
private void UpdateDayNightColor()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: 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_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: 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)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
float localTime = Sun.sun.localTime;
Color32 val = _lightingColors[0];
if (localTime >= 4f && localTime < 20f)
{
TimeColorTransition[] colorTransitions = _colorTransitions;
for (int i = 0; i < colorTransitions.Length; i++)
{
TimeColorTransition timeColorTransition = colorTransitions[i];
if (localTime > timeColorTransition.startTime && localTime <= timeColorTransition.endTime)
{
Color32 val2 = _lightingColors[timeColorTransition.startColorIndex];
Color32 val3 = _lightingColors[timeColorTransition.endColorIndex];
float num = (localTime - timeColorTransition.startTime) / (timeColorTransition.endTime - timeColorTransition.startTime);
val = Color32.op_Implicit(Color.Lerp(Color32.op_Implicit(val2), Color32.op_Implicit(val3), num));
break;
}
}
}
_material.SetColor("_Color", Color32.op_Implicit(val));
}
}
internal class Configs
{
internal static ConfigEntry<bool> addDcGateLamps;
internal static ConfigEntry<bool> addMeteorShowers;
internal static ConfigEntry<bool> addMtMaleficSteam;
internal static ConfigEntry<int> mtMaleficActivity;
internal static ConfigEntry<bool> enablePlayerLight;
internal static ConfigEntry<bool> enableActivateInventoryLamp;
internal static ConfigEntry<bool> enableBlueTobacco;
internal static ConfigEntry<int> bluePotencyMult;
internal static void InitializeConfigs()
{
ConfigFile config = ((BaseUnityPlugin)BBRR_Plugin.Instance).Config;
addDcGateLamps = config.Bind<bool>("Additions", "Add DC Gate Lamps", true, "Adds lamps to the gates of Dragon Cliffs.");
addMeteorShowers = config.Bind<bool>("Additions", "Add Meteor Showers", true, "Adds occasional shooting stars and northern hemisphere meteor showers on their respective days (day 1 = 1 jan, day 366 = 1 jan, etc.)");
addMtMaleficSteam = config.Bind<bool>("Additions", "Add Mt. Malefic Steam", true, "Adds steam being emitted from Mt. Malefic");
mtMaleficActivity = config.Bind<int>("Additions", "Mt. Malefic Activity", 1, "Mt. Malefic activity level: 0 = occasional emissions, 1 = more frequent and longer duration emissions, 2 = constant emission");
enablePlayerLight = config.Bind<bool>("Options", "Ambient Player Light", false, "Light emanating from the player.");
enableActivateInventoryLamp = config.Bind<bool>("Options", "Activate Lamp In Inventory", true, "The ability to activate the lamp in an inventory slot by right-clicking it (or using other activation button).");
enableBlueTobacco = config.Bind<bool>("Options", "Increase Blue Tobacco Potency", true, "Makes blue tobacco more potent.");
bluePotencyMult = config.Bind<int>("Options", "Blue Tobacco Potency Multiplier", 6, "The potency multiplier of blue tobacco as compared to green tobacco. Default is 6.");
}
internal static void UpdateConfigs()
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
GameObject meteorShowerGO = Setup.MeteorShowerGO;
if (meteorShowerGO != null)
{
meteorShowerGO.SetActive(addMeteorShowers.Value);
}
GameObject volcanoSteamGO = Setup.VolcanoSteamGO;
if (volcanoSteamGO != null)
{
volcanoSteamGO.SetActive(addMtMaleficSteam.Value);
}
Scene sceneByName = SceneManager.GetSceneByName("island 9 E Dragon Cliffs");
if (((Scene)(ref sceneByName)).isLoaded)
{
Setup.DCGateLampGOs?.ForEach(delegate(GameObject lamp)
{
if (lamp != null)
{
lamp.SetActive(addDcGateLamps.Value);
}
});
}
if ((Object)(object)Setup.PlayerLight != (Object)null)
{
((Behaviour)Setup.PlayerLight).enabled = enablePlayerLight.Value;
}
}
}