The BepInEx console will not appear when launching like it does for other games on Thunderstore (you can turn it back on in your BepInEx.cfg file). If your PEAK crashes on startup, add -dx12 to your launch parameters.
Decompiled source of PEAK Traditional Chinese Translation v1.0.13
BepInEx/plugins/com.voc.ItemInfoDisplay.dll
Decompiled a week agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Peak.Afflictions; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("com.voc.ItemInfoDisplay")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.13.0")] [assembly: AssemblyInformationalVersion("1.0.13+6a43e52635cc34562ab088505e3bfe034d21de40")] [assembly: AssemblyProduct("com.voc.ItemInfoDisplay")] [assembly: AssemblyTitle("ItemInfoDisplay")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.13.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace ItemInfoDisplay { internal enum EffectColors { HUNGER = 16760086, EXTRA_STAMINA = 12577819, INJURY = 16732928, CRAB = 14759234, POISON = 10566143, COLD = 48383, HEAT = 13109528, SLEEPY = 16735396, DROWSY = 16735397, CURSE = 1769539, WEIGHT = 10902044, THORNS = 7769600, SHIELD = 13929984, ITEM_INFO_DISPLAY_POSITIVE = 14548957, ITEM_INFO_DISPLAY_NEGATIVE = 16764108 } internal static class EffectColorMethods { public static string HexTag(this EffectColors eff) { return "<#" + eff.ToString("X").Substring(2) + ">"; } } [BepInPlugin("com.voc.ItemInfoDisplay", "ItemInfoDisplay", "1.0.13")] public class Plugin : BaseUnityPlugin { private static class ItemInfoDisplayUpdatePatch { [HarmonyPatch(typeof(CharacterItems), "Update")] [HarmonyPostfix] private static void ItemInfoDisplayUpdate(CharacterItems __instance) { if (!configIsEnableIID.Value) { return; } try { if ((Object)(object)guiManager == (Object)null) { AddDisplayObject(); } else if ((Object)(object)Character.observedCharacter.data.currentItem != (Object)null) { if (hasChanged) { hasChanged = false; ProcessItemGameObject(); } else if (Mathf.Abs(Character.observedCharacter.data.sinceItemAttach - lastKnownSinceItemAttach) >= configForceUpdateTime.Value) { hasChanged = true; lastKnownSinceItemAttach = Character.observedCharacter.data.sinceItemAttach; } if (!((Component)itemInfoDisplayTextMesh).gameObject.activeSelf) { ((Component)itemInfoDisplayTextMesh).gameObject.SetActive(true); } } else if (((Component)itemInfoDisplayTextMesh).gameObject.activeSelf) { ((Component)itemInfoDisplayTextMesh).gameObject.SetActive(false); } } catch (Exception ex) { Log.LogError((object)(ex.Message + ex.StackTrace)); } } } private static class ItemInfoDisplayEquipPatch { [HarmonyPatch(typeof(CharacterItems), "Equip")] [HarmonyPostfix] private static void ItemInfoDisplayEquip(CharacterItems __instance) { try { if (Character.observedCharacter == __instance.character) { hasChanged = true; } } catch (Exception ex) { Log.LogError((object)(ex.Message + ex.StackTrace)); } } } private static class ItemInfoDisplayFinishCookingPatch { [HarmonyPatch(typeof(ItemCooking), "FinishCooking")] [HarmonyPostfix] private static void ItemInfoDisplayFinishCooking(ItemCooking __instance) { try { if (Character.observedCharacter == ((ItemComponent)__instance).item.holderCharacter) { hasChanged = true; } } catch (Exception ex) { Log.LogError((object)(ex.Message + ex.StackTrace)); } } } private static class ItemInfoDisplayReduceUsesRPCPatch { [HarmonyPatch(typeof(Action_ReduceUses), "ReduceUsesRPC")] [HarmonyPostfix] private static void ItemInfoDisplayReduceUsesRPC(Action_ReduceUses __instance) { try { if (Character.observedCharacter == ((ItemActionBase)__instance).character) { hasChanged = true; } } catch (Exception ex) { Log.LogError((object)(ex.Message + ex.StackTrace)); } } } private static GUIManager guiManager; private static TextMeshProUGUI itemInfoDisplayTextMesh; private static float lastKnownSinceItemAttach; private static bool hasChanged; private static ConfigEntry<float> configFontSize; private static ConfigEntry<float> configOutlineWidth; private static ConfigEntry<float> configLineSpacing; private static ConfigEntry<float> configSizeDeltaX; private static ConfigEntry<float> configForceUpdateTime; private static ConfigEntry<bool> configIsEnableIID; public const string Id = "com.voc.ItemInfoDisplay"; internal static ManualLogSource Log { get; private set; } public static string Name => "ItemInfoDisplay"; public static string Version => "1.0.13"; private void Awake() { Log = ((BaseUnityPlugin)this).Logger; lastKnownSinceItemAttach = 0f; hasChanged = true; configFontSize = ((BaseUnityPlugin)this).Config.Bind<float>("ItemInfoDisplay", "Font Size", 20f, "調整物品描述文字的字體大小。"); configOutlineWidth = ((BaseUnityPlugin)this).Config.Bind<float>("ItemInfoDisplay", "Outline Width", 0.08f, "調整物品描述文字的輪廓寬度。"); configLineSpacing = ((BaseUnityPlugin)this).Config.Bind<float>("ItemInfoDisplay", "Line Spacing", -35f, "調整物品描述文字的行距。"); configSizeDeltaX = ((BaseUnityPlugin)this).Config.Bind<float>("ItemInfoDisplay", "Size Delta X", 550f, "調整物品描述文字容器的水平長度。增加會將文字向左移動,減少會將文字向右移動。"); configForceUpdateTime = ((BaseUnityPlugin)this).Config.Bind<float>("ItemInfoDisplay", "Force Update Time", 1f, "調整物品強制更新的時間(秒)。"); configIsEnableIID = ((BaseUnityPlugin)this).Config.Bind<bool>("ItemInfoDisplay", "Is Enable ItemInfoDisplay", true, "是否啟用ItemInfoDisplay?"); Harmony.CreateAndPatchAll(typeof(ItemInfoDisplayUpdatePatch), (string)null); Harmony.CreateAndPatchAll(typeof(ItemInfoDisplayEquipPatch), (string)null); Harmony.CreateAndPatchAll(typeof(ItemInfoDisplayFinishCookingPatch), (string)null); Harmony.CreateAndPatchAll(typeof(ItemInfoDisplayReduceUsesRPCPatch), (string)null); Log.LogInfo((object)("Plugin " + Name + " is loaded! (Modified Version by Vocaloid2048) - Is Enabled? " + configIsEnableIID.Value)); } private static void ProcessItemGameObject() { //IL_0aa9: Unknown result type (might be due to invalid IL or missing references) //IL_0ab0: Expected O, but got Unknown //IL_09bb: Unknown result type (might be due to invalid IL or missing references) //IL_09c0: Unknown result type (might be due to invalid IL or missing references) Item currentItem = Character.observedCharacter.data.currentItem; GameObject gameObject = ((Component)currentItem).gameObject; Component[] components = gameObject.GetComponents(typeof(Component)); bool flag = false; string text = ""; string text2 = ""; string text3 = ""; string text4 = ""; string text5 = ""; ((TMP_Text)itemInfoDisplayTextMesh).text = ""; text2 = text2 + EffectColors.HUNGER.HexTag() + "負重:" + PrettyCount((float)(currentItem.carryWeight + Mathf.Min(Ascents.itemWeightModifier, 0)) * 2.5f, 1) + "點</color>\n"; TextMeshProUGUI val; switch (((Object)gameObject).name) { case "Bugle(Clone)": { TextMeshProUGUI obj7 = itemInfoDisplayTextMesh; ((TMP_Text)obj7).text = ((TMP_Text)obj7).text + "圍着隊友吹響它吧!\n" + EffectColors.HEAT.HexTag() + "然後就會有人過來打扁你(誤</color>"; break; } case "Pirate Compass(Clone)": { TextMeshProUGUI obj6 = itemInfoDisplayTextMesh; ((TMP_Text)obj6).text = ((TMP_Text)obj6).text + EffectColors.INJURY.HexTag() + "指向</color>最近的行李箱\n"; break; } case "Compass(Clone)": { TextMeshProUGUI obj5 = itemInfoDisplayTextMesh; ((TMP_Text)obj5).text = ((TMP_Text)obj5).text + EffectColors.INJURY.HexTag() + "指向</color>山頂\n"; break; } case "Shell Big(Clone)": { TextMeshProUGUI obj4 = itemInfoDisplayTextMesh; ((TMP_Text)obj4).text = ((TMP_Text)obj4).text + "試試把它" + EffectColors.HUNGER.HexTag() + "丟向</color>椰子\n"; break; } case "Backpack(Clone)": { TextMeshProUGUI obj3 = itemInfoDisplayTextMesh; ((TMP_Text)obj3).text = ((TMP_Text)obj3).text + "放下背包才可放入物品\n"; break; } case "Megaphone(Clone)": { TextMeshProUGUI obj2 = itemInfoDisplayTextMesh; ((TMP_Text)obj2).text = ((TMP_Text)obj2).text + "感覺聲音太小了嗎?可以試試用它來喊話哦~\n" + EffectColors.HEAT.HexTag() + "我可沒有叫你對着隊友叫賣</color>\n"; break; } case "AloeVera(Clone)": val = itemInfoDisplayTextMesh; ((TMP_Text)val).text = ((TMP_Text)val).text + "食用後可以減少 " + EffectColors.HEAT.HexTag() + "50 點" + EffectColorLocalName(EffectColors.HEAT) + "</color>\n"; break; case "Cure-All(Clone)": { TextMeshProUGUI obj = itemInfoDisplayTextMesh; ((TMP_Text)obj).text = ((TMP_Text)obj).text + "飲用後可以幫助消除多種負面狀態</color>\n"; break; } } string text6 = ((Object)gameObject).name.ToUpper(); if (text6 != null) { if (text6.Contains("WINTERBERRY")) { TextMeshProUGUI obj8 = itemInfoDisplayTextMesh; ((TMP_Text)obj8).text = ((TMP_Text)obj8).text + "放心,這個能吃的(應該吧\n"; } else { string text7 = text6; if (text7.Contains("PRICKLEBERRY")) { TextMeshProUGUI obj9 = itemInfoDisplayTextMesh; ((TMP_Text)obj9).text = ((TMP_Text)obj9).text + "小心有刺!你必須靠其他玩家幫忙才能拔走身上的刺!\n"; } else { string text8 = text6; if (text8.Contains("SCORCHBERRY")) { TextMeshProUGUI obj10 = itemInfoDisplayTextMesh; ((TMP_Text)obj10).text = ((TMP_Text)obj10).text + EffectColorLocalName(EffectColors.HEAT) + "好辣!</color>\n"; } else { string text9 = text6; if (text9.Contains("SUNSCREEN")) { TextMeshProUGUI obj11 = itemInfoDisplayTextMesh; ((TMP_Text)obj11).text = ((TMP_Text)obj11).text + "為玩家提供 90 秒的防曬効果,留意最多只能用三次哦!\n"; } } } } } foreach (Component val2 in components) { ItemUseFeedback val3 = (ItemUseFeedback)(object)((val2 is ItemUseFeedback) ? val2 : null); if (val3 == null) { Action_Consume val4 = (Action_Consume)(object)((val2 is Action_Consume) ? val2 : null); if (val4 == null) { Action_RestoreHunger val5 = (Action_RestoreHunger)(object)((val2 is Action_RestoreHunger) ? val2 : null); if (val5 == null) { Action_GiveExtraStamina val6 = (Action_GiveExtraStamina)(object)((val2 is Action_GiveExtraStamina) ? val2 : null); if (val6 == null) { Action_InflictPoison val7 = (Action_InflictPoison)(object)((val2 is Action_InflictPoison) ? val2 : null); if (val7 == null) { Action_AddOrRemoveThorns val8 = (Action_AddOrRemoveThorns)(object)((val2 is Action_AddOrRemoveThorns) ? val2 : null); if (val8 == null) { Action_ModifyStatus val9 = (Action_ModifyStatus)(object)((val2 is Action_ModifyStatus) ? val2 : null); if (val9 == null) { Action_ApplyMassAffliction val10 = (Action_ApplyMassAffliction)(object)((val2 is Action_ApplyMassAffliction) ? val2 : null); if (val10 == null) { Action_ApplyAffliction val11 = (Action_ApplyAffliction)(object)((val2 is Action_ApplyAffliction) ? val2 : null); if (val11 == null) { Action_ClearAllStatus val12 = (Action_ClearAllStatus)(object)((val2 is Action_ClearAllStatus) ? val2 : null); if (val12 == null) { Action_ConsumeAndSpawn val13 = (Action_ConsumeAndSpawn)(object)((val2 is Action_ConsumeAndSpawn) ? val2 : null); if (val13 == null) { Action_ReduceUses val14 = (Action_ReduceUses)(object)((val2 is Action_ReduceUses) ? val2 : null); if (val14 == null) { Lantern val15 = (Lantern)(object)((val2 is Lantern) ? val2 : null); if (val15 == null) { Action_RaycastDart val16 = (Action_RaycastDart)(object)((val2 is Action_RaycastDart) ? val2 : null); if (val16 == null) { MagicBugle val17 = (MagicBugle)(object)((val2 is MagicBugle) ? val2 : null); if (val17 == null) { ClimbingSpikeComponent val18 = (ClimbingSpikeComponent)(object)((val2 is ClimbingSpikeComponent) ? val2 : null); if (val18 == null) { Action_Flare val19 = (Action_Flare)(object)((val2 is Action_Flare) ? val2 : null); if (val19 == null) { Backpack val20 = (Backpack)(object)((val2 is Backpack) ? val2 : null); if (val20 == null) { BananaPeel val21 = (BananaPeel)(object)((val2 is BananaPeel) ? val2 : null); if (val21 == null) { ScoutEffigy val22 = (ScoutEffigy)(object)((val2 is ScoutEffigy) ? val2 : null); if (val22 == null) { Constructable val23 = (Constructable)(object)((val2 is Constructable) ? val2 : null); if (val23 == null) { RopeSpool val24 = (RopeSpool)(object)((val2 is RopeSpool) ? val2 : null); if (val24 == null) { RopeShooter val25 = (RopeShooter)(object)((val2 is RopeShooter) ? val2 : null); if (val25 == null) { Antigrav val26 = (Antigrav)(object)((val2 is Antigrav) ? val2 : null); if (val26 == null) { Action_Balloon val27 = (Action_Balloon)(object)((val2 is Action_Balloon) ? val2 : null); if (val27 == null) { VineShooter val28 = (VineShooter)(object)((val2 is VineShooter) ? val2 : null); if (val28 == null) { ShelfShroom val29 = (ShelfShroom)(object)((val2 is ShelfShroom) ? val2 : null); if (val29 == null) { Action_Die val30 = (Action_Die)(object)((val2 is Action_Die) ? val2 : null); if (val30 == null) { Action_SpawnGuidebookPage val31 = (Action_SpawnGuidebookPage)(object)((val2 is Action_SpawnGuidebookPage) ? val2 : null); if (val31 == null) { Action_Guidebook val32 = (Action_Guidebook)(object)((val2 is Action_Guidebook) ? val2 : null); if (val32 == null) { Action_CallScoutmaster val33 = (Action_CallScoutmaster)(object)((val2 is Action_CallScoutmaster) ? val2 : null); if (val33 == null) { Action_MoraleBoost val34 = (Action_MoraleBoost)(object)((val2 is Action_MoraleBoost) ? val2 : null); if (val34 == null) { Breakable val35 = (Breakable)(object)((val2 is Breakable) ? val2 : null); if (val35 == null) { Bonkable val36 = (Bonkable)(object)((val2 is Bonkable) ? val2 : null); if (val36 == null) { MagicBean val37 = (MagicBean)(object)((val2 is MagicBean) ? val2 : null); if (val37 == null) { BingBong val38 = (BingBong)(object)((val2 is BingBong) ? val2 : null); if (val38 == null) { Action_Passport val39 = (Action_Passport)(object)((val2 is Action_Passport) ? val2 : null); if (val39 == null) { Actions_Binoculars val40 = (Actions_Binoculars)(object)((val2 is Actions_Binoculars) ? val2 : null); if (val40 == null) { Action_WarpToRandomPlayer val41 = (Action_WarpToRandomPlayer)(object)((val2 is Action_WarpToRandomPlayer) ? val2 : null); if (val41 == null) { Action_WarpToBiome val42 = (Action_WarpToBiome)(object)((val2 is Action_WarpToBiome) ? val2 : null); if (val42 == null) { Parasol val43 = (Parasol)(object)((val2 is Parasol) ? val2 : null); if (val43 == null) { Frisbee val44 = (Frisbee)(object)((val2 is Frisbee) ? val2 : null); if (val44 == null) { Action_ConstructableScoutCannonScroll val45 = (Action_ConstructableScoutCannonScroll)(object)((val2 is Action_ConstructableScoutCannonScroll) ? val2 : null); if (val45 == null) { Dynamite val46 = (Dynamite)(object)((val2 is Dynamite) ? val2 : null); if (val46 == null) { Scorpion val47 = (Scorpion)(object)((val2 is Scorpion) ? val2 : null); if (val47 == null) { Action_Spawn val48 = (Action_Spawn)(object)((val2 is Action_Spawn) ? val2 : null); if (val48 == null) { CactusBall val49 = (CactusBall)(object)((val2 is CactusBall) ? val2 : null); if (val49 == null) { BingBongShieldWhileHolding val50 = (BingBongShieldWhileHolding)(object)((val2 is BingBongShieldWhileHolding) ? val2 : null); if (val50 == null) { ItemCooking val51 = (ItemCooking)(object)((val2 is ItemCooking) ? val2 : null); if (val51 == null) { continue; } if (val51.wreckWhenCooked) { text4 = text4 + "\n" + EffectColors.CURSE.HexTag() + ((val51.timesCookedLocal >= 1) ? "因為被烤而壞掉</color>" : "拿去烤的話會壞掉</color>"); continue; } switch (val51.timesCookedLocal) { case 0: text4 = text4 + "\n" + EffectColors.EXTRA_STAMINA.HexTag() + "可被烤</color>"; continue; case 1: text4 = text4 + "\n" + EffectColors.EXTRA_STAMINA.HexTag() + "烤過 1 次</color>\n - " + EffectColors.HUNGER.HexTag() + "可被烤</color>"; continue; case 2: text4 = text4 + "\n" + EffectColors.HUNGER.HexTag() + "烤過 2 次</color>\n - " + EffectColors.INJURY.HexTag() + "可被烤</color>"; continue; case 3: text4 = text4 + "\n" + EffectColors.INJURY.HexTag() + "烤過 3 次</color>\n - " + EffectColors.POISON.HexTag() + "可被烤</color>"; continue; } if (val51.timesCookedLocal >= 12) { text4 = text4 + "\n" + EffectColors.CURSE.HexTag() + "烤過 " + val51.timesCookedLocal + " 次 - 不可被烤</color>"; } else if (val51.timesCookedLocal >= 4) { text4 = text4 + "\n" + EffectColors.POISON.HexTag() + "烤過 " + val51.timesCookedLocal + " 次 - 可被烤</color>"; } } else { TextMeshProUGUI obj12 = itemInfoDisplayTextMesh; ((TMP_Text)obj12).text = ((TMP_Text)obj12).text + "<#CCCCCC>裝備時將會獲得:</color>\n" + EffectColors.SHIELD.HexTag() + "護盾</color>(無敵狀態)\n"; } } else { val = itemInfoDisplayTextMesh; ((TMP_Text)val).text = ((TMP_Text)val).text + "需要至少用" + PrettyCount(((StickyItemComponent)val49).throwChargeRequirement * 100f, 1) + "% 的力" + EffectColors.HUNGER.HexTag() + "丟出去</color>\n不然就會" + EffectColors.THORNS.HexTag() + "黏</color>在你身上\n"; } } else if (((Object)val48.objectToSpawn).name.Equals("VFX_Sunscreen")) { AOE component = ((Component)val48.objectToSpawn.transform.Find("AOE")).GetComponent<AOE>(); RemoveAfterSeconds component2 = ((Component)val48.objectToSpawn.transform.Find("AOE")).GetComponent<RemoveAfterSeconds>(); val = itemInfoDisplayTextMesh; ((TMP_Text)val).text = ((TMP_Text)val).text + "<#CCCCCC>噴灑一個持續" + PrettyCount(component2.seconds, 1) + "秒</color>的霧氣,會造成以下效果:\n" + ProcessAffliction(component.affliction); } } else if (configForceUpdateTime.Value <= 1f) { float num = Mathf.Max(0.5f, 1f - currentItem.holderCharacter.refs.afflictions.statusSum + 0.05f) * 100f; val = itemInfoDisplayTextMesh; ((TMP_Text)val).text = ((TMP_Text)val).text + "如果蠍子活着的話會" + EffectColors.POISON.HexTag() + "螫</color>你\n在" + EffectColors.HEAT.HexTag() + "烤熟</color>後會" + EffectColors.HEAT.HexTag() + "死掉</color>\n\n<#CCCCCC>每被螫一次會持續</color>" + EffectColors.POISON.HexTag() + PrettyCount(val47.totalPoisonTime, 1) + "秒</color>,共獲得" + PrettyCount(num, 1) + " 點毒素</color>\n<#CCCCCC>(若目前十分健康會造成更多傷害)</color>\n"; } else { val = itemInfoDisplayTextMesh; ((TMP_Text)val).text = ((TMP_Text)val).text + "IF ALIVE, " + EffectColors.POISON.HexTag() + "STINGS</color> YOU\n" + EffectColors.CURSE.HexTag() + "DIES</color> WHEN " + EffectColors.HEAT.HexTag() + "COOKED</color>\n\n<#CCCCCC>NEXT STING WILL DEAL:</color>\nAT LEAST " + EffectColors.POISON.HexTag() + "50 POISON</color> OVER " + PrettyCount(val47.totalPoisonTime, 1) + "s\nAT MOST " + EffectColors.POISON.HexTag() + "105 POISON</color> OVER " + PrettyCount(val47.totalPoisonTime, 1) + "s\n<#CCCCCC>(MORE DAMAGE IF HEALTHY)</color>\n"; } } else { val = itemInfoDisplayTextMesh; ((TMP_Text)val).text = ((TMP_Text)val).text + EffectColors.INJURY.HexTag() + "爆炸</color>造成最多" + EffectColors.INJURY.HexTag() + PrettyCount(val46.explosionPrefab.GetComponent<AOE>().statusAmount * 100f, 1) + " 傷害</color>\n<#CCCCCC>拿着引爆會受到額外傷害</color>\n"; } } else { TextMeshProUGUI obj13 = itemInfoDisplayTextMesh; ((TMP_Text)obj13).text = ((TMP_Text)obj13).text + "\n<#CCCCCC>放下後透過點燃導火線</color>\n來把大砲中的偵察兵發射出去\n"; } } else { TextMeshProUGUI obj14 = itemInfoDisplayTextMesh; ((TMP_Text)obj14).text = ((TMP_Text)obj14).text + "把它" + EffectColors.HUNGER.HexTag() + "丟出去</color>\n"; } } else { val = itemInfoDisplayTextMesh; ((TMP_Text)val).text = ((TMP_Text)val).text + "打開遮陽傘來減緩下降速度\n還能在台地避免太陽直射造成" + EffectColors.HEAT.HexTag() + EffectColorLocalName(EffectColors.HEAT) + "傷害\n"; } } else { TextMeshProUGUI obj15 = itemInfoDisplayTextMesh; ((TMP_Text)obj15).text = ((TMP_Text)obj15).text + "傳送到" + ((object)(Segment)(ref val42.segmentToWarpTo)).ToString().ToUpper() + "\n"; } } else { TextMeshProUGUI obj16 = itemInfoDisplayTextMesh; ((TMP_Text)obj16).text = ((TMP_Text)obj16).text + "傳送到隨機玩家身邊\n"; } } else { TextMeshProUGUI obj17 = itemInfoDisplayTextMesh; ((TMP_Text)obj17).text = ((TMP_Text)obj17).text + "用來看得更遠\n"; } } else { TextMeshProUGUI obj18 = itemInfoDisplayTextMesh; ((TMP_Text)obj18).text = ((TMP_Text)obj18).text + "打開護照來自訂角色\n"; } } else { TextMeshProUGUI obj19 = itemInfoDisplayTextMesh; ((TMP_Text)obj19).text = ((TMP_Text)obj19).text + "兵幫航空的吉祥物\n"; } } else { val = itemInfoDisplayTextMesh; ((TMP_Text)val).text = ((TMP_Text)val).text + EffectColors.HUNGER.HexTag() + "丟出</color>後會種下垂直向上生長的藤蔓,\n最長可達" + PrettyCount(val37.plantPrefab.maxLength / 2f, 1) + "公尺或直到碰到東西為止\n"; } } else { TextMeshProUGUI obj20 = itemInfoDisplayTextMesh; ((TMP_Text)obj20).text = ((TMP_Text)obj20).text + "被丟到頭的玩家會" + EffectColors.INJURY.HexTag() + "暈倒</color>\n"; } } else { TextMeshProUGUI obj21 = itemInfoDisplayTextMesh; ((TMP_Text)obj21).text = ((TMP_Text)obj21).text + EffectColors.HUNGER.HexTag() + "丟出</color>後會裂開\n"; } } else if (val34.boostRadius < 0f) { val = itemInfoDisplayTextMesh; ((TMP_Text)val).text = ((TMP_Text)val).text + EffectColors.ITEM_INFO_DISPLAY_POSITIVE.HexTag() + "獲得</color> " + EffectColors.EXTRA_STAMINA.HexTag() + PrettyCount(val34.baselineStaminaBoost * 100f, 1) + " 點額外士氣</color>\n"; } else if (val34.boostRadius > 0f) { val = itemInfoDisplayTextMesh; ((TMP_Text)val).text = ((TMP_Text)val).text + "<#CCCCCC>最近的玩家</color>" + EffectColors.ITEM_INFO_DISPLAY_POSITIVE.HexTag() + "會獲得</color> " + EffectColors.EXTRA_STAMINA.HexTag() + PrettyCount(val34.baselineStaminaBoost * 100f, 1) + " 點額外士氣</color>\n"; } } else { TextMeshProUGUI obj22 = itemInfoDisplayTextMesh; ((TMP_Text)obj22).text = ((TMP_Text)obj22).text + EffectColors.INJURY.HexTag() + "使用後會打破規則0</color>\n"; } } else { TextMeshProUGUI obj23 = itemInfoDisplayTextMesh; ((TMP_Text)obj23).text = ((TMP_Text)obj23).text + "可被閱讀\n"; } } else { flag = true; TextMeshProUGUI obj24 = itemInfoDisplayTextMesh; ((TMP_Text)obj24).text = ((TMP_Text)obj24).text + "可被開啟\n"; } } else { TextMeshProUGUI obj25 = itemInfoDisplayTextMesh; ((TMP_Text)obj25).text = ((TMP_Text)obj25).text + "用了就" + EffectColors.CURSE.HexTag() + "死翹翹</color>了\n"; } } else if (((Object)val29.instantiateOnBreak).name.Equals("HealingPuffShroomSpawn")) { GameObject gameObject2 = ((Component)val29.instantiateOnBreak.transform.Find("VFX_SporeHealingExplo")).gameObject; AOE component3 = gameObject2.GetComponent<AOE>(); GameObject gameObject3 = ((Component)gameObject2.transform.Find("VFX_SporePoisonExplo")).gameObject; AOE component4 = gameObject3.GetComponent<AOE>(); AOE[] components2 = gameObject3.GetComponents<AOE>(); TimeEvent component5 = gameObject3.GetComponent<TimeEvent>(); RemoveAfterSeconds component6 = gameObject3.GetComponent<RemoveAfterSeconds>(); TextMeshProUGUI obj26 = itemInfoDisplayTextMesh; ((TMP_Text)obj26).text = ((TMP_Text)obj26).text + EffectColors.HUNGER.HexTag() + "丟出</color>後會釋放出氣體,效果為:\n"; TextMeshProUGUI obj27 = itemInfoDisplayTextMesh; ((TMP_Text)obj27).text = ((TMP_Text)obj27).text + ProcessEffect(Mathf.Round(component3.statusAmount * 0.9f * 40f) / 40f, GetEffectColorsByStr(((object)(STATUSTYPE)(ref component3.statusType)).ToString())) + "\n"; TextMeshProUGUI obj28 = itemInfoDisplayTextMesh; ((TMP_Text)obj28).text = ((TMP_Text)obj28).text + ProcessEffectOverTime(Mathf.Round(component4.statusAmount * (1f / component5.rate) * 40f) / 40f, 1f, component6.seconds, GetEffectColorsByStr(((object)(STATUSTYPE)(ref component4.statusType)).ToString())) + "\n"; if (components2.Length > 1) { TextMeshProUGUI obj29 = itemInfoDisplayTextMesh; ((TMP_Text)obj29).text = ((TMP_Text)obj29).text + ProcessEffectOverTime(Mathf.Round(components2[1].statusAmount * (1f / component5.rate) * 40f) / 40f, 1f, component6.seconds + 1f, GetEffectColorsByStr(((object)(STATUSTYPE)(ref components2[1].statusType)).ToString())) + "\n"; } } else if (((Object)val29.instantiateOnBreak).name.Equals("ShelfShroomSpawn")) { TextMeshProUGUI obj30 = itemInfoDisplayTextMesh; ((TMP_Text)obj30).text = ((TMP_Text)obj30).text + EffectColors.HUNGER.HexTag() + "丟出</color>後會生成一個平台\n"; } else if (((Object)val29.instantiateOnBreak).name.Equals("BounceShroomSpawn")) { TextMeshProUGUI obj31 = itemInfoDisplayTextMesh; ((TMP_Text)obj31).text = ((TMP_Text)obj31).text + EffectColors.HUNGER.HexTag() + "丟出</color>後會生成一個彈跳墊\n"; } } else { TextMeshProUGUI obj32 = itemInfoDisplayTextMesh; ((TMP_Text)obj32).text = ((TMP_Text)obj32).text + "從當前位置發射一條鏈條到你瞄準的地方\n最長可達" + PrettyCount(val28.maxLength / 1.6666666f, 1) + "公尺\n"; } } else { text5 += "可以綁在玩家身上\n"; } } else if (val26.intensity != 0f) { text5 = text5 + EffectColors.INJURY.HexTag() + "警告:</color><#CCCCCC>放下後會飛走</color>\n"; } } else { TextMeshProUGUI obj33 = itemInfoDisplayTextMesh; ((TMP_Text)obj33).text = ((TMP_Text)obj33).text + "發射一條"; val = itemInfoDisplayTextMesh; ((TMP_Text)val).text = ((TMP_Text)val).text + PrettyCount(val25.maxLength / 4f, 1) + "公尺長" + (((Object)val25.ropeAnchorWithRopePref).name.Equals("RopeAnchorForRopeShooterAnti") ? "向上漂浮</color>" : "") + "的繩子\n"; } } else { TextMeshProUGUI obj34 = itemInfoDisplayTextMesh; ((TMP_Text)obj34).text = ((TMP_Text)obj34).text + (val24.isAntiRope ? "放置一條向上漂浮的繩索\n" : "放置一條繩索\n"); val = itemInfoDisplayTextMesh; ((TMP_Text)val).text = ((TMP_Text)val).text + "綁繩結最短需" + PrettyCount(val24.minSegments / 4f, 2) + "公尺長,最多" + PrettyCount((float)Rope.MaxSegments / 4f, 1) + "公尺長\n"; if (configForceUpdateTime.Value <= 1f) { text3 = text3 + " 剩餘" + PrettyCount(val24.RopeFuel / 4f, 2) + "公尺"; } } } else if (((Object)val23.constructedPrefab).name.Equals("PortableStovetop_Placed")) { val = itemInfoDisplayTextMesh; ((TMP_Text)val).text = ((TMP_Text)val).text + "放置" + EffectColors.INJURY.HexTag() + "攜帶式爐具</color>以提供" + PrettyCount(val23.constructedPrefab.GetComponent<Campfire>().burnsFor, 1) + "秒的溫暖\n"; } else { TextMeshProUGUI obj35 = itemInfoDisplayTextMesh; ((TMP_Text)obj35).text = ((TMP_Text)obj35).text + "可被放置\n"; } } else { TextMeshProUGUI obj36 = itemInfoDisplayTextMesh; ((TMP_Text)obj36).text = ((TMP_Text)obj36).text + EffectColors.EXTRA_STAMINA.HexTag() + "復活</color>一名死亡的玩家\n"; } } else { TextMeshProUGUI obj37 = itemInfoDisplayTextMesh; ((TMP_Text)obj37).text = ((TMP_Text)obj37).text + "踩到後會" + EffectColors.HUNGER.HexTag() + "滑倒</color>\n"; } } else { TextMeshProUGUI obj38 = itemInfoDisplayTextMesh; ((TMP_Text)obj38).text = ((TMP_Text)obj38).text + "放下背包才可放入物品\n"; } } else { TextMeshProUGUI obj39 = itemInfoDisplayTextMesh; ((TMP_Text)obj39).text = ((TMP_Text)obj39).text + "可被點亮\n"; } } else { TextMeshProUGUI obj40 = itemInfoDisplayTextMesh; ((TMP_Text)obj40).text = ((TMP_Text)obj40).text + "放置一個你可以抓住的岩釘\n來 " + EffectColors.EXTRA_STAMINA.HexTag() + "恢復體力</color>\n"; } } else { TextMeshProUGUI obj41 = itemInfoDisplayTextMesh; ((TMP_Text)obj41).text = ((TMP_Text)obj41).text + "當吹響友誼號角時,\n"; } } else { flag = true; text5 += "<#CCCCCC>發射一支飛鏢,造成以下效果:</color>\n"; for (int j = 0; j < val16.afflictionsOnHit.Length; j++) { text5 += ProcessAffliction(val16.afflictionsOnHit[j]); text5 += ",\n"; } text5 += "\n"; } continue; } if (((Object)gameObject).name.Equals("Torch(Clone)")) { TextMeshProUGUI obj42 = itemInfoDisplayTextMesh; ((TMP_Text)obj42).text = ((TMP_Text)obj42).text + "可被點亮\n"; } else { text5 += "<#CCCCCC>點亮時,附近的玩家會獲得:</color>\n"; } if (((Object)gameObject).name.Equals("Lantern_Faerie(Clone)")) { StatusField component7 = ((Component)gameObject.transform.Find("FaerieLantern/Light/Heat")).GetComponent<StatusField>(); EffectColors effectColorsByStr = GetEffectColorsByStr(((object)(STATUSTYPE)(ref component7.statusType)).ToString()); text5 += ProcessEffectOverTime(component7.statusAmountPerSecond, 1f, val15.startingFuel, effectColorsByStr); foreach (StatusFieldStatus additionalStatus in component7.additionalStatuses) { if (text5.EndsWith('\n')) { text5 = text5.Remove(text5.Length - 1); } text5 = text5 + ",\n" + ProcessEffectOverTime(additionalStatus.statusAmountPerSecond, 1f, val15.startingFuel, effectColorsByStr); } } else if (((Object)gameObject).name.Equals("Lantern(Clone)")) { StatusField component8 = ((Component)gameObject.transform.Find("GasLantern/Light/Heat")).GetComponent<StatusField>(); EffectColors effectColorsByStr2 = GetEffectColorsByStr(((object)(STATUSTYPE)(ref component8.statusType)).ToString()); text5 += ProcessEffectOverTime(component8.statusAmountPerSecond, 1f, val15.startingFuel, effectColorsByStr2); } } else { OptionableIntItemData val52 = (OptionableIntItemData)currentItem.data.data[(DataEntryKey)2]; if (val52.HasData && val52.Value > 1) { text3 = text3 + "剩餘 " + val52.Value + " 次使用次數"; } } } else if (((object)val13.itemToSpawn).ToString().Contains("Peel")) { TextMeshProUGUI obj43 = itemInfoDisplayTextMesh; ((TMP_Text)obj43).text = ((TMP_Text)obj43).text + "<#CCCCCC>食用後獲得果皮</color>\n"; } continue; } TextMeshProUGUI obj44 = itemInfoDisplayTextMesh; ((TMP_Text)obj44).text = ((TMP_Text)obj44).text + EffectColors.ITEM_INFO_DISPLAY_POSITIVE.HexTag() + "清理所有狀態</color>"; TextMeshProUGUI obj45 = itemInfoDisplayTextMesh; ((TMP_Text)obj45).text = ((TMP_Text)obj45).text + (val12.excludeCurse ? ("(除了" + EffectColors.CURSE.HexTag() + "詛咒</color>\n") : "\n"); if (val12.otherExclusions.Count <= 0) { continue; } foreach (STATUSTYPE otherExclusion in val12.otherExclusions) { STATUSTYPE current2 = otherExclusion; EffectColors effectColorsByStr3 = GetEffectColorsByStr(((object)(STATUSTYPE)(ref current2)).ToString()); if (effectColorsByStr3 != EffectColors.CRAB) { val = itemInfoDisplayTextMesh; ((TMP_Text)val).text = ((TMP_Text)val).text + "、" + effectColorsByStr3.HexTag() + EffectColorLocalName(effectColorsByStr3) + "</color>"; } } TextMeshProUGUI obj46 = itemInfoDisplayTextMesh; ((TMP_Text)obj46).text = ((TMP_Text)obj46).text + ")"; } else { text5 += ProcessAffliction(val11.affliction); } continue; } text5 += "<#CCCCCC>附近的玩家將會收到:</color>\n"; text5 += ProcessAffliction(((Action_ApplyAffliction)val10).affliction); if (((Action_ApplyAffliction)val10).extraAfflictions.Length == 0) { continue; } for (int k = 0; k < ((Action_ApplyAffliction)val10).extraAfflictions.Length; k++) { if (text5.EndsWith('\n')) { text5 = text5.Remove(text5.Length - 1); } text5 = text5 + ",\n" + ProcessAffliction(((Action_ApplyAffliction)val10).extraAfflictions[k]); } } else { text = text + ProcessEffect(val9.changeAmount, GetEffectColorsByStr(((object)(STATUSTYPE)(ref val9.statusType)).ToString())) + "\n"; } } else { text = text + ProcessEffect((float)val8.thornCount * 0.05f, EffectColors.THORNS) + "\n"; } } else { text = text + "經過 " + val7.delay + " 秒後," + ProcessEffectOverTime(val7.poisonPerSecond, 1f, val7.inflictionTime, EffectColors.POISON) + "\n"; } } else { text = text + ProcessEffect(val6.amount, EffectColors.EXTRA_STAMINA) + "\n"; } } else { text = text + ProcessEffect(val5.restorationAmount * -1f, EffectColors.HUNGER) + "\n"; } } else { flag = true; } } else { flag = val3.useAnimation.Equals("Eat") || val3.useAnimation.Equals("Drink") || val3.useAnimation.Equals("Heal"); } } if (text.Length > 0 && flag) { ((TMP_Text)itemInfoDisplayTextMesh).text = text + ((TMP_Text)itemInfoDisplayTextMesh).text; } if (text5.Length > 0) { TextMeshProUGUI obj47 = itemInfoDisplayTextMesh; ((TMP_Text)obj47).text = ((TMP_Text)obj47).text + "\n" + text5; } val = itemInfoDisplayTextMesh; ((TMP_Text)val).text = ((TMP_Text)val).text + "\n" + text2 + text3 + text4; ((TMP_Text)itemInfoDisplayTextMesh).text = ((TMP_Text)itemInfoDisplayTextMesh).text.Replace("\n\n\n", "\n\n"); } private static string ProcessEffect(float amount, EffectColors effect) { string text = ""; if (amount == 0f) { return text; } text += ((effect == EffectColors.EXTRA_STAMINA) ? EffectColors.ITEM_INFO_DISPLAY_POSITIVE.HexTag() : EffectColors.ITEM_INFO_DISPLAY_NEGATIVE.HexTag()); text += ((amount > 0f) ? "獲得</color> " : "移除</color> "); return text + effect.HexTag() + PrettyCount(Mathf.Abs(amount) * 100f, 1) + " 點" + EffectColorLocalName(effect); } private static string ProcessEffectOverTime(float amountPerSecond, float rate, float time, EffectColors effect) { string text = ""; if (amountPerSecond == 0f || time == 0f) { return text; } text = text + time + "秒内合共"; text += ((effect == EffectColors.EXTRA_STAMINA) ? EffectColors.ITEM_INFO_DISPLAY_POSITIVE.HexTag() : EffectColors.ITEM_INFO_DISPLAY_NEGATIVE.HexTag()); text += ((amountPerSecond > 0f) ? "獲得</color> " : "移除</color> "); return text + effect.HexTag() + PrettyCount(Mathf.Abs(amountPerSecond) * time * (1f / rate) * 100f, 1) + " 點" + EffectColorLocalName(effect); } private static string ProcessAffliction(Affliction affliction) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected I4, but got Unknown //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_04ae: Expected O, but got Unknown //IL_033a: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Expected O, but got Unknown //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Expected O, but got Unknown //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_0402: Expected O, but got Unknown //IL_0616: Unknown result type (might be due to invalid IL or missing references) //IL_061d: Expected O, but got Unknown string text = ""; AfflictionType afflictionType = affliction.GetAfflictionType(); switch (afflictionType - 1) { case 1: { Affliction_FasterBoi val7 = (Affliction_FasterBoi)affliction; text = text + EffectColors.ITEM_INFO_DISPLAY_POSITIVE.HexTag() + "獲得</color> " + PrettyCount(((Affliction)val7).totalTime + val7.climbDelay, 1) + " 秒的 " + EffectColors.EXTRA_STAMINA.HexTag() + PrettyCount(Mathf.Round(val7.moveSpeedMod * 100f), 1) + "% 奔跑速度加成</color>,\n" + EffectColors.ITEM_INFO_DISPLAY_POSITIVE.HexTag() + "或者獲得</color> " + PrettyCount(((Affliction)val7).totalTime, 1) + " 秒的 " + EffectColors.EXTRA_STAMINA.HexTag() + PrettyCount(Mathf.Round(val7.climbSpeedMod * 100f), 1) + "% 攀爬速度加成</color>\n" + EffectColors.ITEM_INFO_DISPLAY_NEGATIVE.HexTag() + "然後獲得</color> " + EffectColors.DROWSY.HexTag() + PrettyCount(val7.drowsyOnEnd * 100f, 1) + " 秒的昏睡效果</color>\n"; break; } case 7: { Affliction_ClearAllStatus val8 = (Affliction_ClearAllStatus)affliction; text = text + EffectColors.ITEM_INFO_DISPLAY_POSITIVE.HexTag() + "清除所有狀態</color>" + (val8.excludeCurse ? ("(除了" + EffectColors.CURSE.HexTag() + "詛咒</color>)\n") : "\n"); break; } case 9: { Affliction_AddBonusStamina val4 = (Affliction_AddBonusStamina)affliction; text = text + EffectColors.ITEM_INFO_DISPLAY_POSITIVE.HexTag() + "獲得</color> " + EffectColors.EXTRA_STAMINA.HexTag() + PrettyCount(val4.staminaAmount * 100f, 1) + " 點額外體力</color>\n"; break; } case 0: { Affliction_InfiniteStamina val5 = (Affliction_InfiniteStamina)affliction; text = ((!(val5.climbDelay > 0f)) ? (text + EffectColors.ITEM_INFO_DISPLAY_POSITIVE.HexTag() + "獲得</color> " + PrettyCount(((Affliction)val5).totalTime, 1) + "秒的" + EffectColors.EXTRA_STAMINA.HexTag() + "無限體力</color>\n") : (text + EffectColors.ITEM_INFO_DISPLAY_POSITIVE.HexTag() + "獲得</color> " + PrettyCount(((Affliction)val5).totalTime + val5.climbDelay, 1) + "秒的" + EffectColors.EXTRA_STAMINA.HexTag() + "無限奔跑體力</color>,或獲得 " + PrettyCount(((Affliction)val5).totalTime, 1) + "秒的" + EffectColors.EXTRA_STAMINA.HexTag() + "無限攀爬體力</color>\n")); if (val5.drowsyAffliction != null) { text = text + "然後獲得" + ProcessAffliction(val5.drowsyAffliction); } break; } case 6: { Affliction_AdjustStatus val3 = (Affliction_AdjustStatus)affliction; EffectColors effectColorsByStr = GetEffectColorsByStr(((object)(STATUSTYPE)(ref val3.statusType)).ToString()); text += ((effectColorsByStr == EffectColors.EXTRA_STAMINA) ? EffectColors.ITEM_INFO_DISPLAY_POSITIVE.HexTag().ToString() : EffectColors.ITEM_INFO_DISPLAY_NEGATIVE.HexTag()); text += ((val3.statusAmount > 0f) ? "獲得</color> " : "移除</color> "); text = text + effectColorsByStr.HexTag() + PrettyCount(Mathf.Abs(val3.statusAmount) * 100f, 1) + " 點" + EffectColorLocalName(effectColorsByStr) + "</color>\n"; break; } case 10: { Affliction_AdjustDrowsyOverTime val6 = (Affliction_AdjustDrowsyOverTime)affliction; text = text + PrettyCount(((Affliction)val6).totalTime, 1) + " 秒内合共 "; text += ((val6.statusPerSecond > 0f) ? (EffectColors.ITEM_INFO_DISPLAY_POSITIVE.HexTag() + "獲得</color> ") : (EffectColors.ITEM_INFO_DISPLAY_NEGATIVE.HexTag() + "移除</color> ")); text = text + EffectColors.DROWSY.HexTag() + PrettyCount(Mathf.Round(Mathf.Abs(val6.statusPerSecond) * ((Affliction)val6).totalTime * 100f * 0.4f) / 0.4f, 1) + " 點昏睡效果</color>\n"; break; } case 4: { Affliction_AdjustColdOverTime val2 = (Affliction_AdjustColdOverTime)affliction; text = text + PrettyCount(((Affliction)val2).totalTime, 1) + " 秒内合共 "; text += ((val2.statusPerSecond > 0f) ? (EffectColors.ITEM_INFO_DISPLAY_POSITIVE.HexTag() + "獲得</color> ") : (EffectColors.ITEM_INFO_DISPLAY_NEGATIVE.HexTag() + "移除</color> ")); text = text + EffectColors.COLD.HexTag() + PrettyCount(Mathf.Round(Mathf.Abs(val2.statusPerSecond) * ((Affliction)val2).totalTime * 100f * 0.4f) / 0.4f, 1) + " 點寒冷效果</color>\n"; break; } case 5: text = text + EffectColors.ITEM_INFO_DISPLAY_POSITIVE.HexTag() + "清除所有狀態</color>,然後隨機獲得\n" + EffectColors.HUNGER.HexTag() + "飢餓</color>," + EffectColors.EXTRA_STAMINA.HexTag() + "額外體力</color>," + EffectColors.INJURY.HexTag() + "受傷</color>," + EffectColors.POISON.HexTag() + "中毒</color>," + EffectColors.COLD.HexTag() + "寒冷</color>," + EffectColors.HEAT.HexTag() + "炎熱</color>," + EffectColors.DROWSY.HexTag() + "昏睡</color>\n"; break; case 12: { Affliction_Sunscreen val = (Affliction_Sunscreen)affliction; text = text + "慎防中暑!在台地的太陽下逗留超過 " + PrettyCount(((Affliction)val).totalTime, 1) + " 秒後會開始獲得" + EffectColors.HEAT.HexTag() + "炎熱效果</color>\n"; break; } } return text; } private static EffectColors GetEffectColorsByStr(string effect) { return (EffectColors)Enum.Parse(typeof(EffectColors), effect.ToUpper()); } private static void AddDisplayObject() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.Find("GAME/GUIManager"); guiManager = val.GetComponent<GUIManager>(); TMP_FontAsset font = ((TMP_Text)guiManager.heroDayText).font; GameObject gameObject = ((Component)val.transform.Find("Canvas_HUD/Prompts/ItemPromptLayout")).gameObject; GameObject val2 = new GameObject("ItemInfoDisplay"); val2.transform.SetParent(gameObject.transform); itemInfoDisplayTextMesh = val2.AddComponent<TextMeshProUGUI>(); RectTransform component = val2.GetComponent<RectTransform>(); component.sizeDelta = new Vector2(configSizeDeltaX.Value, 0f); ((TMP_Text)itemInfoDisplayTextMesh).font = font; ((TMP_Text)itemInfoDisplayTextMesh).fontSize = configFontSize.Value; ((TMP_Text)itemInfoDisplayTextMesh).alignment = (TextAlignmentOptions)1025; ((TMP_Text)itemInfoDisplayTextMesh).lineSpacing = configLineSpacing.Value; ((TMP_Text)itemInfoDisplayTextMesh).text = ""; ((TMP_Text)itemInfoDisplayTextMesh).outlineWidth = configOutlineWidth.Value; } private static string EffectColorLocalName(EffectColors eff) { return eff switch { EffectColors.HUNGER => "饑餓", EffectColors.EXTRA_STAMINA => "額外體力", EffectColors.INJURY => "受傷", EffectColors.CRAB => "蟹蟹", EffectColors.POISON => "中毒", EffectColors.COLD => "寒冷", EffectColors.HEAT => "高溫", EffectColors.SLEEPY => "倦睏", EffectColors.DROWSY => "昏睡", EffectColors.CURSE => "詛咒", EffectColors.WEIGHT => "負重", EffectColors.THORNS => "荊棘", EffectColors.SHIELD => "護盾", EffectColors.ITEM_INFO_DISPLAY_POSITIVE => "正面效果", EffectColors.ITEM_INFO_DISPLAY_NEGATIVE => "負面效果", _ => eff.ToString(), }; } private static string PrettyCount(float num, int dec) { return num.ToString("F" + dec).Replace(".0", ""); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }
BepInEx/plugins/UniversalFontPatcher.dll
Decompiled a week agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("XoFKon")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Replace in-game font with other things")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+d5fa67705b60c049a3e31d66d30cc939edaa91fb")] [assembly: AssemblyProduct("UniversalFontPatcher")] [assembly: AssemblyTitle("UniversalFontPatcher")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace UniversalFontPatcher { public static class MyPluginInfo { public const string PLUGIN_GUID = "UniversalFontPatcher"; public const string PLUGIN_NAME = "UniversalFontPatcher"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace FontPatcher { [HarmonyPatch] public static class FontLoader { internal class FontBundle { public string BundleName; public TMP_FontAsset Normal; public TMP_FontAsset Transmit; } internal static List<FontBundle> fontBundles = new List<FontBundle>(); internal static Regex normalRegex; internal static Regex transmitRegex; public static void RepatchAllFontsInScene() { TMP_Text[] array = Object.FindObjectsOfType<TMP_Text>(true); foreach (TMP_Text val in array) { if ((Object)(object)val != (Object)null && (Object)(object)val.font != (Object)null) { Plugin.LogInfo("[Repatch] " + ((Object)val).name + " using font " + ((Object)val.font).name); PatchFontAwake(val.font); } } } public static void Load() { try { string path = Path.Combine(Paths.ConfigPath); string text = Path.Combine(path, Plugin.configFontAssetPath.Value); Plugin.LogInfo("Font path: " + text); if (!Directory.Exists(text)) { Plugin.LogError("Font assets directory does not exist: " + text); return; } int num = 0; int num2 = 0; FileInfo[] files = new DirectoryInfo(text).GetFiles("*"); foreach (FileInfo fileInfo in files) { try { AssetBundle val = AssetBundle.LoadFromFile(fileInfo.FullName); Plugin.LogInfo("[" + fileInfo.Name + "] loaded"); FontBundle fontBundle = new FontBundle { Normal = val.LoadAsset<TMP_FontAsset>("Normal"), Transmit = val.LoadAsset<TMP_FontAsset>("Transmit") }; if ((Object)(object)fontBundle.Normal != (Object)null || (Object)(object)fontBundle.Transmit != (Object)null) { fontBundle.BundleName = fileInfo.Name; if ((Object)(object)fontBundle.Normal != (Object)null) { ((Object)fontBundle.Normal).name = fileInfo.Name + "(Normal)"; Plugin.LogInfo("Normal font found (" + ((Object)fontBundle.Normal).name + ")"); } if ((Object)(object)fontBundle.Transmit != (Object)null) { ((Object)fontBundle.Transmit).name = fileInfo.Name + "(Transmit)"; Plugin.LogInfo("Transmit font found (" + ((Object)fontBundle.Transmit).name + ")"); } fontBundles.Add(fontBundle); num++; continue; } throw new Exception("No recognizable TMP_FontAsset found in bundle"); } catch (Exception ex) { Plugin.LogError("[" + fileInfo.Name + "] load failed: " + ex.Message); num2++; } } normalRegex = new Regex(Plugin.configNormalRegexPattern.Value); transmitRegex = new Regex(Plugin.configTransmitRegexPattern.Value); Plugin.LogInfo($"{num} fonts loaded, {num2} failed"); RepatchAllFontsInScene(); } catch (Exception ex2) { Plugin.LogError(ex2.ToString()); } } public static void PatchFontAwake(TMP_FontAsset fontAsset) { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected O, but got Unknown if ((Object)(object)fontAsset == (Object)null) { Plugin.LogError("[PatchFontAwake] fontAsset is NULL — skipping."); return; } if ((Object)(object)fontAsset.atlasTexture == (Object)null) { Plugin.LogError("[Fatal] Font '" + ((Object)fontAsset).name + "' has null atlasTexture — aborting patch to prevent crash."); return; } Plugin.LogInfo($"[FontCheck] {((Object)fontAsset).name}: material={(Object)(object)((TMP_Asset)fontAsset).material != (Object)null}, atlas={(Object)(object)fontAsset.atlasTexture != (Object)null}"); if ((Object)(object)((TMP_Asset)fontAsset).material == (Object)null) { Shader val = Shader.Find("TextMeshPro/Distance Field"); if (!((Object)(object)val != (Object)null)) { Plugin.LogError("[MaterialFix] TMP Shader not found — cannot assign material"); return; } ((TMP_Asset)fontAsset).material = new Material(val) { name = ((Object)fontAsset).name + "_Material" }; ((TMP_Asset)fontAsset).material.SetTexture("_MainTex", (Texture)(object)fontAsset.atlasTexture); ((TMP_Asset)fontAsset).material.mainTexture = (Texture)(object)fontAsset.atlasTexture; Plugin.LogInfo("[MaterialFix] Created material for " + ((Object)fontAsset).name); } Material material = ((TMP_Asset)fontAsset).material; if ((Object)(object)material != (Object)null) { if (!material.HasProperty("_MainTex")) { Plugin.LogWarning("[MaterialCheck] " + ((Object)fontAsset).name + " 材質無 _MainTex"); } if ((Object)(object)material.mainTexture == (Object)null && (Object)(object)fontAsset.atlasTexture != (Object)null) { material.SetTexture("_MainTex", (Texture)(object)fontAsset.atlasTexture); material.mainTexture = (Texture)(object)fontAsset.atlasTexture; Plugin.LogInfo("[MainTexFix] Assigned _MainTex from atlas for " + ((Object)fontAsset).name); } if (material.shaderKeywords == null) { material.shaderKeywords = Array.Empty<string>(); } if (material.renderQueue < 1000) { material.renderQueue = 3000; Plugin.LogInfo("[RenderQueueFix] Set to 3000 for " + ((Object)fontAsset).name); } material.SetFloat("_UnderlayDilate", 1f); material.SetFloat("_UnderlayOffsetX", 0.1f); } string name = ((Object)fontAsset).name; if (normalRegex.IsMatch(name)) { if (!Plugin.configNormalIngameFont.Value) { DisableFont(fontAsset); } AddFallbackFonts(fontAsset, isNormal: true); } else if (transmitRegex.IsMatch(name)) { if (!Plugin.configTransmitIngameFont.Value) { DisableFont(fontAsset); } AddFallbackFonts(fontAsset, isNormal: false); } else if (fontAsset.characterLookupTable == null || fontAsset.characterLookupTable.Count == 0) { Plugin.LogWarning("[Disable] Font " + ((Object)fontAsset).name + " has empty lookup table — disabling."); DisableFont(fontAsset); } else { Plugin.LogWarning("[" + name + "] not matched any regex pattern"); } } private static void FixFontAssetMaterial(TMP_FontAsset fontAsset) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown if ((Object)(object)fontAsset == (Object)null) { return; } Shader val = Shader.Find("TextMeshPro/Distance Field"); if ((Object)(object)val == (Object)null) { Plugin.LogError("[FixMaterial] TMP shader not found!"); return; } if ((Object)(object)((TMP_Asset)fontAsset).material == (Object)null) { ((TMP_Asset)fontAsset).material = new Material(val) { name = ((Object)fontAsset).name + "_Material" }; Plugin.LogInfo("[FixMaterial] Created new material for " + ((Object)fontAsset).name); } else { ((TMP_Asset)fontAsset).material.shader = val; Plugin.LogInfo("[FixMaterial] Reassigned shader for " + ((Object)fontAsset).name); } if ((Object)(object)fontAsset.atlasTexture != (Object)null) { ((TMP_Asset)fontAsset).material.SetTexture("_MainTex", (Texture)(object)fontAsset.atlasTexture); ((TMP_Asset)fontAsset).material.mainTexture = (Texture)(object)fontAsset.atlasTexture; } } private static void AddFallbackFonts(TMP_FontAsset target, bool isNormal) { int num = 0; foreach (FontBundle fontBundle in fontBundles) { TMP_FontAsset val = (isNormal ? fontBundle.Normal : fontBundle.Transmit); if (!((Object)(object)val == (Object)null)) { FixFontAssetMaterial(val); if ((Object)(object)((TMP_Asset)val).material == (Object)null || (Object)(object)val.atlasTexture == (Object)null || (Object)(object)((TMP_Asset)val).material.mainTexture == (Object)null || !((TMP_Asset)val).material.HasProperty("_MainTex")) { Plugin.LogWarning("[SkipFallback] " + ((Object)val).name + " is missing required material/texture/_MainTex"); } else if (!target.fallbackFontAssetTable.Contains(val)) { target.fallbackFontAssetTable.Add(val); num++; } } } if (num > 0) { Plugin.LogInfo(string.Format("[{0}] font patched ({1}) +{2}", ((Object)target).name, isNormal ? "Normal" : "Transmit", num)); } } [HarmonyPostfix] [HarmonyPatch(typeof(TextMeshPro), "Awake")] public static void PatchTMPAwake(TextMeshPro __instance) { if ((Object)(object)((TMP_Text)__instance).font != (Object)null) { PatchFontAwake(((TMP_Text)__instance).font); } } [HarmonyPostfix] [HarmonyPatch(typeof(TextMeshProUGUI), "Awake")] public static void PatchTMPUGUIAwake(TextMeshProUGUI __instance) { if ((Object)(object)((TMP_Text)__instance).font != (Object)null) { TMP_FontAsset font = ((TMP_Text)__instance).font; object[] obj = new object[4] { ((Object)font).name, (Object)(object)((TMP_Asset)font).material != (Object)null, (Object)(object)font.atlasTexture != (Object)null, null }; Material material = ((TMP_Asset)font).material; obj[3] = (Object)(object)((material != null) ? material.mainTexture : null) != (Object)null; Plugin.LogInfo(string.Format("[TMP Awake] {0} / material={1} / atlas={2} / mainTex={3}", obj)); PatchFontAwake(font); } else { Plugin.LogError("[TMP Awake] font is NULL!"); } } private static void DisableFont(TMP_FontAsset font) { font.characterLookupTable?.Clear(); font.atlasPopulationMode = (AtlasPopulationMode)0; } } internal static class PluginInfo { public const string GUID = "universal.fontpatcher"; public const string Name = "Universal TMP Replacer"; public const string Version = "1.0.0"; } [BepInPlugin("universal.fontpatcher", "Universal TMP Replacer", "1.0.0")] public class Plugin : BaseUnityPlugin { public static ConfigEntry<bool> configNormalIngameFont; public static ConfigEntry<bool> configTransmitIngameFont; public static ConfigEntry<string> configNormalRegexPattern; public static ConfigEntry<string> configTransmitRegexPattern; public static ConfigEntry<string> configFontAssetPath; public static ConfigEntry<bool> configDebugLog; public static Plugin Instance; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } configNormalIngameFont = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "UsingNormalIngameFont", true, "是否啟用遊戲內建的 Normal 字體"); configTransmitIngameFont = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "UsingTransmitIngameFont", true, "是否啟用遊戲內建的 Transmit 字體"); configNormalRegexPattern = ((BaseUnityPlugin)this).Config.Bind<string>("Regex", "NormalFontNameRegex", ".*", "匹配 Normal 字體名稱的正則表達式"); configTransmitRegexPattern = ((BaseUnityPlugin)this).Config.Bind<string>("Regex", "TransmitFontNameRegex", ".*", "匹配 Transmit 字體名稱的正則表達式"); configFontAssetPath = ((BaseUnityPlugin)this).Config.Bind<string>("Path", "FontAssetsPath", "FontPatcher", "字體資源所在的資料夾,位於 <遊戲資料夾>/FontPatcher/<此設定>"); configDebugLog = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "Log", false, "是否啟用除錯日誌"); FontLoader.Load(); Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null); } public static void LogInfo(string msg) { if (configDebugLog.Value) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)msg); } } public static void LogWarning(string msg) { if (configDebugLog.Value) { ((BaseUnityPlugin)Instance).Logger.LogWarning((object)msg); } } public static void LogError(string msg) { ((BaseUnityPlugin)Instance).Logger.LogError((object)msg); } } internal static class ResourcePath { public const string NormalFont = "Normal"; public const string TransmitFont = "Transmit"; } }