Decompiled source of SakeysCozyClutter v1.0.0

BepInEx/plugins/Sakey's Cozy Clutter/Sakey's Cozy Clutter.dll

Decompiled 3 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using Jotunn.Configs;
using Jotunn.Entities;
using Jotunn.Managers;
using Jotunn.Utils;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyCompany("Sakey's Cozy Clutter")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Sakey's Cozy Clutter")]
[assembly: AssemblyTitle("Sakey's Cozy Clutter")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SakeysClutter;

[BepInPlugin("com.sakey.clutter", "Sakey's Cozy Clutter", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class SakeysClutterPlugin : BaseUnityPlugin
{
	private class ClutterItemData
	{
		public string PrefabName;

		public string AssetName;

		public string IconName;

		public string NameKey;

		public string DescriptionKey;

		public string DisplayName;

		public string Description;

		public string Category;

		public string Material;

		public int Amount;

		public int Comfort;
	}

	public const string PluginGUID = "com.sakey.clutter";

	public const string PluginName = "Sakey's Cozy Clutter";

	public const string PluginVersion = "1.0.0";

	private const string LOG_PREFIX = "[Sakey's Cozy Clutter]";

	public const string ASSET_BUNDLE_NAME = "cozyclutter";

	public static AssetBundle AssetBundle;

	public const string TOOL_PREFAB_NAME = "SakeysClutterTool";

	public const string TOOL_MODEL_NAME = "clutter_tool";

	public const string TOOL_ICON_NAME = "icon_clutter_tool";

	public const string PIECE_TABLE_NAME = "SakeysClutterTable";

	private readonly ClutterItemData[] clutterItems = new ClutterItemData[45]
	{
		new ClutterItemData
		{
			PrefabName = "DollDverger",
			AssetName = "doll_dverger",
			IconName = "icon_doll_dverger",
			NameKey = "$DollDverger",
			DescriptionKey = "$DollDvergerDesc",
			DisplayName = "ドヴェルグのぬいぐるみ",
			Description = "ドヴェルグを模したかわいいぬいぐるみ。",
			Category = "Doll",
			Material = "Wood",
			Amount = 1,
			Comfort = 1
		},
		new ClutterItemData
		{
			PrefabName = "DollDvergerBig",
			AssetName = "doll_dvergerbig",
			IconName = "icon_doll_dvergerbig",
			NameKey = "$DollDvergerBig",
			DescriptionKey = "$DollDvergerBigDesc",
			DisplayName = "ドヴェルグのBIGぬいぐるみ",
			Description = "ドヴェルグを模した大きなぬいぐるみ。",
			Category = "Doll",
			Material = "Wood",
			Amount = 1,
			Comfort = 2
		},
		new ClutterItemData
		{
			PrefabName = "DollTroll",
			AssetName = "doll_troll",
			IconName = "icon_doll_troll",
			NameKey = "$DollTroll",
			DescriptionKey = "$DollTrollDesc",
			DisplayName = "トロルのぬいぐるみ",
			Description = "トロルを模したかわいいぬいぐるみ。",
			Category = "Doll",
			Material = "Wood",
			Amount = 1,
			Comfort = 1
		},
		new ClutterItemData
		{
			PrefabName = "DollTrollBig",
			AssetName = "doll_trollbig",
			IconName = "icon_doll_trollbig",
			NameKey = "$DollTrollBig",
			DescriptionKey = "$DollTrollBigDesc",
			DisplayName = "トロルのBIGぬいぐるみ",
			Description = "トロルを模した大きなぬいぐるみ。",
			Category = "Doll",
			Material = "Wood",
			Amount = 1,
			Comfort = 2
		},
		new ClutterItemData
		{
			PrefabName = "DollRion",
			AssetName = "doll_rion",
			IconName = "icon_doll_rion",
			NameKey = "$DollRion",
			DescriptionKey = "$DollRionDesc",
			DisplayName = "りおんのぬいぐるみ",
			Description = "Vtuber幸島梨苑のかわいいぬいぐるみ。",
			Category = "Doll",
			Material = "Wood",
			Amount = 1,
			Comfort = 1
		},
		new ClutterItemData
		{
			PrefabName = "DollRionBig",
			AssetName = "doll_rionbig",
			IconName = "icon_doll_rionbig",
			NameKey = "$DollRionBig",
			DescriptionKey = "$DollRionBigDesc",
			DisplayName = "りおんBIGぬいぐるみ",
			Description = "Vtuber幸島梨苑のBIGぬいぐるみ。",
			Category = "Doll",
			Material = "Wood",
			Amount = 1,
			Comfort = 2
		},
		new ClutterItemData
		{
			PrefabName = "DollEikthyr",
			AssetName = "doll_eikthyr",
			IconName = "icon_doll_eikthyr",
			NameKey = "$DollEikthyr",
			DescriptionKey = "$DollEikthyrDesc",
			DisplayName = "エイクスュルのぬいぐるみ",
			Description = "エイクスュルを模したかわいいぬいぐるみ。",
			Category = "Doll",
			Material = "Wood",
			Amount = 1,
			Comfort = 1
		},
		new ClutterItemData
		{
			PrefabName = "DollEikthyrBIG",
			AssetName = "doll_eikthyrbig",
			IconName = "icon_doll_eikthyrbig",
			NameKey = "$DollEikthyrBig",
			DescriptionKey = "$DollEikthyrBigDesc",
			DisplayName = "エイクスュルのBIGぬいぐるみ",
			Description = "エイクスュルを模した大きいかわいいぬいぐるみ。",
			Category = "Doll",
			Material = "Wood",
			Amount = 1,
			Comfort = 2
		},
		new ClutterItemData
		{
			PrefabName = "DollGoblin",
			AssetName = "doll_goblin",
			IconName = "icon_doll_goblin",
			NameKey = "$DollGoblin",
			DescriptionKey = "$DollGoblinDesc",
			DisplayName = "フーリングのぬいぐるみ",
			Description = "フーリングを模したかわいいぬいぐるみ。",
			Category = "Doll",
			Material = "Wood",
			Amount = 1,
			Comfort = 1
		},
		new ClutterItemData
		{
			PrefabName = "DollGoblinBig",
			AssetName = "doll_goblinbig",
			IconName = "icon_doll_goblinbig",
			NameKey = "$DollGoblinBig",
			DescriptionKey = "$DollGoblinBigDesc",
			DisplayName = "フーリングのBIGぬいぐるみ",
			Description = "フーリングを模した大きなぬいぐるみ。",
			Category = "Doll",
			Material = "Wood",
			Amount = 1,
			Comfort = 2
		},
		new ClutterItemData
		{
			PrefabName = "DollNeck",
			AssetName = "doll_neck",
			IconName = "icon_doll_neck",
			NameKey = "$DollNeck",
			DescriptionKey = "$DollNeckDesc",
			DisplayName = "ネックのぬいぐるみ",
			Description = "星2のネックを模したかわいいぬいぐるみ。",
			Category = "Doll",
			Material = "Wood",
			Amount = 1,
			Comfort = 1
		},
		new ClutterItemData
		{
			PrefabName = "DollNeckBig",
			AssetName = "doll_neckbig",
			IconName = "icon_doll_neckbig",
			NameKey = "$DollNeckBig",
			DescriptionKey = "$DollNeckBigDesc",
			DisplayName = "ネックのBIGぬいぐるみ",
			Description = "星2のネックを模した大きなぬいぐるみ。",
			Category = "Doll",
			Material = "Wood",
			Amount = 1,
			Comfort = 2
		},
		new ClutterItemData
		{
			PrefabName = "DollGreyling",
			AssetName = "doll_greyling",
			IconName = "icon_doll_greyling",
			NameKey = "$DollGreyling",
			DescriptionKey = "$DollGreylingDesc",
			DisplayName = "グレイリングのぬいぐるみ",
			Description = "グレイリングを模したぬいぐるみ。",
			Category = "Doll",
			Material = "Wood",
			Amount = 1,
			Comfort = 1
		},
		new ClutterItemData
		{
			PrefabName = "DollSheep",
			AssetName = "doll_sheep",
			IconName = "icon_doll_sheep",
			NameKey = "$DollSheep",
			DescriptionKey = "$DollSheepDesc",
			DisplayName = "おやすみ羊のぬいぐるみ",
			Description = "眠る羊のぬいぐるみ。",
			Category = "Doll",
			Material = "Wood",
			Amount = 1,
			Comfort = 1
		},
		new ClutterItemData
		{
			PrefabName = "DollModer",
			AssetName = "doll_moder",
			IconName = "icon_doll_moder",
			NameKey = "$DollModer",
			DescriptionKey = "$DollModerDesc",
			DisplayName = "モデルのぬいぐるみ",
			Description = "モデルを模したかわいいぬいぐるみ。",
			Category = "Doll",
			Material = "Wood",
			Amount = 1,
			Comfort = 1
		},
		new ClutterItemData
		{
			PrefabName = "DollModerBig",
			AssetName = "doll_moderbig",
			IconName = "icon_doll_moderbig",
			NameKey = "$DollModerBig",
			DescriptionKey = "$DollModerBigDesc",
			DisplayName = "モデルのBIGぬいぐるみ",
			Description = "モデルを模した大きなぬいぐるみ。",
			Category = "Doll",
			Material = "Wood",
			Amount = 1,
			Comfort = 2
		},
		new ClutterItemData
		{
			PrefabName = "DollElder",
			AssetName = "doll_elder",
			IconName = "icon_doll_elder",
			NameKey = "$DollElder",
			DescriptionKey = "$DollElderDesc",
			DisplayName = "長老のぬいぐるみ",
			Description = "長老を模したかわいいぬいぐるみ。",
			Category = "Doll",
			Material = "Wood",
			Amount = 1,
			Comfort = 1
		},
		new ClutterItemData
		{
			PrefabName = "DollElderBig",
			AssetName = "doll_elderbig",
			IconName = "icon_doll_elderbig",
			NameKey = "$DollElderBig",
			DescriptionKey = "$DollElderBigDesc",
			DisplayName = "長老のBIGぬいぐるみ",
			Description = "長老を模した大きなぬいぐるみ。",
			Category = "Doll",
			Material = "Wood",
			Amount = 1,
			Comfort = 2
		},
		new ClutterItemData
		{
			PrefabName = "HobbyDiscoball",
			AssetName = "hobby_discoball",
			IconName = "icon_hobbydiscoball",
			NameKey = "$HobbyDiscoball",
			DescriptionKey = "$HobbyDiscoballDesc",
			DisplayName = "ミラーボール",
			Description = "パーティーピーポー。",
			Category = "Hobby",
			Material = "Stone",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyTank1",
			AssetName = "hobby_tank1",
			IconName = "icon_hobbytank1",
			NameKey = "$HobbyTank1",
			DescriptionKey = "$HobbyTank1Desc",
			DisplayName = "ミリタリーフィギュア",
			Description = "小さな飾り。",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyGamepad1",
			AssetName = "hobby_gamepad1",
			IconName = "icon_hobbygamepad1",
			NameKey = "$HobbyGamepad1",
			DescriptionKey = "$HobbyGamepad1Desc",
			DisplayName = "ゲームのコントローラー",
			Description = "ゲームには欠かせない。",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyGamepad2",
			AssetName = "hobby_gamepad2",
			IconName = "icon_hobbygamepad2",
			NameKey = "$HobbyGamepad2",
			DescriptionKey = "$HobbyGamepad2Desc",
			DisplayName = "ゲームのコントローラー",
			Description = "ボタン表記に混乱する。",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyHeadset1",
			AssetName = "hobby_headset1",
			IconName = "icon_hobbyheadset1",
			NameKey = "$HobbyHeadset1",
			DescriptionKey = "$HobbyHeadset1Desc",
			DisplayName = "猫耳ヘッドホン",
			Description = "猫耳ヘッドセット。ゲーマー向け。",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyHeadset2",
			AssetName = "hobby_headset2",
			IconName = "icon_hobbyheadset2",
			NameKey = "$HobbyHeadset2",
			DescriptionKey = "$HobbyHeadset2Desc",
			DisplayName = "ゲーミング用ヘッドセット",
			Description = "マイク付きヘッドセット。ゲーマー向け。",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyKeyblue",
			AssetName = "hobby_keyblue",
			IconName = "icon_hobbykeyblue",
			NameKey = "$HobbyKeyblue",
			DescriptionKey = "$HobbyKeyblueDesc",
			DisplayName = "PC用キーボード(青)",
			Description = "青色のキーボード",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyKeygreen",
			AssetName = "hobby_keygreen",
			IconName = "icon_hobbykeygreen",
			NameKey = "$HobbyKeygreen",
			DescriptionKey = "$HobbyKeygreenDesc",
			DisplayName = "PC用キーボード(緑)",
			Description = "緑色のキーボード",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyKeypink",
			AssetName = "hobby_keypink",
			IconName = "icon_hobbykeypink",
			NameKey = "$HobbyKeypink",
			DescriptionKey = "$HobbyKeypinkDesc",
			DisplayName = "PC用キーボード(ピンク)",
			Description = "ピンク色のキーボード",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyKeypurple",
			AssetName = "hobby_keypurple",
			IconName = "icon_hobbykeypurple",
			NameKey = "$HobbyKeypurple",
			DescriptionKey = "$HobbyKeypurpleDesc",
			DisplayName = "PC用キーボード(パープル)",
			Description = "パープル色のキーボード",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyKeyred",
			AssetName = "hobby_keyred",
			IconName = "icon_hobbykeyred",
			NameKey = "$HobbyKeyred",
			DescriptionKey = "$HobbyKeyredDesc",
			DisplayName = "PC用キーボード(赤)",
			Description = "赤いキーボード",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyKeywhite",
			AssetName = "hobby_keywhite",
			IconName = "icon_hobbykeywhite",
			NameKey = "$HobbyKeywhite",
			DescriptionKey = "$HobbyKeywhiteDesc",
			DisplayName = "PC用キーボード(黒)",
			Description = "黒のキーボード",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyMouse",
			AssetName = "hobby_mouse",
			IconName = "icon_hobbymouse",
			NameKey = "$Hobbymouse",
			DescriptionKey = "$HobbymouseDesc",
			DisplayName = "PC用の無線マウス",
			Description = "動きが悪いとストレスになります。",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyPCblue",
			AssetName = "hobby_pcblue",
			IconName = "icon_hobbypcblue",
			NameKey = "$HobbyPCblue",
			DescriptionKey = "$HobbypcblueDesc",
			DisplayName = "ゲーミングPC(青)",
			Description = "時々エアダスターで掃除してあげましょう。",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyPCgreen",
			AssetName = "hobby_pcgreen",
			IconName = "icon_hobbypcgreen",
			NameKey = "$HobbyPCgreen",
			DescriptionKey = "$HobbypcgreenDesc",
			DisplayName = "ゲーミングPC(緑)",
			Description = "メモリの増設が高すぎて出来ない。",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyPCpink",
			AssetName = "hobby_pcpink",
			IconName = "icon_hobbypcpink",
			NameKey = "$HobbyPCpink",
			DescriptionKey = "$HobbypcpinkDesc",
			DisplayName = "ゲーミングPC(ピンク)",
			Description = "常に空き容量との闘い。",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyPCpurple",
			AssetName = "hobby_pcpurple",
			IconName = "icon_hobbypcpurple",
			NameKey = "$HobbyPCpurple",
			DescriptionKey = "$HobbypcpurpleDesc",
			DisplayName = "ゲーミングPC(パープル)",
			Description = "MOD入れ過ぎて重い。",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyPCred",
			AssetName = "hobby_pcred",
			IconName = "icon_hobbypcred",
			NameKey = "$HobbyPCred",
			DescriptionKey = "$HobbypcredDesc",
			DisplayName = "ゲーミングPC(赤)",
			Description = "更新後にOBSの音声周りのチェック。",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyPCwhite",
			AssetName = "hobby_pcwhite",
			IconName = "icon_hobbypcwhite",
			NameKey = "$HobbyPCwhite",
			DescriptionKey = "$HobbypcwhiteDesc",
			DisplayName = "ゲーミングPC(黒)",
			Description = "とりあえずSteam見ちゃう。",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyPCmoniter",
			AssetName = "hobby_pcmoniter",
			IconName = "icon_hobbypcmoniter",
			NameKey = "$Hobbypcmoniter",
			DescriptionKey = "$HobbypcmoniterDesc",
			DisplayName = "パソコンモニター",
			Description = "Valheimを起動中。",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyPCretro",
			AssetName = "hobby_pcretro",
			IconName = "icon_hobbypcretro",
			NameKey = "$Hobbypcretro",
			DescriptionKey = "$HobbypcretroDesc",
			DisplayName = "レトロなパソコン",
			Description = "98か95ぐらいかな?",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyPentab",
			AssetName = "hobby_pentab",
			IconName = "icon_hobbypentab",
			NameKey = "$HobbyPentab",
			DescriptionKey = "$HobbyPentabDesc",
			DisplayName = "ペンタブレット",
			Description = "絵描きには必須。",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "HobbyMicro",
			AssetName = "hobby_micro",
			IconName = "icon_hobbymicro",
			NameKey = "$HobbyMicro",
			DescriptionKey = "$HobbymicroDesc",
			DisplayName = "マイク",
			Description = "PC用マイク。",
			Category = "Hobby",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "FoodApple",
			AssetName = "food_apple",
			IconName = "icon_foodapple",
			NameKey = "$FoodApple",
			DescriptionKey = "$FoodappleDesc",
			DisplayName = "りんご箱",
			Description = "青りんごの入った箱。",
			Category = "Foods",
			Material = "Raspberry",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "FoodLafrance",
			AssetName = "food_lafrance",
			IconName = "icon_foodlafrance",
			NameKey = "$FoodLafrance",
			DescriptionKey = "$FoodlafranceDesc",
			DisplayName = "洋ナシの箱",
			Description = "洋ナシの入った箱。",
			Category = "Foods",
			Material = "Raspberry",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "GardenRose",
			AssetName = "garden_rose",
			IconName = "icon_gardenrose",
			NameKey = "$GardenRose",
			DescriptionKey = "$GardenroseDesc",
			DisplayName = "バラの花瓶",
			Description = "赤いバラの花瓶。",
			Category = "Garden",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		},
		new ClutterItemData
		{
			PrefabName = "GardenPlant",
			AssetName = "garden_plant",
			IconName = "icon_gardenplant",
			NameKey = "$GardenPlant",
			DescriptionKey = "$GardenplantDesc",
			DisplayName = "ヤシの鉢植え",
			Description = "室内観葉植物。",
			Category = "Garden",
			Material = "Wood",
			Amount = 1,
			Comfort = 0
		}
	};

	private static ConfigEntry<bool> enableClutterTool;

	private void Awake()
	{
		//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Expected O, but got Unknown
		//IL_0127: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[Sakey's Cozy Clutter] 起動しました。");
		enableClutterTool = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "EnableClutterTool", true, "家具作成ツールを有効にするかどうか");
		string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "cozyclutter");
		((BaseUnityPlugin)this).Logger.LogInfo((object)("[Sakey's Cozy Clutter] AssetBundle読み込み開始: " + text));
		try
		{
			AssetBundle = AssetUtils.LoadAssetBundle(text);
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("[Sakey's Cozy Clutter] AssetBundleの読み込み中に例外が発生しました:\n" + ex));
			AssetBundle = null;
		}
		if ((Object)(object)AssetBundle == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("[Sakey's Cozy Clutter] AssetBundleの読み込みに失敗しました:\n" + text));
			return;
		}
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[Sakey's Cozy Clutter] AssetBundle loaded: cozyclutter");
		try
		{
			PieceManager instance = PieceManager.Instance;
			PieceTableConfig val = new PieceTableConfig();
			val.CanRemovePieces = true;
			val.UseCategories = false;
			val.UseCustomCategories = true;
			val.CustomCategories = new string[5] { "Doll", "Hobby", "Foods", "Garden", "Other" };
			instance.AddPieceTable(new CustomPieceTable("SakeysClutterTable", val));
			((BaseUnityPlugin)this).Logger.LogInfo((object)"[Sakey's Cozy Clutter] 専用PieceTableを登録しました。");
		}
		catch (Exception ex2)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("[Sakey's Cozy Clutter] PieceTable登録中に例外が発生しました:\n" + ex2));
			return;
		}
		LocalizationManager.OnLocalizationAdded += AddCustomLocalizations;
		AddCustomLocalizations();
		PrefabManager.OnPrefabsRegistered += OnPrefabsRegistered;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[Sakey's Cozy Clutter] 初期化処理が完了しました。");
	}

	private void OnDestroy()
	{
		PrefabManager.OnPrefabsRegistered -= OnPrefabsRegistered;
		LocalizationManager.OnLocalizationAdded -= AddCustomLocalizations;
		AssetBundle = null;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[Sakey's Cozy Clutter] 終了しました。");
	}

	private void AddCustomLocalizations()
	{
		try
		{
			CustomLocalization localization = LocalizationManager.Instance.GetLocalization();
			string text = "Japanese";
			localization.AddTranslation(ref text, new Dictionary<string, string>
			{
				{ "SakeysClutterTool", "ツール CozyTool Stick" },
				{ "SakeysClutterToolDesc", "Sakey's Cozy Clutterのツール。雑多な家具や飾りを設置するための道具。" },
				{ "DollDverger", "ドヴェルグのぬいぐるみ" },
				{ "DollDvergerDesc", "ドヴェルグを模したかわいいぬいぐるみ。" },
				{ "DollDvergerBig", "ドヴェルグのBIGぬいぐるみ" },
				{ "DollDvergerBigDesc", "ドヴェルグを模した大きなぬいぐるみ。" },
				{ "DollTroll", "トロルのぬいぐるみ" },
				{ "DollTrollDesc", "トロルを模したかわいいぬいぐるみ。" },
				{ "DollTrollBig", "トロルのBIGぬいぐるみ" },
				{ "DollTrollBigDesc", "トロルを模した大きいぬいぐるみ。" },
				{ "DollRion", "りおんぬいぐるみ" },
				{ "DollRionDesc", "Vtuber幸島梨苑のぬいぐるみ。https://www.youtube.com/@kojima-rion/featured" },
				{ "DollRionBig", "りおんのBIGぬいぐるみ" },
				{ "DollRionBigDesc", "Vtuber幸島梨苑のBIGぬいぐるみ。https://www.youtube.com/@kojima-rion/featured" },
				{ "DollEikthyr", "エイクスュルのぬいぐるみ" },
				{ "DollEikthyrDesc", "エイクスュルを模したかわいいぬいぐるみ。" },
				{ "DollEikthyrBig", "エイクスュルのBIGぬいぐるみ" },
				{ "DollEikthyrBigDesc", "エイクスュルを模した大きいぬいぐるみ。" },
				{ "DollGoblin", "フーリングのぬいぐるみ" },
				{ "DollGoblinDesc", "フーリングを模したかわいいぬいぐるみ。" },
				{ "DollGoblinBig", "フーリングのBIGぬいぐるみ" },
				{ "DollGoblinBigDesc", "フーリングを模した大きいぬいぐるみ。" },
				{ "DollGreyling", "グレイリングのぬいぐるみ" },
				{ "DollGreylingDesc", "グレイリングを模したかわいいぬいぐるみ。" },
				{ "DollNeck", "ネックのぬいぐるみ" },
				{ "DollNeckDesc", "星2ネックを模したかわいいぬいぐるみ。" },
				{ "DollNeckBig", "ネックのBIGぬいぐるみ" },
				{ "DollNeckBigDesc", "星2ネックを模した大きいぬいぐるみ。" },
				{ "DollSheep", "おやすみ羊のぬいぐるみ" },
				{ "DollSheepDesc", "おやすみ羊のかわいいぬいぐるみ。" },
				{ "DollModer", "モデルのぬいぐるみ" },
				{ "DollModerDesc", "モデルを模したかわいいぬいぐるみ。" },
				{ "DollModerBig", "モデルのBIGぬいぐるみ" },
				{ "DollModerBigDesc", "モデルを模した大きいぬいぐるみ。" },
				{ "DollElder", "長老のぬいぐるみ" },
				{ "DollElderDesc", "長老を模したかわいいぬいぐるみ。" },
				{ "DollElderBig", "長老のBIGぬいぐるみ" },
				{ "DollElderBigDesc", "長老を模した大きいぬいぐるみ。" },
				{ "HobbyDiscoball", "ディスコボール" },
				{ "HobbyDiscoballDesc", "ミラーボール" },
				{ "HobbyTank1", "ミリタリーフィギュア" },
				{ "HobbyTank1Desc", "のってきたぞ~!" },
				{ "HobbyGamepad1", "ゲームコントローラー" },
				{ "HobbyGamepad1Desc", "ゲーム用のコントローラー" },
				{ "HobbyGamepad2", "ゲームコントローラー" },
				{ "HobbyGamepad2Desc", "ゲーム用のコントローラー" },
				{ "HobbyHeadset1", "猫耳ヘッドホン" },
				{ "HobbyHeadset1Desc", "猫耳付きの飾りヘッドセット" },
				{ "HobbyHeadset2", "マイク付きゲーミングヘッドセット" },
				{ "HobbyHeadset2Desc", "マルチプレイやボイスチャットには欠かせない" },
				{ "HobbyKeyblue", "PC用キーボード(青)" },
				{ "HobbyKeyblueDesc", "青色のキーボード" },
				{ "HobbyKeygreen", "PC用キーボード(緑)" },
				{ "HobbyKeygreenDesc", "緑色のキーボード" },
				{ "HobbyKeypink", "PC用キーボード(ピンク)" },
				{ "HobbyKeypinkDesc", "ピンク色のキーボード" },
				{ "HobbyKeypurple", "PC用キーボード(パープル)" },
				{ "HobbyKeypurpleDesc", "紫色のキーボード" },
				{ "HobbyKeyred", "PC用キーボード(赤)" },
				{ "HobbyKeyredDesc", "赤いキーボード" },
				{ "HobbyKeywhite", "PC用キーボード(黒)" },
				{ "HobbyKeywhiteDesc", "黒のキーボード" },
				{ "Hobbymouse", "PC用のマウス" },
				{ "HobbymouseDesc", "動きが悪いとストレスになります。" },
				{ "HobbyMicro", "マイク" },
				{ "HobbymicroDesc", "PC用マイク" },
				{ "HobbyPCblue", "ゲーミングPC(青)" },
				{ "HobbypcblueDesc", "時々エアダスターで掃除してあげましょう。" },
				{ "HobbyPCgreen", "ゲーミングPC(緑)" },
				{ "HobbypcgreenDesc", "メモリの増設が高すぎて出来ない。" },
				{ "HobbyPCpink", "ゲーミングPC(ピンク)" },
				{ "HobbypcpinkDesc", "常に空き容量との闘い。" },
				{ "HobbyPCpurple", "ゲーミングPC(パープル)" },
				{ "HobbypcpurpleDesc", "MOD入れ過ぎて重い。" },
				{ "HobbyPCred", "ゲーミングPC(赤)" },
				{ "HobbypcredDesc", "更新後にOBSの音声周りのチェック" },
				{ "HobbyPCwhite", "ゲーミングPC(黒)" },
				{ "HobbypcwhiteDesc", "とりあえずSteam見ちゃう" },
				{ "Hobbypcmoniter", "パソコンモニター" },
				{ "HobbypcmoniterDesc", "Valheimを起動中" },
				{ "Hobbypcretro", "レトロなパソコン" },
				{ "HobbypcretroDesc", "98か95ぐらいかな?" },
				{ "HobbyPentab", "ペンタブレット" },
				{ "HobbyPentabDesc", "絵描きには必須" },
				{ "GardenRose", "バラの鉢植え" },
				{ "GardenroseDesc", "バラの鉢植え" },
				{ "GardenPlant", "ヤシの鉢植え" },
				{ "GardenplantDesc", "室内観葉植物" },
				{ "FoodApple", "リンゴ" },
				{ "FoodappleDesc", "箱に入った青りんご" },
				{ "FoodLafrance", "洋ナシ" },
				{ "FoodlafranceDesc", "洋ナシの入ったカゴ" },
				{ "jotunn_cat_doll", "Doll" },
				{ "jotunn_cat_hobby", "Hobby" },
				{ "jotunn_cat_foods", "Foods" },
				{ "jotunn_cat_garden", "Garden" },
				{ "jotunn_cat_other", "Other" }
			});
			text = "English";
			localization.AddTranslation(ref text, new Dictionary<string, string>
			{
				{ "SakeysClutterTool", "CozyTool Stick" },
				{ "SakeysClutterToolDesc", "A tool for placing various decorative furniture and clutter. (Sakey's Cozy Clutter)" },
				{ "DollDverger", "Dvergr Plushie" },
				{ "DollDvergerDesc", "A cute plushie modeled after a Dvergr." },
				{ "DollDvergerBig", "Big Dvergr Plushie" },
				{ "DollDvergerBigDesc", "A large plushie modeled after a Dvergr." },
				{ "DollTroll", "Troll Plushie" },
				{ "DollTrollDesc", "A cute plushie modeled after a Troll." },
				{ "DollTrollBig", "Big Troll Plushie" },
				{ "DollTrollBigDesc", "A large plushie modeled after a Troll." },
				{ "DollRion", "Rion Plushie" },
				{ "DollRionDesc", "A cute plushie modeled after Japanese Vtuber Kojima Rion. https://www.youtube.com/@kojima-rion/featured" },
				{ "DollRionBig", "Rion BIG Plushie" },
				{ "DollRionBigDesc", "A large Rion plushie. Japanese Vtuber Kojima Rion. https://www.youtube.com/@kojima-rion/featured" },
				{ "DollGreyling", "Greyling Plushie" },
				{ "DollGreylingDesc", "A cute plushie modeled after a Greyling." },
				{ "DollGoblin", "Goblin Plushie" },
				{ "DollGoblinDesc", "A cute plushie modeled after a Goblin." },
				{ "DollGoblinBig", "Big Goblin Plushie" },
				{ "DollGoblinBigDesc", "A large plushie modeled after a Goblin." },
				{ "DollNeck", "Neck Plushie" },
				{ "DollNeckDesc", "A cute plushie modeled after a Neck." },
				{ "DollNeckBig", "Big Neck Plushie" },
				{ "DollNeckBigDesc", "A large plushie modeled after a Neck." },
				{ "DollEikthyr", "Eikthyr Plushie" },
				{ "DollEikthyrDesc", "A cute plushie modeled after Eikthyr." },
				{ "DollEikthyrBig", "Big Eikthyr Plushie" },
				{ "DollEikthyrBigDesc", "A large plushie modeled after Eikthyr." },
				{ "DollElder", "Elder Plushie" },
				{ "DollElderDesc", "A cute plushie modeled after the Elder." },
				{ "DollElderBig", "Big Elder Plushie" },
				{ "DollElderBigDesc", "A large plushie modeled after the Elder." },
				{ "DollModer", "Moder Plushie" },
				{ "DollModerDesc", "A cute plushie modeled after Moder." },
				{ "DollModerBig", "Big Moder Plushie" },
				{ "DollModerBigDesc", "A large plushie modeled after Moder." },
				{ "DollSheep", "Sleep Sheep Plushie" },
				{ "DollSheepDesc", "A cute sleeping sheep plushie." },
				{ "HobbyDiscoball", "Disco Ball" },
				{ "HobbyDiscoballDesc", "Mirror ball" },
				{ "HobbyTank1", "Military Figure" },
				{ "HobbyTank1Desc", "Military figure" },
				{ "HobbyGamepad1", "Game Controller 1" },
				{ "HobbyGamepad1Desc", "Gaming controller" },
				{ "HobbyGamepad2", "Game Controller 2" },
				{ "HobbyGamepad2Desc", "Gaming controller" },
				{ "HobbyHeadset1", "Cat Ear Headphones" },
				{ "HobbyHeadset1Desc", "Decorative cat-ear headset" },
				{ "HobbyHeadset2", "Gaming Headset" },
				{ "HobbyHeadset2Desc", "Essential for multiplayer and voice chat" },
				{ "HobbyKeyblue", "PC Keyboard (Blue)" },
				{ "HobbyKeyblueDesc", "Blue keyboard" },
				{ "HobbyKeygreen", "PC Keyboard (Green)" },
				{ "HobbyKeygreenDesc", "Green keyboard" },
				{ "HobbyKeypink", "PC Keyboard (Pink)" },
				{ "HobbyKeypinkDesc", "Pink keyboard" },
				{ "HobbyKeypurple", "PC Keyboard (Purple)" },
				{ "HobbyKeypurpleDesc", "Purple keyboard" },
				{ "HobbyKeyred", "PC Keyboard (Red)" },
				{ "HobbyKeyredDesc", "Red keyboard" },
				{ "HobbyKeywhite", "PC Keyboard (Black & White)" },
				{ "HobbyKeywhiteDesc", "Black and white keyboard" },
				{ "Hobbymouse", "PC Mouse" },
				{ "HobbymouseDesc", "A PC mouse" },
				{ "HobbyMicro", "Microphone" },
				{ "HobbymicroDesc", "PC microphone" },
				{ "HobbyPCblue", "Gaming PC (Blue)" },
				{ "HobbypcblueDesc", "Gaming PC" },
				{ "HobbyPCgreen", "Gaming PC (Green)" },
				{ "HobbypcgreenDesc", "Gaming PC" },
				{ "HobbyPCpink", "Gaming PC (Pink)" },
				{ "HobbypcpinkDesc", "Gaming PC" },
				{ "HobbyPCpurple", "Gaming PC (Purple)" },
				{ "HobbypcpurpleDesc", "Gaming PC" },
				{ "HobbyPCred", "Gaming PC (Red)" },
				{ "HobbypcredDesc", "Gaming PC" },
				{ "HobbyPCwhite", "Gaming PC (Black & White)" },
				{ "HobbypcwhiteDesc", "Gaming PC" },
				{ "Hobbypcmoniter", "PC Monitor" },
				{ "HobbypcmoniterDesc", "PC Monitor" },
				{ "Hobbypcretro", "Retro PC" },
				{ "HobbypcretroDesc", "Maybe Windows 98 or 95?" },
				{ "HobbyPentab", "Pen Tablet" },
				{ "HobbyPentabDesc", "Essential for drawing" },
				{ "GardenRose", "Rose" },
				{ "GardenroseDesc", "Rose in a vase" },
				{ "GardenPlant", "Plant" },
				{ "GardenplantDesc", "Indoor plant" },
				{ "FoodApple", "Apple" },
				{ "FoodAppleDesc", "Green apples in a box" },
				{ "FoodLafrance", "La France Pear" },
				{ "FoodlafranceDesc", "La France pears in a basket" },
				{ "jotunn_cat_doll", "Doll" },
				{ "jotunn_cat_hobby", "Hobby" },
				{ "jotunn_cat_foods", "Foods" },
				{ "jotunn_cat_garden", "Garden" },
				{ "jotunn_cat_other", "Other" }
			});
			((BaseUnityPlugin)this).Logger.LogInfo((object)"[Sakey's Cozy Clutter] 日本語・英語のLocalizationを登録しました。");
		}
		catch (Exception ex)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("[Sakey's Cozy Clutter] Localization登録中にエラー:\n" + ex));
		}
	}

	private void OnPrefabsRegistered()
	{
		PrefabManager.OnPrefabsRegistered -= OnPrefabsRegistered;
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[Sakey's Cozy Clutter] Prefab登録処理を開始します。");
		try
		{
			if (enableClutterTool.Value)
			{
				((BaseUnityPlugin)this).Logger.LogInfo((object)"[Sakey's Cozy Clutter] 家具作成ツール登録開始。");
				CreateClutterTool();
			}
			int num = 0;
			int num2 = 0;
			ClutterItemData[] array = clutterItems;
			foreach (ClutterItemData clutterItemData in array)
			{
				if (clutterItemData == null)
				{
					((BaseUnityPlugin)this).Logger.LogError((object)"[Sakey's Cozy Clutter] 家具データがnullです。");
					num2++;
					continue;
				}
				((BaseUnityPlugin)this).Logger.LogInfo((object)("[Sakey's Cozy Clutter] 家具登録開始: " + clutterItemData.PrefabName));
				try
				{
					RegisterClutterPiece(clutterItemData);
					num++;
				}
				catch (Exception ex)
				{
					num2++;
					((BaseUnityPlugin)this).Logger.LogError((object)("[Sakey's Cozy Clutter] 家具登録中に例外が発生しました: " + clutterItemData.PrefabName + "\n" + ex));
				}
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)("[Sakey's Cozy Clutter] 家具登録処理終了。成功: " + num + " / 失敗: " + num2));
		}
		catch (Exception ex2)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("[Sakey's Cozy Clutter] Prefab登録中にエラー:\n" + ex2));
		}
	}

	private void CreateClutterTool()
	{
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_0099: Expected O, but got Unknown
		//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f5: Expected O, but got Unknown
		//IL_0108: Unknown result type (might be due to invalid IL or missing references)
		//IL_010e: Expected O, but got Unknown
		//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_0286: Unknown result type (might be due to invalid IL or missing references)
		//IL_0297: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0362: Unknown result type (might be due to invalid IL or missing references)
		//IL_037f: Unknown result type (might be due to invalid IL or missing references)
		//IL_039a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[Sakey's Cozy Clutter] CreateClutterTool開始。");
		if ((Object)(object)AssetBundle == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"[Sakey's Cozy Clutter] AssetBundleが読み込まれていないため、家具作成ツールを作成できません。");
			return;
		}
		GameObject val = AssetBundle.LoadAsset<GameObject>("clutter_tool");
		if ((Object)(object)val == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"[Sakey's Cozy Clutter] clutter_tool がAssetBundleにありません。");
			return;
		}
		((BaseUnityPlugin)this).Logger.LogInfo((object)"[Sakey's Cozy Clutter] ツールモデルを発見しました: clutter_tool");
		Sprite val2 = AssetBundle.LoadAsset<Sprite>("icon_clutter_tool");
		if ((Object)(object)val2 == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"[Sakey's Cozy Clutter] icon_clutter_tool がAssetBundleにありません。");
			return;
		}
		ItemConfig val3 = new ItemConfig();
		val3.Name = "$SakeysClutterTool";
		val3.Description = "$SakeysClutterToolDesc";
		val3.PieceTable = "SakeysClutterTable";
		val3.CraftingStation = "piece_workbench";
		val3.MinStationLevel = 1;
		val3.Weight = 1f;
		val3.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
		{
			new RequirementConfig("Wood", 1, 0, true)
		};
		ItemConfig val4 = val3;
		CustomItem val5 = new CustomItem("SakeysClutterTool", "Hammer", val4);
		if (val5 == null || (Object)(object)val5.ItemPrefab == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"[Sakey's Cozy Clutter] 家具作成ツールPrefabの作成に失敗しました。");
			return;
		}
		GameObject itemPrefab = val5.ItemPrefab;
		ItemDrop component = itemPrefab.GetComponent<ItemDrop>();
		if ((Object)(object)component == (Object)null || component.m_itemData == null || component.m_itemData.m_shared == null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"[Sakey's Cozy Clutter] 家具作成ツールのItemDataが正常に取得できません。");
			return;
		}
		component.m_itemData.m_shared.m_name = "$SakeysClutterTool";
		component.m_itemData.m_shared.m_description = "$SakeysClutterToolDesc";
		component.m_itemData.m_shared.m_maxStackSize = 1;
		component.m_itemData.m_shared.m_weight = 1f;
		component.m_itemData.m_shared.m_itemType = (ItemType)19;
		component.m_itemData.m_quality = 1;
		component.m_itemData.m_stack = 1;
		component.m_itemData.m_dropPrefab = itemPrefab;
		component.m_itemData.m_shared.m_icons = (Sprite[])(object)new Sprite[1] { val2 };
		Renderer[] componentsInChildren = itemPrefab.GetComponentsInChildren<Renderer>(true);
		foreach (Renderer val6 in componentsInChildren)
		{
			if ((Object)(object)val6 != (Object)null)
			{
				val6.enabled = false;
			}
		}
		GameObject val7 = Object.Instantiate<GameObject>(val, itemPrefab.transform);
		((Object)val7).name = "ClutterToolModel";
		val7.transform.localPosition = Vector3.zero;
		val7.transform.localRotation = Quaternion.identity;
		val7.transform.localScale = Vector3.one;
		Collider[] componentsInChildren2 = val7.GetComponentsInChildren<Collider>(true);
		foreach (Collider val8 in componentsInChildren2)
		{
			if ((Object)(object)val8 != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)val8);
			}
		}
		Rigidbody[] componentsInChildren3 = val7.GetComponentsInChildren<Rigidbody>(true);
		foreach (Rigidbody val9 in componentsInChildren3)
		{
			if ((Object)(object)val9 != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)val9);
			}
		}
		LODGroup[] componentsInChildren4 = val7.GetComponentsInChildren<LODGroup>(true);
		foreach (LODGroup val10 in componentsInChildren4)
		{
			if ((Object)(object)val10 != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)val10);
			}
		}
		Transform val11 = itemPrefab.transform.Find("attach");
		if ((Object)(object)val11 == (Object)null)
		{
			val11 = new GameObject("attach").transform;
			val11.SetParent(itemPrefab.transform, false);
			val11.localPosition = Vector3.zero;
			val11.localRotation = Quaternion.Euler(0f, 0f, 90f);
			val11.localScale = Vector3.one;
		}
		GameObject val12 = Object.Instantiate<GameObject>(val7, val11);
		((Object)val12).name = "ClutterToolStandModel";
		val12.transform.localPosition = Vector3.zero;
		val12.transform.localRotation = Quaternion.Euler(90f, 0f, 0f);
		val12.transform.localScale = Vector3.one;
		componentsInChildren2 = val12.GetComponentsInChildren<Collider>(true);
		foreach (Collider val13 in componentsInChildren2)
		{
			if ((Object)(object)val13 != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)val13);
			}
		}
		componentsInChildren3 = val12.GetComponentsInChildren<Rigidbody>(true);
		foreach (Rigidbody val14 in componentsInChildren3)
		{
			if ((Object)(object)val14 != (Object)null)
			{
				Object.DestroyImmediate((Object)(object)val14);
			}
		}
		ZNetView val15 = itemPrefab.GetComponent<ZNetView>();
		if ((Object)(object)val15 == (Object)null)
		{
			val15 = itemPrefab.AddComponent<ZNetView>();
		}
		val15.m_persistent = true;
		if (!ItemManager.Instance.AddItem(val5))
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"[Sakey's Cozy Clutter] 家具作成ツールをItemManagerへ登録できませんでした。");
		}
		else
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"[Sakey's Cozy Clutter] 家具作成ツールを登録しました。");
		}
	}

	private void RegisterClutterPiece(ClutterItemData data)
	{
		//IL_0219: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: Expected O, but got Unknown
		//IL_027b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0281: Expected O, but got Unknown
		//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b0: Expected O, but got Unknown
		//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
		if (data == null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"[Sakey's Cozy Clutter] ClutterItemDataがnullです。");
			return;
		}
		if ((Object)(object)AssetBundle == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("[Sakey's Cozy Clutter] AssetBundleがnullのため家具登録を中止します: " + data.PrefabName));
			return;
		}
		GameObject val = AssetBundle.LoadAsset<GameObject>(data.AssetName);
		if ((Object)(object)val == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("[Sakey's Cozy Clutter] " + data.AssetName + " がAssetBundleにありません。"));
			return;
		}
		((Object)val).name = data.PrefabName;
		((BaseUnityPlugin)this).Logger.LogInfo((object)("[Sakey's Cozy Clutter] Prefabを発見しました: " + data.PrefabName));
		Sprite val2 = null;
		if (!string.IsNullOrEmpty(data.IconName))
		{
			val2 = AssetBundle.LoadAsset<Sprite>(data.IconName);
		}
		if ((Object)(object)val2 == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("[Sakey's Cozy Clutter] " + data.IconName + " がAssetBundleにありません。家具登録を中止します: " + data.PrefabName));
			return;
		}
		Piece val3 = val.GetComponent<Piece>();
		if ((Object)(object)val3 == (Object)null)
		{
			val3 = val.AddComponent<Piece>();
			((BaseUnityPlugin)this).Logger.LogInfo((object)("[Sakey's Cozy Clutter] " + data.PrefabName + " へPieceを追加しました。"));
		}
		if ((Object)(object)val3 == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("[Sakey's Cozy Clutter] " + data.PrefabName + " へPieceを追加できませんでした。"));
			return;
		}
		val3.m_icon = val2;
		val3.m_comfort = data.Comfort;
		val3.m_canBeRemoved = true;
		ZNetView val4 = val.GetComponent<ZNetView>();
		if ((Object)(object)val4 == (Object)null)
		{
			val4 = val.AddComponent<ZNetView>();
			((BaseUnityPlugin)this).Logger.LogInfo((object)("[Sakey's Cozy Clutter] " + data.PrefabName + " へZNetViewを追加しました。"));
		}
		if ((Object)(object)val4 != (Object)null)
		{
			val4.m_persistent = true;
		}
		if ((Object)(object)val.GetComponentInChildren<Collider>(true) == (Object)null)
		{
			BoxCollider obj = val.AddComponent<BoxCollider>();
			obj.center = new Vector3(0f, 0.5f, 0f);
			obj.size = new Vector3(0.5f, 1f, 0.5f);
			((BaseUnityPlugin)this).Logger.LogWarning((object)("[Sakey's Cozy Clutter] " + data.PrefabName + " にColliderが無かったため、簡易BoxColliderを追加しました。"));
		}
		PieceConfig val5 = new PieceConfig();
		val5.Name = data.NameKey;
		val5.Description = data.DescriptionKey;
		val5.PieceTable = "SakeysClutterTable";
		val5.Category = data.Category;
		val5.AllowedInDungeons = false;
		val5.Icon = val2;
		val5.Requirements = (RequirementConfig[])(object)new RequirementConfig[1]
		{
			new RequirementConfig(data.Material, data.Amount, 0, true)
		};
		PieceConfig val6 = val5;
		((BaseUnityPlugin)this).Logger.LogInfo((object)("[Sakey's Cozy Clutter] CustomPiece作成開始: " + data.PrefabName));
		CustomPiece val7 = new CustomPiece(val, false, val6);
		if (val7 == null || (Object)(object)val7.PiecePrefab == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("[Sakey's Cozy Clutter] CustomPiece作成に失敗しました: " + data.PrefabName));
			return;
		}
		if ((Object)(object)val7.Piece == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("[Sakey's Cozy Clutter] CustomPieceにPieceがありません: " + data.PrefabName));
			return;
		}
		val7.Piece.m_comfort = data.Comfort;
		val7.Piece.m_canBeRemoved = true;
		((BaseUnityPlugin)this).Logger.LogInfo((object)("[Sakey's Cozy Clutter] PieceManager登録開始: " + data.PrefabName));
		if (!PieceManager.Instance.AddPiece(val7))
		{
			((BaseUnityPlugin)this).Logger.LogError((object)("[Sakey's Cozy Clutter] PieceManagerへ登録できませんでした: " + data.PrefabName));
		}
		else
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)("[Sakey's Cozy Clutter] PieceManager登録成功: " + data.PrefabName));
		}
	}
}