User accessible playtime (#21242)
Co-authored-by: metalgearsloth <comedian_vs_clown@hotmail.com>
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Players;
|
||||
using Content.Shared.Players.PlayTimeTracking;
|
||||
@@ -122,4 +120,24 @@ public sealed class JobRequirementsManager
|
||||
reason = reasons.Count == 0 ? null : FormattedMessage.FromMarkup(string.Join('\n', reasons));
|
||||
return reason == null;
|
||||
}
|
||||
|
||||
public TimeSpan FetchOverallPlaytime()
|
||||
{
|
||||
return _roles.TryGetValue("Overall", out var overallPlaytime) ? overallPlaytime : TimeSpan.Zero;
|
||||
}
|
||||
|
||||
public IEnumerable<KeyValuePair<string, TimeSpan>> FetchPlaytimeByRoles()
|
||||
{
|
||||
var jobsToMap = _prototypes.EnumeratePrototypes<JobPrototype>();
|
||||
|
||||
foreach (var job in jobsToMap)
|
||||
{
|
||||
if (_roles.TryGetValue(job.PlayTimeTracker, out var locJobName))
|
||||
{
|
||||
yield return new KeyValuePair<string, TimeSpan>(job.Name, locJobName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user