Decompiled source of Echoes of the Seer Creative Mode v1.0.0
CreativeMode.dll
Decompiled 2 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using CreativeMode; using Fusion; using HarmonyLib; using HarmonyLib.Tools; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Microsoft.CodeAnalysis; using SSSGame; using SSSGame.Combat; using SSSGame.UI; using SandSailorStudio.Attributes; using SandSailorStudio.Inventory; using SandSailorStudio.Storage; using UnityEngine; using UnityEngine.Events; using UnityEngine.SceneManagement; using UnityEngine.UI; using eots.bepinex.mod.Managers.StatusEffects; using eots.bepinex.mod.creative.Core; using eots.bepinex.mod.creative.Helpers; using eots.bepinex.mod.creative.Managers; using eots.bepinex.mod.creative.Managers.Characters; using eots.bepinex.mod.creative.Managers.Inputs; using eots.bepinex.mod.creative.Patches; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("CreativeMode")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+6a2d4ae657c255e6d3c185f841fb6b2bea242bb7")] [assembly: AssemblyProduct("CreativeMode")] [assembly: AssemblyTitle("CreativeMode")] [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.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; } } } public static class StatusEffectFactory { public static StatusEffect CreateCreativeModeEffect() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0ab5: Unknown result type (might be due to invalid IL or missing references) //IL_0aba: Unknown result type (might be due to invalid IL or missing references) //IL_0ac1: Unknown result type (might be due to invalid IL or missing references) //IL_0ad1: Unknown result type (might be due to invalid IL or missing references) //IL_0ae8: Expected O, but got Unknown Plugin.Log.LogInfo((object)"[StatusEffectFactory] Creating Creative Mode effect..."); StatusEffectModifierTable val = ScriptableObject.CreateInstance<StatusEffectModifierTable>(); SpriteHelpers.LoadAllSprites(); Sprite val2 = SpriteHelpers.FetchSprite(PluginSettingsManager.CreativeBuffIconName.Value); if ((Object)(object)val2 == (Object)null) { Plugin.Log.LogWarning((object)"[StatusEffectFactory] Creative Mode icon not found, using default."); val2 = SpriteHelpers.FetchSprite("UIFlat_Icon_flower"); } val.id = CharacterConstants.c_HousingPoints_Attr; val.maxStacks = 1; val.stackingBehavior = (StackingBehaviour)0; val.icon = val2; val.iconColor = Color.green; val.textColor = Color.white; val.localizedName = "Creative Mode"; ((Object)val).name = "Creative Mode"; val.localizedDescription = "In Creative Mode, you are free from all restrictions."; val.messageTextAdded = "Creative Mode applied!"; val.messageTextRemoved = "Creative Mode removed!"; val.effectType = StatusEffectTypeCache.Get(Constants.StatusEffectTypeEnum.Buff); val.attrElements = new List<AttributeElement>(); val.vattrElements = new List<VariableAttributeElement>(); val.CureList = new List<StatusEffectModifierTable>(); List<(int, float)> attributes = new List<(int, float)> { (CharacterConstants.c_Hunger_Attr, PluginSettingsManager.c_Hunger_Attr.Value), (CharacterConstants.c_Thirst_Attr, PluginSettingsManager.c_Thirst_Attr.Value), (CharacterConstants.c_Sleep_Attr, PluginSettingsManager.c_Sleep_Attr.Value), (CharacterConstants.c_ColdResistance_Attr, PluginSettingsManager.c_ColdResistance_Attr.Value), (CharacterConstants.c_RainProtection_Attr, PluginSettingsManager.c_RainProtection_Attr.Value), (CharacterConstants.c_WindProtection_Attr, PluginSettingsManager.c_WindProtection_Attr.Value), (CharacterConstants.c_SnowProtection_Attr, PluginSettingsManager.c_SnowProtection_Attr.Value), (CharacterConstants.c_Armor_Attr, PluginSettingsManager.c_Armor_Attr.Value), (CharacterConstants.c_InjuryChance_Attr, PluginSettingsManager.c_InjuryChance_Attr.Value), (CharacterConstants.c_HealingIncrease_Attr, PluginSettingsManager.c_HealingIncrease_Attr.Value), (CharacterConstants.c_DamageTakenIncrease_Attr, PluginSettingsManager.c_DamageTakenIncrease_Attr.Value), (CharacterConstants.c_AggresionThreshold_Attr, PluginSettingsManager.c_AggresionThreshold_Attr.Value), (CharacterConstants.c_Vitality_Attr, PluginSettingsManager.c_Vitality_Attr.Value), (CharacterConstants.c_Strength_Attr, PluginSettingsManager.c_Strength_Attr.Value), (CharacterConstants.c_Dexterity_Attr, PluginSettingsManager.c_Dexterity_Attr.Value), (CharacterConstants.c_Intelligence_Attr, PluginSettingsManager.c_Intelligence_Attr.Value), (CharacterConstants.c_Stamina_Attr, PluginSettingsManager.c_Stamina_Attr.Value), (CharacterConstants.c_StaminaRegen_Attr, PluginSettingsManager.c_StaminaRegen_Attr.Value), (CharacterConstants.c_Stun_Attr, PluginSettingsManager.c_Stun_Attr.Value), (CharacterConstants.c_StunRegen_Attr, PluginSettingsManager.c_StunRegen_Attr.Value), (CharacterConstants.c_ThreatScore_Attr, PluginSettingsManager.c_ThreatScore_Attr.Value), (CharacterConstants.c_HappinessRate_Attr, PluginSettingsManager.c_HappinessRate_Attr.Value), (CharacterConstants.c_Heat_Attr, PluginSettingsManager.c_Heat_Attr.Value), (CharacterConstants.c_Reborn_Attr, PluginSettingsManager.c_Reborn_Attr.Value), (CharacterConstants.c_HarvestDiscount_Attr, PluginSettingsManager.c_HarvestDiscount_Attr.Value), (CharacterConstants.c_CombatDiscount_Attr, PluginSettingsManager.c_CombatDiscount_Attr.Value), (CharacterConstants.c_Blessings_Attr, PluginSettingsManager.c_Blessings_Attr.Value), (CharacterConstants.c_SprintDiscount_Attr, PluginSettingsManager.c_SprintDiscount_Attr.Value), (CharacterConstants.c_Health_VAttr, PluginSettingsManager.c_Health_VAttr.Value), (CharacterConstants.c_Energy_VAttr, PluginSettingsManager.c_Energy_VAttr.Value), (CharacterConstants.c_Stun_VAttr, PluginSettingsManager.c_Stun_VAttr.Value), (CharacterConstants.c_Rest_VAttr, PluginSettingsManager.c_Rest_VAttr.Value), (CharacterConstants.c_Age_VAttr, PluginSettingsManager.c_Age_VAttr.Value), (CharacterConstants.c_RavenLeft_VAttr, PluginSettingsManager.c_RavenLeft_VAttr.Value), (CharacterConstants.c_Healing_VAttr, PluginSettingsManager.c_Healing_VAttr.Value), (CharacterConstants.c_Happiness_VAttr, PluginSettingsManager.c_Happiness_VAttr.Value), (CharacterConstants.c_Warmth_VAttr, PluginSettingsManager.c_Warmth_VAttr.Value), (CharacterConstants.c_Water_VAttr, PluginSettingsManager.c_Water_VAttr.Value), (CharacterConstants.c_Food_VAttr, PluginSettingsManager.c_Food_VAttr.Value), (CharacterConstants.c_PetFood_VAttr, PluginSettingsManager.c_PetFood_VAttr.Value), (CharacterConstants.c_Wetness_VAttr, PluginSettingsManager.c_Wetness_VAttr.Value), (CharacterConstants.c_Frost_VAttr, PluginSettingsManager.c_Frost_VAttr.Value), (CharacterConstants.c_StoneExpertise_VAttr, PluginSettingsManager.c_StoneExpertise_VAttr.Value), (CharacterConstants.c_WoodExpertise_VAttr, PluginSettingsManager.c_WoodExpertise_VAttr.Value), (CharacterConstants.c_SkinningExpertise_VAttr, PluginSettingsManager.c_SkinningExpertise_VAttr.Value), (CharacterConstants.c_FishingExpertise_VAttr, PluginSettingsManager.c_FishingExpertise_VAttr.Value), (CharacterConstants.c_BuildingExpertise_VAttr, PluginSettingsManager.c_BuildingExpertise_VAttr.Value), (CharacterConstants.c_RangedCombatExpertise_VAttr, PluginSettingsManager.c_RangedCombatExpertise_VAttr.Value), (CharacterConstants.c_MeleeCombatExpertise_VAttr, PluginSettingsManager.c_MeleeCombatExpertise_VAttr.Value), (CharacterConstants.c_CraftingExpertise_VAttr, PluginSettingsManager.c_CraftingExpertise_VAttr.Value), (CharacterConstants.c_BlacksmithExpertise_VAttr, PluginSettingsManager.c_BlacksmithExpertise_VAttr.Value), (CharacterConstants.c_CarpentryExpertise_VAttr, PluginSettingsManager.c_CarpentryExpertise_VAttr.Value), (CharacterConstants.c_GatheringExpertise_VAttr, PluginSettingsManager.c_GatheringExpertise_VAttr.Value), (CharacterConstants.c_FirekeepingExpertise_VAttr, PluginSettingsManager.c_FirekeepingExpertise_VAttr.Value), (CharacterConstants.c_FarmingExpertise_VAttr, PluginSettingsManager.c_FarmingExpertise_VAttr.Value), (CharacterConstants.c_CookingExpertise_VAttr, PluginSettingsManager.c_CookingExpertise_VAttr.Value), (CharacterConstants.c_ShamanicExpertise_VAttr, PluginSettingsManager.c_ShamanicExpertise_VAttr.Value), (CharacterConstants.c_WoodHarvestExpMultiplier_Attr, PluginSettingsManager.c_WoodHarvestExpMultiplier_Attr.Value), (CharacterConstants.c_StoneHarvestExpMultiplier_Attr, PluginSettingsManager.c_StoneHarvestExpMultiplier_Attr.Value), (CharacterConstants.c_CraftingExpMultiplier_Attr, PluginSettingsManager.c_CraftingExpMultiplier_Attr.Value), (CharacterConstants.c_GatheringExpMultiplier_Attr, PluginSettingsManager.c_GatheringExpMultiplier_Attr.Value), (CharacterConstants.c_BuildingExpMultiplier_Attr, PluginSettingsManager.c_BuildingExpMultiplier_Attr.Value), (CharacterConstants.c_FirekeepingExpMultiplier_Attr, PluginSettingsManager.c_FirekeepingExpMultiplier_Attr.Value), (CharacterConstants.c_HuntingExpMultiplier_Attr, PluginSettingsManager.c_HuntingExpMultiplier_Attr.Value), (CharacterConstants.c_SkinningExpMultiplier_Attr, PluginSettingsManager.c_SkinningExpMultiplier_Attr.Value), (CharacterConstants.c_FishingExpMultiplier_Attr, PluginSettingsManager.c_FishingExpMultiplier_Attr.Value), (CharacterConstants.c_BlacksmithExpMultiplier_Attr, PluginSettingsManager.c_BlacksmithExpMultiplier_Attr.Value), (CharacterConstants.c_CarpentryExpMultiplier_Attr, PluginSettingsManager.c_CarpentryExpMultiplier_Attr.Value), (CharacterConstants.c_FarmingExpMultiplier_Attr, PluginSettingsManager.c_FarmingExpMultiplier_Attr.Value), (CharacterConstants.c_MeleeCombatExpertiseMultiplier_Attr, PluginSettingsManager.c_MeleeCombatExpertiseMultiplier_Attr.Value), (CharacterConstants.c_RangedCombatExpertiseMultiplier_Attr, PluginSettingsManager.c_RangedCombatExpertiseMultiplier_Attr.Value), (CharacterConstants.c_CookingExpertiseMultiplier_Attr, PluginSettingsManager.c_CookingExpMultiplier_Attr.Value), (CharacterConstants.c_ShamanicExpertiseMultiplier_Attr, PluginSettingsManager.c_ShamanicExpertiseMultiplier_Attr.Value), (CharacterConstants.c_WoodHarvestProf_Attr, PluginSettingsManager.c_WoodHarvestProf_Attr.Value), (CharacterConstants.c_StoneHarvestProf_Attr, PluginSettingsManager.c_StoneHarvestProf_Attr.Value), (CharacterConstants.c_CraftingProf_Attr, PluginSettingsManager.c_CraftingProf_Attr.Value), (CharacterConstants.c_GatheringProf_Attr, PluginSettingsManager.c_GatheringProf_Attr.Value), (CharacterConstants.c_BuildingProf_Attr, PluginSettingsManager.c_BuildingProf_Attr.Value), (CharacterConstants.c_FirekeepingProf_Attr, PluginSettingsManager.c_FirekeepingProf_Attr.Value), (CharacterConstants.c_HuntingProf_Attr, PluginSettingsManager.c_HuntingProf_Attr.Value), (CharacterConstants.c_SkinningProf_Attr, PluginSettingsManager.c_SkinningProf_Attr.Value), (CharacterConstants.c_FishingProf_Attr, PluginSettingsManager.c_FishingProf_Attr.Value), (CharacterConstants.c_BlacksmithProf_Attr, PluginSettingsManager.c_BlacksmithProf_Attr.Value), (CharacterConstants.c_CarpentryProf_Attr, PluginSettingsManager.c_CarpentryProf_Attr.Value), (CharacterConstants.c_FarmingProf_Attr, PluginSettingsManager.c_FarmingProf_Attr.Value), (CharacterConstants.c_MeleeCombatProf_Attr, PluginSettingsManager.c_MeleeCombatProf_Attr.Value), (CharacterConstants.c_RangedCombatProf_Attr, PluginSettingsManager.c_RangedCombatProf_Attr.Value), (CharacterConstants.c_CookingProf_Attr, PluginSettingsManager.c_CookingProf_Attr.Value), (CharacterConstants.c_ShamanicProf_Attr, PluginSettingsManager.c_ShamanicProf_Attr.Value), (CharacterConstants.c_MovementMultiplier, PluginSettingsManager.c_MovementMultiplier.Value), (CharacterConstants.c_SprintSpeedMultiplier, PluginSettingsManager.c_SprintSpeedMultiplier.Value), (CharacterConstants.c_LastDamageTime, PluginSettingsManager.c_LastDamageTime.Value), (CharacterConstants.c_BellowsDrive, PluginSettingsManager.c_BellowsDrive.Value), (CharacterConstants.c_ForgeHeat_VAttr, PluginSettingsManager.c_ForgeHeat_VAttr.Value), (CharacterConstants.c_AirIntake_VAttr, PluginSettingsManager.c_AirIntake_VAttr.Value), (CharacterConstants.c_ProfficiencyMultiplier, PluginSettingsManager.c_ProfficiencyMultiplier.Value) }; AddAttributes(val, attributes); StatusEffect val3 = new StatusEffect { table = val, duration = PluginSettingsManager.CreativeBuffDuration.Value, persistent = false }; Plugin.Log.LogInfo((object)"[StatusEffectFactory] Successfully created Creative Mode effect."); return val3; } private static void AddAttributes(StatusEffectModifierTable table, IEnumerable<(int id, float value)> attributes) { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_0081: Expected O, but got Unknown //IL_0083: Expected O, but got Unknown //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown bool flag = default(bool); foreach (var attribute in attributes) { var (id, num) = attribute; if (Math.Abs(num - -1f) < float.Epsilon) { continue; } AttributeConfig val = ((IEnumerable<AttributeConfig>)AttributeConfigHelpers.DiscoverAllAttributeConfigs()).FirstOrDefault((Func<AttributeConfig, bool>)((AttributeConfig c) => c.attributeId == id)); if ((Object)(object)val != (Object)null) { AttributeElement val2 = new AttributeElement { targetAttribute = val, modifier = new AttributeModifier(num, (ModifierOperation)0) }; table.attrElements.Add(val2); ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(44, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[StatusEffectFactory] Added attrElement: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(val.localizedName); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" = "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(val2.modifier.Value); } log.LogInfo(val3); } else { ManualLogSource log2 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(55, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[StatusEffectFactory] AttributeConfig not found for ID "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(id); } log2.LogWarning(val4); } } } public static StatusEffect CreateStatusEffectClone(string effectName = "Effect_ShelteredCave") { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Expected O, but got Unknown //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Expected O, but got Unknown //IL_02ec: Expected O, but got Unknown //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Expected O, but got Unknown //IL_023c: Expected O, but got Unknown //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Expected O, but got Unknown string effectName2 = effectName; ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(39, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[StatusEffectFactory] Starting "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(effectName2); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Clone..."); } log.LogInfo(val); List<StatusEffectModifierTable> list = DiscoverAllStatusEffectBlueprints(); if (list == null || list.Count == 0) { Plugin.Log.LogWarning((object)"[StatusEffectFactory] No status effect tables discovered."); return null; } ManualLogSource log2 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(36, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[StatusEffectFactory] Found "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(list.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" tables."); } log2.LogInfo(val); StatusEffectModifierTable val2 = ((IEnumerable<StatusEffectModifierTable>)list).FirstOrDefault((Func<StatusEffectModifierTable, bool>)((StatusEffectModifierTable t) => (Object)(object)t != (Object)null && ((Object)t).name != null && ((Object)t).name.Contains(effectName2))); if ((Object)(object)val2 == (Object)null) { ManualLogSource log3 = Plugin.Log; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(68, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[StatusEffectFactory] "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(effectName2); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" not found. Check naming in discovered tables."); } log3.LogWarning(val3); return null; } ManualLogSource log4 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(42, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[StatusEffectFactory] Found "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(effectName2); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("- like table: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)val2).name); } log4.LogInfo(val); StatusEffectModifierTable val4; try { val4 = ScriptableObject.CreateInstance<StatusEffectModifierTable>(); } catch (Exception ex) { ManualLogSource log5 = Plugin.Log; BepInExErrorLogInterpolatedStringHandler val5 = new BepInExErrorLogInterpolatedStringHandler(53, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("[StatusEffectFactory] Failed to create cloned table: "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<Exception>(ex); } log5.LogError(val5); return null; } val4.id = val2.id; val4.localizedName = "Creative Mode"; val4.localizedDescription = "Creative Mode"; val4.maxStacks = 1; val4.stackingBehavior = val2.stackingBehavior; val4.effectType = val2.effectType; val4.attrElements = new List<AttributeElement>(); if (val2.attrElements != null) { AttributeConfig val6 = AttributeConfigHelpers.FindAttributeConfigById(CharacterConstants.c_HappinessRate_Attr); AttributeConfigHelpers.FindAttributeConfigByName("Stamina Regen"); if ((Object)(object)val6 != (Object)null) { AttributeElement val7 = new AttributeElement { targetAttribute = val6, modifier = new AttributeModifier(0.25f, (ModifierOperation)0) }; val4.attrElements.Add(val7); ManualLogSource log6 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(48, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[StatusEffectFactory] Added new attrElement: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(val6.localizedName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" = "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(val7.modifier.Value); } log6.LogInfo(val); } } StatusEffect val8 = new StatusEffect { table = val2 }; ManualLogSource log7 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(50, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[StatusEffectFactory] Successfully cloned "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(effectName2); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" effect."); } log7.LogInfo(val); return val8; } public static List<StatusEffectModifierTable> DiscoverAllStatusEffectBlueprints() { //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown bool flag = default(bool); try { Type type = Type.GetType("SSSGame.StatusEffectModifierTable, Assembly-CSharp"); if (type == (Type)null) { Plugin.Log.LogWarning((object)"[StatusEffectFactory] Could not resolve StatusEffectModifierTable type."); return new List<StatusEffectModifierTable>(); } Il2CppReferenceArray<Object> val = Resources.FindObjectsOfTypeAll(type); if (val == null || ((Il2CppArrayBase<Object>)(object)val).Length == 0) { Plugin.Log.LogWarning((object)"[StatusEffectFactory] No StatusEffectModifierTable assets found."); return new List<StatusEffectModifierTable>(); } List<StatusEffectModifierTable> list = (from a in (IEnumerable<Object>)val select ((Il2CppObjectBase)a).TryCast<StatusEffectModifierTable>() into b where (Object)(object)b != (Object)null select b).ToList(); ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(56, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[StatusEffectFactory] Found "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(list.Count); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" StatusEffectModifierTables."); } log.LogInfo(val2); return list; } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(64, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[StatusEffectFactory] DiscoverAllStatusEffectBlueprints failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } log2.LogInfo(val2); return new List<StatusEffectModifierTable>(); } } public static float SafeGetModifierValue(dynamic attrElement) { //IL_0608: Unknown result type (might be due to invalid IL or missing references) //IL_060f: Expected O, but got Unknown if (attrElement == null) { return 0f; } try { dynamic val = attrElement?.modifier; if (val == null) { return 0f; } dynamic type = val.GetType(); dynamic val2 = type.GetProperty("Value") ?? type.GetProperty("value"); if (val2 != null) { object value = val2.GetValue(val); if (value is float result) { return result; } if (value is double num) { return (float)num; } if (float.TryParse(value?.ToString(), out var result2)) { return result2; } } dynamic val3 = type.GetField("Value") ?? type.GetField("value"); if (val3 != null) { object value2 = val3.GetValue(val); if (value2 is float result3) { return result3; } if (value2 is double num2) { return (float)num2; } if (float.TryParse(value2?.ToString(), out var result4)) { return result4; } } } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(51, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[StatusEffectFactory] SafeGetModifierValue failed: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex.Message); } log.LogWarning(val4); } return 0f; } public static void SetModifierValueSafely(dynamic attrElement, float newValue) { //IL_082c: Unknown result type (might be due to invalid IL or missing references) //IL_0833: Expected O, but got Unknown if (attrElement == null) { return; } dynamic val = attrElement?.modifier; if (val == null) { return; } try { dynamic type = val.GetType(); dynamic val2 = type.GetProperty("Value") ?? type.GetProperty("value"); if (val2 != null && val2.CanWrite) { val2.SetValue(val, Convert.ChangeType(newValue, val2.PropertyType)); return; } dynamic val3 = type.GetField("Value") ?? type.GetField("value"); if (!((val3 != null) ? true : false)) { try { val.Value = newValue; return; } catch { return; } } val3.SetValue(val, Convert.ChangeType(newValue, val3.FieldType)); } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(53, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("[StatusEffectFactory] SetModifierValueSafely failed: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex.Message); } log.LogWarning(val4); } } } namespace CreativeMode { [BepInPlugin("EOTS_Creative", "Creative Mode", "1.0.0")] public class Plugin : BasePlugin { internal static ManualLogSource Log; public override void Load() { Log = ((BasePlugin)this).Log; HarmonyFileLog.Enabled = true; PluginSettingsManager.Initialize(((BasePlugin)this).Config); try { InjectHelperClasses(); } catch (Exception ex) { Log.LogError((object)("InjectHelperClasses failed: " + ex)); } try { ApplyHarmonyPatches(); } catch (Exception ex2) { Log.LogError((object)("ApplyHarmonyPatches failed: " + ex2)); } } private static void InjectHelperClasses() { ClassInjector.RegisterTypeInIl2Cpp<EOTS_InputManager>(); ClassInjector.RegisterTypeInIl2Cpp<Creative_StatusEffectsManager>(); ClassInjector.RegisterTypeInIl2Cpp<SceneWatcherManager>(); ClassInjector.RegisterTypeInIl2Cpp<MapRevealFairy>(); } private void ApplyHarmonyPatches() { Harmony.CreateAndPatchAll(typeof(CharacterPatch), (string)null); Harmony.CreateAndPatchAll(typeof(CreativeModePatches), (string)null); Harmony.CreateAndPatchAll(typeof(StorageInteractionPatch), (string)null); Harmony.CreateAndPatchAll(typeof(StatusEffectPatches), (string)null); } } } namespace CreativeMode.Patches { [HarmonyPatch(typeof(UIGameMapManager))] public static class UIGameMapManagerPatch { private static bool explorerRegistered = false; private static float lastRunTime = 0f; private static float lastLogTime = 0f; private static float logInterval = 5f; private static float minX = float.MaxValue; private static float maxX = float.MinValue; private static float minZ = float.MaxValue; private static float maxZ = float.MinValue; [HarmonyPostfix] [HarmonyPatch(typeof(UIGameMapManager), "RegisterExplorer")] public static void RegisterExplorerPostfix(UIGameMapManager __instance, Transform exploringTransform) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(29, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Patch] Explorer registered: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>((exploringTransform != null) ? ((Object)exploringTransform).name : null); } log.LogInfo(val); explorerRegistered = true; } [HarmonyPostfix] [HarmonyPatch(typeof(UIGameMapManager), "Update")] public static void UpdatePostfix(UIGameMapManager __instance) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown if (!explorerRegistered || Time.time - lastRunTime < 2f) { return; } lastRunTime = Time.time; if (AccessTools.Method(typeof(UIGameMapManager), "get__explorers", (Type[])null, (Type[])null)?.Invoke(__instance, null) is List<Explorer> list && list.Count != 0) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(40, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Patch] Explorers list now has "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(list.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" entries."); } log.LogInfo(val); } } [HarmonyPostfix] [HarmonyPatch("_ExploreTileBiome")] public static void ExploreTileBiomePostfix(WorldTileData tile, Vector2 pos, float radius, Explorer explorer) { } } } namespace eots.bepinex.mod.Managers { public class CreativeModeManager : MonoBehaviour { private bool isEnabled; private readonly List<ICreativeProcess> processes = new List<ICreativeProcess>(); public Transform PlayerTransform { get; set; } public void Subscribe(ICreativeProcess process) { if (!processes.Contains(process)) { processes.Add(process); } if (isEnabled && (Object)(object)PlayerTransform != (Object)null) { process.Execute(PlayerTransform, 0); } } public void Unsubscribe(ICreativeProcess process) { if (processes.Contains(process)) { processes.Remove(process); } } public void SetEnabled(bool enabled) { if (isEnabled == enabled) { return; } isEnabled = enabled; if (!isEnabled) { return; } foreach (ICreativeProcess process in processes) { if ((Object)(object)PlayerTransform != (Object)null) { process.Execute(PlayerTransform, 0); } } } private void Update() { if (!isEnabled || !((Object)(object)PlayerTransform != (Object)null)) { return; } foreach (ICreativeProcess process in processes) { process.Execute(PlayerTransform, 0); } } } public interface ICreativeProcess { void Execute(Transform playerTransform, int actionID); } } namespace eots.bepinex.mod.Managers.StatusEffects { public static class StatusEffectsHelper { public static StatusEffect CreativeStatusEffect; public static void DumpCreativeStatusEffect() { Plugin.Log.LogInfo((object)"####### [DumpCreativeStatusEffect ] ##########"); DescribeEffect(CreativeStatusEffect); Plugin.Log.LogInfo((object)"##############################################"); } public static void ApplyCreativeStatusEffect(Character character, float duration = 10f) { if (CreativeStatusEffect == null) { CreativeStatusEffect = StatusEffectFactory.CreateCreativeModeEffect(); } StatusEffect creativeStatusEffect = CreativeStatusEffect; if ((Object)(object)((creativeStatusEffect != null) ? creativeStatusEffect.table : null) == (Object)null) { Plugin.Log.LogError((object)"[ApplyCreativeStatusEffect] CreativeStatusEffect or its table is null."); return; } StatusEffectManager val = ((character != null) ? character.GetStatusEffectManager() : null); if ((Object)(object)val == (Object)null) { Plugin.Log.LogWarning((object)"[StatusEffectApplyPostfix] Manager was null, skipping apply."); return; } CreativeStatusEffect.duration = duration; val.Apply(CreativeStatusEffect); } public static void DescribeEffect(StatusEffect effect) { //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) if (effect == null) { effect = CreativeStatusEffect; } StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine("=== StatusEffect Dump ==="); StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder3 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(10, 1, stringBuilder2); handler.AppendLiteral("Duration: "); handler.AppendFormatted((effect != null) ? new float?(effect.duration) : null); stringBuilder3.AppendLine(ref handler); stringBuilder2 = stringBuilder; StringBuilder stringBuilder4 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(12, 1, stringBuilder2); handler.AppendLiteral("Persistent: "); handler.AppendFormatted((effect != null) ? new bool?(effect.persistent) : null); stringBuilder4.AppendLine(ref handler); if ((Object)(object)((effect != null) ? effect.table : null) != (Object)null) { StatusEffectModifierTable table = effect.table; stringBuilder.AppendLine("--- Table Info ---"); stringBuilder2 = stringBuilder; StringBuilder stringBuilder5 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(4, 1, stringBuilder2); handler.AppendLiteral("ID: "); handler.AppendFormatted(table.id); stringBuilder5.AppendLine(ref handler); stringBuilder2 = stringBuilder; StringBuilder stringBuilder6 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(6, 1, stringBuilder2); handler.AppendLiteral("Name: "); handler.AppendFormatted(((Object)table).name); stringBuilder6.AppendLine(ref handler); stringBuilder2 = stringBuilder; StringBuilder stringBuilder7 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(13, 1, stringBuilder2); handler.AppendLiteral("Description: "); handler.AppendFormatted(table.localizedDescription); stringBuilder7.AppendLine(ref handler); stringBuilder2 = stringBuilder; StringBuilder stringBuilder8 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(12, 1, stringBuilder2); handler.AppendLiteral("EffectType: "); StatusEffectType effectType = table.effectType; handler.AppendFormatted((effectType != null) ? ((Object)effectType).name : null); stringBuilder8.AppendLine(ref handler); stringBuilder2 = stringBuilder; StringBuilder stringBuilder9 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(11, 1, stringBuilder2); handler.AppendLiteral("MaxStacks: "); handler.AppendFormatted(table.maxStacks); stringBuilder9.AppendLine(ref handler); stringBuilder2 = stringBuilder; StringBuilder stringBuilder10 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(19, 1, stringBuilder2); handler.AppendLiteral("StackingBehaviour: "); handler.AppendFormatted<StackingBehaviour>(table.stackingBehavior); stringBuilder10.AppendLine(ref handler); stringBuilder2 = stringBuilder; StringBuilder stringBuilder11 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(6, 1, stringBuilder2); handler.AppendLiteral("Icon: "); handler.AppendFormatted<Sprite>(table.icon); stringBuilder11.AppendLine(ref handler); stringBuilder2 = stringBuilder; StringBuilder stringBuilder12 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(14, 1, stringBuilder2); handler.AppendLiteral("MessageAdded: "); handler.AppendFormatted(table.messageTextAdded); stringBuilder12.AppendLine(ref handler); stringBuilder2 = stringBuilder; StringBuilder stringBuilder13 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(16, 1, stringBuilder2); handler.AppendLiteral("MessageRemoved: "); handler.AppendFormatted(table.messageTextRemoved); stringBuilder13.AppendLine(ref handler); if (table.attrElements != null && table.attrElements.Count > 0) { stringBuilder.AppendLine("--- Attribute Elements ---"); Enumerator<AttributeElement> enumerator = table.attrElements.GetEnumerator(); while (enumerator.MoveNext()) { AttributeElement current = enumerator.Current; AttributeConfig targetAttribute = current.targetAttribute; AttributeModifier modifier = current.modifier; string value = (((Object)(object)targetAttribute != (Object)null) ? targetAttribute.localizedName : "(null)"); int value2 = (((Object)(object)targetAttribute != (Object)null) ? targetAttribute.attributeId : (-1)); float value3 = ((modifier != null) ? modifier.Value : 0f); ModifierOperation value4 = (ModifierOperation)((modifier != null) ? ((int)modifier.Operation) : 0); stringBuilder2 = stringBuilder; StringBuilder stringBuilder14 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(29, 4, stringBuilder2); handler.AppendLiteral("Target: "); handler.AppendFormatted(value); handler.AppendLiteral(" (ID "); handler.AppendFormatted(value2); handler.AppendLiteral("), Modifier: "); handler.AppendFormatted(value3); handler.AppendLiteral(" ("); handler.AppendFormatted<ModifierOperation>(value4); handler.AppendLiteral(")"); stringBuilder14.AppendLine(ref handler); } } } Plugin.Log.LogInfo((object)stringBuilder.ToString()); } public static List<StatusEffectModifierTable> DiscoverAllStatusEffectBlueprints() { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown try { Type type = Type.GetType("SSSGame.StatusEffectModifierTable, Assembly-CSharp"); if (type == (Type)null) { Plugin.Log.LogWarning((object)"[StatusEffectsHelper] Could not resolve StatusEffectModifierTable type."); return new List<StatusEffectModifierTable>(); } Il2CppReferenceArray<Object> val = Resources.FindObjectsOfTypeAll(type); if (val == null || ((Il2CppArrayBase<Object>)(object)val).Length == 0) { Plugin.Log.LogWarning((object)"[StatusEffectsHelper] No StatusEffectModifierTable assets found."); return new List<StatusEffectModifierTable>(); } return (from a in (IEnumerable<Object>)val select ((Il2CppObjectBase)a).TryCast<StatusEffectModifierTable>() into b where (Object)(object)b != (Object)null select b).ToList(); } catch (Exception ex) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(64, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[StatusEffectsHelper] DiscoverAllStatusEffectBlueprints failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } log.LogInfo(val2); return new List<StatusEffectModifierTable>(); } } public static string SafeGetDisplayName(StatusEffectModifierTable bp) { if ((Object)(object)bp == (Object)null) { return string.Empty; } if (!string.IsNullOrEmpty(bp.localizedName)) { return bp.localizedName; } if (!string.IsNullOrEmpty(((Object)bp).name)) { return ((Object)bp).name; } return "(Unnamed StatusEffect)"; } } } namespace eots.bepinex.mod.Core { public static class MyPluginInfo { public const string PLUGIN_GUID = "EOTS_Creative"; public const string PLUGIN_NAME = "Creative Mode"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace eots.bepinex.mod.creative { public static class MyPluginInfo { public const string PLUGIN_GUID = "CreativeMode"; public const string PLUGIN_NAME = "CreativeMode"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace eots.bepinex.mod.creative.Patches { public class BaseContainerPanel { [HarmonyPostfix] [HarmonyPatch(typeof(BaseContainerPanel), "Refresh")] public static void Postfix(BaseContainerPanel __instance) { Plugin.Log.LogInfo((object)"[Patch] BaseContainerPanel.Refresh fired."); FieldInfo field = __instance.GetType().GetField("summonButton", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { object? value = field.GetValue(__instance); Button val = (Button)((value is Button) ? value : null); if ((Object)(object)val != (Object)null) { ((Selectable)val).interactable = true; Plugin.Log.LogInfo((object)"[Patch] Summon button forced enabled."); } } } } [HarmonyPatch(typeof(Character))] public class CharacterPatch { [HarmonyPostfix] [HarmonyPatch("Spawned")] public static void Spawned(Character __instance) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Expected O, but got Unknown bool flag = default(bool); if (__instance.IsPlayer()) { ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(22, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Spawned] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)__instance).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (IsPlayer="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(__instance.IsPlayer()); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")"); } log.LogInfo(val); } if (StatusEffectsHelper.CreativeStatusEffect == null) { StatusEffectsHelper.CreativeStatusEffect = StatusEffectFactory.CreateCreativeModeEffect(); } if (__instance.IsPlayer() && PluginSettingsManager.Toggle_ApplyCreativeBuffToPlayers.Value) { StatusEffectsHelper.ApplyCreativeStatusEffect(__instance, PluginSettingsManager.CreativeBuffDuration.Value); } if ((int)__instance.Faction == 2 && PluginSettingsManager.Toggle_ApplyCreativeBuffToVillagers.Value) { StatusEffectsHelper.ApplyCreativeStatusEffect(__instance, PluginSettingsManager.CreativeBuffDuration.Value); } if (!Globals.CharacterPatchWasInitialized && __instance.IsPlayer() && ((NetworkBehaviour)__instance).GetLocalAuthorityMask() == 1) { Globals.Character = __instance; Globals.CharacterPatchWasInitialized = true; ManualLogSource log2 = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(42, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Spawned] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)__instance).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" Attaching components completed)"); } log2.LogInfo(val); } } [HarmonyPrefix] [HarmonyPatch("TakeDamage")] public static bool TakeDamagePrefix(Character __instance, DamageData damage, object __state) { if (__instance.IsPlayer() && PluginSettingsManager.Toggle_GodMode.Value) { return false; } return true; } [HarmonyPrefix] [HarmonyPatch("DrainStamina")] public static bool DrainStaminaPrefix(Character __instance, ref float value, DrainStaminaUsage usage) { if (__instance.IsPlayer() && PluginSettingsManager.Toggle_GodMode.Value) { return false; } return true; } } [HarmonyPatch] public static class CreativeModePatches { private static bool isCreativeEnabled => PluginSettingsManager.Toggle_FreeBuild.Value; [HarmonyPostfix] [HarmonyPatch(typeof(NodeTemplate), "Configure")] private static void Configure_Postfix(NodeTemplate __instance) { if (isCreativeEnabled && !((Object)(object)__instance == (Object)null)) { __instance.blueprintConditionsRules = new List<BlueprintConditionsRule>(); } } [HarmonyPostfix] [HarmonyPatch(typeof(NodeTemplate), "FillManifest")] private static void FillManifest_Postfix(NodeTemplate __instance, ref ItemManifest manifest) { if (isCreativeEnabled && !((Object)(object)__instance == (Object)null)) { manifest.Clear(); } } [HarmonyPostfix] [HarmonyPatch(typeof(ItemManifestContainer), "GetManifest")] private static void GetManifest_Postfix(ItemManifestContainer __instance, ref ItemManifest __result) { if (isCreativeEnabled) { ItemCollection inventory = ((ItemContainer)__instance)._inventory; FarmCrop val = ((inventory != null) ? inventory.Owner.GetComponentInParent<FarmCrop>() : null); if (!((Object)(object)val != (Object)null) || !((Object)((Component)val).gameObject).name.Contains("_Crop")) { __result.Clear(); } } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerBuilder), "get_BuildPlacement")] private static void GetBuildPlacement_Postfix(PlayerBuilder __instance, ref Placement __result) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 if (isCreativeEnabled && !((Object)(object)__instance == (Object)null) && __result != null && (int)__instance.CurrentState == 1) { __result.Validity = (PlacementValidity)0; } } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerBuilder), "set_BuildPlacement")] private static void SetBuildPlacement_Postfix(PlayerBuilder __instance, Placement value) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 if (isCreativeEnabled && !((Object)(object)__instance == (Object)null) && value != null && (int)__instance.CurrentState == 1) { value.Validity = (PlacementValidity)0; } } [HarmonyPostfix] [HarmonyPatch(typeof(DynamicDimensionsPlacementTool), "_ValidateFootprint")] [HarmonyPatch(new Type[] { typeof(LayerMask) })] private static void ValidateFootprint_Postfix(ref bool __result) { if (isCreativeEnabled) { __result = true; } } } [HarmonyPatch(typeof(StatusEffectManager))] public class StatusEffectPatches { [HarmonyPrefix] [HarmonyPatch(typeof(StatusEffectManager), "Apply")] private static bool Prefix(StatusEffectManager __instance, StatusEffect statusEffect) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown if (statusEffect == null || (Object)(object)statusEffect.table == (Object)null) { return true; } string text = ((Object)statusEffect.table).ToString().Split(' ')[0]; if (PluginSettingsManager.BadEffects.Value.Contains(text)) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(41, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[StatusEffectPrefix] Blocked bad effect: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text); } log.LogInfo(val); return false; } return true; } [HarmonyPostfix] [HarmonyPatch(typeof(StatusEffectManager), "Apply")] private static void ApplyPostfix(StatusEffect statusEffect) { if (statusEffect == null) { Plugin.Log.LogInfo((object)"[StatusEffectApplyPostfix] StatusEffect was null"); return; } StatusEffectModifierTable table = statusEffect.table; if (!((Object)(object)table == (Object)null)) { StatusEffectsHelper.SafeGetDisplayName(table); } } } [HarmonyPatch(typeof(StorageInteraction))] public class StorageInteractionPatch { [HarmonyPatch("Check")] [HarmonyPrefix] public static bool CheckPrefix(ItemInfo itemInfo, ref bool __result) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(54, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Patch] StorageInteraction.Check called with itemInfo="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ItemInfo>(itemInfo); } log.LogInfo(val); __result = true; return false; } [HarmonyPostfix] [HarmonyPatch(typeof(StorageInteraction), "_OnStartSession")] public static void Postfix(StorageInteraction __instance, InteractionSession session) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown //IL_02b4: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Expected O, but got Unknown //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Expected O, but got Unknown //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Expected O, but got Unknown GameObject gameObject = ((Component)__instance).gameObject; ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(39, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[StorageInteraction] Interacting with: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>((gameObject != null) ? ((Object)gameObject).name : null); } log.LogInfo(val); if ((Object)(object)gameObject == (Object)null || (!((Object)gameObject).name.Contains("Menu/Deposit/ActivationInteraction") && !((Object)gameObject).name.Contains("StorageJotun"))) { ManualLogSource log2 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(51, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[StorageInteraction] Skipping non-OdinStone panel: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>((gameObject != null) ? ((Object)gameObject).name : null); } log2.LogInfo(val); return; } foreach (Component component in ((Component)__instance).gameObject.GetComponents<Component>()) { ManualLogSource log3 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(21, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Component type: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((object)component).GetType().FullName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", GO="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)component.gameObject).name); } log3.LogInfo(val); } if (!PluginSettingsManager.Toggle_AutoFillOdinStone.Value) { ManualLogSource log4 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(51, 0, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Patch] Auto-fill Odin Stone is disabled in config."); } log4.LogInfo(val); return; } ItemContainer container = __instance.Container; if (container == null) { return; } Dictionary<string, ItemInfo> dictionary = new Dictionary<string, ItemInfo>(); foreach (ItemInfo item in Resources.FindObjectsOfTypeAll<ItemInfo>()) { if (!dictionary.ContainsKey(((Object)item).name)) { dictionary.Add(((Object)item).name, item); } } ItemInfo valueOrDefault = dictionary.GetValueOrDefault("Item_Magic_EyeOfOdin"); if ((Object)(object)valueOrDefault != (Object)null) { int num = 0; List<Item> val2 = new List<Item>(); container.GetItemsToList(val2); Enumerator<Item> enumerator3 = val2.GetEnumerator(); while (enumerator3.MoveNext()) { Item current3 = enumerator3.Current; if ((Object)(object)current3.info == (Object)(object)valueOrDefault) { num += current3.count; } } int num2 = Math.Max(0, 5 - num); while (num2-- > 0) { Item val3 = valueOrDefault.CreateItem(); container.AddItem(val3, 1, -1, (ItemEventContext)0); container.OnItemCountChanged?.Invoke(val3); } ManualLogSource log5 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(45, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Patch] EyeOfOdin topped up to 5 (existing="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")."); } log5.LogInfo(val); } ManualLogSource log6 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(51, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Patch] Scanning UI under StorageInteraction root: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)gameObject).name); } log6.LogInfo(val); Il2CppArrayBase<Button> componentsInChildren = gameObject.GetComponentsInChildren<Button>(true); if (componentsInChildren.Length == 0) { Plugin.Log.LogInfo((object)"[Patch] No buttons found under StorageInteraction root."); return; } foreach (Button item2 in componentsInChildren) { Text componentInChildren = ((Component)item2).GetComponentInChildren<Text>(true); string text = ((componentInChildren != null) ? componentInChildren.text : null); ManualLogSource log7 = Plugin.Log; val = new BepInExInfoLogInterpolatedStringHandler(26, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Patch] Button: GO="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)((Component)item2).gameObject).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", Text="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text); } log7.LogInfo(val); if (!string.IsNullOrEmpty(text) && text.IndexOf("Summon", StringComparison.OrdinalIgnoreCase) >= 0) { ((Selectable)item2).interactable = true; Plugin.Log.LogInfo((object)"[Patch] Summon button forced enabled."); } } } [HarmonyPatch(typeof(StorageInteraction), "_OnFinishSession")] [HarmonyPostfix] public static void OnFinishSessionPostfix(StorageInteraction __instance, InteractionSession s, InteractionSessionState reason) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(51, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[OnFinishSessionPostfix] StorageInteraction Reason="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<InteractionSessionState>(reason); } log.LogInfo(val); } } [HarmonyPatch] public static class StorageInteraction_Use_Patch { private static MethodBase TargetMethod() { return AccessTools.Method(typeof(StorageInteraction), "Use", new Type[1] { typeof(InteractionSession) }, (Type[])null); } private static void Postfix(StorageInteraction __instance, InteractionSession session) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown Plugin.Log.LogInfo((object)"[Patch] StorageInteraction._OnStartSession fired."); ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(20, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Session="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<InteractionSession>(session); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", Container="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ItemContainer>(__instance.Container); } log.LogInfo(val); } } internal class VillagerPatches { [HarmonyPatch(typeof(ProficiencyPanel), "SetExpMultiplier")] public class ProficiencyPanelPatch { [HarmonyPrefix] public static bool Prefix(object expMultiplier) { _ = expMultiplier is Property; return true; } } [HarmonyPatch(typeof(Villager), "_OnProficiencyLevelChanged")] public class VillagerProficiencyPatch { [HarmonyPrefix] public static bool Prefix(ref int id, ref float value) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown float num = value; value = 100f; ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(43, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Villager] Proficiency id="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(id); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", original="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", new="); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(value); } log.LogInfo(val); return true; } } } } namespace eots.bepinex.mod.creative.Managers { internal class Creative_StatusEffectsManager : MonoBehaviour { private void Start() { } private void Update() { } } internal class EOTS_InputManager : MonoBehaviour { public static EOTS_InputManager Instance { get; private set; } private void Awake() { if ((Object)(object)Instance != (Object)null && (Object)(object)Instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { Instance = this; } } private void Start() { } private void Update() { InputHelpers.FKeyInputs(); } } public class PluginSettingsManager { public static ConfigEntry<bool> Toggle_FreeBuild; public static ConfigEntry<bool> Toggle_GodMode; public static ConfigEntry<bool> Toggle_AutoFillOdinStone; public static ConfigEntry<bool> Toggle_ApplyCreativeBuffToPlayers; public static ConfigEntry<bool> Toggle_ApplyCreativeBuffToVillagers; public static ConfigEntry<float> CreativeBuffDuration; public static ConfigEntry<string> CreativeBuffIconName; public static ConfigEntry<bool> Toggle_PreventBadStatusEffects; public static ConfigEntry<string> BadEffects; public static ConfigEntry<float> c_Hunger_Attr; public static ConfigEntry<float> c_Thirst_Attr; public static ConfigEntry<float> c_Sleep_Attr; public static ConfigEntry<float> c_ColdResistance_Attr; public static ConfigEntry<float> c_RainProtection_Attr; public static ConfigEntry<float> c_WindProtection_Attr; public static ConfigEntry<float> c_SnowProtection_Attr; public static ConfigEntry<float> c_Armor_Attr; public static ConfigEntry<float> c_InjuryChance_Attr; public static ConfigEntry<float> c_HealingIncrease_Attr; public static ConfigEntry<float> c_DamageTakenIncrease_Attr; public static ConfigEntry<float> c_AggresionThreshold_Attr; public static ConfigEntry<float> c_Vitality_Attr; public static ConfigEntry<float> c_Strength_Attr; public static ConfigEntry<float> c_Dexterity_Attr; public static ConfigEntry<float> c_Intelligence_Attr; public static ConfigEntry<float> c_Stamina_Attr; public static ConfigEntry<float> c_StaminaRegen_Attr; public static ConfigEntry<float> c_Stun_Attr; public static ConfigEntry<float> c_StunRegen_Attr; public static ConfigEntry<float> c_ThreatScore_Attr; public static ConfigEntry<float> c_HappinessCap_Attr; public static ConfigEntry<float> c_HappinessRate_Attr; public static ConfigEntry<float> c_Heat_Attr; public static ConfigEntry<float> c_Reborn_Attr; public static ConfigEntry<float> c_HarvestDiscount_Attr; public static ConfigEntry<float> c_CombatDiscount_Attr; public static ConfigEntry<float> c_Blessings_Attr; public static ConfigEntry<float> c_SprintDiscount_Attr; public static ConfigEntry<float> c_Health_VAttr; public static ConfigEntry<float> c_Energy_VAttr; public static ConfigEntry<float> c_Stun_VAttr; public static ConfigEntry<float> c_Rest_VAttr; public static ConfigEntry<float> c_Age_VAttr; public static ConfigEntry<float> c_RavenLeft_VAttr; public static ConfigEntry<float> c_Healing_VAttr; public static ConfigEntry<float> c_Happiness_VAttr; public static ConfigEntry<float> c_Warmth_VAttr; public static ConfigEntry<float> c_Water_VAttr; public static ConfigEntry<float> c_Food_VAttr; public static ConfigEntry<float> c_PetFood_VAttr; public static ConfigEntry<float> c_Wetness_VAttr; public static ConfigEntry<float> c_Frost_VAttr; public static ConfigEntry<float> c_StoneExpertise_VAttr; public static ConfigEntry<float> c_WoodExpertise_VAttr; public static ConfigEntry<float> c_SkinningExpertise_VAttr; public static ConfigEntry<float> c_FishingExpertise_VAttr; public static ConfigEntry<float> c_BuildingExpertise_VAttr; public static ConfigEntry<float> c_RangedCombatExpertise_VAttr; public static ConfigEntry<float> c_MeleeCombatExpertise_VAttr; public static ConfigEntry<float> c_CraftingExpertise_VAttr; public static ConfigEntry<float> c_BlacksmithExpertise_VAttr; public static ConfigEntry<float> c_CarpentryExpertise_VAttr; public static ConfigEntry<float> c_GatheringExpertise_VAttr; public static ConfigEntry<float> c_FirekeepingExpertise_VAttr; public static ConfigEntry<float> c_FarmingExpertise_VAttr; public static ConfigEntry<float> c_CookingExpertise_VAttr; public static ConfigEntry<float> c_ShamanicExpertise_VAttr; public static ConfigEntry<float> c_WoodHarvestExpMultiplier_Attr; public static ConfigEntry<float> c_StoneHarvestExpMultiplier_Attr; public static ConfigEntry<float> c_CraftingExpMultiplier_Attr; public static ConfigEntry<float> c_GatheringExpMultiplier_Attr; public static ConfigEntry<float> c_BuildingExpMultiplier_Attr; public static ConfigEntry<float> c_FirekeepingExpMultiplier_Attr; public static ConfigEntry<float> c_HuntingExpMultiplier_Attr; public static ConfigEntry<float> c_SkinningExpMultiplier_Attr; public static ConfigEntry<float> c_FishingExpMultiplier_Attr; public static ConfigEntry<float> c_BlacksmithExpMultiplier_Attr; public static ConfigEntry<float> c_CarpentryExpMultiplier_Attr; public static ConfigEntry<float> c_FarmingExpMultiplier_Attr; public static ConfigEntry<float> c_MeleeCombatExpertiseMultiplier_Attr; public static ConfigEntry<float> c_RangedCombatExpertiseMultiplier_Attr; public static ConfigEntry<float> c_CookingExpMultiplier_Attr; public static ConfigEntry<float> c_ShamanicExpertiseMultiplier_Attr; public static ConfigEntry<float> c_WoodHarvestProf_Attr; public static ConfigEntry<float> c_StoneHarvestProf_Attr; public static ConfigEntry<float> c_CraftingProf_Attr; public static ConfigEntry<float> c_GatheringProf_Attr; public static ConfigEntry<float> c_BuildingProf_Attr; public static ConfigEntry<float> c_FirekeepingProf_Attr; public static ConfigEntry<float> c_HuntingProf_Attr; public static ConfigEntry<float> c_SkinningProf_Attr; public static ConfigEntry<float> c_FishingProf_Attr; public static ConfigEntry<float> c_BlacksmithProf_Attr; public static ConfigEntry<float> c_CarpentryProf_Attr; public static ConfigEntry<float> c_FarmingProf_Attr; public static ConfigEntry<float> c_MeleeCombatProf_Attr; public static ConfigEntry<float> c_RangedCombatProf_Attr; public static ConfigEntry<float> c_CookingProf_Attr; public static ConfigEntry<float> c_ShamanicProf_Attr; public static ConfigEntry<float> c_MovementMultiplier; public static ConfigEntry<float> c_SprintSpeedMultiplier; public static ConfigEntry<float> c_LastDamageTime; public static ConfigEntry<float> c_BellowsDrive; public static ConfigEntry<float> c_CreateItemsDropdownPreferences; public static ConfigEntry<float> c_OptionalForCooking; public static ConfigEntry<float> c_ForgeHeat_VAttr; public static ConfigEntry<float> c_AirIntake_VAttr; public static ConfigEntry<float> c_ProfficiencyMultiplier; public static void Initialize(ConfigFile config) { CreativeBuffDuration = config.Bind<float>("01_Creative", "Creative Buff", 300f, "Duration of the buff in seconds"); CreativeBuffIconName = config.Bind<string>("01_Creative", "Icon Sprite Name", "UIFlat_Icon_flower", "In-game sprite(image) name.\nSee nexusmods Article for a complete list.\nUIFlat_icon_house2, UIFlat_icon_compass"); Toggle_ApplyCreativeBuffToPlayers = config.Bind<bool>("01_Creative", "ApplyCreativeBuffToPlayers", true, "Toggle applying creative buff to players"); Toggle_ApplyCreativeBuffToVillagers = config.Bind<bool>("01_Creative", "ApplyCreativeBuffToVillagers", false, "Toggle applying creative buff to villagers"); Toggle_FreeBuild = config.Bind<bool>("02_Features", "FreeBuild", false, "Allow Free Building"); Toggle_GodMode = config.Bind<bool>("02_Features", "God Mode", false, "Enable God Mode (No Damage, Infinite Stamina)"); Toggle_AutoFillOdinStone = config.Bind<bool>("02_Features", "AutoFillOdinStone", false, "Automatically re-fill Odin Stone with blood"); Toggle_PreventBadStatusEffects = config.Bind<bool>("02_Features", "PreventBadStatusEffects", false, "Toggle preventing bad status effects"); string[] names = Enum.GetNames(typeof(Constants.Creative_BadStatusEffects)); BadEffects = config.Bind<string>("02_Features", "BadEffects", string.Join(",", names), "Comma-separated list of bad status effects to block."); c_ColdResistance_Attr = config.Bind<float>("Buff Resistances", "ColdResistance", -1f, "Resistance against cold environments."); c_RainProtection_Attr = config.Bind<float>("Buff Resistances", "RainProtection", -1f, "Protection against rain."); c_WindProtection_Attr = config.Bind<float>("Buff Resistances", "WindProtection", -1f, "Protection against wind."); c_SnowProtection_Attr = config.Bind<float>("Buff Resistances", "SnowProtection", -1f, "Protection against snow."); c_Armor_Attr = config.Bind<float>("Buff Resistances", "Armor", -1f, "Armor value."); c_InjuryChance_Attr = config.Bind<float>("Buff Resistances", "InjuryChance", -1f, "Chance of injury."); c_HealingIncrease_Attr = config.Bind<float>("Buff Resistances", "HealingIncrease", -1f, "Healing increase modifier."); c_DamageTakenIncrease_Attr = config.Bind<float>("Buff Resistances", "DamageTakenIncrease", -1f, "Damage taken increase modifier."); c_AggresionThreshold_Attr = config.Bind<float>("Buff Resistances", "AggresionThreshold", -1f, "Aggression threshold."); c_Hunger_Attr = config.Bind<float>("Buff Base Stats Rates", "Hunger", -1f, "Base hunger drain rate. \n0.5 is like sleeping all the time. 0 = no hunger loss"); c_Thirst_Attr = config.Bind<float>("Buff Base Stats Rates", "Thirst", -1f, "Base thirst drain rate. \n0.5 is like sleeping all the time. 0 = no thirst loss"); c_Sleep_Attr = config.Bind<float>("Buff Base Stats Rates", "Sleep", -1f, "Sleep gain rate. \n5 is like sleeping all the time."); c_Vitality_Attr = config.Bind<float>("Buff Base Stats", "Vitality", -1f, "Base vitality value."); c_Strength_Attr = config.Bind<float>("Buff Base Stats", "Strength", -1f, "Base strength value."); c_Dexterity_Attr = config.Bind<float>("Buff Base Stats", "Dexterity", -1f, "Base dexterity value."); c_Intelligence_Attr = config.Bind<float>("Buff Base Stats", "Intelligence", -1f, "Base intelligence value."); c_Stamina_Attr = config.Bind<float>("Buff Base Stats", "Stamina", -1f, "Base stamina value."); c_StaminaRegen_Attr = config.Bind<float>("Buff Base Stats", "StaminaRegen", -1f, "Stamina regeneration rate."); c_Stun_Attr = config.Bind<float>("Buff Base Stats", "Stun", -1f, "Stun value."); c_StunRegen_Attr = config.Bind<float>("Buff Base Stats", "StunRegen", -1f, "Stun regeneration rate."); c_ThreatScore_Attr = config.Bind<float>("Buff Base Stats", "ThreatScore", -1f, "Threat score."); c_HappinessCap_Attr = config.Bind<float>("Buff Base Stats", "HappinessCap", -1f, "Maximum happiness cap."); c_HappinessRate_Attr = config.Bind<float>("Buff Base Stats", "HappinessRate", -1f, "Rate of happiness gain."); c_Heat_Attr = config.Bind<float>("Buff Base Stats", "Heat", -1f, "Heat value."); c_Reborn_Attr = config.Bind<float>("Buff Base Stats", "Reborn", -1f, "Reborn attribute."); c_HarvestDiscount_Attr = config.Bind<float>("Buff Base Stats", "HarvestDiscount", -1f, "Harvest discount modifier."); c_CombatDiscount_Attr = config.Bind<float>("Buff Base Stats", "CombatDiscount", -1f, "Combat discount modifier."); c_Blessings_Attr = config.Bind<float>("Buff Base Stats", "Blessings", -1f, "Blessings attribute."); c_SprintDiscount_Attr = config.Bind<float>("Buff Base Stats", "SprintDiscount", -1f, "Sprint discount modifier."); c_Health_VAttr = config.Bind<float>("Buff Vitals", "Health", -1f, "Base health value."); c_Energy_VAttr = config.Bind<float>("Buff Vitals", "Energy", -1f, "Base energy value."); c_Stun_VAttr = config.Bind<float>("Buff Vitals", "Stun", -1f, "Base stun value."); c_Rest_VAttr = config.Bind<float>("Buff Vitals", "Rest", -1f, "Base rest value."); c_Age_VAttr = config.Bind<float>("Buff Vitals", "Age", -1f, "Base age value."); c_RavenLeft_VAttr = config.Bind<float>("Buff Vitals", "RavenLeft", -1f, "Raven left attribute."); c_Healing_VAttr = config.Bind<float>("Buff Vitals", "Healing", -1f, "Healing value."); c_Happiness_VAttr = config.Bind<float>("Buff Vitals", "Happiness", -1f, "Happiness value."); c_Warmth_VAttr = config.Bind<float>("Buff Vitals", "Warmth", -1f, "Warmth value."); c_Water_VAttr = config.Bind<float>("Buff Vitals", "Water", -1f, "Water value."); c_Food_VAttr = config.Bind<float>("Buff Vitals", "Food", -1f, "Food value."); c_PetFood_VAttr = config.Bind<float>("Buff Vitals", "PetFood", -1f, "Pet food value."); c_Wetness_VAttr = config.Bind<float>("Buff Vitals", "Wetness", -1f, "Wetness value."); c_Frost_VAttr = config.Bind<float>("Buff Vitals", "Frost", -1f, "Frost value."); c_StoneExpertise_VAttr = config.Bind<float>("Buff Expertise", "StoneExpertise", -1f, "Base value for stone expertise."); c_WoodExpertise_VAttr = config.Bind<float>("Buff Expertise", "WoodExpertise", -1f, "Base value for wood expertise."); c_SkinningExpertise_VAttr = config.Bind<float>("Buff Expertise", "SkinningExpertise", -1f, "Base value for skinning expertise."); c_FishingExpertise_VAttr = config.Bind<float>("Buff Expertise", "FishingExpertise", -1f, "Base value for fishing expertise."); c_BuildingExpertise_VAttr = config.Bind<float>("Buff Expertise", "BuildingExpertise", -1f, "Base value for building expertise."); c_RangedCombatExpertise_VAttr = config.Bind<float>("Buff Expertise", "RangedCombatExpertise", -1f, "Base value for ranged combat expertise."); c_MeleeCombatExpertise_VAttr = config.Bind<float>("Buff Expertise", "MeleeCombatExpertise", -1f, "Base value for melee combat expertise."); c_CraftingExpertise_VAttr = config.Bind<float>("Buff Expertise", "CraftingExpertise", -1f, "Base value for crafting expertise."); c_BlacksmithExpertise_VAttr = config.Bind<float>("Buff Expertise", "BlacksmithExpertise", -1f, "Base value for blacksmith expertise."); c_CarpentryExpertise_VAttr = config.Bind<float>("Buff Expertise", "CarpentryExpertise", -1f, "Base value for carpentry expertise."); c_GatheringExpertise_VAttr = config.Bind<float>("Buff Expertise", "GatheringExpertise", -1f, "Base value for gathering expertise."); c_FirekeepingExpertise_VAttr = config.Bind<float>("Buff Expertise", "FirekeepingExpertise", -1f, "Base value for firekeeping expertise."); c_FarmingExpertise_VAttr = config.Bind<float>("Buff Expertise", "FarmingExpertise", -1f, "Base value for farming expertise."); c_CookingExpertise_VAttr = config.Bind<float>("Buff Expertise", "CookingExpertise", -1f, "Base value for cooking expertise."); c_ShamanicExpertise_VAttr = config.Bind<float>("Buff Expertise", "ShamanicExpertise", -1f, "Base value for shamanic expertise."); c_WoodHarvestExpMultiplier_Attr = config.Bind<float>("Buff Experience Multipliers", "WoodHarvestExpMultiplier", -1f, "Experience gain multiplier for wood harvesting."); c_StoneHarvestExpMultiplier_Attr = config.Bind<float>("Buff Experience Multipliers", "StoneHarvestExpMultiplier", -1f, "Experience gain multiplier for stone harvesting."); c_CraftingExpMultiplier_Attr = config.Bind<float>("Buff Experience Multipliers", "CraftingExpMultiplier", -1f, "Experience gain multiplier for crafting."); c_GatheringExpMultiplier_Attr = config.Bind<float>("Buff Experience Multipliers", "GatheringExpMultiplier", -1f, "Experience gain multiplier for general gathering."); c_BuildingExpMultiplier_Attr = config.Bind<float>("Buff Experience Multipliers", "BuildingExpMultiplier", -1f, "Experience gain multiplier for building."); c_FirekeepingExpMultiplier_Attr = config.Bind<float>("Buff Experience Multipliers", "FirekeepingExpMultiplier", -1f, "Experience gain multiplier for firekeeping."); c_HuntingExpMultiplier_Attr = config.Bind<float>("Buff Experience Multipliers", "HuntingExpMultiplier", -1f, "Experience gain multiplier for hunting."); c_SkinningExpMultiplier_Attr = config.Bind<float>("Buff Experience Multipliers", "SkinningExpMultiplier", -1f, "Experience gain multiplier for skinning."); c_FishingExpMultiplier_Attr = config.Bind<float>("Buff Experience Multipliers", "FishingExpMultiplier", -1f, "Experience gain multiplier for fishing."); c_BlacksmithExpMultiplier_Attr = config.Bind<float>("Buff Experience Multipliers", "BlacksmithExpMultiplier", -1f, "Experience gain multiplier for blacksmithing."); c_CarpentryExpMultiplier_Attr = config.Bind<float>("Buff Experience Multipliers", "CarpentryExpMultiplier", -1f, "Experience gain multiplier for carpentry."); c_FarmingExpMultiplier_Attr = config.Bind<float>("Buff Experience Multipliers", "FarmingExpMultiplier", -1f, "Experience gain multiplier for farming."); c_MeleeCombatExpertiseMultiplier_Attr = config.Bind<float>("Buff Experience Multipliers", "MeleeCombatExpMultiplier", -1f, "Experience gain multiplier for melee combat expertise."); c_RangedCombatExpertiseMultiplier_Attr = config.Bind<float>("Buff Experience Multipliers", "RangedCombatExpMultiplier", -1f, "Experience gain multiplier for ranged combat expertise."); c_CookingExpMultiplier_Attr = config.Bind<float>("Buff Experience Multipliers", "CookingExpMultiplier", -1f, "Experience gain multiplier for cooking."); c_ShamanicExpertiseMultiplier_Attr = config.Bind<float>("Buff Experience Multipliers", "ShamanicCombatExpMultiplier", -1f, "Experience gain multiplier for shamanic combat expertise."); c_MovementMultiplier = config.Bind<float>("Buff Villager Movement", "MovementMultiplier", -1f, "Multiplier for villager movement speed."); c_SprintSpeedMultiplier = config.Bind<float>("Buff Movement", "SprintSpeedMultiplier", -1f, "Multiplier for sprint speed."); c_LastDamageTime = config.Bind<float>("Buff Misc", "LastDamageTime", -1f, "Last damage time attribute."); c_BellowsDrive = config.Bind<float>("Buff Misc", "BellowsDrive", -1f, "Bellows drive attribute."); c_CreateItemsDropdownPreferences = config.Bind<float>("Buff Misc", "CreateItemsDropdownPreferences", -1f, "Create items dropdown preferences."); c_OptionalForCooking = config.Bind<float>("Buff Misc", "OptionalForCooking", -1f, "Optional for cooking attribute."); c_ForgeHeat_VAttr = config.Bind<float>("Buff Misc", "ForgeHeat", -1f, "Forge heat value."); c_AirIntake_VAttr = config.Bind<float>("Buff Misc", "AirIntake", -1f, "Air intake value."); c_ProfficiencyMultiplier = config.Bind<float>("Buff Misc", "ProfficiencyMultiplier", -1f, "Proficiency multiplier."); c_WoodHarvestProf_Attr = config.Bind<float>("Buff Proficiencies", "WoodHarvest", -1f, "Wood harvesting proficiency."); c_StoneHarvestProf_Attr = config.Bind<float>("Buff Proficiencies", "StoneHarvest", -1f, "Stone harvesting proficiency."); c_CraftingProf_Attr = config.Bind<float>("Buff Proficiencies", "Crafting", -1f, "Crafting proficiency."); c_GatheringProf_Attr = config.Bind<float>("Buff Proficiencies", "Gathering", -1f, "Gathering proficiency."); c_BuildingProf_Attr = config.Bind<float>("Buff Proficiencies", "Building", -1f, "Building proficiency."); c_FirekeepingProf_Attr = config.Bind<float>("Buff Proficiencies", "Firekeeping", -1f, "Firekeeping proficiency."); c_HuntingProf_Attr = config.Bind<float>("Buff Proficiencies", "Hunting", -1f, "Hunting proficiency."); c_SkinningProf_Attr = config.Bind<float>("Buff Proficiencies", "Skinning", -1f, "Skinning proficiency."); c_FishingProf_Attr = config.Bind<float>("Buff Proficiencies", "Fishing", -1f, "Fishing proficiency."); c_BlacksmithProf_Attr = config.Bind<float>("Buff Proficiencies", "Blacksmith", -1f, "Blacksmith proficiency."); c_CarpentryProf_Attr = config.Bind<float>("Buff Proficiencies", "Carpentry", -1f, "Carpentry proficiency."); c_FarmingProf_Attr = config.Bind<float>("Buff Proficiencies", "Farming", -1f, "Farming proficiency."); c_MeleeCombatProf_Attr = config.Bind<float>("Buff Proficiencies", "MeleeCombat", -1f, "Melee combat proficiency."); c_RangedCombatProf_Attr = config.Bind<float>("Buff Proficiencies", "RangedCombat", -1f, "Ranged combat proficiency."); c_CookingProf_Attr = config.Bind<float>("Buff Proficiencies", "Cooking", -1f, "Cooking proficiency."); c_ShamanicProf_Attr = config.Bind<float>("Buff Proficiencies", "Shamanic", -1f, "Shamanic proficiency."); } } public class SceneWatcherManager : MonoBehaviour { private Action<Scene, Scene> _sceneChangedHandler; private void OnEnable() { _sceneChangedHandler = HandleSceneChanged; SceneManager.activeSceneChanged += UnityAction<Scene, Scene>.op_Implicit(_sceneChangedHandler); } private void OnDisable() { SceneManager.activeSceneChanged -= UnityAction<Scene, Scene>.op_Implicit(_sceneChangedHandler); } private void HandleSceneChanged(Scene oldScene, Scene newScene) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(42, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[SceneWatcher] Scene changed from '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Scene)(ref oldScene)).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' to '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Scene)(ref newScene)).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'"); } log.LogInfo(val); Globals.CharacterPatchWasInitialized = false; } } } namespace eots.bepinex.mod.creative.Managers.Inputs { internal static class InputHelpers { public static void FKeyInputs() { if (Input.GetKeyDown((KeyCode)286)) { CharacterFinder.ForEach(delegate(Character c) { StatusEffectsHelper.ApplyCreativeStatusEffect(c, 36000f); }); } if (Input.GetKeyDown((KeyCode)287)) { Plugin.Log.LogInfo((object)"GetKeyDown[KeyCode.F6]"); Constants.Creative_StatusEffectType.Effect_ShelteredCave.ToString(); StatusEffectsHelper.CreativeStatusEffect = StatusEffectFactory.CreateCreativeModeEffect(); } if (Input.GetKeyDown((KeyCode)288)) { Plugin.Log.LogInfo((object)"GetKeyDown[KeyCode.F7]"); List<Structure> closestStructures = StructureHelpers.GetClosestStructures(((Component)Globals.Character).transform); if (closestStructures != null && closestStructures.Count > 0) { foreach (Structure item in closestStructures) { if (((Object)item).name.Contains("Hearthstone")) { Plugin.Log.LogInfo((object)"Found HearthstoneCore structure nearby."); } else { Plugin.Log.LogInfo((object)"Closest structure is not a HearthstoneCore."); } } } } if (Input.GetKeyDown((KeyCode)289)) { Plugin.Log.LogInfo((object)"GetKeyDown[KeyCode.F8]"); StatusEffectsHelper.ApplyCreativeStatusEffect(Globals.Character, 1200f); } if (Input.GetKeyDown((KeyCode)290)) { GameMapHelpers.LaunchAFairyRingSet(((Component)Globals.Character).transform, 2); } if (Input.GetKeyDown((KeyCode)291)) { CharacterSurvivalHelper.RefillAll(); } } } } namespace eots.bepinex.mod.creative.Managers.Characters { public class TimeLogger : MonoBehaviour { private float elapsed; private float logInterval = 2f; private void Start() { Plugin.Log.LogInfo((object)"TimeLogger Started"); } private void Update() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown elapsed += Time.deltaTime; if (elapsed >= logInterval) { elapsed = 0f; ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(52, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[TimeLogger] Current game time: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(Time.time, "F2"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" seconds since start"); } log.LogInfo(val); } } } public static class CharacterSurvivalHelper { private static CharacterSurvival GetSurvival(Character character = null) { Character obj = character ?? Globals.Character; if (obj == null) { return null; } return ((Component)obj).GetComponent<CharacterSurvival>(); } public static void ReportPlayerSurvival(Character character = null) { CharacterSurvival survival = GetSurvival(character); if ((Object)(object)survival == (Object)null) { Plugin.Log.LogInfo((object)"No CharacterSurvival component found."); return; } string text = $"Player Survival -> Food={survival.GetNormalizedFood()}, Water={survival.GetNormalizedWater()}, Warmth={survival.GetNormalizedWarmth()}, MaxFood={survival.GetMaxFood()}, IsFreezing={survival.IsFreezing}, IsStarving={survival.IsStarving}, IsDehydrated={survival.IsDehydrated}, IsSuffering={survival.IsSuffering}"; Plugin.Log.LogInfo((object)text); } public static void SetPlayerFood(Character character, float normalizedValue) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown CharacterSurvival survival = GetSurvival(character); if (!((Object)(object)survival == (Object)null)) { float maxFood = survival.GetMaxFood(); float num = Mathf.Clamp(normalizedValue * maxFood, 0f, maxFood); VariableAttribute foodVAttr = survival._foodVAttr; if (foodVAttr != null) { ((Property)foodVAttr).SetValue(num); } ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(20, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Set player food to "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("/"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(maxFood); } log.LogInfo(val); } } public static void SetPlayerWater(Character character, float value) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown CharacterSurvival survival = GetSurvival(character); if (!((Object)(object)survival == (Object)null)) { float num = Mathf.Clamp(value, 0f, 100f); VariableAttribute waterVAttr = survival._waterVAttr; if (waterVAttr != null) { ((Property)waterVAttr).SetValue(num); } ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(24, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Set player water to "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("/100"); } log.LogInfo(val); } } public static void SetPlayerWarmth(Character character, float value) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown CharacterSurvival survival = GetSurvival(character); if (!((Object)(object)survival == (Object)null)) { float num = Mathf.Clamp(value, 0f, 100f); VariableAttribute warmthVAttr = survival._warmthVAttr; if (warmthVAttr != null) { ((Property)warmthVAttr).SetValue(num); } ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(25, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Set player warmth to "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("/100"); } log.LogInfo(val); } } public static void SetPlayerEnergy(Character character, float value) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown CharacterSurvival survival = GetSurvival(character); if (!((Object)(object)survival == (Object)null)) { float num = Mathf.Clamp(value, 0f, 200f); VariableAttribute energyVAttr = survival._energyVAttr; if (energyVAttr != null) { ((Property)energyVAttr).SetValue(num); } ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(25, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Set player energy to "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("/200"); } log.LogInfo(val); } } public static void SetPlayerHealth(Character character, float value) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown CharacterSurvival survival = GetSurvival(character); if (!((Object)(object)survival == (Object)null)) { Character obj = character ?? Globals.Character; float num = ((obj != null) ? obj.MaxHealth : 200f); float num2 = Mathf.Clamp(value, 0f, num); VariableAttribute healthVAttr = survival._healthVAttr; if (healthVAttr != null) { ((Property)healthVAttr).SetValue(num2); } ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(22, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Set player health to "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num2); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("/"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(num); } log.LogInfo(val); } } public static void IncreaseAll(Character character, float amount) { CharacterSurvival survival = GetSurvival(character); if (!((Object)(object)survival == (Object)null)) { float maxFood = survival.GetMaxFood(); VariableAttribute foodVAttr = survival._foodVAttr; if (foodVAttr != null) { VariableAttribute foodVAttr2 = survival._foodVAttr; ((Property)foodVAttr).SetValue(Mathf.Clamp(((foodVAttr2 != null) ? ((Property)foodVAttr2).GetValue() : 0f) + amount, 0f, maxFood)); } VariableAttribute waterVAttr = survival._waterVAttr; if (waterVAttr != null) { VariableAttribute waterVAttr2 = survival._waterVAttr; ((Property)waterVAttr).SetValue(Mathf.Clamp(((waterVAttr2 != null) ? ((Property)waterVAttr2).GetValue() : 0f) + amount, 0f, 100f)); } VariableAttribute warmthVAttr = survival._warmthVAttr; if (warmthVAttr != null) { VariableAttribute warmthVAttr2 = survival._warmthVAttr; ((Property)warmthVAttr).SetValue(Mathf.Clamp(((warmthVAttr2 != null) ? ((Property)warmthVAttr2).GetValue() : 0f) + amount, 0f, 100f)); } Character obj = character ?? Globals.Character; float num = ((obj != null) ? obj.MaxHealth : 200f); VariableAttribute healthVAttr = survival._healthVAttr; if (healthVAttr != null) { VariableAttribute healthVAttr2 = survival._healthVAttr; ((Property)healthVAttr).SetValue(Mathf.Clamp(((healthVAttr2 != null) ? ((Property)healthVAttr2).GetValue() : 0f) + amount, 0f, num)); } } } public static void RefillAll(Character character = null) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown if (!((Object)(object)GetSurvival(character) == (Object)null)) { SetPlayerFood(character, 1f); SetPlayerWater(character, 100f); SetPlayerWarmth(character, 100f); Character obj = character ?? Globals.Character; SetPlayerHealth(character, (obj != null) ? obj.MaxHealth : 200f); ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(40, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Refilled all survival stats to full for "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)character).name); } log.LogInfo(val); } } } public class MapRevealFairy : MonoBehaviour { public float baseAngleSpeed = 270f; public float angleDecayFactor = 0.0005f; public float radius; public Vector3 origin; private float currentAngle; private bool registered; private void Start() { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(52, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[MapRevealFairy] Starting circle at radius "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(radius); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" from "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<Vector3>(origin); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("..."); } log.LogInfo(val); } private void Update() { //IL_00ed: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown if (!registered) { UIGameMapManager val = Object.FindObjectOfType<UIGameMapManager>(); if ((Object)(object)val != (Object)null) { val.RegisterExplorer(((Component)this).transform); registered = true; } } float num = baseAngleSpeed * (1f - angleDecayFactor * radius); num = Mathf.Max(30f, num); currentAngle += num * Time.deltaTime; if (currentAngle >= 360f) { ManualLogSource log = Plugin.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(63, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[MapRevealFairy] Completed circle at radius "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(radius); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(". Destroying fairy."); } log.LogInfo(val2); Object.Destroy((Object)(object)((Component)this).gameObject); } else { float num2 = currentAngle * ((float)Math.PI / 180f); float num3 = Mathf.Cos(num2) * radius; float num4 = Mathf.Sin(num2) * radius; ((Component)this).transform.position = origin + new Vector3(num3, 0f, num4); } } } } namespace eots.bepinex.mod.creative.Helpers { internal class AttributeConfigHelpers { private static Dictionary<int, AttributeConfig> _cacheById; private static List<AttributeConfig> _allConfigs; public static List<AttributeConfig> DiscoverAllAttributeConfigs() { //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Expected O, but got Unknown //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Expected O, but got Unknown if (_allConfigs != null && _allConfigs.Count > 0) { return _allConfigs; } bool flag = default(bool); try { Type type = Type.GetType("SandSailorStudio.Attributes.AttributeConfig, SandSailorStudio"); if (type == (Type)null) { Plugin.Log.LogWarning((object)"[StatusEffectFactory] Could not resolve AttributeConfig type."); _allConfigs = new List<AttributeConfig>(); return _allConfigs; } Il2CppReferenceArray<Object> val = Resources.FindObjectsOfTypeAll(type); if (val == null || ((Il2CppArrayBase<Object>)(object)val).Length == 0) { Plugin.Log.LogWarning((object)"[StatusEffectFactory] No AttributeConfig assets found."); _allConfigs = new List<AttributeConfig>(); return _allConfigs; } _allConfigs = (from a in (IEnumerable<Object>)val select ((Il2CppObjectBase)a).TryCast<AttributeConfig>() into b where (Object)(object)b != (Object)null select b).ToList(); _cacheById = new Dictionary<int, AttributeConfig>(); foreach (AttributeConfig allConfig in _allConfigs) { if (!_cacheById.ContainsKey(allConfig.attributeId)) { _cacheById[allConfig.attributeId] = allConfig; } } ManualLogSource log = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(47, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[StatusEffectFactory] Cached "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(_allConfigs.Count); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" AttributeConfigs."); } log.LogInfo(val2); return _allConfigs; } catch (Exception ex) { ManualLogSource log2 = Plugin.Log; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(58, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[StatusEffectFactory] DiscoverAllAttributeConfigs failed: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } log2.LogInfo(val2); _allConfigs = new List<AttributeConfig>(); _cacheById = new Dictionary<int, AttributeConfig>(); return _allConfigs; } } public static AttributeConfig FindAttributeConfigById(int id) { if (_cacheById == null || _cacheById.Count == 0) { DiscoverAllAttributeConfigs(); } _cacheById.TryGetValue(id, out AttributeConfig value); return value; } public static AttributeConfig FindAttributeConfigByName(string name) { string name2 = name; if (_allConfigs == null || _allConfigs.Count == 0) { DiscoverAllAttributeConfigs(); } return ((IEnumerable<AttributeConfig>)_allConfigs).FirstOrDefault((Func<AttributeConfig, bool>)((AttributeConfig cfg) => cfg.localizedName != null && cfg.localizedName.Contains(name2))); } } public static class CharacterFinder { public static List<Character> FindAllCharacters() { return ((IEnumerable<Character>)Object.FindObjectsOfType<Character>()).ToList(); } public static void ForEach(Action<Character> action) { foreach (Character item in FindAllCharacters()) { action?.Invoke(item); } } public static List<Character> FindAllPlayers() { return (from c in FindAllCharacters() where c.IsPlayer() select c).ToList(); } public static List<Character> FindByFaction(Faction faction) { //IL_0007: Unknown result type