Arma Reforger Explorer 1.7.0.54
Arma Reforger Code Explorer by Zeroy - Thanks to MisterOutofTime
Loading...
Searching...
No Matches
SCR_PlayerDataConfigs.c
Go to the documentation of this file.
1
2// -----------------------------------------------------------------------------
4// -----------------------------------------------------------------------------
5
6//------------------------------------------------------------------------------------------------
7class SCR_BanSettings : JsonApiStruct
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;
65
66 //------------------------------------------------------------------------------------------------
67 string GetDesc()
68 {
69 return m_sDesc;
70 }
71
72 //------------------------------------------------------------------------------------------------
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 //------------------------------------------------------------------------------------------------
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//------------------------------------------------------------------------------------------------
102class 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
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
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;
149 static const int MODIFIER_PLAYERS_DIED_IN_VEHICLE = 500;
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
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 //------------------------------------------------------------------------------------------------
209 {
210 return m_BanSettings.GetBanSettings().m_fScoreThreshold;
211 }
212
213 //------------------------------------------------------------------------------------------------
215 {
216 return m_BanSettings.GetBanSettings().m_fScoreDecreasePerMinute;
217 }
218
219 //------------------------------------------------------------------------------------------------
221 {
222 return m_BanSettings.GetBanSettings().m_fScoreDecreasePerMinute / 60;
223 }
224
225 //------------------------------------------------------------------------------------------------
227 {
228 return m_BanSettings.GetBanSettings().m_fScoreMultiplier;
229 }
230
231 //------------------------------------------------------------------------------------------------
233 {
234 return m_BanSettings.GetBanSettings().m_fAccelerationMin;
235 }
236
237 //------------------------------------------------------------------------------------------------
239 {
240 return m_BanSettings.GetBanSettings().m_fAccelerationMax;
241 }
242
243 //------------------------------------------------------------------------------------------------
245 {
246 return m_BanSettings.GetBanSettings().m_fBanEvaluationLight;
247 }
248
249 //------------------------------------------------------------------------------------------------
251 {
252 return m_BanSettings.GetBanSettings().m_fBanEvaluationHeavy;
253 }
254
255 //------------------------------------------------------------------------------------------------
257 {
258 return m_BanSettings.GetBanSettings().m_fCrimePtFriendKill;
259 }
260
261 //------------------------------------------------------------------------------------------------
263 {
264 return m_BanSettings.GetBanSettings().m_fCrimePtTeamKill;
265 }
266
267 //------------------------------------------------------------------------------------------------
269 {
270 return m_BanSettings.GetBanSettings().m_fQualityTimeTemp;
271 }
272
273 //------------------------------------------------------------------------------------------------
275 {
276 return m_BanSettings.GetBanSettings().m_bVotingSuggestionEnabled >= 1;
277 }
278
279 //------------------------------------------------------------------------------------------------
281 {
282 return m_BanSettings.GetDesc();
283 }
284
285 //------------------------------------------------------------------------------------------------
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 //------------------------------------------------------------------------------------------------
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
375 Print("Error in PlayerDataConfigs: Weird size on specialization0 array", LogLevel.ERROR);
376
378 Print("Error in PlayerDataConfigs: Weird size on specialization1 array", LogLevel.ERROR);
379
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//------------------------------------------------------------------------------------------------
395
396//------------------------------------------------------------------------------------------------
404
405//------------------------------------------------------------------------------------------------
412
413//------------------------------------------------------------------------------------------------
ArmaReforgerScripted GetGame()
Definition game.c:1398
SCR_EDataStats
@ SALINE_FRIENDLIES
Number of times player salined friendlies (not including themself).
@ BANDAGE_FRIENDLIES
Number of times player bandaged friendlies (not including themself).
@ SHOTS
Bullets shot.
@ MORPHINE_FRIENDLIES
Number of times player morphined friendlies (not including themself).
@ SALINE_SELF
Number of times player salined themself.
@ MORPHINE_SELF
Number of times player morphined themself.
@ AI_KILLS
AI enemies killed.
@ BANDAGE_SELF
Number of times player bandaged themself.
@ TOURNIQUET_SELF
Number of times player tourniquetted themself.
@ DISTANCE_DRIVEN
Distance driven with a vehicle.
@ DISTANCE_AS_OCCUPANT
Distance the player was driven around with a vehicle.
@ TOURNIQUET_FRIENDLIES
Number of times player tourniquetted friendlies (not including themself).
@ DISTANCE_WALKED
Distance walked on foot.
SCR_ESpecialization2Display
SCR_ESpecialization0Display
SCR_ESpecialization1Display
@ POINTS_DRIVING_PEOPLE
override void Log()
base classes for filtering in server browser
ref SCR_BanSettings m_BanSettings
ref array< ref SCR_PlayerDataSpecializationDisplay > m_aSpecialization0
static const float MODIFIER_TOURNIQUET_SELF
static const int XP_NEEDED_FOR_RANK_DIVIDER
static const float MetersToKilometersConversion
static const float MODIFIER_PRECISION
static ref const array< int > INTERVALS_END
static const float MODIFIER_BANDAGE_SELF
static ref const array< int > INTERVALS_ORIGIN
static SCR_PlayerDataConfigs GetInstance()
static const float SPPOINTS_CONVERSIONPERCENTAGE
static ref const array< float > INTERVALS_C1
ref array< ref SCR_PlayerDataSpecializationDisplay > m_aSpecialization2
static const float MODIFIER_SALINE_FRIENDLIES
static const float MODIFIER_TRAVELED_DISTANCE_SUPPLY_VEHICLE
static const float MODIFIER_MORPHINE_SELF
static const int XP_NEEDED_FOR_RANK
static const float MODIFIER_BANDAGE_FRIENDLIES
static const float MODIFIER_DRIVER_OF_PLAYERS
static const float MODIFIER_AI_KILLS
static const float MODIFIER_TRAVEL_TIME_SUPPLY_VEHICLE
static ref SCR_BanSettingsContainer m_BanSettings
static const int MAX_PLAYERS_DIED_IN_VEHICLE_PENALTY
static ref SCR_PlayerDataConfigs instance
static const int MODIFIER_PLAYERS_DIED_IN_VEHICLE
static const float MODIFIER_TOURNIQUET_FRIENDLIES
static const float MODIFIER_SPECIALIZATIONS
static const float MODIFIER_DISTANCE_WALKED
static const float MODIFIER_KILLS
static const float MODIFIER_DISTANCE_DRIVEN
static const float WARCRIMES_PUNISHMENT
static const int XP_NEEDED_FOR_LEVEL
array< ref SCR_PlayerDataSpecializationDisplay > GetSpecializationArray(int n)
static const float MAX_WARCRIMES_VALUE
static const int XP_NEEDED_FOR_LEVEL_DIVIDER
static const float MODIFIER_SALINE_SELF
static const float STD_POINTS_QUALITY_TIME
static ref const array< float > INTERVALS_C2
static const float MODIFIER_MORPHINE_FRIENDLIES
ref array< ref SCR_PlayerDataSpecializationDisplay > m_aSpecialization1
static const float WARCRIMES_DECREASE_PER_HOUR
proto void Print(void var, LogLevel level=LogLevel.NORMAL)
Prints content of variable to console/log.
LogLevel
Enum with severity of the logging message.
Definition LogLevel.c:14