Dayz Explorer  1.24.157551 (v105080)
Dayz Code Explorer by Zeroy
biossessionservice.c
Go to the documentation of this file.
2 {
3  protected int m_GetSessionAttempts;
4  string m_CurrentHandle;
5 
7 
16  proto native EBiosError EnterGameplaySessionAsync(string session_address, int session_port);
17 
19 
30  proto native EBiosError LeaveGameplaySessionAsync(string session_address, int session_port);
31 
33 
36  proto native void OnSessionPlayerListUpdate(array<string> newPlayers);
37 
39 
47  void TryGetSession( string join_handle = "" )
48  {
49  if ( join_handle != "" )
50  {
51  m_GetSessionAttempts = 0;
52  m_CurrentHandle = join_handle;
53  }
54 
55  if ( m_GetSessionAttempts < 10 )
56  GetSessionAsync( m_CurrentHandle );
57  else
58  g_Game.DisconnectSessionEx(DISCONNECT_SESSION_FLAGS_JOIN);
59  }
60 
62 
70  proto native EBiosError GetSessionAsync(string join_handle);
71 
73 
82  proto native EBiosError SetGameplayActivityAsync(string session_address, int session_port);
83 
85  //proto native EBiosError SetLobbyActivityAsync(...);
86 
88 
94  proto native EBiosError ClearActivityAsync();
95 
97 
107  proto native EBiosError ShowInviteToGameplaySessionAsync(string session_address, int session_port);
108 
110 
120  proto native EBiosError InviteToGameplaySessionAsync(string session_address, int session_port, array<string> invitee_list);
121 
123  proto native void SetMultiplayState(bool is_active);
124 
126 
129  void OnSetActivity(EBiosError error)
130  {
131  OnlineServices.ErrorCaught( error );
132  }
133 
135 
138  void OnClearActivity(EBiosError error)
139  {
140  }
141 
143 
147  void OnGetGameplaySession(string session_address, int session_port)
148  {
149  m_GetSessionAttempts = 0;
150  switch (g_Game.GetGameState())
151  {
152  case DayZGameState.IN_GAME:
153  {
154  string addr;
155  int port;
156  bool found = GetGame().GetHostAddress( addr, port );
157  if (addr != session_address || port != session_port )
158  {
159  if (found)
160  {
161  OnlineServices.SetInviteServerInfo( session_address, session_port );
162  g_Game.GetUIManager().CloseAll();
163  if (!g_Game.GetUIManager().EnterScriptedMenu( MENU_INVITE_TIMER, null ))
164  {
165  NotificationSystem.AddNotification( NotificationType.CONNECT_FAIL_GENERIC, NotificationSystem.DEFAULT_TIME_DISPLAYED );
166  }
167  }
168  else
169  {
170  NotificationSystem.AddNotification( NotificationType.JOIN_FAIL_GET_SESSION, NotificationSystem.DEFAULT_TIME_DISPLAYED );
171  }
172  }
173  else
174  {
175  NotificationSystem.AddNotification( NotificationType.INVITE_FAIL_SAME_SERVER, NotificationSystem.DEFAULT_TIME_DISPLAYED, "#ps4_already_in_session" );
176  }
177  break;
178  }
179  case DayZGameState.CONNECTING:
180  {
181  g_Game.DisconnectSessionEx(DISCONNECT_SESSION_FLAGS_FORCE);
182  // Intentionally no break, fall through to connecting
183  }
184  default:
185  {
186  g_Game.ConnectFromJoin( session_address, session_port );
187  break;
188  }
189  }
190  }
191 
193  /*void OnGetLobbySession(...)
194  {
195  }*/
196 
198 
201  void OnGetSessionError(EBiosError error)
202  {
203  OnlineServices.ErrorCaught( error );
204  m_GetSessionAttempts++;
205 
206  #ifdef PLATFORM_XBOX
207  GetGame().GetCallQueue( CALL_CATEGORY_SYSTEM ).CallLater( TryGetSession, 100, false, "" );
208  #endif
209  #ifdef PLATFORM_PS4
210  g_Game.DisconnectSessionEx(DISCONNECT_SESSION_FLAGS_JOIN);
211  #endif
212  }
213 
215 
220  void OnEnterGameplaySession(string session_address, int session_port, EBiosError error)
221  {
222  if ( !OnlineServices.ErrorCaught( error ) )
223  {
224  SetGameplayActivityAsync( session_address, session_port );
225  if ( OnlineServices.GetPendingInviteList() )
226  InviteToGameplaySessionAsync( session_address, session_port, OnlineServices.GetPendingInviteList() );
227 
228  //OnlineServices.GetCurrentServerInfo(session_address, session_port);
229  }
230  }
231 
233 
236  void OnLeaveGameplaySession(EBiosError error)
237  {
238  }
239 
241 
244  void OnShowInviteToGameplaySession(EBiosError error)
245  {
246  OnlineServices.ErrorCaught( error );
247  }
248 
250 
253  void OnInviteToGameplaySession(EBiosError error)
254  {
255 
256  }
257 
258  array<string> GetSessionPlayerList()
259  {
260  return ClientData.GetSimplePlayerList();
261  }
262 
263 };
GetGame
proto native CGame GetGame()
CALL_CATEGORY_SYSTEM
const int CALL_CATEGORY_SYSTEM
Definition: tools.c:8
NotificationSystem
Definition: notificationsystem.c:69
DISCONNECT_SESSION_FLAGS_FORCE
enum DisconnectSessionFlags DISCONNECT_SESSION_FLAGS_FORCE
ClientData
Definition: clientdata.c:1
BiosSessionService
Definition: biossessionservice.c:1
g_Game
DayZGame g_Game
Definition: dayzgame.c:3727
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
MENU_INVITE_TIMER
const int MENU_INVITE_TIMER
Definition: constants.c:196
DISCONNECT_SESSION_FLAGS_JOIN
const int DISCONNECT_SESSION_FLAGS_JOIN
Definition: dayzgame.c:14
array< string >
NotificationType
NotificationType
DEPRECATED (moved into NotificationSystem)
Definition: notificationsystem.c:3
OnlineServices
Definition: onlineservices.c:1