using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MoonforgedChristmasDecorations")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoonforgedChristmasDecorations")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("adf433ef-261d-4339-87a0-3b351c8880a7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Moonforged.ChristmasDecorations;
[RequireComponent(typeof(LineRenderer))]
public class BezierRope : MonoBehaviour
{
public Transform pointA;
public Transform pointB;
[Header("Look")]
public int segments = 24;
public float width = 0.015f;
public float sag = 0.25f;
public Material material;
[Header("Cloth-like motion")]
public float windStrength = 0.2f;
public float jiggleAmplitude = 0.02f;
public float jiggleSpeed = 1f;
private LineRenderer _lr;
private float _seed;
private void Awake()
{
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
_lr = ((Component)this).GetComponent<LineRenderer>();
_lr.useWorldSpace = true;
_lr.startWidth = width;
_lr.endWidth = width;
_lr.numCornerVertices = 3;
_lr.numCapVertices = 3;
_lr.textureMode = (LineTextureMode)0;
((Renderer)_lr).material = (Material)(((Object)(object)material != (Object)null) ? ((object)material) : ((object)new Material(Shader.Find("Sprites/Default"))));
((Renderer)_lr).material.color = Color.black;
_seed = Random.Range(0f, 1000f);
}
private void LateUpdate()
{
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: 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_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: 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_0071: 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_0077: 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_007e: 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_008e: 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_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: 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)
//IL_00b0: 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_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: 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_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: 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_014f: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: 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_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: 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_022c: Unknown result type (might be due to invalid IL or missing references)
//IL_0231: Unknown result type (might be due to invalid IL or missing references)
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_0245: 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_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_024c: Unknown result type (might be due to invalid IL or missing references)
//IL_0250: 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)
//IL_025f: Unknown result type (might be due to invalid IL or missing references)
//IL_0263: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_026c: Unknown result type (might be due to invalid IL or missing references)
//IL_0270: Unknown result type (might be due to invalid IL or missing references)
//IL_0277: Unknown result type (might be due to invalid IL or missing references)
//IL_027c: Unknown result type (might be due to invalid IL or missing references)
//IL_0281: Unknown result type (might be due to invalid IL or missing references)
//IL_028b: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)pointA == (Object)null) && !((Object)(object)pointB == (Object)null))
{
_lr.startWidth = width;
_lr.endWidth = width;
Vector3 position = pointA.position;
Vector3 position2 = pointB.position;
Vector3 val = (position + position2) * 0.5f;
Vector3 val2 = Vector3.Lerp(position, val, 0.66f) + Vector3.down * sag;
Vector3 val3 = Vector3.Lerp(position2, val, 0.66f) + Vector3.down * sag;
Vector3 right = Vector3.right;
if ((Object)(object)pointA != (Object)null)
{
right = pointA.right;
}
float num = Time.time + _seed;
float num2 = Mathf.Sin(num * ((float)Math.PI * 2f) * Mathf.Max(0.01f, jiggleSpeed)) * jiggleAmplitude;
val2 += right * windStrength * 0.5f + Vector3.up * num2 * 0.5f;
val3 += right * windStrength * 1f + Vector3.down * num2 * 0.5f;
int num3 = Mathf.Max(4, segments);
_lr.positionCount = num3;
float num4 = 1f / (float)(num3 - 1);
for (int i = 0; i < num3; i++)
{
float num5 = (float)i * num4;
Vector3 val4 = Mathf.Pow(1f - num5, 3f) * position + 3f * Mathf.Pow(1f - num5, 2f) * num5 * val2 + 3f * (1f - num5) * num5 * num5 * val3 + num5 * num5 * num5 * position2;
float num6 = num5 * (1f - num5);
Vector3 val5 = position2 - position;
val5 = Vector3.Cross(((Vector3)(ref val5)).normalized, Vector3.up);
Vector3 normalized = ((Vector3)(ref val5)).normalized;
val4 += normalized * num2 * num6;
_lr.SetPosition(i, val4);
}
}
}
}
public class ChildLightsCycler : MonoBehaviour
{
[CompilerGenerated]
private sealed class <Run>d__10 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public ChildLightsCycler <>4__this;
private float <delay>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Run>d__10(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<delay>5__1 = Mathf.Max(0.05f, <>4__this.stepSeconds);
break;
case 1:
<>1__state = -1;
break;
}
if (<>4__this._mats.Count > 0)
{
<>4__this.ApplyStep();
}
<>2__current = (object)new WaitForSeconds(<delay>5__1);
<>1__state = 1;
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 string[] lightRendererNames = new string[3] { "Light1", "Light2", "Light3" };
public float stepSeconds = 1f;
public float intensity = 4.4f;
private readonly List<Material> _mats = new List<Material>();
private static readonly Color[] Palette = (Color[])(object)new Color[3]
{
Color.red,
Color.yellow,
Color.blue
};
private int _step;
private Coroutine _runner;
private void Awake()
{
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
_mats.Clear();
for (int i = 0; i < lightRendererNames.Length; i++)
{
Transform val = ((Component)this).transform.Find(lightRendererNames[i]);
if ((Object)(object)val == (Object)null)
{
continue;
}
Renderer component = ((Component)val).GetComponent<Renderer>();
if (!((Object)(object)component == (Object)null))
{
Material sharedMaterial = component.sharedMaterial;
if (!((Object)(object)sharedMaterial == (Object)null))
{
sharedMaterial.EnableKeyword("_EMISSION");
sharedMaterial.SetColor("_EmissionColor", Palette[i % Palette.Length] * Mathf.LinearToGammaSpace(intensity));
sharedMaterial.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1;
_mats.Add(sharedMaterial);
}
}
}
}
private void OnEnable()
{
if (_runner == null && _mats.Count > 0)
{
_runner = ((MonoBehaviour)this).StartCoroutine(Run());
}
}
private void OnDisable()
{
if (_runner != null)
{
((MonoBehaviour)this).StopCoroutine(_runner);
_runner = null;
}
}
[IteratorStateMachine(typeof(<Run>d__10))]
private IEnumerator Run()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Run>d__10(0)
{
<>4__this = this
};
}
private void ApplyStep()
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: 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)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < _mats.Count; i++)
{
Material val = _mats[i];
if (!((Object)(object)val == (Object)null))
{
Color val2 = Palette[(i + _step) % Palette.Length];
val.SetColor("_EmissionColor", val2 * Mathf.LinearToGammaSpace(intensity));
}
}
_step = (_step + 1) % Palette.Length;
}
}
public class ChristmasLightChaser : MonoBehaviour
{
public enum AnimationMode
{
Chase,
BlinkAll
}
[CompilerGenerated]
private sealed class <Run>d__20 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public ChristmasLightChaser <>4__this;
private WaitForSeconds <poll>5__1;
private WaitForSeconds <stepWait>5__2;
private bool <hasZdo>5__3;
private ZNetView <znv>5__4;
private int <n>5__5;
private int <i>5__6;
private Renderer <r>5__7;
private MaterialPropertyBlock <mpb>5__8;
private Color <c>5__9;
private Color <c>5__10;
private int <i>5__11;
private Renderer <r>5__12;
private MaterialPropertyBlock <mpb>5__13;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Run>d__20(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<poll>5__1 = null;
<stepWait>5__2 = null;
<znv>5__4 = null;
<r>5__7 = null;
<mpb>5__8 = null;
<r>5__12 = null;
<mpb>5__13 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Expected O, but got Unknown
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Expected O, but got Unknown
//IL_0297: Unknown result type (might be due to invalid IL or missing references)
//IL_029c: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Unknown result type (might be due to invalid IL or missing references)
//IL_01b9: Unknown result type (might be due to invalid IL or missing references)
//IL_033f: Unknown result type (might be due to invalid IL or missing references)
//IL_0354: Unknown result type (might be due to invalid IL or missing references)
//IL_0322: Unknown result type (might be due to invalid IL or missing references)
//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<poll>5__1 = new WaitForSeconds(0.2f);
<stepWait>5__2 = new WaitForSeconds(<>4__this.stepSeconds);
break;
case 1:
<>1__state = -1;
break;
case 2:
<>1__state = -1;
<znv>5__4 = null;
break;
}
<hasZdo>5__3 = false;
<znv>5__4 = ((Component)<>4__this).GetComponentInParent<ZNetView>();
if ((Object)(object)<znv>5__4 != (Object)null)
{
<hasZdo>5__3 = <znv>5__4.GetZDO() != null;
}
if (!<hasZdo>5__3)
{
<>4__this._liveStarted = false;
<>2__current = <poll>5__1;
<>1__state = 1;
return true;
}
if (!<>4__this._liveStarted)
{
<>4__this._liveStarted = true;
<>4__this._step = 0;
}
<n>5__5 = Mathf.Max(1, <>4__this._palette.Length);
if (<>4__this.mode == AnimationMode.Chase)
{
<i>5__6 = 0;
while (<i>5__6 < <>4__this.targets.Count)
{
<r>5__7 = <>4__this.targets[<i>5__6];
if (Object.op_Implicit((Object)(object)<r>5__7))
{
<mpb>5__8 = <>4__this._mpbs[<i>5__6];
<c>5__9 = <>4__this._palette[(<i>5__6 + <>4__this._step) % <n>5__5];
if (<>4__this.affectBaseColor)
{
<mpb>5__8.SetColor(<>4__this._colorId, <c>5__9);
}
<mpb>5__8.SetColor(<>4__this._emissId, <c>5__9 * Mathf.LinearToGammaSpace(<>4__this.emissionIntensity));
<r>5__7.SetPropertyBlock(<mpb>5__8);
<r>5__7 = null;
<mpb>5__8 = null;
}
<i>5__6++;
}
}
else
{
<c>5__10 = <>4__this._palette[<>4__this._step % <n>5__5];
<i>5__11 = 0;
while (<i>5__11 < <>4__this.targets.Count)
{
<r>5__12 = <>4__this.targets[<i>5__11];
if (Object.op_Implicit((Object)(object)<r>5__12))
{
<mpb>5__13 = <>4__this._mpbs[<i>5__11];
if (<>4__this.affectBaseColor)
{
<mpb>5__13.SetColor(<>4__this._colorId, <c>5__10);
}
<mpb>5__13.SetColor(<>4__this._emissId, <c>5__10 * Mathf.LinearToGammaSpace(<>4__this.emissionIntensity));
<r>5__12.SetPropertyBlock(<mpb>5__13);
<r>5__12 = null;
<mpb>5__13 = null;
}
<i>5__11++;
}
}
<>4__this._step++;
<>2__current = <stepWait>5__2;
<>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 bool includeInactive = true;
public Color[] defaultPalette = (Color[])(object)new Color[3]
{
Color.red,
Color.yellow,
Color.blue
};
public Color[] paletteOverride;
public AnimationMode mode = AnimationMode.Chase;
[Min(0.01f)]
public float stepSeconds = 1f;
[Min(0f)]
public float emissionIntensity = 4.4f;
public bool affectBaseColor = false;
public string[] ignoreNameContains = new string[2] { "cable", "snap" };
public List<Renderer> targets = new List<Renderer>();
private readonly List<MaterialPropertyBlock> _mpbs = new List<MaterialPropertyBlock>();
private int _colorId;
private int _emissId;
private int _step;
private Coroutine _runner;
private bool _liveStarted;
private Color[] _palette;
private void Awake()
{
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Expected O, but got Unknown
_palette = ((paletteOverride != null && paletteOverride.Length != 0) ? paletteOverride : defaultPalette);
_colorId = Shader.PropertyToID("_Color");
_emissId = Shader.PropertyToID("_EmissionColor");
if (targets.Count == 0)
{
Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(includeInactive);
foreach (Renderer val in componentsInChildren)
{
if (!Object.op_Implicit((Object)(object)val))
{
continue;
}
string text = ((Object)val).name.ToLowerInvariant();
bool flag = false;
for (int j = 0; j < ignoreNameContains.Length; j++)
{
if (text.Contains(ignoreNameContains[j]))
{
flag = true;
break;
}
}
if (!flag)
{
targets.Add(val);
}
}
}
_mpbs.Clear();
foreach (Renderer target in targets)
{
if (Object.op_Implicit((Object)(object)target))
{
MaterialPropertyBlock val2 = new MaterialPropertyBlock();
target.GetPropertyBlock(val2);
if (Object.op_Implicit((Object)(object)target.material))
{
target.material.EnableKeyword("_EMISSION");
}
_mpbs.Add(val2);
}
}
}
private void OnEnable()
{
if (_runner == null)
{
_runner = ((MonoBehaviour)this).StartCoroutine(Run());
}
}
private void OnDisable()
{
if (_runner != null)
{
((MonoBehaviour)this).StopCoroutine(_runner);
}
_runner = null;
_liveStarted = false;
}
[IteratorStateMachine(typeof(<Run>d__20))]
private IEnumerator Run()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Run>d__20(0)
{
<>4__this = this
};
}
}
public static class ChristmasLightChaserInstaller
{
public static void InstallOn(GameObject prefabRoot, float stepSeconds, float emissionIntensity)
{
InstallOn(prefabRoot, stepSeconds, emissionIntensity, null, ChristmasLightChaser.AnimationMode.Chase);
}
public static void InstallOn(GameObject prefabRoot, float stepSeconds, float emissionIntensity, Color[] paletteOverride, ChristmasLightChaser.AnimationMode mode)
{
if (Object.op_Implicit((Object)(object)prefabRoot))
{
ChristmasLightChaser christmasLightChaser = prefabRoot.GetComponent<ChristmasLightChaser>();
if (!Object.op_Implicit((Object)(object)christmasLightChaser))
{
christmasLightChaser = prefabRoot.AddComponent<ChristmasLightChaser>();
}
christmasLightChaser.includeInactive = true;
christmasLightChaser.stepSeconds = stepSeconds;
christmasLightChaser.emissionIntensity = emissionIntensity;
christmasLightChaser.mode = mode;
if (paletteOverride != null && paletteOverride.Length != 0)
{
christmasLightChaser.paletteOverride = paletteOverride;
}
christmasLightChaser.targets = CollectBulbRenderers(prefabRoot, new string[1] { "light" }, new string[6] { "cable", "wire", "string", "snap", "garland", "rope" });
}
}
private static List<Renderer> CollectBulbRenderers(GameObject root, string[] includePrefixes, string[] ignoreContains)
{
List<Renderer> list = new List<Renderer>();
if (!Object.op_Implicit((Object)(object)root))
{
return list;
}
Renderer[] componentsInChildren = root.GetComponentsInChildren<Renderer>(true);
foreach (Renderer val in componentsInChildren)
{
if (!Object.op_Implicit((Object)(object)val))
{
continue;
}
string text = ((Object)((Component)val).gameObject).name.ToLowerInvariant();
bool flag = false;
if (ignoreContains != null)
{
foreach (string value in ignoreContains)
{
if (!string.IsNullOrEmpty(value) && text.Contains(value))
{
flag = true;
break;
}
}
}
if (flag)
{
continue;
}
bool flag2 = includePrefixes == null || includePrefixes.Length == 0;
if (!flag2)
{
foreach (string value2 in includePrefixes)
{
if (!string.IsNullOrEmpty(value2) && text.StartsWith(value2))
{
flag2 = true;
break;
}
}
}
if (flag2)
{
list.Add(val);
}
}
return list;
}
}
public class ChristmasLightsGlow : MonoBehaviour
{
[Header("Target renderer (child name)")]
public string rendererChildName = "Christmas tree.007";
[Header("Choose how to select materials")]
public bool useIndices = true;
[Tooltip("Material slots that should glow (0-based)")]
public int[] glowSlots = new int[3] { 2, 7, 8 };
[Tooltip("Match by material name (contains, case-insensitive)")]
public string[] glowNameContains = new string[1] { "vray_Christmas Tree Set3_4.001" };
[Header("Glow settings")]
public Color emissionColor = Color.yellow;
public float intensity = 3f;
public bool animate = false;
public float cycleSeconds = 5f;
private Renderer _rend;
private Material[] _mats;
private bool[] _shouldGlow;
private void Awake()
{
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
Transform val = ((Component)this).transform.Find(rendererChildName);
if ((Object)(object)val != (Object)null)
{
_rend = ((Component)val).GetComponent<Renderer>();
}
if ((Object)(object)_rend == (Object)null)
{
_rend = (from r in ((Component)this).GetComponentsInChildren<Renderer>(true)
orderby (r.sharedMaterials != null) ? r.sharedMaterials.Length : 0 descending
select r).FirstOrDefault();
}
if ((Object)(object)_rend == (Object)null)
{
return;
}
_mats = _rend.materials;
_shouldGlow = new bool[_mats.Length];
for (int i = 0; i < _mats.Length; i++)
{
bool flag = false;
if (useIndices)
{
for (int j = 0; j < glowSlots.Length; j++)
{
if (glowSlots[j] == i)
{
flag = true;
break;
}
}
}
else
{
string text = (((Object)(object)_mats[i] != (Object)null) ? ((Object)_mats[i]).name : "");
for (int k = 0; k < glowNameContains.Length; k++)
{
if (!string.IsNullOrEmpty(glowNameContains[k]) && text.ToLower().Contains(glowNameContains[k].ToLower()))
{
flag = true;
break;
}
}
}
_shouldGlow[i] = flag;
if (flag && (Object)(object)_mats[i] != (Object)null)
{
_mats[i].EnableKeyword("_EMISSION");
Color val2 = emissionColor * Mathf.LinearToGammaSpace(intensity);
_mats[i].SetColor("_EmissionColor", val2);
_mats[i].globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1;
}
}
_rend.materials = _mats;
}
private void Update()
{
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
if (!animate || _mats == null)
{
return;
}
float num = Mathf.Max(0.01f, cycleSeconds);
float num2 = Time.time % num / num;
float num3 = 0.5f + 0.5f * Mathf.Sin(num2 * (float)Math.PI * 2f);
for (int i = 0; i < _mats.Length; i++)
{
if (_shouldGlow[i] && (Object)(object)_mats[i] != (Object)null)
{
Color val = emissionColor * Mathf.LinearToGammaSpace(intensity * (0.5f + num3));
_mats[i].SetColor("_EmissionColor", val);
}
}
}
}
internal static class WrappingPaperCraftFX
{
}
public class WrappingBoxProxy : MonoBehaviour, Interactable, Hoverable
{
private WrappingBoxProcessor processor;
private void Awake()
{
processor = ((Component)this).GetComponentInChildren<WrappingBoxProcessor>(true);
}
public bool Interact(Humanoid user, bool hold, bool alt)
{
return false;
}
public bool UseItem(Humanoid user, ItemData item)
{
return false;
}
public string GetHoverName()
{
return "Wrapper";
}
public string GetHoverText()
{
if ((Object)(object)processor != (Object)null && processor.CanWrap())
{
return "Wrapper\n[<color=yellow><b>E</b></color>] Open\n<color=orange>Close box to wrap gift</color>";
}
return "Wrapper\n[<color=yellow><b>E</b></color>] Open\n(Add 1 gift + 1 item)";
}
}
public static class WrappedGiftUse
{
public const string KEY_PREFAB = "wrapped_prefab";
public const string KEY_STACK = "wrapped_stack";
public const string KEY_QUALITY = "wrapped_quality";
public const string KEY_VARIANT = "wrapped_variant";
public const string KEY_DURABILITY = "wrapped_durability";
public static bool OnUse(ItemData gift, Player player)
{
if (gift == null || (Object)(object)player == (Object)null)
{
return false;
}
Inventory inventory = ((Humanoid)player).GetInventory();
if (inventory == null)
{
return false;
}
Dictionary<string, string> customData = gift.m_customData;
if (customData == null || !customData.TryGetValue("wrapped_prefab", out var value))
{
return false;
}
ZNetScene instance = ZNetScene.instance;
GameObject val = ((instance != null) ? instance.GetPrefab(value) : null);
if ((Object)(object)val == (Object)null)
{
return false;
}
ItemDrop component = val.GetComponent<ItemDrop>();
if ((Object)(object)component == (Object)null)
{
return false;
}
int result = 1;
int result2 = 1;
int result3 = 0;
float result4 = 0f;
if (customData.TryGetValue("wrapped_stack", out var value2))
{
int.TryParse(value2, out result);
}
if (customData.TryGetValue("wrapped_quality", out value2))
{
int.TryParse(value2, out result2);
}
if (customData.TryGetValue("wrapped_variant", out value2))
{
int.TryParse(value2, out result3);
}
if (customData.TryGetValue("wrapped_durability", out value2))
{
float.TryParse(value2, NumberStyles.Float, CultureInfo.InvariantCulture, out result4);
}
ItemData val2 = component.m_itemData.Clone();
val2.m_dropPrefab = val;
val2.m_stack = Mathf.Max(1, result);
val2.m_quality = Mathf.Max(1, result2);
val2.m_variant = result3;
if (result4 > 0f)
{
val2.m_durability = result4;
}
if (!inventory.CanAddItem(val2, -1))
{
return false;
}
inventory.AddItem(val2);
inventory.RemoveItem(gift, 1);
return true;
}
public static bool OnUse(ItemData gift)
{
Player localPlayer = Player.m_localPlayer;
if ((Object)(object)localPlayer == (Object)null)
{
return false;
}
return OnUse(gift, localPlayer);
}
}
public class WrappingBoxProcessor : MonoBehaviour
{
[CompilerGenerated]
private sealed class <BlinkRoutine>d__12 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public float duration;
public WrappingBoxProcessor <>4__this;
private Renderer[] <renderers>5__1;
private float <t>5__2;
private Dictionary<Material, Color> <original>5__3;
private Renderer[] <>s__4;
private int <>s__5;
private Renderer <r>5__6;
private float <pulse>5__7;
private Renderer[] <>s__8;
private int <>s__9;
private Renderer <r>5__10;
private Dictionary<Material, Color>.Enumerator <>s__11;
private KeyValuePair<Material, Color> <kv>5__12;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <BlinkRoutine>d__12(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<renderers>5__1 = null;
<original>5__3 = null;
<>s__4 = null;
<r>5__6 = null;
<>s__8 = null;
<r>5__10 = null;
<>s__11 = default(Dictionary<Material, Color>.Enumerator);
<kv>5__12 = default(KeyValuePair<Material, Color>);
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<renderers>5__1 = ((Component)<>4__this).GetComponentsInChildren<Renderer>(true);
<t>5__2 = 0f;
<original>5__3 = new Dictionary<Material, Color>();
<>s__4 = <renderers>5__1;
for (<>s__5 = 0; <>s__5 < <>s__4.Length; <>s__5++)
{
<r>5__6 = <>s__4[<>s__5];
if ((Object)(object)<r>5__6 != (Object)null && (Object)(object)<r>5__6.material != (Object)null && <r>5__6.material.HasProperty("_Color") && !<original>5__3.ContainsKey(<r>5__6.material))
{
<original>5__3[<r>5__6.material] = <r>5__6.material.color;
}
<r>5__6 = null;
}
<>s__4 = null;
break;
case 1:
<>1__state = -1;
break;
}
if (<t>5__2 < duration)
{
<pulse>5__7 = Mathf.Sin(Time.time * 10f) * 0.7f + 1.7f;
<>s__8 = <renderers>5__1;
for (<>s__9 = 0; <>s__9 < <>s__8.Length; <>s__9++)
{
<r>5__10 = <>s__8[<>s__9];
if ((Object)(object)<r>5__10 != (Object)null && (Object)(object)<r>5__10.material != (Object)null && <r>5__10.material.HasProperty("_Color"))
{
<r>5__10.material.color = <original>5__3[<r>5__10.material] * <pulse>5__7;
}
<r>5__10 = null;
}
<>s__8 = null;
<t>5__2 += Time.deltaTime;
<>2__current = null;
<>1__state = 1;
return true;
}
<>s__11 = <original>5__3.GetEnumerator();
try
{
while (<>s__11.MoveNext())
{
<kv>5__12 = <>s__11.Current;
if ((Object)(object)<kv>5__12.Key != (Object)null)
{
<kv>5__12.Key.color = <kv>5__12.Value;
}
<kv>5__12 = default(KeyValuePair<Material, Color>);
}
}
finally
{
((IDisposable)<>s__11).Dispose();
}
<>s__11 = default(Dictionary<Material, Color>.Enumerator);
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 <WrapSequence>d__10 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public WrappingBoxProcessor <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <WrapSequence>d__10(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>4__this.wrapInProgress = true;
<>2__current = ((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.BlinkRoutine(3.8f));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>4__this.Wrap();
<>4__this.SpawnBuildSmoke();
<>4__this.SpawnTamedFX();
<>4__this.wrapInProgress = 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();
}
}
private Container container;
private ZNetView nview;
private bool wasInUseLastFrame = false;
private bool wrapInProgress = false;
private const float WRAP_DELAY = 3.8f;
private void Awake()
{
container = ((Component)this).GetComponentInChildren<Container>(true);
nview = ((Component)this).GetComponent<ZNetView>();
}
private void Update()
{
if (!((Object)(object)container == (Object)null) && (!((Object)(object)nview != (Object)null) || nview.IsOwner()))
{
bool flag = container.IsInUse();
if (wasInUseLastFrame && !flag && !wrapInProgress && CanWrap())
{
((MonoBehaviour)this).StartCoroutine(WrapSequence());
}
wasInUseLastFrame = flag;
}
}
private bool IsWrappingPaper(ItemData item)
{
if (item == null || (Object)(object)item.m_dropPrefab == (Object)null)
{
return false;
}
return ((Object)item.m_dropPrefab).name.Contains("WrappingPaper");
}
private string GetGiftPrefabNameFromPaper(string paperPrefabName)
{
if (string.IsNullOrEmpty(paperPrefabName))
{
return null;
}
switch (paperPrefabName)
{
case "M_Gree_Gold_WrappingPaper":
return "M_Gree_Gold_Gift";
case "M_WrappingPaper_SnowFlake_Blue":
return "M_SnowFlake_Blue";
case "M_WrappingPaper_SnowFlake_Red":
return "M_SnowFlake_Red";
default:
if (paperPrefabName.StartsWith("M_WrappingPaper_"))
{
return "M_Gift_" + paperPrefabName.Substring("M_WrappingPaper_".Length);
}
return paperPrefabName.Replace("WrappingPaper", "Gift");
}
}
public bool CanWrap()
{
List<ItemData> allItems = container.GetInventory().GetAllItems();
if (allItems.Count != 2)
{
return false;
}
ItemData val = null;
ItemData val2 = null;
foreach (ItemData item in allItems)
{
if (IsWrappingPaper(item))
{
val = item;
}
else
{
val2 = item;
}
}
return val != null && val2 != null;
}
[IteratorStateMachine(typeof(<WrapSequence>d__10))]
private IEnumerator WrapSequence()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <WrapSequence>d__10(0)
{
<>4__this = this
};
}
private void Wrap()
{
if ((Object)(object)ZNetScene.instance == (Object)null)
{
return;
}
Inventory inventory = container.GetInventory();
ItemData val = null;
ItemData val2 = null;
foreach (ItemData allItem in inventory.GetAllItems())
{
if (IsWrappingPaper(allItem))
{
val = allItem;
}
else
{
val2 = allItem;
}
}
if (val == null || val2 == null)
{
return;
}
string giftPrefabNameFromPaper = GetGiftPrefabNameFromPaper(((Object)val.m_dropPrefab).name);
if (string.IsNullOrEmpty(giftPrefabNameFromPaper))
{
return;
}
GameObject prefab = ZNetScene.instance.GetPrefab(giftPrefabNameFromPaper);
if (!((Object)(object)prefab == (Object)null))
{
Dictionary<string, string> customData = new Dictionary<string, string>
{
{
"wrapped_prefab",
((Object)val2.m_dropPrefab).name
},
{
"wrapped_stack",
val2.m_stack.ToString()
},
{
"wrapped_quality",
val2.m_quality.ToString()
},
{
"wrapped_variant",
val2.m_variant.ToString()
},
{
"wrapped_durability",
val2.m_durability.ToString(CultureInfo.InvariantCulture)
}
};
inventory.RemoveItem(val2);
inventory.RemoveItem(val);
ItemDrop component = prefab.GetComponent<ItemDrop>();
if (!((Object)(object)component == (Object)null))
{
ItemData val3 = component.m_itemData.Clone();
val3.m_dropPrefab = prefab;
val3.m_stack = 1;
val3.m_customData = customData;
inventory.AddItem(val3);
}
}
}
[IteratorStateMachine(typeof(<BlinkRoutine>d__12))]
private IEnumerator BlinkRoutine(float duration)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <BlinkRoutine>d__12(0)
{
<>4__this = this,
duration = duration
};
}
private void SpawnBuildSmoke()
{
//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_0039: 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)
ZNetScene instance = ZNetScene.instance;
GameObject val = ((instance != null) ? instance.GetPrefab("vfx_PlacePiece") : null);
if ((Object)(object)val != (Object)null)
{
Object.Instantiate<GameObject>(val, ((Component)this).transform.position + Vector3.up * 0.5f, Quaternion.identity);
}
}
private void SpawnTamedFX()
{
//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_0039: 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)
ZNetScene instance = ZNetScene.instance;
GameObject val = ((instance != null) ? instance.GetPrefab("fx_creature_tamed") : null);
if ((Object)(object)val != (Object)null)
{
Object.Instantiate<GameObject>(val, ((Component)this).transform.position + Vector3.up * 0.5f, Quaternion.identity);
}
}
}
public static class WrappedGiftData
{
public const string KEY_PREFAB = "mf_wrap_prefab";
public const string KEY_STACK = "mf_wrap_stack";
public const string KEY_QUALITY = "mf_wrap_quality";
public const string KEY_VARIANT = "mf_wrap_variant";
public const string KEY_DURABILITY = "mf_wrap_durability";
public static void Write(ZNetView znv, ItemData item)
{
if (!((Object)(object)znv == (Object)null) && znv.IsValid() && item != null)
{
ZDO zDO = znv.GetZDO();
if (zDO != null)
{
zDO.Set("mf_wrap_prefab", ((Object)item.m_dropPrefab).name);
zDO.Set("mf_wrap_stack", item.m_stack);
zDO.Set("mf_wrap_quality", item.m_quality);
zDO.Set("mf_wrap_variant", item.m_variant);
zDO.Set("mf_wrap_durability", item.m_durability);
}
}
}
public static bool HasData(ZNetView znv)
{
if ((Object)(object)znv == (Object)null || !znv.IsValid())
{
return false;
}
ZDO zDO = znv.GetZDO();
if (zDO == null)
{
return false;
}
return !string.IsNullOrEmpty(zDO.GetString("mf_wrap_prefab", ""));
}
public static ItemData Read(ZNetView znv)
{
if (!HasData(znv))
{
return null;
}
ZDO zDO = znv.GetZDO();
string @string = zDO.GetString("mf_wrap_prefab", "");
GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(@string);
if ((Object)(object)itemPrefab == (Object)null)
{
return null;
}
ItemDrop component = itemPrefab.GetComponent<ItemDrop>();
if ((Object)(object)component == (Object)null)
{
return null;
}
ItemData val = component.m_itemData.Clone();
val.m_stack = zDO.GetInt("mf_wrap_stack", 1);
val.m_quality = zDO.GetInt("mf_wrap_quality", 1);
val.m_variant = zDO.GetInt("mf_wrap_variant", 0);
val.m_durability = zDO.GetFloat("mf_wrap_durability", val.GetMaxDurability());
return val;
}
}
public static class WrappingPaperRegistrar
{
private struct PaperDef
{
public string PrefabName;
public string DisplayName;
public PaperDef(string prefabName, string displayName)
{
PrefabName = prefabName;
DisplayName = displayName;
}
}
private static bool registered;
public static void Register(AssetBundle bundle)
{
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Expected O, but got Unknown
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Expected O, but got Unknown
//IL_0246: Unknown result type (might be due to invalid IL or missing references)
//IL_024c: Expected O, but got Unknown
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_025c: Expected O, but got Unknown
//IL_0264: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Expected O, but got Unknown
if (registered || (Object)(object)bundle == (Object)null)
{
return;
}
PaperDef[] array = new PaperDef[7]
{
new PaperDef("M_WrappingPaper_BlackOrange_Valheim", "Wrapping Paper (Black & Orange)"),
new PaperDef("M_WrappingPaper_Red_Blue", "Wrapping Paper (Red & Blue)"),
new PaperDef("M_WrappingPaper_Silver_Black", "Wrapping Paper (Silver & Black)"),
new PaperDef("M_WrappingPaper_Yellow_Deco", "Wrapping Paper (Yellow Deco)"),
new PaperDef("M_WrappingPaper_SnowFlake_Blue", "Wrapping Paper (SnowFlake Blue)"),
new PaperDef("M_WrappingPaper_SnowFlake_Red", "Wrapping Paper (SnowFlake Red)"),
new PaperDef("M_Gree_Gold_WrappingPaper", "Wrapping Paper (Green & Gold)")
};
PaperDef[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
PaperDef paperDef = array2[i];
GameObject val = bundle.LoadAsset<GameObject>(paperDef.PrefabName);
if ((Object)(object)val == (Object)null)
{
continue;
}
((Object)val).name = paperDef.PrefabName;
ZNetView val2 = val.GetComponent<ZNetView>() ?? val.AddComponent<ZNetView>();
val2.m_persistent = true;
val.layer = LayerMask.NameToLayer("item");
ItemDrop component = val.GetComponent<ItemDrop>();
if (!((Object)(object)component == (Object)null) && component.m_itemData?.m_shared != null)
{
SharedData shared = component.m_itemData.m_shared;
shared.m_itemType = (ItemType)1;
shared.m_maxStackSize = 100;
shared.m_weight = 0.1f;
shared.m_value = 0;
shared.m_name = paperDef.DisplayName;
shared.m_description = "Festive paper used to wrap gifts.";
Sprite val3 = bundle.LoadAsset<Sprite>(paperDef.PrefabName);
if ((Object)(object)val3 != (Object)null)
{
shared.m_icons = (Sprite[])(object)new Sprite[1] { val3 };
}
component.m_itemData.m_dropPrefab = val;
ItemManager.Instance.AddItem(new CustomItem(val, true));
ItemManager instance = ItemManager.Instance;
RecipeConfig val4 = new RecipeConfig();
val4.Item = paperDef.PrefabName;
val4.Amount = 1;
val4.CraftingStation = "M_Wrapping_Table";
val4.Requirements = (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("Wood", 1, 0, true),
new RequirementConfig("Dandelion", 1, 0, true)
};
instance.AddRecipe(new CustomRecipe(val4));
}
}
registered = true;
}
}
public static class WrappedGiftItemRegistrar
{
private static bool registered;
private static readonly string[] GiftPrefabs = new string[7] { "M_Gift_BlackOrange_Valheim", "M_Gift_Yellow_Deco", "M_Gift_Red_Blue", "M_Gree_Gold_Gift", "M_SnowFlake_Blue", "M_SnowFlake_Red", "M_Gift_Silver_Black" };
public static void Register(AssetBundle bundle)
{
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Expected O, but got Unknown
if (registered || (Object)(object)bundle == (Object)null)
{
return;
}
string[] giftPrefabs = GiftPrefabs;
foreach (string text in giftPrefabs)
{
GameObject val = bundle.LoadAsset<GameObject>(text);
if ((Object)(object)val == (Object)null)
{
continue;
}
((Object)val).name = text;
ZNetView val2 = val.GetComponent<ZNetView>() ?? val.AddComponent<ZNetView>();
val2.m_persistent = true;
val.layer = LayerMask.NameToLayer("item");
ItemDrop component = val.GetComponent<ItemDrop>();
if (!((Object)(object)component == (Object)null) && component.m_itemData?.m_shared != null)
{
SharedData shared = component.m_itemData.m_shared;
shared.m_itemType = (ItemType)2;
shared.m_maxStackSize = 1;
shared.m_weight = 1f;
shared.m_value = 0;
shared.m_description = "A wrapped gift. Right-click to open.";
Sprite val3 = bundle.LoadAsset<Sprite>(text);
if ((Object)(object)val3 != (Object)null)
{
shared.m_icons = (Sprite[])(object)new Sprite[1] { val3 };
}
component.m_itemData.m_dropPrefab = val;
ItemManager.Instance.AddItem(new CustomItem(val, true));
}
}
registered = true;
}
}
public class DeerMarker : MonoBehaviour
{
public static readonly HashSet<DeerMarker> All = new HashSet<DeerMarker>();
private void OnEnable()
{
All.Add(this);
}
private void OnDisable()
{
All.Remove(this);
}
}
public class IcicleFlow : MonoBehaviour
{
public enum Axis
{
Auto,
Y,
Z
}
private class Column
{
public int columnIndex;
public int batch;
public float cycleLength;
public List<Renderer> bulbs = new List<Renderer>();
public List<MaterialPropertyBlock> mpb = new List<MaterialPropertyBlock>();
}
[Header("Target naming")]
public string columnNamePrefix = "Icicle_Lamp_";
public string bulbNamePrefix = "Light";
[Header("Look")]
public Color dripColor = new Color(0.6f, 0.85f, 1f);
[Min(0f)]
public float emissionIntensity = 4.5f;
public bool affectBaseColor = false;
[Header("Timing")]
[Min(0.01f)]
public float dripStepSeconds = 0.15f;
[Min(0f)]
public float pauseAfterColumn = 0.6f;
[Min(1f)]
public int batchCount = 3;
[Min(0f)]
public float batchSpacingSeconds = 4f;
[Header("Advanced")]
public bool includeInactive = true;
public bool autoDetectVerticalAxis = true;
public Axis verticalAxis = Axis.Auto;
[Header("Performance")]
[Min(0.01f)]
public float minUpdateInterval = 0.05f;
[Min(0f)]
public float activeDistance = 60f;
private readonly List<Column> _columns = new List<Column>();
private float _gammaIntensity;
private int _colorId;
private int _emissId;
private float _accum;
private bool _isActive;
private void Awake()
{
_colorId = Shader.PropertyToID("_Color");
_emissId = Shader.PropertyToID("_EmissionColor");
_gammaIntensity = Mathf.LinearToGammaSpace(Mathf.Max(0f, emissionIntensity));
BuildColumns();
}
private void OnEnable()
{
PrepareMPBs();
}
private void Update()
{
//IL_002b: 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_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
if (_columns.Count == 0)
{
return;
}
if (activeDistance > 0f && !Player.IsPlayerInRange(((Component)this).transform.position, activeDistance))
{
if (_isActive)
{
for (int i = 0; i < _columns.Count; i++)
{
SetColumnAll(_columns[i], Color.black);
}
_isActive = false;
}
return;
}
_isActive = true;
_accum += Time.deltaTime;
if (_accum < minUpdateInterval)
{
return;
}
_accum = 0f;
float time = Time.time;
for (int j = 0; j < _columns.Count; j++)
{
Column column = _columns[j];
if (column.bulbs.Count == 0)
{
continue;
}
float num = (float)column.batch * Mathf.Min(batchSpacingSeconds, column.cycleLength * 0.9f);
float num2 = time - num;
if (num2 < 0f)
{
SetColumnAll(column, Color.black);
continue;
}
float num3 = column.cycleLength;
if (num3 <= 0.0001f)
{
num3 = 0.0001f;
}
float num4 = num2 % num3;
int count = column.bulbs.Count;
float num5 = (float)count * Mathf.Max(0.01f, dripStepSeconds);
if (num4 >= 0f && num4 < num5)
{
int activeIndex = Mathf.Clamp(Mathf.FloorToInt(num4 / Mathf.Max(0.01f, dripStepSeconds)), 0, count - 1);
SetColumnActive(column, activeIndex, dripColor);
}
else
{
SetColumnAll(column, Color.black);
}
}
}
private void BuildColumns()
{
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Expected O, but got Unknown
_columns.Clear();
List<Transform> list = new List<Transform>();
Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren<Transform>(includeInactive);
foreach (Transform val in componentsInChildren)
{
if (Object.op_Implicit((Object)(object)val) && (string.IsNullOrEmpty(columnNamePrefix) || ((Object)val).name.StartsWith(columnNamePrefix)))
{
list.Add(val);
}
}
list.Sort((Transform a, Transform b) => a.localPosition.x.CompareTo(b.localPosition.x));
for (int j = 0; j < list.Count; j++)
{
Transform val2 = list[j];
Column column = new Column();
column.columnIndex = j;
column.batch = ((batchCount > 0) ? (j % batchCount) : 0);
Renderer[] componentsInChildren2 = ((Component)val2).GetComponentsInChildren<Renderer>(includeInactive);
foreach (Renderer val3 in componentsInChildren2)
{
if (Object.op_Implicit((Object)(object)val3))
{
string text = ((Object)((Component)val3).gameObject).name.ToLowerInvariant();
if (string.IsNullOrEmpty(bulbNamePrefix) || text.StartsWith(bulbNamePrefix.ToLowerInvariant()))
{
column.bulbs.Add(val3);
}
}
}
if (column.bulbs.Count != 0)
{
Axis axis = ResolveAxis(column.bulbs);
column.bulbs.Sort(delegate(Renderer a, Renderer b)
{
float localAxis = GetLocalAxis(((Component)a).transform, axis);
float localAxis2 = GetLocalAxis(((Component)b).transform, axis);
return -localAxis.CompareTo(localAxis2);
});
for (int l = 0; l < column.bulbs.Count; l++)
{
column.mpb.Add(new MaterialPropertyBlock());
}
column.cycleLength = (float)column.bulbs.Count * Mathf.Max(0.01f, dripStepSeconds) + Mathf.Max(0f, pauseAfterColumn);
_columns.Add(column);
}
}
}
private Axis ResolveAxis(List<Renderer> bulbs)
{
//IL_005a: 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_0061: 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_0071: 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_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
if (!autoDetectVerticalAxis)
{
return (verticalAxis == Axis.Auto) ? Axis.Z : verticalAxis;
}
float num = float.PositiveInfinity;
float num2 = float.NegativeInfinity;
float num3 = float.PositiveInfinity;
float num4 = float.NegativeInfinity;
for (int i = 0; i < bulbs.Count; i++)
{
Transform transform = ((Component)bulbs[i]).transform;
Vector3 localPosition = transform.localPosition;
if (localPosition.y < num)
{
num = localPosition.y;
}
if (localPosition.y > num2)
{
num2 = localPosition.y;
}
if (localPosition.z < num3)
{
num3 = localPosition.z;
}
if (localPosition.z > num4)
{
num4 = localPosition.z;
}
}
float num5 = num2 - num;
float num6 = num4 - num3;
if (num5 >= num6)
{
return Axis.Y;
}
return Axis.Z;
}
private float GetLocalAxis(Transform t, Axis axis)
{
//IL_0012: 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_002e: Unknown result type (might be due to invalid IL or missing references)
return axis switch
{
Axis.Y => t.localPosition.y,
Axis.Z => t.localPosition.z,
_ => t.localPosition.z,
};
}
private void PrepareMPBs()
{
for (int i = 0; i < _columns.Count; i++)
{
Column column = _columns[i];
for (int j = 0; j < column.bulbs.Count; j++)
{
Renderer val = column.bulbs[j];
if (Object.op_Implicit((Object)(object)val))
{
Material sharedMaterial = val.sharedMaterial;
if ((Object)(object)sharedMaterial != (Object)null)
{
sharedMaterial.EnableKeyword("_EMISSION");
}
val.GetPropertyBlock(column.mpb[j]);
}
}
}
}
private void SetColumnActive(Column col, int activeIndex, Color onColor)
{
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: 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_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < col.bulbs.Count; i++)
{
Renderer val = col.bulbs[i];
if (Object.op_Implicit((Object)(object)val))
{
MaterialPropertyBlock val2 = col.mpb[i];
if (affectBaseColor)
{
val2.SetColor(_colorId, (i == activeIndex) ? onColor : Color.black);
}
val2.SetColor(_emissId, (i == activeIndex) ? (onColor * _gammaIntensity) : Color.black);
val.SetPropertyBlock(val2);
}
}
}
private void SetColumnAll(Column col, Color c)
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < col.bulbs.Count; i++)
{
Renderer val = col.bulbs[i];
if (Object.op_Implicit((Object)(object)val))
{
MaterialPropertyBlock val2 = col.mpb[i];
if (affectBaseColor)
{
val2.SetColor(_colorId, c);
}
val2.SetColor(_emissId, c * _gammaIntensity);
val.SetPropertyBlock(val2);
}
}
}
}
[BepInPlugin("Moonforged.ChristmasDecorations", "Moonforged Christmas Decorations", "1.0.3")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class MoonforgedChristmas : BaseUnityPlugin
{
[CompilerGenerated]
private sealed class <DelayedRegister>d__7 : IEnumerator<object>, IDisposable, IEnumerator
{
private int <>1__state;
private object <>2__current;
public AssetBundle bundle;
public MoonforgedChristmas <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DelayedRegister>d__7(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
break;
}
if ((Object)(object)ZNetScene.instance == (Object)null)
{
<>2__current = null;
<>1__state = 1;
return true;
}
RelicRegistrar.RegisterAllRelics(bundle);
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();
}
}
public const string PluginGUID = "Moonforged.ChristmasDecorations";
public const string PluginName = "Moonforged Christmas Decorations";
public const string PluginVersion = "1.0.3";
private AssetBundle christmasBundle;
private static readonly List<GameObject> placedObjects = new List<GameObject>();
public static ConfigEntry<string> PlayerPreferredCategory;
private void Awake()
{
//IL_0006: 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)
new Harmony("moonforged.christmas.scalingdebug").PatchAll();
string resourcePath = "MoonforgedChristmasDecorations.christmas";
christmasBundle = EmbeddedAssetBundleLoader.LoadBundle(resourcePath);
if ((Object)(object)christmasBundle == (Object)null)
{
((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load embedded AssetBundle.");
return;
}
TrackAllPrefabsInBundle(christmasBundle);
PlayerPreferredCategory = ((BaseUnityPlugin)this).Config.Bind<string>("General", "CustomHammerTab", "Moonforged Christmas", "Set the hammer tab where this mod's pieces should appear (e.g., Building, Furniture, Moonforged Christmas)");
foreach (string allCategory in RelicRegistrar.GetAllCategories())
{
PieceManager.Instance.AddPieceCategory(allCategory);
}
PrefabManager.OnPrefabsRegistered += delegate
{
((MonoBehaviour)this).StartCoroutine(DelayedRegister(christmasBundle));
};
}
[IteratorStateMachine(typeof(<DelayedRegister>d__7))]
private IEnumerator DelayedRegister(AssetBundle bundle)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DelayedRegister>d__7(0)
{
<>4__this = this,
bundle = bundle
};
}
public static void TrackAllPrefabsInBundle(AssetBundle bundle)
{
GameObject[] array = bundle.LoadAllAssets<GameObject>();
foreach (GameObject val in array)
{
if ((Object)(object)val != (Object)null && (Object)(object)val.GetComponent<PlacementWatcher>() == (Object)null)
{
val.AddComponent<PlacementWatcher>().RegisterList = placedObjects;
}
}
}
}
public static class EmbeddedAssetBundleLoader
{
public static AssetBundle LoadBundle(string resourcePath)
{
Assembly executingAssembly = Assembly.GetExecutingAssembly();
using Stream stream = executingAssembly.GetManifestResourceStream(resourcePath);
if (stream == null)
{
Debug.LogError((object)("AssetBundle resource not found: " + resourcePath));
return null;
}
byte[] array = new byte[stream.Length];
stream.Read(array, 0, array.Length);
return AssetBundle.LoadFromMemory(array);
}
}
[HarmonyPatch]
internal static class WrappedGiftConsumePatch
{
[HarmonyPatch(typeof(Player), "ConsumeItem")]
[HarmonyPrefix]
private static bool Player_ConsumeItem_Prefix(Player __instance, Inventory inventory, ItemData item)
{
if ((Object)(object)__instance == (Object)null || inventory == null || item == null)
{
return true;
}
if (!IsGift(item))
{
return true;
}
if (WrappedGiftUse.OnUse(item, __instance))
{
return false;
}
return true;
}
private static bool IsGift(ItemData item)
{
if (item == null || (Object)(object)item.m_dropPrefab == (Object)null)
{
return false;
}
string name = ((Object)item.m_dropPrefab).name;
if (string.IsNullOrEmpty(name))
{
return false;
}
if (name.StartsWith("M_Gift_"))
{
return true;
}
if (name.StartsWith("M_SnowFlake_"))
{
return true;
}
if (name == "M_Gree_Gold_Gift")
{
return true;
}
return false;
}
}
[HarmonyPatch(typeof(Container), "GetHoverName")]
internal static class WrappingBoxHoverNamePatch
{
private static void Postfix(Container __instance, ref string __result)
{
if (!((Object)(object)__instance == (Object)null))
{
WrappingBoxProcessor componentInParent = ((Component)__instance).GetComponentInParent<WrappingBoxProcessor>();
if (!((Object)(object)componentInParent == (Object)null))
{
__result = "Wrapper";
}
}
}
}
[HarmonyPatch(typeof(Container), "GetHoverText")]
internal static class WrappingBoxHoverTextPatch
{
private static void Postfix(Container __instance, ref string __result)
{
if ((Object)(object)__instance == (Object)null)
{
return;
}
WrappingBoxProcessor componentInParent = ((Component)__instance).GetComponentInParent<WrappingBoxProcessor>();
if (!((Object)(object)componentInParent == (Object)null))
{
if (componentInParent.CanWrap())
{
__result = "Wrapper\n[<color=yellow><b>E</b></color>] Open\n<color=orange>Close box to wrap gift</color>";
}
else
{
__result = "Wrapper\n[<color=yellow><b>E</b></color>] Open\n(Add 1 gift + 1 item)";
}
}
}
}
public class PlacementWatcher : MonoBehaviour
{
public List<GameObject> RegisterList;
private void Start()
{
if (RegisterList != null && !RegisterList.Contains(((Component)this).gameObject))
{
RegisterList.Add(((Component)this).gameObject);
}
}
private void OnDestroy()
{
if (RegisterList != null)
{
RegisterList.Remove(((Component)this).gameObject);
}
}
}
public class RainbowGlow : MonoBehaviour
{
public float cycleSeconds = 10f;
public float emissionIntensity = 1.5f;
public float lightRange = 3f;
public float lightIntensity = 1.8f;
private bool _active;
private Material _matInstance;
private Light _light;
private void Start()
{
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
_active = (Object)(object)((Component)this).GetComponentInParent<ItemStand>() != (Object)null;
if (_active)
{
Renderer componentInChildren = ((Component)this).GetComponentInChildren<Renderer>();
if ((Object)(object)componentInChildren != (Object)null)
{
_matInstance = componentInChildren.material;
_matInstance.EnableKeyword("_EMISSION");
_matInstance.SetColor("_EmissionColor", Color.white * emissionIntensity);
_matInstance.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1;
}
_light = ((Component)this).GetComponent<Light>();
if ((Object)(object)_light == (Object)null)
{
_light = ((Component)this).gameObject.AddComponent<Light>();
_light.type = (LightType)2;
_light.range = lightRange;
_light.intensity = lightIntensity;
_light.shadows = (LightShadows)0;
}
}
}
private void Update()
{
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: 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_007b: Unknown result type (might be due to invalid IL or missing references)
if (_active && !((Object)(object)_matInstance == (Object)null) && !((Object)(object)_light == (Object)null))
{
float num = Mathf.Max(0.01f, cycleSeconds);
float num2 = Time.time % num / num;
Color val = Color.HSVToRGB(num2, 1f, 1f);
_matInstance.SetColor("_EmissionColor", val * emissionIntensity);
_light.color = val;
}
}
}
public class RelicRegistration
{
public string PrefabName;
public string DisplayName;
public RequirementConfig[] Requirements;
public string Description;
public string Category;
public int Comfort;
public string CraftingStation;
public RelicRegistration(string prefab, string display, RequirementConfig[] reqs, string desc, string cat, int comfort = 0, string craftingStation = "Workbench")
{
PrefabName = prefab;
DisplayName = display;
Requirements = reqs;
Description = desc;
Category = cat;
Comfort = comfort;
CraftingStation = craftingStation;
}
}
public static class RelicRegistrar
{
private class ScaleEnforcer : MonoBehaviour
{
public Vector3 desiredScale = Vector3.one;
private void Awake()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
((Component)this).transform.localScale = desiredScale;
}
}
private static bool wasAlreadyRegistered = false;
private static bool _starRegistered = false;
public static readonly List<RelicRegistration> AllRegistrations = new List<RelicRegistration>
{
new RelicRegistration("M_Christmas_Tree_1", "Town Square Christmas Tree", (RequirementConfig[])(object)new RequirementConfig[4]
{
new RequirementConfig("Wood", 30, 0, true),
new RequirementConfig("Raspberry", 20, 0, true),
new RequirementConfig("Blueberries", 20, 0, true),
new RequirementConfig("Coal", 20, 0, true)
}, "Large town square Christmas Tree, craft a Star in the workbench and place it on the top.", "building"),
new RelicRegistration("M_Christmas_Tree_Small", "Small Christmas Tree", (RequirementConfig[])(object)new RequirementConfig[4]
{
new RequirementConfig("Wood", 10, 0, true),
new RequirementConfig("Raspberry", 5, 0, true),
new RequirementConfig("Blueberries", 5, 0, true),
new RequirementConfig("Coal", 5, 0, true)
}, "A small Christmas Tree, craft a Star in the workbench and place it on the top.", "building"),
new RelicRegistration("M_Garland", "Green Christmas Garland", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("FineWood", 2, 0, true),
new RequirementConfig("Raspberry", 2, 0, true)
}, "A traditional Holiday decoration, you can link them with bows.", "building"),
new RelicRegistration("M_Garland_White", "White Christmas Garland", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("FineWood", 2, 0, true),
new RequirementConfig("Blueberries", 2, 0, true)
}, "A traditional Holiday decoration, you can link them with bows.", "building"),
new RelicRegistration("M_Garland_Spiral_Green", "Christmas Spiral Garland (Green)", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("FineWood", 5, 0, true),
new RequirementConfig("PineCone", 1, 0, true)
}, "They can be used arround pillars and poles.", "building"),
new RelicRegistration("M_Garland_Spiral_White", "Christmas Spiral Garland (White)", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("FineWood", 5, 0, true),
new RequirementConfig("PineCone", 1, 0, true)
}, "They can be used arround pillars and poles.", "building"),
new RelicRegistration("M_Christmas_Wreath", "Christmas Wreath", (RequirementConfig[])(object)new RequirementConfig[3]
{
new RequirementConfig("FineWood", 1, 0, true),
new RequirementConfig("FirCone", 4, 0, true),
new RequirementConfig("Raspberry", 10, 0, true)
}, "Brings a traditional feeling in your homes.", "building"),
new RelicRegistration("M_mistletoe", "Christmas Mistletoe", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("FineWood", 1, 0, true),
new RequirementConfig("JuteRed", 1, 0, true)
}, "Kiss your partner or the troll under it.", "building"),
new RelicRegistration("Christmas_Lights1", "Christmas Star Lights", (RequirementConfig[])(object)new RequirementConfig[1]
{
new RequirementConfig("Crystal", 5, 0, true)
}, "Nice Twinkly Star shaped Lights.", "building"),
new RelicRegistration("Christmas_Lights2", "Christmas Snowflake Lights", (RequirementConfig[])(object)new RequirementConfig[1]
{
new RequirementConfig("Crystal", 5, 0, true)
}, "Nice Twinkly Snowflake shaped Lights", "building"),
new RelicRegistration("MChristmas_Lights1", "Christmas Lights", (RequirementConfig[])(object)new RequirementConfig[3]
{
new RequirementConfig("Raspberry", 5, 0, true),
new RequirementConfig("Blueberries", 5, 0, true),
new RequirementConfig("Coal", 5, 0, true)
}, "Nice Twinkly Lights", "building"),
new RelicRegistration("MChristmas_LongLights1", "Christmas Long Lights", (RequirementConfig[])(object)new RequirementConfig[3]
{
new RequirementConfig("Raspberry", 5, 0, true),
new RequirementConfig("Blueberries", 5, 0, true),
new RequirementConfig("Coal", 5, 0, true)
}, "Nice Twinkly Lights", "building"),
new RelicRegistration("M_Icicle_Lamp", "Icicle Christmas Lights", (RequirementConfig[])(object)new RequirementConfig[1]
{
new RequirementConfig("Crystal", 5, 0, true)
}, "Glowing icicle light string that drips with blue light.", "building"),
new RelicRegistration("MultiStar_Light", "Star Lights", (RequirementConfig[])(object)new RequirementConfig[1]
{
new RequirementConfig("Crystal", 5, 0, true)
}, "Glowing Multi Star lights.", "building"),
new RelicRegistration("8Meter_Town_Light", "8 Meter Town Square Light", (RequirementConfig[])(object)new RequirementConfig[1]
{
new RequirementConfig("Crystal", 5, 0, true)
}, "Town Square Star Light Decoration.", "building"),
new RelicRegistration("M_Snowflake", "Christmas Hanging Snowflake Model I", (RequirementConfig[])(object)new RequirementConfig[1]
{
new RequirementConfig("Crystal", 1, 0, true)
}, "A Shiny Hanging Snowflake.", "building"),
new RelicRegistration("M_Snowflake2", "Christmas Hanging Snowflake Model II", (RequirementConfig[])(object)new RequirementConfig[1]
{
new RequirementConfig("Crystal", 1, 0, true)
}, "A Shiny Hanging Snowflake.", "building"),
new RelicRegistration("M_Snowflake3", "Christmas Hanging Snowflake Model III", (RequirementConfig[])(object)new RequirementConfig[1]
{
new RequirementConfig("Crystal", 1, 0, true)
}, "A Shiny Hanging Snowflake.", "building"),
new RelicRegistration("M_Snowflake4", "Christmas Hanging Snowflake Model IV", (RequirementConfig[])(object)new RequirementConfig[1]
{
new RequirementConfig("Crystal", 1, 0, true)
}, "A Shiny Hanging Snowflake.", "building"),
new RelicRegistration("M_BigblueChristmasbow", "Big Blue Christmas Bow", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("LeatherScraps", 2, 0, true),
new RequirementConfig("Blueberries", 2, 0, true)
}, "A nice Bow to connect your garlands.", "building"),
new RelicRegistration("M_BigredChristmasbow", "Big Red Christmas Bow", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("LeatherScraps", 2, 0, true),
new RequirementConfig("Bloodbag", 1, 0, true)
}, "A nice Bow to connect your garlands.", "building"),
new RelicRegistration("M_Cozy_Yule_Cup", "Cozy Yule Hot Cocoa Cup", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("Wood", 1, 0, true),
new RequirementConfig("Coal", 1, 0, true)
}, "", "building"),
new RelicRegistration("M_Cozy_Candy_Cane_Cup", "Hot Cocoa Cup with a Candy Cane", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("Wood", 1, 0, true),
new RequirementConfig("Coal", 1, 0, true)
}, "", "building"),
new RelicRegistration("Christmas_Cups3", "Hot Cocoa Cup with a Chocolate Tree", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("Wood", 1, 0, true),
new RequirementConfig("Coal", 1, 0, true)
}, "", "building"),
new RelicRegistration("M_MilkandCookiesforSanta", "Milk and Cookies for Santa", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("Resin", 1, 0, true),
new RequirementConfig("Coal", 1, 0, true)
}, "", "building"),
new RelicRegistration("M_Gingerbread_Man", "Gingerbread Man", (RequirementConfig[])(object)new RequirementConfig[1]
{
new RequirementConfig("Wood", 1, 0, true)
}, "We finaly caught him!", "building"),
new RelicRegistration("M_Christmas_Cake", "Christmas Cake on a Plate", (RequirementConfig[])(object)new RequirementConfig[3]
{
new RequirementConfig("Stone", 1, 0, true),
new RequirementConfig("Blueberries", 5, 0, true),
new RequirementConfig("BarleyFlour", 1, 0, true)
}, "Don`t eat it all, leave some for Santa.", "building"),
new RelicRegistration("M_Christmas_Cake2", "Christmas Strawberry Cake on a Plate", (RequirementConfig[])(object)new RequirementConfig[3]
{
new RequirementConfig("Stone", 1, 0, true),
new RequirementConfig("Raspberry", 5, 0, true),
new RequirementConfig("BarleyFlour", 1, 0, true)
}, "Don`t eat it all, leave some for Santa.", "building"),
new RelicRegistration("M_YuleLogCake", "Yule Log Cake", (RequirementConfig[])(object)new RequirementConfig[3]
{
new RequirementConfig("Wood", 1, 0, true),
new RequirementConfig("Raspberry", 5, 0, true),
new RequirementConfig("BarleyFlour", 1, 0, true)
}, "Is not a poop is a cake.", "building"),
new RelicRegistration("M_Christmas_Wine", "Bottle of Wine", (RequirementConfig[])(object)new RequirementConfig[3]
{
new RequirementConfig("Wood", 1, 0, true),
new RequirementConfig("Stone", 1, 0, true),
new RequirementConfig("Raspberry", 5, 0, true)
}, "Moonforged Christmas Home made Wine for you all.", "building"),
new RelicRegistration("M_Red_Candy_Cane_1m", "Red Candy Cane", (RequirementConfig[])(object)new RequirementConfig[3]
{
new RequirementConfig("Wood", 1, 0, true),
new RequirementConfig("Raspberry", 1, 0, true),
new RequirementConfig("Coal", 1, 0, true)
}, "Candy Cane decorations.", "building"),
new RelicRegistration("M_Green_Candy_Cane_1m", "Green Candy Cane", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("Wood", 1, 0, true),
new RequirementConfig("Dandelion", 1, 0, true)
}, "Candy Cane decorations.", "building"),
new RelicRegistration("M_RedGreen_Candy_Cane_1m", "Red & Green Candy Cane", (RequirementConfig[])(object)new RequirementConfig[3]
{
new RequirementConfig("Wood", 1, 0, true),
new RequirementConfig("Raspberry", 1, 0, true),
new RequirementConfig("Dandelion", 1, 0, true)
}, "Candy Cane decorations.", "building"),
new RelicRegistration("M_Green_Red_Candy_Cane_1m", "Green & Red Candy Cane", (RequirementConfig[])(object)new RequirementConfig[3]
{
new RequirementConfig("Wood", 1, 0, true),
new RequirementConfig("Raspberry", 1, 0, true),
new RequirementConfig("Dandelion", 1, 0, true)
}, "Candy Cane decorations.", "building"),
new RelicRegistration("M_Christmas_Stocking", "Christmas Stocking", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("LeatherScraps", 1, 0, true),
new RequirementConfig("Bloodbag", 1, 0, true)
}, "", "building"),
new RelicRegistration("M_Christmas_Stocking_2", "Large Christmas Stocking", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("LeatherScraps", 2, 0, true),
new RequirementConfig("Raspberry", 1, 0, true)
}, "", "building"),
new RelicRegistration("M_Snowman", "Snowman", (RequirementConfig[])(object)new RequirementConfig[3]
{
new RequirementConfig("Wood", 3, 0, true),
new RequirementConfig("Coal", 5, 0, true),
new RequirementConfig("Carrot", 1, 0, true)
}, "", "building"),
new RelicRegistration("M_SantaClaus", "Santa Claus", (RequirementConfig[])(object)new RequirementConfig[4]
{
new RequirementConfig("FineWood", 10, 0, true),
new RequirementConfig("LeatherScraps", 10, 0, true),
new RequirementConfig("Raspberry", 10, 0, true),
new RequirementConfig("Coal", 5, 0, true)
}, "Saint Nicholas", "building"),
new RelicRegistration("M_Small_Santa_Claus", "Small Santa Claus Figurine", (RequirementConfig[])(object)new RequirementConfig[4]
{
new RequirementConfig("FineWood", 2, 0, true),
new RequirementConfig("LeatherScraps", 3, 0, true),
new RequirementConfig("Raspberry", 3, 0, true),
new RequirementConfig("Coal", 1, 0, true)
}, "He`s always watching, what a creep.", "building"),
new RelicRegistration("M_SantaBag", "Santa’s Bag of Gifts", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("Wood", 2, 0, true),
new RequirementConfig("LeatherScraps", 10, 0, true)
}, "Wonder whats inside?", "building"),
new RelicRegistration("M_boot", "Santa’s Boot of Gifts and Flowers", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("Wood", 2, 0, true),
new RequirementConfig("Raspberry", 2, 0, true)
}, "You can put gifts or flowers inside the boot.", "building"),
new RelicRegistration("M_Nutcracker", "Nutcracker Figurine", (RequirementConfig[])(object)new RequirementConfig[1]
{
new RequirementConfig("FineWood", 1, 0, true)
}, "Wooden figurine with a hinged mouth for cracking nuts.", "building"),
new RelicRegistration("M_Deer", "Santa’s Reindeers", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("DeerMeat", 4, 0, true),
new RequirementConfig("DeerHide", 4, 0, true)
}, "Dasher, Dancer, Prancer, Vixen, Comet, Cupid, Donner, Blitzen", "building"),
new RelicRegistration("M_Deer_Rudy", "Rudolph the Red-Nosed Reindeer", (RequirementConfig[])(object)new RequirementConfig[3]
{
new RequirementConfig("DeerMeat", 4, 0, true),
new RequirementConfig("DeerHide", 4, 0, true),
new RequirementConfig("Raspberry", 1, 0, true)
}, "A very shiny nose. You might even say it glows.", "building"),
new RelicRegistration("M_Christmas_Sled", "Santa’s Sled", (RequirementConfig[])(object)new RequirementConfig[3]
{
new RequirementConfig("Wood", 40, 0, true),
new RequirementConfig("BronzeNails", 20, 0, true),
new RequirementConfig("Bronze", 5, 0, true)
}, "Sanat`s Christmas Sled, you can sit in it.", "building", 0, "Forge"),
new RelicRegistration("M_Christmas_Train", "Christmas Train", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("FineWood", 5, 0, true),
new RequirementConfig("Iron", 1, 0, true)
}, "A small train that runs around its track and you can ride it round and round.", "building", 0, "Forge"),
new RelicRegistration("M_Christmas_Banner_1", "Santa`s Christmas Banner I", (RequirementConfig[])(object)new RequirementConfig[4]
{
new RequirementConfig("LeatherScraps", 6, 0, true),
new RequirementConfig("FineWood", 2, 0, true),
new RequirementConfig("Raspberry", 2, 0, true),
new RequirementConfig("Guck", 1, 0, true)
}, "Reindeers under the mistletoe", "building"),
new RelicRegistration("M_Christmas_Banner_2", "Santa`s Christmas Banner II", (RequirementConfig[])(object)new RequirementConfig[4]
{
new RequirementConfig("LeatherScraps", 6, 0, true),
new RequirementConfig("FineWood", 2, 0, true),
new RequirementConfig("Raspberry", 2, 0, true),
new RequirementConfig("Guck", 1, 0, true)
}, "Jingle bells", "building"),
new RelicRegistration("M_Christmas_Banner_4", "Santa`s Christmas Banner IV", (RequirementConfig[])(object)new RequirementConfig[4]
{
new RequirementConfig("LeatherScraps", 6, 0, true),
new RequirementConfig("FineWood", 2, 0, true),
new RequirementConfig("Raspberry", 2, 0, true),
new RequirementConfig("Coal", 1, 0, true)
}, "Reindeers under the evening star.", "building"),
new RelicRegistration("M_Bench", "Santa`s Christmas Bench", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("FineWood", 5, 0, true),
new RequirementConfig("Iron", 2, 0, true)
}, "", "building", 0, "Forge"),
new RelicRegistration("M_Christmas_Throne", "Santa`s Christmas Throne", (RequirementConfig[])(object)new RequirementConfig[3]
{
new RequirementConfig("FineWood", 20, 0, true),
new RequirementConfig("BronzeNails", 10, 0, true),
new RequirementConfig("JuteRed", 2, 0, true)
}, "Sit on Santa`s lap and tell him what you want for christmas.", "building", 0, "Forge"),
new RelicRegistration("M_Star", "Evening Star", (RequirementConfig[])(object)new RequirementConfig[1]
{
new RequirementConfig("Crystal", 2, 0, true)
}, "Can be placed on top of the Christmas tree", "building"),
new RelicRegistration("Tio_de_Nadal", "Tió de Nadal", (RequirementConfig[])(object)new RequirementConfig[3]
{
new RequirementConfig("RoundLog", 2, 0, true),
new RequirementConfig("LeatherScraps", 2, 0, true),
new RequirementConfig("Raspberry", 1, 0, true)
}, "", "building"),
new RelicRegistration("M_icicles", "An Icicle.", (RequirementConfig[])(object)new RequirementConfig[1]
{
new RequirementConfig("Crystal", 1, 0, true)
}, "Dripping ice decoration.", "building"),
new RelicRegistration("ChirstmasMozaic_1", "Snowman Stained-Glass Window.", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("Crystal", 1, 0, true),
new RequirementConfig("FineWood", 4, 0, true)
}, "", "building"),
new RelicRegistration("ChirstmasMozaic_2", "Santa`s Stained-Glass Window.", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("Crystal", 1, 0, true),
new RequirementConfig("FineWood", 4, 0, true)
}, "", "building"),
new RelicRegistration("ChristmasHouseMozaic", "Christmas Home Stained-Glass Window.", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("Crystal", 1, 0, true),
new RequirementConfig("FineWood", 4, 0, true)
}, "", "building"),
new RelicRegistration("M_Wrapping_Table", "Christmas Wrapping Table.", (RequirementConfig[])(object)new RequirementConfig[2]
{
new RequirementConfig("Wood", 5, 0, true),
new RequirementConfig("FineWood", 5, 0, true)
}, "From this table you can create christmas gifts and decorations.", "building", 0, "")
};
public static IEnumerable<string> GetAllCategories()
{
return AllRegistrations.Select((RelicRegistration r) => CategoryToTab(r.Category)).Distinct();
}
private static string CategoryToTab(string category)
{
string text = category.ToLower();
string text2 = text;
string text3 = text2;
if (text3 == "building")
{
return MoonforgedChristmas.PlayerPreferredCategory.Value;
}
return category;
}
public static void RegisterAllRelics(AssetBundle bundle)
{
if (wasAlreadyRegistered)
{
return;
}
foreach (RelicRegistration allRegistration in AllRegistrations)
{
RegisterRelic(bundle, allRegistration);
}
WrappedGiftItemRegistrar.Register(bundle);
WrappingPaperRegistrar.Register(bundle);
wasAlreadyRegistered = true;
}
private static void RegisterRelic(AssetBundle bundle, RelicRegistration reg)
{
//IL_00b2: 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_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: 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_01c2: 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)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0214: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_0263: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: 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_0274: Unknown result type (might be due to invalid IL or missing references)
//IL_027b: Unknown result type (might be due to invalid IL or missing references)
//IL_0280: Unknown result type (might be due to invalid IL or missing references)
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_0307: 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_0313: Unknown result type (might be due to invalid IL or missing references)
//IL_0318: Unknown result type (might be due to invalid IL or missing references)
//IL_031f: Unknown result type (might be due to invalid IL or missing references)
//IL_0324: Unknown result type (might be due to invalid IL or missing references)
//IL_03a9: Unknown result type (might be due to invalid IL or missing references)
//IL_03ae: Unknown result type (might be due to invalid IL or missing references)
//IL_0449: Unknown result type (might be due to invalid IL or missing references)
//IL_044e: Unknown result type (might be due to invalid IL or missing references)
//IL_0a1b: Unknown result type (might be due to invalid IL or missing references)
//IL_0a22: Expected O, but got Unknown
//IL_0a39: Unknown result type (might be due to invalid IL or missing references)
//IL_0a3e: Unknown result type (might be due to invalid IL or missing references)
//IL_0a46: Unknown result type (might be due to invalid IL or missing references)
//IL_0a52: Expected O, but got Unknown
//IL_0a63: Unknown result type (might be due to invalid IL or missing references)
//IL_0a68: Unknown result type (might be due to invalid IL or missing references)
//IL_0a70: Unknown result type (might be due to invalid IL or missing references)
//IL_0a7c: Expected O, but got Unknown
//IL_0ac5: Unknown result type (might be due to invalid IL or missing references)
//IL_0acc: Expected O, but got Unknown
//IL_0ae3: Unknown result type (might be due to invalid IL or missing references)
//IL_0ae8: Unknown result type (might be due to invalid IL or missing references)
//IL_0af0: Unknown result type (might be due to invalid IL or missing references)
//IL_0afc: Expected O, but got Unknown
//IL_0b3e: Unknown result type (might be due to invalid IL or missing references)
//IL_0b43: Unknown result type (might be due to invalid IL or missing references)
//IL_0b4f: Unknown result type (might be due to invalid IL or missing references)
//IL_0b61: Unknown result type (might be due to invalid IL or missing references)
//IL_0b6e: Unknown result type (might be due to invalid IL or missing references)
//IL_0b7d: Expected O, but got Unknown
//IL_0b86: Unknown result type (might be due to invalid IL or missing references)
//IL_0b90: Expected O, but got Unknown
//IL_0b0d: Unknown result type (might be due to invalid IL or missing references)
//IL_0b12: Unknown result type (might be due to invalid IL or missing references)
//IL_0b1a: Unknown result type (might be due to invalid IL or missing references)
//IL_0b26: Expected O, but got Unknown
if ((Object)(object)bundle == (Object)null)
{
return;
}
if (reg.PrefabName == "M_Star")
{
RegisterCraftedStar(bundle, reg);
return;
}
GameObject val = bundle.LoadAsset<GameObject>(reg.PrefabName);
if ((Object)(object)val == (Object)null)
{
return;
}
((Object)val).name = reg.PrefabName;
if (reg.PrefabName == "M_Wrapping_Table")
{
val.AddComponent<WrappingBoxProxy>();
}
if (reg.PrefabName == "M_Deer" || reg.PrefabName == "M_Deer_Rudy")
{
val.transform.localScale = Vector3.one * 0.014f;
ScaleEnforcer scaleEnforcer = val.GetComponent<ScaleEnforcer>() ?? val.AddComponent<ScaleEnforcer>();
scaleEnforcer.desiredScale = Vector3.one * 0.014f;
if (!Object.op_Implicit((Object)(object)val.GetComponent<DeerMarker>()))
{
val.AddComponent<DeerMarker>();
}
}
if (reg.PrefabName == "M_Christmas_Tree_1")
{
ChildLightsCycler childLightsCycler = val.GetComponent<ChildLightsCycler>() ?? val.AddComponent<ChildLightsCycler>();
childLightsCycler.lightRendererNames = new string[3] { "Light1", "Light2", "Light3" };
childLightsCycler.intensity = 4.4f;
childLightsCycler.stepSeconds = 1f;
}
if (reg.PrefabName == "Christmas_Lights1")
{
ChristmasLightChaserInstaller.InstallOn(val, 1f, 4.4f);
}
if (reg.PrefabName == "Christmas_Lights2")
{
ChristmasLightChaserInstaller.InstallOn(val, 0.8f, 4.4f, (Color[])(object)new Color[2]
{
Color.white,
Color.yellow
}, ChristmasLightChaser.AnimationMode.BlinkAll);
}
if (reg.PrefabName == "8Meter_Town_Light")
{
ChristmasLightChaserInstaller.InstallOn(val, 0.8f, 4.4f, (Color[])(object)new Color[2]
{
Color.white,
Color.yellow
}, ChristmasLightChaser.AnimationMode.BlinkAll);
}
if (reg.PrefabName == "MChristmas_Lights1" || reg.PrefabName == "MChristmas_LongLights1")
{
ChristmasLightChaserInstaller.InstallOn(val, 1f, 4.4f, (Color[])(object)new Color[3]
{
Color.red,
Color.yellow,
Color.blue
}, ChristmasLightChaser.AnimationMode.Chase);
}
if (reg.PrefabName == "M_Garland_Spiral_Green")
{
ChristmasLightChaserInstaller.InstallOn(val, 1f, 4.4f, (Color[])(object)new Color[3]
{
Color.red,
Color.yellow,
Color.blue
}, ChristmasLightChaser.AnimationMode.Chase);
}
if (reg.PrefabName == "M_Garland_Spiral_White")
{
ChristmasLightChaserInstaller.InstallOn(val, 1f, 4.4f, (Color[])(object)new Color[3]
{
Color.red,
Color.yellow,
Color.blue
}, ChristmasLightChaser.AnimationMode.Chase);
}
if (reg.PrefabName == "M_Icicle_Lamp")
{
IcicleFlow icicleFlow = val.GetComponent<IcicleFlow>() ?? val.AddComponent<IcicleFlow>();
icicleFlow.columnNamePrefix = "Icicle_Lamp_";
icicleFlow.bulbNamePrefix = "Light";
icicleFlow.dripStepSeconds = 0.35f;
icicleFlow.pauseAfterColumn = 0.6f;
icicleFlow.emissionIntensity = 4.5f;
icicleFlow.dripColor = new Color(0.6f, 0.85f, 1f);
icicleFlow.batchCount = 4;
icicleFlow.batchSpacingSeconds = 4f;
icicleFlow.autoDetectVerticalAxis = true;
}
if (reg.PrefabName == "MultiStar_Light")
{
IcicleFlow icicleFlow2 = val.GetComponent<IcicleFlow>() ?? val.AddComponent<IcicleFlow>();
icicleFlow2.columnNamePrefix = "MultiStar_Light";
icicleFlow2.bulbNamePrefix = "Light";
icicleFlow2.dripStepSeconds = 0.35f;
icicleFlow2.pauseAfterColumn = 0.6f;
icicleFlow2.emissionIntensity = 4.5f;
icicleFlow2.dripColor = new Color(0.6f, 0.85f, 1f);
icicleFlow2.batchCount = 4;
icicleFlow2.batchSpacingSeconds = 4f;
icicleFlow2.autoDetectVerticalAxis = true;
}
if (reg.PrefabName == "M_Christmas_Sled")
{
SledReinsConnector sledReinsConnector = val.GetComponent<SledReinsConnector>() ?? val.AddComponent<SledReinsConnector>();
sledReinsConnector.maxDeer = 9;
sledReinsConnector.sledAnchorRootName = "RopeAttach";
sledReinsConnector.deerAnchorName = "ReinAnchor";
sledReinsConnector.useSingleStart = true;
sledReinsConnector.verticalLift = 0f;
sledReinsConnector.lateralSpacing = 0f;
sledReinsConnector.forwardSpacing = 0f;
sledReinsConnector.leadExtraForward = 0f;
sledReinsConnector.ropeWidth = 0.018f;
sledReinsConnector.ropeSag = 0.15f;
sledReinsConnector.ropeSegments = 28;
sledReinsConnector.windStrength = 0.25f;
sledReinsConnector.jiggleAmplitude = 0.03f;
sledReinsConnector.jiggleSpeed = 1.1f;
}
if (reg.PrefabName == "M_Christmas_Train")
{
InstallTrainOrbit(val, 18f, clockwise: false);
}
if (reg.PrefabName == "M_Wrapping_Table")
{
Transform val2 = val.transform.Find("Wrapping_Box");
if ((Object)(object)val2 != (Object)null)
{
GameObject gameObject = ((Component)val2).gameObject;
if ((Object)(object)gameObject.GetComponent<WrappingBoxProcessor>() == (Object)null)
{
gameObject.AddComponent<WrappingBoxProcessor>();
}
}
EnsureWrappingTableCraftEffects(val);
}
ZNetView val3 = val.GetComponent<ZNetView>() ?? val.AddComponent<ZNetView>();
val3.m_persistent = true;
val3.m_syncInitialScale = true;
if (!Object.op_Implicit((Object)(object)val.GetComponent<ZSyncTransform>()))
{
val.AddComponent<ZSyncTransform>();
}
Piece val4 = val.GetComponent<Piece>() ?? val.AddComponent<Piece>();
val4.m_name = reg.DisplayName;
val4.m_description = reg.Description;
val4.m_groundOnly = false;
Sprite val5 = bundle.LoadAsset<Sprite>(reg.PrefabName);
if ((Object)(object)val5 != (Object)null)
{
val4.m_icon = val5;
}
HashSet<string> hashSet = new HashSet<string> { "M_Gift_BlackOrange_Valheim", "M_Gift_Yellow_Deco", "M_Gift_Red_Blue", "M_SnowFlake_Blue", "M_SnowFlake_Red", "M_Garland", "M_Garland_White", "M_Garland_Spiral_Green", "M_Garland_Spiral_White", "M_Gingerbread_Man" };
HashSet<string> hashSet2 = new HashSet<string>
{
"M_Cozy_Yule_Cup", "M_Cozy_Candy_Cane_Cup", "Christmas_Cups3", "M_Christmas_Cake", "M_Christmas_Cake2", "M_icicles", "M_Snowflake", "M_Snowflake2", "M_Snowflake3", "M_Snowflake4",
"M_YuleLogCake"
};
HashSet<string> hashSet3 = new HashSet<string>
{
"M_BigredChristmasbow", "M_BigblueChristmasbow", "M_Small_Santa_Claus", "M_Christmas_Wine", "M_MilkandCookiesforSanta", "M_boot", "8Meter_Town_Light", "MultiStar_Light", "Christmas_Lights1", "Christmas_Lights2",
"MChristmas_Lights1", "MChristmas_LongLights1", "M_Icicle_Lamp"
};
HashSet<string> hashSet4 = new HashSet<string> { "M_Red_Candy_Cane_1m", "M_Green_Candy_Cane_1m", "M_RedGreen_Candy_Cane_1m", "M_Green_Red_Candy_Cane_1m" };
HashSet<string> hashSet5 = new HashSet<string> { "M_Christmas_Sled", "M_Christmas_Train", "M_Bench" };
string prefabName = reg.PrefabName;
GameObject val6 = null;
ZNetScene instance = ZNetScene.instance;
GameObject val7 = ((instance != null) ? instance.GetPrefab("sfx_build_hammer_default") : null);
GameObject val8 = null;
ZNetScene instance2 = ZNetScene.instance;
GameObject val9 = ((instance2 != null) ? instance2.GetPrefab("sfx_wood_destroyed") : null);
if (hashSet.Contains(prefabName))
{
ZNetScene instance3 = ZNetScene.instance;
val7 = ((instance3 != null) ? instance3.GetPrefab("sfx_build_hammer_default") : null);
ZNetScene instance4 = ZNetScene.instance;
val9 = ((instance4 != null) ? instance4.GetPrefab("sfx_wood_destroyed") : null);
}
else if (hashSet2.Contains(prefabName) || hashSet3.Contains(prefabName))
{
ZNetScene instance5 = ZNetScene.instance;
val7 = ((instance5 != null) ? instance5.GetPrefab("sfx_build_hammer_crystal") : null);
ZNetScene instance6 = ZNetScene.instance;
val9 = ((instance6 != null) ? instance6.GetPrefab("sfx_clay_pot_break") : null);
}
else if (hashSet4.Contains(prefabName))
{
ZNetScene instance7 = ZNetScene.instance;
val6 = ((instance7 != null) ? instance7.GetPrefab("vfx_Place_stone") : null);
ZNetScene instance8 = ZNetScene.instance;
val7 = ((instance8 != null) ? instance8.GetPrefab("sfx_build_hammer_metal") : null);
ZNetScene instance9 = ZNetScene.instance;
val8 = ((instance9 != null) ? instance9.GetPrefab("vfx_destroyed") : null);
ZNetScene instance10 = ZNetScene.instance;
val9 = ((instance10 != null) ? instance10.GetPrefab("sfx_metal_blocked") : null);
}
else if (hashSet5.Contains(prefabName))
{
ZNetScene instance11 = ZNetScene.instance;
val6 = ((instance11 != null) ? instance11.GetPrefab("vfx_Place_stone") : null);
ZNetScene instance12 = ZNetScene.instance;
val7 = ((instance12 != null) ? instance12.GetPrefab("sfx_build_hammer_metal") : null);
ZNetScene instance13 = ZNetScene.instance;
val8 = ((instance13 != null) ? instance13.GetPrefab("vfx_destroyed") : null);
ZNetScene instance14 = ZNetScene.instance;
val9 = ((instance14 != null) ? instance14.GetPrefab("sfx_metal_blocked") : null);
}
EffectList val10 = new EffectList();
List<EffectData> list = new List<EffectData>();
if ((Object)(object)val6 != (Object)null)
{
list.Add(new EffectData
{
m_prefab = val6,
m_enabled = true
});
}
if ((Object)(object)val7 != (Object)null)
{
list.Add(new EffectData
{
m_prefab = val7,
m_enabled = true
});
}
val10.m_effectPrefabs = list.ToArray();
val4.m_placeEffect = val10;
WearNTear val11 = val.GetComponent<WearNTear>() ?? val.AddComponent<WearNTear>();
val11.m_health = Mathf.Max(val11.m_health, 1000f);
val11.m_noRoofWear = true;
EffectList val12 = new EffectList();
List<EffectData> list2 = new List<EffectData>();
if ((Object)(object)val8 != (Object)null)
{
list2.Add(new EffectData
{
m_prefab = val8,
m_enabled = true
});
}
if ((Object)(object)val9 != (Object)null)
{
list2.Add(new EffectData
{
m_prefab = val9,
m_enabled = true
});
}
val12.m_effectPrefabs = list2.ToArray();
val11.m_destroyedEffect = val12;
PieceConfig val13 = new PieceConfig
{
PieceTable = "Hammer",
Category = CategoryToTab(reg.Category),
CraftingStation = reg.CraftingStation,
Requirements = reg.Requirements
};
PieceManager.Instance.AddPiece(new CustomPiece(val, true, val13));
}
private static void EnsureWrappingTableCraftEffects(GameObject wrappingTablePrefab)
{
if (!((Object)(object)wrappingTablePrefab == (Object)null))
{
CraftingStation val = wrappingTablePrefab.GetComponent<CraftingStation>() ?? wrappingTablePrefab.AddComponent<CraftingStation>();
val.m_name = "Wrapping Table";
ZNetScene instance = ZNetScene.instance;
GameObject sfx = ((instance != null) ? instance.GetPrefab("sfx_gui_craftitem_workbench") : null);
ZNetScene instance2 = ZNetScene.instance;
GameObject sfx2 = ((instance2 != null) ? instance2.GetPrefab("sfx_gui_craftitem_workbench_end") : null);
GameObject vfx = null;
GameObject vfx2 = null;
EffectList value = MakeEffectList(vfx, sfx);
EffectList value2 = MakeEffectList(vfx2, sfx2);
TrySetEffectListField(val, "m_craftItemEffects", value);
TrySetEffectListField(val, "m_craftItemEffect", value);
TrySetEffectListField(val, "m_craftDoneEffects", value2);
TrySetEffectListField(val, "m_craftItemDoneEffects", value2);
TrySetEffectListField(val, "m_craftItemDoneEffect", value2);
TrySetEffectListField(val, "m_repairItemEffects", value);
TrySetEffectListField(val, "m_repairItemEffect", value);
}
}
private static void TrySetEffectListField(object target, string fieldName, EffectList value)
{
if (target != null && !string.IsNullOrEmpty(fieldName) && value != null)
{
FieldInfo field = target.GetType().GetField(fieldName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
if (!(field == null) && !(field.FieldType != typeof(EffectList)))
{
field.SetValue(target, value);
}
}
}
private static EffectList MakeEffectList(GameObject vfx, GameObject sfx)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0019: Unknown resu