Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_NotificationPlayerKicked.c
Go to the documentation of this file.
1 
18 {
19  [Attribute("{D3BFEE28E7D5B6A1}Configs/ServerBrowser/KickDialogs.conf", params: "conf")]
20  protected ref SCR_ConfigurableDialogUiPresets m_PlayerKickReasonsConfig;
21 
22  [Attribute("#AR-ServerBrowser_SessionError", desc: "If kick reason is unknown use this string", uiwidget: UIWidgets.LocaleEditBox)]
23  protected LocalizedString m_sUnknownKickReason;
24 
25  override string GetText(SCR_NotificationData data)
26  {
27  int playerID, duration;
28  KickCauseCode kickCode;
29  data.GetParams(playerID, kickCode, duration);
30 
31  string playerName;
32  data.GetNotificationTextEntries(playerName);
33  if (!GetPlayerName(playerID, playerName))
34  return string.Empty;
35 
36  string kickReasonText = m_sUnknownKickReason;
38 
39  string groupId, reasonId;
40 
41  //~ Using the config display the kick reason (Same as displayed to players in MainMenu on kick/Ban). If it could not find the message it will send the m_sUnknownKickReason instead
42  if (m_PlayerKickReasonsConfig)
43  {
44  KickCauseGroup2 groupInt;
45  int reasonInt;
46 
47  if (GetGame().GetFullKickReason(kickCode, groupInt, reasonInt, groupId, reasonId))
48  {
49  preset = m_PlayerKickReasonsConfig.FindPreset(groupId + "_" + reasonId);
50  if (preset && !preset.m_sMessage.IsEmpty())
51  kickReasonText = preset.m_sMessage;
52  }
53  }
54  else
55  {
56  Print("SCR_NotificationPlayerKicked (kick or ban) does not have the m_PlayerKickReasonsConfig assigned with a SCR_ConfigurableDialogUiPresets config prefab!", LogLevel.ERROR);
57  }
58 
59  //~ Player was kicked (0 duration) or banned (-1 duration)
60  if (duration <= 0)
61  {
62  data.SetNotificationTextEntries(playerName, kickReasonText);
63  }
64  //~ Higher then 0 so Player was temp banned
65  else
66  {
67  int days, hours, minutes, seconds;
68  SCR_DateTimeHelper.GetDayHourMinuteSecondFromSeconds(duration, days, hours, minutes, seconds);
69 
70  data.SetNotificationTextEntries(playerName, days.ToString(), hours.ToString(), minutes.ToString(), seconds.ToString(), kickReasonText);
71  }
72 
73  return super.GetText(data);
74  }
75 };
KickCauseGroup2
KickCauseGroup2
Extends KickCauseGroup by adding game-specific groups.
Definition: KickCauseGroup2.c:13
SCR_NotificationPlayer
Definition: SCR_NotificationPlayer.c:10
SCR_BaseContainerCustomTitleEnum
class SCR_CampaignHintStorage SCR_BaseContainerCustomTitleEnum(EHint, "m_eHintId")
Definition: SCR_CampaignHintStorage.c:22
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
desc
UI Textures DeployMenu Briefing conflict_HintBanner_1_UI desc
Definition: SCR_RespawnBriefingComponent.c:17
KickCauseCode
KickCauseCode
Definition: KickCauseCode.c:19
SCR_ConfigurableDialogUiPresets
Class for a .conf file with multiple presets.
Definition: SCR_ConfigurableDialogUI.c:849
SCR_DateTimeHelper
Definition: SCR_DateTimeHelper.c:1
ENotification
ENotification
Definition: ENotification.c:4
Attribute
typedef Attribute
Post-process effect of scripted camera.
SCR_ConfigurableDialogUiPreset
Configuration for a dialog.
Definition: SCR_ConfigurableDialogUI.c:809
SCR_NotificationData
Definition: SCR_NotificationData.c:6
data
Get all prefabs that have the spawner data
Definition: SCR_EntityCatalogManagerComponent.c:305
params
Configs ServerBrowser KickDialogs params
Definition: SCR_NotificationSenderComponent.c:24
LocalizedString
Definition: LocalizedString.c:21
BaseContainerProps
SCR_AIGoalReaction_Follow BaseContainerProps
Handles insects that are supposed to be spawned around selected prefabs defined in prefab names array...
Definition: SCR_AIGoalReaction.c:468
SCR_NotificationPlayerKicked
Definition: SCR_NotificationPlayerKicked.c:17
GetFullKickReason
bool GetFullKickReason(KickCauseCode kickCode, out KickCauseGroup2 groupInt, out int reasonInt, out string group, out string reason)
Definition: game.c:358