using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Jotunn;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MoreVanillaBuilds")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoreVanillaBuilds")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("13e3a4c3-81da-4b3f-bcd2-295ac8f74a32")]
[assembly: AssemblyFileVersion("1.1.5.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
[assembly: AssemblyVersion("1.1.5.0")]
namespace MoreVanillaBuilds;
[BepInPlugin("fr.galathil.MoreVanillaBuilds", "MoreVanillaBuilds", "1.1.5")]
public class Main : BaseUnityPlugin
{
private const string pluginGUID = "fr.galathil.MoreVanillaBuilds";
private const string pluginName = "MoreVanillaBuilds";
private const string pluginVersion = "1.1.5";
public static ConfigFile config;
private readonly Harmony harmony = new Harmony("fr.galathil.MoreVanillaBuilds");
public void Awake()
{
MVBLog.init(((BaseUnityPlugin)this).Logger);
MVBConfig.setConfigFile(((BaseUnityPlugin)this).Config);
MVBConfig.loadMainConfig();
harmony.PatchAll();
PrefabManager.OnPrefabsRegistered += Patches._ac;
}
}
internal class MVBConfig
{
private static ConfigFile configFile;
private static string MainSectionName = "main";
private static ConfigEntry<bool> forceAllPrefabs;
private static ConfigEntry<bool> verboseMode;
public static void setConfigFile(ConfigFile file)
{
configFile = file;
}
public static void loadMainConfig()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Expected O, but got Unknown
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Expected O, but got Unknown
forceAllPrefabs = configFile.Bind<bool>(MainSectionName, "forceAllPrefabs", false, new ConfigDescription("If enable, allow all filtered prefabs from the game with/within configurations (requirements).", (AcceptableValueBase)null, Array.Empty<object>()));
verboseMode = configFile.Bind<bool>(MainSectionName, "verboseMode", false, new ConfigDescription("If enable, print debug informations in console.", (AcceptableValueBase)null, Array.Empty<object>()));
}
public static void save()
{
configFile.Save();
}
public static MVBPrefabConfig loadPrefabConfig(GameObject prefab)
{
MVBPrefabConfig mVBPrefabConfig = new MVBPrefabConfig();
string text = "prefab-" + ((Object)prefab).name;
mVBPrefabConfig.isEnable = configFile.Bind<bool>(text, "isEnable", false, (ConfigDescription)null);
mVBPrefabConfig.category = configFile.Bind<string>(text, "category", "Misc", (ConfigDescription)null);
mVBPrefabConfig.requirements = configFile.Bind<string>(text, "requirements", "", (ConfigDescription)null);
return mVBPrefabConfig;
}
public static bool isVerbose()
{
return verboseMode.Value;
}
public static bool isForceAllPrefabs()
{
return forceAllPrefabs.Value;
}
}
internal class MVBLog
{
private static ManualLogSource _logger;
public static void init(ManualLogSource logger)
{
_logger = logger;
}
public static void info(object data)
{
if (MVBConfig.isVerbose())
{
_logger.LogInfo(data);
}
}
public static void prefab(GameObject prefab)
{
//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Expected O, but got Unknown
info("***** " + ((Object)prefab).name + " *****");
Component[] components = prefab.GetComponents<Component>();
foreach (Component val in components)
{
info("-" + ((object)val).GetType().Name);
PropertyInfo[] properties = ((object)prefab).GetType().GetProperties();
PropertyInfo[] array = properties;
foreach (PropertyInfo propertyInfo in array)
{
info(" -" + propertyInfo.Name + " = " + propertyInfo.GetValue(prefab));
}
}
info("***** " + ((Object)prefab).name + " (childs) *****");
foreach (Transform item in prefab.transform)
{
Transform val2 = item;
info("-" + ((Object)((Component)val2).gameObject).name);
Component[] components2 = ((Component)val2).gameObject.GetComponents<Component>();
foreach (Component val3 in components2)
{
info(" -" + ((object)val3).GetType().Name);
PropertyInfo[] properties2 = ((object)val3).GetType().GetProperties();
PropertyInfo[] array2 = properties2;
foreach (PropertyInfo propertyInfo2 in array2)
{
info(" -" + propertyInfo2.Name + " = " + propertyInfo2.GetValue(val3));
}
}
}
}
}
internal class MVBPrefabConfig
{
public ConfigEntry<bool> isEnable { get; set; }
public ConfigEntry<string> category { get; set; }
public ConfigEntry<string> requirements { get; set; }
}
[HarmonyPatch]
internal class Patches
{
[HarmonyPatch(typeof(Player), "SetupPlacementGhost")]
private class PlayerSetupPlacementGhost
{
private static void Prefix(Player __instance)
{
object obj;
if (__instance == null)
{
obj = null;
}
else
{
Piece selectedPiece = __instance.GetSelectedPiece();
obj = ((selectedPiece != null) ? ((Component)selectedPiece).gameObject : null);
}
GameObject val = (GameObject)obj;
if ((Object)(object)val != (Object)null)
{
settingUpPlacementGhost = true;
}
}
private static void Postfix()
{
settingUpPlacementGhost = false;
}
}
[HarmonyPatch(typeof(Piece), "DropResources")]
public static class Piece_DropResources_Transpiler
{
private static MethodInfo method_Piece_IsPlacedByPlayer = AccessTools.Method(typeof(Piece), "IsPlacedByPlayer", (Type[])null, (Type[])null);
private static FieldInfo field_Requirement_m_recover = AccessTools.Field(typeof(Requirement), "m_recover");
[HarmonyTranspiler]
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Expected O, but got Unknown
List<CodeInstruction> list = instructions.ToList();
for (int i = 0; i < list.Count; i++)
{
if (CodeInstructionExtensions.Calls(list[i], method_Piece_IsPlacedByPlayer))
{
list[i] = new CodeInstruction(OpCodes.Ldc_I4_1, (object)null);
list.RemoveAt(i - 1);
}
}
for (int j = 0; j < list.Count; j++)
{
if (CodeInstructionExtensions.LoadsField(list[j], field_Requirement_m_recover, false))
{
list.RemoveRange(j - 1, 3);
}
}
return list.AsEnumerable();
}
}
public static Action _ac = delegate
{
Prefabs.FindAndRegisterPrefabs();
};
private static bool settingUpPlacementGhost = false;
public static GameObject lastPlacementGhost = null;
[HarmonyPatch(typeof(ObjectDB), "Awake")]
[HarmonyPostfix]
private static void ObjectDBAwakePrefix()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
Scene activeScene = SceneManager.GetActiveScene();
if (!(((Scene)(ref activeScene)).name == "main"))
{
}
}
[HarmonyPatch(typeof(Object), "Internal_CloneSingle", new Type[] { typeof(Object) })]
[HarmonyPrefix]
private static bool ObjectInstantiate1Prefix(ref Object __result, Object data)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Expected O, but got Unknown
if (settingUpPlacementGhost)
{
settingUpPlacementGhost = false;
if (Prefabs.AddedPrefabs.Contains(data.name))
{
Logger.LogInfo((object)("Setting up placement ghost for " + data.name));
GameObject val = new GameObject();
val.SetActive(false);
Object val2 = Object.Instantiate(data, val.transform, false);
Prefabs.PrepareGhostPrefab((GameObject)(object)((val2 is GameObject) ? val2 : null));
__result = Object.Instantiate(val2);
Object.DestroyImmediate((Object)(object)val);
return false;
}
}
return true;
}
[HarmonyPatch(typeof(Player), "UpdatePlacementGhost")]
[HarmonyPostfix]
private static void PlayerUpdatePlacementGhostPostfix(ref GameObject ___m_placementGhost, ref int ___m_placementStatus)
{
lastPlacementGhost = ___m_placementGhost;
if (Object.op_Implicit((Object)(object)___m_placementGhost))
{
___m_placementStatus = 0;
___m_placementGhost.GetComponent<Piece>().SetInvalidPlacementHeightlight(false);
}
}
[HarmonyPatch(typeof(Piece), "SetCreator")]
[HarmonyPrefix]
private static void PieceSetCreatorPrefix(long uid, Piece __instance)
{
ZNetView component = ((Component)__instance).GetComponent<ZNetView>();
if (Object.op_Implicit((Object)(object)component) && !component.m_persistent)
{
component.m_persistent = true;
ZSyncTransform component2 = ((Component)__instance).gameObject.GetComponent<ZSyncTransform>();
if ((Object)(object)component2 == (Object)null)
{
((Component)__instance).gameObject.AddComponent<ZSyncTransform>();
}
component2.m_syncPosition = true;
component2.m_syncRotation = true;
}
}
}
internal class Prefabs
{
public static HashSet<string> AddedPrefabs = new HashSet<string>();
private static readonly HashSet<string> IgnoredPrefabs = new HashSet<string>
{
"Player", "Valkyrie", "HelmetOdin", "CapeOdin", "CastleKit_pot03", "Ravens", "TERRAIN_TEST", "PlaceMarker", "Circle_section", "guard_stone_test",
"Haldor", "odin", "dvergrprops_wood_stake"
};
private static HashSet<string> pieceNameCache = null;
public static void FindAndRegisterPrefabs()
{
MVBLog.info("FindAndRegisterPrefabs()");
Dictionary<PieceCategory, string> pieceCategoriesMap = PieceManager.Instance.GetPieceCategoriesMap();
foreach (string value in pieceCategoriesMap.Values)
{
MVBLog.info("CATEGORY : " + value);
}
(from go in ZNetScene.instance.m_prefabs
where (Object)(object)go.transform.parent == (Object)null && !ShouldIgnorePrefab(go)
orderby ((Object)go).name
select go).ToList().ForEach(CreatePrefabPiece);
MVBConfig.save();
PrefabManager.OnPrefabsRegistered -= Patches._ac;
}
private static bool ShouldIgnorePrefab(GameObject prefab)
{
HashSet<string> existingPieceNames = GetExistingPieceNames();
if (existingPieceNames.Contains(((Object)prefab).name))
{
MVBLog.info("ShouldIgnorePrefab(" + ((Object)prefab).name + ") -> true (already processed)");
return true;
}
if (IgnoredPrefabs.Contains(((Object)prefab).name))
{
MVBLog.info("ShouldIgnorePrefab(" + ((Object)prefab).name + ") -> true (in hard coded filters)");
return true;
}
if ((Object)(object)prefab.GetComponent("Projectile") != (Object)null || (Object)(object)prefab.GetComponent("Humanoid") != (Object)null || (Object)(object)prefab.GetComponent("AnimalAI") != (Object)null || (Object)(object)prefab.GetComponent("Character") != (Object)null || (Object)(object)prefab.GetComponent("CreatureSpawner") != (Object)null || (Object)(object)prefab.GetComponent("SpawnArea") != (Object)null || (Object)(object)prefab.GetComponent("Fish") != (Object)null || (Object)(object)prefab.GetComponent("RandomFlyingBird") != (Object)null || (Object)(object)prefab.GetComponent("MusicLocation") != (Object)null || (Object)(object)prefab.GetComponent("Aoe") != (Object)null || (Object)(object)prefab.GetComponent("ItemDrop") != (Object)null || (Object)(object)prefab.GetComponent("DungeonGenerator") != (Object)null || (Object)(object)prefab.GetComponent("TerrainModifier") != (Object)null || (Object)(object)prefab.GetComponent("EventZone") != (Object)null || (Object)(object)prefab.GetComponent("LocationProxy") != (Object)null || (Object)(object)prefab.GetComponent("LootSpawner") != (Object)null || (Object)(object)prefab.GetComponent("Mister") != (Object)null || (Object)(object)prefab.GetComponent("Ragdoll") != (Object)null || (Object)(object)prefab.GetComponent("MineRock5") != (Object)null || (Object)(object)prefab.GetComponent("TombStone") != (Object)null || (Object)(object)prefab.GetComponent("LiquidVolume") != (Object)null || (Object)(object)prefab.GetComponent("Gibber") != (Object)null || (Object)(object)prefab.GetComponent("TimedDestruction") != (Object)null || (Object)(object)prefab.GetComponent("TeleportAbility") != (Object)null || (Object)(object)prefab.GetComponent("ShipConstructor") != (Object)null || (Object)(object)prefab.GetComponent("TriggerSpawner") != (Object)null || (Object)(object)prefab.GetComponent("TeleportAbility") != (Object)null || (Object)(object)prefab.GetComponent("TeleportWorld") != (Object)null || ((Object)prefab).name.StartsWith("_") || ((Object)prefab).name.StartsWith("OLD_") || ((Object)prefab).name.EndsWith("_OLD") || ((Object)prefab).name.StartsWith("vfx_") || ((Object)prefab).name.StartsWith("sfx_") || ((Object)prefab).name.StartsWith("fx_"))
{
MVBLog.info("ShouldIgnorePrefab(" + ((Object)prefab).name + ") -> true ");
return true;
}
MVBLog.info("ShouldIgnorePrefab(" + ((Object)prefab).name + ") -> false ");
return false;
}
private static HashSet<string> GetExistingPieceNames()
{
if (pieceNameCache == null)
{
IEnumerable<string> collection = from piece in Resources.FindObjectsOfTypeAll<PieceTable>().SelectMany((PieceTable pieceTable) => pieceTable.m_pieces)
select ((Object)piece).name;
pieceNameCache = new HashSet<string>(collection);
}
return pieceNameCache;
}
private static bool EnsureNoDuplicateZNetView(GameObject prefab)
{
ZNetView[] components = prefab.GetComponents<ZNetView>();
for (int i = 1; i < components.Length; i++)
{
Object.DestroyImmediate((Object)(object)components[i]);
}
return components.Length <= 1;
}
private static void InitPieceData(GameObject prefab)
{
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)prefab.GetComponent<Piece>() == (Object)null)
{
Piece val = prefab.AddComponent<Piece>();
if ((Object)(object)val != (Object)null)
{
val.m_enabled = true;
val.m_canBeRemoved = true;
val.m_groundPiece = false;
val.m_groundOnly = false;
val.m_noInWater = false;
val.m_notOnWood = false;
val.m_notOnTiltingSurface = false;
val.m_notOnFloor = false;
val.m_allowedInDungeons = true;
val.m_onlyInTeleportArea = false;
val.m_inCeilingOnly = false;
val.m_cultivatedGroundOnly = false;
val.m_onlyInBiome = (Biome)0;
val.m_allowRotatedOverlap = true;
}
}
}
private static void CreatePrefabPiece(GameObject prefab)
{
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Expected O, but got Unknown
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Expected O, but got Unknown
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Expected O, but got Unknown
MVBLog.info("Starting FindAndRegisterPrefabs(" + ((Object)prefab).name + ")");
if (!EnsureNoDuplicateZNetView(prefab))
{
if (MVBConfig.isVerbose())
{
MVBLog.info("Ignore " + ((Object)prefab).name);
}
return;
}
MVBPrefabConfig mVBPrefabConfig = MVBConfig.loadPrefabConfig(prefab);
if (!mVBPrefabConfig.isEnable.Value && !MVBConfig.isForceAllPrefabs())
{
return;
}
PatchPrefabIfNeeded(prefab);
InitPieceData(prefab);
PieceConfig val = new PieceConfig
{
Name = ((Object)prefab).name,
Description = GetPrefabFriendlyName(prefab),
PieceTable = PieceTables.Hammer,
Category = mVBPrefabConfig.category.Value,
AllowedInDungeons = true,
Icon = CreatePrefabIcon(prefab)
};
if (!mVBPrefabConfig.requirements.Value.Equals(""))
{
string[] array = mVBPrefabConfig.requirements.Value.Split(new char[1] { ';' });
foreach (string text in array)
{
string[] array2 = text.Split(new char[1] { ',' });
RequirementConfig val2 = new RequirementConfig();
val2.Item = array2[0];
val2.Amount = int.Parse(array2[1]);
val2.Recover = true;
val.AddRequirement(val2);
}
}
CustomPiece val3 = new CustomPiece(prefab, true, val);
PieceManager.Instance.AddPiece(val3);
AddedPrefabs.Add(((Object)prefab).name);
MVBLog.info("Ending FindAndRegisterPrefabs(" + ((Object)prefab).name + ")");
}
private static void PatchPrefabIfNeeded(GameObject prefab)
{
//IL_081c: Unknown result type (might be due to invalid IL or missing references)
//IL_0821: Unknown result type (might be due to invalid IL or missing references)
//IL_0837: Unknown result type (might be due to invalid IL or missing references)
//IL_083c: Unknown result type (might be due to invalid IL or missing references)
//IL_0852: Unknown result type (might be due to invalid IL or missing references)
//IL_0857: Unknown result type (might be due to invalid IL or missing references)
//IL_086d: Unknown result type (might be due to invalid IL or missing references)
//IL_0872: Unknown result type (might be due to invalid IL or missing references)
//IL_0888: Unknown result type (might be due to invalid IL or missing references)
//IL_088d: Unknown result type (might be due to invalid IL or missing references)
//IL_08a3: Unknown result type (might be due to invalid IL or missing references)
//IL_08a8: Unknown result type (might be due to invalid IL or missing references)
//IL_08be: Unknown result type (might be due to invalid IL or missing references)
//IL_08c3: Unknown result type (might be due to invalid IL or missing references)
//IL_08d9: Unknown result type (might be due to invalid IL or missing references)
//IL_08de: Unknown result type (might be due to invalid IL or missing references)
//IL_08f4: Unknown result type (might be due to invalid IL or missing references)
//IL_08f9: Unknown result type (might be due to invalid IL or missing references)
//IL_0910: Unknown result type (might be due to invalid IL or missing references)
//IL_0915: Unknown result type (might be due to invalid IL or missing references)
//IL_1bf3: Unknown result type (might be due to invalid IL or missing references)
//IL_1bf8: Unknown result type (might be due to invalid IL or missing references)
//IL_1c0e: Unknown result type (might be due to invalid IL or missing references)
//IL_1c13: Unknown result type (might be due to invalid IL or missing references)
//IL_1c29: Unknown result type (might be due to invalid IL or missing references)
//IL_1c2e: Unknown result type (might be due to invalid IL or missing references)
//IL_1c44: Unknown result type (might be due to invalid IL or missing references)
//IL_1c49: Unknown result type (might be due to invalid IL or missing references)
//IL_108c: Unknown result type (might be due to invalid IL or missing references)
//IL_10c0: Unknown result type (might be due to invalid IL or missing references)
//IL_10f4: Unknown result type (might be due to invalid IL or missing references)
//IL_1128: Unknown result type (might be due to invalid IL or missing references)
//IL_1c71: Unknown result type (might be due to invalid IL or missing references)
//IL_1c76: Unknown result type (might be due to invalid IL or missing references)
//IL_1c8c: Unknown result type (might be due to invalid IL or missing references)
//IL_1c91: Unknown result type (might be due to invalid IL or missing references)
//IL_1ca7: Unknown result type (might be due to invalid IL or missing references)
//IL_1cac: Unknown result type (might be due to invalid IL or missing references)
//IL_1cc2: Unknown result type (might be due to invalid IL or missing references)
//IL_1cc7: Unknown result type (might be due to invalid IL or missing references)
//IL_1864: Unknown result type (might be due to invalid IL or missing references)
//IL_1869: Unknown result type (might be due to invalid IL or missing references)
//IL_187f: Unknown result type (might be due to invalid IL or missing references)
//IL_1884: Unknown result type (might be due to invalid IL or missing references)
//IL_155e: Unknown result type (might be due to invalid IL or missing references)
//IL_1563: Unknown result type (might be due to invalid IL or missing references)
//IL_1579: Unknown result type (might be due to invalid IL or missing references)
//IL_157e: Unknown result type (might be due to invalid IL or missing references)
//IL_0a9f: Unknown result type (might be due to invalid IL or missing references)
//IL_0aa4: Unknown result type (might be due to invalid IL or missing references)
//IL_0aba: Unknown result type (might be due to invalid IL or missing references)
//IL_0abf: Unknown result type (might be due to invalid IL or missing references)
//IL_0ad5: Unknown result type (might be due to invalid IL or missing references)
//IL_0ada: 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_0af5: Unknown result type (might be due to invalid IL or missing references)
//IL_0b0b: Unknown result type (might be due to invalid IL or missing references)
//IL_0b10: Unknown result type (might be due to invalid IL or missing references)
//IL_0b26: Unknown result type (might be due to invalid IL or missing references)
//IL_0b2b: Unknown result type (might be due to invalid IL or missing references)
//IL_1906: Unknown result type (might be due to invalid IL or missing references)
//IL_190b: Unknown result type (might be due to invalid IL or missing references)
//IL_1921: Unknown result type (might be due to invalid IL or missing references)
//IL_1926: Unknown result type (might be due to invalid IL or missing references)
//IL_0fb7: Unknown result type (might be due to invalid IL or missing references)
//IL_0feb: Unknown result type (might be due to invalid IL or missing references)
//IL_101f: Unknown result type (might be due to invalid IL or missing references)
//IL_1053: Unknown result type (might be due to invalid IL or missing references)
//IL_181c: Unknown result type (might be due to invalid IL or missing references)
//IL_1821: Unknown result type (might be due to invalid IL or missing references)
//IL_1837: Unknown result type (might be due to invalid IL or missing references)
//IL_183c: Unknown result type (might be due to invalid IL or missing references)
//IL_14ce: Unknown result type (might be due to invalid IL or missing references)
//IL_14d3: Unknown result type (might be due to invalid IL or missing references)
//IL_14e9: Unknown result type (might be due to invalid IL or missing references)
//IL_14ee: Unknown result type (might be due to invalid IL or missing references)
//IL_1a79: Unknown result type (might be due to invalid IL or missing references)
//IL_1a7e: Unknown result type (might be due to invalid IL or missing references)
//IL_1a94: Unknown result type (might be due to invalid IL or missing references)
//IL_1a99: Unknown result type (might be due to invalid IL or missing references)
//IL_1aaf: Unknown result type (might be due to invalid IL or missing references)
//IL_1ab4: Unknown result type (might be due to invalid IL or missing references)
//IL_1aca: Unknown result type (might be due to invalid IL or missing references)
//IL_1acf: Unknown result type (might be due to invalid IL or missing references)
//IL_1ae5: Unknown result type (might be due to invalid IL or missing references)
//IL_1aea: Unknown result type (might be due to invalid IL or missing references)
//IL_1b00: Unknown result type (might be due to invalid IL or missing references)
//IL_1b05: Unknown result type (might be due to invalid IL or missing references)
//IL_195a: Unknown result type (might be due to invalid IL or missing references)
//IL_197d: Unknown result type (might be due to invalid IL or missing references)
//IL_1982: Unknown result type (might be due to invalid IL or missing references)
//IL_1998: Unknown result type (might be due to invalid IL or missing references)
//IL_199d: Unknown result type (might be due to invalid IL or missing references)
//IL_19b3: Unknown result type (might be due to invalid IL or missing references)
//IL_19b8: Unknown result type (might be due to invalid IL or missing references)
//IL_19ce: Unknown result type (might be due to invalid IL or missing references)
//IL_19d3: Unknown result type (might be due to invalid IL or missing references)
//IL_0d31: Unknown result type (might be due to invalid IL or missing references)
//IL_0d36: Unknown result type (might be due to invalid IL or missing references)
//IL_0d4c: Unknown result type (might be due to invalid IL or missing references)
//IL_0d51: Unknown result type (might be due to invalid IL or missing references)
//IL_0d67: Unknown result type (might be due to invalid IL or missing references)
//IL_0d6c: Unknown result type (might be due to invalid IL or missing references)
//IL_0d82: Unknown result type (might be due to invalid IL or missing references)
//IL_0d87: Unknown result type (might be due to invalid IL or missing references)
//IL_0d9d: Unknown result type (might be due to invalid IL or missing references)
//IL_0da2: Unknown result type (might be due to invalid IL or missing references)
//IL_0db8: Unknown result type (might be due to invalid IL or missing references)
//IL_0dbd: Unknown result type (might be due to invalid IL or missing references)
//IL_18ac: Unknown result type (might be due to invalid IL or missing references)
//IL_18b1: Unknown result type (might be due to invalid IL or missing references)
//IL_0ee2: Unknown result type (might be due to invalid IL or missing references)
//IL_0f16: Unknown result type (might be due to invalid IL or missing references)
//IL_0f4a: Unknown result type (might be due to invalid IL or missing references)
//IL_0f7e: Unknown result type (might be due to invalid IL or missing references)
//IL_0ea9: Unknown result type (might be due to invalid IL or missing references)
//IL_1486: Unknown result type (might be due to invalid IL or missing references)
//IL_148b: Unknown result type (might be due to invalid IL or missing references)
//IL_14a1: Unknown result type (might be due to invalid IL or missing references)
//IL_14a6: Unknown result type (might be due to invalid IL or missing references)
//IL_15a6: Unknown result type (might be due to invalid IL or missing references)
//IL_15ab: Unknown result type (might be due to invalid IL or missing references)
//IL_15c1: Unknown result type (might be due to invalid IL or missing references)
//IL_15c6: Unknown result type (might be due to invalid IL or missing references)
//IL_15dc: Unknown result type (might be due to invalid IL or missing references)
//IL_15e1: Unknown result type (might be due to invalid IL or missing references)
//IL_15f7: Unknown result type (might be due to invalid IL or missing references)
//IL_15fc: Unknown result type (might be due to invalid IL or missing references)
//IL_1516: Unknown result type (might be due to invalid IL or missing references)
//IL_151b: Unknown result type (might be due to invalid IL or missing references)
//IL_1531: Unknown result type (might be due to invalid IL or missing references)
//IL_1536: Unknown result type (might be due to invalid IL or missing references)
//IL_1bab: Unknown result type (might be due to invalid IL or missing references)
//IL_1bb0: Unknown result type (might be due to invalid IL or missing references)
//IL_1bc6: Unknown result type (might be due to invalid IL or missing references)
//IL_1bcb: Unknown result type (might be due to invalid IL or missing references)
//IL_16cf: Unknown result type (might be due to invalid IL or missing references)
//IL_16d4: Unknown result type (might be due to invalid IL or missing references)
//IL_16ea: Unknown result type (might be due to invalid IL or missing references)
//IL_16ef: Unknown result type (might be due to invalid IL or missing references)
//IL_1705: Unknown result type (might be due to invalid IL or missing references)
//IL_170a: Unknown result type (might be due to invalid IL or missing references)
//IL_1720: Unknown result type (might be due to invalid IL or missing references)
//IL_1725: Unknown result type (might be due to invalid IL or missing references)
//IL_095e: Unknown result type (might be due to invalid IL or missing references)
//IL_0963: Unknown result type (might be due to invalid IL or missing references)
//IL_0979: Unknown result type (might be due to invalid IL or missing references)
//IL_097e: Unknown result type (might be due to invalid IL or missing references)
//IL_0994: Unknown result type (might be due to invalid IL or missing references)
//IL_0999: Unknown result type (might be due to invalid IL or missing references)
//IL_09af: Unknown result type (might be due to invalid IL or missing references)
//IL_09b4: Unknown result type (might be due to invalid IL or missing references)
//IL_09ca: Unknown result type (might be due to invalid IL or missing references)
//IL_09cf: Unknown result type (might be due to invalid IL or missing references)
//IL_09e5: Unknown result type (might be due to invalid IL or missing references)
//IL_09ea: Unknown result type (might be due to invalid IL or missing references)
//IL_0a00: Unknown result type (might be due to invalid IL or missing references)
//IL_0a05: 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_0a20: Unknown result type (might be due to invalid IL or missing references)
//IL_0a36: Unknown result type (might be due to invalid IL or missing references)
//IL_0a3b: Unknown result type (might be due to invalid IL or missing references)
//IL_0a52: Unknown result type (might be due to invalid IL or missing references)
//IL_0a57: Unknown result type (might be due to invalid IL or missing references)
//IL_1624: Unknown result type (might be due to invalid IL or missing references)
//IL_1629: Unknown result type (might be due to invalid IL or missing references)
//IL_05e2: Unknown result type (might be due to invalid IL or missing references)
//IL_05e7: Unknown result type (might be due to invalid IL or missing references)
//IL_05fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0602: Unknown result type (might be due to invalid IL or missing references)
//IL_0618: Unknown result type (might be due to invalid IL or missing references)
//IL_061d: Unknown result type (might be due to invalid IL or missing references)
//IL_0633: Unknown result type (might be due to invalid IL or missing references)
//IL_0638: Unknown result type (might be due to invalid IL or missing references)
//IL_064e: Unknown result type (might be due to invalid IL or missing references)
//IL_0653: Unknown result type (might be due to invalid IL or missing references)
//IL_0669: Unknown result type (might be due to invalid IL or missing references)
//IL_066e: Unknown result type (might be due to invalid IL or missing references)
//IL_0684: Unknown result type (might be due to invalid IL or missing references)
//IL_0689: Unknown result type (might be due to invalid IL or missing references)
//IL_069f: Unknown result type (might be due to invalid IL or missing references)
//IL_06a4: Unknown result type (might be due to invalid IL or missing references)
//IL_06ba: Unknown result type (might be due to invalid IL or missing references)
//IL_06bf: Unknown result type (might be due to invalid IL or missing references)
//IL_06d6: Unknown result type (might be due to invalid IL or missing references)
//IL_06db: Unknown result type (might be due to invalid IL or missing references)
//IL_06f2: Unknown result type (might be due to invalid IL or missing references)
//IL_06f7: Unknown result type (might be due to invalid IL or missing references)
//IL_070e: Unknown result type (might be due to invalid IL or missing references)
//IL_0713: Unknown result type (might be due to invalid IL or missing references)
//IL_072a: Unknown result type (might be due to invalid IL or missing references)
//IL_072f: Unknown result type (might be due to invalid IL or missing references)
//IL_0746: Unknown result type (might be due to invalid IL or missing references)
//IL_074b: Unknown result type (might be due to invalid IL or missing references)
//IL_0762: Unknown result type (might be due to invalid IL or missing references)
//IL_0767: Unknown result type (might be due to invalid IL or missing references)
//IL_077e: Unknown result type (might be due to invalid IL or missing references)
//IL_0783: Unknown result type (might be due to invalid IL or missing references)
//IL_079a: Unknown result type (might be due to invalid IL or missing references)
//IL_079f: Unknown result type (might be due to invalid IL or missing references)
//IL_07b6: Unknown result type (might be due to invalid IL or missing references)
//IL_07bb: Unknown result type (might be due to invalid IL or missing references)
//IL_07d2: Unknown result type (might be due to invalid IL or missing references)
//IL_07d7: Unknown result type (might be due to invalid IL or missing references)
//IL_07ee: Unknown result type (might be due to invalid IL or missing references)
//IL_07f3: Unknown result type (might be due to invalid IL or missing references)
//IL_130e: Unknown result type (might be due to invalid IL or missing references)
//IL_1342: Unknown result type (might be due to invalid IL or missing references)
//IL_1376: Unknown result type (might be due to invalid IL or missing references)
//IL_13aa: Unknown result type (might be due to invalid IL or missing references)
//IL_0c07: Unknown result type (might be due to invalid IL or missing references)
//IL_0c0c: Unknown result type (might be due to invalid IL or missing references)
//IL_0c22: Unknown result type (might be due to invalid IL or missing references)
//IL_0c27: Unknown result type (might be due to invalid IL or missing references)
//IL_0c3d: Unknown result type (might be due to invalid IL or missing references)
//IL_0c42: Unknown result type (might be due to invalid IL or missing references)
//IL_0c58: Unknown result type (might be due to invalid IL or missing references)
//IL_0c5d: Unknown result type (might be due to invalid IL or missing references)
//IL_0c73: Unknown result type (might be due to invalid IL or missing references)
//IL_0c78: Unknown result type (might be due to invalid IL or missing references)
//IL_0c8e: Unknown result type (might be due to invalid IL or missing references)
//IL_0c93: Unknown result type (might be due to invalid IL or missing references)
//IL_19fb: Unknown result type (might be due to invalid IL or missing references)
//IL_1a00: Unknown result type (might be due to invalid IL or missing references)
//IL_1a16: Unknown result type (might be due to invalid IL or missing references)
//IL_1a1b: Unknown result type (might be due to invalid IL or missing references)
//IL_1a31: Unknown result type (might be due to invalid IL or missing references)
//IL_1a36: Unknown result type (might be due to invalid IL or missing references)
//IL_1a4c: Unknown result type (might be due to invalid IL or missing references)
//IL_1a51: Unknown result type (might be due to invalid IL or missing references)
//IL_1b2d: Unknown result type (might be due to invalid IL or missing references)
//IL_1b32: Unknown result type (might be due to invalid IL or missing references)
//IL_1b48: Unknown result type (might be due to invalid IL or missing references)
//IL_1b4d: Unknown result type (might be due to invalid IL or missing references)
//IL_1b63: Unknown result type (might be due to invalid IL or missing references)
//IL_1b68: Unknown result type (might be due to invalid IL or missing references)
//IL_1b7e: Unknown result type (might be due to invalid IL or missing references)
//IL_1b83: Unknown result type (might be due to invalid IL or missing references)
//IL_0de5: Unknown result type (might be due to invalid IL or missing references)
//IL_0dea: Unknown result type (might be due to invalid IL or missing references)
//IL_0e00: Unknown result type (might be due to invalid IL or missing references)
//IL_0e05: Unknown result type (might be due to invalid IL or missing references)
//IL_0e1b: Unknown result type (might be due to invalid IL or missing references)
//IL_0e20: Unknown result type (might be due to invalid IL or missing references)
//IL_0e36: Unknown result type (might be due to invalid IL or missing references)
//IL_0e3b: Unknown result type (might be due to invalid IL or missing references)
//IL_0e51: Unknown result type (might be due to invalid IL or missing references)
//IL_0e56: Unknown result type (might be due to invalid IL or missing references)
//IL_0e6c: Unknown result type (might be due to invalid IL or missing references)
//IL_0e71: Unknown result type (might be due to invalid IL or missing references)
//IL_1651: Unknown result type (might be due to invalid IL or missing references)
//IL_1656: Unknown result type (might be due to invalid IL or missing references)
//IL_166c: Unknown result type (might be due to invalid IL or missing references)
//IL_1671: Unknown result type (might be due to invalid IL or missing references)
//IL_1687: Unknown result type (might be due to invalid IL or missing references)
//IL_168c: Unknown result type (might be due to invalid IL or missing references)
//IL_16a2: Unknown result type (might be due to invalid IL or missing references)
//IL_16a7: Unknown result type (might be due to invalid IL or missing references)
//IL_174d: Unknown result type (might be due to invalid IL or missing references)
//IL_1752: Unknown result type (might be due to invalid IL or missing references)
//IL_1768: Unknown result type (might be due to invalid IL or missing references)
//IL_176d: Unknown result type (might be due to invalid IL or missing references)
//IL_1783: Unknown result type (might be due to invalid IL or missing references)
//IL_1788: Unknown result type (might be due to invalid IL or missing references)
//IL_179e: Unknown result type (might be due to invalid IL or missing references)
//IL_17a3: Unknown result type (might be due to invalid IL or missing references)
//IL_17b9: Unknown result type (might be due to invalid IL or missing references)
//IL_17be: Unknown result type (might be due to invalid IL or missing references)
//IL_17d4: Unknown result type (might be due to invalid IL or missing references)
//IL_17d9: Unknown result type (might be due to invalid IL or missing references)
//IL_17ef: Unknown result type (might be due to invalid IL or missing references)
//IL_17f4: Unknown result type (might be due to invalid IL or missing references)
//IL_18d9: Unknown result type (might be due to invalid IL or missing references)
//IL_18de: Unknown result type (might be due to invalid IL or missing references)
//IL_143e: Unknown result type (might be due to invalid IL or missing references)
//IL_1443: Unknown result type (might be due to invalid IL or missing references)
//IL_1459: Unknown result type (might be due to invalid IL or missing references)
//IL_145e: Unknown result type (might be due to invalid IL or missing references)
//IL_1cef: Unknown result type (might be due to invalid IL or missing references)
//IL_1cf4: Unknown result type (might be due to invalid IL or missing references)
//IL_1d0a: Unknown result type (might be due to invalid IL or missing references)
//IL_1d0f: Unknown result type (might be due to invalid IL or missing references)
//IL_1d25: Unknown result type (might be due to invalid IL or missing references)
//IL_1d2a: Unknown result type (might be due to invalid IL or missing references)
//IL_1d40: Unknown result type (might be due to invalid IL or missing references)
//IL_1d45: Unknown result type (might be due to invalid IL or missing references)
//IL_1d5b: Unknown result type (might be due to invalid IL or missing references)
//IL_1d60: Unknown result type (might be due to invalid IL or missing references)
//IL_1d76: Unknown result type (might be due to invalid IL or missing references)
//IL_1d7b: Unknown result type (might be due to invalid IL or missing references)
//IL_1d91: Unknown result type (might be due to invalid IL or missing references)
//IL_1d96: Unknown result type (might be due to invalid IL or missing references)
//IL_1dac: Unknown result type (might be due to invalid IL or missing references)
//IL_1db1: Unknown result type (might be due to invalid IL or missing references)
//IL_11cd: Unknown result type (might be due to invalid IL or missing references)
//IL_1201: Unknown result type (might be due to invalid IL or missing references)
//IL_1235: Unknown result type (might be due to invalid IL or missing references)
//IL_1269: Unknown result type (might be due to invalid IL or missing references)
//IL_0b53: Unknown result type (might be due to invalid IL or missing references)
//IL_0b58: 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_0b73: Unknown result type (might be due to invalid IL or missing references)
//IL_0b89: Unknown result type (might be due to invalid IL or missing references)
//IL_0b8e: Unknown result type (might be due to invalid IL or missing references)
//IL_0ba4: Unknown result type (might be due to invalid IL or missing references)
//IL_0ba9: Unknown result type (might be due to invalid IL or missing references)
//IL_0bbf: Unknown result type (might be due to invalid IL or missing references)
//IL_0bc4: Unknown result type (might be due to invalid IL or missing references)
//IL_0bda: Unknown result type (might be due to invalid IL or missing references)
//IL_0bdf: Unknown result type (might be due to invalid IL or missing references)
//IL_0cc5: Unknown result type (might be due to invalid IL or missing references)
switch (((Object)prefab).name)
{
case "blackmarble_column_3":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[20]
{
new Vector3(-1f, 4f, -1f),
new Vector3(1f, 4f, 1f),
new Vector3(-1f, 4f, 1f),
new Vector3(1f, 4f, -1f),
new Vector3(-1f, 2f, -1f),
new Vector3(1f, 2f, 1f),
new Vector3(-1f, 2f, 1f),
new Vector3(1f, 2f, -1f),
new Vector3(-1f, 0f, -1f),
new Vector3(1f, 0f, 1f),
new Vector3(-1f, 0f, 1f),
new Vector3(1f, 0f, -1f),
new Vector3(-1f, -2f, -1f),
new Vector3(1f, -2f, 1f),
new Vector3(-1f, -2f, 1f),
new Vector3(1f, -2f, -1f),
new Vector3(-1f, -4f, -1f),
new Vector3(1f, -4f, 1f),
new Vector3(-1f, -4f, 1f),
new Vector3(1f, -4f, -1f)
});
break;
case "blackmarble_creep_4x1x1":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[10]
{
new Vector3(-0.5f, 2f, -0.5f),
new Vector3(0.5f, 2f, 0.5f),
new Vector3(-0.5f, 2f, 0.5f),
new Vector3(0.5f, 2f, -0.5f),
new Vector3(-0.5f, -2f, -0.5f),
new Vector3(0.5f, -2f, 0.5f),
new Vector3(-0.5f, -2f, 0.5f),
new Vector3(0.5f, -2f, -0.5f),
new Vector3(0f, -2f, 0f),
new Vector3(0f, 2f, 0f)
});
Object.DestroyImmediate((Object)(object)((Component)prefab.transform.Find("new")).gameObject.GetComponent<RandomPieceRotation>());
break;
case "blackmarble_creep_4x2x1":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[10]
{
new Vector3(1f, 2f, -0.5f),
new Vector3(1f, 2f, 0.5f),
new Vector3(-1f, 2f, -0.5f),
new Vector3(-1f, 2f, 0.5f),
new Vector3(1f, -2f, -0.5f),
new Vector3(1f, -2f, 0.5f),
new Vector3(-1f, -2f, -0.5f),
new Vector3(-1f, -2f, 0.5f),
new Vector3(0f, -2f, 0f),
new Vector3(0f, 2f, 0f)
});
Object.DestroyImmediate((Object)(object)((Component)prefab.transform.Find("new")).gameObject.GetComponent<RandomPieceRotation>());
break;
case "blackmarble_creep_slope_inverted_1x1x2":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[6]
{
new Vector3(-0.5f, 1f, -0.5f),
new Vector3(0.5f, 1f, 0.5f),
new Vector3(-0.5f, 1f, 0.5f),
new Vector3(0.5f, 1f, -0.5f),
new Vector3(0.5f, -1f, -0.5f),
new Vector3(-0.5f, -1f, -0.5f)
});
break;
case "blackmarble_creep_slope_inverted_2x2x1":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[6]
{
new Vector3(-1f, 0.5f, -1f),
new Vector3(1f, 0.5f, 1f),
new Vector3(-1f, 0.5f, 1f),
new Vector3(1f, 0.5f, -1f),
new Vector3(-1f, -0.5f, -1f),
new Vector3(1f, -0.5f, -1f)
});
break;
case "blackmarble_creep_stair":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[6]
{
new Vector3(-1f, 1f, -1f),
new Vector3(1f, 1f, -1f),
new Vector3(-1f, 0f, -1f),
new Vector3(1f, 0f, -1f),
new Vector3(-1f, 0f, 1f),
new Vector3(1f, 0f, 1f)
});
break;
case "blackmarble_floor_large":
{
List<Vector3> list = new List<Vector3>();
for (int i = -1; i <= 1; i += 2)
{
for (int j = -4; j <= 4; j += 2)
{
for (int k = -4; k <= 4; k += 2)
{
list.Add(new Vector3((float)j, (float)i, (float)k));
}
}
}
generateSnapPoints(prefab, list);
break;
}
case "blackmarble_head_big01":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[6]
{
new Vector3(-1f, 1f, -1f),
new Vector3(1f, 1f, 1f),
new Vector3(-1f, 1f, 1f),
new Vector3(1f, 1f, -1f),
new Vector3(1f, -1f, -1f),
new Vector3(-1f, -1f, -1f)
});
break;
case "blackmarble_head_big02":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[6]
{
new Vector3(-1f, 1f, -1f),
new Vector3(1f, 1f, 1f),
new Vector3(-1f, 1f, 1f),
new Vector3(1f, 1f, -1f),
new Vector3(1f, -1f, -1f),
new Vector3(-1f, -1f, -1f)
});
break;
case "blackmarble_out_2":
Object.DestroyImmediate((Object)(object)prefab.GetComponent<MeshCollider>());
prefab.AddComponent<BoxCollider>();
prefab.GetComponent<BoxCollider>().size = new Vector3(2f, 2f, 2f);
break;
case "blackmarble_tile_floor_1x1":
((Component)prefab.transform.Find("_snappoint")).gameObject.transform.localPosition = new Vector3(0.5f, 0.1f, 0.5f);
((Component)prefab.transform.Find("_snappoint (1)")).gameObject.transform.localPosition = new Vector3(0.5f, 0.1f, -0.5f);
((Component)prefab.transform.Find("_snappoint (2)")).gameObject.transform.localPosition = new Vector3(-0.5f, 0.1f, 0.5f);
((Component)prefab.transform.Find("_snappoint (3)")).gameObject.transform.localPosition = new Vector3(-0.5f, 0.1f, -0.5f);
break;
case "blackmarble_tile_floor_2x2":
((Component)prefab.transform.Find("_snappoint")).gameObject.transform.localPosition = new Vector3(1f, 0.1f, 1f);
((Component)prefab.transform.Find("_snappoint (1)")).gameObject.transform.localPosition = new Vector3(1f, 0.1f, -1f);
((Component)prefab.transform.Find("_snappoint (2)")).gameObject.transform.localPosition = new Vector3(-1f, 0.1f, 1f);
((Component)prefab.transform.Find("_snappoint (3)")).gameObject.transform.localPosition = new Vector3(-1f, 0.1f, -1f);
break;
case "blackmarble_tile_wall_1x1":
((Component)prefab.transform.Find("_snappoint")).gameObject.transform.localPosition = new Vector3(0.5f, 0f, 0.1f);
((Component)prefab.transform.Find("_snappoint (1)")).gameObject.transform.localPosition = new Vector3(0.5f, 1f, 0.1f);
((Component)prefab.transform.Find("_snappoint (2)")).gameObject.transform.localPosition = new Vector3(-0.5f, 0f, 0.1f);
((Component)prefab.transform.Find("_snappoint (3)")).gameObject.transform.localPosition = new Vector3(-0.5f, 1f, 0.1f);
Object.DestroyImmediate((Object)(object)((Component)prefab.transform.Find("_snappoint (4)")).gameObject);
Object.DestroyImmediate((Object)(object)((Component)prefab.transform.Find("_snappoint (5)")).gameObject);
Object.DestroyImmediate((Object)(object)((Component)prefab.transform.Find("_snappoint (6)")).gameObject);
Object.DestroyImmediate((Object)(object)((Component)prefab.transform.Find("_snappoint (7)")).gameObject);
break;
case "blackmarble_tile_wall_2x2":
((Component)prefab.transform.Find("_snappoint")).gameObject.transform.localPosition = new Vector3(1f, 0f, 0.1f);
((Component)prefab.transform.Find("_snappoint (1)")).gameObject.transform.localPosition = new Vector3(1f, 2f, 0.1f);
((Component)prefab.transform.Find("_snappoint (2)")).gameObject.transform.localPosition = new Vector3(-1f, 0f, 0.1f);
((Component)prefab.transform.Find("_snappoint (3)")).gameObject.transform.localPosition = new Vector3(-1f, 2f, 0.1f);
Object.DestroyImmediate((Object)(object)((Component)prefab.transform.Find("_snappoint (4)")).gameObject);
Object.DestroyImmediate((Object)(object)((Component)prefab.transform.Find("_snappoint (5)")).gameObject);
Object.DestroyImmediate((Object)(object)((Component)prefab.transform.Find("_snappoint (6)")).gameObject);
Object.DestroyImmediate((Object)(object)((Component)prefab.transform.Find("_snappoint (7)")).gameObject);
break;
case "blackmarble_tile_wall_2x4":
((Component)prefab.transform.Find("_snappoint")).gameObject.transform.localPosition = new Vector3(1f, 0f, 0.1f);
((Component)prefab.transform.Find("_snappoint (1)")).gameObject.transform.localPosition = new Vector3(1f, 4f, 0.1f);
((Component)prefab.transform.Find("_snappoint (2)")).gameObject.transform.localPosition = new Vector3(-1f, 0f, 0.1f);
((Component)prefab.transform.Find("_snappoint (3)")).gameObject.transform.localPosition = new Vector3(-1f, 4f, 0.1f);
Object.DestroyImmediate((Object)(object)((Component)prefab.transform.Find("_snappoint (4)")).gameObject);
Object.DestroyImmediate((Object)(object)((Component)prefab.transform.Find("_snappoint (5)")).gameObject);
Object.DestroyImmediate((Object)(object)((Component)prefab.transform.Find("_snappoint (6)")).gameObject);
Object.DestroyImmediate((Object)(object)((Component)prefab.transform.Find("_snappoint (7)")).gameObject);
break;
case "dungeon_queen_door":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[2]
{
new Vector3(2.5f, 0f, 0f),
new Vector3(-2.5f, 0f, 0f)
});
break;
case "dungeon_sunkencrypt_irongate":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[2]
{
new Vector3(1f, -0.4f, 0f),
new Vector3(-1f, -0.4f, 0f)
});
break;
case "sunken_crypt_gate":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[2]
{
new Vector3(1f, 0f, 0f),
new Vector3(-1f, 0f, 0f)
});
break;
case "dvergrprops_wood_beam":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[2]
{
new Vector3(3f, 0f, 0f),
new Vector3(-3f, 0f, 0f)
});
break;
case "dvergrprops_wood_pole":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[2]
{
new Vector3(0f, 2f, 0f),
new Vector3(0f, -2f, 0f)
});
break;
case "dvergrprops_wood_wall":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[4]
{
new Vector3(2.2f, 2f, 0f),
new Vector3(-2.2f, 2f, 0f),
new Vector3(2.2f, -2f, 0f),
new Vector3(-2.2f, -2f, 0f)
});
break;
case "dvergrtown_arch":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[1]
{
new Vector3(1f, 0.5f, 0f)
});
break;
case "dvergrtown_secretdoor":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[4]
{
new Vector3(2f, 0f, 0f),
new Vector3(-2f, 0f, 0f),
new Vector3(2f, 4f, 0f),
new Vector3(-2f, 4f, 0f)
});
break;
case "dvergrtown_slidingdoor":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[4]
{
new Vector3(2f, 0f, 0f),
new Vector3(-2f, 0f, 0f),
new Vector3(2f, 4f, 0f),
new Vector3(-2f, 4f, 0f)
});
break;
case "dvergrtown_stair_corner_wood_left":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[7]
{
new Vector3(0.25f, 0f, -0.25f),
new Vector3(0.25f, 0f, 0.25f),
new Vector3(0.25f, 1.1f, -0.25f),
new Vector3(0.25f, 1.1f, 0.25f),
new Vector3(0.25f, 0f, 2f),
new Vector3(-0.25f, 1.1f, -0.25f),
new Vector3(-2f, 1.1f, -0.25f)
});
break;
case "dvergrtown_wood_beam":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[2]
{
new Vector3(3f, 0f, 0f),
new Vector3(-3f, 0f, 0f)
});
break;
case "dvergrtown_wood_pole":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[2]
{
new Vector3(0f, -2f, 0f),
new Vector3(0f, 2f, 0f)
});
break;
case "dvergrtown_wood_stake":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[1]
{
new Vector3(0f, 0f, 0f)
});
break;
case "dvergrtown_wood_crane":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[1]
{
new Vector3(0f, -3f, 0f)
});
break;
case "dvergrtown_wood_support":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[2]
{
new Vector3(-2f, 0f, 0f),
new Vector3(2f, 0f, 0f)
});
break;
case "dvergrtown_wood_wall01":
((Component)prefab.transform.Find("wallcollider")).transform.localPosition = new Vector3(0f, 0f, 0f);
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[4]
{
new Vector3(-3f, -2.7f, 0f),
new Vector3(3f, -2.7f, 0f),
new Vector3(-3f, 2.7f, 0f),
new Vector3(3f, 2.7f, 0f)
});
break;
case "dvergrtown_wood_wall02":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[4]
{
new Vector3(-3f, -0.5f, 0f),
new Vector3(3f, -0.5f, 0f),
new Vector3(-3f, 4.5f, 0f),
new Vector3(3f, 4.5f, 0f)
});
break;
case "dvergrtown_wood_wall03":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[6]
{
new Vector3(1.1f, 0f, 0f),
new Vector3(-1.1f, 0f, 0f),
new Vector3(2f, 2f, 0f),
new Vector3(-2f, 2f, 0f),
new Vector3(1.1f, 4f, 0f),
new Vector3(-1.1f, 4f, 0f)
});
break;
case "goblin_roof_45d":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[4]
{
new Vector3(1f, 0f, 1f),
new Vector3(-1f, 0f, 1f),
new Vector3(1f, 2f, -1f),
new Vector3(-1f, 2f, -1f)
});
break;
case "goblin_roof_45d_corner":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[2]
{
new Vector3(-1f, 0f, -1f),
new Vector3(1f, 0f, 1f)
});
break;
case "goblin_woodwall_1m":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[4]
{
new Vector3(-0.5f, 0f, 0f),
new Vector3(0.5f, 0f, 0f),
new Vector3(-0.5f, 2f, 0f),
new Vector3(0.5f, 2f, 0f)
});
break;
case "goblin_woodwall_2m":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[4]
{
new Vector3(-1f, 0f, 0f),
new Vector3(1f, 0f, 0f),
new Vector3(-1f, 2f, 0f),
new Vector3(1f, 2f, 0f)
});
break;
case "Ice_floor":
generateSnapPoints(prefab, (Vector3[])(object)new Vector3[8]
{
new Vector3(2f, 1f, 2f),
new Vector3(-2f, 1f, -2f),
new Vector3(2f, 1f, -2f),
new Vector3(-2f, 1f, 2f),
new Vector3(2f, -1f, 2f),
new Vector3(-2f, -1f, -2f),
new Vector3(2f, -1f, -2f),
new Vector3(-2f, -1f, 2f)
});
break;
}
}
private static void generateSnapPoints(GameObject prefab, Vector3[] positions)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < positions.Length; i++)
{
GameObject val = new GameObject("_snappointt" + i);
val.transform.parent = prefab.transform;
val.transform.localPosition = positions[i];
val.tag = "snappoint";
}
}
private static void generateSnapPoints(GameObject prefab, List<Vector3> positions)
{
generateSnapPoints(prefab, positions.ToArray());
}
private static string GetPrefabFriendlyName(GameObject prefab)
{
HoverText component = prefab.GetComponent<HoverText>();
if (Object.op_Implicit((Object)(object)component))
{
return component.m_text;
}
ItemDrop component2 = prefab.GetComponent<ItemDrop>();
if (Object.op_Implicit((Object)(object)component2))
{
return component2.m_itemData.m_shared.m_name;
}
Character component3 = prefab.GetComponent<Character>();
if (Object.op_Implicit((Object)(object)component3))
{
return component3.m_name;
}
RuneStone component4 = prefab.GetComponent<RuneStone>();
if (Object.op_Implicit((Object)(object)component4))
{
return component4.m_name;
}
ItemStand component5 = prefab.GetComponent<ItemStand>();
if (Object.op_Implicit((Object)(object)component5))
{
return component5.m_name;
}
MineRock component6 = prefab.GetComponent<MineRock>();
if (Object.op_Implicit((Object)(object)component6))
{
return component6.m_name;
}
Pickable component7 = prefab.GetComponent<Pickable>();
if (Object.op_Implicit((Object)(object)component7))
{
return GetPrefabFriendlyName(component7.m_itemPrefab);
}
CreatureSpawner component8 = prefab.GetComponent<CreatureSpawner>();
if (Object.op_Implicit((Object)(object)component8))
{
return GetPrefabFriendlyName(component8.m_creaturePrefab);
}
SpawnArea component9 = prefab.GetComponent<SpawnArea>();
if (Object.op_Implicit((Object)(object)component9) && component9.m_prefabs.Count > 0)
{
return GetPrefabFriendlyName(component9.m_prefabs[0].m_prefab);
}
Piece component10 = prefab.GetComponent<Piece>();
if (Object.op_Implicit((Object)(object)component10) && !string.IsNullOrEmpty(component10.m_name))
{
return component10.m_name;
}
return ((Object)prefab).name;
}
private static Sprite CreatePrefabIcon(GameObject prefab)
{
Sprite val = generateObjectIcon(prefab);
if ((Object)(object)val == (Object)null)
{
RandomItem[] array = prefab.GetComponent<PickableItem>()?.m_randomItemPrefabs;
if (array != null && array.Length != 0)
{
ItemDrop itemPrefab = array[0].m_itemPrefab;
GameObject val2 = ((itemPrefab != null) ? ((Component)itemPrefab).gameObject : null);
if ((Object)(object)val2 != (Object)null)
{
val = generateObjectIcon(val2);
}
}
}
return val;
}
private static Sprite generateObjectIcon(GameObject obj)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
RenderRequest val = new RenderRequest(obj);
val.Rotation = RenderManager.IsometricRotation;
val.UseCache = true;
return RenderManager.Instance.Render(val);
}
public static void PrepareGhostPrefab(GameObject ghost)
{
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
Object.Destroy((Object)(object)ghost.GetComponent<CharacterDrop>());
Component[] componentsInChildren = ghost.GetComponentsInChildren<Component>(true);
Component[] array = componentsInChildren;
foreach (Component val in array)
{
if (!(val is Piece) && !(val is Collider) && !(val is Renderer) && !(val is Transform) && !(val is ZNetView) && !(val is Rigidbody) && !(val is MeshFilter) && !(val is LODGroup) && !(val is PickableItem) && !(val is UIBehaviour) && !(val is WearNTear))
{
Object.DestroyImmediate((Object)(object)val);
}
}
Bounds val2 = default(Bounds);
Renderer[] componentsInChildren2 = ghost.GetComponentsInChildren<Renderer>();
foreach (Renderer val3 in componentsInChildren2)
{
((Bounds)(ref val2)).Encapsulate(val3.bounds);
}
BoxCollider val4 = ghost.AddComponent<BoxCollider>();
val4.center = ((Bounds)(ref val2)).center;
val4.size = ((Bounds)(ref val2)).size;
}
}