private void ProcessGibRequest(GameObject perp, GameObject admin, PlayerAlertData alertEntry, string adminId) { if (alertEntry.gibbed) { return; } var playerScript = perp.GetComponent <PlayerScript>(); if (playerScript == null || playerScript.IsGhost || playerScript.playerHealth == null) { return; } ConnectedPlayer perpPlayer = perp.Player(); UIManager.Instance.adminChatWindows.adminToAdminChat.ServerAddChatRecord( $"{admin.Player().Username} BRUTALLY GIBBED player {perpPlayer.Name} ({perpPlayer.Username}) for a " + $"{alertEntry.playerAlertType.ToString()} incident that happened at roundtime: {alertEntry.roundTime}", adminId); playerScript.playerHealth.ServerGibPlayer(); alertEntry.gibbed = true; ServerSendEntryToAllAdmins(alertEntry); notifications.AddNotification(NotificationKey, -1); PlayerAlertNotifications.SendToAll(-1); }
public void ServerAddNewEntry(string incidentTime, PlayerAlertTypes alertType, ConnectedPlayer perp, string message) { var netId = NetId.Invalid; if (perp?.Connection == null) { return; } if (perp.Connection.identity != null) { netId = perp.Connection.identity.netId; } var entry = new PlayerAlertData(); entry.roundTime = incidentTime; entry.playerNetId = netId; entry.playerAlertType = alertType; entry.Message = message; serverPlayerAlerts.Add(entry); PlayerAlertNotifications.SendToAll(1); ServerSendEntryToAllAdmins(entry); }
public void AddNewPlayerAlert(PlayerAlertData alertEntry) { if (displayPool.Count != 0 && displayPool[0].Index != alertLog.Count - 1) { alertLog.Add(alertEntry); return; } alertLog.Add(alertEntry); TryShowView(alertEntry, true, alertLog.Count - 1); }
public void ClientUpdateSingleEntry(PlayerAlertData entry) { var index = clientPlayerAlerts.FindIndex(x => x.playerNetId == entry.playerNetId && x.roundTime == entry.roundTime); if (index == -1) { playerAlertsScroll.AddNewPlayerAlert(entry); } else { playerAlertsScroll.UpdateExistingPlayerAlert(entry); } }
private void ProcessTakenCareOfRequest(GameObject perp, GameObject admin, PlayerAlertData alertEntry, string adminId) { if (alertEntry.takenCareOf) { return; } var playerScript = perp.GetComponent <PlayerScript>(); if (playerScript == null || playerScript.IsGhost || playerScript.playerHealth == null) { return; } UIManager.Instance.adminChatWindows.adminToAdminChat.ServerAddChatRecord($"{admin.ExpensiveName()} is talking to or monitoring player {perp.ExpensiveName()} for a " + $"{alertEntry.playerAlertType.ToString()} incident that happened at roundtime: " + $"{alertEntry.roundTime}", adminId); alertEntry.takenCareOf = true; ServerSendEntryToAllAdmins(alertEntry); notifications.AddNotification(NotificationKey, -1); PlayerAlertNotifications.SendToAll(-1); }
public void UpdateExistingPlayerAlert(PlayerAlertData alertEntry) { var index = alertLog.FindIndex(x => x.playerNetId == alertEntry.playerNetId && x.roundTime == alertEntry.roundTime); if (index == -1) { AddNewPlayerAlert(alertEntry); } else { foreach (var v in displayPool.Cast <PlayerAlertView>().ToList()) { if (v.LoadedData == alertLog[index]) { alertLog[index] = alertEntry; v.Reload(alertEntry); return; } } alertLog[index] = alertEntry; } }
public void ServerSendEntryToAllAdmins(PlayerAlertData entry) { PlayerAlertsUpdateMessage.SendSingleEntryToAdmins(entry); }