Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of HLGroups v0.6.0
HLGroups.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Net; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using System.Threading; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Splatform; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("HLGroups")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.6.0.0")] [assembly: AssemblyInformationalVersion("0.6.0")] [assembly: AssemblyProduct("HLGroups")] [assembly: AssemblyTitle("HLGroups")] [assembly: AssemblyVersion("0.6.0.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 HLGroups { internal static class VanillaBars { internal enum Kind { Health, Stamina, Eitr } private sealed class Bar { public GameObject Root; public RectTransform RootRect; public GuiBar Fast; public GuiBar Slow; public Vector2 Size; public Vector2 Offset; public int Frame; } private static readonly Dictionary<long, Bar> Bars = new Dictionary<long, Bar>(); private static RectTransform _layout; private static Canvas _canvas; private static bool _failed; private static int _layoutFrame = -1; internal static float Scale = 1f; private static readonly Color StaminaFallback = new Color(1f, 0.8f, 0.1f); private static readonly Color EitrFallback = new Color(0.55f, 0.6f, 1f); internal static bool Place(long memberId, Kind kind, Rect rect, float part) { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.CfgVanillaBars.Value || _failed) { return false; } try { if (!EnsureLayout()) { return false; } long key = memberId * 4 + (long)kind; if (!Bars.TryGetValue(key, out var value) || (Object)(object)value.Root == (Object)null) { if (Bars.Count > 96) { DestroyAll(); } value = Create(kind); Bars[key] = value; } float num = ((Rect)(ref rect)).width / value.Size.x; float num2 = ((Rect)(ref rect)).height / value.Size.y; ((Transform)value.RootRect).localScale = new Vector3(num, num2, 1f); ((Transform)value.RootRect).localPosition = new Vector3(((Rect)(ref rect)).x - value.Offset.x * num, 0f - ((Rect)(ref rect)).y - value.Offset.y * num2, 0f); if (!value.Root.activeSelf) { value.Root.SetActive(true); } part = Mathf.Clamp01(part); value.Fast.SetValue(part); if ((Object)(object)value.Slow != (Object)null) { value.Slow.SetValue(part); } value.Frame = Time.frameCount; return true; } catch (Exception ex) { _failed = true; Plugin.Log.LogWarning((object)("The game's own bar could not be used, drawing plain bars instead. " + ex.GetType().Name + ": " + ex.Message)); DestroyAll(); return false; } } internal static void NewScene() { _failed = false; } internal static void HideAll() { foreach (Bar value in Bars.Values) { if ((Object)(object)value.Root != (Object)null && value.Root.activeSelf) { value.Root.SetActive(false); } } } internal static void LateTick() { if (Bars.Count == 0) { return; } if ((Object)(object)_layout == (Object)null) { Bars.Clear(); return; } int num = Time.frameCount - 1; foreach (Bar value in Bars.Values) { if ((Object)(object)value.Root != (Object)null && value.Frame < num && value.Root.activeSelf) { value.Root.SetActive(false); } } } private static void DestroyAll() { foreach (Bar value in Bars.Values) { if ((Object)(object)value.Root != (Object)null) { Object.Destroy((Object)(object)value.Root); } } Bars.Clear(); } private static bool EnsureLayout() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Expected O, but got Unknown //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_0155: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: 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_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) Hud instance = Hud.instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance.m_rootObject == (Object)null || (Object)(object)EnemyHud.instance == (Object)null) { return false; } if ((Object)(object)_layout == (Object)null) { Bars.Clear(); _layout = (RectTransform)new GameObject("HLGroupsBars", new Type[1] { typeof(RectTransform) }).transform; ((Transform)_layout).SetParent(instance.m_rootObject.transform, false); RectTransform layout = _layout; RectTransform layout2 = _layout; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, 1f); layout2.anchorMax = val; layout.anchorMin = val; _layout.pivot = new Vector2(0f, 1f); _layout.sizeDelta = Vector2.zero; _canvas = instance.m_rootObject.GetComponentInParent<Canvas>(); _layoutFrame = -1; } if (_layoutFrame == Time.frameCount) { return true; } _layoutFrame = Time.frameCount; Transform parent = ((Transform)_layout).parent; RectTransform val2 = (RectTransform)(object)((parent is RectTransform) ? parent : null); if ((Object)(object)val2 == (Object)null) { return false; } Camera val3 = (((Object)(object)_canvas != (Object)null && (int)_canvas.renderMode != 0) ? _canvas.worldCamera : null); Vector3 val4 = default(Vector3); RectTransformUtility.ScreenPointToWorldPointInRectangle(val2, new Vector2(0f, (float)Screen.height), val3, ref val4); Vector3 val5 = default(Vector3); RectTransformUtility.ScreenPointToWorldPointInRectangle(val2, new Vector2(100f, (float)Screen.height), val3, ref val5); float num = Vector3.Distance(val4, val5) / 100f; Vector3 lossyScale = ((Transform)val2).lossyScale; if (num <= 0f || Mathf.Approximately(lossyScale.x, 0f) || Mathf.Approximately(lossyScale.y, 0f)) { return false; } ((Transform)_layout).position = val4; ((Transform)_layout).localScale = new Vector3(Scale * num / lossyScale.x, Scale * num / lossyScale.y, 1f); ((Transform)_layout).SetAsLastSibling(); return true; } private static Color ColorOf(GuiBar source, Color fallback) { //IL_0032: 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) Image val = (((Object)(object)source != (Object)null && (Object)(object)source.m_bar != (Object)null) ? ((Component)source.m_bar).GetComponent<Image>() : null); if (!((Object)(object)val != (Object)null)) { return fallback; } return ((Graphic)val).color; } private static void Paint(GuiBar bar, Color color) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) Image val = (((Object)(object)bar != (Object)null && (Object)(object)bar.m_bar != (Object)null) ? ((Component)bar.m_bar).GetComponent<Image>() : null); if ((Object)(object)val != (Object)null) { ((Graphic)val).color = color; } } private static Bar Create(Kind kind) { //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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) //IL_00d7: Expected O, but got Unknown //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02e9: Unknown result type (might be due to invalid IL or missing references) //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02fc: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_031e: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_035b: 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) //IL_0363: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0245: 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_0295: Unknown result type (might be due to invalid IL or missing references) //IL_029f: Unknown result type (might be due to invalid IL or missing references) //IL_02a4: Unknown result type (might be due to invalid IL or missing references) EnemyHud instance = EnemyHud.instance; GameObject obj = (((Object)(object)instance.m_baseHudPlayer != (Object)null) ? instance.m_baseHudPlayer : instance.m_baseHud); if ((Object)(object)obj == (Object)null) { throw new InvalidOperationException("the game has no bar to copy"); } GameObject val = Object.Instantiate<GameObject>(obj, (Transform)(object)_layout); try { ((Object)val).name = "HLGroups_" + kind; val.SetActive(true); Transform transform = val.transform; RectTransform val2 = (RectTransform)(object)((transform is RectTransform) ? transform : null); Transform obj2 = val.transform.Find("Health"); RectTransform val3 = (RectTransform)(object)((obj2 is RectTransform) ? obj2 : null); if ((Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null) { throw new InvalidOperationException("the copied bar has no 'Health' part"); } ((Transform)val2).localRotation = Quaternion.identity; ((Transform)val2).localScale = Vector3.one; foreach (Transform item in val.transform) { Transform val4 = item; if ((Object)(object)val4 != (Object)(object)val3) { ((Component)val4).gameObject.SetActive(false); } } TMP_Text[] componentsInChildren = ((Component)val3).GetComponentsInChildren<TMP_Text>(true); for (int i = 0; i < componentsInChildren.Length; i++) { ((Component)componentsInChildren[i]).gameObject.SetActive(false); } Graphic[] componentsInChildren2 = val.GetComponentsInChildren<Graphic>(true); for (int i = 0; i < componentsInChildren2.Length; i++) { componentsInChildren2[i].raycastTarget = false; } GuiBar val5 = Find((Transform)(object)val3, "health_fast"); GuiBar val6 = Find((Transform)(object)val3, "health_fast_friendly"); GuiBar val7 = Find((Transform)(object)val3, "health_slow"); GuiBar val8 = (((Object)(object)val6 != (Object)null) ? val6 : val5); if ((Object)(object)val8 == (Object)null) { throw new InvalidOperationException("the copied bar has no 'health_fast' part"); } if ((Object)(object)val5 != (Object)null && (Object)(object)val5 != (Object)(object)val8) { ((Component)val5).gameObject.SetActive(false); } ((Component)val8).gameObject.SetActive(true); if ((Object)(object)val7 != (Object)null) { ((Component)val7).gameObject.SetActive(true); } Hud instance2 = Hud.instance; switch (kind) { case Kind.Stamina: Paint(val8, ColorOf(((Object)(object)instance2 != (Object)null) ? instance2.m_staminaBar2Fast : null, StaminaFallback)); Paint(val7, ColorOf(((Object)(object)instance2 != (Object)null) ? instance2.m_staminaBar2Slow : null, StaminaFallback * 0.6f)); break; case Kind.Eitr: Paint(val8, ColorOf(((Object)(object)instance2 != (Object)null) ? instance2.m_eitrBarFast : null, EitrFallback)); Paint(val7, ColorOf(((Object)(object)instance2 != (Object)null) ? instance2.m_eitrBarSlow : null, EitrFallback * 0.6f)); break; } Canvas.ForceUpdateCanvases(); Vector3[] array = (Vector3[])(object)new Vector3[4]; val3.GetWorldCorners(array); Vector3 val9 = ((Transform)_layout).InverseTransformPoint(array[1]); Vector3 val10 = ((Transform)_layout).InverseTransformPoint(array[3]); Vector2 val11 = default(Vector2); ((Vector2)(ref val11))..ctor(val10.x - val9.x, val9.y - val10.y); if (val11.x < 1f || val11.y < 1f) { throw new InvalidOperationException("the copied bar has no size"); } return new Bar { Root = val, RootRect = val2, Fast = val8, Slow = val7, Size = val11, Offset = new Vector2(val9.x - ((Transform)val2).localPosition.x, val9.y - ((Transform)val2).localPosition.y), Frame = Time.frameCount }; } catch { Object.Destroy((Object)(object)val); throw; } } private static GuiBar Find(Transform frame, string name) { Transform val = frame.Find(name); if (!((Object)(object)val != (Object)null)) { return null; } return ((Component)val).GetComponent<GuiBar>(); } } internal static class Client { internal sealed class Member { public long Id; public string Name = ""; public bool Online; public float Hp; public float MaxHp; public Vector3 Pos; public long Uid; public float Stamina; public float MaxStamina; public float Eitr; public float MaxEitr; public int[] Effects = new int[0]; public byte Ready; public bool HasDeath; public Vector3 DeathPos; public float Dealt; } internal static string GroupName = ""; internal static int GroupColor; internal static int SkillBonus; internal static float BonusRange = 30f; internal static bool ShareExploration; internal static float ShareRadius = 100f; internal static bool ReadyActive; internal static float ReadySecondsLeft; internal static string ReadyBy = ""; internal static bool BonusActive; internal static readonly List<Member> Members = new List<Member>(); internal static int GroupId; internal static long Leader; internal static int MaxSize = 6; internal static bool FriendlyFire; internal static bool AnyMemberCanInvite = true; internal static string InviteFrom; internal static Player HoverTarget; internal static bool HoverHasMod = true; internal static readonly HashSet<long> ModUids = new HashSet<long>(); internal static bool ModListKnown; internal static long MyId; private static float _lastSnapshot = -100f; private static float _nextStatus; private static bool _present; private static string _lastName = ""; private static Vector3 _lastPos; private static float _inviteHiddenUntil; private const float SilenceLimit = 15f; private static readonly HashSet<int> QuietEffects = new HashSet<int> { SEMan.s_statusEffectShelter, SEMan.s_statusEffectCampFire, SEMan.s_statusEffectResting }; private static readonly HashSet<string> CentreMessages = new HashSet<string> { "died", "countdown", "countdown_go", "duel_started", "duel_won", "duel_lost", "duel_draw", "boss_first" }; internal static bool ReadyPending { get { if (!InGroup || !ReadyActive || ReadySecondsLeft <= 0f) { return false; } Member member = Members.FirstOrDefault((Member m) => m.Id == MyId); if (member != null) { return member.Ready == 0; } return false; } } internal static bool ServerPresent => _present; internal static bool InGroup { get { if (ServerPresent) { return GroupId != 0; } return false; } } internal static bool IsLeader { get { if (InGroup) { return Leader == MyId; } return false; } } internal static bool IsMember(long playerId) { if (!InGroup || playerId == 0L) { return false; } for (int i = 0; i < Members.Count; i++) { if (Members[i].Id == playerId) { return true; } } return false; } internal static void Reset() { Members.Clear(); GroupId = 0; Leader = 0L; InviteFrom = null; HoverTarget = null; HoverHasMod = true; ModUids.Clear(); ModListKnown = false; ResetServerRules(); BonusActive = false; DeathPins.Forget(); SharedMap.Forget(); Marks.Forget(); Finder.Reset(); Roster.Reset(); Meter.Reset(); Guilds.Reset(); Duels.Reset(); Admin.Reset(); MyId = 0L; _lastSnapshot = -100f; _present = false; _nextStatus = 0f; _inviteHiddenUntil = 0f; Extra.AnsweredId = 0; Ui.MenuOpen = false; Pins.Forget(); } internal static void Suspend() { Ui.MenuOpen = false; HoverTarget = null; _lastSnapshot = -100f; _present = false; Members.Clear(); GroupId = 0; InviteFrom = null; ResetServerRules(); try { Pins.Sync(); DeathPins.Sync(); Marks.Sync(); if ((Object)(object)Player.m_localPlayer != (Object)null) { Duels.Tick(Player.m_localPlayer); } } catch (Exception e) { Throttle.Warn("switching off", e); } } private static void ResetServerRules() { GroupName = ""; GroupColor = 0; SkillBonus = 0; ShareExploration = false; ReadyActive = false; ReadySecondsLeft = 0f; ReadyBy = ""; Extra.Reset(); Extra5.Reset(); } internal static void Tick() { //IL_0070: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) float realtimeSinceStartup = Time.realtimeSinceStartup; _present = realtimeSinceStartup - _lastSnapshot < 15f; Player localPlayer = Player.m_localPlayer; if ((Object)(object)ZNet.instance == (Object)null || !Net.Ready) { HoverTarget = null; Ui.MenuOpen = false; return; } if ((Object)(object)localPlayer == (Object)null) { HoverTarget = null; Ui.MenuOpen = false; if (MyId != 0L && realtimeSinceStartup >= _nextStatus) { _nextStatus = realtimeSinceStartup + 1f; ZPackage val = new ZPackage(); val.Write((byte)1); val.Write(MyId); val.Write(_lastName); val.Write(0f); val.Write(0f); val.Write(_lastPos); Net.ToServer(val); } return; } MyId = localPlayer.GetPlayerID(); if (realtimeSinceStartup >= _nextStatus) { _nextStatus = realtimeSinceStartup + 1f; SendStatus(localPlayer); } if (!ServerPresent) { Members.Clear(); GroupId = 0; InviteFrom = null; } BonusActive = false; if (InGroup && SkillBonus > 0) { Vector3 position = ((Component)localPlayer).transform.position; foreach (Member member in Members) { if (member.Id != MyId && member.Online && !(Vector3.Distance(position, member.Pos) > BonusRange)) { BonusActive = true; break; } } } try { UpdateHoverTarget(localPlayer); HandleKeys(); } catch (Exception e) { Throttle.Warn("keys", e); } try { Pins.Sync(); DeathPins.Sync(); Marks.Sync(); } catch (Exception e2) { Throttle.Warn("map markers", e2); } try { SharedMap.Tick(); } catch (Exception e3) { Throttle.Warn("shared map", e3); } try { Duels.Tick(localPlayer); } catch (Exception e4) { Throttle.Warn("duel", e4); } } private static void SendStatus(Player me) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0032: Expected O, but got Unknown //IL_006e: Unknown result type (might be due to invalid IL or missing references) if (MyId == 0L) { return; } _lastName = me.GetPlayerName() ?? ""; _lastPos = ((Component)me).transform.position; ZPackage val = new ZPackage(); val.Write((byte)1); val.Write(MyId); val.Write(_lastName); val.Write(((Character)me).GetHealth()); val.Write(((Character)me).GetMaxHealth()); val.Write(((Component)me).transform.position); val.Write(me.GetStamina()); val.Write(((Character)me).GetMaxStamina()); val.Write(me.GetEitr()); val.Write(((Character)me).GetMaxEitr()); List<int> list = ActiveEffects(me); val.Write(list.Count); foreach (int item in list) { val.Write(item); } Net.ToServer(val); } private static List<int> ActiveEffects(Player me) { List<int> list = new List<int>(); SEMan sEMan = ((Character)me).GetSEMan(); if (sEMan == null) { return list; } foreach (StatusEffect statusEffect in sEMan.GetStatusEffects()) { if ((Object)(object)statusEffect == (Object)null || (Object)(object)statusEffect.m_icon == (Object)null) { continue; } int item = statusEffect.NameHash(); if (!QuietEffects.Contains(item) && !list.Contains(item)) { list.Add(item); if (list.Count >= 8) { break; } } } return list; } private static void UpdateHoverTarget(Player me) { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) HoverTarget = null; if (!ServerPresent || Ui.MenuOpen || Ui.Typing() || (Object)(object)GameCamera.instance == (Object)null || InventoryGui.IsVisible() || Minimap.IsOpen() || (InGroup && !IsLeader && !AnyMemberCanInvite) || (InGroup && Members.Count >= MaxSize)) { return; } Transform transform = ((Component)GameCamera.instance).transform; float value = Plugin.CfgInviteRange.Value; Player val = null; float num = 7f; foreach (Player allPlayer in Player.GetAllPlayers()) { if ((Object)(object)allPlayer == (Object)null || (Object)(object)allPlayer == (Object)(object)me || ((Character)allPlayer).IsDead()) { continue; } Vector3 val2 = ((Character)allPlayer).GetCenterPoint() - transform.position; if (!(Vector3.Distance(((Component)allPlayer).transform.position, ((Component)me).transform.position) > value)) { float num2 = Vector3.Angle(transform.forward, val2); if (!(num2 >= num)) { num = num2; val = allPlayer; } } } if (!((Object)(object)val == (Object)null) && !IsMember(val.GetPlayerID())) { HoverTarget = val; HoverHasMod = HasMod(((Character)val).GetOwner()); } } private static void HandleKeys() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_013f: 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_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) bool flag = InventoryGui.IsVisible() || Minimap.IsOpen(); if (Ui.MenuOpen && (flag || Input.GetKeyDown((KeyCode)27))) { Ui.MenuOpen = false; } if (Ui.Typing()) { return; } if (Input.GetKeyDown(Plugin.CfgMenuKey.Value)) { Ui.MenuOpen = !Ui.MenuOpen && !flag; } KeyCode value = Plugin.CfgLookPingKey.Value; if ((int)value != 0 && InGroup && !Ui.MenuOpen && !flag && Input.GetKeyDown(value) && ((int)Plugin.CfgLookPingWith.Value == 0 || Input.GetKey(Plugin.CfgLookPingWith.Value))) { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer != (Object)null && !((Character)localPlayer).IsDead() && !((Character)localPlayer).InPlaceMode() && !Menu.IsVisible() && !StoreGui.IsVisible()) { GroupPing.AtCrosshair(localPlayer); } } if (!Hud.IsUserHidden()) { if (InviteFrom != null) { if (Input.GetKeyDown(Plugin.CfgAcceptKey.Value)) { Respond(accept: true); } else if (Input.GetKeyDown(Plugin.CfgDeclineKey.Value)) { Respond(accept: false); } } else if (Asks.Pending) { if (Input.GetKeyDown(Plugin.CfgAcceptKey.Value)) { Asks.Answer(yes: true, Extra.AskId); } else if (Input.GetKeyDown(Plugin.CfgDeclineKey.Value)) { Asks.Answer(yes: false, Extra.AskId); } } else if (ReadyPending) { if (Input.GetKeyDown(Plugin.CfgAcceptKey.Value)) { AnswerReady(ready: true); } else if (Input.GetKeyDown(Plugin.CfgDeclineKey.Value)) { AnswerReady(ready: false); } } } if (!Ui.MenuOpen && (Object)(object)HoverTarget != (Object)null && HoverHasMod && Input.GetKeyDown(Plugin.CfgInviteKey.Value)) { Invite(((Character)HoverTarget).GetOwner()); } if (!Ui.MenuOpen && !InventoryGui.IsVisible() && !Minimap.IsOpen() && Input.GetKeyDown(Plugin.CfgMarkKey.Value)) { Marks.Toggle(Player.m_localPlayer); } } internal static void Invite(long targetUid) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0009: 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_001c: Expected O, but got Unknown if (targetUid != 0L) { ZPackage val = new ZPackage(); val.Write((byte)2); val.Write(targetUid); Net.ToServer(val); } } internal static void Respond(bool accept) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0018: Expected O, but got Unknown ZPackage val = new ZPackage(); val.Write((byte)3); val.Write(accept); Net.ToServer(val); InviteFrom = null; _inviteHiddenUntil = Time.realtimeSinceStartup + 1.5f; } internal static void Leave() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown ZPackage val = new ZPackage(); val.Write((byte)4); Net.ToServer(val); } internal static void Kick(long playerId) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0018: Expected O, but got Unknown ZPackage val = new ZPackage(); val.Write((byte)5); val.Write(playerId); Net.ToServer(val); } internal static void SendChat(string text) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if (!string.IsNullOrWhiteSpace(text)) { ZPackage val = new ZPackage(); val.Write((byte)7); val.Write(text); Net.ToServer(val); } } internal static void SendPing(Vector3 position, string label = "") { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown ZPackage val = new ZPackage(); val.Write((byte)8); val.Write(position); val.Write(label ?? ""); Net.ToServer(val); } internal static void SendDied(Vector3 position) { //IL_0008: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown if (InGroup) { ZPackage val = new ZPackage(); val.Write((byte)9); val.Write(position); Net.ToServer(val); } } internal static void SendDeathCleared(long ownerId) { //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown if (InGroup && ownerId != 0L) { ZPackage val = new ZPackage(); val.Write((byte)10); val.Write(ownerId); Net.ToServer(val); } } internal static void StartReadyCheck() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ZPackage val = new ZPackage(); val.Write((byte)11); Net.ToServer(val); } internal static void AnswerReady(bool ready) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0019: Expected O, but got Unknown ZPackage val = new ZPackage(); val.Write((byte)12); val.Write(ready); Net.ToServer(val); Member member = Members.FirstOrDefault((Member m) => m.Id == MyId); if (member != null) { member.Ready = (byte)(ready ? 1u : 2u); } } internal static void SetGroupName(string name) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0022: Expected O, but got Unknown ZPackage val = new ZPackage(); val.Write((byte)13); val.Write(name ?? ""); Net.ToServer(val); } internal static void SetGroupColor(int color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0019: Expected O, but got Unknown ZPackage val = new ZPackage(); val.Write((byte)14); val.Write(color); Net.ToServer(val); } internal static void Promote(long playerId) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0018: Expected O, but got Unknown ZPackage val = new ZPackage(); val.Write((byte)6); val.Write(playerId); Net.ToServer(val); } internal static void Handle(ZPackage pkg) { //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) switch ((Net.S)pkg.ReadByte()) { case Net.S.Snapshot: ReadSnapshot(pkg); break; case Net.S.Message: { string text = pkg.ReadString(); string arg = pkg.ReadString(); if ((Object)(object)MessageHud.instance != (Object)null) { MessageHud.instance.ShowMessage((MessageType)((!CentreMessages.Contains(text)) ? 1 : 2), Strings.T(text, Words.Args(arg)), 0, (Sprite)null, false, true); } break; } case Net.S.Chat: pkg.ReadLong(); GroupChat.Show(pkg.ReadString(), pkg.ReadString()); break; case Net.S.Ping: { long fromUid = pkg.ReadLong(); string fromName = pkg.ReadString(); Vector3 position = pkg.ReadVector3(); string label = ((pkg.GetPos() < pkg.Size()) ? pkg.ReadString() : ""); GroupPing.Show(fromUid, fromName, position, label); break; } case Net.S.Teleport: Teleports.Go(pkg.ReadVector3(), pkg.ReadString()); break; case Net.S.Finder: Finder.Read(pkg); break; case Net.S.Roster: Roster.Read(pkg); break; case Net.S.GuildInfo: Guilds.Read(pkg); break; case Net.S.GuildChat: Guilds.ShowChat(pkg.ReadString(), pkg.ReadString()); break; case Net.S.DuelList: Duels.Read(pkg); break; case Net.S.AdminList: Admin.Read(pkg); break; } } private static void ReadSnapshot(ZPackage pkg) { //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0343: Unknown result type (might be due to invalid IL or missing references) //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) _lastSnapshot = Time.realtimeSinceStartup; MaxSize = pkg.ReadInt(); FriendlyFire = pkg.ReadBool(); AnyMemberCanInvite = pkg.ReadBool(); InviteFrom = (pkg.ReadBool() ? pkg.ReadString() : null); if (Time.realtimeSinceStartup < _inviteHiddenUntil) { InviteFrom = null; } ResetServerRules(); Members.Clear(); GroupId = pkg.ReadInt(); if (GroupId == 0) { Leader = 0L; } else { Leader = pkg.ReadLong(); int num = pkg.ReadInt(); for (int i = 0; i < num && i < 32; i++) { Members.Add(new Member { Id = pkg.ReadLong(), Name = pkg.ReadString(), Online = pkg.ReadBool(), Hp = pkg.ReadSingle(), MaxHp = pkg.ReadSingle(), Pos = pkg.ReadVector3(), Uid = pkg.ReadLong() }); } } ModUids.Clear(); ModListKnown = pkg.GetPos() < pkg.Size(); if (!ModListKnown) { return; } int num2 = pkg.ReadInt(); for (int j = 0; j < num2 && j < 256; j++) { ModUids.Add(pkg.ReadLong()); } if (pkg.GetPos() >= pkg.Size()) { return; } int num3 = pkg.ReadInt(); for (int k = 0; k < num3 && k < 32; k++) { float stamina = pkg.ReadSingle(); float maxStamina = pkg.ReadSingle(); if (k < Members.Count) { Members[k].Stamina = stamina; Members[k].MaxStamina = maxStamina; } } if (pkg.GetPos() >= pkg.Size()) { return; } int num4 = pkg.ReadInt(); for (int l = 0; l < num4 && l < 32; l++) { float eitr = pkg.ReadSingle(); float maxEitr = pkg.ReadSingle(); int num5 = Mathf.Clamp(pkg.ReadInt(), 0, 16); int[] array = new int[num5]; for (int m = 0; m < num5; m++) { array[m] = pkg.ReadInt(); } if (l < Members.Count) { Members[l].Eitr = eitr; Members[l].MaxEitr = maxEitr; Members[l].Effects = array; } } if (pkg.GetPos() < pkg.Size()) { SkillBonus = pkg.ReadInt(); BonusRange = pkg.ReadSingle(); ShareExploration = pkg.ReadBool(); ShareRadius = pkg.ReadSingle(); GroupName = pkg.ReadString() ?? ""; GroupColor = pkg.ReadInt(); ReadyActive = pkg.ReadBool(); ReadySecondsLeft = pkg.ReadSingle(); ReadyBy = pkg.ReadString() ?? ""; int num6 = pkg.ReadInt(); for (int n = 0; n < num6 && n < 32; n++) { byte ready = pkg.ReadByte(); bool flag = pkg.ReadBool(); Vector3 deathPos = (flag ? pkg.ReadVector3() : Vector3.zero); if (n < Members.Count) { Members[n].Ready = ready; Members[n].HasDeath = flag; Members[n].DeathPos = deathPos; } } if (pkg.GetPos() < pkg.Size()) { Extra.Read(pkg); } if (pkg.GetPos() < pkg.Size()) { Extra5.Read(pkg); } } Alerts.Check(); } internal static bool HasMod(long uid) { if (ModListKnown) { return ModUids.Contains(uid); } return true; } } internal static class Pins { private static readonly Dictionary<long, PinData> Shown = new Dictionary<long, PinData>(); private static Minimap _map; internal static void Forget() { Shown.Clear(); _map = null; } internal static void Sync() { //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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) Minimap instance = Minimap.instance; if ((Object)(object)instance == (Object)null) { Forget(); return; } if ((Object)(object)_map != (Object)(object)instance) { Shown.Clear(); _map = instance; } HashSet<long> hashSet = new HashSet<long>(); if (Plugin.CfgMapPins.Value && Client.InGroup) { HashSet<long> hashSet2 = new HashSet<long>(); if ((Object)(object)ZNet.instance != (Object)null) { foreach (PlayerInfo player in ZNet.instance.GetPlayerList()) { if (player.m_publicPosition) { ZDOID characterID = player.m_characterID; hashSet2.Add(((ZDOID)(ref characterID)).UserID); } } } foreach (Client.Member member in Client.Members) { if (member.Id == Client.MyId || !member.Online || hashSet2.Contains(member.Uid)) { continue; } hashSet.Add(member.Id); if (Shown.TryGetValue(member.Id, out var value) && value != null) { value.m_pos = member.Pos; continue; } value = instance.AddPin(member.Pos, (PinType)10, member.Name, false, false, 0L, default(PlatformUserID)); if (value != null) { Shown[member.Id] = value; } } } foreach (long item in Shown.Keys.ToList()) { if (!hashSet.Contains(item)) { PinData val = Shown[item]; Shown.Remove(item); if (val != null) { instance.RemovePin(val); } } } } } internal static class GroupChat { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__2_0; internal void <RegisterCommands>b__2_0(ConsoleEventArgs args) { Say(args.ArgsAll); } } private static readonly FieldInfo HideTimer = AccessTools.Field(typeof(Chat), "m_hideTimer"); private static bool _registered; internal static void RegisterCommands() { //IL_005a: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown if (_registered) { return; } _registered = true; string[] array = new string[2] { "g", "p" }; foreach (string obj in array) { object obj2 = <>c.<>9__2_0; if (obj2 == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { Say(args.ArgsAll); }; <>c.<>9__2_0 = val; obj2 = (object)val; } new ConsoleCommand(obj, "HL Groups: say something to your group only", (ConsoleEvent)obj2, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } } private static void Say(string text) { if (Plugin.CfgEnabled.Value) { if (!Client.InGroup) { Tell(Strings.T("chat_no_group")); } else if (string.IsNullOrWhiteSpace(text)) { Tell(Strings.T("chat_usage")); } else { Client.SendChat(text.Trim()); } } } private static void Tell(string text) { if ((Object)(object)MessageHud.instance != (Object)null) { MessageHud.instance.ShowMessage((MessageType)1, text, 0, (Sprite)null, false, true); } } internal static void Line(string line) { Chat instance = Chat.instance; if ((Object)(object)instance == (Object)null) { return; } ((Terminal)instance).AddString(line); try { if (HideTimer != null) { HideTimer.SetValue(instance, 0f); } } catch { } } internal static void Show(string from, string text) { Chat instance = Chat.instance; if ((Object)(object)instance == (Object)null) { return; } from = (from ?? "").Replace("<", "").Replace(">", ""); text = (text ?? "").Replace("<", "").Replace(">", ""); string text2 = (string.IsNullOrEmpty(Client.GroupName) ? Strings.T("chat_tag") : Client.GroupName.Replace("<", "").Replace(">", "")); string text3 = ((Client.GroupColor > 0) ? Palette.Hex(Client.GroupColor) : "#7DFF8A"); ((Terminal)instance).AddString("<color=" + text3 + ">[" + text2 + "] " + from + "</color>: " + text); try { if (HideTimer != null) { HideTimer.SetValue(instance, 0f); } } catch { } } } internal static class GroupPing { private static readonly MethodInfo AddInworldText = AccessTools.Method(typeof(Chat), "AddInworldText", (Type[])null, (Type[])null); internal static string LastText = ""; internal static Vector3 LastAt; private static float _nextLook; private static int _lookMask; internal static void AtCrosshair(Player me) { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) float realtimeSinceStartup = Time.realtimeSinceStartup; if (realtimeSinceStartup < _nextLook || (Object)(object)GameCamera.instance == (Object)null) { return; } if (_lookMask == 0) { _lookMask = LayerMask.GetMask(new string[13] { "Default", "static_solid", "Default_small", "piece", "piece_nonsolid", "terrain", "character", "character_net", "character_ghost", "hitbox", "character_noenv", "vehicle", "item" }); } Transform transform = ((Component)GameCamera.instance).transform; RaycastHit[] array = Physics.RaycastAll(transform.position, transform.forward, 300f, _lookMask, (QueryTriggerInteraction)1); Array.Sort(array, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance)); RaycastHit[] array2 = array; for (int num = 0; num < array2.Length; num++) { RaycastHit val = array2[num]; Collider collider = ((RaycastHit)(ref val)).collider; if ((Object)(object)collider == (Object)null) { continue; } Character componentInParent = ((Component)collider).GetComponentInParent<Character>(); if ((Object)(object)componentInParent == (Object)(object)me) { continue; } Vector3 position = ((RaycastHit)(ref val)).point; string label = ""; if ((Object)(object)componentInParent != (Object)null) { position = componentInParent.GetCenterPoint(); Player val2 = (Player)(object)((componentInParent is Player) ? componentInParent : null); label = ((val2 != null) ? val2.GetPlayerName() : componentInParent.m_name); } else { Container componentInParent2 = ((Component)collider).GetComponentInParent<Container>(); if ((Object)(object)componentInParent2 != (Object)null) { label = componentInParent2.m_name; } else { Hoverable componentInParent3 = ((Component)collider).GetComponentInParent<Hoverable>(); if (componentInParent3 != null) { label = componentInParent3.GetHoverName() ?? ""; } } } _nextLook = realtimeSinceStartup + 0.75f; Client.SendPing(position, label); break; } } internal static void Show(long fromUid, string fromName, Vector3 position, string label = "") { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) Chat instance = Chat.instance; if ((Object)(object)instance == (Object)null || AddInworldText == null) { return; } try { label = (label ?? "").Replace("<", "").Replace(">", "").Trim(); if (label.Length > 0 && Localization.instance != null) { label = Localization.instance.Localize(label).Trim(); } if (label.Length > 48) { label = label.Substring(0, 48); } LastText = label; LastAt = position; UserInfo localUser = UserInfo.GetLocalUser(); localUser.Name = fromName + ((label.Length > 0) ? (" · " + label) : ""); long num = fromUid ^ 0x484C4750; AddInworldText.Invoke(instance, new object[6] { null, num, position, (object)(Type)3, localUser, "" }); } catch (Exception e) { Throttle.Warn("group ping", e); } } } internal static class Alerts { private static readonly Dictionary<long, bool> WasLow = new Dictionary<long, bool>(); private static readonly Dictionary<long, float> LastTold = new Dictionary<long, float>(); internal static bool IsLow(Client.Member member) { if (!Plugin.CfgLowHealthAlert.Value || !member.Online || member.MaxHp <= 0f || member.Hp <= 0f) { return false; } return member.Hp / member.MaxHp < (float)Mathf.Clamp(Plugin.CfgLowHealthPercent.Value, 5, 75) / 100f; } internal static void Check() { foreach (Client.Member member in Client.Members) { if (member.Id == Client.MyId) { continue; } bool flag = IsLow(member); WasLow.TryGetValue(member.Id, out var value); WasLow[member.Id] = flag; if (!flag || value) { continue; } float realtimeSinceStartup = Time.realtimeSinceStartup; if (!LastTold.TryGetValue(member.Id, out var value2) || !(realtimeSinceStartup - value2 < 20f)) { LastTold[member.Id] = realtimeSinceStartup; if ((Object)(object)MessageHud.instance != (Object)null) { MessageHud.instance.ShowMessage((MessageType)2, Strings.T("low_health", member.Name), 0, (Sprite)null, false, true); } } } } } internal static class Palette { internal static readonly Color[] Colors = (Color[])(object)new Color[8] { Color.white, new Color(1f, 0.82f, 0.32f), new Color(0.95f, 0.3f, 0.25f), new Color(1f, 0.6f, 0.2f), new Color(0.45f, 0.9f, 0.45f), new Color(0.35f, 0.9f, 0.95f), new Color(0.45f, 0.6f, 1f), new Color(0.8f, 0.5f, 1f) }; internal static Color Of(int index) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) return Colors[Mathf.Clamp(index, 0, Colors.Length - 1)]; } internal static string Hex(int index) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) return "#" + ColorUtility.ToHtmlStringRGB(Of(index)); } } internal static class DeathPins { private static readonly Dictionary<long, PinData> Shown = new Dictionary<long, PinData>(); private static Minimap _map; internal static void Forget() { Shown.Clear(); _map = null; } internal static void Sync() { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) Minimap instance = Minimap.instance; if ((Object)(object)instance == (Object)null) { Forget(); return; } if ((Object)(object)_map != (Object)(object)instance) { Shown.Clear(); _map = instance; } HashSet<long> hashSet = new HashSet<long>(); if (Plugin.CfgDeathPins.Value && Client.InGroup) { foreach (Client.Member member in Client.Members) { if (member.Id == Client.MyId || !member.HasDeath) { continue; } hashSet.Add(member.Id); if (Shown.TryGetValue(member.Id, out var value) && value != null) { value.m_pos = member.DeathPos; continue; } value = instance.AddPin(member.DeathPos, (PinType)4, member.Name, false, false, 0L, default(PlatformUserID)); if (value != null) { Shown[member.Id] = value; } } } foreach (long item in Shown.Keys.ToList()) { if (!hashSet.Contains(item)) { PinData val = Shown[item]; Shown.Remove(item); if (val != null) { instance.RemovePin(val); } } } } } internal static class SharedMap { private delegate void WorldToPixelFn(Minimap map, Vector3 point, out int px, out int py); private static WorldToPixelFn _toPixel; private static Func<Minimap, int, int, bool> _exploreOthers; private static FieldInfo _pixelSize; private static FieldInfo _textureSize; private static FieldInfo _fog; private static bool _bound; private static bool _usable; private static readonly Dictionary<long, Vector3> LastRevealed = new Dictionary<long, Vector3>(); private static float _nextTick; internal static void Forget() { LastRevealed.Clear(); } private static void Bind() { _bound = true; try { _toPixel = AccessTools.MethodDelegate<WorldToPixelFn>(AccessTools.Method(typeof(Minimap), "WorldToPixel", (Type[])null, (Type[])null), (object)null, true); _exploreOthers = AccessTools.MethodDelegate<Func<Minimap, int, int, bool>>(AccessTools.Method(typeof(Minimap), "ExploreOthers", new Type[2] { typeof(int), typeof(int) }, (Type[])null), (object)null, true); _pixelSize = AccessTools.Field(typeof(Minimap), "m_pixelSize"); _textureSize = AccessTools.Field(typeof(Minimap), "m_textureSize"); _fog = AccessTools.Field(typeof(Minimap), "m_fogTexture"); _usable = _toPixel != null && _exploreOthers != null && _pixelSize != null && _textureSize != null && _fog != null; } catch (Exception ex) { _usable = false; Plugin.Log.LogWarning((object)("Shared exploration is off: the map could not be bound. " + ex.Message)); } } internal static void Tick() { //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) if (!Client.InGroup || !Client.ShareExploration) { return; } float realtimeSinceStartup = Time.realtimeSinceStartup; if (realtimeSinceStartup < _nextTick) { return; } _nextTick = realtimeSinceStartup + 2f; Minimap instance = Minimap.instance; if ((Object)(object)instance == (Object)null) { return; } if (!_bound) { Bind(); } if (!_usable) { return; } foreach (Client.Member member in Client.Members) { if (member.Id != Client.MyId && member.Online && (!LastRevealed.TryGetValue(member.Id, out var value) || !(Vector3.Distance(value, member.Pos) < 8f))) { LastRevealed[member.Id] = member.Pos; Reveal(instance, member.Pos, Client.ShareRadius); } } } private static void Reveal(Minimap map, Vector3 position, float radius) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) float num = Convert.ToSingle(_pixelSize.GetValue(map)); int num2 = Convert.ToInt32(_textureSize.GetValue(map)); if (num <= 0f || num2 <= 0) { return; } int num3 = Mathf.CeilToInt(radius / num); _toPixel(map, position, out var px, out var py); bool flag = false; for (int i = py - num3; i <= py + num3; i++) { if (i < 0 || i >= num2) { continue; } for (int j = px - num3; j <= px + num3; j++) { if (j >= 0 && j < num2) { int num4 = j - px; int num5 = i - py; if (num4 * num4 + num5 * num5 <= num3 * num3 && _exploreOthers(map, j, i)) { flag = true; } } } } if (flag) { object? value = _fog.GetValue(map); Texture2D val = (Texture2D)((value is Texture2D) ? value : null); if (val != null) { val.Apply(); } } } } internal static class Extra { internal static bool Known; internal static bool Teleport; internal static bool TeleportAnyItems; internal static float TeleportWait; internal static bool GroupWards; internal static bool GroupChests; internal static bool FinderOn; internal static byte AskKind; internal static string AskFrom = ""; internal static float AskSecondsLeft; internal static int AskId; internal static int AnsweredId; internal static bool Listed; internal static string Note = ""; internal static bool Marked; internal static ZDOID MarkId = ZDOID.None; internal static Vector3 MarkPos; internal static string MarkName = ""; internal static int MarkLevel = 1; internal static string MarkBy = ""; internal static bool Fight; internal static float FightSeconds; internal static float FightIdle; internal static void Reset() { Known = false; Teleport = false; TeleportAnyItems = false; TeleportWait = 0f; GroupWards = false; GroupChests = false; FinderOn = false; AskKind = 0; AskFrom = ""; AskSecondsLeft = 0f; Listed = false; Note = ""; Marked = false; Fight = false; FightSeconds = 0f; FightIdle = 0f; } internal static void Read(ZPackage pkg) { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) Known = true; Teleport = pkg.ReadBool(); TeleportAnyItems = pkg.ReadBool(); TeleportWait = pkg.ReadSingle(); GroupWards = pkg.ReadBool(); GroupChests = pkg.ReadBool(); FinderOn = pkg.ReadBool(); AskKind = pkg.ReadByte(); if (AskKind != 0) { AskFrom = pkg.ReadString() ?? ""; AskSecondsLeft = pkg.ReadSingle(); AskId = pkg.ReadInt(); if (AskId == AnsweredId) { AskKind = 0; } } Listed = pkg.ReadBool(); Note = pkg.ReadString() ?? ""; Marked = pkg.ReadBool(); if (Marked) { MarkId = pkg.ReadZDOID(); MarkPos = pkg.ReadVector3(); MarkName = pkg.ReadString() ?? ""; MarkLevel = pkg.ReadInt(); MarkBy = pkg.ReadString() ?? ""; } Fight = pkg.ReadBool(); if (!Fight) { return; } FightSeconds = pkg.ReadSingle(); FightIdle = pkg.ReadSingle(); int num = pkg.ReadInt(); for (int i = 0; i < num && i < 32; i++) { float dealt = pkg.ReadSingle(); if (i < Client.Members.Count) { Client.Members[i].Dealt = dealt; } } } } internal static class Asks { internal static bool Pending { get { if (Client.ServerPresent && Extra.AskKind != 0) { return Extra.AskSecondsLeft > 0f; } return false; } } internal static string Question() { return Strings.T((Extra.AskKind == 1) ? "ask_teleport" : ((Extra.AskKind == 2) ? "ask_summon" : ((Extra.AskKind == 4) ? "ask_guild" : ((Extra.AskKind == 5) ? "ask_duel" : "ask_join"))), Words.Title(Extra.AskFrom)); } internal static void Answer(bool yes, int id) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Expected O, but got Unknown if (id != 0 && id != Extra.AnsweredId) { if (yes && Extra.AskKind == 2 && Extra.AskId == id && !Teleports.CanTravel()) { yes = false; } ZPackage val = new ZPackage(); val.Write((byte)16); val.Write(yes); val.Write(id); Net.ToServer(val); Extra.AnsweredId = id; if (Extra.AskId == id) { Extra.AskKind = 0; } } } } internal static class Teleports { internal static bool CanTravel() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || ((Character)localPlayer).IsDead()) { return false; } if (!((Humanoid)localPlayer).IsTeleportable(Extra.TeleportAnyItems)) { ((Character)localPlayer).Message((MessageType)2, "$msg_noteleport", 0, (Sprite)null, false); return false; } return CanPay(localPlayer); } private static string CostName() { if (Extra5.CostAmount <= 0 || string.IsNullOrEmpty(Extra5.CostItem) || (Object)(object)ObjectDB.instance == (Object)null) { return null; } GameObject itemPrefab = ObjectDB.instance.GetItemPrefab(Extra5.CostItem); ItemDrop val = (((Object)(object)itemPrefab != (Object)null) ? itemPrefab.GetComponent<ItemDrop>() : null); if (!((Object)(object)val != (Object)null)) { return null; } return val.m_itemData.m_shared.m_name; } internal static string CostText() { string text = CostName(); if (text != null) { return Extra5.CostAmount + " x " + Words.Game(text); } return ""; } private static bool CanPay(Player me) { string text = CostName(); if (text == null || ((Humanoid)me).GetInventory().CountItems(text, -1, true) >= Extra5.CostAmount) { return true; } if ((Object)(object)MessageHud.instance != (Object)null) { MessageHud.instance.ShowMessage((MessageType)2, Strings.T("teleport_cost_missing", CostText()), 0, (Sprite)null, false, true); } return false; } private static void Pay(Player me) { string text = CostName(); if (text != null) { ((Humanoid)me).GetInventory().RemoveItem(text, Extra5.CostAmount, -1, true); } } internal static void Ask(long memberId, bool summon) { //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown if (summon || CanTravel()) { ZPackage val = new ZPackage(); val.Write((byte)15); val.Write(memberId); val.Write(summon); Net.ToServer(val); } } internal static void Go(Vector3 position, string toName) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Expected O, but got Unknown //IL_0045: 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) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (!((Object)(object)localPlayer == (Object)null) && !((Character)localPlayer).IsDead() && CanTravel()) { if (((Character)localPlayer).IsAttached()) { ((Character)localPlayer).AttachStop(); } bool flag = false; if (!((Character)localPlayer).IsAttached() && !((Character)localPlayer).InBed()) { bool flag2 = Vector3.Distance(((Component)localPlayer).transform.position, position) > 60f; flag = ((Character)localPlayer).TeleportTo(position + Vector3.up * 0.25f, ((Component)localPlayer).transform.rotation, flag2); } if (flag) { Pay(localPlayer); ZPackage val = new ZPackage(); val.Write((byte)39); Net.ToServer(val); } if ((Object)(object)MessageHud.instance != (Object)null) { MessageHud.instance.ShowMessage((MessageType)1, Strings.T(flag ? "teleport_going" : "teleport_failed", toName), 0, (Sprite)null, false, true); } } } } internal static class Marks { private static PinData _pin; private static ZDOID _pinFor = ZDOID.None; private static Minimap _map; private static Character _cached; private static ZDOID _cachedId = ZDOID.None; private static float _nextLookup; internal static void Forget() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) _pin = null; _map = null; _cached = null; _cachedId = ZDOID.None; } internal static Character Target() { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0042: 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_0077: Unknown result type (might be due to invalid IL or missing references) if (!Extra.Marked) { return null; } bool flag = _cachedId == Extra.MarkId; if (flag && (Object)(object)_cached != (Object)null) { return _cached; } float realtimeSinceStartup = Time.realtimeSinceStartup; if (flag && realtimeSinceStartup < _nextLookup) { return null; } _cachedId = Extra.MarkId; _nextLookup = realtimeSinceStartup + 0.5f; _cached = null; ZNetScene instance = ZNetScene.instance; if ((Object)(object)instance == (Object)null || ZDOMan.instance == null) { return null; } GameObject val = instance.FindInstance(Extra.MarkId); _cached = (((Object)(object)val != (Object)null) ? val.GetComponent<Character>() : null); return _cached; } internal static Vector3 Above(Character target) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) try { return target.GetTopPoint() + Vector3.up * 0.6f; } catch { return ((Component)target).transform.position + Vector3.up * 2.5f; } } internal static string Label() { string text = Extra.MarkName ?? ""; try { if (Localization.instance != null) { text = Localization.instance.Localize(text); } } catch { } if (Extra.MarkLevel > 1) { text = text + " " + new string('*', Mathf.Min(Extra.MarkLevel - 1, 5)); } return text; } internal static void Toggle(Player me) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)me == (Object)null || !Client.InGroup || !Extra.Known) { return; } Character val = Pick(me); ZNetView val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<ZNetView>() : null); if ((Object)(object)val2 == (Object)null || !val2.IsValid()) { if (Extra.Marked) { Send(set: false, ZDOID.None, Vector3.zero, "", 1); } return; } ZDOID uid = val2.GetZDO().m_uid; if (Extra.Marked && uid == Extra.MarkId) { Send(set: false, ZDOID.None, Vector3.zero, "", 1); return; } Player val3 = (Player)(object)((val is Player) ? val : null); string name = ((val3 != null) ? val3.GetPlayerName() : val.m_name); Send(set: true, uid, ((Component)val).transform.position, name, val.GetLevel()); } private static void Send(bool set, ZDOID id, Vector3 position, string name, int level) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) ZPackage val = new ZPackage(); val.Write((byte)17); val.Write(set); if (set) { val.Write(id); val.Write(position); val.Write(name ?? ""); val.Write(level); } Net.ToServer(val); } private static bool CanMark(Character candidate, Player me) { if ((Object)(object)candidate == (Object)null || (Object)(object)candidate == (Object)(object)me || candidate.IsDead()) { return false; } Player val = (Player)(object)((candidate is Player) ? candidate : null); if (val != null) { return !Client.IsMember(val.GetPlayerID()); } return true; } private static Character Pick(Player me) { //IL_0057: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) Character hoverCreature = me.GetHoverCreature(); if (CanMark(hoverCreature, me)) { return hoverCreature; } if ((Object)(object)GameCamera.instance == (Object)null) { return null; } Transform transform = ((Component)GameCamera.instance).transform; Character result = null; float num = 4f; foreach (Character allCharacter in Character.GetAllCharacters()) { if (!CanMark(allCharacter, me)) { continue; } Vector3 val = allCharacter.GetCenterPoint() - transform.position; if (!(((Vector3)(ref val)).magnitude > 80f)) { float num2 = Vector3.Angle(transform.forward, val); if (!(num2 >= num)) { num = num2; result = allCharacter; } } } return result; } internal static void Sync() { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) Minimap instance = Minimap.instance; if ((Object)(object)instance == (Object)null) { _pin = null; _map = null; return; } if ((Object)(object)_map != (Object)(object)instance) { _pin = null; _map = instance; } if (!Plugin.CfgMark.Value || !Plugin.CfgMarkPin.Value || !Client.InGroup || !Extra.Marked) { if (_pin != null) { instance.RemovePin(_pin); } _pin = null; return; } if (_pin != null && _pinFor != Extra.MarkId) { instance.RemovePin(_pin); _pin = null; } Character val = Target(); Vector3 val2 = (((Object)(object)val != (Object)null) ? ((Component)val).transform.position : Extra.MarkPos); if (_pin == null) { _pin = instance.AddPin(val2, (PinType)9, Label(), false, false, 0L, default(PlatformUserID)); _pinFor = Extra.MarkId; } else { _pin.m_pos = val2; } } } internal static class Meter { private struct LastHit { public long PlayerId; public float At; } private static readonly Dictionary<long, float> Credits = new Dictionary<long, float>(); private static readonly Dictionary<int, LastHit> LastHits = new Dictionary<int, LastHit>(); private static float _nextFlush; internal static void Reset() { Credits.Clear(); LastHits.Clear(); } internal static long LastAttacker(Character victim) { if ((Object)(object)victim == (Object)null) { return 0L; } if (!LastHits.TryGetValue(((Object)victim).GetInstanceID(), out var value) || !(Time.realtimeSinceStartup - value.At < 15f)) { return 0L; } return value.PlayerId; } internal static void Record(Character victim, HitData hit, float lost) { //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Invalid comparison between Unknown and I4 //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 if ((Object)(object)victim == (Object)null || lost <= 0f || victim.IsPlayer() || victim.IsTamed()) { return; } float realtimeSinceStartup = Time.realtimeSinceStartup; int instanceID = ((Object)victim).GetInstanceID(); long num = 0L; if (hit != null) { Character attacker = hit.GetAttacker(); Player val = (Player)(object)((attacker is Player) ? attacker : null); if (val != null) { num = val.GetPlayerID(); if (num != 0L) { if (LastHits.Count > 300) { LastHits.Clear(); } LastHits[instanceID] = new LastHit { PlayerId = num, At = realtimeSinceStartup }; } goto IL_00cc; } } if (hit != null && ((int)hit.m_hitType == 5 || (int)hit.m_hitType == 7) && LastHits.TryGetValue(instanceID, out var value) && realtimeSinceStartup - value.At < 15f) { num = value.PlayerId; } goto IL_00cc; IL_00cc: if (num != 0L) { Credits.TryGetValue(num, out var value2); Credits[num] = value2 + lost; } } internal static void Tick() { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown float realtimeSinceStartup = Time.realtimeSinceStartup; if (realtimeSinceStartup < _nextFlush) { return; } _nextFlush = realtimeSinceStartup + 1f; if (Credits.Count == 0) { return; } if ((Object)(object)ZNet.instance == (Object)null || !Net.Ready) { Credits.Clear(); return; } if (ZNet.instance.IsDedicated()) { foreach (KeyValuePair<long, float> credit in Credits) { Server.Credit(credit.Key, credit.Value); } } else if (Client.ServerPresent && Extra.Known) { ZPackage val = new ZPackage(); val.Write((byte)18); val.Write(Mathf.Min(Credits.Count, 32)); int num = 0; foreach (KeyValuePair<long, float> credit2 in Credits) { if (num++ >= 32) { break; } val.Write(credit2.Key); val.Write(credit2.Value); } Net.ToServer(val); } Credits.Clear(); } internal static void AskReset() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ZPackage val = new ZPackage(); val.Write((byte)19); Net.ToServer(val); } } internal static class Finder { internal sealed class Entry { public int Id; public string Name = ""; public int Color; public string Leader = ""; public bool LeaderOnline; public int Count; public int Max; public string Note = ""; } internal static readonly List<Entry> Groups = new List<Entry>(); private static float _nextRequest; internal static void Reset() { Groups.Clear(); _nextRequest = 0f; } internal static void RequestList() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown float realtimeSinceStartup = Time.realtimeSinceStartup; if (!(realtimeSinceStartup < _nextRequest)) { _nextRequest = realtimeSinceStartup + 3f; ZPackage val = new ZPackage(); val.Write((byte)20); Net.ToServer(val); } } internal static void Read(ZPackage pkg) { Groups.Clear(); int num = pkg.ReadInt(); for (int i = 0; i < num && i < 100; i++) { Groups.Add(new Entry { Id = pkg.ReadInt(), Name = (pkg.ReadString() ?? ""), Color = pkg.ReadInt(), Leader = (pkg.ReadString() ?? ""), LeaderOnline = pkg.ReadBool(), Count = pkg.ReadInt(), Max = pkg.ReadInt(), Note = (pkg.ReadString() ?? "") }); } } internal static void Set(bool listed, string note) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown ZPackage val = new ZPackage(); val.Write((byte)21); val.Write(listed); val.Write(note ?? ""); Net.ToServer(val); _nextRequest = 0f; } internal static void Join(int groupId) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0019: Expected O, but got Unknown ZPackage val = new ZPackage(); val.Write((byte)22); val.Write(groupId); Net.ToServer(val); } } internal static class Roster { private static readonly Dictionary<long, int> GroupOf = new Dictionary<long, int>(); private static readonly Dictionary<long, int> GuildOf = new Dictionary<long, int>(); private static readonly Dictionary<int, string> GuildTags = new Dictionary<int, string>(); private static readonly Dictionary<int, int> GuildColors = new Dictionary<int, int>(); private static bool _guildsTold; private static bool OnServer { get { if ((Object)(object)ZNet.instance != (Object)null) { return ZNet.instance.IsServer(); } return false; } } internal static bool Wards { get { if (!OnServer) { if (Client.ServerPresent) { return Extra.GroupWards; } return false; } return Plugin.CfgGroupWards.Value; } } internal static bool Chests { get { if (!OnServer) { if (Client.ServerPresent) { return Extra.GroupChests; } return false; } return Plugin.CfgGroupChests.Value; } } internal static bool GuildWards { get { if (!OnServer) { if (Client.ServerPresent) { return Extra5.GuildWards; } return false; } return Plugin.CfgGuildWards.Value; } } internal static bool GuildsKnown { get { if (!OnServer) { if (Client.ServerPresent) { return _guildsTold; } return false; } return true; } } internal static void Reset() { GroupOf.Clear(); GuildOf.Clear(); GuildTags.Clear(); GuildColors.Clear(); _guildsTold = false; } internal static int GroupIdOf(long playerId) { if (playerId == 0L) { return 0; } if (OnServer) { return Server.GroupIdOf(playerId); } if (!GroupOf.TryGetValue(playerId, out var value)) { return 0; } return value; } internal static int GuildIdOf(long playerId) { if (playerId == 0L) { return 0; } if (OnServer) { return Server.GuildIdOf(playerId); } if (!GuildOf.TryGetValue(playerId, out var value)) { return 0; } return value; } internal static bool GuildExists(int guildId) { if (!OnServer) { return GuildTags.ContainsKey(guildId); } return Server.GuildExists(guildId); } internal static bool SameGuild(long a, long b) { if (a == 0L || b == 0L || a == b) { return false; } int num = GuildIdOf(a); if (num != 0) { return num == GuildIdOf(b); } return false; } internal static string TagOfGuild(int guildId) { if (!GuildTags.TryGetValue(guildId, out var value)) { return ""; } return value; } internal static bool TagOf(long playerId, out string tag, out int color) { tag = ""; color = 0; if (!GuildOf.TryGetValue(playerId, out var value) || !GuildTags.TryGetValue(value, out tag)) { return false; } GuildColors.TryGetValue(value, out color); return tag.Length > 0; } internal static void Read(ZPackage pkg) { GroupOf.Clear(); int num = pkg.ReadInt(); for (int i = 0; i < num && i < 2000; i++) { int value = pkg.ReadInt(); int num2 = pkg.ReadInt(); for (int j = 0; j < num2 && j < 64; j++) { GroupOf[pkg.ReadLong()] = value; } } GuildOf.Clear(); GuildTags.Clear(); GuildColors.Clear(); _guildsTold = false; if (pkg.GetPos() >= pkg.Size()) { return; } _guildsTold = true; int num3 = pkg.ReadInt(); for (int k = 0; k < num3 && k < 2000; k++) { int num4 = pkg.ReadInt(); GuildTags[num4] = pkg.ReadString() ?? ""; GuildColors[num4] = pkg.ReadInt(); int num5 = pkg.ReadInt(); for (int l = 0; l < num5 && l < 250; l++) { GuildOf[pkg.ReadLong()] = num4; } } } internal static bool Same(long a, long b) { if (a == 0L || b == 0L || a == b) { return false; } if (OnServer) { return Server.SameGroup(a, b); } if (GroupOf.TryGetValue(a, out var value) && GroupOf.TryGetValue(b, out var value2)) { return value == value2; } return false; } } internal static class Extra5 { internal static bool Known; internal static bool GuildsOn; internal static bool GuildFriendlyFire; internal static bool GuildWards; internal static bool DuelsOn; internal static bool Scaling; internal static float ScaleHealth; internal static float ScaleDamage; internal static float ScaleLoot; internal static float ScaleRange = 50f; internal static string CostItem = ""; internal static int CostAmount; internal static bool IsAdmin; internal static int GuildId; internal static string GuildName = ""; internal static string GuildTag = ""; internal static int GuildColor; internal static byte GuildRank; internal static bool InDuel; internal static int EnemyGroup; internal static string EnemyName = ""; internal static int MyScore; internal static int TheirScore; internal static float DuelSecondsLeft; internal static int DuelTarget; internal static bool Arena; internal static Vector3 ArenaCentre; internal static float ArenaRadius; internal static readonly List<string> Bosses = new List<string>(); internal static int BossBonus; internal static void Reset() { Known = false; GuildsOn = false; GuildFriendlyFire = true; GuildWards = false; DuelsOn = false; Scaling = false; CostItem = ""; CostAmount = 0; IsAdmin = false; GuildId = 0; GuildName = ""; GuildTag = ""; GuildColor = 0; GuildRank = 0; InDuel = false; EnemyGroup = 0; EnemyName = ""; Arena = false; Bosses.Clear(); BossBonus = 0; } internal static void Read(ZPackage pkg) { //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) Known = true; GuildsOn = pkg.ReadBool(); GuildFriendlyFire = pkg.ReadBool(); GuildWards = pkg.ReadBool(); DuelsOn = pkg.ReadBool(); Scaling = pkg.ReadBool(); ScaleHealth = pkg.ReadSingle(); ScaleDamage = pkg.ReadSingle(); ScaleLoot = pkg.ReadSingle(); ScaleRange = pkg.ReadSingle(); CostItem = pkg.ReadString() ?? ""; CostAmount = pkg.ReadInt(); IsAdmin = pkg.ReadBool(); GuildId = pkg.ReadInt(); if (GuildId != 0) { GuildName = pkg.ReadString() ?? ""; GuildTag = pkg.ReadString() ?? ""; GuildColor = pkg.ReadInt(); GuildRank = pkg.ReadByte(); } InDuel = pkg.ReadBool(); if (InDuel) { EnemyGroup = pkg.ReadInt(); EnemyName = pkg.ReadString() ?? ""; MyScore = pkg.ReadInt(); TheirScore = pkg.ReadInt(); DuelSecondsLeft = pkg.ReadSingle(); DuelTarget = pkg.ReadInt(); } Arena = pkg.ReadBool(); if (Arena) { ArenaCentre = pkg.ReadVector3(); ArenaRadius = pkg.ReadSingle(); } int num = pkg.ReadInt(); for (int i = 0; i < num && i < 64; i++) { Bosses.Add(pkg.ReadString() ?? ""); } BossBonus = pkg.ReadInt(); } } internal static class Words { internal static string Title(string raw) { if (string.IsNullOrEmpty(raw)) { return ""; } if (raw[0] != '~') { return raw; } return Strings.T("finder_group_of", raw.Substring(1)); } internal static string Game(string token) { if (string.IsNullOrEmpty(token) || token[0] != '$') { return token ?? ""; } try { return (Localization.instance != null) ? Localization.instance.Localize(token) : token; } catch { return token; } } internal static object[] Args(string arg) { return ((IEnumerable<string>)(arg ?? "").Split(new char[1] { '\t' })).Select((Func<string, object>)((string part) => Game(Title(part)))).ToArray(); } internal static string Bosses(IEnumerable<string> tokens) { return string.Join(", ", tokens.Select(Game)); } } internal static class Guilds { internal sealed class Member { public long Id; public string Name = ""; public byte Rank; public bool Online; } [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static ConsoleEvent <>9__22_0; public static ConsoleEvent <>9__22_1; internal void <RegisterCommands>b__22_0(ConsoleEventArgs args) { Say(args.ArgsAll); } internal void <RegisterCommands>b__22_1(ConsoleEventArgs args) { Vault.Toggle(); } } internal static bool InGuild; internal static string Name = ""; internal static string Tag = ""; internal static int Color; internal static long Leader; internal static int Max = 30; internal static readonly List<Member> Members = new List<Member>(); internal static readonly List<string> Bosses = new List<string>(); private static float _nextRequest; private static bool _registered; internal static void Reset() { InGuild = false; Members.Clear(); Bosses.Clear(); _nextRequest = 0f; } private static void Send(Net.C op, Action<ZPackage> fill = null) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown ZPackage val = new ZPackage(); val.Write((byte)op); fill?.Invoke(val); Net.ToServer(val); _nextRequest = 0f; } internal static void RequestInfo() { //IL_000f: 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_0021: Expected O, but got Unknown float realtimeSinceStartup = Time.realtimeSinceStartup; if (!(realtimeSinceStartup < _nextRequest)) { ZPackage val = new ZPackage(); val.Write((byte)29); Net.ToServer(val); _nextRequest = realtimeSinceStartup + 3f; } } internal static void Read(ZPackage pkg) { Members.Clear(); Bosses.Clear(); InGuild = pkg.ReadBool(); if (InGuild) { pkg.ReadInt(); Name = pkg.ReadString() ?? ""; Tag = pkg.ReadString() ?? ""; Color = pkg.ReadInt(); Leader = pkg.ReadLong(); Max = pkg.ReadInt(); int num = pkg.ReadInt(); for (int i = 0; i < num && i < 250; i++) { Members.Add(new Member { Id = pkg.ReadLong(), Name = (pkg.ReadString() ?? ""), Rank = pkg.ReadByte(), Online = pkg.ReadBool() }); } int num2 = pkg.ReadInt(); for (int j = 0; j < num2 && j < 64; j++) { Bosses.Add(pkg.ReadString() ?? ""); } } } internal static void Create(string name, string tag) { Send(Net.C.GuildCreate, delegate(ZPackage pkg) { pkg.Write(name ?? ""); pkg.Write(Languages.Upper(tag ?? "")); }); } internal static void Invite(long uid) { Send(Net.C.GuildInvite, delegate(ZPackage pkg) { pkg.Write(uid); }); } internal static void Leave() { Send(Net.C.GuildLeave); } internal static void Kick(long playerId) { Send(Net.C.GuildKick, delegate(ZPackage pkg) { pkg.Write(playerId); }); } internal static void Disband() { Send(Net.C.GuildDisband); } internal static void SetColor(int color) { Send(Net.C.GuildColor, delegate(ZPackage pkg) { pkg.Write(color); }); } internal static void SetRank(long playerId, byte rank) { Send(Net.C.GuildRank, delegate(ZPackage pkg) { pkg.Write(playerId); pkg.Write(rank); }); } internal static void RegisterCommands() { //IL_0041: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown if (_registered) { return; } _registered = true; object obj = <>c.<>9__22_0; if (obj == null) { ConsoleEvent val = delegate(ConsoleEventArgs args) { Say(args.ArgsAll); }; <>c.<>9__22_0 = val; obj = (object)val; } new ConsoleCommand("gu", "HL Groups: say something to your guild only", (ConsoleEvent)obj, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); object obj2 = <>c.<>9__22_1; if (obj2 == null) { ConsoleEvent val2 = delegate { Vault.Toggle(); }; <>c.<>9__22_1 = val2; obj2 = (object)val2; } new ConsoleCommand("gvault", "HL Groups: make the chest you are looking at your guild's vault, or stop it being one", (ConsoleEvent)obj2, false, false, false, false, false, false, (ConsoleOptionsFetcher)null, false, false, false); } private static void Say(string text) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown if (Plugin.CfgEnabled.Value) { if (!Client.ServerPresent || Extra5.GuildId == 0) { Vault.Tell(Strings.T("guild_none")); return; } if (string.IsNullOrWhiteSpace(text)) { Vault.Tell(Strings.T("guild_chat_usage")); return; } ZPackage val = new ZPackage(); val.Write((byte)30); val.Write(text.Trim()); Net.ToServer(val); } } internal static void ShowChat(string from, string text) { string text2 = ((Extra5.GuildColor > 0) ? Palette.Hex(Extra5.GuildColor) : "#7DC8FF"); string text3 = (Extra5.GuildTag ?? "").Replace("<", "").Replace(">", ""); GroupChat.Line("<color=" + text2 + ">[" + text3 + "] " + (from ?? "").Replace("<", "").Replace(">", "") + "</color>: " + (text ?? "").Replace("<", "").Replace(">", "")); } } internal static class Vault { internal static readonly int Key = StringExtensionMethods.GetStableHashCode("HLG_guild_vault"); internal static void Tell(string text) { if ((Object)(object)MessageHud.instance != (Object)null) { MessageHud.instance.ShowMessage((MessageType)1, text, 0, (Sprite)null, false, true); } } internal static int Of(Container container) { ZNetView val = (((Object)(object)container != (Object)null) ? ((Component)container).GetComponent<ZNetView>() : null); ZDO val2 = (((Object)(object)val != (Object)null && val.IsValid()) ? val.GetZDO() : null); int num = ((val2 != null) ? val2.GetInt(Key, 0) : 0); if (num == 0 || !Roster.GuildsKnown || !Roster.GuildExists(num)) { return 0; } return num; } internal static bool MayOpen(Container container, int vault, long playerId) { if (playerId == 0L) { return false; } if (Roster.GuildIdOf(playerId) == vault) { return true; } Piece val = (((Object)(object)container != (Object)null) ? ((Component)container).GetComponent<Piece>() : null); if ((Object)(object)val != (Object)null) { return val.GetCreator() == playerId; } return false; } internal static void Toggle() { Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || !Plugin.CfgEnabled.Value) { return; } if (!Client.ServerPresent || Extra5.GuildId == 0) { Tell(Strings.T("guild_none")); return; } if (Extra5.GuildRank == 0) { Tell(Strings.T("guild_no_rank")); return; } GameObject hoverObject = ((Humanoid)localPlayer).GetHoverObject(); Container val = (((Object)(object)hoverObject != (Object)null) ? hoverObject.GetComponentInParent<Container>() : null); ZNetView val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<ZNetView>() : null); if ((Object)(object)val2 == (Object)null || !val2.IsValid()) { Tell(Strings.T("vault_look")); return; } if (val.IsInUse()) { Tell((Localization.instance != null) ? Localization.instance.Localize("$msg_inuse") : "In use"); return; } int num = Of(val); if (num == Extra5.GuildId) { val2.ClaimOwnership(); val2.GetZDO().Set(Key, 0, false); Tell(Strings.T("vault_cleared")); return; } if (num != 0) { Tell(Strings.T("vault_other")); return; } Piece component = ((Component)val).GetComponent<Piece>(); if ((Object)(object)component == (Object)null || !component.IsCreator()) { Tell(Strings.T("vault_not_yours")); return; } val2.ClaimOwnership(); val2.GetZDO().Set(Key, Extra5.GuildId, false); Tell(Strings.T("vault_set", Extra5.GuildName)); } } internal static class Duels { internal sealed class Entry { public int Id; public string Title = ""; public int Count; public bool LeaderOnline; public bool Busy; } internal static readonly List<Entry> Groups = new List<Entry>(); private static float _nextRequest; private static bool _forced; private static bool _before; private static PinData _pin; private static Minimap _map; internal static bool PvpHeld => _forced; internal static void Reset() { Groups.Clear(); _nextRequest = 0f; if (_forced && (Object)(object)InventoryGui.instance != (Object)null && (Object)(object)InventoryGui.instance.m_pvp != (Object)null) { InventoryGui.instance.m_pvp.SetIsOnWithoutNotify(_before); } _forced = false; _pin = null; _map = null; } internal static void RequestList() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown float realtimeSinceStartup = Time.realtimeSinceStartup; if (!(realtimeSinceStartup < _nextRequest)) { _nextRequest = realtimeSinceStartup + 3f; ZPackage val = new ZPackage(); val.Write((byte)32); Net.ToServer(val); } } internal static void Read(ZPackage pkg) { Groups.Clear(); int num = pkg.ReadInt(); for (int i = 0; i < num && i < 100; i++) { Groups.Add(new Entry { Id = pkg.ReadInt(), Title = (pkg.ReadString() ?? ""), Count = pkg.ReadInt(), LeaderOnline = pkg.ReadBool(), Busy = pkg.ReadBool() }); } } internal static void Challenge(int groupId) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0019: Expected O, but got Unknown ZPackage val = new ZPackage(); val.Write((byte)33); val.Write(groupId); Net.ToServer(val); } internal static void GiveUp() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result typ