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 Valheinshi v0.53.25
plugins/Valheinshi/Valheinshi.dll
Decompiled 6 days 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.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Newtonsoft.Json; using SoftReferenceableAssets; using Splatform; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.Sprites; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")] [assembly: AssemblyCompany("Valheinshi")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Valheinshi")] [assembly: AssemblyTitle("Valheinshi")] [assembly: AssemblyVersion("1.0.0.0")] namespace ValheimSquad; public readonly struct ClimateReading { public readonly bool Cold; public readonly bool Freezing; public readonly bool Wet; public ClimateReading(bool cold, bool freezing, bool wet) { Cold = cold; Freezing = freezing; Wet = wet; } } public static class ActorClimate { public sealed class Scope : IDisposable { private readonly ClimateReading? previous; public Scope(Vector3 position) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) previous = current; current = At(position); } public void Dispose() { current = previous; } } private static readonly MethodInfo Select = AccessTools.Method(typeof(EnvMan), "SelectWeightedEnvironment", (Type[])null, (Type[])null); private static readonly FieldInfo Duration = AccessTools.Field(typeof(EnvMan), "m_environmentDuration"); private static readonly FieldInfo Corners = AccessTools.Field(typeof(Heightmap), "m_cornerBiomes"); private static readonly Dictionary<BiomeSector, EnvSetup> cached = new Dictionary<BiomeSector, EnvSetup>(); private static long period = long.MinValue; private static ZNet world; private static ClimateReading? current; public static ClimateReading? Current => current; public static void Clear() { cached.Clear(); period = long.MinValue; world = null; current = null; } public static ClimateReading At(Vector3 position) { //IL_0153: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Invalid comparison between Unknown and I4 //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Invalid comparison between Unknown and I4 //IL_0126: 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_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Invalid comparison between Unknown and I4 //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) EnvMan instance = EnvMan.instance; if (!Object.op_Implicit((Object)(object)instance) || !Object.op_Implicit((Object)(object)ZNet.instance)) { return new ClimateReading(cold: false, freezing: false, wet: false); } long num = ZNet.instance.GetTime().Ticks / 10000000 / Math.Max(1L, (long)Duration.GetValue(instance)); if ((Object)(object)world != (Object)(object)ZNet.instance || num != period) { cached.Clear(); world = ZNet.instance; period = num; } Heightmap val = Heightmap.FindHeightmap(position); Biome val2 = Heightmap.FindBiome(position); BiomeSector val3 = null; if (Object.op_Implicit((Object)(object)val) && Corners.GetValue(val) is IEnumerable<BiomeSector> enumerable) { foreach (BiomeSector item in enumerable) { if (item != null && item.Biome == val2) { val3 = item; break; } } } EnvSetup value = null; if (val3 != null && !cached.TryGetValue(val3, out value)) { List<EnvEntry> availableEnvironments = instance.GetAvailableEnvironments(val3); if (availableEnvironments != null && availableEnvironments.Count > 0) { State state = Random.state; try { Random.InitState((int)num); object? obj = Select.Invoke(instance, new object[1] { availableEnvironments }); value = (EnvSetup)((obj is EnvSetup) ? obj : null); } finally { Random.state = state; } if (value != null) { cached[val3] = value; } } } if (value == null && instance.GetCurrentBiome() == val2) { value = instance.GetCurrentEnvironment(); } bool flag = EnvMan.IsNight(); if (value != null) { return new ClimateReading(value.m_isCold || (flag && value.m_isColdAtNight), value.m_isFreezing || (flag && value.m_isFreezingAtNight), value.m_isWet); } bool flag2 = (int)val2 == 4 || (int)val2 == 64; return new ClimateReading(flag || flag2, flag2, (int)val2 == 2); } } [HarmonyPatch(typeof(Player), "UpdateEnvStatusEffects")] internal static class SurvivorLocalClimate { private static void Prefix(Player __instance, out ActorClimate.Scope __state) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) __state = (Plugin.Ready ? new ActorClimate.Scope(((Component)__instance).transform.position) : null); } private static Exception Finalizer(Exception __exception, ActorClimate.Scope __state) { __state?.Dispose(); return __exception; } } [HarmonyPatch(typeof(EnvMan), "IsCold")] internal static class ActorLocalCold { private static void Postfix(ref bool __result) { if (ActorClimate.Current.HasValue) { __result = ActorClimate.Current.Value.Cold; } } } [HarmonyPatch(typeof(EnvMan), "IsFreezing")] internal static class ActorLocalFreezing { private static void Postfix(ref bool __result) { if (ActorClimate.Current.HasValue) { __result = ActorClimate.Current.Value.Freezing; } } } [HarmonyPatch(typeof(EnvMan), "IsWet")] internal static class ActorLocalWet { private static void Postfix(ref bool __result) { if (ActorClimate.Current.HasValue) { __result = ActorClimate.Current.Value.Wet; } } } [BepInPlugin("Valheinshi", "Valheinshi", "0.53.25")] public sealed class Plugin : BaseUnityPlugin { private sealed class AltItem { public Component Target; public string Text; public Rect Rect; public float Distance; } private sealed class UiBuildStock { public readonly BuildResources Stock = new BuildResources(); public Vector3 Point; public Character Preferred; public float Until; } private sealed class WorldMessage { public Character Source; public Vector3 Point; public string Text; public float Until; public bool Speech; public Dictionary<string, int> Levels; public Dictionary<int, int> Reputation; } private readonly List<AltItem> altItems = new List<AltItem>(); private readonly List<AltItem> altRects = new List<AltItem>(); private readonly HashSet<Component> altSeen = new HashSet<Component>(); private readonly HashSet<long> altCells = new HashSet<long>(); private readonly Collider[] altBuffer = (Collider[])(object)new Collider[1024]; private static readonly FieldInfo Picked = AccessTools.Field(typeof(Pickable), "m_picked"); private static readonly FieldInfo PickedItem = AccessTools.Field(typeof(PickableItem), "m_picked"); private float altScan; private bool altClick; private Sprite merchantCoinIcon; private float survivorMedicineScan; private string constructionTool = "Hammer"; private bool constructionOpen; private bool buildValid; private Piece buildChoice; private PieceTable buildTable; private readonly BuildResources buildResources = new BuildResources(); private float buildRefresh; private Vector3 buildResourcePoint; private Character buildPreferred; private string buildReason = ""; private bool buildHasPoint; private Player buildPlayer; private readonly DemolitionHighlight demolitionHighlight = new DemolitionHighlight(); private readonly Dictionary<ZDOID, ZNetView> pendingDemolition = new Dictionary<ZDOID, ZNetView>(); private readonly List<ZDOID> oldDemolition = new List<ZDOID>(); private readonly List<Container> demolitionContainers = new List<Container>(); private float demolitionErrorAfter; private Piece repairTarget; private float repairRefresh; private readonly HashSet<string> missingEquipment = new HashSet<string>(); private bool factionsOpen; private Vector2 factionsScroll; private GUIStyle factionTitle; private GUIStyle factionText; private GUIStyle factionMuted; private GUIStyle factionHeading; private int houseValidationRotation = -1; private Vector3 houseAnchor; private const float HudHeight = 225f; private GUIStyle infoSmall; private GUIStyle infoName; private GUIStyle infoNumbers; private GUIStyle infoCost; private GUIStyle infoValue; private GUIStyle infoStat; private static readonly FieldInfo TooltipObject = AccessTools.Field(typeof(UITooltip), "m_tooltip"); private static readonly FieldInfo TooltipOwner = AccessTools.Field(typeof(UITooltip), "m_current"); private static readonly Regex TooltipTags = new Regex("<[^>]*>", RegexOptions.Compiled); private readonly Vector3[] tooltipCorners = (Vector3[])(object)new Vector3[4]; private GameObject tooltipCached; private TMP_Text[] tooltipLabels; private GUIStyle tooltipTitle; private GUIStyle tooltipBody; private CanvasGroup tooltipHidden; private float tooltipPreviousAlpha; private CharacterJobs survivorJobs; private CraftingStation editedBase; private string editedBaseName; private bool basesOpen; private bool markingBase; private Vector2 basesScroll; private BodyHealth contextTarget; private BodyHealth rightTarget; private Bed contextBed; private Rect contextRect; private float rightBegan; private bool rightPending; private bool confirmDefeat; private static readonly string[] MedicalCommands = new string[9] { "Conversar", "Seguir", "Curar", "Alimentar", "Carregar", "Soltar", "Inventário", "Finalizar", "Atacar" }; private GUIStyle healthBarLabel; private FejdStartup versionMenu; private int versionMenuScene = int.MinValue; private float nextVersionMenuSearch; private GUIStyle versionMenuStyle; private string versionMenuText; private MiningPitPlan pitPlan; private int pitValidatedRotation = -1; private int characterEscapeFrame = -1; private readonly Dictionary<string, UiBuildStock> buildUiStocks = new Dictionary<string, UiBuildStock>(); public static Plugin Instance; public static bool Strategic; public ConfigEntry<int> Price; public ConfigEntry<bool> Encounters; public ConfigEntry<float> AltRadius; public ConfigEntry<float> EncounterInterval; public ConfigEntry<float> EncounterRespawnDelay; public ConfigEntry<int> AltLimit; public ConfigEntry<float> CombatInterval; public ConfigEntry<bool> SyncPace; public ConfigEntry<bool> KeepSquadAreas; private ConfigEntry<KeyCode> toggle; private Harmony harmony; private Character selected; private Character inspected; private Navigation playerNav; private Orders playerOrders; private Player player; private bool awaitingSurvivor; private bool sessionAttached; private bool strategyInitialized; private ConfigEntry<bool> startInSquad; private Vector3 center; private float zoom = 22f; private float yaw; private float pitch = 60f; private float encounterTimer = 60f; public static GameObject HumanPrefab; private GameObject prefabRoot; private int encounterOrigin; private PrisonBed contextPrison; private string regionalTooltip; private static readonly Color[] regionalColors = (Color[])(object)new Color[3] { new Color(0.15f, 0.39f, 0.14f), new Color(0.85f, 0.72f, 0.2f), new Color(0.62f, 0.12f, 0.1f) }; private readonly ModifierTap shiftTap = new ModifierTap(); private readonly HashSet<Character> group = new HashSet<Character>(); private bool dragging; private bool skillsOpen; private bool dragAdditive; private Vector2 dragStart; private Vector2 rosterScroll; private Rect bar; private Rect inventoryRect; private GUIStyle nameStyle; private readonly List<Character> roster = new List<Character>(); private readonly HashSet<Character> rosterSeen = new HashSet<Character>(); private int rosterFrame = -1; private Character rosterPlayer; private Skills cachedPanelSkills; private string cachedSkillLanguage; private float nextPanelSkillRefresh; private readonly List<Skill> panelSkillRows = new List<Skill>(); private readonly Dictionary<SkillType, string> panelSkillNames = new Dictionary<SkillType, string>(); private Vector2 skillScroll; private GUIStyle factionNameStyle; private GUIStyle characterNameStyle; private GUIStyle effectTitleStyle; private GUIStyle characterBodyStyle; private GUIStyle effectChipStyle; private GUIStyle compactStatStyle; private GUIStyle characterValueStyle; private GUIStyle characterSectionStyle; private GUIStyle characterStatusStyle; private string characterHover; private Character lastCharacterPanelSubject; private static readonly Color PanelAccent = new Color(0.28f, 0.82f, 0.88f); private static readonly Color PanelMuted = new Color(0.65f, 0.66f, 0.63f); private readonly Rect[] hudBlocks = (Rect[])(object)new Rect[5]; private Rect hudRoster; private Rect hudModes; private Rect hudShortcuts; private static readonly float[] HudBlockWidths = new float[5] { 348f, 145f, 0f, 0f, 0f }; private GUIStyle hudButton; private GUIStyle hudCaption; private GUIStyle hudCardButton; private static Texture2D[] paceIcons; private (float left, float dock, int width, int height, int jobs, int roster) hudLayoutInputs; private Sprite hudBackground; private InventoryGui hudBackgroundOwner; private bool hudHelpOpen; private readonly Dictionary<string, PinData> mapPins = new Dictionary<string, PinData>(); private readonly HashSet<string> deadMapMembers = new HashSet<string>(); private readonly Dictionary<string, PinData> deathMapPins = new Dictionary<string, PinData>(); private readonly Dictionary<string, MapRecord> sessionDeaths = new Dictionary<string, MapRecord>(); private readonly HashSet<string> removedDeaths = new HashSet<string>(); private long deathWorld; private MapRecords records = new MapRecords(); private Player mapPlayer; private string mapKey; private float mapTimer; private Sprite squadMapIcon; private Sprite cameraMapIcon; private Image smallCameraMarker; private Image largeCameraMarker; private static readonly FieldInfo SmallMap = AccessTools.Field(typeof(Minimap), "m_mapImageSmall"); private static readonly FieldInfo LargeMap = AccessTools.Field(typeof(Minimap), "m_mapImageLarge"); private static readonly FieldInfo PixelSize = AccessTools.Field(typeof(Minimap), "m_pixelSize"); private static readonly FieldInfo TextureSize = AccessTools.Field(typeof(Minimap), "m_textureSize"); private static readonly FieldInfo LargeRoot = AccessTools.Field(typeof(Minimap), "m_largeRoot"); private static readonly FieldInfo SmallNames = AccessTools.Field(typeof(Minimap), "m_pinNameRootSmall"); private static readonly FieldInfo LargeNames = AccessTools.Field(typeof(Minimap), "m_pinNameRootLarge"); private static readonly FieldInfo DeathPin = AccessTools.Field(typeof(Minimap), "m_deathPin"); private static readonly FieldInfo[] SurvivorMarkers = new FieldInfo[2] { AccessTools.Field(typeof(Minimap), "m_smallMarker"), AccessTools.Field(typeof(Minimap), "m_largeMarker") }; private static readonly MethodInfo CreateName = AccessTools.Method(typeof(Minimap), "CreateMapNamePin", (Type[])null, (Type[])null); private readonly Dictionary<GameObject, bool> nativeMapMarkers = new Dictionary<GameObject, bool>(); private GUIStyle cardText; private GUIStyle vitalText; private GUIStyle modeText; private Character lastRosterClick; private float lastRosterClickTime; private static readonly string[] stealthIconNames = new string[3] { "sneak_hidden", "sneak_alerted", "sneak_detected" }; private readonly Sprite[] stealthSprites = (Sprite[])(object)new Sprite[3]; private Hud stealthIconHud; private Character survivorThreat; private bool survivorFighting; private float survivorScan; private Vector3 survivorBattleOrigin; private bool cameraTracksUnit = true; private Character cameraFollowTarget; private readonly RaycastHit[] cameraSupports = (RaycastHit[])(object)new RaycastHit[24]; private Character hoveredWorld; private readonly List<WorldMessage> worldMessages = new List<WorldMessage>(); private GUIStyle worldMessageStyle; private bool AltHeld { get { if (Application.isFocused) { if (!Input.GetKey((KeyCode)308)) { return Input.GetKey((KeyCode)307); } return true; } return false; } } private Vector3 AltOrigin { get { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (!IsSquad(selected)) { return center; } return ((Component)selected).transform.position; } } public float BuildHudClearance { get { //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_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) float num = Screen.height; Rect val = HealthHudBounds(); float y = ((Rect)(ref val)).y; val = SquadHudBounds(); return num - Mathf.Min(y, ((Rect)(ref val)).y) + 12f; } } public Character StatusOwner { get { if (!IsSquad(selected)) { return (Character)(object)player; } return selected; } } public bool ConstructionActive { get { if (constructionOpen && Ready) { return Strategic; } return false; } } private bool BuildZoom { get { if (constructionOpen && Object.op_Implicit((Object)(object)buildChoice) && !buildChoice.m_repairPiece && !NativeBuildMenu.IsDemolition(buildChoice) && !Input.GetKey((KeyCode)304)) { return Input.GetKey((KeyCode)303); } return true; } } private bool Demolishing { get { if (constructionOpen) { return NativeBuildMenu.IsDemolition(buildChoice); } return false; } } public Vector3 DungeonFocus => center; public Humanoid InventoryOwner { get { Character obj = InventorySelection.Owner(selected, group, IsSquad); return (Humanoid)(object)((obj is Humanoid) ? obj : null); } } public static bool Ready { get { if (Object.op_Implicit((Object)(object)ZNet.instance) && ZNet.IsSinglePlayer) { if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return Strategic; } return true; } return false; } } public static bool Blocked { get { if (!SquadSleep.Active && !NpcDialogue.Visible && !BaseMarket.Visible && !NativeSplitUi.Active && !Menu.IsVisible() && !Minimap.IsOpen() && !StoreGui.IsVisible() && !TextInput.IsVisible() && !Console.IsVisible() && (!Object.op_Implicit((Object)(object)Chat.instance) || !Chat.instance.HasFocus()) && !NativeInventoryBridge.EditingText) { if (Time.timeScale == 0f) { return !TacticalPause.Active; } return false; } return true; } } public static bool MovementBlocked { get { if (!BaseMarket.Visible && !Menu.IsVisible() && !StoreGui.IsVisible() && !TextInput.IsVisible() && !Console.IsVisible() && (!Object.op_Implicit((Object)(object)Chat.instance) || !Chat.instance.HasFocus())) { return Time.timeScale == 0f; } return true; } } public Vector3 ViewFocus => center; private bool InventoryCharacterPanel { get { if (InventoryGui.IsVisible() && Object.op_Implicit((Object)(object)NativeInventoryBridge.Actor)) { return IsSquad((Character)(object)NativeInventoryBridge.Actor); } return false; } } private Character CharacterPanelSubject { get { if (!InventoryCharacterPanel || (skillsOpen && Object.op_Implicit((Object)(object)inspected) && !IsSquad(inspected))) { if (!Object.op_Implicit((Object)(object)inspected)) { return selected; } return inspected; } return (Character)(object)NativeInventoryBridge.Actor; } } private bool CharacterPanelVisible { get { Rect rect; if (!skillsOpen) { return TryDockedCharacterPanel(out rect); } return true; } } public Character SurvivorCombatTarget => playerOrders?.CombatTarget; internal Collider SurvivorHiveCollider => playerOrders?.HiveCollider; private static Vector3 AltPosition(Component target) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) Character val = (Character)(object)((target is Character) ? target : null); if (val == null) { return target.transform.position + Vector3.up * 0.3f; } return CharacterAnchor.Head(val) + Vector3.up * 0.3f; } private bool HasPersistentName(Component target) { Character val = (Character)(object)((target is Character) ? target : null); if (val != null) { if (!IsSquad(val)) { return IsInspectedExternal(val); } return true; } return false; } private void ClearAltLabels() { altItems.Clear(); altRects.Clear(); altScan = 0f; if (!Input.GetMouseButton(0) && !Input.GetMouseButton(1)) { altClick = false; } } private static bool Available(Component component) { if (!Object.op_Implicit((Object)(object)component) || !component.gameObject.activeInHierarchy) { return false; } ItemDrop val = (ItemDrop)(object)((component is ItemDrop) ? component : null); if (val != null) { if (val.m_itemData != null) { return val.m_itemData.m_stack > 0; } return false; } if (component is Pickable) { return !(bool)Picked.GetValue(component); } if (component is PickableItem) { return !(bool)PickedItem.GetValue(component); } Character val2 = (Character)(object)((component is Character) ? component : null); if (val2 != null) { return !val2.IsDead(); } return false; } private void UpdateAltItems() { //IL_0054: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) if (!AltHeld) { ClearAltLabels(); } else { if (Time.unscaledTime < altScan) { return; } altScan = Time.unscaledTime + 0.35f; altItems.Clear(); altSeen.Clear(); Camera main = Camera.main; if (!Object.op_Implicit((Object)(object)main)) { return; } Vector3 altOrigin = AltOrigin; float value = AltRadius.Value; int count = Physics.OverlapSphereNonAlloc(altOrigin, value, altBuffer, LayerMask.GetMask(new string[1] { "item" }), (QueryTriggerInteraction)2); AddAltHits(count, altOrigin, value, main); int num = ~LayerMask.GetMask(new string[5] { "terrain", "water", "UI", "character_ghost", "vehicle" }); count = Physics.OverlapSphereNonAlloc(altOrigin, value, altBuffer, num, (QueryTriggerInteraction)2); AddAltHits(count, altOrigin, value, main); foreach (Character allCharacter in Character.GetAllCharacters()) { if (Object.op_Implicit((Object)(object)allCharacter)) { Vector3 val = ((Component)allCharacter).transform.position - altOrigin; if (((Vector3)(ref val)).sqrMagnitude <= value * value) { AddAltTarget((Component)(object)allCharacter, altOrigin, value, main); } } } altItems.Sort((AltItem a, AltItem b) => a.Distance.CompareTo(b.Distance)); if (altItems.Count > AltLimit.Value) { altItems.RemoveRange(AltLimit.Value, altItems.Count - AltLimit.Value); } foreach (AltItem altItem in altItems) { Component target = altItem.Target; ItemDrop val2 = (ItemDrop)(object)((target is ItemDrop) ? target : null); if (val2 != null) { altItem.Text = Localization.instance.Localize(val2.m_itemData.m_shared.m_name) + ((val2.m_itemData.m_stack > 1) ? (" ×" + val2.m_itemData.m_stack) : ""); continue; } Component target2 = altItem.Target; Pickable val3 = (Pickable)(object)((target2 is Pickable) ? target2 : null); if (val3 != null) { altItem.Text = Localization.instance.Localize(val3.GetHoverName()); continue; } Component target3 = altItem.Target; PickableItem val4 = (PickableItem)(object)((target3 is PickableItem) ? target3 : null); if (val4 != null) { altItem.Text = Localization.instance.Localize(val4.GetHoverName()); continue; } Component target4 = altItem.Target; Character val5 = (Character)(object)((target4 is Character) ? target4 : null); if (val5 != null) { Player val6 = (Player)(object)((val5 is Player) ? val5 : null); altItem.Text = ((val6 != null) ? val6.GetPlayerName() : Localization.instance.Localize(val5.m_name)); } } } } private void AddAltHits(int count, Vector3 origin, float radius, Camera camera) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < count; i++) { Collider val = altBuffer[i]; if (Object.op_Implicit((Object)(object)val)) { Component val2 = (Component)(object)((Component)val).GetComponentInParent<ItemDrop>(); if (!Object.op_Implicit((Object)(object)val2)) { val2 = (Component)(object)((Component)val).GetComponentInParent<Pickable>(); } if (!Object.op_Implicit((Object)(object)val2)) { val2 = (Component)(object)((Component)val).GetComponentInParent<PickableItem>(); } if (!Object.op_Implicit((Object)(object)val2)) { val2 = (Component)(object)DownedBodyProxy.Resolve((Component)(object)val); } AddAltTarget(val2, origin, radius, camera); } } } private void AddAltTarget(Component target, Vector3 origin, float radius, Camera camera) { //IL_0026: 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_0031: 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_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_004a: 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_0056: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)target) && !HasPersistentName(target) && altSeen.Add(target)) { Vector3 val = target.transform.position - origin; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; Vector3 val2 = camera.WorldToViewportPoint(AltPosition(target)); if (HighlightPolicy.Eligible(sqrMagnitude, radius, val2.x, val2.y, val2.z) && Available(target)) { altItems.Add(new AltItem { Target = target, Distance = sqrMagnitude }); } } } private bool HandleAltItemClick() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0061: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) if (altClick) { if (!Input.GetMouseButton(0) && !Input.GetMouseButton(1)) { altClick = false; } return true; } if (!AltHeld || (!Input.GetMouseButtonDown(0) && !Input.GetMouseButtonDown(1)) || PointerOnHud()) { return false; } Vector2 mouse = new Vector2(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y); AltItem altItem = altRects.LastOrDefault((AltItem v) => ((Rect)(ref v.Rect)).Contains(mouse) && Available(v.Target) && !HasPersistentName(v.Target)); if (altItem == null) { return false; } altClick = true; Component target = altItem.Target; Character val = (Character)(object)((target is Character) ? target : null); if (val != null) { if (IsSquad(val)) { SelectOne(val); } else { Inspect(val); } return true; } if (!IsSquad(selected)) { WorldNotice("Selecione um membro do esquadrão para coletar.", null, speech: false, altItem.Target.transform.position + Vector3.up); return true; } Vector3 val2 = altItem.Target.transform.position - AltOrigin; if (((Vector3)(ref val2)).sqrMagnitude > AltRadius.Value * AltRadius.Value) { return true; } if ((Object)(object)selected == (Object)(object)player) { playerOrders.Collect(altItem.Target); } else { ((Component)selected).GetComponent<SquadAgent>().Collect(altItem.Target); } return true; } private static long AltCell(int x, int y) { return ((long)x << 32) ^ (uint)y; } private bool ReserveAltRect(Rect rect) { int num = Mathf.FloorToInt(((Rect)(ref rect)).xMin / 96f); int num2 = Mathf.FloorToInt(((Rect)(ref rect)).xMax / 96f); int num3 = Mathf.FloorToInt(((Rect)(ref rect)).yMin / 23f); int num4 = Mathf.FloorToInt(((Rect)(ref rect)).yMax / 23f); for (int i = num; i <= num2; i++) { for (int j = num3; j <= num4; j++) { if (altCells.Contains(AltCell(i, j))) { return false; } } } for (int k = num; k <= num2; k++) { for (int l = num3; l <= num4; l++) { altCells.Add(AltCell(k, l)); } } return true; } private void DrawAltItems() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_011a: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Expected O, but got Unknown //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02be: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_0362: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) if ((int)Event.current.type != 7) { return; } altRects.Clear(); altCells.Clear(); if (!AltHeld || Blocked) { return; } Camera main = Camera.main; if (!Object.op_Implicit((Object)(object)main)) { return; } Vector3 altOrigin = AltOrigin; float value = AltRadius.Value; Color color = GUI.color; Color backgroundColor = GUI.backgroundColor; GUI.backgroundColor = Color.black; Rect val4 = default(Rect); foreach (AltItem altItem in altItems) { if (!Object.op_Implicit((Object)(object)altItem.Target) || HasPersistentName(altItem.Target)) { continue; } Vector3 val = altItem.Target.transform.position - altOrigin; if (((Vector3)(ref val)).sqrMagnitude > value * value || !Available(altItem.Target) || string.IsNullOrEmpty(altItem.Text)) { continue; } Vector3 val2 = main.WorldToScreenPoint(AltPosition(altItem.Target)); if (val2.z <= 0f || val2.x < 0f || val2.x > (float)Screen.width || val2.y < 148f || val2.y > (float)Screen.height) { continue; } Component target = altItem.Target; Character val3 = (Character)(object)((target is Character) ? target : null); bool flag = val3 != null && BaseMarket.Merchant(val3); float num = Mathf.Clamp(GUI.skin.box.CalcSize(new GUIContent(altItem.Text)).x + 14f + (float)(flag ? 20 : 0), 80f, 260f); ((Rect)(ref val4))..ctor(Mathf.Clamp(val2.x - num / 2f, 4f, (float)Screen.width - num - 4f), Mathf.Clamp((float)Screen.height - val2.y - 20f, 4f, (float)(Screen.height - 172)), num, 21f); bool flag2 = false; for (int i = 0; i < 10; i++) { if (((Rect)(ref val4)).y < 4f) { break; } if (ReserveAltRect(val4)) { flag2 = true; break; } ((Rect)(ref val4)).y = ((Rect)(ref val4)).y - 23f; } if (flag2 && !((Rect)(ref val4)).Overlaps(HealthHudBounds()) && !SquadHudOverlaps(val4)) { altItem.Rect = val4; altRects.Add(altItem); GUI.color = (((Rect)(ref val4)).Contains(new Vector2(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y)) ? Color.cyan : Color.yellow); if (flag) { GUI.Box(val4, ""); GUI.Label(new Rect(((Rect)(ref val4)).x + 24f, ((Rect)(ref val4)).y, ((Rect)(ref val4)).width - 26f, ((Rect)(ref val4)).height), altItem.Text); GUI.color = Color.white; DrawMerchantCoin(new Rect(((Rect)(ref val4)).x + 4f, ((Rect)(ref val4)).y + 2f, 17f, 17f)); } else { GUI.Box(val4, altItem.Text); } } } GUI.color = color; GUI.backgroundColor = backgroundColor; } private void DrawMerchantCoin(Rect rect) { //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)merchantCoinIcon) && Object.op_Implicit((Object)(object)ObjectDB.instance)) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("Coins"); object obj; if (itemPrefab == null) { obj = null; } else { ItemDrop component = itemPrefab.GetComponent<ItemDrop>(); obj = ((component != null) ? component.m_itemData.GetIcon() : null); } merchantCoinIcon = (Sprite)obj; } if (Object.op_Implicit((Object)(object)merchantCoinIcon)) { Texture2D texture = merchantCoinIcon.texture; Rect textureRect = merchantCoinIcon.textureRect; GUI.DrawTextureWithTexCoords(rect, (Texture)(object)texture, new Rect(((Rect)(ref textureRect)).x / (float)((Texture)texture).width, ((Rect)(ref textureRect)).y / (float)((Texture)texture).height, ((Rect)(ref textureRect)).width / (float)((Texture)texture).width, ((Rect)(ref textureRect)).height / (float)((Texture)texture).height)); } } private bool TrySurvivorMedicine() { if (Time.time < survivorMedicineScan) { return false; } survivorMedicineScan = Time.time + 2f; if (playerOrders.Active || playerNav.Active) { return false; } return AutomaticMedicine.TrySelf((Humanoid)(object)player); } private void StartBedTask(Humanoid actor, bool self) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)actor)) { WorldNotice(self ? ModText.Get("Selecione um personagem consciente para deitar.") : ModText.Get("Selecione quem está carregando um paciente."), null, speech: false, ((Component)contextBed).transform.position + Vector3.up * 1.5f); return; } BodyHealth bodyHealth = BodyHealth.BedOccupant(contextBed); if (Object.op_Implicit((Object)(object)bodyHealth)) { WorldNotice(((Object)(object)bodyHealth.Body == (Object)(object)actor && self) ? ModText.Get("Já estou descansando nesta cama.") : ModText.Get("A cama já está ocupada."), (Character)(object)actor); return; } BodyHealth.WakeForCommand((Character)(object)actor); if ((Object)(object)actor == (Object)(object)player) { ClearSurvivorCombat((Character)(object)player); playerOrders.Cancel(); } else { ((Component)actor).GetComponent<SquadAgent>()?.Stop(); } MedicalTask medicalTask = ((Component)actor).GetComponent<MedicalTask>(); if (!Object.op_Implicit((Object)(object)medicalTask)) { medicalTask = ((Component)actor).gameObject.AddComponent<MedicalTask>(); } medicalTask.BeginBed(actor, contextBed, self); } private void DrawBedMenu() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((Component)contextBed).GetComponent<PrisonBed>())) { DrawPrisonMenu(); return; } GUILayout.BeginArea(contextRect, GUI.skin.box); GUILayout.Label("Cama — repouso", Array.Empty<GUILayoutOption>()); BodyHealth bodyHealth = BodyHealth.BedOccupant(contextBed); if (Object.op_Implicit((Object)(object)bodyHealth)) { GUILayout.Label(ModText.Get("Ocupante: ") + Name((Character)(object)bodyHealth.Body), Array.Empty<GUILayoutOption>()); } if (GUILayout.Button(ModText.Get("Deitar"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { Character? obj = CommandUnits().Where(delegate(Character c) { if (BodyHealth.Incapacitated(c)) { BodyHealth bodyHealth2 = BodyHealth.Of(c); if (bodyHealth2 == null || !bodyHealth2.PlayingDead) { return false; } } return (Object)(object)BodyHealth.Of(c)?.Passenger == (Object)null; }).OrderBy(delegate(Character c) { //IL_0006: 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_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) Vector3 val = ((Component)c).transform.position - ((Component)contextBed).transform.position; return ((Vector3)(ref val)).sqrMagnitude; }).FirstOrDefault(); Humanoid actor = (Humanoid)(object)((obj is Humanoid) ? obj : null); StartBedTask(actor, self: true); contextBed = null; } else if (GUILayout.Button(ModText.Get("Colocar personagem carregado"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { Character? obj2 = (from c in CommandUnits() where !BodyHealth.Incapacitated(c) && Object.op_Implicit((Object)(object)BodyHealth.Of(c)?.Passenger) select c).OrderBy(delegate(Character c) { //IL_0006: 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_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) Vector3 val = ((Component)c).transform.position - ((Component)contextBed).transform.position; return ((Vector3)(ref val)).sqrMagnitude; }).FirstOrDefault(); Humanoid actor2 = (Humanoid)(object)((obj2 is Humanoid) ? obj2 : null); StartBedTask(actor2, self: false); contextBed = null; } else if (Object.op_Implicit((Object)(object)bodyHealth) && bodyHealth.SquadControlled && GUILayout.Button(ModText.Get("Levantar"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) })) { WorldNotice(bodyHealth.GetOutOfBed() ? ModText.Get("Vou me levantar.") : ModText.Get("Ainda está incapacitado; é necessário carregá-lo."), (Character)(object)bodyHealth.Body); contextBed = null; } else if (GUILayout.Button(ModText.Get("Fechar"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(25f) })) { contextBed = null; } GUILayout.EndArea(); } public void MedicalLog(string value) { ((BaseUnityPlugin)this).Logger.LogWarning((object)value); } public void RangedStateNotice(Humanoid body, Character enemy, ItemData weapon, string status, string obstacle) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) object? value = AccessTools.Field(typeof(Humanoid), "m_currentAttack").GetValue(body); Attack val = (Attack)((value is Attack) ? value : null); ItemData ammoItem = body.GetAmmoItem(); ManualLogSource logger = ((BaseUnityPlugin)this).Logger; string[] obj = new string[22] { "Diagnóstico de tiro: ", ((Character)body).m_name, "; estado=", status, "; alvo=", Object.op_Implicit((Object)(object)enemy) ? enemy.m_name : "nenhum", "; distância=", Object.op_Implicit((Object)(object)enemy) ? Vector3.Distance(((Component)body).transform.position, ((Component)enemy).transform.position).ToString("F1") : "—", "; arma=", weapon?.m_shared?.m_name ?? "nenhuma", "; durabilidade=", (weapon?.m_durability ?? 0f).ToString("F1"), "; munição=", ammoItem?.m_shared?.m_name ?? "nenhuma", " x", (ammoItem?.m_stack ?? 0).ToString(), "; estamina=", null, null, null, null, null }; Player val2 = (Player)(object)((body is Player) ? body : null); obj[17] = ((val2 != null) ? val2.GetStamina() : (Individual.Of((Character)(object)body)?.Data?.Stamina).GetValueOrDefault()).ToString("F1"); obj[18] = "; ataqueNativo="; obj[19] = (val != null && !val.IsDone()).ToString(); obj[20] = "; obstáculo="; obj[21] = obstacle; logger.LogWarning((object)string.Concat(obj)); } public void RangedNotice(Humanoid body, ItemData weapon, float draw) { ManualLogSource logger = ((BaseUnityPlugin)this).Logger; string[] obj = new string[20] { "Disparo aguardando liberação nativa: ", ((Character)body).m_name, "; arma=", weapon.m_shared.m_name, "; puxada=", draw.ToString("F2"), "; animaçãoAtaque=", ((Character)body).InAttack().ToString(), "; ação=", ((Character)body).InMinorAction().ToString(), "; movimento=", ((Character)body).CanMove().ToString(), "; esquiva=", ((Character)body).InDodge().ToString(), "; atordoado=", ((Character)body).IsStaggering().ToString(), "; estamina=", null, null, null }; Player val = (Player)(object)((body is Player) ? body : null); obj[17] = ((val != null) ? val.GetStamina() : (Individual.Of((Character)(object)body)?.Data?.Stamina).GetValueOrDefault()).ToString("F1"); obj[18] = "; munição="; obj[19] = body.GetAmmoItem()?.m_shared?.m_name ?? "nenhuma"; logger.LogWarning((object)string.Concat(obj)); } private static string Duration(float seconds) { int num = Mathf.Max(0, Mathf.CeilToInt(seconds)); return num / 60 + ":" + (num % 60).ToString("00"); } private void DrawCharacterFood(Character c) { //IL_0018: 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) if (HumanHunger.Managed(c)) { float num = HumanHunger.Factor(c); if (num < 0.999f) { Color color = GUI.color; GUI.color = new Color(1f, 0.75f, 0.4f); GUILayout.Label(ModText.Get("Desnutrição • desempenho ") + (num * 100f).ToString("F0") + "%", characterBodyStyle, Array.Empty<GUILayoutOption>()); GUI.color = color; } } } public void GraveLog(string message, bool error) { if (error) { ((BaseUnityPlugin)this).Logger.LogError((object)message); } else { ((BaseUnityPlugin)this).Logger.LogInfo((object)message); } } private Rect ConstructionBounds() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) return new Rect(8f, 34f, (float)Mathf.Min(390, Screen.width - 16), (float)(MiningPit.IsTool(buildChoice) ? 320 : 240)); } private bool ConstructionPointer() { //IL_0017: 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_001f: 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) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (constructionOpen) { if (!NativeBuildMenu.PointerOn()) { if (!NativeBuildMenu.Visible) { Rect val = ConstructionBounds(); return ((Rect)(ref val)).Contains(new Vector2(Input.mousePosition.x, (float)Screen.height - Input.mousePosition.y)); } return false; } return true; } return false; } public void ConstructionLog(string text) { ((BaseUnityPlugin)this).Logger.LogWarning((object)text); } private void RefreshBuildCatalog() { NativeBuildMenu.Refresh(); ClearBuildUiStocks(); } private void ToggleConstruction(string tool = "Hammer") { if (constructionOpen) { bool num = constructionTool == tool; CloseConstruction(); if (num) { return; } } if (!Object.op_Implicit((Object)(object)Player.m_localPlayer) || ((Character)Player.m_localPlayer).IsDead()) { WorldNotice("Aguarde o sobrevivente renascer para abrir a construção."); return; } try { if (InventoryGui.IsVisible()) { NativeInventoryBridge.CancelWindow(); } NativeLoot.Close(); GameObject val = (Object.op_Implicit((Object)(object)ObjectDB.instance) ? ObjectDB.instance.GetItemPrefab(tool) : null); PieceTable val2 = ((!Object.op_Implicit((Object)(object)val)) ? null : val.GetComponent<ItemDrop>()?.m_itemData?.m_shared?.m_buildPieces); if (!Object.op_Implicit((Object)(object)val2)) { throw new InvalidOperationException("Catálogo da ferramenta indisponível."); } constructionTool = tool; buildPlayer = Player.m_localPlayer; buildTable = NativeBuildMenu.Begin(buildPlayer, val2, tool == "Hammer", tool == "Hoe"); constructionOpen = true; RefreshBuildCatalog(); BuildResources.Discover(); dragging = false; contextTarget = null; contextBed = null; skillsOpen = false; ResetMarchGesture(); ClearAltLabels(); buildReason = ((tool == "Hammer") ? "Escolha uma peça ou o martelo de reparo." : "Escolha uma ação no catálogo."); NativeBuildMenu.Show(); } catch (Exception ex) { CloseConstruction(); ConstructionLog("Construção indisponível: " + ex); WorldNotice(ModText.Get("Não foi possível abrir o catálogo de construção.")); } } private void CancelBuildPiece() { demolitionHighlight.Clear(); demolitionContainers.Clear(); BuildNative.Clear(); HouseBuilding.Hide(); buildResources.Reset(); repairTarget = null; repairRefresh = 0f; buildChoice = null; buildValid = false; buildHasPoint = false; buildReason = "Escolha uma peça."; ResetMarchGesture(); } private void CloseConstruction() { ClearBuildUiStocks(); NativeBuildMenu.End(); CancelBuildPiece(); constructionOpen = false; buildPlayer = null; buildTable = null; } private void SelectBuildPiece(Piece piece) { try { if (NativeBuildMenu.Unlocked(piece)) { demolitionHighlight.Clear(); HouseBuilding.Hide(); repairTarget = null; repairRefresh = 0f; buildChoice = piece; if (piece.m_repairPiece || NativeBuildMenu.IsDemolition(piece) || MiningPit.IsTool(piece) || HouseBuilding.IsTool(piece)) { BuildNative.Clear(); } else { BuildNative.Select(buildPlayer, piece, buildTable); } buildRefresh = 0f; buildHasPoint = false; buildValid = false; dragging = false; } } catch (Exception ex) { CancelBuildPiece(); ConstructionLog("Falha na prévia: " + ex); WorldNotice(ModText.Get("Esta peça não pôde ser preparada.")); } } private bool CancelConstructionEscape() { if (!constructionOpen) { return false; } if (Object.op_Implicit((Object)(object)buildChoice)) { CancelBuildPiece(); NativeBuildMenu.Show(); } else { CloseConstruction(); } return true; } private string PlacementReason(PlacementStatus status) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected I4, but got Unknown //IL_00b2: Unknown result type (might be due to invalid IL or missing references) switch ((int)status) { case 0: return ""; case 1: if (!Object.op_Implicit((Object)(object)buildChoice) || !buildChoice.m_noInWater || !BuildNative.HitWater) { return "Posição inválida: verifique apoio, inclinação e sobreposição."; } return "Esta peça não pode ser construída na água."; case 3: return "Construção proibida neste local."; case 4: return "Área protegida."; case 8: return "Bioma incompatível."; case 7: return "A melhoria precisa da bancada correspondente."; case 2: return "Um personagem está bloqueando a peça."; case 5: return "A peça precisa de mais espaço."; case 9: return "Requer solo cultivado."; case 10: return "Requer solo adequado."; case 12: return "Aponte para o chão ou uma estrutura."; default: return ModText.Format("Posição inválida ({0}).", status); } } private bool UpdateConstruction() { //IL_0459: Unknown result type (might be due to invalid IL or missing references) //IL_045e: Unknown result type (might be due to invalid IL or missing references) //IL_0463: 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_01e3: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) if (!constructionOpen) { return false; } ResetMarchGesture(); dragging = false; ClearAltLabels(); hoveredWorld = null; if (!Object.op_Implicit((Object)(object)buildPlayer) || (Object)(object)buildPlayer != (Object)(object)Player.m_localPlayer || ((Character)buildPlayer).IsDead() || InventoryGui.IsVisible()) { CloseConstruction(); return true; } NativeBuildMenu.Bind(); if (Input.GetMouseButtonDown(1)) { if (Object.op_Implicit((Object)(object)buildChoice)) { CancelBuildPiece(); NativeBuildMenu.Show(); } else { CloseConstruction(); } return true; } if (NativeBuildMenu.Visible) { demolitionHighlight.Clear(); BuildNative.Hide(); HouseBuilding.Hide(); return true; } if (!Object.op_Implicit((Object)(object)buildChoice)) { return true; } if (PointerOnHud()) { demolitionHighlight.Clear(); BuildNative.Hide(); HouseBuilding.Hide(); return true; } if (NativeBuildMenu.IsDemolition(buildChoice)) { UpdateConstructionDemolition(); return true; } if (buildChoice.m_repairPiece) { UpdateConstructionRepair(); return true; } if (!NativeBuildMenu.Unlocked(buildChoice)) { CancelBuildPiece(); NativeBuildMenu.Show(); return true; } if (MiningPit.IsTool(buildChoice)) { UpdateMiningPitConstruction(); return true; } if (HouseBuilding.IsTool(buildChoice)) { UpdateHouseConstruction(); return true; } if (!BuildZoom && buildChoice.m_canRotate && Mathf.Abs(Input.mouseScrollDelta.y) > 0.01f) { BuildNative.Rotation = (BuildNative.Rotation + ((Input.mouseScrollDelta.y > 0f) ? 1 : (-1)) + 16) % 16; } try { buildHasPoint = BuildNative.Tick(Camera.main); if (!buildHasPoint) { buildValid = false; buildReason = "Aponte para o chão ou uma estrutura."; return true; } Vector3 point = BuildNative.Preview.transform.position; bool mouseButtonDown = Input.GetMouseButtonDown(0); if (!mouseButtonDown && !(Time.unscaledTime >= buildRefresh)) { Vector3 val = point - buildResourcePoint; if (!(((Vector3)(ref val)).sqrMagnitude > 1f) && !((Object)(object)buildPreferred != (Object)(object)selected)) { goto IL_0299; } } buildRefresh = Time.unscaledTime + 0.25f; buildResourcePoint = point; buildPreferred = selected; buildResources.Gather(buildPlayer, IsSquad(selected) ? selected : null, Members(), buildChoice, point); goto IL_0299; IL_0299: buildReason = PlacementReason(BuildNative.Status); if (buildReason == "") { buildReason = BuildNative.PlantFailure(); } if (buildReason == "" && !RegionReadiness.Area(point)) { buildReason = "Aguarde o terreno e os objetos da área carregarem."; } if (buildReason == "") { buildReason = buildResources.Failure; } buildValid = buildReason == ""; BuildNative.Color(buildValid); if (mouseButtonDown) { if (!buildValid) { WorldNotice(buildReason, null, speech: false, point + Vector3.up); return true; } Quaternion rotation = BuildNative.Preview.transform.rotation; bool flag = false; try { flag = buildResources.Commit(delegate { //IL_0033: 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) BuildNative.Placing = buildPlayer; BuildNative.Created = null; BuildNative.TerrainApplied = false; BuildNative.Place(buildPlayer, buildChoice, point, rotation); Piece created2 = BuildNative.Created; ZNetView val2 = (Object.op_Implicit((Object)(object)created2) ? ((Component)created2).GetComponent<ZNetView>() : null); if (!BuildNative.TerrainApplied && (!Object.op_Implicit((Object)(object)created2) || !Object.op_Implicit((Object)(object)val2) || !val2.IsValid())) { throw new InvalidOperationException("A peça não confirmou a criação de dados persistentes."); } }); if (!flag) { WorldNotice(ModText.Get("Os materiais mudaram. Tente novamente."), null, speech: false, point + Vector3.up); } } catch (Exception ex) { Piece created = BuildNative.Created; if (Object.op_Implicit((Object)(object)created)) { ZNetView component = ((Component)created).GetComponent<ZNetView>(); if (Object.op_Implicit((Object)(object)component) && component.IsValid() && Object.op_Implicit((Object)(object)ZNetScene.instance)) { ZNetScene.instance.Destroy(((Component)created).gameObject); } else { Object.Destroy((Object)(object)((Component)created).gameObject); } } ConstructionLog("Falha na transação de construção: " + ex); WorldNotice((ex is AggregateException) ? "Falha na recuperação dos materiais; consulte o registro do mod." : "A obra falhou; os materiais foram preservados.", null, speech: false, point + Vector3.up); } finally { TerrainModifier.SetTriggerOnPlaced(false); BuildNative.Placing = null; BuildNative.Created = null; } if (flag) { try { if (Object.op_Implicit((Object)(object)NativeBuildMenu.Menu)) { NativeBuildMenu.Menu.AddRecentPiece(buildChoice); } RefreshBuildCatalog(); } catch (Exception ex2) { ConstructionLog("Obra concluída; reabra o catálogo para atualizar receitas: " + ex2); } } buildRefresh = 0f; } } catch (Exception ex3) { CancelBuildPiece(); ConstructionLog("Prévia de construção cancelada: " + ex3); WorldNotice(ModText.Get("Não foi possível validar esta peça.")); } return true; } public void ChooseNativeConstruction(Piece piece) { if (ConstructionActive && Object.op_Implicit((Object)(object)piece) && NativeBuildMenu.Unlocked(piece) && (!((Object)(object)buildChoice == (Object)(object)piece) || (!piece.m_repairPiece && !NativeBuildMenu.IsDemolition(piece) && !HouseBuilding.IsTool(piece) && !Object.op_Implicit((Object)(object)BuildNative.Preview)))) { SelectBuildPiece(piece); } } private void DrawConstruction() { //IL_0057: 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_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: 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) if (!constructionOpen || NativeBuildMenu.Visible) { return; } if (MiningPit.IsTool(buildChoice) && buildHasPoint) { MiningPit.Draw(Camera.main, pitPlan, Quaternion.Euler(0f, (float)BuildNative.Rotation * 22.5f, 0f), buildValid); } GUILayout.BeginArea(ConstructionBounds(), GUI.skin.box); GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(Object.op_Implicit((Object)(object)buildChoice) ? Localization.instance.Localize(buildChoice.m_name) : ModText.Get("CONSTRUÇÃO RTS"), Array.Empty<GUILayoutOption>()); if (GUILayout.Button(ModText.Get("Escolher"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) })) { NativeBuildMenu.Show(); } if (GUILayout.Button(ModText.Get("Fechar"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(55f) })) { CloseConstruction(); GUILayout.EndHorizontal(); GUILayout.EndArea(); return; } GUILayout.EndHorizontal(); if (MiningPit.IsTool(buildChoice)) { GUILayout.Label(ModText.Get("Profundidade: 4 m • Largura: 6 m") + ((pitPlan != null) ? ("\n" + ModText.Format("Escada adaptada: {0} segmentos", pitPlan.Steps)) : "") + "\n" + ModText.Get("Seta: entrada • Tracejado: escada e fundo\nA escavação permanece ao desmontar a escada."), Array.Empty<GUILayoutOption>()); } GUILayout.Label(Demolishing ? ModText.Get("Clique na estrutura destacada para desmontar. Materiais caem no chão.\nRMB/Esc: cancelar.") : ((Object.op_Implicit((Object)(object)buildChoice) && buildChoice.m_repairPiece) ? ModText.Get("Clique na estrutura para reparar.\nRMB/Esc: voltar ao catálogo.") : ModText.Get("Roda: girar • Shift + roda: zoom\nClique: construir • RMB/Esc: catálogo")), Array.Empty<GUILayoutOption>()); if (Object.op_Implicit((Object)(object)buildChoice) && !buildChoice.m_repairPiece && !NativeBuildMenu.IsDemolition(buildChoice) && buildHasPoint) { GUILayout.Label(Object.op_Implicit((Object)(object)buildResources.Station) ? (ModText.Get("Fontes: área de ") + Localization.instance.Localize(buildResources.Station.m_name)) : ModText.Get("Fontes: companheiros a até 15 m da peça"), Array.Empty<GUILayoutOption>()); if (buildChoice.m_resources != null) { Requirement[] resources = buildChoice.m_resources; foreach (Requirement val in resources) { if (Object.op_Implicit((Object)(object)val?.m_resItem) && val.m_amount > 0) { GUILayout.Label(buildResources.Summary(val.m_resItem.m_itemData.m_shared.m_name, val.m_amount), Array.Empty<GUILayoutOption>()); } } } } Color color = GUI.color; GUI.color = (buildValid ? Color.green : Color.yellow); GUILayout.Label((!buildValid) ? ModText.Get(buildReason) : (Demolishing ? ModText.Get("Clique para desmontar.") : ((Object.op_Implicit((Object)(object)buildChoice) && buildChoice.m_repairPiece) ? ModText.Get("Clique para reparar.") : ModText.Get("Pronto para construir."))), Array.Empty<GUILayoutOption>()); GUI.color = color; GUILayout.EndArea(); } private void ToggleDemolition() { if (Demolishing) { CancelBuildPiece(); NativeBuildMenu.Show(); return; } if (!constructionOpen || constructionTool != "Hammer") { ToggleConstruction(); } if (constructionOpen && Object.op_Implicit((Object)(object)NativeBuildMenu.DemolitionTool)) { buildPlayer.SetSelectedPiece(NativeBuildMenu.DemolitionTool); ChooseNativeConstruction(NativeBuildMenu.DemolitionTool); NativeBuildMenu.Hide(); } } private void ClearPendingDemolition() { pendingDemolition.Clear(); oldDemolition.Clear(); demolitionContainers.Clear(); demolitionHighlight.Clear(); demolitionErrorAfter = 0f; DemolitionDrops.Clear(); } private void PruneDemolition() { //IL_0045: 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) //IL_0084: Unknown result type (might be due to invalid IL or missing references) oldDemolition.Clear(); foreach (KeyValuePair<ZDOID, ZNetView> item in pendingDemolition) { if (!Object.op_Implicit((Object)(object)item.Value) || !item.Value.IsValid()) { oldDemolition.Add(item.Key); } } foreach (ZDOID item2 in oldDemolition) { pendingDemolition.Remove(item2); } oldDemolition.Clear(); } private string DemolitionReason(DemolitionBlock block, Piece piece) { return block switch { DemolitionBlock.None => "", DemolitionBlock.Loading => "Aguarde o terreno e os objetos carregarem.", DemolitionBlock.Protected => "Área protegida ou sem permissão de acesso.", DemolitionBlock.Nonempty => "Esvazie o baú antes de desmontar.", DemolitionBlock.InUse => "Feche o baú antes de desmontar.", DemolitionBlock.Station => ModText.Format("Requer {0} na área.", Localization.instance.Localize(piece.m_craftingStation.m_name)), DemolitionBlock.Reach => "Aproxime um companheiro (15 m) ou use a área de uma bancada.", DemolitionBlock.Native => "Esta estrutura não pode ser desmontada agora.", _ => "Aponte para uma estrutura que possa ser desmontada.", }; } private void UpdateConstructionDemolition() { try { TickConstructionDemolition(); } catch (Exception ex) { demolitionHighlight.Clear(); buildValid = false; buildReason = "Não foi possível validar esta estrutura para desmontagem."; if (Time.unscaledTime >= demolitionErrorAfter) { demolitionErrorAfter = Time.unscaledTime + 5f; ConstructionLog(buildReason + " " + ex); } } } private void TickConstructionDemolition() { //IL_0575: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_02b3: Unknown result type (might be due to invalid IL or missing references) //IL_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: 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_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Unknown result type (might be due to invalid IL or missing references) //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_0419: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_0538: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Unknown result type (might be due to invalid IL or missing references) //IL_04cb: Unknown result type (might be due to invalid IL or missing references) //IL_04dd: Unknown result type (might be due to invalid IL or missing references) BuildNative.Hide(); buildValid = false; buildHasPoint = false; PruneDemolition(); if (!WorldPointer.TryHit(Camera.main, out var hit)) { demolitionHighlight.Clear(); buildReason = DemolitionReason(DemolitionBlock.Invalid, null); return; } Piece componentInParent = ((Component)((RaycastHit)(ref hit)).collider).GetComponentInParent<Piece>(); ZNetView val = (Object.op_Implicit((Object)(object)componentInParent) ? ((Component)componentInParent).GetComponent<ZNetView>() : null); bool flag = Object.op_Implicit((Object)(object)componentInParent) && Object.op_Implicit((Object)(object)val) && val.IsValid() && componentInParent.m_canBeRemoved && !Object.op_Implicit((Object)(object)((Component)componentInParent).GetComponentInChildren<Character>(true)) && !Object.op_Implicit((Object)(object)((Component)componentInParent).GetComponentInChildren<TombStone>(true)); if (!flag) { demolitionHighlight.Clear(); buildReason = DemolitionReason(DemolitionBlock.Invalid, null); return; } bool mouseButtonDown = Input.GetMouseButtonDown(0); buildHasPoint = true; if ((Object)(object)repairTarget != (Object)(object)componentInParent || Time.unscaledTime >= repairRefresh || mouseButtonDown) { repairTarget = componentInParent; repairRefresh = Time.unscaledTime + 0.25f; buildResources.Gather(buildPlayer, IsSquad(selected) ? selected : null, Members(), componentInParent, ((Component)componentInParent).transform.position); demolitionContainers.Clear(); ((Component)componentInParent).GetComponentsInChildren<Container>(true, demolitionContainers); } bool contents = false; bool inUse = false; bool access = PrivateArea.CheckAccess(((Component)componentInParent).transform.position, 0f, mouseButtonDown, false) && !Location.IsInsideNoBuildLocation(((Component)componentInParent).transform.position); foreach (Container demolitionContainer in demolitionContainers) { if (Object.op_Implicit((Object)(object)demolitionContainer)) { if (demolitionContainer.GetInventory() == null || demolitionContainer.GetInventory().NrOfItems() > 0) { contents = true; } if (demolitionContainer.IsInUse()) { inUse = true; } if (!BuildResources.ContainerAccess(demolitionContainer, buildPlayer)) { access = false; } } } DemolitionBlock block = DemolitionRules.Check(flag, RegionReadiness.Area(((Component)componentInParent).transform.position), access, contents, inUse, Object.op_Implicit((Object)(object)componentInParent.m_craftingStation), Object.op_Implicit((Object)(object)buildResources.Station), buildResources.HasAccess, componentInParent.CanBeRemoved()); buildReason = DemolitionReason(block, componentInParent); if (pendingDemolition.ContainsKey(val.GetZDO().m_uid)) { buildReason = "Desmontagem já solicitada; aguardando atualização."; } buildValid = buildReason == ""; demolitionHighlight.Show(componentInParent, buildValid); if (!mouseButtonDown) { return; } Vector3 value = ((RaycastHit)(ref hit)).point + Vector3.up; if (!buildValid) { WorldNotice(buildReason, null, speech: false, value); return; } if (!val.IsOwner()) { val.ClaimOwnership(); } if (!val.IsOwner()) { WorldNotice("Aguarde a atualização da estrutura e tente novamente.", null, speech: false, value); return; } foreach (Container demolitionContainer2 in demolitionContainers) { if (Object.op_Implicit((Object)(object)demolitionContainer2) && (demolitionContainer2.GetInventory() == null || demolitionContainer2.GetInventory().NrOfItems() > 0 || demolitionContainer2.IsInUse() || !BuildResources.ContainerAccess(demolitionContainer2, buildPlayer))) { buildValid = false; buildReason = "O baú foi atualizado. Esvazie e feche-o antes de desmontar."; demolitionHighlight.Show(componentInParent, valid: false); WorldNotice(buildReason, null, speech: false, value); return; } } if (!componentInParent.CanBeRemoved() || !PrivateArea.CheckAccess(((Component)componentInParent).transform.position, 0f, true, false)) { buildValid = false; buildReason = "A estrutura não pode mais ser desmontada."; WorldNotice(buildReason, null, speech: false, value); return; } if (!TryDemolitionRefundPoint(((Component)componentInParent).transform.position, out var destination)) { WorldNotice("Não há solo livre próximo para devolver os materiais.", null, speech: false, value); return; } ZDOID uid = val.GetZDO().m_uid; pendingDemolition[uid] = val; string text = Localization.instance.Localize(componentInParent.m_name); demolitionHighlight.Clear(); try { DemolitionDrops.Request(componentInParent, destination); IRemoved component = ((Component)componentInParent).GetComponent<IRemoved>(); if (component != null) { component.OnRemoved(); } WearNTear val2 = (Object.op_Implicit((Object)(object)componentInParent) ? ((Component)componentInParent).GetComponent<WearNTear>() : null); if (Object.op_Implicit((Object)(object)val2)) { val2.Remove(false); } else if (Object.op_Implicit((Object)(object)componentInParent) && val.IsValid()) { componentInParent.DropResources((HitData)null); componentInParent.m_placeEffect.Create(((Component)componentInParent).transform.position, ((Component)componentInParent).transform.rotation, (Transform)null, 1f, -1, ((Character)buildPlayer).GetZDOID()); ZNetScene.instance.Destroy(((Component)componentInParent).gameObject); } Physics.SyncTransforms(); ClearBuildUiStocks(); buildResources.Reset(); repairTarget = null; repairRefresh = 0f; WorldNotice(ModText.Format("Desmontado: {0}", text), null, speech: false, value); } catch (Exception ex) { ConstructionLog("Desmontagem interrompida em " + text + ": " + ex); WorldNotice("Não foi possível concluir a desmontagem; consulte o registro do mod.", null, speech: false, value); } } private void UpdateConstructionRepair() { //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) BuildNative.Hide(); buildValid = false; buildHasPoint = false; if (!WorldPointer.TryHit(Camera.main, out var hit)) { buildReason = "Aponte para uma estrutura para reparar."; return; } Piece componentInParent = ((Component)((RaycastHit)(ref hit)).collider).GetComponentInParent<Piece>(); WearNTear val = (Object.op_Implicit((Object)(object)componentInParent) ? ((Component)componentInParent).GetComponent<WearNTear>() : null); if (!Object.op_Implicit((Object)(object)componentInParent) || !Object.op_Implicit((Object)(object)val)) { buildReason = "Este objeto não pode ser reparado com o martelo."; return; } buildHasPoint = true; if ((Object)(object)repairTarget != (Object)(object)componentInParent || Time.unscaledTime >= repairRefresh || Input.GetMouseButtonDown(0)) { repairTarget = componentInParent; repairRefresh = Time.unscaledTime + 0.25f; buildResources.Gather(buildPlayer, IsSquad(selected) ? selected : null, Members(), componentInParent, ((Component)componentInParent).transform.position); } buildReason = ""; if (!RegionReadiness.Area(((Component)componentInParent).transform.position)) { buildReason = "Aguarde a área carregar."; } else if (!PrivateArea.CheckAccess(((Component)componentInParent).transform.position, 0f, false, false)) { buildReason = "Área protegida."; } else if (Object.op_Implicit((Object)(object)componentInParent.m_craftingStation) && !Object.op_Implicit((Object)(object)buildResources.Station)) { buildReason = ModText.Format("Requer {0} na área.", Localization.instance.Localize(componentInParent.m_craftingStation.m_name)); } else if (!buildResources.HasAccess) { buildReason = "Aproxime um companheiro (15 m) ou use a área de uma bancada."; } else if (val.GetHealthPercentage() >= 0.9999f) { buildReason = "A estrutura já está em bom estado."; } buildValid = buildReason == ""; val.Highlight(); if (!Input.GetMouseButtonDown(0)) { return; } if (!buildValid) { WorldNotice(buildReason, null, speech: false, ((RaycastHit)(ref hit)).point + Vector3.up); return; } RemoteSimulation.Own((Component)(object)val); if (val.Repair()) { componentInParent.m_placeEffect.Create(((Component)componentInParent).transform.position, ((Component)componentInParent).transform.rotation, (Transform)null, 1f, -1, ((Character)buildPlayer).GetZDOID()); WorldNotice(ModText.Format("Reparado: {0}", Localization.instance.Localize(componentInParent.m_name)), null, speech: false, ((RaycastHit)(ref hit)).point + Vector3.up); } else { WorldNotice("A estrutura não precisa de reparo ou está aguardando atualização.", null, speech: false, ((RaycastHit)(ref hit)).point + Vector3.up); } } public bool RemoveCompanionPin(Minimap map, Vector3 point, float radius) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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) //IL_008c: 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) //IL_00e7: 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_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) if (!Ready || !Object.op_Implicit((Object)(object)mapPlayer) || mapKey != "vs_squad_map_" + ZNet.instance.GetWorldUID()) { return false; } KeyValuePair<string, PinData> pair = deathMapPins.OrderBy((KeyValuePair<string, PinData> p) => Utils.DistanceXZ(p.Value.m_pos, point)).FirstOrDefault(); if (pair.Value == null || Utils.DistanceXZ(pair.Value.m_pos, point) >= radius) { return false; } object? obj = AccessTools.Method(typeof(Minimap), "GetClosestPin", (Type[])null, (Type[])null).Invoke(map, new object[3] { point, radius, true }); PinData val = (PinData)((obj is PinData) ? obj : null); if (val != null && Utils.DistanceXZ(val.m_pos, point) < Utils.DistanceXZ(pair.Value.m_pos, point)) { return false; } deathMapPins.Remove(pair.Key); records.Deaths.RemoveAll((MapRecord r) => r.Id == pair.Key); sessionDeaths.Remove(pair.Key); removedDeaths.Add(pair.Key); if (records.RemovedDeaths == null) { records.RemovedDeaths = new List<string>(); } if (!records.RemovedDeaths.Contains(pair.Key)) { records.RemovedDeaths.Add(pair.Key); } mapPlayer.m_customData[mapKey] = JsonUtility.ToJson((object)records); map.RemovePin(pair.Value); return true; } private bool TryDemolitionRefundPoint(Vector3 source, out Vector3 destination) { //IL_0001: 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_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_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_007a: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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) //IL_0092: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0125: 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_0139: Unknown result type (might be due to invalid IL or missing references) destination = default(Vector3); int mask = LayerMask.GetMask(new string[1] { "terrain" }); int mask2 = LayerMask.GetMask(new string[3] { "terrain", "piece", "static_solid" }); RaycastHit val2 = default(RaycastHit); for (int i = 0; i < 10; i++) { for (int j = 0; j < ((i == 0) ? 1 : 8); j++) { Vector3 val = source + Quaternion.Euler(0f, (float)(j * 45), 0f) * Vector3.forward * (float)(i * 3); if (Physics.Raycast(val + Vector3.up * 80f, Vector3.down, ref val2, 240f, mask, (QueryTriggerInteraction)1) && !(((RaycastHit)(ref val2)).normal.y < 0.6f)) { val = ((RaycastHit)(ref val2)).point; if ((!Object.op_Implicit((Object)(object)ZoneSystem.instance) || !(val.y < ZoneSystem.instance.m_waterLevel)) && !Physics.CheckCapsule(val + Vector3.up * 0.4f, val + Vector3.up * 1.7f, 0.3f, mask2, (QueryTriggerInteraction)1)) { destination = val + Vector3.up * 0.5f; return true; } } } } return false; } public void DungeonArrival(Character body, Vector3 point) { //IL_001d: 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) if ((Object)(object)cameraFollowTarget == (Object)(object)body || (Object)(object)selected == (Object)(object)body) { center = point; cameraTracksUnit = true; cameraFollowTarget = body; } } internal void LogMissingEquipment(string name) { if (missingEquipment.Add(name)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Equipamento não encontrado no jogo instalado: " + name)); } } private Rect FactionsPanelBounds() { //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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Min(900, Screen.width - 32); Rect val = HealthHudBounds(); float y = ((Rect)(ref val)).y; val = SquadHudBounds(); float num2 = Mathf.Min(y, ((Rect)(ref val)).y) - 12f; float num3 = Mathf.Min(608f, Mathf.Max(180f, num2 - 32f)); return new Rect(Mathf.Max(8f, ((float)Screen.width - num) / 2f), Mathf.Max(24f, (num2 - num3) / 2f), num, num3); } private void DrawFactionsPanel() { //IL_00da: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010f: 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_0183: 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_0024: 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_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_0042: Expected O, but got Unknown //IL_0047: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_009c: Expected O, but got Unknown //IL_00a3: 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_00b5: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_02aa: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0327: 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_0331: Unknown result type (might be due to invalid IL or missing references) //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_0511: Unknown result type (might be due to invalid IL or missing references) //IL_0377: 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_039d: Unknown result type (might be due to invalid IL or missing references) //IL_03c6: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_046c: Unknown result type (might be due to invalid IL or missing references) //IL_0491: Unknown result type (might be due to invalid IL or missing references) //IL_04a8: Unknown result type (might be due to invalid IL or missing references) //IL_0456: Unknown result type (might be due to invalid IL or missing references) //IL_0440: Unknown result type (might be due to invalid IL or missing references) if (!factionsOpen) { return; } if (factionText == null) { factionText = new GUIStyle(GUI.skin.label) { fontSize = 13, wordWrap = true, padding = new RectOffset(0, 0, 0, 0) }; factionText.normal.textColor = Color.white; factionTitle = new GUIStyle(factionText) { fontSize = 17, fontStyle = (FontStyle)1 }; factionHeading = new GUIStyle(factionText) { fontSize = 12, fontStyle = (FontStyle)1 }; factionMuted = new GUIStyle(factionText) { fontSize = 12 }; factionMuted.normal.textColor = new Color(0.68f, 0.7f, 0.72f); } Rect val = FactionsPanelBounds(); Color color = GUI.color; GUI.color = new Color(0.035f, 0.04f, 0.045f, 1f); GUI.DrawTexture(val, (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; GUI.Label(new Rect(((Rect)(ref val)).x + 14f, ((Rect)(ref val)).y + 10f, ((Rect)(ref val)).width - 100f, 25f), ModText.Get("FACÇÕES"), factionTitle); if (GUI.Button(new Rect(((Rect)(ref val)).xMax - 80f, ((Rect)(ref val)).y + 10f, 66f, 25f), ModText.Get("Fechar"))) { factionsOpen = false; } GUI.Label(new Rect(((Rect)(ref val)).x + 14f, ((Rect)(ref val)).y + 40f, ((Rect)(ref val)).width - 28f, 20f), ModText.Get("Relacionamento com seu esquadrão"), factionMuted); float num = ((Rect)(ref val)).width - 48f; GUI.Label(new Rect(((Rect)(ref val)).x + 14f, ((Rect)(ref val)).y + 70f, num * 0.58f, 20f), ModText.Get("FACÇÃO"), factionHeading); GUI.Label(new Rect(((Rect)(ref val)).x + 14f + num * 0.58f, ((Rect)(ref val)).y + 70f, num * 0.18f, 20f), ModText.Get("PONTOS"), factionHeading); GUI.Label(new Rect(((Rect)(ref val)).x + 14f + num * 0.76f, ((Rect)(ref val)).y + 70f, num * 0.24f, 20f), ModText.Get("RELAÇÃO"), factionHeading); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(((Rect)(ref val)).x + 12f, ((Rect)(ref val)).y + 96f, ((Rect)(ref val)).width - 24f, ((Rect)(ref val)).height - 140f); float num2 = 468f; factionsScroll = GUI.BeginScrollView(val2, factionsScroll, new Rect(0f, 0f, num, Mathf.Max(((Rect)(ref val2)).height, num2))); int num3 = 0; for (int i = 1; i < HumanFactions.Names.Length; i++) { if (FactionRules.Active(i)) { float num4 = num3++ * 52; int num5 = HumanFactions.Reputation(i); GUI.color = new Color(0.09f, 0.1f, 0.11f, 1f); GUI.DrawTexture(new Rect(0f, num4, num, 46f), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; GUI.Label(new Rect(6f, num4 + 9f, num * 0.58f - 10f, 34f), HumanFactions.DisplayName(i), factionText); GUI.Label(new Rect(num * 0.58f, num4 + 12f, num * 0.18f, 26f), ((num5 > 0) ? "+" : "") + num5, factionText); GUI.color = ((num5 <= -30) ? new Color(1f, 0.45f, 0.4f) : ((num5 >= 30) ? new Color(0.45f, 0.9f, 0.58f) : new Color(0.95f, 0.83f, 0.53f))); GUI.Label(new Rect(num * 0.76f, num4 + 12f, num * 0.24f, 26f), HumanFactions.Relation(i), factionText); GUI.color = Color.white; } } GUI.EndScrollView(); GUI.Label(new Rect(((Rect)(ref val)).x + 14f, ((Rect)(ref val)).yMax - 30f, ((Rect)(ref val)).width - 28f, 22f), ModText.Get("Hostil: até −30 • Neutra: −29 a +29 • Aliada: a partir de +30"), factionMuted); GUI.color = color; } private void UpdateHouseConstruction() { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0127: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_015b: 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_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: 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_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) if (!BuildZoom && Mathf.Abs(Input.mouseScrollDelta.y) > 0.01f) { BuildNative.Rotation = (BuildNative.Rotation + ((Input.mouseScrollDelta.y > 0f) ? 1 : 15)) % 16; } Quaternion rotation = Quaternion.Euler(0f, (float)BuildNative.Rotation * 22.5f, 0f); buildHasPoint = HouseBuilding.Point(Camera.main, out var point); if (!buildHasPoint) { HouseBuilding.Hide(); buildValid = false; buildReason = "Aponte para o terreno."; return; } bool mouseButtonDown = Input.GetMouseButtonDown(0); if (!mouseButtonDown && !(Time.unscaledTime >= buildRefresh)) { Vector3 val = point - buildResourcePoint; if (!(((Vector3)(ref val)).sqrMagnitude > 0.01f) && houseValidationRotation == BuildNative.Rotation && !((Object)(object)buildPreferred != (Object)(object)selected)) { goto IL_01c2; } } buildRefresh = Time.unscaledTime + 0.25f; buildResourcePoint = point; buildPreferred = selected; houseValidationRotation = BuildNative.Rotation; houseAnchor = point; buildResources.Gather(buildPlayer, IsSquad(selected) ? selected : null, Members(), buildChoice, point); buildReason = HouseBuilding.Validate(buildChoice, ref houseAnchor, rotation, buildResources.Station); if (buildReason == "") { buildReason = buildResources.Failure; } buildValid = buildReason == ""; goto IL_01c2; IL_01c2: HouseBuilding.Preview(buildChoice, houseAnchor, rotation); if (!mouseButtonDown) { return; } if (!buildValid) { WorldNotice(buildReason, null, speech: false, houseAnchor + Vector3.up); return; } try { if (buildResources.Commit(delegate { //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) HouseBuilding.Place(buildChoice, buildPlayer, houseAnchor, rotation); })) { RefreshBuildCatalog(); WorldNotice(ModText.Format("{0} concluído.", Localization.instance.Localize(buildChoice.m_name)), null, speech: false, houseAnchor + Vector3.up); } else { WorldNotice("Os materiais mudaram. Tente novamente.", null, speech: false, houseAnchor + Vector3.up); } } catch (Exception ex) { ConstructionLog("Falha na construção da casa: " + ex); WorldNotice("A obra falhou. Consulte o registro do mod.", null, speech: false, houseAnchor + Vector3.up); } buildRefresh = 0f; } private void DrawInfoPanel(Rect area) { //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0178: 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_001b: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0037: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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) //IL_00b2: Unknown r