using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
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 Chameleon;
using Chameleon.Patches;
using Dawn;
using Dawn.Utils;
using Dusk;
using Dusk.Weights;
using GlobeScrap.NetcodePatcher;
using Microsoft.CodeAnalysis;
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: IgnoresAccessChecksTo("CelestialTint")]
[assembly: IgnoresAccessChecksTo("Chameleon")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("GlobeScrap")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.5.0")]
[assembly: AssemblyInformationalVersion("1.0.5")]
[assembly: AssemblyProduct("GlobeScrap")]
[assembly: AssemblyTitle("GlobeScrap")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.5.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
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 GlobeScrap
{
public class GlobeBehaviour : GrabbableObject
{
[CompilerGenerated]
private sealed class <SpinGlobe>d__14 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public GlobeBehaviour <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SpinGlobe>d__14(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>4__this.isSpinning = true;
break;
case 1:
<>1__state = -1;
break;
}
if (<>4__this.spinTime < 2.5f)
{
<>4__this.planetContainer.Rotate(Vector3.up, (0f - <>4__this.spinSpeed) * <>4__this.spinDecceleration.Evaluate(<>4__this.spinTime), (Space)1);
<>4__this.spinTime += Time.deltaTime;
<>2__current = null;
<>1__state = 1;
return true;
}
<>4__this.isSpinning = false;
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 <WaitForID>d__9 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public GlobeBehaviour <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <WaitForID>d__9(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
goto IL_0046;
case 1:
<>1__state = -1;
goto IL_0046;
case 2:
{
<>1__state = -1;
<>4__this.InitializeItem(<>4__this.planetID);
return false;
}
IL_0046:
if (!<>4__this.isSet)
{
<>2__current = null;
<>1__state = 1;
return true;
}
<>2__current = (object)new WaitForSeconds(2f);
<>1__state = 2;
return true;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public Transform planetContainer;
public float spinSpeed = 8f;
public AnimationCurve spinDecceleration;
private bool isSpinning;
private float spinTime;
private int planetID;
private bool isSet = false;
public override void Start()
{
((GrabbableObject)this).Start();
((MonoBehaviour)this).StartCoroutine(WaitForID());
if (!isSet && ((NetworkBehaviour)this).IsServer)
{
SyncPlanetIDRpc();
}
}
[Rpc(/*Could not decode attribute arguments.*/)]
private void SyncPlanetIDRpc()
{
//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_0043: 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_0051: 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_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: 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)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
{
RpcAttributeParams val = default(RpcAttributeParams);
RpcParams val2 = default(RpcParams);
FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(3514806375u, val2, val, (SendTo)7, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendRpc(ref val3, 3514806375u, val2, val, (SendTo)7, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
planetID = StartOfRound.Instance.currentLevelID;
isSet = true;
}
}
}
[IteratorStateMachine(typeof(<WaitForID>d__9))]
private IEnumerator WaitForID()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <WaitForID>d__9(0)
{
<>4__this = this
};
}
private void InitializeItem(int planetID)
{
GameObject val = GlobeBuilder.Build(StartOfRound.Instance.levels[planetID]);
if ((Object)(object)val != (Object)null)
{
HidePlaceholderPlanet();
SetScanNodeData(StartOfRound.Instance.levels[planetID].PlanetName.TrimStart(' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-'));
Object.Instantiate<GameObject>(val, planetContainer, false);
}
}
public override int GetItemDataToSave()
{
((GrabbableObject)this).GetItemDataToSave();
return planetID;
}
public override void LoadItemSaveData(int saveData)
{
((GrabbableObject)this).LoadItemSaveData(saveData);
planetID = saveData;
int num = StartOfRound.Instance.levels.Length;
if (planetID > num)
{
planetID %= num;
}
isSet = true;
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null))
{
spinTime = (float)Random.Range(0, 10) / 10f;
if (!isSpinning)
{
((MonoBehaviour)this).StartCoroutine(SpinGlobe());
}
}
}
[IteratorStateMachine(typeof(<SpinGlobe>d__14))]
private IEnumerator SpinGlobe()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SpinGlobe>d__14(0)
{
<>4__this = this
};
}
private void HidePlaceholderPlanet()
{
((Component)planetContainer.GetChild(0)).gameObject.SetActive(false);
}
private void SetScanNodeData(string planetName)
{
Transform val = ((Component)this).transform.Find("ScanNode");
ScanNodeProperties val2 = default(ScanNodeProperties);
if (((Component)val).TryGetComponent<ScanNodeProperties>(ref val2))
{
val2.headerText = planetName + " Globe";
}
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(3514806375u, new RpcReceiveHandler(__rpc_handler_3514806375), "SyncPlanetIDRpc");
((GrabbableObject)this).__initializeRpcs();
}
private static void __rpc_handler_3514806375(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)1;
((GlobeBehaviour)(object)target).SyncPlanetIDRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "GlobeBehaviour";
}
}
internal static class GlobeBuilder
{
private static string cachedLevelName = string.Empty;
private static GameObject cachedModel;
public static List<SpecialCaseMoon> moonSpecialCaseList;
private static bool CelestialTintEnabled;
private static bool ChameleonEnabled;
private static GameObject planetMesh;
private static Material artificeMatReference;
private static Material embrionMatReference;
private static Material gordionMatReference;
private static Material desertMatReference;
private static Material forestMatReference;
private static Material snowyMatReference;
public static void Initialise(AssetBundle bundle, bool ChameleonCompatFlag, bool CelestialTintCompatFlag)
{
if (ChameleonCompatFlag)
{
ChamaleonCompat();
}
if (CelestialTintCompatFlag)
{
CelestialTintCompat();
}
cachedModel = bundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/CompanyGlobes/BuilderObjects/cacheObject.prefab");
planetMesh = bundle.LoadAsset<GameObject>("Assets/LethalCompany/Mods/CompanyGlobes/BuilderObjects/Prefab.prefab");
desertMatReference = bundle.LoadAsset<Material>("Assets/LethalCompany/Mods/CompanyGlobes/BuilderObjects/DesertPlanet.mat");
forestMatReference = bundle.LoadAsset<Material>("Assets/LethalCompany/Mods/CompanyGlobes/BuilderObjects/ForestPlanet.mat");
snowyMatReference = bundle.LoadAsset<Material>("Assets/LethalCompany/Mods/CompanyGlobes/BuilderObjects/SnowPlanet.mat");
gordionMatReference = bundle.LoadAsset<Material>("Assets/LethalCompany/Mods/CompanyGlobes/BuilderObjects/OceanPlanet.mat");
Populate();
}
private static void CelestialTintCompat()
{
try
{
CelestialTintEnabled = !CelestialTint.ModConfig.VanillaMode.Value;
}
catch
{
}
}
private static void ChamaleonCompat()
{
try
{
ChameleonEnabled = Configuration.planetPreview.Value;
}
catch
{
}
}
public static GameObject Build(SelectableLevel level)
{
if ((Object)(object)cachedModel != (Object)null && cachedLevelName != level.PlanetName)
{
cachedLevelName = level.PlanetName;
if (BuildPrefabbedPlanets(level))
{
return cachedModel;
}
if (CelestialTintEnabled || !BuildFromPrefab(level))
{
BuildFromLevelTag(level);
}
}
return cachedModel;
}
private static bool BuildPrefabbedPlanets(SelectableLevel level)
{
switch (TrimPlanetName(level.PlanetName))
{
case "Artifice":
if (ChameleonEnabled)
{
if (!CheckIfBlizzard())
{
if ((Object)(object)artificeMatReference == (Object)null)
{
artificeMatReference = GetArtMat();
artificeMatReference.SetFloat("_Metallic", 0f);
artificeMatReference.SetFloat("_Smoothness", 0.25f);
artificeMatReference.SetFloat("_NormalScale", 0f);
}
PresetMoon(artificeMatReference);
}
else
{
PresetMoon(snowyMatReference);
}
}
else
{
PresetMoon(forestMatReference);
}
return true;
case "Embrion":
if (ChameleonEnabled)
{
if ((Object)(object)embrionMatReference == (Object)null)
{
embrionMatReference = GetEmbMat();
embrionMatReference.SetFloat("_Metallic", 0f);
embrionMatReference.SetFloat("_Smoothness", 0.25f);
embrionMatReference.SetFloat("_NormalScale", 0f);
}
PresetMoon(embrionMatReference);
return true;
}
break;
case "Gordion":
case "Liquidation":
PresetMoon(gordionMatReference);
return true;
}
return false;
}
private static bool CheckIfBlizzard()
{
try
{
return Object.op_Implicit((Object)(object)Common.artificeBlizzard);
}
catch
{
return false;
}
}
private static Material GetArtMat()
{
try
{
if ((Object)(object)PlanetPreviewPatches.artificeMat != (Object)null)
{
return PlanetPreviewPatches.artificeMat;
}
return null;
}
catch
{
return null;
}
}
private static Material GetEmbMat()
{
try
{
if ((Object)(object)PlanetPreviewPatches.embrionMat != (Object)null)
{
return PlanetPreviewPatches.embrionMat;
}
return null;
}
catch
{
return null;
}
}
private static bool BuildFromPrefab(SelectableLevel level)
{
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: 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_00f9: Unknown result type (might be due to invalid IL or missing references)
SpecialCaseMoon specialCaseMoon = moonSpecialCaseList.Find((SpecialCaseMoon x) => x.PlanetName == TrimPlanetName(level.PlanetName));
if (CopyFromPrefab(level.planetPrefab.transform, (specialCaseMoon == null) ? new List<int>() : specialCaseMoon.PositionInPrefab))
{
cachedModel.transform.localPosition = ((specialCaseMoon == null || !specialCaseMoon.PositionOverride.HasValue) ? Vector3.zero : specialCaseMoon.PositionOverride.Value);
cachedModel.transform.localRotation = ((specialCaseMoon == null || !specialCaseMoon.RotationOverride.HasValue) ? Quaternion.Euler(-90f, 0f, 0f) : specialCaseMoon.RotationOverride.Value);
cachedModel.transform.localScale = ((specialCaseMoon == null || !specialCaseMoon.ScaleOverride.HasValue) ? (Vector3.one * 10.31595f) : specialCaseMoon.ScaleOverride.Value);
cachedModel.layer = 6;
return true;
}
return false;
}
private static string TrimPlanetName(string name)
{
return name.TrimStart(' ', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-');
}
private static void BuildFromLevelTag(SelectableLevel level)
{
foreach (NamespacedKey item in ((DawnBaseInfo<DawnMoonInfo>)(object)SelectableLevelExtensions.GetDawnInfo(level)).AllTags())
{
switch (item.Key)
{
case "Desert":
case "Canyon":
case "Wasteland":
case "Volcanic":
case "Rocky":
case "Argon":
PresetMoon(desertMatReference);
return;
case "Forest":
case "Valley":
case "Marsh":
PresetMoon(forestMatReference);
return;
case "Tundra":
case "Snow":
PresetMoon(snowyMatReference);
return;
case "Company":
case "Ocean":
PresetMoon(gordionMatReference);
return;
}
}
}
private static void PresetMoon(Material overrideMaterial)
{
//IL_0046: 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_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
CopyMeshFilter(planetMesh.GetComponent<MeshFilter>(), cachedModel.gameObject);
MeshRenderer val = cachedModel.GetComponent<MeshRenderer>() ?? cachedModel.AddComponent<MeshRenderer>();
((Renderer)val).material = overrideMaterial;
cachedModel.transform.localPosition = Vector3.zero;
cachedModel.transform.localRotation = Quaternion.Euler(-90f, 0f, 0f);
cachedModel.transform.localScale = Vector3.one * 10.31595f;
cachedModel.layer = 6;
}
private static bool CopyFromPrefab(Transform reference, List<int> positionInPrefab)
{
Transform val = reference;
for (int i = 0; i < positionInPrefab.Count; i++)
{
val = val.GetChild(positionInPrefab[i]);
}
if ((Object)(object)val == (Object)null)
{
return false;
}
((Object)cachedModel).name = ((Object)val).name;
if ((Object)(object)((Component)val).GetComponent<MeshFilter>() != (Object)null && (Object)(object)((Component)val).GetComponent<MeshRenderer>() != (Object)null)
{
CopyMeshFilter(((Component)val).GetComponent<MeshFilter>(), cachedModel.gameObject);
CopyMeshRenderer(((Component)val).GetComponent<MeshRenderer>(), cachedModel.gameObject);
return true;
}
return false;
}
private static void CopyMeshFilter(MeshFilter original, GameObject destination)
{
MeshFilter val = destination.GetComponent<MeshFilter>() ?? destination.AddComponent<MeshFilter>();
val.mesh = original.sharedMesh;
}
private static void CopyMeshRenderer(MeshRenderer original, GameObject destination)
{
MeshRenderer val = destination.GetComponent<MeshRenderer>() ?? destination.AddComponent<MeshRenderer>();
((Renderer)val).materials = ((Renderer)original).sharedMaterials;
((Renderer)val).material.SetFloat("_Metallic", 0f);
((Renderer)val).material.SetFloat("_Smoothness", 0.25f);
((Renderer)val).material.SetFloat("_NormalScale", 0f);
}
public static void Populate()
{
//IL_00fd: 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_0111: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0302: Unknown result type (might be due to invalid IL or missing references)
//IL_030c: Unknown result type (might be due to invalid IL or missing references)
//IL_0572: Unknown result type (might be due to invalid IL or missing references)
//IL_058b: Unknown result type (might be due to invalid IL or missing references)
//IL_0595: Unknown result type (might be due to invalid IL or missing references)
//IL_059f: Unknown result type (might be due to invalid IL or missing references)
//IL_05d2: Unknown result type (might be due to invalid IL or missing references)
//IL_05dc: Unknown result type (might be due to invalid IL or missing references)
//IL_05e6: Unknown result type (might be due to invalid IL or missing references)
moonSpecialCaseList = new List<SpecialCaseMoon>(40)
{
new SpecialCaseMoon("Acidir", new List<int>(2) { 0, 0 }, null, null, null),
new SpecialCaseMoon("Alcatras", new List<int>(2) { 0, 1 }, null, null, null),
new SpecialCaseMoon("Assurance", new List<int>(1) { 0 }, null, null, null),
new SpecialCaseMoon("Asteroid-13", new List<int>(2) { 0, 44 }, null, Quaternion.Euler(313.7936f, 115.4804f, 236.1909f), Vector3.one * 2.7f),
new SpecialCaseMoon("Awakening", new List<int>(1) { 2 }, null, null, null),
new SpecialCaseMoon("Calist", new List<int>(2) { 0, 0 }, null, Quaternion.Euler(0f, 180f, -90f), null),
new SpecialCaseMoon("Core", new List<int>(1) { 0 }, null, null, null),
new SpecialCaseMoon("Cubatres", new List<int>(1) { 0 }, null, Quaternion.Euler(329.7869f, 139.6691f, 272.1489f), Vector3.one * 6.7f),
new SpecialCaseMoon("Demetrica", new List<int>(2) { 0, 0 }, null, null, null),
new SpecialCaseMoon("Desolation", new List<int>(2) { 0, 1 }, null, null, null),
new SpecialCaseMoon("Duckstroid-14", new List<int>(1) { 0 }, (Vector3?)new Vector3(0f, -9.749605f, 3.74985f), (Quaternion?)null, (Vector3?)(Vector3.one * 0.7118006f), useChildObjects: false),
new SpecialCaseMoon("Empra", new List<int>(2) { 0, 0 }, null, null, null),
new SpecialCaseMoon("Espira", new List<int>(1) { 0 }, null, null, null),
new SpecialCaseMoon("Experimentation", new List<int>(1) { 0 }, null, null, null),
new SpecialCaseMoon("Faith", new List<int>(1) { 0 }, null, null, null),
new SpecialCaseMoon("Filitrios", new List<int>(2) { 0, 1 }, null, null, null),
new SpecialCaseMoon("Fission-C", new List<int>(1) { 0 }, null, null, null),
new SpecialCaseMoon("Galetry", new List<int>(2) { 0, 0 }, null, null, null),
new SpecialCaseMoon("Gloom", new List<int>(2) { 0, 1 }, null, null, null),
new SpecialCaseMoon("Hope", new List<int>(1) { 2 }, null, null, null),
new SpecialCaseMoon("Hyve", new List<int>(2) { 0, 19 }, Vector3.up, Quaternion.Euler(349.7223f, 153.4135f, 236.2058f), Vector3.one * 2.3f),
new SpecialCaseMoon("Hyx", new List<int>(1) { 1 }, null, Quaternion.identity, Vector3.one * 5f),
new SpecialCaseMoon("Impact", new List<int>(1) { 2 }, null, null, null),
new SpecialCaseMoon("Junic", new List<int>(2) { 0, 1 }, null, null, null),
new SpecialCaseMoon("Lecaro", new List<int>(2) { 0, 1 }, null, null, null),
new SpecialCaseMoon("Lithium", new List<int>(1) { 0 }, null, null, null),
new SpecialCaseMoon("Lua", new List<int>(1) { 0 }, null, null, null),
new SpecialCaseMoon("Motra", new List<int>(2) { 0, 0 }, null, null, null),
new SpecialCaseMoon("Navel", new List<int>(1) { 2 }, null, null, null),
new SpecialCaseMoon("Offense", new List<int>(1) { 0 }, null, null, null),
new SpecialCaseMoon("Oldred", new List<int>(2) { 0, 1 }, null, null, null),
new SpecialCaseMoon("Oxyde", new List<int>(2) { 0, 0 }, null, null, null),
new SpecialCaseMoon("Perplexing", new List<int>(1) { 2 }, null, null, null),
new SpecialCaseMoon("Spring", new List<int>(1) { 2 }, null, null, null),
new SpecialCaseMoon("Thalasso", new List<int>(2) { 0, 0 }, null, null, null),
new SpecialCaseMoon("Trial", new List<int>(1) { 2 }, null, null, null),
new SpecialCaseMoon("Trite", new List<int>(2) { 0, 0 }, null, null, null),
new SpecialCaseMoon("Utril", new List<int>(2) { 0, 0 }, null, null, null),
new SpecialCaseMoon("Wistful", new List<int>(1) { 2 }, null, null, null),
new SpecialCaseMoon("Kiln", new List<int>(1) { 0 }, null, null, null)
};
}
}
internal class SpecialCaseMoon
{
private readonly string planetName;
private readonly List<int> positionInPrefab;
private Vector3? positionOverride;
private Quaternion? rotationOverride;
private Vector3? scaleOverride;
public string PlanetName => planetName;
public List<int> PositionInPrefab => positionInPrefab;
public Vector3? PositionOverride => positionOverride;
public Quaternion? RotationOverride => rotationOverride;
public Vector3? ScaleOverride => scaleOverride;
public SpecialCaseMoon(string planetName, List<int> positionInPrefab, Vector3? positionOverride, Quaternion? rotationOverride, Vector3? scaleOverride, bool useChildObjects = false)
{
this.planetName = planetName;
this.positionInPrefab = positionInPrefab;
this.positionOverride = positionOverride;
this.rotationOverride = rotationOverride;
this.scaleOverride = scaleOverride;
base..ctor();
}
}
internal class GlobeContentHandler : ContentHandler<GlobeContentHandler>
{
public class ScrapConfig
{
public ConfigEntry<string>? MoonSpawnWeights;
public ConfigEntry<string>? InteriorSpawnWeights;
public ConfigEntry<string>? WeatherSpawnWeights;
}
public ScrapConfig? scrapConfig;
public SpawnWeightsPreset SpawnWeights { get; private set; } = null;
public GlobeContentHandler(DuskMod mod)
: base(mod)
{
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Expected O, but got Unknown
AssetBundle val = AssetBundleUtils.LoadBundle(Assembly.GetExecutingAssembly(), "globescrap");
RegisterCompatibilities(out var ChameleonCompatFlag, out var CelestialTintCompatFlag);
GlobeBuilder.Initialise(val, ChameleonCompatFlag, CelestialTintCompatFlag);
DuskItemDefinition val2 = val.LoadAsset<DuskItemDefinition>("Assets/LethalCompany/Mods/CompanyGlobes/GlobeDefinition.asset");
ConfigContext val3 = mod.ConfigManager.CreateConfigSection(val2.Item.itemName + " Options");
try
{
scrapConfig = CreateItemConfig(val3, val2);
SpawnWeights = new SpawnWeightsPreset();
SpawnWeights.SetupSpawnWeightsPreset(NamespacedConfigWeight.ConvertManyFromString(scrapConfig.MoonSpawnWeights?.Value ?? string.Empty), NamespacedConfigWeight.ConvertManyFromString(scrapConfig.InteriorSpawnWeights?.Value ?? string.Empty), NamespacedConfigWeight.ConvertManyFromString(scrapConfig.WeatherSpawnWeights?.Value ?? string.Empty), 0);
DawnLib.RegisterNetworkPrefab(val2.Item.spawnPrefab);
DawnLib.DefineItem(((DuskContentDefinition<DawnItemInfo>)(object)val2).TypedKey, val2.Item, (Action<ItemInfoBuilder>)delegate(ItemInfoBuilder builder)
{
builder.DefineScrap((Action<ScrapBuilder>)delegate(ScrapBuilder scrapBuilder)
{
scrapBuilder.SetWeights((Action<WeightTableBuilder<DawnMoonInfo, SpawnWeightContext>>)delegate(WeightTableBuilder<DawnMoonInfo, SpawnWeightContext> weightBuilder)
{
weightBuilder.SetGlobalWeight((IWeighted)(object)SpawnWeights);
});
});
});
}
finally
{
((IDisposable)val3)?.Dispose();
}
}
public ScrapConfig CreateItemConfig(ConfigContext context, DuskItemDefinition duskItemDefinition)
{
return new ScrapConfig
{
MoonSpawnWeights = context.Bind<string>("Preset Moon Weights", "Preset moon weights for " + duskItemDefinition.Item.itemName + ".", NamespacedConfigWeight.ConvertManyToString(duskItemDefinition.MoonSpawnWeightsConfig)),
InteriorSpawnWeights = context.Bind<string>("Preset Interior Weights", "Preset interior weights for " + duskItemDefinition.Item.itemName + ".", NamespacedConfigWeight.ConvertManyToString(duskItemDefinition.InteriorSpawnWeightsConfig)),
WeatherSpawnWeights = context.Bind<string>("Preset Weather Weights", "Preset weather weights for " + duskItemDefinition.Item.itemName + ".", NamespacedConfigWeight.ConvertManyToString(duskItemDefinition.WeatherSpawnWeightsConfig))
};
}
private void RegisterCompatibilities(out bool ChameleonCompatFlag, out bool CelestialTintCompatFlag)
{
ChameleonCompatFlag = Chainloader.PluginInfos.ContainsKey("butterystancakes.lethalcompany.chameleon");
CelestialTintCompatFlag = Chainloader.PluginInfos.ContainsKey("CelestialTint");
}
}
[BepInPlugin("CompanyGlobes", "CompanyGlobes", "1.0.6")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public const string DawnDep = "com.github.teamxiaolan.dawnlib";
public const string celestialTint_GUID = "CelestialTint";
public const string chameleon_GUID = "butterystancakes.lethalcompany.chameleon";
public const string PLUGIN_GUID = "CompanyGlobes";
public const string PLUGIN_NAME = "CompanyGlobes";
public const string PLUGIN_VERSION = "1.0.6";
public static DuskMod? Mod { get; private set; }
private void Awake()
{
AssetBundle val = AssetBundleUtils.LoadBundle(Assembly.GetExecutingAssembly(), "globemain");
Mod = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val);
Mod.RegisterContentHandlers();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin GlobeScrap is loaded!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "GlobeScrap";
public const string PLUGIN_NAME = "GlobeScrap";
public const string PLUGIN_VERSION = "1.0.5";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace __GEN
{
internal class NetworkVariableSerializationHelper
{
[RuntimeInitializeOnLoadMethod]
internal static void InitializeSerialization()
{
}
}
}
namespace GlobeScrap.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}