From 24cd1295b633fa81ec7900574c35fe3777d0324b Mon Sep 17 00:00:00 2001 From: MSWS Date: Mon, 10 Nov 2025 03:53:14 -0800 Subject: [PATCH] refactor: Cleanup and reformat --- Locale/Locale.csproj | 2 +- TTT/CS2/API/Items/ITripwireTracker.cs | 2 -- TTT/CS2/CS2.csproj | 2 +- TTT/CS2/Command/Test/GiveItemCommand.cs | 2 -- TTT/CS2/Command/Test/SetRoleCommand.cs | 3 +-- TTT/CS2/Command/Test/SpecialRoundCommand.cs | 2 +- TTT/CS2/Configs/CS2GameConfig.cs | 6 ++--- TTT/CS2/Configs/CS2KarmaConfig.cs | 4 +-- TTT/CS2/Extensions/VectorExtensions.cs | 2 +- .../MapChangeCausesEndListener.cs | 3 +-- .../Items/PoisonShots/PoisonShotsListener.cs | 1 - TTT/CS2/Items/Station/HealthStation.cs | 22 +++++++-------- .../Items/Tripwire/TripwireDamageListener.cs | 10 +++---- .../Items/Tripwire/TripwireDefuserListener.cs | 10 +++---- TTT/CS2/Items/Tripwire/TripwireItem.cs | 27 +++++++++---------- .../Tripwire/TripwireMovementListener.cs | 26 +++++++++--------- TTT/CS2/Items/Tripwire/TripwireMsgs.cs | 6 ++--- TTT/CS2/Player/CS2Player.cs | 10 +++---- TTT/CS2/Player/CS2PlayerFinder.cs | 1 - TTT/Game/TTTConfig.cs | 6 ++--- TTT/Shop/Items/Traitor/C4/C4ShopItem.cs | 3 +-- TTT/Shop/PeriodicRewarder.cs | 6 ++--- TTT/Shop/lang/ShopMsgs.cs | 5 ++-- TTT/ShopAPI/Configs/Traitor/TripwireConfig.cs | 2 +- TTT/ShopAPI/PurchaseResult.cs | 2 +- .../Events/SpecialRoundEnableEvent.cs | 4 +-- TTT/SpecialRound/Rounds/LowGravRound.cs | 3 +-- TTT/SpecialRound/Rounds/RichRound.cs | 2 -- TTT/SpecialRound/SpecialRound.csproj | 2 +- TTT/SpecialRound/SpecialRoundsConfig.cs | 6 ++--- TTT/Stats/SpecialRoundListener.cs | 6 ++--- TTT/Stats/Stats.csproj | 2 +- 32 files changed, 89 insertions(+), 101 deletions(-) diff --git a/Locale/Locale.csproj b/Locale/Locale.csproj index 5f54054..86f3fad 100644 --- a/Locale/Locale.csproj +++ b/Locale/Locale.csproj @@ -9,7 +9,7 @@ - + diff --git a/TTT/CS2/API/Items/ITripwireTracker.cs b/TTT/CS2/API/Items/ITripwireTracker.cs index 50bbdde..10aa873 100644 --- a/TTT/CS2/API/Items/ITripwireTracker.cs +++ b/TTT/CS2/API/Items/ITripwireTracker.cs @@ -1,5 +1,3 @@ -using TTT.CS2.Items.Tripwire; - namespace TTT.CS2.API.Items; public interface ITripwireTracker { diff --git a/TTT/CS2/CS2.csproj b/TTT/CS2/CS2.csproj index 0868ae5..d4fe61f 100644 --- a/TTT/CS2/CS2.csproj +++ b/TTT/CS2/CS2.csproj @@ -13,7 +13,7 @@ - + diff --git a/TTT/CS2/Command/Test/GiveItemCommand.cs b/TTT/CS2/Command/Test/GiveItemCommand.cs index d7eb952..12a38da 100644 --- a/TTT/CS2/Command/Test/GiveItemCommand.cs +++ b/TTT/CS2/Command/Test/GiveItemCommand.cs @@ -1,9 +1,7 @@ using CounterStrikeSharp.API; using Microsoft.Extensions.DependencyInjection; using ShopAPI; -using ShopAPI.Events; using TTT.API.Command; -using TTT.API.Events; using TTT.API.Player; namespace TTT.CS2.Command.Test; diff --git a/TTT/CS2/Command/Test/SetRoleCommand.cs b/TTT/CS2/Command/Test/SetRoleCommand.cs index a28008e..33ad9f5 100644 --- a/TTT/CS2/Command/Test/SetRoleCommand.cs +++ b/TTT/CS2/Command/Test/SetRoleCommand.cs @@ -44,9 +44,8 @@ public class SetRoleCommand(IServiceProvider provider) : ICommand { break; } - if (info.ArgCount == 3) { + if (info.ArgCount == 3) targets = finder.GetMulti(info.Args[2], out targetName, executor); - } Server.NextWorldUpdate(() => { foreach (var player in targets) { diff --git a/TTT/CS2/Command/Test/SpecialRoundCommand.cs b/TTT/CS2/Command/Test/SpecialRoundCommand.cs index 1b5634e..bad19a5 100644 --- a/TTT/CS2/Command/Test/SpecialRoundCommand.cs +++ b/TTT/CS2/Command/Test/SpecialRoundCommand.cs @@ -24,7 +24,7 @@ public class SpecialRoundCommand(IServiceProvider provider) : ICommand { } if (info.ArgCount == 1) { - tracker.TryStartSpecialRound(null); + tracker.TryStartSpecialRound(); info.ReplySync("Started a random special round."); return Task.FromResult(CommandResult.SUCCESS); } diff --git a/TTT/CS2/Configs/CS2GameConfig.cs b/TTT/CS2/Configs/CS2GameConfig.cs index 5c16d0b..a7cf20e 100644 --- a/TTT/CS2/Configs/CS2GameConfig.cs +++ b/TTT/CS2/Configs/CS2GameConfig.cs @@ -48,17 +48,17 @@ public class CS2GameConfig : IStorage, IPluginModule { public static readonly FakeConVar CV_TRAITOR_ARMOR = new( "css_ttt_rolearmor_traitor", - "Amount of armor to give to traitors at start of round", 100, + "Amount of armor to give to traitors at start of round", 0, ConVarFlags.FCVAR_NONE, new RangeValidator(0, 1000)); public static readonly FakeConVar CV_DETECTIVE_ARMOR = new( "css_ttt_rolearmor_detective", - "Amount of armor to give to detectives at start of round", 100, + "Amount of armor to give to detectives at start of round", 0, ConVarFlags.FCVAR_NONE, new RangeValidator(0, 1000)); public static readonly FakeConVar CV_INNOCENT_ARMOR = new( "css_ttt_rolearmor_innocent", - "Amount of armor to give to innocents at start of round", 100, + "Amount of armor to give to innocents at start of round", 0, ConVarFlags.FCVAR_NONE, new RangeValidator(0, 1000)); public static readonly FakeConVar CV_TRAITOR_WEAPONS = new( diff --git a/TTT/CS2/Configs/CS2KarmaConfig.cs b/TTT/CS2/Configs/CS2KarmaConfig.cs index 00389f2..ac4dd1b 100644 --- a/TTT/CS2/Configs/CS2KarmaConfig.cs +++ b/TTT/CS2/Configs/CS2KarmaConfig.cs @@ -64,8 +64,8 @@ public class CS2KarmaConfig : IStorage, IPluginModule { public static readonly FakeConVar CV_TRAITOR_ON_TRAITOR = new( "css_ttt_karma_traitor_on_traitor", - "Karma lost when Traitor kills another Traitor", -12, ConVarFlags.FCVAR_NONE, - new RangeValidator(-50, 50)); + "Karma lost when Traitor kills another Traitor", -12, + ConVarFlags.FCVAR_NONE, new RangeValidator(-50, 50)); public static readonly FakeConVar CV_INNO_ON_DETECTIVE = new( "css_ttt_karma_inno_on_detective", diff --git a/TTT/CS2/Extensions/VectorExtensions.cs b/TTT/CS2/Extensions/VectorExtensions.cs index 89de0f3..b77e058 100644 --- a/TTT/CS2/Extensions/VectorExtensions.cs +++ b/TTT/CS2/Extensions/VectorExtensions.cs @@ -97,7 +97,7 @@ public static class VectorExtensions { public static Vector toVector(this Vector3 vec) { return new Vector(vec.X, vec.Y, vec.Z); } - + public static QAngle toAngle(this Vector vec) { var pitch = (float)(Math.Atan2(-vec.Z, Math.Sqrt(vec.X * vec.X + vec.Y * vec.Y)) * (180.0 / Math.PI)); diff --git a/TTT/CS2/GameHandlers/MapChangeCausesEndListener.cs b/TTT/CS2/GameHandlers/MapChangeCausesEndListener.cs index 2cf10e9..feb7dee 100644 --- a/TTT/CS2/GameHandlers/MapChangeCausesEndListener.cs +++ b/TTT/CS2/GameHandlers/MapChangeCausesEndListener.cs @@ -1,5 +1,4 @@ -using CounterStrikeSharp.API; -using CounterStrikeSharp.API.Core; +using CounterStrikeSharp.API.Core; using Microsoft.Extensions.DependencyInjection; using TTT.API; using TTT.API.Game; diff --git a/TTT/CS2/Items/PoisonShots/PoisonShotsListener.cs b/TTT/CS2/Items/PoisonShots/PoisonShotsListener.cs index 91755b6..1e0bfe6 100644 --- a/TTT/CS2/Items/PoisonShots/PoisonShotsListener.cs +++ b/TTT/CS2/Items/PoisonShots/PoisonShotsListener.cs @@ -16,7 +16,6 @@ using TTT.API.Game; using TTT.API.Player; using TTT.API.Storage; using TTT.CS2.Extensions; -using TTT.CS2.Items.SilentAWP; using TTT.CS2.RayTrace.Class; using TTT.Game.Events.Body; using TTT.Game.Events.Game; diff --git a/TTT/CS2/Items/Station/HealthStation.cs b/TTT/CS2/Items/Station/HealthStation.cs index ad9e335..8e872e2 100644 --- a/TTT/CS2/Items/Station/HealthStation.cs +++ b/TTT/CS2/Items/Station/HealthStation.cs @@ -42,8 +42,8 @@ public class HealthStation(IServiceProvider provider) } /// - /// Scan all props and build a map: Player -> list of (StationInfo, potentialHeal). - /// Also fills toRemove for invalid/expired props. + /// Scan all props and build a map: Player -> list of (StationInfo, potentialHeal). + /// Also fills toRemove for invalid/expired props. /// private Dictionary> @@ -90,8 +90,8 @@ public class HealthStation(IServiceProvider provider) } /// - /// Compute potential heal from a station given the distance. - /// Mirrors your original logic: ceil(HealthIncrements * healthScale). + /// Compute potential heal from a station given the distance. + /// Mirrors your original logic: ceil(HealthIncrements * healthScale). /// private int ComputePotentialHeal(double dist) { var healthScale = 1.0 - dist / _Config.MaxRange; @@ -99,9 +99,9 @@ public class HealthStation(IServiceProvider provider) } /// - /// Apply heals to each player once per tick. - /// Distributes the actual heal proportionally across contributing stations, - /// updates station.Info.HealthGiven and emits a single pickup sound if needed. + /// Apply heals to each player once per tick. + /// Distributes the actual heal proportionally across contributing stations, + /// updates station.Info.HealthGiven and emits a single pickup sound if needed. /// private void applyAccumulatedHeals( Dictionary> @@ -125,7 +125,7 @@ public class HealthStation(IServiceProvider provider) allocateProportionalInteger(totalHealAvailable, potentials); // safety clamp: never allocate more than a station's potential - for (int i = 0; i < allocations.Count; i++) + for (var i = 0; i < allocations.Count; i++) if (allocations[i] > potentials[i]) allocations[i] = potentials[i]; @@ -164,9 +164,9 @@ public class HealthStation(IServiceProvider provider) } /// - /// Proportionally distribute an integer total across integer potentials. - /// Uses floor of shares and assigns leftover to largest fractional remainders. - /// Returns a list of allocations with same length as potentials. + /// Proportionally distribute an integer total across integer potentials. + /// Uses floor of shares and assigns leftover to largest fractional remainders. + /// Returns a list of allocations with same length as potentials. /// private List allocateProportionalInteger(int total, List potentials) { diff --git a/TTT/CS2/Items/Tripwire/TripwireDamageListener.cs b/TTT/CS2/Items/Tripwire/TripwireDamageListener.cs index de88edb..620d148 100644 --- a/TTT/CS2/Items/Tripwire/TripwireDamageListener.cs +++ b/TTT/CS2/Items/Tripwire/TripwireDamageListener.cs @@ -12,21 +12,21 @@ using TTT.CS2.Extensions; namespace TTT.CS2.Items.Tripwire; public class TripwireDamageListener(IServiceProvider provider) : IPluginModule { - public void Dispose() { } - public void Start() { } + private readonly ITripwireActivator? tripwireActivator = + provider.GetRequiredService(); private readonly ITripwireTracker? tripwires = provider.GetService(); - private readonly ITripwireActivator? tripwireActivator = - provider.GetRequiredService(); - private TripwireConfig config => provider.GetService>() ?.Load() .GetAwaiter() .GetResult() ?? new TripwireConfig(); + public void Dispose() { } + public void Start() { } + [UsedImplicitly] [GameEventHandler] public HookResult OnBulletImpact(EventBulletImpact ev, GameEventInfo info) { diff --git a/TTT/CS2/Items/Tripwire/TripwireDefuserListener.cs b/TTT/CS2/Items/Tripwire/TripwireDefuserListener.cs index d1059fa..110efdd 100644 --- a/TTT/CS2/Items/Tripwire/TripwireDefuserListener.cs +++ b/TTT/CS2/Items/Tripwire/TripwireDefuserListener.cs @@ -17,17 +17,17 @@ namespace TTT.CS2.Items.Tripwire; public class TripwireDefuserListener(IServiceProvider provider) : IPluginModule { - private readonly ITripwireTracker? tripwireTracker = - provider.GetService(); - private readonly IPlayerConverter converter = provider.GetRequiredService>(); + private readonly IMsgLocalizer locale = + provider.GetRequiredService(); + private readonly IMessenger messenger = provider.GetRequiredService(); - private readonly IMsgLocalizer locale = - provider.GetRequiredService(); + private readonly ITripwireTracker? tripwireTracker = + provider.GetService(); private TripwireConfig config => provider.GetService>() diff --git a/TTT/CS2/Items/Tripwire/TripwireItem.cs b/TTT/CS2/Items/Tripwire/TripwireItem.cs index 6997b4e..5f59e9c 100644 --- a/TTT/CS2/Items/Tripwire/TripwireItem.cs +++ b/TTT/CS2/Items/Tripwire/TripwireItem.cs @@ -1,5 +1,4 @@ using System.Diagnostics.CodeAnalysis; -using System.Drawing; using System.Reactive.Concurrency; using CounterStrikeSharp.API; using CounterStrikeSharp.API.Core; @@ -36,25 +35,17 @@ public static class TripwireServiceCollection { public class TripwireItem(IServiceProvider provider) : RoleRestrictedItem(provider), IPluginModule, ITripwireTracker { - private TripwireConfig config - => Provider.GetService>() - ?.Load() - .GetAwaiter() - .GetResult() ?? new TripwireConfig(); - private readonly IPlayerConverter converter = provider.GetRequiredService>(); private readonly IScheduler scheduler = provider.GetRequiredService(); - public List ActiveTripwires { get; } = []; - - public void RemoveTripwire(TripwireInstance instance) { - instance.Beam.Remove(); - instance.TripwireProp.Remove(); - ActiveTripwires.Remove(instance); - } + private TripwireConfig config + => Provider.GetService>() + ?.Load() + .GetAwaiter() + .GetResult() ?? new TripwireConfig(); public override string Name => Locale[TripwireMsgs.SHOP_ITEM_TRIPWIRE]; @@ -71,6 +62,14 @@ public class TripwireItem(IServiceProvider provider) onPrecache); } + public List ActiveTripwires { get; } = []; + + public void RemoveTripwire(TripwireInstance instance) { + instance.Beam.Remove(); + instance.TripwireProp.Remove(); + ActiveTripwires.Remove(instance); + } + private void onPrecache(ResourceManifest manifest) { manifest.AddResource( "models/generic/conveyor_control_panel_01/conveyor_button_02.vmdl"); diff --git a/TTT/CS2/Items/Tripwire/TripwireMovementListener.cs b/TTT/CS2/Items/Tripwire/TripwireMovementListener.cs index 85dede0..995aede 100644 --- a/TTT/CS2/Items/Tripwire/TripwireMovementListener.cs +++ b/TTT/CS2/Items/Tripwire/TripwireMovementListener.cs @@ -27,12 +27,12 @@ public class TripwireMovementListener(IServiceProvider provider) private readonly IPlayerConverter converter = provider.GetRequiredService>(); - private readonly ITripwireTracker? tripwireTracker = - provider.GetService(); - private readonly Dictionary killedWithTripwire = new(); + private readonly ITripwireTracker? tripwireTracker = + provider.GetService(); + private TripwireConfig config => Provider.GetService>() ?.Load() @@ -44,6 +44,16 @@ public class TripwireMovementListener(IServiceProvider provider) plugin?.AddTimer(0.2f, checkTripwires, TimerFlags.REPEAT); } + public void ActivateTripwire(TripwireInstance instance) { + tripwireTracker?.RemoveTripwire(instance); + instance.TripwireProp.EmitSound("Flashbang.ExplodeDistant"); + + foreach (var player in Finder.GetOnline()) { + if (!dealTripwireDamage(instance, player, out var gamePlayer)) continue; + gamePlayer.EmitSound("Player.BurnDamage"); + } + } + private void checkTripwires() { if (tripwireTracker == null) return; foreach (var wire in new List(tripwireTracker @@ -96,16 +106,6 @@ public class TripwireMovementListener(IServiceProvider provider) ev.Body.Killer = info.owner; } - public void ActivateTripwire(TripwireInstance instance) { - tripwireTracker?.RemoveTripwire(instance); - instance.TripwireProp.EmitSound("Flashbang.ExplodeDistant"); - - foreach (var player in Finder.GetOnline()) { - if (!dealTripwireDamage(instance, player, out var gamePlayer)) continue; - gamePlayer.EmitSound("Player.BurnDamage"); - } - } - private bool dealTripwireDamage(TripwireInstance instance, IOnlinePlayer player, [NotNullWhen(true)] out CCSPlayerController? gamePlayer) { diff --git a/TTT/CS2/Items/Tripwire/TripwireMsgs.cs b/TTT/CS2/Items/Tripwire/TripwireMsgs.cs index eaeafcc..0839568 100644 --- a/TTT/CS2/Items/Tripwire/TripwireMsgs.cs +++ b/TTT/CS2/Items/Tripwire/TripwireMsgs.cs @@ -12,12 +12,12 @@ public class TripwireMsgs { public static IMsg SHOP_ITEM_TRIPWIRE_TOOFAR => MsgFactory.Create(nameof(SHOP_ITEM_TRIPWIRE_TOOFAR)); + public static IMsg SHOP_ITEM_TRIPWIRE_DEFUSING_CANCELED + => MsgFactory.Create(nameof(SHOP_ITEM_TRIPWIRE_DEFUSING_CANCELED)); + public static IMsg SHOP_ITEM_TRIPWIRE_DEFUSING(double progress, TimeSpan time) { return MsgFactory.Create(nameof(SHOP_ITEM_TRIPWIRE_DEFUSING), progress.ToString("P0"), time.TotalSeconds.ToString("F1")); } - - public static IMsg SHOP_ITEM_TRIPWIRE_DEFUSING_CANCELED - => MsgFactory.Create(nameof(SHOP_ITEM_TRIPWIRE_DEFUSING_CANCELED)); } \ No newline at end of file diff --git a/TTT/CS2/Player/CS2Player.cs b/TTT/CS2/Player/CS2Player.cs index e825b20..e26ab77 100644 --- a/TTT/CS2/Player/CS2Player.cs +++ b/TTT/CS2/Player/CS2Player.cs @@ -2,6 +2,7 @@ using CounterStrikeSharp.API; using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Modules.Utils; using TTT.API.Player; +using TTT.CS2.Extensions; namespace TTT.CS2.Player; @@ -87,18 +88,17 @@ public class CS2Player : IOnlinePlayer, IEquatable { } public int Armor { - get => Player?.PawnArmor ?? 0; + get => Player != null && Player.IsValid ? Player.GetArmor().Item1 : 0; set { - if (Player == null) return; - Player.PawnArmor = value; - Utilities.SetStateChanged(Player, "CCSPlayerController", "m_iPawnArmor"); + if (Player == null || !Player.IsValid) return; + Player.SetArmor(value); } } public bool IsAlive { get - => Player != null && Player is { + => Player != null && Player.IsValid && Player is { Team : CsTeam.CounterTerrorist or CsTeam.Terrorist, Pawn.Value.Health: > 0 }; diff --git a/TTT/CS2/Player/CS2PlayerFinder.cs b/TTT/CS2/Player/CS2PlayerFinder.cs index a398da4..dbd09ca 100644 --- a/TTT/CS2/Player/CS2PlayerFinder.cs +++ b/TTT/CS2/Player/CS2PlayerFinder.cs @@ -1,6 +1,5 @@ using CounterStrikeSharp.API; using CounterStrikeSharp.API.Core; -using CounterStrikeSharp.API.Modules.Commands.Targeting; using TTT.API.Player; namespace TTT.CS2.Player; diff --git a/TTT/Game/TTTConfig.cs b/TTT/Game/TTTConfig.cs index 23ff3e4..8991fd3 100644 --- a/TTT/Game/TTTConfig.cs +++ b/TTT/Game/TTTConfig.cs @@ -21,9 +21,9 @@ public record TTTConfig { public int TraitorHealth { get; init; } = 100; public int DetectiveHealth { get; init; } = 100; public int InnocentHealth { get; init; } = 100; - public int TraitorArmor { get; init; } = 100; - public int DetectiveArmor { get; init; } = 100; - public int InnocentArmor { get; init; } = 100; + public int TraitorArmor { get; init; } + public int DetectiveArmor { get; init; } + public int InnocentArmor { get; init; } public string[]? TraitorWeapons { get; init; } = ["knife", "pistol"]; diff --git a/TTT/Shop/Items/Traitor/C4/C4ShopItem.cs b/TTT/Shop/Items/Traitor/C4/C4ShopItem.cs index 916b8a9..45fa1df 100644 --- a/TTT/Shop/Items/Traitor/C4/C4ShopItem.cs +++ b/TTT/Shop/Items/Traitor/C4/C4ShopItem.cs @@ -47,11 +47,10 @@ public class C4ShopItem(IServiceProvider provider) if (c4sBought > config.MaxC4PerRound) return PurchaseResult.ITEM_NOT_PURCHASABLE; - if (config.MaxC4AtOnce > 0) { + if (config.MaxC4AtOnce > 0) if (finder.GetOnline().Count(p => Shop.HasItem(p)) > config.MaxC4AtOnce) return PurchaseResult.ITEM_NOT_PURCHASABLE; - } return base.CanPurchase(player); } diff --git a/TTT/Shop/PeriodicRewarder.cs b/TTT/Shop/PeriodicRewarder.cs index 9a368db..564ddf2 100644 --- a/TTT/Shop/PeriodicRewarder.cs +++ b/TTT/Shop/PeriodicRewarder.cs @@ -24,6 +24,9 @@ public class PeriodicRewarder(IServiceProvider provider) : ITerrorModule { private readonly IGameManager games = provider.GetRequiredService(); + private readonly IMsgLocalizer localizer = + provider.GetRequiredService(); + private readonly Dictionary> playerPositions = new(); private readonly IScheduler scheduler = @@ -31,9 +34,6 @@ public class PeriodicRewarder(IServiceProvider provider) : ITerrorModule { private readonly IShop shop = provider.GetRequiredService(); - private readonly IMsgLocalizer localizer = - provider.GetRequiredService(); - private IDisposable? rewardTimer, updateTimer; private ShopConfig config diff --git a/TTT/Shop/lang/ShopMsgs.cs b/TTT/Shop/lang/ShopMsgs.cs index df2f4dd..f75036c 100644 --- a/TTT/Shop/lang/ShopMsgs.cs +++ b/TTT/Shop/lang/ShopMsgs.cs @@ -11,8 +11,9 @@ public static class ShopMsgs { public static IMsg SHOP_INACTIVE => MsgFactory.Create(nameof(SHOP_INACTIVE)); public static IMsg CREDITS_NAME => MsgFactory.Create(nameof(CREDITS_NAME)); - - public static IMsg SHOP_EXPLORATION => MsgFactory.Create(nameof(SHOP_EXPLORATION)); + + public static IMsg SHOP_EXPLORATION + => MsgFactory.Create(nameof(SHOP_EXPLORATION)); public static IMsg SHOP_CANNOT_PURCHASE => MsgFactory.Create(nameof(SHOP_CANNOT_PURCHASE)); diff --git a/TTT/ShopAPI/Configs/Traitor/TripwireConfig.cs b/TTT/ShopAPI/Configs/Traitor/TripwireConfig.cs index b9af936..9c85097 100644 --- a/TTT/ShopAPI/Configs/Traitor/TripwireConfig.cs +++ b/TTT/ShopAPI/Configs/Traitor/TripwireConfig.cs @@ -19,6 +19,6 @@ public record TripwireConfig : ShopItemConfig { public TimeSpan DefuseTime { get; init; } = TimeSpan.FromSeconds(5); public TimeSpan DefuseRate { get; init; } = TimeSpan.FromMilliseconds(500); - + public int DefuseReward { get; init; } = 20; } \ No newline at end of file diff --git a/TTT/ShopAPI/PurchaseResult.cs b/TTT/ShopAPI/PurchaseResult.cs index 9230e74..4d0a987 100644 --- a/TTT/ShopAPI/PurchaseResult.cs +++ b/TTT/ShopAPI/PurchaseResult.cs @@ -40,7 +40,7 @@ public enum PurchaseResult { /// /// The item cannot be purchased multiple times, and the player already owns it. /// - ALREADY_OWNED, + ALREADY_OWNED } public static class PurchaseResultExtensions { diff --git a/TTT/SpecialRound/Events/SpecialRoundEnableEvent.cs b/TTT/SpecialRound/Events/SpecialRoundEnableEvent.cs index 4c2105c..f81f2c9 100644 --- a/TTT/SpecialRound/Events/SpecialRoundEnableEvent.cs +++ b/TTT/SpecialRound/Events/SpecialRoundEnableEvent.cs @@ -3,8 +3,8 @@ namespace SpecialRound.Events; /// -/// Called when a special round is enabled. -/// Note that multiple special rounds may be enabled per round. +/// Called when a special round is enabled. +/// Note that multiple special rounds may be enabled per round. /// /// public class SpecialRoundEnableEvent(AbstractSpecialRound round) diff --git a/TTT/SpecialRound/Rounds/LowGravRound.cs b/TTT/SpecialRound/Rounds/LowGravRound.cs index bdbc2ae..f8bb864 100644 --- a/TTT/SpecialRound/Rounds/LowGravRound.cs +++ b/TTT/SpecialRound/Rounds/LowGravRound.cs @@ -13,6 +13,7 @@ namespace SpecialRound.Rounds; public class LowGravRound(IServiceProvider provider) : AbstractSpecialRound(provider) { + private int originalGravity = 800; public override string Name => "Low Grav"; public override IMsg Description => RoundMsgs.SPECIAL_ROUND_LOWGRAV; public override SpecialRoundConfig Config => config; @@ -23,8 +24,6 @@ public class LowGravRound(IServiceProvider provider) .GetAwaiter() .GetResult() ?? new LowGravRoundConfig(); - private int originalGravity = 800; - public override void ApplyRoundEffects() { var cvar = ConVar.Find("sv_gravity"); if (cvar == null) return; diff --git a/TTT/SpecialRound/Rounds/RichRound.cs b/TTT/SpecialRound/Rounds/RichRound.cs index 808406a..07fb5ae 100644 --- a/TTT/SpecialRound/Rounds/RichRound.cs +++ b/TTT/SpecialRound/Rounds/RichRound.cs @@ -1,7 +1,5 @@ -using CounterStrikeSharp.API.Modules.Utils; using JetBrains.Annotations; using Microsoft.Extensions.DependencyInjection; -using ShopAPI; using ShopAPI.Events; using SpecialRound.lang; using SpecialRoundAPI; diff --git a/TTT/SpecialRound/SpecialRound.csproj b/TTT/SpecialRound/SpecialRound.csproj index c35cc63..aecb476 100644 --- a/TTT/SpecialRound/SpecialRound.csproj +++ b/TTT/SpecialRound/SpecialRound.csproj @@ -10,7 +10,7 @@ - + diff --git a/TTT/SpecialRound/SpecialRoundsConfig.cs b/TTT/SpecialRound/SpecialRoundsConfig.cs index b317804..ba1e7b9 100644 --- a/TTT/SpecialRound/SpecialRoundsConfig.cs +++ b/TTT/SpecialRound/SpecialRoundsConfig.cs @@ -7,9 +7,9 @@ public record SpecialRoundsConfig { public float SpecialRoundChance { get; init; } = 0.2f; /// - /// If a special round is started, the chance that another special round - /// will start in conjunction with it. This check is run until it fails, - /// or we run out of special rounds to start. + /// If a special round is started, the chance that another special round + /// will start in conjunction with it. This check is run until it fails, + /// or we run out of special rounds to start. /// public float MultiRoundChance { get; init; } = 0.33f; } \ No newline at end of file diff --git a/TTT/Stats/SpecialRoundListener.cs b/TTT/Stats/SpecialRoundListener.cs index 8b72c5c..3516f68 100644 --- a/TTT/Stats/SpecialRoundListener.cs +++ b/TTT/Stats/SpecialRoundListener.cs @@ -13,12 +13,12 @@ namespace Stats; public class SpecialRoundListener(IServiceProvider provider) : BaseListener(provider) { - private readonly IRoundTracker tracker = - provider.GetRequiredService(); - private readonly HttpClient client = provider.GetRequiredService(); + private readonly IRoundTracker tracker = + provider.GetRequiredService(); + private AbstractSpecialRound? round; [UsedImplicitly] diff --git a/TTT/Stats/Stats.csproj b/TTT/Stats/Stats.csproj index 6207e03..354b114 100644 --- a/TTT/Stats/Stats.csproj +++ b/TTT/Stats/Stats.csproj @@ -9,7 +9,7 @@ - +