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 ItemTagMap = new Dictionary(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 ExtraNameKeys = new Dictionary(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 ExtraCustomNames = new Dictionary(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 HiddenExact = new HashSet(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 PinyinMap = new Dictionary { { '一', "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 _all = new List(); private MajorCategory _major; private string _query = ""; private TMP_FontAsset _fontLatin; private TMP_FontAsset _fontCjk; private Action _onMajorChanged; private bool _subscribedInput; private bool _subscribedLanguage; public void Init(Transform content, Transform template, TMP_InputField searchInput, Action 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)(object)_searchInput.onValueChanged).AddListener((UnityAction)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)(object)_searchInput.onValueChanged).RemoveListener((UnityAction)OnSearchChanged); ((UnityEvent)(object)_searchInput.onValueChanged).AddListener((UnityAction)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)(object)_searchInput.onValueChanged).RemoveListener((UnityAction)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.Instance; if ((Object)(object)instance == (Object)null || ((DatabaseAsset)(object)instance).Objects == null) { return; } foreach (Item @object in ((DatabaseAsset)(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 : "") + ": " + 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() != (Object)null || (Object)(object)((Component)item).GetComponent() != (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(_template, _content); val2.SetAsLastSibling(); ((Object)((Component)val2).gameObject).name = item.prefabName; LocalizedText[] componentsInChildren = ((Component)val2).GetComponentsInChildren(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(); 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(); if ((Object)(object)component2 != (Object)null && item.item.UIData != null) { component2.texture = (Texture)(object)item.item.UIData.icon; } } Button component3 = ((Component)val2).GetComponent