using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Venture_Fearless")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Village")]
[assembly: AssemblyTitle("Village")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace Village
{
[BepInPlugin("Venture_Fearless.Village", "Village", "1.0")]
public class Village : BaseUnityPlugin
{
internal static Village Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
private void Awake()
{
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
internal void Patch()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_0026: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Update()
{
}
}
}
namespace Minecraft_Village
{
public class Cheat : MonoBehaviour
{
public List<GameObject> list = new List<GameObject>();
[Space]
[Space]
public GameObject CheatBook;
public List<GameObject> destroy = new List<GameObject>();
public List<GameObject> door = new List<GameObject>();
public List<GameObject> upgrades = new List<GameObject>();
private int order = 0;
private void OnTriggerEnter(Collider col)
{
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_01bc: Unknown result type (might be due to invalid IL or missing references)
//IL_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
if (order != 3 || !((Object)(object)((Component)col).gameObject.GetComponent<Item_ID>() != (Object)null))
{
return;
}
if (((Component)col).gameObject.GetComponent<Item_ID>().id == Item_ID.id_value.Book)
{
Object.Destroy((Object)(object)((Component)((Component)col).transform.parent.parent).gameObject);
GameObject val = Object.Instantiate<GameObject>(CheatBook, ((Component)this).transform.position, Quaternion.identity);
}
if (((Component)col).gameObject.GetComponent<Item_ID>().id == Item_ID.id_value.Redstone)
{
Object.Destroy((Object)(object)((Component)((Component)col).transform.parent.parent).gameObject);
for (int i = 0; i < destroy.Count; i++)
{
if ((Object)(object)destroy[i] != (Object)null)
{
Object.Destroy((Object)(object)destroy[i]);
}
}
}
if (((Component)col).gameObject.GetComponent<Item_ID>().id == Item_ID.id_value.Coal)
{
Object.Destroy((Object)(object)((Component)((Component)col).transform.parent.parent).gameObject);
for (int j = 0; j < door.Count; j++)
{
if ((Object)(object)door[j] != (Object)null)
{
Object.Destroy((Object)(object)door[j]);
}
}
}
if (((Component)col).gameObject.GetComponent<Item_ID>().id == Item_ID.id_value.Flint)
{
for (int k = 0; k < 10; k++)
{
for (int l = 0; l < upgrades.Count; l++)
{
Object.Instantiate<GameObject>(upgrades[l], new Vector3(((Component)this).transform.position.x + 2f, ((Component)this).transform.position.y + 0.5f * (float)l, ((Component)this).transform.position.z + 3f + 0.5f * (float)k), Quaternion.identity);
}
}
}
if (((Component)col).gameObject.GetComponent<Item_ID>().id == Item_ID.id_value.Gold_Ingot)
{
Object.Destroy((Object)(object)((Component)((Component)col).transform.parent.parent).gameObject);
RunManager.instance.levelsCompleted = 10000;
}
}
private void RemoveChunk()
{
Object.Destroy((Object)(object)((Component)((Component)this).transform.parent).gameObject);
}
public void Toggle(int value)
{
//IL_0058: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
if (value == order + 1)
{
order++;
}
else
{
order -= 10000;
}
if (order == 3)
{
for (int i = 0; i < list.Count; i++)
{
Object.Instantiate<GameObject>(list[i], new Vector3(((Component)this).transform.position.x + 0.5f * (float)i, ((Component)this).transform.position.y + 0.5f * (float)i, ((Component)this).transform.position.z + 3f + 0.5f * (float)i), Quaternion.identity);
}
}
}
}
public class CheatToggle : MonoBehaviour
{
public int order = 1;
public GameObject cheat;
private void OnTriggerEnter(Collider col)
{
if ((Object)(object)((Component)col).gameObject.GetComponent<PlayerPhysObjectStander>() != (Object)null)
{
cheat.GetComponent<Cheat>().Toggle(order);
}
}
}
public class ChunkManager : MonoBehaviour
{
public enum level
{
lvl1,
lvl2,
lvl3
}
public level lvl = level.lvl1;
public bool connected_lvl2 = false;
public bool connected_lvl3 = false;
[Space]
[Space]
public int redstone_needed = 0;
public int book_needed = 0;
public int minecart_needed = 0;
public int fire_needed = 0;
[Space]
[Space]
public List<GameObject> mine = new List<GameObject>();
public List<GameObject> door_lvl2 = new List<GameObject>();
[Space]
[Space]
public List<GameObject> city = new List<GameObject>();
public List<GameObject> door_lvl3 = new List<GameObject>();
private void Start()
{
int num = RunManager.instance.levelsCompleted + 1;
if (num < 4)
{
for (int i = 0; i < mine.Count; i++)
{
Object.Destroy((Object)(object)mine[i]);
}
}
else
{
for (int j = 0; j < door_lvl2.Count; j++)
{
Object.Destroy((Object)(object)door_lvl2[j]);
}
}
if (num < 7)
{
for (int k = 0; k < city.Count; k++)
{
Object.Destroy((Object)(object)city[k]);
}
}
else
{
for (int l = 0; l < door_lvl3.Count; l++)
{
Object.Destroy((Object)(object)door_lvl3[l]);
}
}
}
}
public class Crafting : MonoBehaviour
{
private List<GameObject> currentCollisions = new List<GameObject>();
private float delay = 0f;
private void Update()
{
if (delay > 0f)
{
delay -= Time.deltaTime;
}
}
private void OnTriggerExit(Collider col)
{
currentCollisions.Remove(((Component)col).gameObject);
if (delay <= 0f)
{
Craft();
}
}
private void OnTriggerEnter(Collider col)
{
currentCollisions.Add(((Component)col).gameObject);
if (delay <= 0f)
{
Craft();
}
}
private void Craft()
{
int num = 0;
int num2 = 0;
int num3 = 0;
int num4 = 0;
int num5 = 0;
foreach (GameObject currentCollision in currentCollisions)
{
if ((Object)(object)currentCollision.GetComponent<Item_ID>() != (Object)null)
{
switch (currentCollision.GetComponent<Item_ID>().id)
{
case Item_ID.id_value.Iron_Ingot:
num++;
break;
case Item_ID.id_value.Redstone:
num2++;
break;
case Item_ID.id_value.Flint:
num3++;
break;
case Item_ID.id_value.Coal:
num5++;
break;
case Item_ID.id_value.Echo_Shard:
num4++;
break;
}
}
}
if (currentCollisions.Count == 2 && num == 1 && num3 == 1)
{
ActivateItem(8, ((Component)this).gameObject);
foreach (GameObject currentCollision2 in currentCollisions)
{
Object.Destroy((Object)(object)((Component)currentCollision2.transform.parent.parent).gameObject);
}
currentCollisions.Clear();
}
if (currentCollisions.Count == 9 && num4 == 8 && num5 == 1)
{
ActivateItem(9, ((Component)this).gameObject);
foreach (GameObject currentCollision3 in currentCollisions)
{
Object.Destroy((Object)(object)((Component)currentCollision3.transform.parent.parent).gameObject);
}
currentCollisions.Clear();
}
if (currentCollisions.Count == 5 && num == 4 && num2 == 1)
{
ActivateItem(10, ((Component)this).gameObject);
foreach (GameObject currentCollision4 in currentCollisions)
{
Object.Destroy((Object)(object)((Component)currentCollision4.transform.parent.parent).gameObject);
}
currentCollisions.Clear();
}
delay = 3f;
}
private void ActivateItem(int i, GameObject s)
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
Transform val = ((Component)this).transform;
while ((Object)(object)((Component)val).gameObject.GetComponent<ChunkManager>() == (Object)null)
{
val = val.parent;
}
val = val.parent.GetChild(0).GetChild(9).GetChild(i);
if (val.childCount > 0)
{
GameObject gameObject = ((Component)val.GetChild(0)).gameObject;
gameObject.SetActive(true);
gameObject.transform.position = s.transform.position;
gameObject.transform.rotation = s.transform.rotation;
gameObject.transform.parent = gameObject.transform.parent.parent;
}
else
{
Debug.LogError((object)("Crafting Prefab Limit Exceeded: " + i));
}
}
}
public class Furnace : MonoBehaviour
{
private bool turned_on = false;
private bool smelting = false;
public Material on;
public Material off;
private void Update()
{
((Component)((Component)this).gameObject.transform.parent.GetChild(1)).gameObject.SetActive(turned_on);
}
private void OnTriggerEnter(Collider col)
{
if ((Object)(object)((Component)col).gameObject.GetComponent<Item_ID>() != (Object)null && !smelting)
{
if (!turned_on && ((Component)col).gameObject.GetComponent<Item_ID>().id == Item_ID.id_value.Coal)
{
Object.Destroy((Object)(object)((Component)((Component)col).transform.parent.parent).gameObject);
turned_on = true;
UpdateMaterial();
}
else if (turned_on && ((Component)col).gameObject.GetComponent<Item_ID>().id == Item_ID.id_value.Iron_Ore)
{
Object.Destroy((Object)(object)((Component)((Component)col).transform.parent.parent).gameObject);
smelting = true;
((MonoBehaviour)this).Invoke("Smelt", 8f);
}
}
}
private void Smelt()
{
ActivateItem(7, ((Component)this).gameObject);
turned_on = false;
UpdateMaterial();
smelting = false;
}
private void UpdateMaterial()
{
Material[] array = (Material[])(object)new Material[3]
{
((Renderer)((Component)((Component)this).gameObject.transform.parent).gameObject.GetComponent<MeshRenderer>()).materials[0],
default(Material),
default(Material)
};
if (turned_on)
{
array[1] = on;
}
else
{
array[1] = off;
}
array[2] = ((Renderer)((Component)((Component)this).gameObject.transform.parent).gameObject.GetComponent<MeshRenderer>()).materials[2];
((Renderer)((Component)((Component)this).gameObject.transform.parent).gameObject.GetComponent<MeshRenderer>()).materials = array;
}
private void ActivateItem(int i, GameObject s)
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
Transform val = ((Component)this).transform;
while ((Object)(object)((Component)val).gameObject.GetComponent<ChunkManager>() == (Object)null)
{
val = val.parent;
}
val = val.parent.GetChild(0).GetChild(9).GetChild(i);
if (val.childCount > 0)
{
GameObject gameObject = ((Component)val.GetChild(0)).gameObject;
gameObject.SetActive(true);
gameObject.transform.position = s.transform.position;
gameObject.transform.rotation = s.transform.rotation;
gameObject.transform.parent = gameObject.transform.parent.parent;
}
else
{
Debug.LogError((object)"Furnace Prefab Limit Exceeded");
}
}
}
public class Item_ID : MonoBehaviour
{
public enum id_value
{
Redstone,
Book,
Minecart,
Coal,
Flint,
Iron_Ore,
Iron_Ingot,
Flint_and_Steel,
Compass,
Echo_Shard,
Echo_Compass,
Gold_Ingot
}
public id_value id;
}
public class MinecraftManager : MonoBehaviour
{
public GameObject em_ore;
public GameObject em_flint;
public GameObject em_coal;
private float loadtime = 0f;
private bool loaded = false;
private bool open = false;
private int door_progress = 0;
private void Update()
{
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
if (!loaded)
{
loadtime += Time.deltaTime;
if (loadtime > 7f)
{
loaded = true;
Load();
}
return;
}
int num = 0;
for (int i = 0; i < ((Component)this).gameObject.transform.GetChild(1).childCount; i++)
{
if (((Component)((Component)this).gameObject.transform.GetChild(1).GetChild(i)).gameObject.GetComponent<RedstoneDevice>().GetCurrent())
{
num++;
}
}
open = num == 8;
if (open && door_progress < 100)
{
door_progress++;
}
else if (!open && door_progress > 0)
{
door_progress--;
}
if (door_progress > 1 && door_progress < 100)
{
((Component)this).gameObject.transform.GetChild(2).position = new Vector3(((Component)this).gameObject.transform.GetChild(2).position.x, -40f + (float)door_progress * 0.1f, ((Component)this).gameObject.transform.GetChild(2).position.z);
}
}
private void OnTriggerEnter(Collider col)
{
if (!loaded && (Object)(object)((Component)col).gameObject.GetComponent<PlayerCollisionStand>() != (Object)null)
{
loaded = true;
Load();
}
}
private void Load()
{
int num = RunManager.instance.levelsCompleted + 1;
bool flag = false;
bool flag2 = false;
bool flag3 = false;
bool flag4 = false;
bool flag5 = false;
bool flag6 = false;
bool flag7 = false;
int num2 = 0;
int num3 = 0;
int num4 = 0;
int num5 = 0;
int num6 = 0;
int num7 = 5;
List<GameObject> list = new List<GameObject>();
List<GameObject> list2 = new List<GameObject>();
for (int i = 0; i < ((Component)this).gameObject.transform.GetChild(7).childCount; i++)
{
list2.Add(((Component)((Component)this).gameObject.transform.GetChild(7).GetChild(i)).gameObject);
((Component)((Component)this).gameObject.transform.GetChild(7).GetChild(i)).gameObject.SetActive(false);
}
List<GameObject> list3 = new List<GameObject>();
List<GameObject> list4 = new List<GameObject>();
List<GameObject> list5 = new List<GameObject>();
List<GameObject> list6 = new List<GameObject>();
List<GameObject> list7 = new List<GameObject>();
List<GameObject> list8 = new List<GameObject>();
List<GameObject> list9 = new List<GameObject>();
Transform parent = ((Component)this).gameObject.transform.parent;
for (int j = 0; j < parent.childCount; j++)
{
GameObject gameObject = ((Component)parent.GetChild(j)).gameObject;
if ((Object)(object)gameObject.GetComponent<ChunkManager>() != (Object)null)
{
num2 += gameObject.GetComponent<ChunkManager>().redstone_needed;
num3 += gameObject.GetComponent<ChunkManager>().book_needed;
num4 += gameObject.GetComponent<ChunkManager>().minecart_needed;
num5 += gameObject.GetComponent<ChunkManager>().fire_needed;
if (gameObject.GetComponent<ChunkManager>().connected_lvl2)
{
flag3 = true;
}
if (gameObject.GetComponent<ChunkManager>().connected_lvl3)
{
flag4 = true;
}
if (gameObject.GetComponent<ChunkManager>().lvl == ChunkManager.level.lvl2)
{
flag = true;
}
if (gameObject.GetComponent<ChunkManager>().lvl == ChunkManager.level.lvl3)
{
flag2 = true;
}
}
num6 += parent.GetChild(j).GetChild(0).childCount + 7;
for (int k = 0; k < parent.GetChild(j).GetChild(0).childCount; k++)
{
GameObject gameObject2 = ((Component)parent.GetChild(j).GetChild(0).GetChild(k)).gameObject;
gameObject2.SetActive(false);
if (!((Object)(object)gameObject2.GetComponent<SpawnLocation>() != (Object)null))
{
continue;
}
SpawnLocation.found_lvl found = gameObject2.GetComponent<SpawnLocation>().found;
if (found == SpawnLocation.found_lvl.lvl1 || (found == SpawnLocation.found_lvl.lvl2 && num >= 4) || (found == SpawnLocation.found_lvl.lvl3 && num >= 7))
{
switch (gameObject2.GetComponent<SpawnLocation>().id)
{
case SpawnLocation.id_value.Special_Lever:
list.Add(gameObject2);
break;
case SpawnLocation.id_value.Redstone:
list3.Add(gameObject2);
break;
case SpawnLocation.id_value.Book:
list4.Add(gameObject2);
break;
case SpawnLocation.id_value.Minecart:
list5.Add(gameObject2);
break;
case SpawnLocation.id_value.Coal:
list6.Add(gameObject2);
break;
case SpawnLocation.id_value.Flint:
list7.Add(gameObject2);
break;
case SpawnLocation.id_value.Iron_Ore:
list8.Add(gameObject2);
break;
case SpawnLocation.id_value.Echo_Shard:
list9.Add(gameObject2);
break;
}
}
}
}
num7 = num2 * 53 + num4 * 1117 + num5 * 378 + num3 * 99;
((Component)this).gameObject.GetComponent<ChunkManager>().redstone_needed = num2;
((Component)this).gameObject.GetComponent<ChunkManager>().minecart_needed = num4;
((Component)this).gameObject.GetComponent<ChunkManager>().fire_needed = num5;
((Component)this).gameObject.GetComponent<ChunkManager>().book_needed = num3;
for (int l = -1; l <= 6; l++)
{
List<GameObject> list10 = new List<GameObject>();
int num8 = 0;
switch (l)
{
case 0:
list10 = list3;
num8 = num2;
break;
case 1:
list10 = list4;
num8 = num3;
break;
case 2:
list10 = list5;
num8 = num4;
if (num8 > 2)
{
num8 = 2;
}
break;
case 3:
list10 = list6;
num8 = num5;
break;
case 4:
list10 = list7;
num8 = num5;
break;
case 5:
list10 = list8;
num8 = num5;
break;
case 6:
list10 = list9;
if (num >= 7)
{
num8 = 8;
}
break;
}
if (l == -1)
{
if (num >= 7)
{
if (list.Count >= 7)
{
while (list.Count > 7)
{
int index = num7 % list.Count;
num7 += 1902;
list[index].SetActive(false);
list.RemoveAt(index);
}
}
}
else
{
while (list.Count > 0)
{
list[list.Count - 1].SetActive(false);
list.RemoveAt(list.Count - 1);
}
}
continue;
}
if (list10.Count < num8)
{
if (l != 2)
{
for (int m = 0; m < num8 - list10.Count; m++)
{
if (list2.Count <= 0)
{
break;
}
int index2 = num7 % list2.Count;
num7 += 989;
ActivateItem(l, list2[index2]);
list2.RemoveAt(index2);
}
}
num8 = list10.Count;
}
for (int n = 0; n < num8; n++)
{
int index3 = num7 % list10.Count;
num7 += 1001;
ActivateItem(l, list10[index3]);
if (l == 3 && list10[index3].GetComponent<SpawnLocation>().found != SpawnLocation.found_lvl.lvl3)
{
flag7 = true;
}
if (l == 4 && list10[index3].GetComponent<SpawnLocation>().found != SpawnLocation.found_lvl.lvl3)
{
flag5 = true;
}
if (l == 5 && list10[index3].GetComponent<SpawnLocation>().found != SpawnLocation.found_lvl.lvl3)
{
flag6 = true;
}
list10.RemoveAt(index3);
}
}
bool flag8 = num >= 4 && flag;
bool flag9 = num >= 7 && flag2;
bool flag10 = flag9 && !flag4;
if (!flag10 || flag7)
{
em_coal.SetActive(false);
}
if (!flag10 || flag5)
{
em_flint.SetActive(false);
}
if (!flag10 || flag6)
{
em_ore.SetActive(false);
}
if (flag8 && (!flag3 || num6 % 4 == 3))
{
Object.Destroy((Object)(object)((Component)((Component)this).gameObject.transform.GetChild(5)).gameObject);
}
if (flag9 && (!flag4 || (num2 + num3 + num4 + num5) % 4 == 3))
{
Object.Destroy((Object)(object)((Component)((Component)this).gameObject.transform.GetChild(6)).gameObject);
}
if (num >= 7)
{
Object.Destroy((Object)(object)((Component)((Component)this).gameObject.transform.GetChild(3)).gameObject);
for (int num9 = 0; num9 < ((Component)this).transform.GetChild(4).childCount; num9++)
{
((Component)((Component)this).transform.GetChild(4).GetChild(num9)).gameObject.SetActive(true);
}
}
if (flag8 && num >= 4)
{
for (int num10 = 0; num10 < ((Component)this).transform.GetChild(10).childCount; num10++)
{
((Component)((Component)this).transform.GetChild(10).GetChild(num10)).gameObject.SetActive(true);
}
}
}
private void ActivateItem(int i, GameObject s)
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
Transform val = ((Component)this).transform;
while ((Object)(object)((Component)val).gameObject.GetComponent<ChunkManager>() == (Object)null)
{
val = val.parent;
}
val = val.parent.GetChild(0).GetChild(9).GetChild(i);
if (val.childCount > 0)
{
GameObject gameObject = ((Component)val.GetChild(0)).gameObject;
gameObject.SetActive(true);
gameObject.transform.position = s.transform.position;
gameObject.transform.rotation = s.transform.rotation;
gameObject.transform.parent = gameObject.transform.parent.parent;
}
else
{
Debug.LogError((object)("Spawn Prefab Limit Exceeded: " + i));
}
}
}
public class Piston : MonoBehaviour
{
public List<GameObject> input = new List<GameObject>();
[Space]
[Space]
public List<GameObject> target = new List<GameObject>();
private bool current = false;
public void Tick()
{
bool flag = true;
for (int i = 0; i < input.Count; i++)
{
if ((Object)(object)input[i].GetComponent<PowerSource>() != (Object)null && !input[i].GetComponent<PowerSource>().GetCurrent())
{
flag = false;
}
if ((Object)(object)input[i].GetComponent<Redstone>() != (Object)null && !input[i].GetComponent<Redstone>().GetCurrent())
{
flag = false;
}
}
if (flag != current)
{
current = flag;
((Component)this).GetComponent<AudioSource>().Play();
for (int j = 0; j < target.Count; j++)
{
target[j].SetActive(current);
}
}
}
}
public class PowerSource : MonoBehaviour
{
public enum type_value
{
Redstone_Torch,
Lever,
Lectern,
Wooden_Pressure_Plate,
Stone_Pressure_Plate,
Activator_Rail,
Special_Lever
}
public type_value type = type_value.Redstone_Torch;
public List<GameObject> output = new List<GameObject>();
private bool current = false;
private int value = 0;
private void Start()
{
if (type == type_value.Redstone_Torch)
{
Switch(b: true);
}
}
private void Update()
{
if (type == type_value.Lever)
{
((Component)((Component)this).gameObject.transform.GetChild(1)).gameObject.GetComponent<Rigidbody>().useGravity = false;
}
}
private void OnTriggerEnter(Collider c)
{
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: Unknown result type (might be due to invalid IL or missing references)
//IL_0241: Unknown result type (might be due to invalid IL or missing references)
//IL_024b: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: 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_016e: Unknown result type (might be due to invalid IL or missing references)
if (type == type_value.Activator_Rail && (Object)(object)((Component)c).gameObject.GetComponent<Item_ID>() != (Object)null && ((Component)c).gameObject.GetComponent<Item_ID>().id == Item_ID.id_value.Minecart)
{
Switch(b: true);
((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(false);
((Component)((Component)this).transform.GetChild(1)).gameObject.SetActive(true);
((Component)((Component)this).transform.GetChild(2)).gameObject.SetActive(true);
}
if (type == type_value.Wooden_Pressure_Plate)
{
int num = value;
if ((Object)(object)((Component)c).gameObject.GetComponent<PlayerPhysObjectStander>() != (Object)null)
{
num++;
}
if ((Object)(object)((Component)c).gameObject.GetComponent<PhysGrabObjectCollider>() != (Object)null)
{
num++;
}
if (num != value)
{
if (value == 0)
{
Switch(b: true);
((Component)this).GetComponent<AudioSource>().Play();
((Component)this).transform.GetChild(0).position = new Vector3(((Component)this).transform.GetChild(0).position.x, ((Component)this).transform.GetChild(0).position.y - 0.05f, ((Component)this).transform.GetChild(0).position.z);
}
value = num;
}
}
if (type == type_value.Stone_Pressure_Plate)
{
int num2 = value;
if ((Object)(object)((Component)c).gameObject.GetComponent<PlayerPhysObjectStander>() != (Object)null)
{
num2++;
}
if (num2 != value)
{
if (value == 0)
{
Switch(b: true);
((Component)this).GetComponent<AudioSource>().Play();
((Component)this).transform.GetChild(0).position = new Vector3(((Component)this).transform.GetChild(0).position.x, ((Component)this).transform.GetChild(0).position.y - 0.05f, ((Component)this).transform.GetChild(0).position.z);
}
value = num2;
}
}
if (type == type_value.Lever && ((Object)((Component)c).gameObject).name.Equals("Handle"))
{
Switch(b: true);
}
if (type == type_value.Lectern && !current && (Object)(object)((Component)c).gameObject.GetComponent<Item_ID>() != (Object)null && ((Component)c).gameObject.GetComponent<Item_ID>().id == Item_ID.id_value.Book)
{
Object.Destroy((Object)(object)((Component)((Component)c).transform.parent.parent).gameObject);
((Component)((Component)this).gameObject.transform.GetChild(0)).gameObject.SetActive(true);
Switch(b: true);
}
}
private void OnTriggerExit(Collider c)
{
//IL_0207: Unknown result type (might be due to invalid IL or missing references)
//IL_021d: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
if (type == type_value.Activator_Rail && (Object)(object)((Component)c).gameObject.GetComponent<Item_ID>() != (Object)null && ((Component)c).gameObject.GetComponent<Item_ID>().id == Item_ID.id_value.Minecart)
{
Switch(b: false);
((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(true);
((Component)((Component)this).transform.GetChild(1)).gameObject.SetActive(false);
((Component)((Component)this).transform.GetChild(2)).gameObject.SetActive(false);
}
if (type == type_value.Wooden_Pressure_Plate)
{
int num = value;
if ((Object)(object)((Component)c).gameObject.GetComponent<PlayerPhysObjectStander>() != (Object)null)
{
num--;
}
if ((Object)(object)((Component)c).gameObject.GetComponent<PhysGrabObjectCollider>() != (Object)null)
{
num--;
}
if (num != value)
{
if (num == 0)
{
Switch(b: false);
((Component)this).GetComponent<AudioSource>().Play();
((Component)this).transform.GetChild(0).position = new Vector3(((Component)this).transform.GetChild(0).position.x, ((Component)this).transform.GetChild(0).position.y + 0.05f, ((Component)this).transform.GetChild(0).position.z);
}
value = num;
}
}
if (type == type_value.Stone_Pressure_Plate)
{
int num2 = value;
if ((Object)(object)((Component)c).gameObject.GetComponent<PlayerPhysObjectStander>() != (Object)null)
{
num2--;
}
if (num2 != value)
{
if (num2 == 0)
{
Switch(b: false);
((Component)this).GetComponent<AudioSource>().Play();
((Component)this).transform.GetChild(0).position = new Vector3(((Component)this).transform.GetChild(0).position.x, ((Component)this).transform.GetChild(0).position.y + 0.05f, ((Component)this).transform.GetChild(0).position.z);
}
value = num2;
}
}
if (type == type_value.Lever && ((Object)((Component)c).gameObject).name.Equals("Handle"))
{
Switch(b: false);
}
}
public bool GetCurrent()
{
return current;
}
private void Switch(bool b)
{
current = b;
for (int i = 0; i < output.Count; i++)
{
if ((Object)(object)output[i].GetComponent<RedstoneDevice>() != (Object)null)
{
output[i].GetComponent<RedstoneDevice>().Tick();
}
if ((Object)(object)output[i].GetComponent<Redstone>() != (Object)null)
{
output[i].GetComponent<Redstone>().Tick();
}
if ((Object)(object)output[i].GetComponent<TNT>() != (Object)null)
{
output[i].GetComponent<TNT>().Activate();
}
if ((Object)(object)output[i].GetComponent<Piston>() != (Object)null)
{
output[i].GetComponent<Piston>().Tick();
}
}
}
}
public class Redstone : MonoBehaviour
{
public enum logic_value
{
OR_GATE,
AND_GATE
}
public logic_value logic = logic_value.OR_GATE;
public bool active = true;
[Space]
[Space]
public List<GameObject> input = new List<GameObject>();
public List<GameObject> output = new List<GameObject>();
[Space]
[Space]
public Material off;
[Space]
[Space]
public Material on;
private bool current = false;
private void Start()
{
if (!active)
{
((Component)((Component)this).gameObject.transform.GetChild(0)).gameObject.SetActive(false);
((Component)((Component)this).gameObject.transform.GetChild(2)).gameObject.SetActive(true);
}
}
private void OnTriggerEnter(Collider col)
{
if (!active && (Object)(object)((Component)col).gameObject.GetComponent<Item_ID>() != (Object)null && ((Component)col).gameObject.GetComponent<Item_ID>().id == Item_ID.id_value.Redstone)
{
Object.Destroy((Object)(object)((Component)((Component)col).transform.parent.parent).gameObject);
((Component)((Component)this).gameObject.transform.GetChild(0)).gameObject.SetActive(true);
((Component)((Component)this).gameObject.transform.GetChild(2)).gameObject.SetActive(false);
active = true;
Tick();
}
}
public bool GetCurrent()
{
return current;
}
public void Tick()
{
bool flag = true;
if (logic == logic_value.OR_GATE)
{
flag = false;
for (int i = 0; i < input.Count; i++)
{
if ((Object)(object)input[i].GetComponent<PowerSource>() != (Object)null && input[i].GetComponent<PowerSource>().GetCurrent())
{
flag = true;
}
if ((Object)(object)input[i].GetComponent<Redstone>() != (Object)null && input[i].GetComponent<Redstone>().GetCurrent())
{
flag = true;
}
}
}
if (logic == logic_value.AND_GATE)
{
flag = true;
for (int j = 0; j < input.Count; j++)
{
if ((Object)(object)input[j].GetComponent<PowerSource>() != (Object)null && !input[j].GetComponent<PowerSource>().GetCurrent())
{
flag = false;
}
if ((Object)(object)input[j].GetComponent<Redstone>() != (Object)null && !input[j].GetComponent<Redstone>().GetCurrent())
{
flag = false;
}
}
}
if (!active || flag == current)
{
return;
}
current = flag;
Material material = off;
if (current)
{
material = on;
}
((Renderer)((Component)((Component)this).gameObject.transform.GetChild(0)).GetComponent<MeshRenderer>()).material = material;
((Component)((Component)this).gameObject.transform.GetChild(1)).gameObject.SetActive(current);
for (int k = 0; k < output.Count; k++)
{
if ((Object)(object)output[k].GetComponent<RedstoneDevice>() != (Object)null)
{
output[k].GetComponent<RedstoneDevice>().Tick();
}
if ((Object)(object)output[k].GetComponent<Redstone>() != (Object)null)
{
output[k].GetComponent<Redstone>().Tick();
}
if ((Object)(object)output[k].GetComponent<TNT>() != (Object)null)
{
output[k].GetComponent<TNT>().Activate();
}
if ((Object)(object)output[k].GetComponent<Piston>() != (Object)null)
{
output[k].GetComponent<Piston>().Tick();
}
}
}
}
public class RedstoneDevice : MonoBehaviour
{
public enum type_value
{
Iron_Door,
Redstone_Lamp,
Piston,
Dispenser
}
public type_value type;
private bool current = false;
[Space]
[Space]
public List<GameObject> input = new List<GameObject>();
public List<GameObject> targets = new List<GameObject>();
public bool GetCurrent()
{
return current;
}
public void Tick()
{
bool flag = false;
for (int i = 0; i < input.Count; i++)
{
if ((Object)(object)input[i].GetComponent<PowerSource>() != (Object)null && input[i].GetComponent<PowerSource>().GetCurrent())
{
flag = true;
}
if ((Object)(object)input[i].GetComponent<Redstone>() != (Object)null && input[i].GetComponent<Redstone>().GetCurrent())
{
flag = true;
}
}
if (flag == current)
{
return;
}
current = flag;
if (type == type_value.Iron_Door)
{
if (current)
{
((Component)this).transform.Rotate(0f, 0f, -90f, (Space)1);
}
else
{
((Component)this).transform.Rotate(0f, 0f, 90f, (Space)1);
}
((Component)this).GetComponent<AudioSource>().Play();
}
if (type == type_value.Piston)
{
for (int j = 0; j < targets.Count; j++)
{
targets[j].SetActive(!current);
}
((Component)this).GetComponent<AudioSource>().Play();
}
}
}
public class SpawnLocation : MonoBehaviour
{
public enum id_value
{
Special_Lever = -1,
Redstone,
Book,
Minecart,
Coal,
Flint,
Iron_Ore,
Iron_Ingot,
Echo_Shard
}
public enum found_lvl
{
lvl1 = 1,
lvl2,
lvl3
}
public id_value id = id_value.Redstone;
public found_lvl found = found_lvl.lvl1;
}
public class Test : MonoBehaviour
{
public enum id_value
{
Default
}
public int id;
}
public class TNT : MonoBehaviour
{
public List<GameObject> target = new List<GameObject>();
private float charge = -1f;
private void Update()
{
if (charge < -4f && charge > -10f)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
charge = -20f;
for (int i = 0; i < 5; i++)
{
((Component)((Component)this).gameObject.transform.GetChild(i)).gameObject.SetActive(false);
}
}
else if (charge < -2f)
{
charge = -5f;
}
if (!(charge >= 0f))
{
return;
}
charge += Time.deltaTime;
bool flag = charge % 1f < 0.5f;
((Component)((Component)this).gameObject.transform.GetChild(3)).gameObject.SetActive(flag);
((Component)((Component)this).gameObject.transform.GetChild(2)).gameObject.SetActive(!flag);
if (charge >= 4.7f)
{
charge = -3f;
((Component)((Component)this).gameObject.transform.GetChild(4)).gameObject.SetActive(true);
((Component)((Component)this).gameObject.transform.GetChild(3)).gameObject.SetActive(false);
((Component)((Component)this).gameObject.transform.GetChild(2)).gameObject.SetActive(false);
((Component)((Component)this).gameObject.transform.GetChild(1)).gameObject.SetActive(false);
for (int j = 0; j < target.Count; j++)
{
Object.Destroy((Object)(object)target[j]);
}
}
}
private void OnTriggerEnter(Collider c)
{
if ((int)charge == -1 && (Object)(object)((Component)c).gameObject.GetComponent<Item_ID>() != (Object)null && ((Component)c).gameObject.GetComponent<Item_ID>().id == Item_ID.id_value.Flint_and_Steel)
{
Object.Destroy((Object)(object)((Component)((Component)c).transform.parent.parent).gameObject);
Activate();
}
}
public void Activate()
{
if ((int)charge == -1)
{
((Component)this).GetComponent<AudioSource>().Play();
((Component)((Component)this).transform.GetChild(0)).gameObject.SetActive(false);
((Component)((Component)this).transform.GetChild(1)).gameObject.SetActive(true);
charge = 0f;
}
}
}
}