Whisper 0.1.0: private messages between players
/pm (/w) with names, #userid, SteamIDs, @me, @aim, @random, @randomt and @randomct, /r to reply, and /block, /blocklist, /unblock. Lines use CS2-Tags' rank prefixes and colours: >[[M] Kalus -> me] message. Gagged players can't send; blocks stop everyone but staff. Messages are kept in CS2-SimpleAdmin's database while History is on (css_whisper_history).
This commit is contained in:
commit
c414e8a770
12 changed files with 1547 additions and 0 deletions
35
Ops.cs
Normal file
35
Ops.cs
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Whisper;
|
||||
|
||||
// Every database write, as data, so the writer can run them in order off the game thread and keep
|
||||
// them in the spool file while the database is down. Each is safe to run twice: messages are keyed,
|
||||
// block adds are INSERT IGNOREs and removes are deletes.
|
||||
[JsonPolymorphic(TypeDiscriminatorPropertyName = "op")]
|
||||
[JsonDerivedType(typeof(MessageRecord), "message")]
|
||||
[JsonDerivedType(typeof(BlockAdd), "block_add")]
|
||||
[JsonDerivedType(typeof(BlockRemove), "block_remove")]
|
||||
public abstract record Op;
|
||||
|
||||
public sealed record PlayerState(ulong SteamId, string Name, int Team, bool Alive);
|
||||
|
||||
public sealed record MessageRecord(
|
||||
string Key, DateTime At, int? ServerId, string Map, PlayerState Sender, PlayerState? Recipient,
|
||||
string Target, string Message, string Result) : Op;
|
||||
|
||||
public sealed record BlockAdd(ulong Blocker, ulong Blocked, string BlockedName, DateTime At) : Op;
|
||||
|
||||
public sealed record BlockRemove(ulong Blocker, ulong Blocked) : Op;
|
||||
|
||||
// What the message log calls each outcome (wh_messages.result).
|
||||
public static class Result
|
||||
{
|
||||
public const string Sent = "sent";
|
||||
public const string Blocked = "blocked";
|
||||
public const string Gagged = "gagged";
|
||||
public const string Cooldown = "cooldown";
|
||||
public const string NoTarget = "no_target";
|
||||
public const string Ambiguous = "ambiguous";
|
||||
public const string GroupTarget = "group_target";
|
||||
public const string TooLong = "too_long";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue