Dayz Explorer 1.29.162510
Loading...
Searching...
No Matches
bioslobbyservice.c
Go to the documentation of this file.
1// ip, name, connection port, queryPort
2typedef Param4<string, string, int, int> CachedServerInfo;
3
4// JSON struct data for news articles
6{
8 int categoryID;
9
11 string dlcName;
12
14 string qrCodeImageUrl;
15
16 string date;
17 string excerpt;
18 string category;
19 string title;
20 string slug;
21 string coverImage;
22 string fullUrl;
23};
24
29
30// Script File
31
44
50
52{
53 static ref ServerBrowserHelperFunctions s_ServerBrowserHelperFunctions;
54 protected static const string CHERNARUS_MAP_IMAGE = ""; // placeholder image path
55 protected static const string LIVONIA_MAP_IMAGE = ""; // placeholder image path
56 protected static const string SAKHAL_MAP_IMAGE = ""; // placeholder image path
57 protected static const string LOWERCASE_ALPHABET = "abcdefghijklmnopqrstuvwxyz"; // used for temporary hotfix
59
61 {
62 INTERNAL_MAP_NAMES.Insert("chernarusplus", "Chernarus");
63 INTERNAL_MAP_NAMES.Insert("enoch", "Livonia");
64 INTERNAL_MAP_NAMES.Insert("sakhal", "Sakhal");
65 }
66
67 // Use this function to add maps to the server browser map filter options
68 static void AddMapInfo(string mapName, string mapDisplayName)
69 {
70 string mdn;
71 if (!INTERNAL_MAP_NAMES.Find(mapName, mdn))
72 INTERNAL_MAP_NAMES.Insert(mapName, mapDisplayName);
73 }
74
75 // Returns internal map name (mission world name) depending on given map display name if it can be fetched from CfgWorlds config.
76 static string GetInternalMapName(string mapName)
77 {
78 string internalMapName;
79 foreach (string mn, string mdp: INTERNAL_MAP_NAMES)
80 {
81 if (mdp == mapName)
82 {
83 internalMapName = mn;
84 break;
85 }
86 }
87
88 return internalMapName;
89 }
90
91 // Returns map display name depending on given internal map name (mission world name).
92 static string GetMapDisplayName(string mapName)
93 {
94 string displayMapName;
95 string internalMapName = mapName;
96 internalMapName.ToLower();
97
98 foreach (string mn, string mdp: INTERNAL_MAP_NAMES)
99 {
100 if (mn == internalMapName)
101 {
102 displayMapName = mdp;
103 break;
104 }
105 }
106
107 if (displayMapName == "")
108 {
109 displayMapName = mapName;
110 string fc = displayMapName[0];
111 if (fc != "")
112 {
113 // temporary fix for VME until fixed internaly
114 if (LOWERCASE_ALPHABET.IndexOf(fc) > -1)
115 {
116 fc.ToUpper();
117 }
118
119 displayMapName[0] = fc;
120 }
121 }
122
123 return displayMapName;
124 }
125
126 // Returns map image texture path depending on given internal map name (mission world name).
127 static string GetServerMapImagePath(string mapName)
128 {
129 string image;
130 mapName.ToLower();
131 switch (mapName)
132 {
133 case "enoch":
134 {
135 image = LIVONIA_MAP_IMAGE;
136 break;
137 }
138 case "chernarusplus":
139 {
140 image = CHERNARUS_MAP_IMAGE;
141 break;
142 }
143 case "sakhal":
144 {
145 image = SAKHAL_MAP_IMAGE;
146 break;
147 }
148 }
149
150 return image;
151 }
152
154 {
155 if (!s_ServerBrowserHelperFunctions)
156 s_ServerBrowserHelperFunctions = new ServerBrowserHelperFunctions;
157
158 return s_ServerBrowserHelperFunctions;
159 }
160}
161
162class GetServerModListResult
163{
164 string m_Id; // server id (IP:Port)
166}
167
170{
171 string m_Id; // PC is IP:Port
172 int m_Priority; // PC something is working -> 667223046
173 string m_Name; // PC is name of server
174 string m_Description; // PC not work
175 string m_HostIp; // PC not work
176 int m_HostPort; // PC is works
177 bool m_Invisible;
178 bool m_Official;
179 string m_MapNameToRun; // map that server is running: "enoch" for Livonia, "chernarusplus" for Chernarus, "sakhal" for Sakhal
180 bool m_Modded; // specifies whether a PC server uses mods
181 int m_ModeId; // identifies if third person is allowed on a CONSOLE server. On PC always 0
182 bool m_AntiCheat;
183 int m_RegionId; // PC not work always 0
184 int m_MinPlayers;
185 int m_MaxPlayers; // PC - max players
186 int m_FreeSlots; // PC - max players
187 int m_CurrentNumberPlayers;
188 int m_PlayersInQueue;
189 string m_GameVersion; // PC not work alway ""
190 bool m_IsPasswordProtected; // PC work
191 string m_CreatedAt;
192 string m_UpdatedAt;
193 bool m_MouseAndKeyboardEnabled;
194 bool m_WhitelistEnabled;
195 bool m_IsDLC;
196
197 //Scripted
198 bool m_IsExpanded;
199 int m_SortName;
200 int m_SortTime;
201 bool m_IsSelected;
202
203 //characters alive
204 string m_CharactersAlive;
205 //steam friends - list of names separated by comma
206 string m_SteamFriends;
207
208 int m_Ping;
209 string m_TimeOfDay;
211 int m_Disable3rdPerson; //1 for disabled, ie. hardcore
213 float m_EnvironmentTimeMul;
214 float m_EnvironmentNightTimeMul;
215 bool m_AllowedFilePatching;
216 string m_ShardId;
217 int m_SteamQueryPort;
218
219 bool m_Favorite;
220
221 string GetIpPort()
222 {
223#ifdef PLATFORM_WINDOWS
224 return m_Id;
225#else
226 return GetIP() + ":" + m_HostPort;
227#endif
228 }
229
230 string GetIP()
231 {
232#ifdef PLATFORM_WINDOWS
233 // Hack - In new Serverborwser on PC has bad m_HostIp but ID contains correct IP
234 array<string> parts = new array<string>;
235 m_Id.Split(":", parts);
236 return parts[0];
237#else
238 return m_HostIp;
239#endif
240 }
241
242 bool IsSelected()
243 {
244 return m_IsSelected;
245 }
246
247 string GetValueStr(ESortType sort_type)
248 {
249 switch( sort_type )
250 {
251 case ESortType.HOST:
252 {
253 return m_Name;
254 }
255
256 case ESortType.MAP:
257 {
258 // m_MapNameToRun should never be a empty string but just in case we check before getting the map display name
259 if (m_MapNameToRun != "")
260 return ServerBrowserHelperFunctions.GetMapDisplayName(m_MapNameToRun);
261 }
262 }
263
264 return "";
265 }
266
267 int GetValueInt(ESortType sort_type)
268 {
269 switch( sort_type )
270 {
271 case ESortType.TIME:
272 {
273 return m_SortTime;
274 }
275 case ESortType.POPULATION:
276 {
277 return m_CurrentNumberPlayers;
278 }
279 case ESortType.SLOTS:
280 {
281 return m_MaxPlayers;
282 }
283 case ESortType.PING:
284 {
285 return m_Ping;
286 }
287 case ESortType.QUEUE:
288 {
289 return m_PlayersInQueue;
290 }
291 }
292 return 0;
293 }
294
295 // Returns 0 if values are equal,
296 // a positive number if this entry is "greater than" other,
297 // and a negative number if this entry is "less than" other
298 int CompareTo(GetServersResultRow other, ESortType sortType)
299 {
300 // string comparison
301 if (sortType == ESortType.HOST || sortType == ESortType.MAP)
302 {
303 string val1 = this.GetValueStr(sortType);
304 string val2 = other.GetValueStr(sortType);
305
306 if (val1 == val2)
307 return 0;
308
309 if (val1 < val2)
310 return 1;
311
312 return -1;
313 }
314
315 // int comparison
316 int comparisonResult = other.GetValueInt(sortType) - this.GetValueInt(sortType);
317 if (comparisonResult == 0)
318 {
319 // if sorting by POPULATION, break ties using QUEUE size
320 if (sortType == ESortType.POPULATION)
321 {
322 comparisonResult = this.CompareTo(other, ESortType.QUEUE);
323 }
324 }
325
326 return comparisonResult;
327 }
328};
329
330
332
337
340{
341 bool m_Official;
342 string m_GameVersion;
343 int m_RegionId;
344
345 bool m_UseOfficial;
346 bool m_UseGameVersion;
347 bool m_UseRegionId;
348
349 void SetOfficial( bool Official )
350 {
351 m_Official = Official;
352 m_UseOfficial = true;
353 }
354
355 void SetGameVersion( string GameVersion )
356 {
357 m_GameVersion = GameVersion;
358 m_UseGameVersion = true;
359 }
360
361 void SetRegionId( int RegionId )
362 {
363 m_RegionId = RegionId;
364 m_UseRegionId = true;
365 }
366};
367
370{
371 int m_Page;
372 int m_Pages;
373 ref GetServersResultRowArray m_Results;
374
375 int m_NumServers;
376};
377
380{
381 bool m_AntiCheat;
382 int m_RowsPerPage;
383 string m_SortBy; //na of property
384 ESortOrder m_SortOrder;
385 string m_Name;
386 string m_GameType;
387 int m_Platform; // 1 - PC, 2 - xbox, 3 - PSN
388 int m_ModeId; // identifies if third person is allowed on a CONSOLE server. On PC always 0
389 int m_Page;
390 string m_GameVersion;
391 bool m_Official;
392 bool m_Joinable;
393 string m_MapNameToRun;
394 bool m_IsModded;
395 int m_MinPlayers; // minimum 1
396 int m_MaxPlayers; // maximum 99
397 bool m_IsPasswordProtected;
398 int m_RegionId; // 1 - Americas, 2 - Europe, 3 - Asia
399 int m_Priority;
400 int m_FreeSlotsMin;
401 int m_FreeSlotsMax;
402 string m_HostIp;
403 int m_HostPort;
404 string m_FavoriteServers;
405 bool m_MouseAndKeyboardEnabled;
406 bool m_WhitelistEnabled;
407 bool m_IsDLC;
408
409 bool m_UseAntiCheat;
410 bool m_UseName;
411 bool m_UseGameType;
412 bool m_UseModeId;
413 bool m_UseGameVersion;
414 bool m_UseOfficial;
415 bool m_UseJoinable;
416 bool m_UseMapNameToRun;
417 bool m_UseIsModded;
418 bool m_UseMinPlayers;
419 bool m_UseMaxPlayers;
420 bool m_UseIsPasswordProtected;
421 bool m_UseRegionId;
422 bool m_UsePriority;
423 bool m_UseFreeSlotsMin;
424 bool m_UseFreeSlotsMax;
425 bool m_UseHostIp;
426 bool m_UseHostPort;
427 bool m_UseHostIps;
428 bool m_UseMouseAndKeyboardEnabled;
429 bool m_UseWhitelistEnabled;
430 bool m_UseIsDLC;
431
432 void SetAntiCheatFilter( bool anti_cheat )
433 {
434 m_AntiCheat = anti_cheat;
435 m_UseAntiCheat = true;
436 }
437
438 void SetNameFilter( string name )
439 {
440 m_Name = name;
441 m_UseName = true;
442 }
443
444 void SetGameTypeFilter( string game_type )
445 {
446 m_GameType = game_type;
447 m_UseGameType = true;
448 }
449
450 void SetModeIdFilter( int mode_id )
451 {
452 m_ModeId = mode_id;
453 m_UseModeId = true;
454 }
455
456 void SetGameVersionFilter( string game_version )
457 {
458 m_GameVersion = game_version;
459 m_UseGameVersion = true;
460 }
461
462 void SetOfficialFilter( bool official )
463 {
464 m_Official = official;
465 m_UseOfficial = true;
466 }
467
468 void SetJoinableFilter( bool joinable )
469 {
470 m_Joinable = joinable;
471 m_UseJoinable = true;
472 }
473
474 void SetMapNameToRun( string mapNameToRun )
475 {
476 m_MapNameToRun = mapNameToRun;
477 m_UseMapNameToRun = true;
478 }
479
480 void SetIsModdedFilter( bool is_modded )
481 {
482 m_IsModded = is_modded;
483 m_UseIsModded = true;
484 }
485
486 void SetMinPlayersFilter( int min_players )
487 {
488 m_MinPlayers = min_players;
489 m_UseMinPlayers = true;
490 }
491
492 void SetMaxPlayersFilter( int max_players )
493 {
494 m_MaxPlayers = max_players;
495 m_UseMaxPlayers = true;
496 }
497
498 void SetIsPasswordProtectedFilter( bool password_protected )
499 {
500 m_IsPasswordProtected = password_protected;
501 m_UseIsPasswordProtected = true;
502 }
503
504 void SetRegionIdFilter( int region )
505 {
506 m_RegionId = region;
507 m_UseRegionId = true;
508 }
509
510 void SetPriorityFilter( int priority )
511 {
512 m_Priority = priority;
513 m_UsePriority = true;
514 }
515
516 void SetFreeSlotsMin( int freeSlotsMin )
517 {
518 m_FreeSlotsMin = freeSlotsMin;
519 m_UseFreeSlotsMin = true;
520 }
521
522 void SetFreeSlotsMax( int freeSlotsMax )
523 {
524 m_FreeSlotsMax = freeSlotsMax;
525 m_UseFreeSlotsMax = true;
526 }
527
528 void SetHostIp( string hostIp )
529 {
530 m_HostIp = hostIp;
531 m_UseHostIp = true;
532 }
533
534 void SetHostPort( int hostPort )
535 {
536 m_HostPort = hostPort;
537 m_UseHostPort = true;
538 }
539
540 void SetMouseAndKeyboardEnabled(bool enabledMouseAndKeyboard)
541 {
542 m_MouseAndKeyboardEnabled = enabledMouseAndKeyboard;
543 m_UseMouseAndKeyboardEnabled = true;
544 }
545
546 void SetFavorited( bool show )
547 {
548 m_SortBy += "F";
549 AddShow( show );
550
551 }
552
553 void SetFriendsPlaying( bool show )
554 {
555 m_SortBy += "P";
556 AddShow( show );
557 }
558
559 void SetPreviouslyPlayed( bool show )
560 {
561 m_SortBy += "R";
562 AddShow( show );
563 }
564
565 void SetProperVersionMatch( bool show )
566 {
567 m_SortBy += "V";
568 AddShow( show );
569 }
570
571 void SetFullServer( bool show )
572 {
573 m_SortBy += "S";
574 AddShow( show );
575 }
576
577 void SetThirdPerson( bool show )
578 {
579 m_SortBy += "3";
580 AddShow( show );
581 }
582
583 void SetPublic( bool show )
584 {
585 m_SortBy += "L";
586 AddShow( show );
587 }
588
589 void SetAcceleratedTime( bool show )
590 {
591 m_SortBy += "A";
592 AddShow( show );
593 }
594
595 void SetAllowedFilePatching( bool show )
596 {
597 m_SortBy += "7";
598 AddShow( show );
599 }
600
601 void SetLAN()
602 {
603 m_SortBy += "N";
604 }
605
606 void SetPingFilter( int pingMaxValue )
607 {
608 m_SortBy += "M" + pingMaxValue + ";";
609 }
610
611 void SetBattleyeProtection(bool show)
612 {
613 m_SortBy += "B";
614 AddShow(show);
615 }
616
617 void SetPassworded(bool show)
618 {
619 m_SortBy += "C";
620 AddShow(show);
621 }
622
623 void AddShow( bool show )
624 {
625 if( show )
626 m_SortBy += "+";
627 else
628 m_SortBy += "-";
629 }
630
631 void AddFavourite(string ip, int port)
632 {
633 m_FavoriteServers += ip + ";" + port + ";";
634 }
635
636 void SetWhitelistEnabled(bool whitelistEnabled)
637 {
638 m_WhitelistEnabled = whitelistEnabled;
639 m_UseWhitelistEnabled = true;
640
641 m_SortBy += "W";
642 AddShow(whitelistEnabled);
643 }
644
645 void SetIsDLC(bool isDLC)
646 {
647 m_IsDLC = isDLC;
648 m_UseIsDLC = true;
649
650 m_SortBy += "D";
651 AddShow(isDLC);
652 }
653};
654
656{
658
667 proto native EBiosError GetServers(GetServersInput inputValues);
668
670
674 proto native EBiosError GetFirstServerWithEmptySlot(GetFirstServerWithEmptySlotInput inputValues);
675
676 proto native void AddServerFavorite(string ipAddress, int port, int steamQueryPort);
677 proto native void RemoveServerFavorite(string ipAddress, int port, int steamQueryPort);
678 proto native void GetFavoriteServers(TStringArray favServers);
679
681
684 proto native void GetCachedFavoriteServerInfo(array<ref CachedServerInfo> favServersInfoCache);
685
689 proto native EBiosError GetServerModList(string serverId);
690
692
697
698 void OnDoneAsync(GetServersResult result_list, EBiosError error, string response)
699 {
700 /*
701 if (result_list.m_Results != null && result_list.m_Results.Count() > 0)
702 Print(result_list.m_Results[0].m_TimeOfDay);
703 */
704 OnlineServices.OnLoadServersAsync( result_list, error, response );
705 }
706
707 void OnGetFirstServerWithEmptySlot(GetFirstServerWithEmptySlotResult result_list, EBiosError error)
708 {
709 OnlineServices.OnAutoConnectToEmptyServer( result_list, error );
710 }
711
713 void OnServerModList(GetServerModListResult result_list, EBiosError error)
714 {
715 OnlineServices.OnGetServerModList( result_list, error );
716 }
717};
EBiosError
Possible Error codes for bios API. This is the list of errors that can be returned from bios API....
ESortOrder
@ ASCENDING
@ DESCENDING
ESortType
@ QUEUE
@ HOST
@ MAP
@ PASSWORDED
@ SLOTS
@ POPULATION
@ FAVORITE
class ServerBrowserHelperFunctions m_Id
array< string > m_Mods
array< ref GetServersResultRow > GetServersResultRowArray
Param4< string, string, int, int > CachedServerInfo
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
GetServersInput the input structure of the GetServers operation.
GetServersInput the input structure of the GetServers operation.
GetServersResult the output structure of the GetServers operation.
GetServersResultRow the output structure of the GetServers operation that represents one game server.
TODO doc.
Definition enscript.c:118
TODO doc.
Definition enscript.c:123
static void OnLoadServersAsync(GetServersResult result_list, EBiosError error, string response)
static void OnGetServerModList(GetServerModListResult result_list, EBiosError error)
static void OnAutoConnectToEmptyServer(GetFirstServerWithEmptySlotResult result_list, EBiosError error)
static void AddMapInfo(string mapName, string mapDisplayName)
static string GetServerMapImagePath(string mapName)
static const string SAKHAL_MAP_IMAGE
static ref map< string, string > INTERNAL_MAP_NAMES
static ServerBrowserHelperFunctions GetInstance()
static const string LIVONIA_MAP_IMAGE
static string GetMapDisplayName(string mapName)
static const string LOWERCASE_ALPHABET
static const string CHERNARUS_MAP_IMAGE
static string GetInternalMapName(string mapName)
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
@ PING
array< string > TStringArray
Definition enscript.c:712