PlaytimeHistory 0.1.0: sessions and team/alive segments in MySQL, DB-IP locations
This commit is contained in:
commit
a56dbad03a
11 changed files with 1989 additions and 0 deletions
81
Config.cs
Normal file
81
Config.cs
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
using System.Text.Json.Serialization;
|
||||
using CounterStrikeSharp.API.Core;
|
||||
|
||||
namespace PlaytimeHistory;
|
||||
|
||||
// configs/plugins/PlaytimeHistory/PlaytimeHistory.json, which CSS writes with these defaults on first
|
||||
// load. It holds the database password, so the plugin keeps it at mode 600. Changes need the plugin
|
||||
// reloaded: css_plugins reload PlaytimeHistory.
|
||||
public class PlaytimeHistoryConfig : BasePluginConfig
|
||||
{
|
||||
[JsonPropertyName("Database")]
|
||||
public DatabaseConfig Database { get; set; } = new();
|
||||
|
||||
// pt_servers.id. Must differ between servers writing to the same database.
|
||||
[JsonPropertyName("ServerId")]
|
||||
public int ServerId { get; set; } = 1;
|
||||
|
||||
// "host:port" for pt_servers.address. The server can't work out its own public address, so
|
||||
// nothing is stored when this is empty.
|
||||
[JsonPropertyName("PublicAddress")]
|
||||
public string PublicAddress { get; set; } = "";
|
||||
|
||||
// Whether time spent spectating or unassigned (team picker) counts toward pt_players.total_seconds.
|
||||
// It's always recorded in pt_segments and pt_players.spec_seconds either way.
|
||||
[JsonPropertyName("CountSpectatorTime")]
|
||||
public bool CountSpectatorTime { get; set; } = false;
|
||||
|
||||
// DB-IP's City Lite database, relative to the plugin folder. pre.sh installs it. Without it,
|
||||
// sessions have no country or city.
|
||||
[JsonPropertyName("GeoIpDatabase")]
|
||||
public string GeoIpDatabase { get; set; } = "dbip-city-lite.mmdb";
|
||||
|
||||
[JsonPropertyName("PingSampleIntervalSeconds")]
|
||||
public int PingSampleIntervalSeconds { get; set; } = 30;
|
||||
|
||||
// How often players online are counted into pt_online_snapshots. 0 turns snapshots off.
|
||||
[JsonPropertyName("OnlineSnapshotIntervalSeconds")]
|
||||
public int OnlineSnapshotIntervalSeconds { get; set; } = 300;
|
||||
|
||||
// How often open sessions and segments get heartbeat_at, which is where they're closed after a
|
||||
// crash. A crash loses at most this much time.
|
||||
[JsonPropertyName("HeartbeatSeconds")]
|
||||
public int HeartbeatSeconds { get; set; } = 60;
|
||||
|
||||
// Writes kept on disk while the database is unreachable, sent once it's back. Beyond this, new
|
||||
// writes are dropped (and logged).
|
||||
[JsonPropertyName("SpoolMaxEntries")]
|
||||
public int SpoolMaxEntries { get; set; } = 20000;
|
||||
|
||||
// css_playtime/css_lastseen about someone else need this; about yourself, nothing.
|
||||
[JsonPropertyName("OtherPlayersPermission")]
|
||||
public string OtherPlayersPermission { get; set; } = "@css/generic";
|
||||
|
||||
[JsonPropertyName("CommandCooldownSeconds")]
|
||||
public int CommandCooldownSeconds { get; set; } = 5;
|
||||
|
||||
[JsonPropertyName("LastSeenLimit")]
|
||||
public int LastSeenLimit { get; set; } = 5;
|
||||
}
|
||||
|
||||
public class DatabaseConfig
|
||||
{
|
||||
[JsonPropertyName("Host")]
|
||||
public string Host { get; set; } = "127.0.0.1";
|
||||
|
||||
[JsonPropertyName("Port")]
|
||||
public uint Port { get; set; } = 3306;
|
||||
|
||||
[JsonPropertyName("Database")]
|
||||
public string Database { get; set; } = "playtime_history";
|
||||
|
||||
[JsonPropertyName("User")]
|
||||
public string User { get; set; } = "pt_plugin";
|
||||
|
||||
[JsonPropertyName("Password")]
|
||||
public string Password { get; set; } = "";
|
||||
|
||||
// MySqlConnector's SslMode: None, Preferred, Required, VerifyCA or VerifyFull.
|
||||
[JsonPropertyName("SslMode")]
|
||||
public string SslMode { get; set; } = "None";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue