using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Security.Cryptography;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Steamworks;
using Steamworks.Data;
using Unity.Collections;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Rendering;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: AssemblyVersion("0.0.0.0")]
namespace blocks;
[BepInPlugin("4902.Minecraft_Scraps", "Minecraft_Scraps", "1.0.0")]
public class yon : BaseUnityPlugin
{
public static readonly Harmony harmony = new Harmony("4902.Minecraft_Scraps");
public static ManualLogSource mls;
public static ConfigEntry<bool> temp_saveseeds;
public static ConfigEntry<int> temp_millisecond;
public static ConfigEntry<bool> temp_synced_percentages;
public static ConfigEntry<int> temp_base_percentage;
public static ConfigEntry<int> temp_diamond_block;
public static ConfigEntry<int> temp_spider;
public static ConfigEntry<int> temp_zombie;
public static ConfigEntry<int> temp_villager;
public static ConfigEntry<int> temp_creeper;
public static ConfigEntry<int> temp_pumpkin;
public static ConfigEntry<int> temp_anvil;
public static ConfigEntry<int> temp_steve;
public static ConfigEntry<int> temp_tnt;
public static ConfigEntry<int> temp_diamond;
public static ConfigEntry<int> temp_diamond_sword;
public static ConfigEntry<int> temp_diamond_pickaxe;
public static ConfigEntry<int> temp_apple;
public static ConfigEntry<int> temp_torch;
public static ConfigEntry<int> temp_chest;
public static ConfigEntry<int> temp_pig;
public static ConfigEntry<int> temp_sheep;
public static ConfigEntry<int> temp_cow;
public static ConfigEntry<int> temp_chicken;
public static ConfigEntry<int> temp_bee;
public static cfg_bool cfg_saveseeds = new cfg_bool();
public static cfg_int cfg_millisecond = new cfg_int();
public static cfg_bool cfg_synced_percentages = new cfg_bool();
public static cfg_int cfg_base_percentage = new cfg_int();
public static cfg_int cfg_diamond_block = new cfg_int();
public static cfg_int cfg_spider = new cfg_int();
public static cfg_int cfg_zombie = new cfg_int();
public static cfg_int cfg_villager = new cfg_int();
public static cfg_int cfg_creeper = new cfg_int();
public static cfg_int cfg_pumpkin = new cfg_int();
public static cfg_int cfg_anvil = new cfg_int();
public static cfg_int cfg_steve = new cfg_int();
public static cfg_int cfg_tnt = new cfg_int();
public static cfg_int cfg_diamond = new cfg_int();
public static cfg_int cfg_diamond_sword = new cfg_int();
public static cfg_int cfg_diamond_pickaxe = new cfg_int();
public static cfg_int cfg_apple = new cfg_int();
public static cfg_int cfg_torch = new cfg_int();
public static cfg_int cfg_chest = new cfg_int();
public static cfg_int cfg_pig = new cfg_int();
public static cfg_int cfg_sheep = new cfg_int();
public static cfg_int cfg_cow = new cfg_int();
public static cfg_int cfg_chicken = new cfg_int();
public static cfg_int cfg_bee = new cfg_int();
private void Awake()
{
temp_saveseeds = ((BaseUnityPlugin)this).Config.Bind<bool>("#", "save/load", true, "[Save/load seeds]\nwhether the magnifying glass/minecraft item types should be saved to the save file. this saves the seed that determines the items type, so it will be the same when rejoining.\nloading a save file that has saved seeds without having this enabled or while in lan isn't recommended as the saved seeds can be reset if the number of items is changed.\nsaved item types are synced with other players if the synced percentages config is enabled");
cfg_saveseeds.Value = temp_saveseeds.Value;
temp_millisecond = ((BaseUnityPlugin)this).Config.Bind<int>("#", "timer", 100, "[Client wait_timer]\nwhen joining a lobby as non-host magnifying glass items will wait to set their item type until the network message sent by the host has been received or the time spent waiting reached the maximum amount set by this config.\nthere will be a log message specifying if the network message was received first or the timer ended first. if the timer is often ending before the message from the host is being received then this should be increased. if the host doesn't have this mod then save/load can be disabled since there won't be a received message from the host so the items would always wait the full timer.\nmin is 20, max is 4000. 100 is before the player spawn animation ends, 500 is about 10 seconds, 1000 is about 15 seconds");
cfg_millisecond.Value = temp_millisecond.Value;
temp_synced_percentages = ((BaseUnityPlugin)this).Config.Bind<bool>("#", "sync", true, "[Synced percentages]\nautomatically sync config item percentages/weights with the host. only disable if you're aware that disabling this can cause the item types to not be the same as other players if playing with others that have this mod");
cfg_synced_percentages.Value = temp_synced_percentages.Value;
temp_base_percentage = ((BaseUnityPlugin)this).Config.Bind<int>("#", "base_percent", 80, "percentage that a minecraft scrap will replace magnifying glass\ninput = percentage, 50 is 50% etc");
cfg_base_percentage.Value = temp_base_percentage.Value;
temp_diamond_block = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "diamond_block", 10, "item types with higher numbers relative to other item types will be more frequent\n(if there are (10 red, 20 green, 30 blue) blocks, and if one block was selected randomly, the color with more blocks would be more likely to be selected, and a color with no blocks couldn't be selected)\n(color is the item type, number of blocks is the config number)");
cfg_diamond_block.Value = temp_diamond_block.Value;
temp_spider = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "spider", 55, "");
cfg_spider.Value = temp_spider.Value;
temp_zombie = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "zombie", 55, "");
cfg_zombie.Value = temp_zombie.Value;
temp_villager = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "villager", 40, "");
cfg_villager.Value = temp_villager.Value;
temp_creeper = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "creeper", 55, "");
cfg_creeper.Value = temp_creeper.Value;
temp_pumpkin = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "pumpkin", 50, "");
cfg_pumpkin.Value = temp_pumpkin.Value;
temp_anvil = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "anvil", 35, "");
cfg_anvil.Value = temp_anvil.Value;
temp_steve = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "steve", 1, "");
cfg_steve.Value = temp_steve.Value;
temp_tnt = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "tnt", 40, "");
cfg_tnt.Value = temp_tnt.Value;
temp_diamond = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "diamond", 40, "");
cfg_diamond.Value = temp_diamond.Value;
temp_diamond_sword = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "diamond_sword", 30, "");
cfg_diamond_sword.Value = temp_diamond_sword.Value;
temp_diamond_pickaxe = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "diamond_pickaxe", 30, "");
cfg_diamond_pickaxe.Value = temp_diamond_pickaxe.Value;
temp_apple = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "apple", 50, "");
cfg_apple.Value = temp_apple.Value;
temp_torch = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "torch", 50, "");
cfg_torch.Value = temp_torch.Value;
temp_chest = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "chest", 50, "");
cfg_chest.Value = temp_chest.Value;
temp_pig = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "pig", 45, "");
cfg_pig.Value = temp_pig.Value;
temp_sheep = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "sheep", 45, "");
cfg_sheep.Value = temp_sheep.Value;
temp_cow = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "cow", 45, "");
cfg_cow.Value = temp_cow.Value;
temp_chicken = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "chicken", 45, "");
cfg_chicken.Value = temp_chicken.Value;
temp_bee = ((BaseUnityPlugin)this).Config.Bind<int>("Items", "bee", 15, "");
cfg_bee.Value = temp_bee.Value;
mls = Logger.CreateLogSource("Minecraft Scraps");
mls.LogInfo((object)"1.12.2");
harmony.PatchAll(typeof(minecraft_scraps));
}
}
public class cfg_bool
{
public bool Value { get; set; }
}
public class cfg_int
{
public int Value { get; set; }
}
public class minecraft_scraps
{
private static string[] item = new string[21];
private static Mesh[] fish = (Mesh[])(object)new Mesh[16];
private static Material[][] cats = new Material[16][];
private static AudioClip[] take = (AudioClip[])(object)new AudioClip[21];
private static AudioClip[] give = (AudioClip[])(object)new AudioClip[21];
private static bool[] dots = new bool[16];
private static int[] item_weights = new int[21];
private static Transform chest;
private static Transform[] tree = (Transform[])(object)new Transform[5];
private static Vector3[][] ward = new Vector3[5][];
private static ulong lobbyid = 0uL;
private static bool[] first_item = new bool[3] { true, true, true };
private static bool sync = false;
private static string seeds = "nil";
private static bool[] disconnected;
private static int[] synced_weights;
private static bool client_received;
private static string saved_glass;
private static List<string> loaded_glass;
[HarmonyPatch(typeof(GrabbableObject), "Start")]
[HarmonyPostfix]
private static void pst1(GrabbableObject __instance, ref MeshRenderer ___mainObjectRenderer)
{
pst1async(__instance, ___mainObjectRenderer);
}
private static async void pst1async(GrabbableObject __instance, MeshRenderer ___mainObjectRenderer)
{
if (!(((Object)__instance.itemProperties).name == "MagnifyingGlass"))
{
return;
}
await wait_frames(1);
if ((Object)(object)((Component)__instance).gameObject.GetComponent<temporary>() != (Object)null)
{
return;
}
((Component)__instance).gameObject.AddComponent<temporary>();
if (first_item[0])
{
Item val = StartOfRound.Instance.allItemsList.itemsList.First((Item _) => ((Object)_).name == "MagnifyingGlass");
val.restingRotation = new Vector3(0f, 90f, -90f);
val.verticalOffset = 0.05f;
}
if (!GameNetworkManager.Instance.disableSteam && seeds == "nil")
{
if (!GameNetworkManager.Instance.isHostingGame)
{
if (first_item[0])
{
yon.mls.LogInfo((object)"await wait_timer");
first_item[0] = false;
}
await wait_timer((yon.cfg_millisecond.Value >= 20 && yon.cfg_millisecond.Value <= 4000) ? yon.cfg_millisecond.Value : 100);
if (disconnected[0])
{
return;
}
}
if (seeds == "nil")
{
seeds = "?";
}
}
MeshFilter component = ((Component)___mainObjectRenderer).GetComponent<MeshFilter>();
if (item[0] == null)
{
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "4902-minecraft_scraps").Replace("\\", "/");
yon.mls.LogMessage((object)("Searching this filepath:" + text));
AssetBundle assetBundle = AssetBundle.LoadFromFileAsync(text).assetBundle;
item[0] = __instance.itemProperties.itemName;
fish[0] = component.mesh;
cats[0] = ((Renderer)___mainObjectRenderer).materials;
take[0] = __instance.itemProperties.grabSFX;
give[0] = __instance.itemProperties.dropSFX;
item[1] = "Diamond block";
fish[1] = Object.Instantiate<Mesh>(fish1.fish2(assetBundle.LoadAsset<Mesh>("minecraft diamond block.fbx")));
cats[1] = (Material[])(object)new Material[1] { assetBundle.LoadAsset<Material>("diamond-minecraft-2.mat") };
take[1] = assetBundle.LoadAsset<AudioClip>("block place1.ogg");
give[1] = assetBundle.LoadAsset<AudioClip>("block place2.ogg");
item[2] = "Spider";
fish[2] = Object.Instantiate<Mesh>(fish1.fish2(assetBundle.LoadAsset<Mesh>("Spider.fbx")));
cats[2] = (Material[])(object)new Material[1] { assetBundle.LoadAsset<Material>("spider.mat") };
take[2] = assetBundle.LoadAsset<AudioClip>("spider1.ogg");
give[2] = assetBundle.LoadAsset<AudioClip>("spider2.ogg");
item[3] = "Zombie";
fish[3] = Object.Instantiate<Mesh>(fish1.fish2(assetBundle.LoadAsset<Mesh>("Zombie.fbx")));
cats[3] = (Material[])(object)new Material[1] { assetBundle.LoadAsset<Material>("zombie.mat") };
take[3] = assetBundle.LoadAsset<AudioClip>("zombie1.ogg");
give[3] = assetBundle.LoadAsset<AudioClip>("zombie2.ogg");
item[4] = "Villager";
fish[4] = Object.Instantiate<Mesh>(fish1.fish2(assetBundle.LoadAsset<Mesh>("Villager.fbx")));
cats[4] = (Material[])(object)new Material[1] { assetBundle.LoadAsset<Material>("villager_farmer.mat") };
take[4] = assetBundle.LoadAsset<AudioClip>("villager1.ogg");
give[4] = assetBundle.LoadAsset<AudioClip>("villager2.ogg");
item[5] = "Creeper";
fish[5] = Object.Instantiate<Mesh>(fish1.fish2(assetBundle.LoadAsset<Mesh>("Creeper.fbx")));
cats[5] = (Material[])(object)new Material[1] { assetBundle.LoadAsset<Material>("creeper.mat") };
take[5] = assetBundle.LoadAsset<AudioClip>("creeper.ogg");
give[5] = take[5];
item[6] = "Pumpkin";
fish[6] = Object.Instantiate<Mesh>(fish1.fish2(assetBundle.LoadAsset<GameObject>("pumpkin.obj").GetComponentInChildren<MeshFilter>().mesh));
cats[6] = (Material[])(object)new Material[1] { assetBundle.LoadAsset<Material>("pumpkin.mat") };
take[6] = take[1];
give[6] = give[1];
item[7] = "Anvil";
fish[7] = Object.Instantiate<Mesh>(fish1.fish2(assetBundle.LoadAsset<GameObject>("mineways2skfb.obj").GetComponentInChildren<MeshFilter>().mesh));
cats[7] = (Material[])(object)new Material[1] { assetBundle.LoadAsset<Material>("mineways2skfb-rgba.mat") };
take[7] = assetBundle.LoadAsset<AudioClip>("anvil1.ogg");
give[7] = assetBundle.LoadAsset<AudioClip>("anvil2.ogg");
item[8] = "Steve";
fish[8] = Object.Instantiate<Mesh>(fish1.fish2(assetBundle.LoadAsset<Mesh>("steve.fbx")));
cats[8] = (Material[])(object)new Material[1] { assetBundle.LoadAsset<Material>("steve.mat") };
take[8] = take[0];
give[8] = give[0];
item[9] = "TNT";
fish[9] = Object.Instantiate<Mesh>(assetBundle.LoadAsset<Mesh>("mesh_id27_0_0.asset"));
cats[9] = (Material[])(object)new Material[1] { assetBundle.LoadAsset<Material>("60_0.mat") };
take[9] = assetBundle.LoadAsset<AudioClip>("tnt1.ogg");
give[9] = assetBundle.LoadAsset<AudioClip>("tnt2.ogg");
item[10] = "Diamond";
fish[10] = Object.Instantiate<Mesh>(assetBundle.LoadAsset<Mesh>("cube_0_0_0.asset"));
cats[10] = (Material[])(object)new Material[1] { assetBundle.LoadAsset<Material>("material_0.mat") };
take[10] = take[1];
give[10] = give[1];
item[11] = "Diamond sword";
fish[11] = Object.Instantiate<Mesh>(fish1.fish2(assetBundle.LoadAsset<GameObject>("diamondsword.obj").GetComponentInChildren<MeshFilter>().mesh));
cats[11] = (Material[])(object)new Material[1] { assetBundle.LoadAsset<Material>("diffuse1.mat") };
take[11] = take[1];
give[11] = give[1];
item[12] = "Diamond pickaxe";
fish[12] = Object.Instantiate<Mesh>(fish1.fish2(assetBundle.LoadAsset<GameObject>("diamond-pickaxe.obj").GetComponentInChildren<MeshFilter>().mesh));
cats[12] = (Material[])(object)new Material[1] { assetBundle.LoadAsset<Material>("diffuse2.mat") };
take[12] = take[1];
give[12] = give[1];
item[13] = "Apple";
fish[13] = Object.Instantiate<Mesh>(fish1.fish2(assetBundle.LoadAsset<GameObject>("apple.blend").GetComponentInChildren<MeshFilter>().mesh));
cats[13] = (Material[])(object)new Material[1] { assetBundle.LoadAsset<Material>("apple.mat") };
take[13] = assetBundle.LoadAsset<AudioClip>("eat1.ogg");
give[13] = take[13];
item[14] = "Torch";
fish[14] = Object.Instantiate<Mesh>(fish1.fish2(assetBundle.LoadAsset<GameObject>("torch.obj").GetComponentInChildren<MeshFilter>().mesh));
cats[14] = (Material[])(object)new Material[1] { assetBundle.LoadAsset<Material>("torch_diffuse.mat") };
take[14] = take[1];
give[14] = give[1];
item[15] = "Chest";
chest = assetBundle.LoadAsset<GameObject>("chest.fbx").transform;
fish[15] = Object.Instantiate<Mesh>(fish1.fish2(((Component)((Component)chest).GetComponentsInChildren<Transform>()[1]).GetComponent<SkinnedMeshRenderer>().sharedMesh));
cats[15] = (Material[])(object)new Material[1] { assetBundle.LoadAsset<Material>("diffuse.mat") };
take[15] = assetBundle.LoadAsset<AudioClip>("chest1.ogg");
give[15] = assetBundle.LoadAsset<AudioClip>("chest2.ogg");
item[16] = "Pig";
take[16] = assetBundle.LoadAsset<AudioClip>("pig1.ogg");
give[16] = assetBundle.LoadAsset<AudioClip>("pig2.ogg");
tree[0] = assetBundle.LoadAsset<GameObject>("pig.prefab").GetComponentsInChildren<Transform>()[2];
ward[0] = (Vector3[])(object)new Vector3[5]
{
new Vector3(-0.4f, 0f, 0f),
new Vector3(0f, 270f, 270f),
new Vector3(2f, 2f, 2f),
new Vector3(-0.03f, 0.148f, -0.034f),
new Vector3(314f, 357f, 204f)
};
item[17] = "Sheep";
take[17] = assetBundle.LoadAsset<AudioClip>("sheep1.ogg");
give[17] = assetBundle.LoadAsset<AudioClip>("sheep2.ogg");
tree[1] = assetBundle.LoadAsset<GameObject>("sheep.prefab").GetComponentsInChildren<Transform>()[2];
ward[1] = (Vector3[])(object)new Vector3[5]
{
new Vector3(-0.85f, 0f, 0f),
new Vector3(0f, 180f, 270f),
new Vector3(4f, 4f, 4f),
new Vector3(-0.12f, 0.11f, -0.014f),
new Vector3(314f, 357f, 204f)
};
item[18] = "Cow";
take[18] = assetBundle.LoadAsset<AudioClip>("cow1.ogg");
give[18] = assetBundle.LoadAsset<AudioClip>("cow2.ogg");
tree[2] = assetBundle.LoadAsset<GameObject>("cow.prefab").GetComponentsInChildren<Transform>()[2];
ward[2] = (Vector3[])(object)new Vector3[5]
{
new Vector3(-1.3f, 0f, 0f),
new Vector3(0f, 270f, 270f),
new Vector3(4f, 4f, 4f),
new Vector3(-0.16f, 0.165f, 0.046f),
new Vector3(314f, 357f, 204f)
};
item[19] = "Chicken";
take[19] = assetBundle.LoadAsset<AudioClip>("chicken1.ogg");
give[19] = assetBundle.LoadAsset<AudioClip>("chicken2.ogg");
tree[3] = assetBundle.LoadAsset<GameObject>("chicken.prefab").GetComponentsInChildren<Transform>()[2];
ward[3] = (Vector3[])(object)new Vector3[5]
{
new Vector3(-0.35f, 0f, 0f),
new Vector3(0f, 180f, 270f),
new Vector3(4f, 4f, 4f),
new Vector3(-0.05f, 0.026f, -0.05f),
new Vector3(314f, 357f, 204f)
};
item[20] = "Bee";
take[20] = null;
give[20] = null;
tree[4] = assetBundle.LoadAsset<GameObject>("bee.prefab").GetComponentsInChildren<Transform>()[2];
ward[4] = (Vector3[])(object)new Vector3[5]
{
new Vector3(0.8f, 0f, 0.5f),
new Vector3(270f, 68f, 0f),
new Vector3(50f, 50f, 50f),
new Vector3(-0.03f, 0.13f, 0.03f),
new Vector3(0f, 112.5f, 117.2f)
};
set_item_weights();
}
if (item[0] == null)
{
return;
}
Shion shion;
if (!GameNetworkManager.Instance.disableSteam && lobbyid != 0 && (Object)(object)((Component)__instance).GetComponent<NetworkObject>() != (Object)null)
{
ulong seed;
if (yon.cfg_saveseeds.Value && seeds != "nil" && seeds != "?" && seeds.Contains(((Component)__instance).GetComponent<NetworkObject>().NetworkObjectId + "."))
{
if (first_item[2])
{
yon.mls.LogInfo((object)"custom_random = new Shion(saved seed)");
}
int num = seeds.IndexOf(((Component)__instance).GetComponent<NetworkObject>().NetworkObjectId + ".");
int num2 = ((Component)__instance).GetComponent<NetworkObject>().NetworkObjectId.ToString().Length + 1;
seed = ulong.Parse(seeds.Substring(num + num2, seeds.IndexOf("/", num) - (num + num2)));
}
else
{
if (first_item[2])
{
yon.mls.LogInfo((object)"custom_random = new Shion(lobbyid+networkobjectid)");
}
seed = lobbyid + ((Component)__instance).GetComponent<NetworkObject>().NetworkObjectId;
}
shion = new Shion(seed);
if (yon.cfg_saveseeds.Value)
{
((Component)__instance).gameObject.AddComponent<ItemTypeSeed>();
((Component)__instance).gameObject.GetComponent<ItemTypeSeed>().seed = seed.ToString();
}
}
else
{
if (first_item[2])
{
yon.mls.LogInfo((object)"custom_random = new Shion()");
}
shion = new Shion();
}
if (first_item[2])
{
yon.mls.LogInfo((object)((yon.cfg_synced_percentages.Value && synced_weights[0] != -1) ? "host config" : "local config"));
}
first_item[2] = false;
bool flag = false;
if (shion.next32mm(0, 100) < yon.cfg_base_percentage.Value)
{
int[] array = ((yon.cfg_synced_percentages.Value && synced_weights[0] != -1) ? synced_weights : item_weights);
int num3 = shion.next32mm(1, array[0] + 1);
int num4 = 0;
int i;
for (i = 1; i < array.Length; i++)
{
num4 += array[i];
if (num4 >= num3)
{
break;
}
}
Bounds bounds2;
switch (i)
{
case 1:
{
component.mesh = fish[1];
if (!dots[1])
{
Mesh mesh = component.mesh;
Vector3[] vertices = mesh.vertices;
Vector3[] normals = mesh.normals;
bounds2 = mesh.bounds;
Vector3 center = ((Bounds)(ref bounds2)).center;
for (int num2 = 0; num2 < vertices.Length; num2++)
{
ref Vector3 reference19 = ref vertices[num2];
reference19 = vertices[num2] - center;
ref Vector3 reference20 = ref vertices[num2];
reference20 = vertices[num2] * 90f;
float x3 = vertices[num2].x;
float z = vertices[num2].z;
float x4 = normals[num2].x;
float z2 = normals[num2].z;
vertices[num2].x = 0f - z;
vertices[num2].z = x3;
normals[num2].x = 0f - z2;
normals[num2].z = x4;
vertices[num2].x = vertices[num2].x - 0.5f;
ref Vector3 reference21 = ref vertices[num2];
reference21 = vertices[num2] + center;
}
mesh.vertices = vertices;
mesh.normals = normals;
mesh.RecalculateBounds();
mesh.RecalculateNormals();
fish[1] = mesh;
dots[1] = true;
}
BoxCollider component2 = ((Component)___mainObjectRenderer).GetComponent<BoxCollider>();
component2.center = new Vector3(-0.5f, 0f, 0f);
component2.size = new Vector3(1.9f, 1.9f, 1.9f);
((Component)((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>()).transform.localPosition = new Vector3(-0.5f, 0f, 0f);
__instance.itemProperties.itemName = item[1];
((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>().headerText = item[1];
__instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[1];
((Renderer)___mainObjectRenderer).materials = cats[1];
break;
}
case 2:
{
component.mesh = fish[2];
if (!dots[2])
{
Mesh mesh = component.mesh;
Vector3[] vertices = mesh.vertices;
Vector3[] normals = mesh.normals;
bounds2 = mesh.bounds;
Vector3 center = ((Bounds)(ref bounds2)).center;
for (int num2 = 0; num2 < vertices.Length; num2++)
{
ref Vector3 reference10 = ref vertices[num2];
reference10 = vertices[num2] - center;
ref Vector3 reference11 = ref vertices[num2];
reference11 = vertices[num2] * 3f;
float x3 = vertices[num2].x;
float z = vertices[num2].z;
float x4 = normals[num2].x;
float z2 = normals[num2].z;
vertices[num2].x = 0f - z;
vertices[num2].z = x3;
normals[num2].x = 0f - z2;
normals[num2].z = x4;
float y3 = vertices[num2].y;
float z3 = vertices[num2].z;
float y4 = normals[num2].y;
float z4 = normals[num2].z;
vertices[num2].y = z3;
vertices[num2].z = 0f - y3;
normals[num2].y = z4;
normals[num2].z = 0f - y4;
vertices[num2].y = vertices[num2].y - 0.24f;
vertices[num2].x = vertices[num2].x + 0.1f;
ref Vector3 reference12 = ref vertices[num2];
reference12 = vertices[num2] + center;
}
mesh.vertices = vertices;
mesh.normals = normals;
mesh.RecalculateBounds();
mesh.RecalculateNormals();
fish[2] = mesh;
dots[2] = true;
}
BoxCollider component2 = ((Component)___mainObjectRenderer).GetComponent<BoxCollider>();
component2.center = new Vector3(0.05f, 0f, 0f);
component2.size = new Vector3(0.65f, 1.9f, 1.9f);
((Component)((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>()).transform.localPosition = new Vector3(0.05f, 0f, 0f);
__instance.itemProperties.itemName = item[2];
((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>().headerText = item[2];
__instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[2];
((Renderer)___mainObjectRenderer).materials = cats[2];
break;
}
case 3:
{
component.mesh = fish[3];
if (!dots[3])
{
Mesh mesh = component.mesh;
Vector3[] vertices = mesh.vertices;
Vector3[] normals = mesh.normals;
bounds2 = mesh.bounds;
Vector3 center = ((Bounds)(ref bounds2)).center;
for (int num2 = 0; num2 < vertices.Length; num2++)
{
ref Vector3 reference40 = ref vertices[num2];
reference40 = vertices[num2] - center;
ref Vector3 reference41 = ref vertices[num2];
reference41 = vertices[num2] * 3f;
float x3 = vertices[num2].x;
float y = vertices[num2].y;
float x4 = normals[num2].x;
float y2 = normals[num2].y;
vertices[num2].x = y;
vertices[num2].y = 0f - x3;
normals[num2].x = y2;
normals[num2].y = 0f - x4;
ref Vector3 reference42 = ref vertices[num2];
reference42 = vertices[num2] + center;
}
mesh.vertices = vertices;
mesh.normals = normals;
mesh.RecalculateBounds();
mesh.RecalculateNormals();
fish[3] = mesh;
dots[3] = true;
}
BoxCollider component2 = ((Component)___mainObjectRenderer).GetComponent<BoxCollider>();
component2.center = new Vector3(0.05f, 0f, 0f);
component2.size = new Vector3(0.65f, 1.2f, 2.4f);
((Component)((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>()).transform.localPosition = new Vector3(0.05f, 0f, 0f);
__instance.itemProperties.itemName = item[3];
((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>().headerText = item[3];
__instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[3];
((Renderer)___mainObjectRenderer).materials = cats[3];
break;
}
case 4:
{
component.mesh = fish[4];
if (!dots[4])
{
Mesh mesh = component.mesh;
Vector3[] vertices = mesh.vertices;
Vector3[] normals = mesh.normals;
bounds2 = mesh.bounds;
Vector3 center = ((Bounds)(ref bounds2)).center;
for (int num2 = 0; num2 < vertices.Length; num2++)
{
ref Vector3 reference37 = ref vertices[num2];
reference37 = vertices[num2] - center;
ref Vector3 reference38 = ref vertices[num2];
reference38 = vertices[num2] * 3f;
float x3 = vertices[num2].x;
float y = vertices[num2].y;
float x4 = vertices[num2].x;
float y2 = vertices[num2].y;
vertices[num2].x = y;
vertices[num2].y = 0f - x3;
normals[num2].x = y2;
normals[num2].y = 0f - x4;
vertices[num2].z = vertices[num2].z + 0.4f;
vertices[num2].y = vertices[num2].y + 0.05f;
ref Vector3 reference39 = ref vertices[num2];
reference39 = vertices[num2] + center;
}
mesh.vertices = vertices;
mesh.normals = normals;
mesh.RecalculateBounds();
mesh.RecalculateNormals();
fish[4] = mesh;
dots[4] = true;
}
BoxCollider component2 = ((Component)___mainObjectRenderer).GetComponent<BoxCollider>();
component2.center = new Vector3(0.05f, 0f, 0.1f);
component2.size = new Vector3(0.65f, 1.2f, 2.6f);
((Component)((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>()).transform.localPosition = new Vector3(0.05f, 0f, 0f);
__instance.itemProperties.itemName = item[4];
((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>().headerText = item[4];
__instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[4];
((Renderer)___mainObjectRenderer).materials = cats[4];
break;
}
case 5:
{
component.mesh = fish[5];
if (!dots[5])
{
Mesh mesh = component.mesh;
Vector3[] vertices = mesh.vertices;
Vector3[] normals = mesh.normals;
bounds2 = mesh.bounds;
Vector3 center = ((Bounds)(ref bounds2)).center;
for (int num2 = 0; num2 < vertices.Length; num2++)
{
ref Vector3 reference13 = ref vertices[num2];
reference13 = vertices[num2] - center;
ref Vector3 reference14 = ref vertices[num2];
reference14 = vertices[num2] * 3f;
float x3 = vertices[num2].x;
float y = vertices[num2].y;
float x4 = normals[num2].x;
float y2 = normals[num2].y;
vertices[num2].x = y;
vertices[num2].y = 0f - x3;
normals[num2].x = y2;
normals[num2].y = 0f - x4;
vertices[num2].z = vertices[num2].z + 0.25f;
ref Vector3 reference15 = ref vertices[num2];
reference15 = vertices[num2] + center;
}
mesh.vertices = vertices;
mesh.normals = normals;
mesh.RecalculateBounds();
mesh.RecalculateNormals();
fish[5] = mesh;
dots[5] = true;
}
BoxCollider component2 = ((Component)___mainObjectRenderer).GetComponent<BoxCollider>();
component2.center = new Vector3(0.05f, 0f, 0.25f);
component2.size = new Vector3(0.65f, 0.6f, 1.9f);
((Component)((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>()).transform.localPosition = new Vector3(0.05f, 0f, 0.25f);
__instance.itemProperties.itemName = item[5];
((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>().headerText = item[5];
__instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[5];
((Renderer)___mainObjectRenderer).materials = cats[5];
break;
}
case 6:
{
component.mesh = fish[6];
if (!dots[6])
{
Mesh mesh = component.mesh;
Vector3[] vertices = mesh.vertices;
Vector3[] normals = mesh.normals;
bounds2 = mesh.bounds;
Vector3 center = ((Bounds)(ref bounds2)).center;
for (int num2 = 0; num2 < vertices.Length; num2++)
{
ref Vector3 reference28 = ref vertices[num2];
reference28 = vertices[num2] - center;
ref Vector3 reference29 = ref vertices[num2];
reference29 = vertices[num2] * 1.11f;
float x3 = vertices[num2].x;
float z = vertices[num2].z;
float x4 = normals[num2].x;
float z2 = normals[num2].z;
vertices[num2].x = 0f - z;
vertices[num2].z = x3;
normals[num2].x = 0f - z2;
normals[num2].z = x4;
float x = vertices[num2].x;
float y3 = vertices[num2].y;
float x2 = normals[num2].x;
float y4 = normals[num2].y;
vertices[num2].x = 0f - y3;
vertices[num2].y = x;
normals[num2].x = 0f - y4;
normals[num2].y = x2;
float y5 = vertices[num2].y;
float z5 = vertices[num2].z;
float y6 = normals[num2].y;
float z6 = normals[num2].z;
vertices[num2].y = z5;
vertices[num2].z = 0f - y5;
normals[num2].y = z6;
normals[num2].z = 0f - y6;
vertices[num2].y = vertices[num2].y - 0.8f;
vertices[num2].x = vertices[num2].x - 0.5f;
ref Vector3 reference30 = ref vertices[num2];
reference30 = vertices[num2] + center;
}
mesh.vertices = vertices;
mesh.normals = normals;
mesh.RecalculateBounds();
mesh.RecalculateNormals();
fish[6] = mesh;
dots[6] = true;
}
BoxCollider component2 = ((Component)___mainObjectRenderer).GetComponent<BoxCollider>();
component2.center = new Vector3(-0.5f, 0f, 0f);
component2.size = new Vector3(1.9f, 1.9f, 1.9f);
((Component)((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>()).transform.localPosition = new Vector3(-0.5f, 0f, 0f);
__instance.itemProperties.itemName = item[6];
((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>().headerText = item[6];
__instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[6];
((Renderer)___mainObjectRenderer).materials = cats[6];
break;
}
case 7:
{
component.mesh = fish[7];
if (!dots[7])
{
Mesh mesh = component.mesh;
Vector3[] vertices = mesh.vertices;
Vector3[] normals = mesh.normals;
bounds2 = mesh.bounds;
Vector3 center = ((Bounds)(ref bounds2)).center;
for (int num2 = 0; num2 < vertices.Length; num2++)
{
ref Vector3 reference34 = ref vertices[num2];
reference34 = vertices[num2] - center;
ref Vector3 reference35 = ref vertices[num2];
reference35 = vertices[num2] * 3.5f;
float x3 = vertices[num2].x;
float z = vertices[num2].z;
float x4 = normals[num2].x;
float z2 = normals[num2].z;
vertices[num2].x = 0f - z;
vertices[num2].z = x3;
normals[num2].x = 0f - z2;
normals[num2].z = x4;
float x = vertices[num2].x;
float y3 = vertices[num2].y;
float x2 = normals[num2].x;
float y4 = normals[num2].y;
vertices[num2].x = 0f - y3;
vertices[num2].y = x;
normals[num2].x = 0f - y4;
normals[num2].y = x2;
float y5 = vertices[num2].y;
float z5 = vertices[num2].z;
float y6 = normals[num2].y;
float z6 = normals[num2].z;
vertices[num2].y = z5;
vertices[num2].z = 0f - y5;
normals[num2].y = z6;
normals[num2].z = 0f - y6;
vertices[num2].y = vertices[num2].y - 0.25f;
vertices[num2].x = vertices[num2].x - 0.25f;
vertices[num2].z = vertices[num2].z - 0.25f;
ref Vector3 reference36 = ref vertices[num2];
reference36 = vertices[num2] + center;
}
mesh.vertices = vertices;
mesh.normals = normals;
mesh.RecalculateBounds();
mesh.RecalculateNormals();
fish[7] = mesh;
dots[7] = true;
}
BoxCollider component2 = ((Component)___mainObjectRenderer).GetComponent<BoxCollider>();
component2.center = new Vector3(-0.5f, 0f, 0f);
component2.size = new Vector3(1.9f, 1.9f, 1.425f);
((Component)((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>()).transform.localPosition = new Vector3(-0.5f, 0f, 0f);
__instance.itemProperties.itemName = item[7];
((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>().headerText = item[7];
__instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[7];
((Renderer)___mainObjectRenderer).materials = cats[7];
break;
}
case 8:
{
component.mesh = fish[8];
if (!dots[8])
{
Mesh mesh = component.mesh;
Vector3[] vertices = mesh.vertices;
Vector3[] normals = mesh.normals;
bounds2 = mesh.bounds;
Vector3 center = ((Bounds)(ref bounds2)).center;
for (int num2 = 0; num2 < vertices.Length; num2++)
{
ref Vector3 reference22 = ref vertices[num2];
reference22 = vertices[num2] - center;
ref Vector3 reference23 = ref vertices[num2];
reference23 = vertices[num2] * 3f;
float x3 = vertices[num2].x;
float y = vertices[num2].y;
float x4 = normals[num2].x;
float y2 = normals[num2].y;
vertices[num2].x = y;
vertices[num2].y = 0f - x3;
normals[num2].x = y2;
normals[num2].y = 0f - x4;
ref Vector3 reference24 = ref vertices[num2];
reference24 = vertices[num2] + center;
}
mesh.vertices = vertices;
mesh.normals = normals;
mesh.RecalculateBounds();
mesh.RecalculateNormals();
fish[8] = mesh;
dots[8] = true;
}
BoxCollider component2 = ((Component)___mainObjectRenderer).GetComponent<BoxCollider>();
component2.center = new Vector3(0.05f, 0f, 0f);
component2.size = new Vector3(0.65f, 1.2f, 2.4f);
((Component)((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>()).transform.localPosition = new Vector3(0.05f, 0f, 0f);
__instance.itemProperties.itemName = item[8];
((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>().headerText = item[8];
__instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[8];
((Renderer)___mainObjectRenderer).materials = cats[8];
break;
}
case 9:
{
component.mesh = fish[9];
if (!dots[9])
{
Mesh mesh = component.mesh;
Vector3[] vertices = mesh.vertices;
Vector3[] normals = mesh.normals;
bounds2 = mesh.bounds;
Vector3 center = ((Bounds)(ref bounds2)).center;
for (int num2 = 0; num2 < vertices.Length; num2++)
{
ref Vector3 reference4 = ref vertices[num2];
reference4 = vertices[num2] - center;
ref Vector3 reference5 = ref vertices[num2];
reference5 = vertices[num2] * 0.005f * 1.044f;
float x3 = vertices[num2].x;
float y = vertices[num2].y;
float x4 = normals[num2].x;
float y2 = normals[num2].y;
vertices[num2].x = 0f - y;
vertices[num2].y = x3;
normals[num2].x = 0f - y2;
normals[num2].y = x4;
vertices[num2].x = vertices[num2].x - 0.5f;
ref Vector3 reference6 = ref vertices[num2];
reference6 = vertices[num2] + center;
}
mesh.vertices = vertices;
mesh.normals = normals;
mesh.RecalculateBounds();
mesh.RecalculateNormals();
fish[9] = mesh;
dots[9] = true;
}
BoxCollider component2 = ((Component)___mainObjectRenderer).GetComponent<BoxCollider>();
component2.center = new Vector3(-0.5f, 0f, 0f);
component2.size = new Vector3(1.9f, 1.9f, 1.9f);
((Component)((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>()).transform.localPosition = new Vector3(-0.5f, 0f, 0f);
__instance.itemProperties.itemName = item[9];
((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>().headerText = item[9];
__instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[9];
((Renderer)___mainObjectRenderer).materials = cats[9];
break;
}
case 10:
{
component.mesh = fish[10];
if (!dots[10])
{
Mesh mesh = component.mesh;
Vector3[] vertices = mesh.vertices;
Vector3[] normals = mesh.normals;
int[] triangles = mesh.triangles;
bounds2 = mesh.bounds;
Vector3 center = ((Bounds)(ref bounds2)).center;
for (int num2 = 0; num2 < vertices.Length; num2++)
{
ref Vector3 reference43 = ref vertices[num2];
reference43 = vertices[num2] - center;
ref Vector3 reference44 = ref vertices[num2];
reference44 = vertices[num2] * 0.75f;
float y = vertices[num2].y;
float z = vertices[num2].z;
float y2 = normals[num2].y;
float z2 = normals[num2].z;
vertices[num2].y = 0f - y;
vertices[num2].z = 0f - z;
normals[num2].y = 0f - y2;
normals[num2].z = 0f - z2;
float x = vertices[num2].x;
float y3 = vertices[num2].y;
float x2 = normals[num2].x;
float y4 = normals[num2].y;
vertices[num2].x = 0f - x;
vertices[num2].y = 0f - y3;
normals[num2].x = 0f - x2;
normals[num2].y = 0f - y4;
vertices[num2].x = vertices[num2].x * 0.08f;
vertices[num2].x = vertices[num2].x - 0.1f;
vertices[num2].z = vertices[num2].z + 0.3f;
vertices[num2].y = vertices[num2].y + 0.1f;
ref Vector3 reference45 = ref vertices[num2];
reference45 = vertices[num2] + center;
}
for (int num2 = 0; num2 < triangles.Length; num2 += 3)
{
if (vertices[triangles[num2]].x > -0.1f && vertices[triangles[num2 + 1]].x > -0.1f && vertices[triangles[num2 + 2]].x > -0.1f)
{
int num5 = triangles[num2];
triangles[num2] = triangles[num2 + 2];
triangles[num2 + 2] = num5;
}
}
mesh.vertices = vertices;
mesh.normals = normals;
mesh.triangles = triangles;
mesh.RecalculateBounds();
mesh.RecalculateNormals();
fish[10] = mesh;
dots[10] = true;
}
BoxCollider component2 = ((Component)___mainObjectRenderer).GetComponent<BoxCollider>();
component2.center = new Vector3(-0.1f, 0f, 0.3f);
component2.size = new Vector3(0.1f, 1.4f, 1.5f);
((Component)((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>()).transform.localPosition = new Vector3(-0.1f, 0f, 0.3f);
__instance.itemProperties.itemName = item[10];
((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>().headerText = item[10];
__instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[10];
((Renderer)___mainObjectRenderer).materials = cats[10];
break;
}
case 11:
{
component.mesh = fish[11];
if (!dots[11])
{
Mesh mesh = component.mesh;
Vector3[] vertices = mesh.vertices;
Vector3[] normals = mesh.normals;
bounds2 = mesh.bounds;
Vector3 center = ((Bounds)(ref bounds2)).center;
for (int num2 = 0; num2 < vertices.Length; num2++)
{
ref Vector3 reference25 = ref vertices[num2];
reference25 = vertices[num2] - center;
ref Vector3 reference26 = ref vertices[num2];
reference26 = vertices[num2] * 0.06f;
float y = vertices[num2].y;
float z = vertices[num2].z;
float y2 = normals[num2].y;
float z2 = normals[num2].z;
vertices[num2].y = 0f - y;
vertices[num2].z = 0f - z;
normals[num2].y = 0f - y2;
normals[num2].z = 0f - z2;
float x = vertices[num2].x;
float y3 = vertices[num2].y;
float x2 = normals[num2].x;
float y4 = normals[num2].y;
vertices[num2].x = y3;
vertices[num2].y = 0f - x;
normals[num2].x = y4;
normals[num2].y = 0f - x2;
float y5 = vertices[num2].y;
float z5 = vertices[num2].z;
float y6 = normals[num2].y;
float z6 = normals[num2].z;
vertices[num2].y = (float)((double)y5 * Math.Cos(5.497787) - (double)z5 * Math.Sin(5.497787));
vertices[num2].z = (float)((double)y5 * Math.Sin(5.497787) + (double)z5 * Math.Cos(5.497787));
normals[num2].y = (float)((double)y6 * Math.Cos(5.497787) - (double)z6 * Math.Sin(5.497787));
normals[num2].z = (float)((double)y6 * Math.Sin(5.497787) + (double)z6 * Math.Cos(5.497787));
vertices[num2].x = vertices[num2].x - 0.1f;
vertices[num2].z = vertices[num2].z + 1f;
vertices[num2].y = vertices[num2].y + 0.01f;
ref Vector3 reference27 = ref vertices[num2];
reference27 = vertices[num2] + center;
}
mesh.vertices = vertices;
mesh.normals = normals;
mesh.RecalculateBounds();
mesh.RecalculateNormals();
fish[11] = mesh;
dots[11] = true;
}
BoxCollider component2 = ((Component)___mainObjectRenderer).GetComponent<BoxCollider>();
component2.center = new Vector3(-0.1f, 0f, 1f);
component2.size = new Vector3(0.1f, 1.3f, 2.7f);
((Component)((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>()).transform.localPosition = new Vector3(-0.1f, 0f, 1f);
__instance.itemProperties.itemName = item[11];
((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>().headerText = item[11];
__instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[11];
((Renderer)___mainObjectRenderer).materials = cats[11];
break;
}
case 12:
{
component.mesh = fish[12];
if (!dots[12])
{
Mesh mesh = component.mesh;
Vector3[] vertices = mesh.vertices;
Vector3[] normals = mesh.normals;
bounds2 = mesh.bounds;
Vector3 center = ((Bounds)(ref bounds2)).center;
for (int num2 = 0; num2 < vertices.Length; num2++)
{
ref Vector3 reference7 = ref vertices[num2];
reference7 = vertices[num2] - center;
ref Vector3 reference8 = ref vertices[num2];
reference8 = vertices[num2] * 0.06f;
float y = vertices[num2].y;
float z = vertices[num2].z;
float y2 = normals[num2].y;
float z2 = normals[num2].z;
vertices[num2].y = 0f - y;
vertices[num2].z = 0f - z;
normals[num2].y = 0f - y2;
normals[num2].z = 0f - z2;
float x = vertices[num2].x;
float y3 = vertices[num2].y;
float x2 = normals[num2].x;
float y4 = normals[num2].y;
vertices[num2].x = y3;
vertices[num2].y = 0f - x;
normals[num2].x = y4;
normals[num2].y = 0f - x2;
float y5 = vertices[num2].y;
float z5 = vertices[num2].z;
float y6 = normals[num2].y;
float z6 = normals[num2].z;
vertices[num2].y = (float)((double)y5 * Math.Cos(0.7853982) - (double)z5 * Math.Sin(0.7853982));
vertices[num2].z = (float)((double)y5 * Math.Sin(0.7853982) + (double)z5 * Math.Cos(0.7853982));
normals[num2].y = (float)((double)y6 * Math.Cos(0.7853982) - (double)z6 * Math.Sin(0.7853982));
normals[num2].z = (float)((double)y6 * Math.Sin(0.7853982) + (double)z6 * Math.Cos(0.7853982));
vertices[num2].x = vertices[num2].x - 0.1f;
vertices[num2].z = vertices[num2].z + 0.8f;
vertices[num2].y = vertices[num2].y + 0.01f;
ref Vector3 reference9 = ref vertices[num2];
reference9 = vertices[num2] + center;
}
mesh.vertices = vertices;
mesh.normals = normals;
mesh.RecalculateBounds();
mesh.RecalculateNormals();
fish[12] = mesh;
dots[12] = true;
}
BoxCollider component2 = ((Component)___mainObjectRenderer).GetComponent<BoxCollider>();
component2.center = new Vector3(-0.1f, 0f, 0.7f);
component2.size = new Vector3(0.1f, 1.5f, 2f);
((Component)((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>()).transform.localPosition = new Vector3(-0.1f, 0f, 0.7f);
__instance.itemProperties.itemName = item[12];
((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>().headerText = item[12];
__instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[12];
((Renderer)___mainObjectRenderer).materials = cats[12];
break;
}
case 13:
{
component.mesh = fish[13];
if (!dots[13])
{
Mesh mesh = component.mesh;
Vector3[] vertices = mesh.vertices;
int[] triangles = mesh.triangles;
bounds2 = mesh.bounds;
Vector3 center = ((Bounds)(ref bounds2)).center;
for (int num2 = 0; num2 < vertices.Length; num2++)
{
ref Vector3 reference31 = ref vertices[num2];
reference31 = vertices[num2] - center;
ref Vector3 reference32 = ref vertices[num2];
reference32 = vertices[num2] * 0.93f;
vertices[num2].x = vertices[num2].x * 0.08f;
vertices[num2].x = vertices[num2].x - 0.1f;
vertices[num2].z = vertices[num2].z + 0.5f;
vertices[num2].y = vertices[num2].y + 0.2f;
ref Vector3 reference33 = ref vertices[num2];
reference33 = vertices[num2] + center;
}
for (int num2 = 0; num2 < triangles.Length; num2 += 3)
{
if (vertices[triangles[num2]].x > -0.1f && vertices[triangles[num2 + 1]].x > -0.1f && vertices[triangles[num2 + 2]].x > -0.1f)
{
int num5 = triangles[num2];
triangles[num2] = triangles[num2 + 2];
triangles[num2 + 2] = num5;
}
}
mesh.vertices = vertices;
mesh.triangles = triangles;
mesh.RecalculateBounds();
fish[13] = mesh;
dots[13] = true;
}
BoxCollider component2 = ((Component)___mainObjectRenderer).GetComponent<BoxCollider>();
component2.center = new Vector3(-0.1f, -0.05f, 0.4f);
component2.size = new Vector3(0.1f, 1.4f, 1.65f);
((Component)((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>()).transform.localPosition = new Vector3(-0.1f, -0.05f, 0.4f);
__instance.itemProperties.itemName = item[13];
((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>().headerText = item[13];
__instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[13];
((Renderer)___mainObjectRenderer).materials = cats[13];
break;
}
case 14:
{
component.mesh = fish[14];
if (!dots[14])
{
Mesh mesh = component.mesh;
Vector3[] vertices = mesh.vertices;
Vector3[] normals = mesh.normals;
bounds2 = mesh.bounds;
Vector3 center = ((Bounds)(ref bounds2)).center;
for (int num2 = 0; num2 < vertices.Length; num2++)
{
ref Vector3 reference16 = ref vertices[num2];
reference16 = vertices[num2] - center;
ref Vector3 reference17 = ref vertices[num2];
reference17 = vertices[num2] * 1f;
float y = vertices[num2].y;
float z = vertices[num2].z;
float y2 = normals[num2].y;
float z2 = normals[num2].z;
vertices[num2].y = 0f - z;
vertices[num2].z = y;
normals[num2].y = 0f - z2;
normals[num2].z = y2;
vertices[num2].x = vertices[num2].x - 0.1f;
vertices[num2].z = vertices[num2].z + 0.3f;
ref Vector3 reference18 = ref vertices[num2];
reference18 = vertices[num2] + center;
}
mesh.vertices = vertices;
mesh.normals = normals;
mesh.RecalculateBounds();
mesh.RecalculateNormals();
fish[14] = mesh;
dots[14] = true;
}
BoxCollider component2 = ((Component)___mainObjectRenderer).GetComponent<BoxCollider>();
component2.center = new Vector3(-0.1f, 0f, 0.3f);
component2.size = new Vector3(0.25f, 0.25f, 1.25f);
((Component)((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>()).transform.localPosition = new Vector3(-0.1f, 0f, 0.3f);
__instance.itemProperties.itemName = item[14];
((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>().headerText = item[14];
__instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[14];
((Renderer)___mainObjectRenderer).materials = cats[14];
break;
}
case 15:
{
if (!dots[15])
{
Vector3[] vertices = fish[15].vertices;
Vector3[] normals = fish[15].normals;
Bounds bounds = fish[15].bounds;
Vector3 center = ((Bounds)(ref bounds)).center;
for (int num2 = 0; num2 < vertices.Length; num2++)
{
ref Vector3 reference = ref vertices[num2];
reference = vertices[num2] - center;
ref Vector3 reference2 = ref vertices[num2];
reference2 = vertices[num2] * 87.5f;
float y = vertices[num2].y;
float z = vertices[num2].z;
float y2 = normals[num2].y;
float z2 = normals[num2].z;
vertices[num2].y = 0f - y;
vertices[num2].z = 0f - z;
normals[num2].y = 0f - y2;
normals[num2].z = 0f - z2;
float x = vertices[num2].x;
float z3 = vertices[num2].z;
float x2 = normals[num2].x;
float z4 = normals[num2].z;
vertices[num2].x = z3;
vertices[num2].z = 0f - x;
normals[num2].x = z4;
normals[num2].z = 0f - x2;
vertices[num2].x = vertices[num2].x - 0.4f;
ref Vector3 reference3 = ref vertices[num2];
reference3 = vertices[num2] + center;
}
fish[15].vertices = vertices;
fish[15].normals = normals;
fish[15].RecalculateBounds();
fish[15].RecalculateNormals();
dots[15] = true;
}
Object.Instantiate<Transform>(chest).SetParent(((Component)__instance).transform);
Transform val3 = ((Component)__instance).GetComponentsInChildren<Transform>()[4];
Transform val4 = ((Component)__instance).GetComponentsInChildren<Transform>()[2];
val3.localPosition = new Vector3(0.4f, 0f, 0f);
val3.localRotation = new Quaternion(0.7071068f, 0f, -0.7071068f, 0f);
val3.localScale = new Vector3(90f, 90f, 90f);
val4.localPosition = new Vector3(0f, 0f, 0f);
val4.localRotation = new Quaternion(0f, 0f, 0f, 1f);
val4.localScale = new Vector3(1f, 1f, 1f);
((Renderer)((Component)((Component)__instance).GetComponentsInChildren<Transform>()[3]).GetComponent<SkinnedMeshRenderer>()).materials = cats[15];
((Component)__instance).GetComponent<MeshFilter>().mesh = null;
BoxCollider component2 = ((Component)__instance).GetComponent<BoxCollider>();
component2.center = new Vector3(-0.4f, -0.01f, -0.01f);
component2.size = new Vector3(1.6f, 1.6f, 1.6f);
((Component)((Component)__instance).GetComponentInChildren<ScanNodeProperties>()).transform.localPosition = new Vector3(-0.4f, -0.01f, -0.01f);
__instance.itemProperties.itemName = item[15];
((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = item[15];
break;
}
case 16:
{
Object.Instantiate<Transform>(tree[0]).SetParent(((Component)__instance).transform);
Transform val2 = ((Component)__instance).GetComponentsInChildren<Transform>()[2];
val2.localPosition = ward[0][0];
val2.localEulerAngles = ward[0][1];
val2.localScale = ward[0][2];
((Component)__instance).GetComponent<MeshFilter>().mesh = null;
BoxCollider component2 = ((Component)__instance).GetComponent<BoxCollider>();
component2.center = new Vector3(-0.4f, 0f, 0f);
component2.size = new Vector3(1.6f, 1f, 2.45f);
((Component)((Component)__instance).GetComponentInChildren<ScanNodeProperties>()).transform.localPosition = new Vector3(-0.4f, 0f, 0f);
__instance.itemProperties.itemName = item[16];
((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = item[16];
break;
}
case 17:
{
Object.Instantiate<Transform>(tree[1]).SetParent(((Component)__instance).transform);
Transform val2 = ((Component)__instance).GetComponentsInChildren<Transform>()[2];
val2.localPosition = ward[1][0];
val2.localEulerAngles = ward[1][1];
val2.localScale = ward[1][2];
((Component)__instance).GetComponent<MeshFilter>().mesh = null;
BoxCollider component2 = ((Component)__instance).GetComponent<BoxCollider>();
component2.center = new Vector3(-0.7f, 0f, 0f);
component2.size = new Vector3(2.3f, 1.25f, 2.45f);
((Component)((Component)__instance).GetComponentInChildren<ScanNodeProperties>()).transform.localPosition = new Vector3(-0.85f, 0f, 0f);
__instance.itemProperties.itemName = item[17];
((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = item[17];
break;
}
case 18:
{
Object.Instantiate<Transform>(tree[2]).SetParent(((Component)__instance).transform);
Transform val2 = ((Component)__instance).GetComponentsInChildren<Transform>()[2];
val2.localPosition = ward[2][0];
val2.localEulerAngles = ward[2][1];
val2.localScale = ward[2][2];
((Component)__instance).GetComponent<MeshFilter>().mesh = null;
BoxCollider component2 = ((Component)__instance).GetComponent<BoxCollider>();
component2.center = new Vector3(-0.8f, 0f, 0.3f);
component2.size = new Vector3(2.45f, 1.25f, 2.45f);
((Component)((Component)__instance).GetComponentInChildren<ScanNodeProperties>()).transform.localPosition = new Vector3(-0.8f, 0f, 0.3f);
__instance.itemProperties.itemName = item[18];
((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = item[18];
break;
}
case 19:
{
Object.Instantiate<Transform>(tree[3]).SetParent(((Component)__instance).transform);
Transform val2 = ((Component)__instance).GetComponentsInChildren<Transform>()[2];
val2.localPosition = ward[3][0];
val2.localEulerAngles = ward[3][1];
val2.localScale = ward[3][2];
((Component)__instance).GetComponent<MeshFilter>().mesh = null;
BoxCollider component2 = ((Component)__instance).GetComponent<BoxCollider>();
component2.center = new Vector3(-0.35f, 0f, 0f);
component2.size = new Vector3(1.5f, 0.8f, 1.2f);
((Component)((Component)__instance).GetComponentInChildren<ScanNodeProperties>()).transform.localPosition = new Vector3(-0.35f, 0f, 0f);
__instance.itemProperties.itemName = item[19];
((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = item[19];
break;
}
case 20:
{
Object.Instantiate<Transform>(tree[4]).SetParent(((Component)__instance).transform);
Transform val2 = ((Component)__instance).GetComponentsInChildren<Transform>()[2];
val2.localPosition = ward[4][0];
val2.localEulerAngles = ward[4][1];
val2.localScale = ward[4][2];
((Component)__instance).GetComponent<MeshFilter>().mesh = null;
BoxCollider component2 = ((Component)__instance).GetComponent<BoxCollider>();
component2.center = new Vector3(0.01f, 0f, 0.24f);
component2.size = new Vector3(0.5f, 0.5f, 0.68f);
((Component)((Component)__instance).GetComponentInChildren<ScanNodeProperties>()).transform.localPosition = new Vector3(0.01f, 0f, 0.24f);
__instance.itemProperties.itemName = item[20];
((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText = item[20];
break;
}
default:
yon.mls.LogInfo((object)"somehow outside?");
flag = true;
break;
}
}
else
{
flag = true;
}
if (flag)
{
component.mesh = fish[0];
__instance.itemProperties.itemName = item[0];
((Component)___mainObjectRenderer).GetComponentInChildren<ScanNodeProperties>().headerText = item[0];
__instance.itemProperties.spawnPrefab.GetComponent<MeshFilter>().mesh = fish[0];
((Renderer)___mainObjectRenderer).materials = cats[0];
}
}
private static async Task wait_frames(int frames)
{
int previous_frames = Time.frameCount;
while (Time.frameCount <= previous_frames + frames)
{
await Task.Delay(4);
}
}
private static async Task wait_timer(int maxwell)
{
int i = 0;
while (seeds == "nil" && !client_received && i < maxwell && !disconnected[0])
{
i++;
await Task.Delay(4);
}
if (disconnected[0])
{
if (!disconnected[1])
{
yon.mls.LogMessage((object)"disconnected before wait_timer ended");
disconnected[1] = true;
}
}
else if (first_item[1])
{
yon.mls.LogMessage((object)((seeds == "nil" && !client_received) ? ("timer ended before receiving network message (" + i + "/" + yon.cfg_millisecond.Value + ")") : ("received network message before timer ended (" + i + "/" + yon.cfg_millisecond.Value + ")")));
first_item[1] = false;
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(GrabbableObject), "PlayDropSFX")]
private static void pre1(ref GrabbableObject __instance)
{
if (item[0] == null || !((Object)(object)__instance != (Object)null) || !(((Object)__instance.itemProperties).name == "MagnifyingGlass") || !((Object)(object)((Component)__instance).GetComponentInChildren<ScanNodeProperties>() != (Object)null))
{
return;
}
for (int i = 0; i < item.Length; i++)
{
if (((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText == item[i])
{
__instance.itemProperties.dropSFX = give[i];
break;
}
}
}
[HarmonyPatch(typeof(PlayerControllerB), "BeginGrabObject")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> trn1(IEnumerable<CodeInstruction> Instrs)
{
List<CodeInstruction> i = new List<CodeInstruction>(Instrs);
for (int j = 0; j < i.Count; j++)
{
yield return i[j];
if (j > 0 && ((object)i[j - 1]).ToString() == "call static float UnityEngine.Mathf::Clamp(float value, float min, float max)" && ((object)i[j]).ToString() == "stfld float GameNetcodeStuff.PlayerControllerB::carryWeight")
{
yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
yield return new CodeInstruction(OpCodes.Ldfld, (object)typeof(PlayerControllerB).GetField("currentlyGrabbingObject", BindingFlags.Instance | BindingFlags.NonPublic));
yield return new CodeInstruction(OpCodes.Call, (object)typeof(minecraft_scraps).GetMethod("grab_item"));
}
}
}
public static void grab_item(GrabbableObject currentlyGrabbingObject)
{
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
if (item[0] == null || !((Object)(object)currentlyGrabbingObject != (Object)null) || !(((Object)currentlyGrabbingObject.itemProperties).name == "MagnifyingGlass") || !((Object)(object)((Component)currentlyGrabbingObject).GetComponentInChildren<ScanNodeProperties>() != (Object)null))
{
return;
}
for (int i = 0; i < item.Length; i++)
{
if (((Component)currentlyGrabbingObject).GetComponentInChildren<ScanNodeProperties>().headerText == item[i])
{
currentlyGrabbingObject.itemProperties.itemName = item[i];
currentlyGrabbingObject.itemProperties.grabSFX = take[i];
if (GameNetworkManager.Instance.isHostingGame)
{
int num = ((i > 15 && i < 20) ? (i - fish.Length) : 4);
currentlyGrabbingObject.itemProperties.positionOffset = ward[num][3];
currentlyGrabbingObject.itemProperties.rotationOffset = ward[num][4];
}
break;
}
}
}
[HarmonyPrefix]
[HarmonyPatch(typeof(GrabbableObject), "GrabItemOnClient")]
private static void pre2(GrabbableObject __instance)
{
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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)
if (item[0] == null || !((Object)(object)__instance != (Object)null) || !(((Object)__instance.itemProperties).name == "MagnifyingGlass") || !((Object)(object)((Component)__instance).GetComponentInChildren<ScanNodeProperties>() != (Object)null))
{
return;
}
for (int i = 0; i < item.Length; i++)
{
if (((Component)__instance).GetComponentInChildren<ScanNodeProperties>().headerText == item[i])
{
int num = ((i > 15 && i < 20) ? (i - fish.Length) : 4);
__instance.itemProperties.positionOffset = ward[num][3];
__instance.itemProperties.rotationOffset = ward[num][4];
}
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(PlayerControllerB), "SwitchToItemSlot")]
private static IEnumerable<CodeInstruction> trn2(IEnumerable<CodeInstruction> Instrs)
{
List<CodeInstruction> i = new List<CodeInstruction>(Instrs);
for (int j = 0; j < i.Count; j++)
{
yield return i[j];
if (j < i.Count - 4 && ((object)i[j + 4]).ToString() == "callvirt virtual void GrabbableObject::EquipItem()")
{
yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
yield return new CodeInstruction(OpCodes.Call, (object)typeof(minecraft_scraps).GetMethod("hold_item"));
}
}
}
public static void hold_item(PlayerControllerB player)
{
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_0172: Unknown result type (might be due to invalid IL or missing references)
GrabbableObject val = player.ItemSlots[player.currentItemSlot];
if (item[0] == null || !((Object)(object)val != (Object)null) || !(((Object)val.itemProperties).name == "MagnifyingGlass") || !((Object)(object)((Component)val).GetComponentInChildren<ScanNodeProperties>() != (Object)null))
{
return;
}
for (int i = 0; i < item.Length; i++)
{
if (!(((Component)val).GetComponentInChildren<ScanNodeProperties>().headerText == item[i]))
{
continue;
}
val.itemProperties.grabSFX = take[i];
PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
if ((Object)(object)player == (Object)(object)localPlayerController || (Object)(object)localPlayerController.ItemSlots[localPlayerController.currentItemSlot] == (Object)null || ((Object)localPlayerController.ItemSlots[localPlayerController.currentItemSlot].itemProperties).name != "MagnifyingGlass" || localPlayerController.isPlayerDead)
{
val.itemProperties.itemName = item[i];
if (val.isHeld || (Object)(object)player != (Object)(object)localPlayerController)
{
int num = ((i > 15 && i < 20) ? (i - fish.Length) : 4);
val.itemProperties.positionOffset = ward[num][3];
val.itemProperties.rotationOffset = ward[num][4];
}
}
break;
}
}
[HarmonyPatch(typeof(HUDManager), "DisplayNewScrapFound")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> trn3(IEnumerable<CodeInstruction> Instrs)
{
List<CodeInstruction> i = new List<CodeInstruction>(Instrs);
for (int j = 0; j < i.Count; j++)
{
if (j < i.Count - 1 && ((object)i[j + 1]).ToString() == "callvirt UnityEngine.Renderer[] UnityEngine.GameObject::GetComponentsInChildren()")
{
yield return new CodeInstruction(OpCodes.Ldarg_0, (object)null);
yield return new CodeInstruction(OpCodes.Ldloc_0, (object)null);
yield return new CodeInstruction(OpCodes.Call, (object)typeof(minecraft_scraps).GetMethod("display_items"));
}
yield return i[j];
}
}
public static void display_items(HUDManager instance, GameObject displayingObject)
{
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
if (item[0] == null || !((Object)(object)instance.itemsToBeDisplayed[0] != (Object)null) || !(((Object)instance.itemsToBeDisplayed[0].itemProperties).name == "MagnifyingGlass") || !(((Object)displayingObject).name == "MagnifyingGlass(Clone)") || !((Object)(object)((Component)instance.itemsToBeDisplayed[0]).GetComponentInChildren<ScanNodeProperties>() != (Object)null))
{
return;
}
for (int i = 0; i < item.Length; i++)
{
if (((Component)instance.itemsToBeDisplayed[0]).GetComponentInChildren<ScanNodeProperties>().headerText == item[i])
{
instance.itemsToBeDisplayed[0].itemProperties.itemName = item[i];
if (i < fish.Length)
{
displayingObject.GetComponent<MeshFilter>().mesh = fish[i];
}
else if (i - fish.Length < tree.Length)
{
int num = i - fish.Length;
Object.Instantiate<Transform>(tree[num]).SetParent(displayingObject.transform);
Transform val = displayingObject.GetComponentsInChildren<Transform>(true)[2];
val.localPosition = ward[num][0];
val.localEulerAngles = ward[num][1];
val.localScale = ward[num][2];
displayingObject.GetComponent<MeshFilter>().mesh = null;
}
break;
}
}
}
[HarmonyPatch(typeof(StartOfRound), "Awake")]
[HarmonyPostfix]
private static void pst2()
{
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
if (!GameNetworkManager.Instance.disableSteam)
{
bool[] array = new bool[2];
disconnected = array;
synced_weights = new int[21]
{
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1
};
if (GameNetworkManager.Instance.currentLobby.HasValue)
{
Lobby value = GameNetworkManager.Instance.currentLobby.Value;
lobbyid = SteamId.op_Implicit(((Lobby)(ref value)).Id) % 1000000000;
yon.mls.LogInfo((object)lobbyid);
}
else
{
yon.mls.LogError((object)"current lobby id is null");
}
}
}
private static void set_item_weights()
{
item_weights[0] = 0;
item_weights[1] = yon.cfg_diamond_block.Value;
item_weights[2] = yon.cfg_spider.Value;
item_weights[3] = yon.cfg_zombie.Value;
item_weights[4] = yon.cfg_villager.Value;
item_weights[5] = yon.cfg_creeper.Value;
item_weights[6] = yon.cfg_pumpkin.Value;
item_weights[7] = yon.cfg_anvil.Value;
item_weights[8] = yon.cfg_steve.Value;
item_weights[9] = yon.cfg_tnt.Value;
item_weights[10] = yon.cfg_diamond.Value;
item_weights[11] = yon.cfg_diamond_sword.Value;
item_weights[12] = yon.cfg_diamond_pickaxe.Value;
item_weights[13] = yon.cfg_apple.Value;
item_weights[14] = yon.cfg_torch.Value;
item_weights[15] = yon.cfg_chest.Value;
item_weights[16] = yon.cfg_pig.Value;
item_weights[17] = yon.cfg_sheep.Value;
item_weights[18] = yon.cfg_cow.Value;
item_weights[19] = yon.cfg_chicken.Value;
item_weights[20] = yon.cfg_bee.Value;
for (int i = 1; i < item_weights.Length; i++)
{
if (item_weights[i] < 0)
{
item_weights[i] = 0;
}
item_weights[0] = item_weights[0] + item_weights[i];
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
private static void pst3()
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Expected O, but got Unknown
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Expected O, but got Unknown
if (!sync)
{
if (NetworkManager.Singleton.IsHost)
{
NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("4902.Minecraft_Scraps-Host", new HandleNamedMessageDelegate(host_receive));
}
else
{
yon.mls.LogInfo((object)"requesting message from host");
NetworkManager.Singleton.CustomMessagingManager.RegisterNamedMessageHandler("4902.Minecraft_Scraps-Client", new HandleNamedMessageDelegate(client_receive));
FastBufferWriter val = default(FastBufferWriter);
((FastBufferWriter)(ref val))..ctor(0, (Allocator)2, -1);
NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("4902.Minecraft_Scraps-Host", 0uL, val, (NetworkDelivery)3);
((FastBufferWriter)(ref val)).Dispose();
}
sync = true;
}
}
private static void host_receive(ulong id, FastBufferReader r)
{
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
if (NetworkManager.Singleton.IsHost)
{
yon.mls.LogInfo((object)"received request from client");
if (item_weights[0] == 0)
{
set_item_weights();
}
string text = string.Join(",", item_weights) + "^" + lobbyid + "^" + seeds;
yon.mls.LogInfo((object)("sending message " + text));
FastBufferWriter val = default(FastBufferWriter);
((FastBufferWriter)(ref val))..ctor(FastBufferWriter.GetWriteSize(text, false), (Allocator)2, -1);
((FastBufferWriter)(ref val)).WriteValueSafe(text, false);
NetworkManager.Singleton.CustomMessagingManager.SendNamedMessage("4902.Minecraft_Scraps-Client", id, val, (NetworkDelivery)4);
((FastBufferWriter)(ref val)).Dispose();
}
}
private static void client_receive(ulong id, FastBufferReader r)
{
if (!NetworkManager.Singleton.IsHost)
{
string text = default(string);
((FastBufferReader)(ref r)).ReadValueSafe(ref text, false);
client_received = true;
yon.mls.LogInfo((object)("client received message " + text));
int num = 2;
if (text.Length - text.Replace("^", "").Length == num)
{
string[] array = text.Split(new char[1] { '^' }, num + 1);
synced_weights = Array.ConvertAll(array[0].Split(new char[1] { ',' }), Convert.ToInt32);
lobbyid = ulong.Parse(array[1]);
seeds = array[2];
}
else
{
yon.mls.LogError((object)"received message was not what was expected. wasn't able to sync variables with host. (are the mod versions not the same?)");
yon.mls.LogError((object)("found " + (text.Length - text.Replace("^", "").Length) + "/" + num + " ^ in message " + text));
}
}
}
[HarmonyPatch(typeof(GameNetworkManager), "Disconnect")]
[HarmonyPrefix]
private static void pre3()
{
disconnected[0] = true;
if ((Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.CustomMessagingManager != null)
{
try
{
NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("4902.Minecraft_Scraps-Host");
NetworkManager.Singleton.CustomMessagingManager.UnregisterNamedMessageHandler("4902.Minecraft_Scraps-Client");
}
catch (Exception ex)
{
yon.mls.LogError((object)ex);
}
}
}
[HarmonyPatch(typeof(GameNetworkManager), "Disconnect")]
[HarmonyPostfix]
private static void pst4()
{
sync = false;
seeds = "nil";
lobbyid = 0uL;
first_item = new bool[3] { true, true, true };
saved_glass = "";
loaded_glass = new List<string>();
synced_weights = new int[21]
{
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1
};
client_received = false;
}
[HarmonyPatch(typeof(GameNetworkManager), "SaveItemsInShip")]
[HarmonyTranspiler]
private static IEnumerable<CodeInstruction> trn4(IEnumerable<CodeInstruction> Instrs)
{
List<CodeInstruction> i = new List<CodeInstruction>(Instrs);
for (int j = 0; j < i.Count; j++)
{
yield return i[j];
if (((object)i[j]).ToString() == "callvirt virtual void System.Collections.Generic.List<UnityEngine.Vector3>::Add(UnityEngine.Vector3 item)")
{
yield return new CodeInstruction(OpCodes.Ldloc_0, (object)null);
yield return new CodeInstruction(OpCodes.Ldloc, (object)6);
yield return new CodeInstruction(OpCodes.Call, (object)typeof(minecraft_scraps).GetMethod("save_glass"));
}
}
}
public static void save_glass(GrabbableObject[] _items, int index)
{
if (yon.cfg_saveseeds.Value && GameNetworkManager.Instance.isHostingGame && !GameNetworkManager.Instance.disableSteam && lobbyid != 0 && ((Object)_items[index].itemProperties).name == "MagnifyingGlass")
{
if ((Object)(object)((Component)_items[index]).GetComponent<ItemTypeSeed>() != (Object)null)
{
ItemTypeSeed component = ((Component)_items[index]).GetComponent<ItemTypeSeed>();
saved_glass = saved_glass + component.seed + "/";
}
else if ((Object)(object)((Component)_items[index]).GetComponent<NetworkObject>() != (Object)null)
{
saved_glass = saved_glass + (lobbyid + ((Component)_items[index]).GetComponent<NetworkObject>().NetworkObjectId) + "/";
yon.mls.LogInfo((object)"ItemTypeSeed is null! saving seed for this item as lobbyid+networkobjectid");
}
else
{
saved_glass = saved_glass + new Shion().next32mm(1, 101) + "/";
yon.mls.LogInfo((object)"ItemTypeSeed and NetworkObject are null! saving seed for this item as a random number from 1 to 100");
}
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GameNetworkManager), "SaveGame")]
private static void pst5()
{
if (!yon.cfg_saveseeds.Value || !GameNetworkManager.Instance.isHostingGame || GameNetworkManager.Instance.disableSteam || !StartOfRound.Instance.inShipPhase || StartOfRound.Instance.isChallengeFile)
{
return;
}
try
{
if (saved_glass == "")
{
saved_glass = "nil";
}
if (saved_glass.EndsWith("/"))
{
saved_glass = saved_glass.Substring(0, saved_glass.Length - 1);
}
yon.mls.LogInfo((object)("saving " + saved_glass));
ES3.Save<string>("4902.Minecraft_Scraps-1", saved_glass, GameNetworkManager.Instance.currentSaveFileName);
saved_glass = "";
}
catch (Exception ex)
{
yon.mls.LogError((object)("Error saving item types: " + ex));
}
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(StartOfRound), "LoadShipGrabbableItems")]
private static IEnumerable<CodeInstruction> trn5(IEnumerable<CodeInstruction> Instrs)
{
List<CodeInstruction> i = new List<CodeInstruction>(Instrs);
for (int j = 0; j < i.Count; j++)
{
yield return i[j];
if (((object)i[j]).ToString() == "callvirt void Unity.Netcode.NetworkObject::Spawn(bool destroyWithScene)")
{
yield return new CodeInstruction(OpCodes.Ldloc_0, (object)null);
yield return new CodeInstruction(OpCodes.Call, (object)typeof(minecraft_scraps).GetMethod("load_glass"));
}
}
}
public static void load_glass(GrabbableObject _item)
{
if (yon.cfg_saveseeds.Value && GameNetworkManager.Instance.isHostingGame && !GameNetworkManager.Instance.disableSteam && lobbyid != 0 && ((Object)_item.itemProperties).name == "MagnifyingGlass")
{
if ((Object)(object)((Component)_item).GetComponent<NetworkObject>() != (Object)null)
{
loaded_glass.Add(((Component)_item).GetComponent<NetworkObject>().NetworkObjectId.ToString());
return;
}
loaded_glass.Add("nil");
yon.mls.LogInfo((object)"NetworkObject is null! the seed can't be loaded for this item");
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(StartOfRound), "Start")]
private static void pst6()
{
if (!yon.cfg_saveseeds.Value || !GameNetworkManager.Instance.isHostingGame || GameNetworkManager.Instance.disableSteam)
{
return;
}
try
{
string text = ES3.Load<string>("4902.Minecraft_Scraps-1", GameNetworkManager.Instance.currentSaveFileName, "nil");
yon.mls.LogInfo((object)("loaded " + text));
string[] array = text.Split(new char[1] { '/' });
if (array[0] != "nil" && array[0] != "" && array.Length == loaded_glass.Count)
{
seeds = "";
for (int i = 0; i < loaded_glass.Count; i++)
{
seeds = seeds + loaded_glass[i] + "." + array[i] + "/";
}
yon.mls.LogInfo((object)("current networkobjectids + saved seeds " + seeds));
}
loaded_glass = new List<string>();
}
catch (Exception ex)
{
yon.mls.LogError((object)("Error loading item types: " + ex));
}
}
static minecraft_scraps()
{
bool[] array = new bool[2];
disconnected = array;
synced_weights = new int[21]
{
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1
};
client_received = false;
saved_glass = "";
loaded_glass = new List<string>();
}
}
public class fish1
{
public static Mesh fish2(Mesh nonReadableMesh)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
Mesh val = new Mesh();
val.indexFormat = nonReadableMesh.indexFormat;
GraphicsBuffer vertexBuffer = nonReadableMesh.GetVertexBuffer(0);
int num = vertexBuffer.stride * vertexBuffer.count;
byte[] array = new byte[num];
vertexBuffer.GetData((Array)array);
val.SetVertexBufferParams(nonReadableMesh.vertexCount, nonReadableMesh.GetVertexAttributes());
val.SetVertexBufferData<byte>(array, 0, 0, num, 0, (MeshUpdateFlags)0);
vertexBuffer.Release();
val.subMeshCount = nonReadableMesh.subMeshCount;
GraphicsBuffer indexBuffer = nonReadableMesh.GetIndexBuffer();
int num2 = indexBuffer.stride * indexBuffer.count;
byte[] array2 = new byte[num2];
indexBuffer.GetData((Array)array2);
val.SetIndexBufferParams(indexBuffer.count, nonReadableMesh.indexFormat);
val.SetIndexBufferData<byte>(array2, 0, 0, num2, (MeshUpdateFlags)0);
indexBuffer.Release();
uint num3 = 0u;
for (int i = 0; i < val.subMeshCount; i++)
{
uint indexCount = nonReadableMesh.GetIndexCount(i);
val.SetSubMesh(i, new SubMeshDescriptor((int)num3, (int)indexCount, (MeshTopology)0), (MeshUpdateFlags)0);
num3 += indexCount;
}
val.RecalculateNormals();
val.RecalculateBounds();
return val;
}
}
public class temporary : MonoBehaviour
{
}
public class ItemTypeSeed : MonoBehaviour
{
public string guid = yon.harmony.Id;
public string seed;
}
public class Shion
{
private ulong[] state;
public Shion()
{
RandomNumberGenerator randomNumberGenerator = RandomNumberGenerator.Create();
byte[] array = new byte[8];
randomNumberGenerator.GetBytes(array, 0, 8);
ulong seed = BitConverter.ToUInt64(array, 0);
xorshift256_init(seed);
}
public Shion(ulong seed)
{
xorshift256_init(seed);
}
public int next32mm(int min, int max)
{
uint num = next32();
double num2 = (double)(max - min) / 4294967295.0;
return (int)((double)min + (double)num * num2);
}
public byte[] next8()
{
ulong value = xoshiro256ss();
return BitConverter.GetBytes(value);
}
public uint next32()
{
byte[] value = next8();
return BitConverter.ToUInt32(value, 0);
}
public ulong next64()
{
return xoshiro256ss();
}
public double next01()
{
ulong num = xoshiro256ss();
return (double)num / 1.8446744073709552E+19;
}
private ulong splitmix64(ulong partialstate)
{
partialstate += 11400714819323198485uL;
partialstate = (partialstate ^ (partialstate >> 30)) * 13787848793156543929uL;
partialstate = (partialstate ^ (partialstate >> 27)) * 10723151780598845931uL;
return partialstate ^ (partialstate >> 31);
}
private void xorshift256_init(ulong seed)
{
ulong[] array = new ulong[4];
array[0] = splitmix64(seed);
array[1] = splitmix64(array[0]);
array[2] = splitmix64(array[1]);
array[3] = splitmix64(array[2]);
state = array;
}
private ulong rotl64(ulong x, int k)
{
return (x << k) | (x >> 64 - k);
}
private ulong xoshiro256ss()
{
ulong result = rotl64(state[1] * 5, 7) * 9;
ulong num = state[1] << 17;
state[2] ^= state[0];
state[3] ^= state[1];
state[1] ^= state[2];
state[0] ^= state[3];
state[2] ^= num;
state[3] = rotl64(state[3], 45);
return result;
}
}