using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using Fusion; using LycansMods.Shared; using Microsoft.CodeAnalysis; using On; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Localization; using UnityEngine.Localization.Settings; using UnityEngine.Localization.Tables; using UnityEngine.Networking; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")] [assembly: AssemblyCompany("LycansMod.AfterlifeBets")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+9d859ede976e8c5dc9c35879c610ff99649ba124")] [assembly: AssemblyProduct("LycansMod.AfterlifeBets")] [assembly: AssemblyTitle("LycansMod.AfterlifeBets")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] internal sealed class IsReadOnlyAttribute : Attribute { } [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 LycansMods.Shared { public static class AbilityHud { public enum Placement { BelowAction, StaminaRight, ScreenCenter } private sealed class Watcher : MonoBehaviour { private void LateUpdate() { if ((Object)(object)_root != (Object)null && ((Component)_root).gameObject.activeSelf && Time.unscaledTime - _shownAt > 0.25f) { ((Component)_root).gameObject.SetActive(false); } } } private static RectTransform _root; private static Image _ring; private static TextMeshProUGUI _icon; private static TextMeshProUGUI _title; private static TextMeshProUGUI _detail; private static TextMeshProUGUI _badge; private static GameObject _badgeGo; private static float _shownAt; private static Sprite _circle; public static void Show(string icon, string title, string detail, Color color, float fill, string badge = null, Placement placement = Placement.StaminaRight) { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) if (Build()) { _shownAt = Time.unscaledTime; ((Component)_root).gameObject.SetActive(true); ((Transform)_root).SetAsLastSibling(); Place(placement); bool flag = !string.IsNullOrEmpty(icon) && ((Object)(object)((TMP_Text)_icon).font == (Object)null || ((TMP_Text)_icon).font.HasCharacter(icon[0], true, false)); ((TMP_Text)_icon).text = (flag ? icon : (string.IsNullOrEmpty(title) ? "?" : title.Substring(0, 1).ToUpperInvariant())); ((TMP_Text)_title).text = title; ((Graphic)_title).color = color; ((TMP_Text)_detail).text = detail; ((Graphic)_ring).color = new Color(color.r, color.g, color.b, (fill >= 0.999f) ? 1f : 0.85f); _ring.fillAmount = Mathf.Clamp01(fill); ((Graphic)_icon).color = (Color)((fill >= 0.999f) ? Color.white : new Color(1f, 1f, 1f, 0.55f)); _badgeGo.SetActive(!string.IsNullOrEmpty(badge)); if (_badgeGo.activeSelf) { ((TMP_Text)_badge).text = badge; } } } private static bool Build() { //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_02cc: Unknown result type (might be due to invalid IL or missing references) //IL_0317: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0375: Unknown result type (might be due to invalid IL or missing references) //IL_03b4: Unknown result type (might be due to invalid IL or missing references) //IL_03e3: Unknown result type (might be due to invalid IL or missing references) //IL_03ea: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Unknown result type (might be due to invalid IL or missing references) //IL_0423: Unknown result type (might be due to invalid IL or missing references) //IL_0441: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_root != (Object)null) { return true; } GameUI val = (((Object)(object)GameManager.Instance != (Object)null) ? GameManager.Instance.gameUI : null); RectTransform val2 = ActionAnchor(val) ?? Anchor(val); Canvas val3 = (((Object)(object)val2 != (Object)null) ? ((Component)val2).GetComponentInParent() : null); RectTransform val4 = (((Object)(object)val3 != (Object)null && (Object)(object)val3.rootCanvas != (Object)null) ? ((Component)val3.rootCanvas).GetComponent() : null); if ((Object)(object)val2 == (Object)null || (Object)(object)val4 == (Object)null) { return false; } TMP_FontAsset font = (((Object)(object)val.actionShortcut != (Object)null && (Object)(object)((Component)val.actionShortcut).GetComponent() != (Object)null) ? ((TMP_Text)((Component)val.actionShortcut).GetComponent()).font : null); _root = new GameObject("LycansAbilityHud", new Type[1] { typeof(RectTransform) }).GetComponent(); ((Transform)_root).SetParent((Transform)(object)val4, false); ((Component)_root).gameObject.AddComponent(); _root.sizeDelta = new Vector2(330f, 64f); RectTransform root = _root; RectTransform root2 = _root; Vector2 val5 = default(Vector2); ((Vector2)(ref val5))..ctor(0.5f, 0.5f); root2.anchorMax = val5; root.anchorMin = val5; _root.pivot = new Vector2(0f, 0.5f); Image obj = Circle(_root, "Back", new Color(0f, 0f, 0f, 0.55f), 60f, new Vector2(30f, 0f)); _ring = Circle(((Graphic)obj).rectTransform, "Ring", Color.white, 60f, Vector2.zero); _ring.type = (Type)3; _ring.fillMethod = (FillMethod)4; _ring.fillOrigin = 2; _ring.fillClockwise = true; _icon = Label(((Graphic)Circle(((Graphic)obj).rectTransform, "Core", new Color(0.08f, 0.06f, 0.05f, 0.92f), 48f, Vector2.zero)).rectTransform, font, 24f, (TextAlignmentOptions)514, (FontStyles)1); ((TMP_Text)_icon).rectTransform.sizeDelta = new Vector2(48f, 48f); Image obj2 = Circle(((Graphic)obj).rectTransform, "Badge", new Color(0.12f, 0.09f, 0.07f, 0.95f), 24f, new Vector2(22f, 22f)); _badgeGo = ((Component)obj2).gameObject; _badge = Label(((Graphic)obj2).rectTransform, font, 13f, (TextAlignmentOptions)514, (FontStyles)1); ((TMP_Text)_badge).rectTransform.sizeDelta = new Vector2(24f, 24f); _title = Label(_root, font, 18f, (TextAlignmentOptions)1025, (FontStyles)1); RectTransform rectTransform = ((TMP_Text)_title).rectTransform; RectTransform rectTransform2 = ((TMP_Text)_title).rectTransform; ((Vector2)(ref val5))..ctor(0f, 0.5f); rectTransform2.anchorMax = val5; rectTransform.anchorMin = val5; ((TMP_Text)_title).rectTransform.pivot = new Vector2(0f, 0f); ((TMP_Text)_title).rectTransform.anchoredPosition = new Vector2(70f, 2f); ((TMP_Text)_title).rectTransform.sizeDelta = new Vector2(260f, 24f); _detail = Label(_root, font, 15f, (TextAlignmentOptions)257, (FontStyles)0); ((Graphic)_detail).color = new Color(1f, 1f, 1f, 0.88f); RectTransform rectTransform3 = ((TMP_Text)_detail).rectTransform; RectTransform rectTransform4 = ((TMP_Text)_detail).rectTransform; ((Vector2)(ref val5))..ctor(0f, 0.5f); rectTransform4.anchorMax = val5; rectTransform3.anchorMin = val5; ((TMP_Text)_detail).rectTransform.pivot = new Vector2(0f, 1f); ((TMP_Text)_detail).rectTransform.anchoredPosition = new Vector2(70f, -2f); ((TMP_Text)_detail).rectTransform.sizeDelta = new Vector2(260f, 24f); ((Component)_root).gameObject.SetActive(false); return true; } private static RectTransform ActionAnchor(GameUI ui) { if (!((Object)(object)ui != (Object)null) || !((Object)(object)ui.actionShortcut != (Object)null)) { return null; } return ((Component)ui.actionShortcut).GetComponent(); } private static RectTransform Anchor(GameUI ui) { if ((Object)(object)ui == (Object)null) { return null; } if ((Object)(object)ui.hungerProgressMask != (Object)null) { return ((Graphic)ui.hungerProgressMask).rectTransform; } if (!((Object)(object)ui.actionShortcut != (Object)null)) { return null; } return ((Component)ui.actionShortcut).GetComponent(); } private static void Place(Placement placement) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) RectTransform val = Anchor(((Object)(object)GameManager.Instance != (Object)null) ? GameManager.Instance.gameUI : null); RectTransform val2 = ((placement == Placement.StaminaRight) ? val : null); Transform parent = ((Transform)_root).parent; RectTransform val3 = (RectTransform)(object)((parent is RectTransform) ? parent : null); if (!((Object)(object)val3 == (Object)null)) { Canvas componentInParent = ((Component)val3).GetComponentInParent(); Camera val4 = (((Object)(object)componentInParent != (Object)null && (int)componentInParent.renderMode != 0) ? componentInParent.worldCamera : null); float num = (((Object)(object)componentInParent != (Object)null) ? componentInParent.scaleFactor : 1f); Vector2 val5 = default(Vector2); Vector2 pivot = default(Vector2); if (placement == Placement.BelowAction) { ((Vector2)(ref val5))..ctor((float)Screen.width * 0.5f, (float)Screen.height * 0.43f); ((Vector2)(ref pivot))..ctor(0.5f, 0.5f); } else if (placement == Placement.ScreenCenter || (Object)(object)val2 == (Object)null) { ((Vector2)(ref val5))..ctor((float)Screen.width / 2f, (float)Screen.height * 0.58f); ((Vector2)(ref pivot))..ctor(0.5f, 0.5f); } else { Vector3[] array = (Vector3[])(object)new Vector3[4]; val2.GetWorldCorners(array); val5 = RectTransformUtility.WorldToScreenPoint(val4, new Vector3(array[2].x, (array[0].y + array[2].y) / 2f, array[0].z)) + new Vector2(16f * num, 0f); ((Vector2)(ref pivot))..ctor(0f, 0.5f); } Vector2 val6 = default(Vector2); if (RectTransformUtility.ScreenPointToLocalPointInRectangle(val3, val5, val4, ref val6)) { _root.pivot = pivot; ((Transform)_root).localPosition = new Vector3(val6.x, val6.y, 0f); } } } private static Image Circle(RectTransform parent, string name, Color color, float size, Vector2 position) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) RectTransform component = new GameObject(name, new Type[1] { typeof(RectTransform) }).GetComponent(); ((Transform)component).SetParent((Transform)(object)parent, false); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(((Object)(object)parent == (Object)(object)_root) ? 0f : 0.5f, 0.5f); component.anchorMax = val; component.anchorMin = val; component.sizeDelta = new Vector2(size, size); component.anchoredPosition = position; Image obj = ((Component)component).gameObject.AddComponent(); obj.sprite = CircleSprite(); ((Graphic)obj).color = color; ((Graphic)obj).raycastTarget = false; return obj; } private static TextMeshProUGUI Label(RectTransform parent, TMP_FontAsset font, float size, TextAlignmentOptions align, FontStyles style) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) RectTransform component = new GameObject("Text", new Type[1] { typeof(RectTransform) }).GetComponent(); ((Transform)component).SetParent((Transform)(object)parent, false); TextMeshProUGUI val = ((Component)component).gameObject.AddComponent(); if ((Object)(object)font != (Object)null) { ((TMP_Text)val).font = font; } ((TMP_Text)val).fontSize = size; ((TMP_Text)val).alignment = align; ((TMP_Text)val).fontStyle = style; ((TMP_Text)val).enableWordWrapping = false; ((Graphic)val).raycastTarget = false; ((Graphic)val).color = Color.white; return val; } private static Sprite CircleSprite() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_circle != (Object)null) { return _circle; } Texture2D val = new Texture2D(128, 128, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; Color32[] array = (Color32[])(object)new Color32[16384]; float num = 63f; for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { float num2 = Mathf.Sqrt(((float)j + 0.5f - 64f) * ((float)j + 0.5f - 64f) + ((float)i + 0.5f - 64f) * ((float)i + 0.5f - 64f)); array[i * 128 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(Mathf.Clamp01(num - num2 + 0.5f) * 255f)); } } val.SetPixels32(array); val.Apply(); _circle = Sprite.Create(val, new Rect(0f, 0f, 128f, 128f), new Vector2(0.5f, 0.5f), 100f); return _circle; } } public static class Achievements { private const string ApplyKey = "lycans.achievements.apply"; private const string PendingKey = "lycans.achievements.pending"; public const string ReportAction = "achievements.report"; private const string SoloKey = "lycans.victory.solo"; public static int[] SoloWinners => AppDomain.CurrentDomain.GetData("lycans.victory.solo") as int[]; public static void Increment(string key, long n = 1L) { Apply("inc", key, null, n); } public static void SetMax(string key, long value) { Apply("max", key, null, value); } public static void AddToSet(string key, string value) { Apply("set", key, value, 1L); } public static void AddProgress(string achievementId, long n = 1L) { Apply("progress", achievementId, null, n); } public static void Unlock(string achievementId) { Apply("unlock", achievementId, null, 1L); } public static void ReportTo(PlayerController player, string op, string key, long n = 1L) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)player == (Object)null) && !string.IsNullOrEmpty(key)) { if ((Object)(object)player == (Object)(object)PlayerController.Local) { Apply(op, key, null, n); } else if (AppDomain.CurrentDomain.GetData("lycans.achievements.apply") != null) { ActionRequests.Broadcast("achievements.report", player, ModProposals.Hash(op + "|" + key), new Vector3((float)n, 0f, 0f)); } } } private static void Apply(string op, string key, string value, long n) { if (string.IsNullOrEmpty(key)) { return; } if (AppDomain.CurrentDomain.GetData("lycans.achievements.apply") is Action action) { action(op, key, value, n); return; } ArrayList arrayList = AppDomain.CurrentDomain.GetData("lycans.achievements.pending") as ArrayList; if (arrayList == null) { arrayList = new ArrayList(); AppDomain.CurrentDomain.SetData("lycans.achievements.pending", arrayList); } if (arrayList.Count < 2000) { arrayList.Add(new object[4] { op, key, value, n }); } } public static void SetSoloWinners(int[] playerIndices) { AppDomain.CurrentDomain.SetData("lycans.victory.solo", playerIndices); } public static void Publish(Action apply) { AppDomain.CurrentDomain.SetData("lycans.achievements.apply", apply); if (AppDomain.CurrentDomain.GetData("lycans.achievements.pending") is ArrayList arrayList) { object[] array = arrayList.ToArray(); for (int i = 0; i < array.Length; i++) { object[] array2 = (object[])array[i]; apply((string)array2[0], (string)array2[1], (string)array2[2], (long)array2[3]); } arrayList.Clear(); } } } public static class ActionRequests { private const string HandlersKey = "lycans.mods.actions.handlers"; private const string SendKey = "lycans.mods.actions.send"; public static void Register(string action, Action handler) { Handlers()[ModProposals.Hash(action)] = handler; } public static bool Request(string action, PlayerController actor, int value, Vector3 position = default(Vector3)) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) return Send(broadcast: false, action, actor, value, position); } public static bool Broadcast(string action, PlayerController actor, int value, Vector3 position = default(Vector3)) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) return Send(broadcast: true, action, actor, value, position); } public static bool ShouldSendFrom(PlayerController actor) { if ((Object)(object)actor != (Object)null && ((SimulationBehaviour)actor).HasInputAuthority && (Object)(object)((SimulationBehaviour)actor).Runner != (Object)null) { return ((SimulationBehaviour)actor).Runner.IsForward; } return false; } public static void PublishSender(Action send) { AppDomain.CurrentDomain.SetData("lycans.mods.actions.send", send); } public static void Dispatch(int hash, int actorIndex, int value, Vector3 position) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (!Handlers().TryGetValue(hash, out var value2)) { Log.Warning("[ActionRequests] Action inconnue (" + hash + ") : mod absent chez ce joueur ?"); return; } PlayerController actor = null; PlayerRegistry.ForEach((Action)delegate(PlayerController p) { if ((Object)(object)actor == (Object)null && (Object)(object)p != (Object)null && p.Index == actorIndex) { actor = p; } }); try { value2(actor, value, position); } catch (Exception ex) { Log.Error("[ActionRequests] Action en erreur : " + ex); } } private static bool Send(bool broadcast, string action, PlayerController actor, int value, Vector3 position) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) if (!(AppDomain.CurrentDomain.GetData("lycans.mods.actions.send") is Action action2)) { Log.Warning("[ActionRequests] « " + action + " » ignorée : mod_core absent."); return false; } action2(broadcast, ModProposals.Hash(action), ((Object)(object)actor != (Object)null) ? actor.Index : (-1), value, position); return true; } private static Dictionary> Handlers() { if (AppDomain.CurrentDomain.GetData("lycans.mods.actions.handlers") is Dictionary> result) { return result; } Dictionary> dictionary = new Dictionary>(); AppDomain.CurrentDomain.SetData("lycans.mods.actions.handlers", dictionary); return dictionary; } } public static class AdminCommands { private const string Key = "lycans.mods.admin.commands"; public static void Register(string category, string label, Action run, Func available = null) { List list = All(); lock (list) { list.Add(new object[4] { category, label, run, available }); } } public static List All() { if (AppDomain.CurrentDomain.GetData("lycans.mods.admin.commands") is List result) { return result; } List list = new List(); AppDomain.CurrentDomain.SetData("lycans.mods.admin.commands", list); return list; } } public static class AfterlifeHooks { private const string PagesKey = "lycans.afterlife.pages"; private const string SectionsKey = "lycans.afterlife.sections"; private const string PointsKey = "lycans.afterlife.points"; private const string SpendKey = "lycans.afterlife.spend"; private const string AwardKey = "lycans.afterlife.award"; private const string SelectedKey = "lycans.afterlife.selected"; public static PlayerController Selected { get { if (!(AppDomain.CurrentDomain.GetData("lycans.afterlife.selected") is Func func)) { return null; } return func(); } } public static void AddPage(string id, string fr, string en, Action build, Action refresh = null) { Pages().Add(new Hashtable { ["id"] = id, ["fr"] = fr, ["en"] = en, ["build"] = build, ["refresh"] = refresh }); } public static void AddSection(string id, string fr, string en, Action build, Action refresh = null, int order = 100) { Sections().Add(new Hashtable { ["id"] = id, ["fr"] = fr, ["en"] = en, ["build"] = build, ["refresh"] = refresh, ["order"] = order }); } public static ArrayList Sections() { return List("lycans.afterlife.sections"); } public static ArrayList Pages() { return List("lycans.afterlife.pages"); } private static ArrayList List(string key) { ArrayList arrayList = AppDomain.CurrentDomain.GetData(key) as ArrayList; if (arrayList == null) { arrayList = new ArrayList(); AppDomain.CurrentDomain.SetData(key, arrayList); } return arrayList; } public static int Points(PlayerController player) { if (!((Object)(object)player != (Object)null) || !(AppDomain.CurrentDomain.GetData("lycans.afterlife.points") is Func func)) { return 0; } return func(player); } public static bool TrySpend(PlayerController player, int cost) { if ((Object)(object)player != (Object)null && AppDomain.CurrentDomain.GetData("lycans.afterlife.spend") is Func func) { return func(player, cost); } return false; } public static void Award(PlayerController player, int points) { if ((Object)(object)player != (Object)null && AppDomain.CurrentDomain.GetData("lycans.afterlife.award") is Action action) { action(player, points); } } public static void Publish(Func points, Func spend, Action award, Func selected) { AppDomain.CurrentDomain.SetData("lycans.afterlife.points", points); AppDomain.CurrentDomain.SetData("lycans.afterlife.spend", spend); AppDomain.CurrentDomain.SetData("lycans.afterlife.award", award); AppDomain.CurrentDomain.SetData("lycans.afterlife.selected", selected); } } public static class AppearanceHooks { private const string CurrentKey = "lycans.appearance.skin.current"; private const string ChooseKey = "lycans.appearance.skin.choose"; private const string ColorKey = "lycans.appearance.color.request"; private const string PreviewKey = "lycans.appearance.preview.wolf"; public static bool SkinsAvailable => AppDomain.CurrentDomain.GetData("lycans.appearance.skin.choose") is Action; public static bool ColorsAvailable => AppDomain.CurrentDomain.GetData("lycans.appearance.color.request") is Action; public static bool PreviewWolf { get { if (AppDomain.CurrentDomain.GetData("lycans.appearance.preview.wolf") is bool[] array) { return array[0]; } return false; } set { bool[] array = AppDomain.CurrentDomain.GetData("lycans.appearance.preview.wolf") as bool[]; if (array == null) { AppDomain.CurrentDomain.SetData("lycans.appearance.preview.wolf", array = new bool[1]); } array[0] = value; } } public static string CurrentSkin(bool werewolf) { if (!(AppDomain.CurrentDomain.GetData("lycans.appearance.skin.current") is Func func)) { return null; } return func(werewolf); } public static void ChooseSkin(bool werewolf, string key) { if (AppDomain.CurrentDomain.GetData("lycans.appearance.skin.choose") is Action action) { action(werewolf, key); } } public static void RequestColor(int color) { if (AppDomain.CurrentDomain.GetData("lycans.appearance.color.request") is Action action) { action(color); } } public static void PublishSkins(Func current, Action choose) { AppDomain.CurrentDomain.SetData("lycans.appearance.skin.current", current); AppDomain.CurrentDomain.SetData("lycans.appearance.skin.choose", choose); } public static void PublishColorRequest(Action request) { AppDomain.CurrentDomain.SetData("lycans.appearance.color.request", request); } } public static class AudioBank { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_Spawned <>9__3_0; internal void b__3_0(orig_Spawned orig, GameManager self) { orig.Invoke(self); if (_loaded) { return; } _loaded = true; string[] manifestResourceNames = _assembly.GetManifestResourceNames(); foreach (string text in manifestResourceNames) { if (text.StartsWith("LycansAudio.", StringComparison.Ordinal)) { ((MonoBehaviour)self).StartCoroutine(Load(text)); } } } } public const string ResourcePrefix = "LycansAudio."; private static Assembly _assembly; private static bool _loaded; public static string TempDir => Path.Combine(Path.GetTempPath(), "LycansModsAudio", Process.GetCurrentProcess().Id.ToString()); public static void LoadEmbedded(Assembly assembly) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown if (_assembly != null) { return; } _assembly = assembly; object obj = <>c.<>9__3_0; if (obj == null) { hook_Spawned val = delegate(orig_Spawned orig, GameManager self) { orig.Invoke(self); if (!_loaded) { _loaded = true; string[] manifestResourceNames = _assembly.GetManifestResourceNames(); foreach (string text in manifestResourceNames) { if (text.StartsWith("LycansAudio.", StringComparison.Ordinal)) { ((MonoBehaviour)self).StartCoroutine(Load(text)); } } } }; <>c.<>9__3_0 = val; obj = (object)val; } GameManager.Spawned += (hook_Spawned)obj; } private static IEnumerator Load(string resource) { string fileName = resource.Substring("LycansAudio.".Length); string text; try { string tempDir = TempDir; Directory.CreateDirectory(tempDir); text = Path.Combine(tempDir, fileName); using Stream stream = _assembly.GetManifestResourceStream(resource); using FileStream destination = File.Create(text); stream.CopyTo(destination); } catch (Exception ex) { Log.Error("[AudioBank] Extraction impossible de " + fileName + " : " + ex.Message); yield break; } string name = Path.GetFileNameWithoutExtension(fileName); bool split = name.EndsWith("__split", StringComparison.OrdinalIgnoreCase); UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip("file://" + text.Replace("\\", "/"), TypeOf(text)); try { if (split) { DownloadHandler downloadHandler = request.downloadHandler; DownloadHandlerAudioClip val = (DownloadHandlerAudioClip)(object)((downloadHandler is DownloadHandlerAudioClip) ? downloadHandler : null); if (val != null) { val.streamAudio = false; } } yield return request.SendWebRequest(); if ((int)request.result != 1) { Log.Error("[AudioBank] Lecture impossible de " + fileName + " : " + request.error); yield break; } AudioClip content = DownloadHandlerAudioClip.GetContent(request); AudioManager instance = AudioManager.Instance; if ((Object)(object)content == (Object)null || instance?.soundBank?.dictionary == null) { Log.Error("[AudioBank] " + fileName + " : son ou banque de sons du jeu indisponible."); yield break; } if (split) { AddSplit(instance, content, name.Substring(0, name.Length - "__split".Length).ToUpperInvariant()); yield break; } string text2 = (((Object)content).name = name.ToUpperInvariant()); instance.soundBank.dictionary[text2] = content; Log.Info("[AudioBank] Son « " + text2 + " » ajouté."); } finally { ((IDisposable)request)?.Dispose(); } } private static void AddSplit(AudioManager audio, AudioClip clip, string baseKey) { int num = Math.Max(1, clip.channels); float[] array = new float[clip.samples * num]; clip.GetData(array, 0); List list = DetectSegments(array, num, clip.frequency); if (list.Count == 0) { ((Object)clip).name = baseKey; audio.soundBank.dictionary[baseKey] = clip; Log.Warning("[AudioBank] « " + baseKey + " » : aucun segment, son entier ajouté."); return; } for (int i = 0; i < list.Count; i++) { int num2 = list[i][0]; int num3 = list[i][1] - list[i][0]; float[] array2 = new float[num3 * num]; Array.Copy(array, num2 * num, array2, 0, num3 * num); string text = baseKey + "_" + (i + 1); AudioClip val = AudioClip.Create(text, num3, num, clip.frequency, false); val.SetData(array2, 0); audio.soundBank.dictionary[text] = val; } Log.Info("[AudioBank] « " + baseKey + " » découpé en " + list.Count + " son(s)."); } private static List DetectSegments(float[] data, int channels, int frequency) { int num = data.Length / channels; float num2 = 0f; foreach (float num3 in data) { num2 = Mathf.Max(num2, Mathf.Abs(num3)); } float num4 = Mathf.Max(0.02f, num2 * 0.08f); int num5 = Mathf.Max(1, (int)((float)frequency * 0.12f)); int minSegment = Mathf.Max(1, (int)((float)frequency * 0.05f)); int pad = (int)((float)frequency * 0.02f); List list = new List(); bool flag = false; int start = 0; int num6 = 0; for (int j = 0; j < num; j++) { float num7 = 0f; for (int k = 0; k < channels; k++) { num7 = Mathf.Max(num7, Mathf.Abs(data[j * channels + k])); } if (num7 >= num4) { if (!flag) { flag = true; start = j; } num6 = 0; } else if (flag && ++num6 >= num5) { AddSegment(list, start, j - num6 + 1, num, minSegment, pad); flag = false; } } if (flag) { AddSegment(list, start, num, num, minSegment, pad); } return list; } private static void AddSegment(List segments, int start, int end, int frames, int minSegment, int pad) { start = Math.Max(0, start - pad); end = Math.Min(frames, end + pad); if (end - start >= minSegment) { segments.Add(new int[2] { start, end }); } } private static AudioType TypeOf(string path) { return (AudioType)(Path.GetExtension(path).ToLowerInvariant() switch { ".mp3" => 13, ".ogg" => 14, ".wav" => 20, _ => 0, }); } } public static class BookUi { public static readonly Color Night = Hex(724491, 0.86f); public static readonly Color LeatherDark = Hex(2496015); public static readonly Color Leather = Hex(4926747); public static readonly Color Page = Hex(13810829); public static readonly Color PageRight = Hex(13284228); public static readonly Color PaperLight = Hex(14468502); public static readonly Color PaperDark = Hex(10190417); public static readonly Color Ink = Hex(2759442); public static readonly Color InkSoft = Hex(6573624); public static readonly Color Red = Hex(7614764); public static readonly Color Gold = Hex(10318136); public static readonly Color Row = Hex(5913634, 0.1f); private static TMP_FontAsset _font; private static Sprite _rounded; public static TMP_FontAsset Font { get { if ((Object)(object)_font != (Object)null) { return _font; } TextMeshProUGUI val = Object.FindObjectOfType(); _font = (((Object)(object)val != (Object)null) ? ((TMP_Text)val).font : TMP_Settings.defaultFontAsset); if ((Object)(object)_font == (Object)null) { TMP_FontAsset[] array = Resources.FindObjectsOfTypeAll(); for (int i = 0; i < array.Length && !((Object)(object)(_font = array[i]) != (Object)null); i++) { } } return _font; } } private static Color Hex(int rgb, float a = 1f) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) return new Color((float)((rgb >> 16) & 0xFF) / 255f, (float)((rgb >> 8) & 0xFF) / 255f, (float)(rgb & 0xFF) / 255f, a); } public static Canvas Overlay(string name, int order = 5100) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); Object.DontDestroyOnLoad((Object)val); Canvas val2 = val.AddComponent(); val2.renderMode = (RenderMode)0; val2.sortingOrder = order; CanvasScaler obj = val.AddComponent(); obj.uiScaleMode = (ScaleMode)1; obj.referenceResolution = new Vector2(1920f, 1080f); obj.matchWidthOrHeight = 0.5f; val.AddComponent(); if ((Object)(object)EventSystem.current == (Object)null && (Object)(object)Object.FindObjectOfType() == (Object)null) { GameObject val3 = new GameObject("LycansEventSystem"); Object.DontDestroyOnLoad((Object)val3); val3.AddComponent(); val3.AddComponent(); } val.SetActive(false); return val2; } public static RectTransform Rect(Transform parent, string name) { //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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown GameObject val = new GameObject(name, new Type[1] { typeof(RectTransform) }); val.transform.SetParent(parent, false); return (RectTransform)val.transform; } public static RectTransform FillParent(this RectTransform rt, float left = 0f, float right = 0f, float top = 0f, float bottom = 0f) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) rt.anchorMin = Vector2.zero; rt.anchorMax = Vector2.one; rt.offsetMin = new Vector2(left, bottom); rt.offsetMax = new Vector2(0f - right, 0f - top); return rt; } public static RectTransform Centered(this RectTransform rt, float width, float height) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 0.5f); rt.pivot = val; Vector2 anchorMin = (rt.anchorMax = val); rt.anchorMin = anchorMin; rt.sizeDelta = new Vector2(width, height); rt.anchoredPosition = Vector2.zero; return rt; } public static Image Panel(Transform parent, string name, Color color, float radius = 0f, bool raycast = false) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) Image val = ((Component)Rect(parent, name)).gameObject.AddComponent(); ((Graphic)val).color = color; ((Graphic)val).raycastTarget = raycast; if (radius > 0f) { Round(val, radius); } return val; } public static TextMeshProUGUI Text(Transform parent, string text, float size, Color color, FontStyles style = (FontStyles)0, TextAlignmentOptions align = (TextAlignmentOptions)257) { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = ((Component)Rect(parent, "Text")).gameObject.AddComponent(); if ((Object)(object)Font != (Object)null) { ((TMP_Text)val).font = Font; } ((TMP_Text)val).text = text; ((TMP_Text)val).fontSize = size; ((Graphic)val).color = color; ((TMP_Text)val).fontStyle = style; ((TMP_Text)val).alignment = align; ((TMP_Text)val).enableWordWrapping = true; ((Graphic)val).raycastTarget = false; return val; } public static LayoutElement Size(this Component c, float height = -1f, float width = -1f, float flexibleWidth = -1f) { LayoutElement val = c.gameObject.GetComponent() ?? c.gameObject.AddComponent(); if (height >= 0f) { float preferredHeight = (val.minHeight = height); val.preferredHeight = preferredHeight; } if (width >= 0f) { float preferredHeight = (val.minWidth = width); val.preferredWidth = preferredHeight; } if (flexibleWidth >= 0f) { val.flexibleWidth = flexibleWidth; } return val; } public static VerticalLayoutGroup Vertical(GameObject go, float spacing, RectOffset padding = null) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) VerticalLayoutGroup obj = go.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj).spacing = spacing; ((LayoutGroup)obj).padding = (RectOffset)(((object)padding) ?? ((object)new RectOffset())); bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true); ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = childControlWidth; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = true; ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false; return obj; } public static HorizontalLayoutGroup Horizontal(GameObject go, float spacing, TextAnchor align = (TextAnchor)4) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) HorizontalLayoutGroup obj = go.AddComponent(); ((HorizontalOrVerticalLayoutGroup)obj).spacing = spacing; ((LayoutGroup)obj).childAlignment = align; bool childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj).childControlHeight = true); ((HorizontalOrVerticalLayoutGroup)obj).childControlWidth = childControlWidth; childControlWidth = (((HorizontalOrVerticalLayoutGroup)obj).childForceExpandHeight = false); ((HorizontalOrVerticalLayoutGroup)obj).childForceExpandWidth = childControlWidth; return obj; } public static Button Button(Transform parent, string label, Color background, Color textColor, float size, UnityAction onClick, float radius = 12f) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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_00c3: Unknown result type (might be due to invalid IL or missing references) Image val = Panel(parent, "Button", background, radius, raycast: true); Button val2 = ((Component)val).gameObject.AddComponent