Decompiled source of FriendsCardBar v1.1.8
FriendsCardBar.dll
Decompiled 3 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using FriendsCardBar.Game; using FriendsCardBar.Logic; using HarmonyLib; using InControl; using Microsoft.CodeAnalysis; using ModdingUtils.Utils; using Photon.Pun; using Photon.Realtime; using RarityLib.Utils; using TMPro; using UnboundLib; using UnboundLib.Extensions; using UnboundLib.GameModes; using UnboundLib.Utils; using UnboundLib.Utils.UI; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("FriendsCardBar")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.7.0")] [assembly: AssemblyInformationalVersion("1.1.7+ddf9180d6a77d25cf198abec79e83d7c2e8ae5b7")] [assembly: AssemblyProduct("FriendsCardBar")] [assembly: AssemblyTitle("FriendsCardBar")] [assembly: AssemblyVersion("1.1.7.0")] [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 FriendsCardBar { [BepInPlugin("dannythealien.rounds.friendscardbar", "Friends Card Bar", "1.1.8")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static UnityAction <>9__18_0; public static UnityAction<bool> <>9__21_0; public static UnityAction<bool> <>9__21_1; public static UnityAction<float> <>9__21_2; internal void <Awake>b__18_0() { } internal void <BuildMenu>b__21_0(bool v) { Set(barEnabled, v); } internal void <BuildMenu>b__21_1(bool v) { Set(feedEnabled, v); } internal void <BuildMenu>b__21_2(float v) { Set(size, v); } } public const string Guid = "dannythealien.rounds.friendscardbar"; public const string Version = "1.1.8"; internal static Plugin Instance; internal static ManualLogSource Log; internal static Harmony Harmony; private static ConfigEntry<bool> barEnabled; private static ConfigEntry<bool> feedEnabled; private static ConfigEntry<float> size; private float nextSecond; internal static bool BarEnabled => barEnabled.Value; internal static bool FeedEnabled => feedEnabled.Value; internal static float Size => Mathf.Clamp(size.Value, 0.75f, 1.5f); internal static event Action SettingsChanged; private void Awake() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown Instance = this; Log = ((BaseUnityPlugin)this).Logger; Harmony = new Harmony("dannythealien.rounds.friendscardbar"); barEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Friends Card Bar", "Card bar", true, "Show the new card bar (off brings back the old one)."); feedEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Friends Card Bar", "Kill feed", true, "Show the kill feed."); size = ((BaseUnityPlugin)this).Config.Bind<float>("Friends Card Bar", "Size", 1f, "Overall size, 0.75 to 1.5."); object obj = <>c.<>9__18_0; if (obj == null) { UnityAction val = delegate { }; <>c.<>9__18_0 = val; obj = (object)val; } Unbound.RegisterMenu("Friends Card Bar", (UnityAction)obj, (Action<GameObject>)BuildMenu, (GameObject)null, false); Log.LogInfo((object)"Friends Card Bar 1.1.8 loaded"); } private void Start() { BarView.Create(); FeedView.Create(BarView.Instance); try { DeathWatcher.Install(); } catch (Exception ex) { Log.LogWarning((object)("kill feed hooks failed, feed off: " + ex)); } try { StatTracker.Install(); } catch (Exception ex2) { Log.LogWarning((object)("stat measuring hooks failed, stats off: " + ex2)); } } private void Update() { DevCommands.Poll(); if (!(Time.unscaledTime < nextSecond)) { nextSecond = Time.unscaledTime + 1f; OldBarHider.Apply(BarEnabled); } } private static void BuildMenu(GameObject menu) { MenuHandler.CreateToggle(barEnabled.Value, "Card bar", menu, (UnityAction<bool>)delegate(bool v) { Set(barEnabled, v); }, 40, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null); MenuHandler.CreateToggle(feedEnabled.Value, "Kill feed", menu, (UnityAction<bool>)delegate(bool v) { Set(feedEnabled, v); }, 40, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null); Slider val = null; MenuHandler.CreateSlider("Size", menu, 40, 0.75f, 1.5f, size.Value, (UnityAction<float>)delegate(float v) { Set(size, v); }, ref val, false, (Color?)null, (Direction)0, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null); TextMeshProUGUI val2 = default(TextMeshProUGUI); MenuHandler.CreateText("Keys: 1 = your deck, 2-9 = others (again: stats, again: close). 0 = open all / close all (controller Y). Hold ` = your stats (controller: right stick click).", menu, ref val2, 24, true, (Color?)null, (TMP_FontAsset)null, (Material)null, (TextAlignmentOptions?)null); } internal static void Set<T>(ConfigEntry<T> entry, T value) { entry.Value = value; OldBarHider.Apply(BarEnabled); Plugin.SettingsChanged?.Invoke(); } internal static void SetBar(bool on) { Set(barEnabled, on); } internal static void SetFeed(bool on) { Set(feedEnabled, on); } } } namespace FriendsCardBar.Logic { public sealed class CardEffect { public int Id; public int PlayerId; public string Card; public int Occurrence; public List<StatChange> Changes = new List<StatChange>(); public List<string> Effects = new List<string>(); } public sealed class CardLedger { public const string Hidden = "(hidden card)"; private readonly List<CardEffect> records = new List<CardEffect>(); private readonly Dictionary<int, Dictionary<string, double>> start = new Dictionary<int, Dictionary<string, double>>(); private readonly Dictionary<int, int> last = new Dictionary<int, int>(); private int nextId = 1; public void Reset() { records.Clear(); start.Clear(); last.Clear(); } public void SeeStart(int playerId, StatSnapshot first) { if (!start.ContainsKey(playerId)) { start[playerId] = new Dictionary<string, double>(first.Values); } } public int Record(int playerId, string card, int occurrence, List<StatChange> changes, List<string> effects) { card = (string.IsNullOrWhiteSpace(card) ? "(hidden card)" : card); CardEffect cardEffect = records.FirstOrDefault((CardEffect x) => x.PlayerId == playerId && x.Card == card && x.Occurrence == occurrence); if (cardEffect == null) { cardEffect = new CardEffect { Id = nextId++, PlayerId = playerId, Card = card, Occurrence = occurrence }; records.Add(cardEffect); } cardEffect.Changes = new List<StatChange>(changes); cardEffect.Effects = new List<string>(effects); last[playerId] = cardEffect.Id; return cardEffect.Id; } public void AddLate(int recordId, List<StatChange> changes) { CardEffect cardEffect = records.FirstOrDefault((CardEffect x) => x.Id == recordId); if (cardEffect == null) { return; } foreach (StatChange c in changes) { StatChange statChange = cardEffect.Changes.FirstOrDefault((StatChange x) => x.Key == c.Key); if (statChange != null) { statChange.After = c.After; continue; } cardEffect.Changes.Add(new StatChange { Key = c.Key, Before = c.Before, After = c.After }); } cardEffect.Changes.RemoveAll((StatChange x) => StatDiff.Same(x.Before, x.After)); } public bool HasStart(int playerId) { return start.ContainsKey(playerId); } public void Prune(int playerId, IReadOnlyList<string> currentCards) { Dictionary<string, int> held = new Dictionary<string, int>(); foreach (string currentCard in currentCards) { string key = (string.IsNullOrWhiteSpace(currentCard) ? "(hidden card)" : currentCard); held[key] = ((!held.TryGetValue(key, out var value)) ? 1 : (value + 1)); } records.RemoveAll((CardEffect r) => r.PlayerId == playerId && (!held.TryGetValue(r.Card, out var value2) || r.Occurrence >= value2)); } public int LastRecordFor(int playerId) { if (!last.TryGetValue(playerId, out var value)) { return -1; } return value; } public IReadOnlyList<CardEffect> EffectsOf(int playerId, string card) { return (from x in records where x.PlayerId == playerId && x.Card == (string.IsNullOrWhiteSpace(card) ? "(hidden card)" : card) orderby x.Occurrence select x).ToList(); } public IReadOnlyList<(string card, int occurrence, StatChange change)> Breakdown(int playerId, string key) { return records.Where((CardEffect x) => x.PlayerId == playerId).SelectMany((CardEffect x) => from c in x.Changes where c.Key == key select (Card: x.Card, Occurrence: x.Occurrence, c: c)).ToList(); } public IEnumerable<string> ChangedKeys(int playerId) { return records.Where((CardEffect x) => x.PlayerId == playerId).SelectMany((CardEffect x) => x.Changes.Select((StatChange c) => c.Key)).Distinct(); } public double StartOf(int playerId, string key) { if (!start.TryGetValue(playerId, out var value) || !value.TryGetValue(key, out var value2)) { return 0.0; } return value2; } public double Other(int playerId, string key, double current) { return current - StartOf(playerId, key) - Breakdown(playerId, key).Sum(((string card, int occurrence, StatChange change) b) => b.change.Delta); } } public static class DeathEdge { public static bool IsNewDeath(bool wasDead, bool wasRespawning, bool isDead, bool isRespawning) { if (!(!wasDead && isDead)) { return !wasDead && !wasRespawning && isRespawning; } return true; } } public static class DeckLayout { public const int RowsPerColumn = 22; public static int Columns(int entries) { return (entries + 22 - 1) / 22; } public static float ScaleToFit(float needed, float available) { if (!(needed <= available) && !(needed <= 0f)) { return available / needed; } return 1f; } public static float InfoLeft(float decksRight, float infoW, float available) { if (!(decksRight + infoW <= available)) { return available; } return decksRight + infoW; } } public static class Keys { public const int AllDigit = 0; public static int? StripForDigit(int digit) { if (digit < 1 || digit > 9) { return null; } return digit - 1; } } public enum DeckMode { Cards, Stats } public sealed class OpenDecks { private readonly List<int> order = new List<int>(); private readonly Dictionary<int, DeckMode> modes = new Dictionary<int, DeckMode>(); public IReadOnlyList<int> Order => order; public DeckMode ModeOf(int playerId) { if (!modes.TryGetValue(playerId, out var value)) { return DeckMode.Cards; } return value; } public void SetMode(int playerId, DeckMode mode) { modes[playerId] = mode; } public static string NextAction(bool open, DeckMode mode) { if (open) { if (mode != DeckMode.Cards) { return "close"; } return "stats"; } return "open"; } public void Cycle(int playerId) { if (!IsOpen(playerId)) { order.Add(playerId); modes[playerId] = DeckMode.Cards; } else if (ModeOf(playerId) == DeckMode.Cards) { modes[playerId] = DeckMode.Stats; } else { order.Remove(playerId); modes.Remove(playerId); } } public void CycleAll(IReadOnlyList<int> playerIds) { if (order.Count > 0) { order.Clear(); modes.Clear(); return; } order.AddRange(playerIds); foreach (int playerId in playerIds) { modes[playerId] = DeckMode.Cards; } } public bool IsOpen(int playerId) { return order.Contains(playerId); } public void Toggle(int playerId) { if (!order.Remove(playerId)) { order.Add(playerId); modes[playerId] = DeckMode.Cards; } else { modes.Remove(playerId); } } public void ToggleAll(IReadOnlyList<int> playerIds) { if (order.Count > 0) { order.Clear(); modes.Clear(); } else { order.AddRange(playerIds); } } public void Retain(IReadOnlyList<int> playerIds) { HashSet<int> keep = new HashSet<int>(playerIds); order.RemoveAll((int id) => !keep.Contains(id)); foreach (int item in modes.Keys.Where((int id) => !keep.Contains(id)).ToList()) { modes.Remove(item); } } } public sealed class DeckEntry { public string Name; public int Count; public int FirstIndex; public bool IsNew; } public sealed class DeckCopy { public string Name; public int Copy; public int Index; public bool IsNew; } public static class DeckModel { public static List<DeckCopy> EachCopy(IReadOnlyList<string> pickOrder, int newest = 2, Func<string, int, bool> picked = null) { List<DeckCopy> list = new List<DeckCopy>(); Dictionary<string, int> dictionary = new Dictionary<string, int>(); foreach (string item in pickOrder) { if (!string.IsNullOrWhiteSpace(item)) { dictionary.TryGetValue(item, out var value); dictionary[item] = value + 1; list.Add(new DeckCopy { Name = item, Copy = value + 1, Index = list.Count }); } } for (int i = list.Count - newest; i < list.Count; i++) { if (i >= 0 && (picked == null || picked(list[i].Name, list[i].Copy - 1))) { list[i].IsNew = true; } } return list; } public static List<DeckEntry> Group(IReadOnlyList<string> pickOrder, int newest = 2) { return Group(pickOrder, newest, null); } public static List<DeckEntry> Group(IReadOnlyList<string> pickOrder, int newest, Func<string, int, bool> picked) { List<string> list = new List<string>(); foreach (string item in pickOrder) { if (!string.IsNullOrWhiteSpace(item)) { list.Add(item); } } List<DeckEntry> list2 = new List<DeckEntry>(); Dictionary<string, DeckEntry> dictionary = new Dictionary<string, DeckEntry>(); Dictionary<string, int> dictionary2 = new Dictionary<string, int>(); for (int i = 0; i < list.Count; i++) { if (!dictionary.TryGetValue(list[i], out var value)) { value = new DeckEntry { Name = list[i], FirstIndex = i }; dictionary[list[i]] = value; list2.Add(value); } value.Count++; dictionary2.TryGetValue(list[i], out var value2); dictionary2[list[i]] = value2 + 1; if (i >= list.Count - newest && (picked == null || picked(list[i], value2))) { value.IsNew = true; } } return list2; } } public static class Derived { public static double Reload(double reloadTime, double add, double multiplier) { return (reloadTime + add) * multiplier; } public static double BlockCooldown(double cooldown, double add, double multiplier) { return (cooldown + add) * multiplier; } public static double ShotsPerSecond(double attackSpeed, double defaultCooldown, bool locked, double multiplier) { return multiplier / Math.Max(0.01, locked ? defaultCooldown : attackSpeed); } } public sealed class FeedQueue { public const float Lifetime = 5f; private const int MaxKept = 5; private readonly List<(string text, float at)> lines = new List<(string, float)>(); public void Add(string text, float now) { lines.Insert(0, (text, now)); if (lines.Count > 5) { lines.RemoveRange(5, lines.Count - 5); } } public IReadOnlyList<(string text, float age)> Visible(float now, int playerCount) { int num = ((playerCount <= 4) ? 3 : 5); List<(string, float)> list = new List<(string, float)>(); foreach (var (item, num2) in lines) { if (list.Count >= num) { break; } float num3 = now - num2; if (num3 <= 5f) { list.Add((item, num3)); } } return list; } } public sealed class PickRounds { private readonly Dictionary<int, List<(string name, int round)>> decks = new Dictionary<int, List<(string, int)>>(); private readonly Dictionary<int, Dictionary<string, Queue<int>>> removed = new Dictionary<int, Dictionary<string, Queue<int>>>(); public void StartGame(IReadOnlyDictionary<int, IReadOnlyList<string>> decksAtStart) { decks.Clear(); removed.Clear(); foreach (KeyValuePair<int, IReadOnlyList<string>> item in decksAtStart) { Update(item.Key, item.Value, 0); } } public void Update(int playerId, IReadOnlyList<string> deck, int round) { Dictionary<string, Queue<int>> dictionary = new Dictionary<string, Queue<int>>(); if (decks.TryGetValue(playerId, out List<(string, int)> value)) { foreach (var (key, item) in value) { if (!dictionary.TryGetValue(key, out var value2)) { value2 = (dictionary[key] = new Queue<int>()); } value2.Enqueue(item); } } if (!removed.TryGetValue(playerId, out var value3)) { value3 = (removed[playerId] = new Dictionary<string, Queue<int>>()); } List<(string, int)> list = new List<(string, int)>(); foreach (string item3 in deck) { if (item3 != null) { int item2 = round; Queue<int> value5; if (dictionary.TryGetValue(item3, out var value4) && value4.Count > 0) { item2 = value4.Dequeue(); } else if (value3.TryGetValue(item3, out value5) && value5.Count > 0) { item2 = value5.Dequeue(); } list.Add((item3, item2)); } } foreach (KeyValuePair<string, Queue<int>> item4 in dictionary) { foreach (int item5 in item4.Value) { if (!value3.TryGetValue(item4.Key, out var value6)) { value6 = (value3[item4.Key] = new Queue<int>()); } value6.Enqueue(item5); } } decks[playerId] = list; } public int RoundOf(int playerId, string card, int occurrence) { if (!decks.TryGetValue(playerId, out List<(string, int)> value)) { return -1; } int num = 0; foreach (var (text, result) in value) { if (text == card && num++ == occurrence) { return result; } } return -1; } } public enum DeathKind { Kill, Self, NoKiller } public static class StableHash { private const uint Offset = 2166136261u; private const uint Prime = 16777619u; public static uint Of(params int[] values) { uint num = 2166136261u; foreach (int num2 in values) { for (int j = 0; j < 4; j++) { num ^= (byte)(num2 >> 8 * j); num *= 16777619; } } return num; } public static uint Of(uint seed, string s) { uint num = seed; string text = s ?? ""; foreach (char c in text) { num ^= (byte)c; num *= 16777619; num ^= (byte)((int)c >> 8); num *= 16777619; } return num; } } public sealed class KillLine { public DeathKind Kind; public int Phrase; public int PhraseId; public string Card; public string Template; public string Format(string victim, string killer) { return Template.Replace("{victim}", victim ?? "?").Replace("{killer}", killer ?? "?").Replace("{card}", Card ?? "?"); } } public static class KillLines { public static readonly string[] KillPhrases = new string[28] { "{killer} sent {victim} to the shadow realm", "{victim} got cooked by {killer}", "{killer} deleted {victim}", "{victim} was no match for {killer}", "{killer} turned {victim} into a fine paste", "{victim} got absolutely diffed by {killer}", "{killer} sent {victim} back to the lobby (spiritually)", "{victim} caught {killer}'s hands", "{killer} put {victim} in the group chat obituary", "{victim} has been uninstalled by {killer}", "{killer} made {victim} touch grass. Permanently.", "{victim} got ratio'd by {killer}", "{killer} gave {victim} a free trip to the respawn screen", "{victim} forgot to block. {killer} did not forget to shoot.", "{killer} served {victim} a fresh plate of bullets", "{victim} was speedrun by {killer}", "{killer} hit {victim} with the skill issue", "{victim} got folded like a lawn chair by {killer}", "{killer} sent {victim} to Ohio", "{victim} learned what {killer}'s gun does", "{killer} unalived {victim} (respectfully)", "{victim} was too slow for {killer}", "{killer} turned {victim}'s health bar into a rumor", "{victim} got clipped by {killer}. Somebody save the replay.", "{killer} rolled {victim} like a 50/50 that only went one way", "{victim} blinked and {killer} was already done", "{killer} posted {victim}'s L in 4K", "{victim} tried their best. {killer} tried harder." }; public static readonly string[] KillCardPhrases = new string[9] { "{killer}'s {card} turned {victim} into confetti", "{victim} found out what {card} does. Thanks, {killer}.", "{killer} picked {card} for exactly this moment, {victim}", "{card} strikes again: {killer} 1, {victim} 0", "{victim} got {card}'d by {killer}", "{killer}'s {card} sends its regards to {victim}", "{victim} should have read {killer}'s {card} card", "{killer} + {card} = {victim} on the floor", "Tonight's {card} victim: {victim}, courtesy of {killer}" }; public static readonly string[] SelfPhrases = new string[11] { "{victim} played themselves", "{victim} tripped over their own bullet", "{victim} found out their gun works on them too", "{victim} took the shortcut to the respawn screen", "{victim} has been eliminated by {victim}. Tragic.", "{victim} wanted to see what their own build feels like", "{victim} friendly-fired the friendliest target: themselves", "{victim} pulled a 200 IQ move. It was not 200 IQ.", "{victim} rage-quit their own health bar", "{victim} self-destructed with style", "{victim} bounced one too many times" }; public static readonly string[] NoKillerPhrases = new string[11] { "{victim} fell off the map. Gravity: 1, {victim}: 0", "{victim} died of mysterious causes", "{victim} was taken out by the map itself", "{victim} walked into the void and the void said hi", "{victim} got bonked by the environment", "{victim} forgot that floors are optional here", "{victim} has left the chat", "{victim} was defeated by nothing in particular", "{victim} took a tour of the out-of-bounds", "{victim} lost a 1v1 against physics", "{victim} got cursed into oblivion" }; public static readonly string[] BouncePhrases = new string[8] { "{victim} got their own bullet sent back with a bow on it by {killer}", "{killer} hit block and {victim} hit the floor", "{victim} was returned to sender by {killer}", "{killer} said \"no thanks\" and {victim}'s bullet agreed", "{victim} got parried by {killer}. Skill issue.", "{killer} blocked, {victim} regretted", "{victim}'s bullet switched teams. {killer} says thanks.", "{killer} reflected on life. {victim} didn't get the chance." }; public static readonly string[] SwordPhrases = new string[7] { "{victim} got skewered by {killer}'s Excalibur. The sword of kings has spoken.", "{killer}'s flying swords made {victim} into a kebab", "{victim} was knighted by {killer}. Permanently.", "{killer} didn't even swing. The swords did it. RIP {victim}.", "{victim} pulled the sword out of the stone. Wrong end. Thanks {killer}.", "{killer}'s Excalibur collected {victim}'s head as a souvenir", "{victim} got shish-kebabbed by {killer}'s floating cutlery" }; private const int KillOffset = 0; private const int KillCardOffset = 1000; private const int SelfOffset = 2000; private const int NoKillerOffset = 3000; private const int BounceOffset = 4000; private const int SwordOffset = 5000; public static KillLine Pick(int victimId, int victimDeaths, int? killerId, IReadOnlyList<string> killerCards, int previousPhraseForVictim, string how = null) { DeathKind deathKind = ((!killerId.HasValue) ? DeathKind.NoKiller : ((killerId == victimId) ? DeathKind.Self : DeathKind.Kill)); uint num = StableHash.Of(victimId, victimDeaths, killerId ?? (-1), (int)deathKind); List<string> list = new List<string>(); if (deathKind == DeathKind.Kill && killerCards != null) { foreach (string killerCard in killerCards) { if (!string.IsNullOrWhiteSpace(killerCard)) { list.Add(killerCard); } } } string card = null; string[] array; int num2; if (deathKind == DeathKind.Kill && how == "bounce") { array = BouncePhrases; num2 = 4000; } else if (deathKind == DeathKind.Kill && how == "sword") { array = SwordPhrases; num2 = 5000; } else if (deathKind == DeathKind.Kill && list.Count > 0 && num % 3 == 0) { array = KillCardPhrases; num2 = 1000; card = list[(int)(StableHash.Of((int)num, 7) % (uint)list.Count)]; } else { switch (deathKind) { case DeathKind.Kill: array = KillPhrases; num2 = 0; break; case DeathKind.Self: array = SelfPhrases; num2 = 2000; break; default: array = NoKillerPhrases; num2 = 3000; break; } } int num3 = (int)(num / 3 % (uint)array.Length); if (num2 + num3 == previousPhraseForVictim) { num3 = (num3 + 1) % array.Length; } return new KillLine { Kind = deathKind, Phrase = num3, PhraseId = num2 + num3, Card = card, Template = array[num3] }; } } public enum StatUnit { Flat, Multiplier, Percent, Seconds, PerSecond } public sealed class StatInfo { public string Key; public string Name; public string Group; public StatUnit Unit; public bool HigherIsBetter = true; public int Order; } public static class StatCatalog { public const string DamageKey = "Gun|Derived|damage"; public const string ShotsKey = "Gun|Derived|shotsPerSecond"; public const string ReloadKey = "Gun|Derived|reload"; public const string BlockCooldownKey = "Block|Derived|cooldown"; public static readonly IReadOnlyList<StatInfo> Known = Build(); private static readonly Dictionary<string, StatInfo> byKey = Known.ToDictionary((StatInfo s) => s.Key); private static List<StatInfo> Build() { List<StatInfo> l = new List<StatInfo>(); Add("Gun|Derived|damage", "Damage"); Add("Gun|Derived|shotsPerSecond", "Shots / sec"); Add("Gun|GunAmmo|maxAmmo", "Ammo"); Add("Gun|Derived|reload", "Reload", StatUnit.Seconds, higherBetter: false); Add("Gun|Gun|numberOfProjectiles", "Bullets / shot"); Add("Gun|Gun|bursts", "Bursts"); Add("Gun|Gun|timeBetweenBullets", "Time between bursts", StatUnit.Seconds, higherBetter: false); Add("Gun|Gun|projectileSpeed", "Bullet speed", StatUnit.Multiplier); Add("Gun|Gun|projectileSize", "Bullet size"); Add("Gun|Gun|reflects", "Bounces"); Add("Gun|Gun|spread", "Spread", StatUnit.Flat, higherBetter: false); Add("Gun|Gun|knockback", "Knockback", StatUnit.Multiplier); Add("Gun|Gun|gravity", "Bullet gravity", StatUnit.Multiplier, higherBetter: false); Add("Gun|Gun|damageAfterDistanceMultiplier", "Damage over distance", StatUnit.Multiplier); Add("Gun|Gun|slow", "Slow on hit"); Add("Gun|Gun|percentageDamage", "Damage of max HP", StatUnit.Percent); Add("Gun|Gun|destroyBulletAfter", "Bullet lifetime", StatUnit.Seconds); Add("Gun|Gun|unblockable", "Unblockable"); Add("Gun|Gun|ignoreWalls", "Through walls"); Add("Gun|GunAmmo|ammoReg", "Ammo regen"); Add("Body|CharacterData|maxHealth", "Health"); Add("Body|HealthHandler|regeneration", "Regen", StatUnit.PerSecond); Add("Body|CharacterStatModifiers|lifeSteal", "Lifesteal", StatUnit.Percent); Add("Body|CharacterStatModifiers|movementSpeed", "Move speed", StatUnit.Multiplier); Add("Body|CharacterStatModifiers|jump", "Jump", StatUnit.Multiplier); Add("Body|CharacterData|jumps", "Jumps"); Add("Body|Gravity|gravityForce", "Gravity", StatUnit.Flat, higherBetter: false); Add("Body|CharacterStatModifiers|sizeMultiplier", "Size", StatUnit.Multiplier, higherBetter: false); Add("Body|CharacterStatModifiers|respawns", "Extra lives"); Add("Body|CharacterStatModifiers|secondsToTakeDamageOver", "Damage taken over", StatUnit.Seconds); Add("Body|CharacterStatModifiers|slow", "Slowed", StatUnit.Flat, higherBetter: false); Add("Body|CharacterStatModifiers|attackSpeedMultiplier", "Body attack speed", StatUnit.Multiplier); Add("Block|Derived|cooldown", "Block cooldown", StatUnit.Seconds, higherBetter: false); Add("Block|Block|additionalBlocks", "Extra blocks"); Add("Block|Block|healing", "Heal on block"); Add("Block|Block|forceToAdd", "Block push"); return l; void Add(string key, string name, StatUnit unit = StatUnit.Flat, bool higherBetter = true) { string text = key.Substring(0, key.IndexOf('|')); l.Add(new StatInfo { Key = key, Name = name, Group = text, Unit = unit, HigherIsBetter = higherBetter, Order = l.Count }); } } public static StatInfo For(string key) { if (key != null && byKey.TryGetValue(key, out var value)) { return value; } return new StatInfo { Key = key, Name = ReadableName(key), Group = "Mod", Unit = StatUnit.Flat, HigherIsBetter = true, Order = 1000 }; } public static string Format(StatInfo s, double v) { return s.Unit switch { StatUnit.Seconds => Num(v) + "s", StatUnit.Multiplier => Num(v) + "x", StatUnit.Percent => Num(v * 100.0) + "%", StatUnit.PerSecond => Num(v) + "/s", _ => Num(v), }; } public static (string text, bool better) Change(StatInfo s, double before, double after) { double num = after - before; string text = ((Math.Abs(before) > 1E-09) ? (Signed(num / Math.Abs(before) * 100.0) + "%") : (Signed((s.Unit == StatUnit.Percent) ? (num * 100.0) : num) + ((s.Unit == StatUnit.Percent) ? "%" : ""))); bool item = (s.HigherIsBetter ? (num > 0.0) : (num < 0.0)); return (text: Format(s, before) + " → " + Format(s, after) + " (" + text + ")", better: item); } public static string ReadableName(string key) { if (string.IsNullOrEmpty(key)) { return "?"; } string[] array = key.Split(new char[1] { '|' }); string text = ((array.Length > 1) ? array[1] : ""); string member = ((array.Length > 2) ? array[2] : array[^1]); string text2 = text.Substring(text.LastIndexOf('.') + 1); if (text2.EndsWith("AdditionalData") && text.Contains(".")) { return text.Substring(0, text.IndexOf('.')) + ": " + Words(LastMember(member)); } text = text2; return Words(text) + ": " + Words(LastMember(member)); } private static string LastMember(string member) { member = Regex.Replace(member, "\\[\\d+\\]", ""); return member.Substring(member.LastIndexOf('.') + 1); } private static string Words(string s) { s = s.Trim(new char[1] { '_' }).Replace('_', ' '); s = Regex.Replace(s, "(?<=[a-z0-9])(?=[A-Z])|(?<=[A-Z])(?=[A-Z][a-z])", " "); if (s.Length != 0) { return char.ToUpperInvariant(s[0]) + s.Substring(1); } return s; } private static string Num(double v) { return v.ToString((Math.Abs(v) >= 100.0) ? "0" : "0.##", CultureInfo.InvariantCulture); } private static string Signed(double v) { return ((v >= 0.0) ? "+" : "−") + Num(Math.Abs(v)); } } public sealed class StatSnapshot { public readonly Dictionary<string, double> Values = new Dictionary<string, double>(); public readonly HashSet<string> Effects = new HashSet<string>(); } public sealed class StatChange { public string Key; public double Before; public double After; public double Delta => After - Before; } public static class StatDiff { public static bool Same(double a, double b) { return Math.Abs(a - b) <= 1E-06 * Math.Max(1.0, Math.Max(Math.Abs(a), Math.Abs(b))); } public static List<StatChange> Compute(StatSnapshot before, StatSnapshot after) { List<StatChange> list = new List<StatChange>(); foreach (string item in before.Values.Keys.Union(after.Values.Keys)) { before.Values.TryGetValue(item, out var value); after.Values.TryGetValue(item, out var value2); if (!Same(value2, value)) { list.Add(new StatChange { Key = item, Before = value, After = value2 }); } } list.Sort((StatChange x, StatChange y) => string.CompareOrdinal(x.Key, y.Key)); return list; } public static List<string> AddedEffects(StatSnapshot before, StatSnapshot after) { return after.Effects.Where((string e) => !before.Effects.Contains(e)).OrderBy<string, string>((string e) => e, StringComparer.Ordinal).ToList(); } } public static class NoiseFilter { private static readonly Regex Noise = new Regex("timer|until|counter|since|^last|last[A-Z_]|current|index|cooldownleft|elapsed|frame|seed|random|(^|[a-z_])(ID|Id)$|^id$|count$", RegexOptions.Compiled); public static bool IsNoise(string memberName) { if (string.IsNullOrEmpty(memberName)) { return true; } if (Regex.IsMatch(memberName, "(ID|Id)$|^id$|^is[A-Z]")) { return true; } string text = memberName.ToLowerInvariant(); if (Noise.IsMatch(text)) { return true; } if (text.Contains("time") && !text.Contains("reload") && !text.Contains("between")) { return true; } return false; } } } namespace FriendsCardBar.Game { internal sealed class BarView : MonoBehaviour { internal static BarView Instance; private const float Margin = 12f; private const float StripH = 24f; private const float StripW = 460f; private const float RowH = 20f; private const float ColW = 200f; private const float HeaderH = 24f; private const float Gap = 8f; private const float InfoW = 280f; private const int StripFont = 17; private const int RowFont = 15; private const int InfoFont = 15; private static readonly Color Muted = new Color(0.44f, 0.53f, 0.59f); private static readonly Color Body = new Color(0.9f, 0.93f, 0.95f); private static readonly Color StripBg = new Color(0f, 0f, 0f, 0.45f); private static readonly Color PanelBg = new Color(0f, 0f, 0f, 0.72f); private static readonly Color InfoBg = new Color(0.02f, 0.05f, 0.07f, 0.9f); internal readonly OpenDecks Open = new OpenDecks(); internal readonly PickRounds Rounds = new PickRounds(); internal int KillerOfMe = -1; private Canvas canvas; private RectTransform strips; private RectTransform decks; private RectTransform info; private TextMeshProUGUI infoText; private string lastSignature = ""; private float nextCheck; private int round; private bool snapshotPending; private bool warned; private string killMark = "☠"; private static MethodInfo botName; private static bool botNameLooked; private readonly Dictionary<int, List<StatRow>> statRows = new Dictionary<int, List<StatRow>>(); private string statsSig = ""; private float nextStats; private bool quickOn; private bool quickWasOpen; private DeckMode quickWasMode; private float infoRight; private float infoTop; private float available = 1900f; private float fit = 1f; private const float StatColW = 250f; private Func<string> liveInfo; internal float FeedTop { get; private set; } internal RectTransform Content { get; private set; } internal TMP_FontAsset Font { get; private set; } internal static int MyDeletablePlayer { get { int pid = CardDeletionBridge.DeletablePlayer; if (pid < 0) { return -1; } Player val = ((IEnumerable<Player>)PlayerManager.instance?.players).FirstOrDefault((Func<Player, bool>)((Player x) => (Object)(object)x != (Object)null && x.playerID == pid)); if (!((Object)(object)val != (Object)null) || !IsLocalHuman(val)) { return -1; } return pid; } } internal float Fit => fit; internal static void Create() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown if (!((Object)(object)Instance != (Object)null)) { GameObject val = new GameObject("FriendsCardBar"); Object.DontDestroyOnLoad((Object)val); Instance = val.AddComponent<BarView>(); } } private void Awake() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) canvas = ((Component)this).gameObject.AddComponent<Canvas>(); canvas.renderMode = (RenderMode)0; canvas.sortingOrder = 30; CanvasScaler obj = ((Component)this).gameObject.AddComponent<CanvasScaler>(); obj.uiScaleMode = (ScaleMode)1; obj.referenceResolution = new Vector2(1920f, 1080f); obj.matchWidthOrHeight = 1f; ((Component)this).gameObject.AddComponent<GraphicRaycaster>(); Content = NewRect("content", ((Component)this).transform); RectTransform content = Content; RectTransform content2 = Content; RectTransform content3 = Content; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(1f, 1f); content3.pivot = val; Vector2 anchorMin = (content2.anchorMax = val); content.anchorMin = anchorMin; Content.anchoredPosition = new Vector2(-12f, -12f); Content.sizeDelta = Vector2.zero; strips = NewRect("strips", (Transform)(object)Content); decks = NewRect("decks", (Transform)(object)Content); info = NewRect("info", (Transform)(object)Content); Image obj2 = ((Component)info).gameObject.AddComponent<Image>(); ((Graphic)obj2).color = InfoBg; ((Graphic)obj2).raycastTarget = false; infoText = NewText("text", (Transform)(object)info, 15, (TextAlignmentOptions)257); ((TMP_Text)infoText).rectTransform.anchorMin = Vector2.zero; ((TMP_Text)infoText).rectTransform.anchorMax = Vector2.one; ((TMP_Text)infoText).rectTransform.offsetMin = new Vector2(10f, 8f); ((TMP_Text)infoText).rectTransform.offsetMax = new Vector2(-10f, -8f); ((Component)info).gameObject.SetActive(false); Plugin.SettingsChanged += delegate { lastSignature = ""; }; GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)OnGameStart); GameModeManager.AddHook("PickStart", (Func<IGameModeHandler, IEnumerator>)OnPickStart); GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)OnPointStart); DevCommands.Handlers["open"] = delegate(string[] a) { Digit(int.Parse(a[0])); }; DevCommands.Handlers["key"] = delegate(string[] a) { if (!InputReader.ChatOpen) { Digit(int.Parse(a[0])); } else { Plugin.Log.LogInfo((object)"[fcb] key ignored: chat open"); } }; DevCommands.Handlers["fakechat"] = delegate(string[] a) { InputReader.FakeChat = a.Length != 0 && a[0] == "on"; }; DevCommands.Handlers["quick"] = delegate(string[] a) { InputReader.FakeQuick = a.Length != 0 && a[0] == "on"; }; DevCommands.Handlers["info"] = delegate(string[] a) { DevInfo(int.Parse(a[0]), int.Parse(a[1])); }; DevCommands.Handlers["dump"] = delegate { Dump(); }; DevCommands.Handlers["statinfo"] = delegate(string[] a) { DevStatInfo(int.Parse(a[0]), int.Parse(a[1])); }; DevCommands.Handlers["hook"] = delegate(string[] a) { ((MonoBehaviour)this).StartCoroutine(GameModeManager.TriggerHook(a[0])); }; DevCommands.Handlers["effectsof"] = delegate(string[] a) { List<Player> list = Players(); int? num = Keys.StripForDigit(int.Parse(a[0])); if (num.HasValue) { int valueOrDefault = num.GetValueOrDefault(); if (valueOrDefault < list.Count) { Plugin.Log.LogInfo((object)("[fcb] components on " + NameOf(list[valueOrDefault]) + ": " + string.Join(", ", from m in ((Component)list[valueOrDefault]).GetComponents<MonoBehaviour>() where (Object)(object)m != (Object)null && ((object)m).GetType().Namespace != null && ((object)m).GetType().Namespace.StartsWith("PotatoCards") select ((object)m).GetType().Name))); } } }; DevCommands.Handlers["autodelete"] = delegate { ((MonoBehaviour)this).StartCoroutine(AutoDelete()); }; DevCommands.Handlers["givemany"] = delegate(string[] a) { GiveMany(int.Parse(a[0]), int.Parse(a[1])); }; } private IEnumerator OnGameStart(IGameModeHandler gm) { round = 0; snapshotPending = true; KillerOfMe = -1; lastSignature = ""; yield break; } private IEnumerator OnPickStart(IGameModeHandler gm) { if (snapshotPending) { snapshotPending = false; Rounds.StartGame(((IEnumerable<Player>)Players()).ToDictionary((Func<Player, int>)((Player p) => p.playerID), (Func<Player, IReadOnlyList<string>>)((Player p) => Names(p)))); } round++; yield break; } private IEnumerator OnPointStart(IGameModeHandler gm) { KillerOfMe = -1; lastSignature = ""; yield break; } internal static List<Player> Players() { if ((Object)(object)PlayerManager.instance == (Object)null) { return new List<Player>(); } List<Player> list = (from p in PlayerManager.instance.players where (Object)(object)p != (Object)null orderby p.playerID select p).ToList(); Player val = ((IEnumerable<Player>)list).FirstOrDefault((Func<Player, bool>)IsLocalHuman); if ((Object)(object)val != (Object)null) { list.Remove(val); list.Insert(0, val); } return list; } private static bool InFight() { if ((Object)(object)GameManager.instance != (Object)null) { return GameManager.instance.battleOngoing; } return false; } private static bool IsLocalHuman(Player p) { try { return p.data.view.IsMine && !p.data.input.controlledElseWhere; } catch { return false; } } private static List<string> Names(Player p) { if (p.data?.currentCards != null) { return (from c in p.data.currentCards where (Object)(object)c != (Object)null select c.cardName).ToList(); } return new List<string>(); } internal static Color ColorOf(Player p) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //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_001c: Unknown result type (might be due to invalid IL or missing references) try { return PlayerSkinBank.GetPlayerSkinColors(PlayerExtensions.colorID(p)).color; } catch { return Color.white; } } internal static string NameOf(Player p) { try { if (!botNameLooked) { botNameLooked = true; botName = AccessTools.Method(AccessTools.TypeByName("FriendsFixes.BotNames"), "NameFor", (Type[])null, (Type[])null); } if (botName != null && botName.Invoke(null, new object[1] { p }) is string { Length: >0 } text) { return text; } } catch { } try { Player owner = p.data.view.Owner; string text2 = ((owner != null) ? owner.NickName : null); if (!string.IsNullOrEmpty(text2)) { return text2; } } catch { } return "Player " + (p.playerID + 1); } internal static string Hex(Color c) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) return ColorUtility.ToHtmlStringRGB(c); } private void Update() { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) try { List<Player> list = Players(); bool flag = Plugin.BarEnabled && list.Count > 0; ((Component)Content).gameObject.SetActive(flag); if (!flag) { return; } ((Transform)Content).localScale = Vector3.one * (Plugin.Size * fit); InputReader.Poll(Digit); QuickStats(list); if (Time.unscaledTime < nextCheck) { return; } nextCheck = Time.unscaledTime + 0.25f; Open.Retain(list.Select((Player p) => p.playerID).ToList()); RefreshStats(list); string text = Signature(list) + statsSig; if (text == lastSignature) { return; } lastSignature = text; foreach (Player item in list) { Rounds.Update(item.playerID, Names(item), round); } Rebuild(list); } catch (Exception ex) { if (!warned) { warned = true; Plugin.Log.LogWarning((object)("[fcb] card bar failed: " + ex)); } } } private void RefreshStats(List<Player> players) { if (Time.unscaledTime < nextStats) { return; } nextStats = Time.unscaledTime + 1f; StringBuilder stringBuilder = new StringBuilder(); statRows.Clear(); foreach (int id in Open.Order.Where((int playerId) => Open.ModeOf(playerId) == DeckMode.Stats)) { Player val = ((IEnumerable<Player>)players).FirstOrDefault((Func<Player, bool>)((Player x) => x.playerID == id)); if (!((Object)(object)val == (Object)null)) { StatSnapshot statSnapshot = Snapshotter.Take(val, Snapshotter.GunOf(val)); if (!StatTracker.Ledger.HasStart(val.playerID)) { StatTracker.Ledger.SeeStart(val.playerID, statSnapshot); } List<StatRow> list = StatsView.Rows(val, statSnapshot); statRows[id] = list; stringBuilder.Append(id).Append('{').Append(StatsView.Signature(list)) .Append('}'); } } statsSig = stringBuilder.ToString(); } private string Signature(List<Player> players) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(InFight()).Append('|').Append(Plugin.Size) .Append('|') .Append(KillerOfMe) .Append('|') .Append(MyDeletablePlayer) .Append('|') .Append(string.Join(",", Open.Order.Select((int id) => id.ToString() + Open.ModeOf(id)))) .Append('|'); foreach (Player player in players) { List<string> list = Names(player); stringBuilder.Append(player.playerID).Append(':').Append(NameOf(player)) .Append(':') .Append(list.Count) .Append(':'); foreach (string item in list) { stringBuilder.Append(item).Append(';'); } stringBuilder.Append('|'); } return stringBuilder.ToString(); } private void QuickStats(List<Player> players) { bool quickHeld = InputReader.QuickHeld; if (quickHeld == quickOn || players.Count == 0) { return; } int playerID = players[0].playerID; if (quickHeld) { quickWasOpen = Open.IsOpen(playerID); quickWasMode = Open.ModeOf(playerID); if (!quickWasOpen) { Open.Toggle(playerID); } Open.SetMode(playerID, DeckMode.Stats); } else if (Open.IsOpen(playerID)) { if (!quickWasOpen) { Open.Toggle(playerID); } else { Open.SetMode(playerID, quickWasMode); } } quickOn = quickHeld; nextCheck = 0f; nextStats = 0f; } internal void Digit(int d) { List<Player> list = Players(); if (d == 0) { Open.CycleAll(list.Select((Player p) => p.playerID).ToList()); } else { int? num = Keys.StripForDigit(d); if (num.HasValue) { int valueOrDefault = num.GetValueOrDefault(); if (valueOrDefault < list.Count) { Open.Cycle(list[valueOrDefault].playerID); } } } nextStats = 0f; nextCheck = 0f; } private void Rebuild(List<Player> players) { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_020e: 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) EnsureFont(); Clear((Transform)(object)strips); Clear((Transform)(object)decks); float num = 60f; List<TextMeshProUGUI> list = new List<TextMeshProUGUI>(); for (int i = 0; i < players.Count; i++) { TextMeshProUGUI val = NewText("name" + i, (Transform)(object)strips, 17, (TextAlignmentOptions)513); Place(((TMP_Text)val).rectTransform, 0f, (float)(-i) * 24f, 224f, 24f); ((TMP_Text)val).enableWordWrapping = false; ((TMP_Text)val).overflowMode = (TextOverflowModes)1; ((TMP_Text)val).text = "<color=#" + Hex(ColorOf(players[i])) + "><b>" + Esc(NameOf(players[i])) + "</b></color>"; ((TMP_Text)val).ForceMeshUpdate(); num = Mathf.Max(num, Mathf.Min(220f, ((TMP_Text)val).preferredWidth)); list.Add(val); } float num2 = 36f + num + 8f + 38f + 10f; for (int j = 0; j < players.Count; j++) { Player val2 = players[j]; float num3 = (float)(-j) * 24f; RectTransform obj = NewRect("back" + j, (Transform)(object)strips); ((Transform)obj).SetAsFirstSibling(); Place(obj, 0f - num2, num3 - 1f, num2, 22f); Image obj2 = ((Component)obj).gameObject.AddComponent<Image>(); ((Graphic)obj2).color = StripBg; ((Graphic)obj2).raycastTarget = true; ((Component)obj).gameObject.AddComponent<StripClick>().PlayerId = val2.playerID; TextMeshProUGUI obj3 = NewText("key" + j, (Transform)(object)strips, 15, (TextAlignmentOptions)514); Place(((TMP_Text)obj3).rectTransform, 0f - num2 + 10f, num3, 26f, 24f); ((TMP_Text)obj3).text = "<color=#" + Hex(Muted) + ">" + ((j < 9) ? (j + 1).ToString() : "") + "</color>"; Place(((TMP_Text)list[j]).rectTransform, 0f - num2 + 10f + 26f, num3, num + 4f, 24f); ((TMP_Text)list[j]).ForceMeshUpdate(); TextMeshProUGUI obj4 = NewText("count" + j, (Transform)(object)strips, 17, (TextAlignmentOptions)516); Place(((TMP_Text)obj4).rectTransform, -48f, num3, 38f, 24f); ((TMP_Text)obj4).text = Names(val2).Count.ToString(); if (val2.playerID == KillerOfMe) { TextMeshProUGUI obj5 = NewText("killer" + j, (Transform)(object)strips, 13, (TextAlignmentOptions)516); Place(((TMP_Text)obj5).rectTransform, 0f - num2 - 160f, num3, 154f, 24f); ((TMP_Text)obj5).enableWordWrapping = false; ((TMP_Text)obj5).text = "<color=#FF6B6B>" + ((killMark != "") ? (killMark + " ") : "") + "killed you</color>"; } } float num4 = (float)players.Count * 24f; string text = null; if (MyDeletablePlayer >= 0) { text = ((Open.IsOpen(MyDeletablePlayer) && Open.ModeOf(MyDeletablePlayer) == DeckMode.Cards) ? "<color=#FF9F6B>your pick: click a card to delete it</color>" : "<color=#FF9F6B>your pick: [1] then click a card to delete it</color>"); } else if (!InFight()) { text = "<color=#" + Hex(Muted) + ">[1] you [2–9] others [0] all [`] stats</color>"; } if (text != null) { TextMeshProUGUI obj6 = NewText("keys", (Transform)(object)strips, 12, (TextAlignmentOptions)516); Place(((TMP_Text)obj6).rectTransform, 0f - num2 - 200f, 0f - num4 - 1f, num2 + 200f - 4f, 16f); ((TMP_Text)obj6).enableWordWrapping = false; ((TMP_Text)obj6).text = Glyphs(text); num4 += 18f; } FeedTop = num4 + 8f; float num5 = (Plugin.FeedEnabled ? ((float)((players.Count <= 4) ? 3 : 5) * 20f + 8f) : 0f); float top = FeedTop + num5; float num6 = 0f; foreach (int id in Open.Order) { Player val3 = ((IEnumerable<Player>)players).FirstOrDefault((Func<Player, bool>)((Player x) => x.playerID == id)); if (!((Object)(object)val3 == (Object)null)) { num6 += BuildDeck(val3, num6, top) + 8f; } } float num7 = 1080f * (float)Screen.width / (float)Mathf.Max(1, Screen.height); fit = DeckLayout.ScaleToFit(num6, (num7 - 24f) / Plugin.Size); available = (num7 - 24f) / (Plugin.Size * fit); infoRight = num6; infoTop = top; HideInfo(); } private void BuildTabs(RectTransform panel, int playerId, float w, DeckMode current) { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) (DeckMode, string, float)[] array = new(DeckMode, string, float)[2] { (DeckMode.Cards, "Cards", w - 106f), (DeckMode.Stats, "Stats", w - 56f) }; for (int i = 0; i < array.Length; i++) { (DeckMode, string, float) tuple = array[i]; DeckMode item = tuple.Item1; string item2 = tuple.Item2; float item3 = tuple.Item3; TextMeshProUGUI val = NewText("tab" + item2, (Transform)(object)panel, 14, (TextAlignmentOptions)514); Place(((TMP_Text)val).rectTransform, item3, -4f, 50f, 20f); ((TMP_Text)val).text = ((item == current) ? ("<b><color=#FFFFFF>" + item2 + "</color></b>") : ("<color=#" + Hex(Muted) + ">" + item2 + "</color>")); ((Graphic)val).raycastTarget = true; TabClick tabClick = ((Component)val).gameObject.AddComponent<TabClick>(); tabClick.PlayerId = playerId; tabClick.Mode = item; if (item == current) { RectTransform obj = NewRect("underline", ((TMP_Text)val).transform); Place(obj, 8f, -18f, 34f, 2f); Image obj2 = ((Component)obj).gameObject.AddComponent<Image>(); ((Graphic)obj2).color = Body; ((Graphic)obj2).raycastTarget = false; } } } private void KeyHint(RectTransform panel, Player p, float w, float h, DeckMode mode) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) int num = Players().IndexOf(p); string text = ((num >= 0 && num < 9) ? (num + 1).ToString() : ""); TextMeshProUGUI obj = NewText("keyhint", (Transform)(object)panel, 11, (TextAlignmentOptions)516); Place(((TMP_Text)obj).rectTransform, 6f, 0f - h + 16f, w - 12f, 13f); string text2 = OpenDecks.NextAction(open: true, mode); ((TMP_Text)obj).text = "<color=#" + Hex(Muted) + ">" + ((text != "") ? ("[" + text + "] " + text2 + " · ") : "") + "[0] close all</color>"; } private float BuildStats(Player p, float right, float top) { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0369: Unknown result type (might be due to invalid IL or missing references) //IL_035d: Unknown result type (might be due to invalid IL or missing references) if (!statRows.TryGetValue(p.playerID, out var value)) { value = StatsView.Rows(p, Snapshotter.Take(p, Snapshotter.GunOf(p))); } int num = Math.Max(1, DeckLayout.Columns(value.Count)); int num2 = Math.Min(value.Count, 22); float num3 = Math.Max((float)num * 250f + 12f, 230f); float h = 24f + (float)num2 * 20f + 24f; RectTransform val = NewRect("deck" + p.playerID, (Transform)(object)decks); Place(val, 0f - right - num3, 0f - top, num3, h); Image obj = ((Component)val).gameObject.AddComponent<Image>(); ((Graphic)obj).color = PanelBg; ((Graphic)obj).raycastTarget = false; RectTransform obj2 = NewRect("accent", (Transform)(object)val); Place(obj2, 0f, 0f, num3, 3f); Image obj3 = ((Component)obj2).gameObject.AddComponent<Image>(); ((Graphic)obj3).color = ColorOf(p); ((Graphic)obj3).raycastTarget = false; TextMeshProUGUI obj4 = NewText("head", (Transform)(object)val, 15, (TextAlignmentOptions)513); Place(((TMP_Text)obj4).rectTransform, 8f, -4f, num3 - 120f, 24f); ((TMP_Text)obj4).text = "<color=#" + Hex(ColorOf(p)) + "><b>" + Esc(NameOf(p)) + "</b></color>"; BuildTabs(val, p.playerID, num3, DeckMode.Stats); KeyHint(val, p, num3, h, DeckMode.Stats); for (int i = 0; i < value.Count; i++) { StatRow statRow = value[i]; int num4 = i / 22; int num5 = i % 22; RectTransform val2 = NewRect("stat" + i, (Transform)(object)val); Place(val2, 6f + (float)num4 * 250f, -24f - (float)num5 * 20f, 242f, 20f); if (statRow.Header != null) { TextMeshProUGUI obj5 = NewText("h", (Transform)(object)val2, 12, (TextAlignmentOptions)1025); Place(((TMP_Text)obj5).rectTransform, 2f, 0f, 238f, 20f); ((TMP_Text)obj5).text = "<color=#" + Hex(Muted) + "><b>" + statRow.Header + "</b></color>"; continue; } Image val3 = ((Component)val2).gameObject.AddComponent<Image>(); ((Graphic)val3).color = new Color(1f, 1f, 1f, 0f); TextMeshProUGUI obj6 = NewText("name", (Transform)(object)val2, 15, (TextAlignmentOptions)513); Place(((TMP_Text)obj6).rectTransform, 4f, 0f, 160f, 20f); ((TMP_Text)obj6).enableWordWrapping = false; ((TMP_Text)obj6).overflowMode = (TextOverflowModes)1; TextMeshProUGUI val4 = NewText("value", (Transform)(object)val2, 15, (TextAlignmentOptions)516); Place(((TMP_Text)val4).rectTransform, 154f, 0f, 84f, 20f); string text = (statRow.Changed ? Hex(Color.white) : Hex(Muted)); ((TMP_Text)obj6).text = "<color=#" + (statRow.Changed ? Hex(Body) : Hex(Muted)) + ">" + Esc(statRow.Info.Name) + "</color>"; ((TMP_Text)val4).text = "<color=#" + text + ">" + (statRow.Changed ? "<b>" : "") + StatCatalog.Format(statRow.Info, statRow.Value) + (statRow.Changed ? "</b>" : "") + "</color>"; StatHover statHover = ((Component)val2).gameObject.AddComponent<StatHover>(); statHover.PlayerId = p.playerID; statHover.Info = statRow.Info; statHover.Value = statRow.Value; statHover.Highlight = val3; } return num3; } private float BuildDeck(Player p, float right, float top) { //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_0358: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) if (Open.ModeOf(p.playerID) == DeckMode.Stats) { return BuildStats(p, right, top); } List<DeckCopy> list = DeckModel.EachCopy(Names(p), 2, (string n, int o) => Rounds.RoundOf(p.playerID, n, o) > 0); int num = Math.Max(1, DeckLayout.Columns(list.Count)); int num2 = Math.Min(list.Count, 22); float num3 = Math.Max((float)num * 200f + 12f, 230f); float h = 24f + (float)num2 * 20f + 24f; RectTransform val = NewRect("deck" + p.playerID, (Transform)(object)decks); Place(val, 0f - right - num3, 0f - top, num3, h); Image obj = ((Component)val).gameObject.AddComponent<Image>(); ((Graphic)obj).color = PanelBg; ((Graphic)obj).raycastTarget = false; RectTransform obj2 = NewRect("accent", (Transform)(object)val); Place(obj2, 0f, 0f, num3, 3f); Image obj3 = ((Component)obj2).gameObject.AddComponent<Image>(); ((Graphic)obj3).color = ColorOf(p); ((Graphic)obj3).raycastTarget = false; TextMeshProUGUI obj4 = NewText("head", (Transform)(object)val, 15, (TextAlignmentOptions)513); Place(((TMP_Text)obj4).rectTransform, 8f, -4f, num3 - 120f, 24f); ((TMP_Text)obj4).enableWordWrapping = false; ((TMP_Text)obj4).overflowMode = (TextOverflowModes)1; ((TMP_Text)obj4).text = $"<color=#{Hex(ColorOf(p))}><b>{Esc(NameOf(p))}</b></color> <color=#{Hex(Muted)}>{Names(p).Count}</color>"; BuildTabs(val, p.playerID, num3, DeckMode.Cards); KeyHint(val, p, num3, h, DeckMode.Cards); List<CardInfo> source = p.data.currentCards.Where((CardInfo c) => (Object)(object)c != (Object)null).ToList(); for (int num4 = 0; num4 < list.Count; num4++) { DeckCopy e = list[num4]; int num5 = num4 / 22; int num6 = num4 % 22; RectTransform val2 = NewRect("row" + num4, (Transform)(object)val); Place(val2, 6f + (float)num5 * 200f, -24f - (float)num6 * 20f, 196f, 20f); Image val3 = ((Component)val2).gameObject.AddComponent<Image>(); ((Graphic)val3).color = new Color(1f, 1f, 1f, e.IsNew ? 0.06f : 0f); CardInfo card = ((IEnumerable<CardInfo>)source).FirstOrDefault((Func<CardInfo, bool>)((CardInfo c) => c.cardName == e.Name)); CardFact cardFact = CardFacts.For(card); RectTransform obj5 = NewRect("dot", (Transform)(object)val2); Place(obj5, 2f, -6.5f, 7f, 7f); Image obj6 = ((Component)obj5).gameObject.AddComponent<Image>(); ((Graphic)obj6).color = cardFact?.RarityColor ?? Muted; ((Graphic)obj6).raycastTarget = false; TextMeshProUGUI obj7 = NewText("name", (Transform)(object)val2, 15, (TextAlignmentOptions)513); Place(((TMP_Text)obj7).rectTransform, 14f, 0f, 180f, 20f); ((TMP_Text)obj7).enableWordWrapping = false; ((TMP_Text)obj7).overflowMode = (TextOverflowModes)1; ((Graphic)obj7).raycastTarget = false; string text = ((e.Copy > 1) ? $" <color=#{Hex(Muted)}>#{e.Copy}</color>" : ""); ((TMP_Text)obj7).text = (e.IsNew ? ("<b><color=#FFFFFF>" + Esc(e.Name) + "</color></b>" + text) : ("<color=#" + Hex(Body) + ">" + Esc(e.Name) + "</color>" + text)); RowHover rowHover = ((Component)val2).gameObject.AddComponent<RowHover>(); rowHover.Card = card; rowHover.PlayerId = p.playerID; rowHover.Name = e.Name; rowHover.Highlight = val3; rowHover.IsNew = e.IsNew; rowHover.Copy = e.Copy; rowHover.Deletable = p.playerID == MyDeletablePlayer; } return num3; } internal void ShowInfo(CardInfo card, int playerId, string name, bool deletable = false, int copy = 0) { if (CardFacts.For(card) == null) { HideInfo(); return; } ShowLive(() => (deletable ? "<color=#FF9F6B><b>Click to delete this card</b> (uses your pick)</color>\n" : "") + CardText(card, playerId, name, copy)); } private string CardText(CardInfo card, int playerId, string name, int copy = 0) { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) CardFact cardFact = CardFacts.For(card); int num = Rounds.RoundOf(playerId, name, 0); string text = ((num == 0) ? "from save" : ((num > 0) ? ("picked round " + num) : "")); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append($"<b><size={18}>{Esc(cardFact.Name)}</size></b>\n"); stringBuilder.Append("<color=#" + Hex(cardFact.RarityColor) + ">" + Esc(cardFact.RarityName) + "</color><color=#" + Hex(Muted) + "> · " + Esc(cardFact.Mod) + ((text != "") ? (" · " + text) : "") + "</color>\n"); foreach (var (s, flag) in cardFact.Stats) { stringBuilder.Append("<color=" + (flag ? "#6FDC8C" : "#FF7B7B") + ">" + Esc(s) + "</color>\n"); } if (!string.IsNullOrWhiteSpace(cardFact.Description)) { stringBuilder.Append("\n<i><color=#B8C7CF>" + Esc(cardFact.Description) + "</color></i>\n"); } stringBuilder.Append(StatsView.WhatItDid(playerId, name, copy)); return stringBuilder.ToString(); } private string Glyphs(string text) { if ((Object)(object)Font != (Object)null && !Font.HasCharacter('→')) { text = text.Replace("→", "->"); } if ((Object)(object)Font != (Object)null && !Font.HasCharacter('−')) { text = text.Replace("−", "-"); } if ((Object)(object)Font != (Object)null && !Font.HasCharacter('×')) { text = text.Replace("×", "x"); } if ((Object)(object)Font != (Object)null && !Font.HasCharacter('–')) { text = text.Replace("–", "-"); } return text; } internal void ShowLive(Func<string> make) { liveInfo = make; ShowText(make()); } internal double? CurrentValue(int playerId, string key) { if (!statRows.TryGetValue(playerId, out var value)) { return null; } return value.FirstOrDefault((StatRow r) => r.Info != null && r.Info.Key == key)?.Value; } internal void ShowText(string text) { ((TMP_Text)infoText).text = Glyphs(text); ((TMP_Text)infoText).ForceMeshUpdate(); float h = Mathf.Max(60f, ((TMP_Text)infoText).preferredHeight + 18f); Place(info, 0f - DeckLayout.InfoLeft(infoRight, 280f, available), 0f - infoTop, 280f, h); ((Component)info).gameObject.SetActive(true); } internal void HideInfo() { liveInfo = null; ((Component)info).gameObject.SetActive(false); } private void DevInfo(int digit, int row) { List<Player> list = Players(); int? num = Keys.StripForDigit(digit); if (!num.HasValue) { return; } int valueOrDefault = num.GetValueOrDefault(); if (valueOrDefault >= list.Count) { return; } Player val = list[valueOrDefault]; if (!Open.IsOpen(val.playerID)) { Open.Toggle(val.playerID); } lastSignature = ""; nextCheck = 0f; Update(); List<DeckEntry> e = DeckModel.Group(Names(val)); if (row < e.Count) { CardInfo card = ((IEnumerable<CardInfo>)val.data.currentCards).FirstOrDefault((Func<CardInfo, bool>)((CardInfo c) => (Object)(object)c != (Object)null && c.cardName == e[row].Name)); ShowInfo(card, val.playerID, e[row].Name); Plugin.Log.LogInfo((object)($"[fcb] info (round lookup {Rounds.RoundOf(val.playerID, e[row].Name, 0)}, current round {round}): " + ((TMP_Text)infoText).text.Replace("\n", " / "))); } } private IEnumerator AutoDelete() { float until = Time.unscaledTime + 120f; while (CardDeletionBridge.DeletablePlayer < 0 && Time.unscaledTime < until) { yield return null; } int pid = CardDeletionBridge.DeletablePlayer; Player p = ((IEnumerable<Player>)Players()).FirstOrDefault((Func<Player, bool>)((Player x) => x.playerID == pid)); if ((Object)(object)p == (Object)null) { Plugin.Log.LogInfo((object)"[fcb] autodelete: no deletable pick seen"); yield break; } List<string> list = Names(p); Plugin.Log.LogInfo((object)$"[fcb] autodelete: Card Deletion allows {NameOf(p)} (human on this PC: {IsLocalHuman(p)}); delete hint shown for player {MyDeletablePlayer}; cards before: {list.Count}"); yield return null; CardInfo card = ((IEnumerable<CardInfo>)p.data.currentCards).FirstOrDefault((Func<CardInfo, bool>)((CardInfo c) => (Object)(object)c != (Object)null)); bool sent = CardDeletionBridge.Delete(card); yield return (object)new WaitForSecondsRealtime(2f); Plugin.Log.LogInfo((object)$"[fcb] autodelete: sent={sent} for {card?.cardName}; cards after: {Names(p).Count}; still holds it: {Names(p).Contains(card?.cardName)}"); } private static void GiveMany(int digit, int n) { List<Player> list = Players(); int? num = Keys.StripForDigit(digit); if (!num.HasValue) { return; } int valueOrDefault = num.GetValueOrDefault(); if (valueOrDefault < list.Count) { List<CardInfo> list2 = CardChoice.instance.cards.Where((CardInfo c) => (Object)(object)c != (Object)null).ToList(); Random random = new Random(digit * 7919 + n); for (int num2 = 0; num2 < n; num2++) { Cards.instance.AddCardToPlayer(list[valueOrDefault], list2[random.Next(list2.Count)], false, "", 0f, 0f, true); } Plugin.Log.LogInfo((object)$"[fcb] gave {n} random cards to strip {digit}"); } } private void DevStatInfo(int digit, int row) { List<Player> list = Players(); int? num = Keys.StripForDigit(digit); if (!num.HasValue) { return; } int valueOrDefault = num.GetValueOrDefault(); if (valueOrDefault < list.Count) { Player val = list[valueOrDefault]; if (!Open.IsOpen(val.playerID)) { Open.Toggle(val.playerID); } Open.SetMode(val.playerID, DeckMode.Stats); nextStats = 0f; lastSignature = ""; nextCheck = 0f; Update(); List<StatRow> value; List<StatRow> list2 = (statRows.TryGetValue(val.playerID, out value) ? value.Where((StatRow x) => x.Header == null).ToList() : new List<StatRow>()); if (row < list2.Count) { ShowText(StatsView.Breakdown(val.playerID, list2[row].Info, list2[row].Value)); Plugin.Log.LogInfo((object)("[fcb] statinfo: " + ((TMP_Text)infoText).text.Replace("\n", " / "))); } } } private void Dump() { //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Expected O, but got Unknown //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) List<Player> list = Players(); for (int i = 0; i < list.Count; i++) { Plugin.Log.LogInfo((object)$"[fcb] strip {i + 1}: {NameOf(list[i])} cards={Names(list[i]).Count} open={Open.IsOpen(list[i].playerID)} killer={list[i].playerID == KillerOfMe}"); } Plugin.Log.LogInfo((object)string.Format("[fcb] open order: {0}; chat open: {1}; round {2}", string.Join(",", Open.Order.Select((int id) => id + ":" + Open.ModeOf(id))), InputReader.ChatOpen, round)); foreach (Transform item in (Transform)decks) { Transform val = item; ManualLogSource log = Plugin.Log; object[] obj = new object[4] { ((Object)val).name, null, null, null }; Rect rect = ((RectTransform)val).rect; obj[1] = ((Rect)(ref rect)).size; obj[2] = ((RectTransform)val).anchoredPosition; obj[3] = val.childCount - 2; log.LogInfo((object)string.Format("[fcb] deck panel {0}: {1} at {2}, rows {3}", obj)); } FeedView.Instance?.Dump(); } private void EnsureFont() { if (!((Object)(object)Font != (Object)null)) { Font = (from t in Object.FindObjectsOfType<TextMeshProUGUI>() select ((TMP_Text)t).font).FirstOrDefault((Func<TMP_FontAsset, bool>)((TMP_FontAsset f) => (Object)(object)f != (Object)null)) ?? TMP_Settings.defaultFontAsset ?? Resources.FindObjectsOfTypeAll<TMP_FontAsset>().FirstOrDefault(); if ((Object)(object)Font != (Object)null && !Font.HasCharacter('☠')) { killMark = (Font.HasCharacter('†') ? "†" : ""); } Plugin.Log.LogInfo((object)string.Format("[fcb] font: {0}, skull glyph: {1}", ((Object)(object)Font != (Object)null) ? ((Object)Font).name : "none", killMark == "☠")); } } internal static string Esc(string s) { return (s ?? "").Replace("<", "‹").Replace(">", "›"); } internal static RectTransform NewRect(string name, Transform parent) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_002c: 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_003f: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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: Expected O, but got Unknown RectTransform val = (RectTransform)new GameObject(name, new Type[1] { typeof(RectTransform) }).transform; ((Transform)val).SetParent(parent, false); Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(0f, 1f); val.pivot = val2; Vector2 anchorMin = (val.anchorMax = val2); val.anchorMin = anchorMin; return val; } internal static void Place(RectTransform rt, float x, float y, float w, float h) { //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_0039: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, 1f); rt.pivot = val; Vector2 anchorMin = (rt.anchorMax = val); rt.anchorMin = anchorMin; rt.anchoredPosition = new Vector2(x, y); rt.sizeDelta = new Vector2(w, h); } internal TextMeshProUGUI NewText(string name, Transform parent, int size, TextAlignmentOptions align) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI val = ((Component)NewRect(name, parent)).gameObject.AddComponent<TextMeshProUGUI>(); EnsureFont(); if ((Object)(object)Font != (Object)null) { ((TMP_Text)val).font = Font; } ((TMP_Text)val).fontSize = size; ((TMP_Text)val).alignment = align; ((TMP_Text)val).richText = true; ((Graphic)val).color = Body; ((Graphic)val).raycastTarget = false; return val; } private static void Clear(Transform t) { for (int num = t.childCount - 1; num >= 0; num--) { Object.Destroy((Object)(object)((Component)t.GetChild(num)).gameObject); } } } internal sealed class StripClick : MonoBehaviour, IPointerClickHandler, IEventSystemHandler { public int PlayerId; private void Awake() { TextMeshProUGUI component = ((Component)this).GetComponent<TextMeshProUGUI>(); if (Object.op_Implicit((Object)(object)component)) { ((Graphic)component).raycastTarget = true; } } public void OnPointerClick(PointerEventData e) { if (!((Object)(object)GameManager.instance != (Object)null) || !GameManager.instance.battleOngoing) { BarView.Instance.Open.Toggle(PlayerId); BarView.Instance.Digit(-1); } } } internal sealed class RowHover : MonoBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IPointerClickHandler { public CardInfo Card; public int PlayerId; public string Name; public Image Highlight; public bool IsNew; public bool Deletable; public int Copy; public void OnPointerEnter(PointerEventData e) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Highlight)) { ((Graphic)Highlight).color = (Deletable ? new Color(1f, 0.35f, 0.3f, 0.45f) : new Color(1f, 1f, 1f, 0.22f)); } BarView.Instance.ShowInfo(Card, PlayerId, Name, Deletable, Copy); } public void OnPointerClick(PointerEventData e) { if (Deletable) { CardDeletionBridge.Delete(Card); } } public void OnPointerExit(PointerEventData e) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)Highlight)) { ((Graphic)Highlight).color = new Color(1f, 1f, 1f, IsNew ? 0.06f : 0f); } BarView.Instance.HideInfo(); } } internal static class CardDeletionBridge { private static readonly Type Manager = AccessTools.TypeByName("Rounds2Mod.CardDeleteManager"); private static readonly FieldInfo IsPickPhase = ((Manager == null) ? null : AccessTools.Field(Manager, "isPickPhase")); private static readonly FieldInfo Instance = ((Manager == null) ? null : AccessTools.Field(Manager, "instance")); private static readonly FieldInfo PickerField = ((Manager == null) ? null : AccessTools.Field(Manager, "currentPickerID")); private static readonly MethodInfo LocalTurn = ((Manager == null) ? null : AccessTools.Method(Manager, "IsLocalPlayerTurn", (Type[])null, (Type[])null)); private static readonly MethodInfo RequestDelete = ((Manager == null) ? null : AccessTools.Method(Manager, "RequestDelete", new Type[1] { typeof(CardInfo) }, (Type[])null)); private static bool warned; public static bool Installed { get { if (IsPickPhase != null && Instance != null && LocalTurn != null) { return RequestDelete != null; } return false; } } public static bool CanDeleteNow { get { if (!Installed) { return false; } try { return (bool)IsPickPhase.GetValue(null) && (bool)LocalTurn.Invoke(null, null) && Instance.GetValue(null) != null; } catch (Exception e) { Warn(e); return false; } } } public static int DeletablePlayer { get { if (!CanDeleteNow || PickerField == null) { return -1; } try { return (int)PickerField.GetValue(null); } catch { return -1; } } } public static bool Delete(CardInfo card) { if ((Object)(object)card == (Object)null || !CanDeleteNow) { return false; } try { RequestDelete.Invoke(Instance.GetValue(null), new object[1] { card }); Plugin.Log.LogInfo((object)("[fcb] asked Card Deletion to delete " + card.cardName)); return true; } catch (Exception e) { Warn(e); return false; } } private static void Warn(Exception e) { if (!warned) { warned = true; Plugin.Log.LogWarning((object)("[fcb] Card Deletion bridge failed: " + e)); } } } internal sealed class CardFact { public string Name; public string RarityName; public string Mod; public string Description; public Color RarityColor; public List<(string text, bool positive)> Stats = new List<(string, bool)>(); } internal static class CardFacts { private static readonly Dictionary<CardInfo, CardFact> cache = new Dictionary<CardInfo, CardFact>(); private static readonly Regex Prefix = new Regex("^__(.+?)__"); private static bool rarityLibMissing; public static CardFact For(CardInfo card) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)card == (Object)null) { return null; } if (cache.TryGetValue(card, out var value)) { return value; } value = new CardFact { Name = card.cardName, Description = (card.cardDestription ?? "") }; (value.RarityName, value.RarityColor) = Rarity(card.rarity); if (0.2126f * value.RarityColor.r + 0.7152f * value.RarityColor.g + 0.0722f * value.RarityColor.b < 0.35f) { value.RarityColor = Color.Lerp(value.RarityColor, Color.white, 0.45f); } value.Mod = ModOf(card); if (card.cardStats != null) { CardInfoStat[] cardStats = card.cardStats; foreach (CardInfoStat val in cardStats) { if (val != null && !string.IsNullOrWhiteSpace(val.stat)) { value.Stats.Add(((val.amount + " " + val.stat).Trim(), val.positive)); } } } cache[card] = value; return value; } private static (string, Color) Rarity(Rarity r) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 //IL_0007: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) if (!rarityLibMissing) { try { return FromRarityLib(r); } catch (Exception) { rarityLibMissing = true; } } if ((int)r != 1) { if ((int)r == 2) { return ("Rare", new Color(1f, 0.18f, 0.76f)); } return ("Common", new Color(0.6f, 0.64f, 0.68f)); } return ("Uncommon", new Color(0.17f, 0.68f, 1f)); } private static (string, Color) FromRarityLib(Rarity r) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) Rarity rarityData = RarityUtils.GetRarityData(r); Color color = rarityData.color; if ((int)r == 0) { ((Color)(ref color))..ctor(0.6f, 0.64f, 0.68f); } return (rarityData.name, color); } private static string ModOf(CardInfo card) { if (CardManager.cards != null && CardManager.cards.TryGetValue(((Object)card).name, out var value) && !string.IsNullOrEmpty(value.category)) { return value.category; } Match match = Prefix.Match(((Object)card).name ?? ""); if (!match.Success) { return "Vanilla"; } return match.Groups[1].Value; } } internal static class DeathWatcher { private static readonly FieldRef<HealthHandler, CharacterData> Data = AccessTools.FieldRefAccess<HealthHandler, CharacterData>("data"); private static readonly Dictionary<int, Player> lastHitter = new Dictionary<int, Player>(); private static readonly Dictionary<int, int> deaths = new Dictionary<int, int>(); private static readonly Dictionary<int, int> previousPhrase = new Dictionary<int, int>(); private static bool warned; private static string lastHow; private static readonly Dictionary<int, string> lastHowFor = new Dictionary<int, string>(); private static readonly Dictionary<int, (Player blocker, float time)> blockedBy = new Dictionary<int, (Player, float)>(); private const float BounceBackWindow = 4f; private static string lastFoundKind = ""; private static float lastNote; private static Type swordSpawner; private static bool swordLookedUp; public static void Install() { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown //IL_006a: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown Harmony harmony = Plugin.Harmony; string[] array = new string[2] { "RPCA_Die", "RPCA_Die_Phoenix" }; foreach (string text in array) { harmony.Patch((MethodBase)AccessTools.Method(typeof(HealthHandler), text, (Type[])null, (Type[])null), new HarmonyMethod(typeof(DeathWatcher), "BeforeDie", (Type[])null), new HarmonyMethod(typeof(DeathWatcher), "AfterDie", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } harmony.Patch((MethodBase)AccessTools.Method(typeof(HealthHandler), "DoDamage", (Type[])null, (Type[])null), new HarmonyMethod(typeof(DeathWatcher), "BeforeDamage", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(ProjectileHit), "RPCA_DoHit", (Type[])null, (Type[])null), new HarmonyMethod(typeof(DeathWatcher), "BeforeHit", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); GameModeManager.AddHook("GameStart", (Func<IGameModeHandler, IEnumerator>)((IGameModeHandler _) => Reset(match: true))); GameModeManager.AddHook("PointStart", (Func<IGameModeHandler, IEnumerator>)((IGameModeHandler _) => Reset(match: false))); DevCommands.Handlers["slay"] = delegate(string[] a) { Slay(int.Parse(a[0]), (a.Length > 1) ? int.Parse(a[1]) : 0); }; } private static IEnumerator Reset(bool match) { lastHitter.Clear(); blockedBy.Clear(); lastHowFor.Clear(); if (match) { deaths.Clear(); previousPhrase.Clear(); } yield break; } private static void BeforeDie(HealthHandler __instance, out int __state) { CharacterData val = Data.Invoke(__instance); __state = (((Object)(object)val == (Object)null || !val.isPlaying) ? (-1) : ((val.dead ? 1 : 0) | (__instance.isRespawning ? 2 : 0))); } private static void BeforeDamage(HealthHandler __instance, Vector2 damage, Vector2 position, Player damagingPlayer, bool ignoreBlock) { //IL_0021: 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_007e: Unknown result type (might be due to invalid IL or missing references) try { CharacterData val = Data.Invoke(__instance); if (!((Object)(object)val?.player == (Object)null) && !(damage == Vector2.zero) && val.isPlaying && !val.dead && (!((Object)(object)val.block != (Object)null) || !val.block.IsBlocking() || ignoreBlock)) { lastHow = null; lastHitter[val.player.playerID] = Attribute(val.player, damagingPlayer, position); lastHowFor[val.player.playerID] = lastHow; } } catch { } } private static void BeforeHit(ProjectileHit __instance, int viewID, bool wasBlocked) { try { if (wasBlocked && viewID != -1 && !((Object)(object)__instance.ownPlayer == (Object)null)) { PhotonView photonView = PhotonNetwork.GetPhotonView(viewID); Player val = ((photonView != null) ? ((Component)photonView).GetComponent<Player>() : null); if ((Object)(object)val != (Object)null && (Object)(object)val != (Object)(object)__instance.ownPlayer) { blockedBy[__instance.ownPlayer.playerID] = (val, Time.time); } } } catch { } } private static Player Attribute(Player victim, Player hitter, Vector2 position) { //IL_0095: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)hitter == (Object)(object)victim && blockedBy.TryGetValue(victim.playerID, out (Player, float) value) && (Object)(object)value.Item1 != (Object)null && Time.time - value.Item2 <= 4f) { Note($"p{victim.playerID}'s own bullet bounced back off p{value.Item1.playerID}'s block: credit p{value.Item1.playerID}"); lastHow = "bounce"; return value.Item1; } if ((Object)(object)hitter == (Object)null) { Player val = OwnerNear(position, victim); if ((Object)(object)val != (Object)null) { Note($"ownerless damage on p{victim.playerID} next to p{val.playerID}'s {lastFoundKind}: credit p{val.playerID}"); lastHow = "sword"; } return val; } return hitter; } private static void Note(string msg) { if (!(Time.time - lastNote < 0.5f)) { lastNote = Time.time; Plugin.Log.LogInfo((object)("[fcb] kill credit: " + msg)); } } private static Player OwnerNear(Vector2 pos, Player victim) { //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) Player result = null; float num = 3f; if (!swordLookedUp) { swordLookedUp = true; swordSpawner = AccessTools.TypeByName("CardsPlusPlugin.Cards.SwordSpawner"); } if (swordSpawner != null) { Object[] array = Object.FindObjectsOfType(swordSpawner); foreach (Object val in array) { Object obj = ((val is Component) ? val : null); Player val2 = ((obj != null) ? ((Component)obj).GetComponentInParent<Player>() : null); if ((Object)(object)val2 == (Object)null || (Object)(object)val2 == (Object)(object)victim) { continue; } IEnumerable value = Traverse.Create((object)val).Field("swords").GetValue<IEnumerable>(); if (value == null) { continue; } foreach (object item in value) { GameObject value2 = Traverse.Create(item).Field("sword").GetValue<GameObject>(); if (!((Object)(object)value2 == (Object)null)) { float num2 = Vector2.Distance(Vector2.op_Implicit(value2.transform.position), pos); if (num2 < num) { num = num2; result = val2; lastFoundKind = "sword"; } } } } } return result; } private static void AfterDie(HealthHandler __instance, int __state) { if (__state < 0) { return; } CharacterData val = Data.Invoke(__instance); if ((Object)(object)val == (Object)null || !DeathEdge.IsNewDeath((__state & 1) != 0, (__state & 2) != 0, val.dead, __instance.isRespawning)) { return; } try { Player val2 = Data.Invoke(__instance)?.player; if (!((Object)(object)val2 == (Object)null)) { lastHitter.TryGetValue(val2.playerID, out var value); if ((Object)(object)value == (Object)null || !BarView.Players().Contains(value)) { value = null; } OnDeath(val2, value); } } catch (Exception ex) { if (!warned) { warned = true; Plugin.Log.LogWarning((object)("[fcb] kill feed failed: " + ex)); } } } private static void OnDeath(Player victim, Player killer) { int playerID = victim.playerID; deaths[playerID] = ((!deaths.TryGetValue(playerID, out var value)) ? 1 : (value + 1)); previousPhrase.TryGetValue(playerID, out var value2); if (!previousPhrase.ContainsKey(playerID)) { value2 = -1; } List<string> killerCards = (((Object)(object)killer == (Object)null) ? new List<string>() : (from c in killer.data.currentCards where (Object)(object)c != (Object)null select c.cardName).ToList()); lastHowFor.TryGetValue(playerID, out var value3); KillLine killLine = KillLines.Pick(playerID, deaths[playerID], killer?.playerID, killerCards, value2, ((Object)(object)killer != (Object)null && (Object)(object)killer != (Object)(object)victim) ? value3 : null); previousPhrase[playerID] = killLine.PhraseId; string text = killLine.Format(BarView.NameOf(victim), ((Object)(object)killer != (Object)null) ? BarView.NameOf(killer) : null); Plugin.Log.LogInfo((object)string.Format("[fcb] kill: victim={0} death={1} killer={2} line={3}: {4}", playerID, deaths[playerID], ((Object)(object)killer != (Object)null) ? killer.playerID.ToString() : "-", killLine.PhraseId, text)); if (Plugin.FeedEnabled && (Object)(object)FeedView.Instance != (Object)null) { FeedView.Instance.Add(Colored(killLine, victim, killer)); } if (victim.data.view.IsMine && (Object)(object)BarView.Instance != (Object)null) { BarView.Instance.KillerOfMe = (((Object)(object)killer != (Object)null && (Object)(object)killer != (Object)(object)victim) ? killer.playerID : (-1)); } } private static string Colored(KillLine line, Player victim, Player killer) { return line.Template.Replace("{card}", "<b>" + BarView.Esc(line.Card ?? "?") + "</b>").Replace("{victim}", Name(victim)).Replace("{killer}", ((Object)(object)killer != (Object)null) ? Name(killer) : "?"); static string Name(Player p) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) return "<color=#" + BarView.Hex(BarView.ColorOf(p)) + "><b>" + BarView.Esc(BarView.NameOf(p)) + "</b></color>"; } } private static void Slay(int victimDigit, int killerDigit) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_0086: Unknown result type (might be due to invalid IL or missing references) List<Player> list = BarView.Players(); int? num = Keys.StripForDigit(victimDigit); if (!num.HasValue) { return; } int valueOrDefault = num.GetValueOrDefault(); if (valueOrDefault >= list.Count) { return; } num = Keys.StripForDigit(killerDigit); object obj; if (num.HasValue) { int valueOrDefault2 = num.GetValueOrDefault(); if (valueOrDefault2 < list.Count) { obj = list[valueOrDefault2]; goto IL_0055; } } obj = null; goto IL_0055; IL_0055: Player val = (Player)obj; Player val2 = list[valueOrDefault]; ((Damagable)val2.data.healthHandler).CallTakeDamage(Vector2.up * 100000f, Vector2.op_Implicit(((Component)val2).transform.position), (GameObject)null, val, true); } } internal static class DevCommands { private static readonly bool active = Environment.GetEnvironmentVariable("FCB_DEV") == "1"; private static readonly string file; private static float nextPoll; internal static readonly Dictionary<string, Action<string[]>> Handlers; public static void Poll() { if (!active || Time.unscaledTime < nextPoll) { return; } nextPoll = Time.unscaledTime + 0.5f; try { if (!File.Exists(file)) { File.WriteAllText(file, ""); return; } string[] array = File.ReadAllLines(file); if (array.Length == 0) { return; } File.WriteAllText(file, ""); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Trim().Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (array3.Length == 0) { continue; } Plugin.Log.LogInfo((object)("[fcb] command: " + text.Trim())); if (Handlers.TryGetValue(array3[0], out var value)) { string[] array4 = new string[array3.Length - 1]; Array.Copy(array3, 1, array4, 0, array4.Length); try { value(array4); } catch (Exception ex) { Plugin.Log.LogWarning((object)("[fcb] command failed: " + ex)); } } else { Plugin.Log.LogInfo((object)"[fcb] unknown command"); } } } catch (Exception ex2) { Plugin.Log.LogWarning((object)("[fcb] command file: " + ex2.Message)); } } private static void DumpOldBar() { CardBarHandler instance = CardBarHandler.instance; if ((Object)(object)instance == (Object)null) { Plugin.Log.LogInfo((object)"[fcb] old bar: no handler"); return; } CardBar[] componentsInChildren = ((Component)instance).GetComponentsInChildren<CardBar>(true); foreach (CardBar val in componentsInChildren) { CanvasGroup component = ((Component)val).GetComponent<CanvasGroup>(); Plugin.Log.LogInfo((object)$"[fcb] old bar row {((Object)val).name}: active={((Component)val).gameObject.activeInHierarchy} alpha={(Object.op_Implicit((Object)(object)component) ? component.alpha : 1f)}"); } } static DevCommands() { string configPath = Paths.ConfigPath; string environmentVariable = Environment.GetEnvironmentVariable("FFT_ID"); file = Path.Combine(configPath, "friendscardbar-dev-commands" + ((environmentVariable != null && environmentVariable.Length > 0) ? ("-" + environmentVariable) : "") + ".txt"); Handlers = new Dictionary<string, Action<string[]>> { ["bar"] = delegate(string[] a) { Plugin.SetBar(a.Length != 0 && a[0] == "on"); }, ["feed"] = delegate(string[] a) { Plugin.SetFeed(a.Length != 0 && a[0] == "on"); }, ["oldbar"] = delegate { DumpOldBar(); } }; } } internal sealed class FeedView : MonoBehaviour { internal static FeedView Instance; private const float LineH = 20f; private const float LineW = 640f; private readonly FeedQueue queue = new FeedQueue(); private readonly List<(RectTransform root, Image back, TextMeshProUGUI text)> lines = new List<(RectTransform, Image, TextMeshProUGUI)>(); private RectTransform area; private bool warned; internal static void Create(BarView bar) { if (!((Object)(object)Instance != (Object)null)) { Instance = ((Component)bar).gameObject.AddComponent<FeedView>(); } } private void Start() { //IL_003f: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0047: 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_0059: 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_00d0: Unknown result type (might be due to invalid IL or missing references) BarView instance = BarView.Instance; area = BarView.NewRect("feed", ((Component)instance).transform); RectTransform obj = area; RectTransform obj2 = area; RectTransform obj3 = area; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(1f, 1f); obj3.pivot = val; Vector2 anchorMin = (obj2.anchorMax = val); obj.anchorMin = anchorMin; area.sizeDelta = Vector2.zero; area.anchoredPosition = new Vector2(-12f, -12f); for (int i = 0; i < 5; i++) { RectTransform val3 = BarView.NewRect("line" + i, (Transform)(object)area); Image val4 = ((Component)BarView.NewRect("back", (Transform)(object)val3)).gameObject.AddComponent<Image>(); ((Graphic)val4).color = new Color(0f, 0f, 0f, 0.45f); ((Graphic)val4).raycastTarget = false; TextMeshProUGUI val5 = instance.NewText("text", (Transform)(object)val3, 15, (TextAlignmentOptions)516); ((TMP_Text)val5).enableWordWrapping = false; BarView.Place(((TMP_Text)val5).rectTransform, -640f, 0f, 640f, 20f); ((Component)val3).gameObject.SetActive(false); lines.Add((val3, val4, val5)); } } internal void Add(string coloredText) { queue.Add(coloredText, Time.unscaledTime); } private void Update() { try { Draw(); } catch (Exception ex) { if (!warned) { warned = true; Plugin.Log.LogWarning((object)("[fcb] kill feed failed: " + ex)); } if ((Object)(object)area != (Object)null) { ((Component)area).gameObject.SetActive(false); } } } private void Draw() { //IL_0059: 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_0192: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Expected O, but got Unknown //IL_01ca: