Play time tracking: Job timers 3: more titles: when the (#9978)

Co-authored-by: Veritius <veritiusgaming@gmail.com>
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
Pieter-Jan Briers
2022-08-07 08:00:42 +02:00
committed by GitHub
parent 6b94db0336
commit e852ada6c8
91 changed files with 5044 additions and 247 deletions

View File

@@ -0,0 +1,34 @@
using Lidgren.Network;
using Robust.Shared.Network;
namespace Content.Shared.Players.PlayTimeTracking;
/// <summary>
/// Sent server -> client to inform the client of their play times.
/// </summary>
public sealed class MsgPlayTime : NetMessage
{
public override MsgGroups MsgGroup => MsgGroups.EntityEvent;
public Dictionary<string, TimeSpan> Trackers = new();
public override void ReadFromBuffer(NetIncomingMessage buffer)
{
var count = buffer.ReadVariableInt32();
for (var i = 0; i < count; i++)
{
Trackers.Add(buffer.ReadString(), buffer.ReadTimeSpan());
}
}
public override void WriteToBuffer(NetOutgoingMessage buffer)
{
buffer.WriteVariableInt32(Trackers.Count);
foreach (var (role, time) in Trackers)
{
buffer.Write(role);
buffer.Write(time);
}
}
}