Skip to main content

RecentPlayers

A static class in Root.Township, the global namespace.

Client-only helpers and the recent-players console module (alias recent) for the recent players list, which is stored through the Alta API.

Fields​

3 private and internal fields
MemberWhat it is
private static Logger loggerNLog logger for API errors.
private const string RecentStatusTimeThe text a moment ago used in status strings.
private static IVoiceChat voiceChatBacking field for VoiceChat.

Properties​

1 private and internal property
MemberWhat it is
private static IVoiceChat VoiceChat { get; }Voice chat service, resolved on first use, used to check mutes.

Methods​

MemberWhat it is
static string FriendlyText(ReportType type)Display text for a report reason.
static async Task<IEnumerable<RecentPlayerInteractionInfo>> GetAllRecentPlayerInteractions()Fetches all recent player interactions from the API. Returns empty on error.
static FriendshipType GetFriendshipType(RecentPlayerInteractionInfo info)The local player's friendship status with this recent player.
static async Task<IEnumerable<RecentPlayerInteractionInfo>> GetRecentPlayerInteractionsForServer(int serverId)Fetches interactions for one server, or all of them for server -1.
static string GetStatusTextApprox(RecentPlayerInteractionInfo info)Status text: offline with time since last seen, on the server, or nearby.
static bool HasBeenFriendRequestedByMe(RecentPlayerInteractionInfo info)True if the local player has sent this player a friend request.
static bool HasFriendshipRequestedMe(RecentPlayerInteractionInfo info)True if this player has sent the local player a friend request.
static bool IsFriend(RecentPlayerInteractionInfo info)True if the local player is friends with this player.
static bool IsMuted(RecentPlayerInteractionInfo info)True if this player is muted in voice chat.
static async void RecordInteraction(UserInfo userInfo, RecentPlayerInteractionType interactionType)Records an interaction with another user through the API. Ignores the logged-in user.
static async Task TestRecordInteraction(string name, int id, int interactionType)Console command test-record (tr): records a test interaction with a made-up user.
static string ToPrettyFormat(TimeSpan span)Formats a time span as days, hours and minutes ago.
static string ToPrettyFormatApprox(TimeSpan span)Formats a time span as its largest unit only, such as "3 hours ago".
2 private and internal methods
MemberWhat it is
private static async Task<IEnumerable<RecentPlayerInteractionInfo>> QueryDbForInteractions(int? serverIdToCheck = null)Fetches recent player interactions from the API, for one server or all. Returns empty on error.
private static TimeSpan TimeSince(RecentPlayerInteractionInfo info)Time since the interaction happened, in UTC.