Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
bioslobbyservice.c
Go to the documentation of this file.
1 // ip, name, connection port, queryPort
2 typedef Param4<string, string, int, int> CachedServerInfo;
3 
4 // Script File
5 
7 {
8  HOST,
9  TIME,
12  PING
16 };
17 
19 {
22 };
23 
25 {
26  string m_Id; // server id (IP:Port)
27  array<string> m_Mods;
28 }
29 
31 class GetServersResultRow
32 {
33  string m_Id; // PC is IP:Port
34  int m_Priority; // PC something is working -> 667223046
35  string m_Name; // PC is name of server
36  string m_Description; // PC not work
37  string m_HostIp; // PC not work
38  int m_HostPort; // PC is works
40  bool m_Official;
41  string m_MapNameToRun; // PC not work always 0
42  bool m_Modded; // PC not work always 0
43  int m_ModeId; // identifies if third person is allowed on a CONSOLE server. On PC always 0
45  int m_RegionId; // PC not work always 0
47  int m_MaxPlayers; // PC - max players
48  int m_FreeSlots; // PC - max players
51  string m_GameVersion; // PC not work alway ""
52  bool m_IsPasswordProtected; // PC work
53  string m_CreatedAt;
54  string m_UpdatedAt;
57  bool m_IsDLC;
58 
59  //Scripted
61  int m_SortName;
64 
65  //characters alive
67  //steam friends - list of names separated by comma
69 
70  int m_Ping;
71  string m_TimeOfDay;
73  int m_Disable3rdPerson; //1 for disabled, ie. hardcore
78  string m_ShardId;
80 
81  bool m_Favorite;
82 
83  string GetIpPort()
84  {
85 #ifdef PLATFORM_WINDOWS
86  return m_Id;
87 #else
88  return GetIP() + ":" + m_HostPort;
89 #endif
90  }
91 
92  string GetIP()
93  {
94 #ifdef PLATFORM_WINDOWS
95  // Hack - In new Serverborwser on PC has bad m_HostIp but ID contains correct IP
96  array<string> parts = new array<string>;
97  m_Id.Split(":", parts);
98  return parts[0];
99 #else
100  return m_HostIp;
101 #endif
102  }
103 
104  bool IsSelected()
105  {
106  return m_IsSelected;
107  }
108 
109  string GetValueStr(ESortType sort_type)
110  {
111  switch( sort_type )
112  {
113  case ESortType.HOST:
114  {
115  return m_Name;
116  }
117  }
118 
119  return "";
120  }
121 
122  int GetValueInt(ESortType sort_type)
123  {
124  switch( sort_type )
125  {
126  case ESortType.TIME:
127  {
128  return m_SortTime;
129  }
130  case ESortType.POPULATION:
131  {
132  return m_CurrentNumberPlayers;
133  }
134  case ESortType.SLOTS:
135  {
136  return m_MaxPlayers;
137  }
138  case ESortType.PING:
139  {
140  return m_Ping;
141  }
142  case ESortType.QUEUE:
143  {
144  return m_PlayersInQueue;
145  }
146  }
147  return 0;
148  }
149 
150  // Returns 0 if values are equal,
151  // a positive number if this entry is "greater than" other,
152  // and a negative number if this entry is "less than" other
153  int CompareTo(GetServersResultRow other, ESortType sortType)
154  {
155  // string comparison
156  if (sortType == ESortType.HOST)
157  {
158  string val1 = this.GetValueStr(ESortType.HOST);
159  string val2 = other.GetValueStr(ESortType.HOST);
160 
161  if (val1 == val2)
162  return 0;
163 
164  if (val1 < val2)
165  return 1;
166 
167  return -1;
168  }
169 
170  // int comparison
171  int comparisonResult = other.GetValueInt(sortType) - this.GetValueInt(sortType);
172  if (comparisonResult == 0)
173  {
174  // if sorting by POPULATION, break ties using QUEUE size
175  if (sortType == ESortType.POPULATION)
176  {
177  comparisonResult = this.CompareTo(other, ESortType.QUEUE);
178  }
179  }
180 
181  return comparisonResult;
182  }
183 };
184 
185 
187 
189 {
190  GetServersResult m_Result;
191 };
192 
195 {
196  bool m_Official;
197  string m_GameVersion;
198  int m_RegionId;
199 
200  bool m_UseOfficial;
201  bool m_UseGameVersion;
202  bool m_UseRegionId;
203 
204  void SetOfficial( bool Official )
205  {
206  m_Official = Official;
207  m_UseOfficial = true;
208  }
209 
210  void SetGameVersion( string GameVersion )
211  {
212  m_GameVersion = GameVersion;
213  m_UseGameVersion = true;
214  }
215 
216  void SetRegionId( int RegionId )
217  {
218  m_RegionId = RegionId;
219  m_UseRegionId = true;
220  }
221 };
222 
225 {
226  int m_Page;
227  int m_Pages;
228  ref GetServersResultRowArray m_Results;
229 
230  int m_NumServers;
231 };
232 
235 {
236  bool m_AntiCheat;
237  int m_RowsPerPage;
238  string m_SortBy; //na of property
239  ESortOrder m_SortOrder;
240  string m_Name;
241  string m_GameType;
242  int m_Platform; // 1 - PC, 2 - xbox, 3 - PSN
243  int m_ModeId; // identifies if third person is allowed on a CONSOLE server. On PC always 0
244  int m_Page;
245  string m_GameVersion;
246  bool m_Official;
247  bool m_Joinable;
248  string m_MapNameToRun;
249  bool m_IsModded;
250  int m_MinPlayers; // minimum 1
251  int m_MaxPlayers; // maximum 99
252  bool m_IsPasswordProtected;
253  int m_RegionId; // 1 - Americas, 2 - Europe, 3 - Asia
254  int m_Priority;
255  int m_FreeSlotsMin;
256  int m_FreeSlotsMax;
257  string m_HostIp;
258  int m_HostPort;
259  string m_FavoriteServers;
260  bool m_MouseAndKeyboardEnabled;
261  bool m_WhitelistEnabled;
262  bool m_IsDLC;
263 
264  bool m_UseAntiCheat;
265  bool m_UseName;
266  bool m_UseGameType;
267  bool m_UseModeId;
268  bool m_UseGameVersion;
269  bool m_UseOfficial;
270  bool m_UseJoinable;
271  bool m_UseMapNameToRun;
272  bool m_UseIsModded;
273  bool m_UseMinPlayers;
274  bool m_UseMaxPlayers;
275  bool m_UseIsPasswordProtected;
276  bool m_UseRegionId;
277  bool m_UsePriority;
278  bool m_UseFreeSlotsMin;
279  bool m_UseFreeSlotsMax;
280  bool m_UseHostIp;
281  bool m_UseHostPort;
282  bool m_UseHostIps;
283  bool m_UseMouseAndKeyboardEnabled;
284  bool m_UseWhitelistEnabled;
285  bool m_UseIsDLC;
286 
287  void SetAntiCheatFilter( bool anti_cheat )
288  {
289  m_AntiCheat = anti_cheat;
290  m_UseAntiCheat = true;
291  }
292 
293  void SetNameFilter( string name )
294  {
295  m_Name = name;
296  m_UseName = true;
297  }
298 
299  void SetGameTypeFilter( string game_type )
300  {
301  m_GameType = game_type;
302  m_UseGameType = true;
303  }
304 
305  void SetModeIdFilter( int mode_id )
306  {
307  m_ModeId = mode_id;
308  m_UseModeId = true;
309  }
310 
311  void SetGameVersionFilter( string game_version )
312  {
313  m_GameVersion = game_version;
314  m_UseGameVersion = true;
315  }
316 
317  void SetOfficialFilter( bool official )
318  {
319  m_Official = official;
320  m_UseOfficial = true;
321  }
322 
323  void SetJoinableFilter( bool joinable )
324  {
325  m_Joinable = joinable;
326  m_UseJoinable = true;
327  }
328 
329  void SetMapNameToRun( string mapNameToRun )
330  {
331  m_MapNameToRun = mapNameToRun;
332  m_UseMapNameToRun = true;
333  }
334 
335  void SetIsModdedFilter( bool is_modded )
336  {
337  m_IsModded = is_modded;
338  m_UseIsModded = true;
339  }
340 
341  void SetMinPlayersFilter( int min_players )
342  {
343  m_MinPlayers = min_players;
344  m_UseMinPlayers = true;
345  }
346 
347  void SetMaxPlayersFilter( int max_players )
348  {
349  m_MaxPlayers = max_players;
350  m_UseMaxPlayers = true;
351  }
352 
353  void SetIsPasswordProtectedFilter( bool password_protected )
354  {
355  m_IsPasswordProtected = password_protected;
356  m_UseIsPasswordProtected = true;
357  }
358 
359  void SetRegionIdFilter( int region )
360  {
361  m_RegionId = region;
362  m_UseRegionId = true;
363  }
364 
365  void SetPriorityFilter( int priority )
366  {
367  m_Priority = priority;
368  m_UsePriority = true;
369  }
370 
371  void SetFreeSlotsMin( int freeSlotsMin )
372  {
373  m_FreeSlotsMin = freeSlotsMin;
374  m_UseFreeSlotsMin = true;
375  }
376 
377  void SetFreeSlotsMax( int freeSlotsMax )
378  {
379  m_FreeSlotsMax = freeSlotsMax;
380  m_UseFreeSlotsMax = true;
381  }
382 
383  void SetHostIp( string hostIp )
384  {
385  m_HostIp = hostIp;
386  m_UseHostIp = true;
387  }
388 
389  void SetHostPort( int hostPort )
390  {
391  m_HostPort = hostPort;
392  m_UseHostPort = true;
393  }
394 
395  void SetMouseAndKeyboardEnabled(bool enabledMouseAndKeyboard)
396  {
397  m_MouseAndKeyboardEnabled = enabledMouseAndKeyboard;
398  m_UseMouseAndKeyboardEnabled = true;
399  }
400 
401  void SetFavorited( bool show )
402  {
403  m_SortBy += "F";
404  AddShow( show );
405 
406  }
407 
408  void SetFriendsPlaying( bool show )
409  {
410  m_SortBy += "P";
411  AddShow( show );
412  }
413 
414  void SetPreviouslyPlayed( bool show )
415  {
416  m_SortBy += "R";
417  AddShow( show );
418  }
419 
420  void SetProperVersionMatch( bool show )
421  {
422  m_SortBy += "V";
423  AddShow( show );
424  }
425 
426  void SetFullServer( bool show )
427  {
428  m_SortBy += "S";
429  AddShow( show );
430  }
431 
432  void SetThirdPerson( bool show )
433  {
434  m_SortBy += "3";
435  AddShow( show );
436  }
437 
438  void SetPublic( bool show )
439  {
440  m_SortBy += "L";
441  AddShow( show );
442  }
443 
444  void SetAcceleratedTime( bool show )
445  {
446  m_SortBy += "A";
447  AddShow( show );
448  }
449 
450  void SetAllowedFilePatching( bool show )
451  {
452  m_SortBy += "7";
453  AddShow( show );
454  }
455 
456  void SetLAN()
457  {
458  m_SortBy += "N";
459  }
460 
461  void SetPingFilter( int pingMaxValue )
462  {
463  m_SortBy += "M" + pingMaxValue + ";";
464  }
465 
466  void SetBattleyeProtection(bool show)
467  {
468  m_SortBy += "B";
469  AddShow(show);
470  }
471 
472  void SetPassworded(bool show)
473  {
474  m_SortBy += "C";
475  AddShow(show);
476  }
477 
478  void AddShow( bool show )
479  {
480  if( show )
481  m_SortBy += "+";
482  else
483  m_SortBy += "-";
484  }
485 
486  void AddFavourite(string ip, int port)
487  {
488  m_FavoriteServers += ip + ";" + port + ";";
489  }
490 
491  void SetWhitelistEnabled(bool whitelistEnabled)
492  {
493  m_WhitelistEnabled = whitelistEnabled;
494  m_UseWhitelistEnabled = true;
495 
496  m_SortBy += "W";
497  AddShow(whitelistEnabled);
498  }
499 
500  void SetIsDLC(bool isDLC)
501  {
502  m_IsDLC = isDLC;
503  m_UseIsDLC = true;
504 
505  m_SortBy += "D";
506  AddShow(isDLC);
507  }
508 };
509 
511 {
513 
522  proto native EBiosError GetServers(GetServersInput inputValues);
523 
525 
529  proto native EBiosError GetFirstServerWithEmptySlot(GetFirstServerWithEmptySlotInput inputValues);
530 
531  proto native void AddServerFavorite(string ipAddress, int port, int steamQueryPort);
532  proto native void RemoveServerFavorite(string ipAddress, int port, int steamQueryPort);
533  proto native void GetFavoriteServers(TStringArray favServers);
534 
536 
539  proto native void GetCachedFavoriteServerInfo(array<ref CachedServerInfo> favServersInfoCache);
540 
544  proto native EBiosError GetServerModList(string serverId);
545 
547 
553  void OnDoneAsync(GetServersResult result_list, EBiosError error, string response)
554  {
555  /*
556  if (result_list.m_Results != null && result_list.m_Results.Count() > 0)
557  Print(result_list.m_Results[0].m_TimeOfDay);
558  */
559  OnlineServices.OnLoadServersAsync( result_list, error, response );
560  }
561 
562  void OnGetFirstServerWithEmptySlot(GetFirstServerWithEmptySlotResult result_list, EBiosError error)
563  {
564  OnlineServices.OnAutoConnectToEmptyServer( result_list, error );
565  }
566 
568  void OnServerModList(GetServerModListResult result_list, EBiosError error)
569  {
570  OnlineServices.OnGetServerModList( result_list, error );
571  }
572 };
DESCENDING
@ DESCENDING
Definition: bioslobbyservice.c:21
m_MinPlayers
int m_MinPlayers
Definition: bioslobbyservice.c:46
FAVORITE
@ FAVORITE
Definition: bioslobbyservice.c:13
GetValueStr
string GetValueStr(ESortType sort_type)
Definition: bioslobbyservice.c:109
m_Official
bool m_Official
Definition: bioslobbyservice.c:40
GetIP
string GetIP()
Definition: bioslobbyservice.c:92
m_CurrentNumberPlayers
int m_CurrentNumberPlayers
Definition: bioslobbyservice.c:49
m_EnvironmentTimeMul
float m_EnvironmentTimeMul
time multiplier of environment
Definition: bioslobbyservice.c:75
m_Priority
int m_Priority
Definition: bioslobbyservice.c:34
CachedServerInfo
Param4< string, string, int, int > CachedServerInfo
Definition: bioslobbyservice.c:2
m_ShardId
string m_ShardId
Definition: bioslobbyservice.c:78
m_Description
string m_Description
Definition: bioslobbyservice.c:36
m_IsPasswordProtected
bool m_IsPasswordProtected
Definition: bioslobbyservice.c:52
m_Disable3rdPerson
int m_Disable3rdPerson
disable3rdPerson servers for mode regular/hardcore
Definition: bioslobbyservice.c:73
m_Name
string m_Name
Definition: bioslobbyservice.c:35
m_MaxPlayers
int m_MaxPlayers
Definition: bioslobbyservice.c:47
BiosLobbyService
Definition: bioslobbyservice.c:510
m_RegionId
int m_RegionId
Definition: bioslobbyservice.c:45
m_HostIp
string m_HostIp
Definition: bioslobbyservice.c:37
m_HostPort
int m_HostPort
Definition: bioslobbyservice.c:38
HOST
@ HOST
Definition: bioslobbyservice.c:8
m_TimeOfDay
string m_TimeOfDay
Definition: bioslobbyservice.c:71
ESortType
ESortType
Definition: bioslobbyservice.c:6
m_ModeId
int m_ModeId
Definition: bioslobbyservice.c:43
PASSWORDED
@ PASSWORDED
Definition: bioslobbyservice.c:14
m_IsSelected
bool m_IsSelected
Definition: bioslobbyservice.c:63
PING
@ PING
Definition: egamestateicons.c:3
m_PlayersInQueue
int m_PlayersInQueue
Definition: bioslobbyservice.c:50
m_AntiCheat
bool m_AntiCheat
Definition: bioslobbyservice.c:44
m_UpdatedAt
string m_UpdatedAt
Definition: bioslobbyservice.c:54
IsSelected
bool IsSelected()
Definition: bioslobbyservice.c:104
m_Invisible
bool m_Invisible
Definition: bioslobbyservice.c:39
m_IsExpanded
bool m_IsExpanded
Definition: bioslobbyservice.c:60
EBiosError
EBiosError
Possible Error codes for bios API. This is the list of errors that can be returned from bios API....
Definition: bioserrormodule.c:6
GetServersResult
GetServersResult the output structure of the GetServers operation.
Definition: bioslobbyservice.c:224
m_AllowedFilePatching
bool m_AllowedFilePatching
Definition: bioslobbyservice.c:77
m_Id
class GetServerModListResult m_Id
GetServersResultRow the output structure of the GetServers operation that represents one game server.
GetFirstServerWithEmptySlotResult
Definition: bioslobbyservice.c:188
m_SortName
int m_SortName
Definition: bioslobbyservice.c:61
ESortOrder
ESortOrder
Definition: bioslobbyservice.c:18
GetIpPort
string GetIpPort()
Definition: bioslobbyservice.c:83
m_SortTime
int m_SortTime
Definition: bioslobbyservice.c:62
array< string >
m_SteamFriends
string m_SteamFriends
Definition: bioslobbyservice.c:68
GetServersResultRowArray
array< ref GetServersResultRow > GetServersResultRowArray
Definition: bioslobbyservice.c:183
m_GameVersion
string m_GameVersion
Definition: bioslobbyservice.c:51
m_WhitelistEnabled
bool m_WhitelistEnabled
Definition: bioslobbyservice.c:56
name
PlayerSpawnPresetDiscreteItemSetSlotData name
one set for cargo
m_FreeSlots
int m_FreeSlots
Definition: bioslobbyservice.c:48
m_Favorite
bool m_Favorite
Definition: bioslobbyservice.c:81
GetServerModListResult
Definition: bioslobbyservice.c:24
GetFirstServerWithEmptySlotInput
GetServersInput the input structure of the GetServers operation.
Definition: bioslobbyservice.c:194
TIME
@ TIME
Definition: bioslobbyservice.c:9
SLOTS
@ SLOTS
Definition: bioslobbyservice.c:11
GetServersInput
GetServersInput the input structure of the GetServers operation.
Definition: bioslobbyservice.c:234
ASCENDING
@ ASCENDING
Definition: bioslobbyservice.c:20
GetValueInt
int GetValueInt(ESortType sort_type)
Definition: bioslobbyservice.c:122
m_Modded
bool m_Modded
Definition: bioslobbyservice.c:42
POPULATION
@ POPULATION
Definition: bioslobbyservice.c:10
m_MouseAndKeyboardEnabled
bool m_MouseAndKeyboardEnabled
Definition: bioslobbyservice.c:55
m_MapNameToRun
string m_MapNameToRun
Definition: bioslobbyservice.c:41
m_Ping
int m_Ping
Definition: bioslobbyservice.c:70
m_IsDLC
bool m_IsDLC
Definition: bioslobbyservice.c:57
m_CreatedAt
string m_CreatedAt
Definition: bioslobbyservice.c:53
CompareTo
int CompareTo(GetServersResultRow other, ESortType sortType)
Definition: bioslobbyservice.c:153
QUEUE
@ QUEUE
Definition: bioslobbyservice.c:15
m_SteamQueryPort
int m_SteamQueryPort
Definition: bioslobbyservice.c:79
OnlineServices
Definition: onlineservices.c:1
m_EnvironmentNightTimeMul
float m_EnvironmentNightTimeMul
Definition: bioslobbyservice.c:76
m_CharactersAlive
string m_CharactersAlive
Definition: bioslobbyservice.c:66