Skip to content
Merged
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
3 changes: 1 addition & 2 deletions EXILED/Exiled.API/Enums/DoorType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
namespace Exiled.API.Enums
{
using Exiled.API.Features.Doors;

using static Interactables.Interobjects.ElevatorManager;
using Interactables.Interobjects;

/// <summary>
/// Unique identifier for the different types of doors.
Expand Down
3 changes: 1 addition & 2 deletions EXILED/Exiled.API/Features/Player.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ namespace Exiled.API.Features
using MEC;
using Mirror;
using Mirror.LiteNetLib4Mirror;
using NorthwoodLib;
using PlayerRoles;
using PlayerRoles.FirstPersonControl;
using PlayerRoles.RoleAssign;
Expand Down Expand Up @@ -1323,7 +1322,7 @@ public static Player Get(string args)
if (!player.IsVerified || player.Nickname is null)
continue;

if (!player.Nickname.Contains(args, StringComparison.OrdinalIgnoreCase))
if (!player.Nickname.ToLower().Contains(args.ToLower()))
continue;

string secondString = player.Nickname;
Expand Down
2 changes: 1 addition & 1 deletion EXILED/Exiled.CustomItems/API/Features/CustomItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ public virtual uint Spawn(IEnumerable<SpawnPoint> spawnPoints, uint limit)

if (pickup.Is(out Exiled.API.Features.Pickups.FirearmPickup firearmPickup) && this is CustomWeapon customWeapon)
{
firearmPickup
// set MaxAmmo if synced TODO
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ public class PlacingBulletHoleEventArgs : IFirearmEvent, IPlayerEvent, IDeniable
/// <param name="hit">
/// <inheritdoc cref="RaycastHit" />
/// </param>
public PlacingBulletHoleEventArgs(Firearm firearm, RaycastHit hit)
public PlacingBulletHoleEventArgs(Item firearm, RaycastHit hit)
{
Firearm = firearm;
Firearm = firearm.As<Firearm>();
Player = Firearm.Owner;
Position = hit.point;
Rotation = Quaternion.LookRotation(hit.normal);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@
// </copyright>
// -----------------------------------------------------------------------

using Respawning.Waves;

namespace Exiled.Events.EventArgs.Map
{
using Exiled.Events.EventArgs.Interfaces;
using Respawning;
using Respawning.Waves;

/// <summary>
/// Contains all information before the server spawns a team's respawn vehicle.
Expand Down
15 changes: 1 addition & 14 deletions EXILED/Exiled.Events/EventArgs/Player/EscapedEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,10 @@ public class EscapedEventArgs : IPlayerEvent
/// <param name="player"><inheritdoc cref="Player"/></param>
/// <param name="escapeScenario"><inheritdoc cref="EscapeScenario"/></param>
/// <param name="role"><inheritdoc cref="Role"/></param>
/// <param name="kvp"><inheritdoc cref="Tickets"/>, <inheritdoc cref="Team"/>.</param>
public EscapedEventArgs(Player player, EscapeScenario escapeScenario, Role role, KeyValuePair<SpawnableTeamType, float> kvp)
public EscapedEventArgs(Player player, EscapeScenario escapeScenario, Role role)
{
Player = player;
EscapeScenario = escapeScenario;
Team = kvp.Key;
Tickets = kvp.Value;
OldRole = role;
EscapeTime = (int)Math.Ceiling(role.ActiveTime.TotalSeconds);
}
Expand All @@ -47,16 +44,6 @@ public EscapedEventArgs(Player player, EscapeScenario escapeScenario, Role role,
/// </summary>
public EscapeScenario EscapeScenario { get; }

/// <summary>
/// Gets the <see cref="SpawnableTeamType"/> that gained tickets for this escape.
/// </summary>
public SpawnableTeamType Team { get; }

/// <summary>
/// Gets the amount of tickets gained for this escape.
/// </summary>
public float Tickets { get; }

/// <summary>
/// Gets the previous role for this player.
/// </summary>
Expand Down
8 changes: 4 additions & 4 deletions EXILED/Exiled.Events/EventArgs/Player/ShootingEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,12 @@ public class ShootingEventArgs : IPlayerEvent, IDeniableEvent, IFirearmEvent
/// <param name="firearm">
/// <inheritdoc cref="Firearm" />
/// </param>
/// <param name="msg">
/// <inheritdoc cref="ShotMessage" />
/// </param>
public ShootingEventArgs(Player shooter, BaseFirearm firearm)
{
Player = shooter;
Firearm = Item.Get(firearm).As<Firearm>();
ShotMessage = msg;

// ShotMessage = msg;
}

/// <summary>
Expand All @@ -58,6 +56,7 @@ public ShootingEventArgs(Player shooter, BaseFirearm firearm)
/// <inheritdoc/>
public Item Item => Firearm;

/*
/// <summary>
/// Gets or sets the <see cref="ShotMessage" /> for the event.
/// </summary>
Expand Down Expand Up @@ -104,6 +103,7 @@ public uint TargetNetId
};
}
}
*/

/// <summary>
/// Gets or sets a value indicating whether the shot can be fired.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@
// </copyright>
// -----------------------------------------------------------------------

using Respawning.Waves;

namespace Exiled.Events.EventArgs.Server
{
using System.Collections.Generic;

using Exiled.API.Features;
using Exiled.Events.EventArgs.Interfaces;

using PlayerRoles;

using Respawning;
using Respawning.Waves;

/// <summary>
/// Contains all information before spawning a wave of <see cref="SpawnableTeamType.NineTailedFox" /> or
Expand Down
6 changes: 3 additions & 3 deletions EXILED/Exiled.Events/Handlers/Server.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
// </copyright>
// -----------------------------------------------------------------------

using Respawning.Waves;

namespace Exiled.Events.Handlers
{
using System.Collections.Generic;

using Respawning;
using Respawning.Waves;

#pragma warning disable SA1623 // Property summary documentation should match accessors

using Exiled.Events.EventArgs.Player;
Expand Down Expand Up @@ -165,7 +165,7 @@ public static class Server
/// <summary>
/// Called after team spawns.
/// </summary>
/// <param name="teamType"><inheritdoc cref="RespawnedTeamEventArgs.Team"/></param>
/// <param name="teamType"><inheritdoc cref="RespawnedTeamEventArgs.Wave"/></param>
/// <param name="hubs"><inheritdoc cref="RespawnedTeamEventArgs.Players"/></param>
public static void OnRespawnedTeam(SpawnableWaveBase teamType, List<ReferenceHub> hubs) => RespawnedTeam.InvokeSafely(new RespawnedTeamEventArgs(teamType, hubs));

Expand Down
7 changes: 5 additions & 2 deletions EXILED/Exiled.Events/Patches/Events/Item/ChangingAmmo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ namespace Exiled.Events.Patches.Events.Item
using static HarmonyLib.AccessTools;

/// <summary>
/// Patches <see cref="Firearm.Status" />.
/// Patches <see cref="Firearm" />.
/// Adds the <see cref="Item.ChangingAmmo" /> event.
/// </summary>
[EventPatch(typeof(Item), nameof(Item.ChangingAmmo))]
[HarmonyPatch(typeof(Firearm), nameof(Firearm.Status), MethodType.Setter)]

// [HarmonyPatch(typeof(Firearm), nameof(Firearm.Status), MethodType.Setter)]
internal static class ChangingAmmo
{
/*
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
List<CodeInstruction> newInstructions = ListPool<CodeInstruction>.Pool.Get(instructions);
Expand Down Expand Up @@ -137,5 +139,6 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi

ListPool<CodeInstruction>.Pool.Return(newInstructions);
}
*/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
{
List<CodeInstruction> newInstructions = ListPool<CodeInstruction>.Pool.Get(instructions);

int index = newInstructions.FindLastIndex(instruction => instruction.opcode == OpCodes.Ldloc_1);
int offset = 1;
int index = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Ret) + offset;

LocalBuilder ev = generator.DeclareLocal(typeof(ReceivingPreferenceEventArgs));
LocalBuilder curCode = generator.DeclareLocal(typeof(uint));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Exiled.Events.Patches.Events.Map
using static HarmonyLib.AccessTools;

/// <summary>
/// Patches <see cref="ExplosionGrenade.Explode(Footprint, Vector3, ExplosionGrenade)"/>.
/// Patches <see cref="ExplosionGrenade.Explode"/>.
/// Adds the <see cref="Handlers.Map.ExplodingGrenade"/> event.
/// </summary>
[EventPatch(typeof(Handlers.Map), nameof(Handlers.Map.ExplodingGrenade))]
Expand Down
3 changes: 2 additions & 1 deletion EXILED/Exiled.Events/Patches/Events/Map/PlacingBulletHole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace Exiled.Events.Patches.Events.Map
using Exiled.Events.EventArgs.Map;
using Handlers;
using HarmonyLib;
using InventorySystem.Items;
using InventorySystem.Items.Firearms.Modules;
using UnityEngine;

Expand Down Expand Up @@ -47,7 +48,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
// this.Firearm
new(OpCodes.Ldarg_0),
new(OpCodes.Callvirt, PropertyGetter(typeof(ImpactEffectsModule), nameof(ImpactEffectsModule.Firearm))),
new(OpCodes.Call, Method(typeof(API.Features.Items.Item), nameof(API.Features.Items.Item.Get))),
new(OpCodes.Call, Method(typeof(API.Features.Items.Item), nameof(API.Features.Items.Item.Get), new[] { typeof(ItemBase) })),

// hit
new(OpCodes.Ldarg_2),
Expand Down
14 changes: 9 additions & 5 deletions EXILED/Exiled.Events/Patches/Events/Map/SpawningTeamVehicle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
// </copyright>
// -----------------------------------------------------------------------

using Respawning.Waves;

namespace Exiled.Events.Patches.Events.Map
{
using System.Collections.Generic;
Expand Down Expand Up @@ -38,12 +36,18 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
Label continueLabel = generator.DefineLabel();

LocalBuilder ev = generator.DeclareLocal(typeof(SpawningTeamVehicleEventArgs));
LocalBuilder msg = generator.DeclareLocal(typeof(WaveUpdateMessage));

int offset = 1;
int index = newInstructions.FindIndex(x => x.opcode == OpCodes.Newobj) + offset;

newInstructions.InsertRange(0, new CodeInstruction[]
newInstructions.InsertRange(index, new[]
{
new(OpCodes.Stloc_S, msg.LocalIndex),

// if (type != RespawnEffectsController.EffectType.Selection)
// goto continueLabel;
new(OpCodes.Ldarg_0),
new(OpCodes.Ldloc_S, msg.LocalIndex),
new(OpCodes.Callvirt, PropertyGetter(typeof(WaveUpdateMessage), nameof(WaveUpdateMessage.IsTrigger))),
new(OpCodes.Brfalse_S, continueLabel),

Expand Down Expand Up @@ -72,7 +76,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
new(OpCodes.Callvirt, PropertyGetter(typeof(SpawningTeamVehicleEventArgs), nameof(SpawningTeamVehicleEventArgs.Team))),
new(OpCodes.Starg_S, 1),

new CodeInstruction(OpCodes.Nop).WithLabels(continueLabel),
new CodeInstruction(OpCodes.Ldloc_S, msg.LocalIndex).WithLabels(continueLabel),
});

newInstructions[newInstructions.Count - 1].WithLabels(retLabel);
Expand Down
2 changes: 1 addition & 1 deletion EXILED/Exiled.Events/Patches/Events/Player/DamagingDoor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Exiled.Events.Patches.Events.Player
using static HarmonyLib.AccessTools;

/// <summary>
/// Patch the <see cref="BreakableDoor.ServerDamage(float, DoorDamageType)" />.
/// Patch the <see cref="BreakableDoor.ServerDamage" />.
/// Adds the <see cref="Player.DamagingDoor" /> event.
/// </summary>
[EventPatch(typeof(Player), nameof(Player.DamagingDoor))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi

Label ret = generator.DefineLabel();

int offset = -5;
int index = newInstructions.FindLastIndex(instruction => instruction.opcode == OpCodes.Newobj) + offset;
int index = newInstructions.FindLastIndex(instruction => instruction.opcode == OpCodes.Ldloc_0);

newInstructions.InsertRange(
index,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
{
List<CodeInstruction> newInstructions = ListPool<CodeInstruction>.Pool.Get(instructions);

List<Label> labels;
Label returnLabel = generator.DefineLabel();

LocalBuilder ev = generator.DeclareLocal(typeof(EscapingEventArgs));
Expand Down
2 changes: 1 addition & 1 deletion EXILED/Exiled.Events/Patches/Events/Player/Hurting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
// HurtEventArgs ev = new(player, handler, handleroutput)
new CodeInstruction(OpCodes.Ldloc, player.LocalIndex),
new(OpCodes.Ldarg_1),
new(OpCodes.Ldloc_1),
new(OpCodes.Ldloc_2),
new(OpCodes.Newobj, GetDeclaredConstructors(typeof(HurtEventArgs))[0]),
new(OpCodes.Dup),

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ namespace Exiled.Events.Patches.Events.Player
using static HarmonyLib.AccessTools;

/// <summary>
/// Patches <see cref="ElevatorManager.ServerReceiveMessage(NetworkConnection, ElevatorManager.ElevatorSyncMsg)" />.
/// Patches <see cref="ElevatorManager" />.
/// Adds the <see cref="Handlers.Player.InteractingElevator" /> event.
/// </summary>
[EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.InteractingElevator))]
Expand Down
2 changes: 1 addition & 1 deletion EXILED/Exiled.Events/Patches/Events/Player/Joined.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ internal static void CallEvent(ReferenceHub hub, out Player player)
#endif
Player.UnverifiedPlayers.Add(hub.gameObject, player);

if (ReferenceHub.HostHub == null)
if (ReferenceHub._hostHub == null)
{
Server.Host = player;
}
Expand Down
7 changes: 5 additions & 2 deletions EXILED/Exiled.Events/Patches/Events/Player/Shooting.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,15 @@ namespace Exiled.Events.Patches.Events.Player
using static HarmonyLib.AccessTools;

/// <summary>
/// Patches <see cref="FirearmBasicMessagesHandler.ServerShotReceived" />.
/// Patches <see cref="Player" />.
/// Adds the <see cref="Handlers.Player.Shooting" /> events.
/// </summary>
[EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Shooting))]
[HarmonyPatch(typeof(FirearmBasicMessagesHandler), nameof(FirearmBasicMessagesHandler.ServerShotReceived))]

// [HarmonyPatch(typeof(FirearmBasicMessagesHandler), nameof(FirearmBasicMessagesHandler.ServerShotReceived))]
internal static class Shooting
{
/*
private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
{
List<CodeInstruction> newInstructions = ListPool<CodeInstruction>.Pool.Get(instructions);
Expand Down Expand Up @@ -85,5 +87,6 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi

ListPool<CodeInstruction>.Pool.Return(newInstructions);
}
*/
}
}
2 changes: 0 additions & 2 deletions EXILED/Exiled.Events/Patches/Events/Player/Shot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
// </copyright>
// -----------------------------------------------------------------------

using System;

namespace Exiled.Events.Patches.Events.Player
{
#pragma warning disable SA1402 // File may only contain a single type
Expand Down
2 changes: 1 addition & 1 deletion EXILED/Exiled.Events/Patches/Events/Player/Spawning.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ namespace Exiled.Events.Patches.Events.Player
using static HarmonyLib.AccessTools;

/// <summary>
/// Patches <see cref="RoleSpawnpointManager.Init"/> delegate.
/// Patches <see cref="RoleSpawnpointManager"/> delegate.
/// Adds the <see cref="Handlers.Player.Spawning"/> event.
/// Fix for spawning in void.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
new(OpCodes.Brtrue_S, cnt),

// gameobject loads into stack before il inject
new(OpCodes.Pop),
new(OpCodes.Ldloc_1),
new(OpCodes.Callvirt, PropertyGetter(typeof(BasicRagdoll), nameof(BasicRagdoll.gameObject))),
new(OpCodes.Call, Method(typeof(Object), nameof(Object.Destroy), new[] { typeof(Object) })),
new(OpCodes.Ldnull),
new(OpCodes.Ret),
Expand Down
4 changes: 1 addition & 3 deletions EXILED/Exiled.Events/Patches/Events/Scp106/Stalking.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,8 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
new(OpCodes.Brfalse_S, returnLabel),
});

offset = 2;
index = newInstructions.FindIndex(instruction => instruction.operand == (object)PropertySetter(typeof(Scp106StalkAbility), nameof(Scp106StalkAbility.StalkActive))) + offset;
newInstructions.InsertRange(
index,
newInstructions.Count - 1,
new CodeInstruction[]
{
// Player.Get(this.Owner);
Expand Down
Loading