using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PEAKGreenScreen")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+c215dbd43e32177f9db61dcec0b3bae27ad759f8")]
[assembly: AssemblyProduct("Adds green screen/blue screen to PEAK")]
[assembly: AssemblyTitle("PEAKGreenScreen")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 PEAKGreenScreen
{
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("com.atomic.greenscreen", "PEAK Green Screen", "1.4.0")]
public class Plugin : BaseUnityPlugin
{
internal static ManualLogSource Logger;
public static ConfigEntry<float> configColorR;
public static ConfigEntry<float> configColorG;
public static ConfigEntry<float> configColorB;
public static ConfigEntry<bool> sunLighting;
public static ConfigEntry<bool> disableFestiveAirport;
public static ConfigEntry<float> frontLeftIntensity;
public static ConfigEntry<float> frontLeftSpotAngle;
public static ConfigEntry<bool> frontLeftLightActive;
public static ConfigEntry<float> frontRightIntensity;
public static ConfigEntry<float> frontRightSpotAngle;
public static ConfigEntry<bool> frontRightLightActive;
public static bool isAirportRemixedLoaded;
public static AssetBundle LightBundle;
private Light frontLeftLight;
private Light frontRightLight;
private Renderer greenScreenRenderer1;
private Renderer greenScreenRenderer2;
private Renderer greenScreenRenderer3;
private Renderer greenScreenRenderer4;
private GameObject holidayAirport;
private string CurrentScene = "";
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Logger.LogInfo((object)"Plugin PEAKGreenScreen is loaded!");
Object.DontDestroyOnLoad((Object)(object)this);
CheckMod("tony4twentys.Airport_Remixed", ref isAirportRemixedLoaded);
if (isAirportRemixedLoaded)
{
Logger.LogInfo((object)"Airport Remixed is loaded, applying compatibility settings.");
}
else
{
Logger.LogInfo((object)"Airport Remixed is not loaded. Resume normal behavior.");
}
configColorR = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ColorR", 0f, "Red value for custom color (0-255).");
configColorG = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ColorG", 255f, "Green value for custom color (0-255).");
configColorB = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ColorB", 0f, "Blue value for custom color (0-255).");
sunLighting = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "SunLighting", true, "If set to false, in the airport the sun won't have any lighting effects, good for getting that perfect shot.");
disableFestiveAirport = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Disable Festive Airport", false, "If set to true, disables the festive decorations in the airport (if they are present), this can be toggled in game.");
frontLeftIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Front Left Light", "FL Intensity", 1f, "Intensity of the front left light.");
frontLeftSpotAngle = ((BaseUnityPlugin)this).Config.Bind<float>("Front Left Light", "FL SpotAngle", 120f, "Spot angle of the front left light.");
frontLeftLightActive = ((BaseUnityPlugin)this).Config.Bind<bool>("Front Left Light", "FL LightActive", true, "If set to false, the front left light will be disabled.");
frontRightIntensity = ((BaseUnityPlugin)this).Config.Bind<float>("Front Right Light", "FR Intensity", 1f, "Intensity of the front right light.");
frontRightSpotAngle = ((BaseUnityPlugin)this).Config.Bind<float>("Front Right Light", "FR SpotAngle", 120f, "Spot angle of the front right light.");
frontRightLightActive = ((BaseUnityPlugin)this).Config.Bind<bool>("Front Right Light", "FR LightActive", true, "If set to false, the front right light will be disabled.");
configColorR.SettingChanged += OnConfigSettingChanged;
configColorG.SettingChanged += OnConfigSettingChanged;
configColorB.SettingChanged += OnConfigSettingChanged;
disableFestiveAirport.SettingChanged += OnConfigSettingChanged;
frontLeftIntensity.SettingChanged += OnConfigSettingChanged;
frontLeftSpotAngle.SettingChanged += OnConfigSettingChanged;
frontLeftLightActive.SettingChanged += OnConfigSettingChanged;
frontRightIntensity.SettingChanged += OnConfigSettingChanged;
frontRightSpotAngle.SettingChanged += OnConfigSettingChanged;
frontRightLightActive.SettingChanged += OnConfigSettingChanged;
configColorR.Value = Mathf.Clamp(configColorR.Value, 0f, 255f);
configColorG.Value = Mathf.Clamp(configColorG.Value, 0f, 255f);
configColorB.Value = Mathf.Clamp(configColorB.Value, 0f, 255f);
sunLighting.SettingChanged += delegate
{
if (Object.op_Implicit((Object)(object)GameObject.Find("BL_Holiday")))
{
GameObject val = GameObject.Find("SpecialDay Airport (1)");
((Component)val.transform.Find("Directional Light")).gameObject.SetActive(sunLighting.Value);
}
else
{
GameObject val2 = GameObject.Find("SpecialDay Airport");
((Component)val2.transform.Find("Directional Light")).gameObject.SetActive(sunLighting.Value);
}
};
string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
LightBundle = AssetBundle.LoadFromFile(Path.Combine(directoryName, "lightbundle.atomic"));
if ((Object)(object)LightBundle == (Object)null)
{
Logger.LogError((object)"Failed to load the light bundle!!");
}
else
{
Logger.LogMessage((object)"Light bundle loaded successfully.");
}
}
private void OnEnable()
{
SceneManager.sceneLoaded += OnSceneLoaded;
}
private void OnDisable()
{
SceneManager.sceneLoaded -= OnSceneLoaded;
}
private void OnSceneLoaded(Scene scene, LoadSceneMode loadSceneMode)
{
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Expected O, but got Unknown
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Expected O, but got Unknown
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_0265: Unknown result type (might be due to invalid IL or missing references)
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_029f: Unknown result type (might be due to invalid IL or missing references)
//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_02ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0301: Unknown result type (might be due to invalid IL or missing references)
//IL_0315: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: 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_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
//IL_0375: Unknown result type (might be due to invalid IL or missing references)
//IL_037b: Expected O, but got Unknown
//IL_0494: Unknown result type (might be due to invalid IL or missing references)
//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
//IL_04bc: Unknown result type (might be due to invalid IL or missing references)
//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
//IL_04f6: Unknown result type (might be due to invalid IL or missing references)
//IL_050a: Unknown result type (might be due to invalid IL or missing references)
//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0405: Unknown result type (might be due to invalid IL or missing references)
//IL_0419: Unknown result type (might be due to invalid IL or missing references)
//IL_043f: Unknown result type (might be due to invalid IL or missing references)
//IL_0453: Unknown result type (might be due to invalid IL or missing references)
//IL_0467: Unknown result type (might be due to invalid IL or missing references)
CurrentScene = ((Scene)(ref scene)).name;
if (((Scene)(ref scene)).name == "Airport")
{
if (Object.op_Implicit((Object)(object)GameObject.Find("BL_Holiday")))
{
GameObject val = GameObject.Find("SpecialDay Airport (1)");
((Component)val.transform.Find("Directional Light")).gameObject.SetActive(sunLighting.Value);
holidayAirport = GameObject.Find("BL_Holiday");
holidayAirport.SetActive(!disableFestiveAirport.Value);
}
else
{
GameObject val2 = GameObject.Find("SpecialDay Airport");
((Component)val2.transform.Find("Directional Light")).gameObject.SetActive(sunLighting.Value);
}
Material material = new Material(Shader.Find("Unlit/Color"));
Material material2 = new Material(Shader.Find("W/Peak_Standard"));
if (!isAirportRemixedLoaded)
{
greenScreenRenderer1 = CreateCube(new Vector3(-6.3764f, 3.94f, 122.8569f), new Vector3(0.0073f, 6.9709f, 15.1f), Quaternion.Euler(0f, 90f, 0f), material, "GreenScreenPart1");
greenScreenRenderer2 = CreateCube(new Vector3(-6.3764f, -1.76f, 122.4569f), new Vector3(16.6818f, 4.6709f, 15.1f), Quaternion.Euler(0f, 90f, 0f), material, "GreenScreenPart2");
greenScreenRenderer3 = CreateCube(new Vector3(-6.3764f, 3.94f, 122.8669f), new Vector3(0.0073f, 6.9709f, 15.1f), Quaternion.Euler(0f, 90f, 0f), material2, "GreenScreenPart3");
}
else
{
greenScreenRenderer1 = CreateCube(new Vector3(-27.8256f, 8.2482f, 48.777f), new Vector3(0.0073f, 15.1564f, 22.1709f), Quaternion.Euler(0f, 90f, 0f), material, "GreenScreenPart1");
greenScreenRenderer2 = CreateCube(new Vector3(-27.6983f, -1.44f, 41.3118f), new Vector3(14.9472f, 4.6709f, 21.911f), Quaternion.Euler(0f, 90f, 0f), material, "GreenScreenPart2");
greenScreenRenderer3 = CreateCube(new Vector3(-27.8256f, 8.2482f, 48.778f), new Vector3(0.0073f, 15.1564f, 22.1709f), Quaternion.Euler(0f, 90f, 0f), material2, "GreenScreenPart3");
greenScreenRenderer4 = CreateCube(new Vector3(-38.6728f, 8.2482f, 44.9271f), new Vector3(0.4073f, 15.1564f, 22.1709f), Quaternion.Euler(0f, 0f, 0f), material, "GreenScreenPart4");
}
Object.Destroy((Object)(object)GameObject.Find("fence (17)"));
Object.Destroy((Object)(object)GameObject.Find("fence (16)"));
Object.Destroy((Object)(object)GameObject.Find("fence (15)"));
Object.Destroy((Object)(object)GameObject.Find("fence (14)"));
Material val3 = new Material(Shader.Find("Universal Render Pipeline/Unlit"));
Texture2D val4 = LightBundle.LoadAsset<Texture2D>("LightTexture");
if ((Object)(object)val4 != (Object)null)
{
val3.SetTexture("_BaseMap", (Texture)(object)val4);
Logger.LogMessage((object)"LightTexture loaded and applied to material successfully.");
}
else
{
Logger.LogError((object)"Failed to load LightTexture from the asset bundle.");
}
if (!isAirportRemixedLoaded)
{
frontLeftLight = CreateLight(new Vector3(-2.0073f, 1.7926f, 113.8106f), new Vector3(0.5f, 0.5f, 0.5f), Quaternion.Euler(0f, 50.3132f, 180f), "GreenScreenLight1", val3);
frontRightLight = CreateLight(new Vector3(-10.6891f, 1.7926f, 113.8106f), new Vector3(0.5f, 0.5f, 0.5f), Quaternion.Euler(0f, 130.4433f, 180f), "GreenScreenLight2", val3);
}
else
{
frontLeftLight = CreateLight(new Vector3(-20.8874f, 2.0162f, 33.4678f), new Vector3(0.5f, 0.5f, 0.5f), Quaternion.Euler(0f, 50.3132f, 180f), "GreenScreenLight1", val3);
frontRightLight = CreateLight(new Vector3(-34.7994f, 2.0226f, 33.4846f), new Vector3(0.5f, 0.5f, 0.5f), Quaternion.Euler(0f, 130.4433f, 180f), "GreenScreenLight2", val3);
}
UpdateObjects();
}
}
private void OnConfigSettingChanged(object sender, EventArgs e)
{
configColorR.Value = Mathf.Clamp(configColorR.Value, 0f, 255f);
configColorG.Value = Mathf.Clamp(configColorG.Value, 0f, 255f);
configColorB.Value = Mathf.Clamp(configColorB.Value, 0f, 255f);
if (sender == disableFestiveAirport && (Object)(object)holidayAirport != (Object)null)
{
holidayAirport.SetActive(!disableFestiveAirport.Value);
}
if ((Object)(object)greenScreenRenderer1 != (Object)null && (Object)(object)frontLeftLight != (Object)null)
{
UpdateObjects();
}
}
private void UpdateObjects()
{
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: 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_00e8: 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)
Color val = default(Color);
((Color)(ref val))..ctor(configColorR.Value / 255f, configColorG.Value / 255f, configColorB.Value / 255f);
greenScreenRenderer1.material.color = val;
greenScreenRenderer1.material.SetColor("_EmissionColor", val * 10f);
greenScreenRenderer2.material.color = val;
greenScreenRenderer2.material.SetColor("_EmissionColor", val * 10f);
greenScreenRenderer3.material.SetColor("_BaseColor", val);
if ((Object)(object)greenScreenRenderer4 != (Object)null)
{
greenScreenRenderer4.material.color = val;
greenScreenRenderer4.material.SetColor("_EmissionColor", val * 10f);
}
if ((Object)(object)frontLeftLight != (Object)null)
{
((Component)frontLeftLight).gameObject.SetActive(frontLeftLightActive.Value);
frontLeftLight.intensity = frontLeftIntensity.Value;
frontLeftLight.spotAngle = frontLeftSpotAngle.Value;
}
if ((Object)(object)frontRightLight != (Object)null)
{
((Component)frontRightLight).gameObject.SetActive(frontRightLightActive.Value);
frontRightLight.intensity = frontRightIntensity.Value;
frontRightLight.spotAngle = frontRightSpotAngle.Value;
}
}
private Light CreateLight(Vector3 pos, Vector3 scale, Quaternion rotation, string Name, Material material)
{
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
GameObject val = LightBundle.LoadAsset<GameObject>("GreenScreenLight");
if ((Object)(object)val == (Object)null)
{
Logger.LogError((object)("Failed to load " + Name + " from bundle."));
return null;
}
GameObject val2 = Object.Instantiate<GameObject>(val);
MeshRenderer component = val2.GetComponent<MeshRenderer>();
MeshCollider val3 = val2.AddComponent<MeshCollider>();
if ((Object)(object)material != (Object)null)
{
((Renderer)component).material = material;
}
val2.transform.position = pos;
val2.transform.localScale = scale;
val2.transform.rotation = rotation;
((Object)val2).name = Name;
val3.sharedMesh = val2.GetComponent<MeshFilter>().sharedMesh;
val3.convex = true;
Transform val4 = val2.transform.Find("Spot Light");
if ((Object)(object)val4 != (Object)null)
{
val4.localEulerAngles = new Vector3(0f, 90f, 0f);
Light component2 = ((Component)val4).GetComponent<Light>();
if ((Object)(object)component2 != (Object)null)
{
return component2;
}
}
return null;
}
private Renderer CreateCube(Vector3 pos, Vector3 scale, Quaternion rotation, Material material, string Name)
{
//IL_001e: 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)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
GameObject val = GameObject.CreatePrimitive((PrimitiveType)3);
Renderer component = val.GetComponent<Renderer>();
component.material = material;
val.transform.position = pos;
val.transform.localScale = scale;
val.transform.rotation = rotation;
((Object)val).name = Name;
return component;
}
public void CheckMod(string modGUID, ref bool loaded)
{
Chainloader.PluginInfos.TryGetValue(modGUID, out var value);
loaded = value != null;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "PEAKGreenScreen";
public const string PLUGIN_NAME = "Adds green screen/blue screen to PEAK";
public const string PLUGIN_VERSION = "1.0.0";
}
}