From 279600f9a17cdbaa01650a12c4b350d45bce8d3e Mon Sep 17 00:00:00 2001 From: jithatsonei Date: Fri, 26 Apr 2024 21:13:50 -0500 Subject: [PATCH] Revert "Add weapon drops to logs" --- .../Listeners/LogEntityListeners.cs | 58 +------------------ 1 file changed, 1 insertion(+), 57 deletions(-) diff --git a/mod/Jailbreak.Logs/Listeners/LogEntityListeners.cs b/mod/Jailbreak.Logs/Listeners/LogEntityListeners.cs index 236587b3..22f51286 100644 --- a/mod/Jailbreak.Logs/Listeners/LogEntityListeners.cs +++ b/mod/Jailbreak.Logs/Listeners/LogEntityListeners.cs @@ -1,8 +1,7 @@ using CounterStrikeSharp.API; using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core.Attributes.Registration; -using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions; -using CounterStrikeSharp.API.Modules.Utils; + using Jailbreak.Formatting.Views; using Jailbreak.Public.Behaviors; using Jailbreak.Public.Extensions; @@ -16,61 +15,6 @@ public class LogEntityListeners : IPluginBehavior public LogEntityListeners(IRichLogService logs) { _logs = logs; - OnDropGun(); - } - - private static MemoryFunctionVoid WeaponDrop = new( @"\x55\x48\x89\xE5\x41\x56\x41\x55\x49\x89\xD5\x41\x54\x49\x89\xFC\x53\x48\x89\xF3\xE8\x2A\x2A\x2A\x2A" ); - - private void OnDropGun() - { - WeaponDrop.Hook(hook => - { - var pawn = hook.GetParam(0); - var weapon = hook.GetParam(1); - - if (!pawn.IsValid) return HookResult.Continue; - if (pawn.Controller.Value == null || !pawn.Controller.IsValid) return HookResult.Continue; - - var player = (CCSPlayerController)pawn.Controller.Value; - - if (player.Team != CsTeam.CounterTerrorist) return HookResult.Changed; - - _logs.Append(_logs.Player(player), $"dropped weapon: {weapon.DesignerName}"); - return HookResult.Continue; - }, HookMode.Pre); - } - - [GameEventHandler] - public void OnItemPickup(EventItemPickup @event, GameEventInfo info) - { - var player = @event.Userid; - if (!player.IsReal()) - return; - - if (!player.IsValid) - return; - - if (player.Team != CsTeam.Terrorist) return; - - - Server.NextFrame(() => - { - var pawn = player.PlayerPawn.Value; - if (pawn == null || !pawn.IsValid) return; - var weaponServices = pawn.WeaponServices; - if (weaponServices == null) return; - - foreach (var weaponHandle in weaponServices.MyWeapons.Where(handle => handle.IsValid && handle.Value != null).ToList()) - { - if (!weaponHandle.Value.DesignerName.Equals(@event.Item)) continue; - - var owner = weaponHandle.Value.OwnerEntity.Value.As(); - if (owner.Team != CsTeam.CounterTerrorist) return; - _logs.Append(_logs.Player(player), $"picked up an {_logs.Player(owner)}s item: {weaponHandle.Value.DesignerName}"); - - } - }); - } [EntityOutputHook("func_button", "OnPressed")]