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