From 5d9370a811f9e9ef28c3bed704d3df2a47b08591 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 6 Oct 2024 07:07:19 +0000 Subject: [PATCH 01/34] Bump Lib.Harmony from 2.2.2 to 2.3.3 in /EXILED Bumps [Lib.Harmony](https://github.com/pardeike/Harmony) from 2.2.2 to 2.3.3. - [Release notes](https://github.com/pardeike/Harmony/releases) - [Commits](https://github.com/pardeike/Harmony/compare/v2.2.2.0...v2.3.3.0) --- updated-dependencies: - dependency-name: Lib.Harmony dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- EXILED/EXILED.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/EXILED.props b/EXILED/EXILED.props index c496e96ba6..617f53a2b0 100644 --- a/EXILED/EXILED.props +++ b/EXILED/EXILED.props @@ -19,7 +19,7 @@ false - 2.2.2 + 2.3.3 1.1.118 2.0.2 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 02/34] 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 18/34] 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 19/34] 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 20/34] 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 21/34] 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 22/34] 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 23/34] 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 24/34] 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 25/34] 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 26/34] 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 27/34] 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 28/34] 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 29/34] 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 30/34] 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 31/34] 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 32/34] 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 33/34] 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 065717396b5652e51be81dff2f49ee4cbbe63513 Mon Sep 17 00:00:00 2001 From: Yamato <66829532+louis1706@users.noreply.github.com> Date: Sun, 20 Apr 2025 22:51:07 +0200 Subject: [PATCH 34/34] Update EXILED/EXILED.props --- EXILED/EXILED.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED/EXILED.props b/EXILED/EXILED.props index 1199eb36a8..fdee843e2e 100644 --- a/EXILED/EXILED.props +++ b/EXILED/EXILED.props @@ -19,7 +19,7 @@ false - 2.3.3 + 2.3.6 1.1.118 2.0.2