Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of MapClock v0.1.0
plugins/MapClock/MapClock.dll
Decompiled 3 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Blackforge.Hot; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("assembly_valheim")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Blackforge { public static class Clock { private const string Name = "bf_clock"; private const string DialFile = "clock/dial.png"; private const string HandFile = "clock/hand.png"; private const float Size = 88f; private const float Margin = 30f; private const float Morning = 0.15f; private const float Evening = 0.85f; private const float Day = 0.70000005f; private static HotHost host; private static GameObject dial; private static RectTransform hand; private static readonly List<Sprite> sprites = new List<Sprite>(); private static bool failed; public static void Load(HotHost from) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown host = from; host.Harmony.Patch((MethodBase)AccessTools.Method(typeof(Minimap), "Update", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(Clock), "Tick", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } public static void Unload() { if ((Object)(object)dial != (Object)null) { Object.Destroy((Object)(object)dial); } foreach (Sprite sprite in sprites) { Object.Destroy((Object)(object)sprite.texture); Object.Destroy((Object)(object)sprite); } sprites.Clear(); dial = null; hand = null; failed = false; host = null; } private static void Tick(Minimap __instance) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (host == null || failed || (Object)(object)EnvMan.instance == (Object)null || (int)__instance.m_mode != 2 || (Object)(object)__instance.m_mapImageLarge == (Object)null) { return; } if ((Object)(object)dial == (Object)null) { try { Build(((Graphic)__instance.m_mapImageLarge).rectTransform); } catch (Exception ex) { failed = true; host.Log.LogWarning((object)("clock: no dial on the big map: " + ex.Message)); return; } } ((Transform)hand).localEulerAngles = new Vector3(0f, 0f, -360f * Turn(EnvMan.instance.GetDayFraction())); } private static float Turn(float fraction) { float num = ((fraction < 0.25f) ? (fraction / 0.25f * 0.15f) : ((!(fraction <= 0.75f)) ? (0.85f + (fraction - 0.75f) / 0.25f * 0.14999998f) : (0.15f + (fraction - 0.25f) / 0.5f * 0.70000005f))); return Mathf.Repeat(num - 0.15f, 1f); } private static void Build(RectTransform map) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) Sprite sprite = Picture("clock/dial.png"); Sprite sprite2 = Picture("clock/hand.png"); dial = Layer("bf_clock", map, sprite); RectTransform val = (RectTransform)dial.transform; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0f, 1f); val.pivot = val2; Vector2 anchorMin = (val.anchorMax = val2); val.anchorMin = anchorMin; val.anchoredPosition = new Vector2(30f, -30f); val.sizeDelta = new Vector2(88f, 88f); hand = (RectTransform)Layer("hand", val, sprite2).transform; hand.anchorMin = Vector2.zero; hand.anchorMax = Vector2.one; RectTransform obj = hand; anchorMin = (hand.offsetMax = Vector2.zero); obj.offsetMin = anchorMin; host.Log.LogInfo((object)"clock: the dial is on the big map"); } private static GameObject Layer(string name, RectTransform parent, Sprite sprite) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }) { layer = ((Component)parent).gameObject.layer }; val.transform.SetParent((Transform)(object)parent, false); Image obj = val.AddComponent<Image>(); obj.sprite = sprite; ((Graphic)obj).raycastTarget = false; return val; } private static Sprite Picture(string file) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(2, 2, (TextureFormat)4, true); ImageConversion.LoadImage(val, host.ReadAsset(file), true); Sprite val2 = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f)); sprites.Add(val2); return val2; } } [BepInPlugin("vladasz.mapclock", "Map Clock", "0.1.0")] public class MapClockPlugin : BaseUnityPlugin { public const string Id = "vladasz.mapclock"; public const string Number = "0.1.0"; private void Awake() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown HotHost hotHost = new HotHost(((BaseUnityPlugin)this).Logger, new Harmony("vladasz.mapclock"), "0.1.0"); if (!hotHost.IsDedicatedServer) { Clock.Load(hotHost); } } } } namespace Blackforge.Hot { public sealed class HotHost { public ManualLogSource Log { get; } public Harmony Harmony { get; } public string Version { get; } public bool IsDedicatedServer => (int)SystemInfo.graphicsDeviceType == 4; internal HotHost(ManualLogSource log, Harmony harmony, string version) { Log = log; Harmony = harmony; Version = version; } public byte[] ReadAsset(string relative) { return File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(typeof(HotHost).Assembly.Location), relative)); } public void UnregisterRpc(IEnumerable<string> names) { if (ZRoutedRpc.instance == null) { return; } foreach (string name in names) { ZRoutedRpc.instance.m_functions.Remove(StringExtensionMethods.GetStableHashCode(name)); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }