Decompiled source of UniversalCompany BrutalEdition v2.1.3
BepInEx/plugins/PotatoePet-AdvancedCompany/advancedcompany/AdvancedCompany.dll
Decompiled 10 months ago
The result has been truncated due to the large size, download it to view full contents!
#define DEBUG using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Numerics; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using AdvancedCompany; using AdvancedCompany.Boot; using AdvancedCompany.Config; using AdvancedCompany.Cosmetics; using AdvancedCompany.Game; using AdvancedCompany.Hooks.PlayerControllerB; using AdvancedCompany.IL; using AdvancedCompany.Lib; using AdvancedCompany.Lib.SyncCallbacks; using AdvancedCompany.Lib.SyncHandler; using AdvancedCompany.Network; using AdvancedCompany.Network.Messages; using AdvancedCompany.Network.Sync; using AdvancedCompany.Network.Sync.Items; using AdvancedCompany.Objects; using AdvancedCompany.Objects.Interfaces; using AdvancedCompany.Patches; using AdvancedCompany.PostProcessing; using AdvancedCompany.Terminal.Applications; using AdvancedCompany.UI; using AdvancedCompany.Unity.Moons; using AdvancedCompany.Unity.UI; using AssetsTools.NET; using AssetsTools.NET.Extra; using AssetsTools.NET.Extra.Decompressors.LZ4; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Coroner; using Dissonance; using GameNetcodeStuff; using HarmonyLib; using LZ4ps; using LethalCompanyInputUtils.Api; using Microsoft.CodeAnalysis; using Mono.Cecil; using Mono.Collections.Generic; using MoreCompany.Cosmetics; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using SevenZip; using SevenZip.Compression.LZ; using SevenZip.Compression.LZMA; using SevenZip.Compression.RangeCoder; using Steamworks; using Steamworks.Data; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Rendering; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyMetadata("AdvancedCompanyIgnore", "True")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } public class BaseSettings<T> : MonoBehaviour where T : Configuration, new() { public class Preset { private IConfigurationProvider Provider; private bool _CanBeRenamed; private bool _CanBeRemoved; private bool _CanBeSaved; private string _Name; public T Configuration; internal bool Selected = false; internal GameObject Container; internal GameObject SelectedBackground; internal TextMeshProUGUI Label; internal Button PresetButton; internal Button RemoveButton; internal Button RenameButton; public bool CanBeRenamed { get { return _CanBeRenamed; } set { _CanBeRenamed = value; if ((Object)(object)RenameButton != (Object)null) { ((Component)RenameButton).gameObject.SetActive(_CanBeRenamed); } } } public bool CanBeRemoved { get { return _CanBeRemoved; } set { _CanBeRemoved = value; if ((Object)(object)RemoveButton != (Object)null) { ((Component)RemoveButton).gameObject.SetActive(_CanBeRemoved); } } } public bool CanBeSaved { get { return _CanBeSaved; } set { _CanBeSaved = value; } } public string Name { get { return _Name; } set { _Name = value; if ((Object)(object)Label != (Object)null) { ((TMP_Text)Label).text = _Name; } } } public Preset(IConfigurationProvider provider, string name, T configuration, bool canRemove = true, bool canRename = true, bool canBeSaved = true) { Provider = provider; _Name = name; Configuration = configuration; _CanBeRemoved = canRemove; _CanBeRenamed = canRename; _CanBeSaved = canBeSaved; } } public interface IConfigurationProvider { List<Preset> GetPresets(); Preset GetPreset(string name); void PresetRenamed(Preset preset, string oldName, string newName); void PresetRemoved(Preset preset); void PresetCreated(Preset preset); void PresetSaved(Preset preset); Preset CreatePreset(string name, T configuration); } public class TestConfigurationProvider : IConfigurationProvider { private List<Preset> Presets = new List<Preset>(); public TestConfigurationProvider() { Presets.Add(new Preset(this, "File config", new T(), canRemove: false, canRename: false)); Presets.Add(new Preset(this, "Test 1", new T())); Presets.Add(new Preset(this, "Test 2", new T())); } public Preset GetPreset(string name) { for (int i = 0; i < Presets.Count; i++) { if (Presets[i].Name.Equals(name, StringComparison.OrdinalIgnoreCase)) { return Presets[i]; } } return null; } public void PresetCreated(Preset preset) { Presets.Add(preset); } public List<Preset> GetPresets() { return Presets; } public void PresetRemoved(Preset preset) { Presets.Remove(preset); } public void PresetRenamed(Preset preset, string oldName, string newName) { } public void PresetSaved(Preset preset) { } public Preset CreatePreset(string name, T configuration) { return new Preset(this, name, configuration); } } public delegate void Continue(T configuration, string presetName); public delegate void Cancel(); [Header("Images")] public Sprite TabActive; public Sprite TabInactive; [Header("Window")] public Transform TabContainer; public Transform Container; [Header("Presets")] public GameObject PresetTemplate; public Transform PresetContainer; public Button CreatePreset; private IConfigurationProvider PresetsProvider; [HideInInspector] public Preset SelectedPreset; [Header("Windows")] public RenamePresetWindow RenamePreset; public RemovePresetWindow RemovePreset; public ConfirmOverrideWindow ConfirmOverride; public NewPresetWindow NewPreset; [Header("Buttons")] public Button SaveAsNewPresetButton; public Button SaveButton; public Button ContinueButton; public Button CancelButton; [Header("Notification")] public GameObject NotificationObject; public TextMeshProUGUI NotificationText; [HideInInspector] public Continue OnContinue; [HideInInspector] public Cancel OnCancel; internal List<Button> Tabs = new List<Button>(); internal List<GameObject> Containers = new List<GameObject>(); internal T Configuration; private bool CreatingNew = false; private Preset RenamingPreset; private Preset DeletingPreset; public void SetConfiguration(IConfigurationProvider configuration) { PresetsProvider = configuration; Transform presetContainer = PresetContainer; for (int num = presetContainer.childCount - 1; num >= 0; num--) { GameObject gameObject = ((Component)presetContainer.GetChild(num)).gameObject; Object.Destroy((Object)(object)gameObject); } List<Preset> presets = PresetsProvider.GetPresets(); for (int i = 0; i < presets.Count; i++) { AddPreset(presets[i]); } if (presets.Count > 0) { SelectPreset(presets[0]); } } public virtual void ApplyConfiguration() { } internal void ShowNotification(string text) { NotificationObject.SetActive(true); ((TMP_Text)NotificationText).text = text; ((MonoBehaviour)this).StartCoroutine(HideNotification()); } internal IEnumerator HideNotification() { yield return (object)new WaitForSeconds(1f); NotificationObject.SetActive(false); } public virtual void Awake() { //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Expected O, but got Unknown //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Expected O, but got Unknown //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Expected O, but got Unknown //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Expected O, but got Unknown Configuration = new T(); Configuration.Build(); for (int i = 0; i < Container.childCount; i++) { Containers.Add(((Component)Container.GetChild(i)).gameObject); } for (int j = 0; j < TabContainer.childCount; j++) { Button button = ((Component)TabContainer.GetChild(j)).gameObject.GetComponent<Button>(); GameObject container = Containers[j]; ((UnityEvent)button.onClick).AddListener((UnityAction)delegate { ChangeTab(button, container); }); Tabs.Add(button); } ((UnityEvent)SaveButton.onClick).AddListener((UnityAction)delegate { SelectedPreset.Configuration.CopyFrom(Configuration); PresetsProvider.PresetSaved(SelectedPreset); ShowNotification("Preset saved"); }); ((UnityEvent)SaveAsNewPresetButton.onClick).AddListener((UnityAction)delegate { CreatingNew = false; NewPreset.Open("New preset"); }); ((UnityEvent)ContinueButton.onClick).AddListener((UnityAction)delegate { if (OnContinue != null) { OnContinue(Configuration, SelectedPreset.Name); Close(); } }); ((UnityEvent)CancelButton.onClick).AddListener((UnityAction)delegate { if (OnCancel != null) { OnCancel(); Close(); } }); ConfirmOverride.OnSubmitted = delegate(string name) { Preset preset4 = PresetsProvider.GetPreset(name); if (preset4 != null) { Object.Destroy((Object)(object)preset4.Container); PresetsProvider.PresetRemoved(preset4); } if (RenamingPreset != null) { string name3 = RenamingPreset.Name; RenamingPreset.Name = name; PresetsProvider.PresetRenamed(RenamingPreset, name3, name); RenamingPreset = null; ShowNotification("Preset renamed"); } else { Preset preset5 = PresetsProvider.CreatePreset(name, CreatingNew ? new T() : ((T)Configuration._Clone())); AddPreset(preset5); PresetsProvider.PresetCreated(preset5); ShowNotification("Preset created"); SelectPreset(preset5); } CreatingNew = false; }; RenamePreset.OnSubmitted = delegate(string name) { Preset preset3 = PresetsProvider.GetPreset(name); if (preset3 != null) { if (preset3.CanBeSaved) { ConfirmOverride.Open(name); } } else { string name2 = RenamingPreset.Name; RenamingPreset.Name = name; PresetsProvider.PresetRenamed(RenamingPreset, name2, name); RenamingPreset = null; ShowNotification("Preset renamed"); } }; RemovePreset.OnSubmitted = delegate { PresetsProvider.PresetRemoved(DeletingPreset); Object.Destroy((Object)(object)DeletingPreset.Container); ShowNotification("Preset deleted"); List<Preset> presets = PresetsProvider.GetPresets(); if (presets.Count > 0) { SelectPreset(presets[0]); } else { Configuration = new T(); ApplyConfiguration(); } DeletingPreset = null; }; NewPreset.OnSubmitted = delegate(string name) { if (!(name == "File config")) { Preset preset = PresetsProvider.GetPreset(name); if (preset != null) { if (preset.CanBeSaved) { ConfirmOverride.Open(name); } } else { Preset preset2 = PresetsProvider.CreatePreset(name, CreatingNew ? new T() : ((T)Configuration._Clone())); AddPreset(preset2); PresetsProvider.PresetCreated(preset2); SelectPreset(preset2); ShowNotification("Preset created"); } } }; ((UnityEvent)CreatePreset.onClick).AddListener((UnityAction)delegate { CreatingNew = true; NewPreset.Open("New preset"); }); ChangeTab(Tabs[0], Containers[0]); } public void Close() { NotificationObject.SetActive(false); ((Component)this).gameObject.SetActive(false); } internal void AddPreset(Preset preset) { //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Expected O, but got Unknown //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Expected O, but got Unknown //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Expected O, but got Unknown GameObject val = Object.Instantiate<GameObject>(PresetTemplate, PresetContainer); preset.Container = val; preset.PresetButton = val.GetComponent<Button>(); preset.SelectedBackground = ((Component)val.transform.GetChild(0)).gameObject; preset.SelectedBackground.SetActive(false); preset.Label = ((Component)val.transform.GetChild(1)).GetComponent<TextMeshProUGUI>(); preset.RemoveButton = ((Component)val.transform.GetChild(2)).GetComponent<Button>(); preset.RenameButton = ((Component)val.transform.GetChild(3)).GetComponent<Button>(); ((TMP_Text)preset.Label).text = preset.Name; ((Component)preset.RemoveButton).gameObject.SetActive(preset.CanBeRemoved); ((Component)preset.RenameButton).gameObject.SetActive(preset.CanBeRenamed); ((UnityEvent)preset.RenameButton.onClick).AddListener((UnityAction)delegate { RenamingPreset = preset; RenamePreset.Open(preset.Name); }); ((UnityEvent)preset.RemoveButton.onClick).AddListener((UnityAction)delegate { DeletingPreset = preset; RemovePreset.Open(preset.Name); }); ((UnityEvent)preset.PresetButton.onClick).AddListener((UnityAction)delegate { SelectPreset(preset); }); val.SetActive(true); } public void SelectPreset(string name) { SelectPreset(PresetsProvider.GetPreset(name)); } public void SelectPreset(Preset preset) { if (preset != null) { if (SelectedPreset != null) { SelectedPreset.SelectedBackground.SetActive(false); } preset.SelectedBackground.SetActive(true); SelectedPreset = preset; if (SelectedPreset != null) { ((Component)SaveButton).gameObject.SetActive(SelectedPreset.CanBeSaved); } Configuration.CopyFrom(SelectedPreset.Configuration); ApplyConfiguration(); } } internal void ChangeTab(Button toTab, GameObject container) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00d9: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < Containers.Count; i++) { Button val = Tabs[i]; bool flag = (Object)(object)val == (Object)(object)toTab; Containers[i].SetActive(flag); Graphic targetGraphic = ((Selectable)val).targetGraphic; Image val2 = (Image)(object)((targetGraphic is Image) ? targetGraphic : null); if (val2 != null) { val2.sprite = (flag ? TabActive : TabInactive); } HorizontalLayoutGroup component = ((Component)val).GetComponent<HorizontalLayoutGroup>(); TextMeshProUGUI componentInChildren = ((Component)val).GetComponentInChildren<TextMeshProUGUI>(); ((Graphic)componentInChildren).color = (flag ? new Color(0.99607843f, 0.39607844f, 0.08627451f) : new Color(0.6901961f, 23f / 85f, 0.05490196f)); ((TMP_Text)componentInChildren).fontSize = (flag ? 25 : 20); ((LayoutGroup)component).padding = (flag ? new RectOffset(20, 20, 0, 0) : new RectOffset(10, 10, 10, 0)); RectTransform component2 = ((Component)((Selectable)val).targetGraphic).GetComponent<RectTransform>(); component2.offsetMin = new Vector2(0f, flag ? (-0.1f) : 0f); component2.offsetMax = new Vector2(0f, flag ? 0f : (-9f)); } } } public class LobbySettings : BaseSettings<LobbyConfiguration> { [Header("General")] public ConfigTabContent GeneralTab; private ConfigSlider LobbySize; private ConfigToggle KeepOpen; private ConfigToggle KeepOpenOnMoon; [Header("Game")] public ConfigTabContent GameTab; public ConfigNumericInput StartCredits; public ConfigSlider GlobalValueMultiplier; public ConfigSlider GlobalAmountMultiplier; public ConfigSlider GlobalMaxPowerMultiplier; public ConfigToggle ActivatePortableTerminal; private ConfigToggle ExtendDeadline; public ConfigNumericInput DeadlineLength; private ConfigToggle SaveSuits; private ConfigToggle Cosmetics; private ConfigToggle SaveProgress; private ConfigNumericInput StartXP; private ConfigSlider XPMultiplier; private ConfigSlider LengthOfDay; [Header("Items")] public ConfigTabContent ItemsTab; private ConfigContainer ItemsContainer; private ConfigContainer ScrapContainer; private ConfigContainer UnlockablesContainer; private Dictionary<string, ConfigItemInput> Items = new Dictionary<string, ConfigItemInput>(); private Dictionary<string, ConfigScrapInput> Scrap = new Dictionary<string, ConfigScrapInput>(); private Dictionary<string, ConfigUnlockableInput> Unlockables = new Dictionary<string, ConfigUnlockableInput>(); private ConfigSlider BulletProofVestDamageReductionAtFullHealth; private ConfigSlider BulletProofVestDamageReductionAtNoHealth; private ConfigNumericInput BulletProofVestTurretDamage; private ConfigNumericInput BulletProofVestShotgunDamage; private ConfigNumericInput BulletProofVestMaxDamage; private ConfigToggle BulletProofVestDestroyOnNoHealth; private ConfigNumericInput VisionEnhancerBatteryLife; private ConfigNumericInput HelmetLampBatteryLife; private ConfigNumericInput HeadsetBatteryLife; private ConfigNumericInput TacticalHelmetBatteryLife; private ConfigNumericInput TacticalHelmetBatteryLifeWithLight; private ConfigSlider FlippersSpeed; [Header("Perks")] public ConfigTabContent PerksTab; private Dictionary<string, ConfigPerkInput> PlayerPerks = new Dictionary<string, ConfigPerkInput>(); private Dictionary<string, ConfigPerkInput> ShipPerks = new Dictionary<string, ConfigPerkInput>(); [Header("Enemies")] public ConfigTabContent EnemiesTab; private Dictionary<string, ConfigEnemyInput> Enemies = new Dictionary<string, ConfigEnemyInput>(); private ConfigContainer EnemiesContainer; [Header("Moons")] public ConfigTabContent MoonsTab; private ConfigToggle EnableWeatherModifiers; private Dictionary<string, ConfigWeatherInput> Weathers = new Dictionary<string, ConfigWeatherInput>(); private ConfigToggle EnableMoonPrices; private MoonsContainer MoonsContainer; private Dictionary<string, ConfigMoonInput> Moons = new Dictionary<string, ConfigMoonInput>(); public override void ApplyConfiguration() { LobbySize.UpdateValue(); KeepOpen.UpdateValue(); KeepOpenOnMoon.UpdateValue(); ExtendDeadline.UpdateValue(); SaveSuits.UpdateValue(); Cosmetics.UpdateValue(); SaveProgress.UpdateValue(); StartXP.UpdateValue(); XPMultiplier.UpdateValue(); LengthOfDay.UpdateValue(); StartCredits.UpdateValue(); GlobalValueMultiplier.UpdateValue(); GlobalAmountMultiplier.UpdateValue(); GlobalMaxPowerMultiplier.UpdateValue(); DeadlineLength.UpdateValue(); ActivatePortableTerminal.UpdateValue(); foreach (KeyValuePair<string, ConfigItemInput> item in Items) { if (Configuration.Items.Items.ContainsKey(item.Key)) { item.Value.SetValue(Configuration.Items.Items[item.Key]); } else { item.Value.SetValue(LobbyConfiguration.AllItemsConfig.Items[item.Key]); } } foreach (KeyValuePair<string, ConfigUnlockableInput> unlockable in Unlockables) { if (Configuration.Items.Unlockables.ContainsKey(unlockable.Key)) { unlockable.Value.SetValue(Configuration.Items.Unlockables[unlockable.Key]); } else { unlockable.Value.SetValue(LobbyConfiguration.AllUnlockablesConfig.Unlockables[unlockable.Key]); } } foreach (KeyValuePair<string, ConfigScrapInput> item2 in Scrap) { if (Configuration.Items.Scrap.ContainsKey(item2.Key)) { item2.Value.SetValue(Configuration.Items.Scrap[item2.Key]); } else { item2.Value.SetValue(LobbyConfiguration.AllScrapConfig.Items[item2.Key]); } } foreach (KeyValuePair<string, ConfigEnemyInput> enemy in Enemies) { if (Configuration.Enemies.Enemies.ContainsKey(enemy.Key)) { enemy.Value.SetValue(Configuration.Enemies.Enemies[enemy.Key]); } else { enemy.Value.SetValue(LobbyConfiguration.AllEnemiesConfig.Enemies[enemy.Key]); } } VisionEnhancerBatteryLife.UpdateValue(); BulletProofVestDestroyOnNoHealth.UpdateValue(); BulletProofVestDamageReductionAtFullHealth.UpdateValue(); BulletProofVestDamageReductionAtNoHealth.UpdateValue(); BulletProofVestTurretDamage.UpdateValue(); BulletProofVestShotgunDamage.UpdateValue(); BulletProofVestMaxDamage.UpdateValue(); HelmetLampBatteryLife.UpdateValue(); HeadsetBatteryLife.UpdateValue(); TacticalHelmetBatteryLife.UpdateValue(); TacticalHelmetBatteryLifeWithLight.UpdateValue(); FlippersSpeed.UpdateValue(); PlayerPerks["SprintSpeed"].UpdateValue(); PlayerPerks["JumpHeight"].UpdateValue(); PlayerPerks["JumpStamina"].UpdateValue(); PlayerPerks["SprintStamina"].UpdateValue(); PlayerPerks["StaminaRegen"].UpdateValue(); PlayerPerks["FallDamage"].UpdateValue(); PlayerPerks["Damage"].UpdateValue(); PlayerPerks["Weight"].UpdateValue(); PlayerPerks["WeightSpeed"].UpdateValue(); PlayerPerks["DealDamage"].UpdateValue(); PlayerPerks["ClimbingSpeed"].UpdateValue(); PlayerPerks["InventorySlots"].UpdateValue(); ShipPerks["ScanDistance"].UpdateValue(); ShipPerks["ExtraBattery"].UpdateValue(); ShipPerks["ExtendDeadlineDiscount"].UpdateValue(); ShipPerks["LandingSpeed"].UpdateValue(); ShipPerks["DeliverySpeed"].UpdateValue(); ShipPerks["SaveLoot"].UpdateValue(); ShipPerks["TravelDiscount"].UpdateValue(); Weathers["Clear"].UpdateValue(); Weathers["Foggy"].UpdateValue(); Weathers["Rainy"].UpdateValue(); Weathers["Flooded"].UpdateValue(); Weathers["Stormy"].UpdateValue(); Weathers["Eclipsed"].UpdateValue(); MoonsContainer.UpdateValues(); } public override void Awake() { base.Awake(); ConfigContainer configContainer = GeneralTab.AddContainer("Lobby", ""); LobbySize = configContainer.AddSlider(Configuration.Lobby.Field("LobbySize"), "Lobby size"); ConfigContainer configContainer2 = GeneralTab.AddContainer("Keep open - EXPERIMENTAL", "When activated your Steam lobby will be kept open and joinable when you are in orbit. You can also activate to allow joining of players while on a moon. This will put the players into spectator mode."); KeepOpen = configContainer2.AddToggle(Configuration.Lobby.Field("KeepOpen"), "Enabled"); KeepOpenOnMoon = configContainer2.AddToggle(Configuration.Lobby.Field("KeepOpenOnMoon"), "Allow when landed"); ConfigContainer configContainer3 = GameTab.AddContainer("Day settings", "Settings to change how days behave."); LengthOfDay = configContainer3.AddSlider(Configuration.General.Field("DayLength"), "Length of day"); ConfigContainer configContainer4 = GameTab.AddContainer("Start settings", "Settings to change how a round starts."); StartCredits = configContainer4.AddNumericInput(Configuration.General.Field("StartCredits"), "Start credits", ""); ConfigContainer configContainer5 = GameTab.AddContainer("Global multipliers", "Settings to change how much scrap spawns and how valueable it is and other stuff like enemy max power."); GlobalValueMultiplier = configContainer5.AddSlider(Configuration.General.Field("GlobalScrapValueMultiplier"), "Value"); GlobalAmountMultiplier = configContainer5.AddSlider(Configuration.General.Field("GlobalScrapAmountMultiplier"), "Amount"); GlobalMaxPowerMultiplier = configContainer5.AddSlider(Configuration.General.Field("GlobalMaxPowerMultiplier"), "Max enemy power"); ConfigContainer configContainer6 = GameTab.AddContainer("Deadline", "The extend deadline option adds a command to your portable terminal to extend your deadline once per quota. You can also change the length of the deadline in general. Changes to this variable only takes effect when starting a new game or quota"); ExtendDeadline = configContainer6.AddToggle(Configuration.General.Field("EnableExtendDeadline"), "Enabled"); DeadlineLength = configContainer6.AddNumericInput(Configuration.General.Field("DeadlineLength"), "Length of deadline", ""); ConfigContainer configContainer7 = GameTab.AddContainer("Save suits after being fired", "When activated will save your suits when you are getting fired."); SaveSuits = configContainer7.AddToggle(Configuration.General.Field("SaveSuitsAfterDeath"), "Enabled"); ConfigContainer configContainer8 = GameTab.AddContainer("Enable cosmetics", "When activated players will have the ability to wear cosmetics."); Cosmetics = configContainer8.AddToggle(Configuration.General.Field("EnableCosmetics"), "Enabled"); ConfigContainer configContainer9 = GameTab.AddContainer("Portable terminal", "PLEASE NOTE: If you deactivate the portable terminal you won't have access to perks as well. There is NO replacement!"); ActivatePortableTerminal = configContainer9.AddToggle(Configuration.General.Field("ActivatePortableTerminal"), "Enabled"); ConfigContainer configContainer10 = GameTab.AddContainer("Save progress", "When deactivated allows you to customize starting XP and XP multipliers. Progress for all players will be saved in the hosts save file and reset when not meeting the quota."); SaveProgress = configContainer10.AddToggle(Configuration.General.Field("SaveProgress"), "Enabled"); configContainer10.AddEmpty(); StartXP = configContainer10.AddNumericInput(Configuration.General.Field("StartingXP"), "Start XP", "XP", 60f); XPMultiplier = configContainer10.AddSlider(Configuration.General.Field("XPMultiplier"), "XP multiplier"); ItemsContainer = ItemsTab.AddItemContainer("Store items", "Here you can configure store items and if they should be activated."); foreach (KeyValuePair<string, LobbyConfiguration.ItemConfig> item in Configuration.Items.Items) { Items[item.Key] = ItemsContainer.AddItem(item.Value, item.Key); } UnlockablesContainer = ItemsTab.AddUnlockableContainer("Unlockables", "Here you can configure unlockables and if they should be purchaseable."); foreach (KeyValuePair<string, LobbyConfiguration.UnlockableConfig> unlockable in Configuration.Items.Unlockables) { Unlockables[unlockable.Key] = UnlockablesContainer.AddUnlockable(unlockable.Value, unlockable.Key); } ScrapContainer = ItemsTab.AddScrapContainer("Scrap items", "Here you can configure scrap items and if they should spawn."); foreach (KeyValuePair<string, LobbyConfiguration.ScrapConfig> item2 in Configuration.Items.Scrap) { Scrap[item2.Key] = ScrapContainer.AddScrap(item2.Value, item2.Key); } EnemiesContainer = EnemiesTab.AddEnemyContainer("Enemies", "Here you can configure enemies power levels and if they should spawn at all."); foreach (KeyValuePair<string, LobbyConfiguration.EnemyConfig> enemy in Configuration.Enemies.Enemies) { Enemies[enemy.Key] = EnemiesContainer.AddEnemy(enemy.Value, enemy.Key); } ConfigContainer configContainer11 = ItemsTab.AddContainer("Vision enhancer", "Here you can change parameters for the vision enhancer."); VisionEnhancerBatteryLife = configContainer11.AddNumericInput(Configuration.Items.VisionEnhancer.Field("BatteryTime"), "Battery life", "secs", 60f); ConfigContainer configContainer12 = ItemsTab.AddContainer("Bulletproof vest", "Here you can change parameters for the bulletproof vest."); BulletProofVestMaxDamage = configContainer12.AddNumericInput(Configuration.Items.BulletProofVest.Field("MaxDamage"), "Max damage", "HP", 60f); BulletProofVestDestroyOnNoHealth = configContainer12.AddToggle(Configuration.Items.BulletProofVest.Field("DestroyAtNoHealth"), "Destroy on no health"); BulletProofVestTurretDamage = configContainer12.AddNumericInput(Configuration.Items.BulletProofVest.Field("TurretDamage"), "Turret damage", "HP", 60f); BulletProofVestShotgunDamage = configContainer12.AddNumericInput(Configuration.Items.BulletProofVest.Field("ShotgunDamage"), "Shotgun damage", "HP", 60f); BulletProofVestDamageReductionAtFullHealth = configContainer12.AddSlider(Configuration.Items.BulletProofVest.Field("DamageReductionAtFullHealth"), "Damage reduction at full health"); BulletProofVestDamageReductionAtNoHealth = configContainer12.AddSlider(Configuration.Items.BulletProofVest.Field("DamageReductionAtNoHealth"), "Damage reduction at no health"); ConfigContainer configContainer13 = ItemsTab.AddContainer("Helmet lamp", "Here you can change parameters for the helmet lamp."); HelmetLampBatteryLife = configContainer13.AddNumericInput(Configuration.Items.HelmetLamp.Field("BatteryTime"), "Battery life", "secs", 60f); ConfigContainer configContainer14 = ItemsTab.AddContainer("Headset", "Here you can change parameters for the headset."); HeadsetBatteryLife = configContainer14.AddNumericInput(Configuration.Items.Headset.Field("BatteryTime"), "Battery life", "secs", 60f); ConfigContainer configContainer15 = ItemsTab.AddContainer("Tactical helmet", "Here you can change parameters for the tactical helmet."); TacticalHelmetBatteryLife = configContainer15.AddNumericInput(Configuration.Items.TacticalHelmet.Field("BatteryTime"), "Battery life", "secs", 60f); TacticalHelmetBatteryLifeWithLight = configContainer15.AddNumericInput(Configuration.Items.TacticalHelmet.Field("BatteryTimeWithLight"), "Battery life with light", "secs", 60f); ConfigContainer configContainer16 = ItemsTab.AddContainer("Flippers", "Here you can change parameters for the flippers."); FlippersSpeed = configContainer16.AddSlider(Configuration.Items.Flippers.Field("Speed"), "Speed"); ConfigContainer configContainer17 = PerksTab.AddPerkContainer("Player perks", "Player perks can be purchased by every player individually and will only have an effect for the player who've bought them."); PlayerPerks["SprintSpeed"] = configContainer17.AddPerk(Configuration.PlayerPerks.SprintSpeed, "Sprint speed"); PlayerPerks["JumpHeight"] = configContainer17.AddPerk(Configuration.PlayerPerks.JumpHeight, "Jump height"); PlayerPerks["JumpStamina"] = configContainer17.AddPerk(Configuration.PlayerPerks.JumpStamina, "Jump stamina"); PlayerPerks["SprintStamina"] = configContainer17.AddPerk(Configuration.PlayerPerks.SprintStamina, "Sprint stamina"); PlayerPerks["StaminaRegen"] = configContainer17.AddPerk(Configuration.PlayerPerks.StaminaRegen, "Stamina regen"); PlayerPerks["FallDamage"] = configContainer17.AddPerk(Configuration.PlayerPerks.FallDamage, "Fall damage"); PlayerPerks["Damage"] = configContainer17.AddPerk(Configuration.PlayerPerks.Damage, "Damage"); PlayerPerks["Weight"] = configContainer17.AddPerk(Configuration.PlayerPerks.Weight, "Weight"); PlayerPerks["WeightSpeed"] = configContainer17.AddPerk(Configuration.PlayerPerks.WeightSpeed, "Weight speed"); PlayerPerks["DealDamage"] = configContainer17.AddPerk(Configuration.PlayerPerks.DealDamage, "Critical strike chance"); PlayerPerks["ClimbingSpeed"] = configContainer17.AddPerk(Configuration.PlayerPerks.ClimbingSpeed, "Climbing speed"); PlayerPerks["InventorySlots"] = configContainer17.AddPerk(Configuration.PlayerPerks.InventorySlots, "Inventory slots"); ConfigContainer configContainer18 = PerksTab.AddPerkContainer("Ship perks", "Ship perks can be purchased by every player for the whole crew and they will have an effect for the entire team."); ShipPerks["ScanDistance"] = configContainer18.AddPerk(Configuration.ShipPerks.ScanDistance, "Scan distance"); ShipPerks["ExtraBattery"] = configContainer18.AddPerk(Configuration.ShipPerks.ExtraBattery, "Extra battery"); ShipPerks["ExtendDeadlineDiscount"] = configContainer18.AddPerk(Configuration.ShipPerks.ExtendDeadlineDiscount, "Extend deadline discount"); ShipPerks["LandingSpeed"] = configContainer18.AddPerk(Configuration.ShipPerks.LandingSpeed, "Landing speed"); ShipPerks["DeliverySpeed"] = configContainer18.AddPerk(Configuration.ShipPerks.DeliverySpeed, "Delivery speed"); ShipPerks["SaveLoot"] = configContainer18.AddPerk(Configuration.ShipPerks.SaveLoot, "Save loot"); ShipPerks["TravelDiscount"] = configContainer18.AddPerk(Configuration.ShipPerks.TravelDiscount, "Travel discount"); MoonsContainer = MoonsTab.AddMoonContainer("Moons", "Here you can configure moons, their loot tables and enemy spawn table. If a moon is missing from the list, start a game once and come back here after that. They should show up then.", Configuration.Moons); ConfigContainer configContainer19 = MoonsTab.AddContainer("Weather modifiers", "Here you can modify the scrap value and amount present on moons during specific weather conditions."); ConfigContainer configContainer20 = MoonsTab.AddWeatherContainer(null, null); Weathers["Clear"] = configContainer20.AddWeather(Configuration.Moons.ClearWeather, "Clear"); Weathers["Foggy"] = configContainer20.AddWeather(Configuration.Moons.FoggyWeather, "Foggy"); Weathers["Rainy"] = configContainer20.AddWeather(Configuration.Moons.RainyWeather, "Rainy"); Weathers["Flooded"] = configContainer20.AddWeather(Configuration.Moons.FloodedWeather, "Flooded"); Weathers["Stormy"] = configContainer20.AddWeather(Configuration.Moons.StormyWeather, "Stormy"); Weathers["Eclipsed"] = configContainer20.AddWeather(Configuration.Moons.EclipsedWeather, "Eclipsed"); } } public class PlayerSettings : BaseSettings<PlayerConfiguration> { public interface ICosmeticProvider { List<Cosmetic> GetCosmetics(); } public class TestCosmeticProvider : ICosmeticProvider { private List<Cosmetic> Cosmetics; public TestCosmeticProvider() { Cosmetics = new List<Cosmetic>(); List<CosmeticInstance> list = CosmeticDatabase.AllCosmetics.Values.ToList(); for (int i = 0; i < list.Count; i++) { Cosmetics.Add(new Cosmetic { MoreCompanyInstance = list[i], Icon = list[i].icon }); } Cosmetics.OrderBy((Cosmetic v) => v.MoreCompanyInstance.cosmeticId); } public List<Cosmetic> GetCosmetics() { return Cosmetics; } } public class Cosmetic { public Texture2D Icon; public CosmeticInstance MoreCompanyInstance; internal Image SelectedBackground; internal Button Button; public void Unselect() { ((Behaviour)SelectedBackground).enabled = false; } public void Select() { ((Behaviour)SelectedBackground).enabled = true; } } [Header("File")] public ConfigTabContent FileTabContent; private ConfigToggle SaveInProfile; [Header("Hotbar")] public ConfigTabContent HotbarTabContent; private ConfigSlider HotbarAlpha; private ConfigSlider HotbarScale; private ConfigSlider HotbarSpacing; private ConfigSlider HotbarBorderWidth; private ConfigSlider HotbarY; private ConfigToggle InvertScroll; [Header("Graphics")] public ConfigTabContent GraphicsTabContent; private ConfigSlider MusicVolume; private ConfigSlider VisionEnhancerBrightness; [Header("Compability")] public ConfigTabContent CompabilityTabContent; private ConfigToggle DisableMusic; private ConfigToggle HideEquipment; private ConfigToggle HideCosmetics; private ConfigToggle AnimationsCompability; [Header("Cosmetics")] public GameObject IconTemplate; public Transform CosmeticTabsContainer; public Transform CosmeticContainer; public RawImage PlayerCamera; public DressUpDrag PlayerDragHandler; private float DressUpRotation; private float DressUpHeight; public Transform DressUpTarget; public Camera DressUpCamera; public Transform DressUpPlayer; private Transform DressUpSpine004; private Transform DressUpSpine003; private Transform DressUpArmRLower; private Transform DressUpSpine; private Transform DressUpShinL; private Transform DressUpShinR; private List<Button> CosmeticTabs = new List<Button>(); private List<GameObject> CosmeticContainers = new List<GameObject>(); private ICosmeticProvider CosmeticsProvider; private Dictionary<CosmeticType, Dictionary<string, GameObject>> SpawnedCosmetics = new Dictionary<CosmeticType, Dictionary<string, GameObject>>(); public override void ApplyConfiguration() { RemoveAllCosmetics(); HotbarAlpha.UpdateValue(); HotbarScale.UpdateValue(); HotbarBorderWidth.UpdateValue(); HotbarSpacing.UpdateValue(); HotbarY.UpdateValue(); InvertScroll.UpdateValue(); SaveInProfile.UpdateValue(); MusicVolume.UpdateValue(); VisionEnhancerBrightness.UpdateValue(); DisableMusic.UpdateValue(); HideCosmetics.UpdateValue(); HideEquipment.UpdateValue(); AnimationsCompability.UpdateValue(); if (CosmeticsProvider == null) { return; } List<Cosmetic> cosmetics = CosmeticsProvider.GetCosmetics(); foreach (Cosmetic item in cosmetics) { item.Unselect(); } foreach (string activatedCosmetic in Configuration.Cosmetics.ActivatedCosmetics) { for (int i = 0; i < cosmetics.Count; i++) { if ((Object)(object)cosmetics[i].MoreCompanyInstance != (Object)null && cosmetics[i].MoreCompanyInstance.cosmeticId == activatedCosmetic) { cosmetics[i].Select(); AddCosmetic(cosmetics[i]); break; } } } } public void SetCosmeticsProvider(ICosmeticProvider provider) { //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Expected O, but got Unknown CosmeticsProvider = provider; List<Cosmetic> cosmetics = CosmeticsProvider.GetCosmetics(); foreach (GameObject cosmeticContainer in CosmeticContainers) { int childCount = cosmeticContainer.transform.childCount; for (int num = childCount - 1; num >= 0; num--) { Transform child = cosmeticContainer.transform.GetChild(num); Object.Destroy((Object)(object)((Component)child).gameObject); } } for (int i = 0; i < cosmetics.Count; i++) { Cosmetic cosmetic = cosmetics[i]; if ((Object)(object)cosmetic.MoreCompanyInstance != (Object)null) { GameObject val = CosmeticContainers[0]; if (cosmetic.MoreCompanyInstance.cosmeticType == CosmeticType.CHEST) { val = CosmeticContainers[1]; } else if (cosmetic.MoreCompanyInstance.cosmeticType == CosmeticType.HIP) { val = CosmeticContainers[2]; } else if (cosmetic.MoreCompanyInstance.cosmeticType == CosmeticType.R_LOWER_ARM) { val = CosmeticContainers[3]; } else if (cosmetic.MoreCompanyInstance.cosmeticType == CosmeticType.L_SHIN) { val = CosmeticContainers[4]; } else if (cosmetic.MoreCompanyInstance.cosmeticType == CosmeticType.R_SHIN) { val = CosmeticContainers[5]; } GameObject val2 = Object.Instantiate<GameObject>(IconTemplate, val.transform); ((Behaviour)val2.GetComponent<Image>()).enabled = true; cosmetics[i].Button = val2.GetComponent<Button>(); ((Behaviour)cosmetics[i].Button).enabled = true; ((UnityEvent)cosmetics[i].Button.onClick).AddListener((UnityAction)delegate { ChangeCosmetic(cosmetic); }); cosmetics[i].SelectedBackground = ((Component)val2.transform.GetChild(0)).GetComponent<Image>(); ((Behaviour)cosmetics[i].SelectedBackground).enabled = false; RawImage component = ((Component)val2.transform.GetChild(2)).GetComponent<RawImage>(); component.texture = (Texture)(object)cosmetic.MoreCompanyInstance.icon; ((Behaviour)component).enabled = true; val2.SetActive(true); } } if (Configuration == null) { return; } foreach (Cosmetic item in cosmetics) { item.Unselect(); } foreach (string activatedCosmetic in Configuration.Cosmetics.ActivatedCosmetics) { for (int j = 0; j < cosmetics.Count; j++) { if ((Object)(object)cosmetics[j].MoreCompanyInstance != (Object)null && cosmetics[j].MoreCompanyInstance.cosmeticId == activatedCosmetic) { cosmetics[j].Select(); AddCosmetic(cosmetics[j]); break; } } } } private void AddCosmetic(Cosmetic cosmetic) { //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) if (!SpawnedCosmetics.ContainsKey(cosmetic.MoreCompanyInstance.cosmeticType)) { SpawnedCosmetics.Add(cosmetic.MoreCompanyInstance.cosmeticType, new Dictionary<string, GameObject>()); } Dictionary<string, GameObject> dictionary = SpawnedCosmetics[cosmetic.MoreCompanyInstance.cosmeticType]; if (!dictionary.ContainsKey(cosmetic.MoreCompanyInstance.cosmeticId)) { Transform val = SelectBone(cosmetic.MoreCompanyInstance.cosmeticType); GameObject val2 = Object.Instantiate<GameObject>(((Component)cosmetic.MoreCompanyInstance).gameObject); val2.transform.position = ((Component)val).transform.position; val2.transform.rotation = ((Component)val).transform.rotation; Transform[] componentsInChildren = val2.GetComponentsInChildren<Transform>(); for (int i = 0; i < componentsInChildren.Length; i++) { ((Component)componentsInChildren[i]).gameObject.layer = 31; } val2.transform.parent = val; Transform transform = val2.transform; transform.localScale *= DressUpPlayer.parent.lossyScale.x * 0.38f; val2.layer = 31; dictionary.Add(cosmetic.MoreCompanyInstance.cosmeticId, val2); } } private void RemoveAllCosmetics() { foreach (KeyValuePair<CosmeticType, Dictionary<string, GameObject>> spawnedCosmetic in SpawnedCosmetics) { foreach (KeyValuePair<string, GameObject> item in spawnedCosmetic.Value) { Object.Destroy((Object)(object)item.Value); } } SpawnedCosmetics = new Dictionary<CosmeticType, Dictionary<string, GameObject>>(); } private void RemoveCosmetic(Cosmetic cosmetic) { if (SpawnedCosmetics.ContainsKey(cosmetic.MoreCompanyInstance.cosmeticType)) { Dictionary<string, GameObject> dictionary = SpawnedCosmetics[cosmetic.MoreCompanyInstance.cosmeticType]; if (dictionary.ContainsKey(cosmetic.MoreCompanyInstance.cosmeticId)) { Object.Destroy((Object)(object)dictionary[cosmetic.MoreCompanyInstance.cosmeticId]); dictionary.Remove(cosmetic.MoreCompanyInstance.cosmeticId); } } } private void ChangeCosmetic(Cosmetic cosmetic) { if (Configuration.Cosmetics.ActivatedCosmetics == null) { Configuration.Cosmetics.ActivatedCosmetics = new List<string>(); } if (Configuration.Cosmetics.ActivatedCosmetics.Contains(cosmetic.MoreCompanyInstance.cosmeticId)) { cosmetic.Unselect(); Configuration.Cosmetics.ActivatedCosmetics.Remove(cosmetic.MoreCompanyInstance.cosmeticId); RemoveCosmetic(cosmetic); return; } Configuration.Cosmetics.ActivatedCosmetics.Add(cosmetic.MoreCompanyInstance.cosmeticId); if (!SpawnedCosmetics.ContainsKey(cosmetic.MoreCompanyInstance.cosmeticType)) { SpawnedCosmetics.Add(cosmetic.MoreCompanyInstance.cosmeticType, new Dictionary<string, GameObject>()); } cosmetic.Select(); AddCosmetic(cosmetic); } private Transform SelectBone(CosmeticType type) { return (Transform)(type switch { CosmeticType.HAT => DressUpSpine004, CosmeticType.CHEST => DressUpSpine003, CosmeticType.HIP => DressUpSpine, CosmeticType.R_LOWER_ARM => DressUpArmRLower, CosmeticType.L_SHIN => DressUpShinL, CosmeticType.R_SHIN => DressUpShinR, _ => null, }); } public override void Awake() { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Expected O, but got Unknown //IL_047f: Unknown result type (might be due to invalid IL or missing references) //IL_049f: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Unknown result type (might be due to invalid IL or missing references) //IL_04ca: Unknown result type (might be due to invalid IL or missing references) base.Awake(); for (int i = 0; i < CosmeticContainer.childCount; i++) { CosmeticContainers.Add(((Component)CosmeticContainer.GetChild(i)).gameObject); } for (int j = 0; j < CosmeticTabsContainer.childCount; j++) { Button button = ((Component)CosmeticTabsContainer.GetChild(j)).gameObject.GetComponent<Button>(); GameObject container = CosmeticContainers[j]; ((UnityEvent)button.onClick).AddListener((UnityAction)delegate { ChangeCosmeticTab(button, container); }); CosmeticTabs.Add(button); } Transform child = ((Component)DressUpPlayer).transform.GetChild(0).GetChild(1); DressUpSpine = child.Find("spine"); Transform val = DressUpSpine.Find("thigh.L"); DressUpShinL = val.Find("shin.L"); Transform val2 = DressUpSpine.Find("thigh.R"); DressUpShinR = val2.Find("shin.R"); Transform val3 = DressUpSpine.Find("spine.001"); Transform val4 = val3.Find("spine.002"); DressUpSpine003 = val4.Find("spine.003"); DressUpSpine004 = DressUpSpine003.Find("spine.004"); Transform val5 = DressUpSpine003.Find("shoulder.R"); Transform val6 = val5.Find("arm.R_upper"); DressUpArmRLower = val6.Find("arm.R_lower"); PresetTemplate.SetActive(false); IconTemplate.SetActive(false); ConfigContainer configContainer = HotbarTabContent.AddContainer("Hotbar", "Here you can customize the appearance of the hotbar."); HotbarAlpha = configContainer.AddSlider(Configuration.Hotbar.Field("HotbarAlpha"), "Hotbar alpha"); HotbarScale = configContainer.AddSlider(Configuration.Hotbar.Field("HotbarScale"), "Hotbar scale"); HotbarBorderWidth = configContainer.AddSlider(Configuration.Hotbar.Field("HotbarBorderWidth"), "Hotbar border width"); HotbarSpacing = configContainer.AddSlider(Configuration.Hotbar.Field("HotbarSpacing"), "Hotbar spacing"); HotbarY = configContainer.AddSlider(Configuration.Hotbar.Field("HotbarY"), "Hotbar Y pos"); InvertScroll = configContainer.AddToggle(Configuration.Hotbar.Field("InvertScroll"), "Invert scroll"); configContainer = FileTabContent.AddContainer("Save in profile", "When activated your progression file will be saved in your profile folder."); SaveInProfile = configContainer.AddToggle(Configuration.File.Field("SaveInProfile"), "Enable"); ConfigContainer configContainer2 = GraphicsTabContent.AddContainer("Audio", "Change audio volume."); MusicVolume = configContainer2.AddSlider(Configuration.Graphics.Field("MusicVolume"), "Music volume"); ConfigContainer configContainer3 = GraphicsTabContent.AddContainer("Vision enhancer", "Change how the vision enhancer looks."); VisionEnhancerBrightness = configContainer3.AddSlider(Configuration.Graphics.Field("VisionEnhancerBrightness"), "Brightness"); ConfigContainer configContainer4 = CompabilityTabContent.AddContainer("Compability", "Here you can change certain client side functionality for compability reasons. Those settings will mostly only take effect when applied BEFORE joining a game."); DisableMusic = configContainer4.AddToggle(Configuration.Compability.Field("DisableMusic"), "Disable music"); HideCosmetics = configContainer4.AddToggle(Configuration.Compability.Field("HideCosmetics"), "Hide cosmetics"); HideEquipment = configContainer4.AddToggle(Configuration.Compability.Field("HideEquipment"), "Hide equipment"); AnimationsCompability = configContainer4.AddToggle(Configuration.Compability.Field("AnimationsCompability"), "Animation compability mode"); ((Component)DressUpPlayer).transform.parent.localScale = new Vector3(1f / ((Component)DressUpPlayer).transform.parent.lossyScale.x, 1f / ((Component)DressUpPlayer).transform.parent.lossyScale.y, 1f / ((Component)DressUpPlayer).transform.parent.lossyScale.z); } internal void ChangeCosmeticTab(Button toTab, GameObject container) { //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00cd: Expected O, but got Unknown for (int i = 0; i < CosmeticContainers.Count; i++) { Button val = CosmeticTabs[i]; bool flag = (Object)(object)val == (Object)(object)toTab; CosmeticContainers[i].SetActive(flag); Graphic targetGraphic = ((Selectable)val).targetGraphic; Image val2 = (Image)(object)((targetGraphic is Image) ? targetGraphic : null); if (val2 != null) { val2.sprite = (flag ? TabActive : TabInactive); } HorizontalLayoutGroup component = ((Component)val).GetComponent<HorizontalLayoutGroup>(); Image component2 = ((Component)((Component)val).transform.GetChild(1)).GetComponent<Image>(); ((Graphic)component2).color = (flag ? new Color(0.99607843f, 0.39607844f, 0.08627451f) : new Color(0.6901961f, 23f / 85f, 0.05490196f)); ((LayoutGroup)component).padding = (flag ? new RectOffset(5, 5, 5, 0) : new RectOffset(5, 5, 5, 0)); } } public void Update() { //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_00c5: 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) if (PlayerDragHandler.Delta != Vector2.zero) { DressUpRotation += PlayerDragHandler.Delta.x * 0.2f; DressUpHeight += PlayerDragHandler.Delta.y * 0.01f; } DressUpRotation = Mathf.Clamp((DressUpRotation + 360f) % 360f, 0f, 360f); DressUpHeight = Mathf.Clamp(DressUpHeight, -0.5f, 1.5f); ((Component)DressUpCamera).transform.localPosition = new Vector3(0f, 1f + DressUpHeight, 4f); ((Component)DressUpCamera).transform.LookAt(DressUpTarget); ((Component)DressUpPlayer).transform.localRotation = Quaternion.Euler(new Vector3(0f, DressUpRotation, 0f)); } } namespace SevenZip { internal class CRC { public static readonly uint[] Table; private uint _value = uint.MaxValue; static CRC() { Table = new uint[256]; for (uint num = 0u; num < 256; num++) { uint num2 = num; for (int i = 0; i < 8; i++) { num2 = (((num2 & 1) == 0) ? (num2 >> 1) : ((num2 >> 1) ^ 0xEDB88320u)); } Table[num] = num2; } } public void Init() { _value = uint.MaxValue; } public void UpdateByte(byte b) { _value = Table[(byte)_value ^ b] ^ (_value >> 8); } public void Update(byte[] data, uint offset, uint size) { for (uint num = 0u; num < size; num++) { _value = Table[(byte)_value ^ data[offset + num]] ^ (_value >> 8); } } public uint GetDigest() { return _value ^ 0xFFFFFFFFu; } private static uint CalculateDigest(byte[] data, uint offset, uint size) { CRC cRC = new CRC(); cRC.Update(data, offset, size); return cRC.GetDigest(); } private static bool VerifyDigest(uint digest, byte[] data, uint offset, uint size) { return CalculateDigest(data, offset, size) == digest; } } internal class DataErrorException : ApplicationException { public DataErrorException() : base("Data Error") { } } internal class InvalidParamException : ApplicationException { public InvalidParamException() : base("Invalid Parameter") { } } public interface ICodeProgress { void SetProgress(long inSize, long outSize); } public interface ICoder { void Code(Stream inStream, Stream outStream, long inSize, long outSize, ICodeProgress progress); } public enum CoderPropID { DefaultProp, DictionarySize, UsedMemorySize, Order, BlockSize, PosStateBits, LitContextBits, LitPosBits, NumFastBytes, MatchFinder, MatchFinderCycles, NumPasses, Algorithm, NumThreads, EndMarker } public interface ISetCoderProperties { void SetCoderProperties(CoderPropID[] propIDs, object[] properties); } public interface IWriteCoderProperties { void WriteCoderProperties(Stream outStream); } public interface ISetDecoderProperties { void SetDecoderProperties(byte[] properties); } } namespace SevenZip.Compression.RangeCoder { internal class Encoder { public const uint kTopValue = 16777216u; private Stream Stream; public ulong Low; public uint Range; private uint _cacheSize; private byte _cache; private long StartPosition; public void SetStream(Stream stream) { Stream = stream; } public void ReleaseStream() { Stream = null; } public void Init() { StartPosition = Stream.Position; Low = 0uL; Range = uint.MaxValue; _cacheSize = 1u; _cache = 0; } public void FlushData() { for (int i = 0; i < 5; i++) { ShiftLow(); } } public void FlushStream() { Stream.Flush(); } public void CloseStream() { Stream.Close(); } public void Encode(uint start, uint size, uint total) { Low += start * (Range /= total); Range *= size; while (Range < 16777216) { Range <<= 8; ShiftLow(); } } public void ShiftLow() { if ((uint)Low < 4278190080u || (int)(Low >> 32) == 1) { byte b = _cache; do { Stream.WriteByte((byte)(b + (Low >> 32))); b = byte.MaxValue; } while (--_cacheSize != 0); _cache = (byte)((uint)Low >> 24); } _cacheSize++; Low = (uint)((int)Low << 8); } public void EncodeDirectBits(uint v, int numTotalBits) { for (int num = numTotalBits - 1; num >= 0; num--) { Range >>= 1; if (((v >> num) & 1) == 1) { Low += Range; } if (Range < 16777216) { Range <<= 8; ShiftLow(); } } } public void EncodeBit(uint size0, int numTotalBits, uint symbol) { uint num = (Range >> numTotalBits) * size0; if (symbol == 0) { Range = num; } else { Low += num; Range -= num; } while (Range < 16777216) { Range <<= 8; ShiftLow(); } } public long GetProcessedSizeAdd() { return _cacheSize + Stream.Position - StartPosition + 4; } } internal class Decoder { public const uint kTopValue = 16777216u; public uint Range; public uint Code; public Stream Stream; public void Init(Stream stream) { Stream = stream; Code = 0u; Range = uint.MaxValue; for (int i = 0; i < 5; i++) { Code = (Code << 8) | (byte)Stream.ReadByte(); } } public void ReleaseStream() { Stream = null; } public void CloseStream() { Stream.Close(); } public void Normalize() { while (Range < 16777216) { Code = (Code << 8) | (byte)Stream.ReadByte(); Range <<= 8; } } public void Normalize2() { if (Range < 16777216) { Code = (Code << 8) | (byte)Stream.ReadByte(); Range <<= 8; } } public uint GetThreshold(uint total) { return Code / (Range /= total); } public void Decode(uint start, uint size, uint total) { Code -= start * Range; Range *= size; Normalize(); } public uint DecodeDirectBits(int numTotalBits) { uint num = Range; uint num2 = Code; uint num3 = 0u; for (int num4 = numTotalBits; num4 > 0; num4--) { num >>= 1; uint num5 = num2 - num >> 31; num2 -= num & (num5 - 1); num3 = (num3 << 1) | (1 - num5); if (num < 16777216) { num2 = (num2 << 8) | (byte)Stream.ReadByte(); num <<= 8; } } Range = num; Code = num2; return num3; } public uint DecodeBit(uint size0, int numTotalBits) { uint num = (Range >> numTotalBits) * size0; uint result; if (Code < num) { result = 0u; Range = num; } else { result = 1u; Code -= num; Range -= num; } Normalize(); return result; } } internal struct BitEncoder { public const int kNumBitModelTotalBits = 11; public const uint kBitModelTotal = 2048u; private const int kNumMoveBits = 5; private const int kNumMoveReducingBits = 2; public const int kNumBitPriceShiftBits = 6; private uint Prob; private static uint[] ProbPrices; public void Init() { Prob = 1024u; } public void UpdateModel(uint symbol) { if (symbol == 0) { Prob += 2048 - Prob >> 5; } else { Prob -= Prob >> 5; } } public void Encode(Encoder encoder, uint symbol) { uint num = (encoder.Range >> 11) * Prob; if (symbol == 0) { encoder.Range = num; Prob += 2048 - Prob >> 5; } else { encoder.Low += num; encoder.Range -= num; Prob -= Prob >> 5; } if (encoder.Range < 16777216) { encoder.Range <<= 8; encoder.ShiftLow(); } } static BitEncoder() { ProbPrices = new uint[512]; for (int num = 8; num >= 0; num--) { uint num2 = (uint)(1 << 9 - num - 1); uint num3 = (uint)(1 << 9 - num); for (uint num4 = num2; num4 < num3; num4++) { ProbPrices[num4] = (uint)(num << 6) + (num3 - num4 << 6 >> 9 - num - 1); } } } public uint GetPrice(uint symbol) { return ProbPrices[(((Prob - symbol) ^ (int)(0 - symbol)) & 0x7FF) >> 2]; } public uint GetPrice0() { return ProbPrices[Prob >> 2]; } public uint GetPrice1() { return ProbPrices[2048 - Prob >> 2]; } } internal struct BitDecoder { public const int kNumBitModelTotalBits = 11; public const uint kBitModelTotal = 2048u; private const int kNumMoveBits = 5; private uint Prob; public void UpdateModel(int numMoveBits, uint symbol) { if (symbol == 0) { Prob += 2048 - Prob >> numMoveBits; } else { Prob -= Prob >> numMoveBits; } } public void Init() { Prob = 1024u; } public uint Decode(Decoder rangeDecoder) { uint num = (rangeDecoder.Range >> 11) * Prob; if (rangeDecoder.Code < num) { rangeDecoder.Range = num; Prob += 2048 - Prob >> 5; if (rangeDecoder.Range < 16777216) { rangeDecoder.Code = (rangeDecoder.Code << 8) | (byte)rangeDecoder.Stream.ReadByte(); rangeDecoder.Range <<= 8; } return 0u; } rangeDecoder.Range -= num; rangeDecoder.Code -= num; Prob -= Prob >> 5; if (rangeDecoder.Range < 16777216) { rangeDecoder.Code = (rangeDecoder.Code << 8) | (byte)rangeDecoder.Stream.ReadByte(); rangeDecoder.Range <<= 8; } return 1u; } } internal struct BitTreeEncoder { private BitEncoder[] Models; private int NumBitLevels; public BitTreeEncoder(int numBitLevels) { NumBitLevels = numBitLevels; Models = new BitEncoder[1 << numBitLevels]; } public void Init() { for (uint num = 1u; num < 1 << NumBitLevels; num++) { Models[num].Init(); } } public void Encode(Encoder rangeEncoder, uint symbol) { uint num = 1u; int num2 = NumBitLevels; while (num2 > 0) { num2--; uint num3 = (symbol >> num2) & 1u; Models[num].Encode(rangeEncoder, num3); num = (num << 1) | num3; } } public void ReverseEncode(Encoder rangeEncoder, uint symbol) { uint num = 1u; for (uint num2 = 0u; num2 < NumBitLevels; num2++) { uint num3 = symbol & 1u; Models[num].Encode(rangeEncoder, num3); num = (num << 1) | num3; symbol >>= 1; } } public uint GetPrice(uint symbol) { uint num = 0u; uint num2 = 1u; int num3 = NumBitLevels; while (num3 > 0) { num3--; uint num4 = (symbol >> num3) & 1u; num += Models[num2].GetPrice(num4); num2 = (num2 << 1) + num4; } return num; } public uint ReverseGetPrice(uint symbol) { uint num = 0u; uint num2 = 1u; for (int num3 = NumBitLevels; num3 > 0; num3--) { uint num4 = symbol & 1u; symbol >>= 1; num += Models[num2].GetPrice(num4); num2 = (num2 << 1) | num4; } return num; } public static uint ReverseGetPrice(BitEncoder[] Models, uint startIndex, int NumBitLevels, uint symbol) { uint num = 0u; uint num2 = 1u; for (int num3 = NumBitLevels; num3 > 0; num3--) { uint num4 = symbol & 1u; symbol >>= 1; num += Models[startIndex + num2].GetPrice(num4); num2 = (num2 << 1) | num4; } return num; } public static void ReverseEncode(BitEncoder[] Models, uint startIndex, Encoder rangeEncoder, int NumBitLevels, uint symbol) { uint num = 1u; for (int i = 0; i < NumBitLevels; i++) { uint num2 = symbol & 1u; Models[startIndex + num].Encode(rangeEncoder, num2); num = (num << 1) | num2; symbol >>= 1; } } } internal struct BitTreeDecoder { private BitDecoder[] Models; private int NumBitLevels; public BitTreeDecoder(int numBitLevels) { NumBitLevels = numBitLevels; Models = new BitDecoder[1 << numBitLevels]; } public void Init() { for (uint num = 1u; num < 1 << NumBitLevels; num++) { Models[num].Init(); } } public uint Decode(Decoder rangeDecoder) { uint num = 1u; for (int num2 = NumBitLevels; num2 > 0; num2--) { num = (num << 1) + Models[num].Decode(rangeDecoder); } return num - (uint)(1 << NumBitLevels); } public uint ReverseDecode(Decoder rangeDecoder) { uint num = 1u; uint num2 = 0u; for (int i = 0; i < NumBitLevels; i++) { uint num3 = Models[num].Decode(rangeDecoder); num <<= 1; num += num3; num2 |= num3 << i; } return num2; } public static uint ReverseDecode(BitDecoder[] Models, uint startIndex, Decoder rangeDecoder, int NumBitLevels) { uint num = 1u; uint num2 = 0u; for (int i = 0; i < NumBitLevels; i++) { uint num3 = Models[startIndex + num].Decode(rangeDecoder); num <<= 1; num += num3; num2 |= num3 << i; } return num2; } } } namespace SevenZip.Compression.LZ { internal interface IInWindowStream { void SetStream(Stream inStream); void Init(); void ReleaseStream(); byte GetIndexByte(int index); uint GetMatchLen(int index, uint distance, uint limit); uint GetNumAvailableBytes(); } internal interface IMatchFinder : IInWindowStream { void Create(uint historySize, uint keepAddBufferBefore, uint matchMaxLen, uint keepAddBufferAfter); uint GetMatches(uint[] distances); void Skip(uint num); } public class BinTree : InWindow, IMatchFinder, IInWindowStream { private uint _cyclicBufferPos; private uint _cyclicBufferSize = 0u; private uint _matchMaxLen; private uint[] _son; private uint[] _hash; private uint _cutValue = 255u; private uint _hashMask; private uint _hashSizeSum = 0u; private bool HASH_ARRAY = true; private const uint kHash2Size = 1024u; private const uint kHash3Size = 65536u; private const uint kBT2HashSize = 65536u; private const uint kStartMaxLen = 1u; private const uint kHash3Offset = 1024u; private const uint kEmptyHashValue = 0u; private const uint kMaxValForNormalize = 2147483647u; private uint kNumHashDirectBytes = 0u; private uint kMinMatchCheck = 4u; private uint kFixHashSize = 66560u; public void SetType(int numHashBytes) { HASH_ARRAY = numHashBytes > 2; if (HASH_ARRAY) { kNumHashDirectBytes = 0u; kMinMatchCheck = 4u; kFixHashSize = 66560u; } else { kNumHashDirectBytes = 2u; kMinMatchCheck = 3u; kFixHashSize = 0u; } } public new void SetStream(Stream stream) { base.SetStream(stream); } public new void ReleaseStream() { base.ReleaseStream(); } public new void Init() { base.Init(); for (uint num = 0u; num < _hashSizeSum; num++) { _hash[num] = 0u; } _cyclicBufferPos = 0u; ReduceOffsets(-1); } public new void MovePos() { if (++_cyclicBufferPos >= _cyclicBufferSize) { _cyclicBufferPos = 0u; } base.MovePos(); if (_pos == int.MaxValue) { Normalize(); } } public new byte GetIndexByte(int index) { return base.GetIndexByte(index); } public new uint GetMatchLen(int index, uint distance, uint limit) { return base.GetMatchLen(index, distance, limit); } public new uint GetNumAvailableBytes() { return base.GetNumAvailableBytes(); } public void Create(uint historySize, uint keepAddBufferBefore, uint matchMaxLen, uint keepAddBufferAfter) { if (historySize > 2147483391) { throw new Exception(); } _cutValue = 16 + (matchMaxLen >> 1); uint keepSizeReserv = (historySize + keepAddBufferBefore + matchMaxLen + keepAddBufferAfter) / 2 + 256; Create(historySize + keepAddBufferBefore, matchMaxLen + keepAddBufferAfter, keepSizeReserv); _matchMaxLen = matchMaxLen; uint num = historySize + 1; if (_cyclicBufferSize != num) { _son = new uint[(_cyclicBufferSize = num) * 2]; } uint num2 = 65536u; if (HASH_ARRAY) { num2 = historySize - 1; num2 |= num2 >> 1; num2 |= num2 >> 2; num2 |= num2 >> 4; num2 |= num2 >> 8; num2 >>= 1; num2 |= 0xFFFFu; if (num2 > 16777216) { num2 >>= 1; } _hashMask = num2; num2++; num2 += kFixHashSize; } if (num2 != _hashSizeSum) { _hash = new uint[_hashSizeSum = num2]; } } public uint GetMatches(uint[] distances) { uint num; if (_pos + _matchMaxLen <= _streamPos) { num = _matchMaxLen; } else { num = _streamPos - _pos; if (num < kMinMatchCheck) { MovePos(); return 0u; } } uint num2 = 0u; uint num3 = ((_pos > _cyclicBufferSize) ? (_pos - _cyclicBufferSize) : 0u); uint num4 = _bufferOffset + _pos; uint num5 = 1u; uint num6 = 0u; uint num7 = 0u; uint num9; if (HASH_ARRAY) { uint num8 = CRC.Table[_bufferBase[num4]] ^ _bufferBase[num4 + 1]; num6 = num8 & 0x3FFu; num8 ^= (uint)(_bufferBase[num4 + 2] << 8); num7 = num8 & 0xFFFFu; num9 = (num8 ^ (CRC.Table[_bufferBase[num4 + 3]] << 5)) & _hashMask; } else { num9 = (uint)(_bufferBase[num4] ^ (_bufferBase[num4 + 1] << 8)); } uint num10 = _hash[kFixHashSize + num9]; if (HASH_ARRAY) { uint num11 = _hash[num6]; uint num12 = _hash[1024 + num7]; _hash[num6] = _pos; _hash[1024 + num7] = _pos; if (num11 > num3 && _bufferBase[_bufferOffset + num11] == _bufferBase[num4]) { num5 = (distances[num2++] = 2u); distances[num2++] = _pos - num11 - 1; } if (num12 > num3 && _bufferBase[_bufferOffset + num12] == _bufferBase[num4]) { if (num12 == num11) { num2 -= 2; } num5 = (distances[num2++] = 3u); distances[num2++] = _pos - num12 - 1; num11 = num12; } if (num2 != 0 && num11 == num10) { num2 -= 2; num5 = 1u; } } _hash[kFixHashSize + num9] = _pos; uint num13 = (_cyclicBufferPos << 1) + 1; uint num14 = _cyclicBufferPos << 1; uint val; uint val2 = (val = kNumHashDirectBytes); if (kNumHashDirectBytes != 0 && num10 > num3 && _bufferBase[_bufferOffset + num10 + kNumHashDirectBytes] != _bufferBase[num4 + kNumHashDirectBytes]) { num5 = (distances[num2++] = kNumHashDirectBytes); distances[num2++] = _pos - num10 - 1; } uint cutValue = _cutValue; while (true) { if (num10 <= num3 || cutValue-- == 0) { _son[num13] = (_son[num14] = 0u); break; } uint num15 = _pos - num10; uint num16 = ((num15 <= _cyclicBufferPos) ? (_cyclicBufferPos - num15) : (_cyclicBufferPos - num15 + _cyclicBufferSize)) << 1; uint num17 = _bufferOffset + num10; uint num18 = Math.Min(val2, val); if (_bufferBase[num17 + num18] == _bufferBase[num4 + num18]) { while (++num18 != num && _bufferBase[num17 + num18] == _bufferBase[num4 + num18]) { } if (num5 < num18) { num5 = (distances[num2++] = num18); distances[num2++] = num15 - 1; if (num18 == num) { _son[num14] = _son[num16]; _son[num13] = _son[num16 + 1]; break; } } } if (_bufferBase[num17 + num18] < _bufferBase[num4 + num18]) { _son[num14] = num10; num14 = num16 + 1; num10 = _son[num14]; val = num18; } else { _son[num13] = num10; num13 = num16; num10 = _son[num13]; val2 = num18; } } MovePos(); return num2; } public void Skip(uint num) { do { uint num2; if (_pos + _matchMaxLen <= _streamPos) { num2 = _matchMaxLen; } else { num2 = _streamPos - _pos; if (num2 < kMinMatchCheck) { MovePos(); continue; } } uint num3 = ((_pos > _cyclicBufferSize) ? (_pos - _cyclicBufferSize) : 0u); uint num4 = _bufferOffset + _pos; uint num8; if (HASH_ARRAY) { uint num5 = CRC.Table[_bufferBase[num4]] ^ _bufferBase[num4 + 1]; uint num6 = num5 & 0x3FFu; _hash[num6] = _pos; num5 ^= (uint)(_bufferBase[num4 + 2] << 8); uint num7 = num5 & 0xFFFFu; _hash[1024 + num7] = _pos; num8 = (num5 ^ (CRC.Table[_bufferBase[num4 + 3]] << 5)) & _hashMask; } else { num8 = (uint)(_bufferBase[num4] ^ (_bufferBase[num4 + 1] << 8)); } uint num9 = _hash[kFixHashSize + num8]; _hash[kFixHashSize + num8] = _pos; uint num10 = (_cyclicBufferPos << 1) + 1; uint num11 = _cyclicBufferPos << 1; uint val; uint val2 = (val = kNumHashDirectBytes); uint cutValue = _cutValue; while (true) { if (num9 <= num3 || cutValue-- == 0) { _son[num10] = (_son[num11] = 0u); break; } uint num12 = _pos - num9; uint num13 = ((num12 <= _cyclicBufferPos) ? (_cyclicBufferPos - num12) : (_cyclicBufferPos - num12 + _cyclicBufferSize)) << 1; uint num14 = _bufferOffset + num9; uint num15 = Math.Min(val2, val); if (_bufferBase[num14 + num15] == _bufferBase[num4 + num15]) { while (++num15 != num2 && _bufferBase[num14 + num15] == _bufferBase[num4 + num15]) { } if (num15 == num2) { _son[num11] = _son[num13]; _son[num10] = _son[num13 + 1]; break; } } if (_bufferBase[num14 + num15] < _bufferBase[num4 + num15]) { _son[num11] = num9; num11 = num13 + 1; num9 = _son[num11]; val = num15; } else { _son[num10] = num9; num10 = num13; num9 = _son[num10]; val2 = num15; } } MovePos(); } while (--num != 0); } private void NormalizeLinks(uint[] items, uint numItems, uint subValue) { for (uint num = 0u; num < numItems; num++) { uint num2 = items[num]; num2 = ((num2 > subValue) ? (num2 - subValue) : 0u); items[num] = num2; } } private void Normalize() { uint subValue = _pos - _cyclicBufferSize; NormalizeLinks(_son, _cyclicBufferSize * 2, subValue); NormalizeLinks(_hash, _hashSizeSum, subValue); ReduceOffsets((int)subValue); } public void SetCutValue(uint cutValue) { _cutValue = cutValue; } } public class InWindow { public byte[] _bufferBase = null; private Stream _stream; private uint _posLimit; private bool _streamEndWasReached; private uint _pointerToLastSafePosition; public uint _bufferOffset; public uint _blockSize; public uint _pos; private uint _keepSizeBefore; private uint _keepSizeAfter; public uint _streamPos; public void MoveBlock() { uint num = _bufferOffset + _pos - _keepSizeBefore; if (num != 0) { num--; } uint num2 = _bufferOffset + _streamPos - num; for (uint num3 = 0u; num3 < num2; num3++) { _bufferBase[num3] = _bufferBase[num + num3]; } _bufferOffset -= num; } public virtual void ReadBlock() { if (_streamEndWasReached) { return; } while (true) { int num = (int)(0 - _bufferOffset + _blockSize - _streamPos); if (num == 0) { return; } int num2 = _stream.Read(_bufferBase, (int)(_bufferOffset + _streamPos), num); if (num2 == 0) { break; } _streamPos += (uint)num2; if (_streamPos >= _pos + _keepSizeAfter) { _posLimit = _streamPos - _keepSizeAfter; } } _posLimit = _streamPos; uint num3 = _bufferOffset + _posLimit; if (num3 > _pointerToLastSafePosition) { _posLimit = _pointerToLastSafePosition - _bufferOffset; } _streamEndWasReached = true; } private void Free() { _bufferBase = null; } public void Create(uint keepSizeBefore, uint keepSizeAfter, uint keepSizeReserv) { _keepSizeBefore = keepSizeBefore; _keepSizeAfter = keepSizeAfter; uint num = keepSizeBefore + keepSizeAfter + keepSizeReserv; if (_bufferBase == null || _blockSize != num) { Free(); _blockSize = num; _bufferBase = new byte[_blockSize]; } _pointerToLastSafePosition = _blockSize - keepSizeAfter; } public void SetStream(Stream stream) { _stream = stream; } public void ReleaseStream() { _stream = null; } public void Init() { _bufferOffset = 0u; _pos = 0u; _streamPos = 0u; _streamEndWasReached = false; ReadBlock(); } public void MovePos() { _pos++; if (_pos > _posLimit) { uint num = _bufferOffset + _pos; if (num > _pointerToLastSafePosition) { MoveBlock(); } ReadBlock(); } } public byte GetIndexByte(int index) { return _bufferBase[_bufferOffset + _pos + index]; } public uint GetMatchLen(int index, uint distance, uint limit) { if (_streamEndWasReached && _pos + index + limit > _streamPos) { limit = _streamPos - (uint)(int)(_pos + index); } distance++; uint num = _bufferOffset + _pos + (uint)index; uint num2; for (num2 = 0u; num2 < limit && _bufferBase[num + num2] == _bufferBase[num + num2 - distance]; num2++) { } return num2; } public uint GetNumAvailableBytes() { return _streamPos - _pos; } public void ReduceOffsets(int subValue) { _bufferOffset += (uint)subValue; _posLimit -= (uint)subValue; _pos -= (uint)subValue; _streamPos -= (uint)subValue; } } public class OutWindow { private byte[] _buffer = null; private uint _pos; private uint _windowSize = 0u; private uint _streamPos; private Stream _stream; public uint TrainSize = 0u; public void Create(uint windowSize) { if (_windowSize != windowSize) { _buffer = new byte[windowSize]; } _windowSize = windowSize; _pos = 0u; _streamPos = 0u; } public void Init(Stream stream, bool solid) { ReleaseStream(); _stream = stream; if (!solid) { _streamPos = 0u; _pos = 0u; TrainSize = 0u; } } public bool Train(Stream stream) { long length = stream.Length; uint num = (TrainSize = (uint)((length < _windowSize) ? length : _windowSize)); stream.Position = length - num; _streamPos = (_pos = 0u); while (num != 0) { uint num2 = _windowSize - _pos; if (num < num2) { num2 = num; } int num3 = stream.Read(_buffer, (int)_pos, (int)num2); if (num3 == 0) { return false; } num -= (uint)num3; _pos += (uint)num3; _streamPos += (uint)num3; if (_pos == _windowSize) { _streamPos = (_pos = 0u); } } return true; } public void ReleaseStream() { Flush(); _stream = null; } public void Flush() { uint num = _pos - _streamPos; if (num != 0) { _stream.Write(_buffer, (int)_streamPos, (int)num); if (_pos >= _windowSize) { _pos = 0u; } _streamPos = _pos; } } public void CopyBlock(uint distance, uint len) { uint num = _pos - distance - 1; if (num >= _windowSize) { num += _windowSize; } while (len != 0) { if (num >= _windowSize) { num = 0u; } _buffer[_pos++] = _buffer[num++]; if (_pos >= _windowSize) { Flush(); } len--; } } public void PutByte(byte b) { _buffer[_pos++] = b; if (_pos >= _windowSize) { Flush(); } } public byte GetByte(uint distance) { uint num = _pos - distance - 1; if (num >= _windowSize) { num += _windowSize; } return _buffer[num]; } } } namespace SevenZip.Compression.LZMA { internal abstract class Base { public struct State { public uint Index; public void Init() { Index = 0u; } public void UpdateChar() { if (Index < 4) { Index = 0u; } else if (Index < 10) { Index -= 3u; } else { Index -= 6u; } } public void UpdateMatch() { Index = ((Index < 7) ? 7u : 10u); } public void UpdateRep() { Index = ((Index < 7) ? 8u : 11u); } public void UpdateShortRep() { Index = ((Index < 7) ? 9u : 11u); } public bool IsCharState() { return Index < 7; } } public const uint kNumRepDistances = 4u; public const uint kNumStates = 12u; public const int kNumPosSlotBits = 6; public const int kDicLogSizeMin = 0; public const int kNumLenToPosStatesBits = 2; public const uint kNumLenToPosStates = 4u; public const uint kMatchMinLen = 2u; public const int kNumAlignBits = 4; public const uint kAlignTableSize = 16u; public const uint kAlignMask = 15u; public const uint kStartPosModelIndex = 4u; public const uint kEndPosModelIndex = 14u; public const uint kNumPosModels = 10u; public const uint kNumFullDistances = 128u; public const uint kNumLitPosStatesBitsEncodingMax = 4u; public const uint kNumLitContextBitsMax = 8u; public const int kNumPosStatesBitsMax = 4; public const uint kNumPosStatesMax = 16u; public const int kNumPosStatesBitsEncodingMax = 4; public const uint kNumPosStatesEncodingMax = 16u; public const int kNumLowLenBits = 3; public const int kNumMidLenBits = 3; public const int kNumHighLenBits = 8; public const uint kNumLowLenSymbols = 8u; public const uint kNumMidLenSymbols = 8u; public const uint kNumLenSymbols = 272u; public const uint kMatchMaxLen = 273u; public static uint GetLenToPosState(uint len) { len -= 2; if (len < 4) { return len; } return 3u; } } public class Decoder : ICoder, ISetDecoderProperties { private class LenDecoder { private BitDecoder m_Choice = default(BitDecoder); private BitDecoder m_Choice2 = default(BitDecoder); private BitTreeDecoder[] m_LowCoder = new BitTreeDecoder[16]; private BitTreeDecoder[] m_MidCoder = new BitTreeDecoder[16]; private BitTreeDecoder m_HighCoder = new BitTreeDecoder(8); private uint m_NumPosStates = 0u; public void Create(uint numPosStates) { for (uint num = m_NumPosStates; num < numPosStates; num++) { m_LowCoder[num] = new BitTreeDecoder(3); m_MidCoder[num] = new BitTreeDecoder(3); } m_NumPosStates = numPosStates; } public void Init() { m_Choice.Init(); for (uint num = 0u; num < m_NumPosStates; num++) { m_LowCoder[num].Init(); m_MidCoder[num].Init(); } m_Choice2.Init(); m_HighCoder.Init(); } public uint Decode(SevenZip.Compression.RangeCoder.Decoder rangeDecoder, uint posState) { if (m_Choice.Decode(rangeDecoder) == 0) { return m_LowCoder[posState].Decode(rangeDecoder); } uint num = 8u; if (m_Choice2.Decode(rangeDecoder) == 0) { num += m_MidCoder[posState].Decode(rangeDecoder); } else { num += 8; num += m_HighCoder.Decode(rangeDecoder); } return num; } } private class LiteralDecoder { private struct Decoder2 { private BitDecoder[] m_Decoders; public void Create() { m_Decoders = new BitDecoder[768]; } public void Init() { for (int i = 0; i < 768; i++) { m_Decoders[i].Init(); } } public byte DecodeNormal(SevenZip.Compression.RangeCoder.Decoder rangeDecoder) { uint num = 1u; do { num = (num << 1) | m_Decoders[num].Decode(rangeDecoder); } while (num < 256); return (byte)num; } public byte DecodeWithMatchByte(SevenZip.Compression.RangeCoder.Decoder rangeDecoder, byte matchByte) { uint num = 1u; do { uint num2 = (uint)(matchByte >> 7) & 1u; matchByte <<= 1; uint num3 = m_Decoders[(1 + num2 << 8) + num].Decode(rangeDecoder); num = (num << 1) | num3; if (num2 != num3) { while (num < 256) { num = (num << 1) | m_Decoders[num].Decode(rangeDecoder); } break; } } while (num < 256); return (byte)num; } } private Decoder2[] m_Coders; private int m_NumPrevBits; private int m_NumPosBits; private uint m_PosMask; public void Create(int numPosBits, int numPrevBits) { if (m_Coders == null || m_NumPrevBits != numPrevBits || m_NumPosBits != numPosBits) { m_NumPosBits = numPosBits; m_PosMask = (uint)((1 << numPosBits) - 1); m_NumPrevBits = numPrevBits; uint num = (uint)(1 << m_NumPrevBits + m_NumPosBits); m_Coders = new Decoder2[num]; for (uint num2 = 0u; num2 < num; num2++) { m_Coders[num2].Create(); } } } public void Init() { uint num = (uint)(1 << m_NumPrevBits + m_NumPosBits); for (uint num2 = 0u; num2 < num; num2++) { m_Coders[num2].Init(); } } private uint GetState(uint pos, byte prevByte) { return ((pos & m_PosMask) << m_NumPrevBits) + (uint)(prevByte >> 8 - m_NumPrevBits); } public byte DecodeNormal(SevenZip.Compression.RangeCoder.Decoder rangeDecoder, uint pos, byte prevByte) { return m_Coders[GetState(pos, prevByte)].DecodeNormal(rangeDecoder); } public byte DecodeWithMatchByte(SevenZip.Compression.RangeCoder.Decoder rangeDecoder, uint pos, byte prevByte, byte matchByte) { return m_Coders[GetState(pos, prevByte)].DecodeWithMatchByte(rangeDecoder, matchByte); } } private OutWindow m_OutWindow = new OutWindow(); private SevenZip.Compression.RangeCoder.Decoder m_RangeDecoder = new SevenZip.Compression.RangeCoder.Decoder(); private BitDecoder[] m_IsMatchDecoders = new BitDecoder[192]; private BitDecoder[] m_IsRepDecoders = new BitDecoder[12]; private BitDecoder[] m_IsRepG0Decoders = new BitDecoder[12]; private BitDecoder[] m_IsRepG1Decoders = new BitDecoder[12]; private BitDecoder[] m_IsRepG2Decoders = new BitDecoder[12]; private BitDecoder[] m_IsRep0LongDecoders = new BitDecoder[192]; private BitTreeDecoder[] m_PosSlotDecoder = new BitTreeDecoder[4]; private BitDecoder[] m_PosDecoders = new BitDecoder[114]; private BitTreeDecoder m_PosAlignDecoder = new BitTreeDecoder(4); private LenDecoder m_LenDecoder = new LenDecoder(); private LenDecoder m_RepLenDecoder = new LenDecoder(); private LiteralDecoder m_LiteralDecoder = new LiteralDecoder(); private uint m_DictionarySize; private uint m_DictionarySizeCheck; private uint m_PosStateMask; private bool _solid = false; public Decoder() { m_DictionarySize = uint.MaxValue; for (int i = 0; (long)i < 4L; i++) { m_PosSlotDecoder[i] = new BitTreeDecoder(6); } } private void SetDictionarySize(uint dictionarySize) { if (m_DictionarySize != dictionarySize) { m_DictionarySize = dictionarySize; m_DictionarySizeCheck = Math.Max(m_DictionarySize, 1u); uint windowSize = Math.Max(m_DictionarySizeCheck, 4096u); m_OutWindow.Create(windowSize); } } private void SetLiteralProperties(int lp, int lc) { if (lp > 8) { throw new InvalidParamException(); } if (lc > 8) { throw new InvalidParamException(); } m_LiteralDecoder.Create(lp, lc); } private void SetPosBitsProperties(int pb) { if (pb > 4) { throw new InvalidParamException(); } uint num = (uint)(1 << pb); m_LenDecoder.Create(num); m_RepLenDecoder.Create(num); m_PosStateMask = num - 1; } private void Init(Stream inStream, Stream outStream) { m_RangeDecoder.Init(inStream); m_OutWindow.Init(outStream, _solid); for (uint num = 0u; num < 12; num++) { for (uint num2 = 0u; num2 <= m_PosStateMask; num2++) { uint num3 = (num << 4) + num2; m_IsMatchDecoders[num3].Init(); m_IsRep0LongDecoders[num3].Init(); } m_IsRepDecoders[num].Init(); m_IsRepG0Decoders[num].Init(); m_IsRepG1Decoders[num].Init(); m_IsRepG2Decoders[num].Init(); } m_LiteralDecoder.Init(); for (uint num = 0u; num < 4; num++) { m_PosSlotDecoder[num].Init(); } for (uint num = 0u; num < 114; num++) { m_PosDecoders[num].Init(); } m_LenDecoder.Init(); m_RepLenDecoder.Init(); m_PosAlignDecoder.Init(); } public void Code(Stream inStream, Stream outStream, long inSize, long outSize, ICodeProgress progress) { Init(inStream, outStream); Base.State state = default(Base.State); state.Init(); uint num = 0u; uint num2 = 0u; uint num3 = 0u; uint num4 = 0u; ulong num5 = 0uL; if (num5 < (ulong)outSize) { if (m_IsMatchDecoders[state.Index << 4].Decode(m_RangeDecoder) != 0) { throw new DataErrorException(); } state.UpdateChar(); byte b = m_LiteralDecoder.DecodeNormal(m_RangeDecoder, 0u, 0); m_OutWindow.PutByte(b); num5++; } while (num5 < (ulong)outSize) { uint num6 = (uint)(int)num5 & m_PosStateMask; if (m_IsMatchDecoders[(state.Index << 4) + num6].Decode(m_RangeDecoder) == 0) { byte @byte = m_OutWindow.GetByte(0u); byte b2 = (state.IsCharState() ? m_LiteralDecoder.DecodeNormal(m_RangeDecoder, (uint)num5, @byte) : m_LiteralDecoder.DecodeWithMatchByte(m_RangeDecoder, (uint)num5, @byte, m_OutWindow.GetByte(num))); m_OutWindow.PutByte(b2); state.UpdateChar(); num5++; continue; } uint num8; if (m_IsRepDecoders[state.Index].Decode(m_RangeDecoder) == 1) { if (m_IsRepG0Decoders[state.Index].Decode(m_RangeDecoder) == 0) { if (m_IsRep0LongDecoders[(state.Index << 4) + num6].Decode(m_RangeDecoder) == 0) { state.UpdateShortRep(); m_OutWindow.PutByte(m_OutWindow.GetByte(num)); num5++; continue; } } else { uint num7; if (m_IsRepG1Decoders[state.Index].Decode(m_RangeDecoder) == 0) { num7 = num2; } else { if (m_IsRepG2Decoders[state.Index].Decode(m_RangeDecoder) == 0) { num7 = num3; } else { num7 = num4; num4 = num3; } num3 = num2; } num2 = num; num = num7; } num8 = m_RepLenDecoder.Decode(m_RangeDecoder, num6) + 2; state.UpdateRep(); } else { num4 = num3; num3 = num2; num2 = num; num8 = 2 + m_LenDecoder.Decode(m_RangeDecoder, num6); state.UpdateMatch(); uint num9 = m_PosSlotDecoder[Base.GetLenToPosState(num8)].Decode(m_RangeDecoder); if (num9 >= 4) { int num10 = (int)((num9 >> 1) - 1); num = (2 | (num9 & 1)) << num10; if (num9 < 14) { num += BitTreeDecoder.ReverseDecode(m_PosDecoders, num - num9 - 1, m_RangeDecoder, num10); } else { num += m_RangeDecoder.DecodeDirectBits(num10 - 4) << 4; num += m_PosAlignDecoder.ReverseDecode(m_RangeDecoder); } } else { num = num9; } } if (num >= m_OutWindow.TrainSize + num5 || num >= m_DictionarySizeCheck) { if (num == uint.MaxValue) { break; } throw new DataErrorException(); } m_OutWindow.CopyBlock(num, num8); num5 += num8; } m_OutWindow.Flush(); m_OutWindow.ReleaseStream(); m_RangeDecoder.ReleaseStream(); } public void SetDecoderProperties(byte[] properties) { if (properties.Length < 5) { throw new InvalidParamException(); } int lc = properties[0] % 9; int num = properties[0] / 9; int lp = num % 5; int num2 = num / 5; if (num2 > 4) { throw new InvalidParamException(); } uint num3 = 0u; for (int i = 0; i < 4; i++) { num3 += (uint)(properties[1 + i] << i * 8); } SetDictionarySize(num3); SetLiteralProperties(lp, lc); SetPosBitsProperties(num2); } public bool Train(Stream stream) { _solid = true; return m_OutWindow.Train(stream); } } public class Encoder : ICoder, ISetCoderProperties, IWriteCoderProperties { private enum EMatchFinderType { BT2, BT4 } private class LiteralEncoder { public struct Encoder2 { private BitEncoder[] m_Encoders; public void Create() { m_Encoders = new BitEncoder[768]; } public void Init() { for (int i = 0; i < 768; i++) { m_Encoders[i].Init(); } } public void Encode(SevenZip.Compression.RangeCoder.Encoder rangeEncoder, byte symbol) { uint num = 1u; for (int num2 = 7; num2 >= 0; num2--) { uint num3 = (uint)(symbol >> num2) & 1u; m_Encoders[num].Encode(rangeEncoder, num3); num = (num << 1) | num3; } } public void EncodeMatched(SevenZip.Compression.RangeCoder.Encoder rangeEncoder, byte matchByte, byte symbol) { uint num = 1u; bool flag = true; for (int num2 = 7; num2 >= 0; num2--) { uint num3 = (uint)(symbol >> num2) & 1u; uint num4 = num; if (flag) { uint num5 = (uint)(matchByte >> num2) & 1u; num4 += 1 + num5 << 8; flag = num5 == num3; } m_Encoders[num4].Encode(rangeEncoder, num3); num = (num << 1) | num3; } } public uint GetPrice(bool matchMode, byte matchByte, byte symbol) { uint num = 0u; uint num2 = 1u; int num3 = 7; if (matchMode) { while (num3 >= 0) { uint num4 = (uint)(matchByte >> num3) & 1u; uint num5 = (uint)(symbol >> num3) & 1u; num += m_Encoders[(1 + num4 << 8) + num2].GetPrice(num5); num2 = (num2 << 1) | num5; if (num4 != num5) { num3--; break; } num3--; } } while (num3 >= 0) { uint num6 = (uint)(symbol >> num3) & 1u; num += m_Encoders[num2].GetPrice(num6); num2 = (num2 << 1) | num6; num3--; } return num; } } private Encoder2[] m_Coders; private int m_NumPrevBits; private int m_NumPosBits; private uint m_PosMask; public void Create(int numPosBits, int numPrevBits) { if (m_Coders == null || m_NumPrevBits != numPrevBits || m_NumPosBits != numPosBits) { m_NumPosBits = numPosBits; m_PosMask = (uint)((1 << numPosBits) - 1); m_NumPrevBits = numPrevBits; uint num = (uint)(1 << m_NumPrevBits + m_NumPosBits); m_Coders = new Encoder2[num]; for (uint num2 = 0u; num2 < num; num2++) { m_Coders[num2].Create(); } } } public void Init() { uint num = (uint)(1 << m_NumPrevBits + m_NumPosBits); for (uint num2 = 0u; num2 < num; num2++) { m_Coders[num2].Init(); } } public Encoder2 GetSubCoder(uint pos, byte prevByte) { return m_Coders[(int)((pos & m_PosMask) << m_NumPrevBits) + (prevByte >> 8 - m_NumPrevBits)]; } } private class LenEncoder { private BitEncoder _choice = default(BitEncoder); private BitEncoder _choice2 = default(BitEncoder); private BitTreeEncoder[] _lowCoder = new BitTreeEncoder[16]; private BitTreeEncoder[] _midCoder = new BitTreeEncoder[16]; private BitTreeEncoder _highCoder = new BitTreeEncoder(8); public LenEncoder() { for (uint num = 0u; num < 16; num++) { _lowCoder[num] = new BitTreeEncoder(3); _midCoder[num] = new BitTreeEncoder(3); } } public void Init(uint numPosStates) { _choice.Init(); _choice2.Init(); for (uint num = 0u; num < numPosStates; num++) { _lowCoder[num].Init(); _midCoder[num].Init(); } _highCoder.Init(); } public void Encode(SevenZip.Compression.RangeCoder.Encoder rangeEncoder, uint symbol, uint posState) { if (symbol < 8) { _choice.Encode(rangeEncoder, 0u); _lowCoder[posState].Encode(rangeEncoder, symbol); return; } symbol -= 8; _choice.Encode(rangeEncoder, 1u); if (symbol < 8) { _choice2.Encode(rangeEncoder, 0u); _midCoder[posState].Encode(rangeEncoder, symbol); } else { _choice2.Encode(rangeEncoder, 1u); _highCoder.Encode(rangeEncoder, symbol - 8); } } public void SetPrices(uint posState, uint numSymbols, uint[] prices, uint st) { uint price = _choice.GetPrice0(); uint price2 = _choice.GetPrice1(); uint num = price2 + _choice2.GetPrice0(); uint num2 = price2 + _choice2.GetPrice1(); uint num3 = 0u; for (num3 = 0u; num3 < 8; num3++) { if (num3 >= numSymbols) { return; } prices[st + num3] = price + _lowCoder[posState].GetPrice(num3); } for (; num3 < 16; num3++) { if (num3 >= numSymbols) { return; } prices[st + num3] = num + _midCoder[posState].GetPrice(num3 - 8); } for (; num3 < numSymbols; num3++) { prices[st + num3] = num2 + _highCoder.GetPrice(num3 - 8 - 8); } } } private class LenPriceTableEncoder : LenEncoder { private uint[] _prices = new uint[4352]; private uint _tableSize; private uint[] _counters = new uint[16]; public void SetTableSize(uint tableSize) { _tableSize = tableSize; } public uint GetPrice(uint symbol, uint posState) { return _prices[posState * 272 + symbol]; } private void UpdateTable(uint posState) { SetPrices(posState, _tableSize, _prices, posState * 272); _counters[posState] = _tableSize; } public void UpdateTables(uint numPosStates) { for (uint num = 0u; num < numPosStates; num++) { UpdateTable(num); } } public new void Encode(SevenZip.Compression.RangeCoder.Encoder rangeEncoder, uint symbol, uint posState) { base.Encode(rangeEncoder, symbol, posState); if (--_counters[posState] == 0) { UpdateTable(posState); } } } private class Optimal { public Base.State State; public bool Prev1IsChar; public bool Prev2; public uint PosPrev2; public uint BackPrev2; public uint Price; public uint PosPrev; public uint BackPrev; public uint Backs0; public uint Backs1; public uint Backs2; public uint Backs3; public void MakeAsChar() { BackPrev = uint.MaxValue; Prev1IsChar = false; } public void MakeAsShortRep() { BackPrev = 0u; Prev1IsChar = false; } public bool IsShortRep() { return BackPrev == 0; } } private const uint kIfinityPrice = 268435455u; private static byte[] g_FastPos; private Base.State _state = default(Base.State); private byte _previousByte; private uint[] _repDistances = new uint[4]; private const int kDefaultDictionaryLogSize = 22; private const uint kNumFastBytesDefault = 32u; private const uint kNumLenSpecSymbols = 16u; private const uint kNumOpts = 4096u; private Optimal[] _optimum = new Optimal[4096]; private IMatchFinder _matchFinder = null; private SevenZip.Compression.RangeCoder.Encoder _rangeEncoder = new SevenZip.Compression.RangeCoder.Encoder(); private BitEncoder[] _isMatch = new BitEncoder[192]; private BitEncoder[] _isRep = new BitEncoder[12]; private BitEncoder[] _isRepG0 = new BitEncoder[12]; private BitEncoder[] _isRepG1 = new BitEncoder[12]; private BitEncoder[] _isRepG2 = new BitEncoder[12]; private BitEncoder[] _isRep0Long = new BitEncoder[192]; private BitTreeEncoder[] _posSlotEncoder = new BitTreeEncoder[4]; private BitEncoder[] _posEncoders = new BitEncoder[114]; private BitTreeEncoder _posAlignEncoder = new BitTreeEncoder(4); private LenPriceTableEncoder _lenEncoder = new LenPriceTableEncoder(); private LenPriceTableEncoder _repMatchLenEncoder = new LenPriceTableEncoder(); private LiteralEncoder _literalEncoder = new LiteralEncoder(); private uint[] _matchDistances = new uint[548]; private uint _numFastBytes = 32u; private uint _longestMatchLength; private uint _numDistancePairs; private uint _additionalOffset; private uint _optimumEndIndex; private uint _optimumCurrentIndex; private bool _longestMatchWasFound; private uint[] _posSlotPrices = new uint[256]; private uint[] _distancesPrices = new uint[512]; private uint[] _alignPrices = new uint[16]; private uint _alignPriceCount; private uint _distTableSize = 44u; private int _posStateBits = 2; private uint _posStateMask = 3u; private int _numLiteralPosStateBits = 0; private int _numLiteralContextBits = 3; private uint _dictionarySize = 4194304u; private uint _dictionarySizePrev = uint.MaxValue; private uint _numFastBytesPrev = uint.MaxValue; private long nowPos64; private bool _finished; private Stream _inStream; private EMatchFinderType _matchFinderType = EMatchFinderType.BT4; private bool _writeEndMark = false; private bool _needReleaseMFStream; private uint[] reps = new uint[4]; private uint[] repLens = new uint[4]; private const int kPropSize = 5; private byte[] properties = new byte[5]; private uint[] tempPrices = new uint[128]; private uint _matchPriceCount; private static string[] kMatchFinderIDs; private uint _trainSize = 0u; static Encoder() { g_FastPos = new byte[2048]; kMatchFinderIDs = new string[2] { "BT2", "BT4" }; int num = 2; g_FastPos[0] = 0; g_FastPos[1] = 1; for (byte b = 2; b < 22; b++) { uint num2 = (uint)(1 << (b >> 1) - 1); uint num3 = 0u; while (num3 < num2) { g_FastPos[num] = b; num3++; num++; } } } private static uint GetPosSlot(uint pos) { if (pos < 2048) { return g_FastPos[pos]; } if (pos < 2097152) { return (uint)(g_FastPos[pos >> 10] + 20); } return (uint)(g_FastPos[pos >> 20] + 40); } private static uint GetPosSlot2(uint pos) { if (pos < 131072) { return (uint)(g_FastPos[pos >> 6] + 12); } if (pos < 134217728) { return (uint)(g_FastPos[pos >> 16] + 32); } return (uint)(g_FastPos[pos >> 26] + 52); } private void BaseInit() { _state.Init(); _previousByte = 0; for (uint num = 0u; num < 4; num++) { _repDistances[num] = 0u; } } private void Create() { if (_matchFinder == null) { BinTree binTree = new BinTree(); int type = 4; if (_matchFinderType == EMatchFinderType.BT2) { type = 2; } binTree.SetType(type); _matchFinder = binTree; } _literalEncoder.Create(_numLiteralPosStateBits, _numLiteralContextBits); if (_dictionarySize != _dictionarySizePrev || _numFastBytesPrev != _numFastBytes) { _matchFinder.Create(_dictionarySize, 4096u, _numFastBytes, 274u); _dictionarySizePrev = _dictionarySize; _numFastBytesPrev = _numFastBytes; } } public Encoder() { for (int i = 0; (long)i < 4096L; i++) { _optimum[i] = new Optimal(); } for (int j = 0; (long)j < 4L; j++) { _posSlotEncoder[j] = new BitTreeEncoder(6); } } private void SetWriteEndMarkerMode(bool writeEndMarker) { _writeEndMark = writeEndMarker; } private void Init() { BaseInit(); _rangeEncoder.Init(); for (uint num = 0u; num < 12; num++) { for (uint num2 = 0u; num2 <= _posStateMask; num2++) { uint num3 = (num << 4) + num2; _isMatch[num3].Init(); _isRep0Long[num3].Init(); } _isRep[num].Init(); _isRepG0[num].Init(); _isRepG1[num].Init(); _isRepG2[num].Init(); } _literalEncoder.Init(); for (uint num = 0u; num < 4; num++) { _posSlotEncoder[num].Init(); } for (uint num = 0u; num < 114; num++) { _posEncoders[num].Init(); } _lenEncoder.Init((uint)(1 << _posStateBits)); _repMatchLenEncoder.Init((uint)(1 << _posStateBits)); _posAlignEncoder.Init(); _longestMatchWasFound = false; _optimumEndIndex = 0u; _optimumCurrentIndex = 0u; _additionalOffset = 0u; } private void ReadMatchDistances(out uint lenRes, out uint numDistancePairs) { lenRes = 0u; numDistancePairs = _matchFinder.GetMatches(_matchDistances); if (numDistancePairs != 0) { lenRes = _matchDistances[numDistancePairs - 2]; if (lenRes == _numFastBytes) { lenRes += _matchFinder.GetMatchLen((int)(lenRes - 1), _matchDistances[numDistancePairs - 1], 273 - lenRes); } } _additionalOffset++; } private void MovePos(uint num) { if (num != 0) { _matchFinder.Skip(num); _additionalOffset += num; } } private uint GetRepLen1Price(Base.State state, uint posState) { return _isRepG0[state.Index].GetPrice0() + _isRep0Long[(state.Index << 4) + posState].GetPrice0(); } private uint GetP
BepInEx/plugins/PotatoePet-AdvancedCompany/advancedcompany/MoreCompany.dll
Decompiled 10 months agousing System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("MoreCompany")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("100.0.0")] [assembly: AssemblyInformationalVersion("100.0.0")] [assembly: AssemblyProduct("MoreCompany")] [assembly: AssemblyTitle("MoreCompany")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("100.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace MoreCompany { [BepInPlugin("me.swipez.melonloader.morecompany", "MoreCompany", "100.0.0")] public class MainClass : BaseUnityPlugin { private void Awake() { ((BaseUnityPlugin)this).Logger.LogInfo((object)"I am just a MoreCompany replacement! :)"); } } } namespace MoreCompany.Cosmetics { public enum CosmeticType { HAT, WRIST, CHEST, R_LOWER_ARM, HIP, L_SHIN, R_SHIN } public class CosmeticInstance : MonoBehaviour { public CosmeticType cosmeticType; public string cosmeticId; public Texture2D icon; } public class CosmeticGeneric { public static ObservableCollection<GameObject> ToLoad = new ObservableCollection<GameObject>(); public virtual string gameObjectPath { get; } public virtual string cosmeticId { get; } public virtual string textureIconPath { get; } public CosmeticType cosmeticType { get; } public void LoadFromBundle(AssetBundle bundle) { GameObject val = bundle.LoadAsset<GameObject>(gameObjectPath); ((Object)val).hideFlags = (HideFlags)32; Texture2D val2 = bundle.LoadAsset<Texture2D>(textureIconPath); ((Object)val2).hideFlags = (HideFlags)32; CosmeticInstance cosmeticInstance = val.AddComponent<CosmeticInstance>(); cosmeticInstance.cosmeticId = cosmeticId; cosmeticInstance.icon = val2; cosmeticInstance.cosmeticType = cosmeticType; CollectionExtensions.AddItem<GameObject>((IEnumerable<GameObject>)ToLoad, val); } } public class CosmeticApplication : MonoBehaviour { public Transform head; public Transform hip; public Transform lowerArmRight; public Transform shinLeft; public Transform shinRight; public Transform chest; public List<CosmeticInstance> spawnedCosmetics = new List<CosmeticInstance>(); public void Awake() { } public void ClearCosmetics() { } public void ApplyCosmetic(string cosmeticId, bool startEnabled) { } public void RefreshAllCosmeticPositions() { } } public class CosmeticRegistry { public static GameObject cosmeticGUI; private static GameObject displayGuy; private static CosmeticApplication cosmeticApplication; public static List<string> locallySelectedCosmetics = new List<string>(); public const float COSMETIC_PLAYER_SCALE_MULT = 0.38f; public static ObservableCollection<AssetBundle> ToLoad = new ObservableCollection<AssetBundle>(); public static Dictionary<string, CosmeticInstance> cosmeticInstances = new Dictionary<string, CosmeticInstance>(); public static void LoadCosmeticsFromBundle(AssetBundle bundle) { ToLoad.Add(bundle); } public static void LoadCosmeticsFromAssembly(Assembly assembly, AssetBundle bundle) { Type[] types = assembly.GetTypes(); Type[] array = types; foreach (Type type in array) { if (type.IsSubclassOf(typeof(CosmeticGeneric))) { CosmeticGeneric cosmeticGeneric = (CosmeticGeneric)type.GetConstructor(new Type[0]).Invoke(new object[0]); cosmeticGeneric.LoadFromBundle(bundle); } } } public static void SpawnCosmeticGUI() { } public static void PopulateCosmetics() { } public static void UpdateCosmeticsOnDisplayGuy(bool startEnabled) { } public static bool IsEquipped(string cosmeticId) { return false; } public static void ToggleCosmetic(string cosmeticId) { } } } namespace MoreCompany.Utils { public static class AssetBundleExtension { public static T LoadPersistentAsset<T>(this AssetBundle bundle, string name) where T : Object { T val = bundle.LoadAsset<T>(name); if ((Object)(object)val != (Object)null) { ((Object)val).hideFlags = (HideFlags)32; return val; } return default(T); } } }