From 088ba33f0c72658ee8499f72812e3d0fa232ad96 Mon Sep 17 00:00:00 2001 From: Yamato <66829532+louis1706@users.noreply.github.com> Date: Tue, 11 Feb 2025 22:56:19 +0100 Subject: [PATCH 01/70] LabAPI Update (#435) * No error for build * Fix Exiled * Fix RoundEnding * Now is fucking separated by default * CustomSubtitles * Missing IsCustomAnnouncement * Fix 3 patch & removal of CustomHealthStat * Fix UsingAndCancellingItemUse * Fix TogglingFlashlight * La Flemme ? * La flemme 2 * Fix ReservedSlotPatch * Fix PickingUpItem(PickingUpAmmo) * Fix Hurt event * Fix FlippingCoin & EscapingPocketDimension * Fix FailingEscapePocketDimension * EscapingAndEscaped fix patch * Fix UpgradingPlayer patch * Fix BeingObserved * Fix PlacingTantrum * Fix FinishingRecall * ChangingCamera (Not working) * putting again the event than i was lazzy to fix * Rework InteractingDoor Patch missing removing the Prefix part lol & SkillIssueFix * Remove useless using and warning disable * OUPS * if stupidity was me it's here (i am stupid) * Fixing Noclip with breakingchange * CustomHumeShieldStat * Fix InteractingGenerator * Fix ChangingCamera * Not finish * InteractingDoor swap CanInteract & IsAllowed back to normal * Player::Gravity * Gravity in wrong place * IHumeShieldRole for Human * Fix BlastDoors & add OpenBlastDoor * Fix SpawningRagdoll Scale & missing argument when modify * Now fix in LabAPI only * we will keep the funny Ragdoll scale * Fix Merge & Split Command * new workflow for LabAPI --- .github/workflows/labapi.yml | 74 ++++++++++ EXILED/Exiled.API/Exiled.API.csproj | 2 +- .../Extensions/UserGroupExtensions.cs | 4 +- EXILED/Exiled.API/Features/Camera.cs | 4 +- .../Exiled.API/Features/CustomHealthStat.cs | 26 ---- .../CustomStats/CustomHumeShieldStat.cs | 16 +-- .../Features/Doors/CheckpointDoor.cs | 16 +-- .../Features/Hazards/TemporaryHazard.cs | 4 +- EXILED/Exiled.API/Features/Paths.cs | 4 +- EXILED/Exiled.API/Features/Player.cs | 60 +++++---- EXILED/Exiled.API/Features/Roles/FpcRole.cs | 9 ++ EXILED/Exiled.API/Features/Roles/HumanRole.cs | 8 +- EXILED/Exiled.API/Features/Scp914.cs | 8 +- EXILED/Exiled.API/Features/Server.cs | 6 +- EXILED/Exiled.API/Features/Warhead.cs | 11 +- .../Exiled.CreditTags.csproj | 4 +- .../API/EventArgs/OwnerEscapingEventArgs.cs | 2 +- .../Exiled.CustomItems.csproj | 2 +- .../Exiled.CustomRoles.csproj | 2 +- EXILED/Exiled.Events/Commands/Config/Merge.cs | 2 +- EXILED/Exiled.Events/Commands/Config/Split.cs | 2 +- .../Cassie/SendingCassieMessageEventArgs.cs | 20 ++- .../DeactivatingWorkstationEventArgs.cs | 2 +- .../EventArgs/Player/EscapingEventArgs.cs | 6 +- .../FailingEscapePocketDimensionEventArgs.cs | 9 +- .../EventArgs/Player/FlippingCoinEventArgs.cs | 6 +- .../EventArgs/Player/HurtEventArgs.cs | 8 +- .../Player/PickingUpItemEventArgs.cs | 6 +- .../Player/PreAuthenticatingEventArgs.cs | 1 - .../Player/ReservedSlotsCheckEventArgs.cs | 42 +++++- .../Player/SendingValidCommandEventArgs.cs | 2 +- .../Player/SentValidCommandEventArgs.cs | 2 +- .../Player/SpawningRagdollEventArgs.cs | 25 ++-- .../Player/TogglingNoClipEventArgs.cs | 10 +- .../Player/UsingRadioBatteryEventArgs.cs | 7 +- .../EventArgs/Server/EndingRoundEventArgs.cs | 12 +- EXILED/Exiled.Events/Events.cs | 6 +- EXILED/Exiled.Events/Exiled.Events.csproj | 2 +- EXILED/Exiled.Events/Handlers/Player.cs | 4 - .../Events/Cassie/SendingCassieMessage.cs | 11 +- .../Events/Player/DamagingShootingTarget.cs | 2 +- .../Events/Player/EscapingAndEscaped.cs | 60 ++------- .../Events/Player/EscapingPocketDimension.cs | 41 +++--- .../Player/FailingEscapePocketDimension.cs | 29 +--- .../Patches/Events/Player/FlippingCoin.cs | 11 +- .../Patches/Events/Player/Hurting.cs | 24 ++-- .../Patches/Events/Player/InteractingDoor.cs | 126 ++++++------------ .../Events/Player/InteractingGenerator.cs | 17 +-- .../Patches/Events/Player/PickingUp330.cs | 7 +- .../Patches/Events/Player/PickingUpAmmo.cs | 20 ++- .../Patches/Events/Player/PickingUpArmor.cs | 7 +- .../Patches/Events/Player/PickingUpItem.cs | 5 +- .../Patches/Events/Player/PickingUpScp244.cs | 5 +- .../Events/Player/ProcessDisarmMessage.cs | 6 +- .../Events/Player/ReservedSlotPatch.cs | 86 +++--------- .../Patches/Events/Player/SpawningRagdoll.cs | 2 +- .../Events/Player/TogglingFlashlight.cs | 28 ++-- .../Patches/Events/Player/TogglingNoClip.cs | 48 +++---- .../Patches/Events/Player/TogglingRadio.cs | 4 +- .../Player/UsingAndCancellingItemUse.cs | 19 +-- .../Events/Player/UsingRadioBattery.cs | 36 ++--- .../Patches/Events/Scp049/FinishingRecall.cs | 4 +- .../Patches/Events/Scp079/ChangingCamera.cs | 13 +- .../Patches/Events/Scp173/BeingObserved.cs | 13 +- .../Patches/Events/Scp173/PlacingTantrum.cs | 14 +- .../Events/Scp330/InteractingScp330.cs | 5 +- .../Patches/Events/Scp914/UpgradingPlayer.cs | 23 ++-- .../Patches/Events/Server/Reporting.cs | 10 +- .../Patches/Events/Server/RoundEnd.cs | 24 +--- .../Patches/Fixes/FixNWDisarmCommand.cs | 48 ------- .../Patches/Fixes/NWFixDetonationTimer.cs | 2 +- .../Patches/Fixes/Scp3114FriendlyFireFix.cs | 2 +- .../Patches/Generic/OfflineModeIds.cs | 9 +- .../Patches/Generic/ServerNamePatch.cs | 2 +- EXILED/Exiled.Example/Exiled.Example.csproj | 2 +- EXILED/Exiled.Loader/Config.cs | 2 +- EXILED/Exiled.Loader/ConfigManager.cs | 2 +- EXILED/Exiled.Loader/Exiled.Loader.csproj | 2 +- EXILED/Exiled.Loader/Loader.cs | 2 +- EXILED/Exiled.Loader/LoaderPlugin.cs | 64 +++++++-- EXILED/Exiled.Loader/Updater.cs | 4 +- .../Exiled.Permissions.csproj | 2 +- .../Extensions/Permissions.cs | 4 +- EXILED/docs/docs.csproj | 2 +- 84 files changed, 589 insertions(+), 696 deletions(-) create mode 100644 .github/workflows/labapi.yml delete mode 100644 EXILED/Exiled.API/Features/CustomHealthStat.cs delete mode 100644 EXILED/Exiled.Events/Patches/Fixes/FixNWDisarmCommand.cs diff --git a/.github/workflows/labapi.yml b/.github/workflows/labapi.yml new file mode 100644 index 0000000000..889c33f8d6 --- /dev/null +++ b/.github/workflows/labapi.yml @@ -0,0 +1,74 @@ +name: Exiled Dev CI + +on: + push: + branches: + - LabAPI + pull_request: + branches: + - LabAPI + workflow_dispatch: + +defaults: + run: + working-directory: ./EXILED + +env: + EXILED_REFERENCES_URL: https://exmod-team.github.io/SL-References/LabAPI.zip + EXILED_REFERENCES_PATH: ${{ github.workspace }}/EXILED/References + EXILED_DLL_ARCHIVER_URL: https://github.com/ExMod-Team/EXILED-DLL-Archiver/releases/latest/download/EXILED-DLL-Archiver.exe + +jobs: + + build: + + runs-on: windows-latest + # Prevent double running for push & pull_request events from the main repo + if: github.event_name != 'push' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name + + steps: + + - name: Setup .NET Core SDK + uses: actions/setup-dotnet@v4.0.1 + + - name: Setup Nuget + uses: nuget/setup-nuget@v2 + + - uses: actions/checkout@v4.1.7 + + - name: Get references + shell: pwsh + run: | + Invoke-WebRequest -Uri ${{ env.EXILED_REFERENCES_URL }} -OutFile ${{ github.workspace }}/EXILED/References.zip + Expand-Archive -Path References.zip -DestinationPath ${{ env.EXILED_REFERENCES_PATH }} + + - name: Build + env: + EXILED_REFERENCES: ${{ env.EXILED_REFERENCES_PATH }} + shell: pwsh + run: | + ./build.ps1 -BuildNuGet + $File = (Get-ChildItem -Path . -Include 'ExMod.Exiled.*.nupkg' -Recurse).Name + Out-File -FilePath ${{ github.env }} -InputObject "PackageFile=$File" -Encoding utf-8 -Append + + - name: Upload nuget package + uses: actions/upload-artifact@v4 + with: + name: ${{ env.PackageFile }} + path: EXILED/${{ env.PackageFile }} + + - name: Get references + shell: pwsh + run: | + Invoke-WebRequest -Uri ${{ env.EXILED_DLL_ARCHIVER_URL }} -OutFile ${{ github.workspace }}/EXILED/EXILED-DLL-Archiver.exe + + - name: Packaging results as tar.gz + shell: pwsh + run: ./packaging.ps1 + + - name: Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: Build Result + path: EXILED/bin/Release/Exiled.tar.gz + diff --git a/EXILED/Exiled.API/Exiled.API.csproj b/EXILED/Exiled.API/Exiled.API.csproj index 961b44e98d..c8737a790c 100644 --- a/EXILED/Exiled.API/Exiled.API.csproj +++ b/EXILED/Exiled.API/Exiled.API.csproj @@ -27,10 +27,10 @@ + - diff --git a/EXILED/Exiled.API/Extensions/UserGroupExtensions.cs b/EXILED/Exiled.API/Extensions/UserGroupExtensions.cs index 7b9138618c..41b8523433 100644 --- a/EXILED/Exiled.API/Extensions/UserGroupExtensions.cs +++ b/EXILED/Exiled.API/Extensions/UserGroupExtensions.cs @@ -37,7 +37,7 @@ public static bool EqualsTo(this UserGroup @this, UserGroup other) /// /// The . /// The key of that group, or if not found. - public static string GetKey(this UserGroup @this) => Server.PermissionsHandler._groups + public static string GetKey(this UserGroup @this) => Server.PermissionsHandler.Groups .FirstOrDefault(pair => pair.Value.EqualsTo(@this)).Key; /// @@ -47,7 +47,7 @@ public static string GetKey(this UserGroup @this) => Server.PermissionsHandler._ /// The value of that group, or if not found. public static UserGroup GetValue(string groupName) { - ServerStatic.GetPermissionsHandler().GetAllGroups().TryGetValue(groupName, out UserGroup userGroup); + ServerStatic.PermissionsHandler.GetAllGroups().TryGetValue(groupName, out UserGroup userGroup); return userGroup; } } diff --git a/EXILED/Exiled.API/Features/Camera.cs b/EXILED/Exiled.API/Features/Camera.cs index 6c72485739..d852933ddc 100644 --- a/EXILED/Exiled.API/Features/Camera.cs +++ b/EXILED/Exiled.API/Features/Camera.cs @@ -216,8 +216,8 @@ internal Camera(Scp079Camera camera079) /// public Quaternion Rotation { - get => Base._cameraAnchor.rotation; - set => Base._cameraAnchor.rotation = value; + get => Base.CameraAnchor.rotation; + set => Base.CameraAnchor.rotation = value; } /// diff --git a/EXILED/Exiled.API/Features/CustomHealthStat.cs b/EXILED/Exiled.API/Features/CustomHealthStat.cs deleted file mode 100644 index 57f6d31c20..0000000000 --- a/EXILED/Exiled.API/Features/CustomHealthStat.cs +++ /dev/null @@ -1,26 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) ExMod Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.API.Features -{ - using PlayerStatsSystem; - - /// - /// A custom version of which allows the player's max amount of health to be changed. - /// TODO: Move to Features.CustomStats. - /// - public class CustomHealthStat : HealthStat - { - /// - public override float MaxValue => CustomMaxValue == default ? base.MaxValue : CustomMaxValue; - - /// - /// Gets or sets the maximum amount of health the player will have. - /// - public float CustomMaxValue { get; set; } - } -} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/CustomStats/CustomHumeShieldStat.cs b/EXILED/Exiled.API/Features/CustomStats/CustomHumeShieldStat.cs index 78c4cd807d..b4c4d8d739 100644 --- a/EXILED/Exiled.API/Features/CustomStats/CustomHumeShieldStat.cs +++ b/EXILED/Exiled.API/Features/CustomStats/CustomHumeShieldStat.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -18,25 +18,17 @@ namespace Exiled.API.Features.CustomStats /// public class CustomHumeShieldStat : HumeShieldStat { - /// - public override float MaxValue => CustomMaxValue == -1 ? base.MaxValue : CustomMaxValue; - /// /// Gets or sets the multiplier for gaining HumeShield. /// public float ShieldRegenerationMultiplier { get; set; } = 1; - /// - /// Gets or sets the maximum amount of HumeShield the player can have. - /// - public float CustomMaxValue { get; set; } = -1; - private float ShieldRegeneration => TryGetHsModule(out HumeShieldModuleBase controller) ? controller.HsRegeneration * ShieldRegenerationMultiplier : 0; /// public override void Update() { - if (MaxValue == -1 && ShieldRegenerationMultiplier is 1) + if (ShieldRegenerationMultiplier is 1) { base.Update(); return; @@ -45,7 +37,7 @@ public override void Update() if (!NetworkServer.active) return; - if (_valueDirty) + if (ValueDirty) { new SyncedStatMessages.StatMessage() { @@ -53,7 +45,7 @@ public override void Update() SyncedValue = CurValue, }.SendToHubsConditionally(CanReceive); _lastSent = CurValue; - _valueDirty = false; + ValueDirty = false; } if (ShieldRegeneration == 0) diff --git a/EXILED/Exiled.API/Features/Doors/CheckpointDoor.cs b/EXILED/Exiled.API/Features/Doors/CheckpointDoor.cs index 837bd5ff72..06c4f756db 100644 --- a/EXILED/Exiled.API/Features/Doors/CheckpointDoor.cs +++ b/EXILED/Exiled.API/Features/Doors/CheckpointDoor.cs @@ -44,8 +44,8 @@ internal CheckpointDoor(Interactables.Interobjects.CheckpointDoor door, List public Interactables.Interobjects.CheckpointDoor.CheckpointSequenceStage CurrentStage { - get => Base._currentSequence; - set => Base._currentSequence = value; + get => Base.CurrentSequence; + set => Base.CurrentSequence = value; } /// @@ -53,8 +53,8 @@ public Interactables.Interobjects.CheckpointDoor.CheckpointSequenceStage Current /// public float MainTimer { - get => Base._mainTimer; - set => Base._mainTimer = value; + get => Base.MainTimer; + set => Base.MainTimer = value; } /// @@ -62,8 +62,8 @@ public float MainTimer /// public float WaitTime { - get => Base._waitTime; - set => Base._waitTime = value; + get => Base.WaitTime; + set => Base.WaitTime = value; } /// @@ -71,8 +71,8 @@ public float WaitTime /// public float WarningTime { - get => Base._warningTime; - set => Base._warningTime = value; + get => Base.WarningTime; + set => Base.WarningTime = value; } /// diff --git a/EXILED/Exiled.API/Features/Hazards/TemporaryHazard.cs b/EXILED/Exiled.API/Features/Hazards/TemporaryHazard.cs index 0e701a8093..c9dfecb650 100644 --- a/EXILED/Exiled.API/Features/Hazards/TemporaryHazard.cs +++ b/EXILED/Exiled.API/Features/Hazards/TemporaryHazard.cs @@ -56,8 +56,8 @@ public bool IsDestroyed /// public float Duration { - get => Base._elapsed; - set => Base._elapsed = value; + get => Base.Elapsed; + set => Base.Elapsed = value; } /// diff --git a/EXILED/Exiled.API/Features/Paths.cs b/EXILED/Exiled.API/Features/Paths.cs index 153d8e0bf6..8d99b1a996 100644 --- a/EXILED/Exiled.API/Features/Paths.cs +++ b/EXILED/Exiled.API/Features/Paths.cs @@ -11,6 +11,8 @@ namespace Exiled.API.Features using System.IO; using System.Linq; + using LabApi.Loader; + /// /// A set of useful paths. /// @@ -106,7 +108,7 @@ public static void Reload(string rootDirectory = null) Dependencies = Path.Combine(Plugins, "dependencies"); Configs = Path.Combine(Exiled, "Configs"); IndividualConfigs = Path.Combine(Configs, "Plugins"); - LoaderConfig = PluginAPI.Loader.AssemblyLoader.InstalledPlugins.FirstOrDefault(x => x.PluginName == "Exiled Loader")?.MainConfigPath; + LoaderConfig = LabApi.Loader.PluginLoader.EnabledPlugins.FirstOrDefault(x => x.Name == "Exiled Loader")?.GetConfigPath("Exiled Loader"); Config = Path.Combine(Configs, $"{Server.Port}-config.yml"); BackupConfig = Path.Combine(Configs, $"{Server.Port}-config.yml.old"); IndividualTranslations = Path.Combine(Configs, "Translations"); diff --git a/EXILED/Exiled.API/Features/Player.cs b/EXILED/Exiled.API/Features/Player.cs index ada3c952af..df2ab96604 100644 --- a/EXILED/Exiled.API/Features/Player.cs +++ b/EXILED/Exiled.API/Features/Player.cs @@ -53,7 +53,6 @@ namespace Exiled.API.Features using PlayerRoles.Spectating; using PlayerRoles.Voice; using PlayerStatsSystem; - using PluginAPI.Core; using RelativePositioning; using RemoteAdmin; using Respawning.NamingRules; @@ -96,7 +95,7 @@ public class Player : TypeCastObject, IEntity, IWorldSpace private readonly HashSet componentsInChildren = new(); private ReferenceHub referenceHub; - private CustomHealthStat healthStat; + private HealthStat healthStat; private CustomHumeShieldStat humeShieldStat; private Role role; @@ -178,7 +177,7 @@ private set Inventory = value.inventory; CameraTransform = value.PlayerCameraReference; - value.playerStats._dictionarizedTypes[typeof(HealthStat)] = value.playerStats.StatModules[Array.IndexOf(PlayerStats.DefinedModules, typeof(HealthStat))] = healthStat = new CustomHealthStat { Hub = value }; + healthStat = value.playerStats.StatModules[Array.IndexOf(PlayerStats.DefinedModules, typeof(HealthStat))] as HealthStat; value.playerStats._dictionarizedTypes[typeof(HumeShieldStat)] = value.playerStats.StatModules[Array.IndexOf(PlayerStats.DefinedModules, typeof(HumeShieldStat))] = humeShieldStat = new CustomHumeShieldStat { Hub = value }; } } @@ -422,7 +421,7 @@ public float InfoViewRange /// /// /// - public bool HasReservedSlot => ReservedSlot.HasReservedSlot(UserId, out _); + public bool HasReservedSlot => ReservedSlot.HasReservedSlot(UserId); /// /// Gets a value indicating whether the player is in whitelist. @@ -509,7 +508,7 @@ public Player Cuffer public virtual Vector3 Position { get => Transform.position; - set => ReferenceHub.TryOverridePosition(value, Vector3.zero); + set => ReferenceHub.TryOverridePosition(value); } /// @@ -529,7 +528,7 @@ public RelativePosition RelativePosition public Quaternion Rotation { get => Transform.rotation; - set => ReferenceHub.TryOverridePosition(Position, value.eulerAngles); + set => ReferenceHub.TryOverrideRotation(value.eulerAngles); } /// @@ -883,7 +882,7 @@ public float Health public float MaxHealth { get => healthStat.MaxValue; - set => healthStat.CustomMaxValue = value; + set => healthStat.MaxValue = value; } /// @@ -939,7 +938,7 @@ public float HumeShield public float MaxHumeShield { get => humeShieldStat.MaxValue; - set => humeShieldStat.CustomMaxValue = value; + set => humeShieldStat.MaxValue = value; } /// @@ -1014,8 +1013,8 @@ public float Stamina /// public string GroupName { - get => ServerStatic.PermissionsHandler._members.TryGetValue(UserId, out string groupName) ? groupName : null; - set => ServerStatic.PermissionsHandler._members[UserId] = value; + get => ServerStatic.PermissionsHandler.Members.TryGetValue(UserId, out string groupName) ? groupName : null; + set => ServerStatic.PermissionsHandler.Members[UserId] = value; } /// @@ -1182,11 +1181,18 @@ public bool IsSpawnProtected internal static ConditionalWeakTable UnverifiedPlayers { get; } = new(); /// - /// Converts NwPluginAPI player to EXILED player. + /// Converts LabApi player to EXILED player. /// - /// The NwPluginAPI player. + /// The LabApi player. /// EXILED player. - public static implicit operator Player(PluginAPI.Core.Player player) => Get(player); + public static implicit operator Player(LabApi.Features.Wrappers.Player player) => Get(player); + + /// + /// Converts LabApi player to EXILED player. + /// + /// The LabApi player. + /// EXILED player. + public static implicit operator LabApi.Features.Wrappers.Player(Player player) => LabApi.Features.Wrappers.Player.Get(player.ReferenceHub); /// /// Gets a filtered by side. Can be empty. @@ -1377,11 +1383,11 @@ public static Player Get(string args) } /// - /// Gets the from NwPluginAPI class. + /// Gets the from LabApi class. /// - /// The class. + /// The class. /// A or if not found. - public static Player Get(PluginAPI.Core.Player apiPlayer) => Get(apiPlayer.ReferenceHub); + public static Player Get(LabApi.Features.Wrappers.Player apiPlayer) => Get(apiPlayer.ReferenceHub); /// /// Try-get a player given a . @@ -1464,12 +1470,12 @@ public static Player Get(string args) public static bool TryGet(string args, out Player player) => (player = Get(args)) is not null; /// - /// Try-get the from NwPluginAPI class. + /// Try-get the from LabApi class. /// - /// The class. + /// The class. /// The player found or if not found. /// A boolean indicating whether a player was found. - public static bool TryGet(PluginAPI.Core.Player apiPlayer, out Player player) => (player = Get(apiPlayer)) is not null; + public static bool TryGet(LabApi.Features.Wrappers.Player apiPlayer, out Player player) => (player = Get(apiPlayer)) is not null; /// /// Try-get player by . @@ -1508,10 +1514,10 @@ public static bool AddReservedSlot(string userId, bool isPermanent) { if (isPermanent) { - if (ReservedSlots.HasReservedSlot(userId)) + if (LabApi.Features.Wrappers.ReservedSlots.HasReservedSlot(userId)) return false; - ReservedSlots.Add(userId); + LabApi.Features.Wrappers.ReservedSlots.Add(userId); return true; } @@ -1532,7 +1538,7 @@ public static bool AddToWhitelist(string userId, bool isPermanent) if (WhiteList.IsOnWhitelist(userId)) return false; - Whitelist.Add(userId); + LabApi.Features.Wrappers.Whitelist.Add(userId); return true; } @@ -1824,7 +1830,7 @@ public bool TryGetItem(ushort serial, out Item item) /// The group to be set. public void SetRank(string name, UserGroup group) { - if (ServerStatic.GetPermissionsHandler()._groups.TryGetValue(name, out UserGroup userGroup)) + if (ServerStatic.PermissionsHandler.Groups.TryGetValue(name, out UserGroup userGroup)) { userGroup.BadgeColor = group.BadgeColor; userGroup.BadgeText = name; @@ -1835,15 +1841,15 @@ public void SetRank(string name, UserGroup group) } else { - ServerStatic.GetPermissionsHandler()._groups.Add(name, group); + ServerStatic.PermissionsHandler.Groups.Add(name, group); ReferenceHub.serverRoles.SetGroup(group, false, false); } - if (ServerStatic.GetPermissionsHandler()._members.ContainsKey(UserId)) - ServerStatic.GetPermissionsHandler()._members[UserId] = name; + if (ServerStatic.PermissionsHandler.Members.ContainsKey(UserId)) + ServerStatic.PermissionsHandler.Members[UserId] = name; else - ServerStatic.GetPermissionsHandler()._members.Add(UserId, name); + ServerStatic.PermissionsHandler.Members.Add(UserId, name); } /// diff --git a/EXILED/Exiled.API/Features/Roles/FpcRole.cs b/EXILED/Exiled.API/Features/Roles/FpcRole.cs index ecc946c9b7..fc041ff513 100644 --- a/EXILED/Exiled.API/Features/Roles/FpcRole.cs +++ b/EXILED/Exiled.API/Features/Roles/FpcRole.cs @@ -68,6 +68,15 @@ public RelativePosition ClientRelativePosition set => FirstPersonController.FpcModule.Motor.ReceivedPosition = value; } + /// + /// Gets or sets the player's gravity. + /// + public Vector3 Gravity + { + get => FirstPersonController.FpcModule.Motor.GravityController.Gravity; + set => FirstPersonController.FpcModule.Motor.GravityController.Gravity = value; + } + /// /// Gets or sets a value indicating whether if the player should get damage. /// diff --git a/EXILED/Exiled.API/Features/Roles/HumanRole.cs b/EXILED/Exiled.API/Features/Roles/HumanRole.cs index 8a238a3e7d..767a010d45 100644 --- a/EXILED/Exiled.API/Features/Roles/HumanRole.cs +++ b/EXILED/Exiled.API/Features/Roles/HumanRole.cs @@ -8,7 +8,7 @@ namespace Exiled.API.Features.Roles { using PlayerRoles; - + using PlayerRoles.PlayableScps.HumeShield; using Respawning; using Respawning.NamingRules; @@ -17,7 +17,7 @@ namespace Exiled.API.Features.Roles /// /// Defines a role that represents a human class. /// - public class HumanRole : FpcRole + public class HumanRole : FpcRole, IHumeShieldRole { /// /// Initializes a new instance of the class. @@ -27,6 +27,7 @@ internal HumanRole(HumanGameRole baseRole) : base(baseRole) { Base = baseRole; + HumeShieldModule = baseRole.HumeShieldModule; } /// @@ -56,6 +57,9 @@ public byte UnitNameId /// public new HumanGameRole Base { get; } + /// + public HumeShieldModuleBase HumeShieldModule { get; } + /// /// Gets the armor efficacy based on a specific and the armor the is wearing. /// diff --git a/EXILED/Exiled.API/Features/Scp914.cs b/EXILED/Exiled.API/Features/Scp914.cs index 57ee9d366c..7d9ea65818 100644 --- a/EXILED/Exiled.API/Features/Scp914.cs +++ b/EXILED/Exiled.API/Features/Scp914.cs @@ -40,8 +40,8 @@ public static Scp914KnobSetting KnobStatus /// public static Scp914Mode ConfigMode { - get => Scp914Controller._configMode.Value; - set => Scp914Controller._configMode.Value = value; + get => Scp914Controller.ConfigMode.Value; + set => Scp914Controller.ConfigMode.Value = value; } /// @@ -72,7 +72,7 @@ public static Scp914Mode ConfigMode /// /// Gets a value indicating whether SCP-914 is active and currently processing items. /// - public static bool IsWorking => Scp914Controller._isUpgrading; + public static bool IsWorking => Scp914Controller.IsUpgrading; /// /// Gets a value indicating all of the GameObjects currently present inside SCP-914's intake chamber. @@ -92,7 +92,7 @@ public static Scp914Mode ConfigMode /// /// Gets the list with which SCP-914 has. /// - public static IReadOnlyCollection Doors => Scp914Controller._doors.Select(Door.Get).ToList(); + public static IReadOnlyCollection Doors => Scp914Controller.Doors.Select(Door.Get).ToList(); /// /// Filters all GameObjects inside SCP-914's intake chamber into players and items. diff --git a/EXILED/Exiled.API/Features/Server.cs b/EXILED/Exiled.API/Features/Server.cs index c79d0c4c1d..c9a7e40212 100644 --- a/EXILED/Exiled.API/Features/Server.cs +++ b/EXILED/Exiled.API/Features/Server.cs @@ -60,11 +60,11 @@ public static class Server /// public static string Name { - get => ServerConsole._serverName; + get => ServerConsole.ServerName; set { - ServerConsole._serverName = value; - ServerConsole.singleton.RefreshServerName(); + ServerConsole.ServerName = value; + ServerConsole.Singleton.RefreshServerName(); } } diff --git a/EXILED/Exiled.API/Features/Warhead.cs b/EXILED/Exiled.API/Features/Warhead.cs index 687b4fb035..2857cd61c9 100644 --- a/EXILED/Exiled.API/Features/Warhead.cs +++ b/EXILED/Exiled.API/Features/Warhead.cs @@ -168,7 +168,16 @@ public static int Kills public static void CloseBlastDoors() { foreach (BlastDoor door in BlastDoors) - door.SetClosed(false, true); + door.SetDoorState(true, false); + } + + /// + /// Open the surface blast doors. + /// + public static void OpenBlastDoors() + { + foreach (BlastDoor door in BlastDoors) + door.SetDoorState(false, true); } /// diff --git a/EXILED/Exiled.CreditTags/Exiled.CreditTags.csproj b/EXILED/Exiled.CreditTags/Exiled.CreditTags.csproj index 9382489fb3..a169d69155 100644 --- a/EXILED/Exiled.CreditTags/Exiled.CreditTags.csproj +++ b/EXILED/Exiled.CreditTags/Exiled.CreditTags.csproj @@ -27,13 +27,13 @@ + - - + diff --git a/EXILED/Exiled.CustomItems/API/EventArgs/OwnerEscapingEventArgs.cs b/EXILED/Exiled.CustomItems/API/EventArgs/OwnerEscapingEventArgs.cs index 2fc89ef333..54f478d7ce 100644 --- a/EXILED/Exiled.CustomItems/API/EventArgs/OwnerEscapingEventArgs.cs +++ b/EXILED/Exiled.CustomItems/API/EventArgs/OwnerEscapingEventArgs.cs @@ -30,7 +30,7 @@ public class OwnerEscapingEventArgs : EscapingEventArgs /// /// The instance. public OwnerEscapingEventArgs(Item item, EscapingEventArgs ev) - : base(ev.Player, ev.NewRole, ev.EscapeScenario) + : base(ev.Player.ReferenceHub, ev.NewRole, ev.EscapeScenario) { Item = item; } diff --git a/EXILED/Exiled.CustomItems/Exiled.CustomItems.csproj b/EXILED/Exiled.CustomItems/Exiled.CustomItems.csproj index 703a8a7c77..6d45708c17 100644 --- a/EXILED/Exiled.CustomItems/Exiled.CustomItems.csproj +++ b/EXILED/Exiled.CustomItems/Exiled.CustomItems.csproj @@ -28,9 +28,9 @@ + - diff --git a/EXILED/Exiled.CustomRoles/Exiled.CustomRoles.csproj b/EXILED/Exiled.CustomRoles/Exiled.CustomRoles.csproj index d569aacb2c..78b2030580 100644 --- a/EXILED/Exiled.CustomRoles/Exiled.CustomRoles.csproj +++ b/EXILED/Exiled.CustomRoles/Exiled.CustomRoles.csproj @@ -29,9 +29,9 @@ + - diff --git a/EXILED/Exiled.Events/Commands/Config/Merge.cs b/EXILED/Exiled.Events/Commands/Config/Merge.cs index b9916ede64..c6cf79042d 100644 --- a/EXILED/Exiled.Events/Commands/Config/Merge.cs +++ b/EXILED/Exiled.Events/Commands/Config/Merge.cs @@ -49,8 +49,8 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s SortedDictionary configs = ConfigManager.LoadSorted(ConfigManager.Read()); LoaderPlugin.Config.ConfigType = ConfigType.Default; bool haveBeenSaved = ConfigManager.Save(configs); - PluginAPI.Loader.AssemblyLoader.InstalledPlugins.FirstOrDefault(x => x.PluginName == "Exiled Loader")?.SaveConfig(new LoaderPlugin(), nameof(LoaderPlugin.Config)); + LoaderPlugin.Instance.SaveConfig(); response = $"Configs have been merged successfully! Feel free to remove the directory in the following path:\n\"{Paths.IndividualConfigs}\""; return haveBeenSaved; } diff --git a/EXILED/Exiled.Events/Commands/Config/Split.cs b/EXILED/Exiled.Events/Commands/Config/Split.cs index 9fad9c3e16..34816af579 100644 --- a/EXILED/Exiled.Events/Commands/Config/Split.cs +++ b/EXILED/Exiled.Events/Commands/Config/Split.cs @@ -49,8 +49,8 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s SortedDictionary configs = ConfigManager.LoadSorted(ConfigManager.Read()); LoaderPlugin.Config.ConfigType = ConfigType.Separated; bool haveBeenSaved = ConfigManager.Save(configs); - PluginAPI.Loader.AssemblyLoader.InstalledPlugins.FirstOrDefault(x => x.PluginName == "Exiled Loader")?.SaveConfig(new LoaderPlugin(), nameof(LoaderPlugin.Config)); + LoaderPlugin.Instance.SaveConfig(); response = $"Configs have been merged successfully! Feel free to remove the file in the following path:\n\"{Paths.Config}\""; return haveBeenSaved; } diff --git a/EXILED/Exiled.Events/EventArgs/Cassie/SendingCassieMessageEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Cassie/SendingCassieMessageEventArgs.cs index e39a463c23..a8b986c171 100644 --- a/EXILED/Exiled.Events/EventArgs/Cassie/SendingCassieMessageEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Cassie/SendingCassieMessageEventArgs.cs @@ -26,12 +26,20 @@ public class SendingCassieMessageEventArgs : IDeniableEvent /// /// /// + /// + /// + /// + /// + /// + /// /// Indicates whether the event can be executed. - public SendingCassieMessageEventArgs(string words, bool makeHold, bool makeNoise, bool isAllowed = true) + public SendingCassieMessageEventArgs(string words, bool makeHold, bool makeNoise, bool customAnnouncement, string customSubtitles, bool isAllowed = true) { Words = words; + CustomSubtitles = customSubtitles; MakeHold = makeHold; MakeNoise = makeNoise; + IsCustomAnnouncement = customAnnouncement; IsAllowed = isAllowed; } @@ -40,6 +48,11 @@ public SendingCassieMessageEventArgs(string words, bool makeHold, bool makeNoise /// public string Words { get; set; } + /// + /// Gets or sets the message subtitles. + /// + public string CustomSubtitles { get; set; } + /// /// Gets or sets a value indicating whether the message should be held. /// @@ -54,5 +67,10 @@ public SendingCassieMessageEventArgs(string words, bool makeHold, bool makeNoise /// Gets or sets a value indicating whether the message can be sent. /// public bool IsAllowed { get; set; } + + /// + /// Gets or sets a value indicating whether the message can be sent. + /// + public bool IsCustomAnnouncement { get; set; } } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/DeactivatingWorkstationEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/DeactivatingWorkstationEventArgs.cs index 48b7164d83..20ce6f84d0 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/DeactivatingWorkstationEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/DeactivatingWorkstationEventArgs.cs @@ -31,7 +31,7 @@ public class DeactivatingWorkstationEventArgs : IPlayerEvent, IDeniableEvent /// public DeactivatingWorkstationEventArgs(WorkstationController controller, bool isAllowed = true) { - Player = Player.Get(controller._knownUser); + Player = Player.Get(controller.KnownUser); WorkstationController = controller; IsAllowed = isAllowed; } diff --git a/EXILED/Exiled.Events/EventArgs/Player/EscapingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/EscapingEventArgs.cs index a10eea6922..756873bc56 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/EscapingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/EscapingEventArgs.cs @@ -25,7 +25,7 @@ public class EscapingEventArgs : IPlayerEvent, IDeniableEvent /// /// Initializes a new instance of the class. /// - /// + /// /// /// /// @@ -34,9 +34,9 @@ public class EscapingEventArgs : IPlayerEvent, IDeniableEvent /// /// /// - public EscapingEventArgs(Player player, RoleTypeId newRole, EscapeScenario escapeScenario) + public EscapingEventArgs(ReferenceHub referenceHub, RoleTypeId newRole, EscapeScenario escapeScenario) { - Player = player; + Player = Player.Get(referenceHub); NewRole = newRole; EscapeScenario = escapeScenario; IsAllowed = escapeScenario is not EscapeScenario.CustomEscape; diff --git a/EXILED/Exiled.Events/EventArgs/Player/FailingEscapePocketDimensionEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/FailingEscapePocketDimensionEventArgs.cs index 247e62cbe7..9d398abdda 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/FailingEscapePocketDimensionEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/FailingEscapePocketDimensionEventArgs.cs @@ -7,6 +7,8 @@ namespace Exiled.Events.EventArgs.Player { + using System; + using API.Features; using Interfaces; @@ -22,22 +24,19 @@ public class FailingEscapePocketDimensionEventArgs : IPlayerEvent, IDeniableEven /// /// /// - /// - /// - /// /// /// /// - public FailingEscapePocketDimensionEventArgs(Player player, PocketDimensionTeleport teleporter, bool isAllowed = true) + public FailingEscapePocketDimensionEventArgs(Player player, bool isAllowed = true) { Player = player; - Teleporter = teleporter; IsAllowed = isAllowed; } /// /// Gets the PocketDimensionTeleport the player walked into. /// + [Obsolete("can't be used")] public PocketDimensionTeleport Teleporter { get; } /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/FlippingCoinEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/FlippingCoinEventArgs.cs index 369a443868..954d2f39e8 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/FlippingCoinEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/FlippingCoinEventArgs.cs @@ -20,7 +20,7 @@ public class FlippingCoinEventArgs : IPlayerEvent, IDeniableEvent, IItemEvent /// /// Initializes a new instance of the class. /// - /// + /// /// /// /// @@ -29,9 +29,9 @@ public class FlippingCoinEventArgs : IPlayerEvent, IDeniableEvent, IItemEvent /// /// /// - public FlippingCoinEventArgs(Player player, Coin coin, bool isTails) + public FlippingCoinEventArgs(ReferenceHub referenceHub, Coin coin, bool isTails) { - Player = player; + Player = Player.Get(referenceHub); Item = Item.Get(coin); IsTails = isTails; } diff --git a/EXILED/Exiled.Events/EventArgs/Player/HurtEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/HurtEventArgs.cs index 1b97b4a946..8fd0eab99b 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/HurtEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/HurtEventArgs.cs @@ -23,7 +23,7 @@ public class HurtEventArgs : IAttackerEvent /// /// Initializes a new instance of the class. /// - /// + /// /// /// /// @@ -32,11 +32,11 @@ public class HurtEventArgs : IAttackerEvent /// /// /// - public HurtEventArgs(Player target, DamageHandlerBase damageHandler, DamageHandlerBase.HandlerOutput handlerOutput) + public HurtEventArgs(ReferenceHub referenceHub, DamageHandlerBase damageHandler, DamageHandlerBase.HandlerOutput handlerOutput) { - DamageHandler = new CustomDamageHandler(target, damageHandler); + Player = Player.Get(referenceHub); + DamageHandler = new CustomDamageHandler(Player, damageHandler); Attacker = DamageHandler.BaseIs(out CustomAttackerHandler attackerDamageHandler) ? attackerDamageHandler.Attacker : null; - Player = target; HandlerOutput = handlerOutput; } diff --git a/EXILED/Exiled.Events/EventArgs/Player/PickingUpItemEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/PickingUpItemEventArgs.cs index 90493c03c5..f71781e3b7 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/PickingUpItemEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/PickingUpItemEventArgs.cs @@ -21,7 +21,7 @@ public class PickingUpItemEventArgs : IPlayerEvent, IPickupEvent, IDeniableEvent /// /// Initializes a new instance of the class. /// - /// + /// /// /// /// @@ -30,10 +30,10 @@ public class PickingUpItemEventArgs : IPlayerEvent, IPickupEvent, IDeniableEvent /// /// /// - public PickingUpItemEventArgs(Player player, ItemPickupBase pickup, bool isAllowed = true) + public PickingUpItemEventArgs(ReferenceHub referenceHub, ItemPickupBase pickup, bool isAllowed = true) { IsAllowed = isAllowed; - Player = player; + Player = Player.Get(referenceHub); Pickup = Pickup.Get(pickup); } diff --git a/EXILED/Exiled.Events/EventArgs/Player/PreAuthenticatingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/PreAuthenticatingEventArgs.cs index f2af6a8300..3c127ca02e 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/PreAuthenticatingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/PreAuthenticatingEventArgs.cs @@ -13,7 +13,6 @@ namespace Exiled.Events.EventArgs.Player using LiteNetLib; using LiteNetLib.Utils; - using PluginAPI.Events; #pragma warning disable SA1600 //TODO: #pragma warning disable SA1309 diff --git a/EXILED/Exiled.Events/EventArgs/Player/ReservedSlotsCheckEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ReservedSlotsCheckEventArgs.cs index 47861a038c..d571f1e451 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ReservedSlotsCheckEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ReservedSlotsCheckEventArgs.cs @@ -13,21 +13,24 @@ namespace Exiled.Events.EventArgs.Player /// /// Contains all information when checking if a player has a reserved slot. /// - public class ReservedSlotsCheckEventArgs : IExiledEvent + public class ReservedSlotsCheckEventArgs : IExiledEvent, IDeniableEvent { + private ReservedSlotEventResult reservedSlotEventResult = ReservedSlotEventResult.UseBaseGameSystem; + /// /// Initializes a new instance of the class. /// - /// - /// - /// /// /// /// - public ReservedSlotsCheckEventArgs(string userId, bool hasReservedSlot) + /// + /// + /// + public ReservedSlotsCheckEventArgs(bool hasReservedSlot, string userId) { UserId = userId; HasReservedSlot = hasReservedSlot; + IsAllowed = hasReservedSlot; } /// @@ -40,9 +43,36 @@ public ReservedSlotsCheckEventArgs(string userId, bool hasReservedSlot) /// public bool HasReservedSlot { get; } + /// + /// Gets or sets a value indicating whether the player is allowed to connect. + /// + public bool IsAllowed { get; set; } + /// /// Gets or sets the event result. /// - public ReservedSlotEventResult Result { get; set; } = ReservedSlotEventResult.UseBaseGameSystem; + public ReservedSlotEventResult Result + { + get => reservedSlotEventResult; + set + { + switch (reservedSlotEventResult) + { + case ReservedSlotEventResult.CanUseReservedSlots or ReservedSlotEventResult.UseBaseGameSystem: + IsAllowed = HasReservedSlot; + break; + case ReservedSlotEventResult.AllowConnectionUnconditionally: + IsAllowed = true; + break; + case ReservedSlotEventResult.CannotUseReservedSlots: + IsAllowed = false; + break; + default: + return; + } + + reservedSlotEventResult = value; + } + } } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/SendingValidCommandEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/SendingValidCommandEventArgs.cs index a3fa2d5310..1ea8a6df71 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/SendingValidCommandEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/SendingValidCommandEventArgs.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.EventArgs.Player using Exiled.API.Features; using Exiled.API.Features.Pickups; using Exiled.Events.EventArgs.Interfaces; - using PluginAPI.Enums; + using LabApi.Features.Enums; using RemoteAdmin; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/SentValidCommandEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/SentValidCommandEventArgs.cs index 0fb7778a16..1c96ff88f9 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/SentValidCommandEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/SentValidCommandEventArgs.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.EventArgs.Player using Exiled.API.Features; using Exiled.API.Features.Pickups; using Exiled.Events.EventArgs.Interfaces; - using PluginAPI.Enums; + using LabApi.Features.Enums; using RemoteAdmin; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs index e12dc914a1..a925a3b8bf 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs @@ -8,7 +8,6 @@ namespace Exiled.Events.EventArgs.Player { using API.Features; - using Interfaces; using PlayerRoles; @@ -16,6 +15,7 @@ namespace Exiled.Events.EventArgs.Player using PlayerStatsSystem; using UnityEngine; + using YamlDotNet.Core.Tokens; /// /// Contains all information before spawning a player ragdoll. @@ -45,7 +45,7 @@ public SpawningRagdollEventArgs(RagdollData info, bool isAllowed = true) public Vector3 Position { get => Info.StartPosition; - set => Info = new RagdollData(Player.ReferenceHub, DamageHandlerBase, value, Rotation); + set => Info = new RagdollData(Player.ReferenceHub, DamageHandlerBase, Role, value, Rotation, Scale, Nickname, CreationTime); } /// @@ -54,13 +54,22 @@ public Vector3 Position public Quaternion Rotation { get => Info.StartRotation; - set => Info = new RagdollData(Player.ReferenceHub, DamageHandlerBase, Position, value); + set => Info = new RagdollData(Player.ReferenceHub, DamageHandlerBase, Role, Position, value, Scale, Nickname, CreationTime); + } + + /// + /// Gets or sets the ragdoll's scale with RagdollData. + /// + public Vector3 Scale + { + get => Info.Scale; + set => Info = new RagdollData(Player.ReferenceHub, DamageHandlerBase, Role, Position, Rotation, value, Nickname, CreationTime); } /// - /// Gets or sets the ragdoll's scale. + /// Gets or sets the ragdoll's scale with GameObject. /// - public Vector3 Scale { get; set; } + public Vector3 RagdollScale { get; set; } /// /// Gets or sets the ragdoll's . @@ -68,7 +77,7 @@ public Quaternion Rotation public RoleTypeId Role { get => Info.RoleType; - set => Info = new RagdollData(Player.ReferenceHub, DamageHandlerBase, value, Position, Rotation, Nickname, CreationTime); + set => Info = new RagdollData(Player.ReferenceHub, DamageHandlerBase, value, Position, Rotation, Scale, Nickname, CreationTime); } /// @@ -82,7 +91,7 @@ public RoleTypeId Role public string Nickname { get => Info.Nickname; - set => Info = new RagdollData(Player.ReferenceHub, DamageHandlerBase, Role, Position, Rotation, value, CreationTime); + set => Info = new RagdollData(Player.ReferenceHub, DamageHandlerBase, Role, Position, Rotation, Scale, value, CreationTime); } /// @@ -96,7 +105,7 @@ public string Nickname public DamageHandlerBase DamageHandlerBase { get => Info.Handler; - set => Info = new RagdollData(Player.ReferenceHub, value, Role, Position, Rotation, Nickname, CreationTime); + set => Info = new RagdollData(Player.ReferenceHub, value, Role, Position, Rotation, Scale, Nickname, CreationTime); } /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/TogglingNoClipEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/TogglingNoClipEventArgs.cs index 78144567ec..65ea273731 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/TogglingNoClipEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/TogglingNoClipEventArgs.cs @@ -19,7 +19,7 @@ public class TogglingNoClipEventArgs : IPlayerEvent, IDeniableEvent /// /// Initializes a new instance of the class. /// - /// + /// /// /// /// @@ -28,9 +28,9 @@ public class TogglingNoClipEventArgs : IPlayerEvent, IDeniableEvent /// /// /// - public TogglingNoClipEventArgs(Player player, bool newValue, bool isAllowed = true) + public TogglingNoClipEventArgs(ReferenceHub referenceHub, bool newValue, bool isAllowed = true) { - Player = player; + Player = Player.Get(referenceHub); IsEnabled = newValue; IsAllowed = isAllowed; } @@ -41,9 +41,9 @@ public TogglingNoClipEventArgs(Player player, bool newValue, bool isAllowed = tr public Player Player { get; } /// - /// Gets or sets a value indicating whether the noclip mode will be enabled. + /// Gets a value indicating whether the noclip mode will be enabled. /// - public bool IsEnabled { get; set; } + public bool IsEnabled { get; } /// /// Gets or sets a value indicating whether the player can toggle noclip. diff --git a/EXILED/Exiled.Events/EventArgs/Player/UsingRadioBatteryEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/UsingRadioBatteryEventArgs.cs index ae1995da47..3b3af1c73f 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/UsingRadioBatteryEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/UsingRadioBatteryEventArgs.cs @@ -25,19 +25,16 @@ public class UsingRadioBatteryEventArgs : IPlayerEvent, IDeniableEvent, IItemEve /// /// /// - /// - /// - /// /// /// /// /// /// /// - public UsingRadioBatteryEventArgs(RadioItem radio, Player player, float drain, bool isAllowed = true) + public UsingRadioBatteryEventArgs(RadioItem radio, float drain, bool isAllowed = true) { Radio = Item.Get(radio); - Player = player; + Player = Radio.Owner; Drain = drain; IsAllowed = isAllowed; } diff --git a/EXILED/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs index 216676772b..7ed1dcbb58 100644 --- a/EXILED/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs @@ -24,17 +24,13 @@ public class EndingRoundEventArgs : IDeniableEvent /// /// /// - /// - /// - /// /// /// /// - public EndingRoundEventArgs(LeadingTeam leadingTeam, RoundSummary.SumInfo_ClassList classList, bool isForceEnded, bool isAllowed) + public EndingRoundEventArgs(LeadingTeam leadingTeam, RoundSummary.SumInfo_ClassList classList, bool isAllowed) { LeadingTeam = leadingTeam; ClassList = classList; - IsForceEnded = isForceEnded; IsAllowed = isAllowed; } @@ -51,7 +47,11 @@ public EndingRoundEventArgs(LeadingTeam leadingTeam, RoundSummary.SumInfo_ClassL /// /// Gets or sets a value indicating whether the round is ended by API call. /// - public bool IsForceEnded { get; set; } + public bool IsForceEnded + { + get => RoundSummary.singleton._roundEnded; + set => RoundSummary.singleton._roundEnded = value; + } /// /// Gets or sets a value indicating whether the round is going to finish or not. diff --git a/EXILED/Exiled.Events/Events.cs b/EXILED/Exiled.Events/Events.cs index ac37f5528a..4815c2492c 100644 --- a/EXILED/Exiled.Events/Events.cs +++ b/EXILED/Exiled.Events/Events.cs @@ -20,7 +20,7 @@ namespace Exiled.Events using InventorySystem.Items.Usables; using PlayerRoles.Ragdolls; using PlayerRoles.RoleAssign; - using PluginAPI.Events; + using Respawning; using UnityEngine.SceneManagement; using UserSettings.ServerSpecific; @@ -84,8 +84,6 @@ public override void OnEnabled() ServerConsole.ReloadServerName(); ServerSpecificSettingsSync.ServerOnSettingValueReceived += SettingBase.OnSettingUpdated; - - EventManager.RegisterEvents(this); } /// @@ -118,8 +116,6 @@ public override void OnDisabled() ItemPickupBase.OnPickupDestroyed -= Handlers.Internal.PickupEvent.OnRemovedPickup; ServerSpecificSettingsSync.ServerOnSettingValueReceived -= SettingBase.OnSettingUpdated; - - EventManager.UnregisterEvents(this); } /// diff --git a/EXILED/Exiled.Events/Exiled.Events.csproj b/EXILED/Exiled.Events/Exiled.Events.csproj index aa7f9ff4bf..620625057d 100644 --- a/EXILED/Exiled.Events/Exiled.Events.csproj +++ b/EXILED/Exiled.Events/Exiled.Events.csproj @@ -26,10 +26,10 @@ + - diff --git a/EXILED/Exiled.Events/Handlers/Player.cs b/EXILED/Exiled.Events/Handlers/Player.cs index ac58bb3085..62df1b459b 100644 --- a/EXILED/Exiled.Events/Handlers/Player.cs +++ b/EXILED/Exiled.Events/Handlers/Player.cs @@ -17,10 +17,6 @@ namespace Exiled.Events.Handlers using Exiled.Events.Features; - using PluginAPI.Core.Attributes; - using PluginAPI.Enums; - using PluginAPI.Events; - /// /// Player related events. /// diff --git a/EXILED/Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs b/EXILED/Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs index 1bdacfd8f2..2c138e305e 100644 --- a/EXILED/Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs +++ b/EXILED/Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs @@ -22,7 +22,7 @@ namespace Exiled.Events.Patches.Events.Cassie using static HarmonyLib.AccessTools; /// - /// Patches . + /// Patches . /// Adds the event. /// [EventPatch(typeof(Cassie), nameof(Cassie.SendingCassieMessage))] @@ -35,13 +35,13 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable instruction.opcode == OpCodes.Newobj) + offset; newInstructions.InsertRange( index, new[] { - // Player.Get(hub) + // hub new CodeInstruction(OpCodes.Ldarg_0).MoveLabelsFrom(newInstructions[index]), - new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), // roleTypeId - new(OpCodes.Ldloc_0), + new(OpCodes.Ldloc_1), // escapeScenario - new(OpCodes.Ldloc_1), + new(OpCodes.Ldloc_2), - // EscapingEventArgs ev = new(Player, RoleTypeId, EscapeScenario, SpawnableTeamType, float) + // EscapingEventArgs ev = new(Player, RoleTypeId, EscapeScenario) new(OpCodes.Newobj, GetDeclaredConstructors(typeof(EscapingEventArgs))[0]), new(OpCodes.Dup), new(OpCodes.Dup), @@ -75,7 +74,12 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } - - /// - /// Patches for . - /// Replaces last returned to . - /// - [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Escaping))] - [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Escaped))] - [HarmonyPatch(typeof(Escape), nameof(Escape.ServerGetScenario))] - internal static class GetScenario - { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) - { - List newInstructions = ListPool.Pool.Get(instructions); - - LocalBuilder fpcRole = generator.DeclareLocal(typeof(FpcStandardRoleBase)); - - // replace HumanRole to FpcStandardRoleBase - newInstructions.Find(x => x.opcode == OpCodes.Isinst).operand = typeof(FpcStandardRoleBase); - - // after this index all invalid exit are considered Custom - int customExit = newInstructions.FindLastIndex(x => x.opcode == OpCodes.Ldarg_0); - for (int i = 0; i < newInstructions.Count; i++) - { - OpCode opcode = newInstructions[i].opcode; - if (opcode == OpCodes.Stloc_0) - newInstructions[i] = new CodeInstruction(OpCodes.Stloc_S, fpcRole.LocalIndex).WithLabels(newInstructions[i].labels); - else if (opcode == OpCodes.Ldloc_0) - newInstructions[i] = new CodeInstruction(OpCodes.Ldloc_S, fpcRole.LocalIndex).WithLabels(newInstructions[i].labels); - else if (opcode == OpCodes.Ldc_I4_0 && i > customExit) - newInstructions[i].opcode = OpCodes.Ldc_I4_5; - } - - for (int z = 0; z < newInstructions.Count; z++) - yield return newInstructions[z]; - - ListPool.Pool.Return(newInstructions); - } - } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/EscapingPocketDimension.cs b/EXILED/Exiled.Events/Patches/Events/Player/EscapingPocketDimension.cs index e69b577385..6c6408b36f 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/EscapingPocketDimension.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/EscapingPocketDimension.cs @@ -8,6 +8,7 @@ namespace Exiled.Events.Patches.Events.Player { using System.Collections.Generic; + using System.Reflection; using System.Reflection.Emit; using API.Features; @@ -25,11 +26,11 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches the method. + /// Patches the method. /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.EscapingPocketDimension))] - [HarmonyPatch(typeof(PocketDimensionTeleport), nameof(PocketDimensionTeleport.OnTriggerEnter))] + [HarmonyPatch(typeof(PocketDimensionTeleport), nameof(PocketDimensionTeleport.Exit))] internal static class EscapingPocketDimension { private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) @@ -40,24 +41,17 @@ private static IEnumerable Transpiler(IEnumerable instruction.Calls(Method(typeof(FirstPersonMovementModule), nameof(FirstPersonMovementModule.ServerOverridePosition)))) + offset; - - // Replaces "ServerOverridePosition" with our logic - newInstructions.RemoveRange(index, 6); - + int offset = 1; + int index = newInstructions.FindIndex(x => x.opcode == OpCodes.Ret) + offset; newInstructions.InsertRange( index, new[] { - // Player.Get(referenceHub) - new CodeInstruction(OpCodes.Ldloc_1).WithLabels((Label)newInstructions[index + labelOffset].operand), - new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), + // referenceHub + new CodeInstruction(OpCodes.Ldarg_0).MoveLabelsFrom(newInstructions[index]), // Scp106PocketExitFinder.GetBestExitPosition(fpcRole) - new(OpCodes.Ldloc_2), + new(OpCodes.Ldloc_0), new(OpCodes.Call, Method(typeof(Scp106PocketExitFinder), nameof(Scp106PocketExitFinder.GetBestExitPosition), new[] { typeof(IFpcRole) })), // EscapingPocketDimensionEventArgs ev = new(Player, Vector3) @@ -73,15 +67,20 @@ private static IEnumerable Transpiler(IEnumerable instruction.Calls(Method(typeof(FirstPersonMovementModule), nameof(FirstPersonMovementModule.ServerOverridePosition)))) + offset; + + // Replaces "fpcRole.FpcModule.ServerOverridePosition(Scp106PocketExitFinder.GetBestExitPosition(fpcRole))" + // with "fpcRole.FpcModule.ServerOverridePosition(ev.TeleportPosition)" + newInstructions.RemoveRange(index, 2); + newInstructions.InsertRange(index, new CodeInstruction[] + { + new(OpCodes.Ldloc_S, ev.LocalIndex), + new(OpCodes.Callvirt, PropertyGetter(typeof(EscapingPocketDimensionEventArgs), nameof(EscapingPocketDimensionEventArgs.TeleportPosition))), + }); newInstructions[newInstructions.Count - 1].WithLabels(ret); for (int z = 0; z < newInstructions.Count; z++) diff --git a/EXILED/Exiled.Events/Patches/Events/Player/FailingEscapePocketDimension.cs b/EXILED/Exiled.Events/Patches/Events/Player/FailingEscapePocketDimension.cs index d64fe8c8cf..875c26611a 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/FailingEscapePocketDimension.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/FailingEscapePocketDimension.cs @@ -22,11 +22,11 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . + /// Patches . /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.FailingEscapePocketDimension))] - [HarmonyPatch(typeof(PocketDimensionTeleport), nameof(PocketDimensionTeleport.OnTriggerEnter))] + [HarmonyPatch(typeof(PocketDimensionTeleport), nameof(PocketDimensionTeleport.Kill))] internal static class FailingEscapePocketDimension { private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) @@ -35,34 +35,17 @@ private static IEnumerable Transpiler(IEnumerable instruction.opcode == OpCodes.Newobj) + offset; - newInstructions.InsertRange( - index, + 0, new[] { - new CodeInstruction(OpCodes.Ldloc_1).MoveLabelsFrom(newInstructions[index]), - new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), - new(OpCodes.Dup), - new(OpCodes.Stloc_S, player.LocalIndex), - new(OpCodes.Brfalse, returnLabel), - - // player - new CodeInstruction(OpCodes.Ldloc_S, player.LocalIndex), - - // this - new(OpCodes.Ldarg_0), + // referenceHub + new CodeInstruction(OpCodes.Ldarg_0), // true new(OpCodes.Ldc_I4_1), - // FailingEscapePocketDimensionEventArgs ev = new(Player, PocketDimensionTeleport, bool) + // FailingEscapePocketDimensionEventArgs ev = new(ReferenceHub, bool) new(OpCodes.Newobj, GetDeclaredConstructors(typeof(FailingEscapePocketDimensionEventArgs))[0]), new(OpCodes.Dup), diff --git a/EXILED/Exiled.Events/Patches/Events/Player/FlippingCoin.cs b/EXILED/Exiled.Events/Patches/Events/Player/FlippingCoin.cs index 71e9711a7f..4ec1ce8c9f 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/FlippingCoin.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/FlippingCoin.cs @@ -38,25 +38,24 @@ private static IEnumerable Transpiler(IEnumerable x.opcode == OpCodes.Brtrue_S) + offset; + int offset = 1; + int index = newInstructions.FindLastIndex(x => x.opcode == OpCodes.Stloc_0) + offset; newInstructions.InsertRange( index, new[] { - // Player.Get(ReferenceHub) + // this.Owner new CodeInstruction(OpCodes.Ldarg_0), new(OpCodes.Callvirt, PropertyGetter(typeof(ItemBase), nameof(ItemBase.Owner))), - new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), // this new CodeInstruction(OpCodes.Ldarg_0), // isTails - new(OpCodes.Ldloc_1), + new(OpCodes.Ldloc_0), - // FlippingCoinEventArgs ev = new(Player, bool) + // FlippingCoinEventArgs ev = new(ReferenceHub, bool) new(OpCodes.Newobj, GetDeclaredConstructors(typeof(FlippingCoinEventArgs))[0]), new(OpCodes.Dup), new(OpCodes.Dup), diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Hurting.cs b/EXILED/Exiled.Events/Patches/Events/Player/Hurting.cs index 11e3e2a96c..1a5e4093f6 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Hurting.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Hurting.cs @@ -38,8 +38,6 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); - LocalBuilder player = generator.DeclareLocal(typeof(Player)); - Label jump = generator.DefineLabel(); int offset = 1; int index = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Ret) + offset; @@ -48,15 +46,14 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); + Label retLabel = generator.DefineLabel(); LocalBuilder ev = generator.DeclareLocal(typeof(InteractingDoorEventArgs)); - List public float MaxRadius { - get => Base._maxRadius; - set => Base._maxRadius = value; + get => Base.MaxRadius; + set => Base.MaxRadius = value; } /// @@ -94,8 +94,8 @@ public float ConcussDuration /// public float ScpDamageMultiplier { - get => Base._scpDamageMultiplier; - set => Base._scpDamageMultiplier = value; + get => Base.ScpDamageMultiplier; + set => Base.ScpDamageMultiplier = value; } /// diff --git a/EXILED/Exiled.API/Features/Roles/Scp079Role.cs b/EXILED/Exiled.API/Features/Roles/Scp079Role.cs index 2480ca3d88..d46d069cdf 100644 --- a/EXILED/Exiled.API/Features/Roles/Scp079Role.cs +++ b/EXILED/Exiled.API/Features/Roles/Scp079Role.cs @@ -593,7 +593,7 @@ public void ActivateTesla(bool consumeEnergy = true) Scp079Camera cam = CurrentCameraSync.CurrentCamera; RewardManager.MarkRoom(cam.Room); - if (!global::TeslaGate.AllGates.TryGetFirst(x => RoomIdUtils.IsTheSameRoom(cam.Position, x.transform.position), out global::TeslaGate teslaGate)) + if (!global::TeslaGate.AllGates.TryGetFirst(x => RoomUtils.IsTheSameRoom(cam.Position, x.transform.position), out global::TeslaGate teslaGate)) return; if (consumeEnergy) diff --git a/EXILED/Exiled.API/Features/Room.cs b/EXILED/Exiled.API/Features/Room.cs index 9fde18957c..f2f7c802a9 100644 --- a/EXILED/Exiled.API/Features/Room.cs +++ b/EXILED/Exiled.API/Features/Room.cs @@ -246,7 +246,7 @@ public static Room Get(RoomIdentifier roomIdentifier) => roomIdentifier == null /// /// The to search for. /// The with the given or if not found. - public static Room Get(Vector3 position) => RoomIdUtils.RoomAtPositionRaycasts(position, false) is RoomIdentifier identifier ? Get(identifier) : null; + public static Room Get(Vector3 position) => RoomUtils.RoomAtPositionRaycasts(position, false) is RoomIdentifier identifier ? Get(identifier) : null; /// /// Gets a given the specified . diff --git a/EXILED/Exiled.Events/EventArgs/Map/FillingLockerEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Map/FillingLockerEventArgs.cs index 66043379d5..205500cf60 100644 --- a/EXILED/Exiled.Events/EventArgs/Map/FillingLockerEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Map/FillingLockerEventArgs.cs @@ -41,7 +41,7 @@ public FillingLockerEventArgs(ItemPickupBase pickupBase, LockerChamber lockerCha /// /// Gets a locker which is containing . /// - public API.Features.Lockers.Locker Locker => Chamber.Locker; + public API.Features.Lockers.Locker Locker => Chamber?.Locker; /// /// Gets a chamber which is filling. diff --git a/EXILED/Exiled.Events/EventArgs/Scp330/InteractingScp330EventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp330/InteractingScp330EventArgs.cs index dc39d420c5..d706ea289d 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp330/InteractingScp330EventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp330/InteractingScp330EventArgs.cs @@ -21,31 +21,29 @@ public class InteractingScp330EventArgs : IPlayerEvent, IScp330Event, IDeniableE /// /// Initializes a new instance of the class. /// - /// + /// /// /// /// /// /// - public InteractingScp330EventArgs(Player player, int usage) + /// + /// + /// + /// + /// + /// + /// + /// + /// + public InteractingScp330EventArgs(ReferenceHub referenceHub, int usage, bool shouldPlaySound, bool shouldSever, CandyKindID candy) { - Player = player; + Player = Player.Get(referenceHub); UsageCount = usage; ShouldSever = usage >= 2; - ShouldPlaySound = true; + ShouldPlaySound = shouldPlaySound; IsAllowed = Player.IsHuman; Candy = Scp330Candies.GetRandom(); - - if (Scp330Bag.TryGetBag(player.ReferenceHub, out Scp330Bag scp330Bag)) - { - Scp330 = (Scp330)Item.Get(scp330Bag); - } - else - { - Scp330 = (Scp330)Item.Create(ItemType.SCP330, player); - Scp330.RemoveAllCandy(); - player.AddItem(Scp330); - } } /// diff --git a/EXILED/Exiled.Events/Patches/Events/Map/ExplodingFlashGrenade.cs b/EXILED/Exiled.Events/Patches/Events/Map/ExplodingFlashGrenade.cs index 0884e28710..c9ae310ba9 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/ExplodingFlashGrenade.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/ExplodingFlashGrenade.cs @@ -73,7 +73,7 @@ private static void ProcessEvent(FlashbangGrenade instance, float distance) continue; if (!IndividualFriendlyFire.CheckFriendlyFirePlayer(instance.PreviousOwner, player.ReferenceHub) && !instance.PreviousOwner.CompareLife(player.ReferenceHub)) continue; - if (Physics.Linecast(instance.transform.position, player.CameraTransform.position, instance._blindingMask)) + if (Physics.Linecast(instance.transform.position, player.CameraTransform.position, instance.BlindingMask)) continue; targetToAffect.Add(player); diff --git a/EXILED/Exiled.Events/Patches/Events/Scp0492/Consumed.cs b/EXILED/Exiled.Events/Patches/Events/Scp0492/Consumed.cs index 4a72c1f55d..dcb3ca94b8 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp0492/Consumed.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp0492/Consumed.cs @@ -38,35 +38,32 @@ private static IEnumerable Transpiler(IEnumerable instruction.opcode == OpCodes.Ret) + offset; - Label returnLabel = generator.DefineLabel(); newInstructions.InsertRange( - index, + 0, new[] { - // Player.Get(base.Owner) - new CodeInstruction(OpCodes.Ldarg_0).MoveLabelsFrom(newInstructions[index]), + // base.Owner + new CodeInstruction(OpCodes.Ldarg_0), new(OpCodes.Call, PropertyGetter(typeof(StandardSubroutine), nameof(StandardSubroutine.Owner))), // base.CurRagdoll new CodeInstruction(OpCodes.Ldarg_0), new(OpCodes.Call, PropertyGetter(typeof(RagdollAbilityBase), nameof(RagdollAbilityBase.CurRagdoll))), - // ConsumingCorpseEventArgs ev = new(Player, Ragdoll, bool) + // ConsumingCorpseEventArgs ev = new(ReferenceHub, Ragdoll, bool) new(OpCodes.Newobj, GetDeclaredConstructors(typeof(ConsumedCorpseEventArgs))[0]), new(OpCodes.Dup), new(OpCodes.Stloc_S, ev.LocalIndex), - // Handlers.Scp049.OnSendingCall(ev) + // Handlers.Scp049.OnConsumedCorpse(ev) new(OpCodes.Call, Method(typeof(Handlers.Scp0492), nameof(Handlers.Scp0492.OnConsumedCorpse))), }); - // replace "base.Owner.playerStats.GetModule().ServerHeal(100f)" with "base.Owner.playerStats.GetModule().ServerHeal(ev.ConsumeHeal)" - offset = -1; - index = newInstructions.FindIndex(instruction => instruction.operand == (object)Method(typeof(HealthStat), nameof(HealthStat.ServerHeal))) + offset; + // replace "Scp0492ConsumingCorpseEventArgs(base.Owner, base.CurRagdoll, 100f);" with "Scp0492ConsumingCorpseEventArgs(base.Owner, base.CurRagdoll, ev.ConsumeHeal);" + int offset = -1; + int index = newInstructions.FindIndex(x => x.opcode == OpCodes.Ldc_R4 && (float)x.operand == ZombieConsumeAbility.ConsumeHeal) + offset; newInstructions.RemoveAt(index); newInstructions.InsertRange( diff --git a/EXILED/Exiled.Events/Patches/Events/Scp330/InteractingScp330.cs b/EXILED/Exiled.Events/Patches/Events/Scp330/InteractingScp330.cs index 15ed8f01b1..b7e714470a 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp330/InteractingScp330.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp330/InteractingScp330.cs @@ -46,23 +46,30 @@ private static IEnumerable Transpiler(IEnumerable instruction.Calls(Method(typeof(Scp330Bag), nameof(Scp330Bag.ServerProcessPickup)))) + offset; + instruction => instruction.Calls(Method(typeof(Scp330Candies), nameof(Scp330Candies.GetRandom)))) + offset; newInstructions.InsertRange( index, new[] { - // Player.Get(ply) - new CodeInstruction(OpCodes.Ldarg_1).MoveLabelsFrom(newInstructions[index]), - new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), + // ply + new CodeInstruction(OpCodes.Ldarg_1), - // num2 + // usage new(OpCodes.Ldloc_1), - // InteractingScp330EventArgs ev = new(Player, int) + // shouldPlaySound + new(OpCodes.Ldloc_2), + + // shouldSever + new(OpCodes.Ldloc_3), + + // candyKindID + new(OpCodes.Ldloc_S, 4), + + // InteractingScp330EventArgs ev = new(ReferenceHub, int, bool, bool, CandyKindID) new(OpCodes.Newobj, GetDeclaredConstructors(typeof(InteractingScp330EventArgs))[0]), new(OpCodes.Dup), new(OpCodes.Dup), @@ -70,81 +77,26 @@ private static IEnumerable Transpiler(IEnumerable instruction.Calls(Method(typeof(Scp330Bag), nameof(Scp330Bag.ServerProcessPickup)))) + remove_offset; - - // Remove original add candy logic - newInstructions.RemoveRange(remove_index, 4); - - /* next code will used to override sound rpc check by EXILED - * old: - * if (args.PlaySound) - * new: - * if (args.PlaySound | ev.PlaySound) - */ - offset = 1; - index = newInstructions.FindLastIndex( - instruction => instruction.Calls(PropertyGetter(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerInteractingScp330EventArgs), nameof(LabApi.Events.Arguments.PlayerEvents.PlayerInteractingScp330EventArgs.PlaySound)))) + offset; - newInstructions.InsertRange( - index, - new[] - { - // load ev.ShouldPlaySound and or operation with nw property. - new CodeInstruction(OpCodes.Ldloc_S, ev.LocalIndex), + // shouldPlaySound = ev.ShouldPlaySound new(OpCodes.Callvirt, PropertyGetter(typeof(InteractingScp330EventArgs), nameof(InteractingScp330EventArgs.ShouldPlaySound))), - new(OpCodes.Or), - }); - /* next code will used to override Sever check by EXILED - * old: - * if (args.AllowPunishment && uses >= 2) - * new: - * if (args.AllowPunishment && ev.ShouldSever) - */ + new(OpCodes.Stloc, 2), - // set `notSeverLabel` - offset = -1; - index = newInstructions.FindLastIndex( - instruction => instruction.LoadsField(Field(typeof(Scp330Interobject), nameof(Scp330Interobject._previousUses)))) + offset; - - Label notSeverLabel = newInstructions[index].labels[0]; - - offset = 2; - index = newInstructions.FindLastIndex( - instruction => instruction.Calls(PropertyGetter(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerInteractingScp330EventArgs), nameof(LabApi.Events.Arguments.PlayerEvents.PlayerInteractingScp330EventArgs.AllowPunishment)))) + offset; + // shouldSever = ev.ShouldSever + new(OpCodes.Callvirt, PropertyGetter(typeof(InteractingScp330EventArgs), nameof(InteractingScp330EventArgs.ShouldSever))), + new(OpCodes.Stloc, 3), - // remove `uses >= 2` check, to override that by ev.ShouldSever - newInstructions.RemoveRange(index, 3); + // candyKindID = ev.Candy + new(OpCodes.Callvirt, PropertyGetter(typeof(InteractingScp330EventArgs), nameof(InteractingScp330EventArgs.Candy))), + new(OpCodes.Stloc_S, 4), - newInstructions.InsertRange( - index, - new[] - { - // if (!ev.ShouldSever) - // goto shouldNotSever; - new CodeInstruction(OpCodes.Ldloc_S, ev.LocalIndex), - new(OpCodes.Callvirt, PropertyGetter(typeof(InteractingScp330EventArgs), nameof(InteractingScp330EventArgs.ShouldSever))), - new(OpCodes.Brfalse_S, notSeverLabel), + // if (!ev.IsAllowed) + // return; + new(OpCodes.Callvirt, PropertyGetter(typeof(InteractingScp330EventArgs), nameof(InteractingScp330EventArgs.IsAllowed))), + new(OpCodes.Brfalse, returnLabel), }); newInstructions[newInstructions.Count - 1].labels.Add(returnLabel); @@ -154,28 +106,5 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } - - private static bool ServerProcessPickup(ReferenceHub player, CandyKindID candy, out Scp330Bag bag) - { - if (!Scp330Bag.TryGetBag(player, out bag)) - { - player.inventory.ServerAddItem(ItemType.SCP330, ItemAddReason.AdminCommand); - - if (!Scp330Bag.TryGetBag(player, out bag)) - return false; - - bag.Candies = new List { candy }; - bag.ServerRefreshBag(); - - return true; - } - - bool result = bag.TryAddSpecific(candy); - - if (bag.AcquisitionAlreadyReceived) - bag.ServerRefreshBag(); - - return result; - } } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Generic/LockerList.cs b/EXILED/Exiled.Events/Patches/Generic/LockerList.cs index 1815a58e79..f76ac47c51 100644 --- a/EXILED/Exiled.Events/Patches/Generic/LockerList.cs +++ b/EXILED/Exiled.Events/Patches/Generic/LockerList.cs @@ -20,23 +20,28 @@ namespace Exiled.Events.Patches.Generic using static HarmonyLib.AccessTools; /// - /// Patches . + /// Patches . /// - [HarmonyPatch(typeof(MapGeneration.Distributors.Locker), nameof(MapGeneration.Distributors.Locker.Start))] + [HarmonyPatch(typeof(SpawnableStructure), nameof(SpawnableStructure.Start))] internal class LockerList { - private static IEnumerable Transpiler(IEnumerable codeInstructions) + private static IEnumerable Transpiler(IEnumerable codeInstructions, ILGenerator generator) { List newInstructions = ListPool.Pool.Get(codeInstructions); + Label jump = generator.DefineLabel(); + // new Locker(this) newInstructions.InsertRange( 0, new CodeInstruction[] { new(OpCodes.Ldarg_0), + new(OpCodes.Isinst, typeof(MapGeneration.Distributors.Locker)), + new(OpCodes.Dup), + new(OpCodes.Brfalse_S, jump), new(OpCodes.Newobj, GetDeclaredConstructors(typeof(API.Features.Lockers.Locker))[0]), - new(OpCodes.Pop), + new CodeInstruction(OpCodes.Pop).WithLabels(jump), }); for (int z = 0; z < newInstructions.Count; z++) diff --git a/EXILED/Exiled.Events/Patches/Generic/RoomList.cs b/EXILED/Exiled.Events/Patches/Generic/RoomList.cs index 037103be04..c61c7bc3f6 100644 --- a/EXILED/Exiled.Events/Patches/Generic/RoomList.cs +++ b/EXILED/Exiled.Events/Patches/Generic/RoomList.cs @@ -35,7 +35,7 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(codeInstructions); int offset = -3; - int index = newInstructions.FindIndex(i => i.Calls(Method(typeof(RoomIdUtils), nameof(RoomIdUtils.PositionToCoords)))) + offset; + int index = newInstructions.FindIndex(i => i.Calls(Method(typeof(RoomUtils), nameof(RoomUtils.PositionToCoords)))) + offset; // Room.Get(gameObject).InternalCreate(); newInstructions.InsertRange( From 8df2572e59ba223665987d76bad63c7b6dda3f7e Mon Sep 17 00:00:00 2001 From: Yamato Date: Sat, 5 Apr 2025 20:57:54 +0200 Subject: [PATCH 17/70] TODO: Fix THE CRASH ISSUE --- .../Patches/Events/Player/UsingAndCancellingItemUse.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EXILED/Exiled.Events/Patches/Events/Player/UsingAndCancellingItemUse.cs b/EXILED/Exiled.Events/Patches/Events/Player/UsingAndCancellingItemUse.cs index ead102f44a..f1d6b99606 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/UsingAndCancellingItemUse.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/UsingAndCancellingItemUse.cs @@ -117,7 +117,7 @@ private static IEnumerable Transpiler(IEnumerable instruction.Calls(Method(typeof(NetworkUtils), nameof(NetworkUtils.SendToAuthenticated)))) + offset; - + /* // TODO: FIX THE CRASH ISSUE newInstructions.InsertRange( index, new[] @@ -135,7 +135,7 @@ private static IEnumerable Transpiler(IEnumerable Date: Sat, 5 Apr 2025 21:00:26 +0200 Subject: [PATCH 18/70] Fix Consumed Event - doubt --- EXILED/Exiled.Events/Patches/Events/Scp0492/Consumed.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/EXILED/Exiled.Events/Patches/Events/Scp0492/Consumed.cs b/EXILED/Exiled.Events/Patches/Events/Scp0492/Consumed.cs index dcb3ca94b8..592dd3a7b1 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp0492/Consumed.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp0492/Consumed.cs @@ -52,7 +52,7 @@ private static IEnumerable Transpiler(IEnumerable), nameof(RagdollAbilityBase.CurRagdoll))), - // ConsumingCorpseEventArgs ev = new(ReferenceHub, Ragdoll, bool) + // ConsumingCorpseEventArgs ev = new(ReferenceHub, Ragdoll) new(OpCodes.Newobj, GetDeclaredConstructors(typeof(ConsumedCorpseEventArgs))[0]), new(OpCodes.Dup), new(OpCodes.Stloc_S, ev.LocalIndex), @@ -62,7 +62,7 @@ private static IEnumerable Transpiler(IEnumerable x.opcode == OpCodes.Ldc_R4 && (float)x.operand == ZombieConsumeAbility.ConsumeHeal) + offset; newInstructions.RemoveAt(index); From aaa01b9d819dae763ecfcc8c5d7eca0e2d999c2f Mon Sep 17 00:00:00 2001 From: Yamato Date: Sun, 6 Apr 2025 19:41:29 +0200 Subject: [PATCH 19/70] Fix & Small change on UsingAndCancellingItemUse --- .../Player/CancelledItemUseEventArgs.cs | 13 ++++--- .../Player/CancellingItemUseEventArgs.cs | 8 +++-- .../EventArgs/Player/UsingItemEventArgs.cs | 8 +++-- .../Player/UsingAndCancellingItemUse.cs | 34 ++++++++----------- 4 files changed, 33 insertions(+), 30 deletions(-) diff --git a/EXILED/Exiled.Events/EventArgs/Player/CancelledItemUseEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/CancelledItemUseEventArgs.cs index 33719e6217..19435c5250 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/CancelledItemUseEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/CancelledItemUseEventArgs.cs @@ -10,6 +10,7 @@ namespace Exiled.Events.EventArgs.Player using API.Features; using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items.Usables; /// /// Contains all information before a player cancels usage of an item. @@ -19,14 +20,16 @@ public class CancelledItemUseEventArgs : IPlayerEvent, IUsableEvent /// /// Initializes a new instance of the class. /// - /// The player who's stopping the use of an item. - /// + /// + /// + /// + /// /// /// - public CancelledItemUseEventArgs(Player player, Item item) + public CancelledItemUseEventArgs(ReferenceHub hub, UsableItem usableItem) { - Player = player; - Usable = item is Usable usable ? usable : null; + Player = Player.Get(hub); + Usable = Item.Get(usableItem); } /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/CancellingItemUseEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/CancellingItemUseEventArgs.cs index 1caaabb0a6..a030f171c2 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/CancellingItemUseEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/CancellingItemUseEventArgs.cs @@ -20,13 +20,15 @@ public class CancellingItemUseEventArgs : IPlayerEvent, IDeniableEvent, IUsableE /// /// Initializes a new instance of the class. /// - /// The player who's stopping the use of an item. + /// + /// + /// /// /// /// - public CancellingItemUseEventArgs(Player player, UsableItem item) + public CancellingItemUseEventArgs(ReferenceHub hub, UsableItem item) { - Player = player; + Player = Player.Get(hub); Usable = Item.Get(item); } diff --git a/EXILED/Exiled.Events/EventArgs/Player/UsingItemEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/UsingItemEventArgs.cs index 6165eb35c3..317d6ddbeb 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/UsingItemEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/UsingItemEventArgs.cs @@ -21,16 +21,18 @@ public class UsingItemEventArgs : IPlayerEvent, IDeniableEvent, IUsableEvent /// /// Initializes a new instance of the class. /// - /// The player who's going to use the item. + /// + /// + /// /// /// /// /// /// /// - public UsingItemEventArgs(Player player, UsableItem item, float cooldown) + public UsingItemEventArgs(ReferenceHub hub, UsableItem item, float cooldown) { - Player = player; + Player = Player.Get(hub); Usable = Item.Get(item) is Usable usable ? usable : null; Cooldown = cooldown; } diff --git a/EXILED/Exiled.Events/Patches/Events/Player/UsingAndCancellingItemUse.cs b/EXILED/Exiled.Events/Patches/Events/Player/UsingAndCancellingItemUse.cs index f1d6b99606..ec10d374a6 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/UsingAndCancellingItemUse.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/UsingAndCancellingItemUse.cs @@ -20,6 +20,7 @@ namespace Exiled.Events.Patches.Events.Player using HarmonyLib; using InventorySystem.Items.Usables; + using LabApi.Events.Arguments.PlayerEvents; using Utils.Networking; using static HarmonyLib.AccessTools; @@ -53,9 +54,8 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable instruction.Calls(Method(typeof(NetworkUtils), nameof(NetworkUtils.SendToAuthenticated)))) + offset; - /* // TODO: FIX THE CRASH ISSUE + instruction => instruction.opcode == OpCodes.Newobj) + offset; + newInstructions.InsertRange( index, new[] { - // Player.Get(referenceHub) + // referenceHub new CodeInstruction(OpCodes.Ldloc_0), - new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), - // evCancellingItemUseEventArgs.Item - new(OpCodes.Ldloc_S, evCancellingItemUseEventArgs.LocalIndex), - new(OpCodes.Callvirt, PropertyGetter(typeof(CancellingItemUseEventArgs), nameof(CancellingItemUseEventArgs.Item))), + // usableItem + new(OpCodes.Ldloc_1), - // CancellingItemUseEventArgs ev = new(Player, UsableItem) + // CancelledItemUseEventArgs ev = new(ReferenceHub, UsableItem) new(OpCodes.Newobj, GetDeclaredConstructors(typeof(CancelledItemUseEventArgs))[0]), - // Handlers.Player.OnCancellingItemUse(ev) + // Handlers.Player.OnCancelledItemUse(ev) new(OpCodes.Call, Method(typeof(Handlers.Player), nameof(Handlers.Player.OnCancelledItemUse))), - });*/ + }); newInstructions[newInstructions.Count - 1].WithLabels(returnLabel); From ba6d2ce64d2e72e68d6eb9c091a768a86f871f80 Mon Sep 17 00:00:00 2001 From: Yamato Date: Sun, 6 Apr 2025 20:03:04 +0200 Subject: [PATCH 20/70] Fix an issue where HashSetPool was never return --- .../Events/Map/ExplodingFragGrenade.cs | 83 +++++++++++-------- 1 file changed, 48 insertions(+), 35 deletions(-) diff --git a/EXILED/Exiled.Events/Patches/Events/Map/ExplodingFragGrenade.cs b/EXILED/Exiled.Events/Patches/Events/Map/ExplodingFragGrenade.cs index e29c8c621e..b65661b3e4 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/ExplodingFragGrenade.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/ExplodingFragGrenade.cs @@ -61,54 +61,67 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); - int offset = 1; - int index = newInstructions.FindIndex(i => i.opcode == OpCodes.Stloc_3) + offset; + int offset = 2; + int index = newInstructions.FindIndex(i => i.opcode == OpCodes.Ldloc_S && i.operand is LocalBuilder { LocalIndex: 5 }) + offset; - Label returnLabel = generator.DefineLabel(); + Log.Warn($"INDEX OF EXPLODING GRENADE: {index}"); + Label continueLabel = generator.DefineLabel(); LocalBuilder ev = generator.DeclareLocal(typeof(ExplodingGrenadeEventArgs)); - newInstructions.InsertRange( - index, - new CodeInstruction[] - { - // attacker; - new(OpCodes.Ldarg_0), + newInstructions.InsertRange(index, new CodeInstruction[] + { + // attacker; + new(OpCodes.Ldarg_0), + + // position + new(OpCodes.Ldarg_1), - // position - new(OpCodes.Ldarg_1), + // grenade + new(OpCodes.Ldarg_2), - // grenade - new(OpCodes.Ldarg_2), + // Collider[] + new(OpCodes.Ldloc_S, 5), - // Collider[] - new(OpCodes.Ldloc_3), + // explosionType + new(OpCodes.Ldarg_3), - // explosionType - new(OpCodes.Ldarg_3), + // ExplodingGrenadeEventArgs ev = new(Footprint, position, grenade, colliders, ExplosionType); + new(OpCodes.Newobj, DeclaredConstructor(typeof(ExplodingGrenadeEventArgs), new[] { typeof(Footprint), typeof(Vector3), typeof(ExplosionGrenade), typeof(Collider[]), typeof(ExplosionType) })), + new(OpCodes.Dup), + new(OpCodes.Dup), + new(OpCodes.Stloc, ev.LocalIndex), - // ExplodingGrenadeEventArgs ev = new(player, position, grenade, colliders, ExplosionType); - new(OpCodes.Newobj, DeclaredConstructor(typeof(ExplodingGrenadeEventArgs), new[] { typeof(Footprint), typeof(Vector3), typeof(ExplosionGrenade), typeof(Collider[]), typeof(ExplosionType) })), - new(OpCodes.Dup), - new(OpCodes.Dup), - new(OpCodes.Stloc, ev.LocalIndex), + // Map.OnExplodingGrenade(ev); + new(OpCodes.Call, Method(typeof(Handlers.Map), nameof(Handlers.Map.OnExplodingGrenade))), - // Map.OnExplodingGrenade(ev); - new(OpCodes.Call, Method(typeof(Handlers.Map), nameof(Handlers.Map.OnExplodingGrenade))), + // if (!ev.IsAllowed) + // return; + new(OpCodes.Callvirt, PropertyGetter(typeof(ExplodingGrenadeEventArgs), nameof(ExplodingGrenadeEventArgs.IsAllowed))), + new(OpCodes.Brtrue_S, continueLabel), - // if (!ev.IsAllowed) - // return; - new(OpCodes.Callvirt, PropertyGetter(typeof(ExplodingGrenadeEventArgs), nameof(ExplodingGrenadeEventArgs.IsAllowed))), - new(OpCodes.Brfalse, returnLabel), + // HashSetPool.Shared.Return(hashSet); + new(OpCodes.Ldsfld, Field(typeof(NorthwoodLib.Pools.HashSetPool), nameof(NorthwoodLib.Pools.HashSetPool.Shared))), + new(OpCodes.Ldloc_2), + new(OpCodes.Callvirt, Method(typeof(NorthwoodLib.Pools.HashSetPool), nameof(NorthwoodLib.Pools.HashSetPool.Return))), - // colliders = TrimColliders(ev, colliders) - new(OpCodes.Ldloc, ev.LocalIndex), - new(OpCodes.Ldloc_3), - new(OpCodes.Call, Method(typeof(ExplodingFragGrenade), nameof(TrimColliders))), - new(OpCodes.Stloc_3), - }); + // HashSetPool.Shared.Return(hashSet2); + new(OpCodes.Ldsfld, Field(typeof(NorthwoodLib.Pools.HashSetPool), nameof(NorthwoodLib.Pools.HashSetPool.Shared))), + new(OpCodes.Ldloc_3), + new(OpCodes.Callvirt, Method(typeof(NorthwoodLib.Pools.HashSetPool), nameof(NorthwoodLib.Pools.HashSetPool.Return))), - newInstructions[newInstructions.Count - 1].labels.Add(returnLabel); + // return; + new(OpCodes.Ret), + + // colliders = TrimColliders(ev, colliders) + new CodeInstruction(OpCodes.Ldloc, ev.LocalIndex).WithLabels(continueLabel), + new(OpCodes.Ldloc_S, 5), + new(OpCodes.Call, Method(typeof(ExplodingFragGrenade), nameof(TrimColliders))), + new(OpCodes.Stloc_S, 5), + }); + + for (int z = 0; z < newInstructions.Count; z++) + Log.Info($"[{z}]{newInstructions[z].opcode} : {newInstructions[z].operand} ({newInstructions[z].labels.Count})"); for (int z = 0; z < newInstructions.Count; z++) yield return newInstructions[z]; From bf437c5fcac698391da0f9ec2948fd842ea11a32 Mon Sep 17 00:00:00 2001 From: Yamato Date: Mon, 7 Apr 2025 01:16:56 +0200 Subject: [PATCH 21/70] Fix IL CODE error & remove debug --- .../Patches/Events/Map/ExplodingFragGrenade.cs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/EXILED/Exiled.Events/Patches/Events/Map/ExplodingFragGrenade.cs b/EXILED/Exiled.Events/Patches/Events/Map/ExplodingFragGrenade.cs index b65661b3e4..ad35198c58 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/ExplodingFragGrenade.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/ExplodingFragGrenade.cs @@ -61,10 +61,9 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); - int offset = 2; - int index = newInstructions.FindIndex(i => i.opcode == OpCodes.Ldloc_S && i.operand is LocalBuilder { LocalIndex: 5 }) + offset; + int offset = 1; + int index = newInstructions.FindIndex(i => i.opcode == OpCodes.Stloc_S && i.operand is LocalBuilder { LocalIndex: 5 }) + offset; - Log.Warn($"INDEX OF EXPLODING GRENADE: {index}"); Label continueLabel = generator.DefineLabel(); LocalBuilder ev = generator.DeclareLocal(typeof(ExplodingGrenadeEventArgs)); @@ -120,9 +119,6 @@ private static IEnumerable Transpiler(IEnumerable Date: Mon, 7 Apr 2025 01:45:00 +0200 Subject: [PATCH 22/70] Add warning in case of missing PrefabType --- EXILED/Exiled.API/Enums/AdminToyType.cs | 5 ++++ EXILED/Exiled.API/Enums/PrefabType.cs | 9 +++++++ .../Handlers/Internal/ClientStarted.cs | 25 ++++++++++++++++--- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/EXILED/Exiled.API/Enums/AdminToyType.cs b/EXILED/Exiled.API/Enums/AdminToyType.cs index c7f937721a..1ca81b5e01 100644 --- a/EXILED/Exiled.API/Enums/AdminToyType.cs +++ b/EXILED/Exiled.API/Enums/AdminToyType.cs @@ -32,5 +32,10 @@ public enum AdminToyType /// Speaker toy. /// Speaker, + + /// + /// Capybara toy. + /// + Capybara, } } \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/PrefabType.cs b/EXILED/Exiled.API/Enums/PrefabType.cs index 7ec8a851c3..4296de63db 100644 --- a/EXILED/Exiled.API/Enums/PrefabType.cs +++ b/EXILED/Exiled.API/Enums/PrefabType.cs @@ -336,5 +336,14 @@ public enum PrefabType [Prefab(912031041, "ElevatorChamberNuke")] ElevatorChamberNuke, + + [Prefab(3087007600, "CapybaraToy")] + CapybaraToy, + + [Prefab(3539746802, "Sinkhole")] + Sinkhole, + + [Prefab(1548138668, "AutoRagdoll")] + AutoRagdoll, } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/Handlers/Internal/ClientStarted.cs b/EXILED/Exiled.Events/Handlers/Internal/ClientStarted.cs index a260cf4957..8115dc4e65 100644 --- a/EXILED/Exiled.Events/Handlers/Internal/ClientStarted.cs +++ b/EXILED/Exiled.Events/Handlers/Internal/ClientStarted.cs @@ -33,21 +33,38 @@ public static void OnClientStarted() foreach (KeyValuePair prefab in NetworkClient.prefabs) { - if(!prefabs.ContainsKey(prefab.Key)) + if (!prefabs.ContainsKey(prefab.Key)) prefabs.Add(prefab.Key, prefab.Value); } foreach (NetworkIdentity ragdollPrefab in RagdollManager.AllRagdollPrefabs) { - if(!prefabs.ContainsKey(ragdollPrefab.assetId)) + if (!prefabs.ContainsKey(ragdollPrefab.assetId)) prefabs.Add(ragdollPrefab.assetId, ragdollPrefab.gameObject); } - foreach (PrefabType prefabType in EnumUtils.Values) + for (int i = 0; i < EnumUtils.Values.Length; i++) { + PrefabType prefabType = EnumUtils.Values[i]; PrefabAttribute attribute = prefabType.GetPrefabAttribute(); - PrefabHelper.Prefabs.Add(prefabType, prefabs.FirstOrDefault(prefab => prefab.Key == attribute.AssetId || prefab.Value.name.Contains(attribute.Name)).Value); + if (prefabs.TryGetValue(attribute.AssetId, out GameObject gameObject)) + { + PrefabHelper.Prefabs.Add(prefabType, gameObject); + prefabs.Remove(attribute.AssetId); + continue; + } + + KeyValuePair? value = prefabs.FirstOrDefault(x => x.Value.name == attribute.Name); + if (value.HasValue) + { + PrefabHelper.Prefabs.Add(prefabType, gameObject); + prefabs.Remove(value.Value.Key); + continue; + } } + + foreach (KeyValuePair missing in prefabs) + Log.Warn($"Missing prefab in {nameof(PrefabType)}: {missing.Value.name} ({missing.Key})"); } } } \ No newline at end of file From a28431529cca2b251720d7692addf7732a8e7efc Mon Sep 17 00:00:00 2001 From: Yamato Date: Mon, 7 Apr 2025 01:52:48 +0200 Subject: [PATCH 23/70] Capybara Toy --- EXILED/Exiled.API/Features/Toys/AdminToy.cs | 1 + EXILED/Exiled.API/Features/Toys/Capybara.cs | 50 +++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 EXILED/Exiled.API/Features/Toys/Capybara.cs diff --git a/EXILED/Exiled.API/Features/Toys/AdminToy.cs b/EXILED/Exiled.API/Features/Toys/AdminToy.cs index a3ffa539cd..19fd51f9ca 100644 --- a/EXILED/Exiled.API/Features/Toys/AdminToy.cs +++ b/EXILED/Exiled.API/Features/Toys/AdminToy.cs @@ -166,6 +166,7 @@ public static AdminToy Get(AdminToyBase adminToyBase) PrimitiveObjectToy primitiveObjectToy => new Primitive(primitiveObjectToy), ShootingTarget shootingTarget => new ShootingTargetToy(shootingTarget), SpeakerToy speakerToy => new Speaker(speakerToy), + CapybaraToy capybaraToy => new Capybara(capybaraToy), _ => throw new System.NotImplementedException() }; } diff --git a/EXILED/Exiled.API/Features/Toys/Capybara.cs b/EXILED/Exiled.API/Features/Toys/Capybara.cs new file mode 100644 index 0000000000..6a3ad51056 --- /dev/null +++ b/EXILED/Exiled.API/Features/Toys/Capybara.cs @@ -0,0 +1,50 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Toys +{ + using System.Collections.Generic; + + using AdminToys; + using Enums; + using Exiled.API.Interfaces; + using UnityEngine; + using VoiceChat.Networking; + using VoiceChat.Playbacks; + + /// + /// A wrapper class for . + /// + public class Capybara : AdminToy, IWrapper + { + /// + /// Initializes a new instance of the class. + /// + /// The of the toy. + internal Capybara(CapybaraToy speakerToy) + : base(speakerToy, AdminToyType.Speaker) => Base = speakerToy; + + /// + /// Gets the prefab. + /// + public static CapybaraToy Prefab => PrefabHelper.GetPrefab(PrefabType.CapybaraToy); + + /// + /// Gets the base . + /// + public CapybaraToy Base { get; } + + /// + /// Gets or sets a value indicating whether the capybara can be collided with. + /// + public bool Collidable + { + get => Base.Network_collisionsEnabled; + set => Base.Network_collisionsEnabled = value; + } + } +} From 4a807e43d21ea046b5ccd40483f45f7ca7919227 Mon Sep 17 00:00:00 2001 From: Yamato Date: Mon, 7 Apr 2025 02:06:58 +0200 Subject: [PATCH 24/70] remove using --- EXILED/Exiled.API/Features/Toys/Capybara.cs | 5 ----- 1 file changed, 5 deletions(-) diff --git a/EXILED/Exiled.API/Features/Toys/Capybara.cs b/EXILED/Exiled.API/Features/Toys/Capybara.cs index 6a3ad51056..b88dbfd9c8 100644 --- a/EXILED/Exiled.API/Features/Toys/Capybara.cs +++ b/EXILED/Exiled.API/Features/Toys/Capybara.cs @@ -7,14 +7,9 @@ namespace Exiled.API.Features.Toys { - using System.Collections.Generic; - using AdminToys; using Enums; using Exiled.API.Interfaces; - using UnityEngine; - using VoiceChat.Networking; - using VoiceChat.Playbacks; /// /// A wrapper class for . From 883218f3189c2002ab1de90ea8116278bd601405 Mon Sep 17 00:00:00 2001 From: Yamato Date: Mon, 7 Apr 2025 10:38:51 +0200 Subject: [PATCH 25/70] Fix SpawningRagdoll not setting NetworkInfo --- .../Patches/Events/Player/SpawningRagdoll.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/EXILED/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs b/EXILED/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs index 21c44aa091..413e29bc51 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs @@ -57,7 +57,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Date: Mon, 7 Apr 2025 11:18:33 +0200 Subject: [PATCH 26/70] Fix Ragdoll Scale & ConsumingEvent --- EXILED/Exiled.API/Features/Ragdoll.cs | 15 ++++++++++++--- .../EventArgs/Player/SpawningRagdollEventArgs.cs | 4 ++-- .../EventArgs/Scp0492/ConsumingCorpseEventArgs.cs | 4 +--- .../Patches/Events/Scp0492/Consuming.cs | 15 ++++++--------- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/EXILED/Exiled.API/Features/Ragdoll.cs b/EXILED/Exiled.API/Features/Ragdoll.cs index 8cde5d8cb2..01b9a10b73 100644 --- a/EXILED/Exiled.API/Features/Ragdoll.cs +++ b/EXILED/Exiled.API/Features/Ragdoll.cs @@ -145,7 +145,16 @@ public bool CanBeCleanedUp public string Nickname { get => NetworkInfo.Nickname; - set => NetworkInfo = new(NetworkInfo.OwnerHub, NetworkInfo.Handler, NetworkInfo.RoleType, NetworkInfo.StartPosition, NetworkInfo.StartRotation, value, NetworkInfo.CreationTime); + set => NetworkInfo = new(NetworkInfo.OwnerHub, NetworkInfo.Handler, NetworkInfo.RoleType, NetworkInfo.StartPosition, NetworkInfo.StartRotation, NetworkInfo.Scale, value, NetworkInfo.CreationTime); + } + + /// + /// Gets or sets the ragdoll's Scale with RagdollData. + /// + public Vector3 Scale + { + get => NetworkInfo.Scale; + set => NetworkInfo = new(NetworkInfo.OwnerHub, NetworkInfo.Handler, NetworkInfo.RoleType, NetworkInfo.StartPosition, NetworkInfo.StartRotation, value, NetworkInfo.Nickname, NetworkInfo.CreationTime); } /// @@ -248,9 +257,9 @@ public Quaternion Rotation } /// - /// Gets or sets the ragdoll's scale. + /// Gets or sets the ragdoll's as Gameobjectscale. /// - public Vector3 Scale + public Vector3 RagdollScale { get => Base.transform.localScale; set diff --git a/EXILED/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs index a925a3b8bf..9ec7423835 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs @@ -63,13 +63,13 @@ public Quaternion Rotation public Vector3 Scale { get => Info.Scale; - set => Info = new RagdollData(Player.ReferenceHub, DamageHandlerBase, Role, Position, Rotation, value, Nickname, CreationTime); + set => Info = new RagdollData(Player.ReferenceHub, DamageHandlerBase, Role, Position, Rotation, Vector3.Scale(value, RagdollManager.GetDefaultScale(Role)), Nickname, CreationTime); } /// /// Gets or sets the ragdoll's scale with GameObject. /// - public Vector3 RagdollScale { get; set; } + public Vector3 RagdollScale { get; set; } = Vector3.one; /// /// Gets or sets the ragdoll's . diff --git a/EXILED/Exiled.Events/EventArgs/Scp0492/ConsumingCorpseEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp0492/ConsumingCorpseEventArgs.cs index 008ef83591..06de15a086 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp0492/ConsumingCorpseEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp0492/ConsumingCorpseEventArgs.cs @@ -25,10 +25,8 @@ public class ConsumingCorpseEventArgs : IScp0492Event, IRagdollEvent, IDeniableE /// /// /// - /// /// See for all ragdolls consumed. - // TODO: remove isAllowed argument - public ConsumingCorpseEventArgs(ReferenceHub player, BasicRagdoll ragDoll, ZombieConsumeAbility.ConsumeError error, bool isAllowed = true) + public ConsumingCorpseEventArgs(ReferenceHub player, BasicRagdoll ragDoll, ZombieConsumeAbility.ConsumeError error) { Player = Player.Get(player); Scp0492 = Player.Role.As(); diff --git a/EXILED/Exiled.Events/Patches/Events/Scp0492/Consuming.cs b/EXILED/Exiled.Events/Patches/Events/Scp0492/Consuming.cs index 9f0d5fa849..5422d0b2e2 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp0492/Consuming.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp0492/Consuming.cs @@ -35,8 +35,8 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); - int offset = 0; - int index = newInstructions.FindLastIndex(i => i.opcode == OpCodes.Ldc_I4_0) + offset; + int offset = 1; + int index = newInstructions.FindLastIndex(i => i.opcode == OpCodes.Endfinally) + offset; newInstructions.InsertRange(index, new CodeInstruction[] { @@ -47,13 +47,10 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Date: Mon, 7 Apr 2025 11:19:33 +0200 Subject: [PATCH 27/70] Missing NetworkInfo.Scale Argument --- EXILED/Exiled.API/Features/Ragdoll.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/EXILED/Exiled.API/Features/Ragdoll.cs b/EXILED/Exiled.API/Features/Ragdoll.cs index 01b9a10b73..011c092248 100644 --- a/EXILED/Exiled.API/Features/Ragdoll.cs +++ b/EXILED/Exiled.API/Features/Ragdoll.cs @@ -101,7 +101,7 @@ public RagdollData NetworkInfo public DamageHandlerBase DamageHandler { get => NetworkInfo.Handler; - set => NetworkInfo = new(NetworkInfo.OwnerHub, value, NetworkInfo.RoleType, NetworkInfo.StartPosition, NetworkInfo.StartRotation, NetworkInfo.Nickname, NetworkInfo.CreationTime); + set => NetworkInfo = new(NetworkInfo.OwnerHub, value, NetworkInfo.RoleType, NetworkInfo.StartPosition, NetworkInfo.StartRotation, NetworkInfo.Scale, NetworkInfo.Nickname, NetworkInfo.CreationTime); } /// @@ -168,7 +168,7 @@ public Vector3 Scale public Player Owner { get => Player.Get(NetworkInfo.OwnerHub); - set => NetworkInfo = new(value.ReferenceHub, NetworkInfo.Handler, NetworkInfo.RoleType, NetworkInfo.StartPosition, NetworkInfo.StartRotation, NetworkInfo.Nickname, NetworkInfo.CreationTime); + set => NetworkInfo = new(value.ReferenceHub, NetworkInfo.Handler, NetworkInfo.RoleType, NetworkInfo.StartPosition, NetworkInfo.StartRotation, NetworkInfo.Scale, NetworkInfo.Nickname, NetworkInfo.CreationTime); } /// @@ -180,7 +180,7 @@ public DateTime CreationTime set { float creationTime = (float)(NetworkTime.time - (DateTime.Now - value).TotalSeconds); - NetworkInfo = new RagdollData(NetworkInfo.OwnerHub, NetworkInfo.Handler, NetworkInfo.RoleType, NetworkInfo.StartPosition, NetworkInfo.StartRotation, NetworkInfo.Nickname, creationTime); + NetworkInfo = new RagdollData(NetworkInfo.OwnerHub, NetworkInfo.Handler, NetworkInfo.RoleType, NetworkInfo.StartPosition, NetworkInfo.StartRotation, NetworkInfo.Scale, NetworkInfo.Nickname, creationTime); } } @@ -190,7 +190,7 @@ public DateTime CreationTime public RoleTypeId Role { get => NetworkInfo.RoleType; - set => NetworkInfo = new(NetworkInfo.OwnerHub, NetworkInfo.Handler, value, NetworkInfo.StartPosition, NetworkInfo.StartRotation, NetworkInfo.Nickname, NetworkInfo.CreationTime); + set => NetworkInfo = new(NetworkInfo.OwnerHub, NetworkInfo.Handler, value, NetworkInfo.StartPosition, NetworkInfo.StartRotation, NetworkInfo.Scale, NetworkInfo.Nickname, NetworkInfo.CreationTime); } /// From 154feb67760c0de2672a687921717d05c74c8ac2 Mon Sep 17 00:00:00 2001 From: Yamato Date: Mon, 7 Apr 2025 11:42:17 +0200 Subject: [PATCH 28/70] Fix: Door.Get(GameObject) --- EXILED/Exiled.API/Features/Doors/Door.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/Exiled.API/Features/Doors/Door.cs b/EXILED/Exiled.API/Features/Doors/Door.cs index fb947039dc..32fc4e1616 100644 --- a/EXILED/Exiled.API/Features/Doors/Door.cs +++ b/EXILED/Exiled.API/Features/Doors/Door.cs @@ -357,7 +357,7 @@ public static T Get(string name) /// /// The base-game . /// The with the given name or if not found. - public static Door Get(GameObject gameObject) => gameObject is null ? null : Get(gameObject.GetComponentInChildren()); + public static Door Get(GameObject gameObject) => gameObject is null ? null : Get(gameObject.GetComponentInParent()); /// /// Returns the closest to the given . From 6ae1304eea62d2249e713fd1336ee968de0a11cf Mon Sep 17 00:00:00 2001 From: Yamato Date: Mon, 7 Apr 2025 11:52:55 +0200 Subject: [PATCH 29/70] TantrumHazard is always null --- .../EventArgs/Scp173/PlacingTantrumEventArgs.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/EXILED/Exiled.Events/EventArgs/Scp173/PlacingTantrumEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp173/PlacingTantrumEventArgs.cs index 459befc3b5..70ed06bdf4 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp173/PlacingTantrumEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp173/PlacingTantrumEventArgs.cs @@ -7,6 +7,8 @@ namespace Exiled.Events.EventArgs.Scp173 { + using System; + using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; @@ -39,7 +41,9 @@ public PlacingTantrumEventArgs(Player player, TantrumEnvironmentalHazard tantrum { Player = player; Scp173 = Player.Role.As(); +#pragma warning disable CS0618 TantrumHazard = tantrumHazard; +#pragma warning restore CS0618 Cooldown = cooldown; IsAllowed = isAllowed; } @@ -52,6 +56,7 @@ public PlacingTantrumEventArgs(Player player, TantrumEnvironmentalHazard tantrum /// /// Gets the . /// + [Obsolete("This propperty is always null")] public TantrumEnvironmentalHazard TantrumHazard { get; } /// From 73726f70670a0768ab571a44cc3ff38e3e26026c Mon Sep 17 00:00:00 2001 From: Yamato Date: Mon, 7 Apr 2025 11:53:05 +0200 Subject: [PATCH 30/70] 9.6.0-beta5 --- EXILED/EXILED.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/EXILED.props b/EXILED/EXILED.props index ffd4802dd7..41070ca1d0 100644 --- a/EXILED/EXILED.props +++ b/EXILED/EXILED.props @@ -15,7 +15,7 @@ - 9.6.0-beta4 + 9.6.0-beta5 false From c577619e0c13e08273d405a585874d4b8e4cae81 Mon Sep 17 00:00:00 2001 From: Yamato Date: Mon, 7 Apr 2025 12:45:11 +0200 Subject: [PATCH 31/70] Update EXILED_DLL_ARCHIVER_URL for LabAPI --- .github/workflows/labapi.yml | 2 +- .github/workflows/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/labapi.yml b/.github/workflows/labapi.yml index 0e950dea97..61e302071b 100644 --- a/.github/workflows/labapi.yml +++ b/.github/workflows/labapi.yml @@ -16,7 +16,7 @@ defaults: env: EXILED_REFERENCES_URL: https://exmod-team.github.io/SL-References/LabAPI.zip EXILED_REFERENCES_PATH: ${{ github.workspace }}/EXILED/References - EXILED_DLL_ARCHIVER_URL: https://github.com/ExMod-Team/EXILED-DLL-Archiver/releases/download/v1.8.0/EXILED-DLL-Archiver.exe + EXILED_DLL_ARCHIVER_URL: https://github.com/ExMod-Team/EXILED-DLL-Archiver/releases/download/v1.8.1/EXILED-DLL-Archiver.exe jobs: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d8be33cb91..3f5bee1900 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,7 +13,7 @@ defaults: env: EXILED_REFERENCES_URL: https://exmod-team.github.io/SL-References/LabAPI.zip EXILED_REFERENCES_PATH: ${{ github.workspace }}/EXILED/References - EXILED_DLL_ARCHIVER_URL: https://github.com/ExMod-Team/EXILED-DLL-Archiver/releases/download/v1.8.0/EXILED-DLL-Archiver.exe + EXILED_DLL_ARCHIVER_URL: https://github.com/ExMod-Team/EXILED-DLL-Archiver/releases/download/v1.8.1/EXILED-DLL-Archiver.exe jobs: build: From 75677026aaa8e7fb1ea1f4ab1d062b4b68dc20b4 Mon Sep 17 00:00:00 2001 From: Nameless <85962933+Misfiy@users.noreply.github.com> Date: Sat, 19 Apr 2025 19:20:16 +0200 Subject: [PATCH 32/70] fix: use basegame validation for CustomInfo (#452) * Validate using basegame * Update EXILED/Exiled.API/Features/Player.cs --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> --- EXILED/Exiled.API/Features/Player.cs | 32 ++-------------------------- 1 file changed, 2 insertions(+), 30 deletions(-) diff --git a/EXILED/Exiled.API/Features/Player.cs b/EXILED/Exiled.API/Features/Player.cs index a7e957218c..c6ba920a42 100644 --- a/EXILED/Exiled.API/Features/Player.cs +++ b/EXILED/Exiled.API/Features/Player.cs @@ -348,37 +348,9 @@ public string CustomInfo get => ReferenceHub.nicknameSync.Network_customPlayerInfoString; set { - // NW Client check. - if (value.Contains('<')) + if (NicknameSync.ValidateCustomInfo(value, out string rejectionText)) { - foreach (string token in value.Split('<')) - { - if (token.StartsWith("/", StringComparison.Ordinal) || - token.StartsWith("b>", StringComparison.Ordinal) || - token.StartsWith("i>", StringComparison.Ordinal) || - token.StartsWith("size=", StringComparison.Ordinal) || - token.Length is 0) - continue; - - if (token.StartsWith("color=", StringComparison.Ordinal)) - { - if (token.Length < 14 || token[13] != '>') - Log.Error($"Custom info of player {Nickname} has been REJECTED. \nreason: (Bad text reject) \ntoken: {token} \nInfo: {value}"); - else if (!Misc.AllowedColors.ContainsValue(token.Substring(6, 7))) - Log.Error($"Custom info of player {Nickname} has been REJECTED. \nreason: (Bad color reject) \ntoken: {token} \nInfo: {value}"); - } - else if (token.StartsWith("#", StringComparison.Ordinal)) - { - if (token.Length < 8 || token[7] != '>') - Log.Error($"Custom info of player {Nickname} has been REJECTED. \nreason: (Bad text reject) \ntoken: {token} \nInfo: {value}"); - else if (!Misc.AllowedColors.ContainsValue(token.Substring(0, 7))) - Log.Error($"Custom info of player {Nickname} has been REJECTED. \nreason: (Bad color reject) \ntoken: {token} \nInfo: {value}"); - } - else - { - Log.Error($"Custom info of player {Nickname} has been REJECTED. \nreason: (Bad color reject) \ntoken: {token} \nInfo: {value}"); - } - } + Log.Error($"Could not set CustomInfo for {Nickname}. Reason: {rejectionText}"); } InfoArea = string.IsNullOrEmpty(value) ? InfoArea & ~PlayerInfoArea.CustomInfo : InfoArea |= PlayerInfoArea.CustomInfo; From ae03b8bd0bee9c95bc976b3be2f9e448dd670bee Mon Sep 17 00:00:00 2001 From: SlejmUr Date: Mon, 21 Apr 2025 10:02:14 +0200 Subject: [PATCH 33/70] feat: Custom limits for armor & virtual dmg for customweapon (#477) --- .../API/Features/CustomArmor.cs | 19 +++++++++++++++++++ .../API/Features/CustomWeapon.cs | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/EXILED/Exiled.CustomItems/API/Features/CustomArmor.cs b/EXILED/Exiled.CustomItems/API/Features/CustomArmor.cs index f87d473783..e6f1932905 100644 --- a/EXILED/Exiled.CustomItems/API/Features/CustomArmor.cs +++ b/EXILED/Exiled.CustomItems/API/Features/CustomArmor.cs @@ -8,13 +8,16 @@ namespace Exiled.CustomItems.API.Features { using System; + using System.Collections.Generic; using System.ComponentModel; using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Items; + using Exiled.API.Structs; using Exiled.Events.EventArgs.Player; + using InventorySystem.Items.Armor; using MEC; /// @@ -55,6 +58,16 @@ public override ItemType Type [Description("The value must be above 0 and below 100")] public virtual int VestEfficacy { get; set; } = 80; + /// + /// Gets or sets the Ammunition limit the player have. + /// + public virtual List AmmoLimits { get; set; } = new(); + + /// + /// Gets or sets the Item Category limit the player have. + /// + public virtual List CategoryLimits { get; set; } = new(); + /// public override void Give(Player player, bool displayMessage = true) { @@ -66,6 +79,12 @@ public override void Give(Player player, bool displayMessage = true) armor.VestEfficacy = VestEfficacy; armor.HelmetEfficacy = HelmetEfficacy; + if (AmmoLimits.Count != 0) + armor.AmmoLimits = AmmoLimits; + + if (AmmoLimits.Count != 0) + armor.CategoryLimits = CategoryLimits; + player.AddItem(armor); TrackedSerials.Add(armor.Serial); diff --git a/EXILED/Exiled.CustomItems/API/Features/CustomWeapon.cs b/EXILED/Exiled.CustomItems/API/Features/CustomWeapon.cs index e775ee3e9f..68fe0103e7 100644 --- a/EXILED/Exiled.CustomItems/API/Features/CustomWeapon.cs +++ b/EXILED/Exiled.CustomItems/API/Features/CustomWeapon.cs @@ -52,7 +52,7 @@ public override ItemType Type /// /// Gets or sets the weapon damage. /// - public abstract float Damage { get; set; } + public virtual float Damage { get; set; } = float.NaN; /// /// Gets or sets a value indicating how big of a clip the weapon will have. @@ -205,7 +205,7 @@ protected virtual void OnShot(ShotEventArgs ev) /// . protected virtual void OnHurting(HurtingEventArgs ev) { - if (ev.IsAllowed && Damage > 0f) + if (ev.IsAllowed && Damage != float.NaN) ev.Amount = Damage; } From fb2971f6dcecfb89152774b2fcad59e76e7eb583 Mon Sep 17 00:00:00 2001 From: VALERA771 <72030575+VALERA771@users.noreply.github.com> Date: Fri, 25 Apr 2025 20:12:34 +0300 Subject: [PATCH 34/70] fix: activating warhead panel event fix (#504) fix: fix for activating warhead panel --- .../Patches/Events/Player/ActivatingWarheadPanel.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ActivatingWarheadPanel.cs b/EXILED/Exiled.Events/Patches/Events/Player/ActivatingWarheadPanel.cs index f910b8cb9e..22a210f02f 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ActivatingWarheadPanel.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ActivatingWarheadPanel.cs @@ -45,8 +45,6 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Date: Fri, 25 Apr 2025 22:17:29 +0200 Subject: [PATCH 35/70] Fix Error (from Conflict) --- EXILED/Exiled.API/Features/Map.cs | 2 +- EXILED/Exiled.API/Features/Player.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/EXILED/Exiled.API/Features/Map.cs b/EXILED/Exiled.API/Features/Map.cs index 95888ddd8b..add2a5123b 100644 --- a/EXILED/Exiled.API/Features/Map.cs +++ b/EXILED/Exiled.API/Features/Map.cs @@ -107,7 +107,7 @@ public static bool IsDecontaminationEnabled /// /// Gets the . /// - public static SqueakSpawner SqueakSpawner => squeakSpawner ??= Object.FindObjectOfType(); + public static SqueakSpawner SqueakSpawner => squeakSpawner ??= Object.FindFirstObjectByType(); /// /// Sends a staff message to all players online with permission. diff --git a/EXILED/Exiled.API/Features/Player.cs b/EXILED/Exiled.API/Features/Player.cs index 307618a739..4b2c5ae261 100644 --- a/EXILED/Exiled.API/Features/Player.cs +++ b/EXILED/Exiled.API/Features/Player.cs @@ -180,7 +180,7 @@ private set Inventory = value.inventory; CameraTransform = value.PlayerCameraReference; - value.playerStats._dictionarizedTypes[typeof(HealthStat)] = value.playerStats.StatModules[Array.IndexOf(PlayerStats.DefinedModules, typeof(HealthStat))] = CustomHealthStat = new CustomHealthStat { Hub = value }; + CustomHealthStat = (HealthStat)value.playerStats._dictionarizedTypes[typeof(HealthStat)]; value.playerStats._dictionarizedTypes[typeof(HumeShieldStat)] = value.playerStats.StatModules[Array.IndexOf(PlayerStats.DefinedModules, typeof(HumeShieldStat))] = CustomHumeShieldStat = new CustomHumeShieldStat { Hub = value }; } } @@ -857,7 +857,7 @@ public float Health public float MaxHealth { get => CustomHealthStat.MaxValue; - set => CustomHealthStat.CustomMaxValue = value; + set => CustomHealthStat.MaxValue = value; } /// @@ -913,7 +913,7 @@ public float HumeShield public float MaxHumeShield { get => CustomHumeShieldStat.MaxValue; - set => CustomHumeShieldStat.CustomMaxValue = value; + set => CustomHumeShieldStat.MaxValue = value; } /// @@ -1161,7 +1161,7 @@ public bool IsSpawnProtected /// /// Gets or sets a . /// - protected CustomHealthStat CustomHealthStat { get; set; } + protected HealthStat CustomHealthStat { get; set; } /// /// Converts LabApi player to EXILED player. From 6974b0f22396b16844c3763302ab874993235946 Mon Sep 17 00:00:00 2001 From: Yamato Date: Fri, 25 Apr 2025 22:45:48 +0200 Subject: [PATCH 36/70] Fix doc error --- EXILED/Exiled.API/Features/Npc.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/Exiled.API/Features/Npc.cs b/EXILED/Exiled.API/Features/Npc.cs index 698b74ad80..48fe39a9dc 100644 --- a/EXILED/Exiled.API/Features/Npc.cs +++ b/EXILED/Exiled.API/Features/Npc.cs @@ -36,7 +36,7 @@ namespace Exiled.API.Features public class Npc : Player { /// - /// The time it takes for the NPC to receive its , and . + /// The time it takes for the NPC to receive its and . /// public const float SpawnSetRoleDelay = 0.5f; From 8d66cc9481402feef3325704f60342c980e3ee41 Mon Sep 17 00:00:00 2001 From: Yamato Date: Sat, 26 Apr 2025 00:21:01 +0200 Subject: [PATCH 37/70] Fix few error --- .../Features/Doors/CheckpointDoor.cs | 18 ++++++------ EXILED/Exiled.API/Features/Doors/Door.cs | 24 +++++----------- EXILED/Exiled.API/Features/Generator.cs | 16 ++++++++--- EXILED/Exiled.API/Features/Items/Keycard.cs | 2 +- EXILED/Exiled.API/Features/Npc.cs | 2 +- EXILED/Exiled.API/Features/Roles/FpcRole.cs | 19 ++++++++----- .../Player/SearchingPickupEventArgs.cs | 4 +-- .../Events/Map/SpawningRoomConnector.cs | 28 ------------------- 8 files changed, 44 insertions(+), 69 deletions(-) diff --git a/EXILED/Exiled.API/Features/Doors/CheckpointDoor.cs b/EXILED/Exiled.API/Features/Doors/CheckpointDoor.cs index 06c4f756db..0fa6ea4139 100644 --- a/EXILED/Exiled.API/Features/Doors/CheckpointDoor.cs +++ b/EXILED/Exiled.API/Features/Doors/CheckpointDoor.cs @@ -42,10 +42,10 @@ internal CheckpointDoor(Interactables.Interobjects.CheckpointDoor door, List /// Gets or sets the current checkpoint stage. /// - public Interactables.Interobjects.CheckpointDoor.CheckpointSequenceStage CurrentStage + public Interactables.Interobjects.CheckpointDoor.SequenceState CurrentStage { - get => Base.CurrentSequence; - set => Base.CurrentSequence = value; + get => Base.CurSequence; + set => Base.CurSequence = value; } /// @@ -53,8 +53,8 @@ public Interactables.Interobjects.CheckpointDoor.CheckpointSequenceStage Current /// public float MainTimer { - get => Base.MainTimer; - set => Base.MainTimer = value; + get => Base.SequenceCtrl.RemainingTime; + set => Base.SequenceCtrl.RemainingTime = value; } /// @@ -62,8 +62,8 @@ public float MainTimer /// public float WaitTime { - get => Base.WaitTime; - set => Base.WaitTime = value; + get => Base.SequenceCtrl.OpenLoopTime; + set => Base.SequenceCtrl.OpenLoopTime = value; } /// @@ -71,8 +71,8 @@ public float WaitTime /// public float WarningTime { - get => Base.WarningTime; - set => Base.WarningTime = value; + get => Base.SequenceCtrl.WarningTime; + set => Base.SequenceCtrl.WarningTime = value; } /// diff --git a/EXILED/Exiled.API/Features/Doors/Door.cs b/EXILED/Exiled.API/Features/Doors/Door.cs index 32fc4e1616..3085f6fb4a 100644 --- a/EXILED/Exiled.API/Features/Doors/Door.cs +++ b/EXILED/Exiled.API/Features/Doors/Door.cs @@ -22,7 +22,6 @@ namespace Exiled.API.Features.Doors using UnityEngine; using BaseBreakableDoor = Interactables.Interobjects.BreakableDoor; - using BaseKeycardPermissions = Interactables.Interobjects.DoorUtils.KeycardPermissions; using Breakable = BreakableDoor; using Checkpoint = CheckpointDoor; using Elevator = ElevatorDoor; @@ -181,8 +180,8 @@ public bool IsOpen /// public KeycardPermissions KeycardPermissions { - get => (KeycardPermissions)RequiredPermissions.RequiredPermissions; - set => RequiredPermissions.RequiredPermissions = (BaseKeycardPermissions)value; + get => (KeycardPermissions)Base.RequiredPermissions.RequiredPermissions; + set => Base.RequiredPermissions = new((DoorPermissionFlags)value, Base.RequiredPermissions.RequireAll, Base.RequiredPermissions.Bypass2176); } /// @@ -241,15 +240,6 @@ public DoorLockType DoorLockType /// public string Name => Nametag == null ? GameObject.name.GetBefore(' ') : Nametag.GetName.RemoveBracketsOnEndOfName(); - /// - /// Gets or sets the required permissions to open the door. - /// - public DoorPermissions RequiredPermissions - { - get => Base.RequiredPermissions; - set => Base.RequiredPermissions = value; - } - /// /// Gets or sets the door's rotation. /// @@ -474,11 +464,11 @@ public void PlaySound(DoorBeepType beep) { switch (Base) { - case Interactables.Interobjects.BasicDoor basic: - basic.RpcPlayBeepSound(beep is not DoorBeepType.InteractionAllowed); + case Interactables.Interobjects.BasicDoor basic when beep is not DoorBeepType.InteractionAllowed: + basic.RpcPlayBeepSound(); break; - case Interactables.Interobjects.CheckpointDoor chkPt: - chkPt.RpcPlayBeepSound((byte)Mathf.Min((int)beep, 3)); + case Interactables.Interobjects.CheckpointDoor chkPt when beep is not DoorBeepType.InteractionAllowed: + chkPt.RpcPlayDeniedBeep(); break; } } @@ -553,7 +543,7 @@ public void Lock(DoorLockType lockType) /// Returns the Door in a human-readable format. /// /// A string containing Door-related data. - public override string ToString() => $"{Type} ({Zone}) [{Room}] *{DoorLockType}* ={RequiredPermissions?.RequiredPermissions}="; + public override string ToString() => $"{Type} ({Zone}) [{Room}] *{DoorLockType}* ={KeycardPermissions}="; /// /// Creates the door object associated with a specific . diff --git a/EXILED/Exiled.API/Features/Generator.cs b/EXILED/Exiled.API/Features/Generator.cs index 7b8a6b6baf..ae989736f5 100644 --- a/EXILED/Exiled.API/Features/Generator.cs +++ b/EXILED/Exiled.API/Features/Generator.cs @@ -13,7 +13,7 @@ namespace Exiled.API.Features using Enums; using Exiled.API.Interfaces; - + using Interactables.Interobjects.DoorUtils; using MapGeneration.Distributors; using UnityEngine; @@ -216,7 +216,7 @@ public Player LastActivator public KeycardPermissions KeycardPermissions { get => (KeycardPermissions)Base._requiredPermission; - set => Base._requiredPermission = (Interactables.Interobjects.DoorUtils.KeycardPermissions)value; + set => Base._requiredPermission = (DoorPermissionFlags)value; } /// @@ -281,7 +281,15 @@ public static bool TryGet(Func predicate, out IEnumerable /// Denies the unlock. /// - public void DenyUnlock() => Base.RpcDenied(); + public void DenyUnlock() => Base.RpcDenied(Interactables.Interobjects.DoorUtils.DoorPermissionFlags.None); + + // TODO: Documentation + + /// + /// Denies the unlock. + /// + /// . + public void DenyUnlock(KeycardPermissions doorPermission) => Base.RpcDenied((Interactables.Interobjects.DoorUtils.DoorPermissionFlags)doorPermission); /// /// Denies the unlock and resets the interaction cooldown. @@ -299,7 +307,7 @@ public void DenyUnlockAndResetCooldown() /// A value indicating whether the flag is enabled. public void SetPermissionFlag(KeycardPermissions flag, bool isEnabled) { - Interactables.Interobjects.DoorUtils.KeycardPermissions permission = (Interactables.Interobjects.DoorUtils.KeycardPermissions)flag; + DoorPermissionFlags permission = (DoorPermissionFlags)flag; if (isEnabled) Base._requiredPermission |= permission; diff --git a/EXILED/Exiled.API/Features/Items/Keycard.cs b/EXILED/Exiled.API/Features/Items/Keycard.cs index 0bd390018b..97adf63067 100644 --- a/EXILED/Exiled.API/Features/Items/Keycard.cs +++ b/EXILED/Exiled.API/Features/Items/Keycard.cs @@ -49,7 +49,7 @@ internal Keycard(ItemType type) /// public KeycardPermissions Permissions { - get => (KeycardPermissions)Base.Permissions; + get => (KeycardPermissions)Base.GetPermissions(new()); set => Base.Permissions = (Interactables.Interobjects.DoorUtils.KeycardPermissions)value; } diff --git a/EXILED/Exiled.API/Features/Npc.cs b/EXILED/Exiled.API/Features/Npc.cs index 48fe39a9dc..127ec1c629 100644 --- a/EXILED/Exiled.API/Features/Npc.cs +++ b/EXILED/Exiled.API/Features/Npc.cs @@ -263,7 +263,7 @@ public static Npc Spawn(string name, RoleTypeId role, Vector3 position) { npc.Role.Set(role, SpawnReason.ForceClass); npc.Position = position; - npc.ReferenceHub.playerStats._dictionarizedTypes[typeof(HealthStat)] = npc.ReferenceHub.playerStats.StatModules[Array.IndexOf(PlayerStats.DefinedModules, typeof(HealthStat))] = npc.CustomHealthStat = new CustomHealthStat { Hub = npc.ReferenceHub }; + npc.CustomHealthStat = (HealthStat)npc.ReferenceHub.playerStats._dictionarizedTypes[typeof(HealthStat)]; npc.Health = npc.MaxHealth; // otherwise the npc will spawn with 0 health npc.ReferenceHub.playerStats._dictionarizedTypes[typeof(HumeShieldStat)] = npc.ReferenceHub.playerStats.StatModules[Array.IndexOf(PlayerStats.DefinedModules, typeof(HumeShieldStat))] = npc.CustomHumeShieldStat = new CustomHumeShieldStat { Hub = npc.ReferenceHub }; }); diff --git a/EXILED/Exiled.API/Features/Roles/FpcRole.cs b/EXILED/Exiled.API/Features/Roles/FpcRole.cs index fc041ff513..6a0c0fa49a 100644 --- a/EXILED/Exiled.API/Features/Roles/FpcRole.cs +++ b/EXILED/Exiled.API/Features/Roles/FpcRole.cs @@ -27,7 +27,7 @@ namespace Exiled.API.Features.Roles /// public abstract class FpcRole : Role, IVoiceRole { - private static FieldInfo enableFallDamageField; + private static FieldInfo enableFallDamageSettings; private bool isUsingStamina = true; /// @@ -82,12 +82,17 @@ public Vector3 Gravity /// public bool IsFallDamageEnable { - get => FirstPersonController.FpcModule.Motor._enableFallDamage; - set - { - enableFallDamageField ??= AccessTools.Field(typeof(FpcMotor), nameof(FpcMotor._enableFallDamage)); - enableFallDamageField.SetValue(FirstPersonController.FpcModule.Motor, value); - } + get => FirstPersonController.FpcModule.Motor._fallDamageSettings.Enabled; + set => FirstPersonController.FpcModule.Motor._fallDamageSettings.Enabled = value; + } + + /// + /// Gets or sets the multiplier of damage. + /// + public float FallDamageMultiplier + { + get => FirstPersonController.FpcModule.Motor._fallDamageSettings.Multiplier; + set => FirstPersonController.FpcModule.Motor._fallDamageSettings.Multiplier = value; } /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/SearchingPickupEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/SearchingPickupEventArgs.cs index c714df950a..fe17eb979a 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/SearchingPickupEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/SearchingPickupEventArgs.cs @@ -37,7 +37,7 @@ public class SearchingPickupEventArgs : IPlayerEvent, IPickupEvent, IDeniableEve /// /// /// - public SearchingPickupEventArgs(Player player, ItemPickupBase pickup, SearchSession searchSession, SearchCompletor searchCompletor, float searchTime) + public SearchingPickupEventArgs(Player player, ItemPickupBase pickup, SearchSession searchSession, PickupSearchCompletor searchCompletor, float searchTime) { Player = player; Pickup = Pickup.Get(pickup); @@ -54,7 +54,7 @@ public SearchingPickupEventArgs(Player player, ItemPickupBase pickup, SearchSess /// /// Gets or sets the SearchCompletor. /// - public SearchCompletor SearchCompletor { get; set; } + public PickupSearchCompletor SearchCompletor { get; set; } /// /// Gets or sets the Pickup search duration. diff --git a/EXILED/Exiled.Events/Patches/Events/Map/SpawningRoomConnector.cs b/EXILED/Exiled.Events/Patches/Events/Map/SpawningRoomConnector.cs index 7b11934f9d..e1cfcc367c 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/SpawningRoomConnector.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/SpawningRoomConnector.cs @@ -75,32 +75,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } - - /// - /// Patches . - /// Adds the event. - /// - [EventPatch(typeof(Handlers.Map), nameof(Handlers.Map.SpawningRoomConnector))] - [HarmonyPatch(typeof(SeedSynchronizer), nameof(SeedSynchronizer.GenerateLevel))] - internal static class SpawningRoomConnectorFix - { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) - { - List newInstructions = ListPool.Pool.Get(instructions); - - int offset = 0; - int index = newInstructions.FindIndex(i => i.Calls(Method(typeof(RoomConnectorSpawnpointBase), nameof(RoomConnectorSpawnpointBase.SetupAllRoomConnectors)))) + offset; - - newInstructions.RemoveAt(index); - - offset = -1; - index = newInstructions.FindIndex(i => i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(PluginAPI.Events.MapGeneratedEvent))[0]) + offset; - newInstructions.Insert(index, new CodeInstruction(OpCodes.Call, Method(typeof(RoomConnectorSpawnpointBase), nameof(RoomConnectorSpawnpointBase.SetupAllRoomConnectors))).MoveLabelsFrom(newInstructions[index])); - - for (int z = 0; z < newInstructions.Count; z++) - yield return newInstructions[z]; - - ListPool.Pool.Return(newInstructions); - } - } } \ No newline at end of file From da34f2201200ea8c54df97bb44fc93fb1320881b Mon Sep 17 00:00:00 2001 From: Yamato <66829532+louis1706@users.noreply.github.com> Date: Sun, 27 Apr 2025 16:12:33 +0200 Subject: [PATCH 38/70] refactor!: update to 14.1 (#508) * refactor!: update to 14.1 * fix: few patches fix * feat: new custom keycard logic * fix: ActivatingWarheadPanel event * fix: checkpoint sequence time * fix: Shot event * fix: DroppingCandy event * Fix last Error on Release Build * Update new PrefabType * fix: AnnouncingScpTermination event * fix: SpawningItem event error (require testing) * fix: Shot.cs fix * analysis error * Fix error * Fix build error * NW_Documentation * fix: announcing wave entrance * Reference new Room * Fix Build error * fix: fixes pickingup event * Nameless Skill Issue * fix: locker patch * fix: spawning room connector * CameraToy * Get CameraToy * Finish InteractableToy & fix doc * fix Error for build * Remove todo * fix: generator events * ElevatorType.ServerRoom * Fix a 2 hours loss * Fix NW moment * fix: interacting generator * fix: interacting locker event * fix: missing obstacle shot * fix: KeycardInteracting again * Fix SendingCassieMessage * fix: temp fix interacting door (need to refactor) * refactor: change the property * fix doc * extension for Scp127 & ServerRoom * FirearmType.Scp127 * AdminToyList * fix: camera weren't added * new CameraType * wrong doc * fix: interacting door event (improved) * Invalid Camera * Better doc * fix: interacting door (bolton issue) * FixDamagingWindow index * RemoveBreakingChange * Fix FailingEscapePocketDimensionEventArgs --------- Co-authored-by: Bolton <48883340+BoltonDev@users.noreply.github.com> Co-authored-by: VALERA771 Co-authored-by: VALERA771 <72030575+VALERA771@users.noreply.github.com> --- EXILED/Exiled.API/Enums/AdminToyType.cs | 10 + EXILED/Exiled.API/Enums/CameraType.cs | 14 + EXILED/Exiled.API/Enums/DamageType.cs | 5 + EXILED/Exiled.API/Enums/DoorType.cs | 19 + EXILED/Exiled.API/Enums/ElevatorType.cs | 5 + EXILED/Exiled.API/Enums/FirearmType.cs | 5 + EXILED/Exiled.API/Enums/GeneratorState.cs | 4 +- EXILED/Exiled.API/Enums/GlassType.cs | 5 + EXILED/Exiled.API/Enums/LockerType.cs | 5 + EXILED/Exiled.API/Enums/PrefabType.cs | 24 + EXILED/Exiled.API/Enums/RoomType.cs | 10 + .../Extensions/DamageTypeExtensions.cs | 1 + .../Extensions/DoorTypeExtensions.cs | 2 +- .../Exiled.API/Extensions/ItemExtensions.cs | 2 + .../Exiled.API/Extensions/LockerExtensions.cs | 1 + .../Exiled.API/Extensions/RoomExtensions.cs | 2 +- EXILED/Exiled.API/Features/Camera.cs | 17 +- .../CustomStats/CustomHumeShieldStat.cs | 9 +- .../DamageHandlers/GenericDamageHandler.cs | 3 + EXILED/Exiled.API/Features/Doors/BasicDoor.cs | 6 +- EXILED/Exiled.API/Features/Doors/Door.cs | 24 +- .../Exiled.API/Features/Doors/ElevatorDoor.cs | 3 +- EXILED/Exiled.API/Features/Generator.cs | 4 +- EXILED/Exiled.API/Features/Items/Armor.cs | 17 +- EXILED/Exiled.API/Features/Items/Keycard.cs | 45 +- EXILED/Exiled.API/Features/Items/Scp1344.cs | 2 +- EXILED/Exiled.API/Features/Lockers/Chamber.cs | 4 +- EXILED/Exiled.API/Features/Npc.cs | 9 +- .../Features/Pickups/KeycardPickup.cs | 17 +- EXILED/Exiled.API/Features/Player.cs | 5 +- EXILED/Exiled.API/Features/Roles/FpcRole.cs | 1 - .../Exiled.API/Features/Roles/Scp079Role.cs | 2 +- EXILED/Exiled.API/Features/Room.cs | 23 +- EXILED/Exiled.API/Features/Round.cs | 2 +- EXILED/Exiled.API/Features/Server.cs | 2 +- EXILED/Exiled.API/Features/Toys/AdminToy.cs | 2 + EXILED/Exiled.API/Features/Toys/CameraToy.cs | 83 +++ .../Features/Toys/InteractableToy.cs | 61 +++ EXILED/Exiled.API/Features/Toys/Light.cs | 2 + EXILED/Exiled.API/Features/Warhead.cs | 6 +- EXILED/Exiled.API/Features/Window.cs | 3 +- .../API/Features/CustomKeycard.cs | 84 ++- .../Map/AnnouncingScpTerminationEventArgs.cs | 9 +- .../Player/ActivatingGeneratorEventArgs.cs | 7 +- .../Player/ActivatingWarheadPanelEventArgs.cs | 2 +- .../Player/ClosingGeneratorEventArgs.cs | 5 +- .../FailingEscapePocketDimensionEventArgs.cs | 6 +- .../Player/InteractingDoorEventArgs.cs | 7 +- .../Player/OpeningGeneratorEventArgs.cs | 7 +- .../EventArgs/Player/ShotEventArgs.cs | 5 +- .../Player/StoppingGeneratorEventArgs.cs | 5 +- .../Player/UnlockingGeneratorEventArgs.cs | 2 +- EXILED/Exiled.Events/Events.cs | 6 +- .../Handlers/Internal/AdminToyList.cs | 27 + .../Handlers/Internal/SceneUnloaded.cs | 1 - .../Events/Cassie/SendingCassieMessage.cs | 42 +- .../Patches/Events/Item/KeycardInteracting.cs | 155 ++---- .../Events/Map/AnnouncingChaosEntrance.cs | 2 +- .../Events/Map/AnnouncingNtfEntrance.cs | 6 +- .../Events/Map/AnnouncingScpTermination.cs | 10 +- .../Patches/Events/Map/SpawningItem.cs | 4 +- .../Events/Map/SpawningRoomConnector.cs | 28 + .../Events/Player/ActivatingWarheadPanel.cs | 70 +-- .../Events/Player/ChangingRoleAndSpawned.cs | 2 - .../Patches/Events/Player/DamagingWindow.cs | 2 +- .../Patches/Events/Player/InteractingDoor.cs | 198 +++++-- .../Events/Player/InteractingGenerator.cs | 269 ++++------ .../Events/Player/InteractingLocker.cs | 10 +- .../Patches/Events/Player/PickingUpAmmo.cs | 10 +- .../Patches/Events/Player/PickingUpArmor.cs | 6 +- .../Patches/Events/Player/PickingUpItem.cs | 6 +- .../Patches/Events/Player/PickingUpScp244.cs | 9 +- .../Player/SendingValidGameConsoleCommand.cs | 6 +- .../Patches/Events/Player/Shot.cs | 160 +++--- .../Patches/Events/Scp330/DroppingCandy.cs | 35 +- .../Patches/Events/Server/RoundEnd.cs | 8 +- .../Patches/Fixes/ArmorDropPatch.cs | 4 +- .../Patches/Fixes/LockerFixes.cs | 2 +- ...RemoteAdminNpcCommandAddToDictionaryFix.cs | 1 + .../Patches/Fixes/Scp3114FriendlyFireFix.cs | 4 + .../Patches/Generic/CameraList.cs | 5 +- .../Exiled.Events/Patches/Generic/RoomList.cs | 9 +- EXILED/Exiled.Loader/AutoUpdateFiles.cs | 2 +- .../SCPSLRessources/NW_Documentation.md | 487 ++++++++++++++++-- 84 files changed, 1445 insertions(+), 746 deletions(-) create mode 100644 EXILED/Exiled.API/Features/Toys/CameraToy.cs create mode 100644 EXILED/Exiled.API/Features/Toys/InteractableToy.cs create mode 100644 EXILED/Exiled.Events/Handlers/Internal/AdminToyList.cs diff --git a/EXILED/Exiled.API/Enums/AdminToyType.cs b/EXILED/Exiled.API/Enums/AdminToyType.cs index 1ca81b5e01..1ddad225ed 100644 --- a/EXILED/Exiled.API/Enums/AdminToyType.cs +++ b/EXILED/Exiled.API/Enums/AdminToyType.cs @@ -37,5 +37,15 @@ public enum AdminToyType /// Capybara toy. /// Capybara, + + /// + /// InvisibleInteractable toy. + /// + InvisibleInteractableToy, + + /// + /// Camera Object toy. + /// + CameraToy, } } \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/CameraType.cs b/EXILED/Exiled.API/Enums/CameraType.cs index 80c1b7cb89..8b064b045f 100644 --- a/EXILED/Exiled.API/Enums/CameraType.cs +++ b/EXILED/Exiled.API/Enums/CameraType.cs @@ -123,6 +123,7 @@ public enum CameraType Hcz173ContChamber, [System.Obsolete("This Camera no longer exist.")] Hcz173Hallway, + [System.Obsolete("This Camera no longer exist.")] HczCurve, HczJunkMain, HczJunkHallway, @@ -137,6 +138,19 @@ public enum CameraType HczWarheadPortElevator, HczMicroHIDLab, HczPipesMain, + HczScp127Lab, + HczScp127Containment, + HczServersUpperStorage, + HczLowerServerStorage, + HczServerStaircase, + #endregion + + #region custom + EzArmCameraToy, + EzCameraToy, + HczCameraToy, + LczCameraToy, + SzCameraToy, #endregion } } diff --git a/EXILED/Exiled.API/Enums/DamageType.cs b/EXILED/Exiled.API/Enums/DamageType.cs index 602ad2f740..ae93c5c020 100644 --- a/EXILED/Exiled.API/Enums/DamageType.cs +++ b/EXILED/Exiled.API/Enums/DamageType.cs @@ -269,5 +269,10 @@ public enum DamageType /// Damage caused by . /// SnowBall, + + /// + /// Damage caused by . + /// + Scp127, } } \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/DoorType.cs b/EXILED/Exiled.API/Enums/DoorType.cs index ee5655f77e..4e3cb644f5 100644 --- a/EXILED/Exiled.API/Enums/DoorType.cs +++ b/EXILED/Exiled.API/Enums/DoorType.cs @@ -167,11 +167,20 @@ public enum DoorType /// /// Represents the HID_UPPER door. /// + [Obsolete("This Door has been renamed too HID_LAB.")] HIDUpper, + /// + /// Represents the HID_LAB door. + /// +#pragma warning disable CS0618 + HIDLab = HIDUpper, +#pragma warning restore CS0618 + /// /// Represents the HID_LOWER door. /// + [Obsolete("This Door has been removed from the game.")] HIDLower, /// @@ -320,5 +329,15 @@ public enum DoorType /// Represents the ESCAPE_FINAL door. /// EscapeFinal, + + /// + /// Represents the Elevator door for . + /// + ElevatorServerRoom, + + /// + /// Represents the HCZ_127_LAB door. + /// + Hcz127Lab, } } \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/ElevatorType.cs b/EXILED/Exiled.API/Enums/ElevatorType.cs index 02783b7180..ebccf5b356 100644 --- a/EXILED/Exiled.API/Enums/ElevatorType.cs +++ b/EXILED/Exiled.API/Enums/ElevatorType.cs @@ -48,5 +48,10 @@ public enum ElevatorType : byte /// Light Containment Zone checkpoint B elevator. /// LczB, + + /// + /// Heavy Containment Zone ServerRoom elevator. + /// + ServerRoom, } } \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/FirearmType.cs b/EXILED/Exiled.API/Enums/FirearmType.cs index aa814136fa..05cccf2388 100644 --- a/EXILED/Exiled.API/Enums/FirearmType.cs +++ b/EXILED/Exiled.API/Enums/FirearmType.cs @@ -89,5 +89,10 @@ public enum FirearmType /// Represents the . /// A7, + + /// + /// Represents the . + /// + Scp127, } } diff --git a/EXILED/Exiled.API/Enums/GeneratorState.cs b/EXILED/Exiled.API/Enums/GeneratorState.cs index 1b434908b0..4f0a9b7111 100644 --- a/EXILED/Exiled.API/Enums/GeneratorState.cs +++ b/EXILED/Exiled.API/Enums/GeneratorState.cs @@ -20,9 +20,9 @@ namespace Exiled.API.Enums public enum GeneratorState : byte { /// - /// Generator is locked. + /// Generator is doing nothing. /// - None = 1, + None = 0, /// /// Generator is unlocked. diff --git a/EXILED/Exiled.API/Enums/GlassType.cs b/EXILED/Exiled.API/Enums/GlassType.cs index 9857ed2a82..4144c7fd98 100644 --- a/EXILED/Exiled.API/Enums/GlassType.cs +++ b/EXILED/Exiled.API/Enums/GlassType.cs @@ -69,5 +69,10 @@ public enum GlassType /// Represents the window in . /// TestRoom, + + /// + /// Represents the window in . + /// + Scp127, } } \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/LockerType.cs b/EXILED/Exiled.API/Enums/LockerType.cs index af62a06cb3..14c2f365df 100644 --- a/EXILED/Exiled.API/Enums/LockerType.cs +++ b/EXILED/Exiled.API/Enums/LockerType.cs @@ -115,5 +115,10 @@ public enum LockerType /// SCP-1853 pedestal. /// Scp1853Pedestal, + + /// + /// SCP-127 pedestal. + /// + Scp127Pedestal, } } diff --git a/EXILED/Exiled.API/Enums/PrefabType.cs b/EXILED/Exiled.API/Enums/PrefabType.cs index 4296de63db..000773a6c3 100644 --- a/EXILED/Exiled.API/Enums/PrefabType.cs +++ b/EXILED/Exiled.API/Enums/PrefabType.cs @@ -345,5 +345,29 @@ public enum PrefabType [Prefab(1548138668, "AutoRagdoll")] AutoRagdoll, + + [Prefab(1323017091, "ElevatorChamberCargo")] + ElevatorChamberCargo, + + [Prefab(359728307, "InvisibleInteractableToy")] + InvisibleInteractableToy, + + [Prefab(1824808402, "EzArmCameraToy")] + EzArmCameraToy, + + [Prefab(3375932423, "EzCameraToy")] + EzCameraToy, + + [Prefab(144958943, "HczCameraToy")] + HczCameraToy, + + [Prefab(2026969629, "LczCameraToy")] + LczCameraToy, + + [Prefab(1548138668, "SzCameraToy")] + SzCameraToy, + + [Prefab(2842703865, "KeycardPickup_Chaos")] + KeycardPickupChaos, } } \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/RoomType.cs b/EXILED/Exiled.API/Enums/RoomType.cs index 3cb78e53f2..6e236c25d1 100644 --- a/EXILED/Exiled.API/Enums/RoomType.cs +++ b/EXILED/Exiled.API/Enums/RoomType.cs @@ -328,5 +328,15 @@ public enum RoomType /// Entrance Zone's straight hall with Dr.L's and conference room 9b locked room. /// EzSmallrooms, + + /// + /// Heavy Containment Zone's SCP-330 room. + /// + Hcz127, + + /// + /// Heavy Containment Zone's storage / server room. + /// + HczServerRoom, } } \ No newline at end of file diff --git a/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs b/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs index 7e496e77ac..6abeea8a2f 100644 --- a/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs +++ b/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs @@ -102,6 +102,7 @@ public static class DamageTypeExtensions { ItemType.Jailbird, DamageType.Jailbird }, { ItemType.GunFRMG0, DamageType.Frmg0 }, { ItemType.GunA7, DamageType.A7 }, + { ItemType.GunSCP127, DamageType.Scp127 }, }; /// diff --git a/EXILED/Exiled.API/Extensions/DoorTypeExtensions.cs b/EXILED/Exiled.API/Extensions/DoorTypeExtensions.cs index 79164df2b3..a4380d81cf 100644 --- a/EXILED/Exiled.API/Extensions/DoorTypeExtensions.cs +++ b/EXILED/Exiled.API/Extensions/DoorTypeExtensions.cs @@ -35,6 +35,6 @@ public static bool IsGate(this DoorType door) => door is DoorType.GateA or DoorT /// The door to be checked. /// Returns whether the is an elevator. public static bool IsElevator(this DoorType door) => door is DoorType.ElevatorGateA or DoorType.ElevatorGateB - or DoorType.ElevatorLczA or DoorType.ElevatorLczB or DoorType.ElevatorNuke or DoorType.ElevatorScp049; + or DoorType.ElevatorLczA or DoorType.ElevatorLczB or DoorType.ElevatorNuke or DoorType.ElevatorScp049 or DoorType.ElevatorServerRoom; } } \ No newline at end of file diff --git a/EXILED/Exiled.API/Extensions/ItemExtensions.cs b/EXILED/Exiled.API/Extensions/ItemExtensions.cs index c169f03011..458fd10bc4 100644 --- a/EXILED/Exiled.API/Extensions/ItemExtensions.cs +++ b/EXILED/Exiled.API/Extensions/ItemExtensions.cs @@ -182,6 +182,7 @@ public static int GetMaxAmmo(this FirearmType item) ItemType.GunCom45 => FirearmType.Com45, ItemType.GunFRMG0 => FirearmType.FRMG0, ItemType.ParticleDisruptor => FirearmType.ParticleDisruptor, + ItemType.GunSCP127 => FirearmType.Scp127, _ => FirearmType.None, }; @@ -220,6 +221,7 @@ public static int GetMaxAmmo(this FirearmType item) FirearmType.Com45 => ItemType.GunCom45, FirearmType.FRMG0 => ItemType.GunFRMG0, FirearmType.ParticleDisruptor => ItemType.ParticleDisruptor, + FirearmType.Scp127 => ItemType.GunSCP127, _ => ItemType.None, }; diff --git a/EXILED/Exiled.API/Extensions/LockerExtensions.cs b/EXILED/Exiled.API/Extensions/LockerExtensions.cs index 4a6466f636..da8b915794 100644 --- a/EXILED/Exiled.API/Extensions/LockerExtensions.cs +++ b/EXILED/Exiled.API/Extensions/LockerExtensions.cs @@ -48,6 +48,7 @@ public static class LockerExtensions "RegularMedkitStructure" => LockerType.Medkit, "AdrenalineMedkitStructure" => LockerType.Adrenaline, "MicroHIDpedestal" => LockerType.MicroHid, + "SCP_127_Container" => LockerType.Scp127Pedestal, _ => LockerType.Unknown, }; } diff --git a/EXILED/Exiled.API/Extensions/RoomExtensions.cs b/EXILED/Exiled.API/Extensions/RoomExtensions.cs index 14141a4422..8d36486505 100644 --- a/EXILED/Exiled.API/Extensions/RoomExtensions.cs +++ b/EXILED/Exiled.API/Extensions/RoomExtensions.cs @@ -52,7 +52,7 @@ public static bool IsCheckpoint(this RoomType room) => room is RoomType.LczCheck /// Returns whether the contains any SCP. public static bool IsScp(this RoomType room) => room is RoomType.Lcz173 or RoomType.Lcz330 or RoomType.Lcz914 or RoomType.Hcz049 or RoomType.Hcz079 or - RoomType.Hcz096 or RoomType.Hcz106 or RoomType.Hcz939; + RoomType.Hcz096 or RoomType.Hcz106 or RoomType.Hcz939 or RoomType.Hcz127; /// /// Converts the provided into the corresponding . diff --git a/EXILED/Exiled.API/Features/Camera.cs b/EXILED/Exiled.API/Features/Camera.cs index 208b4c672f..da3f73e27b 100644 --- a/EXILED/Exiled.API/Features/Camera.cs +++ b/EXILED/Exiled.API/Features/Camera.cs @@ -70,7 +70,6 @@ public class Camera : IWrapper, IWorldSpace ["HCZ ARMORY"] = CameraType.HczArmory, ["HCZ ARMORY INTERIOR"] = CameraType.HczArmoryInterior, ["HCZ CROSSING"] = CameraType.HczCrossing, - ["HCZ CURVE"] = CameraType.HczCurve, ["HCZ ELEV SYS A"] = CameraType.HczElevSysA, ["HCZ ELEV SYS B"] = CameraType.HczElevSysB, ["HCZ HALLWAY"] = CameraType.HczHallway, @@ -134,6 +133,18 @@ public class Camera : IWrapper, IWorldSpace ["WARHEAD TOP ELEVATORS"] = CameraType.HczWarheadTopElevators, ["WARHEAD CONNECTOR"] = CameraType.HczWarheadConnector, ["WARHEAD PORT ELEVATOR"] = CameraType.HczWarheadPortElevator, + ["HCZ SCP-127 LAB"] = CameraType.HczScp127Lab, + ["HCZ SCP-127 CONTAINMENT"] = CameraType.HczScp127Containment, + ["HCZ SERVERS UPPER STORAGE"] = CameraType.HczServersUpperStorage, + ["HCZ LOWER SERVER STORAGE"] = CameraType.HczLowerServerStorage, + ["HCZ SERVERS STAIRCASE"] = CameraType.HczServerStaircase, + + // CustomCamera + ["EZ ARM CAMERA TOY"] = CameraType.EzArmCameraToy, + ["EZ CAMERA TOY"] = CameraType.EzCameraToy, + ["HCZ CAMERA TOY"] = CameraType.HczCameraToy, + ["LCZ CAMERA TOY"] = CameraType.LczCameraToy, + ["SZ CAMERA TOY"] = CameraType.SzCameraToy, }; private Room room; @@ -147,10 +158,6 @@ internal Camera(Scp079Camera camera079) Base = camera079; Camera079ToCamera.Add(camera079, this); Type = GetCameraType(); -#if DEBUG - if (Type is CameraType.Unknown) - Log.Error($"[CAMERATYPE UNKNOWN] {this} BASE = {Base}"); -#endif } /// diff --git a/EXILED/Exiled.API/Features/CustomStats/CustomHumeShieldStat.cs b/EXILED/Exiled.API/Features/CustomStats/CustomHumeShieldStat.cs index b4c4d8d739..e19ce970f5 100644 --- a/EXILED/Exiled.API/Features/CustomStats/CustomHumeShieldStat.cs +++ b/EXILED/Exiled.API/Features/CustomStats/CustomHumeShieldStat.cs @@ -23,7 +23,14 @@ public class CustomHumeShieldStat : HumeShieldStat /// public float ShieldRegenerationMultiplier { get; set; } = 1; - private float ShieldRegeneration => TryGetHsModule(out HumeShieldModuleBase controller) ? controller.HsRegeneration * ShieldRegenerationMultiplier : 0; + private float ShieldRegeneration + { + get + { + IHumeShieldProvider.GetForHub(Hub, out _, out _, out float hsRegen, out _); + return hsRegen * ShieldRegenerationMultiplier; + } + } /// public override void Update() diff --git a/EXILED/Exiled.API/Features/DamageHandlers/GenericDamageHandler.cs b/EXILED/Exiled.API/Features/DamageHandlers/GenericDamageHandler.cs index 2008936bea..bd858b3447 100644 --- a/EXILED/Exiled.API/Features/DamageHandlers/GenericDamageHandler.cs +++ b/EXILED/Exiled.API/Features/DamageHandlers/GenericDamageHandler.cs @@ -155,6 +155,9 @@ public GenericDamageHandler(Player player, Player attacker, float damage, Damage case DamageType.A7: GenericFirearm(player, attacker, damage, damageType, ItemType.GunA7); break; + case DamageType.Scp127: + GenericFirearm(player, attacker, damage, damageType, ItemType.GunSCP127); + break; case DamageType.ParticleDisruptor: Base = new DisruptorDamageHandler(new (Item.Create(ItemType.ParticleDisruptor, attacker).Base as InventorySystem.Items.Firearms.Firearm, InventorySystem.Items.Firearms.Modules.DisruptorActionModule.FiringState.FiringSingle), Vector3.up, damage); break; diff --git a/EXILED/Exiled.API/Features/Doors/BasicDoor.cs b/EXILED/Exiled.API/Features/Doors/BasicDoor.cs index 39316fdd37..5a53caa738 100644 --- a/EXILED/Exiled.API/Features/Doors/BasicDoor.cs +++ b/EXILED/Exiled.API/Features/Doors/BasicDoor.cs @@ -9,6 +9,8 @@ namespace Exiled.API.Features.Doors { using System.Collections.Generic; + using Exiled.API.Enums; + using PlayerRoles; using UnityEngine; using Basegame = Interactables.Interobjects.BasicDoor; @@ -35,9 +37,9 @@ public BasicDoor(Basegame door, List room) public new Basegame Base { get; } /// - /// Gets the list with all SCP-106's colliders. + /// Gets the list with all Ignored's colliders for or . /// - public IEnumerable Scp106Colliders => Base.Scp106Colliders; + public IEnumerable Scp106Colliders => Base.IgnoredColliders; /// /// Gets or sets the total cooldown before door can be triggered again. diff --git a/EXILED/Exiled.API/Features/Doors/Door.cs b/EXILED/Exiled.API/Features/Doors/Door.cs index 3085f6fb4a..c2cea9a761 100644 --- a/EXILED/Exiled.API/Features/Doors/Door.cs +++ b/EXILED/Exiled.API/Features/Doors/Door.cs @@ -25,7 +25,7 @@ namespace Exiled.API.Features.Doors using Breakable = BreakableDoor; using Checkpoint = CheckpointDoor; using Elevator = ElevatorDoor; - using KeycardPermissions = Enums.KeycardPermissions; + using KeycardPermissions = Exiled.API.Enums.KeycardPermissions; /// /// A wrapper class for . @@ -54,10 +54,6 @@ internal Door(DoorVariant door, List rooms) } Type = GetDoorType(); -#if DEBUG - if (Type is DoorType.UnknownDoor or DoorType.UnknownGate or DoorType.UnknownElevator) - Log.Error($"[DOORTYPE UNKNOWN] {this} BASE = {Base}"); -#endif } /// @@ -180,8 +176,8 @@ public bool IsOpen /// public KeycardPermissions KeycardPermissions { - get => (KeycardPermissions)Base.RequiredPermissions.RequiredPermissions; - set => Base.RequiredPermissions = new((DoorPermissionFlags)value, Base.RequiredPermissions.RequireAll, Base.RequiredPermissions.Bypass2176); + get => (KeycardPermissions)RequiredPermissions; + set => RequiredPermissions = (DoorPermissionFlags)value; } /// @@ -240,6 +236,15 @@ public DoorLockType DoorLockType /// public string Name => Nametag == null ? GameObject.name.GetBefore(' ') : Nametag.GetName.RemoveBracketsOnEndOfName(); + /// + /// Gets or sets the required permissions to open the door. + /// + public DoorPermissionFlags RequiredPermissions + { + get => Base.RequiredPermissions.RequiredPermissions; + set => Base.RequiredPermissions.RequiredPermissions = value; + } + /// /// Gets or sets the door's rotation. /// @@ -603,6 +608,7 @@ private DoorType GetDoorType() ElevatorGroup.Scp049 => DoorType.ElevatorScp049, ElevatorGroup.GateB => DoorType.ElevatorGateB, ElevatorGroup.GateA => DoorType.ElevatorGateA, + ElevatorGroup.ServerRoom => DoorType.ElevatorServerRoom, ElevatorGroup.LczA01 or ElevatorGroup.LczA02 => DoorType.ElevatorLczA, ElevatorGroup.LczB01 or ElevatorGroup.LczB02 => DoorType.ElevatorLczB, ElevatorGroup.Nuke01 or ElevatorGroup.Nuke02 => DoorType.ElevatorNuke, @@ -644,8 +650,8 @@ private DoorType GetDoorType() "173_CONNECTOR" => DoorType.Scp173Connector, "LCZ_WC" => DoorType.LczWc, "HID_CHAMBER" => DoorType.HIDChamber, - "HID_UPPER" => DoorType.HIDUpper, - "HID_LOWER" => DoorType.HIDLower, + "HID_LAB" => DoorType.HIDLab, + "HCZ_127_LAB" => DoorType.Hcz127Lab, "173_ARMORY" => DoorType.Scp173Armory, "173_GATE" => DoorType.Scp173Gate, "GR18" => DoorType.GR18Gate, diff --git a/EXILED/Exiled.API/Features/Doors/ElevatorDoor.cs b/EXILED/Exiled.API/Features/Doors/ElevatorDoor.cs index 797378312a..0145e53f84 100644 --- a/EXILED/Exiled.API/Features/Doors/ElevatorDoor.cs +++ b/EXILED/Exiled.API/Features/Doors/ElevatorDoor.cs @@ -30,7 +30,7 @@ internal ElevatorDoor(Interactables.Interobjects.ElevatorDoor door, List r Base = door; Lift = Lift.Get(x => x.Group == Group).FirstOrDefault(); - Panel = Object.FindObjectsOfType().FirstOrDefault(x => x._door == door); + Panel = Object.FindObjectsByType(FindObjectsInactive.Include, FindObjectsSortMode.None).FirstOrDefault(x => x._door == door); } /// @@ -56,6 +56,7 @@ internal ElevatorDoor(Interactables.Interobjects.ElevatorDoor door, List r ElevatorGroup.Scp049 => ElevatorType.Scp049, ElevatorGroup.GateA => ElevatorType.GateA, ElevatorGroup.GateB => ElevatorType.GateB, + ElevatorGroup.ServerRoom => ElevatorType.ServerRoom, ElevatorGroup.LczA01 or ElevatorGroup.LczA02 => ElevatorType.LczA, ElevatorGroup.LczB01 or ElevatorGroup.LczB02 => ElevatorType.LczB, ElevatorGroup.Nuke01 or ElevatorGroup.Nuke02 => ElevatorType.Nuke, diff --git a/EXILED/Exiled.API/Features/Generator.cs b/EXILED/Exiled.API/Features/Generator.cs index ae989736f5..b19369208d 100644 --- a/EXILED/Exiled.API/Features/Generator.cs +++ b/EXILED/Exiled.API/Features/Generator.cs @@ -281,9 +281,7 @@ public static bool TryGet(Func predicate, out IEnumerable /// Denies the unlock. /// - public void DenyUnlock() => Base.RpcDenied(Interactables.Interobjects.DoorUtils.DoorPermissionFlags.None); - - // TODO: Documentation + public void DenyUnlock() => Base.RpcDenied(DoorPermissionFlags.None); /// /// Denies the unlock. diff --git a/EXILED/Exiled.API/Features/Items/Armor.cs b/EXILED/Exiled.API/Features/Items/Armor.cs index 238de555ec..344b7a0118 100644 --- a/EXILED/Exiled.API/Features/Items/Armor.cs +++ b/EXILED/Exiled.API/Features/Items/Armor.cs @@ -65,21 +65,22 @@ internal Armor(ItemType type) public bool IsWorn => Base.IsWorn; /// - /// Gets or sets the Weight of the armor. + /// Gets or sets a value indicating whether excess ammo should be removed when the armor is dropped. /// - public new float Weight + [Obsolete("Not functional anymore", true)] + public bool RemoveExcessOnDrop { - get => Base.Weight; - set => Base._weight = value; + get => false; + set => _ = value; } /// - /// Gets or sets a value indicating whether excess ammo should be removed when the armor is dropped. + /// Gets or sets the Weight of the armor. /// - public bool RemoveExcessOnDrop + public new float Weight { - get => !Base.DontRemoveExcessOnDrop; - set => Base.DontRemoveExcessOnDrop = !value; + get => Base.Weight; + set => Base._weight = value; } /// diff --git a/EXILED/Exiled.API/Features/Items/Keycard.cs b/EXILED/Exiled.API/Features/Items/Keycard.cs index 97adf63067..4e68dd60a5 100644 --- a/EXILED/Exiled.API/Features/Items/Keycard.cs +++ b/EXILED/Exiled.API/Features/Items/Keycard.cs @@ -7,14 +7,12 @@ namespace Exiled.API.Features.Items { + using System; + using Exiled.API.Enums; - using Exiled.API.Features.Pickups; using Exiled.API.Interfaces; - using InventorySystem.Items.Keycards; - using KeycardPickup = Pickups.KeycardPickup; - /// /// A wrapper class for . /// @@ -49,33 +47,30 @@ internal Keycard(ItemType type) /// public KeycardPermissions Permissions { - get => (KeycardPermissions)Base.GetPermissions(new()); - set => Base.Permissions = (Interactables.Interobjects.DoorUtils.KeycardPermissions)value; - } + get + { + foreach (DetailBase detail in Base.Details) + { + switch (detail) + { + case PredefinedPermsDetail predefinedPermsDetail: + return (KeycardPermissions)predefinedPermsDetail.Levels.Permissions; + case CustomPermsDetail customPermsDetail: + return (KeycardPermissions)customPermsDetail.GetPermissions(null); + } + } - /// - /// Clones current object. - /// - /// New object. - public override Item Clone() => new Keycard(Type) - { - Permissions = Permissions, - }; + return KeycardPermissions.None; + } + + [Obsolete("Not functional anymore", true)] + set => _ = value; + } /// /// Returns the Keycard in a human readable format. /// /// A string containing Keycard-related data. public override string ToString() => $"{Type} ({Serial}) [{Weight}] *{Scale}* |{Permissions}|"; - - /// - internal override void ReadPickupInfoBefore(Pickup pickup) - { - base.ReadPickupInfoBefore(pickup); - if (pickup is KeycardPickup keycardPickup) - { - Permissions = keycardPickup.Permissions; - } - } } } \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Items/Scp1344.cs b/EXILED/Exiled.API/Features/Items/Scp1344.cs index 460aeb8c06..7f96da8903 100644 --- a/EXILED/Exiled.API/Features/Items/Scp1344.cs +++ b/EXILED/Exiled.API/Features/Items/Scp1344.cs @@ -11,7 +11,7 @@ namespace Exiled.API.Features.Items using InventorySystem.Items.Usables; using InventorySystem.Items.Usables.Scp1344; - using PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers; + using PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers.Wearables; /// /// A wrapper class for . diff --git a/EXILED/Exiled.API/Features/Lockers/Chamber.cs b/EXILED/Exiled.API/Features/Lockers/Chamber.cs index 4c05213cc3..e98281ed5c 100644 --- a/EXILED/Exiled.API/Features/Lockers/Chamber.cs +++ b/EXILED/Exiled.API/Features/Lockers/Chamber.cs @@ -115,7 +115,7 @@ public IEnumerable AcceptableTypes public KeycardPermissions RequiredPermissions { get => (KeycardPermissions)Base.RequiredPermissions; - set => Base.RequiredPermissions = (Interactables.Interobjects.DoorUtils.KeycardPermissions)value; + set => Base.RequiredPermissions = (Interactables.Interobjects.DoorUtils.DoorPermissionFlags)value; } /// @@ -235,7 +235,7 @@ public void AddItem(Pickup item) Base.Content.Add(item.Base); item.Spawn(); - if (Base._wasEverOpened) + if (Base.WasEverOpened) item.IsLocked = false; } diff --git a/EXILED/Exiled.API/Features/Npc.cs b/EXILED/Exiled.API/Features/Npc.cs index 127ec1c629..7791218042 100644 --- a/EXILED/Exiled.API/Features/Npc.cs +++ b/EXILED/Exiled.API/Features/Npc.cs @@ -11,25 +11,20 @@ namespace Exiled.API.Features using System; using System.Collections.Generic; using System.Linq; - using System.Reflection; - using CentralAuth; using CommandSystem; using CommandSystem.Commands.RemoteAdmin.Dummies; using Exiled.API.Enums; - using Exiled.API.Features.Components; using Exiled.API.Features.CustomStats; using Exiled.API.Features.Roles; using Footprinting; - using GameCore; using MEC; using Mirror; + using NetworkManagerUtils.Dummies; using PlayerRoles; using PlayerStatsSystem; using UnityEngine; - using Object = UnityEngine.Object; - /// /// Wrapper class for handling NPC players. /// @@ -287,7 +282,7 @@ public static Npc Spawn(string name, RoleTypeId role = RoleTypeId.None, bool ign Timing.CallDelayed(SpawnSetRoleDelay, () => { npc.Role.Set(role, SpawnReason.ForceClass, position is null ? RoleSpawnFlags.All : RoleSpawnFlags.AssignInventory); - npc.ReferenceHub.playerStats._dictionarizedTypes[typeof(HealthStat)] = npc.ReferenceHub.playerStats.StatModules[Array.IndexOf(PlayerStats.DefinedModules, typeof(HealthStat))] = npc.CustomHealthStat = new CustomHealthStat { Hub = npc.ReferenceHub }; + npc.ReferenceHub.playerStats._dictionarizedTypes[typeof(HealthStat)] = npc.ReferenceHub.playerStats.StatModules[Array.IndexOf(PlayerStats.DefinedModules, typeof(HealthStat))] = npc.CustomHealthStat = new HealthStat { Hub = npc.ReferenceHub }; npc.Health = npc.MaxHealth; // otherwise the npc will spawn with 0 health npc.ReferenceHub.playerStats._dictionarizedTypes[typeof(HumeShieldStat)] = npc.ReferenceHub.playerStats.StatModules[Array.IndexOf(PlayerStats.DefinedModules, typeof(HumeShieldStat))] = npc.CustomHumeShieldStat = new CustomHumeShieldStat { Hub = npc.ReferenceHub }; diff --git a/EXILED/Exiled.API/Features/Pickups/KeycardPickup.cs b/EXILED/Exiled.API/Features/Pickups/KeycardPickup.cs index 49115119b9..e7e29ff13e 100644 --- a/EXILED/Exiled.API/Features/Pickups/KeycardPickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/KeycardPickup.cs @@ -42,9 +42,9 @@ internal KeycardPickup(ItemType type) } /// - /// Gets or sets the of the keycard. + /// Gets the of the keycard. /// - public KeycardPermissions Permissions { get; set; } + public KeycardPermissions Permissions { get; private set; } /// /// Gets the that this class is encapsulating. @@ -67,7 +67,18 @@ protected override void InitializeProperties(ItemBase itemBase) base.InitializeProperties(itemBase); if (itemBase is KeycardItem keycardItem) { - Permissions = (KeycardPermissions)keycardItem.Permissions; + foreach (DetailBase detail in keycardItem.Details) + { + switch (detail) + { + case PredefinedPermsDetail predefinedPermsDetail: + Permissions = (KeycardPermissions)predefinedPermsDetail.Levels.Permissions; + return; + case CustomPermsDetail customPermsDetail: + Permissions = (KeycardPermissions)customPermsDetail.GetPermissions(null); + return; + } + } } } } diff --git a/EXILED/Exiled.API/Features/Player.cs b/EXILED/Exiled.API/Features/Player.cs index 4b2c5ae261..4dfcf09409 100644 --- a/EXILED/Exiled.API/Features/Player.cs +++ b/EXILED/Exiled.API/Features/Player.cs @@ -351,7 +351,7 @@ public string CustomInfo get => ReferenceHub.nicknameSync.Network_customPlayerInfoString; set { - if (NicknameSync.ValidateCustomInfo(value, out string rejectionText)) + if (!NicknameSync.ValidateCustomInfo(value, out string rejectionText)) { Log.Error($"Could not set CustomInfo for {Nickname}. Reason: {rejectionText}"); } @@ -2962,9 +2962,6 @@ public void ClearInventory(bool destroy = true) /// public void ClearItems(bool destroy = true) { - if (CurrentArmor is Armor armor) - armor.RemoveExcessOnDrop = false; - while (Items.Count > 0) RemoveItem(Items.ElementAt(0), destroy); } diff --git a/EXILED/Exiled.API/Features/Roles/FpcRole.cs b/EXILED/Exiled.API/Features/Roles/FpcRole.cs index 6a0c0fa49a..d1c0a12591 100644 --- a/EXILED/Exiled.API/Features/Roles/FpcRole.cs +++ b/EXILED/Exiled.API/Features/Roles/FpcRole.cs @@ -27,7 +27,6 @@ namespace Exiled.API.Features.Roles /// public abstract class FpcRole : Role, IVoiceRole { - private static FieldInfo enableFallDamageSettings; private bool isUsingStamina = true; /// diff --git a/EXILED/Exiled.API/Features/Roles/Scp079Role.cs b/EXILED/Exiled.API/Features/Roles/Scp079Role.cs index d46d069cdf..c2b8cb70ce 100644 --- a/EXILED/Exiled.API/Features/Roles/Scp079Role.cs +++ b/EXILED/Exiled.API/Features/Roles/Scp079Role.cs @@ -593,7 +593,7 @@ public void ActivateTesla(bool consumeEnergy = true) Scp079Camera cam = CurrentCameraSync.CurrentCamera; RewardManager.MarkRoom(cam.Room); - if (!global::TeslaGate.AllGates.TryGetFirst(x => RoomUtils.IsTheSameRoom(cam.Position, x.transform.position), out global::TeslaGate teslaGate)) + if (!global::TeslaGate.AllGates.TryGetFirst(x => cam.Position.TryGetRoom(out RoomIdentifier camRoom) && x.transform.position.TryGetRoom(out RoomIdentifier teslaRoom) && camRoom == teslaRoom, out global::TeslaGate teslaGate)) return; if (consumeEnergy) diff --git a/EXILED/Exiled.API/Features/Room.cs b/EXILED/Exiled.API/Features/Room.cs index f2f7c802a9..e5bcc9c0d5 100644 --- a/EXILED/Exiled.API/Features/Room.cs +++ b/EXILED/Exiled.API/Features/Room.cs @@ -246,7 +246,7 @@ public static Room Get(RoomIdentifier roomIdentifier) => roomIdentifier == null /// /// The to search for. /// The with the given or if not found. - public static Room Get(Vector3 position) => RoomUtils.RoomAtPositionRaycasts(position, false) is RoomIdentifier identifier ? Get(identifier) : null; + public static Room Get(Vector3 position) => position.TryGetRoom(out RoomIdentifier room) ? Get(room) : null; /// /// Gets a given the specified . @@ -421,7 +421,7 @@ internal void InternalCreate() Identifier = gameObject.GetComponent(); RoomIdentifierToRoom.Add(Identifier, this); - Zone = FindZone(gameObject); + Zone = Identifier.Zone.GetZone(); #if DEBUG if (Zone is ZoneType.Unspecified) Log.Error($"[ZONETYPE UNKNOWN] {this} Zone : {Identifier?.Zone}"); @@ -496,6 +496,8 @@ private static RoomType FindType(GameObject gameObject) "HCZ_Straight Variant" => RoomType.HczStraightVariant, "HCZ_ChkpA" => RoomType.HczElevatorA, "HCZ_ChkpB" => RoomType.HczElevatorB, + "HCZ_127" => RoomType.Hcz127, + "HCZ_ServerRoom" => RoomType.HczServerRoom, "EZ_GateA" => RoomType.EzGateA, "EZ_GateB" => RoomType.EzGateB, "EZ_ThreeWay" => RoomType.EzTCross, @@ -527,22 +529,5 @@ private static RoomType FindType(GameObject gameObject) _ => RoomType.Unknown, }; } - - private static ZoneType FindZone(GameObject gameObject) - { - Transform transform = gameObject.transform; - - if (gameObject.name == "PocketWorld") - return ZoneType.Pocket; - - return transform.parent?.name.RemoveBracketsOnEndOfName() switch - { - "HeavyRooms" => ZoneType.HeavyContainment, - "LightRooms" => ZoneType.LightContainment, - "EntranceRooms" => ZoneType.Entrance, - "HCZ_EZ_Checkpoint" => ZoneType.HeavyContainment | ZoneType.Entrance, - _ => transform.position.y > 900 ? ZoneType.Surface : ZoneType.Unspecified, - }; - } } } diff --git a/EXILED/Exiled.API/Features/Round.cs b/EXILED/Exiled.API/Features/Round.cs index b6ee2b35fc..a278e169dc 100644 --- a/EXILED/Exiled.API/Features/Round.cs +++ b/EXILED/Exiled.API/Features/Round.cs @@ -54,7 +54,7 @@ public static class Round /// /// Gets a value indicating whether the round is ended. /// - public static bool IsEnded => RoundSummary._singletonSet && RoundSummary.singleton._roundEnded; + public static bool IsEnded => RoundSummary._singletonSet && RoundSummary.singleton.IsRoundEnded; /// /// Gets a value indicating whether the round is lobby. diff --git a/EXILED/Exiled.API/Features/Server.cs b/EXILED/Exiled.API/Features/Server.cs index 202d026112..5de5dd5655 100644 --- a/EXILED/Exiled.API/Features/Server.cs +++ b/EXILED/Exiled.API/Features/Server.cs @@ -64,7 +64,7 @@ public static string Name set { ServerConsole.ServerName = value; - ServerConsole.singleton.RefreshServerNameSafe(); + ServerConsole.Singleton.RefreshServerNameSafe(); } } diff --git a/EXILED/Exiled.API/Features/Toys/AdminToy.cs b/EXILED/Exiled.API/Features/Toys/AdminToy.cs index 19fd51f9ca..79c5bfc17d 100644 --- a/EXILED/Exiled.API/Features/Toys/AdminToy.cs +++ b/EXILED/Exiled.API/Features/Toys/AdminToy.cs @@ -167,6 +167,8 @@ public static AdminToy Get(AdminToyBase adminToyBase) ShootingTarget shootingTarget => new ShootingTargetToy(shootingTarget), SpeakerToy speakerToy => new Speaker(speakerToy), CapybaraToy capybaraToy => new Capybara(capybaraToy), + Scp079CameraToy scp079CameraToy => new CameraToy(scp079CameraToy), + InvisibleInteractableToy invisibleInteractableToy => new InteractableToy(invisibleInteractableToy), _ => throw new System.NotImplementedException() }; } diff --git a/EXILED/Exiled.API/Features/Toys/CameraToy.cs b/EXILED/Exiled.API/Features/Toys/CameraToy.cs new file mode 100644 index 0000000000..518c4d789a --- /dev/null +++ b/EXILED/Exiled.API/Features/Toys/CameraToy.cs @@ -0,0 +1,83 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Toys +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Text; + using System.Threading.Tasks; + + using AdminToys; + using Exiled.API.Enums; + using Exiled.API.Interfaces; + using UnityEngine; + + /// + /// A wrapper class for . + /// + internal class CameraToy : AdminToy, IWrapper + { + /// + /// Initializes a new instance of the class. + /// + /// The of the toy. + internal CameraToy(Scp079CameraToy scp079CameraToy) + : base(scp079CameraToy, AdminToyType.CameraToy) => Base = scp079CameraToy; + + /// + /// Gets the base . + /// + public Scp079CameraToy Base { get; } + + /// + /// Gets or sets the Vertical Restriction. + /// + public Vector2 VerticalConstraint + { + get => Base.NetworkVerticalConstraint; + set => Base.NetworkVerticalConstraint = value; + } + + /// + /// Gets or sets the Horizontal restriction. + /// + public Vector2 HorizontalConstraint + { + get => Base.NetworkHorizontalConstraint; + set => Base.NetworkHorizontalConstraint = value; + } + + /// + /// Gets or sets the Zoom restriction. + /// + public Vector2 ZoomConstraint + { + get => Base.NetworkZoomConstraint; + set => Base.NetworkZoomConstraint = value; + } + + /// + /// Gets or sets the Room where the Camera is associated with. + /// + public Room Room + { + get => Room.Get(Base.NetworkRoom); + set => Base.NetworkRoom = value.Identifier; + } + + /// + /// Gets or sets the Name of the Camera. + /// + public string Name + { + get => Base.NetworkLabel; + set => Base.NetworkLabel = value; + } + } +} diff --git a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs new file mode 100644 index 0000000000..c6c73936cd --- /dev/null +++ b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs @@ -0,0 +1,61 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Toys +{ + using AdminToys; + using Exiled.API.Enums; + using Exiled.API.Interfaces; + using UnityEngine; + + using static AdminToys.InvisibleInteractableToy; + + /// + /// A wrapper class for . + /// + internal class InteractableToy : AdminToy, IWrapper + { + /// + /// Initializes a new instance of the class. + /// + /// The of the toy. + internal InteractableToy(InvisibleInteractableToy invisibleInteractableToy) + : base(invisibleInteractableToy, AdminToyType.InvisibleInteractableToy) => Base = invisibleInteractableToy; + + /// + /// Gets the base . + /// + public InvisibleInteractableToy Base { get; } + + /// + /// Gets or sets the Shape of the Interactable. + /// + public ColliderShape Shape + { + get => Base.NetworkShape; + set => Base.NetworkShape = value; + } + + /// + /// Gets or sets the time to interact with the Interactable. + /// + public float InteractionDuration + { + get => Base.NetworkInteractionDuration; + set => Base.NetworkInteractionDuration = value; + } + + /// + /// Gets or sets a value indicating whether the interactable is locked. + /// + public bool IsLocked + { + get => Base.NetworkIsLocked; + set => Base.NetworkIsLocked = value; + } + } +} diff --git a/EXILED/Exiled.API/Features/Toys/Light.cs b/EXILED/Exiled.API/Features/Toys/Light.cs index 9496f6b833..9e167d1bb5 100644 --- a/EXILED/Exiled.API/Features/Toys/Light.cs +++ b/EXILED/Exiled.API/Features/Toys/Light.cs @@ -7,6 +7,7 @@ namespace Exiled.API.Features.Toys { + using System; using System.Linq; using AdminToys; @@ -98,6 +99,7 @@ public Color Color /// /// Gets or sets the shape that the Light emits. /// + [Obsolete("This property has been deprecated. Use LightType.Spot, LightType.Pyramid, or LightType.Box instead.")] public LightShape LightShape { get => Base.NetworkLightShape; diff --git a/EXILED/Exiled.API/Features/Warhead.cs b/EXILED/Exiled.API/Features/Warhead.cs index 682c63e8c4..97ce5a9cfe 100644 --- a/EXILED/Exiled.API/Features/Warhead.cs +++ b/EXILED/Exiled.API/Features/Warhead.cs @@ -35,7 +35,7 @@ public static class Warhead /// /// Gets the cached component. /// - public static AlphaWarheadOutsitePanel OutsitePanel => alphaWarheadOutsitePanel != null ? alphaWarheadOutsitePanel : (alphaWarheadOutsitePanel = UnityEngine.Object.FindObjectOfType()); + public static AlphaWarheadOutsitePanel OutsitePanel => alphaWarheadOutsitePanel != null ? alphaWarheadOutsitePanel : (alphaWarheadOutsitePanel = UnityEngine.Object.FindFirstObjectByType()); /// /// Gets the of the warhead lever. @@ -84,8 +84,8 @@ public static bool LeverStatus /// public static bool IsKeycardActivated { - get => OutsitePanel.NetworkkeycardEntered; - set => OutsitePanel.NetworkkeycardEntered = value; + get => AlphaWarheadActivationPanel.IsUnlocked; + set => AlphaWarheadActivationPanel.IsUnlocked = value; } /// diff --git a/EXILED/Exiled.API/Features/Window.cs b/EXILED/Exiled.API/Features/Window.cs index d11fe275ef..892733246b 100644 --- a/EXILED/Exiled.API/Features/Window.cs +++ b/EXILED/Exiled.API/Features/Window.cs @@ -45,7 +45,7 @@ internal Window(BreakableWindow window, Room room) } /// - /// Gets a of which contains all the instances. + /// Gets a of which contains all the instances. /// public static IReadOnlyCollection List => BreakableWindowToWindow.Values; @@ -225,6 +225,7 @@ public void DamageWindow(float amount, DamageHandlerBase handler) RoomType.HczTestRoom => GlassType.TestRoom, RoomType.HczEzCheckpointA => GlassType.HczEzCheckpointA, RoomType.HczEzCheckpointB => GlassType.HczEzCheckpointB, + RoomType.Hcz127 => GlassType.Scp127, _ => GlassType.Unknown, }; } diff --git a/EXILED/Exiled.CustomItems/API/Features/CustomKeycard.cs b/EXILED/Exiled.CustomItems/API/Features/CustomKeycard.cs index e28f1ea3d3..d53846cbb0 100644 --- a/EXILED/Exiled.CustomItems/API/Features/CustomKeycard.cs +++ b/EXILED/Exiled.CustomItems/API/Features/CustomKeycard.cs @@ -8,6 +8,7 @@ namespace Exiled.CustomItems.API.Features { using System; + using System.Linq; using Exiled.API.Enums; using Exiled.API.Extensions; @@ -18,6 +19,8 @@ namespace Exiled.CustomItems.API.Features using Exiled.API.Features.Pickups; using Exiled.Events.EventArgs.Item; using Exiled.Events.EventArgs.Player; + using Interactables.Interobjects.DoorUtils; + using InventorySystem.Items.Keycards; using UnityEngine; /// @@ -33,16 +36,41 @@ public override ItemType Type set { if (!value.IsKeycard()) - throw new ArgumentOutOfRangeException("Type", value, "Invalid keycard type."); + throw new ArgumentOutOfRangeException(nameof(Type), value, "Invalid keycard type."); base.Type = value; } } + /// + /// Gets or sets name of keycard holder. + /// + public virtual string KeycardName { get; set; } = string.Empty; + + /// + /// Gets or sets a label for keycard. + /// + public virtual string KeycardLabel { get; set; } = string.Empty; + + /// + /// Gets or sets a color of keycard label. + /// + public virtual Color32? KeycardLabelColor { get; set; } + + /// + /// Gets or sets a tint color. + /// + public virtual Color32? TintColor { get; set; } + /// /// Gets or sets the permissions for custom keycard. /// - public virtual KeycardPermissions Permissions { get; set; } + public virtual KeycardPermissions Permissions { get; set; } = KeycardPermissions.None; + + /// + /// Gets or sets a color of keycard permissions. + /// + public virtual Color32? KeycardPermissionsColor { get; set; } /// public override void Give(Player player, Item item, bool displayMessage = true) @@ -50,18 +78,66 @@ public override void Give(Player player, Item item, bool displayMessage = true) base.Give(player, item, displayMessage); if (item.Is(out Keycard card)) - card.Permissions = Permissions; + SetupKeycard(card); } /// public override Pickup? Spawn(Vector3 position, Item item, Player? previousOwner = null) { if (item.Is(out Keycard card)) - card.Permissions = Permissions; + SetupKeycard(card); return base.Spawn(position, item, previousOwner); } + /// + /// Setups keycard according to this class. + /// + /// Item instance. + protected virtual void SetupKeycard(Keycard keycard) + { + if (!keycard.Base.Customizable) + return; + + DetailBase[] details = keycard.Base.Details; + + NametagDetail? nameDetail = details.OfType().FirstOrDefault(); + + if (nameDetail != null && !string.IsNullOrEmpty(KeycardName)) + NametagDetail._customNametag = KeycardName; + + CustomItemNameDetail? raNameDetail = details.OfType().FirstOrDefault(); + + if (raNameDetail != null) + raNameDetail.Name = Name; + + CustomLabelDetail? labelDetail = details.OfType().FirstOrDefault(); + + if (labelDetail != null) + { + if (!string.IsNullOrEmpty(KeycardLabel)) + CustomLabelDetail._customText = KeycardLabel; + + if (KeycardLabelColor.HasValue) + CustomLabelDetail._customColor = KeycardLabelColor.Value; + } + + CustomPermsDetail? permsDetail = details.OfType().FirstOrDefault(); + + if (permsDetail != null) + { + CustomPermsDetail._customLevels = new((DoorPermissionFlags)Permissions); + CustomPermsDetail._customColor = KeycardPermissionsColor; + } + + CustomTintDetail? tintDetail = details.OfType().FirstOrDefault(); + + if (tintDetail != null && TintColor.HasValue) + { + CustomTintDetail._customColor = TintColor.Value; + } + } + /// /// Called when custom keycard interacts with a door. /// diff --git a/EXILED/Exiled.Events/EventArgs/Map/AnnouncingScpTerminationEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Map/AnnouncingScpTerminationEventArgs.cs index a083ac1fa1..4c43eb1df8 100644 --- a/EXILED/Exiled.Events/EventArgs/Map/AnnouncingScpTerminationEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Map/AnnouncingScpTerminationEventArgs.cs @@ -30,17 +30,14 @@ public class AnnouncingScpTerminationEventArgs : IAttackerEvent, IDeniableEvent /// /// /// - /// - /// - /// - public AnnouncingScpTerminationEventArgs(Player scp, DamageHandlerBase damageHandlerBase, bool isAllowed = true) + public AnnouncingScpTerminationEventArgs(Player scp, DamageHandlerBase damageHandlerBase) { Player = scp; Role = scp.Role; DamageHandler = new CustomDamageHandler(scp, damageHandlerBase); Attacker = DamageHandler.BaseIs(out CustomAttackerHandler customAttackerHandler) ? customAttackerHandler.Attacker : null; TerminationCause = damageHandlerBase.CassieDeathAnnouncement.Announcement; - IsAllowed = isAllowed; + IsAllowed = true; } /// @@ -71,6 +68,6 @@ public AnnouncingScpTerminationEventArgs(Player scp, DamageHandlerBase damageHan /// /// Gets or sets a value indicating whether the SCP termination will be announced by C.A.S.S.I.E. /// - public bool IsAllowed { get; set; } = true; + public bool IsAllowed { get; set; } } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/ActivatingGeneratorEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ActivatingGeneratorEventArgs.cs index 33a6e87ee5..8050e534bf 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ActivatingGeneratorEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ActivatingGeneratorEventArgs.cs @@ -27,14 +27,11 @@ public class ActivatingGeneratorEventArgs : IPlayerEvent, IGeneratorEvent, IDeni /// /// /// - /// - /// - /// - public ActivatingGeneratorEventArgs(Player player, Scp079Generator generator, bool isAllowed = true) + public ActivatingGeneratorEventArgs(Player player, Scp079Generator generator) { Player = player; Generator = Generator.Get(generator); - IsAllowed = isAllowed; + IsAllowed = true; } /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/ActivatingWarheadPanelEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ActivatingWarheadPanelEventArgs.cs index f31eded385..65504085ed 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ActivatingWarheadPanelEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ActivatingWarheadPanelEventArgs.cs @@ -25,7 +25,7 @@ public class ActivatingWarheadPanelEventArgs : IPlayerEvent, IDeniableEvent /// /// /// - public ActivatingWarheadPanelEventArgs(Player player, bool isAllowed = true) + public ActivatingWarheadPanelEventArgs(Player player, bool isAllowed) { Player = player; IsAllowed = isAllowed; diff --git a/EXILED/Exiled.Events/EventArgs/Player/ClosingGeneratorEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ClosingGeneratorEventArgs.cs index 9218db494b..c33b0bcc0f 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ClosingGeneratorEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ClosingGeneratorEventArgs.cs @@ -21,12 +21,11 @@ public class ClosingGeneratorEventArgs : IPlayerEvent, IDeniableEvent, IGenerato /// /// The player who's closing the generator. /// The instance. - /// Indicates whether the generator can be closed. - public ClosingGeneratorEventArgs(Player player, Scp079Generator generator, bool isAllowed = true) + public ClosingGeneratorEventArgs(Player player, Scp079Generator generator) { Player = player; Generator = Generator.Get(generator); - IsAllowed = isAllowed; + IsAllowed = true; } /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/FailingEscapePocketDimensionEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/FailingEscapePocketDimensionEventArgs.cs index 490ebfa1a9..620178368c 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/FailingEscapePocketDimensionEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/FailingEscapePocketDimensionEventArgs.cs @@ -24,16 +24,16 @@ public class FailingEscapePocketDimensionEventArgs : IPlayerEvent, IDeniableEven /// /// /// - /// + /// /// /// /// /// /// - public FailingEscapePocketDimensionEventArgs(PocketDimensionTeleport pocketDimensionTeleport, Player player, bool isAllowed = true) + public FailingEscapePocketDimensionEventArgs(PocketDimensionTeleport pocketDimensionTeleport, ReferenceHub hub, bool isAllowed = true) { + Player = Player.Get(hub); Teleporter = pocketDimensionTeleport; - Player = player; IsAllowed = isAllowed; } diff --git a/EXILED/Exiled.Events/EventArgs/Player/InteractingDoorEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/InteractingDoorEventArgs.cs index 75eb562f39..c93656d6fc 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/InteractingDoorEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/InteractingDoorEventArgs.cs @@ -33,17 +33,14 @@ public class InteractingDoorEventArgs : IPlayerEvent, IDoorEvent, IDeniableEvent /// /// /// - /// - /// - /// - public InteractingDoorEventArgs(Player player, DoorVariant door, byte colliderId, bool isAllowed = true, bool canInteract = true) + public InteractingDoorEventArgs(Player player, DoorVariant door, byte colliderId, bool isAllowed) { Player = player; Door = Door.Get(door); ColliderId = colliderId; Collider = InteractableCollider.TryGetCollider(door, colliderId, out InteractableCollider interactableCollider) ? interactableCollider : null; IsAllowed = isAllowed; - CanInteract = canInteract; + CanInteract = true; } /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/OpeningGeneratorEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/OpeningGeneratorEventArgs.cs index f69507e355..13dc43febf 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/OpeningGeneratorEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/OpeningGeneratorEventArgs.cs @@ -27,14 +27,11 @@ public class OpeningGeneratorEventArgs : IPlayerEvent, IDeniableEvent, IGenerato /// /// /// - /// - /// - /// - public OpeningGeneratorEventArgs(Player player, Scp079Generator generator, bool isAllowed = true) + public OpeningGeneratorEventArgs(Player player, Scp079Generator generator) { Player = player; Generator = Generator.Get(generator); - IsAllowed = isAllowed; + IsAllowed = true; } /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/ShotEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ShotEventArgs.cs index 0eb6a5c69d..18d2303353 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ShotEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ShotEventArgs.cs @@ -25,15 +25,16 @@ public class ShotEventArgs : IPlayerEvent, IFirearmEvent /// Raycast hit info. /// The firearm used. /// The IDestructible that was hit. Can be null. - public ShotEventArgs(HitscanHitregModuleBase hitregModule, RaycastHit hitInfo, InventorySystem.Items.Firearms.Firearm firearm, IDestructible destructible) + /// + public ShotEventArgs(HitscanHitregModuleBase hitregModule, RaycastHit hitInfo, InventorySystem.Items.Firearms.Firearm firearm, IDestructible destructible, float damage) { HitregModule = hitregModule; RaycastHit = hitInfo; Destructible = destructible; Firearm = Item.Get(firearm); + Damage = damage; Player = Firearm.Owner; - Damage = Destructible is not null ? HitregModule.DamageAtDistance(hitInfo.distance) : 0f; if (Destructible is HitboxIdentity hitboxIdentity) { diff --git a/EXILED/Exiled.Events/EventArgs/Player/StoppingGeneratorEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/StoppingGeneratorEventArgs.cs index 53f0d9ecf5..6462c655d8 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/StoppingGeneratorEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/StoppingGeneratorEventArgs.cs @@ -21,12 +21,11 @@ public class StoppingGeneratorEventArgs : IPlayerEvent, IGeneratorEvent, IDeniab /// /// The player who's flipping the switch. /// The instance. - /// Indicates whether the switch of the generator can be flipped. - public StoppingGeneratorEventArgs(Player player, Scp079Generator generator, bool isAllowed = true) + public StoppingGeneratorEventArgs(Player player, Scp079Generator generator) { Player = player; Generator = Generator.Get(generator); - IsAllowed = isAllowed; + IsAllowed = true; } /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/UnlockingGeneratorEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/UnlockingGeneratorEventArgs.cs index 422def506f..77541732d0 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/UnlockingGeneratorEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/UnlockingGeneratorEventArgs.cs @@ -30,7 +30,7 @@ public class UnlockingGeneratorEventArgs : IPlayerEvent, IGeneratorEvent, IDenia /// /// /// - public UnlockingGeneratorEventArgs(Player player, Scp079Generator generator, bool isAllowed = true) + public UnlockingGeneratorEventArgs(Player player, Scp079Generator generator, bool isAllowed) { Player = player; Generator = Generator.Get(generator); diff --git a/EXILED/Exiled.Events/Events.cs b/EXILED/Exiled.Events/Events.cs index 4815c2492c..103ba58829 100644 --- a/EXILED/Exiled.Events/Events.cs +++ b/EXILED/Exiled.Events/Events.cs @@ -81,9 +81,13 @@ public override void OnEnabled() RagdollManager.OnRagdollRemoved += Handlers.Internal.RagdollList.OnRemovedRagdoll; ItemPickupBase.OnPickupAdded += Handlers.Internal.PickupEvent.OnSpawnedPickup; ItemPickupBase.OnPickupDestroyed += Handlers.Internal.PickupEvent.OnRemovedPickup; - ServerConsole.ReloadServerName(); + + AdminToys.AdminToyBase.OnAdded += Handlers.Internal.AdminToyList.OnAddedAdminToys; + AdminToys.AdminToyBase.OnRemoved += Handlers.Internal.AdminToyList.OnRemovedAdminToys; ServerSpecificSettingsSync.ServerOnSettingValueReceived += SettingBase.OnSettingUpdated; + + ServerConsole.ReloadServerName(); } /// diff --git a/EXILED/Exiled.Events/Handlers/Internal/AdminToyList.cs b/EXILED/Exiled.Events/Handlers/Internal/AdminToyList.cs new file mode 100644 index 0000000000..2d4ebf971e --- /dev/null +++ b/EXILED/Exiled.Events/Handlers/Internal/AdminToyList.cs @@ -0,0 +1,27 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.Handlers.Internal +{ + /// + /// Handles adding and removing from . + /// + internal static class AdminToyList + { + /// + /// Called after a ragdoll is spawned. Hooked to . + /// + /// The spawned ragdoll. + public static void OnAddedAdminToys(AdminToys.AdminToyBase adminToy) => API.Features.Toys.AdminToy.Get(adminToy); + + /// + /// Called before a ragdoll is destroyed. Hooked to . + /// + /// The destroyed ragdoll. + public static void OnRemovedAdminToys(AdminToys.AdminToyBase adminToy) => API.Features.Toys.AdminToy.BaseToAdminToy.Remove(adminToy); + } +} diff --git a/EXILED/Exiled.Events/Handlers/Internal/SceneUnloaded.cs b/EXILED/Exiled.Events/Handlers/Internal/SceneUnloaded.cs index 63bb70267e..55b9d0738b 100644 --- a/EXILED/Exiled.Events/Handlers/Internal/SceneUnloaded.cs +++ b/EXILED/Exiled.Events/Handlers/Internal/SceneUnloaded.cs @@ -35,7 +35,6 @@ public static void OnSceneUnloaded(Scene _) { Player.UserIdsCache.Clear(); Player.Dictionary.Clear(); - AdminToy.BaseToAdminToy.Clear(); } } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs b/EXILED/Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs index 2c138e305e..0cb378ac02 100644 --- a/EXILED/Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs +++ b/EXILED/Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs @@ -35,40 +35,62 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); LocalBuilder isUnlocked = generator.DeclareLocal(typeof(bool)); - LocalBuilder notEmptyPermissions = generator.DeclareLocal(typeof(bool)); - LocalBuilder havePermissions = generator.DeclareLocal(typeof(bool)); + LocalBuilder hasPermission = generator.DeclareLocal(typeof(bool)); - Label skip = generator.DefineLabel(); Label ret = generator.DefineLabel(); int offset = 1; int index = newInstructions.FindIndex(i => i.LoadsField(Field(typeof(DoorVariant), nameof(DoorVariant.ActiveLocks)))) + offset; + Label continueLabel = (Label)newInstructions[index].operand; + newInstructions.RemoveAt(index); newInstructions.InsertRange( index, - new[] + new CodeInstruction[] { // check and write door lock state (isUnlocked) new(OpCodes.Ldc_I4_0), new(OpCodes.Ceq), - new CodeInstruction(OpCodes.Stloc_S, isUnlocked.LocalIndex), - }); - - index = newInstructions.FindIndex(i => i.LoadsField(Field(typeof(DoorPermissions), nameof(DoorPermissions.RequiredPermissions)))) + offset; - - newInstructions.InsertRange( - index, - new[] - { - // checking empty permissions - new(OpCodes.Ldc_I4_0), - new(OpCodes.Cgt), - - new(OpCodes.Stloc_S, notEmptyPermissions.LocalIndex), - new(OpCodes.Br_S, skip), - - // save original return - new CodeInstruction(OpCodes.Ret).MoveLabelsFrom(newInstructions[index + 1]), - new CodeInstruction(OpCodes.Nop).WithLabels(skip), - }); - - // 6 new instructions - offset = 6; - index += offset; - - newInstructions.RemoveRange(index, 14); - - newInstructions.InsertRange( - index, - new[] - { - // override permissions check, to implement KeycardPickup::Permissions - new(OpCodes.Ldarg_0), - new(OpCodes.Ldloc_1), - new CodeInstruction(OpCodes.Call, Method(typeof(KeycardInteracting), nameof(KeycardInteracting.CheckPermissions))), - new CodeInstruction(OpCodes.Stloc_S, havePermissions.LocalIndex), + new(OpCodes.Stloc_S, isUnlocked.LocalIndex), + new(OpCodes.Br, continueLabel), }); - // 4 new instructions - offset = 4; - index += offset; - - newInstructions.RemoveRange(index, 2); - - offset = -5; - index = newInstructions.FindIndex(i => i.Calls(PropertySetter(typeof(DoorVariant), nameof(DoorVariant.NetworkTargetState)))) + offset; + offset = 1; + index = newInstructions.FindIndex(i => i.Calls(Method( + typeof(DoorPermissionsPolicyExtensions), + nameof(DoorPermissionsPolicyExtensions.CheckPermissions), + new[] { typeof(IDoorPermissionRequester), typeof(IDoorPermissionProvider), typeof(PermissionUsed).MakeByRefType() }))) + offset; newInstructions.InsertRange( index, - new[] - { - // pickup - new(OpCodes.Ldarg_0), - - // PreviousOwner.Hub - new CodeInstruction(OpCodes.Ldarg_0), - new(OpCodes.Ldflda, Field(typeof(BaseKeycardPickup), nameof(BaseKeycardPickup.PreviousOwner))), - new(OpCodes.Ldfld, Field(typeof(Footprint), nameof(Footprint.Hub))), - new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), - - // door - new(OpCodes.Ldloc_1), - - // allowed calculate - new(OpCodes.Ldloc_S, isUnlocked), - - new(OpCodes.Ldloc_S, havePermissions), - - new(OpCodes.Ldloc_S, notEmptyPermissions), - new(OpCodes.Call, PropertyGetter(typeof(Events), nameof(Events.Instance))), - new(OpCodes.Callvirt, PropertyGetter(typeof(Events), nameof(Events.Config))), - new(OpCodes.Callvirt, PropertyGetter(typeof(Config), nameof(Config.CanKeycardThrowAffectDoors))), - new(OpCodes.Or), - - new(OpCodes.And), - new(OpCodes.And), - - // ThrowKeycardInteractingEventArgs ev = new(pickup, player, door, isAllowed); - // - // Item.OnThrowKeycardInteracting(ev); - // - // if (!ev.IsAllowed) - // return; - new(OpCodes.Newobj, GetDeclaredConstructors(typeof(KeycardInteractingEventArgs))[0]), - new(OpCodes.Dup), - new(OpCodes.Call, Method(typeof(Handlers.Item), nameof(Handlers.Item.OnKeycardInteracting))), - new(OpCodes.Callvirt, PropertyGetter(typeof(KeycardInteractingEventArgs), nameof(KeycardInteractingEventArgs.IsAllowed))), - new(OpCodes.Brfalse_S, ret), - }); + new CodeInstruction[] + { + // hasPermission + new(OpCodes.Stloc_S, hasPermission.LocalIndex), + + // pickup + new(OpCodes.Ldarg_0), + + // PreviousOwner.Hub + new(OpCodes.Ldarg_0), + new(OpCodes.Ldflda, Field(typeof(BaseKeycardPickup), nameof(BaseKeycardPickup.PreviousOwner))), + new(OpCodes.Ldfld, Field(typeof(Footprint), nameof(Footprint.Hub))), + new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), + + // door + new(OpCodes.Ldloc_1), + + // isAllowed = isUnlocked && hasPermission && Events.Instance.Config.CanKeycardThrowAffectDoors + new(OpCodes.Ldloc_S, isUnlocked.LocalIndex), + new(OpCodes.Ldloc_S, hasPermission.LocalIndex), + new(OpCodes.And), + new(OpCodes.Call, PropertyGetter(typeof(Events), nameof(Events.Instance))), + new(OpCodes.Callvirt, PropertyGetter(typeof(Events), nameof(Events.Config))), + new(OpCodes.Callvirt, PropertyGetter(typeof(Config), nameof(Config.CanKeycardThrowAffectDoors))), + new(OpCodes.And), + + // ev = new KeycardInteractingEventArgs(pickup, player, door, isAllowed) + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(KeycardInteractingEventArgs))[0]), + new(OpCodes.Dup), + new(OpCodes.Call, Method(typeof(Handlers.Item), nameof(Handlers.Item.OnKeycardInteracting))), + + new(OpCodes.Callvirt, PropertyGetter(typeof(KeycardInteractingEventArgs), nameof(KeycardInteractingEventArgs.IsAllowed))), + }); newInstructions.InsertRange( newInstructions.Count - 1, @@ -167,26 +123,5 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } - - private static bool CheckPermissions(BaseKeycardPickup keycard, DoorVariant door) - { - DoorPermissions permissions = door.RequiredPermissions; - if (permissions.RequiredPermissions == KeycardPermissions.None) - { - return true; - } - - if (Pickup.Get(keycard) is KeycardPickup keycardPickup) - { - if (!permissions.RequireAll) - { - return ((KeycardPermissions)keycardPickup.Permissions & permissions.RequiredPermissions) != 0; - } - - return ((KeycardPermissions)keycardPickup.Permissions & permissions.RequiredPermissions) == permissions.RequiredPermissions; - } - - return InventorySystem.InventoryItemLoader.AvailableItems.TryGetValue(keycard.Info.ItemId, out ItemBase itemBase) && permissions.CheckPermissions(itemBase, null); - } } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingChaosEntrance.cs b/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingChaosEntrance.cs index 1bf2c9c02d..0d53ebeefb 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingChaosEntrance.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingChaosEntrance.cs @@ -42,7 +42,7 @@ private static IEnumerable Transpiler(IEnumerable i.opcode == OpCodes.Ldloca_S); + int index = newInstructions.FindIndex(i => i.opcode == OpCodes.Pop) + 1; newInstructions.InsertRange(index, new[] { diff --git a/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingNtfEntrance.cs b/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingNtfEntrance.cs index f9663ecc7e..4d169bf050 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingNtfEntrance.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingNtfEntrance.cs @@ -55,8 +55,8 @@ private static IEnumerable Transpiler(IEnumerable x.characterClassManager.CurRole.team == Team.SCP && x.characterClassManager.CurClass != RoleTypeId.Scp0492); - new(OpCodes.Ldloc_3), + // scpsLeft + new(OpCodes.Ldloc_2), // string[] unitInformation = unitNameClear.Split('-'); new(OpCodes.Ldloc_1), @@ -111,7 +111,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable i.opcode == OpCodes.Ldloc_0) + offset; + int offset = -3; + int index = newInstructions.FindIndex(i => i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.ServerEvents.CassieQueuingScpTerminationEventArgs))[0]) + offset; newInstructions.InsertRange( index, @@ -53,10 +54,7 @@ private static IEnumerable Transpiler(IEnumerable - /// Patches . + /// Patches . /// Adds the event. /// [EventPatch(typeof(Map), nameof(Map.SpawningItem))] - [HarmonyPatch(typeof(ItemDistributor), nameof(ItemDistributor.CreatePickup))] + [HarmonyPatch(typeof(ItemDistributor), nameof(ItemDistributor.ServerRegisterPickup))] internal static class SpawningItem { private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) diff --git a/EXILED/Exiled.Events/Patches/Events/Map/SpawningRoomConnector.cs b/EXILED/Exiled.Events/Patches/Events/Map/SpawningRoomConnector.cs index e1cfcc367c..b379bdec1a 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/SpawningRoomConnector.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/SpawningRoomConnector.cs @@ -75,4 +75,32 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } + + /// + /// Patches . + /// Adds the event. + /// + [EventPatch(typeof(Handlers.Map), nameof(Handlers.Map.SpawningRoomConnector))] + [HarmonyPatch(typeof(SeedSynchronizer), nameof(SeedSynchronizer.GenerateLevel))] + internal static class SpawningRoomConnectorFix + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); + + int index = newInstructions.FindIndex(i => i.Calls(Method(typeof(RoomConnectorSpawnpointBase), nameof(RoomConnectorSpawnpointBase.SetupAllRoomConnectors)))); + List - [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.InteractingDoor))] + [EventPatch(typeof(Handlers.Player), nameof(Player.InteractingDoor))] [HarmonyPatch(typeof(DoorVariant), nameof(DoorVariant.ServerInteract), typeof(ReferenceHub), typeof(byte))] internal static class InteractingDoor { @@ -32,55 +33,166 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); - Label retLabel = generator.DefineLabel(); - LocalBuilder ev = generator.DeclareLocal(typeof(InteractingDoorEventArgs)); + LocalBuilder labEvent = generator.DeclareLocal(typeof(PlayerInteractedDoorEventArgs)); + + Label exiledEvContinue = generator.DefineLabel(); + Label labEvContinue = generator.DefineLabel(); + + int offset = -3; + int index = newInstructions.FindIndex(i => i.Calls(Method(typeof(DoorVariant), nameof(DoorVariant.AllowInteracting)))) + offset; + + Label elseStatement = newInstructions[index].labels[0]; + + offset = -1; + index = newInstructions.FindIndex(i => i.LoadsField(Field(typeof(DoorVariant), nameof(DoorVariant._remainingDeniedCooldown)))) + offset; + + Label bypassLock = generator.DefineLabel(); + Label continueLabel = generator.DefineLabel(); + + newInstructions[index].labels.Add(bypassLock); + + newInstructions.InsertRange( + index, + new[] + { + // pluginRequestSent = true (which prevent the second event call) + new(OpCodes.Ldc_I4_1), + new(OpCodes.Stloc_2), + + // Player.Get(ply) + new(OpCodes.Ldarg_1), + new(OpCodes.Call, Method(typeof(API.Features.Player), nameof(API.Features.Player.Get), new[] { typeof(ReferenceHub) })), + + // doorVariant + new(OpCodes.Ldarg_0), + + // colliderId + new(OpCodes.Ldarg_2), + + // false (canOpen is false because the door is locked, but still calling the event) + new(OpCodes.Ldc_I4_0), + + // ev = new InteractingDoorEventArgs(Player, DoorVariant, byte) + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(InteractingDoorEventArgs))[0]), + new(OpCodes.Dup), + new(OpCodes.Dup), + + // Player.OnInteractingDoor(ev); + new(OpCodes.Call, Method(typeof(Handlers.Player), nameof(Handlers.Player.OnInteractingDoor))), + + // if (ev.CanInteract) goto continueLabel + // else return + new(OpCodes.Callvirt, PropertyGetter(typeof(InteractingDoorEventArgs), nameof(InteractingDoorEventArgs.CanInteract))), + new(OpCodes.Brtrue_S, exiledEvContinue), + new(OpCodes.Pop), + new(OpCodes.Ret), + + // canOpen = ev.IsAllowed + new CodeInstruction(OpCodes.Callvirt, PropertyGetter(typeof(InteractingDoorEventArgs), nameof(InteractingDoorEventArgs.IsAllowed))).WithLabels(exiledEvContinue), + new(OpCodes.Stloc_0), + + // hub + new(OpCodes.Ldarg_1), - CodeInstruction[] interactingEvent = new CodeInstruction[] - { - // Player.Get(ply) - new(OpCodes.Ldarg_1), - new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), + // doorVariant + new(OpCodes.Ldarg_0), - // this - new(OpCodes.Ldarg_0), + // canOpen + new(OpCodes.Ldloc_0), - // colliderId - new(OpCodes.Ldarg_2), + // labEvent = new PlayerInteractingDoorEventArgs(ReferenceHub, DoorVariant, bool) + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(PlayerInteractingDoorEventArgs))[0]), + new(OpCodes.Dup), + new(OpCodes.Dup), + new(OpCodes.Stloc_S, labEvent.LocalIndex), - // IsAllowed - new(OpCodes.Ldloc_1), + // PlayerEvents.OnInteractingDoor(labEvent) + new(OpCodes.Call, Method(typeof(PlayerEvents), nameof(PlayerEvents.OnInteractingDoor))), - // CanInteract - new(OpCodes.Ldc_I4_1), + // if (!labEvent.IsAllowed) goto bypassLock + new(OpCodes.Callvirt, PropertyGetter(typeof(PlayerInteractingDoorEventArgs), nameof(PlayerInteractingDoorEventArgs.IsAllowed))), + new(OpCodes.Brfalse_S, bypassLock), - // InteractingDoorEventArgs ev = new(Player.Get(ply), __instance, colliderId, bool, true); - new(OpCodes.Newobj, GetDeclaredConstructors(typeof(InteractingDoorEventArgs))[0]), - new(OpCodes.Dup), - new(OpCodes.Dup), + // canOpen = ev.CanOpen + new(OpCodes.Ldloc_S, labEvent.LocalIndex), + new CodeInstruction(OpCodes.Callvirt, PropertyGetter(typeof(PlayerInteractingDoorEventArgs), nameof(PlayerInteractingDoorEventArgs.CanOpen))).WithLabels(labEvContinue), + new(OpCodes.Stloc_0), + new(OpCodes.Br_S, elseStatement), + }); - // Handlers.Player.OnInteractingDoor(ev); - new(OpCodes.Call, Method(typeof(Handlers.Player), nameof(Handlers.Player.OnInteractingDoor))), - new(OpCodes.Stloc_S, ev.LocalIndex), + offset = -3; + index = newInstructions.FindLastIndex(i => i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerInteractingDoorEventArgs))[0]) + offset; - // if (!ev.CanInteract) return; - new(OpCodes.Callvirt, PropertyGetter(typeof(InteractingDoorEventArgs), nameof(InteractingDoorEventArgs.CanInteract))), - new(OpCodes.Brfalse_S, retLabel), + newInstructions.InsertRange( + index, + new[] + { + // Player.Get(ply) + new(OpCodes.Ldarg_1), + new(OpCodes.Call, Method(typeof(API.Features.Player), nameof(API.Features.Player.Get), new[] { typeof(ReferenceHub) })), - // CanInteract = ev.IsAllowed (Reminder this is done on purpose because we prefer than IDeniableEvent when cancel use CanInteract and not Interacting) - new(OpCodes.Ldloc_S, ev.LocalIndex), - new(OpCodes.Callvirt, PropertyGetter(typeof(InteractingDoorEventArgs), nameof(InteractingDoorEventArgs.IsAllowed))), - new(OpCodes.Stloc_1), - }; + // doorVariant + new(OpCodes.Ldarg_0), + + // colliderId + new(OpCodes.Ldarg_2), + + // canOpen + new(OpCodes.Ldloc_0), + + // ev = new InteractingDoorEventArgs(Player, DoorVariant, byte) + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(InteractingDoorEventArgs))[0]), + new(OpCodes.Dup), + new(OpCodes.Dup), + + // Player.OnInteractingDoor(ev); + new(OpCodes.Call, Method(typeof(Handlers.Player), nameof(Handlers.Player.OnInteractingDoor))), + + // if (ev.CanInteract) goto continueLabel + // else return + new(OpCodes.Callvirt, PropertyGetter(typeof(InteractingDoorEventArgs), nameof(InteractingDoorEventArgs.CanInteract))), + new(OpCodes.Brtrue_S, continueLabel), + new(OpCodes.Pop), + new(OpCodes.Ret), + + // canOpen = ev.IsAllowed + new CodeInstruction(OpCodes.Callvirt, PropertyGetter(typeof(InteractingDoorEventArgs), nameof(InteractingDoorEventArgs.IsAllowed))).WithLabels(continueLabel), + new(OpCodes.Stloc_0), + }); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + } + + /// + /// Patches . + /// + [EventPatch(typeof(Handlers.Player), nameof(Player.InteractingDoor))] + [HarmonyPatch(typeof(DoorVariant), nameof(DoorVariant.TryResolveLock))] +#pragma warning disable SA1402 + internal static class ChangeNWLogic + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); - int offset = 4; - int index = newInstructions.FindLastIndex(x => x.Calls(Method(typeof(DoorLockUtils), nameof(DoorLockUtils.HasFlagFast), new System.Type[] { typeof(DoorLockMode), typeof(DoorLockMode) }))) + offset; - newInstructions.InsertRange(index, interactingEvent); + int offset = -3; + int index = newInstructions.FindIndex(i => i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerInteractingDoorEventArgs))[0]) + offset; - offset = 2; - index = newInstructions.FindIndex(x => x.opcode == OpCodes.Ldloc_0) + offset; - newInstructions.InsertRange(index, interactingEvent); + newInstructions.InsertRange( + index, + new[] + { + new CodeInstruction(OpCodes.Ldc_I4_0).MoveLabelsFrom(newInstructions[index]), + new(OpCodes.Ret), + }); - newInstructions[newInstructions.Count - 1].labels.Add(retLabel); + // placing index after new added instructions + index += 2; + newInstructions.RemoveRange(index, newInstructions.Count - index); for (int z = 0; z < newInstructions.Count; z++) yield return newInstructions[z]; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/InteractingGenerator.cs b/EXILED/Exiled.Events/Patches/Events/Player/InteractingGenerator.cs index 796e588b8e..ade2d45a67 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/InteractingGenerator.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/InteractingGenerator.cs @@ -9,6 +9,7 @@ namespace Exiled.Events.Patches.Events.Player { using System.Collections.Generic; using System.Diagnostics; + using System.Linq; using System.Reflection; using System.Reflection.Emit; @@ -41,19 +42,14 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); LocalBuilder player = generator.DeclareLocal(typeof(API.Features.Player)); - LocalBuilder isAllowedUnlocking = generator.DeclareLocal(typeof(bool)); - Label isOpening = generator.DefineLabel(); - Label isActivating = generator.DefineLabel(); - Label check = generator.DefineLabel(); - Label check2 = generator.DefineLabel(); - Label notAllowed = generator.DefineLabel(); - Label skip = generator.DefineLabel(); - Label skip2 = generator.DefineLabel(); - Label @break = (Label)newInstructions.FindLast(instruction => instruction.opcode == OpCodes.Br_S).operand; + int offset = -1; + int index = newInstructions.FindLastIndex(i => i.LoadsField(Field(typeof(Scp079Generator), nameof(Scp079Generator._cooldownStopwatch)))) + offset; - int offset = 1; - int index = newInstructions.FindIndex(instruction => instruction.Calls(Method(typeof(Stopwatch), nameof(Stopwatch.Stop)))) + offset; + Label breakLabel = newInstructions[index].labels.First(); + + offset = 1; + index = newInstructions.FindIndex(instruction => instruction.Calls(Method(typeof(Stopwatch), nameof(Stopwatch.Stop)))) + offset; newInstructions.InsertRange( index, @@ -65,121 +61,74 @@ private static IEnumerable Transpiler(IEnumerable instruction.opcode == OpCodes.Newobj && (ConstructorInfo)instruction.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerClosingGeneratorEventArgs))[0]) + offset; - - // if (this.HasFlag(_flags, GeneratorFlags.Open)) - // { - // ClosingGeneratorEventArgs ev = new(player, this, true); - // - // Player.OnClosingGenerator(ev); - // - // if (!ev.IsAllowed) - // { - // this._targetCooldown = this._unlockCooldownTime; - // this.RpcDenied(); - // break; - // } - // } - // else - // { - // OpeningGeneratorEventArgs ev = new(player, this, true); - // - // Player.OnOpeningGenerator(ev); - // - // if (!ev.IsAllowed) - // { - // this._targetCooldown = this._unlockCooldownTime; - // this.RpcDenied(); - // break; - // } - // } + // closing generator index + offset = -2; + index = newInstructions.FindIndex(i => i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerClosingGeneratorEventArgs))[0]) + offset; + newInstructions.InsertRange( index, - new[] + new CodeInstruction[] { // player - new CodeInstruction(OpCodes.Ldloc_S, player.LocalIndex), - - // this - new(OpCodes.Ldarg_0), - - // true - new(OpCodes.Ldc_I4_1), + new(OpCodes.Ldloc_S, player.LocalIndex), - // if (!this.HasFlag(_flags, GeneratorFlags.Open)) - // goto isOpening; + // Scp079Generator new(OpCodes.Ldarg_0), - new(OpCodes.Ldarg_0), - new(OpCodes.Ldfld, Field(typeof(Scp079Generator), nameof(Scp079Generator._flags))), - new(OpCodes.Ldc_I4_4), // GeneratorFlags.Open - new(OpCodes.Callvirt, Method(typeof(Scp079Generator), nameof(Scp079Generator.HasFlag))), - new(OpCodes.Brfalse_S, isOpening), - // ClosingGeneratorEventArgs ev = new(Player, Scp079Generator, bool) + // ClosingGeneratorEventArgs ev = new(Player, Scp079Generator) new(OpCodes.Newobj, GetDeclaredConstructors(typeof(ClosingGeneratorEventArgs))[0]), new(OpCodes.Dup), // Player.OnClosingGenerator(ev) new(OpCodes.Call, Method(typeof(Player), nameof(Player.OnClosingGenerator))), - // ev.IsAllowed - // - // goto check + // if (!ev.IsAllowed) goto break; new(OpCodes.Callvirt, PropertyGetter(typeof(ClosingGeneratorEventArgs), nameof(ClosingGeneratorEventArgs.IsAllowed))), - new(OpCodes.Br_S, check), - - // OpeningGeneratorEventArgs ev = new(Player, Scp079Generator, bool) - new CodeInstruction(OpCodes.Newobj, GetDeclaredConstructors(typeof(OpeningGeneratorEventArgs))[0]).WithLabels(isOpening), - new(OpCodes.Dup), + new(OpCodes.Brfalse_S, breakLabel), + }); - // Player.OnOpeningGenerator(ev) - new(OpCodes.Call, Method(typeof(Player), nameof(Player.OnOpeningGenerator))), + // opening generator index + offset = -2; + index = newInstructions.FindIndex(i => i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerOpeningGeneratorEventArgs))[0]) + offset; - // loads ev.isAllowed - // - // if (ev.IsAllowed) - // goto skip; - new(OpCodes.Callvirt, PropertyGetter(typeof(OpeningGeneratorEventArgs), nameof(OpeningGeneratorEventArgs.IsAllowed))), - new CodeInstruction(OpCodes.Brtrue_S, skip).WithLabels(check), + newInstructions.InsertRange( + index, + new[] + { + // player + new CodeInstruction(OpCodes.Ldloc_S, player.LocalIndex).MoveLabelsFrom(newInstructions[index]), - // notAllowed: - // - // this._targetCooldown = this._unlockCooldownTime; - new CodeInstruction(OpCodes.Ldarg_0).WithLabels(notAllowed), + // Scp079Generator new(OpCodes.Ldarg_0), - new(OpCodes.Ldfld, Field(typeof(Scp079Generator), nameof(Scp079Generator._unlockCooldownTime))), - new(OpCodes.Stfld, Field(typeof(Scp079Generator), nameof(Scp079Generator._targetCooldown))), - // this.RpcDenied() - new(OpCodes.Ldarg_0), - new(OpCodes.Callvirt, Method(typeof(Scp079Generator), nameof(Scp079Generator.RpcDenied))), + // OpeningGeneratorEventArgs ev = new(Player, Scp079Generator) + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(OpeningGeneratorEventArgs))[0]), + new(OpCodes.Dup), - // goto @break - new(OpCodes.Br_S, @break), + // Player.OnOpeningGenerator(ev) + new(OpCodes.Call, Method(typeof(Player), nameof(Player.OnOpeningGenerator))), - // skip: - new CodeInstruction(OpCodes.Nop).WithLabels(skip), + // if (!ev.IsAllowed) goto break; + new(OpCodes.Callvirt, PropertyGetter(typeof(OpeningGeneratorEventArgs), nameof(OpeningGeneratorEventArgs.IsAllowed))), + new(OpCodes.Brfalse_S, breakLabel), }); - offset = -6; - index = newInstructions.FindLastIndex(instruction => instruction.Calls(Method(typeof(Scp079Generator), nameof(Scp079Generator.RpcDenied)))) + offset; + // unlocking generator index + offset = -2; + index = newInstructions.FindIndex(i => i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerUnlockingGeneratorEventArgs))[0]) + offset; newInstructions.InsertRange( index, new[] { - // save the value of IsAllowed - new CodeInstruction(OpCodes.Stloc_S, isAllowedUnlocking.LocalIndex).MoveLabelsFrom(newInstructions[index]), - // player - new(OpCodes.Ldloc_S, player.LocalIndex), + new CodeInstruction(OpCodes.Ldloc_S, player.LocalIndex), - // this + // Scp079Generator new(OpCodes.Ldarg_0), - // isAllowed - new(OpCodes.Ldloc_S, isAllowedUnlocking.LocalIndex), + // flag + new(OpCodes.Ldloc_2), // UnlockingGeneratorEventArgs ev = new(Player, Scp079Generator, bool) new(OpCodes.Newobj, GetDeclaredConstructors(typeof(UnlockingGeneratorEventArgs))[0]), @@ -188,113 +137,69 @@ private static IEnumerable Transpiler(IEnumerable i.Calls(PropertySetter(typeof(Scp079Generator), nameof(Scp079Generator.Activating)))) + offset; - - // if (this.Activating) - // { - // StoppingGeneratorEventArgs ev = new(player, this, true); - // - // Player.OnStoppingGenerator(ev); - // - // if (!ev.IsAllowed) - // { - // this._targetCooldown = this._unlockCooldownTime; - // this.RpcDenied(); - // break; - // } - // } - // else - // { - // ActivatingGeneratorEventArgs ev = new(player, this, true); - // - // Player.OnActivatingGenerator(ev); - // - // if (!ev.IsAllowed) - // { - // this._targetCooldown = this._unlockCooldownTime; - // this.RpcDenied(); - // break; - // } - // } + // activating generator index + offset = -2; + index = newInstructions.FindIndex(i => i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerActivatingGeneratorEventArgs))[0]) + offset; + newInstructions.InsertRange( index, new[] { // player - new CodeInstruction(OpCodes.Ldloc_S, player.LocalIndex).MoveLabelsFrom(newInstructions[index]), - - // this - new(OpCodes.Ldarg_0), - - // true - new(OpCodes.Ldc_I4_1), + new CodeInstruction(OpCodes.Ldloc_S, player.LocalIndex), - // if (!this.Activating) - // goto isActivating; + // Scp079Generator new(OpCodes.Ldarg_0), - new(OpCodes.Callvirt, PropertyGetter(typeof(Scp079Generator), nameof(Scp079Generator.Activating))), - new(OpCodes.Brfalse_S, isActivating), - // StoppingGeneratorEventArgs ev = new(Player, Scp079Generator, bool) - new(OpCodes.Newobj, GetDeclaredConstructors(typeof(StoppingGeneratorEventArgs))[0]), - new(OpCodes.Dup), - - // Player.OnStoppingGenerator(ev) - new(OpCodes.Call, Method(typeof(Player), nameof(Player.OnStoppingGenerator))), - - // ev.IsAllowed - new(OpCodes.Callvirt, PropertyGetter(typeof(StoppingGeneratorEventArgs), nameof(StoppingGeneratorEventArgs.IsAllowed))), - new(OpCodes.Br_S, check2), - - // isActivating: - // - // ActivatingGeneratorEventArgs ev = new(Player, Scp079Generator, bool) - new CodeInstruction(OpCodes.Newobj, GetDeclaredConstructors(typeof(ActivatingGeneratorEventArgs))[0]).WithLabels(isActivating), + // ActivatingGeneratorEventArgs ev = new(Player, Scp079Generator) + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(ActivatingGeneratorEventArgs))[0]), new(OpCodes.Dup), // Player.OnActivatingGenerator(ev) new(OpCodes.Call, Method(typeof(Player), nameof(Player.OnActivatingGenerator))), - // if (!ev.IsAllowed) - // goto notAllowed; + // if (!ev.IsAllowed) goto break; new(OpCodes.Callvirt, PropertyGetter(typeof(ActivatingGeneratorEventArgs), nameof(ActivatingGeneratorEventArgs.IsAllowed))), - new CodeInstruction(OpCodes.Brfalse_S, notAllowed).WithLabels(check2), + new(OpCodes.Brfalse_S, breakLabel), }); - offset = 1; - index = newInstructions.FindLastIndex(i => i.opcode == OpCodes.Brfalse_S) + offset; - - newInstructions.InsertRange( - index, - new[] - { - // player - new CodeInstruction(OpCodes.Ldloc_S, player.LocalIndex), - - // this - new(OpCodes.Ldarg_0), - - // true - new(OpCodes.Ldc_I4_1), - - // StoppingGeneratorEventArgs ev = new(Player, Scp079Generator, bool) - new(OpCodes.Newobj, GetDeclaredConstructors(typeof(StoppingGeneratorEventArgs))[0]), - new(OpCodes.Dup), - - // Player.OnStoppingGenerator(ev) - new(OpCodes.Call, Method(typeof(Player), nameof(Player.OnStoppingGenerator))), - - // if (!ev.IsAllowed) - // return notAllowed; - new(OpCodes.Callvirt, PropertyGetter(typeof(StoppingGeneratorEventArgs), nameof(StoppingGeneratorEventArgs.IsAllowed))), - new(OpCodes.Brfalse_S, notAllowed), - }); + // deactivating generator instructions + CodeInstruction[] deactivatingGeneratorEvent = + { + // Scp079Generator + new(OpCodes.Ldarg_0), + + // StoppingGeneratorEventArgs ev = new(Player, Scp079Generator) + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(StoppingGeneratorEventArgs))[0]), + new(OpCodes.Dup), + + // Player.OnStoppingGenerator(ev) + new(OpCodes.Call, Method(typeof(Player), nameof(Player.OnStoppingGenerator))), + + // if (!ev.IsAllowed) goto break; + new(OpCodes.Callvirt, PropertyGetter(typeof(StoppingGeneratorEventArgs), nameof(StoppingGeneratorEventArgs.IsAllowed))), + new(OpCodes.Brfalse_S, breakLabel), + }; + + // deactivating generator index + offset = -2; + index = newInstructions.FindIndex(i => i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerDeactivatingGeneratorEventArgs))[0]) + offset; + newInstructions.InsertRange(index, new[] + { + new CodeInstruction(OpCodes.Ldloc_S, player.LocalIndex).MoveLabelsFrom(newInstructions[index]), + }.AddRangeToArray(deactivatingGeneratorEvent)); + + // second deactivating generator index + index = newInstructions.FindLastIndex(i => i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerDeactivatingGeneratorEventArgs))[0]) + offset; + newInstructions.InsertRange(index, new[] + { + new CodeInstruction(OpCodes.Ldloc_S, player.LocalIndex), + }.AddRangeToArray(deactivatingGeneratorEvent)); for (int z = 0; z < newInstructions.Count; z++) yield return newInstructions[z]; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/InteractingLocker.cs b/EXILED/Exiled.Events/Patches/Events/Player/InteractingLocker.cs index 21f3ef2d23..3ce7b9aeee 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/InteractingLocker.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/InteractingLocker.cs @@ -8,6 +8,7 @@ namespace Exiled.Events.Patches.Events.Player { using System.Collections.Generic; + using System.Reflection; using System.Reflection.Emit; using API.Features; @@ -32,14 +33,15 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); - int index = newInstructions.FindLastIndex(instruction => instruction.opcode == OpCodes.Ldloc_1); + int offset = -9; + int index = newInstructions.FindIndex(i => i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerInteractingLockerEventArgs))[0]) + offset; newInstructions.InsertRange( index, - new[] + new CodeInstruction[] { // Player.Get(ply); - new CodeInstruction(OpCodes.Ldarg_1).MoveLabelsFrom(newInstructions[index]), + new(OpCodes.Ldarg_1), new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), // this @@ -54,7 +56,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable instruction.opcode == OpCodes.Stloc_2) + offset; + int index = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Ldloc_1); + newInstructions[index].labels.Add(continueLabel); newInstructions.InsertRange( index, @@ -43,7 +43,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerPickingUpArmorEventArgs))[0]) + offset; newInstructions.InsertRange( index, @@ -43,7 +45,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerPickingUpItemEventArgs))[0]) + offset; newInstructions[index].WithLabels(continueLabel); @@ -50,7 +52,7 @@ private static IEnumerable Transpiler(IEnumerable /// Patches to add missing event handler to the /// . @@ -36,8 +35,8 @@ private static IEnumerable Transpiler(IEnumerable instruction.opcode == OpCodes.Ret) + offset; + int offset = -4; + int index = newInstructions.FindIndex(i => i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.PlayerEvents.PlayerPickingUpItemEventArgs))[0]) + offset; newInstructions.InsertRange( index, @@ -45,7 +44,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable - /// Patches . + /// Patches . /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Shot))] - [HarmonyPatch(typeof(HitscanHitregModuleBase), nameof(HitscanHitregModuleBase.ServerPerformHitscan))] - internal static class Shot + [HarmonyPatch(typeof(HitscanHitregModuleBase), nameof(HitscanHitregModuleBase.ServerApplyDestructibleDamage))] + internal static class ShotTarget { - private static void ProcessRaycastMiss(HitscanHitregModuleBase hitregModule, Ray ray, float maxDistance) - { - RaycastHit hit = new() - { - distance = maxDistance, - point = ray.GetPoint(maxDistance), - normal = -ray.direction, - }; - - ShotEventArgs ev = new(hitregModule, hit, hitregModule.Firearm, null); - Handlers.Player.OnShot(ev); - } - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { List newInstructions = ListPool.Pool.Get(instructions); - /* - IL_0020: ldarg.1 // targetRay - IL_0021: ldloca.s hitInfo - IL_0023: ldloc.0 // maxDistance - IL_0024: ldsfld class CachedLayerMask InventorySystem.Items.Firearms.Modules.HitscanHitregModuleBase::HitregMask - IL_0029: call int32 CachedLayerMask::op_Implicit(class CachedLayerMask) - IL_002e: call bool [UnityEngine.PhysicsModule]UnityEngine.Physics::Raycast(valuetype [UnityEngine.CoreModule]UnityEngine.Ray, valuetype [UnityEngine.PhysicsModule]UnityEngine.RaycastHit&, float32, int32) - IL_0033: brtrue.s IL_0037 - [] <= Here - */ - MethodInfo raycastMethod = Method(typeof(Physics), nameof(Physics.Raycast), new[] { typeof(Ray), typeof(RaycastHit).MakeByRefType(), typeof(float), typeof(int) }); - int raycastFailIndex = newInstructions.FindIndex(i => i.Calls(raycastMethod)) + 2; - - newInstructions.InsertRange( - raycastFailIndex, - new CodeInstruction[] - { - // ProcessRaycastMiss(this, targetRay, maxDistance); - new(OpCodes.Ldarg_0), - new(OpCodes.Ldarg_1), - new(OpCodes.Ldloc_0), - new(OpCodes.Call, Method(typeof(Shot), nameof(ProcessRaycastMiss))), - }); - - /* - IL_0037: ldloca.s hitInfo - IL_0039: call instance class [UnityEngine.PhysicsModule]UnityEngine.Collider [UnityEngine.PhysicsModule]UnityEngine.RaycastHit::get_collider() - IL_003e: ldloca.s component - IL_0040: callvirt instance bool [UnityEngine.CoreModule]UnityEngine.Component::TryGetComponent(!!0/*class IDestructible* /&) - [] <= Here // This position is reached whether IDestructible is found or not. - IL_0045: brfalse.s IL_005e - */ - int destructibleGetIndex = newInstructions.FindIndex(i => i.operand is MethodInfo { Name: nameof(Component.TryGetComponent) }) + 1; + int index = newInstructions.FindIndex(i => i.opcode == OpCodes.Ldloc_2); Label continueLabel = generator.DefineLabel(); LocalBuilder ev = generator.DeclareLocal(typeof(ShotEventArgs)); newInstructions.InsertRange( - destructibleGetIndex, + index, new[] { - // var ev = new ShotEventArgs(this, hitInfo, firearm, component); - new(OpCodes.Ldarg_0), // this - new(OpCodes.Ldloc_1), // hitInfo - new(OpCodes.Ldarg_0), // this.Firearm + // this + new(OpCodes.Ldarg_0), + + // target.Raycast.Hit + new(OpCodes.Ldarg_1), + new(OpCodes.Ldfld, Field(typeof(DestructibleHitPair), nameof(DestructibleHitPair.Raycast))), + new(OpCodes.Ldfld, Field(typeof(HitRayPair), nameof(HitRayPair.Hit))), + + // this.Firearm + new(OpCodes.Ldarg_0), new(OpCodes.Callvirt, PropertyGetter(typeof(HitscanHitregModuleBase), nameof(HitscanHitregModuleBase.Firearm))), - new(OpCodes.Ldloc_2), // component + + // destructible + new(OpCodes.Ldloc_2), + + // damage + new(OpCodes.Ldloc_0), + + // ShotEventArgs ev = new ShotEventArgs(this, hitInfo, firearm, component, damage); new(OpCodes.Newobj, GetDeclaredConstructors(typeof(ShotEventArgs))[0]), - new(OpCodes.Dup), // Leave ShotEventArgs on the stack + new(OpCodes.Dup), + new(OpCodes.Dup), new(OpCodes.Stloc_S, ev.LocalIndex), - new(OpCodes.Dup), // Leave ShotEventArgs on the stack new(OpCodes.Call, Method(typeof(Handlers.Player), nameof(Handlers.Player.OnShot))), - // if (!ev.CanHurt) hitInfo.distance = maxDistance; + // if (!ev.CanHurt) num = 0; new(OpCodes.Callvirt, PropertyGetter(typeof(ShotEventArgs), nameof(ShotEventArgs.CanHurt))), new(OpCodes.Brtrue, continueLabel), - new(OpCodes.Ldloca_S, 1), // hitInfo address - new(OpCodes.Ldloc_0), // maxDistance - new(OpCodes.Call, PropertySetter(typeof(RaycastHit), nameof(RaycastHit.distance))), // hitInfo.distance = maxDistance + new(OpCodes.Ldc_I4_0), + new(OpCodes.Stloc_0), new CodeInstruction(OpCodes.Nop).WithLabels(continueLabel), }); - /* - [] <= Here - IL_0067: ldarg.0 // this - IL_0068: call instance class InventorySystem.Items.Firearms.Firearm InventorySystem.Items.Firearms.FirearmSubcomponentBase::get_Firearm() - IL_006d: ldloca.s module - IL_006f: ldc.i4.1 - IL_0070: call bool InventorySystem.Items.Firearms.Modules.ModulesUtils::TryGetModule(class InventorySystem.Items.Firearms.Firearm, !!0/*class InventorySystem.Items.Firearms.Modules.ImpactEffectsModule* /&, bool) - IL_0075: brtrue.s IL_0079 - */ - int impactEffectsIndex = newInstructions.FindIndex(i => i.operand is MethodInfo { Name: nameof(ModulesUtils.TryGetModule) }) - 4; - List - [HarmonyPatch(typeof(BodyArmorUtils), nameof(BodyArmorUtils.RemoveEverythingExceedingLimits), typeof(Inventory), typeof(BodyArmor), typeof(bool), typeof(bool))] + [HarmonyPatch(typeof(BodyArmorUtils), nameof(BodyArmorUtils.RemoveEverythingExceedingLimits), typeof(InventorySystem.Inventory))] internal static class ArmorDropPatch { private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) diff --git a/EXILED/Exiled.Events/Patches/Fixes/LockerFixes.cs b/EXILED/Exiled.Events/Patches/Fixes/LockerFixes.cs index 97cbb98577..2538e90ca2 100644 --- a/EXILED/Exiled.Events/Patches/Fixes/LockerFixes.cs +++ b/EXILED/Exiled.Events/Patches/Fixes/LockerFixes.cs @@ -23,7 +23,7 @@ namespace Exiled.Events.Patches.Fixes /// /// Fix for chamber lists weren't cleared. /// - [HarmonyPatch(typeof(LockerChamber), nameof(LockerChamber.SetDoor))] + [HarmonyPatch(typeof(LockerChamber), nameof(LockerChamber.OnFirstTimeOpen))] internal class LockerFixes { private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) diff --git a/EXILED/Exiled.Events/Patches/Fixes/RemoteAdminNpcCommandAddToDictionaryFix.cs b/EXILED/Exiled.Events/Patches/Fixes/RemoteAdminNpcCommandAddToDictionaryFix.cs index cb7b867f77..ec70f756bc 100644 --- a/EXILED/Exiled.Events/Patches/Fixes/RemoteAdminNpcCommandAddToDictionaryFix.cs +++ b/EXILED/Exiled.Events/Patches/Fixes/RemoteAdminNpcCommandAddToDictionaryFix.cs @@ -16,6 +16,7 @@ namespace Exiled.Events.Patches.Fixes using Exiled.API.Features.Pools; using GameCore; using HarmonyLib; + using NetworkManagerUtils.Dummies; using UnityEngine; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Fixes/Scp3114FriendlyFireFix.cs b/EXILED/Exiled.Events/Patches/Fixes/Scp3114FriendlyFireFix.cs index e2d309ced2..6d0f4accf4 100644 --- a/EXILED/Exiled.Events/Patches/Fixes/Scp3114FriendlyFireFix.cs +++ b/EXILED/Exiled.Events/Patches/Fixes/Scp3114FriendlyFireFix.cs @@ -94,6 +94,10 @@ public Scp3114FriendlyFireFix2(Footprint attacker, float damage) public override float Damage { get; set; } + public override string RagdollInspectText { get; } + + public override string DeathScreenText { get; } + public override string ServerLogsText { get; } #pragma warning restore SA1600 // Elements should be documented diff --git a/EXILED/Exiled.Events/Patches/Generic/CameraList.cs b/EXILED/Exiled.Events/Patches/Generic/CameraList.cs index c0981eb87f..db02509a4f 100644 --- a/EXILED/Exiled.Events/Patches/Generic/CameraList.cs +++ b/EXILED/Exiled.Events/Patches/Generic/CameraList.cs @@ -37,10 +37,13 @@ private static IEnumerable Transpiler(IEnumerable i.Calls(PropertySetter(typeof(Scp079InteractableBase), nameof(Scp079InteractableBase.Room)))) + offset; + // if (this is Scp079Camera camera) // Room.RoomIdentifierToRoom[Room].CamerasValue.Add(new Camera(camera)); newInstructions.InsertRange( - newInstructions.Count - 1, + index, new CodeInstruction[] { new(OpCodes.Ldarg_0), diff --git a/EXILED/Exiled.Events/Patches/Generic/RoomList.cs b/EXILED/Exiled.Events/Patches/Generic/RoomList.cs index c61c7bc3f6..88c24aa6c7 100644 --- a/EXILED/Exiled.Events/Patches/Generic/RoomList.cs +++ b/EXILED/Exiled.Events/Patches/Generic/RoomList.cs @@ -27,22 +27,19 @@ namespace Exiled.Events.Patches.Generic /// /// Patches . /// - [HarmonyPatch(typeof(RoomIdentifier), nameof(RoomIdentifier.TryAssignId))] + [HarmonyPatch(typeof(RoomIdentifier), nameof(RoomIdentifier.RegisterCoords))] internal class RoomList { private static IEnumerable Transpiler(IEnumerable codeInstructions) { List newInstructions = ListPool.Pool.Get(codeInstructions); - int offset = -3; - int index = newInstructions.FindIndex(i => i.Calls(Method(typeof(RoomUtils), nameof(RoomUtils.PositionToCoords)))) + offset; - // Room.Get(gameObject).InternalCreate(); newInstructions.InsertRange( - index, + 0, new CodeInstruction[] { - new CodeInstruction(OpCodes.Ldarg_0).MoveLabelsFrom(newInstructions[index]), + new(OpCodes.Ldarg_0), new(OpCodes.Callvirt, PropertyGetter(typeof(Component), nameof(Component.gameObject))), new(OpCodes.Callvirt, Method(typeof(Room), nameof(Room.CreateComponent))), }); diff --git a/EXILED/Exiled.Loader/AutoUpdateFiles.cs b/EXILED/Exiled.Loader/AutoUpdateFiles.cs index 18d49995ef..8490d01eea 100644 --- a/EXILED/Exiled.Loader/AutoUpdateFiles.cs +++ b/EXILED/Exiled.Loader/AutoUpdateFiles.cs @@ -17,6 +17,6 @@ public static class AutoUpdateFiles /// /// Gets which SCP: SL version generated Exiled. /// - public static readonly Version RequiredSCPSLVersion = new(14, 0, 0, 3); + public static readonly Version RequiredSCPSLVersion = new(14, 1, 0, 0); } } \ No newline at end of file diff --git a/EXILED/docs/articles/SCPSLRessources/NW_Documentation.md b/EXILED/docs/articles/SCPSLRessources/NW_Documentation.md index d192c18231..31ee11803d 100644 --- a/EXILED/docs/articles/SCPSLRessources/NW_Documentation.md +++ b/EXILED/docs/articles/SCPSLRessources/NW_Documentation.md @@ -17,7 +17,7 @@ title: NW Documentation --- -Last Update (14.0.0.3) +Last Update (14.1.0.0) ### Index @@ -61,8 +61,7 @@ Last Update (14.0.0.3) - [ChallengeState](#challengestate) - [ChallengeType](#challengetype) - [ChamberState](#chamberstate) -- [CheckpointErrorType](#checkpointerrortype) -- [CheckpointSequenceStage](#checkpointsequencestage) +- [ChaosMsgType](#chaosmsgtype) - [ClientFlags](#clientflags) - [ClientInstanceMode](#clientinstancemode) - [ClientReceivedContentType](#clientreceivedcontenttype) @@ -72,6 +71,7 @@ Last Update (14.0.0.3) - [CmdTeleportData](#cmdteleportdata) - [CoffeeTranslation](#coffeetranslation) - [CollectionDeserializeToBehaviour](#collectiondeserializetobehaviour) +- [ColliderShape](#collidershape) - [CollisionsDisablingReasons](#collisionsdisablingreasons) - [ColorMode](#colormode) - [CommandOperationMode](#commandoperationmode) @@ -89,6 +89,7 @@ Last Update (14.0.0.3) - [DecalPoolType](#decalpooltype) - [DecontaminationStatus](#decontaminationstatus) - [DeliveryMethod](#deliverymethod) +- [DetectionStatus](#detectionstatus) - [DiodeType](#diodetype) - [DisconnectReason](#disconnectreason) - [DisconnectResult](#disconnectresult) @@ -101,6 +102,7 @@ Last Update (14.0.0.3) - [DoorDamageType](#doordamagetype) - [DoorLockMode](#doorlockmode) - [DoorLockReason](#doorlockreason) +- [DoorPermissionFlags](#doorpermissionflags) - [DropdownEntryType](#dropdownentrytype) - [DtoaMode](#dtoamode) - [EffectClassification](#effectclassification) @@ -133,6 +135,8 @@ Last Update (14.0.0.3) - [FoldoutMode](#foldoutmode) - [FootprintsTranslation](#footprintstranslation) - [FootstepLoudness](#footsteploudness) +- [ForceCondition](#forcecondition) +- [ForceResult](#forceresult) - [FpcViewMode](#fpcviewmode) - [FreezingMode](#freezingmode) - [FriendlyFireAction](#friendlyfireaction) @@ -171,7 +175,8 @@ Last Update (14.0.0.3) - [JailbirdMessageType](#jailbirdmessagetype) - [JailbirdWearState](#jailbirdwearstate) - [JsonToken](#jsontoken) -- [KeycardPermissions](#keycardpermissions) +- [KeycardLabelTranslation](#keycardlabeltranslation) +- [KeyCodeTranslations](#keycodetranslations) - [LcdElementType](#lcdelementtype) - [LeadingTeam](#leadingteam) - [LegacyInterfaces](#legacyinterfaces) @@ -196,6 +201,7 @@ Last Update (14.0.0.3) - [Mode](#mode) - [ModifierMode](#modifiermode) - [Modules](#modules) +- [MsgType](#msgtype) - [NatAddressType](#nataddresstype) - [NetLogLevel](#netloglevel) - [NetworkProtocolType](#networkprotocoltype) @@ -231,12 +237,14 @@ Last Update (14.0.0.3) - [RadioCommand](#radiocommand) - [RadioRangeLevel](#radiorangelevel) - [RejectionReason](#rejectionreason) +- [RejectionReason](#rejectionreason) - [ReloaderMessageHeader](#reloadermessageheader) - [RemoteAdminResponseFlags](#remoteadminresponseflags) - [RemovalMode](#removalmode) - [ReproProjectAssetType](#reproprojectassettype) - [RequestType](#requesttype) - [RespawnSetting](#respawnsetting) +- [RespawnTooltipTranslation](#respawntooltiptranslation) - [ResurrectError](#resurrecterror) - [RoleChangeReason](#rolechangereason) - [RoleSpawnFlags](#rolespawnflags) @@ -257,6 +265,7 @@ Last Update (14.0.0.3) - [RpcType](#rpctype) - [RpcType](#rpctype) - [RpcType](#rpctype) +- [RpcType](#rpctype) - [ScanSequenceStep](#scansequencestep) - [Scp0492SoundId](#scp0492soundid) - [Scp079HudTranslation](#scp079hudtranslation) @@ -264,6 +273,8 @@ Last Update (14.0.0.3) - [Scp096HitResult](#scp096hitresult) - [Scp096HudTranslation](#scp096hudtranslation) - [Scp096RageState](#scp096ragestate) +- [Scp127Tier](#scp127tier) +- [Scp127VoiceLinesTranslation](#scp127voicelinestranslation) - [Scp1344Status](#scp1344status) - [Scp173SoundId](#scp173soundid) - [Scp244State](#scp244state) @@ -275,8 +286,10 @@ Last Update (14.0.0.3) - [Scp939DamageType](#scp939damagetype) - [Scp939HudTranslation](#scp939hudtranslation) - [Scp939LungeState](#scp939lungestate) +- [ScpSetting](#scpsetting) - [SecurityLevel](#securitylevel) - [SensitivitySetting](#sensitivitysetting) +- [SequenceState](#sequencestate) - [ServerLogType](#serverlogtype) - [ServerOperativeSystem](#serveroperativesystem) - [ServerRateLimit](#serverratelimit) @@ -319,6 +332,7 @@ Last Update (14.0.0.3) - [VersionType](#versiontype) - [VoiceChatChannel](#voicechatchannel) - [VoiceChatSupportMode](#voicechatsupportmode) +- [VoiceLinePriority](#voicelinepriority) - [VoiceLinesName](#voicelinesname) - [VolumeSliderSetting](#volumeslidersetting) - [WarheadScenarioType](#warheadscenariotype) @@ -383,6 +397,7 @@ Last Update (14.0.0.3) [48] = UndeadSpaceProgram [49] = ArizonaRanger [50] = Matador + [51] = ToothAndNail ``` @@ -987,27 +1002,15 @@ Last Update (14.0.0.3) -### CheckpointErrorType - -
Interactables.Interobjects.CheckpointDoor+CheckpointErrorType - -``` - [0] = Denied - [1] = LockedDown - [2] = Destroyed -``` - -
- -### CheckpointSequenceStage +### ChaosMsgType -
Interactables.Interobjects.CheckpointDoor+CheckpointSequenceStage +
InventorySystem.Items.Keycards.ChaosKeycardItem+ChaosMsgType ``` - [0] = Idle - [1] = Granted - [2] = Open - [3] = Closing + [0] = SnakeMsgSync + [1] = NewConnectionFullSync + [2] = MovementSwitch + [3] = UseDetails ```
@@ -1162,6 +1165,18 @@ Last Update (14.0.0.3)
+### ColliderShape + +
AdminToys.InvisibleInteractableToy+ColliderShape + +``` + [0] = Box + [1] = Sphere + [2] = Capsule +``` + +
+ ### CollisionsDisablingReasons
Interactables.Interobjects.DoorUtils.DoorVariant+CollisionsDisablingReasons @@ -1414,6 +1429,18 @@ Last Update (14.0.0.3)
+### DetectionStatus + +
InventorySystem.Items.Firearms.Modules.Scp127.Scp127CassieBasedVoiceTriggerBase+DetectionStatus + +``` + [0] = Idle + [1] = WaitingForTrigger + [2] = AnnouncementStartedPlaying +``` + +
+ ### DiodeType
AlphaWarheadNukesitePanel+DiodeType @@ -1586,6 +1613,28 @@ Last Update (14.0.0.3)
+### DoorPermissionFlags + +
Interactables.Interobjects.DoorUtils.DoorPermissionFlags + +``` + [0] = None + [1] = Checkpoints + [2] = ExitGates + [4] = Intercom + [8] = AlphaWarhead + [16] = ContainmentLevelOne + [32] = ContainmentLevelTwo + [64] = ContainmentLevelThree + [128] = ArmoryLevelOne + [256] = ArmoryLevelTwo + [512] = ArmoryLevelThree + [1024] = ScpOverride + [65535] = All +``` + +
+ ### DropdownEntryType
UserSettings.ServerSpecific.SSDropdownSetting+DropdownEntryType @@ -1650,6 +1699,7 @@ Last Update (14.0.0.3) [6] = Nuke01 [7] = Scp049 [8] = Nuke02 + [9] = ServerRoom ```
@@ -1659,11 +1709,12 @@ Last Update (14.0.0.3)
Interactables.Interobjects.ElevatorChamber+ElevatorSequence ``` - [0] = DoorClosing - [1] = MovingAway - [2] = Arriving - [3] = DoorOpening - [4] = Ready + [0] = StartingSequence + [1] = DoorClosing + [2] = MovingAway + [3] = Arriving + [4] = DoorOpening + [5] = Ready ```
@@ -2024,6 +2075,7 @@ Last Update (14.0.0.3) [9] = HalloweenOutside [10] = ChristmasInside [11] = ChristmasOutside + [12] = PocketDimension ``` @@ -2073,6 +2125,29 @@ Last Update (14.0.0.3) +### ForceCondition + +
PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers.GlowInTheDarkSubcontroller+ForceCondition + +``` + [0] = NeverForce + [1] = ForceWhenFriendly + [2] = ForceWhenEnemy +``` + +
+ +### ForceResult + +
PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers.GlowInTheDarkSubcontroller+ForceResult + +``` + [0] = ForceDarkened + [1] = ForceNormal +``` + +
+ ### FpcViewMode
PlayerRoles.FirstPersonControl.FpcMotor+FpcViewMode @@ -2270,6 +2345,7 @@ Last Update (14.0.0.3) [15] = PackedLong [16] = PackedULong [17] = Scp330Hint + [18] = SSKeybind ```
@@ -2500,6 +2576,8 @@ Last Update (14.0.0.3) [24] = JailbirdChargeHint [25] = MicroHidReadyToDischarge [26] = MicroHidDamaged + [27] = Scp127OnEquip + [28] = SnakeHint ``` @@ -2660,6 +2738,13 @@ Last Update (14.0.0.3) [57] = Coal [58] = SpecialCoal [59] = SCP1507Tape + [60] = DebugRagdollMover + [61] = SurfaceAccessPass + [62] = GunSCP127 + [63] = KeycardCustomTaskForce + [64] = KeycardCustomSite02 + [65] = KeycardCustomManagement + [66] = KeycardCustomMetalCase [-1] = None ``` @@ -2719,23 +2804,48 @@ Last Update (14.0.0.3) -### KeycardPermissions +### KeycardLabelTranslation -
Interactables.Interobjects.DoorUtils.KeycardPermissions +
InventorySystem.Items.Keycards.TranslatedLabelDetail+KeycardLabelTranslation ``` - [0] = None - [1] = Checkpoints - [2] = ExitGates - [4] = Intercom - [8] = AlphaWarhead - [16] = ContainmentLevelOne - [32] = ContainmentLevelTwo - [64] = ContainmentLevelThree - [128] = ArmoryLevelOne - [256] = ArmoryLevelTwo - [512] = ArmoryLevelThree - [1024] = ScpOverride + [0] = Scientist + [1] = Janitor + [2] = ResearchSupervisor + [3] = ContEngineer + [4] = SecurityGuard + [5] = ZoneManager + [6] = FacilityManager + [7] = SurfaceAccessPassNormal + [8] = SurfaceAccessPassUsed +``` + +
+ +### KeyCodeTranslations + +
Hints.KeyCodeTranslations + +``` + [0] = ServerSettingNotFound + [1] = KeyNotAssigned + [2] = ArrowUp + [3] = ArrowDown + [4] = ArrowLeft + [5] = ArrowRight + [6] = LeftShift + [7] = RightShift + [8] = LeftControl + [9] = RightControl + [10] = LeftAlt + [11] = RightAlt + [12] = Tab + [13] = Space + [14] = Enter + [15] = MousePrimary + [16] = MouseSecondary + [17] = MouseMiddle + [18] = MouseN ```
@@ -2853,12 +2963,14 @@ Last Update (14.0.0.3)
MapGeneration.MapGenerationPhase ``` - [0] = ParentRoomRegistration - [1] = RelativePositioningWaypoints - [2] = ComplexDecorationsAndClutter - [3] = SimpleDecorations - [4] = CullingCaching - [5] = SpawnableStructures + [0] = RoomCoordsRegistrations + [1] = ParentRoomRegistration + [2] = RelativePositioningWaypoints + [3] = ComplexDecorationsAndClutter + [4] = SimpleDecorations + [5] = CullingCaching + [6] = SpawnableStructures + [7] = StaticBatching ```
@@ -2887,6 +2999,7 @@ Last Update (14.0.0.3) [3] = RpcFire [4] = RpcDryFire [5] = RpcNewPlayerSync + [6] = RpcRejectionReason ```
@@ -2925,9 +3038,10 @@ Last Update (14.0.0.3) [1] = RpcRequireReloadFalse [2] = RpcRequireReloadFullResync [3] = RpcStartFiring - [4] = RpcOnShot - [5] = CmdRequestStartFiring - [6] = CmdConfirmDischarge + [4] = RpcStopFiring + [5] = RpcOnShot + [6] = CmdRequestStartFiring + [7] = CmdConfirmDischarge ``` @@ -2989,6 +3103,7 @@ Last Update (14.0.0.3) [5] = RightClickToDrop [6] = InventoryToggle [7] = Scp079KeybindZoneSwitching + [8] = AutomaticSpectatorSwitch ``` @@ -3019,6 +3134,7 @@ Last Update (14.0.0.3) [2] = HeadBobbing [3] = FlashbangDarkMode [4] = ShowNeedles + [5] = Scp939VisionBlur ``` @@ -3033,6 +3149,7 @@ Last Update (14.0.0.3) [2] = Weapons [3] = VoiceChat [4] = NoDucking + [5] = Scp127VoiceViewmodel ``` @@ -3093,6 +3210,19 @@ Last Update (14.0.0.3) +### MsgType + +
InventorySystem.Items.Keycards.KeycardItem+MsgType + +``` + [0] = Custom + [1] = OnKeycardUsed + [2] = Inspect + [3] = NewPlayerFullResync +``` + +
+ ### NatAddressType
LiteNetLib.NatAddressType @@ -3659,6 +3789,19 @@ Last Update (14.0.0.3)
+### RejectionReason + +
InventorySystem.Items.Firearms.Modules.AutomaticActionModule+RejectionReason + +``` + [1] = TimedOut + [2] = ModuleBusy + [3] = NotCocked + [4] = BoltLocked +``` + +
+ ### ReloaderMessageHeader
InventorySystem.Items.Firearms.Modules.AnimatorReloaderModuleBase+ReloaderMessageHeader @@ -3732,6 +3875,18 @@ Last Update (14.0.0.3)
+### RespawnTooltipTranslation + +
Respawning.Graphics.RespawnTooltipTranslation + +``` + [0] = TimerBarTranslation + [1] = InfluenceTranslation + [2] = RespawnsTokensTranslation +``` + +
+ ### ResurrectError
PlayerRoles.PlayableScps.Scp049.Scp049ResurrectAbility+ResurrectError @@ -3861,6 +4016,7 @@ Last Update (14.0.0.3) [35] = Outside [36] = Pocket [37] = HczTestroom + [38] = Hcz127 ```
@@ -4042,6 +4198,17 @@ Last Update (14.0.0.3) ### RpcType +
InventorySystem.Items.Firearms.Modules.Scp127.Scp127VoiceLineManagerModule+RpcType + +``` + [0] = OwnerRegistered + [1] = PlayLine +``` + +
+ +### RpcType +
InventorySystem.Items.Firearms.Attachments.FlashlightAttachment+RpcType ``` @@ -4236,6 +4403,181 @@ Last Update (14.0.0.3)
+### Scp127Tier + +
InventorySystem.Items.Firearms.Modules.Scp127.Scp127Tier + +``` + [0] = Tier1 + [1] = Tier2 + [2] = Tier3 +``` + +
+ +### Scp127VoiceLinesTranslation + +
InventorySystem.Items.Firearms.Modules.Scp127.Scp127VoiceLinesTranslation + +``` + [0] = ChamberingDammitThatHurts + [1] = ChamberingFeelThatTmrw + [2] = ChamberingGrunt1 + [3] = ChamberingGrunt2 + [4] = ChamberingGrunt3 + [5] = ChamberingGrunt4 + [6] = ChamberingHateThatPart + [7] = ChamberingNopeNeverGettinBetter + [8] = ChamberingThatStings + [9] = ChaosSpawnDrowningConstantly + [10] = ChaosSpawnIDontTrustEm + [11] = ChaosSpawnNotHereNotAgain + [12] = ChaosSpawnNotJustMe + [13] = ChaosSpawnThemAgain + [14] = ChaosSpawnThisIsntGonnaEndWell + [15] = DrawGoodToSeeYa + [16] = DrawHelloAgain + [17] = DrawHelloThere + [18] = DrawHello + [19] = DrawHeyHey + [20] = DrawHowsItGoin + [21] = DroppedDontForgetAboutMe + [22] = DroppedGuessIllWaitHere + [23] = DroppedIllCatchUp + [24] = DroppedSeeyaLaterBoss + [25] = DroppedTakeCareBoss + [26] = DroppedWatchThePaint + [27] = HolsterBeHereIfYouNeedMe + [28] = HolsterByeBye + [29] = HolsterFairEnough + [30] = HolsterGoodbye + [31] = HolsterIsTheSafetyOn2 + [32] = HolsterIsTheSafetyOn + [33] = HolsterOffIGo + [34] = HolsterYouKnowWhereToFindMeBoss + [35] = IdleChatterBarDownInQueens + [36] = IdleChatterDifferentFacility + [37] = IdleChatterGettingPaidForThisRight + [38] = IdleChatterSoundedLikeDeath + [39] = IdleChatterThoughtIHeardSomething + [40] = IdleChatterWhatWentWrong + [41] = IdleChatterYouGotAnyPlans + [42] = IdleChatterYouKnowWhereYoureGoin + [43] = MissedAlmostHitSomething + [44] = MissedILikeYourStyleBoss + [45] = MissedInvisHatFellaAround + [46] = MissedUhYouGoodBoss + [47] = MtfSpawnAhaReinforcements + [48] = MtfSpawnDontLetEmTakeMeAgain + [49] = MtfSpawnDontSayAnything + [50] = MtfSpawnFriendsOfYours + [51] = MtfSpawnGotAPlan + [52] = MtfSpawnThatsNotGood + [53] = MtfSpawnThingsAreGettingInterestingNow + [54] = MtfSpawnWereGettingBackup + [55] = OnKillBang + [56] = OnKillBeatItBopIt + [57] = OnKillGoodOneBoss + [58] = OnKillGoodStuff + [59] = OnKillGoodWorkBoss + [60] = OnKillNiceOneBoss + [61] = OnKillNiceShot + [62] = OnKillOooNice + [63] = OnKillRattleHim + [64] = OnKillScram + [65] = OnKillWhamo + [66] = PickupChamberNecksnapMcgee + [67] = PickupChamberPleasedToMeetYa + [68] = PickupChamberRoomForOneMore + [69] = PickupChamberSayWhatYearIsIt + [70] = PickupChamberSweetOxygen + [71] = PickupChamberWaterboarding + [72] = PickupChaosGasMask + [73] = PickupChaosSickGladRagsBoss + [74] = PickupChaosYouFellasFromOuttaTown + [75] = PickupDclassCouplaCorpses + [76] = PickupDclassNeedAHand + [77] = PickupDclassPartnersInCrime + [78] = PickupDclassTagEmBoss + [79] = PickupDclassUsedToOwnAJumpsuit + [80] = PickupDclassWooBreakout + [81] = PickupGenericEasyOnTheGrip + [82] = PickupGenericHeyBossHowsItGoin + [83] = PickupGenericSobbing + [84] = PickupGenericTakeMeWith + [85] = PickupMtfAnyChanceICanGo + [86] = PickupMtfAwJeezRick + [87] = PickupScientistDidntYouStickMeInThatTank + [88] = PickupScientistThoseGlassesBetterBe + [89] = PickupScientistYouDoKnowHowToShootRight + [90] = PickupTutorialHereToRescueMe + [91] = PickupTutorialOutOfPlaceHereBoss + [92] = RankupBetterThanExpected + [93] = RankupDoinPrettyGood + [94] = RankupFeelsGoodToBeBack + [95] = RankupIThinkWereWinning + [96] = RankupManicLaughter + [97] = RankupPartnersInCrimeOrJustice + [98] = ScpKilled049AppleADay + [99] = ScpKilled049BehindThatBeak + [100] = ScpKilled049IAmTheBlackDeath + [101] = ScpKilled049MsBirdface + [102] = ScpKilled049OverdosedOnShells + [103] = ScpKilled049ResurrectThis + [104] = ScpKilled049TakeGoodCareOfTheKids + [105] = ScpKilled0790101Moron + [106] = ScpKilled079AintDyinToAMinifridge + [107] = ScpKilled079KeepTheCamera + [108] = ScpKilled079NeverLikedThatToaster + [109] = ScpKilled079WarrantyRunOut + [110] = ScpKilled0967FeetTall + [111] = ScpKilled096AllTheRage + [112] = ScpKilled096IMayNotHaveEyes2 + [113] = ScpKilled096IMayNotHaveEyes + [114] = ScpKilled096LikedTheStatue + [115] = ScpKilled096ThoughtHedNeverShutUp + [116] = ScpKilled106HaveFunInTheCage + [117] = ScpKilled106OldDudesGone + [118] = ScpKilled106PocketThisDimension + [119] = ScpKilled106SinkingFeeling + [120] = ScpKilled106StayForABit + [121] = ScpKilled106SunkIntoTheFloor + [122] = ScpKilled173EyeOpener + [123] = ScpKilled173PeiceThatBackTogether + [124] = ScpKilled173ScrapingWasGettingOnMyNerves + [125] = ScpKilled173ShatteredLikeGlass + [126] = ScpKilled939NothingToSayNow + [127] = ScpKilled939StayDownFreakshow + [128] = ScpKilled939YouAintTheFirst2 + [129] = ScpKilled939YouAintTheFirst + [130] = ScpKilled3114NoMoreBones + [131] = ScpKilled3114OneLessSkeleton + [132] = ScpKilled3114WeGotTheSkinwalker + [133] = ScpKilledAllThoseFreakyPowers + [134] = ScpKilledCoupleOfRounds + [135] = ScpKilledGunBeatsWhateverYouAre2 + [136] = ScpKilledGunBeatsWhateverYouAre + [137] = ScpKilledNotSoTough + [138] = ScpKilledWhyBuildAContainer + [139] = ScpKilledZombieAintNoPill + [140] = ScpKilledZombieGetHisGoons + [141] = ScpKilledZombieMr12FeetUnder + [142] = ScpKilledZombieSayGoodbyeToUrGoons + [143] = ScpKilledZombieStayDown + [144] = ScpKilledZombieTwoLivesTooMany + [145] = ScpKilledZombieWhatGetsUp + [146] = UserKilledAttacthmentIssues + [147] = UserKilledBooooosss + [148] = UserKilledHeyHeyGetUp + [149] = UserKilledJustStartingToLikeYou + [150] = UserKilledNoNotNow2 + [151] = UserKilledNoNotNow + [152] = UserKilledNotAgain2 + [153] = UserKilledNotAgain +``` + +
+ ### Scp1344Status
InventorySystem.Items.Usables.Scp1344.Scp1344Status @@ -4438,6 +4780,16 @@ Last Update (14.0.0.3)
+### ScpSetting + +
UserSettings.OtherSettings.ScpSetting + +``` + [0] = ScpOptOut +``` + +
+ ### SecurityLevel
EncryptedChannelManager+SecurityLevel @@ -4461,6 +4813,19 @@ Last Update (14.0.0.3)
+### SequenceState + +
Interactables.Interobjects.CheckpointDoor+SequenceState + +``` + [0] = Idle + [1] = Granted + [2] = OpenLoop + [3] = ClosingWarning +``` + +
+ ### ServerLogType
ServerLogs+ServerLogType @@ -4894,6 +5259,7 @@ Last Update (14.0.0.3) [4] = Trigger [8] = Tokens [11] = All + [16] = Spawn ```
@@ -5067,6 +5433,19 @@ Last Update (14.0.0.3) +### VoiceLinePriority + +
InventorySystem.Items.Firearms.Modules.Scp127.Scp127VoiceTriggerBase+VoiceLinePriority + +``` + [0] = Low + [1] = Normal + [2] = High + [3] = VeryHigh +``` + +
+ ### VoiceLinesName
PlayerRoles.PlayableScps.Scp3114.Scp3114VoiceLines+VoiceLinesName @@ -5093,6 +5472,8 @@ Last Update (14.0.0.3) [2] = SoundEffects [3] = MenuMusic [4] = MenuUI + [5] = Scp127Voice + [6] = Scp3114Voice ```
@@ -5124,12 +5505,13 @@ Last Update (14.0.0.3) ### WearableElements -
PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers.WearableElements +
PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers.Wearables.WearableElements ``` [0] = None [1] = Scp268Hat [2] = Scp1344Goggles + [4] = Armor ```
@@ -5213,7 +5595,7 @@ Last Update (14.0.0.3)
Damage Handlers -```md title="Latest Updated: 14.0.0.3" +```md title="Latest Updated: 14.1.0.0" All available DamageHandlers + Symbol ':' literally means "inherits from" @@ -5223,6 +5605,7 @@ All available DamageHandlers Scp956DamageHandler : StandardDamageHandler SnowballDamageHandler : AttackerDamageHandler PlayerStatsSystem.CustomReasonDamageHandler : StandardDamageHandler +PlayerStatsSystem.CustomReasonFirearmDamageHandler : FirearmDamageHandler PlayerStatsSystem.DisruptorDamageHandler : AttackerDamageHandler PlayerStatsSystem.ExplosionDamageHandler : AttackerDamageHandler PlayerStatsSystem.FirearmDamageHandler : AttackerDamageHandler From 48bf7901c0ce262224028777e62a86a0e54d4caa Mon Sep 17 00:00:00 2001 From: Yamato Date: Sun, 27 Apr 2025 16:15:46 +0200 Subject: [PATCH 39/70] 9.6.0-beta6 --- EXILED/EXILED.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/EXILED.props b/EXILED/EXILED.props index 53be61447a..61f6a85fc9 100644 --- a/EXILED/EXILED.props +++ b/EXILED/EXILED.props @@ -15,7 +15,7 @@ - 9.5.2 + 9.6.0-beta6 false From 0f28a9abd4d960ecbe37c3f97ae7ab4cc1145f01 Mon Sep 17 00:00:00 2001 From: Yamato Date: Sun, 27 Apr 2025 18:28:22 +0200 Subject: [PATCH 40/70] SNOWBALL DO NOT EXIST --- EXILED/Exiled.Example/Events/PlayerHandler.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/Exiled.Example/Events/PlayerHandler.cs b/EXILED/Exiled.Example/Events/PlayerHandler.cs index f54bc5a32e..6af4398923 100644 --- a/EXILED/Exiled.Example/Events/PlayerHandler.cs +++ b/EXILED/Exiled.Example/Events/PlayerHandler.cs @@ -201,7 +201,7 @@ public void OnSpawned(SpawnedEventArgs ev) if (ev.Player.Role.Type == RoleTypeId.Scientist) { ev.Player.Position = RoleTypeId.Tutorial.GetRandomSpawnLocation().Position; - ev.Player.ResetInventory(new ItemType[] { ItemType.Snowball, ItemType.Jailbird, ItemType.Snowball, ItemType.Snowball, ItemType.Snowball, ItemType.Radio, ItemType.Jailbird }); + ev.Player.ResetInventory(new ItemType[] { ItemType.Jailbird, ItemType.GunSCP127, ItemType.Radio, ItemType.Jailbird }); } } From 907d72841e3129e8de78b0d908e998ffaf04bdb0 Mon Sep 17 00:00:00 2001 From: Bolton <48883340+BoltonDev@users.noreply.github.com> Date: Sun, 27 Apr 2025 18:38:28 +0200 Subject: [PATCH 41/70] fix: ChangingCamera event (#511) --- .../Patches/Events/Scp079/ChangingCamera.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/EXILED/Exiled.Events/Patches/Events/Scp079/ChangingCamera.cs b/EXILED/Exiled.Events/Patches/Events/Scp079/ChangingCamera.cs index 352439aeea..3afb14f354 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp079/ChangingCamera.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp079/ChangingCamera.cs @@ -8,6 +8,7 @@ namespace Exiled.Events.Patches.Events.Scp079 { using System.Collections.Generic; + using System.Reflection; using System.Reflection.Emit; using API.Features.Pools; @@ -16,7 +17,7 @@ namespace Exiled.Events.Patches.Events.Scp079 using Exiled.Events.Handlers; using HarmonyLib; - + using LabApi.Events.Arguments.Scp079Events; using Mirror; using PlayerRoles.PlayableScps.Scp079; using PlayerRoles.PlayableScps.Scp079.Cameras; @@ -38,8 +39,8 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); - int offset = 6; - int index = newInstructions.FindIndex(x => x.opcode == OpCodes.Ldc_I4_S && (sbyte)x.operand == (sbyte)Scp079HudTranslation.SignalLost) + offset; + int offset = -4; + int index = newInstructions.FindIndex(i => i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.Scp079Events.Scp079ChangingCameraEventArgs))[0]) + offset; Label returnLabel = generator.DefineLabel(); @@ -47,9 +48,9 @@ private static IEnumerable Transpiler(IEnumerable), nameof(StandardSubroutine.Owner))), new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), @@ -87,9 +88,9 @@ private static IEnumerable Transpiler(IEnumerable x.opcode == OpCodes.Ldc_I4_S && (sbyte)x.operand == (sbyte)Scp079HudTranslation.SignalLost) + offset; + // return as the same way as NW does + offset = 2; + index = newInstructions.FindIndex(i => i.Calls(PropertyGetter(typeof(Scp079ChangingCameraEventArgs), nameof(Scp079ChangingCameraEventArgs.IsAllowed)))) + offset; newInstructions[index].labels.Add(returnLabel); for (int z = 0; z < newInstructions.Count; z++) From aeeb8e3acd5d2456abb9bf0ea365536b497c4382 Mon Sep 17 00:00:00 2001 From: Bolton <48883340+BoltonDev@users.noreply.github.com> Date: Sun, 27 Apr 2025 18:55:19 +0200 Subject: [PATCH 42/70] fix: useless fix now & prevent crash (#512) --- .../Patches/Fixes/ArmorDropPatch.cs | 55 ------------------- 1 file changed, 55 deletions(-) delete mode 100644 EXILED/Exiled.Events/Patches/Fixes/ArmorDropPatch.cs diff --git a/EXILED/Exiled.Events/Patches/Fixes/ArmorDropPatch.cs b/EXILED/Exiled.Events/Patches/Fixes/ArmorDropPatch.cs deleted file mode 100644 index 231df09f2a..0000000000 --- a/EXILED/Exiled.Events/Patches/Fixes/ArmorDropPatch.cs +++ /dev/null @@ -1,55 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) ExMod Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.Events.Patches.Fixes -{ - using System.Collections.Generic; - using System.Reflection.Emit; - - using Exiled.API.Features.Pools; - using HarmonyLib; - using InventorySystem; - using InventorySystem.Items; - using InventorySystem.Items.Armor; - - using static HarmonyLib.AccessTools; - - /// - /// Patches to fix https://git.scpslgame.com/northwood-qa/scpsl-bug-reporting/-/issues/230 bug. - /// - [HarmonyPatch(typeof(BodyArmorUtils), nameof(BodyArmorUtils.RemoveEverythingExceedingLimits), typeof(InventorySystem.Inventory))] - internal static class ArmorDropPatch - { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) - { - List newInstructions = ListPool.Pool.Get(instructions); - - Label continueLabel = generator.DefineLabel(); - int continueIndex = newInstructions.FindIndex(x => x.Is(OpCodes.Call, Method(typeof(Dictionary.Enumerator), nameof(Dictionary.Enumerator.MoveNext)))) - 1; - newInstructions[continueIndex].WithLabels(continueLabel); - - // before: if (keyValuePair.Value.Category != ItemCategory.Armor) - // after: if (keyValuePair.Value.Category != ItemCategory.Armor && keyValuePair.Value.Category != ItemCategory.None) - int index = newInstructions.FindIndex(x => x.Is(OpCodes.Ldc_I4_S, 9)); - - newInstructions.InsertRange(index, new CodeInstruction[] - { - // && keyValuePair.Value.Category != ItemCategory.None) - new(OpCodes.Ldloca_S, 4), - new(OpCodes.Call, PropertyGetter(typeof(KeyValuePair), nameof(KeyValuePair.Value))), - new(OpCodes.Ldfld, Field(typeof(ItemBase), nameof(ItemBase.Category))), - new(OpCodes.Ldc_I4_0), - new(OpCodes.Beq_S, continueLabel), - }); - - for (int z = 0; z < newInstructions.Count; z++) - yield return newInstructions[z]; - - ListPool.Pool.Return(newInstructions); - } - } -} \ No newline at end of file From b4893c2231b7661eecdbf6f1668cee9b62471fb1 Mon Sep 17 00:00:00 2001 From: Bolton <48883340+BoltonDev@users.noreply.github.com> Date: Sun, 27 Apr 2025 20:43:23 +0200 Subject: [PATCH 43/70] fix: EndingRound event IsAllowed (#513) fix: EndingRound event isallowed --- .../Patches/Events/Server/RoundEnd.cs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs b/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs index d39719db77..65a9abf52a 100644 --- a/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs +++ b/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs @@ -87,10 +87,11 @@ private static IEnumerable Transpiler(IEnumerable x.StoresField(Field(PrivateType, LeadingTeam))) + offset; - int offset2 = -1; - int index2 = newInstructions.FindIndex(x => x.LoadsField(Field(PrivateType, LeadingTeam))) + offset2; + offset = 2; + index = newInstructions.FindLastIndex(x => x.LoadsField(Field(typeof(RoundSummary), nameof(RoundSummary.IsRoundEnded)))) + offset; + int offset2 = -2; + int index2 = newInstructions.FindIndex(i => i.opcode == OpCodes.Newobj && (ConstructorInfo)i.operand == GetDeclaredConstructors(typeof(LabApi.Events.Arguments.ServerEvents.RoundEndingEventArgs))[0]) + offset2; + List leadingTeamLogic = newInstructions.GetRange(index, index2 - index); List
[Obsolete("Only availaible for Christmas and AprilFools.")] Snowed, + + /// + /// . + /// + Scp1344Detected, } } diff --git a/EXILED/Exiled.API/Extensions/EffectTypeExtension.cs b/EXILED/Exiled.API/Extensions/EffectTypeExtension.cs index dc209c3ba0..6f038fd761 100644 --- a/EXILED/Exiled.API/Extensions/EffectTypeExtension.cs +++ b/EXILED/Exiled.API/Extensions/EffectTypeExtension.cs @@ -75,6 +75,7 @@ public static class EffectTypeExtension { EffectType.SeveredEyes, typeof(SeveredEyes) }, { EffectType.PitDeath, typeof(PitDeath) }, { EffectType.Blurred, typeof(Blurred) }, + { EffectType.Scp1344Detected, typeof(Scp1344Detected) }, #pragma warning disable CS0618 { EffectType.Marshmallow, typeof(MarshmallowEffect) }, { EffectType.BecomingFlamingo, typeof(BecomingFlamingo) }, From 45ed8a338579ee8f11e2f46421d71953cbe84a72 Mon Sep 17 00:00:00 2001 From: Bolton <48883340+BoltonDev@users.noreply.github.com> Date: Sun, 18 May 2025 19:14:39 +0200 Subject: [PATCH 59/70] Update labapi.yml --- .github/workflows/labapi.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/labapi.yml b/.github/workflows/labapi.yml index 61e302071b..67e708f4af 100644 --- a/.github/workflows/labapi.yml +++ b/.github/workflows/labapi.yml @@ -14,9 +14,9 @@ defaults: working-directory: ./EXILED env: - EXILED_REFERENCES_URL: https://exmod-team.github.io/SL-References/LabAPI.zip + EXILED_REFERENCES_URL: https://exslmod-team.github.io/SL-References/LabAPI.zip EXILED_REFERENCES_PATH: ${{ github.workspace }}/EXILED/References - EXILED_DLL_ARCHIVER_URL: https://github.com/ExMod-Team/EXILED-DLL-Archiver/releases/download/v1.8.1/EXILED-DLL-Archiver.exe + EXILED_DLL_ARCHIVER_URL: https://github.com/ExSLMod-Team/EXILED-DLL-Archiver/releases/download/v1.7.0/EXILED-DLL-Archiver.exe jobs: From 2a1fd40e283335f4a2e28c0dd2bc5bf2164b6457 Mon Sep 17 00:00:00 2001 From: Bolton <48883340+BoltonDev@users.noreply.github.com> Date: Sun, 18 May 2025 19:23:19 +0200 Subject: [PATCH 60/70] Update labapi.yml --- .github/workflows/labapi.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/labapi.yml b/.github/workflows/labapi.yml index 67e708f4af..69cb71f0aa 100644 --- a/.github/workflows/labapi.yml +++ b/.github/workflows/labapi.yml @@ -16,7 +16,7 @@ defaults: env: EXILED_REFERENCES_URL: https://exslmod-team.github.io/SL-References/LabAPI.zip EXILED_REFERENCES_PATH: ${{ github.workspace }}/EXILED/References - EXILED_DLL_ARCHIVER_URL: https://github.com/ExSLMod-Team/EXILED-DLL-Archiver/releases/download/v1.7.0/EXILED-DLL-Archiver.exe + EXILED_DLL_ARCHIVER_URL: https://github.com/ExSLMod-Team/EXILED-DLL-Archiver/releases/download/v1.8.2/EXILED-DLL-Archiver.exe jobs: From 0a85eaddecf921ee0afb39ee09912541aa5a51bc Mon Sep 17 00:00:00 2001 From: Yamato Date: Sun, 18 May 2025 20:20:13 +0200 Subject: [PATCH 61/70] TextToy Implementation API --- EXILED/Exiled.API/Enums/AdminToyType.cs | 5 ++ EXILED/Exiled.API/Enums/PrefabType.cs | 3 ++ EXILED/Exiled.API/Features/Toys/AdminToy.cs | 1 + EXILED/Exiled.API/Features/Toys/Text.cs | 55 +++++++++++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 EXILED/Exiled.API/Features/Toys/Text.cs diff --git a/EXILED/Exiled.API/Enums/AdminToyType.cs b/EXILED/Exiled.API/Enums/AdminToyType.cs index 1ddad225ed..0ad8bb43dd 100644 --- a/EXILED/Exiled.API/Enums/AdminToyType.cs +++ b/EXILED/Exiled.API/Enums/AdminToyType.cs @@ -47,5 +47,10 @@ public enum AdminToyType /// Camera Object toy. ///
CameraToy, + + /// + /// Text toy. + /// + TextToy, } } \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/PrefabType.cs b/EXILED/Exiled.API/Enums/PrefabType.cs index 000773a6c3..f34093aba8 100644 --- a/EXILED/Exiled.API/Enums/PrefabType.cs +++ b/EXILED/Exiled.API/Enums/PrefabType.cs @@ -369,5 +369,8 @@ public enum PrefabType [Prefab(2842703865, "KeycardPickup_Chaos")] KeycardPickupChaos, + + [Prefab(162530276, "TextToy")] + TextToy, } } \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Toys/AdminToy.cs b/EXILED/Exiled.API/Features/Toys/AdminToy.cs index 79c5bfc17d..4a82030c8c 100644 --- a/EXILED/Exiled.API/Features/Toys/AdminToy.cs +++ b/EXILED/Exiled.API/Features/Toys/AdminToy.cs @@ -169,6 +169,7 @@ public static AdminToy Get(AdminToyBase adminToyBase) CapybaraToy capybaraToy => new Capybara(capybaraToy), Scp079CameraToy scp079CameraToy => new CameraToy(scp079CameraToy), InvisibleInteractableToy invisibleInteractableToy => new InteractableToy(invisibleInteractableToy), + TextToy textToy => new Text(textToy), _ => throw new System.NotImplementedException() }; } diff --git a/EXILED/Exiled.API/Features/Toys/Text.cs b/EXILED/Exiled.API/Features/Toys/Text.cs new file mode 100644 index 0000000000..7c3317cd22 --- /dev/null +++ b/EXILED/Exiled.API/Features/Toys/Text.cs @@ -0,0 +1,55 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Toys +{ + using AdminToys; + using Enums; + using Exiled.API.Interfaces; + using UnityEngine; + + /// + /// A wrapper class for . + /// + public class Text : AdminToy, IWrapper + { + /// + /// Initializes a new instance of the class. + /// + /// The of the toy. + internal Text(TextToy speakerToy) + : base(speakerToy, AdminToyType.TextToy) => Base = speakerToy; + + /// + /// Gets the prefab. + /// + public static TextToy Prefab => PrefabHelper.GetPrefab(PrefabType.TextToy); + + /// + /// Gets the base . + /// + public TextToy Base { get; } + + /// + /// Gets or sets the Text shown. + /// + public string TextFormat + { + get => Base.Network_textFormat; + set => Base.Network_textFormat = value; + } + + /// + /// Gets or sets the size of the Display Size of the Text. + /// + public Vector2 DisplaySize + { + get => Base.Network_displaySize; + set => Base.Network_displaySize = value; + } + } +} From e34def0e9ed398697cebd481d9f0af6cb978a15e Mon Sep 17 00:00:00 2001 From: Bolton <48883340+BoltonDev@users.noreply.github.com> Date: Sun, 18 May 2025 22:05:00 +0200 Subject: [PATCH 62/70] chore: remove hub (doesn't exist anymore) --- EXILED/Exiled.Events/Commands/Hub/Hub.cs | 51 -------- .../Commands/Hub/HubApi/ApiProvider.cs | 64 ---------- .../Commands/Hub/HubApi/Models/HubPlugin.cs | 35 ------ EXILED/Exiled.Events/Commands/Hub/Install.cs | 118 ------------------ 4 files changed, 268 deletions(-) delete mode 100644 EXILED/Exiled.Events/Commands/Hub/Hub.cs delete mode 100644 EXILED/Exiled.Events/Commands/Hub/HubApi/ApiProvider.cs delete mode 100644 EXILED/Exiled.Events/Commands/Hub/HubApi/Models/HubPlugin.cs delete mode 100644 EXILED/Exiled.Events/Commands/Hub/Install.cs diff --git a/EXILED/Exiled.Events/Commands/Hub/Hub.cs b/EXILED/Exiled.Events/Commands/Hub/Hub.cs deleted file mode 100644 index 5df93df48c..0000000000 --- a/EXILED/Exiled.Events/Commands/Hub/Hub.cs +++ /dev/null @@ -1,51 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) ExMod Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.Events.Commands.Hub -{ - using System; - - using CommandSystem; - - /// - /// The EXILED hub command. - /// - [CommandHandler(typeof(RemoteAdminCommandHandler))] - [CommandHandler(typeof(GameConsoleCommandHandler))] - public class Hub : ParentCommand - { - /// - /// Initializes a new instance of the class. - /// - public Hub() - { - LoadGeneratedCommands(); - } - - /// - public override string Command { get; } = "hub"; - - /// - public override string[] Aliases { get; } = Array.Empty(); - - /// - public override string Description { get; } = "The EXILED hub command."; - - /// - public override void LoadGeneratedCommands() - { - RegisterCommand(Install.Instance); - } - - /// - protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) - { - response = "Please, specify a valid subcommand! Available ones: install"; - return false; - } - } -} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Commands/Hub/HubApi/ApiProvider.cs b/EXILED/Exiled.Events/Commands/Hub/HubApi/ApiProvider.cs deleted file mode 100644 index 8733468300..0000000000 --- a/EXILED/Exiled.Events/Commands/Hub/HubApi/ApiProvider.cs +++ /dev/null @@ -1,64 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) ExMod Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.Events.Commands.Hub.HubApi -{ - using System; - using System.IO; - using System.Net.Http; - using System.Reflection; - using System.Threading.Tasks; - - using Exiled.Events.Commands.Hub.HubApi.Models; - - using Utf8Json; - - /// - /// An API bridge to EXILED Hub. - /// - public static class ApiProvider - { - /// - /// The API endpoint to get the plugin installation data. - /// - private const string InstallApiEndpoint = "https://hub.exiled-team.net/api/install?name="; - - /// - /// Gets installation data of the plugin by name. - /// - /// The name of plugin. - /// The . - /// A instance containing installation data. - public static async Task GetInstallationData(string pluginName, HttpClient client) - { - string url = InstallApiEndpoint + pluginName; - using HttpResponseMessage response = await client.GetAsync(url).ConfigureAwait(false); - - if (response.IsSuccessStatusCode) - { - using Stream stream = await response.Content.ReadAsStreamAsync().ConfigureAwait(false); - return JsonSerializer.Deserialize(stream); - } - - return null; - } - - /// - /// Creates a HTTP client for EXILED Hub API. - /// - /// Created HTTP client. - internal static HttpClient CreateClient() - { - HttpClient client = new(); - - client.Timeout = TimeSpan.FromSeconds(460); - client.DefaultRequestHeaders.Add("User-Agent", $"Exiled.Events (https://github.com/ExMod-Team/EXILED, {Assembly.GetExecutingAssembly().GetName().Version.ToString(3)})"); - - return client; - } - } -} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Commands/Hub/HubApi/Models/HubPlugin.cs b/EXILED/Exiled.Events/Commands/Hub/HubApi/Models/HubPlugin.cs deleted file mode 100644 index 7d0a7b8f00..0000000000 --- a/EXILED/Exiled.Events/Commands/Hub/HubApi/Models/HubPlugin.cs +++ /dev/null @@ -1,35 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) ExMod Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.Events.Commands.Hub.HubApi.Models -{ - using System.Runtime.Serialization; - - using Utf8Json; - - /// - /// A struct containing all hub plugin data. - /// - public readonly struct HubPlugin : IJsonSerializable - { - /// - /// The repository id. - /// - [DataMember(Name = "repositoryId")] - public readonly long RepositoryId; - - /// - /// Initializes a new instance of the struct. - /// - /// - [SerializationConstructor] - public HubPlugin(long repositoryId) - { - RepositoryId = repositoryId; - } - } -} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Commands/Hub/Install.cs b/EXILED/Exiled.Events/Commands/Hub/Install.cs deleted file mode 100644 index 323a230108..0000000000 --- a/EXILED/Exiled.Events/Commands/Hub/Install.cs +++ /dev/null @@ -1,118 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) ExMod Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.Events.Commands.Hub -{ - using System; - using System.IO; - using System.Linq; - using System.Net.Http; - - using CommandSystem; - - using Exiled.API.Features; - using Exiled.Events.Commands.Hub.HubApi.Models; - using Exiled.Loader; - using Exiled.Loader.GHApi; - using Exiled.Loader.GHApi.Models; - using Exiled.Loader.GHApi.Settings; - using Exiled.Permissions.Extensions; - - using RemoteAdmin; - - /// - /// The command to install a plugin from EXILED Hub. - /// - public class Install : ICommand, IUsageProvider - { - /// - /// Gets static instance of the command. - /// - public static Install Instance { get; } = new(); - - /// - public string Command { get; } = "install"; - - /// - public string[] Aliases { get; } = { "i" }; - - /// - public string[] Usage { get; } = { "Plugin name", "Release tag (optional)" }; - - /// - public string Description { get; } = "Installs a plugin from EXILED Hub."; - - /// - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - const string permission = "hub.install"; - - if (!sender.CheckPermission(permission) && sender is PlayerCommandSender playerSender && !playerSender.FullPermissions) - { - response = $"You don't have permissions to install the plugins. Required permission node: \"{permission}\"."; - return false; - } - - if (arguments.Count == 0) - { - response = "Missing arguments! Usage: hub install (release tag)"; - return false; - } - - using HttpClient client = HubApi.ApiProvider.CreateClient(); - - HubPlugin? pluginData = HubApi.ApiProvider.GetInstallationData(arguments.At(0), client).GetAwaiter().GetResult(); - - if (pluginData == null) - { - response = "An error has occurred while fetching the plugin data. Please check if the plugin name is correct and try again."; - return false; - } - - Release[] pluginReleases = client.GetReleases(pluginData.Value.RepositoryId, new GetReleasesSettings(50, 1)).GetAwaiter().GetResult(); - Release releaseToDownload = pluginReleases[0]; - - if (arguments.Count > 1) - { - Release foundRelease = pluginReleases.FirstOrDefault(x => x.TagName == arguments.At(1)); - - if (foundRelease.Id == 0) - { - response = "Release with the provided tag not found."; - return false; - } - - releaseToDownload = foundRelease; - } - - ReleaseAsset[] releaseAssets = releaseToDownload.Assets.Where(x => x.Name.IndexOf("nwapi", StringComparison.OrdinalIgnoreCase) == -1).ToArray(); - - Log.Info($"Downloading release \"{releaseToDownload.TagName}\". Found {releaseAssets.Length} asset(s) to download."); - - foreach (ReleaseAsset asset in releaseAssets) - { - Log.Info($"Downloading asset {asset.Name}. Asset size: {Math.Round(asset.Size / 1000f, 2)} KB."); - using HttpResponseMessage assetResponse = client.GetAsync(asset.BrowserDownloadUrl).ConfigureAwait(false).GetAwaiter().GetResult(); - - string pluginPath = Path.Combine(Paths.Plugins, asset.Name); - - if (File.Exists(pluginPath) && Environment.OSVersion.Platform == PlatformID.Unix) - LinuxPermission.SetFileUserAndGroupReadWriteExecutePermissions(pluginPath); - - using Stream stream = assetResponse.Content.ReadAsStreamAsync().ConfigureAwait(false).GetAwaiter().GetResult(); - using FileStream fileStream = new(pluginPath, FileMode.Create, FileAccess.Write, FileShare.None); - stream.CopyToAsync(fileStream).ConfigureAwait(false).GetAwaiter().GetResult(); - - if (Environment.OSVersion.Platform == PlatformID.Unix) - LinuxPermission.SetFileUserAndGroupReadWriteExecutePermissions(pluginPath); - } - - response = $"{arguments.At(0)} has been successfully installed."; - return true; - } - } -} \ No newline at end of file From a002194c88212487fc5f09610f4ccb887bc06a37 Mon Sep 17 00:00:00 2001 From: Bolton <48883340+BoltonDev@users.noreply.github.com> Date: Sun, 18 May 2025 22:11:07 +0200 Subject: [PATCH 63/70] fix: update exmod -> exslmod & bump: 9.6.0 --- EXILED/EXILED.props | 6 +++--- EXILED/Exiled.Installer/README.md | 4 ++-- EXILED/Exiled.Loader/Updater.cs | 2 +- EXILED/Exiled/Exiled.nuspec | 6 +++--- EXILED/docs/articles/contributing/index.md | 2 +- EXILED/docs/articles/installation/automatic/linux.md | 2 +- EXILED/docs/articles/installation/automatic/windows.md | 2 +- EXILED/docs/articles/installation/manual.md | 2 +- EXILED/docs/docfx.json | 2 +- EXILED/docs/toc.yml | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) diff --git a/EXILED/EXILED.props b/EXILED/EXILED.props index 4e5c799a11..eefc8a1140 100644 --- a/EXILED/EXILED.props +++ b/EXILED/EXILED.props @@ -15,7 +15,7 @@ - 9.6.0-beta8 + 9.6.0 false @@ -25,8 +25,8 @@ Copyright © $(Authors) 2020 - $([System.DateTime]::Now.ToString("yyyy")) Git - https://github.com/ExMod-Team/EXILED - https://github.com/ExMod-Team/EXILED + https://github.com/ExSLMod-Team/EXILED + https://github.com/ExSLMod-Team/EXILED CC-BY-SA-3.0 $(DefineConstants);PUBLIC_BETA diff --git a/EXILED/Exiled.Installer/README.md b/EXILED/Exiled.Installer/README.md index d4e20cf857..0b20769fd4 100644 --- a/EXILED/Exiled.Installer/README.md +++ b/EXILED/Exiled.Installer/README.md @@ -43,7 +43,7 @@ Trying to find release.. Release found! PRE: True | ID: 87710626 | TAG: 6.0.0-beta.18 Asset found! -ID: 90263995 | NAME: Exiled.tar.gz | SIZE: 1027928 | URL: https://api.github.com/repos/ExMod-Team/Exiled-EA/releases/assets/90263995 | DownloadURL: https://github.com/ExMod-Team/Exiled-EA/releases/download/6.0.0-beta.18/Exiled.tar.gz +ID: 90263995 | NAME: Exiled.tar.gz | SIZE: 1027928 | URL: https://api.github.com/repos/ExMod-Team/Exiled-EA/releases/assets/90263995 | DownloadURL: https://github.com/ExSLMod-Team/Exiled-EA/releases/download/6.0.0-beta.18/Exiled.tar.gz Processing 'EXILED/Plugins/dependencies/0Harmony.dll' Extracting '0Harmony.dll' into 'YourAppDataPath/EXILED/Plugins/dependencies/0Harmony.dll'... Processing 'EXILED/Plugins/dependencies/Exiled.API.dll' @@ -88,7 +88,7 @@ Trying to find release.. Release found! PRE: False | ID: 87710626 | TAG: 6.0.0-beta.18 Asset found! -ID: 90263995 | NAME: Exiled.tar.gz | SIZE: 1027928 | URL: https://api.github.com/repos/ExMod-Team/Exiled-EA/releases/assets/90263995 | DownloadURL: https://github.com/ExMod-Team/Exiled-EA/releases/download/6.0.0-beta.18/Exiled.tar.gz +ID: 90263995 | NAME: Exiled.tar.gz | SIZE: 1027928 | URL: https://api.github.com/repos/ExMod-Team/Exiled-EA/releases/assets/90263995 | DownloadURL: https://github.com/ExSLMod-Team/Exiled-EA/releases/download/6.0.0-beta.18/Exiled.tar.gz Processing 'EXILED/Plugins/dependencies/0Harmony.dll' Extracting '0Harmony.dll' into '/user/SCP/EXILED/Plugins/dependencies/0Harmony.dll'... Processing 'EXILED/Plugins/dependencies/Exiled.API.dll' diff --git a/EXILED/Exiled.Loader/Updater.cs b/EXILED/Exiled.Loader/Updater.cs index 7621e33c57..a90f0589b0 100644 --- a/EXILED/Exiled.Loader/Updater.cs +++ b/EXILED/Exiled.Loader/Updater.cs @@ -136,7 +136,7 @@ private HttpClient CreateHttpClient() Timeout = TimeSpan.FromSeconds(480), }; - client.DefaultRequestHeaders.Add("User-Agent", $"Exiled.Loader (https://github.com/ExMod-Team/EXILED, {Assembly.GetExecutingAssembly().GetName().Version.ToString(3)})"); + client.DefaultRequestHeaders.Add("User-Agent", $"Exiled.Loader (https://github.com/ExSLMod-Team/EXILED, {Assembly.GetExecutingAssembly().GetName().Version.ToString(3)})"); return client; } diff --git a/EXILED/Exiled/Exiled.nuspec b/EXILED/Exiled/Exiled.nuspec index 28c3c7bead..cf95b0fbc8 100644 --- a/EXILED/Exiled/Exiled.nuspec +++ b/EXILED/Exiled/Exiled.nuspec @@ -9,9 +9,9 @@ ExMod-Team Copyright © ExMod Team 2024 - $year$ false - - https://github.com/ExMod-Team/EXILED/blob/master/LICENSE - https://github.com/ExMod-Team/EXILED + + https://github.com/ExSLMod-Team/EXILED/blob/master/LICENSE + https://github.com/ExSLMod-Team/EXILED images\Exiled_Icon.png Plugin framework for SCP: Secret Laboratory. diff --git a/EXILED/docs/articles/contributing/index.md b/EXILED/docs/articles/contributing/index.md index b721accdf3..1e7eb4be83 100644 --- a/EXILED/docs/articles/contributing/index.md +++ b/EXILED/docs/articles/contributing/index.md @@ -6,7 +6,7 @@ title: Contributing to EXILED This is a simple tutorial guiding you to contribute to our framework. ### Forking EXILED -First, create a fork of our [GitHub repository](https://github.com/ExMod-Team/EXILED). +First, create a fork of our [GitHub repository](https://github.com/ExSLMod-Team/EXILED). Then, clone it to your computer like so: `git clone https://github.com/your-username/EXILED.git` diff --git a/EXILED/docs/articles/installation/automatic/linux.md b/EXILED/docs/articles/installation/automatic/linux.md index d2b4550e2e..d8268593d6 100644 --- a/EXILED/docs/articles/installation/automatic/linux.md +++ b/EXILED/docs/articles/installation/automatic/linux.md @@ -4,7 +4,7 @@ title: Automatic Linux Installation # Automatic Linux Installation -Download `Exiled.Installer-Linux` from [here](https://github.com/ExMod-Team/EXILED/releases). +Download `Exiled.Installer-Linux` from [here](https://github.com/ExSLMod-Team/EXILED/releases). Move it into your **server directory** and run it using `./Exiled.Installer-Linux` - Make sure the server directory is the one where LocalAdmin executable is found. diff --git a/EXILED/docs/articles/installation/automatic/windows.md b/EXILED/docs/articles/installation/automatic/windows.md index 61bc27e7b7..c9e890ea74 100644 --- a/EXILED/docs/articles/installation/automatic/windows.md +++ b/EXILED/docs/articles/installation/automatic/windows.md @@ -4,7 +4,7 @@ title: Automatic Windows Installation # Automatic Windows Installation -Download `Exiled.Installer-Win.exe` from [here](https://github.com/ExMod-Team/EXILED/releases). +Download `Exiled.Installer-Win.exe` from [here](https://github.com/ExSLMod-Team/EXILED/releases). Move it into your **server directory** and double click the .exe. - Make sure the server directory is the one where LocalAdmin.exe is found. diff --git a/EXILED/docs/articles/installation/manual.md b/EXILED/docs/articles/installation/manual.md index 4b38c89fcd..9b8cb7c3d9 100644 --- a/EXILED/docs/articles/installation/manual.md +++ b/EXILED/docs/articles/installation/manual.md @@ -8,7 +8,7 @@ You can download exiled manually following this steps: ### Pick a release -You can select a release inside [our official GitHub repo](https://github.com/ExMod-Team/EXILED/releases/). +You can select a release inside [our official GitHub repo](https://github.com/ExSLMod-Team/EXILED/releases/). ### Download the release diff --git a/EXILED/docs/docfx.json b/EXILED/docs/docfx.json index 4991f54874..8dc6b28e44 100644 --- a/EXILED/docs/docfx.json +++ b/EXILED/docs/docfx.json @@ -27,7 +27,7 @@ "_enableSearch": true, "_lang": "en", "_gitContribute": { - "repo": "https://github.com/ExMod-Team/EXILED", + "repo": "https://github.com/ExSLMod-Team/EXILED", "branch": "dev" } }, diff --git a/EXILED/docs/toc.yml b/EXILED/docs/toc.yml index 4e78e3efc1..b4e40a4a6a 100644 --- a/EXILED/docs/toc.yml +++ b/EXILED/docs/toc.yml @@ -5,6 +5,6 @@ - name: NW Documentation href: articles/SCPSLRessources/NW_Documentation.html - name: Repository - href: https://github.com/ExMod-Team/EXILED + href: https://github.com/ExSLMod-Team/EXILED - name: Plugins href: https://hub.exiled-team.net/ From 5de8d8b0957a00c5ef4c54aaee389c0b8cd514ee Mon Sep 17 00:00:00 2001 From: Bolton <48883340+BoltonDev@users.noreply.github.com> Date: Sun, 18 May 2025 22:14:27 +0200 Subject: [PATCH 64/70] fix: missing some change --- EXILED/Exiled.CreditTags/Features/DatabaseHandler.cs | 2 +- EXILED/Exiled.Installer/README.md | 4 ++-- EXILED/docs/articles/contributing/index.md | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/EXILED/Exiled.CreditTags/Features/DatabaseHandler.cs b/EXILED/Exiled.CreditTags/Features/DatabaseHandler.cs index 11c6a6c2a1..c2ec515742 100644 --- a/EXILED/Exiled.CreditTags/Features/DatabaseHandler.cs +++ b/EXILED/Exiled.CreditTags/Features/DatabaseHandler.cs @@ -17,7 +17,7 @@ namespace Exiled.CreditTags.Features public static class DatabaseHandler { - private const string Url = "https://raw.githubusercontent.com/ExMod-Team/CreditTags/main/data.yml"; + private const string Url = "https://raw.githubusercontent.com/ExSLMod-Team/CreditTags/main/data.yml"; private const string ETagCacheFileName = "etag_cache.txt"; private const string DatabaseCacheFileName = "data.yml"; private const int CacheTimeInMinutes = 5; diff --git a/EXILED/Exiled.Installer/README.md b/EXILED/Exiled.Installer/README.md index 0b20769fd4..c2033165c2 100644 --- a/EXILED/Exiled.Installer/README.md +++ b/EXILED/Exiled.Installer/README.md @@ -43,7 +43,7 @@ Trying to find release.. Release found! PRE: True | ID: 87710626 | TAG: 6.0.0-beta.18 Asset found! -ID: 90263995 | NAME: Exiled.tar.gz | SIZE: 1027928 | URL: https://api.github.com/repos/ExMod-Team/Exiled-EA/releases/assets/90263995 | DownloadURL: https://github.com/ExSLMod-Team/Exiled-EA/releases/download/6.0.0-beta.18/Exiled.tar.gz +ID: 90263995 | NAME: Exiled.tar.gz | SIZE: 1027928 | URL: https://api.github.com/repos/ExSLMod-Team/Exiled-EA/releases/assets/90263995 | DownloadURL: https://github.com/ExSLMod-Team/Exiled-EA/releases/download/6.0.0-beta.18/Exiled.tar.gz Processing 'EXILED/Plugins/dependencies/0Harmony.dll' Extracting '0Harmony.dll' into 'YourAppDataPath/EXILED/Plugins/dependencies/0Harmony.dll'... Processing 'EXILED/Plugins/dependencies/Exiled.API.dll' @@ -88,7 +88,7 @@ Trying to find release.. Release found! PRE: False | ID: 87710626 | TAG: 6.0.0-beta.18 Asset found! -ID: 90263995 | NAME: Exiled.tar.gz | SIZE: 1027928 | URL: https://api.github.com/repos/ExMod-Team/Exiled-EA/releases/assets/90263995 | DownloadURL: https://github.com/ExSLMod-Team/Exiled-EA/releases/download/6.0.0-beta.18/Exiled.tar.gz +ID: 90263995 | NAME: Exiled.tar.gz | SIZE: 1027928 | URL: https://api.github.com/repos/ExSLMod-Team/Exiled-EA/releases/assets/90263995 | DownloadURL: https://github.com/ExSLMod-Team/Exiled-EA/releases/download/6.0.0-beta.18/Exiled.tar.gz Processing 'EXILED/Plugins/dependencies/0Harmony.dll' Extracting '0Harmony.dll' into '/user/SCP/EXILED/Plugins/dependencies/0Harmony.dll'... Processing 'EXILED/Plugins/dependencies/Exiled.API.dll' diff --git a/EXILED/docs/articles/contributing/index.md b/EXILED/docs/articles/contributing/index.md index 1e7eb4be83..fdcec6d5a0 100644 --- a/EXILED/docs/articles/contributing/index.md +++ b/EXILED/docs/articles/contributing/index.md @@ -14,7 +14,7 @@ Open a terminal in your forked EXILED folder and run ```git checkout dev```. Thi ### Setting `EXILED_REFERENCES` -If you haven't already, install the `SCP: Secret Laboratory Dedicated Server` through Steam or extract [this zip file](https://ExMod-Team.github.io/SL-References/Dev.zip) to an easily accessible folder. +If you haven't already, install the `SCP: Secret Laboratory Dedicated Server` through Steam or extract [this zip file](https://ExSLMod-Team.github.io/SL-References/Dev.zip) to an easily accessible folder. #### Windows users Open the Environment Variables menu by searching for `Environment Variables` in the Start Menu. From 4f8927d9378483377ed4efaa16d47999dd95cc4c Mon Sep 17 00:00:00 2001 From: Bolton <48883340+BoltonDev@users.noreply.github.com> Date: Sun, 18 May 2025 22:20:14 +0200 Subject: [PATCH 65/70] missing hub --- EXILED/docs/toc.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/EXILED/docs/toc.yml b/EXILED/docs/toc.yml index b4e40a4a6a..f3e6ee456a 100644 --- a/EXILED/docs/toc.yml +++ b/EXILED/docs/toc.yml @@ -6,5 +6,3 @@ href: articles/SCPSLRessources/NW_Documentation.html - name: Repository href: https://github.com/ExSLMod-Team/EXILED -- name: Plugins - href: https://hub.exiled-team.net/ From b2deab09b89e5a81169808f48a7dd7cc99a3422b Mon Sep 17 00:00:00 2001 From: Bolton <48883340+BoltonDev@users.noreply.github.com> Date: Mon, 19 May 2025 01:24:54 +0200 Subject: [PATCH 66/70] fix: wrong repo id --- EXILED/Exiled.Loader/Updater.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/EXILED/Exiled.Loader/Updater.cs b/EXILED/Exiled.Loader/Updater.cs index a90f0589b0..7d4aab7102 100644 --- a/EXILED/Exiled.Loader/Updater.cs +++ b/EXILED/Exiled.Loader/Updater.cs @@ -32,7 +32,7 @@ namespace Exiled.Loader ///
internal sealed class Updater { - private const long REPOID = 833723500; + private const long REPOID = 984817990; private const string INSTALLER_ASSET_NAME_LINUX = "Exiled.Installer-Linux"; private const string INSTALLER_ASSET_NAME_WIN = "Exiled.Installer-Win.exe"; @@ -178,8 +178,9 @@ private bool FindUpdate(HttpClient client, bool forced, out NewVersion newVersio Log.Info("No new versions found, you're using the most recent version of Exiled!"); } } - catch (Utf8Json.JsonParsingException) + catch (Utf8Json.JsonParsingException e) { + Log.Warn(e); Log.Warn("Encountered GitHub ratelimit, unable to check and download the latest version of Exiled."); } catch (Exception ex) From af07af941f75e769da4c3667b4027a13b308dc7c Mon Sep 17 00:00:00 2001 From: Bolton <48883340+BoltonDev@users.noreply.github.com> Date: Mon, 19 May 2025 01:25:52 +0200 Subject: [PATCH 67/70] fix: missing log warn --- EXILED/Exiled.Loader/Updater.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/EXILED/Exiled.Loader/Updater.cs b/EXILED/Exiled.Loader/Updater.cs index 7d4aab7102..92c47415ee 100644 --- a/EXILED/Exiled.Loader/Updater.cs +++ b/EXILED/Exiled.Loader/Updater.cs @@ -178,9 +178,8 @@ private bool FindUpdate(HttpClient client, bool forced, out NewVersion newVersio Log.Info("No new versions found, you're using the most recent version of Exiled!"); } } - catch (Utf8Json.JsonParsingException e) + catch (Utf8Json.JsonParsingException) { - Log.Warn(e); Log.Warn("Encountered GitHub ratelimit, unable to check and download the latest version of Exiled."); } catch (Exception ex) From 7ebe899c7c6d984887ee2f5dfd3cb669aff10feb Mon Sep 17 00:00:00 2001 From: VALERA771 <72030575+VALERA771@users.noreply.github.com> Date: Thu, 31 Jul 2025 20:47:44 +0300 Subject: [PATCH 68/70] feat: Item::Inspected Item::Inspecting & Scp939::PlacingMimicPoint (#473) * feat: a bunch of new evs * revert Events.cs changes * docs: comments for transpilers * feat: support for all items * feat: mhid support * docs: fetch documentation * fix: fix InspectedItemEventArgs.cs and docs update --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> --- .../EventArgs/Item/InspectedItemEventArgs.cs | 35 ++ .../EventArgs/Item/InspectingItemEventArgs.cs | 41 +++ .../Scp939/PlacingMimicPointEventArgs.cs | 48 +++ EXILED/Exiled.Events/Handlers/Item.cs | 22 ++ EXILED/Exiled.Events/Handlers/Scp939.cs | 11 + .../Patches/Events/Item/Inspect.cs | 319 ++++++++++++++++++ .../Events/Scp939/PlacingMimicPoint.cs | 84 +++++ 7 files changed, 560 insertions(+) create mode 100644 EXILED/Exiled.Events/EventArgs/Item/InspectedItemEventArgs.cs create mode 100644 EXILED/Exiled.Events/EventArgs/Item/InspectingItemEventArgs.cs create mode 100644 EXILED/Exiled.Events/EventArgs/Scp939/PlacingMimicPointEventArgs.cs create mode 100644 EXILED/Exiled.Events/Patches/Events/Item/Inspect.cs create mode 100644 EXILED/Exiled.Events/Patches/Events/Scp939/PlacingMimicPoint.cs diff --git a/EXILED/Exiled.Events/EventArgs/Item/InspectedItemEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Item/InspectedItemEventArgs.cs new file mode 100644 index 0000000000..283fd4910f --- /dev/null +++ b/EXILED/Exiled.Events/EventArgs/Item/InspectedItemEventArgs.cs @@ -0,0 +1,35 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Item +{ + using Exiled.API.Features; + using Exiled.API.Features.Items; + using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items; + + /// + /// Contains all information before weapon is inspected. + /// + public class InspectedItemEventArgs : IItemEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + public InspectedItemEventArgs(ItemBase item) + { + Item = Item.Get(item); + } + + /// + public Player Player => Item.Owner; + + /// + public Item Item { get; } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Item/InspectingItemEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Item/InspectingItemEventArgs.cs new file mode 100644 index 0000000000..5bb7cb4077 --- /dev/null +++ b/EXILED/Exiled.Events/EventArgs/Item/InspectingItemEventArgs.cs @@ -0,0 +1,41 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Item +{ + using Exiled.API.Features; + using Exiled.API.Features.Items; + using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items; + + /// + /// Contains all information before weapon is inspected. + /// + public class InspectingItemEventArgs : IItemEvent, IDeniableEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + public InspectingItemEventArgs(ItemBase item, bool isAllowed = true) + { + Item = Item.Get(item); + IsAllowed = isAllowed; + } + + /// + public Player Player => Item.Owner; + + /// + public Item Item { get; } + + /// + /// Setter will not work if inspected is a or a . + public bool IsAllowed { get; set; } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp939/PlacingMimicPointEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp939/PlacingMimicPointEventArgs.cs new file mode 100644 index 0000000000..a761942caf --- /dev/null +++ b/EXILED/Exiled.Events/EventArgs/Scp939/PlacingMimicPointEventArgs.cs @@ -0,0 +1,48 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Scp939 +{ + using Exiled.API.Features; + using Exiled.API.Features.Roles; + using Exiled.Events.EventArgs.Interfaces; + using RelativePositioning; + + /// + /// Contains all information before mimicry point is placed. + /// + public class PlacingMimicPointEventArgs : IScp939Event, IDeniableEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + public PlacingMimicPointEventArgs(Player player, RelativePosition position, bool isAllowed = true) + { + Player = player; + Scp939 = player.Role.As(); + Position = position; + IsAllowed = isAllowed; + } + + /// + public Player Player { get; } + + /// + public Scp939Role Scp939 { get; } + + /// + public bool IsAllowed { get; set; } + + /// + /// Gets or sets a position of mimicry point. + /// + public RelativePosition Position { get; set; } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Handlers/Item.cs b/EXILED/Exiled.Events/Handlers/Item.cs index d8153a586e..4cca796fef 100644 --- a/EXILED/Exiled.Events/Handlers/Item.cs +++ b/EXILED/Exiled.Events/Handlers/Item.cs @@ -58,6 +58,16 @@ public static class Item ///
public static Event ChangingMicroHIDPickupState { get; set; } = new(); + /// + /// Invoked before item inspection is started. + /// + public static Event InspectingItem { get; set; } = new(); + + /// + /// Invoked after item inspection is started. + /// + public static Event InspectedItem { get; set; } = new(); + /// /// Invoked before a firing while on the ground. /// The client will still see all effects, like sounds and shoot. @@ -118,5 +128,17 @@ public static class Item /// /// The instance. public static void OnChangingMicroHIDPickupState(ChangingMicroHIDPickupStateEventArgs ev) => ChangingMicroHIDPickupState.InvokeSafely(ev); + + /// + /// Called before item inspection is started. + /// + /// The instance. + public static void OnInspectingItem(InspectingItemEventArgs ev) => InspectingItem.InvokeSafely(ev); + + /// + /// Called before item inspection is started. + /// + /// The instance. + public static void OnInspectedItem(InspectedItemEventArgs ev) => InspectedItem.InvokeSafely(ev); } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/Handlers/Scp939.cs b/EXILED/Exiled.Events/Handlers/Scp939.cs index d2ca5e4533..d5d5da378e 100644 --- a/EXILED/Exiled.Events/Handlers/Scp939.cs +++ b/EXILED/Exiled.Events/Handlers/Scp939.cs @@ -74,6 +74,11 @@ public static class Scp939 ///
public static Event ValidatingVisibility { get; set; } = new(); + /// + /// Invoked before mimicry point is placed. + /// + public static Event PlacingMimicPoint { get; set; } = new(); + /// /// Called before SCP-939 changes its target focus. /// @@ -139,5 +144,11 @@ public static class Scp939 ///
/// The instance. public static void OnValidatingVisibility(ValidatingVisibilityEventArgs ev) => ValidatingVisibility.InvokeSafely(ev); + + /// + /// Called before mimicry point is placed. + /// + /// The instance. + public static void OnPlacingMimicPoint(PlacingMimicPointEventArgs ev) => PlacingMimicPoint.InvokeSafely(ev); } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Item/Inspect.cs b/EXILED/Exiled.Events/Patches/Events/Item/Inspect.cs new file mode 100644 index 0000000000..860d064ea1 --- /dev/null +++ b/EXILED/Exiled.Events/Patches/Events/Item/Inspect.cs @@ -0,0 +1,319 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.Patches.Events.Item +{ +#pragma warning disable SA1402 +#pragma warning disable SA1649 + using System.Collections.Generic; + using System.Reflection.Emit; + + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; + using Exiled.Events.EventArgs.Item; + using HarmonyLib; + using InventorySystem.Items.Firearms.Modules; + using InventorySystem.Items.Jailbird; + using InventorySystem.Items.Keycards; + using InventorySystem.Items.MicroHID.Modules; + using InventorySystem.Items.Usables.Scp1344; + + using static HarmonyLib.AccessTools; + + /// + /// Patches + /// to add and event. + /// + [EventPatch(typeof(Handlers.Item), nameof(Handlers.Item.InspectingItem))] + [EventPatch(typeof(Handlers.Item), nameof(Handlers.Item.InspectedItem))] + [HarmonyPatch(typeof(SimpleInspectorModule), nameof(SimpleInspectorModule.ServerProcessCmd))] + internal class InspectWeapon + { + private static IEnumerable Transpiler(IEnumerable instructions) + { + List newInstructions = ListPool.Pool.Get(instructions); + + int index = newInstructions.FindLastIndex(x => x.opcode == OpCodes.Ldarg_0); + + newInstructions.InsertRange(index, new[] + { + // this.Firearm + new CodeInstruction(OpCodes.Ldarg_0).MoveLabelsFrom(newInstructions[index]), + new(OpCodes.Callvirt, PropertyGetter(typeof(SimpleInspectorModule), nameof(SimpleInspectorModule.Firearm))), + + // true + new(OpCodes.Ldc_I4_1), + + // InspectingItemEventArgs ev = new(this.Firearm) + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(InspectingItemEventArgs))[0]), + + // Handlers.Item.OnInspectingItem(ev) + new(OpCodes.Call, Method(typeof(Handlers.Item), nameof(Handlers.Item.OnInspectingItem))), + }); + + newInstructions.InsertRange(newInstructions.Count - 1, new CodeInstruction[] + { + // this.Firearm + new(OpCodes.Ldarg_0), + new(OpCodes.Callvirt, PropertyGetter(typeof(SimpleInspectorModule), nameof(SimpleInspectorModule.Firearm))), + + // InspectedItemEventArgs ev = new(this.Firearm) + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(InspectedItemEventArgs))[0]), + + // Handlers.Item.OnInspectedItem(ev) + new(OpCodes.Call, Method(typeof(Handlers.Item), nameof(Handlers.Item.OnInspectedItem))), + }); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + } + + /// + /// Patches + /// to add and event. + /// + [EventPatch(typeof(Handlers.Item), nameof(Handlers.Item.InspectingItem))] + [EventPatch(typeof(Handlers.Item), nameof(Handlers.Item.InspectedItem))] + [HarmonyPatch(typeof(Scp1344NetworkHandler), nameof(Scp1344NetworkHandler.TryInspect))] + internal class InspectScp1344 + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); + + int offset = 1; + int index = newInstructions.FindIndex(x => x.Is(OpCodes.Callvirt, PropertyGetter(typeof(Scp1344Item), nameof(Scp1344Item.AllowInspect)))) + offset; + + LocalBuilder allowed = generator.DeclareLocal(typeof(bool)); + + newInstructions.InsertRange(index, new CodeInstruction[] + { + // store isAllowed + new(OpCodes.Stloc_S, allowed.LocalIndex), + + // curInstance + new(OpCodes.Ldloc_0), + + // load isAllowed + new(OpCodes.Ldloc_S, allowed.LocalIndex), + + // InspectingItemEventArgs ev = new(curInstance, isAllowed); + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(InspectingItemEventArgs))[0]), + new(OpCodes.Dup), + + // Handlers.Item.OnInspectingItem(ev); + new(OpCodes.Call, Method(typeof(Handlers.Item), nameof(Handlers.Item.OnInspectingItem))), + + // load isAllowed + new(OpCodes.Callvirt, PropertyGetter(typeof(InspectingItemEventArgs), nameof(InspectingItemEventArgs.IsAllowed))), + }); + + newInstructions.InsertRange(newInstructions.Count - 1, new CodeInstruction[] + { + // curInstance + new(OpCodes.Ldloc_0), + + // InspectedItemEventArgs = new(curInstance); + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(InspectedItemEventArgs))[0]), + + // Handlers.Item.OnInspectedItem(ev); + new(OpCodes.Call, Method(typeof(Handlers.Item), nameof(Handlers.Item.OnInspectedItem))), + }); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + } + + /// + /// Patches + /// to add and event. + /// + [EventPatch(typeof(Handlers.Item), nameof(Handlers.Item.InspectingItem))] + [EventPatch(typeof(Handlers.Item), nameof(Handlers.Item.InspectedItem))] + [HarmonyPatch(typeof(KeycardItem), nameof(KeycardItem.ServerProcessCmd))] + internal class InspectKeycard + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); + + int offset = 1; + int index = newInstructions.FindLastIndex(x => x.opcode == OpCodes.Ldloc_1) + offset; + + LocalBuilder allowed = generator.DeclareLocal(typeof(bool)); + + newInstructions.InsertRange(index, new CodeInstruction[] + { + // save flag value as isAllowed + new(OpCodes.Stloc_S, allowed.LocalIndex), + + // this + new(OpCodes.Ldarg_0), + + // load isAllowed + new(OpCodes.Ldloc_S, allowed.LocalIndex), + + // InspectingItemEventArgs ev = new(this, isAllowed) + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(InspectingItemEventArgs))[0]), + new(OpCodes.Dup), + + // Handlers.Item.OnInspectingItem(ev) + new(OpCodes.Call, Method(typeof(Handlers.Item), nameof(Handlers.Item.OnInspectingItem))), + + // load isAllowed + new(OpCodes.Callvirt, PropertyGetter(typeof(InspectingItemEventArgs), nameof(InspectingItemEventArgs.IsAllowed))), + }); + + newInstructions.InsertRange(newInstructions.Count - 1, new CodeInstruction[] + { + // this + new(OpCodes.Ldarg_0), + + // InspectedItemEventArgs ev = new(this) + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(InspectedItemEventArgs))[0]), + + // Handlers.Item.OnInspectedItem(ev) + new(OpCodes.Call, Method(typeof(Handlers.Item), nameof(Handlers.Item.OnInspectedItem))), + }); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + + private static void Return(KeycardItem item) => item.ServerSendPrivateRpc(x => KeycardItem.WriteInspect(x, false)); + } + + /// + /// Patches + /// to add and event. + /// + [EventPatch(typeof(Handlers.Item), nameof(Handlers.Item.InspectingItem))] + [EventPatch(typeof(Handlers.Item), nameof(Handlers.Item.InspectedItem))] + [HarmonyPatch(typeof(JailbirdItem), nameof(JailbirdItem.ServerProcessCmd))] + internal class InspectJailbird + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); + + int offset = 1; + int index = newInstructions.FindLastIndex(x => x.opcode == OpCodes.Ldloc_2) + offset; + + LocalBuilder allowed = generator.DeclareLocal(typeof(bool)); + + newInstructions.InsertRange(index, new CodeInstruction[] + { + // save flag value as isAllowed + new(OpCodes.Stloc_S, allowed.LocalIndex), + + // this + new(OpCodes.Ldarg_0), + + // load isAllowed + new(OpCodes.Ldloc_S, allowed.LocalIndex), + + // InspectingItemEventArgs ev = new(this, isAllowed) + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(InspectingItemEventArgs))[0]), + new(OpCodes.Dup), + + // Handlers.Item.OnInspectingItem(ev) + new(OpCodes.Call, Method(typeof(Handlers.Item), nameof(Handlers.Item.OnInspectingItem))), + + // load isAllowed + new(OpCodes.Callvirt, PropertyGetter(typeof(InspectingItemEventArgs), nameof(InspectingItemEventArgs.IsAllowed))), + }); + + index = newInstructions.FindLastIndex(x => x.Calls(Method(typeof(JailbirdItem), nameof(JailbirdItem.SendRpc)))) + offset; + + newInstructions.InsertRange(index, new CodeInstruction[] + { + // this + new(OpCodes.Ldarg_0), + + // InspectedItemEventArgs ev = new(this) + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(InspectedItemEventArgs))[0]), + + // Handlers.Item.OnInspectedItem(ev) + new(OpCodes.Call, Method(typeof(Handlers.Item), nameof(Handlers.Item.OnInspectedItem))), + }); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + } + + /// + /// Patches + /// to add and event. + /// + [EventPatch(typeof(Handlers.Item), nameof(Handlers.Item.InspectingItem))] + [EventPatch(typeof(Handlers.Item), nameof(Handlers.Item.InspectedItem))] + [HarmonyPatch(typeof(DrawAndInspectorModule), nameof(DrawAndInspectorModule.ServerProcessCmd))] + internal class InspectMicroHid + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); + + int index = newInstructions.FindLastIndex(x => x.opcode == OpCodes.Ldarg_0); + + Label returnLabel = generator.DefineLabel(); + + newInstructions.InsertRange(index, new[] + { + // this.MicroHid + new CodeInstruction(OpCodes.Ldarg_0).MoveLabelsFrom(newInstructions[index]), + new(OpCodes.Callvirt, PropertyGetter(typeof(DrawAndInspectorModule), nameof(DrawAndInspectorModule.MicroHid))), + + // true + new(OpCodes.Ldc_I4_1), + + // InspectingItemEventArgs ev = new(this.MicroHid, true) + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(InspectingItemEventArgs))[0]), + new(OpCodes.Dup), + + // Handlers.Item.OnInspectingItem(ev) + new(OpCodes.Call, Method(typeof(Handlers.Item), nameof(Handlers.Item.OnInspectingItem))), + + // if (!ev.IsAllowed) + // return + new(OpCodes.Callvirt, PropertyGetter(typeof(InspectingItemEventArgs), nameof(InspectingItemEventArgs.IsAllowed))), + new(OpCodes.Brfalse_S, returnLabel), + }); + + newInstructions.InsertRange(newInstructions.Count - 1, new CodeInstruction[] + { + // this.MicroHid + new(OpCodes.Ldarg_0), + new(OpCodes.Callvirt, PropertyGetter(typeof(DrawAndInspectorModule), nameof(DrawAndInspectorModule.MicroHid))), + + // InspectedItemEventArgs = new(this.MicroHid) + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(InspectedItemEventArgs))[0]), + + // Handlers.Item.OnInspectedItem(ev) + new(OpCodes.Call, Method(typeof(Handlers.Item), nameof(Handlers.Item.OnInspectedItem))), + }); + + newInstructions[newInstructions.Count - 1].labels.Add(returnLabel); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Scp939/PlacingMimicPoint.cs b/EXILED/Exiled.Events/Patches/Events/Scp939/PlacingMimicPoint.cs new file mode 100644 index 0000000000..753291df01 --- /dev/null +++ b/EXILED/Exiled.Events/Patches/Events/Scp939/PlacingMimicPoint.cs @@ -0,0 +1,84 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.Patches.Events.Scp939 +{ + using System.Collections.Generic; + using System.Reflection.Emit; + + using Exiled.API.Features; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; + using Exiled.Events.EventArgs.Scp939; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp939.Mimicry; + + using static HarmonyLib.AccessTools; + + /// + /// Patches + /// to add event. + /// + [EventPatch(typeof(Handlers.Scp939), nameof(Handlers.Scp939.PlacingMimicPoint))] + [HarmonyPatch(typeof(MimicPointController), nameof(MimicPointController.ServerProcessCmd))] + internal class PlacingMimicPoint + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); + + int offset = 1; + int index = newInstructions.FindLastIndex(x => x.opcode == OpCodes.Stfld) + offset; + + Label returnLabel = generator.DefineLabel(); + + LocalBuilder ev = generator.DeclareLocal(typeof(PlacingMimicPointEventArgs)); + + newInstructions.InsertRange(index, new CodeInstruction[] + { + // Player.Get(this.Owner) + new(OpCodes.Ldarg_0), + new(OpCodes.Callvirt, PropertyGetter(typeof(MimicPointController), nameof(MimicPointController.Owner))), + new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), + + // this._syncPos + new(OpCodes.Ldarg_0), + new(OpCodes.Ldfld, Field(typeof(MimicPointController), nameof(MimicPointController._syncPos))), + + // true + new(OpCodes.Ldc_I4_1), + + // PlacingMimicPointEventArgs = new(Player.Get(this.Owner), this._syncPos, true) + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(PlacingMimicPointEventArgs))[0]), + new(OpCodes.Dup), + new(OpCodes.Dup), + new(OpCodes.Stloc_S, ev.LocalIndex), + + // Handlers.Scp939.OnPlacingMimicPoint(ev) + new(OpCodes.Call, Method(typeof(Handlers.Scp939), nameof(Handlers.Scp939.OnPlacingMimicPoint))), + + // if (!ev.IsAllowed) + // return + new(OpCodes.Callvirt, PropertyGetter(typeof(PlacingMimicPointEventArgs), nameof(PlacingMimicPointEventArgs.IsAllowed))), + new(OpCodes.Brfalse_S, returnLabel), + + // this._syncPos = ev.Position + new(OpCodes.Ldarg_0), + new(OpCodes.Ldloc_S, ev.LocalIndex), + new(OpCodes.Callvirt, PropertyGetter(typeof(PlacingMimicPointEventArgs), nameof(PlacingMimicPointEventArgs.Position))), + new(OpCodes.Stfld, Field(typeof(MimicPointController), nameof(MimicPointController._syncPos))), + }); + + newInstructions[newInstructions.Count - 1].labels.Add(returnLabel); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + } +} \ No newline at end of file From ea41ca962117b4c2a302cab45eaccdb17419029f Mon Sep 17 00:00:00 2001 From: Yamato <66829532+louis1706@users.noreply.github.com> Date: Thu, 31 Jul 2025 21:35:12 +0200 Subject: [PATCH 69/70] Delete .github/workflows/labapi.yml --- .github/workflows/labapi.yml | 74 ------------------------------------ 1 file changed, 74 deletions(-) delete mode 100644 .github/workflows/labapi.yml diff --git a/.github/workflows/labapi.yml b/.github/workflows/labapi.yml deleted file mode 100644 index 69cb71f0aa..0000000000 --- a/.github/workflows/labapi.yml +++ /dev/null @@ -1,74 +0,0 @@ -name: Exiled Dev CI - -on: - push: - branches: - - LabAPI - pull_request: - branches: - - LabAPI - workflow_dispatch: - -defaults: - run: - working-directory: ./EXILED - -env: - EXILED_REFERENCES_URL: https://exslmod-team.github.io/SL-References/LabAPI.zip - EXILED_REFERENCES_PATH: ${{ github.workspace }}/EXILED/References - EXILED_DLL_ARCHIVER_URL: https://github.com/ExSLMod-Team/EXILED-DLL-Archiver/releases/download/v1.8.2/EXILED-DLL-Archiver.exe - -jobs: - - build: - - runs-on: windows-latest - # Prevent double running for push & pull_request events from the main repo - if: github.event_name != 'push' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name - - steps: - - - name: Setup .NET Core SDK - uses: actions/setup-dotnet@v4.0.1 - - - name: Setup Nuget - uses: nuget/setup-nuget@v2 - - - uses: actions/checkout@v4.1.7 - - - name: Get references - shell: pwsh - run: | - Invoke-WebRequest -Uri ${{ env.EXILED_REFERENCES_URL }} -OutFile ${{ github.workspace }}/EXILED/References.zip - Expand-Archive -Path References.zip -DestinationPath ${{ env.EXILED_REFERENCES_PATH }} - - - name: Build - env: - EXILED_REFERENCES: ${{ env.EXILED_REFERENCES_PATH }} - shell: pwsh - run: | - ./build.ps1 -BuildNuGet - $File = (Get-ChildItem -Path . -Include 'ExMod.Exiled.*.nupkg' -Recurse).Name - Out-File -FilePath ${{ github.env }} -InputObject "PackageFile=$File" -Encoding utf-8 -Append - - - name: Upload nuget package - uses: actions/upload-artifact@v4 - with: - name: ${{ env.PackageFile }} - path: EXILED/${{ env.PackageFile }} - - - name: Get references - shell: pwsh - run: | - Invoke-WebRequest -Uri ${{ env.EXILED_DLL_ARCHIVER_URL }} -OutFile ${{ github.workspace }}/EXILED/EXILED-DLL-Archiver.exe - - - name: Packaging results as tar.gz - shell: pwsh - run: ./packaging.ps1 - - - name: Upload artifacts - uses: actions/upload-artifact@v4 - with: - name: Build Result - path: EXILED/bin/Release/Exiled.tar.gz - From 62ca0e134689e1dbf113b223b9872684bc30af03 Mon Sep 17 00:00:00 2001 From: Yamato Date: Thu, 31 Jul 2025 21:37:38 +0200 Subject: [PATCH 70/70] revert bad stuff again --- .github/workflows/dev.yml | 4 ++-- EXILED/Exiled.Installer/Program.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index ab7b2d0556..7ee77d48a0 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -16,9 +16,9 @@ defaults: working-directory: ./EXILED env: - EXILED_REFERENCES_URL: https://exslmod-team.github.io/SL-References/Dev.zip + EXILED_REFERENCES_URL: https://exmod-team.github.io/SL-References/Dev.zip EXILED_REFERENCES_PATH: ${{ github.workspace }}/EXILED/References - EXILED_DLL_ARCHIVER_URL: https://github.com/ExSLMod-Team/EXILED-DLL-Archiver/releases/latest/download/EXILED-DLL-Archiver.exe + EXILED_DLL_ARCHIVER_URL: https://github.com/ExMod-Team/EXILED-DLL-Archiver/releases/latest/download/EXILED-DLL-Archiver.exe jobs: diff --git a/EXILED/Exiled.Installer/Program.cs b/EXILED/Exiled.Installer/Program.cs index 8b9c39c7e8..c7a43a2dcd 100644 --- a/EXILED/Exiled.Installer/Program.cs +++ b/EXILED/Exiled.Installer/Program.cs @@ -42,7 +42,7 @@ internal enum PathResolution internal static class Program { - private const long RepoID = 984817990; + private const long RepoID = 833723500; private const string ExiledAssetName = "exiled.tar.gz"; // This is the lowest version the installer will check to install