From 801b024e65cb726348596746d873e578b91cb727 Mon Sep 17 00:00:00 2001 From: Velken <8467292+Velken@users.noreply.github.com> Date: Thu, 29 Jan 2026 15:40:06 -0300 Subject: [PATCH] [Admin] Made admin log be high if the buyer is not from expected faction for a store. (#42687) * more admin qol prs * mistakes were made at 3am * mindshield check and cleanup * address reviews * typo --- .../Store/Systems/StoreSystem.Ui.cs | 21 +++++++++++++++++-- .../Store/Components/StoreComponent.cs | 8 +++++++ .../Entities/Objects/Magic/books.yml | 1 + .../Entities/Objects/Specific/syndicate.yml | 1 + Resources/Prototypes/Store/presets.yml | 4 ++++ 5 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Content.Server/Store/Systems/StoreSystem.Ui.cs b/Content.Server/Store/Systems/StoreSystem.Ui.cs index cd9059b1db2..6b67ff5d60e 100644 --- a/Content.Server/Store/Systems/StoreSystem.Ui.cs +++ b/Content.Server/Store/Systems/StoreSystem.Ui.cs @@ -8,6 +8,8 @@ using Content.Shared.Database; using Content.Shared.FixedPoint; using Content.Shared.Hands.EntitySystems; using Content.Shared.Mind; +using Content.Shared.Mindshield.Components; +using Content.Shared.NPC.Systems; using Content.Shared.PDA.Ringer; using Content.Shared.Store; using Content.Shared.Store.Components; @@ -30,6 +32,7 @@ public sealed partial class StoreSystem [Dependency] private readonly SharedAudioSystem _audio = default!; [Dependency] private readonly StackSystem _stack = default!; [Dependency] private readonly UserInterfaceSystem _ui = default!; + [Dependency] private readonly NpcFactionSystem _npcFaction = default!; private void InitializeUi() { @@ -262,9 +265,23 @@ public sealed partial class StoreSystem } //log dat shit. + var logImpact = LogImpact.Low; + var logExtraInfo = ""; + if (component.ExpectedFaction?.Count > 0 && !_npcFaction.IsMemberOfAny(buyer, component.ExpectedFaction)) + { + logImpact = LogImpact.High; + logExtraInfo = ", but was not from an expected faction"; + + if (HasComp(buyer)) + { + logImpact = LogImpact.Extreme; + logExtraInfo += " while also possessing a mindshield"; + } + } + _admin.Add(LogType.StorePurchase, - LogImpact.Low, - $"{ToPrettyString(buyer):player} purchased listing \"{ListingLocalisationHelpers.GetLocalisedNameOrEntityName(listing, _proto)}\" from {ToPrettyString(uid)}"); + logImpact, + $"{ToPrettyString(buyer):player} purchased listing \"{ListingLocalisationHelpers.GetLocalisedNameOrEntityName(listing, _proto)}\" from {ToPrettyString(uid)}{logExtraInfo}."); listing.PurchaseAmount++; //track how many times something has been purchased _audio.PlayEntity(component.BuySuccessSound, msg.Actor, uid); //cha-ching! diff --git a/Content.Shared/Store/Components/StoreComponent.cs b/Content.Shared/Store/Components/StoreComponent.cs index 19d13e6d052..0d5b1952a5a 100644 --- a/Content.Shared/Store/Components/StoreComponent.cs +++ b/Content.Shared/Store/Components/StoreComponent.cs @@ -1,4 +1,5 @@ using Content.Shared.FixedPoint; +using Content.Shared.NPC.Prototypes; using Robust.Shared.Audio; using Robust.Shared.GameStates; using Robust.Shared.Prototypes; @@ -36,6 +37,13 @@ public sealed partial class StoreComponent : Component [DataField] public HashSet> CurrencyWhitelist = new(); + /// + /// The expected Faction to use this store. (Optional) + /// Used to increase the severity of the admin log upon purchase if the purchaser is not a member of one of the listed factions. + /// + [DataField] + public HashSet>? ExpectedFaction = new (); + /// /// The person/mind who "owns" the store/account. Used if you want the listings to be fixed /// regardless of who activated it. I.E. role specific items for uplinks. diff --git a/Resources/Prototypes/Entities/Objects/Magic/books.yml b/Resources/Prototypes/Entities/Objects/Magic/books.yml index 55bb7e55820..6ab0412840f 100644 --- a/Resources/Prototypes/Entities/Objects/Magic/books.yml +++ b/Resources/Prototypes/Entities/Objects/Magic/books.yml @@ -70,6 +70,7 @@ ownerOnly: false # For ease of debugging. balance: WizCoin: 99999 + expectedFaction: #nulls out the expected faction - type: entity parent: BaseSpellbook diff --git a/Resources/Prototypes/Entities/Objects/Specific/syndicate.yml b/Resources/Prototypes/Entities/Objects/Specific/syndicate.yml index fcbd0ecc024..c3b48a4a46a 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/syndicate.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/syndicate.yml @@ -123,3 +123,4 @@ - type: Store balance: Telecrystal: 99999 + expectedFaction: #nulls out the expected faction diff --git a/Resources/Prototypes/Store/presets.yml b/Resources/Prototypes/Store/presets.yml index de7717877dc..37329d4096d 100644 --- a/Resources/Prototypes/Store/presets.yml +++ b/Resources/Prototypes/Store/presets.yml @@ -20,6 +20,8 @@ - Telecrystal balance: Telecrystal: 0 + expectedFaction: + - Syndicate - type: entity id: StorePresetSpellbook @@ -35,6 +37,8 @@ - SpellbookEvents #Summon Weapons, Summon Ghosts currencyWhitelist: - WizCoin + expectedFaction: + - Wizard - type: entity id: StorePresetChangeling