From 19241f55ba9167053dbd0482aad78d6511403777 Mon Sep 17 00:00:00 2001
From: Chief-Engineer <119664036+Chief-Engineer@users.noreply.github.com>
Date: Wed, 11 Jan 2023 02:15:47 -0600
Subject: [PATCH] Add prayer logs (#13362)
* hijack unused log type I accidentally introduced
* add subtle message logs
* add prayer logs
* fix missing parameter
---
Content.Server/Administration/Systems/AdminVerbSystem.cs | 2 +-
Content.Server/Prayer/PrayerSystem.cs | 7 ++++++-
Content.Shared.Database/LogType.cs | 2 +-
3 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/Content.Server/Administration/Systems/AdminVerbSystem.cs b/Content.Server/Administration/Systems/AdminVerbSystem.cs
index b920216b05..022a4662af 100644
--- a/Content.Server/Administration/Systems/AdminVerbSystem.cs
+++ b/Content.Server/Administration/Systems/AdminVerbSystem.cs
@@ -92,7 +92,7 @@ namespace Content.Server.Administration.Systems
{
_quickDialog.OpenDialog(player, "Subtle Message", "Message", "Popup Message", (string message, string popupMessage) =>
{
- _prayerSystem.SendSubtleMessage(targetActor.PlayerSession, message, popupMessage == "" ? Loc.GetString("prayer-popup-subtle-default") : popupMessage);
+ _prayerSystem.SendSubtleMessage(targetActor.PlayerSession, player, message, popupMessage == "" ? Loc.GetString("prayer-popup-subtle-default") : popupMessage);
});
};
prayerVerb.Impact = LogImpact.Low;
diff --git a/Content.Server/Prayer/PrayerSystem.cs b/Content.Server/Prayer/PrayerSystem.cs
index 8072222216..7dbd65d9d1 100644
--- a/Content.Server/Prayer/PrayerSystem.cs
+++ b/Content.Server/Prayer/PrayerSystem.cs
@@ -1,4 +1,5 @@
using Content.Server.Administration;
+using Content.Server.Administration.Logs;
using Content.Server.Bible.Components;
using Content.Server.Chat.Managers;
using Content.Server.Popups;
@@ -19,6 +20,7 @@ namespace Content.Server.Prayer;
///
public sealed class PrayerSystem : EntitySystem
{
+ [Dependency] private readonly IAdminLogManager _adminLogger = default!;
[Dependency] private readonly PopupSystem _popupSystem = default!;
[Dependency] private readonly IChatManager _chatManager = default!;
[Dependency] private readonly QuickDialogSystem _quickDialog = default!;
@@ -68,9 +70,10 @@ public sealed class PrayerSystem : EntitySystem
/// Subtly messages a player by giving them a popup and a chat message.
///
/// The IPlayerSession that you want to send the message to
+ /// The IPlayerSession that sent the message
/// The main message sent to the player via the chatbox
/// The popup to notify the player, also prepended to the messageString
- public void SendSubtleMessage(IPlayerSession target, string messageString, string popupMessage)
+ public void SendSubtleMessage(IPlayerSession target, IPlayerSession source, string messageString, string popupMessage)
{
if (target.AttachedEntity == null)
return;
@@ -79,6 +82,7 @@ public sealed class PrayerSystem : EntitySystem
_popupSystem.PopupEntity(popupMessage, target.AttachedEntity.Value, target, PopupType.Large);
_chatManager.ChatMessageToOne(ChatChannel.Local, messageString, message, EntityUid.Invalid, false, target.ConnectedClient);
+ _adminLogger.Add(LogType.AdminMessage, LogImpact.Low, $"{ToPrettyString(target.AttachedEntity.Value):player} received subtle message from {source.Name}: {message}");
}
///
@@ -99,5 +103,6 @@ public sealed class PrayerSystem : EntitySystem
_popupSystem.PopupEntity(Loc.GetString("prayer-popup-notify-sent"), sender.AttachedEntity.Value, sender, PopupType.Medium);
_chatManager.SendAdminAnnouncement(Loc.GetString("prayer-chat-notify", ("name", sender.Name), ("message", message)));
+ _adminLogger.Add(LogType.AdminMessage, LogImpact.Low, $"{ToPrettyString(sender.AttachedEntity.Value):player} sent prayer: {message}");
}
}
diff --git a/Content.Shared.Database/LogType.cs b/Content.Shared.Database/LogType.cs
index d6230e5678..77d77747e4 100644
--- a/Content.Shared.Database/LogType.cs
+++ b/Content.Shared.Database/LogType.cs
@@ -80,5 +80,5 @@ public enum LogType
Stripping = 75,
Stamina = 76,
EntitySpawn = 77,
- Container = 78,
+ AdminMessage = 78,
}