def handleAction(self, model, entityID, action):
     super(AcceptPrbInviteHandler,
           self).handleAction(model, entityID, action)
     yield lambda callback: callback(None)
     postActions = []
     invite = self.prbInvites.getInvite(entityID)
     state = self.prbDispatcher.getFunctionalState()
     if state.doLeaveToAcceptInvite(invite.type):
         postActions.append(actions.LeavePrbModalEntity())
     if invite and invite.anotherPeriphery:
         success = True
         if g_preDefinedHosts.isRoamingPeriphery(invite.peripheryID):
             success = yield DialogsInterface.showI18nConfirmDialog(
                 'changeRoamingPeriphery')
         if not success:
             return
         postActions.append(actions.DisconnectFromPeriphery())
         postActions.append(actions.ConnectToPeriphery(invite.peripheryID))
         postActions.append(actions.PrbInvitesInit())
         postActions.append(actions.LeavePrbEntity())
     g_eventBus.handleEvent(events.PrbInvitesEvent(
         events.PrbInvitesEvent.ACCEPT,
         inviteID=entityID,
         postActions=postActions),
                            scope=EVENT_BUS_SCOPE.LOBBY)
예제 #2
0
 def canAcceptInvite(self, invite):
     result = False
     if invite.alwaysAvailable is True:
         result = True
     elif invite.clientID in self.__invites:
         dispatcher = self.__loader.getDispatcher()
         if dispatcher:
             if invite.alreadyJoined:
                 return False
             if dispatcher.getEntity().hasLockedState():
                 return False
         another = invite.anotherPeriphery
         if another:
             if g_preDefinedHosts.periphery(invite.peripheryID) is None:
                 LOG_ERROR('Periphery not found')
                 result = False
             elif self.lobbyContext.getCredentials() is None:
                 LOG_ERROR('Login info not found')
                 result = False
             elif g_preDefinedHosts.isRoamingPeriphery(invite.peripheryID) and not isRoamingEnabled(self.itemsCache.items.stats.attributes):
                 LOG_ERROR('Roaming is not supported')
                 result = False
             else:
                 result = invite.clientID > 0 and invite.isActive()
         else:
             result = invite.clientID > 0 and invite.isActive()
     return result
예제 #3
0
 def canAcceptInvite(self, invite):
     result = False
     if invite.id in self.__receivedInvites:
         from gui.prb_control.dispatcher import g_prbLoader
         dispatcher = g_prbLoader.getDispatcher()
         if dispatcher:
             prbFunctional = dispatcher.getPrbFunctional()
             unitFunctional = dispatcher.getUnitFunctional()
             return (prbFunctional and prbFunctional.hasLockedState()
                     or unitFunctional
                     and unitFunctional.hasLockedState()) and False
     another = invite.anotherPeriphery
     if another:
         if g_preDefinedHosts.periphery(invite.peripheryID) is None:
             LOG_ERROR('Periphery not found')
             result = False
         elif g_lobbyContext.getCredentials() is None:
             LOG_ERROR('Login info not found')
             result = False
         elif g_preDefinedHosts.isRoamingPeriphery(
                 invite.peripheryID) and not isRoamingEnabled(
                     g_itemsCache.items.stats.attributes):
             LOG_ERROR('Roaming is not supported')
             result = False
         elif invite.id > 0:
             result = invite.isActive()
         else:
             result = invite.id > 0 and invite.isActive()
     return result
예제 #4
0
 def __relogin(self, peripheryID):
     if g_preDefinedHosts.isRoamingPeriphery(peripheryID):
         success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
     else:
         success = yield DialogsInterface.showI18nConfirmDialog('changePeriphery')
     if success:
         self.relogin.doRelogin(peripheryID, extraChainSteps=self.__ctx.getExtraChainSteps())
예제 #5
0
 def canAcceptInvite(self, invite):
     result = False
     if invite.id in self.__receivedInvites:
         from gui.prb_control.dispatcher import g_prbLoader
         dispatcher = g_prbLoader.getDispatcher()
         if dispatcher:
             prbFunctional = dispatcher.getPrbFunctional()
             unitFunctional = dispatcher.getUnitFunctional()
             return (prbFunctional and prbFunctional.hasLockedState() or unitFunctional and unitFunctional.hasLockedState()) and False
     another = invite.anotherPeriphery
     if another:
         if g_preDefinedHosts.periphery(invite.peripheryID) is None:
             LOG_ERROR('Periphery not found')
             result = False
         elif g_lobbyContext.getCredentials() is None:
             LOG_ERROR('Login info not found')
             result = False
         elif g_preDefinedHosts.isRoamingPeriphery(invite.peripheryID) and not isRoamingEnabled(g_itemsCache.items.stats.attributes):
             LOG_ERROR('Roaming is not supported')
             result = False
         elif invite.id > 0:
             result = invite.isActive()
         else:
             result = invite.id > 0 and invite.isActive()
     return result
예제 #6
0
 def canAcceptInvite(self, invite):
     result = False
     if invite.alwaysAvailable is True:
         result = True
     elif invite.clientID in self.__invites:
         dispatcher = self.__loader.getDispatcher()
         if dispatcher:
             prbFunctional = dispatcher.getPrbFunctional()
             unitFunctional = dispatcher.getUnitFunctional()
             preQueueFunctional = dispatcher.getPreQueueFunctional()
             if invite.alreadyJoined:
                 return False
             if prbFunctional and prbFunctional.hasLockedState() or unitFunctional and unitFunctional.hasLockedState() or preQueueFunctional and preQueueFunctional.hasLockedState():
                 return False
         another = invite.anotherPeriphery
         if another:
             if g_preDefinedHosts.periphery(invite.peripheryID) is None:
                 LOG_ERROR('Periphery not found')
                 result = False
             elif g_lobbyContext.getCredentials() is None:
                 LOG_ERROR('Login info not found')
                 result = False
             elif g_preDefinedHosts.isRoamingPeriphery(invite.peripheryID) and not isRoamingEnabled(g_itemsCache.items.stats.attributes):
                 LOG_ERROR('Roaming is not supported')
                 result = False
             else:
                 result = invite.clientID > 0 and invite.isActive()
         else:
             result = invite.clientID > 0 and invite.isActive()
     return result
예제 #7
0
 def relogin(self, peripheryID):
     if g_preDefinedHosts.isRoamingPeriphery(peripheryID):
         success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
     else:
         success = yield DialogsInterface.showI18nConfirmDialog('changePeriphery')
     if success:
         game_control.g_instance.roaming.relogin(peripheryID)
     self.as_setPeripheryChangingS(success)
 def __relogin(self, peripheryID):
     self.__isGuiUpdateSuppressed = True
     if g_preDefinedHosts.isRoamingPeriphery(peripheryID):
         success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
     else:
         success = yield DialogsInterface.showI18nConfirmDialog('changePeriphery')
     if success:
         game_control.g_instance.relogin.doRelogin(peripheryID, extraChainSteps=self.__ctx.getExtraChainSteps())
 def __relogin(self, peripheryID):
     self.__isGuiUpdateSuppressed = True
     if g_preDefinedHosts.isRoamingPeriphery(peripheryID):
         success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
     else:
         success = yield DialogsInterface.showI18nConfirmDialog('changePeriphery')
     if success:
         game_control.g_instance.relogin.doRelogin(peripheryID, extraChainSteps=self.__ctx.getExtraChainSteps())
예제 #10
0
 def relogin(self, peripheryID):
     if g_preDefinedHosts.isRoamingPeriphery(peripheryID):
         LOG_DEBUG('g_preDefinedHosts.isRoamingPeriphery(peripheryID)', peripheryID)
         success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
     else:
         success = yield DialogsInterface.showI18nConfirmDialog('changePeriphery')
     if success:
         game_control.g_instance.relogin.doRelogin(peripheryID)
     if not success:
         self.as_changePeripheryFailedS()
예제 #11
0
 def relogin(self, peripheryID):
     self.__isGuiUpdateSuppressed = True
     if g_preDefinedHosts.isRoamingPeriphery(peripheryID):
         success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
     else:
         success = yield DialogsInterface.showI18nConfirmDialog('changePeriphery')
     if success:
         game_control.g_instance.relogin.doRelogin(peripheryID)
     self.__isGuiUpdateSuppressed = False
     self.as_setPeripheryChangingS(success)
예제 #12
0
 def relogin(self, peripheryID):
     if g_preDefinedHosts.isRoamingPeriphery(peripheryID):
         LOG_DEBUG('g_preDefinedHosts.isRoamingPeriphery(peripheryID)', peripheryID)
         success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
     else:
         success = yield DialogsInterface.showI18nConfirmDialog('changePeriphery')
     if success:
         self.reloginCtrl.doRelogin(peripheryID, self.__onReloing)
     else:
         self.as_changePeripheryFailedS()
예제 #13
0
 def relogin(self, peripheryID):
     if g_preDefinedHosts.isRoamingPeriphery(peripheryID):
         LOG_DEBUG('g_preDefinedHosts.isRoamingPeriphery(peripheryID)', peripheryID)
         success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
     else:
         success = yield DialogsInterface.showI18nConfirmDialog('changePeriphery')
     if success:
         game_control.g_instance.relogin.doRelogin(peripheryID)
     if not success:
         self.as_changePeripheryFailedS()
 def acceptInvite(self):
     yield lambda callback: callback(None)
     prbID = self._inviteInfo.getID()
     invite = self.prbAutoInvites.getInvite(prbID)
     postActions = [actions.LeavePrbModalEntity()]
     finishActions = [_DisableNotify(channel_num_gen.getClientID4LazyChannel(LAZY_CHANNEL.SPECIAL_BATTLES))]
     if g_preDefinedHosts.isRoamingPeriphery(invite.peripheryID):
         success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
         if not success:
             return
     self.prbPeripheriesHandler.join(invite.peripheryID, JoinBattleSessionCtx(prbID, invite.prbType, 'prebattle/join'), postActions, finishActions)
예제 #15
0
 def relogin(self, peripheryID):
     self.__isGuiUpdateSuppressed = True
     if g_preDefinedHosts.isRoamingPeriphery(peripheryID):
         success = yield DialogsInterface.showI18nConfirmDialog(
             'changeRoamingPeriphery')
     else:
         success = yield DialogsInterface.showI18nConfirmDialog(
             'changePeriphery')
     if success:
         game_control.g_instance.relogin.doRelogin(peripheryID)
     self.__isGuiUpdateSuppressed = False
     self.as_setPeripheryChangingS(success)
예제 #16
0
 def isPeripheryAvailable(self, peripheryID):
     result = True
     if g_preDefinedHosts.periphery(peripheryID) is None:
         LOG_ERROR('Periphery not found', peripheryID)
         result = False
     elif self.__credentials is None:
         LOG_ERROR('Login info not found', peripheryID)
         result = False
     elif g_preDefinedHosts.isRoamingPeriphery(peripheryID) and not isRoamingEnabled(g_itemsCache.items.stats.attributes):
         LOG_ERROR('Roaming is not supported', peripheryID)
         result = False
     return result
예제 #17
0
 def acceptInvite(self):
     yield lambda callback: callback(None)
     prbID = self._inviteInfo.getID()
     invite = self.prbAutoInvites.getInvite(prbID)
     postActions = []
     if self.prbDispatcher.hasModalEntity():
         postActions.append(actions.LeavePrbModalEntity())
     finishActions = [_DisableNotify(channel_num_gen.getClientID4LazyChannel(LAZY_CHANNEL.SPECIAL_BATTLES))]
     if g_preDefinedHosts.isRoamingPeriphery(invite.peripheryID):
         success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
         if not success:
             return
     self.prbPeripheriesHandler.join(invite.peripheryID, JoinBattleSessionCtx(prbID, invite.prbType, 'prebattle/join'), postActions, finishActions)
예제 #18
0
 def isPeripheryAvailable(self, peripheryID):
     result = True
     if _isSkipPeripheryChecking():
         LOG_NOTE('Skip periphery checking in standalone mode')
         return result
     else:
         if g_preDefinedHosts.periphery(peripheryID) is None:
             LOG_ERROR('Periphery not found', peripheryID)
             result = False
         elif self.__credentials is None:
             LOG_ERROR('Login info not found', peripheryID)
             result = False
         elif g_preDefinedHosts.isRoamingPeriphery(peripheryID) and not isRoamingEnabled(g_itemsCache.items.stats.attributes):
             LOG_ERROR('Roaming is not supported', peripheryID)
             result = False
         return result
예제 #19
0
 def handleAction(self, model, entityID, action):
     super(AcceptPrbInviteHandler, self).handleAction(model, entityID, action)
     yield lambda callback: callback(None)
     postActions = []
     invite = self.prbInvites.getInvite(entityID)
     state = self.prbDispatcher.getFunctionalState()
     if state.doLeaveToAcceptInvite(invite.type):
         postActions.append(actions.LeavePrbModalEntity())
     if invite and invite.anotherPeriphery:
         success = True
         if g_preDefinedHosts.isRoamingPeriphery(invite.peripheryID):
             success = yield DialogsInterface.showI18nConfirmDialog('changeRoamingPeriphery')
         if not success:
             return
         postActions.append(actions.DisconnectFromPeriphery())
         postActions.append(actions.ConnectToPeriphery(invite.peripheryID))
         postActions.append(actions.PrbInvitesInit())
     self.prbInvites.acceptInvite(entityID, postActions=postActions)