Skip to main content

PlayerCommunityAnalytics

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

Client helpers that post social analytics events (friend requests, reports, bans, unbans) to Alta's API for the logged-in user.

Fields​

21 private and internal fields
MemberWhat it is
private const string BanCreatedInMainMenuPageKeyEvent data key for the main menu page a ban came from.
private const string BanCreatedInSocialTabletRoleKeyEvent data key for whether a social tablet ban came from an owner or moderator.
private const string BanCreatedOriginKeyEvent data key for where a ban came from.
private const string BanPlayerEventEvent name for a ban.
private static readonly Dictionary<string, object> EventDataShared event data filled by each helper before posting.
private const string FriendRequestTokenFriendlyTextDisplay text for the friend request token origin.
private const string FriendshipStatusActionOriginKeyEvent data key for where a friendship action came from.
private static Logger loggerNLog logger for this class.
private const string MainMenuFriendlyTextDisplay text for the main menu origin.
private const string MutualFriendshipCreationEventEvent name for a new mutual friendship.
private const string MutualFriendshipOriginKeyEvent data key for how a mutual friendship was made.
private const string RemoveFriendEventEvent name for removing a friend.
private const string RequestFriendEventEvent name for a friend request.
private const string RespondFriendRequestEventEvent name for answering a friend request.
private static readonly GroupPermissions[] serverOwnerPermissionDataPermission checked to decide whether a banner is the server owner.
private const string SocialTabletFriendlyTextDisplay text for the social tablet origin.
private const string UnBanPlayerEventEvent name for an unban.
private const string UnBanPlayerOriginKeyEvent data key for where an unban came from.
private static int userIdBacking field for UserId, -1 when not cached.
private const string UserReportPlayerEventEvent name for a player report.
private const string UserReportPlayerOriginKeyEvent data key for where a report came from.

Properties​

1 private and internal property
MemberWhat it is
private static int UserId { get; }The logged-in user's ID, cached until logout.

Methods​

MemberWhat it is
static void BanPlayerInMainMenu(SocialAnalyticsBanMenuPanelOrigin mainSocialAnalyticsBanMenuPageUsedFor)Posts a ban event from the main menu, with the page it was made on.
static async void BanPlayerInSocialTablet(int serverId)Posts a ban event from the social tablet, with the player's role (owner or moderator) on the server.
static string FriendlyText(SocialAnalyticsEventOrigin reportEventOriginType)Turns a social event origin into its display text.
static void FriendRequestedFrom(SocialAnalyticsEventOrigin eventOrigin)Posts a friend request event with its origin.
static void FriendRequestToken()Posts a mutual friendship event made through a friend request token.
static void ReportPlayer(SocialAnalyticsEventOrigin eventOrigin)Posts a player report event with its origin.
static void RespondFriendRequestFrom(SocialAnalyticsEventOrigin eventOrigin)Posts a friend request response event with its origin.
static void UnBanPlayerSocialTablet()Posts an unban event from the social tablet.
static void UnFriend(SocialAnalyticsEventOrigin eventOrigin)Posts a remove friend event with its origin.
3 private and internal methods
MemberWhat it is
private static async void CreateAnalyticEvent(string eventName)Posts the event with the gathered EventData, then clears the data even on failure.
private static async Task<string> GetPlayerBanRole(int serverId)Returns "Owner" if the player can control the server, otherwise "Moderator".
private static void LoggedOut()Clears the cached user ID.