Skip to content
This repository was archived by the owner on Jul 8, 2025. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion EXILED/Exiled.API/Exiled.API.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,18 @@
</ItemGroup>

<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<PostBuildEvent>if not "$(EXILED_DEV_PLUGINAPI_REFERENCE)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_PLUGINAPI_REFERENCE)\dependencies\" &amp;&amp; if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\dependencies\"</PostBuildEvent>
<PostBuildEvent>
if not "$(EXILED_DEV_PLUGINAPI_REFERENCE)"=="" (
copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_PLUGINAPI_REFERENCE)\dependencies\"
)
if not "$(EXILED_DEV_REFERENCES)"=="" (
copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\dependencies\"
)
if not "$(EXILED_DEV_PLUGINAPI_REFERENCE_GLOBAL)"=="" (
if not exist "$(EXILED_DEV_PLUGINAPI_REFERENCE_GLOBAL)\dependencies\global" mkdir "$(EXILED_DEV_PLUGINAPI_REFERENCE_GLOBAL)\dependencies\global"
copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_PLUGINAPI_REFERENCE_GLOBAL)\dependencies\global\"
)
</PostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' == 'Unix' ">
<PostBuildEvent>if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/dependencies/"; fi</PostBuildEvent>
Expand Down
2 changes: 1 addition & 1 deletion EXILED/Exiled.API/Features/Items/Keycard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public Keycard(KeycardItem itemBase)
/// </summary>
/// <param name="type">The <see cref="ItemType"/> of the keycard.</param>
internal Keycard(ItemType type)
: this((KeycardItem)Server.Host.Inventory.CreateItemInstance(new(type, 0), false))
: this((KeycardItem)Server.Host.Inventory.CreateItemInstance(new(type, 1), false))
{
}

Expand Down
4 changes: 2 additions & 2 deletions EXILED/Exiled.CustomItems/API/Features/CustomKeycard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ public override ItemType Type
/// <inheritdoc/>
public override void Give(Player player, Item item, bool displayMessage = true)
{
base.Give(player, item, displayMessage);

if (item.Is(out Keycard card))
SetupKeycard(card);
base.Give(player, item, displayMessage);

}

/// <inheritdoc/>
Expand Down
33 changes: 22 additions & 11 deletions EXILED/Exiled.Events/Patches/Events/Scp914/UpgradingPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
namespace Exiled.Events.Patches.Events.Scp914
{
using System.Collections.Generic;
using System.Reflection;
using System.Reflection.Emit;

using API.Features;
Expand All @@ -22,6 +23,7 @@ namespace Exiled.Events.Patches.Events.Scp914

using static HarmonyLib.AccessTools;

using OpCode = System.Reflection.Emit.OpCode;
using Scp914 = Handlers.Scp914;

/// <summary>
Expand Down Expand Up @@ -112,43 +114,52 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi

LocalBuilder ev2 = generator.DeclareLocal(typeof(UpgradingInventoryItemEventArgs));
offset = 1;
index = newInstructions.FindIndex(x => x.opcode == OpCodes.Stloc_S && x.operand is LocalBuilder { LocalIndex: 10 }) + offset;

//index = newInstructions.FindIndex(x => x.opcode == OpCodes.Stloc_S && x.operand is LocalBuilder { LocalIndex: 10 }) + offset;
ConstructorInfo plugin_api_constructor = typeof(LabApi.Events.Arguments.Scp914Events.Scp914ProcessingInventoryItemEventArgs)
.GetConstructor(new[] {
typeof(InventorySystem.Items.ItemBase),
typeof(Scp914KnobSetting),
typeof(ReferenceHub)
});
index = newInstructions.FindIndex(x => x.Is(OpCodes.Newobj, plugin_api_constructor)) + offset;
//ridtp lcz914
//noclip
//give tuxwonder7 47
newInstructions.InsertRange(
index,
new CodeInstruction[]
{
// setting = curSetting
new(OpCodes.Ldloc_S, curSetting.LocalIndex),
new(OpCodes.Starg_S, 3),

// Player.Get(ply)
new(OpCodes.Ldarg_0),
new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })),

// itemBase
new(OpCodes.Ldloc_S, 8),

new(OpCodes.Ldloc_S, 7),
// setting
new(OpCodes.Ldarg_S, 3),

// true
new(OpCodes.Ldc_I4_1),

// UpgradingInventoryItemEventArgs ev = new(player, itemBase, setting)
new(OpCodes.Newobj, GetDeclaredConstructors(typeof(UpgradingInventoryItemEventArgs))[0]),
new(OpCodes.Dup),
new(OpCodes.Dup),
new(OpCodes.Stloc_S, ev2.LocalIndex),

// Handlers.Scp914.OnUpgradingInventoryItem(ev);
new(OpCodes.Call, Method(typeof(Scp914), nameof(Scp914.OnUpgradingInventoryItem))),

// if (!ev.IsAllowed)
// return;
new(OpCodes.Callvirt, PropertyGetter(typeof(UpgradingInventoryItemEventArgs), nameof(UpgradingInventoryItemEventArgs.IsAllowed))),
new(OpCodes.Brfalse_S, continueLabel),

// setting = ev.KnobSetting
new(OpCodes.Ldloc_S, ev2.LocalIndex),
new(OpCodes.Callvirt, PropertyGetter(typeof(UpgradingInventoryItemEventArgs), nameof(UpgradingInventoryItemEventArgs.KnobSetting))),
Expand Down