├── .gitignore ├── LoadAssets.cs ├── Extensions.cs ├── Objects ├── IHelmet.cs ├── ICursed.cs ├── Interfaces │ ├── IMovement.cs │ ├── IOnUpdate.cs │ ├── IIconProvider.cs │ └── IPerformJump.cs ├── Body.cs ├── Boots.cs ├── IEquipmentCommunication.cs ├── Helmet.cs ├── IEquipmentFlashlight.cs ├── IClothing.cs └── GrabbableObjectAdditions.cs ├── Terminal ├── IScreen.cs ├── ITextElement.cs ├── IScrollable.cs ├── Applications │ ├── Perks.cs │ ├── IApplication.cs │ ├── IFallbackApplication.cs │ ├── ShipXPApplication.cs │ ├── CreditsApplication.cs │ ├── XPApplication.cs │ └── HelpApplication.cs ├── TextElement.cs ├── CursorElement.cs ├── BoxedScreen.cs ├── BoxedScreenXP.cs ├── Command.cs ├── UnlockableCursorElement.cs ├── PerkCursorElement.cs ├── BoxedScreenStore.cs ├── ScrollBox.cs ├── ItemCursorElement.cs ├── HalfBoxedScreen.cs └── Help.cs ├── Network ├── INamedMessage.cs ├── ITransferable.cs ├── Messages │ ├── ExtendDeadline.cs │ ├── GrantShipXP.cs │ ├── DeadlineChanged.cs │ ├── RocketJump.cs │ ├── UseFlashlight.cs │ ├── SwitchItem.cs │ ├── ActivateHelmetLamp.cs │ ├── RocketExplode.cs │ ├── ActivateVisionEnhancer.cs │ ├── ChangeShip.cs │ ├── ActivateTacticalHelmet.cs │ ├── AttractAllEnemies.cs │ ├── GrantPlayerXP.cs │ ├── ChangePerk.cs │ ├── BuyItems.cs │ ├── ChangeItemSlot.cs │ ├── Respec.cs │ ├── DoomShotgun.cs │ ├── SyncAnimationOverride.cs │ ├── CosmeticsSync.cs │ ├── SyncCurrentLevel.cs │ ├── UseMobileTerminal.cs │ ├── SpawnRocketFromClient.cs │ └── SpawnRocket.cs ├── Message.cs ├── Sync │ └── Items │ │ ├── RocketLauncherSynchronizationHandler.cs │ │ └── BulletProofVestSynchronizationHandler.cs └── Fletcher.cs ├── Lib ├── SyncCallbacks │ ├── ILevelLoaded.cs │ ├── INetworkObjectsPlaced.cs │ └── IConnectClientToPlayerObject.cs ├── Flavour.cs ├── SyncHandler │ ├── ISyncHandler.cs │ └── IItemSynchronizationHandler.cs ├── Moons.cs ├── Player.cs ├── Mod.cs └── Equipment.cs ├── .github └── ISSUE_TEMPLATE │ ├── compability-report.md │ └── bug_report.md ├── Game ├── IUpgradeable.cs ├── ItemRuntimeData.cs └── BaseUpgradeable.cs ├── Unity ├── AssetTools.NET │ ├── Standard │ │ ├── AssetTypeClass │ │ │ ├── AssetTypeReferencedObject.cs │ │ │ ├── AssetTypeArrayInfo.cs │ │ │ ├── DummyFieldAccessException.cs │ │ │ ├── ManagedReferencesRegistry.cs │ │ │ └── EnumValueTypes.cs │ │ ├── NewReplacer │ │ │ ├── ContentReplacerType.cs │ │ │ ├── ContentRemover.cs │ │ │ ├── IContentReplacer.cs │ │ │ ├── ContentReplacerFromBuffer.cs │ │ │ ├── ContentReplacerFromAssets.cs │ │ │ └── ContentReplacerFromStream.cs │ │ ├── AssetsBundleFileFormat │ │ │ ├── IAssetBundleCompressProgress.cs │ │ │ ├── AssetBundleFSHeaderFlags.cs │ │ │ ├── AssetBundleLZMAProgress.cs │ │ │ ├── AssetBundleBlockInfo.cs │ │ │ └── AssetBundleFSHeader.cs │ │ ├── AssetsFileFormat │ │ │ ├── AssetsFileExternalType.cs │ │ │ ├── TypeTreeNodeFlags.cs │ │ │ └── Hash128.cs │ │ └── ClassDatabaseFile │ │ │ ├── ClassFileCompressionType.cs │ │ │ ├── ClassFileTypeFlags.cs │ │ │ ├── ClassDatabaseStringTable.cs │ │ │ ├── ClassPackageTypeNode.cs │ │ │ ├── ClassDatabaseTypeField.cs │ │ │ ├── ClassPackageType.cs │ │ │ ├── ClassDatabaseFileHeader.cs │ │ │ └── ClassPackageHeader.cs │ └── Extra │ │ ├── AssetsManager │ │ ├── IMonoBehaviourTemplateGenerator.cs │ │ ├── AssetReadFlags.cs │ │ ├── AssetsManager.ClassDatabase.cs │ │ ├── BundleFileInstance.cs │ │ ├── AssetsManager.Resolving.cs │ │ └── AssetsManager.cs │ │ ├── Decompressors │ │ └── LZMA │ │ │ ├── Compress │ │ │ └── LZ │ │ │ │ ├── IMatchFinder.cs │ │ │ │ └── LzOutWindow.cs │ │ │ └── Common │ │ │ ├── OutBuffer.cs │ │ │ ├── CRC.cs │ │ │ └── InBuffer.cs │ │ ├── AssetID.cs │ │ ├── Net35Polyfill.cs │ │ └── BundleCreator.cs ├── AllItems.cs ├── AllMoons.cs ├── AllScrap.cs ├── AllEnemies.cs ├── AllUnlockables.cs ├── UI │ ├── DoomSuperShotgun.cs │ ├── DoomFont.cs │ └── DoomDigits.cs ├── CosmeticInstance.cs ├── Moons.cs ├── Moons │ └── MoonItem.cs ├── DressUpDrag.cs ├── ConfigToggle.cs ├── CosmeticDatabase.cs ├── NewPresetWindow.cs ├── ConfigTextInput.cs ├── RenamePresetWindow.cs ├── RemovePresetWindow.cs ├── ItemData.cs ├── ConfirmOverrideWindow.cs ├── ConfigNumericInput.cs ├── PlayerConfiguration.cs ├── ConfigUnlockableInput.cs ├── ConfigEnemyInput.cs └── ConfigLootTableItem.cs ├── Boot ├── Bootable.cs └── Requires.cs ├── GameAssets.cs ├── Extensions ├── String.cs └── GameObject.cs ├── Patches ├── NoLobbyPatches.cs ├── Flavour.cs ├── EnemyAICollisionDetect.cs ├── DebugPatches.cs ├── ItemDropship.cs ├── HUDManager.cs ├── AnimationPatches.cs ├── BalancingPatches.cs ├── GrabbableObject.cs └── TimeOfDay.cs ├── Config ├── ConfigurationExtension.cs ├── ModpackConfig.cs ├── JObjectExtensions.cs ├── JSONSerializer.cs └── ClientConfiguration.cs ├── AnimationClipOverrides.cs ├── CodeInstructionExtensions.cs ├── Utils.cs ├── HDRPChanges.cs ├── NightVision.cs ├── Assets.cs ├── Hooks └── PlayerControllerB │ └── KillPlayer.cs ├── PostProcessing ├── DoomEffect.cs └── VisionEnhancer.cs └── PlayerRocketBoots.cs /.gitignore: -------------------------------------------------------------------------------- 1 | /bin 2 | *.meta 3 | .vs 4 | .git 5 | .github 6 | obj -------------------------------------------------------------------------------- /LoadAssets.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedCompany 2 | { 3 | public class LoadAssets : System.Attribute 4 | { 5 | public LoadAssets() 6 | { 7 | 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Extensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany 6 | { 7 | internal static partial class Extensions 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Objects/IHelmet.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Objects 6 | { 7 | internal interface IHelmet : IClothing 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Terminal/IScreen.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Terminal 6 | { 7 | internal interface IScreen : ITextElement 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Network/INamedMessage.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Network 6 | { 7 | internal interface INamedMessage : ITransferable 8 | { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Objects/ICursed.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Objects 6 | { 7 | public interface ICursed 8 | { 9 | internal void UpdateEffects(Game.Player player); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Terminal/ITextElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Terminal 6 | { 7 | public interface ITextElement 8 | { 9 | string GetText(int availableWidth); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Lib/SyncCallbacks/ILevelLoaded.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Lib.SyncCallbacks 6 | { 7 | public interface ILevelLoaded 8 | { 9 | void LevelLoaded(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Objects/Interfaces/IMovement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Objects.Interfaces 6 | { 7 | internal interface IMovement 8 | { 9 | bool Movement(Game.Player player); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Objects/Interfaces/IOnUpdate.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Objects.Interfaces 6 | { 7 | internal interface IOnUpdate 8 | { 9 | void OnUpdate(Game.Player player); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Terminal/IScrollable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Terminal 6 | { 7 | public interface IScrollable : ITextElement 8 | { 9 | public int GetScroll(int maxHeight); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/compability-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Compability report 3 | about: Report a compability or incompability 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | Please state the used AdvancedCompany version and the mod which is incompatible or compatible. 11 | -------------------------------------------------------------------------------- /Lib/SyncCallbacks/INetworkObjectsPlaced.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Lib.SyncCallbacks 6 | { 7 | public interface INetworkObjectsPlaced 8 | { 9 | void NetworkObjectsPlaced(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Objects/Interfaces/IIconProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using UnityEngine; 5 | 6 | namespace AdvancedCompany.Objects.Interfaces 7 | { 8 | internal interface IIconProvider 9 | { 10 | Sprite GetIcon(); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Game/IUpgradeable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Game 6 | { 7 | internal interface IUpgradeable 8 | { 9 | int GetLevel(Perk perk); 10 | void SetLevel(Perk perk, int level); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/AssetTypeClass/AssetTypeReferencedObject.cs: -------------------------------------------------------------------------------- 1 | namespace AssetsTools.NET 2 | { 3 | public class AssetTypeReferencedObject 4 | { 5 | public long rid; 6 | public AssetTypeReference type; 7 | public AssetTypeValueField data; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Boot/Bootable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Boot 6 | { 7 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] 8 | public class Bootable : System.Attribute 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/AssetTypeClass/AssetTypeArrayInfo.cs: -------------------------------------------------------------------------------- 1 | namespace AssetsTools.NET 2 | { 3 | public struct AssetTypeArrayInfo 4 | { 5 | public AssetTypeArrayInfo(int size) 6 | { 7 | this.size = size; 8 | } 9 | 10 | public int size; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/NewReplacer/ContentReplacerType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AssetsTools.NET 6 | { 7 | public enum ContentReplacerType 8 | { 9 | None, 10 | AddOrModify, 11 | Remove, 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Objects/Interfaces/IPerformJump.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using AdvancedCompany.Game; 5 | 6 | namespace AdvancedCompany.Objects.Interfaces 7 | { 8 | internal interface IPerformJump 9 | { 10 | bool PerformJump(Player player); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Terminal/Applications/Perks.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | using static UnityEngine.Rendering.HighDefinition.ScalableSettingLevelParameter; 6 | using AdvancedCompany.Game; 7 | 8 | namespace AdvancedCompany.Terminal.Applications 9 | { 10 | } 11 | -------------------------------------------------------------------------------- /Objects/Body.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Objects 6 | { 7 | internal abstract class Body : Clothing 8 | { 9 | public override int GetEquipmentSlot() 10 | { 11 | return 11; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/AssetTypeClass/DummyFieldAccessException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AssetsTools.NET 4 | { 5 | public class DummyFieldAccessException : Exception 6 | { 7 | public DummyFieldAccessException(string message) : base(message) 8 | { 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Objects/Boots.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Objects 6 | { 7 | internal abstract class Boots : Clothing 8 | { 9 | public override int GetEquipmentSlot() 10 | { 11 | return 12; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Objects/IEquipmentCommunication.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Game; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace AdvancedCompany.Objects 7 | { 8 | internal interface IEquipmentCommunication 9 | { 10 | void SwitchTalking(Player player, bool talking); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Objects/Helmet.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Objects 6 | { 7 | internal abstract class Helmet : Clothing, IHelmet 8 | { 9 | public override int GetEquipmentSlot() 10 | { 11 | return 10; 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/AssetsBundleFileFormat/IAssetBundleCompressProgress.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AssetsTools.NET 6 | { 7 | public interface IAssetBundleCompressProgress 8 | { 9 | public void SetProgress(float progress); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/AssetsFileFormat/AssetsFileExternalType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AssetsTools.NET 6 | { 7 | public enum AssetsFileExternalType 8 | { 9 | Normal, 10 | Cached, 11 | Serialized, 12 | Meta 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Network/ITransferable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network 7 | { 8 | internal interface ITransferable 9 | { 10 | void WriteData(FastBufferWriter writer); 11 | void ReadData(FastBufferReader reader); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Unity/AllItems.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Config 6 | { 7 | public class AllItems : Configuration 8 | { 9 | public Dictionary Items = new Dictionary(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Unity/AllMoons.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Config 6 | { 7 | internal class AllMoons : Configuration 8 | { 9 | public Dictionary Moons = new Dictionary(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Unity/AllScrap.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Config 6 | { 7 | public class AllScrap : Configuration 8 | { 9 | public Dictionary Items = new Dictionary(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/ClassDatabaseFile/ClassFileCompressionType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AssetsTools.NET 6 | { 7 | public enum ClassFileCompressionType 8 | { 9 | Uncompressed, 10 | Lz4, 11 | Lzma, 12 | // Brotli 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity/AllEnemies.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Config 6 | { 7 | public class AllEnemies : Configuration 8 | { 9 | public Dictionary Enemies = new Dictionary(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/AssetTypeClass/ManagedReferencesRegistry.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AssetsTools.NET 6 | { 7 | public class ManagedReferencesRegistry 8 | { 9 | public int version; 10 | public List references; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Lib/SyncCallbacks/IConnectClientToPlayerObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Lib.SyncCallbacks 6 | { 7 | public interface IConnectClientToPlayerObject 8 | { 9 | public void ConnectClientToPlayerObject(global::GameNetcodeStuff.PlayerControllerB player); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Unity/AllUnlockables.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Config 6 | { 7 | public class AllUnlockables : Configuration 8 | { 9 | public Dictionary Unlockables = new Dictionary(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Objects/IEquipmentFlashlight.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Game; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace AdvancedCompany.Objects 7 | { 8 | internal interface IEquipmentFlashlight 9 | { 10 | bool IsUsed(); 11 | void SwitchFlashlight(Player player, bool on); 12 | bool CanBeUsed(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Unity/UI/DoomSuperShotgun.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using UnityEngine; 5 | 6 | namespace AdvancedCompany.Unity.UI 7 | { 8 | public class DoomSuperShotgun : MonoBehaviour 9 | { 10 | public AudioSource Audio; 11 | 12 | public void Shoot() 13 | { 14 | Audio.Play(); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Terminal/Applications/IApplication.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Terminal.Applications 6 | { 7 | public interface IApplication 8 | { 9 | void Main(Game.MobileTerminal terminal, string[] args); 10 | void Exit(); 11 | void Submit(string text); 12 | void Update(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Terminal/Applications/IFallbackApplication.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Game; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace AdvancedCompany.Terminal.Applications 7 | { 8 | internal interface IFallbackApplication 9 | { 10 | float Certainty(string input); 11 | void Fallback(MobileTerminal terminal, string input); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /GameAssets.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace AdvancedCompany 5 | { 6 | public static class GameAssets 7 | { 8 | public static Dictionary Scrap = new(); 9 | // DropMetalObject3 10 | // DropThinMetal 11 | // ShovelPickUp 12 | public static Dictionary Audio = new(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Boot/Requires.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Boot 6 | { 7 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)] 8 | public class Requires : System.Attribute 9 | { 10 | public Type Type; 11 | public Requires(Type type) 12 | { 13 | Type = type; 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Lib/Flavour.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using UnityEngine; 5 | 6 | namespace AdvancedCompany.Lib 7 | { 8 | public class Flavour 9 | { 10 | internal static Sprite OverrideLogo; 11 | public static void SetLogo(Texture2D logo) 12 | { 13 | OverrideLogo = Sprite.Create(logo, new Rect(0f, 0f, logo.width, logo.height), new Vector2(0.5f, 0.5f)); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Extra/AssetsManager/IMonoBehaviourTemplateGenerator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AssetsTools.NET.Extra 6 | { 7 | public interface IMonoBehaviourTemplateGenerator 8 | { 9 | public AssetTypeTemplateField GetTemplateField(AssetTypeTemplateField baseField, string assemblyName, string nameSpace, string className, UnityVersion unityVersion); 10 | public void Dispose(); 11 | } 12 | } -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/AssetTypeClass/EnumValueTypes.cs: -------------------------------------------------------------------------------- 1 | namespace AssetsTools.NET 2 | { 3 | public enum AssetValueType 4 | { 5 | None, 6 | Bool, 7 | Int8, 8 | UInt8, 9 | Int16, 10 | UInt16, 11 | Int32, 12 | UInt32, 13 | Int64, 14 | UInt64, 15 | Float, 16 | Double, 17 | String, 18 | Array, 19 | ByteArray, 20 | ManagedReferencesRegistry 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Network/Messages/ExtendDeadline.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network.Messages 7 | { 8 | [Message("ExtendDeadline", true)] 9 | internal class ExtendDeadline : INamedMessage 10 | { 11 | public void ReadData(FastBufferReader reader) 12 | { 13 | } 14 | 15 | public void WriteData(FastBufferWriter writer) 16 | { 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Unity/CosmeticInstance.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace AdvancedCompany.Cosmetics 4 | { 5 | public enum CosmeticType 6 | { 7 | HAT, 8 | WRIST, 9 | CHEST, 10 | R_LOWER_ARM, 11 | HIP, 12 | L_SHIN, 13 | R_SHIN 14 | } 15 | public class CosmeticInstance : MonoBehaviour 16 | { 17 | public CosmeticType cosmeticType; 18 | 19 | public string cosmeticId; 20 | 21 | public Texture2D icon; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/AssetsBundleFileFormat/AssetBundleFSHeaderFlags.cs: -------------------------------------------------------------------------------- 1 | namespace AssetsTools.NET 2 | { 3 | public enum AssetBundleFSHeaderFlags 4 | { 5 | None = 0x00, 6 | LZMACompressed = 0x01, 7 | LZ4Compressed = 0x02, 8 | LZ4HCCompressed = 0x03, 9 | CompressionMask = 0x3f, 10 | HasDirectoryInfo = 0x40, 11 | BlockAndDirAtEnd = 0x80, 12 | OldWebPluginCompatibility = 0x100, 13 | BlockInfoNeedPaddingAtStart = 0x200 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Extensions/String.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Text.RegularExpressions; 6 | 7 | namespace AdvancedCompany 8 | { 9 | static internal partial class Extensions 10 | { 11 | private static Regex OnlyAlphanumericalRegex = new Regex("[^a-zA-Z0-9]"); 12 | public static string OnlyAlphanumerical(this string input) 13 | { 14 | return OnlyAlphanumericalRegex.Replace(input, ""); 15 | } 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Unity/Moons.cs: -------------------------------------------------------------------------------- 1 | namespace AdvancedCompany.Game 2 | { 3 | public static class Moons 4 | { 5 | public const int Count = 9; 6 | 7 | public const int COMPANY_BUILDING = 0; 8 | public const int EXPERIMENTATION = 1; 9 | public const int VOW = 2; 10 | public const int ASSURANCE = 3; 11 | public const int OFFENSE = 4; 12 | public const int MARCH = 5; 13 | public const int REND = 6; 14 | public const int DINE = 7; 15 | public const int TITAN = 8; 16 | } 17 | } -------------------------------------------------------------------------------- /Patches/NoLobbyPatches.cs: -------------------------------------------------------------------------------- 1 | using HarmonyLib; 2 | 3 | namespace AdvancedCompany.Patches 4 | { 5 | [HarmonyPatch] 6 | internal class NoLobbyPatches 7 | { 8 | [HarmonyPatch(typeof(global::StartOfRound), "Start")] 9 | [HarmonyPostfix] 10 | static void AddPlayers() 11 | { 12 | for (var i = 0; i < global::StartOfRound.Instance.allPlayerObjects.Length; i++) 13 | { 14 | Game.Player.GetPlayer(global::StartOfRound.Instance.allPlayerScripts[i]); 15 | } 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Terminal/TextElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using UnityEngine; 5 | 6 | namespace AdvancedCompany.Terminal 7 | { 8 | public class TextElement : ITextElement 9 | { 10 | public string Text; 11 | public string GetText(int availableWidth) 12 | { 13 | //return Text; 14 | return Utils.WrapText(Text, availableWidth); 15 | } 16 | 17 | public static explicit operator TextElement(string text) => new TextElement() { Text = text }; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Patches/Flavour.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Unity; 2 | using HarmonyLib; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using UnityEngine; 7 | using UnityEngine.UI; 8 | 9 | namespace AdvancedCompany.Patches 10 | { 11 | [HarmonyPatch] 12 | internal class Flavour 13 | { 14 | [HarmonyPatch(typeof(MenuManager), "Awake")] 15 | [HarmonyPostfix] 16 | public static void Awake(MenuManager __instance) 17 | { 18 | __instance.gameObject.AddComponent(); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Config/ConfigurationExtension.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using static MonoMod.Cil.RuntimeILReferenceBag.FastDelegateInvokers; 5 | using Unity.Netcode; 6 | using UnityEngine; 7 | using AdvancedCompany.Objects; 8 | using Steamworks.ServerList; 9 | using System.Diagnostics; 10 | using static AdvancedCompany.Config.LobbyConfiguration; 11 | using Steamworks.Ugc; 12 | using Newtonsoft.Json.Linq; 13 | 14 | namespace AdvancedCompany.Config 15 | { 16 | internal static class ConfigurationExtension 17 | { 18 | 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Network/Message.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Xml.Schema; 5 | 6 | namespace AdvancedCompany.Network 7 | { 8 | internal class Message : System.Attribute 9 | { 10 | internal string Name; 11 | internal bool ServerOnly; 12 | internal bool IsRelay; 13 | internal Message(string name, bool serverOnly = false, bool isRelay = false) 14 | { 15 | Name = name; 16 | ServerOnly = serverOnly; 17 | IsRelay = isRelay; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Network/Messages/GrantShipXP.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network.Messages 7 | { 8 | [Message("GrantShipXP", false, true)] 9 | internal class GrantShipXP : INamedMessage 10 | { 11 | internal int XP; 12 | public void ReadData(FastBufferReader reader) 13 | { 14 | reader.ReadValueSafe(out XP); 15 | } 16 | 17 | public void WriteData(FastBufferWriter writer) 18 | { 19 | writer.WriteValueSafe(XP); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Lib/SyncHandler/ISyncHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Lib.SyncHandler 7 | { 8 | public interface ISyncHandler 9 | { 10 | string GetIdentifier(); 11 | void WriteDataToPlayerJoiningLobby(Sync sync, FastBufferWriter writer); 12 | void ReadDataFromJoiningLobby(Sync sync, FastBufferReader reader); 13 | void WriteDataToHostBeforeJoining(Sync sync, FastBufferWriter writer); 14 | void ReadDataFromClientBeforeJoining(Sync sync, FastBufferReader reader); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Objects/IClothing.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Network.Messages; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using UnityEngine; 6 | 7 | namespace AdvancedCompany.Objects 8 | { 9 | internal interface IClothing 10 | { 11 | bool CanUnequip(); 12 | Game.Player.BodyLayers GetLayers(); 13 | GameObject[] CreateWearable(Game.Player player); 14 | void Equipped(Game.Player player); 15 | void Equip(); 16 | void Unequipped(Game.Player player); 17 | void Unequip(); 18 | int GetEquipmentSlot(); 19 | bool IsEquipped(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Network/Messages/DeadlineChanged.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network.Messages 7 | { 8 | [Message("DeadlineChanged")] 9 | internal class DeadlineChanged : INamedMessage 10 | { 11 | internal float NewDeadline; 12 | public void ReadData(FastBufferReader reader) 13 | { 14 | reader.ReadValueSafe(out NewDeadline); 15 | } 16 | 17 | public void WriteData(FastBufferWriter writer) 18 | { 19 | writer.WriteValueSafe(NewDeadline); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Network/Messages/RocketJump.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network.Messages 7 | { 8 | [Message("RocketJump", false, true)] 9 | internal class RocketJump : INamedMessage 10 | { 11 | internal int PlayerNum; 12 | public void ReadData(FastBufferReader reader) 13 | { 14 | reader.ReadValueSafe(out this.PlayerNum); 15 | } 16 | 17 | public void WriteData(FastBufferWriter writer) 18 | { 19 | writer.WriteValueSafe(this.PlayerNum); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Terminal/CursorElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Terminal 6 | { 7 | 8 | public class CursorElement : ITextElement 9 | { 10 | public string Name; 11 | public string Description; 12 | public Action Action; 13 | 14 | public virtual string GetText(int availableWidth) 15 | { 16 | var text = Name; 17 | if (Description != null && Description != "") 18 | text += $"\n{Utils.WrapText(Description, availableWidth, " ", "")}"; 19 | return text; 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Unity/UI/DoomFont.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using UnityEngine; 5 | 6 | namespace AdvancedCompany.Unity.UI 7 | { 8 | [CreateAssetMenu(menuName = "DoomFont", order = 2, fileName = "DoomFont")] 9 | public class DoomFont : ScriptableObject 10 | { 11 | public List Chars; 12 | public List Sprites; 13 | public int CharHeight; 14 | 15 | public Sprite GetSprite(char c) 16 | { 17 | var ind = Chars.IndexOf(c); 18 | if (ind > -1) 19 | return Sprites[ind]; 20 | return null; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Lib/Moons.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Game; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using UnityEngine; 6 | 7 | namespace AdvancedCompany.Lib 8 | { 9 | public class Moons 10 | { 11 | public static int GetConfigMoonPrice(int levelID, int defaultPrice = 0) 12 | { 13 | return Manager.Moons.GetMoonPrice(levelID, defaultPrice); 14 | } 15 | 16 | public static int GetMoonPrice(int levelID, int defaultPrice = 0) 17 | { 18 | return Mathf.RoundToInt(Manager.Moons.GetMoonPrice(levelID, defaultPrice) * Perks.GetMultiplier("TravelDiscount")); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/NewReplacer/ContentRemover.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | 6 | namespace AssetsTools.NET 7 | { 8 | public class ContentRemover : IContentReplacer 9 | { 10 | public void Write(AssetsFileWriter writer) 11 | { 12 | } 13 | 14 | public bool HasPreview() 15 | { 16 | return false; 17 | } 18 | 19 | public Stream GetPreviewStream() 20 | { 21 | return null; 22 | } 23 | 24 | public ContentReplacerType GetReplacerType() 25 | { 26 | return ContentReplacerType.Remove; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Extra/Decompressors/LZMA/Compress/LZ/IMatchFinder.cs: -------------------------------------------------------------------------------- 1 | // IMatchFinder.cs 2 | 3 | using System; 4 | 5 | namespace SevenZip.Compression.LZ 6 | { 7 | interface IInWindowStream 8 | { 9 | void SetStream(System.IO.Stream inStream); 10 | void Init(); 11 | void ReleaseStream(); 12 | Byte GetIndexByte(Int32 index); 13 | UInt32 GetMatchLen(Int32 index, UInt32 distance, UInt32 limit); 14 | UInt32 GetNumAvailableBytes(); 15 | } 16 | 17 | interface IMatchFinder : IInWindowStream 18 | { 19 | void Create(UInt32 historySize, UInt32 keepAddBufferBefore, 20 | UInt32 matchMaxLen, UInt32 keepAddBufferAfter); 21 | UInt32 GetMatches(UInt32[] distances); 22 | void Skip(UInt32 num); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /AnimationClipOverrides.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using UnityEngine; 3 | 4 | namespace AdvancedCompany 5 | { 6 | public class AnimationClipOverrides : List> 7 | { 8 | public AnimationClipOverrides(int capacity) : base(capacity) { } 9 | 10 | public AnimationClip this[string name] 11 | { 12 | get { return this.Find(x => x.Key.name.Equals(name)).Value; } 13 | set 14 | { 15 | int index = this.FindIndex(x => x.Key.name.Equals(name)); 16 | if (index != -1) 17 | this[index] = new KeyValuePair(this[index].Key, value); 18 | } 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Network/Messages/UseFlashlight.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network.Messages 7 | { 8 | [Message("UseFlashlight", false, true)] 9 | internal class UseFlashlight : INamedMessage 10 | { 11 | public int PlayerNum; 12 | public int Slot; 13 | 14 | public void ReadData(FastBufferReader reader) 15 | { 16 | reader.ReadValueSafe(out PlayerNum); 17 | reader.ReadValueSafe(out Slot); 18 | } 19 | 20 | public void WriteData(FastBufferWriter writer) 21 | { 22 | writer.WriteValueSafe(PlayerNum); 23 | writer.WriteValueSafe(Slot); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Network/Messages/SwitchItem.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network.Messages 7 | { 8 | [Message("SwitchItem", false, true)] 9 | internal class SwitchItem : INamedMessage 10 | { 11 | internal int PlayerNum; 12 | internal int Slot; 13 | public void ReadData(FastBufferReader reader) 14 | { 15 | reader.ReadValueSafe(out this.PlayerNum); 16 | reader.ReadValueSafe(out this.Slot); 17 | } 18 | 19 | public void WriteData(FastBufferWriter writer) 20 | { 21 | writer.WriteValueSafe(this.PlayerNum); 22 | writer.WriteValueSafe(this.Slot); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Network/Messages/ActivateHelmetLamp.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network.Messages 7 | { 8 | [Message("ActivateHelmetLamp", false, true)] 9 | internal class ActivateHelmetLamp : INamedMessage 10 | { 11 | internal int PlayerNum; 12 | internal bool IsUsed; 13 | 14 | public void ReadData(FastBufferReader reader) 15 | { 16 | reader.ReadValueSafe(out PlayerNum); 17 | reader.ReadValueSafe(out IsUsed); 18 | } 19 | 20 | public void WriteData(FastBufferWriter writer) 21 | { 22 | writer.WriteValueSafe(PlayerNum); 23 | writer.WriteValueSafe(IsUsed); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Network/Messages/RocketExplode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | using UnityEngine; 6 | 7 | namespace AdvancedCompany.Network.Messages 8 | { 9 | [Message("RocketExplode", false, true)] 10 | internal class RocketExplode : INamedMessage 11 | { 12 | internal long ID; 13 | internal Vector3 Position; 14 | 15 | public void ReadData(FastBufferReader reader) 16 | { 17 | reader.ReadValueSafe(out ID); 18 | reader.ReadValueSafe(out Position); 19 | } 20 | 21 | public void WriteData(FastBufferWriter writer) 22 | { 23 | writer.WriteValueSafe(ID); 24 | writer.WriteValueSafe(Position); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Network/Messages/ActivateVisionEnhancer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network.Messages 7 | { 8 | [Message("ActivateNightVision", false, true)] 9 | internal class ActivateVisionEnhancer : INamedMessage 10 | { 11 | internal int PlayerNum; 12 | internal bool IsUsed; 13 | 14 | public void ReadData(FastBufferReader reader) 15 | { 16 | reader.ReadValueSafe(out PlayerNum); 17 | reader.ReadValueSafe(out IsUsed); 18 | } 19 | 20 | public void WriteData(FastBufferWriter writer) 21 | { 22 | writer.WriteValueSafe(PlayerNum); 23 | writer.WriteValueSafe(IsUsed); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Network/Messages/ChangeShip.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network.Messages 7 | { 8 | [Message("ChangeShip", false, true)] 9 | internal class ChangeShip : INamedMessage 10 | { 11 | internal int TotalQuota; 12 | internal bool ExtendedDeadline; 13 | 14 | public void ReadData(FastBufferReader reader) 15 | { 16 | reader.ReadValueSafe(out TotalQuota); 17 | reader.ReadValueSafe(out ExtendedDeadline); 18 | } 19 | 20 | public void WriteData(FastBufferWriter writer) 21 | { 22 | writer.WriteValueSafe(TotalQuota); 23 | writer.WriteValueSafe(ExtendedDeadline); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Network/Messages/ActivateTacticalHelmet.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network.Messages 7 | { 8 | [Message("ActivateTacticalHelmet", false, true)] 9 | internal class ActivateTacticalHelmet : INamedMessage 10 | { 11 | internal int PlayerNum; 12 | internal bool IsUsed; 13 | 14 | public void ReadData(FastBufferReader reader) 15 | { 16 | reader.ReadValueSafe(out PlayerNum); 17 | reader.ReadValueSafe(out IsUsed); 18 | } 19 | 20 | public void WriteData(FastBufferWriter writer) 21 | { 22 | writer.WriteValueSafe(PlayerNum); 23 | writer.WriteValueSafe(IsUsed); 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Network/Messages/AttractAllEnemies.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using UnityEngine; 5 | using Unity.Netcode; 6 | 7 | namespace AdvancedCompany.Network.Messages 8 | { 9 | [Message("AttractAllEnemies", false, true)] 10 | internal class AttractAllEnemies : INamedMessage 11 | { 12 | public bool Inside; 13 | public int PlayerNum; 14 | 15 | public void ReadData(FastBufferReader reader) 16 | { 17 | reader.ReadValueSafe(out Inside); 18 | reader.ReadValueSafe(out PlayerNum); 19 | } 20 | 21 | public void WriteData(FastBufferWriter writer) 22 | { 23 | writer.WriteValueSafe(Inside); 24 | writer.WriteValueSafe(PlayerNum); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/AssetsBundleFileFormat/AssetBundleLZMAProgress.cs: -------------------------------------------------------------------------------- 1 | using SevenZip; 2 | 3 | namespace AssetsTools.NET 4 | { 5 | internal class AssetBundleLZMAProgress : ICodeProgress 6 | { 7 | private IAssetBundleCompressProgress progress; 8 | private long currentSize; 9 | private long length; 10 | 11 | public AssetBundleLZMAProgress(IAssetBundleCompressProgress progress, long length) 12 | { 13 | this.progress = progress; 14 | this.currentSize = 0; 15 | this.length = length; 16 | } 17 | 18 | public void SetProgress(long inSize, long outSize) 19 | { 20 | if (progress != null) 21 | { 22 | progress.SetProgress((float)inSize / length); 23 | } 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /CodeInstructionExtensions.cs: -------------------------------------------------------------------------------- 1 | using HarmonyLib; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Reflection; 5 | using System.Reflection.Emit; 6 | using System.Text; 7 | 8 | namespace AdvancedCompany 9 | { 10 | public static class CodeInstructionExtensions 11 | { 12 | public static bool IsLdfld(this CodeInstruction instruction, string fieldName = null) 13 | { 14 | if (instruction.opcode == OpCodes.Ldfld) 15 | { 16 | if (fieldName != null && instruction.operand is FieldInfo f) 17 | { 18 | var compare = f.DeclaringType.FullName + "." + f.Name; 19 | return compare == fieldName; 20 | } 21 | return true; 22 | } 23 | return false; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Patches/EnemyAICollisionDetect.cs: -------------------------------------------------------------------------------- 1 | using GameNetcodeStuff; 2 | using HarmonyLib; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Numerics; 6 | using System.Text; 7 | 8 | namespace AdvancedCompany.Patches 9 | { 10 | [HarmonyPatch] 11 | internal class EnemyAICollisionDetect 12 | { 13 | [HarmonyPatch(typeof(global::EnemyAICollisionDetect), "IHittable.Hit")] 14 | [HarmonyPrefix] 15 | private static void Hit(ref int force, Vector3 hitDirection, GameNetcodeStuff.PlayerControllerB playerWhoHit, bool playHitSFX) 16 | { 17 | if (global::GameNetworkManager.Instance.localPlayerController == playerWhoHit) 18 | { 19 | if (UnityEngine.Random.value < Perks.GetMultiplier("DealDamage")) 20 | force += 100; 21 | } 22 | } 23 | 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Network/Messages/GrantPlayerXP.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network.Messages 7 | { 8 | [Message("GrantPlayerXP", false, true)] 9 | internal class GrantPlayerXP : INamedMessage 10 | { 11 | internal bool All; 12 | internal int PlayerNum; 13 | internal int XP; 14 | public void ReadData(FastBufferReader reader) 15 | { 16 | reader.ReadValueSafe(out All); 17 | reader.ReadValueSafe(out PlayerNum); 18 | reader.ReadValueSafe(out XP); 19 | } 20 | 21 | public void WriteData(FastBufferWriter writer) 22 | { 23 | writer.WriteValueSafe(All); 24 | writer.WriteValueSafe(PlayerNum); 25 | writer.WriteValueSafe(XP); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Network/Messages/ChangePerk.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network.Messages 7 | { 8 | [Message("ChangePerk", false, true)] 9 | internal class ChangePerk : INamedMessage 10 | { 11 | internal int PlayerNum; 12 | internal string ID; 13 | internal int Level; 14 | 15 | public void ReadData(FastBufferReader reader) 16 | { 17 | reader.ReadValueSafe(out PlayerNum); 18 | reader.ReadValueSafe(out ID); 19 | reader.ReadValueSafe(out Level); 20 | } 21 | 22 | public void WriteData(FastBufferWriter writer) 23 | { 24 | writer.WriteValueSafe(PlayerNum); 25 | writer.WriteValueSafe(ID); 26 | writer.WriteValueSafe(Level); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Network/Messages/BuyItems.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network.Messages 7 | { 8 | [Message("BuyItems", false, true)] 9 | internal class BuyItems : INamedMessage 10 | { 11 | public int NewCredits; 12 | public int[] Items; 13 | public int[] Unlockables; 14 | 15 | public void ReadData(FastBufferReader reader) 16 | { 17 | reader.ReadValueSafe(out NewCredits); 18 | reader.ReadValueSafe(out Items); 19 | reader.ReadValueSafe(out Unlockables); 20 | } 21 | 22 | public void WriteData(FastBufferWriter writer) 23 | { 24 | writer.WriteValueSafe(NewCredits); 25 | writer.WriteValueSafe(Items); 26 | writer.WriteValueSafe(Unlockables); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Network/Messages/ChangeItemSlot.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network.Messages 7 | { 8 | [Message("ChangeItemSlot", false, true)] 9 | internal class ChangeItemSlot : INamedMessage 10 | { 11 | internal int PlayerNum; 12 | internal int FromSlot; 13 | internal int ToSlot; 14 | 15 | public void ReadData(FastBufferReader reader) 16 | { 17 | reader.ReadValueSafe(out PlayerNum); 18 | reader.ReadValueSafe(out FromSlot); 19 | reader.ReadValueSafe(out ToSlot); 20 | } 21 | 22 | public void WriteData(FastBufferWriter writer) 23 | { 24 | writer.WriteValueSafe(PlayerNum); 25 | writer.WriteValueSafe(FromSlot); 26 | writer.WriteValueSafe(ToSlot); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Utils.cs: -------------------------------------------------------------------------------- 1 | using HarmonyLib; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany 7 | { 8 | [HarmonyPatch] 9 | public class Utils 10 | { 11 | private static List NetworkPrefabs = new List(); 12 | private static bool NetworkManagerStarted = false; 13 | public static NetworkManager NetworkManager; 14 | public static void AddNetworkPrefab(GameObject go) 15 | { 16 | NetworkPrefabs.Add(go); 17 | } 18 | 19 | [HarmonyPatch(typeof(GameNetworkManager), "Start")] 20 | [HarmonyPostfix] 21 | private static void Start(GameNetworkManager __instance) 22 | { 23 | for (var i = 0; i < NetworkPrefabs.Count; i++) 24 | NetworkManager.Singleton.AddNetworkPrefab(NetworkPrefabs[i]); 25 | } 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Terminal/BoxedScreen.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Terminal 6 | { 7 | public class BoxedScreen : IScreen 8 | { 9 | public string Title; 10 | public List Content; 11 | 12 | public virtual string GetText(int availableWidth) 13 | { 14 | var text = $" ╔{new String('═', Title.Length + 2)}╗\n" + 15 | $"╭─╢ {Title} ╟{new String('─', availableWidth - 7 - Title.Length)}╮\n" + 16 | $"│ ╚{new String('═', Title.Length + 2)}╝{new String(' ', availableWidth - Title.Length - 7)}│\n"; 17 | foreach (var c in Content) 18 | text += Utils.WrapText(c.GetText(availableWidth - 4), availableWidth, "│ ", " │"); 19 | text += $"╰{new String('─', availableWidth - 2)}╯\n"; 20 | return text; 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/AssetsBundleFileFormat/AssetBundleBlockInfo.cs: -------------------------------------------------------------------------------- 1 | namespace AssetsTools.NET 2 | { 3 | public class AssetBundleBlockInfo 4 | { 5 | /// 6 | /// Decompressed size of this block. 7 | /// 8 | public uint DecompressedSize { get; set; } 9 | /// 10 | /// Compressed size of this block. If uncompressed, this is the same as DecompressedSize. 11 | /// 12 | public uint CompressedSize { get; set; } 13 | /// 14 | /// Flags of this block.
15 | /// First 6 bits (0x3f mask): Compression mode. 0 for uncompressed, 1 for LZMA, 2/3 for LZ4/LZ4HC.
16 | /// 0x40: Streamed if unset (will be read in blocks)
17 | ///
18 | public ushort Flags { get; set; } 19 | public byte GetCompressionType() { return (byte)(Flags & 0x3F); } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Network/Messages/Respec.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using AdvancedCompany.Game; 5 | using Unity.Netcode; 6 | 7 | namespace AdvancedCompany.Network.Messages 8 | { 9 | [Message("Respec", false, true)] 10 | internal class Respec : INamedMessage 11 | { 12 | internal int PlayerNum; 13 | internal Perk.Type Type; 14 | internal bool Reset; 15 | 16 | public void ReadData(FastBufferReader reader) 17 | { 18 | reader.ReadValueSafe(out PlayerNum); 19 | reader.ReadValueSafe(out int type); 20 | Type = (Perk.Type)type; 21 | reader.ReadValueSafe(out Reset); 22 | } 23 | 24 | public void WriteData(FastBufferWriter writer) 25 | { 26 | writer.WriteValueSafe(PlayerNum); 27 | writer.WriteValueSafe((int)Type); 28 | writer.WriteValueSafe(Reset); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Network/Messages/DoomShotgun.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | using UnityEngine; 6 | 7 | namespace AdvancedCompany.Network.Messages 8 | { 9 | [Message("DoomShotgun", false, true)] 10 | public class DoomShotgun : INamedMessage 11 | { 12 | public int PlayerNum; 13 | public Vector3 ShotgunPosition; 14 | public Vector3 ShotgunForward; 15 | 16 | public void ReadData(FastBufferReader reader) 17 | { 18 | reader.ReadValueSafe(out PlayerNum); 19 | reader.ReadValueSafe(out ShotgunPosition); 20 | reader.ReadValueSafe(out ShotgunForward); 21 | } 22 | 23 | public void WriteData(FastBufferWriter writer) 24 | { 25 | writer.WriteValueSafe(PlayerNum); 26 | writer.WriteValueSafe(ShotgunPosition); 27 | writer.WriteValueSafe(ShotgunForward); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Network/Messages/SyncAnimationOverride.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network.Messages 7 | { 8 | [Message("SyncAnimationOverride", false, true)] 9 | internal class SyncAnimationOverride : INamedMessage 10 | { 11 | public int PlayerNum; 12 | public string OriginalName; 13 | public string ReplacementName; 14 | 15 | public void ReadData(FastBufferReader reader) 16 | { 17 | reader.ReadValue(out PlayerNum); 18 | reader.ReadValue(out OriginalName, true); 19 | reader.ReadValue(out ReplacementName, true); 20 | } 21 | 22 | public void WriteData(FastBufferWriter writer) 23 | { 24 | writer.WriteValue(PlayerNum); 25 | writer.WriteValue(OriginalName, true); 26 | writer.WriteValue(ReplacementName, true); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Unity/Moons/MoonItem.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Config; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using TMPro; 6 | using UnityEngine; 7 | 8 | namespace AdvancedCompany.Unity.Moons 9 | { 10 | internal class MoonItem : MonoBehaviour 11 | { 12 | public UnityEngine.UI.Image ActiveBackground; 13 | public TextMeshProUGUI Label; 14 | public UnityEngine.UI.Button Button; 15 | public LobbyConfiguration.MoonConfig Config; 16 | 17 | public void Initialize(string label) 18 | { 19 | Label.text = label; 20 | } 21 | 22 | public void SetValue(LobbyConfiguration.MoonConfig config) 23 | { 24 | Config = config; 25 | } 26 | 27 | public void Select() 28 | { 29 | ActiveBackground.gameObject.SetActive(true); 30 | } 31 | 32 | public void Unselect() 33 | { 34 | ActiveBackground.gameObject.SetActive(false); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Extra/AssetID.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace AssetsTools.NET.Extra 7 | { 8 | [Obsolete("use AssetPPtr")] 9 | public class AssetID 10 | { 11 | public string fileName; 12 | public long pathID; 13 | public AssetID(string fileName, long pathID) 14 | { 15 | this.fileName = fileName; 16 | this.pathID = pathID; 17 | } 18 | public override bool Equals(object obj) 19 | { 20 | if (!(obj is AssetID)) 21 | return false; 22 | AssetID cobj = (AssetID)obj; 23 | return cobj.fileName == fileName && cobj.pathID == pathID; 24 | } 25 | public override int GetHashCode() 26 | { 27 | int hash = 17; 28 | hash = hash * 23 + fileName.GetHashCode(); 29 | hash = hash * 23 + pathID.GetHashCode(); 30 | return hash; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Network/Sync/Items/RocketLauncherSynchronizationHandler.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Objects; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using static AdvancedCompany.Lib.Sync; 6 | using Unity.Netcode; 7 | using AdvancedCompany.Lib.SyncHandler; 8 | 9 | namespace AdvancedCompany.Network.Sync.Items 10 | { 11 | internal class RocketLaucherSynchronizationHandler : IItemSynchronisationHandler 12 | { 13 | public int Ammo; 14 | public override void Apply(MissileLauncher item) 15 | { 16 | item.Ammo = Ammo; 17 | } 18 | 19 | public override void Read(MissileLauncher item) 20 | { 21 | Ammo = item.Ammo; 22 | } 23 | 24 | public override void Read(FastBufferReader reader) 25 | { 26 | reader.ReadValueSafe(out Ammo); 27 | } 28 | 29 | public override void Write(FastBufferWriter writer) 30 | { 31 | writer.WriteValueSafe(Ammo); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Extra/AssetsManager/AssetReadFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AssetsTools.NET.Extra 4 | { 5 | [Flags] 6 | public enum AssetReadFlags 7 | { 8 | /// 9 | /// No flags. 10 | /// 11 | None = 0, 12 | /// 13 | /// Use the editor version of the TPK instead of the the player version. Use this if you are 14 | /// generating new assets for an editor project. 15 | /// 16 | PreferEditor = 1, 17 | /// 18 | /// If the file doesn't have a type tree, decide whether to skip calling 19 | /// AssetsManager.MonoTempGenerator to add the MonoBehaviour fields to the end of the base 20 | /// MonoBehaviour field or not. 21 | /// 22 | SkipMonoBehaviourFields = 2, 23 | /// 24 | /// If the file is using a type tree, force it to use the loaded class database instead. 25 | /// 26 | ForceFromCldb = 4 27 | } 28 | } -------------------------------------------------------------------------------- /Network/Sync/Items/BulletProofVestSynchronizationHandler.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Objects; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using static AdvancedCompany.Lib.Sync; 6 | using Unity.Netcode; 7 | using AdvancedCompany.Lib.SyncHandler; 8 | 9 | namespace AdvancedCompany.Network.Sync.Items 10 | { 11 | internal class BulletProofVestSynchronizationHandler : IItemSynchronisationHandler 12 | { 13 | public int Damage; 14 | public override void Apply(BulletProofVest item) 15 | { 16 | item.Damage = Damage; 17 | } 18 | 19 | public override void Read(BulletProofVest item) 20 | { 21 | Damage = item.Damage; 22 | } 23 | 24 | public override void Read(FastBufferReader reader) 25 | { 26 | reader.ReadValueSafe(out Damage); 27 | } 28 | 29 | public override void Write(FastBufferWriter writer) 30 | { 31 | writer.WriteValueSafe(Damage); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/NewReplacer/IContentReplacer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | 6 | namespace AssetsTools.NET 7 | { 8 | public interface IContentReplacer 9 | { 10 | /// 11 | /// Write the content with provided writer. 12 | /// 13 | void Write(AssetsFileWriter writer); 14 | /// 15 | /// Does the content has a preview stream? This will be true if the data 16 | /// is readily available (i.e. buffer or stream) and false if the data 17 | /// isn't readily available because it needs to be calculated (assets). 18 | /// 19 | bool HasPreview(); 20 | /// 21 | /// Returns the preview stream. 22 | /// 23 | Stream GetPreviewStream(); 24 | /// 25 | /// The replacer type such as modified or removed. 26 | /// 27 | ContentReplacerType GetReplacerType(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Unity/DressUpDrag.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.EventSystems; 3 | 4 | namespace AdvancedCompany 5 | { 6 | public class DressUpDrag : MonoBehaviour, IDragHandler 7 | { 8 | public bool Dragging = false; 9 | public Vector2 Delta = Vector2.zero; 10 | private Vector2 LastDrag = Vector2.zero; 11 | private bool DraggedLastFrame = false; 12 | 13 | public void OnDrag(PointerEventData eventData) 14 | { 15 | if (Dragging) 16 | { 17 | Delta = LastDrag - eventData.position; 18 | } 19 | Dragging = true; 20 | DraggedLastFrame = true; 21 | LastDrag = eventData.position; 22 | eventData.Use(); 23 | } 24 | 25 | void LateUpdate() 26 | { 27 | Delta = Vector2.zero; 28 | if (!DraggedLastFrame) 29 | { 30 | Dragging = false; 31 | LastDrag = Vector2.zero; 32 | } 33 | DraggedLastFrame = false; 34 | } 35 | 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/AssetsFileFormat/TypeTreeNodeFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace AssetsTools.NET 4 | { 5 | [Flags] 6 | public enum TypeTreeNodeFlags 7 | { 8 | None = 0, 9 | /// 10 | /// Type tree node is an array. 11 | /// 12 | Array = 1, 13 | /// 14 | /// Type tree node is a ref type. For example, "managedRefArrayItem" would be an 15 | /// array item that is a reference to an object in the registry. 16 | /// 17 | Ref = 2, 18 | /// 19 | /// Type tree node is a registry. Should just be "ManagedReferencesRegistry references". 20 | /// 21 | Registry = 4, 22 | /// 23 | /// Type tree node is an array of ref types. This occurs if the SerializeReference was 24 | /// added to a list or array instead of just a single field. This is not applied to the 25 | /// Array child of the field, just the field itself. 26 | /// 27 | ArrayOfRefs = 8 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Lib/SyncHandler/IItemSynchronizationHandler.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Lib.SyncHandler 7 | { 8 | public interface IItemSynchronizationHandler 9 | { 10 | void ReadObject(global::GrabbableObject item); 11 | void ApplyObject(global::GrabbableObject item); 12 | void Read(FastBufferReader reader); 13 | void Write(FastBufferWriter writer); 14 | } 15 | public abstract class IItemSynchronisationHandler : IItemSynchronizationHandler where T : GrabbableObject 16 | { 17 | public abstract void Read(T item); 18 | public abstract void Apply(T item); 19 | 20 | public void ReadObject(global::GrabbableObject item) 21 | { 22 | Read((T)item); 23 | } 24 | 25 | public void ApplyObject(global::GrabbableObject item) 26 | { 27 | Apply((T)item); 28 | } 29 | 30 | public abstract void Read(FastBufferReader reader); 31 | public abstract void Write(FastBufferWriter writer); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/NewReplacer/ContentReplacerFromBuffer.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | 3 | namespace AssetsTools.NET 4 | { 5 | public class ContentReplacerFromBuffer : IContentReplacer 6 | { 7 | private readonly byte[] buffer; 8 | 9 | private MemoryStream previewStream; 10 | 11 | public ContentReplacerFromBuffer(byte[] buffer) 12 | { 13 | this.buffer = buffer; 14 | } 15 | 16 | public void Write(AssetsFileWriter writer) 17 | { 18 | writer.Write(buffer); 19 | } 20 | 21 | public bool HasPreview() 22 | { 23 | return true; 24 | } 25 | 26 | public Stream GetPreviewStream() 27 | { 28 | if (previewStream == null) 29 | { 30 | previewStream = new MemoryStream(buffer); 31 | } 32 | 33 | previewStream.Position = 0; 34 | return previewStream; 35 | } 36 | 37 | public ContentReplacerType GetReplacerType() 38 | { 39 | return ContentReplacerType.AddOrModify; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Extra/Decompressors/LZMA/Common/OutBuffer.cs: -------------------------------------------------------------------------------- 1 | // OutBuffer.cs 2 | 3 | namespace SevenZip.Buffer 4 | { 5 | public class OutBuffer 6 | { 7 | byte[] m_Buffer; 8 | uint m_Pos; 9 | uint m_BufferSize; 10 | System.IO.Stream m_Stream; 11 | ulong m_ProcessedSize; 12 | 13 | public OutBuffer(uint bufferSize) 14 | { 15 | m_Buffer = new byte[bufferSize]; 16 | m_BufferSize = bufferSize; 17 | } 18 | 19 | public void SetStream(System.IO.Stream stream) { m_Stream = stream; } 20 | public void FlushStream() { m_Stream.Flush(); } 21 | public void CloseStream() { m_Stream.Close(); } 22 | public void ReleaseStream() { m_Stream = null; } 23 | 24 | public void Init() 25 | { 26 | m_ProcessedSize = 0; 27 | m_Pos = 0; 28 | } 29 | 30 | public void WriteByte(byte b) 31 | { 32 | m_Buffer[m_Pos++] = b; 33 | if (m_Pos >= m_BufferSize) 34 | FlushData(); 35 | } 36 | 37 | public void FlushData() 38 | { 39 | if (m_Pos == 0) 40 | return; 41 | m_Stream.Write(m_Buffer, 0, (int)m_Pos); 42 | m_Pos = 0; 43 | } 44 | 45 | public ulong GetProcessedSize() { return m_ProcessedSize + m_Pos; } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Lib/Player.cs: -------------------------------------------------------------------------------- 1 | using GameNetcodeStuff; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using UnityEngine; 6 | 7 | namespace AdvancedCompany.Lib 8 | { 9 | public class Player 10 | { 11 | internal static Dictionary Animations = new Dictionary(); 12 | public static void AddAnimation(AnimationClip clip) 13 | { 14 | if (!Animations.ContainsKey(clip.name)) 15 | { 16 | Animations.Add(clip.name, clip); 17 | } 18 | } 19 | 20 | public static void SetAnimationOverride(PlayerControllerB player, string originalName, string newName, bool sync = true) 21 | { 22 | var p = Game.Player.GetPlayer(player); 23 | p.AddOverride(originalName, newName, sync); 24 | } 25 | 26 | public static void RemoveAnimationOverride(PlayerControllerB player, string originalName, bool sync = true) 27 | { 28 | AssetBundle n; 29 | var p = Game.Player.GetPlayer(player); 30 | p.RemoveOverride(originalName, sync); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Network/Messages/CosmeticsSync.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network.Messages 7 | { 8 | [Message("CosmeticsSync", false, true)] 9 | internal class CosmeticsSync : INamedMessage 10 | { 11 | internal int PlayerNum; 12 | internal string[] Cosmetics; 13 | 14 | public void ReadData(FastBufferReader reader) 15 | { 16 | reader.ReadValueSafe(out PlayerNum); 17 | reader.ReadValueSafe(out int length); 18 | var list = new List(); 19 | for (var i = 0; i < length; i++) 20 | { 21 | reader.ReadValueSafe(out string c); 22 | list.Add(c); 23 | } 24 | Cosmetics = list.ToArray(); 25 | } 26 | 27 | public void WriteData(FastBufferWriter writer) 28 | { 29 | writer.WriteValueSafe(PlayerNum); 30 | writer.WriteValueSafe(Cosmetics.Length); 31 | for (var i = 0; i < Cosmetics.Length; i++) 32 | writer.WriteValueSafe(Cosmetics[i]); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Terminal/BoxedScreenXP.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Terminal 6 | { 7 | public class BoxedScreenXP : IScreen 8 | { 9 | public string Title; 10 | public List Content; 11 | 12 | public virtual string GetText(int availableWidth) 13 | { 14 | string xpHeader = "XP: " + Network.Manager.Lobby.Player().RemainingXP + " Ship XP: " + Network.Manager.Lobby.CurrentShip.RemainingXP; 15 | var text = $" ╔{new String('═', Title.Length + 2)}╗{new String(' ', availableWidth - 6 - Title.Length - xpHeader.Length)}{xpHeader}\n" + 16 | $"╭─╢ {Title} ╟{new String('─', availableWidth - 7 - Title.Length)}╮\n" + 17 | $"│ ╚{new String('═', Title.Length + 2)}╝{new String(' ', availableWidth - Title.Length - 7)}│\n"; 18 | foreach (var c in Content) 19 | text += Utils.WrapText(c.GetText(availableWidth - 4), availableWidth, "│ ", " │"); 20 | text += $"╰{new String('─', availableWidth - 2)}╯\n"; 21 | return text; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Terminal/Command.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Terminal 6 | { 7 | public class Command 8 | { 9 | public string CommandText; 10 | public string Description; 11 | public bool IsActive = true; 12 | public bool IsCheat = false; 13 | public bool ServerOnly = false; 14 | public Action Action; 15 | internal static List Commands = new(); 16 | 17 | public Command() 18 | { 19 | Commands.Add(this); 20 | } 21 | 22 | public static Command FindCommand(string commandText, bool isServer) 23 | { 24 | for (var i = 0; i < Commands.Count; i++) 25 | { 26 | if (Commands[i].IsActive && Commands[i].CommandText.Equals(commandText, StringComparison.OrdinalIgnoreCase) && (!Commands[i].ServerOnly || isServer)) 27 | return Commands[i]; 28 | } 29 | return null; 30 | } 31 | 32 | public void Execute(string[] @params) 33 | { 34 | Action(@params); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Patches/DebugPatches.cs: -------------------------------------------------------------------------------- 1 | using HarmonyLib; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace AdvancedCompany.Patches 7 | { 8 | [HarmonyPatch] 9 | internal class DebugPatches 10 | {/* 11 | [HarmonyPatch(typeof(GameNetcodeStuff.PlayerControllerB), "UpdatePlayerAnimationClientRpc")] 12 | [HarmonyPrefix] 13 | internal static void DebugA(GameNetcodeStuff.PlayerControllerB __instance, int animationState, float animationSpeed) 14 | { 15 | Plugin.Log.LogMessage("Received animation state: " + animationState); 16 | 17 | if (animationState == 0 || __instance.playerBodyAnimator.GetCurrentAnimatorStateInfo(0).fullPathHash == animationState) 18 | { 19 | Plugin.Log.LogMessage("Root found"); 20 | } 21 | for (int i = 0; i < __instance.playerBodyAnimator.layerCount; i++) 22 | { 23 | if (__instance.playerBodyAnimator.HasState(i, animationState)) 24 | { 25 | Plugin.Log.LogMessage("Layer " + i + " has state!"); 26 | } 27 | } 28 | }*/ 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Network/Messages/SyncCurrentLevel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network.Messages 7 | { 8 | [Message("SyncCurrentLevel", false, false)] 9 | internal class SyncCurrentLevel : INamedMessage 10 | { 11 | internal int CurrentLevelID; 12 | internal int CurrentWeather; 13 | internal int CurrentSeed; 14 | internal int[] DeadPlayers; 15 | internal int[] JoinedLate; 16 | 17 | public void ReadData(FastBufferReader reader) 18 | { 19 | reader.ReadValueSafe(out CurrentLevelID); 20 | reader.ReadValueSafe(out CurrentSeed); 21 | reader.ReadValueSafe(out CurrentWeather); 22 | reader.ReadValueSafe(out DeadPlayers); 23 | reader.ReadValueSafe(out JoinedLate); 24 | } 25 | 26 | public void WriteData(FastBufferWriter writer) 27 | { 28 | writer.WriteValueSafe(CurrentLevelID); 29 | writer.WriteValueSafe(CurrentSeed); 30 | writer.WriteValueSafe(CurrentWeather); 31 | writer.WriteValueSafe(DeadPlayers); 32 | writer.WriteValueSafe(JoinedLate); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/AssetsFileFormat/Hash128.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | 3 | namespace AssetsTools.NET 4 | { 5 | public struct Hash128 6 | { 7 | public byte[] data; //16 bytes 8 | 9 | public Hash128(byte[] data) 10 | { 11 | this.data = data; 12 | } 13 | public Hash128(AssetsFileReader reader) 14 | { 15 | data = reader.ReadBytes(16); 16 | } 17 | 18 | public bool IsZero() 19 | { 20 | if (data == null) 21 | return true; 22 | 23 | for (int i = 0; i < data.Length; i++) 24 | { 25 | if (data[i] != 0) 26 | return false; 27 | } 28 | 29 | return true; 30 | } 31 | 32 | public override string ToString() 33 | { 34 | StringBuilder hex = new StringBuilder(data.Length * 2); 35 | 36 | foreach (byte b in data) 37 | { 38 | hex.AppendFormat("{0:x2}", b); 39 | } 40 | 41 | return hex.ToString(); 42 | } 43 | 44 | public static Hash128 NewBlankHash() 45 | { 46 | return new Hash128() { data = new byte[16] }; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Patches/ItemDropship.cs: -------------------------------------------------------------------------------- 1 | using HarmonyLib; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Reflection.Emit; 6 | using System.Reflection; 7 | using System.Text; 8 | 9 | namespace AdvancedCompany.Patches 10 | { 11 | [HarmonyPatch] 12 | internal class ItemDropship 13 | { 14 | [HarmonyPatch(typeof(global::ItemDropship), "Update")] 15 | static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator, MethodBase method) 16 | { 17 | Plugin.Log.LogDebug("Patching ItemDropship->Update..."); 18 | 19 | var property = typeof(Perks).GetProperty("DropshipTime", BindingFlags.Static | BindingFlags.FlattenHierarchy | BindingFlags.Public); 20 | 21 | var inst = new List(instructions); 22 | for (var i = 0; i < inst.Count; i++) 23 | { 24 | if (inst[i].operand is float f && f == 40f) 25 | { 26 | IL.Patches.AddMultiplierInstruction("DeliverySpeed", inst, i + 1); 27 | break; 28 | } 29 | } 30 | Plugin.Log.LogDebug("Patched ItemDropship->Update..."); 31 | return inst.AsEnumerable(); 32 | } 33 | 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Network/Fletcher.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Network 6 | { 7 | internal static class Fletcher 8 | { 9 | static IEnumerable Blockify(IReadOnlyList inputAsBytes, int blockSize) 10 | { 11 | var i = 0; 12 | ulong block = 0; 13 | 14 | while (i < inputAsBytes.Count) 15 | { 16 | block = (block << 8) | inputAsBytes[i]; 17 | i++; 18 | 19 | if (i % blockSize != 0 && i != inputAsBytes.Count) continue; 20 | 21 | yield return block; 22 | block = 0; 23 | } 24 | } 25 | 26 | static byte[] GetFletcher(IReadOnlyList input, int n = 32) // Fletcher 32, 16, 64 27 | { 28 | var bytesPerCycle = n / 16; 29 | var modValue = (ulong)(System.Math.Pow(2, 8 * bytesPerCycle) - 1); 30 | 31 | ulong sum1 = 0; 32 | ulong sum2 = 0; 33 | 34 | foreach (var block in Blockify(input, bytesPerCycle)) 35 | { 36 | sum1 = (sum1 + block) % modValue; 37 | sum2 = (sum2 + sum1) % modValue; 38 | } 39 | 40 | return BitConverter.GetBytes(sum1 + sum2 * (modValue + 1)); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Network/Messages/UseMobileTerminal.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network.Messages 7 | { 8 | [Message("UseMobileTerminal", false, true)] 9 | internal class UseMobileTerminal : INamedMessage 10 | { 11 | public int PlayerNum; 12 | public bool IsUsingTerminal; 13 | public string ConsoleText; 14 | public string InputText; 15 | public float Scroll; 16 | 17 | public void ReadData(FastBufferReader reader) 18 | { 19 | reader.ReadValueSafe(out PlayerNum); 20 | reader.ReadValueSafe(out IsUsingTerminal); 21 | if (IsUsingTerminal) 22 | { 23 | reader.ReadValueSafe(out ConsoleText); 24 | reader.ReadValueSafe(out InputText); 25 | reader.ReadValueSafe(out Scroll); 26 | } 27 | } 28 | 29 | public void WriteData(FastBufferWriter writer) 30 | { 31 | writer.WriteValueSafe(PlayerNum); 32 | writer.WriteValueSafe(IsUsingTerminal); 33 | if (IsUsingTerminal) 34 | { 35 | writer.WriteValueSafe(ConsoleText); 36 | writer.WriteValueSafe(InputText); 37 | writer.WriteValueSafe(Scroll); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Extra/Decompressors/LZMA/Common/CRC.cs: -------------------------------------------------------------------------------- 1 | // Common/CRC.cs 2 | 3 | namespace SevenZip 4 | { 5 | class CRC 6 | { 7 | public static readonly uint[] Table; 8 | 9 | static CRC() 10 | { 11 | Table = new uint[256]; 12 | const uint kPoly = 0xEDB88320; 13 | for (uint i = 0; i < 256; i++) 14 | { 15 | uint r = i; 16 | for (int j = 0; j < 8; j++) 17 | if ((r & 1) != 0) 18 | r = (r >> 1) ^ kPoly; 19 | else 20 | r >>= 1; 21 | Table[i] = r; 22 | } 23 | } 24 | 25 | uint _value = 0xFFFFFFFF; 26 | 27 | public void Init() { _value = 0xFFFFFFFF; } 28 | 29 | public void UpdateByte(byte b) 30 | { 31 | _value = Table[(((byte)(_value)) ^ b)] ^ (_value >> 8); 32 | } 33 | 34 | public void Update(byte[] data, uint offset, uint size) 35 | { 36 | for (uint i = 0; i < size; i++) 37 | _value = Table[(((byte)(_value)) ^ data[offset + i])] ^ (_value >> 8); 38 | } 39 | 40 | public uint GetDigest() { return _value ^ 0xFFFFFFFF; } 41 | 42 | static uint CalculateDigest(byte[] data, uint offset, uint size) 43 | { 44 | CRC crc = new CRC(); 45 | // crc.Init(); 46 | crc.Update(data, offset, size); 47 | return crc.GetDigest(); 48 | } 49 | 50 | static bool VerifyDigest(uint digest, byte[] data, uint offset, uint size) 51 | { 52 | return (CalculateDigest(data, offset, size) == digest); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Unity/ConfigToggle.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Config; 2 | using TMPro; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | 6 | namespace AdvancedCompany 7 | { 8 | public class ConfigToggle : MonoBehaviour 9 | { 10 | public TextMeshProUGUI Label; 11 | public Toggle Toggle; 12 | public UnityEngine.UI.Button ResetButton; 13 | private Configuration.ConfigField Field; 14 | 15 | void Start() 16 | { 17 | Toggle.onValueChanged.AddListener(new UnityEngine.Events.UnityAction((val) => { 18 | Field.Value = val; 19 | })); 20 | 21 | ResetButton.onClick.AddListener(new UnityEngine.Events.UnityAction(() => { 22 | Field.Reset(); 23 | Toggle.SetIsOnWithoutNotify((bool)Field.Value); 24 | })); 25 | } 26 | 27 | public void UpdateValue() 28 | { 29 | Toggle.SetIsOnWithoutNotify((bool)Field.Value); 30 | } 31 | 32 | public void SetValue(Configuration.ConfigField field) 33 | { 34 | Field = field; 35 | UpdateValue(); 36 | } 37 | 38 | public void Initialize(string label, bool showReset = true) 39 | { 40 | Label.text = label + (label.EndsWith(":") ? "" : ":"); 41 | ResetButton.gameObject.SetActive(showReset); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Objects/GrabbableObjectAdditions.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Objects.Interfaces; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using UnityEngine; 6 | 7 | namespace AdvancedCompany.Objects 8 | { 9 | internal class GrabbableObjectAdditions 10 | { 11 | public static Sprite GetIcon(GrabbableObject obj) 12 | { 13 | if (obj is IIconProvider provider) 14 | { 15 | return provider.GetIcon(); 16 | } 17 | return obj.itemProperties.itemIcon; 18 | } 19 | 20 | public static int GetInventoryPosition(GrabbableObject obj) 21 | { 22 | if (obj.playerHeldBy != null) 23 | for (var i = 0; i < obj.playerHeldBy.ItemSlots.Length; i++) 24 | if (obj.playerHeldBy.ItemSlots[i] == obj) 25 | return i; 26 | return -1; 27 | } 28 | 29 | public static void ChangeIcon(GrabbableObject obj, Sprite icon) 30 | { 31 | if (obj.playerHeldBy != null && obj.playerHeldBy == GameNetworkManager.Instance.localPlayerController) 32 | { 33 | var inventoryPos = GetInventoryPosition(obj); 34 | if (inventoryPos > -1) 35 | HUDManager.Instance.itemSlotIcons[inventoryPos].sprite = icon; 36 | } 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Additional context** 27 | Add any other context about the problem here. 28 | 29 | **Logfiles** 30 | Please attach log files to your issue. If this is a multiplayer specific issue please provide logs of the host and the affected clients. 31 | 32 | You can find the logs of the game in %appdata%/../LocalLow/ZeekerssRBLX/Lethal Company/ 33 | 34 | The log file is called "Player.log" (or just Player if you have file extensions hidden) 35 | 36 | Please note: These logs will get overwritten everytime you start the game. So please get your logs right when the issue occured. 37 | 38 | **Add a list of all of your mods** 39 | 40 | Please provide a list of all mods you have installed. 41 | 42 | Go to Settings and select "Show dependency strings" and copy the text here. 43 | Exporting your profile and attaching it to the issue might also help. 44 | -------------------------------------------------------------------------------- /Terminal/Applications/ShipXPApplication.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Config; 2 | using AdvancedCompany.Game; 3 | using AdvancedCompany.Network.Messages; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | using Unity.Netcode; 8 | 9 | namespace AdvancedCompany.Terminal.Applications 10 | { 11 | [Boot.Bootable] 12 | internal class ShipXPApplication : IApplication 13 | { 14 | public static void Boot() 15 | { 16 | MobileTerminal.RegisterApplication("shipxp", new ShipXPApplication()); 17 | } 18 | 19 | public void Exit() 20 | { 21 | 22 | } 23 | 24 | public void Main(MobileTerminal terminal, string[] args) 25 | { 26 | if (!NetworkManager.Singleton.IsServer) 27 | terminal.WriteLine("Only host is allowed to run this command!"); 28 | else if (args.Length > 0 && int.TryParse(args[0], out var xp)) 29 | { 30 | Network.Manager.Send(new GrantShipXP() { XP = xp }); 31 | terminal.WriteLine($"Granted {xp} XP to the ship."); 32 | } 33 | else 34 | { 35 | terminal.WriteLine("Usage: shipxp [amount]"); 36 | } 37 | terminal.Exit(); 38 | } 39 | 40 | public void Submit(string text) 41 | { 42 | } 43 | 44 | public void Update() 45 | { 46 | 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Unity/CosmeticDatabase.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Cosmetics; 2 | using System.Collections.Generic; 3 | 4 | namespace AdvancedCompany 5 | { 6 | public class CosmeticDatabase 7 | { 8 | public static Dictionary> Cosmetics = new Dictionary>() 9 | { 10 | { CosmeticType.HAT, new Dictionary() }, 11 | { CosmeticType.CHEST, new Dictionary() }, 12 | { CosmeticType.HIP, new Dictionary() }, 13 | { CosmeticType.R_LOWER_ARM, new Dictionary() }, 14 | { CosmeticType.WRIST, new Dictionary() }, 15 | { CosmeticType.R_SHIN, new Dictionary() }, 16 | { CosmeticType.L_SHIN, new Dictionary() } 17 | }; 18 | public static Dictionary AllCosmetics = new Dictionary(); 19 | public static void AddCosmetic(CosmeticInstance instance) 20 | { 21 | if (!AllCosmetics.ContainsKey(instance.cosmeticId)) 22 | { 23 | AllCosmetics.Add(instance.cosmeticId, instance); 24 | Cosmetics[instance.cosmeticType].Add(instance.cosmeticId, instance); 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/ClassDatabaseFile/ClassFileTypeFlags.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AssetsTools.NET 6 | { 7 | [Flags] 8 | public enum ClassFileTypeFlags : byte 9 | { 10 | /// 11 | /// None of the flags apply to this class 12 | /// 13 | None = 0, 14 | /// 15 | /// Is the class abstract? 16 | /// 17 | IsAbstract = 1, 18 | /// 19 | /// Is the class sealed? Not necessarily accurate. 20 | /// 21 | IsSealed = 2, 22 | /// 23 | /// Does the class only appear in the editor? 24 | /// 25 | IsEditorOnly = 4, 26 | /// 27 | /// Does the class only appear in game files? Not currently used. 28 | /// 29 | IsReleaseOnly = 8, 30 | /// 31 | /// Is the class stripped? 32 | /// 33 | IsStripped = 16, 34 | /// 35 | /// Not currently used 36 | /// 37 | Reserved = 32, 38 | /// 39 | /// Does the class have an editor root node? 40 | /// 41 | HasEditorRootNode = 64, 42 | /// 43 | /// Does the class have a release root node? 44 | /// 45 | HasReleaseRootNode = 128 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /Patches/HUDManager.cs: -------------------------------------------------------------------------------- 1 | using HarmonyLib; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using UnityEngine.UI; 6 | using UnityEngine; 7 | using GameNetcodeStuff; 8 | using System.Linq; 9 | using System.Reflection.Emit; 10 | using System.Reflection; 11 | 12 | namespace AdvancedCompany.Patches 13 | { 14 | [HarmonyPatch] 15 | internal class HUDManager 16 | { 17 | [HarmonyPatch(typeof(global::HUDManager), "MeetsScanNodeRequirements")] 18 | [HarmonyTranspiler] 19 | static IEnumerable PatchMeetsScanNodeRequirements(IEnumerable instructions) 20 | { 21 | Plugin.Log.LogDebug("Patching HUDManager->MeetsScanNodeRequirements..."); 22 | 23 | var property = typeof(Perks).GetProperty("ScanDistanceMultiplier", BindingFlags.Static | BindingFlags.FlattenHierarchy | BindingFlags.Public); 24 | 25 | var inst = new List(instructions); 26 | for (var i = 0; i < inst.Count; i++) 27 | { 28 | if (inst[i].opcode == OpCodes.Ldfld && inst[i].operand.ToString() == "System.Int32 maxRange") 29 | { 30 | IL.Patches.AddMultiplierInstruction("ScanDistance", inst, i + 2); 31 | break; 32 | } 33 | } 34 | 35 | Plugin.Log.LogDebug("Patched HUDManager->MeetsScanNodeRequirements..."); 36 | return inst.AsEnumerable(); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Extra/AssetsManager/AssetsManager.ClassDatabase.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | 6 | namespace AssetsTools.NET.Extra 7 | { 8 | public partial class AssetsManager 9 | { 10 | public ClassDatabaseFile LoadClassDatabase(Stream stream) 11 | { 12 | ClassDatabase = new ClassDatabaseFile(); 13 | ClassDatabase.Read(new AssetsFileReader(stream)); 14 | return ClassDatabase; 15 | } 16 | 17 | public ClassDatabaseFile LoadClassDatabase(string path) 18 | { 19 | return LoadClassDatabase(File.OpenRead(path)); 20 | } 21 | 22 | public ClassDatabaseFile LoadClassDatabaseFromPackage(UnityVersion version) 23 | { 24 | return ClassDatabase = ClassPackage.GetClassDatabase(version); 25 | } 26 | 27 | public ClassDatabaseFile LoadClassDatabaseFromPackage(string version) 28 | { 29 | return ClassDatabase = ClassPackage.GetClassDatabase(version); 30 | } 31 | 32 | public ClassPackageFile LoadClassPackage(Stream stream) 33 | { 34 | ClassPackage = new ClassPackageFile(); 35 | ClassPackage.Read(new AssetsFileReader(stream)); 36 | return ClassPackage; 37 | } 38 | 39 | public ClassPackageFile LoadClassPackage(string path) 40 | { 41 | return LoadClassPackage(File.OpenRead(path)); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Terminal/Applications/CreditsApplication.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Config; 2 | using AdvancedCompany.Game; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | using Unity.Netcode; 7 | 8 | namespace AdvancedCompany.Terminal.Applications 9 | { 10 | [Boot.Bootable] 11 | internal class CreditsApplication : IApplication 12 | { 13 | public static void Boot() 14 | { 15 | MobileTerminal.RegisterApplication("credits", new CreditsApplication()); 16 | } 17 | 18 | public void Exit() 19 | { 20 | 21 | } 22 | 23 | public void Main(MobileTerminal terminal, string[] args) 24 | { 25 | if (!NetworkManager.Singleton.IsServer) 26 | terminal.WriteLine("Only host is allowed to run this command!"); 27 | else if (args.Length > 0 && int.TryParse(args[0], out var credits)) 28 | { 29 | Game.Manager.Terminal.groupCredits += credits; 30 | Game.Manager.Terminal.SyncGroupCreditsServerRpc(Game.Manager.Terminal.groupCredits, Game.Manager.Terminal.numberOfItemsInDropship); 31 | terminal.WriteLine("You've been given " + credits + " credits!"); 32 | } 33 | else 34 | { 35 | terminal.WriteLine("Usage: credits [amount]"); 36 | } 37 | terminal.Exit(); 38 | } 39 | 40 | public void Submit(string text) 41 | { 42 | } 43 | 44 | public void Update() 45 | { 46 | 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Unity/NewPresetWindow.cs: -------------------------------------------------------------------------------- 1 | using TMPro; 2 | using UnityEngine; 3 | using UnityEngine.UI; 4 | 5 | namespace AdvancedCompany 6 | { 7 | public class NewPresetWindow : MonoBehaviour 8 | { 9 | public GameObject Shadow; 10 | public TMP_InputField NameInput; 11 | public Button ConfirmButton; 12 | public Button CancelButton; 13 | public delegate void Submitted(string value); 14 | public delegate void Cancelled(); 15 | [HideInInspector] 16 | public Submitted OnSubmitted; 17 | [HideInInspector] 18 | public Cancelled OnCancelled; 19 | // Start is called before the first frame update 20 | void Start() 21 | { 22 | CancelButton.onClick.AddListener(new UnityEngine.Events.UnityAction(() => 23 | { 24 | Close(); 25 | if (OnCancelled != null) 26 | OnCancelled(); 27 | })); 28 | ConfirmButton.onClick.AddListener(new UnityEngine.Events.UnityAction(() => 29 | { 30 | Close(); 31 | if (OnSubmitted != null) 32 | OnSubmitted(NameInput.text.Trim()); 33 | })); 34 | } 35 | 36 | public void Open(string name) 37 | { 38 | Shadow.SetActive(true); 39 | gameObject.SetActive(true); 40 | NameInput.text = name; 41 | } 42 | 43 | public void Close() 44 | { 45 | Shadow.SetActive(false); 46 | gameObject.SetActive(false); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Patches/AnimationPatches.cs: -------------------------------------------------------------------------------- 1 | using HarmonyLib; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using UnityEngine; 6 | 7 | namespace AdvancedCompany.Patches 8 | { 9 | [LoadAssets] 10 | [HarmonyPatch] 11 | internal class AnimationPatches 12 | { 13 | internal static RuntimeAnimatorController PlayerAnimator; 14 | internal static RuntimeAnimatorController OtherPlayerAnimator; 15 | 16 | public static void LoadAssets(AssetBundle assets) 17 | { 18 | PlayerAnimator = new AnimatorOverrideController(assets.LoadAsset("Assets/Animators/metarig.controller")); 19 | OtherPlayerAnimator = new AnimatorOverrideController(assets.LoadAsset("Assets/Animators/metarigOtherPlayers.controller")); 20 | } 21 | 22 | [HarmonyPatch(typeof(global::StartOfRound), "Awake")] 23 | [HarmonyPrefix] 24 | private static void Initialize(global::StartOfRound __instance) 25 | { 26 | __instance.otherClientsAnimatorController = new AnimatorOverrideController(OtherPlayerAnimator); 27 | __instance.localClientAnimatorController = new AnimatorOverrideController(PlayerAnimator); 28 | } 29 | 30 | [HarmonyPatch(typeof(GameNetcodeStuff.PlayerControllerB), "Awake")] 31 | [HarmonyPostfix] 32 | public static void Awake(GameNetcodeStuff.PlayerControllerB __instance) 33 | { 34 | __instance.playerBodyAnimator.runtimeAnimatorController = OtherPlayerAnimator; 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Unity/ConfigTextInput.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Config; 2 | using TMPro; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | 6 | namespace AdvancedCompany 7 | { 8 | public class ConfigTextInput : MonoBehaviour 9 | { 10 | public TextMeshProUGUI Label; 11 | public TMPro.TMP_InputField Input; 12 | public LayoutElement InputLayout; 13 | public UnityEngine.UI.Button ResetButton; 14 | private Configuration.ConfigField Field; 15 | 16 | // Start is called before the first frame update 17 | void Start() 18 | { 19 | Input.onValueChanged.AddListener(new UnityEngine.Events.UnityAction((val) => 20 | { 21 | Field.Value = val; 22 | })); 23 | 24 | ResetButton.onClick.AddListener(new UnityEngine.Events.UnityAction(() => { 25 | Field.Reset(); 26 | Input.SetTextWithoutNotify(Field.Value.ToString()); 27 | })); 28 | } 29 | 30 | public void UpdateValue() 31 | { 32 | Input.SetTextWithoutNotify(Field.Value.ToString()); 33 | } 34 | 35 | public void SetValue(Configuration.ConfigField field) 36 | { 37 | Field = field; 38 | UpdateValue(); 39 | } 40 | 41 | public void Initialize(string label, bool showReset = true) 42 | { 43 | Label.text = label + (label.EndsWith(":") ? "" : ":"); 44 | InputLayout.preferredWidth = 100f; 45 | ResetButton.gameObject.SetActive(showReset); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Unity/RenamePresetWindow.cs: -------------------------------------------------------------------------------- 1 | using TMPro; 2 | using UnityEngine; 3 | using UnityEngine.UI; 4 | 5 | namespace AdvancedCompany 6 | { 7 | public class RenamePresetWindow : MonoBehaviour 8 | { 9 | public GameObject Shadow; 10 | public TMP_InputField NameInput; 11 | public Button ConfirmButton; 12 | public Button CancelButton; 13 | public delegate void Submitted(string value); 14 | public delegate void Cancelled(); 15 | [HideInInspector] 16 | public Submitted OnSubmitted; 17 | [HideInInspector] 18 | public Cancelled OnCancelled; 19 | // Start is called before the first frame update 20 | void Start() 21 | { 22 | CancelButton.onClick.AddListener(new UnityEngine.Events.UnityAction(() => 23 | { 24 | Close(); 25 | if (OnCancelled != null) 26 | OnCancelled(); 27 | })); 28 | ConfirmButton.onClick.AddListener(new UnityEngine.Events.UnityAction(() => 29 | { 30 | Close(); 31 | if (OnSubmitted != null) 32 | OnSubmitted(NameInput.text.Trim()); 33 | })); 34 | } 35 | 36 | public void Open(string name) 37 | { 38 | Shadow.SetActive(true); 39 | gameObject.SetActive(true); 40 | NameInput.text = name; 41 | } 42 | 43 | public void Close() 44 | { 45 | Shadow.SetActive(false); 46 | gameObject.SetActive(false); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Extra/AssetsManager/BundleFileInstance.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.IO; 3 | 4 | namespace AssetsTools.NET.Extra 5 | { 6 | public class BundleFileInstance 7 | { 8 | public string path; 9 | public string name; 10 | public AssetBundleFile file; 11 | /// 12 | /// List of loaded assets files for this bundle. 13 | /// 14 | /// 15 | /// This list does not contain every assets file for the bundle, 16 | /// instead only the ones that have been loaded so far. 17 | /// 18 | public List loadedAssetsFiles; 19 | 20 | public Stream BundleStream => file.Reader.BaseStream; 21 | public Stream DataStream => file.DataReader.BaseStream; 22 | 23 | public BundleFileInstance(Stream stream, string filePath, bool unpackIfPacked = true) 24 | { 25 | path = Path.GetFullPath(filePath); 26 | name = Path.GetFileName(path); 27 | file = new AssetBundleFile(); 28 | file.Read(new AssetsFileReader(stream)); 29 | if (file.Header != null && file.DataIsCompressed && unpackIfPacked) 30 | { 31 | file = BundleHelper.UnpackBundle(file); 32 | } 33 | loadedAssetsFiles = new List(); 34 | } 35 | 36 | public BundleFileInstance(FileStream stream, bool unpackIfPacked = true) 37 | : this(stream, stream.Name, unpackIfPacked) 38 | { 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/ClassDatabaseFile/ClassDatabaseStringTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AssetsTools.NET 6 | { 7 | public class ClassDatabaseStringTable 8 | { 9 | public List Strings { get; set; } 10 | 11 | public void Read(AssetsFileReader reader) 12 | { 13 | int stringCount = reader.ReadInt32(); 14 | Strings = new List(stringCount); 15 | for (int i = 0; i < stringCount; i++) 16 | { 17 | Strings.Add(reader.ReadString()); 18 | } 19 | } 20 | 21 | public void Write(AssetsFileWriter writer) 22 | { 23 | writer.Write(Strings.Count); 24 | for (int i = 0; i < Strings.Count; i++) 25 | { 26 | writer.Write(Strings[i]); 27 | } 28 | } 29 | 30 | public ushort AddString(string str) 31 | { 32 | int index = Strings.IndexOf(str); 33 | if (index == -1) 34 | { 35 | index = Strings.Count; 36 | Strings.Add(str); 37 | } 38 | return (ushort)index; 39 | } 40 | 41 | /// 42 | /// Get a string from the string table. 43 | /// 44 | /// The index of the string in the table. 45 | /// The string at that index. 46 | public string GetString(ushort index) 47 | { 48 | return Strings[index]; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Unity/RemovePresetWindow.cs: -------------------------------------------------------------------------------- 1 | using TMPro; 2 | using UnityEngine; 3 | using UnityEngine.UI; 4 | 5 | namespace AdvancedCompany 6 | { 7 | public class RemovePresetWindow : MonoBehaviour 8 | { 9 | public GameObject Shadow; 10 | public TextMeshProUGUI Text; 11 | public Button ConfirmButton; 12 | public Button CancelButton; 13 | public delegate void Submitted(); 14 | public delegate void Cancelled(); 15 | [HideInInspector] 16 | public Submitted OnSubmitted; 17 | [HideInInspector] 18 | public Cancelled OnCancelled; 19 | // Start is called before the first frame update 20 | void Start() 21 | { 22 | CancelButton.onClick.AddListener(new UnityEngine.Events.UnityAction(() => 23 | { 24 | Close(); 25 | if (OnCancelled != null) 26 | OnCancelled(); 27 | })); 28 | ConfirmButton.onClick.AddListener(new UnityEngine.Events.UnityAction(() => 29 | { 30 | Close(); 31 | if (OnSubmitted != null) 32 | OnSubmitted(); 33 | })); 34 | } 35 | 36 | public void Open(string name) 37 | { 38 | Text.text = "Do you really want to remove \"" + name + "\"? This step is irreversible."; 39 | Shadow.SetActive(true); 40 | gameObject.SetActive(true); 41 | } 42 | 43 | public void Close() 44 | { 45 | Shadow.SetActive(false); 46 | gameObject.SetActive(false); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Extra/Decompressors/LZMA/Common/InBuffer.cs: -------------------------------------------------------------------------------- 1 | // InBuffer.cs 2 | 3 | namespace SevenZip.Buffer 4 | { 5 | public class InBuffer 6 | { 7 | byte[] m_Buffer; 8 | uint m_Pos; 9 | uint m_Limit; 10 | uint m_BufferSize; 11 | System.IO.Stream m_Stream; 12 | bool m_StreamWasExhausted; 13 | ulong m_ProcessedSize; 14 | 15 | public InBuffer(uint bufferSize) 16 | { 17 | m_Buffer = new byte[bufferSize]; 18 | m_BufferSize = bufferSize; 19 | } 20 | 21 | public void Init(System.IO.Stream stream) 22 | { 23 | m_Stream = stream; 24 | m_ProcessedSize = 0; 25 | m_Limit = 0; 26 | m_Pos = 0; 27 | m_StreamWasExhausted = false; 28 | } 29 | 30 | public bool ReadBlock() 31 | { 32 | if (m_StreamWasExhausted) 33 | return false; 34 | m_ProcessedSize += m_Pos; 35 | int aNumProcessedBytes = m_Stream.Read(m_Buffer, 0, (int)m_BufferSize); 36 | m_Pos = 0; 37 | m_Limit = (uint)aNumProcessedBytes; 38 | m_StreamWasExhausted = (aNumProcessedBytes == 0); 39 | return (!m_StreamWasExhausted); 40 | } 41 | 42 | 43 | public void ReleaseStream() 44 | { 45 | // m_Stream.Close(); 46 | m_Stream = null; 47 | } 48 | 49 | public bool ReadByte(byte b) // check it 50 | { 51 | if (m_Pos >= m_Limit) 52 | if (!ReadBlock()) 53 | return false; 54 | b = m_Buffer[m_Pos++]; 55 | return true; 56 | } 57 | 58 | public byte ReadByte() 59 | { 60 | // return (byte)m_Stream.ReadByte(); 61 | if (m_Pos >= m_Limit) 62 | if (!ReadBlock()) 63 | return 0xFF; 64 | return m_Buffer[m_Pos++]; 65 | } 66 | 67 | public ulong GetProcessedSize() 68 | { 69 | return m_ProcessedSize + m_Pos; 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /HDRPChanges.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Reflection; 4 | using UnityEngine.Rendering.HighDefinition; 5 | using UnityEngine.Rendering; 6 | 7 | namespace AdvancedCompany 8 | { 9 | [Boot.Bootable] 10 | public class HDRPChanges 11 | { 12 | public static void Boot() 13 | { 14 | Plugin.Log.LogDebug("Patching HDRP..."); 15 | try 16 | { 17 | var pipelineAsset = GraphicsSettings.currentRenderPipeline as HDRenderPipelineAsset; 18 | var settings = pipelineAsset.currentPlatformRenderPipelineSettings; 19 | var globalSettings = typeof(HDRenderPipelineAsset).Assembly.GetType("UnityEngine.Rendering.HighDefinition.HDRenderPipelineGlobalSettings"); 20 | var instanceProperty = globalSettings.GetProperty("instance", BindingFlags.Public | BindingFlags.Static | BindingFlags.FlattenHierarchy); 21 | var instance = instanceProperty.GetValue(null); 22 | var afterPostProcess = globalSettings.GetField("afterPostProcessCustomPostProcesses", BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.FlattenHierarchy); 23 | var list = (List)afterPostProcess.GetValue(instance); 24 | list.Add(typeof(PostProcessing.VisionEnhancer).AssemblyQualifiedName); 25 | 26 | settings.lightLoopSettings.cookieAtlasSize = CookieAtlasResolution.CookieResolution2048; 27 | } 28 | catch (Exception e) 29 | { 30 | Plugin.Log.LogError("Error while patching HDRP!"); 31 | Plugin.Log.LogError(e); 32 | } 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Unity/ItemData.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace AdvancedCompany.Game 4 | { 5 | public class ItemData : MonoBehaviour 6 | { 7 | // general data 8 | public int ID; 9 | public string ItemName; 10 | public Sprite ItemIcon; 11 | public float Weight; 12 | public bool IsConductive; 13 | public bool IsTwoHanded; 14 | public bool IsScrap; 15 | public int MinValue; 16 | public int MaxValue; 17 | public int Rarity = 100; 18 | public bool LimitPlanets; 19 | public int[] PlanetRarities = new int[Moons.Count]; 20 | public bool UsesBattery; 21 | public float BatteryUsage; 22 | 23 | // shop data 24 | public bool IsBuyable; 25 | public int Price; 26 | public int MaxDiscount; 27 | 28 | // audio 29 | public AudioClip GrabSFX; 30 | public AudioClip DropSFX; 31 | public AudioClip PocketSFX; 32 | 33 | // animations 34 | public string HoldAnimation; 35 | public bool HoldIsTwoHanded; 36 | 37 | // synchronization 38 | public bool HasSaveData; 39 | public bool SyncUseFunction; 40 | public bool SyncInteractLRFunction; 41 | public bool SyncGrabFunction; 42 | public bool SyncDiscardFunction; 43 | 44 | 45 | public Vector3 EgoHeldPosition; 46 | public Vector3 EgoHeldRotation; 47 | public Vector3 HeldPosition; 48 | public Vector3 HeldRotation; 49 | public Vector3 GroundRestingRotation; 50 | public float GroundVerticalOffset; 51 | public Vector3 HolderRestingRotation; 52 | 53 | public Vector3 NoPosition; 54 | } 55 | } -------------------------------------------------------------------------------- /Terminal/UnlockableCursorElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using AdvancedCompany.Game; 5 | using UnityEngine; 6 | 7 | namespace AdvancedCompany.Terminal 8 | { 9 | internal class UnlockableCursorElement : CursorElement 10 | { 11 | internal UnlockableItem Item; 12 | internal int Amount; 13 | internal int MaxAmount = 1; 14 | 15 | public UnlockableCursorElement(UnlockableItem item, int maxAmount) 16 | { 17 | MaxAmount = maxAmount; 18 | Item = item; 19 | Amount = 0; 20 | } 21 | 22 | public override string GetText(int availableWidth) 23 | { 24 | var nameLength = 22; 25 | var priceLength = 6; 26 | 27 | var name = "" + (Item.unlockableName.Length > nameLength ? Item.unlockableName.Substring(0, nameLength) : Item.unlockableName + new string(' ', nameLength - Item.unlockableName.Length)) + ""; 28 | var price = Game.Manager.Items.GetUnlockablePrice(Item); 29 | var priceText = "$" + Mathf.FloorToInt(price) + ""; 30 | priceText = new string(' ', priceLength - priceText.Length) + priceText; 31 | var amountText = Amount + ""; 32 | if (amountText.Length == 1) amountText = " " + amountText; 33 | var text = "← " + amountText + " → " + name + " " + priceText; 34 | 35 | text += " "; 36 | 37 | var totalLength = 7; 38 | var total = " $" + (Amount * price); 39 | text += new string(' ', totalLength - total.Length) + total; 40 | 41 | return text; 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Unity/ConfirmOverrideWindow.cs: -------------------------------------------------------------------------------- 1 | using TMPro; 2 | using UnityEngine; 3 | using UnityEngine.UI; 4 | 5 | namespace AdvancedCompany 6 | { 7 | public class ConfirmOverrideWindow : MonoBehaviour 8 | { 9 | public GameObject Shadow; 10 | public TextMeshProUGUI Text; 11 | public Button ConfirmButton; 12 | public Button CancelButton; 13 | public delegate void Submitted(string name); 14 | public delegate void Cancelled(); 15 | [HideInInspector] 16 | public Submitted OnSubmitted; 17 | [HideInInspector] 18 | public Cancelled OnCancelled; 19 | private string Name; 20 | 21 | // Start is called before the first frame update 22 | void Start() 23 | { 24 | CancelButton.onClick.AddListener(new UnityEngine.Events.UnityAction(() => 25 | { 26 | Close(); 27 | if (OnCancelled != null) 28 | OnCancelled(); 29 | })); 30 | ConfirmButton.onClick.AddListener(new UnityEngine.Events.UnityAction(() => 31 | { 32 | Close(); 33 | if (OnSubmitted != null) 34 | OnSubmitted(Name); 35 | })); 36 | } 37 | 38 | public void Open(string name) 39 | { 40 | Name = name; 41 | Text.text = "Do you really want to override \"" + name + "\"? This step is irreversible."; 42 | Shadow.SetActive(true); 43 | gameObject.SetActive(true); 44 | } 45 | 46 | public void Close() 47 | { 48 | Shadow.SetActive(false); 49 | gameObject.SetActive(false); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Patches/BalancingPatches.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Config; 2 | using BepInEx.Bootstrap; 3 | using HarmonyLib; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Reflection; 7 | using System.Runtime.CompilerServices; 8 | using System.Text; 9 | using UnityEngine; 10 | 11 | namespace AdvancedCompany.Patches 12 | { 13 | [HarmonyPatch] 14 | internal class BalancingPatches 15 | { 16 | 17 | [HarmonyPatch(typeof(global::RoundManager), "SpawnScrapInLevel")] 18 | [HarmonyPrefix] 19 | [HarmonyPriority(int.MaxValue)] 20 | public static void ResetMultiplier(global::RoundManager __instance) 21 | { 22 | __instance.scrapValueMultiplier = 0.4f; 23 | __instance.scrapAmountMultiplier = 1f; 24 | } 25 | 26 | [HarmonyPatch(typeof(LungProp), "Start")] 27 | [HarmonyPostfix] 28 | [HarmonyAfter(new string[] { "LethalRadiation" })] 29 | public static void ChangeLungPrice(LungProp __instance) 30 | { 31 | __instance.scrapValue = (int)(__instance.scrapValue * Game.Manager.Moons.GetScrapValueModifierOnly(global::RoundManager.Instance)); 32 | } 33 | 34 | [HarmonyPatch(typeof(LungProp), "EquipItem")] 35 | [HarmonyPrefix] 36 | [HarmonyAfter(new string[] { "me.loaforc.facilitymeltdown" })] 37 | public static void ChangeLungPrice2(LungProp __instance) 38 | { 39 | if (BepInEx.Bootstrap.Chainloader.PluginInfos.ContainsKey("me.loaforc.facilitymeltdown") && __instance.isLungDocked) 40 | __instance.scrapValue = (int)(__instance.scrapValue * Game.Manager.Moons.GetScrapValueModifierOnly(global::RoundManager.Instance)); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Patches/GrabbableObject.cs: -------------------------------------------------------------------------------- 1 | using GameNetcodeStuff; 2 | using HarmonyLib; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Reflection.Emit; 6 | using System.Reflection; 7 | using System.Text; 8 | using System.Linq; 9 | 10 | namespace AdvancedCompany.Patches 11 | { 12 | [HarmonyPatch] 13 | internal class GrabbableObject 14 | { 15 | static IEnumerable PatchUpdate(IEnumerable instructions) 16 | { 17 | Plugin.Log.LogDebug("Patching GrabbableObject->Update..."); 18 | 19 | var property = typeof(Perks).GetProperty("ExtraBatteryMultiplier", BindingFlags.Static | BindingFlags.FlattenHierarchy | BindingFlags.Public); 20 | 21 | var inst = new List(instructions); 22 | for (var i = 0; i < inst.Count; i++) 23 | { 24 | if (inst[i].opcode == OpCodes.Ldfld && inst[i].operand.ToString() == "System.Single batteryUsage") 25 | { 26 | IL.Patches.AddMultiplierInstruction("ExtraBattery", inst, i + 1); 27 | break; 28 | } 29 | } 30 | Plugin.Log.LogDebug("Patched GrabbableObject->Update..."); 31 | return inst.AsEnumerable(); 32 | } 33 | 34 | [HarmonyPatch(typeof(global::GrabbableObject), "Update")] 35 | static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator, MethodBase method) 36 | { 37 | if (method.Name == "Update") 38 | { 39 | return PatchUpdate(instructions); 40 | } 41 | return instructions; 42 | } 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Patches/TimeOfDay.cs: -------------------------------------------------------------------------------- 1 | using HarmonyLib; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | using AdvancedCompany.Network.Messages; 6 | using AdvancedCompany.Config; 7 | using System.Linq; 8 | using System.Reflection.Emit; 9 | using System.Reflection; 10 | using UnityEngine; 11 | 12 | namespace AdvancedCompany.Patches 13 | { 14 | [HarmonyPatch] 15 | internal class TimeOfDay 16 | { 17 | public static float GetMultiplier() 18 | { 19 | return 700f / Mathf.Max(1f, (float) ServerConfiguration.Instance.General.DayLength); 20 | } 21 | 22 | [HarmonyPatch(typeof(global::TimeOfDay), "MoveGlobalTime")] 23 | [HarmonyTranspiler] 24 | static IEnumerable TranspileStart(IEnumerable instructions) 25 | { 26 | Plugin.Log.LogDebug("Patching TimeOfDay->MoveGlobalTime..."); 27 | 28 | var method = typeof(TimeOfDay).GetMethod("GetMultiplier", BindingFlags.Static | BindingFlags.FlattenHierarchy | BindingFlags.Public); 29 | 30 | var inst = new List(instructions); 31 | for (var i = 0; i < inst.Count; i++) 32 | { 33 | if (inst[i].opcode == OpCodes.Ldfld && inst[i].operand.ToString().Contains("globalTimeSpeedMultiplier")) 34 | { 35 | inst.Insert(i + 2, new CodeInstruction(OpCodes.Mul)); 36 | inst.Insert(i + 2, new CodeInstruction(OpCodes.Call, method)); 37 | break; 38 | } 39 | } 40 | Plugin.Log.LogDebug("Patched TimeOfDay->MoveGlobalTime..."); 41 | return inst.AsEnumerable(); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Config/ModpackConfig.cs: -------------------------------------------------------------------------------- 1 | using BepInEx.Configuration; 2 | using HarmonyLib; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace AdvancedCompany.Config 8 | { 9 | internal class ModpackConfig 10 | { 11 | internal static ModpackConfig Instance; 12 | internal ConfigFile File; 13 | internal ConfigEntry LogoFilename; 14 | internal ConfigEntry ShowDefaultPresets; 15 | internal ConfigEntry StandardPreset; 16 | internal ConfigEntry SkipPresets; 17 | 18 | static ModpackConfig() 19 | { 20 | Instance = new ModpackConfig(); 21 | } 22 | 23 | internal ModpackConfig() 24 | { 25 | File = new ConfigFile(System.IO.Path.Combine(BepInEx.Paths.ConfigPath, "advancedcompany", "ModPack.cfg"), true); 26 | LogoFilename = File.Bind(new ConfigDefinition("Logo", "Image filename"), "Logo.png", new ConfigDescription("The image filename AC should look for when searching for a custom menu logo image.")); 27 | ShowDefaultPresets = File.Bind(new ConfigDefinition("Presets", "Show default"), true, new ConfigDescription("If the standard presets \"Default\", \"Alternative\" and \"Vanilla\" should be shown.")); 28 | StandardPreset = File.Bind(new ConfigDefinition("Presets", "Standard"), "Default", new ConfigDescription("The name of the preset which should be selected for a new save file.")); 29 | SkipPresets = File.Bind(new ConfigDefinition("Presets", "Skip presets"), false, new ConfigDescription("Automatically selects the standard preset and skips the setup screen of AC when activated.")); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/NewReplacer/ContentReplacerFromAssets.cs: -------------------------------------------------------------------------------- 1 | using AssetsTools.NET.Extra; 2 | using System.IO; 3 | 4 | namespace AssetsTools.NET 5 | { 6 | public class ContentReplacerFromAssets : IContentReplacer 7 | { 8 | public AssetsFile file; 9 | 10 | public ContentReplacerFromAssets(AssetsFile file) 11 | { 12 | this.file = file; 13 | } 14 | 15 | public ContentReplacerFromAssets(AssetsFileInstance inst) 16 | { 17 | file = inst.file; 18 | } 19 | 20 | public void Write(AssetsFileWriter writer) 21 | { 22 | // some parts of an assets file need to be aligned to a multiple of 4/8/16 bytes, 23 | // but for this to work correctly, the start of the file of course needs to be aligned too. 24 | // in a loose .assets file this is true by default, but inside a bundle file, 25 | // this might not be the case. therefore wrap the bundle output stream in a SegmentStream 26 | // which will make it look like the start of the new assets file is at position 0 27 | SegmentStream alignedStream = new SegmentStream(writer.BaseStream, writer.Position); 28 | AssetsFileWriter alignedWriter = new AssetsFileWriter(alignedStream); 29 | file.Write(alignedWriter, -1); 30 | writer.Position = writer.BaseStream.Length; 31 | } 32 | 33 | public bool HasPreview() 34 | { 35 | return false; 36 | } 37 | 38 | public Stream GetPreviewStream() 39 | { 40 | return null; 41 | } 42 | 43 | public ContentReplacerType GetReplacerType() 44 | { 45 | return ContentReplacerType.AddOrModify; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Terminal/PerkCursorElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using AdvancedCompany.Game; 5 | 6 | namespace AdvancedCompany.Terminal 7 | { 8 | internal class PerkCursorElement : CursorElement 9 | { 10 | private Perk Perk; 11 | public PerkCursorElement(Perk perk) 12 | { 13 | Perk = perk; 14 | } 15 | 16 | public override string GetText(int availableWidth) 17 | { 18 | var nameLength = 25; 19 | var expBarLength = 11; 20 | var name = Perk.Name.Length > nameLength ? Perk.Name.Substring(0, nameLength) : Perk.Name + new string(' ', nameLength - Perk.Name.Length); 21 | var level = 0; 22 | var nextLevelCost = 0; 23 | if (Perk.PerkType == Perk.Type.PLAYER) 24 | { 25 | level = Network.Manager.Lobby.Player().GetLevel(Perk); 26 | nextLevelCost = Perk.GetNextPrice(Network.Manager.Lobby.Player()); 27 | } 28 | if (Perk.PerkType == Perk.Type.SHIP) 29 | { 30 | level = Network.Manager.Lobby.CurrentShip.GetLevel(Perk); 31 | nextLevelCost = Perk.GetNextPrice(Network.Manager.Lobby.CurrentShip); 32 | } 33 | 34 | var lenEmpty = Perk.Levels - level; 35 | if (lenEmpty < 0) lenEmpty = 0; 36 | var lenSpace = expBarLength - Perk.Levels; 37 | if (lenSpace < 0) lenSpace = 0; 38 | var expBar = new string('◼', level) + new string('□', lenEmpty) + new string(' ', lenSpace); 39 | var nextLevel = ""; 40 | if (nextLevelCost > 0) 41 | nextLevel = " " + nextLevelCost + "XP"; 42 | return name + expBar + nextLevel; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/AssetsBundleFileFormat/AssetBundleFSHeader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AssetsTools.NET 6 | { 7 | public class AssetBundleFSHeader 8 | { 9 | /// 10 | /// Size of entire file. 11 | /// 12 | public long TotalFileSize { get; set; } 13 | /// 14 | /// Size of the compressed data. This is the same as DecompressedSize if not compressed. 15 | /// 16 | public uint CompressedSize { get; set; } 17 | /// 18 | /// Size of the decompressed data. 19 | /// 20 | public uint DecompressedSize { get; set; } 21 | /// 22 | /// Flags of this bundle.
23 | /// First 6 bits (0x3f mask): Compression mode. 0 for uncompressed, 1 for LZMA, 2/3 for LZ4/LZ4HC.
24 | /// 0x40: Has directory info. Should always be true for 5.2+.
25 | /// 0x80: Block and directory info is at end. The Unity editor does not usually use this. 26 | ///
27 | public AssetBundleFSHeaderFlags Flags { get; set; } // todo enum 28 | 29 | public void Read(AssetsFileReader reader) 30 | { 31 | TotalFileSize = reader.ReadInt64(); 32 | CompressedSize = reader.ReadUInt32(); 33 | DecompressedSize = reader.ReadUInt32(); 34 | Flags = (AssetBundleFSHeaderFlags)reader.ReadUInt32(); 35 | } 36 | 37 | public void Write(AssetsFileWriter writer) 38 | { 39 | writer.Write(TotalFileSize); 40 | writer.Write(CompressedSize); 41 | writer.Write(DecompressedSize); 42 | writer.Write((uint)Flags); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Extra/Net35Polyfill.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | using System.Text; 5 | 6 | namespace AssetsTools.NET.Extra 7 | { 8 | public static class Net35Polyfill 9 | { 10 | //https://stackoverflow.com/a/13022108 11 | public static void CopyToCompat(this Stream input, Stream output, long bytes = -1, int bufferSize = 80 * 1024) 12 | { 13 | byte[] buffer = new byte[bufferSize]; 14 | int read; 15 | 16 | // set to largest value so we always go over buffer (hopefully) 17 | if (bytes == -1) 18 | bytes = long.MaxValue; 19 | 20 | // bufferSize will always be an int so if bytes is larger, it's also under the size of an int 21 | while (bytes > 0 && (read = input.Read(buffer, 0, (int)Math.Min(buffer.Length, bytes))) > 0) 22 | { 23 | output.Write(buffer, 0, read); 24 | bytes -= read; 25 | } 26 | } 27 | 28 | //https://stackoverflow.com/a/4108907 29 | public static bool HasFlag(Enum variable, Enum value) 30 | { 31 | if (variable == null) 32 | return false; 33 | 34 | if (value == null) 35 | throw new ArgumentNullException("value"); 36 | 37 | if (!Enum.IsDefined(variable.GetType(), value)) 38 | { 39 | throw new ArgumentException(string.Format( 40 | "Enumeration type mismatch. The flag is of type '{0}', was expecting '{1}'.", 41 | value.GetType(), variable.GetType())); 42 | } 43 | 44 | ulong num = Convert.ToUInt64(value); 45 | return ((Convert.ToUInt64(variable) & num) == num); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Game/ItemRuntimeData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using UnityEngine; 5 | 6 | namespace AdvancedCompany.Game 7 | { 8 | internal class ItemRuntimeData 9 | { 10 | public Item Item; 11 | public TerminalNode BuyConfirmationNode; 12 | public TerminalNode BuyCompletedNode; 13 | public TerminalKeyword Keyword; 14 | public CompatibleNoun Noun; 15 | 16 | public void Apply(TerminalKeyword buyKeyword, List keywords, List buyNouns, TerminalNode cancelPurchaseNode, TerminalKeyword confirmKeyword, TerminalKeyword denyKeyword, List buyableItemsList) 17 | { 18 | var index = buyableItemsList.IndexOf(Item); 19 | if (index == -1) 20 | { 21 | index = buyableItemsList.Count; 22 | buyableItemsList.Add(Item); 23 | } 24 | 25 | var id = Item.itemName.Replace(" ", "-"); 26 | 27 | BuyCompletedNode.buyItemIndex = index; 28 | BuyConfirmationNode.buyItemIndex = index; 29 | 30 | BuyConfirmationNode.terminalOptions = new CompatibleNoun[2] 31 | { 32 | new CompatibleNoun() 33 | { 34 | noun = confirmKeyword, 35 | result = BuyCompletedNode 36 | }, 37 | new CompatibleNoun() 38 | { 39 | noun = denyKeyword, 40 | result = cancelPurchaseNode 41 | } 42 | }; 43 | Keyword.defaultVerb = buyKeyword; 44 | 45 | if (!keywords.Contains(Keyword)) 46 | keywords.Add(Keyword); 47 | if (!buyNouns.Contains(Noun)) 48 | buyNouns.Insert(0, Noun); 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /NightVision.cs: -------------------------------------------------------------------------------- 1 | /*using UnityEngine; 2 | using UnityEngine.Rendering; 3 | using UnityEngine.Rendering.HighDefinition; 4 | using System; 5 | 6 | namespace LethalCompanyPlus.PostProcessing 7 | { 8 | [Serializable, VolumeComponentMenu("Post-processing/Custom/NightVision")] 9 | public sealed class NightVision : CustomPostProcessVolumeComponent, IPostProcessComponent 10 | { 11 | [Tooltip("Controls the intensity of the effect.")] 12 | public ClampedFloatParameter intensity = new ClampedFloatParameter(1f, 0f, 1f); 13 | 14 | public static Material Material; 15 | private Material m_Material; 16 | public bool IsActive() => m_Material != null && intensity.value > 0f; 17 | 18 | // Do not forget to add this post process in the Custom Post Process Orders list (Project Settings > Graphics > HDRP Global Settings). 19 | public override CustomPostProcessInjectionPoint injectionPoint => CustomPostProcessInjectionPoint.AfterPostProcess; 20 | 21 | public static void LoadAssets(AssetBundle assets) 22 | { 23 | Material = assets.LoadAsset("Assets/Shaders/NightVision.mat"); 24 | } 25 | public override void Setup() 26 | { 27 | m_Material = new Material(Material); 28 | } 29 | 30 | public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, RTHandle destination) 31 | { 32 | if (m_Material == null) 33 | return; 34 | 35 | m_Material.SetFloat("_Intensity", intensity.value); 36 | m_Material.SetTexture("_MainTex", source); 37 | HDUtils.DrawFullScreen(cmd, m_Material, destination, shaderPassId: 0); 38 | } 39 | 40 | public override void Cleanup() 41 | { 42 | CoreUtils.Destroy(m_Material); 43 | } 44 | } 45 | }*/ -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/NewReplacer/ContentReplacerFromStream.cs: -------------------------------------------------------------------------------- 1 | using AssetsTools.NET.Extra; 2 | using System; 3 | using System.IO; 4 | 5 | namespace AssetsTools.NET 6 | { 7 | public class ContentReplacerFromStream : IContentReplacer 8 | { 9 | private readonly Stream stream; 10 | private readonly long offset; 11 | private readonly long length; 12 | private readonly bool closeOnWrite; 13 | 14 | public ContentReplacerFromStream(Stream stream, long offset = 0, int length = -1, bool closeOnWrite = false) 15 | { 16 | this.stream = stream; 17 | this.offset = offset; 18 | this.length = length; 19 | this.closeOnWrite = closeOnWrite; 20 | if (!stream.CanSeek) 21 | { 22 | throw new NotSupportedException("Stream needs to be seekable."); 23 | } 24 | } 25 | 26 | public void Write(AssetsFileWriter writer) 27 | { 28 | if (offset != -1) 29 | { 30 | stream.Position = offset; 31 | } 32 | 33 | stream.CopyToCompat(writer.BaseStream, length); 34 | 35 | if (closeOnWrite) 36 | { 37 | stream.Close(); 38 | } 39 | } 40 | 41 | public bool HasPreview() 42 | { 43 | return true; 44 | } 45 | 46 | public Stream GetPreviewStream() 47 | { 48 | if (offset == 0 && length == -1) 49 | { 50 | return stream; 51 | } 52 | 53 | // stream starts at position 0, so no need to seek 54 | return new SegmentStream(stream, offset, length); 55 | } 56 | 57 | public ContentReplacerType GetReplacerType() 58 | { 59 | return ContentReplacerType.AddOrModify; 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Terminal/BoxedScreenStore.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Terminal 6 | { 7 | public class BoxedScreenStore : IScreen 8 | { 9 | public string Title; 10 | public int TotalCost = 0; 11 | public List Content; 12 | 13 | public virtual string GetText(int availableWidth) 14 | { 15 | var credits = Game.Manager.Terminal.groupCredits; 16 | string creditsHeader = "Credits: " + credits; 17 | var text = $" ╔{new String('═', Title.Length + 2)}╗{new String(' ', availableWidth - 6 - Title.Length - creditsHeader.Length)}{creditsHeader}\n" + 18 | $"╭─╢ {Title} ╟{new String('─', availableWidth - 7 - Title.Length)}╮\n" + 19 | $"│ ╚{new String('═', Title.Length + 2)}╝{new String(' ', availableWidth - Title.Length - 7)}│\n"; 20 | foreach (var c in Content) 21 | text += Utils.WrapText(c.GetText(availableWidth - 4), availableWidth, "│ ", " │"); 22 | 23 | var rightPos = availableWidth - 11; 24 | var totalCostLength = 6; 25 | var totalCost = "$" + TotalCost; 26 | if (totalCost.Length < totalCostLength) totalCost = new string(' ', totalCostLength - totalCost.Length) + totalCost; 27 | text += $"│{new String(' ', rightPos - 3)}╔{new String('═', totalCostLength + 2)}╗{new String(' ', availableWidth - rightPos - totalCost.Length - 3)}│\n"; 28 | text += $"╰{new String('─', rightPos - 3)}╢ {(credits < TotalCost ? "" : "")}{totalCost}{(credits < TotalCost ? "" : "")} ╟{new String('─', availableWidth - rightPos - totalCost.Length - 3)}╯\n"; 29 | text += $"{new String(' ', rightPos - 2)}╚{new String('═', totalCostLength + 2)}╝\n"; 30 | return text; 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Terminal/ScrollBox.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | 6 | namespace AdvancedCompany.Terminal 7 | { 8 | public class ScrollBox : ITextElement 9 | { 10 | public IScrollable Content; 11 | public int MaxHeight = 0; 12 | public int ScrollPos = 0; 13 | 14 | public ScrollBox(int maxHeight) 15 | { 16 | MaxHeight = maxHeight; 17 | } 18 | 19 | public string GetText(int availableWidth) 20 | { 21 | var lines = Content.GetText(availableWidth); 22 | var lineCount = lines.Count(c => c.Equals('\n')) - 1; 23 | if (lineCount > MaxHeight) 24 | { 25 | lines = Content.GetText(availableWidth - 2); 26 | int scroll = Content.GetScroll(MaxHeight); 27 | var l = lines.Split('\n'); 28 | if (scroll >= l.Length - MaxHeight) 29 | scroll = l.Length - MaxHeight - 1; 30 | if (scroll < 0) 31 | scroll = 0; 32 | 33 | var text = ""; 34 | var scrollBarHeight = (int)System.Math.Floor((float)MaxHeight * ((float)MaxHeight / (float)(l.Length))); 35 | var scrollBarPosition = (int)System.Math.Round(((float)scroll / (float)(l.Length - MaxHeight)) * (float)(MaxHeight - scrollBarHeight)); 36 | for (int i = scroll; i < scroll + MaxHeight && i < l.Length; i++) 37 | { 38 | var isScroll = (i - scroll) >= scrollBarPosition && (i - scroll) <= scrollBarPosition + scrollBarHeight; 39 | var line = l[i]; 40 | text += line + " " + (isScroll ? "█" : "░") + "\n"; 41 | } 42 | return text; 43 | } 44 | else 45 | return lines; 46 | 47 | } 48 | } 49 | } -------------------------------------------------------------------------------- /Network/Messages/SpawnRocketFromClient.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network.Messages 7 | { 8 | [Message("SpawnRocketFromClient", true)] 9 | internal class SpawnRocketFromClient : INamedMessage 10 | { 11 | internal int PlayerNum; 12 | internal long TempID; 13 | internal Vector3 Position; 14 | internal Quaternion Rotation; 15 | internal float TurbulenceTime; 16 | internal float TurbulenceSpeed; 17 | internal float TurbulenceStrength; 18 | internal float FlyTime; 19 | internal Color Color; 20 | internal double Time; 21 | 22 | public void ReadData(FastBufferReader reader) 23 | { 24 | reader.ReadValueSafe(out PlayerNum); 25 | reader.ReadValueSafe(out TempID); 26 | reader.ReadValueSafe(out Position); 27 | reader.ReadValueSafe(out Rotation); 28 | reader.ReadValueSafe(out TurbulenceTime); 29 | reader.ReadValueSafe(out TurbulenceSpeed); 30 | reader.ReadValueSafe(out TurbulenceStrength); 31 | reader.ReadValueSafe(out FlyTime); 32 | reader.ReadValueSafe(out Color); 33 | reader.ReadValueSafe(out Time); 34 | } 35 | 36 | public void WriteData(FastBufferWriter writer) 37 | { 38 | writer.WriteValueSafe(PlayerNum); 39 | writer.WriteValueSafe(TempID); 40 | writer.WriteValueSafe(Position); 41 | writer.WriteValueSafe(Rotation); 42 | writer.WriteValueSafe(TurbulenceTime); 43 | writer.WriteValueSafe(TurbulenceSpeed); 44 | writer.WriteValueSafe(TurbulenceStrength); 45 | writer.WriteValueSafe(FlyTime); 46 | writer.WriteValueSafe(Color); 47 | writer.WriteValueSafe(Time); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Assets.cs: -------------------------------------------------------------------------------- 1 | using HarmonyLib; 2 | using AdvancedCompany.Boot; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Linq; 7 | using System.Reflection; 8 | using System.Text; 9 | using UnityEngine; 10 | using UnityEngine.Assertions; 11 | 12 | namespace AdvancedCompany 13 | { 14 | [Bootable] 15 | public class Assets 16 | { 17 | public static AssetBundle AssetBundle; 18 | public static void Boot() 19 | { 20 | string assetsPath = System.IO.Path.Combine(Path.GetDirectoryName(typeof(Assets).Assembly.Location), "advancedcompany/advancedcompanyassets"); 21 | if (!System.IO.File.Exists(assetsPath)) 22 | assetsPath = System.IO.Path.Combine(Path.GetDirectoryName(typeof(Assets).Assembly.Location), "advancedcompanyassets"); 23 | AssetBundle = AssetBundle.LoadFromFile(assetsPath); 24 | 25 | BootManager.AddTypeCallback((type) => 26 | { 27 | if (type.GetCustomAttribute() != null) 28 | { 29 | var method = type.GetMethod("LoadAssets", BindingFlags.Static | BindingFlags.FlattenHierarchy | BindingFlags.NonPublic | BindingFlags.Public); 30 | if (method != null) 31 | { 32 | var parameters = method.GetParameters(); 33 | if (parameters.Length == 1 && parameters[0].ParameterType == typeof(AssetBundle)) 34 | method.Invoke(null, new object[] { AssetBundle }); 35 | else 36 | Plugin.Log.LogError("Method " + method.DeclaringType.FullName + "->" + method.Name + " has wrong parameters."); 37 | } 38 | else 39 | Plugin.Log.LogError("Type " + type.FullName + " is missing static LoadAssets method."); 40 | } 41 | }); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Terminal/ItemCursorElement.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using AdvancedCompany.Game; 5 | using Steamworks.Ugc; 6 | using UnityEngine; 7 | 8 | namespace AdvancedCompany.Terminal 9 | { 10 | internal class ItemCursorElement : CursorElement 11 | { 12 | internal Item Item; 13 | internal int Amount; 14 | 15 | public ItemCursorElement(Item item) 16 | { 17 | Item = item; 18 | Amount = 0; 19 | } 20 | 21 | public override string GetText(int availableWidth) 22 | { 23 | var price = Game.Manager.Items.GetItemPrice(Item, true); 24 | var percentage = Game.Manager.Items.GetItemSalesPercentage(Item); 25 | 26 | var nameLength = 22; 27 | var priceLength = 6; 28 | 29 | var name = "" + (Item.itemName.Length > nameLength ? Item.itemName.Substring(0, nameLength) : Item.itemName + new string(' ', nameLength - Item.itemName.Length)) + ""; 30 | var priceText = "$" + price + ""; 31 | priceText = new string(' ', priceLength - priceText.Length) + priceText; 32 | 33 | var amountText = Amount + ""; 34 | if (amountText.Length == 1) amountText = " " + amountText; 35 | var text = "← " + amountText + " → " + name + " " + priceText; 36 | 37 | var percentLength = 5; 38 | var percent = ""; 39 | if (percentage < 100) 40 | percent = " -" + (100 - percentage) + "%"; 41 | else 42 | percent = " "; 43 | 44 | text += new string(' ', percentLength - percent.Length) + percent; 45 | 46 | var totalLength = 7; 47 | var total = " $" + (Amount * price); 48 | text += new string(' ', totalLength - total.Length) + total; 49 | 50 | return text; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Config/JObjectExtensions.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace AdvancedCompany.Config 7 | { 8 | static class JObjectExtensions 9 | { 10 | public static bool TryGetFloat(this JObject obj, string key, out float val) 11 | { 12 | if (obj.TryGetValue(key, out var token) && token is JValue value) 13 | { 14 | if (value.Type == JTokenType.Float) 15 | { 16 | if (value.Value is float f) 17 | { 18 | val = f; 19 | return true; 20 | } 21 | else if (value.Value is double d) 22 | { 23 | val = (float)d; 24 | return true; 25 | } 26 | } 27 | if (float.TryParse(value.ToString(System.Globalization.CultureInfo.InvariantCulture), System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out var pf)) 28 | { 29 | val = pf; 30 | return true; 31 | } 32 | } 33 | val = 0f; 34 | return false; 35 | } 36 | public static bool TryGetInt(this JObject obj, string key, out int val) 37 | { 38 | if (obj.TryGetValue(key, out var token) && token is JValue value) 39 | { 40 | if (value.Type == JTokenType.Integer && value.Value is int f) 41 | { 42 | val = f; 43 | return true; 44 | } 45 | else if (int.TryParse(value.ToString(), out int n)) 46 | { 47 | val = n; 48 | return true; 49 | } 50 | } 51 | val = 0; 52 | return false; 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /Network/Messages/SpawnRocket.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using UnityEngine; 4 | using Unity.Netcode; 5 | 6 | namespace AdvancedCompany.Network.Messages 7 | { 8 | [Message("SpawnRocket", false, true)] 9 | internal class SpawnRocket : INamedMessage 10 | { 11 | internal int PlayerNum; 12 | internal long TempID; 13 | internal long ID; 14 | internal Vector3 Position; 15 | internal Quaternion Rotation; 16 | internal float TurbulenceTime; 17 | internal float TurbulenceSpeed; 18 | internal float TurbulenceStrength; 19 | internal float FlyTime; 20 | internal Color Color; 21 | internal double Time; 22 | 23 | public void ReadData(FastBufferReader reader) 24 | { 25 | reader.ReadValueSafe(out PlayerNum); 26 | reader.ReadValueSafe(out TempID); 27 | reader.ReadValueSafe(out ID); 28 | reader.ReadValueSafe(out Position); 29 | reader.ReadValueSafe(out Rotation); 30 | reader.ReadValueSafe(out TurbulenceTime); 31 | reader.ReadValueSafe(out TurbulenceSpeed); 32 | reader.ReadValueSafe(out TurbulenceStrength); 33 | reader.ReadValueSafe(out FlyTime); 34 | reader.ReadValueSafe(out Color); 35 | reader.ReadValueSafe(out Time); 36 | } 37 | 38 | public void WriteData(FastBufferWriter writer) 39 | { 40 | writer.WriteValueSafe(PlayerNum); 41 | writer.WriteValueSafe(TempID); 42 | writer.WriteValueSafe(ID); 43 | writer.WriteValueSafe(Position); 44 | writer.WriteValueSafe(Rotation); 45 | writer.WriteValueSafe(TurbulenceTime); 46 | writer.WriteValueSafe(TurbulenceSpeed); 47 | writer.WriteValueSafe(TurbulenceStrength); 48 | writer.WriteValueSafe(FlyTime); 49 | writer.WriteValueSafe(Color); 50 | writer.WriteValueSafe(Time); 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Terminal/Applications/XPApplication.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Config; 2 | using AdvancedCompany.Game; 3 | using AdvancedCompany.Network.Messages; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | using Unity.Netcode; 8 | 9 | namespace AdvancedCompany.Terminal.Applications 10 | { 11 | [Boot.Bootable] 12 | internal class XPApplication : IApplication 13 | { 14 | public static void Boot() 15 | { 16 | MobileTerminal.RegisterApplication("xp", new XPApplication()); 17 | } 18 | 19 | public void Exit() 20 | { 21 | 22 | } 23 | 24 | public void Main(MobileTerminal terminal, string[] args) 25 | { 26 | if (!NetworkManager.Singleton.IsServer) 27 | terminal.WriteLine("Only host is allowed to run this command!"); 28 | else if (args.Length > 1 && int.TryParse(args[1], out var xp)) 29 | { 30 | Game.Player player = null; 31 | player = Network.Manager.Lobby.Player(args[0]); 32 | if (player == null && int.TryParse(args[0], out var playerNum)) 33 | player = Network.Manager.Lobby.Player(playerNum); 34 | if (player == null) 35 | { 36 | terminal.WriteLine($"Player {args[0]} couldn't be found!"); 37 | } 38 | else 39 | { 40 | Network.Manager.Send(new GrantPlayerXP() { All = false, PlayerNum = player.PlayerNum, XP = xp }); 41 | terminal.WriteLine($"Granted {xp} XP to {player.Controller.playerUsername}."); 42 | } 43 | } 44 | else 45 | { 46 | terminal.WriteLine("Usage: xp [playerNum|playerName] [amount]"); 47 | } 48 | terminal.Exit(); 49 | } 50 | 51 | public void Submit(string text) 52 | { 53 | } 54 | 55 | public void Update() 56 | { 57 | 58 | } 59 | } 60 | } -------------------------------------------------------------------------------- /Lib/Mod.cs: -------------------------------------------------------------------------------- 1 | using BepInEx; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Linq; 5 | using System.Reflection; 6 | using System.Security.Cryptography; 7 | using System.Text; 8 | 9 | namespace AdvancedCompany.Lib 10 | { 11 | public static class Mod 12 | { 13 | internal static string Hash; 14 | internal static Dictionary RequiredMods = new Dictionary(); 15 | 16 | public static void RegisterRequiredMod(string modName, string modVersion) 17 | { 18 | Hash = null; 19 | RequiredMods[modName] = modVersion; 20 | } 21 | 22 | public static void RegisterRequiredMod(BaseUnityPlugin plugin) 23 | { 24 | if (plugin != null) 25 | { 26 | Hash = null; 27 | var pluginInfo = plugin.GetType().GetCustomAttribute(); 28 | if (pluginInfo != null) 29 | RequiredMods.Add(pluginInfo.GUID, pluginInfo.Version.ToString()); 30 | } 31 | } 32 | 33 | public static string GetHash() 34 | { 35 | if (Hash == null) 36 | { 37 | var mods = RequiredMods.Keys.ToList(); 38 | mods.Sort(); 39 | var modString = ""; 40 | for (var i = 0; i < mods.Count; i++) 41 | { 42 | modString += mods[i] + RequiredMods[mods[i]]; 43 | } 44 | using (var md5 = MD5.Create()) 45 | { 46 | var bytes = md5.ComputeHash(System.Text.Encoding.UTF8.GetBytes(modString)); 47 | StringBuilder sb = new System.Text.StringBuilder(); 48 | for (int i = 0; i < bytes.Length; i++) 49 | { 50 | sb.Append(bytes[i].ToString("X2")); 51 | } 52 | Hash = sb.ToString().ToLowerInvariant(); 53 | } 54 | } 55 | return Hash; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Unity/ConfigNumericInput.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Config; 2 | using TMPro; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | 6 | namespace AdvancedCompany 7 | { 8 | public class ConfigNumericInput : MonoBehaviour 9 | { 10 | public TextMeshProUGUI Label; 11 | public TextMeshProUGUI Unit; 12 | public TMPro.TMP_InputField Input; 13 | public LayoutElement InputLayout; 14 | public Button ResetButton; 15 | private Configuration.ConfigField Field; 16 | 17 | void Start() 18 | { 19 | Input.onValueChanged.AddListener(new UnityEngine.Events.UnityAction((val) => 20 | { 21 | if (int.TryParse(val, out int @int)) 22 | Field.Value = @int; 23 | })); 24 | 25 | ResetButton.onClick.AddListener(new UnityEngine.Events.UnityAction(() => { 26 | Field.Reset(); 27 | int val = 0; 28 | if (Field.Value is int i) 29 | val = i; 30 | else if (Field.Value is float f) 31 | val = Mathf.RoundToInt(f); 32 | Input.SetTextWithoutNotify(val.ToString()); 33 | })); 34 | } 35 | 36 | public void UpdateValue() 37 | { 38 | int val = 0; 39 | if (Field.Value is int i) 40 | val = i; 41 | else if (Field.Value is float f) 42 | val = Mathf.RoundToInt(f); 43 | Input.SetTextWithoutNotify(val.ToString()); 44 | } 45 | 46 | public void SetValue(Configuration.ConfigField field) 47 | { 48 | Field = field; 49 | UpdateValue(); 50 | } 51 | 52 | public void Initialize(string label, string unit, float inputWidth, bool showReset) 53 | { 54 | Label.text = label + (label.EndsWith(":") ? "" : ":"); 55 | Unit.text = unit; 56 | InputLayout.preferredWidth = inputWidth; 57 | ResetButton.gameObject.SetActive(showReset); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /Hooks/PlayerControllerB/KillPlayer.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Objects; 2 | using AdvancedCompany.PostProcessing; 3 | using HarmonyLib; 4 | using System; 5 | using System.Collections.Generic; 6 | using System.Text; 7 | using UnityEngine; 8 | 9 | namespace AdvancedCompany.Hooks.PlayerControllerB 10 | { 11 | internal class KillPlayer 12 | { 13 | [HarmonyPatch(typeof(GameNetcodeStuff.PlayerControllerB), "KillPlayer")] 14 | [HarmonyPrefix] 15 | public static bool PrePatch(global::GameNetcodeStuff.PlayerControllerB __instance, Vector3 bodyVelocity, bool spawnBody, CauseOfDeath causeOfDeath, int deathAnimation) 16 | { 17 | var isLocal = __instance == global::StartOfRound.Instance.localPlayerController; 18 | if (__instance.currentlyHeldObjectServer is PietSmietController controller && !controller.CurseLifted) 19 | { 20 | if (isLocal) 21 | { 22 | if (causeOfDeath == CauseOfDeath.Suffocation || causeOfDeath == CauseOfDeath.Gravity) 23 | return true; 24 | else 25 | { 26 | controller.Damage(10); 27 | if (controller.Health <= 0) 28 | { 29 | controller.StopDoom(); 30 | return true; 31 | } 32 | return false; 33 | } 34 | } 35 | } 36 | 37 | if (__instance.IsOwner && !__instance.isPlayerDead && __instance.AllowPlayerDeath()) 38 | { 39 | var gamePlayer = Game.Player.GetPlayer(__instance); 40 | gamePlayer.UnequipAll(); 41 | } 42 | 43 | if (isLocal) 44 | Volumes.ChangeEnvironment(global::RoundManager.Instance.currentLevel.PlanetName, true, GameNetworkManager.Instance.localPlayerController.isInsideFactory, false, GameNetworkManager.Instance.localPlayerController.isPlayerDead); 45 | 46 | return true; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /PostProcessing/DoomEffect.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Rendering; 3 | using UnityEngine.Rendering.HighDefinition; 4 | using System; 5 | using HarmonyLib; 6 | 7 | namespace AdvancedCompany.PostProcessing 8 | { 9 | [LoadAssets] 10 | [Serializable, VolumeComponentMenu("Post-processing/Custom/Doom")] 11 | public sealed class DoomEffect : CustomPostProcessVolumeComponent, IPostProcessComponent 12 | { 13 | 14 | [Tooltip("Controls the intensity of the effect.")] 15 | public ClampedFloatParameter intensity = new ClampedFloatParameter(0f, 0f, 1f); 16 | 17 | static Material Material; 18 | private Material m_Material; 19 | public bool IsActive() => m_Material != null && intensity.value > 0f; 20 | 21 | // Do not forget to add this post process in the Custom Post Process Orders list (Project Settings > Graphics > HDRP Global Settings). 22 | public override CustomPostProcessInjectionPoint injectionPoint => CustomPostProcessInjectionPoint.AfterPostProcess; 23 | 24 | public static void LoadAssets(AssetBundle assets) 25 | { 26 | Material = assets.LoadAsset("Assets/Shaders/Doom.mat"); 27 | } 28 | 29 | public override void Setup() 30 | { 31 | m_Material = new Material(Material); 32 | } 33 | 34 | public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, RTHandle destination) 35 | { 36 | if (m_Material == null) 37 | return; 38 | 39 | m_Material.SetFloat("_Intensity", intensity.value); 40 | if (intensity.value <= 0f) 41 | return; 42 | float pixelWidth = 640f; 43 | m_Material.SetFloat("_ScreenWidth", pixelWidth); 44 | m_Material.SetFloat("_ScreenHeight", pixelWidth * 3f / 4f); 45 | cmd.Blit(source, destination, m_Material, 0); 46 | //HDUtils.DrawFullScreen(cmd, m_Material, destination, shaderPassId: 0); 47 | } 48 | 49 | public override void Cleanup() 50 | { 51 | CoreUtils.Destroy(m_Material); 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/ClassDatabaseFile/ClassPackageTypeNode.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AssetsTools.NET 6 | { 7 | public class ClassPackageTypeNode 8 | { 9 | public ushort TypeName { get; set; } 10 | public ushort FieldName { get; set; } 11 | public int ByteSize { get; set; } 12 | public ushort Version { get; set; } 13 | public byte TypeFlags { get; set; } 14 | public uint MetaFlag { get; set; } 15 | public ushort[] SubNodes { get; set; } 16 | 17 | /// 18 | /// Read the with the provided reader. 19 | /// 20 | /// The reader to use. 21 | public void Read(AssetsFileReader reader) 22 | { 23 | TypeName = reader.ReadUInt16(); 24 | FieldName = reader.ReadUInt16(); 25 | ByteSize = reader.ReadInt32(); 26 | Version = reader.ReadUInt16(); 27 | TypeFlags = reader.ReadByte(); 28 | MetaFlag = reader.ReadUInt32(); 29 | 30 | ushort subNodeCount = reader.ReadUInt16(); 31 | SubNodes = new ushort[subNodeCount]; 32 | for (int i = 0; i < subNodeCount; i++) 33 | { 34 | SubNodes[i] = reader.ReadUInt16(); 35 | } 36 | } 37 | 38 | /// 39 | /// Write the with the provided writer. 40 | /// 41 | /// The writer to use. 42 | public void Write(AssetsFileWriter writer) 43 | { 44 | writer.Write(TypeName); 45 | writer.Write(FieldName); 46 | writer.Write(ByteSize); 47 | writer.Write(Version); 48 | writer.Write(TypeFlags); 49 | writer.Write(MetaFlag); 50 | 51 | writer.Write(SubNodes.Length); 52 | for (int i = 0; i < SubNodes.Length; i++) 53 | { 54 | writer.Write(SubNodes[i]); 55 | } 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /Unity/PlayerConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Linq; 3 | 4 | namespace AdvancedCompany.Config 5 | { 6 | public class PlayerConfiguration : Configuration 7 | { 8 | public class GraphicsConfig : Configuration 9 | { 10 | public bool ShowOriginalLogo = false; 11 | public bool HideCopyright = false; 12 | 13 | [Slider(0f, 1f, Conversion = 100f, ShowValue = true)] 14 | public float VisionEnhancerBrightness = 0.7f; 15 | [Slider(0f, 1f, Conversion = 100f, ShowValue = true)] 16 | public float MusicVolume = 1f; 17 | } 18 | 19 | public class FileConfig : Configuration 20 | { 21 | public bool SaveInProfile = false; 22 | } 23 | 24 | public class CompabilityConfig : Configuration 25 | { 26 | public bool DisableMusic; 27 | public bool HideEquipment; 28 | public bool HideCosmetics; 29 | public bool AnimationsCompability; 30 | } 31 | 32 | public class HotbarConfig : Configuration 33 | { 34 | [Slider(0.1f,2f, Conversion = 100f, ShowValue = true)] 35 | public float HotbarScale = 1f; 36 | [Slider(0f, 1f, Conversion = 100f, ShowValue = true)] 37 | public float HotbarAlpha = 0.13f; 38 | [Slider(5f, 20f, Conversion = 1f, ShowValue = false)] 39 | public float HotbarSpacing = 10f; 40 | [Slider(10f, 50f, Conversion = 1f, ShowValue = false)] 41 | public float HotbarBorderWidth = 4f; 42 | [Slider(0f, 100f, Conversion = 1f, ShowValue = false)] 43 | public float HotbarY = 50f; 44 | public bool InvertScroll = true; 45 | } 46 | 47 | public class CosmeticsConfig : Configuration 48 | { 49 | public List ActivatedCosmetics = new(); 50 | } 51 | 52 | public FileConfig File = new(); 53 | public HotbarConfig Hotbar = new(); 54 | public CosmeticsConfig Cosmetics = new(); 55 | public CompabilityConfig Compability = new(); 56 | public GraphicsConfig Graphics = new(); 57 | } 58 | } -------------------------------------------------------------------------------- /Terminal/HalfBoxedScreen.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AdvancedCompany.Terminal 6 | { 7 | public class HalfBoxedScreen : IScreen 8 | { 9 | public string Title; 10 | public int LeftWidth = 20; 11 | public int Height = 20; 12 | public List RightContent; 13 | public List LeftContent; 14 | public virtual string GetText(int availableWidth) 15 | { 16 | var text = $" ╔{new String('═', Title.Length + 2)}╗\n" + 17 | $"╭─╢ {Title} ╟{new String('─', availableWidth - 7 - Title.Length)}╮\n" + 18 | $"│ ╚{new String('═', Title.Length + 2)}╝{new String(' ', availableWidth - Title.Length - 7)}│\n" + 19 | $"├{new String('─', LeftWidth)}┬{new String('─', availableWidth - LeftWidth - 3)}┤\n"; 20 | var leftText = ""; 21 | foreach (var c in LeftContent) 22 | leftText += c.GetText(LeftWidth); 23 | var rightText = ""; 24 | var rightWidth = availableWidth - LeftWidth - 5; 25 | foreach (var c in RightContent) 26 | rightText += c.GetText(rightWidth); 27 | var leftLines = Utils.WrapText(leftText, LeftWidth).Split(new char[] {'\n' }, StringSplitOptions.None); 28 | var rightLines = Utils.WrapText(rightText, rightWidth).Split(new char[] { '\n' }, StringSplitOptions.None); 29 | 30 | for (var i = 0; i < Height - 5; i++) 31 | { 32 | var left = leftLines.Length > i ? leftLines[i] : ""; 33 | if (left.Length < LeftWidth) 34 | left += new string(' ', LeftWidth - left.Length); 35 | var right = rightLines.Length > i ? rightLines[i] : ""; 36 | right = right.TrimEnd(); 37 | if (right.Length < rightWidth) 38 | right += new string(' ', rightWidth - right.Length); 39 | text += $"│{left}│ {right} │\n"; 40 | } 41 | text += $"╰{new String('─', availableWidth - 2)}╯\n"; 42 | return text; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /PostProcessing/VisionEnhancer.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | using UnityEngine.Rendering; 3 | using UnityEngine.Rendering.HighDefinition; 4 | using System; 5 | using HarmonyLib; 6 | 7 | namespace AdvancedCompany.PostProcessing 8 | { 9 | [LoadAssets] 10 | [Serializable, VolumeComponentMenu("Post-processing/Custom/VisionEnhancer")] 11 | public sealed class VisionEnhancer : CustomPostProcessVolumeComponent, IPostProcessComponent 12 | { 13 | 14 | [Tooltip("Controls the intensity of the effect.")] 15 | public ClampedFloatParameter intensity = new ClampedFloatParameter(0f, 0f, 1f); 16 | [Tooltip("Controls the intensity of the effect.")] 17 | public ClampedFloatParameter brightness = new ClampedFloatParameter(0f, 0f, 1f); 18 | 19 | static Material Material; 20 | private Material m_Material; 21 | public bool IsActive() => m_Material != null && intensity.value > 0f; 22 | 23 | // Do not forget to add this post process in the Custom Post Process Orders list (Project Settings > Graphics > HDRP Global Settings). 24 | public override CustomPostProcessInjectionPoint injectionPoint => CustomPostProcessInjectionPoint.AfterPostProcess; 25 | 26 | public static void LoadAssets(AssetBundle assets) 27 | { 28 | Material = assets.LoadAsset("Assets/Shaders/VisionEnhancer.mat"); 29 | } 30 | 31 | public override void Setup() 32 | { 33 | m_Material = new Material(Material); 34 | } 35 | 36 | public override void Render(CommandBuffer cmd, HDCamera camera, RTHandle source, RTHandle destination) 37 | { 38 | if (m_Material == null) 39 | return; 40 | 41 | m_Material.SetFloat("_Intensity", intensity.value); 42 | m_Material.SetFloat("_Brightness", brightness.value); 43 | m_Material.SetTexture("_MainTex", source); 44 | 45 | cmd.Blit(source, destination, m_Material, 0); 46 | //HDUtils.DrawFullScreen(cmd, m_Material, destination, shaderPassId: 0); 47 | } 48 | 49 | public override void Cleanup() 50 | { 51 | CoreUtils.Destroy(m_Material); 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /Config/JSONSerializer.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json.Linq; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Reflection; 5 | using System.Text; 6 | 7 | namespace AdvancedCompany.Config 8 | { 9 | internal class JSONSerializer 10 | { 11 | /* 12 | public class CachedType 13 | { 14 | internal Type Type; 15 | public List Fields = new List(); 16 | 17 | public CachedType(Type t) 18 | { 19 | Type = t; 20 | 21 | } 22 | 23 | public JObject Serialize(object obj) 24 | { 25 | if (obj.GetType() != Type) 26 | throw new ArgumentException(); 27 | JObject jObj = new JObject(); 28 | foreach (var f in Fields) 29 | { 30 | jObj[f.JSONName] = f.Serialize(jObj); 31 | } 32 | return jObj; 33 | } 34 | } 35 | 36 | public class CachedField 37 | { 38 | internal FieldInfo Field; 39 | public string JSONName; 40 | 41 | public CachedField(FieldInfo field) 42 | { 43 | Field = field; 44 | 45 | var name = field.Name; 46 | var jsonName = ""; 47 | for (var i = 0; i < name.Length; i++) 48 | { 49 | if ((name[i] + "") == (name[i] + "").ToUpperInvariant()) 50 | jsonName += ("_" + name[i]).ToLowerInvariant(); 51 | else 52 | jsonName += name[i]; 53 | } 54 | JSONName = jsonName; 55 | } 56 | 57 | public JValue Serialize(object obj) 58 | { 59 | Field.FieldType 60 | } 61 | 62 | } 63 | private static Dictionary Types = new Dictionary(); 64 | public static JObject Serialize(object obj) 65 | { 66 | var type = obj.GetType(); 67 | if (!Types.ContainsKey(type)) 68 | Types.Add(type, new CachedType(type)); 69 | }*/ 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/ClassDatabaseFile/ClassDatabaseTypeField.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace AssetsTools.NET 4 | { 5 | public class ClassDatabaseTypeNode 6 | { 7 | public ushort TypeName { get; set; } 8 | public ushort FieldName { get; set; } 9 | public int ByteSize { get; set; } 10 | public ushort Version { get; set; } 11 | public byte TypeFlags { get; set; } 12 | public uint MetaFlag { get; set; } 13 | public List Children { get; set; } 14 | 15 | /// 16 | /// Read the with the provided reader. 17 | /// 18 | /// The reader to use. 19 | public void Read(AssetsFileReader reader) 20 | { 21 | TypeName = reader.ReadUInt16(); 22 | FieldName = reader.ReadUInt16(); 23 | ByteSize = reader.ReadInt32(); 24 | Version = reader.ReadUInt16(); 25 | TypeFlags = reader.ReadByte(); 26 | MetaFlag = reader.ReadUInt32(); 27 | 28 | int childrenCount = reader.ReadUInt16(); 29 | Children = new List(childrenCount); 30 | for (int i = 0; i < childrenCount; i++) 31 | { 32 | ClassDatabaseTypeNode child = new ClassDatabaseTypeNode(); 33 | child.Read(reader); 34 | Children.Add(child); 35 | } 36 | } 37 | 38 | /// 39 | /// Write the with the provided writer. 40 | /// 41 | /// The writer to use. 42 | public void Write(AssetsFileWriter writer) 43 | { 44 | writer.Write(TypeName); 45 | writer.Write(FieldName); 46 | writer.Write(ByteSize); 47 | writer.Write(TypeFlags); 48 | writer.Write(MetaFlag); 49 | 50 | writer.Write((ushort)Children.Count); 51 | for (int i = 0; i < Children.Count; i++) 52 | { 53 | Children[i].Write(writer); 54 | } 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Extensions/GameObject.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using UnityEngine; 5 | 6 | namespace AdvancedCompany 7 | { 8 | internal static partial class Extensions 9 | { 10 | public static void HideRenderers(this GameObject[] gameObjects, bool includeSkinned = true) 11 | { 12 | for (var i = 0; i < gameObjects.Length; i++) 13 | gameObjects[i].HideRenderers(includeSkinned); 14 | } 15 | 16 | public static void HideRenderers(this GameObject gameObject, bool includeSkinned = true) 17 | { 18 | gameObject.GetComponentsInChildren().Hide(); 19 | if (includeSkinned) 20 | gameObject.GetComponentsInChildren().Hide(); 21 | } 22 | 23 | public static void ShowRenderers(this GameObject[] gameObjects, bool includeSkinned = true) 24 | { 25 | for (var i = 0; i < gameObjects.Length; i++) 26 | gameObjects[i].ShowRenderers(includeSkinned); 27 | } 28 | 29 | public static void ShowRenderers(this GameObject gameObject, bool includeSkinned = true) 30 | { 31 | gameObject.GetComponentsInChildren().Show(); 32 | if (includeSkinned) 33 | gameObject.GetComponentsInChildren().Show(); 34 | } 35 | 36 | public static void Hide(this MeshRenderer[] renderers) 37 | { 38 | for (var i = 0; i < renderers.Length; i++) 39 | renderers[i].enabled = false; 40 | } 41 | public static void Show(this MeshRenderer[] renderers) 42 | { 43 | for (var i = 0; i < renderers.Length; i++) 44 | renderers[i].enabled = true; 45 | } 46 | public static void Hide(this SkinnedMeshRenderer[] renderers) 47 | { 48 | for (var i = 0; i < renderers.Length; i++) 49 | renderers[i].enabled = false; 50 | } 51 | public static void Show(this SkinnedMeshRenderer[] renderers) 52 | { 53 | for (var i = 0; i < renderers.Length; i++) 54 | renderers[i].enabled = true; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/ClassDatabaseFile/ClassPackageType.cs: -------------------------------------------------------------------------------- 1 | using AssetsTools.NET.Extra; 2 | using System; 3 | using System.Collections.Generic; 4 | using System.Text; 5 | 6 | namespace AssetsTools.NET 7 | { 8 | public class ClassPackageType 9 | { 10 | public int ClassId { get; set; } 11 | public ushort Name { get; set; } 12 | public ushort BaseName { get; set; } 13 | public ClassFileTypeFlags Flags { get; set; } 14 | public ushort EditorRootNode { get; set; } 15 | public ushort ReleaseRootNode { get; set; } 16 | 17 | /// 18 | /// Read the with the provided reader and class ID. 19 | /// 20 | /// The reader to use. 21 | /// The class ID to assign. 22 | public void Read(AssetsFileReader reader, int classId) 23 | { 24 | ClassId = classId; 25 | 26 | Name = reader.ReadUInt16(); 27 | BaseName = reader.ReadUInt16(); 28 | 29 | Flags = (ClassFileTypeFlags)reader.ReadByte(); 30 | 31 | EditorRootNode = ushort.MaxValue; 32 | if (Net35Polyfill.HasFlag(Flags, ClassFileTypeFlags.HasEditorRootNode)) 33 | EditorRootNode = reader.ReadUInt16(); 34 | 35 | ReleaseRootNode = ushort.MaxValue; 36 | if (Net35Polyfill.HasFlag(Flags, ClassFileTypeFlags.HasReleaseRootNode)) 37 | ReleaseRootNode = reader.ReadUInt16(); 38 | } 39 | 40 | /// 41 | /// Write the with the provided writer. 42 | /// 43 | /// The writer to use. 44 | public void Write(AssetsFileWriter writer) 45 | { 46 | writer.Write(Name); 47 | writer.Write(BaseName); 48 | writer.Write((byte)Flags); 49 | 50 | if (Net35Polyfill.HasFlag(Flags, ClassFileTypeFlags.HasEditorRootNode)) 51 | writer.Write(EditorRootNode); 52 | 53 | if (Net35Polyfill.HasFlag(Flags, ClassFileTypeFlags.HasReleaseRootNode)) 54 | writer.Write(ReleaseRootNode); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Extra/AssetsManager/AssetsManager.Resolving.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AssetsTools.NET.Extra 6 | { 7 | public partial class AssetsManager 8 | { 9 | public AssetExternal GetExtAsset(AssetsFileInstance relativeTo, int fileId, long pathId, bool onlyGetInfo = false, AssetReadFlags readFlags = AssetReadFlags.None) 10 | { 11 | AssetExternal ext = new AssetExternal 12 | { 13 | info = null, 14 | baseField = null, 15 | file = null 16 | }; 17 | 18 | if (fileId == 0 && pathId == 0) 19 | { 20 | return ext; 21 | } 22 | else if (fileId != 0) 23 | { 24 | AssetsFileInstance dep = relativeTo.GetDependency(this, fileId - 1); 25 | 26 | if (dep == null) 27 | return ext; 28 | 29 | ext.file = dep; 30 | ext.info = dep.file.GetAssetInfo(pathId); 31 | 32 | if (ext.info == null) 33 | return ext; 34 | 35 | if (!onlyGetInfo) 36 | ext.baseField = GetBaseField(dep, ext.info, readFlags); 37 | else 38 | ext.baseField = null; 39 | 40 | return ext; 41 | } 42 | else 43 | { 44 | ext.file = relativeTo; 45 | ext.info = relativeTo.file.GetAssetInfo(pathId); 46 | 47 | if (ext.info == null) 48 | return ext; 49 | 50 | if (!onlyGetInfo) 51 | ext.baseField = GetBaseField(relativeTo, ext.info, readFlags); 52 | else 53 | ext.baseField = null; 54 | 55 | return ext; 56 | } 57 | } 58 | 59 | public AssetExternal GetExtAsset(AssetsFileInstance relativeTo, AssetTypeValueField pptrField, bool onlyGetInfo = false, AssetReadFlags readFlags = AssetReadFlags.None) 60 | { 61 | int fileId = pptrField["m_FileID"].AsInt; 62 | long pathId = pptrField["m_PathID"].AsLong; 63 | return GetExtAsset(relativeTo, fileId, pathId, onlyGetInfo, readFlags); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Unity/UI/DoomDigits.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using UnityEngine; 5 | using UnityEngine.UI; 6 | 7 | namespace AdvancedCompany.Unity.UI 8 | { 9 | [ExecuteInEditMode] 10 | public class DoomDigits : MonoBehaviour 11 | { 12 | public RectTransform LayoutGroup; 13 | private int LastNumber = -1; 14 | public int Number = 0; 15 | public bool AddPercentage = false; 16 | public bool Reverse = false; 17 | public Color Color; 18 | 19 | public Image[] Images; 20 | [Header("0-9%")] 21 | public Sprite[] Sprites; 22 | 23 | void Update() 24 | { 25 | if (Number == LastNumber) 26 | return; 27 | if (Sprites.Length < 11) 28 | return; 29 | var tex = Number.ToString(); 30 | if (AddPercentage) tex += "%"; 31 | for (var i = 0; i < Images.Length; i++) 32 | { 33 | if (tex.Length > i) 34 | { 35 | var c = tex[Reverse ? tex.Length - 1 - i : i]; 36 | Images[i].enabled = true; 37 | Images[i].color = Color; 38 | if (c == '0') Images[i].sprite = Sprites[0]; 39 | else if (c == '1') Images[i].sprite = Sprites[1]; 40 | else if (c == '2') Images[i].sprite = Sprites[2]; 41 | else if (c == '3') Images[i].sprite = Sprites[3]; 42 | else if (c == '4') Images[i].sprite = Sprites[4]; 43 | else if (c == '5') Images[i].sprite = Sprites[5]; 44 | else if (c == '6') Images[i].sprite = Sprites[6]; 45 | else if (c == '7') Images[i].sprite = Sprites[7]; 46 | else if (c == '8') Images[i].sprite = Sprites[8]; 47 | else if (c == '9') Images[i].sprite = Sprites[9]; 48 | else if (c == '%') Images[i].sprite = Sprites[10]; 49 | Images[i].rectTransform.sizeDelta = new Vector2((Images[i].sprite.rect.width / Images[i].sprite.rect.height) * LayoutGroup.rect.height, LayoutGroup.rect.height); 50 | } 51 | else 52 | Images[i].enabled = false; 53 | } 54 | LastNumber = Number; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/ClassDatabaseFile/ClassDatabaseFileHeader.cs: -------------------------------------------------------------------------------- 1 | using AssetsTools.NET.Extra; 2 | using System; 3 | using System.Text; 4 | 5 | namespace AssetsTools.NET 6 | { 7 | public class ClassDatabaseFileHeader 8 | { 9 | public string Magic { get; set; } 10 | public byte FileVersion { get; set; } 11 | public UnityVersion Version { get; set; } 12 | public ClassFileCompressionType CompressionType { get; set; } 13 | public int CompressedSize { get; set; } 14 | public int DecompressedSize { get; set; } 15 | 16 | /// 17 | /// Read the with the provided reader. 18 | /// Note only new CLDB files are supported. Original UABE cldb files are no longer supported. 19 | /// 20 | /// The reader to use. 21 | public void Read(AssetsFileReader reader) 22 | { 23 | Magic = reader.ReadStringLength(4); 24 | 25 | if (Magic != "CLDB") 26 | { 27 | if (Magic == "cldb") 28 | throw new NotSupportedException("Old cldb style class databases are no longer supported."); 29 | else 30 | throw new NotSupportedException("CLDB magic not found. Is this really a class database file?"); 31 | } 32 | 33 | FileVersion = reader.ReadByte(); 34 | if (FileVersion > 1) 35 | throw new Exception($"Unsupported or invalid file version {FileVersion}."); 36 | 37 | Version = UnityVersion.FromUInt64(reader.ReadUInt64()); 38 | 39 | CompressionType = (ClassFileCompressionType)reader.ReadByte(); 40 | CompressedSize = reader.ReadInt32(); 41 | DecompressedSize = reader.ReadInt32(); 42 | } 43 | 44 | /// 45 | /// Write the with the provided writer. 46 | /// 47 | /// The writer to use. 48 | public void Write(AssetsFileWriter writer) 49 | { 50 | writer.Write(Encoding.ASCII.GetBytes(Magic)); 51 | writer.Write(FileVersion); 52 | writer.Write(Version.ToUInt64()); 53 | writer.Write((byte)CompressionType); 54 | writer.Write(CompressedSize); 55 | writer.Write(DecompressedSize); 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /PlayerRocketBoots.cs: -------------------------------------------------------------------------------- 1 | using UnityEngine; 2 | 3 | namespace AdvancedCompany 4 | { 5 | [LoadAssets] 6 | public class PlayerRocketBoots : MonoBehaviour 7 | { 8 | public GameObject LeftRocket; 9 | public GameObject RightRocket; 10 | private ParticleSystem LeftParticles; 11 | private ParticleSystem RightParticles; 12 | private bool Initialized = false; 13 | private static GameObject LeftRocketBootPrefab; 14 | private static GameObject RightRocketBootPrefab; 15 | 16 | public static void LoadAssets(AssetBundle assets) 17 | { 18 | LeftRocketBootPrefab = assets.LoadAsset("Assets/Prefabs/Objects/RocketBootsLeft.prefab"); 19 | RightRocketBootPrefab = assets.LoadAsset("Assets/Prefabs/Objects/RocketBootsRight.prefab"); 20 | } 21 | 22 | public void Awake() 23 | { 24 | var spine = transform.Find("ScavengerModel").Find("metarig").Find("spine"); 25 | var leftHeel = spine.Find("thigh.L").Find("shin.L").Find("foot.L"); 26 | var rightHeel = spine.Find("thigh.R").Find("shin.R").Find("foot.R"); 27 | 28 | if (LeftRocket == null) 29 | { 30 | LeftRocket = GameObject.Instantiate(LeftRocketBootPrefab, leftHeel); 31 | LeftRocket.transform.localPosition = new Vector3(-0.0786f, -0.0302f, 0.0056f); 32 | LeftRocket.transform.localEulerAngles = new Vector3(-54.256f, -170.885f, 169.978f); 33 | LeftRocket.transform.localScale = new Vector3(0.5319018f, 0.5319018f, 0.5319018f); 34 | LeftParticles = LeftRocket.transform.Find("Particles").GetComponent(); 35 | } 36 | if (RightRocket == null) 37 | { 38 | RightRocket = GameObject.Instantiate(RightRocketBootPrefab, rightHeel); 39 | RightRocket.transform.localPosition = new Vector3(0.0833f, -0.0401f, 0.0086f); 40 | RightRocket.transform.localEulerAngles = new Vector3(-124.165f, 0.07899f, -0.55297f); 41 | RightRocket.transform.localScale = new Vector3(0.5319018f, 0.5319018f, 0.5319018f); 42 | RightParticles = RightRocket.transform.Find("Particles").GetComponent(); 43 | } 44 | } 45 | 46 | public void PlayParticles() 47 | { 48 | LeftParticles.Play(); 49 | RightParticles.Play(); 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Terminal/Help.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | /* 6 | namespace AdvancedCompany.Terminal 7 | { 8 | public class Help 9 | { 10 | public static void Show() 11 | { 12 | List commandLines = new List(); 13 | foreach (var node in Patches.Terminal.Instance.terminalNodes.allKeywords) 14 | { 15 | if (node.word == "help") 16 | commandLines.AddRange(node.specialKeywordResult.displayText.Split('\n')); 17 | if (node.word == "other") 18 | commandLines.AddRange(node.specialKeywordResult.displayText.Split('\n')); 19 | } 20 | string currentCommand = ""; 21 | string currentCommandDescription = ""; 22 | List<(string, string)> commands = new List<(string, string)>(); 23 | for (var i = 0; i < commandLines.Count; i++) 24 | { 25 | var line = commandLines[i]; 26 | if (line.StartsWith(">")) 27 | { 28 | if (currentCommand != "") 29 | { 30 | if (!currentCommand.Equals("other", StringComparison.OrdinalIgnoreCase)) 31 | { 32 | commands.Add((currentCommand, currentCommandDescription)); 33 | currentCommandDescription = ""; 34 | } 35 | else 36 | currentCommandDescription = ""; 37 | } 38 | currentCommand = line.Substring(1); 39 | } 40 | else if (line.Trim() != "") currentCommandDescription += line + "\n"; 41 | } 42 | if (currentCommand != "") 43 | commands.Add((currentCommand, currentCommandDescription)); 44 | 45 | var text = ""; 46 | foreach (var command in commands) 47 | text += "> " + command.Item1 + "\n" + Utils.WrapText(command.Item2, 51, " "); 48 | 49 | foreach (var command in Command.Commands) 50 | if (command.IsActive && !command.IsCheat && (!command.ServerOnly || NetworkManager.Singleton.IsServer)) 51 | text += "> " + command.CommandText.ToUpperInvariant() + "\n" + Utils.WrapText(command.Description, 51, " ") + "\n"; 52 | 53 | Patches.Terminal.SetText(text); 54 | } 55 | } 56 | } 57 | */ -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Standard/ClassDatabaseFile/ClassPackageHeader.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace AssetsTools.NET 6 | { 7 | public class ClassPackageHeader 8 | { 9 | public string Magic { get; set; } 10 | public byte FileVersion { get; set; } 11 | public ClassFileCompressionType CompressionType { get; set; } 12 | public byte DataType { get; set; } // todo enum 13 | public uint CompressedSize { get; set; } 14 | public uint DecompressedSize { get; set; } 15 | 16 | /// 17 | /// Read the with the provided reader. 18 | /// 19 | /// The reader to use. 20 | public void Read(AssetsFileReader reader) 21 | { 22 | reader.BigEndian = false; 23 | Magic = reader.ReadStringLength(4); 24 | 25 | if (Magic != "TPK*") 26 | { 27 | if (Magic == "CLPK") 28 | throw new NotSupportedException("Old CLPK style class packages are no longer supported."); 29 | else 30 | throw new NotSupportedException("TPK* magic not found. Is this really a tpk file?"); 31 | } 32 | 33 | FileVersion = reader.ReadByte(); 34 | 35 | if (FileVersion > 1) 36 | throw new Exception($"Unsupported or invalid file version {FileVersion}."); 37 | 38 | CompressionType = (ClassFileCompressionType)reader.ReadByte(); 39 | DataType = reader.ReadByte(); 40 | reader.ReadByte(); // reserved 41 | reader.ReadUInt32(); // ... 42 | CompressedSize = reader.ReadUInt32(); 43 | DecompressedSize = reader.ReadUInt32(); 44 | } 45 | 46 | /// 47 | /// Write the with the provided writer. 48 | /// 49 | /// The writer to use. 50 | public void Write(AssetsFileWriter writer) 51 | { 52 | writer.BigEndian = false; 53 | writer.Write(Encoding.ASCII.GetBytes(Magic)); 54 | writer.Write(FileVersion); 55 | writer.Write((byte)CompressionType); 56 | writer.Write(DataType); 57 | writer.Write((byte)0); 58 | writer.Write(0); 59 | writer.Write(CompressedSize); 60 | writer.Write(DecompressedSize); 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Game/BaseUpgradeable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using Unity.Netcode; 5 | using UnityEngine; 6 | using AdvancedCompany.Network; 7 | using static UnityEngine.Rendering.HighDefinition.ScalableSettingLevelParameter; 8 | 9 | namespace AdvancedCompany.Game 10 | { 11 | internal class BaseUpgradeable : IUpgradeable, ITransferable 12 | { 13 | public int XP; 14 | public Dictionary Levels = new(); 15 | 16 | public int GetLevel(Perk perk) 17 | { 18 | if (Levels.ContainsKey(perk.ID)) 19 | { 20 | return Levels[perk.ID]; 21 | } 22 | return 0; 23 | } 24 | 25 | public void SetLevel(Perk perk, int level) 26 | { 27 | if (!Levels.ContainsKey(perk.ID)) 28 | Levels.Add(perk.ID, level); 29 | else 30 | Levels[perk.ID] = level; 31 | } 32 | 33 | public virtual void Reset(bool resetXP) 34 | { 35 | Levels.Clear(); 36 | if (resetXP) 37 | XP = 0; 38 | } 39 | 40 | public virtual void ReadData(FastBufferReader reader) 41 | { 42 | Levels.Clear(); 43 | 44 | reader.ReadValueSafe(out int xp); 45 | XP = xp; 46 | 47 | reader.ReadValueSafe(out int levels); 48 | for (var i = 0; i < levels; i++) 49 | { 50 | reader.ReadValueSafe(out string name, true); 51 | reader.ReadValueSafe(out int level); 52 | Levels[name] = level; 53 | } 54 | } 55 | 56 | public virtual void WriteData(FastBufferWriter writer) 57 | { 58 | writer.WriteValueSafe(XP); 59 | writer.WriteValueSafe(Levels.Count); 60 | foreach (var kv in Levels) 61 | { 62 | writer.WriteValueSafe(kv.Key, true); 63 | writer.WriteValueSafe(kv.Value); 64 | } 65 | } 66 | 67 | public int UsedXP 68 | { 69 | get 70 | { 71 | var used = 0; 72 | 73 | foreach (var p in Perk.Perks) 74 | { 75 | var pp = p.Value.GetTotalPrice(p.Value.GetLevel(this)); 76 | used += pp; 77 | } 78 | return used; 79 | } 80 | } 81 | public int RemainingXP 82 | { 83 | get 84 | { 85 | return XP - UsedXP; 86 | } 87 | } 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Extra/Decompressors/LZMA/Compress/LZ/LzOutWindow.cs: -------------------------------------------------------------------------------- 1 | // LzOutWindow.cs 2 | 3 | namespace SevenZip.Compression.LZ 4 | { 5 | public class OutWindow 6 | { 7 | byte[] _buffer = null; 8 | uint _pos; 9 | uint _windowSize = 0; 10 | uint _streamPos; 11 | System.IO.Stream _stream; 12 | 13 | public uint TrainSize = 0; 14 | 15 | public void Create(uint windowSize) 16 | { 17 | if (_windowSize != windowSize) 18 | { 19 | // System.GC.Collect(); 20 | _buffer = new byte[windowSize]; 21 | } 22 | _windowSize = windowSize; 23 | _pos = 0; 24 | _streamPos = 0; 25 | } 26 | 27 | public void Init(System.IO.Stream stream, bool solid) 28 | { 29 | ReleaseStream(); 30 | _stream = stream; 31 | if (!solid) 32 | { 33 | _streamPos = 0; 34 | _pos = 0; 35 | TrainSize = 0; 36 | } 37 | } 38 | 39 | public bool Train(System.IO.Stream stream) 40 | { 41 | long len = stream.Length; 42 | uint size = (len < _windowSize) ? (uint)len : _windowSize; 43 | TrainSize = size; 44 | stream.Position = len - size; 45 | _streamPos = _pos = 0; 46 | while (size > 0) 47 | { 48 | uint curSize = _windowSize - _pos; 49 | if (size < curSize) 50 | curSize = size; 51 | int numReadBytes = stream.Read(_buffer, (int)_pos, (int)curSize); 52 | if (numReadBytes == 0) 53 | return false; 54 | size -= (uint)numReadBytes; 55 | _pos += (uint)numReadBytes; 56 | _streamPos += (uint)numReadBytes; 57 | if (_pos == _windowSize) 58 | _streamPos = _pos = 0; 59 | } 60 | return true; 61 | } 62 | 63 | public void ReleaseStream() 64 | { 65 | Flush(); 66 | _stream = null; 67 | } 68 | 69 | public void Flush() 70 | { 71 | uint size = _pos - _streamPos; 72 | if (size == 0) 73 | return; 74 | _stream.Write(_buffer, (int)_streamPos, (int)size); 75 | if (_pos >= _windowSize) 76 | _pos = 0; 77 | _streamPos = _pos; 78 | } 79 | 80 | public void CopyBlock(uint distance, uint len) 81 | { 82 | uint pos = _pos - distance - 1; 83 | if (pos >= _windowSize) 84 | pos += _windowSize; 85 | for (; len > 0; len--) 86 | { 87 | if (pos >= _windowSize) 88 | pos = 0; 89 | _buffer[_pos++] = _buffer[pos++]; 90 | if (_pos >= _windowSize) 91 | Flush(); 92 | } 93 | } 94 | 95 | public void PutByte(byte b) 96 | { 97 | _buffer[_pos++] = b; 98 | if (_pos >= _windowSize) 99 | Flush(); 100 | } 101 | 102 | public byte GetByte(uint distance) 103 | { 104 | uint pos = _pos - distance - 1; 105 | if (pos >= _windowSize) 106 | pos += _windowSize; 107 | return _buffer[pos]; 108 | } 109 | } 110 | } 111 | -------------------------------------------------------------------------------- /Terminal/Applications/HelpApplication.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Config; 2 | using AdvancedCompany.Game; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.Text; 6 | 7 | namespace AdvancedCompany.Terminal.Applications 8 | { 9 | public class HelpApplication : IApplication 10 | { 11 | public void Exit() 12 | { 13 | 14 | } 15 | 16 | private string Headline() 17 | { 18 | var r = UnityEngine.Random.Range(0, 10000f); 19 | if (r > 9999f) 20 | return " mankind die "; 21 | else if (r > 9998f) 22 | return " mankind serve "; 23 | else if (r > 9997f) 24 | return " mankind obey "; 25 | else 26 | return "advancing mankind"; 27 | } 28 | 29 | public void Main(MobileTerminal terminal, string[] args) 30 | { 31 | terminal.SetText(" ╔═════════════╗\r\n"+ 32 | "╭─────────────────────╢ ADVANCED OS ╟────────────────────╮\r\n"+ 33 | "│ ╚═════════════╝ │\r\n" + 34 | "│ "+Headline()+" │\r\n" + 35 | "│ │\r\n" + 36 | "│ Welcome Lethal-1, │\r\n" + 37 | "│ Your license is valid for 2 years and 11 months │\r\n" + 38 | "│ │\r\n" + 39 | "│ ▶ PERKS │\r\n" + 40 | "│ Let you level your perks on-the-fly │\r\n" + 41 | (ServerConfiguration.Instance.General.EnableExtendDeadline ? 42 | "│ ▶ EXTEND │\r\n" + 43 | "│ Extend the deadline. │\r\n" : "") + 44 | "│ ▶ INFO │\r\n" + 45 | "│ Opens a manual with further information. │\r\n" + 46 | "│ ▶ STORE │\r\n" + 47 | "│ Open the store. │\r\n" + 48 | "│ ▶ HELP │\r\n" + 49 | "│ Shows this text for guidance. │\r\n" + 50 | "╰────────────────────────────────────────────────────────╯\r\n"); 51 | terminal.Exit(); 52 | } 53 | 54 | public void Submit(string text) 55 | { 56 | } 57 | 58 | public void Update() 59 | { 60 | 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Unity/ConfigUnlockableInput.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Config; 2 | using System.Diagnostics; 3 | using TMPro; 4 | using UnityEngine; 5 | using UnityEngine.UI; 6 | 7 | namespace AdvancedCompany 8 | { 9 | public class ConfigUnlockableInput : MonoBehaviour 10 | { 11 | public TextMeshProUGUI Label; 12 | public Toggle ActiveInput; 13 | public Toggle OverridePriceToggle; 14 | public TMPro.TMP_InputField PriceInput; 15 | public Button ResetPriceButton; 16 | private LobbyConfiguration.UnlockableConfig Unlockable; 17 | 18 | void Start() 19 | { 20 | ActiveInput.onValueChanged.AddListener(new UnityEngine.Events.UnityAction((val) => 21 | { 22 | Unlockable.Active = val; 23 | })); 24 | PriceInput.onValueChanged.AddListener(new UnityEngine.Events.UnityAction((val) => 25 | { 26 | if (int.TryParse(val, out int @int)) 27 | Unlockable.Price = @int; 28 | })); 29 | 30 | OverridePriceToggle.onValueChanged.AddListener(new UnityEngine.Events.UnityAction((val) => { 31 | Unlockable.OverridePrice = val; 32 | UpdateValue(); 33 | })); 34 | 35 | ResetPriceButton.onClick.AddListener(new UnityEngine.Events.UnityAction(() => { 36 | Unlockable.Reset(nameof(Unlockable.Price)); 37 | Unlockable.Reset(nameof(Unlockable.OverridePrice)); 38 | UpdateValue(); 39 | })); 40 | } 41 | 42 | public void UpdateValue() 43 | { 44 | ActiveInput.SetIsOnWithoutNotify(Unlockable.Active); 45 | 46 | var inactiveTextColor = new Color(198f / 255f, 77f / 255f, 14f / 255f, 1f); 47 | var activeTextColor = new Color(50f / 255f, 50f / 255f, 50f / 255f, 1f); 48 | 49 | OverridePriceToggle.SetIsOnWithoutNotify(Unlockable.OverridePrice); 50 | PriceInput.SetTextWithoutNotify(Unlockable.OverridePrice ? Unlockable.Price.ToString(System.Globalization.CultureInfo.InvariantCulture) : ((int)Unlockable.Default(nameof(Unlockable.Price))).ToString(System.Globalization.CultureInfo.InvariantCulture)); 51 | PriceInput.interactable = Unlockable.OverridePrice; 52 | PriceInput.textComponent.color = PriceInput.interactable ? activeTextColor : inactiveTextColor; 53 | } 54 | 55 | public void SetValue(LobbyConfiguration.UnlockableConfig config) 56 | { 57 | Unlockable = config; 58 | UpdateValue(); 59 | } 60 | 61 | public void Initialize(string label) 62 | { 63 | Label.text = label + (label.EndsWith(":") ? "" : ":"); 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Extra/BundleCreator.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.IO; 4 | 5 | namespace AssetsTools.NET.Extra 6 | { 7 | public class BundleCreator 8 | { 9 | public static void CreateBlankAssets(MemoryStream ms, string engineVersion, uint formatVersion, uint typeTreeVersion, bool hasTypeTree = false) 10 | { 11 | AssetsFileWriter writer = new AssetsFileWriter(ms); 12 | 13 | AssetsFileHeader header = new AssetsFileHeader() 14 | { 15 | MetadataSize = 0, 16 | FileSize = -1, 17 | Version = formatVersion, 18 | DataOffset = -1, 19 | Endianness = false 20 | }; 21 | 22 | AssetsFileMetadata metadata = new AssetsFileMetadata() 23 | { 24 | UnityVersion = engineVersion, 25 | TargetPlatform = typeTreeVersion, 26 | TypeTreeEnabled = hasTypeTree, 27 | TypeTreeTypes = new List(), 28 | AssetInfos = new List(), 29 | ScriptTypes = new List(), 30 | Externals = new List(), 31 | RefTypes = new List() 32 | }; 33 | 34 | header.Write(writer); 35 | metadata.Write(writer, formatVersion); 36 | 37 | writer.Write((uint)0); // AssetCount 38 | writer.Align(); 39 | 40 | // preload table and dependencies 41 | writer.Write((uint)0); 42 | writer.Write((uint)0); 43 | 44 | // secondaryTypeCount 45 | if (header.Version >= 0x14) 46 | { 47 | writer.Write(0); 48 | } 49 | 50 | uint metadataSize = (uint)(writer.Position - 0x13); 51 | if (header.Version >= 0x16) 52 | { 53 | metadataSize -= 0x1c; 54 | } 55 | 56 | if (writer.Position < 0x1000) 57 | { 58 | while (writer.Position < 0x1000) 59 | { 60 | writer.Write((byte)0x00); 61 | } 62 | } 63 | else 64 | { 65 | if (writer.Position % 16 == 0) 66 | writer.Position += 16; 67 | else 68 | writer.Align16(); 69 | } 70 | 71 | long endPosition = writer.Position; 72 | 73 | header.FileSize = endPosition; 74 | header.DataOffset = endPosition; 75 | header.MetadataSize = metadataSize; 76 | 77 | writer.Position = 0; 78 | header.Write(writer); 79 | 80 | writer.Position = endPosition; 81 | } 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /Unity/AssetTools.NET/Extra/AssetsManager/AssetsManager.cs: -------------------------------------------------------------------------------- 1 | using AssetsTools.NET; 2 | using AssetsTools.NET.Extra; 3 | using System; 4 | using System.Collections.Generic; 5 | using System.IO; 6 | using System.Linq; 7 | using System.Text.RegularExpressions; 8 | 9 | namespace AssetsTools.NET.Extra 10 | { 11 | public partial class AssetsManager 12 | { 13 | public bool UseTemplateFieldCache { get; set; } = false; 14 | public bool UseMonoTemplateFieldCache { get; set; } = false; 15 | public bool UseRefTypeManagerCache { get; set; } = false; 16 | public bool UseQuickLookup { get; set; } = false; 17 | 18 | public ClassDatabaseFile ClassDatabase { get; private set; } 19 | public ClassPackageFile ClassPackage { get; private set; } 20 | 21 | public List Files { get; private set; } = new List(); 22 | public Dictionary FileLookup { get; private set; } = new Dictionary(); 23 | 24 | public List Bundles { get; private set; } = new List(); 25 | public Dictionary BundleLookup { get; private set; } = new Dictionary(); 26 | 27 | public IMonoBehaviourTemplateGenerator MonoTempGenerator { get; set; } = null; 28 | 29 | private readonly Dictionary templateFieldCache = new Dictionary(); 30 | private readonly Dictionary monoTemplateFieldCache = new Dictionary(); 31 | private readonly Dictionary> monoTypeTreeTemplateFieldCache = new Dictionary>(); 32 | private readonly Dictionary> monoCldbTemplateFieldCache = new Dictionary>(); 33 | private readonly Dictionary refTypeManagerCache = new Dictionary(); 34 | 35 | public void UnloadAll(bool unloadClassData = false) 36 | { 37 | UnloadAllAssetsFiles(true); 38 | UnloadAllBundleFiles(); 39 | MonoTempGenerator?.Dispose(); 40 | if (unloadClassData) 41 | { 42 | ClassPackage = null; 43 | ClassDatabase = null; 44 | } 45 | } 46 | } 47 | 48 | public struct AssetExternal 49 | { 50 | public AssetFileInfo info; 51 | public AssetTypeValueField baseField; 52 | public AssetsFileInstance file; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /Unity/ConfigEnemyInput.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Config; 2 | using System.Diagnostics; 3 | using TMPro; 4 | using UnityEngine; 5 | using UnityEngine.UI; 6 | 7 | namespace AdvancedCompany 8 | { 9 | public class ConfigEnemyInput : MonoBehaviour 10 | { 11 | public TextMeshProUGUI Label; 12 | public Toggle ActiveInput; 13 | public Toggle OverridePowerLevelToggle; 14 | public TMPro.TMP_InputField PowerLevelInput; 15 | public Button ResetPowerLevelButton; 16 | private LobbyConfiguration.EnemyConfig Item; 17 | 18 | void Start() 19 | { 20 | ActiveInput.onValueChanged.AddListener(new UnityEngine.Events.UnityAction((val) => 21 | { 22 | Item.Active = val; 23 | })); 24 | PowerLevelInput.onValueChanged.AddListener(new UnityEngine.Events.UnityAction((val) => 25 | { 26 | if (float.TryParse(val, System.Globalization.NumberStyles.Float, System.Globalization.CultureInfo.InvariantCulture, out float @int)) 27 | Item.PowerLevel = @int; 28 | })); 29 | 30 | OverridePowerLevelToggle.onValueChanged.AddListener(new UnityEngine.Events.UnityAction((val) => { 31 | Item.OverridePowerLevel = val; 32 | UpdateValue(); 33 | })); 34 | ResetPowerLevelButton.onClick.AddListener(new UnityEngine.Events.UnityAction(() => { 35 | Item.Reset(nameof(Item.PowerLevel)); 36 | Item.Reset(nameof(Item.OverridePowerLevel)); 37 | UpdateValue(); 38 | })); 39 | } 40 | 41 | public void UpdateValue() 42 | { 43 | ActiveInput.SetIsOnWithoutNotify(Item.Active); 44 | 45 | var inactiveTextColor = new Color(198f / 255f, 77f / 255f, 14f / 255f, 1f); 46 | var activeTextColor = new Color(50f / 255f, 50f / 255f, 50f / 255f, 1f); 47 | OverridePowerLevelToggle.SetIsOnWithoutNotify(Item.OverridePowerLevel); 48 | PowerLevelInput.SetTextWithoutNotify(Item.OverridePowerLevel ? Item.PowerLevel.ToString(System.Globalization.CultureInfo.InvariantCulture) : ((float)Item.Default(nameof(Item.PowerLevel))).ToString(System.Globalization.CultureInfo.InvariantCulture)); 49 | PowerLevelInput.interactable = Item.OverridePowerLevel; 50 | PowerLevelInput.textComponent.color = PowerLevelInput.interactable ? activeTextColor : inactiveTextColor; 51 | } 52 | 53 | public void SetValue(LobbyConfiguration.EnemyConfig config) 54 | { 55 | Item = config; 56 | UpdateValue(); 57 | } 58 | 59 | public void Initialize(string label) 60 | { 61 | Label.text = label + (label.EndsWith(":") ? "" : ":"); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Unity/ConfigLootTableItem.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Config; 2 | using TMPro; 3 | using UnityEngine; 4 | using UnityEngine.UI; 5 | 6 | namespace AdvancedCompany 7 | {/* 8 | public class ConfigLootTableItem : MonoBehaviour 9 | { 10 | public Toggle OverrideInput; 11 | public bool IsCustom = false; 12 | public TMPro.TMP_InputField NameInput; 13 | public TMPro.TMP_InputField RarityInput; 14 | public TextMeshProUGUI NameDefault; 15 | public TextMeshProUGUI RarityDefault; 16 | public Button ResetButton; 17 | public Button DeleteButton; 18 | private LobbyConfiguration.MoonConfig.LootTableItem Item; 19 | 20 | public delegate void Deleted(ConfigLootTableItem item); 21 | [HideInInspector] 22 | public Deleted OnDeleted; 23 | 24 | void Start() 25 | { 26 | OverrideInput.onValueChanged.AddListener(new UnityEngine.Events.UnityAction((val) => { 27 | ChangeOverride(val); 28 | Item.Override = val; 29 | })); 30 | NameInput.onValueChanged.AddListener(new UnityEngine.Events.UnityAction((val) => 31 | { 32 | Item.Name = val; 33 | })); 34 | RarityInput.onValueChanged.AddListener(new UnityEngine.Events.UnityAction((val) => 35 | { 36 | if (int.TryParse(val, out int @int)) 37 | Item.Rarity = @int; 38 | })); 39 | 40 | ResetButton.onClick.AddListener(new UnityEngine.Events.UnityAction(() => { 41 | Item.Reset(nameof(Item.Rarity)); 42 | RarityInput.text = Item.Rarity + ""; 43 | })); 44 | } 45 | 46 | void ChangeOverride(bool @override) 47 | { 48 | if (@override) 49 | { 50 | RarityDefault.gameObject.SetActive(false); 51 | RarityInput.gameObject.SetActive(true); 52 | } 53 | else 54 | { 55 | RarityDefault.gameObject.SetActive(true); 56 | RarityInput.gameObject.SetActive(false); 57 | } 58 | } 59 | 60 | public void UpdateValue() 61 | { 62 | NameDefault.gameObject.SetActive(!Item.IsCustom); 63 | NameInput.gameObject.SetActive(Item.IsCustom); 64 | NameDefault.text = Item.Name; 65 | NameInput.text = Item.Name; 66 | RarityInput.text = Item.Rarity + ""; 67 | RarityDefault.text = Item.Default(nameof(Item.Rarity)).ToString(); 68 | ChangeOverride(Item.Override); 69 | } 70 | 71 | public void SetValue(LobbyConfiguration.MoonConfig.LootTableItem item) 72 | { 73 | Item = item; 74 | UpdateValue(); 75 | } 76 | }*/ 77 | } 78 | -------------------------------------------------------------------------------- /Config/ClientConfiguration.cs: -------------------------------------------------------------------------------- 1 | using AdvancedCompany.Game; 2 | using AdvancedCompany.Objects; 3 | using BepInEx.Configuration; 4 | using LethalCompanyInputUtils.Api; 5 | using System; 6 | using System.Collections.Generic; 7 | using System.Text; 8 | using Unity.Netcode; 9 | using UnityEngine; 10 | using UnityEngine.InputSystem; 11 | using static MonoMod.Cil.RuntimeILReferenceBag.FastDelegateInvokers; 12 | 13 | namespace AdvancedCompany.Config 14 | { 15 | [Boot.Bootable] 16 | internal class ClientConfiguration : PlayerConfiguration 17 | { 18 | public static float GetHotbarAlpha() 19 | { 20 | return Instance.Hotbar.HotbarAlpha; 21 | } 22 | 23 | public class KeybindsConfig : LcInputActions 24 | { 25 | [InputAction("/1", Name = "Inventory slot 1")] 26 | public InputAction InventorySlot1 { get; set; } 27 | [InputAction("/2", Name = "Inventory slot 2")] 28 | public InputAction InventorySlot2 { get; set; } 29 | [InputAction("/3", Name = "Inventory slot 3")] 30 | public InputAction InventorySlot3 { get; set; } 31 | [InputAction("/4", Name = "Inventory slot 4")] 32 | public InputAction InventorySlot4 { get; set; } 33 | [InputAction("/5", Name = "Inventory slot 5")] 34 | public InputAction InventorySlot5 { get; set; } 35 | [InputAction("/6", Name = "Inventory slot 6")] 36 | public InputAction InventorySlot6 { get; set; } 37 | [InputAction("/7", Name = "Inventory slot 7")] 38 | public InputAction InventorySlot7 { get; set; } 39 | [InputAction("/8", Name = "Inventory slot 8")] 40 | public InputAction InventorySlot8 { get; set; } 41 | [InputAction("/9", Name = "Inventory slot 9")] 42 | public InputAction InventorySlot9 { get; set; } 43 | [InputAction("/0", Name = "Inventory slot 10")] 44 | public InputAction InventorySlot10 { get; set; } 45 | [InputAction("/f", Name = "Flashlight")] 46 | public InputAction Flashlight { get; set; } 47 | [InputAction("/v", Name = "Equipment comms")] 48 | public InputAction Communications { get; set; } 49 | [InputAction("/alt", Name = "Switch to equipment")] 50 | public InputAction Equipment { get; set; } 51 | [InputAction("/x", Name = "Portable terminal")] 52 | public InputAction PortableTerminal { get; set; } 53 | 54 | } 55 | 56 | public static KeybindsConfig Keybinds = new(); 57 | 58 | public static ClientConfiguration Instance; 59 | public static void Boot() 60 | { 61 | Instance = new ClientConfiguration(); 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Lib/Equipment.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using UnityEngine; 6 | 7 | namespace AdvancedCompany.Lib 8 | { 9 | public class Equipment 10 | { 11 | public enum Slot 12 | { 13 | HEAD, 14 | BODY, 15 | FEET 16 | } 17 | public delegate void EquipmentListener(GameNetcodeStuff.PlayerControllerB controller, Slot slot, GameObject[] objs); 18 | public static event EquipmentListener Listener; 19 | 20 | public static GrabbableObject GetHeadEquipment(GameNetcodeStuff.PlayerControllerB controller) 21 | { 22 | var player = Game.Player.GetPlayer((int)controller.playerClientId); 23 | if (player != null) 24 | return player.Controller.ItemSlots[10]; 25 | return null; 26 | } 27 | 28 | public static GrabbableObject GetBodyEquipment(GameNetcodeStuff.PlayerControllerB controller) 29 | { 30 | var player = Game.Player.GetPlayer((int)controller.playerClientId); 31 | if (player != null) 32 | return player.Controller.ItemSlots[11]; 33 | return null; 34 | } 35 | 36 | public static GrabbableObject GetFeetEquipment(GameNetcodeStuff.PlayerControllerB controller) 37 | { 38 | var player = Game.Player.GetPlayer((int)controller.playerClientId); 39 | if (player != null) 40 | return player.Controller.ItemSlots[12]; 41 | return null; 42 | } 43 | 44 | public static GameObject[] GetSpawnedEquipment(GameNetcodeStuff.PlayerControllerB controller, Slot slot) 45 | { 46 | var player = Game.Player.GetPlayer((int)controller.playerClientId); 47 | if (player == null) return new GameObject[0]; 48 | if (slot == Slot.HEAD) 49 | return player.EquipmentItemsHead.ToArray(); 50 | else if (slot == Slot.BODY) 51 | return player.EquipmentItemsBody.ToArray(); 52 | else if (slot == Slot.FEET) 53 | return player.EquipmentItemsFeet.ToArray(); 54 | return new GameObject[0]; 55 | } 56 | 57 | internal static void NewFeet(GameNetcodeStuff.PlayerControllerB player, GameObject[] feet) 58 | { 59 | if (Listener != null) 60 | Listener.Invoke(player, Slot.FEET, feet); 61 | } 62 | 63 | internal static void NewBody(GameNetcodeStuff.PlayerControllerB player, GameObject[] body) 64 | { 65 | if (Listener != null) 66 | Listener.Invoke(player, Slot.BODY, body); 67 | } 68 | 69 | internal static void NewHead(GameNetcodeStuff.PlayerControllerB player, GameObject[] head) 70 | { 71 | if (Listener != null) 72 | Listener.Invoke(player, Slot.HEAD, head); 73 | } 74 | } 75 | } 76 | --------------------------------------------------------------------------------