Arma Reforger Explorer  1.1.0.42
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
SCR_PlayerDataConfigs.c
Go to the documentation of this file.
1 
2 // -----------------------------------------------------------------------------
4 // -----------------------------------------------------------------------------
5 
6 //------------------------------------------------------------------------------------------------
8 {
9  float m_fScoreThreshold;
10  float m_fScoreDecreasePerMinute;
11  float m_fScoreMultiplier;
12  float m_fAccelerationMin;
13  float m_fAccelerationMax;
14  float m_fBanEvaluationLight;
15  float m_fBanEvaluationHeavy;
16  float m_fCrimePtFriendKill;
17  float m_fCrimePtTeamKill;
18  float m_fQualityTimeTemp;
19  float m_bVotingSuggestionEnabled;
20 
21  //------------------------------------------------------------------------------------------------
22  void Log(LogLevel lv)
23  {
24  Print("m_fScoreThreshold: " + m_fScoreThreshold, lv);
25  Print("m_fScoreDecreasePerMinute: " + m_fScoreDecreasePerMinute, lv);
26  Print("m_fScoreMultiplier: " + m_fScoreMultiplier, lv);
27  Print("m_fAccelerationMin: " + m_fAccelerationMin, lv);
28  Print("m_fAccelerationMax: " + m_fAccelerationMax, lv);
29  Print("m_fBanEvaluationLight: " + m_fBanEvaluationLight, lv);
30  Print("m_fBanEvaluationHeavy: " + m_fBanEvaluationHeavy, lv);
31  Print("m_fCrimePtFriendKill: " + m_fCrimePtFriendKill, lv);
32  Print("m_fCrimePtTeamKill: " + m_fCrimePtTeamKill, lv);
33  Print("m_fQualityTimeTemp: " + m_fQualityTimeTemp, lv);
34  Print("m_bVotingSuggestionEnabled: " + m_bVotingSuggestionEnabled, lv);
35  }
36 
37  //------------------------------------------------------------------------------------------------
38  void SetDefault()
39  {
40  m_fScoreThreshold = 10.0;
41  m_fScoreDecreasePerMinute = 0.2;
42  m_fScoreMultiplier = 0.2;
43  m_fAccelerationMin = 1.0;
44  m_fAccelerationMax = 6.0;
45  m_fBanEvaluationLight = 0.8;
46  m_fBanEvaluationHeavy = 1.0;
47  m_fCrimePtFriendKill = 1.0;
48  m_fCrimePtTeamKill = 0.7;
49  m_fQualityTimeTemp = 1.0;
50  m_bVotingSuggestionEnabled = 0.0;
51  }
52 
53  //------------------------------------------------------------------------------------------------
54  void SCR_BanSettings()
55  {
56  RegAll();
57  }
58 };
59 
60 //------------------------------------------------------------------------------------------------
62 {
63  protected string m_sDesc;
64  protected ref SCR_BanSettings m_BanSettings = new SCR_BanSettings();
65 
66  //------------------------------------------------------------------------------------------------
67  string GetDesc()
68  {
69  return m_sDesc;
70  }
71 
72  //------------------------------------------------------------------------------------------------
73  SCR_BanSettings GetBanSettings()
74  {
75  return m_BanSettings;
76  }
77 
78  //------------------------------------------------------------------------------------------------
79  void Log(LogLevel lv)
80  {
81  Print(" -- Settings -- ", lv);
82  Print("m_sDesc: " + m_sDesc, lv);
83  m_BanSettings.Log(lv);
84  }
85 
86  //------------------------------------------------------------------------------------------------
87  void SetDefault()
88  {
89  m_sDesc = "Default params";
90  m_BanSettings.SetDefault();
91  }
92 
93  //------------------------------------------------------------------------------------------------
95  {
96  RegV("m_sDesc");
97  RegV("m_BanSettings");
98  }
99 };
100 
101 //------------------------------------------------------------------------------------------------
102 class SCR_PlayerDataConfigs : Managed
103 {
104 
105  protected static ref SCR_PlayerDataConfigs instance;
106 
107  /****************/
108  //RANK AND LEVEL//
109  /****************/
110 
111  static const float MODIFIER_SPECIALIZATIONS = 0.2;
112  static const int XP_NEEDED_FOR_LEVEL = 10000;
113  static const int XP_NEEDED_FOR_LEVEL_DIVIDER = 0.0001;
114  static const int XP_NEEDED_FOR_RANK = 100000;
115  static const int XP_NEEDED_FOR_RANK_DIVIDER = 0.00001;
116  static const int MAX_EXP = 1000000;
117 
118  /*****************/
119  //SPECIALIZATIONS//
120  /*****************/
121 
122  int SPECIALIZATIONS_COUNT;
123 
124  string SPECIALIZATION_0_NAME = "#AR-CareerProfile_Specialization1";
125  string SPECIALIZATION_1_NAME = "#AR-CareerProfile_Specialization2";
126  string SPECIALIZATION_2_NAME = "#AR-CareerProfile_Specialization3";
127 
128  int SPECIALIZATION_0_COUNT;
129  int SPECIALIZATION_1_COUNT;
130  int SPECIALIZATION_2_COUNT;
131 
132  ref array<ref SCR_PlayerDataSpecializationDisplay> m_aSpecialization0 = {};
133  ref array<ref SCR_PlayerDataSpecializationDisplay> m_aSpecialization1 = {};
134  ref array<ref SCR_PlayerDataSpecializationDisplay> m_aSpecialization2 = {};
135 
136  const int SPECIALIZATION_MAX = 1000000;
137 
138  //0 - Infantry
139  static const float MODIFIER_DISTANCE_WALKED = 1;
140  static const float MODIFIER_KILLS = 250;
141  static const float MODIFIER_AI_KILLS = 125;
142  static const float MODIFIER_PRECISION = 300;
143 
144  //1 - Logistics
145  static const float MODIFIER_DISTANCE_DRIVEN = 1;
146  static const float MODIFIER_DRIVER_OF_PLAYERS = 0.7;
147  static const float MODIFIER_TRAVEL_TIME_SUPPLY_VEHICLE = 1;
148  static const float MODIFIER_TRAVELED_DISTANCE_SUPPLY_VEHICLE = 5;
149  static const int MODIFIER_PLAYERS_DIED_IN_VEHICLE = 500;
150  static const int MAX_PLAYERS_DIED_IN_VEHICLE_PENALTY = MODIFIER_PLAYERS_DIED_IN_VEHICLE * 5;
151 
152  //2 - Medical Support
153  static const float MODIFIER_BANDAGE_SELF = 150;
154  static const float MODIFIER_BANDAGE_FRIENDLIES = 300;
155  static const float MODIFIER_TOURNIQUET_SELF = 150;
156  static const float MODIFIER_TOURNIQUET_FRIENDLIES = 300;
157  static const float MODIFIER_SALINE_SELF = 150;
158  static const float MODIFIER_SALINE_FRIENDLIES = 300;
159  static const float MODIFIER_MORPHINE_SELF = 150;
160  static const float MODIFIER_MORPHINE_FRIENDLIES = 300;
161 
162  //Config of Ranges
163  static const int INTERVALS_COUNT = 5;
164  static ref const array<int> INTERVALS_ORIGIN = {0, 160000, 600000, 750000, 900000};
165  static ref const array<int> INTERVALS_END = {160000, 600000, 750000, 900000, 1000000};
166  static ref const array<float> INTERVALS_C1 = {1.9449, 0.71, 8.1682, 6, 18};
167  static ref const array<float> INTERVALS_C2 = {0.9254, 0.9908, 0.9517, 0.9559, 0.9425};
168 
169  /************/
170  //WAR CRIMES//
171  /************/
172 
173  static const float WARCRIMES_PUNISHMENT = 0.25;
174 
175  static const float MAX_WARCRIMES_VALUE = 250000;
176  static const float WARCRIMES_DECREASE_PER_HOUR = 25000;
177 
178  static const float STD_POINTS_QUALITY_TIME = 10000;
179 
180  /**************/
181  //BAN SETTINGS//
182  /**************/
183 
184  protected static ref SCR_BanSettingsContainer m_BanSettings = new SCR_BanSettingsContainer();
185 
186  /**********/
187  //UI STUFF//
188  /**********/
189 
190  static const float SPPOINTS_CONVERSIONPERCENTAGE = 0.0001;
191 
192  /********/
193  //BASICS//
194  /********/
195 
196  static const float MetersToKilometersConversion = 0.001;
197 
198  //------------------------------------------------------------------------------------------------
199  static SCR_PlayerDataConfigs GetInstance()
200  {
201  if (!instance)
202  instance = new SCR_PlayerDataConfigs();
203 
204  return instance;
205  }
206 
207  //------------------------------------------------------------------------------------------------
208  float GetScoreThreshold()
209  {
210  return m_BanSettings.GetBanSettings().m_fScoreThreshold;
211  }
212 
213  //------------------------------------------------------------------------------------------------
214  float GetScoreDecreasePerMinute()
215  {
216  return m_BanSettings.GetBanSettings().m_fScoreDecreasePerMinute;
217  }
218 
219  //------------------------------------------------------------------------------------------------
220  float GetScoreDecreasePerSecond()
221  {
222  return m_BanSettings.GetBanSettings().m_fScoreDecreasePerMinute / 60;
223  }
224 
225  //------------------------------------------------------------------------------------------------
226  float GetScoreToAccelerationMultiplier()
227  {
228  return m_BanSettings.GetBanSettings().m_fScoreMultiplier;
229  }
230 
231  //------------------------------------------------------------------------------------------------
232  float GetMinAcceleration()
233  {
234  return m_BanSettings.GetBanSettings().m_fAccelerationMin;
235  }
236 
237  //------------------------------------------------------------------------------------------------
238  float GetMaxAcceleration()
239  {
240  return m_BanSettings.GetBanSettings().m_fAccelerationMax;
241  }
242 
243  //------------------------------------------------------------------------------------------------
244  float GetBanEvaluationLight()
245  {
246  return m_BanSettings.GetBanSettings().m_fBanEvaluationLight;
247  }
248 
249  //------------------------------------------------------------------------------------------------
250  float GetBanEvaluationHeavy()
251  {
252  return m_BanSettings.GetBanSettings().m_fBanEvaluationHeavy;
253  }
254 
255  //------------------------------------------------------------------------------------------------
256  float GetCrimePointsFriendlyKill()
257  {
258  return m_BanSettings.GetBanSettings().m_fCrimePtFriendKill;
259  }
260 
261  //------------------------------------------------------------------------------------------------
262  float GetCrimePointsFriendlyMultiKill()
263  {
264  return m_BanSettings.GetBanSettings().m_fCrimePtTeamKill;
265  }
266 
267  //------------------------------------------------------------------------------------------------
268  float GetQualityTimeTemp()
269  {
270  return m_BanSettings.GetBanSettings().m_fQualityTimeTemp;
271  }
272 
273  //------------------------------------------------------------------------------------------------
274  bool GetVotingSuggestionEnabled()
275  {
276  return m_BanSettings.GetBanSettings().m_bVotingSuggestionEnabled >= 1;
277  }
278 
279  //------------------------------------------------------------------------------------------------
280  string GetBanSettingsDescription()
281  {
282  return m_BanSettings.GetDesc();
283  }
284 
285  //------------------------------------------------------------------------------------------------
286  string GetSpecializationName(int n)
287  {
288  switch (n)
289  {
290  case 0: return SPECIALIZATION_0_NAME;
291  case 1: return SPECIALIZATION_1_NAME;
292  case 2: return SPECIALIZATION_2_NAME;
293  }
294 
295  return "UNDEFINED_NAME";
296  }
297 
298  //------------------------------------------------------------------------------------------------
299  int GetSpecializationStatsCount(int n)
300  {
301  switch (n)
302  {
303  case 0: return SPECIALIZATION_0_COUNT;
304  case 1: return SPECIALIZATION_1_COUNT;
305  case 2: return SPECIALIZATION_2_COUNT;
306  }
307 
308  return -1;
309  }
310 
311  //------------------------------------------------------------------------------------------------
312  array<ref SCR_PlayerDataSpecializationDisplay> GetSpecializationArray(int n)
313  {
314  switch (n)
315  {
316  case 0: return m_aSpecialization0;
317  case 1: return m_aSpecialization1;
318  case 2: return m_aSpecialization2;
319  }
320 
321  return null;
322  }
323 
324  //------------------------------------------------------------------------------------------------
325  void LoadJson()
326  {
327  if (m_BanSettings.GetDesc().IsEmpty())
328  GetGame().GetBackendApi().SettingsData("BanSettings", m_BanSettings);
329  else
330  Print(m_BanSettings.GetDesc(), LogLevel.DEBUG);
331 
332  if (m_BanSettings.GetDesc().IsEmpty())
333  {
334  Print("Ban Settings could not be loaded from BE Storage: Relying on default config", LogLevel.WARNING);
335  m_BanSettings.SetDefault();
336  }
337 
338  m_BanSettings.Log(LogLevel.DEBUG);
339  }
340 
341  //------------------------------------------------------------------------------------------------
342  private void SCR_PlayerDataConfigs()
343  {
344  m_aSpecialization0.Insert(new SCR_PlayerDataSpecializationDisplay(SCR_ESpecialization0Display.DISTANCE_WALKED, SCR_EDataStats.DISTANCE_WALKED, "#AR-CareerProfile_DistanceTravelled_ByFoot", "#AR-CareerProfile_KMs"));
345  m_aSpecialization0.Insert(new SCR_PlayerDataSpecializationDisplay(SCR_ESpecialization0Display.PLAYER_KILLS, SCR_EDataStats.KILLS, "#AR-CareerProfile_PlayersKilled", "#AR-CareerProfile_Enemies"));
346  m_aSpecialization0.Insert(new SCR_PlayerDataSpecializationDisplay(SCR_ESpecialization0Display.AI_KILLS, SCR_EDataStats.AI_KILLS, "#AR-CareerProfile_AIKilled", "#AR-CareerProfile_Enemies"));
347  m_aSpecialization0.Insert(new SCR_PlayerDataSpecializationDisplay(SCR_ESpecialization0Display.SHOTS, SCR_EDataStats.SHOTS, "#AR-CareerProfile_BulletsShot", "#AR-CareerProfile_Rounds"));
348 
349  m_aSpecialization1.Insert(new SCR_PlayerDataSpecializationDisplay(SCR_ESpecialization1Display.DISTANCE_DRIVEN, SCR_EDataStats.DISTANCE_DRIVEN, "#AR-CareerProfile_DistanceTravelled_AsDriver", "#AR-CareerProfile_KMs"));
350  m_aSpecialization1.Insert(new SCR_PlayerDataSpecializationDisplay(SCR_ESpecialization1Display.DISTANCE_AS_OCCUPANT, SCR_EDataStats.DISTANCE_AS_OCCUPANT, "#AR-CareerProfile_DistanceTravelled_AsPassenger", "#AR-CareerProfile_KMs"));
351  m_aSpecialization1.Insert(new SCR_PlayerDataSpecializationDisplay(SCR_ESpecialization1Display.POINTS_DRIVING_PEOPLE, SCR_EDataStats.POINTS_AS_DRIVER_OF_PLAYERS, "#AR-CareerProfile_PointsDriverAllies", "#AR-CareerProfile_Points"));
352 
353  m_aSpecialization2.Insert(new SCR_PlayerDataSpecializationDisplay(SCR_ESpecialization2Display.BANDAGE_SELF, SCR_EDataStats.BANDAGE_SELF, "#AR-CareerProfile_BandagesSelf", "#AR-CareerProfile_Times"));
354  m_aSpecialization2.Insert(new SCR_PlayerDataSpecializationDisplay(SCR_ESpecialization2Display.BANDAGE_FRIENDLIES, SCR_EDataStats.BANDAGE_FRIENDLIES, "#AR-CareerProfile_BandagesAllies", "#AR-CareerProfile_Times"));
355  m_aSpecialization2.Insert(new SCR_PlayerDataSpecializationDisplay(SCR_ESpecialization2Display.TOURNIQUET_SELF, SCR_EDataStats.TOURNIQUET_SELF, "#AR-CareerProfile_TourniquetsSelf", "#AR-CareerProfile_Times"));
356  m_aSpecialization2.Insert(new SCR_PlayerDataSpecializationDisplay(SCR_ESpecialization2Display.TOURNIQUET_FRIENDLIES, SCR_EDataStats.TOURNIQUET_FRIENDLIES, "#AR-CareerProfile_TourniquetsAllies", "#AR-CareerProfile_Times"));
357  m_aSpecialization2.Insert(new SCR_PlayerDataSpecializationDisplay(SCR_ESpecialization2Display.SALINE_SELF, SCR_EDataStats.SALINE_SELF, "#AR-CareerProfile_SelinesSelf", "#AR-CareerProfile_Times"));
358  m_aSpecialization2.Insert(new SCR_PlayerDataSpecializationDisplay(SCR_ESpecialization2Display.SALINE_FRIENDLIES, SCR_EDataStats.SALINE_FRIENDLIES, "#AR-CareerProfile_SelinesAllies", "#AR-CareerProfile_Times"));
359  m_aSpecialization2.Insert(new SCR_PlayerDataSpecializationDisplay(SCR_ESpecialization2Display.MORPHINE_SELF, SCR_EDataStats.MORPHINE_SELF, "#AR-CareerProfile_MorphinesSelf", "#AR-CareerProfile_Times"));
360  m_aSpecialization2.Insert(new SCR_PlayerDataSpecializationDisplay(SCR_ESpecialization2Display.MORPHINE_FRIENDLIES, SCR_EDataStats.MORPHINE_FRIENDLIES, "#AR-CareerProfile_MorphinesAllies", "#AR-CareerProfile_Times"));
361 
362  typename tEnum = SCR_ECareerSp;
363  SPECIALIZATIONS_COUNT = tEnum.GetVariableCount();
364 
366  SPECIALIZATION_0_COUNT = tEnum.GetVariableCount();
367 
369  SPECIALIZATION_1_COUNT = tEnum.GetVariableCount();
370 
372  SPECIALIZATION_2_COUNT = tEnum.GetVariableCount();
373 
374  if (m_aSpecialization0.Count() != SPECIALIZATION_0_COUNT)
375  Print("Error in PlayerDataConfigs: Weird size on specialization0 array", LogLevel.ERROR);
376 
377  if (m_aSpecialization1.Count() != SPECIALIZATION_1_COUNT)
378  Print("Error in PlayerDataConfigs: Weird size on specialization1 array", LogLevel.ERROR);
379 
380  if (m_aSpecialization2.Count() != SPECIALIZATION_2_COUNT)
381  Print("Error in PlayerDataConfigs: Weird size on specialization2 array", LogLevel.ERROR);
382 
383  LoadJson();
384  }
385 };
386 
387 //Don't change the orders of any of these enums please, we are using their position as an id
388 //------------------------------------------------------------------------------------------------
390 {
394 };
395 
396 //------------------------------------------------------------------------------------------------
398 {
403 };
404 
405 //------------------------------------------------------------------------------------------------
407 {
411 };
412 
413 //------------------------------------------------------------------------------------------------
415 {
424 };
TOURNIQUET_FRIENDLIES
@ TOURNIQUET_FRIENDLIES
Definition: SCR_PlayerDataConfigs.c:419
PLAYER_KILLS
@ PLAYER_KILLS
Definition: SCR_PlayerDataConfigs.c:400
AI_KILLS
@ AI_KILLS
Definition: SCR_PlayerDataConfigs.c:401
MORPHINE_FRIENDLIES
@ MORPHINE_FRIENDLIES
Definition: SCR_PlayerDataConfigs.c:423
POINTS_DRIVING_PEOPLE
@ POINTS_DRIVING_PEOPLE
Definition: SCR_PlayerDataConfigs.c:410
GetGame
ArmaReforgerScripted GetGame()
Definition: game.c:1424
JsonApiStruct
Parameters for joining server.
Definition: FeedbackDialogUI.c:2
SCR_ECareerSp
SCR_ECareerSp
Definition: SCR_PlayerDataConfigs.c:389
DISTANCE_DRIVEN
@ DISTANCE_DRIVEN
Definition: SCR_PlayerDataConfigs.c:408
DISTANCE_AS_OCCUPANT
@ DISTANCE_AS_OCCUPANT
Definition: SCR_PlayerDataConfigs.c:409
SCR_ESpecialization0Display
SCR_ESpecialization0Display
Definition: SCR_PlayerDataConfigs.c:397
SALINE_FRIENDLIES
@ SALINE_FRIENDLIES
Definition: SCR_PlayerDataConfigs.c:421
SCR_PlayerDataSpecializationDisplay
Definition: SCR_PlayerDataSpecializationDisplay.c:2
DISTANCE_WALKED
@ DISTANCE_WALKED
Definition: SCR_PlayerDataConfigs.c:399
SCR_ESpecialization1Display
SCR_ESpecialization1Display
Definition: SCR_PlayerDataConfigs.c:406
SCR_PlayerDataConfigs
Definition: SCR_PlayerDataConfigs.c:102
INFANTRY
@ INFANTRY
Definition: SCR_PlayerDataConfigs.c:391
MORPHINE_SELF
@ MORPHINE_SELF
Definition: SCR_PlayerDataConfigs.c:422
BANDAGE_FRIENDLIES
@ BANDAGE_FRIENDLIES
Definition: SCR_PlayerDataConfigs.c:417
TOURNIQUET_SELF
@ TOURNIQUET_SELF
Definition: SCR_PlayerDataConfigs.c:418
BANDAGE_SELF
@ BANDAGE_SELF
Definition: SCR_PlayerDataConfigs.c:416
LOGISTICS
@ LOGISTICS
Definition: SCR_PlayerDataConfigs.c:392
SALINE_SELF
@ SALINE_SELF
Definition: SCR_PlayerDataConfigs.c:420
SCR_BanSettings
Settings item.
Definition: SCR_PlayerDataConfigs.c:7
SCR_ESpecialization2Display
SCR_ESpecialization2Display
Definition: SCR_PlayerDataConfigs.c:414
SCR_EDataStats
SCR_EDataStats
Definition: SCR_PlayerData.c:950
SHOTS
@ SHOTS
Definition: SCR_PlayerDataConfigs.c:402
MEDICAL
@ MEDICAL
Definition: SCR_PlayerDataConfigs.c:393
SCR_BanSettingsContainer
Definition: SCR_PlayerDataConfigs.c:61