Decompiled source of ItemSpawnerPlus v1.0.0

plugins/ItemSpawnerPlus.dll

Decompiled 15 hours ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using ItemSpawner;
using Peak;
using Photon.Pun;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;
using Zorro.Core;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("ItemSpawnerPlus")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ca5a87217ab92514dabffc3d974eb707331f3a98")]
[assembly: AssemblyProduct("ItemSpawnerPlus")]
[assembly: AssemblyTitle("ItemSpawnerPlus")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ItemSpawnerEnhancement;

[Flags]
public enum ItemCategory
{
	None = 0,
	Tools = 1,
	Food = 2,
	Mystical = 4,
	Equipment = 8,
	Consumables = 0x10,
	Props = 0x20
}
public enum MajorCategory
{
	All,
	Tools,
	Food,
	Mystical,
	Equipment,
	Consumables,
	Props
}
public static class ItemCatalog
{
	public static readonly Dictionary<string, ItemCategory> ItemTagMap = new Dictionary<string, ItemCategory>(StringComparer.OrdinalIgnoreCase)
	{
		{
			"Airplane Food",
			ItemCategory.Food
		},
		{
			"AK",
			ItemCategory.Props
		},
		{
			"AloeVera",
			ItemCategory.Consumables
		},
		{
			"Amulet_Clone",
			ItemCategory.Mystical
		},
		{
			"Amulet_Healing",
			ItemCategory.Mystical
		},
		{
			"Amulet_InfiniteStamina",
			ItemCategory.Mystical
		},
		{
			"Amulet_SuperJump",
			ItemCategory.Mystical
		},
		{
			"AncientIdol",
			ItemCategory.Mystical
		},
		{
			"Anti-Rope Spool",
			ItemCategory.Tools | ItemCategory.Mystical
		},
		{
			"Antidote",
			ItemCategory.Consumables
		},
		{
			"AntiZooka",
			ItemCategory.Tools | ItemCategory.Mystical
		},
		{
			"Apple Berry Green",
			ItemCategory.Food
		},
		{
			"Apple Berry Red",
			ItemCategory.Food
		},
		{
			"Apple Berry Weird",
			ItemCategory.Food
		},
		{
			"Apple Berry Yellow",
			ItemCategory.Food
		},
		{
			"Backpack",
			ItemCategory.Equipment
		},
		{
			"Balloon",
			ItemCategory.Consumables
		},
		{
			"BalloonBunch",
			ItemCategory.Consumables
		},
		{
			"Bandages",
			ItemCategory.Consumables
		},
		{
			"Basketball",
			ItemCategory.Props
		},
		{
			"Beehive",
			ItemCategory.Props
		},
		{
			"Berrynana Blue",
			ItemCategory.Food
		},
		{
			"Berrynana Brown",
			ItemCategory.Food
		},
		{
			"Berrynana Peel Blue Variant",
			ItemCategory.Props
		},
		{
			"Berrynana Peel Brown Variant",
			ItemCategory.Props
		},
		{
			"Berrynana Peel Pink Variant",
			ItemCategory.Props
		},
		{
			"Berrynana Peel Yellow",
			ItemCategory.Props
		},
		{
			"Berrynana Pink",
			ItemCategory.Food
		},
		{
			"Berrynana Yellow",
			ItemCategory.Food
		},
		{
			"BingBong",
			ItemCategory.Mystical | ItemCategory.Equipment
		},
		{
			"Binoculars",
			ItemCategory.Equipment
		},
		{
			"BookOfBones",
			ItemCategory.Mystical
		},
		{
			"BounceShroom",
			ItemCategory.Tools
		},
		{
			"Bugfix",
			ItemCategory.Food
		},
		{
			"Bugle",
			ItemCategory.Equipment
		},
		{
			"Bugle_Magic",
			ItemCategory.Mystical | ItemCategory.Equipment
		},
		{
			"Bugle_Scoutmaster Variant",
			ItemCategory.Mystical | ItemCategory.Equipment
		},
		{
			"C_Bishop B",
			ItemCategory.Props
		},
		{
			"C_Bishop W",
			ItemCategory.Props
		},
		{
			"C_Bishop_f",
			ItemCategory.Props
		},
		{
			"C_Bishop_f Variant",
			ItemCategory.Props
		},
		{
			"C_Bishop_m",
			ItemCategory.Props
		},
		{
			"C_Bishop_m Variant",
			ItemCategory.Props
		},
		{
			"C_King",
			ItemCategory.Props
		},
		{
			"C_King B",
			ItemCategory.Props
		},
		{
			"C_King Variant",
			ItemCategory.Props
		},
		{
			"C_King W",
			ItemCategory.Props
		},
		{
			"C_Knight",
			ItemCategory.Props
		},
		{
			"C_Knight B",
			ItemCategory.Props
		},
		{
			"C_Knight Variant",
			ItemCategory.Props
		},
		{
			"C_Knight W",
			ItemCategory.Props
		},
		{
			"C_Pawn B",
			ItemCategory.Props
		},
		{
			"C_Pawn W",
			ItemCategory.Props
		},
		{
			"C_Pawn_f",
			ItemCategory.Props
		},
		{
			"C_Pawn_f Variant",
			ItemCategory.Props
		},
		{
			"C_Pawn_m",
			ItemCategory.Props
		},
		{
			"C_Pawn_m Variant",
			ItemCategory.Props
		},
		{
			"C_Queen",
			ItemCategory.Props
		},
		{
			"C_Queen B",
			ItemCategory.Props
		},
		{
			"C_Queen Variant",
			ItemCategory.Props
		},
		{
			"C_Queen W",
			ItemCategory.Props
		},
		{
			"C_Rook B",
			ItemCategory.Props
		},
		{
			"C_Rook W",
			ItemCategory.Props
		},
		{
			"C_Rook_f",
			ItemCategory.Props
		},
		{
			"C_Rook_f Variant",
			ItemCategory.Props
		},
		{
			"C_Rook_m",
			ItemCategory.Props
		},
		{
			"C_Rook_m Variant",
			ItemCategory.Props
		},
		{
			"CactusBall",
			ItemCategory.Props
		},
		{
			"Candle",
			ItemCategory.Tools
		},
		{
			"ChainShooter",
			ItemCategory.Tools
		},
		{
			"Cheat Compass",
			ItemCategory.Mystical
		},
		{
			"Cheat Compass 1",
			ItemCategory.Mystical
		},
		{
			"ClimbingChalk",
			ItemCategory.Consumables
		},
		{
			"ClimbingSpike",
			ItemCategory.Tools
		},
		{
			"CloudFungus",
			ItemCategory.Tools
		},
		{
			"Clusterberry Black",
			ItemCategory.Food
		},
		{
			"Clusterberry Red",
			ItemCategory.Food
		},
		{
			"Clusterberry Yellow",
			ItemCategory.Food
		},
		{
			"Compass",
			ItemCategory.Equipment
		},
		{
			"Cure-All",
			ItemCategory.Mystical | ItemCategory.Consumables
		},
		{
			"Cure-Some",
			ItemCategory.Consumables
		},
		{
			"Cursed Skull",
			ItemCategory.Mystical
		},
		{
			"Darkberry",
			ItemCategory.Food
		},
		{
			"Dynamite",
			ItemCategory.Consumables
		},
		{
			"EarlyWorm",
			ItemCategory.Food
		},
		{
			"Egg",
			ItemCategory.Food
		},
		{
			"EggRaven",
			ItemCategory.Food
		},
		{
			"EggTurkey",
			ItemCategory.Food
		},
		{
			"Energy Drink",
			ItemCategory.Food
		},
		{
			"Energy Elixir",
			ItemCategory.Mystical | ItemCategory.Consumables
		},
		{
			"Fannypack",
			ItemCategory.Equipment
		},
		{
			"FireWood",
			ItemCategory.Props
		},
		{
			"FirstAidKit",
			ItemCategory.Consumables
		},
		{
			"Flag_Plantable_Checkpoint",
			ItemCategory.Tools
		},
		{
			"Flare",
			ItemCategory.Consumables
		},
		{
			"FortifiedMilk",
			ItemCategory.Food
		},
		{
			"Frisbee",
			ItemCategory.Props
		},
		{
			"Frog",
			ItemCategory.Food
		},
		{
			"FrogLegs",
			ItemCategory.Food
		},
		{
			"Glider",
			ItemCategory.Equipment
		},
		{
			"Glizzy",
			ItemCategory.Food
		},
		{
			"Glizzy_CattailVariant",
			ItemCategory.Food
		},
		{
			"Granola Bar",
			ItemCategory.Food
		},
		{
			"Guidebook",
			ItemCategory.Equipment
		},
		{
			"GuidebookPage",
			ItemCategory.Props
		},
		{
			"GuidebookPage_0_Intro",
			ItemCategory.Props
		},
		{
			"GuidebookPage_10_Sleepy",
			ItemCategory.Props
		},
		{
			"GuidebookPage_11_Awake",
			ItemCategory.Props
		},
		{
			"GuidebookPage_12_Crashout",
			ItemCategory.Props
		},
		{
			"GuidebookPage_13_FirstTeams",
			ItemCategory.Props
		},
		{
			"GuidebookPage_1_Mushrooms",
			ItemCategory.Props
		},
		{
			"GuidebookPage_2_Campfire",
			ItemCategory.Props
		},
		{
			"GuidebookPage_3_Revival",
			ItemCategory.Props
		},
		{
			"GuidebookPage_4_Poison",
			ItemCategory.Props
		},
		{
			"GuidebookPage_5_Zombies",
			ItemCategory.Props
		},
		{
			"GuidebookPage_6_BodyHeat",
			ItemCategory.Props
		},
		{
			"GuidebookPage_7_BurningSun",
			ItemCategory.Props
		},
		{
			"GuidebookPage_8_Magma",
			ItemCategory.Props
		},
		{
			"GuidebookPage_9_Gloom",
			ItemCategory.Props
		},
		{
			"GuidebookPageScroll Variant",
			ItemCategory.Props
		},
		{
			"HealingDart Variant",
			ItemCategory.Tools
		},
		{
			"HealingPuffShroom",
			ItemCategory.Consumables
		},
		{
			"Heat Pack",
			ItemCategory.Consumables
		},
		{
			"Item_Coconut",
			ItemCategory.Food
		},
		{
			"Item_Coconut_half",
			ItemCategory.Food
		},
		{
			"Item_Honeycomb",
			ItemCategory.Food
		},
		{
			"Jetpack",
			ItemCategory.Equipment
		},
		{
			"Kingberry Green",
			ItemCategory.Food
		},
		{
			"Kingberry Purple",
			ItemCategory.Food
		},
		{
			"Kingberry Yellow",
			ItemCategory.Food
		},
		{
			"Lantern",
			ItemCategory.Tools
		},
		{
			"Lantern_Faerie",
			ItemCategory.Mystical | ItemCategory.Consumables
		},
		{
			"Lollipop",
			ItemCategory.Food
		},
		{
			"Lollipop_Evil",
			ItemCategory.Food | ItemCategory.Mystical
		},
		{
			"MagicBean",
			ItemCategory.Tools | ItemCategory.Mystical
		},
		{
			"Mandrake",
			ItemCategory.Food | ItemCategory.Mystical
		},
		{
			"Marshmallow",
			ItemCategory.Food
		},
		{
			"Matchbook",
			ItemCategory.Consumables
		},
		{
			"MedicinalRoot",
			ItemCategory.Food
		},
		{
			"Megaphone",
			ItemCategory.Equipment
		},
		{
			"Mushroom Chubby",
			ItemCategory.Food
		},
		{
			"Mushroom Cluster",
			ItemCategory.Food
		},
		{
			"Mushroom Cluster Poison",
			ItemCategory.Food
		},
		{
			"Mushroom Glow",
			ItemCategory.Food
		},
		{
			"Mushroom Lace",
			ItemCategory.Food
		},
		{
			"Mushroom Lace Poison",
			ItemCategory.Food
		},
		{
			"Mushroom Normie",
			ItemCategory.Food
		},
		{
			"Mushroom Normie Poison",
			ItemCategory.Food
		},
		{
			"Napberry",
			ItemCategory.Food
		},
		{
			"NestEgg",
			ItemCategory.Food
		},
		{
			"NestEgg_Raven",
			ItemCategory.Food
		},
		{
			"Painkillers",
			ItemCategory.Consumables
		},
		{
			"PandorasBox",
			ItemCategory.Food | ItemCategory.Mystical
		},
		{
			"Parachute",
			ItemCategory.Consumables
		},
		{
			"Parasol",
			ItemCategory.Equipment
		},
		{
			"Parasol_Roots Variant",
			ItemCategory.Equipment
		},
		{
			"Passport",
			ItemCategory.Equipment
		},
		{
			"Pepper Berry",
			ItemCategory.Food
		},
		{
			"Pirate Compass",
			ItemCategory.Equipment
		},
		{
			"PortableStovetopItem",
			ItemCategory.Tools
		},
		{
			"Prickleberry_Gold",
			ItemCategory.Food
		},
		{
			"Prickleberry_Red",
			ItemCategory.Food
		},
		{
			"RescueHook",
			ItemCategory.Tools
		},
		{
			"RescueHook_Infinite",
			ItemCategory.Tools
		},
		{
			"RitualDagger",
			ItemCategory.Mystical
		},
		{
			"Rocketpack",
			ItemCategory.Equipment
		},
		{
			"RopeShooter",
			ItemCategory.Tools
		},
		{
			"RopeShooterAnti",
			ItemCategory.Tools | ItemCategory.Mystical
		},
		{
			"RopeSpool",
			ItemCategory.Tools
		},
		{
			"Scorpion",
			ItemCategory.Food
		},
		{
			"ScoutCannonItem",
			ItemCategory.Tools
		},
		{
			"ScoutCookies",
			ItemCategory.Food
		},
		{
			"ScoutCookies_Vanilla",
			ItemCategory.Food
		},
		{
			"ScoutEffigy",
			ItemCategory.Mystical
		},
		{
			"ScoutmasterSoul",
			ItemCategory.Mystical
		},
		{
			"ScoutsHonor",
			ItemCategory.Mystical
		},
		{
			"ShelfShroom",
			ItemCategory.Tools
		},
		{
			"Shell Big",
			ItemCategory.Food
		},
		{
			"Shroomberry_Blue",
			ItemCategory.Food
		},
		{
			"Shroomberry_Green",
			ItemCategory.Food
		},
		{
			"Shroomberry_Purple",
			ItemCategory.Food
		},
		{
			"Shroomberry_Red",
			ItemCategory.Food
		},
		{
			"Shroomberry_Yellow",
			ItemCategory.Food
		},
		{
			"Skyberry",
			ItemCategory.Food
		},
		{
			"Snowball",
			ItemCategory.Props
		},
		{
			"Sports Drink",
			ItemCategory.Food
		},
		{
			"Stone",
			ItemCategory.Props
		},
		{
			"Strange Gem",
			ItemCategory.Mystical
		},
		{
			"Sunscreen",
			ItemCategory.Consumables
		},
		{
			"Torch",
			ItemCategory.Tools
		},
		{
			"TrailMix",
			ItemCategory.Food
		},
		{
			"Wand of Wind",
			ItemCategory.Mystical
		},
		{
			"Warp Compass",
			ItemCategory.Mystical
		},
		{
			"WarpFungus",
			ItemCategory.Mystical
		},
		{
			"Warpsketball",
			ItemCategory.Props
		},
		{
			"Winterberry Orange",
			ItemCategory.Food
		},
		{
			"Winterberry Yellow",
			ItemCategory.Food
		},
		{
			"Wonderberry",
			ItemCategory.Food | ItemCategory.Mystical
		}
	};

	public static readonly Dictionary<string, string> ExtraNameKeys = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
	{
		{ "Bugfix", "NAME_TICK" },
		{ "EggRaven", "NAME_EGG" },
		{ "EggTurkey", "NAME_BIRD" },
		{ "FireWood", "NAME_STICK" },
		{ "NestEgg", "NAME_BIG EGG" },
		{ "NestEgg_Raven", "NAME_SMALL EGG" },
		{ "Parachute", "NAME_AUTOPARACHUTE" }
	};

	public static readonly Dictionary<string, string[]> ExtraCustomNames = new Dictionary<string, string[]>(StringComparer.OrdinalIgnoreCase)
	{
		{
			"AK",
			new string[2] { "AK", "AK" }
		},
		{
			"Apple Berry Weird",
			new string[2] { "诡异脆莓", "Weird Crispberry" }
		},
		{
			"ClimbingChalk",
			new string[2] { "攀岩粉", "Climbing Chalk" }
		},
		{
			"Cure-Some",
			new string[2] { "疗伤药", "Cure-Some" }
		},
		{
			"Darkberry",
			new string[2] { "暗莓", "Darkberry" }
		},
		{
			"Energy Elixir",
			new string[2] { "能量灵药", "Energy Elixir" }
		},
		{
			"Lollipop_Evil",
			new string[2] { "恶趣棒棒糖", "Follypop" }
		},
		{
			"Matchbook",
			new string[2] { "火柴盒", "Matchbook" }
		},
		{
			"Painkillers",
			new string[2] { "止痛药", "Medicine" }
		},
		{
			"Skyberry",
			new string[2] { "粉荔莓", "Pink Kingberry" }
		},
		{
			"Wand of Wind",
			new string[2] { "风之杖", "Wand of Wind" }
		},
		{
			"Warpsketball",
			new string[2] { "太空篮球", "Warpsketball" }
		},
		{
			"Wonderberry",
			new string[2] { "奇迹莓", "Wonderberry" }
		}
	};

	public static readonly HashSet<string> HiddenExact = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "BaseConstructable Variant", "BaseObject", "Berrynana UNUSED", "Portable Speaker", "Propeller", "Skull", "TestConstructable Variant", "foodTest" };

	public static readonly string[] HiddenPrefixes = new string[0];

	public static readonly string[] HiddenSubstrings = new string[4] { "_Prop", "_TEMP", "_UNUSED", "_Hidden" };

	public static readonly Dictionary<char, string> PinyinMap = new Dictionary<char, string>
	{
		{ '一', "yi" },
		{ '万', "wan" },
		{ '下', "xia" },
		{ '不', "bu" },
		{ '与', "yu" },
		{ '丑', "chou" },
		{ '专', "zhuan" },
		{ '世', "shi" },
		{ '业', "ye" },
		{ '严', "yan" },
		{ '中', "zhong" },
		{ '丰', "feng" },
		{ '主', "zhu" },
		{ '久', "jiu" },
		{ '义', "yi" },
		{ '之', "zhi" },
		{ '乐', "le" },
		{ '书', "shu" },
		{ '乾', "qian" },
		{ '云', "yun" },
		{ '人', "ren" },
		{ '仙', "xian" },
		{ '代', "dai" },
		{ '仪', "yi" },
		{ '休', "xiu" },
		{ '伞', "san" },
		{ '传', "chuan" },
		{ '伤', "shang" },
		{ '使', "shi" },
		{ '便', "bian" },
		{ '係', "xi" },
		{ '保', "bao" },
		{ '信', "xin" },
		{ '健', "jian" },
		{ '偶', "ou" },
		{ '傘', "san" },
		{ '備', "bei" },
		{ '傳', "chuan" },
		{ '傷', "shang" },
		{ '像', "xiang" },
		{ '僻', "pi" },
		{ '儀', "yi" },
		{ '儿', "er" },
		{ '先', "xian" },
		{ '克', "ke" },
		{ '兒', "er" },
		{ '全', "quan" },
		{ '公', "gong" },
		{ '兵', "bing" },
		{ '内', "nei" },
		{ '军', "jun" },
		{ '冬', "dong" },
		{ '冷', "leng" },
		{ '准', "zhun" },
		{ '凉', "liang" },
		{ '凌', "ling" },
		{ '切', "qie" },
		{ '则', "ze" },
		{ '刺', "ci" },
		{ '剂', "ji" },
		{ '則', "ze" },
		{ '剣', "jian" },
		{ '劑', "ji" },
		{ '力', "li" },
		{ '加', "jia" },
		{ '动', "dong" },
		{ '助', "zhu" },
		{ '動', "dong" },
		{ '包', "bao" },
		{ '匆', "cong" },
		{ '匕', "bi" },
		{ '化', "hua" },
		{ '匹', "pi" },
		{ '半', "ban" },
		{ '卒', "zu" },
		{ '南', "nan" },
		{ '危', "wei" },
		{ '卵', "luan" },
		{ '卷', "juan" },
		{ '参', "can" },
		{ '參', "can" },
		{ '友', "you" },
		{ '双', "shuang" },
		{ '反', "fan" },
		{ '发', "fa" },
		{ '取', "qu" },
		{ '古', "gu" },
		{ '叭', "ba" },
		{ '台', "tai" },
		{ '史', "shi" },
		{ '号', "hao" },
		{ '合', "he" },
		{ '名', "ming" },
		{ '后', "hou" },
		{ '向', "xiang" },
		{ '吹', "chui" },
		{ '呆', "dai" },
		{ '呪', "zhou" },
		{ '咒', "zhou" },
		{ '响', "xiang" },
		{ '喇', "la" },
		{ '喷', "pen" },
		{ '器', "qi" },
		{ '噴', "pen" },
		{ '回', "hui" },
		{ '国', "guo" },
		{ '國', "guo" },
		{ '坚', "jian" },
		{ '型', "xing" },
		{ '城', "cheng" },
		{ '堅', "jian" },
		{ '堆', "dui" },
		{ '堡', "bao" },
		{ '士', "shi" },
		{ '备', "bei" },
		{ '変', "bian" },
		{ '多', "duo" },
		{ '大', "da" },
		{ '天', "tian" },
		{ '太', "tai" },
		{ '头', "tou" },
		{ '奇', "qi" },
		{ '奖', "jiang" },
		{ '奪', "duo" },
		{ '奶', "nai" },
		{ '好', "hao" },
		{ '妖', "yao" },
		{ '子', "zi" },
		{ '存', "cun" },
		{ '孤', "gu" },
		{ '学', "xue" },
		{ '學', "xue" },
		{ '守', "shou" },
		{ '安', "an" },
		{ '宝', "bao" },
		{ '实', "shi" },
		{ '害', "hai" },
		{ '家', "jia" },
		{ '宾', "bin" },
		{ '密', "mi" },
		{ '寝', "qin" },
		{ '實', "shi" },
		{ '寶', "bao" },
		{ '对', "dui" },
		{ '対', "dui" },
		{ '専', "zhuan" },
		{ '射', "she" },
		{ '專', "zhuan" },
		{ '尋', "xun" },
		{ '對', "dui" },
		{ '導', "dao" },
		{ '小', "xiao" },
		{ '尖', "jian" },
		{ '屈', "qu" },
		{ '山', "shan" },
		{ '岩', "yan" },
		{ '峰', "feng" },
		{ '巢', "chao" },
		{ '巣', "chao" },
		{ '巨', "ju" },
		{ '巻', "juan" },
		{ '师', "shi" },
		{ '带', "dai" },
		{ '師', "shi" },
		{ '帯', "dai" },
		{ '帶', "dai" },
		{ '干', "gan" },
		{ '应', "ying" },
		{ '度', "du" },
		{ '弁', "bian" },
		{ '异', "yi" },
		{ '弄', "nong" },
		{ '式', "shi" },
		{ '弟', "di" },
		{ '強', "qiang" },
		{ '弹', "dan" },
		{ '彈', "dan" },
		{ '当', "dang" },
		{ '形', "xing" },
		{ '徒', "tu" },
		{ '御', "yu" },
		{ '復', "fu" },
		{ '微', "wei" },
		{ '德', "de" },
		{ '徽', "hui" },
		{ '心', "xin" },
		{ '忍', "ren" },
		{ '志', "zhi" },
		{ '忙', "mang" },
		{ '応', "ying" },
		{ '快', "kuai" },
		{ '急', "ji" },
		{ '怪', "guai" },
		{ '恩', "en" },
		{ '恵', "hui" },
		{ '恶', "e" },
		{ '情', "qing" },
		{ '惡', "e" },
		{ '慨', "kai" },
		{ '慷', "kang" },
		{ '憂', "you" },
		{ '應', "ying" },
		{ '战', "zhan" },
		{ '手', "shou" },
		{ '打', "da" },
		{ '扣', "kou" },
		{ '扩', "kuo" },
		{ '技', "ji" },
		{ '把', "ba" },
		{ '抓', "zhua" },
		{ '护', "hu" },
		{ '抱', "bao" },
		{ '拉', "la" },
		{ '拓', "tuo" },
		{ '拔', "ba" },
		{ '持', "chi" },
		{ '指', "zhi" },
		{ '捜', "sou" },
		{ '捨', "she" },
		{ '捷', "jie" },
		{ '掌', "zhang" },
		{ '掠', "lve" },
		{ '採', "cai" },
		{ '接', "jie" },
		{ '提', "ti" },
		{ '援', "yuan" },
		{ '携', "xie" },
		{ '撕', "si" },
		{ '撞', "zhuang" },
		{ '攀', "pan" },
		{ '攜', "xie" },
		{ '攝', "she" },
		{ '放', "fang" },
		{ '救', "jiu" },
		{ '教', "jiao" },
		{ '敲', "qiao" },
		{ '敵', "di" },
		{ '文', "wen" },
		{ '料', "liao" },
		{ '旅', "lv" },
		{ '族', "zu" },
		{ '旗', "qi" },
		{ '日', "ri" },
		{ '早', "zao" },
		{ '昆', "kun" },
		{ '明', "ming" },
		{ '星', "xing" },
		{ '晒', "shai" },
		{ '晚', "wan" },
		{ '晶', "jing" },
		{ '智', "zhi" },
		{ '暖', "nuan" },
		{ '暗', "an" },
		{ '曬', "shai" },
		{ '曲', "qu" },
		{ '書', "shu" },
		{ '曼', "man" },
		{ '最', "zui" },
		{ '望', "wang" },
		{ '木', "mu" },
		{ '末', "mo" },
		{ '本', "ben" },
		{ '朵', "duo" },
		{ '机', "ji" },
		{ '杂', "za" },
		{ '杖', "zhang" },
		{ '束', "shu" },
		{ '板', "ban" },
		{ '极', "ji" },
		{ '林', "lin" },
		{ '果', "guo" },
		{ '枝', "zhi" },
		{ '架', "jia" },
		{ '查', "cha" },
		{ '柴', "chai" },
		{ '标', "biao" },
		{ '树', "shu" },
		{ '根', "gen" },
		{ '梨', "li" },
		{ '检', "jian" },
		{ '棉', "mian" },
		{ '棍', "gun" },
		{ '棒', "bang" },
		{ '棕', "zong" },
		{ '棚', "peng" },
		{ '森', "sen" },
		{ '椰', "ye" },
		{ '業', "ye" },
		{ '極', "ji" },
		{ '榮', "rong" },
		{ '槍', "qiang" },
		{ '樂', "le" },
		{ '樹', "shu" },
		{ '橘', "ju" },
		{ '橙', "cheng" },
		{ '機', "ji" },
		{ '檢', "jian" },
		{ '欢', "huan" },
		{ '止', "zhi" },
		{ '步', "bu" },
		{ '歴', "li" },
		{ '歷', "li" },
		{ '死', "si" },
		{ '段', "duan" },
		{ '毅', "yi" },
		{ '毒', "du" },
		{ '民', "min" },
		{ '气', "qi" },
		{ '氣', "qi" },
		{ '水', "shui" },
		{ '治', "zhi" },
		{ '法', "fa" },
		{ '流', "liu" },
		{ '浜', "bang" },
		{ '浪', "lang" },
		{ '海', "hai" },
		{ '涼', "liang" },
		{ '混', "hun" },
		{ '清', "qing" },
		{ '游', "you" },
		{ '滑', "hua" },
		{ '漫', "man" },
		{ '潘', "pan" },
		{ '激', "ji" },
		{ '濁', "zhuo" },
		{ '灘', "tan" },
		{ '火', "huo" },
		{ '灯', "deng" },
		{ '灵', "ling" },
		{ '災', "zai" },
		{ '灾', "zai" },
		{ '炉', "lu" },
		{ '炬', "ju" },
		{ '炮', "pao" },
		{ '炸', "zha" },
		{ '点', "dian" },
		{ '烈', "lie" },
		{ '烛', "zhu" },
		{ '烧', "shao" },
		{ '热', "re" },
		{ '烹', "peng" },
		{ '無', "wu" },
		{ '然', "ran" },
		{ '焼', "shao" },
		{ '煎', "jian" },
		{ '煙', "yan" },
		{ '照', "zhao" },
		{ '熱', "re" },
		{ '燈', "deng" },
		{ '燕', "yan" },
		{ '營', "ying" },
		{ '燭', "zhu" },
		{ '爐', "lu" },
		{ '爪', "zhao" },
		{ '爽', "shuang" },
		{ '片', "pian" },
		{ '牛', "niu" },
		{ '牧', "mu" },
		{ '物', "wu" },
		{ '特', "te" },
		{ '狗', "gou" },
		{ '独', "du" },
		{ '狼', "lang" },
		{ '獎', "jiang" },
		{ '玄', "xuan" },
		{ '玉', "yu" },
		{ '王', "wang" },
		{ '玩', "wan" },
		{ '环', "huan" },
		{ '球', "qiu" },
		{ '理', "li" },
		{ '琴', "qin" },
		{ '瓜', "gua" },
		{ '生', "sheng" },
		{ '用', "yong" },
		{ '田', "tian" },
		{ '留', "liu" },
		{ '略', "lve" },
		{ '異', "yi" },
		{ '當', "dang" },
		{ '疗', "liao" },
		{ '痕', "hen" },
		{ '痛', "tong" },
		{ '療', "liao" },
		{ '発', "fa" },
		{ '登', "deng" },
		{ '發', "fa" },
		{ '白', "bai" },
		{ '的', "de" },
		{ '皇', "huang" },
		{ '皮', "pi" },
		{ '盈', "ying" },
		{ '盒', "he" },
		{ '盗', "dao" },
		{ '盘', "pan" },
		{ '盛', "sheng" },
		{ '盜', "dao" },
		{ '盤', "pan" },
		{ '真', "zhen" },
		{ '眼', "yan" },
		{ '睡', "shui" },
		{ '矢', "shi" },
		{ '短', "duan" },
		{ '石', "shi" },
		{ '砲', "pao" },
		{ '破', "po" },
		{ '祈', "qi" },
		{ '祕', "mi" },
		{ '神', "shen" },
		{ '祷', "dao" },
		{ '秘', "mi" },
		{ '稽', "ji" },
		{ '空', "kong" },
		{ '窩', "wo" },
		{ '章', "zhang" },
		{ '童', "tong" },
		{ '等', "deng" },
		{ '筒', "tong" },
		{ '管', "guan" },
		{ '箭', "jian" },
		{ '箱', "xiang" },
		{ '篮', "lan" },
		{ '簇', "cu" },
		{ '籃', "lan" },
		{ '籠', "long" },
		{ '粉', "fen" },
		{ '精', "jing" },
		{ '糖', "tang" },
		{ '紀', "ji" },
		{ '紅', "hong" },
		{ '索', "suo" },
		{ '紫', "zi" },
		{ '終', "zhong" },
		{ '結', "jie" },
		{ '綁', "bang" },
		{ '綜', "zong" },
		{ '綠', "lv" },
		{ '網', "wang" },
		{ '緊', "jin" },
		{ '緑', "lv" },
		{ '繃', "beng" },
		{ '繍', "xiu" },
		{ '繡', "xiu" },
		{ '繩', "sheng" },
		{ '红', "hong" },
		{ '纪', "ji" },
		{ '结', "jie" },
		{ '绣', "xiu" },
		{ '绳', "sheng" },
		{ '绷', "beng" },
		{ '绿', "lv" },
		{ '网', "wang" },
		{ '罗', "luo" },
		{ '美', "mei" },
		{ '群', "qun" },
		{ '義', "yi" },
		{ '翔', "xiang" },
		{ '翱', "ao" },
		{ '翼', "yi" },
		{ '耀', "yao" },
		{ '老', "lao" },
		{ '考', "kao" },
		{ '者', "zhe" },
		{ '耐', "nai" },
		{ '聲', "sheng" },
		{ '肠', "chang" },
		{ '胃', "wei" },
		{ '背', "bei" },
		{ '胖', "pang" },
		{ '能', "neng" },
		{ '脆', "cui" },
		{ '腰', "yao" },
		{ '腳', "jiao" },
		{ '腿', "tui" },
		{ '臣', "chen" },
		{ '臨', "lin" },
		{ '自', "zi" },
		{ '致', "zhi" },
		{ '航', "hang" },
		{ '船', "chuan" },
		{ '色', "se" },
		{ '艺', "yi" },
		{ '芦', "lu" },
		{ '花', "hua" },
		{ '茎', "jing" },
		{ '茶', "cha" },
		{ '草', "cao" },
		{ '荔', "li" },
		{ '荟', "hui" },
		{ '荣', "rong" },
		{ '药', "yao" },
		{ '莓', "mei" },
		{ '莽', "mang" },
		{ '菇', "gu" },
		{ '菌', "jun" },
		{ '营', "ying" },
		{ '萬', "wan" },
		{ '落', "luo" },
		{ '葚', "ren" },
		{ '蓋', "gai" },
		{ '蓝', "lan" },
		{ '蕉', "jiao" },
		{ '蕩', "dang" },
		{ '薈', "hui" },
		{ '薬', "yao" },
		{ '藍', "lan" },
		{ '藝', "yi" },
		{ '藥', "yao" },
		{ '蘆', "lu" },
		{ '蘑', "mo" },
		{ '號', "hao" },
		{ '虫', "chong" },
		{ '蛋', "dan" },
		{ '蛙', "wa" },
		{ '蜂', "feng" },
		{ '蜜', "mi" },
		{ '蜱', "pi" },
		{ '蝎', "xie" },
		{ '螺', "luo" },
		{ '蟲', "chong" },
		{ '蠍', "xie" },
		{ '行', "xing" },
		{ '術', "shu" },
		{ '补', "bu" },
		{ '被', "bei" },
		{ '裹', "guo" },
		{ '覓', "mi" },
		{ '觅', "mi" },
		{ '角', "jiao" },
		{ '解', "jie" },
		{ '触', "chu" },
		{ '觸', "chu" },
		{ '詛', "zu" },
		{ '詭', "gui" },
		{ '誉', "yu" },
		{ '謀', "mou" },
		{ '識', "shi" },
		{ '護', "hu" },
		{ '譽', "yu" },
		{ '變', "bian" },
		{ '诅', "zu" },
		{ '诡', "gui" },
		{ '谊', "yi" },
		{ '豆', "dou" },
		{ '貝', "bei" },
		{ '負', "fu" },
		{ '賊', "zei" },
		{ '賓', "bin" },
		{ '質', "zhi" },
		{ '贼', "zei" },
		{ '赤', "chi" },
		{ '赶', "gan" },
		{ '起', "qi" },
		{ '超', "chao" },
		{ '趣', "qu" },
		{ '足', "zu" },
		{ '跡', "ji" },
		{ '路', "lu" },
		{ '跳', "tiao" },
		{ '踏', "ta" },
		{ '踐', "jian" },
		{ '蹟', "ji" },
		{ '軍', "jun" },
		{ '軸', "zhou" },
		{ '輕', "qing" },
		{ '车', "che" },
		{ '轴', "zhou" },
		{ '辛', "xin" },
		{ '辟', "pi" },
		{ '边', "bian" },
		{ '辺', "bian" },
		{ '迁', "qian" },
		{ '迅', "xun" },
		{ '运', "yun" },
		{ '进', "jin" },
		{ '远', "yuan" },
		{ '迹', "ji" },
		{ '送', "song" },
		{ '透', "tou" },
		{ '進', "jin" },
		{ '遊', "you" },
		{ '運', "yun" },
		{ '道', "dao" },
		{ '遠', "yuan" },
		{ '避', "bi" },
		{ '邦', "bang" },
		{ '重', "zhong" },
		{ '野', "ye" },
		{ '量', "liang" },
		{ '金', "jin" },
		{ '釘', "ding" },
		{ '針', "zhen" },
		{ '鈕', "niu" },
		{ '鈣', "gai" },
		{ '鈴', "ling" },
		{ '鉤', "gou" },
		{ '銅', "tong" },
		{ '鎖', "suo" },
		{ '鏈', "lian" },
		{ '鏡', "jing" },
		{ '鐘', "zhong" },
		{ '针', "zhen" },
		{ '钉', "ding" },
		{ '钙', "gai" },
		{ '钟', "zhong" },
		{ '钩', "gou" },
		{ '银', "yin" },
		{ '链', "lian" },
		{ '锁', "suo" },
		{ '镜', "jing" },
		{ '長', "zhang" },
		{ '門', "men" },
		{ '開', "kai" },
		{ '関', "guan" },
		{ '门', "men" },
		{ '队', "dui" },
		{ '防', "fang" },
		{ '阳', "yang" },
		{ '降', "jiang" },
		{ '限', "xian" },
		{ '陽', "yang" },
		{ '隊', "dui" },
		{ '階', "jie" },
		{ '难', "nan" },
		{ '集', "ji" },
		{ '雕', "diao" },
		{ '雙', "shuang" },
		{ '難', "nan" },
		{ '雪', "xue" },
		{ '雲', "yun" },
		{ '零', "ling" },
		{ '雾', "wu" },
		{ '霧', "wu" },
		{ '露', "lu" },
		{ '靈', "ling" },
		{ '青', "qing" },
		{ '韧', "ren" },
		{ '音', "yin" },
		{ '響', "xiang" },
		{ '頁', "ye" },
		{ '頂', "ding" },
		{ '頭', "tou" },
		{ '頼', "lai" },
		{ '顆', "ke" },
		{ '類', "lei" },
		{ '页', "ye" },
		{ '顶', "ding" },
		{ '领', "ling" },
		{ '風', "feng" },
		{ '风', "feng" },
		{ '飛', "fei" },
		{ '飞', "fei" },
		{ '食', "shi" },
		{ '飪', "ren" },
		{ '飲', "yin" },
		{ '飽', "bao" },
		{ '餅', "bing" },
		{ '餐', "can" },
		{ '饪', "ren" },
		{ '饮', "yin" },
		{ '饶', "rao" },
		{ '饼', "bing" },
		{ '馒', "man" },
		{ '首', "shou" },
		{ '駆', "qu" },
		{ '騎', "qi" },
		{ '驅', "qu" },
		{ '驱', "qu" },
		{ '骑', "qi" },
		{ '骨', "gu" },
		{ '骷', "ku" },
		{ '骸', "hai" },
		{ '髅', "lou" },
		{ '髏', "lou" },
		{ '高', "gao" },
		{ '魂', "hun" },
		{ '魔', "mo" },
		{ '鲍', "bao" },
		{ '鳥', "niao" },
		{ '鳴', "ming" },
		{ '鸟', "niao" },
		{ '鸡', "ji" },
		{ '麥', "mai" },
		{ '麦', "mai" },
		{ '黃', "huang" },
		{ '黄', "huang" },
		{ '黑', "hei" },
		{ '黒', "hei" },
		{ '點', "dian" }
	};

	public static bool IsHidden(string prefab)
	{
		if (string.IsNullOrEmpty(prefab))
		{
			return true;
		}
		if (HiddenExact.Contains(prefab))
		{
			return true;
		}
		for (int i = 0; i < HiddenPrefixes.Length; i++)
		{
			if (prefab.StartsWith(HiddenPrefixes[i], StringComparison.OrdinalIgnoreCase))
			{
				return true;
			}
		}
		for (int j = 0; j < HiddenSubstrings.Length; j++)
		{
			if (prefab.IndexOf(HiddenSubstrings[j], StringComparison.OrdinalIgnoreCase) >= 0)
			{
				return true;
			}
		}
		return false;
	}

	public static string GetMajorLabel(MajorCategory major)
	{
		bool flag = ItemListView.IsChineseLanguage();
		switch (major)
		{
		case MajorCategory.All:
			if (!flag)
			{
				return "All";
			}
			return "全部";
		case MajorCategory.Tools:
			if (!flag)
			{
				return "Tools";
			}
			return "工具";
		case MajorCategory.Food:
			if (!flag)
			{
				return "Food";
			}
			return "食物";
		case MajorCategory.Mystical:
			if (!flag)
			{
				return "Mystical";
			}
			return "神秘";
		case MajorCategory.Equipment:
			if (!flag)
			{
				return "Equipment";
			}
			return "装备";
		case MajorCategory.Consumables:
			if (!flag)
			{
				return "Consumables";
			}
			return "消耗品";
		case MajorCategory.Props:
			if (!flag)
			{
				return "Props";
			}
			return "场景";
		default:
			return "?";
		}
	}

	public static bool IsInMajor(ItemCategory tags, MajorCategory major)
	{
		return major switch
		{
			MajorCategory.All => tags != ItemCategory.None, 
			MajorCategory.Tools => (tags & ItemCategory.Tools) != 0, 
			MajorCategory.Food => (tags & ItemCategory.Food) != 0, 
			MajorCategory.Mystical => (tags & ItemCategory.Mystical) != 0, 
			MajorCategory.Equipment => (tags & ItemCategory.Equipment) != 0, 
			MajorCategory.Consumables => (tags & ItemCategory.Consumables) != 0, 
			MajorCategory.Props => (tags & ItemCategory.Props) != 0, 
			_ => true, 
		};
	}

	public static ItemCategory PrimaryOfTags(ItemCategory tags)
	{
		ItemCategory[] array = new ItemCategory[6]
		{
			ItemCategory.Tools,
			ItemCategory.Food,
			ItemCategory.Mystical,
			ItemCategory.Equipment,
			ItemCategory.Consumables,
			ItemCategory.Props
		};
		for (int i = 0; i < array.Length; i++)
		{
			if ((tags & array[i]) != ItemCategory.None)
			{
				return array[i];
			}
		}
		return ItemCategory.Props;
	}
}
public class ItemListView : MonoBehaviour
{
	public class Entry
	{
		public Item item;

		public string displayName;

		public string enName;

		public string prefabName;

		public string pinyin;

		public ItemCategory tags;

		public ItemCategory primary;
	}

	private Transform _content;

	private Transform _template;

	private TMP_InputField _searchInput;

	private List<Entry> _all = new List<Entry>();

	private MajorCategory _major;

	private string _query = "";

	private TMP_FontAsset _fontLatin;

	private TMP_FontAsset _fontCjk;

	private Action<MajorCategory> _onMajorChanged;

	private bool _subscribedInput;

	private bool _subscribedLanguage;

	public void Init(Transform content, Transform template, TMP_InputField searchInput, Action<MajorCategory> onMajorChanged)
	{
		_content = content;
		_template = template;
		_searchInput = searchInput;
		_onMajorChanged = onMajorChanged;
		_fontLatin = FindFont("DarumaDropOne-Regular SDF");
		_fontCjk = GetGameBaseFont();
		BuildCatalog();
		if ((Object)(object)_searchInput != (Object)null && !_subscribedInput)
		{
			((UnityEvent<string>)(object)_searchInput.onValueChanged).AddListener((UnityAction<string>)OnSearchChanged);
			_subscribedInput = true;
		}
		if (!_subscribedLanguage)
		{
			LocalizedText.OnLangugageChanged = (Action)Delegate.Combine(LocalizedText.OnLangugageChanged, new Action(OnLanguageChanged));
			_subscribedLanguage = true;
		}
		RefreshFonts();
		Rebuild();
	}

	public void SubscribeSearchInput()
	{
		if ((Object)(object)_searchInput != (Object)null)
		{
			((UnityEvent<string>)(object)_searchInput.onValueChanged).RemoveListener((UnityAction<string>)OnSearchChanged);
			((UnityEvent<string>)(object)_searchInput.onValueChanged).AddListener((UnityAction<string>)OnSearchChanged);
			_subscribedInput = true;
		}
	}

	private void OnDestroy()
	{
		LocalizedText.OnLangugageChanged = (Action)Delegate.Remove(LocalizedText.OnLangugageChanged, new Action(OnLanguageChanged));
	}

	public void Stop()
	{
		if (_subscribedLanguage)
		{
			LocalizedText.OnLangugageChanged = (Action)Delegate.Remove(LocalizedText.OnLangugageChanged, new Action(OnLanguageChanged));
			_subscribedLanguage = false;
		}
		if (_subscribedInput && (Object)(object)_searchInput != (Object)null)
		{
			((UnityEvent<string>)(object)_searchInput.onValueChanged).RemoveListener((UnityAction<string>)OnSearchChanged);
			_subscribedInput = false;
		}
	}

	public void SetMajor(MajorCategory major)
	{
		if (_major != major)
		{
			_major = major;
			Rebuild();
			if (_onMajorChanged != null)
			{
				_onMajorChanged(major);
			}
		}
	}

	public void SetQuery(string value)
	{
		_query = value ?? "";
		Rebuild();
	}

	private void OnSearchChanged(string value)
	{
		SetQuery(value);
	}

	private void OnLanguageChanged()
	{
		foreach (Entry item in _all)
		{
			item.displayName = ResolveDisplayName(item.item, item.prefabName);
			item.pinyin = ToPinyin(item.displayName);
		}
		_all.Sort(CompareEntries);
		RefreshFonts();
		UiEnhancer.RefreshButtonLabels();
		Rebuild();
	}

	private void BuildCatalog()
	{
		_all.Clear();
		ItemDatabase instance = SingletonAsset<ItemDatabase>.Instance;
		if ((Object)(object)instance == (Object)null || ((DatabaseAsset<ItemDatabase, Item>)(object)instance).Objects == null)
		{
			return;
		}
		foreach (Item @object in ((DatabaseAsset<ItemDatabase, Item>)(object)instance).Objects)
		{
			try
			{
				if (!((Object)(object)@object == (Object)null))
				{
					string name = ((Object)((Component)@object).gameObject).name;
					if (!string.IsNullOrEmpty(name) && !ItemCatalog.IsHidden(name))
					{
						string text = ResolveDisplayName(@object, name);
						ResolveCategories(@object, name, out var tags, out var primary);
						_all.Add(new Entry
						{
							item = @object,
							displayName = text,
							enName = ResolveEnglishName(@object, name),
							prefabName = name,
							pinyin = ToPinyin(text),
							tags = tags,
							primary = primary
						});
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("ItemSpawnerPlus: 跳过异常物品 " + (((Object)(object)@object != (Object)null) ? ((Object)((Component)@object).gameObject).name : "<null>") + ": " + ex.Message));
			}
		}
		_all.Sort(CompareEntries);
	}

	private static string ResolveDisplayName(Item item, string prefab)
	{
		if (ItemCatalog.ExtraNameKeys.TryGetValue(prefab, out var value))
		{
			string text = LocalizedText.GetText(value, false);
			if (!string.IsNullOrEmpty(text) && !text.StartsWith("LOC:", StringComparison.OrdinalIgnoreCase))
			{
				return text;
			}
		}
		if (ItemCatalog.ExtraCustomNames.TryGetValue(prefab, out var value2) && value2 != null && value2.Length >= 1)
		{
			if (IsChineseLanguage())
			{
				return value2[0];
			}
			if (value2.Length < 2 || string.IsNullOrEmpty(value2[1]))
			{
				return value2[0];
			}
			return value2[1];
		}
		if ((Object)(object)item != (Object)null && item.UIData != null)
		{
			string name = item.GetName();
			if (!string.IsNullOrEmpty(name) && !name.StartsWith("LOC:", StringComparison.OrdinalIgnoreCase))
			{
				return name;
			}
		}
		if ((Object)(object)item != (Object)null && item.UIData != null && !string.IsNullOrEmpty(item.UIData.itemName))
		{
			return item.UIData.itemName;
		}
		return prefab;
	}

	private static string ResolveEnglishName(Item item, string prefab)
	{
		if ((Object)(object)item != (Object)null && item.UIData != null && !string.IsNullOrEmpty(item.UIData.itemName))
		{
			string text = item.UIData.itemName;
			if (text.StartsWith("LOC:", StringComparison.OrdinalIgnoreCase))
			{
				text = text.Substring(4).Trim();
			}
			return text;
		}
		return prefab;
	}

	private static void ResolveCategories(Item item, string prefab, out ItemCategory tags, out ItemCategory primary)
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0037: Unknown result type (might be due to invalid IL or missing references)
		//IL_0052: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0057: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		tags = ItemCategory.None;
		primary = ItemCategory.Props;
		if (ItemCatalog.ItemTagMap.TryGetValue(prefab, out tags))
		{
			primary = ItemCatalog.PrimaryOfTags(tags);
			return;
		}
		if ((Object)(object)item != (Object)null)
		{
			ItemTags itemTags = item.itemTags;
			if ((itemTags & 1) != 0 || (itemTags & 0x40) != 0 || (itemTags & 0x100) != 0 || (itemTags & 0x200) != 0)
			{
				tags |= ItemCategory.Mystical;
			}
			if ((itemTags & 2) != 0 || (itemTags & 4) != 0 || (itemTags & 8) != 0)
			{
				tags |= ItemCategory.Food;
			}
			if ((Object)(object)((Component)item).GetComponent<ItemCooking>() != (Object)null || (Object)(object)((Component)item).GetComponent<Action_Consume>() != (Object)null)
			{
				tags |= ItemCategory.Food;
			}
		}
		if (prefab.IndexOf("Shroom", StringComparison.OrdinalIgnoreCase) >= 0 || prefab.IndexOf("Mushroom", StringComparison.OrdinalIgnoreCase) >= 0 || prefab.IndexOf("Berry", StringComparison.OrdinalIgnoreCase) >= 0)
		{
			tags |= ItemCategory.Food;
		}
		if (prefab.IndexOf("Rope", StringComparison.OrdinalIgnoreCase) >= 0 || prefab.IndexOf("Spike", StringComparison.OrdinalIgnoreCase) >= 0 || prefab.IndexOf("Spool", StringComparison.OrdinalIgnoreCase) >= 0 || prefab.IndexOf("Cannon", StringComparison.OrdinalIgnoreCase) >= 0 || prefab.IndexOf("Shooter", StringComparison.OrdinalIgnoreCase) >= 0)
		{
			tags |= ItemCategory.Tools;
		}
		if (tags == ItemCategory.None)
		{
			tags = ItemCategory.Props;
		}
		primary = ItemCatalog.PrimaryOfTags(tags);
	}

	private static int CompareEntries(Entry a, Entry b)
	{
		int num = a.primary.CompareTo(b.primary);
		if (num != 0)
		{
			return num;
		}
		return string.Compare(a.displayName, b.displayName, StringComparison.OrdinalIgnoreCase);
	}

	private void RefreshFonts()
	{
		TMP_FontAsset val = (NeedsCjkFont() ? _fontCjk : _fontLatin);
		if (!((Object)(object)val == (Object)null) && (Object)(object)_searchInput != (Object)null)
		{
			if ((Object)(object)_searchInput.textComponent != (Object)null)
			{
				_searchInput.textComponent.font = val;
				_searchInput.textComponent.fontSize = 24f;
			}
			Graphic placeholder = _searchInput.placeholder;
			TMP_Text val2 = (TMP_Text)(object)((placeholder is TMP_Text) ? placeholder : null);
			if ((Object)(object)val2 != (Object)null)
			{
				val2.font = val;
				val2.fontSize = 24f;
				val2.text = (IsChineseLanguage() ? "搜索..." : "Search...");
			}
		}
	}

	private void Rebuild()
	{
		//IL_0216: Unknown result type (might be due to invalid IL or missing references)
		//IL_0220: Expected O, but got Unknown
		if ((Object)(object)_content == (Object)null || (Object)(object)_template == (Object)null)
		{
			return;
		}
		for (int num = _content.childCount - 1; num >= 0; num--)
		{
			Transform child = _content.GetChild(num);
			if (!((Object)(object)child == (Object)(object)_template))
			{
				Object.Destroy((Object)(object)((Component)child).gameObject);
			}
		}
		TMP_FontAsset val = (NeedsCjkFont() ? _fontCjk : _fontLatin);
		string text = ((_query == null) ? "" : _query.Trim().ToLowerInvariant());
		string queryNoSpace = text.Replace(" ", "");
		foreach (Entry item in _all)
		{
			if (!Matches(item, text, queryNoSpace))
			{
				continue;
			}
			Transform val2 = Object.Instantiate<Transform>(_template, _content);
			val2.SetAsLastSibling();
			((Object)((Component)val2).gameObject).name = item.prefabName;
			LocalizedText[] componentsInChildren = ((Component)val2).GetComponentsInChildren<LocalizedText>(true);
			for (int i = 0; i < componentsInChildren.Length; i++)
			{
				if ((Object)(object)componentsInChildren[i] != (Object)null)
				{
					Object.Destroy((Object)(object)componentsInChildren[i]);
				}
			}
			Transform val3 = val2.Find("ItemName");
			if ((Object)(object)val3 != (Object)null)
			{
				TextMeshProUGUI component = ((Component)val3).GetComponent<TextMeshProUGUI>();
				if ((Object)(object)component != (Object)null)
				{
					((TMP_Text)component).text = item.displayName;
					if ((Object)(object)val != (Object)null)
					{
						((TMP_Text)component).font = val;
					}
				}
			}
			Transform val4 = val2.Find("ItemIcon");
			if ((Object)(object)val4 != (Object)null)
			{
				RawImage component2 = ((Component)val4).GetComponent<RawImage>();
				if ((Object)(object)component2 != (Object)null && item.item.UIData != null)
				{
					component2.texture = (Texture)(object)item.item.UIData.icon;
				}
			}
			Button component3 = ((Component)val2).GetComponent<Button>();
			if ((Object)(object)component3 != (Object)null)
			{
				Item captured = item.item;
				((UnityEventBase)component3.onClick).RemoveAllListeners();
				((UnityEvent)component3.onClick).AddListener((UnityAction)delegate
				{
					SpawnItem(captured);
				});
			}
			((Component)val2).gameObject.SetActive(true);
		}
		((Component)_template).gameObject.SetActive(false);
	}

	private bool Matches(Entry entry, string query, string queryNoSpace)
	{
		if (!ItemCatalog.IsInMajor(entry.tags, _major))
		{
			return false;
		}
		if (query.Length == 0)
		{
			return true;
		}
		if (entry.displayName != null && entry.displayName.ToLowerInvariant().Contains(query))
		{
			return true;
		}
		if (entry.enName != null && entry.enName.ToLowerInvariant().Contains(query))
		{
			return true;
		}
		if (entry.prefabName != null && entry.prefabName.ToLowerInvariant().Contains(query))
		{
			return true;
		}
		if (entry.pinyin != null && entry.pinyin.Contains(queryNoSpace))
		{
			return true;
		}
		return false;
	}

	private void SpawnItem(Item item)
	{
		if ((Object)(object)item == (Object)null)
		{
			return;
		}
		if (!PhotonNetwork.IsConnected || (Object)(object)Character.localCharacter == (Object)null)
		{
			Plugin.Log.LogWarning((object)("ItemSpawnerPlus: 无法生成 " + ((Object)((Component)item).gameObject).name + "(未连接到房间或本地角色不存在)"));
			return;
		}
		try
		{
			Plugin.Spawn(item);
		}
		catch (Exception ex)
		{
			Plugin.Log.LogError((object)("ItemSpawner Enhancement failed to spawn " + ((Object)((Component)item).gameObject).name + ": " + ex));
		}
	}

	public static string ToPinyin(string text)
	{
		if (string.IsNullOrEmpty(text))
		{
			return "";
		}
		StringBuilder stringBuilder = new StringBuilder(text.Length);
		foreach (char c in text)
		{
			if (c >= '一' && c <= '鿿')
			{
				if (ItemCatalog.PinyinMap.TryGetValue(c, out var value))
				{
					stringBuilder.Append(value);
				}
				else
				{
					stringBuilder.Append(c);
				}
			}
			else if (char.IsLetterOrDigit(c))
			{
				stringBuilder.Append(char.ToLowerInvariant(c));
			}
		}
		return stringBuilder.ToString();
	}

	public static bool NeedsCjkFont()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Invalid comparison between Unknown and I4
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Invalid comparison between Unknown and I4
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0013: Invalid comparison between Unknown and I4
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_0018: Invalid comparison between Unknown and I4
		Language cURRENT_LANGUAGE = LocalizedText.CURRENT_LANGUAGE;
		if ((int)cURRENT_LANGUAGE != 9 && (int)cURRENT_LANGUAGE != 10 && (int)cURRENT_LANGUAGE != 11)
		{
			return (int)cURRENT_LANGUAGE == 12;
		}
		return true;
	}

	public static bool IsChineseLanguage()
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0009: Invalid comparison between Unknown and I4
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Invalid comparison between Unknown and I4
		Language cURRENT_LANGUAGE = LocalizedText.CURRENT_LANGUAGE;
		if ((int)cURRENT_LANGUAGE != 9)
		{
			return (int)cURRENT_LANGUAGE == 10;
		}
		return true;
	}

	public static TMP_FontAsset FindFont(string name)
	{
		TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll<TMP_FontAsset>();
		if (array == null)
		{
			return null;
		}
		for (int i = 0; i < array.Length; i++)
		{
			if ((Object)(object)array[i] != (Object)null && ((Object)array[i]).name == name)
			{
				return array[i];
			}
		}
		return null;
	}

	public static TMP_FontAsset GetGameBaseFont()
	{
		if ((Object)(object)FontFallbackSwapper.instance != (Object)null && (Object)(object)FontFallbackSwapper.instance.mainBaseFont != (Object)null)
		{
			return FontFallbackSwapper.instance.mainBaseFont;
		}
		TMP_FontAsset val = FindFont("Muli SDF");
		if ((Object)(object)val != (Object)null)
		{
			return val;
		}
		val = FindFont("Muli");
		if ((Object)(object)val != (Object)null)
		{
			return val;
		}
		return FindFont("LiberationSans SDF");
	}
}
[BepInPlugin("com.itemspawnerplus.ItemSpawnerPlus", "ItemSpawnerPlus", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	[HarmonyPatch(typeof(ItemSpawnerWindow), "Initialize")]
	private static class Patch_Initialize
	{
		private static void Prefix(ItemSpawnerWindow __instance)
		{
			try
			{
				UiEnhancer.Setup(__instance);
			}
			catch (Exception ex)
			{
				Log.LogError((object)("ItemSpawner Enhancement failed during Initialize prefix: " + ex));
			}
		}

		private static void Postfix(ItemSpawnerWindow __instance)
		{
			if (UiEnhancer.SetupSucceeded)
			{
				SearchScript component = ((Component)__instance).GetComponent<SearchScript>();
				if ((Object)(object)component != (Object)null)
				{
					Object.Destroy((Object)(object)component);
				}
			}
		}
	}

	[HarmonyPatch(typeof(ItemSpawnerWindow), "RefreshEntries")]
	private static class Patch_RefreshEntries
	{
		private static bool Prefix()
		{
			return !UiEnhancer.SetupSucceeded;
		}
	}

	[HarmonyPatch(typeof(WarpOnThrow), "OnDisable")]
	private static class Patch_WarpOnThrow_OnDisable
	{
		private static bool Prefix(WarpOnThrow __instance)
		{
			if ((Object)(object)__instance.trailFX != (Object)null)
			{
				return true;
			}
			try
			{
				MethodInfo method = typeof(WarpOnThrow).GetMethod("OnItemThrown", BindingFlags.Instance | BindingFlags.NonPublic);
				if (method != null)
				{
					Action<Item> value = (Action<Item>)Delegate.CreateDelegate(typeof(Action<Item>), __instance, method);
					GlobalEvents.OnItemThrown = (Action<Item>)Delegate.Remove(GlobalEvents.OnItemThrown, value);
				}
				else
				{
					Log.LogError((object)"ItemSpawnerPlus: WarpOnThrow.OnItemThrown 反射失败,委托未移除,可能泄漏");
				}
				PhotonNetwork.RemoveCallbackTarget((object)__instance);
			}
			catch (Exception ex)
			{
				Log.LogWarning((object)("ItemSpawnerPlus: WarpOnThrow.OnDisable 防御修复异常: " + ex.Message));
			}
			return false;
		}
	}

	internal static ManualLogSource Log { get; private set; }

	private void Awake()
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		Log = ((BaseUnityPlugin)this).Logger;
		new Harmony("com.itemspawnerplus.ItemSpawnerPlus").PatchAll(Assembly.GetExecutingAssembly());
		Log.LogInfo((object)"ItemSpawner Enhancement loaded!");
	}
}
public static class UiEnhancer
{
	internal static bool SetupSucceeded;

	private static readonly List<Button> _categoryButtons = new List<Button>();

	private static readonly List<TextMeshProUGUI> _categoryButtonLabels = new List<TextMeshProUGUI>();

	private static ItemListView _view;

	private static readonly Color ColorIdle = new Color(1f, 1f, 1f, 1f);

	private static readonly Color ColorHover = new Color(0.82f, 0.82f, 0.82f, 1f);

	private static readonly Color ColorSelected = new Color(0.92f, 0.72f, 0.2f, 1f);

	private static MajorCategory _currentMajor = MajorCategory.All;

	public static void Setup(ItemSpawnerWindow window)
	{
		//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
		//IL_0115: Unknown result type (might be due to invalid IL or missing references)
		//IL_011a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0134: Unknown result type (might be due to invalid IL or missing references)
		//IL_014f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		SetupSucceeded = false;
		if ((Object)(object)window == (Object)null)
		{
			Plugin.Log.LogError((object)"ItemSpawnerPlus: Setup abort, window is null.");
			return;
		}
		Transform transform = ((MenuWindow)window).panel.transform;
		Transform val = TransformExtensions.FindChildRecursive(transform, "SearchBar");
		Transform val2 = TransformExtensions.FindChildRecursive(transform, "Scroll View");
		Transform val3 = TransformExtensions.FindChildRecursive(transform, "Content");
		Transform val4 = TransformExtensions.FindChildRecursive(transform, "ItemEntry");
		if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null || (Object)(object)val4 == (Object)null)
		{
			Plugin.Log.LogError((object)"ItemSpawnerPlus: UI nodes not found, abort setup. 原模组列表填充逻辑将保持启用(避免窗口空白)。");
			return;
		}
		TMP_InputField component = ((Component)val).GetComponent<TMP_InputField>();
		Transform parent = val2.parent;
		RectTransform val5 = (RectTransform)(object)((parent is RectTransform) ? parent : null);
		RectTransform val6 = (RectTransform)(object)((val is RectTransform) ? val : null);
		val6.anchorMin = new Vector2(0.5f, 1f);
		val6.anchorMax = new Vector2(0.5f, 1f);
		val6.pivot = new Vector2(0.5f, 1f);
		val6.anchoredPosition = new Vector2(0f, -12f);
		float num;
		if (!((Object)(object)val5 != (Object)null))
		{
			num = 900f;
		}
		else
		{
			Rect rect = val5.rect;
			num = ((Rect)(ref rect)).width;
		}
		float num2 = num;
		val6.sizeDelta = new Vector2(num2 * 0.86f, 50f);
		Transform obj = ((val2 is RectTransform) ? val2 : null);
		((RectTransform)obj).anchoredPosition = new Vector2(0f, -46f);
		((RectTransform)obj).sizeDelta = new Vector2(-26f, -148f);
		CreateCategoryBar(val5, val6);
		if ((Object)(object)_view != (Object)null)
		{
			_view.Stop();
		}
		_view = ((Component)window).gameObject.GetComponent<ItemListView>();
		if ((Object)(object)_view == (Object)null)
		{
			_view = ((Component)window).gameObject.AddComponent<ItemListView>();
		}
		_view.Init(val3, val4, component, OnMajorSelected);
		SearchScript component2 = ((Component)window).GetComponent<SearchScript>();
		if ((Object)(object)component2 != (Object)null)
		{
			Object.Destroy((Object)(object)component2);
		}
		if ((Object)(object)component != (Object)null)
		{
			((UnityEventBase)component.onValueChanged).RemoveAllListeners();
			_view.SubscribeSearchInput();
		}
		OnMajorSelected(MajorCategory.All);
		SetupSucceeded = true;
	}

	internal static void RefreshButtonLabels()
	{
		TMP_FontAsset val = (ItemListView.NeedsCjkFont() ? ItemListView.GetGameBaseFont() : ItemListView.FindFont("DarumaDropOne-Regular SDF"));
		for (int i = 0; i < _categoryButtonLabels.Count; i++)
		{
			TextMeshProUGUI val2 = _categoryButtonLabels[i];
			if (!((Object)(object)val2 == (Object)null))
			{
				((TMP_Text)val2).text = ItemCatalog.GetMajorLabel((MajorCategory)i);
				if ((Object)(object)val != (Object)null)
				{
					((TMP_Text)val2).font = val;
				}
			}
		}
	}

	private static Transform CreateCategoryBar(RectTransform panel, RectTransform searchBar)
	{
		//IL_0018: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_004d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0083: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_009c: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("CategoryBar", new Type[1] { typeof(RectTransform) });
		RectTransform component = val.GetComponent<RectTransform>();
		((Transform)component).SetParent((Transform)(object)panel, false);
		component.anchorMin = new Vector2(0.5f, 1f);
		component.anchorMax = new Vector2(0.5f, 1f);
		component.pivot = new Vector2(0.5f, 1f);
		component.anchoredPosition = new Vector2(0f, -68f);
		Rect rect = panel.rect;
		component.sizeDelta = new Vector2(((Rect)(ref rect)).width * 0.9f, 50f);
		((Transform)component).SetAsLastSibling();
		if ((Object)(object)val.GetComponent<CanvasRenderer>() == (Object)null)
		{
			val.AddComponent<CanvasRenderer>();
		}
		HorizontalLayoutGroup obj = val.AddComponent<HorizontalLayoutGroup>();
		((LayoutGroup)obj).childAlignment = (TextAnchor)4;
		((HorizontalOrVerticalLayoutGroup)obj).spacing = 6f;
		((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = true;
		((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = false;
		((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true;
		((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false;
		TMP_FontAsset font = (ItemListView.NeedsCjkFont() ? ItemListView.GetGameBaseFont() : ItemListView.FindFont("DarumaDropOne-Regular SDF"));
		_categoryButtons.Clear();
		_categoryButtonLabels.Clear();
		MajorCategory[] array = (MajorCategory[])Enum.GetValues(typeof(MajorCategory));
		for (int i = 0; i < array.Length; i++)
		{
			CreateCategoryButton(component, array[i], font);
		}
		return (Transform)(object)component;
	}

	private static void CreateCategoryButton(RectTransform parent, MajorCategory major, TMP_FontAsset font)
	{
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Expected O, but got Unknown
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_008b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_011c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Expected O, but got Unknown
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0131: Unknown result type (might be due to invalid IL or missing references)
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_0139: Expected O, but got Unknown
		//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_0157: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Expected O, but got Unknown
		//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
		//IL_01db: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
		//IL_0236: Unknown result type (might be due to invalid IL or missing references)
		//IL_0256: Unknown result type (might be due to invalid IL or missing references)
		//IL_025b: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject("CatButton", new Type[4]
		{
			typeof(RectTransform),
			typeof(CanvasRenderer),
			typeof(Image),
			typeof(Button)
		});
		RectTransform component = val.GetComponent<RectTransform>();
		((Transform)component).SetParent((Transform)(object)parent, false);
		component.sizeDelta = new Vector2(0f, 50f);
		Image image = val.GetComponent<Image>();
		image.sprite = null;
		((Graphic)image).color = ColorIdle;
		((Graphic)image).raycastTarget = true;
		Button button = val.GetComponent<Button>();
		((Selectable)button).targetGraphic = (Graphic)(object)image;
		((Selectable)button).transition = (Transition)0;
		Outline obj = val.AddComponent<Outline>();
		((Shadow)obj).effectColor = new Color(0f, 0f, 0f, 1f);
		((Shadow)obj).effectDistance = new Vector2(1f, 1f);
		MajorCategory captured = major;
		((UnityEvent)button.onClick).AddListener((UnityAction)delegate
		{
			OnMajorSelected(captured);
		});
		EventTrigger obj2 = val.AddComponent<EventTrigger>();
		Entry val2 = new Entry
		{
			eventID = (EventTriggerType)0
		};
		((UnityEvent<BaseEventData>)(object)val2.callback).AddListener((UnityAction<BaseEventData>)delegate
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (_categoryButtons.IndexOf(button) != (int)_currentMajor)
			{
				((Graphic)image).color = ColorHover;
			}
		});
		Entry val3 = new Entry
		{
			eventID = (EventTriggerType)1
		};
		((UnityEvent<BaseEventData>)(object)val3.callback).AddListener((UnityAction<BaseEventData>)delegate
		{
			RefreshButtonColor(_categoryButtons.IndexOf(button));
		});
		obj2.triggers.Add(val2);
		obj2.triggers.Add(val3);
		GameObject val4 = new GameObject("Label", new Type[3]
		{
			typeof(RectTransform),
			typeof(CanvasRenderer),
			typeof(TextMeshProUGUI)
		});
		val4.transform.SetParent(val.transform, false);
		RectTransform component2 = val4.GetComponent<RectTransform>();
		component2.anchorMin = Vector2.zero;
		component2.anchorMax = Vector2.one;
		component2.offsetMin = Vector2.zero;
		component2.offsetMax = Vector2.zero;
		TextMeshProUGUI component3 = val4.GetComponent<TextMeshProUGUI>();
		((TMP_Text)component3).font = font;
		((TMP_Text)component3).fontSize = 22f;
		((TMP_Text)component3).fontStyle = (FontStyles)1;
		((TMP_Text)component3).alignment = (TextAlignmentOptions)514;
		((Graphic)component3).color = Color.white;
		((Graphic)component3).raycastTarget = false;
		((TMP_Text)component3).outlineWidth = 0.14f;
		((TMP_Text)component3).outlineColor = Color32.op_Implicit(Color.black);
		((TMP_Text)component3).text = ItemCatalog.GetMajorLabel(major);
		_categoryButtons.Add(button);
		_categoryButtonLabels.Add(component3);
	}

	private static void RefreshButtonColor(int index)
	{
		//IL_0041: Unknown result type (might be due to invalid IL or missing references)
		//IL_003a: Unknown result type (might be due to invalid IL or missing references)
		if (index >= 0 && index < _categoryButtons.Count)
		{
			Graphic targetGraphic = ((Selectable)_categoryButtons[index]).targetGraphic;
			Image val = (Image)(object)((targetGraphic is Image) ? targetGraphic : null);
			if ((Object)(object)val != (Object)null)
			{
				((Graphic)val).color = ((index == (int)_currentMajor) ? ColorSelected : ColorIdle);
			}
		}
	}

	private static void OnMajorSelected(MajorCategory major)
	{
		_currentMajor = major;
		if ((Object)(object)_view != (Object)null)
		{
			_view.SetMajor(major);
		}
		for (int i = 0; i < _categoryButtons.Count; i++)
		{
			RefreshButtonColor(i);
		}
	}

	private static Sprite FindSprite(string name)
	{
		Sprite[] array = Resources.FindObjectsOfTypeAll<Sprite>();
		if (array == null)
		{
			return null;
		}
		for (int i = 0; i < array.Length; i++)
		{
			if ((Object)(object)array[i] != (Object)null && ((Object)array[i]).name == name)
			{
				return array[i];
			}
		}
		return null;
	}
}