Ejemplo n.º 1
0
 def showMessage(self, text, lookupType = None):
     guiType = None
     if type is not None:
         guiType = SystemMessages.SM_TYPE.lookup(lookupType)
     if guiType is None:
         guiType = SystemMessages.SM_TYPE.Information
     SystemMessages.pushMessage(text, type=guiType)
Ejemplo n.º 2
0
 def changeDivision(self, ctx, callback = None):
     if ctx.getRequestType() != REQUEST_TYPE.CHANGE_DIVISION:
         LOG_ERROR('Invalid context for request changeDivision', ctx)
         if callback:
             callback(False)
         return
     if not ctx.isDivisionChanged(self._settings):
         if callback:
             callback(False)
         return
     if isRequestInCoolDown(REQUEST_TYPE.CHANGE_SETTINGS):
         SystemMessages.pushMessage(messages.getRequestInCoolDownMessage(REQUEST_TYPE.CHANGE_SETTINGS), type=SystemMessages.SM_TYPE.Error)
         if callback:
             callback(False)
         return
     if ctx.getDivision() not in PREBATTLE_COMPANY_DIVISION.RANGE:
         LOG_ERROR('Division is invalid', ctx)
         if callback:
             callback(False)
         return
     if self.getTeamState().isInQueue():
         LOG_ERROR('Team is ready or locked', ctx)
         if callback:
             callback(False)
         return
     pPermissions = self.getPermissions()
     if not pPermissions.canChangeDivision():
         LOG_ERROR('Player can not change division', pPermissions)
         if callback:
             callback(False)
         return
     ctx.startProcessing(callback)
     BigWorld.player().prb_changeDivision(ctx.getDivision(), ctx.onResponseReceived)
     setRequestCoolDown(REQUEST_TYPE.CHANGE_SETTINGS)
Ejemplo n.º 3
0
 def _showMessage4Item(self, scope, msg, itemCD, msgType = SystemMessages.SM_TYPE.Error, **kwargs):
     itemTypeID, nationID, itemID = vehicles.parseIntCompactDescr(itemCD)
     raise itemTypeID != _VEHICLE or AssertionError
     key = scope('item', msg)
     kwargs.update({'typeString': getTypeInfoByIndex(itemTypeID)['userString'],
      'userString': vehicles.getDictDescr(itemCD)['userString']})
     SystemMessages.pushMessage(i18n.makeString(key, **kwargs), type=msgType)
Ejemplo n.º 4
0
    def _setTeamReady(self, ctx, callback=None):
        if prb_getters.isParentControlActivated():
            g_eventDispatcher.showParentControlNotification()
            if callback:
                callback(False)
            return
        isValid, notValidReason = self._limits.isTeamValid()

        def _requestResponse(code, errStr):
            msg = messages.getInvalidTeamServerMessage(errStr, functional=self)
            if msg is not None:
                SystemMessages.pushMessage(msg, type=SystemMessages.SM_TYPE.Error)
            ctx.onResponseReceived(code)
            return

        if isValid:
            ctx.startProcessing(callback)
            BigWorld.player().prb_teamReady(ctx.getTeam(), ctx.isForced(), ctx.getGamePlayMask(), _requestResponse)
        else:
            LOG_ERROR("Team is invalid", notValidReason)
            if callback:
                callback(False)
            SystemMessages.pushMessage(
                messages.getInvalidTeamMessage(notValidReason, functional=self), type=SystemMessages.SM_TYPE.Error
            )
Ejemplo n.º 5
0
 def __onIgrTypeChanged(self, roomType, xpFactor):
     icon = gui.makeHtmlString('html_templates:igr/iconSmall', 'premium')
     if roomType == constants.IGR_TYPE.PREMIUM:
         SystemMessages.pushMessage(i18n.makeString(SYSTEM_MESSAGES.IGR_CUSTOMIZATION_BEGIN, igrIcon=icon), type=SystemMessages.SM_TYPE.Information)
     elif roomType in [constants.IGR_TYPE.BASE, constants.IGR_TYPE.NONE] and self.__currIgrType == constants.IGR_TYPE.PREMIUM:
         SystemMessages.pushMessage(i18n.makeString(SYSTEM_MESSAGES.IGR_CUSTOMIZATION_END, igrIcon=icon), type=SystemMessages.SM_TYPE.Information)
     self.__currIgrType = roomType
Ejemplo n.º 6
0
 def xfw_cmd(self, cmd, *args):
     try:
         if IS_DEVELOPMENT and cmd in _LOG_COMMANDS:
             debug('[XFW] xfw_cmd: {} {}'.format(cmd, args))
         if cmd == COMMAND.XFW_COMMAND_LOG:
             if swf.g_xvmlogger is None:
                 swf.g_xvmlogger = Logger(PATH.XVM_LOG_FILE_NAME)
             swf.g_xvmlogger.add(*args)
         elif cmd == COMMAND.XFW_COMMAND_INITIALIZED:
             swf.xfwInitialized = True
         elif cmd == COMMAND.XFW_COMMAND_SWF_LOADED:
             xfw_mods_info.swf_loaded(args[0])
             g_eventBus.handleEvent(HasCtxEvent(XFWEVENT.SWF_LOADED, args[0]))
         elif cmd == COMMAND.XFW_COMMAND_GETMODS:
             return self.getMods()
         elif cmd == COMMAND.XFW_COMMAND_LOADFILE:
             return load_file(args[0])
         elif cmd == XFWCOMMAND.XFW_COMMAND_GETGAMEREGION:
             return GAME_REGION
         elif cmd == XFWCOMMAND.XFW_COMMAND_GETGAMELANGUAGE:
             return GAME_LANGUAGE
         elif cmd == XFWCOMMAND.XFW_COMMAND_CALLBACK:
             e = swf._events.get(args[0], None)
             if e:
                 e.fire({
                   "name": args[0],
                   "type": args[1],
                   "x": int(args[2]),
                   "y": int(args[3]),
                   "stageX": int(args[4]),
                   "stageY": int(args[5]),
                   "buttonIdx": int(args[6]),
                   "delta": int(args[7])
                 })
         elif cmd == XFWCOMMAND.XFW_COMMAND_MESSAGEBOX:
             # title, message
             DialogsInterface.showDialog(dialogs.SimpleDialogMeta(
                 args[0],
                 args[1],
                 dialogs.I18nInfoDialogButtons('common/error')),
                 (lambda x: None))
         elif cmd == XFWCOMMAND.XFW_COMMAND_SYSMESSAGE:
             # message, type
             # Types: gui.SystemMessages.SM_TYPE:
             #   'Error', 'Warning', 'Information', 'GameGreeting', ...
             SystemMessages.pushMessage(
                 args[0],
                 type=SystemMessages.SM_TYPE.of(args[1]))
         else:
             handlers = g_eventBus._EventBus__scopes[EVENT_BUS_SCOPE.DEFAULT][XFWCOMMAND.XFW_CMD]
             for handler in handlers.copy():
                 try:
                     (result, status) = handler(cmd, *args)
                     if status:
                         return result
                 except TypeError:
                     err(traceback.format_exc())
             log('WARNING: unknown command: {}'.format(cmd))
     except:
         err(traceback.format_exc())
Ejemplo n.º 7
0
 def assignPrivate(self):
     databaseID = self.databaseID
     result = yield self.clubsCtrl.sendRequest(
         AssignPrivateCtx(self.__clubDbID, databaseID, waitingID="clubs/assignPrivate")
     )
     if result.isSuccess():
         SystemMessages.pushMessage(club_fmts.getAssignPrivateSysMsg(self.getUserFullName(databaseID)))
Ejemplo n.º 8
0
 def __ci_onCustomizationDropSuccess(self, message):
     self.as_onDropSuccessS()
     Waiting.hide('customizationDrop')
     self.__lockUpdate = False
     BigWorld.player().resyncDossiers()
     self.__refreshData()
     SystemMessages.pushMessage(message, type=SystemMessages.SM_TYPE.Information)
Ejemplo n.º 9
0
    def doAction(self, action):
        if not g_currentVehicle.isPresent():
            SystemMessages.pushMessage(messages.getInvalidVehicleMessage(PREBATTLE_RESTRICTION.VEHICLE_NOT_PRESENT), type=SystemMessages.SM_TYPE.Error)
            return False
        LOG_DEBUG('Do prebattle action', action)
        actionName = action.actionName
        if actionName == PREBATTLE_ACTION_NAME.LEAVE_RANDOM_QUEUE:
            self.exitFromRandomQueue()
            result = True
        elif actionName == PREBATTLE_ACTION_NAME.PREBATTLE_LEAVE:
            self.__prbFunctional.doLeaveAction(self)
            result = True
        elif actionName == PREBATTLE_ACTION_NAME.UNIT_LEAVE:
            self.__unitFunctional.doLeaveAction(self)
            result = True
        elif actionName in self.OPEN_PRB_LIST_BY_ACTION:
            entry = functional.createPrbEntry(self.OPEN_PRB_LIST_BY_ACTION[actionName])
            entry.doAction(action, dispatcher=self)
            result = True
        else:
            result = False
            for func in (self.__unitFunctional, self.__prbFunctional, self.__queueFunctional):
                if func.doAction(action=action, dispatcher=self):
                    result = True
                    break

        return result
Ejemplo n.º 10
0
 def onKickedFromArena(self, *args):
     super(HistoricalQueueFunctional, self).onKickedFromQueue(*args)
     self.__requestCtx.stopProcessing(True)
     g_eventDispatcher.loadHangar()
     g_eventDispatcher.updateUI()
     SystemMessages.pushMessage(messages.getKickReasonMessage('timeout'), type=SystemMessages.SM_TYPE.Warning)
     self.__checkAvailability()
Ejemplo n.º 11
0
    def setXvmContactData(self, uid, value):
        try:
            if self.cached_data is None or 'players' not in self.cached_data:
                raise Exception('[INTERNAL_ERROR]')

            if (value['nick'] is None or value['nick'] == '') and (value['comment'] is None or value['comment'] == ''):
                self.cached_data['players'].pop(str(uid), None)
            else:
                self.cached_data['players'][str(uid)] = value

            json_data = simplejson.dumps(self.cached_data)
            #log(json_data)
            self._doRequest('addComments', json_data)

            return True

        except Exception as ex:
            self.contacts_disabled = True
            self.is_available = False
            self.cached_token = None
            self.cached_data = None

            errstr = _SYSTEM_MESSAGE_TPL.replace('%VALUE%', '<b>{0}</b>\n\n{1}\n\n{2}'.format(
                l10n('Error saving comments'),
                str(ex),
                l10n('Comments disabled')))
            SystemMessages.pushMessage(errstr, type=SystemMessages.SM_TYPE.Error)
            err(traceback.format_exc())

            return False
Ejemplo n.º 12
0
 def onKickedFromQueue(self):
     super(RandomQueueFunctional, self).onKickedFromQueue()
     self.__requestCtx.stopProcessing(True)
     g_prbCtrlEvents.onPreQueueFunctionalDestroyed()
     g_eventDispatcher.loadHangar()
     g_eventDispatcher.updateUI()
     SystemMessages.pushMessage(messages.getKickReasonMessage('timeout'), type=SystemMessages.SM_TYPE.Warning)
Ejemplo n.º 13
0
 def removeMember(self, memberDbID, userName):
     member = self.clubsCtrl.getClub(self._clubDbID).getMember(memberDbID)
     if member.isOwner():
         i18nId = 'staticFormation/staffView/discontinuingFormationConfirmation'
     elif self.__viewerDbID == memberDbID:
         i18nId = 'staticFormation/staffView/leaveClubConfirmation'
     else:
         i18nId = 'staticFormation/staffView/removeMemberConfirmation'
     isOk = yield DialogsInterface.showDialog(I18nConfirmDialogMeta(i18nId, messageCtx={'userName': userName}))
     if isOk:
         if member.isOwner():
             ctx = DestroyClubCtx(self._clubDbID)
             waitingID = WAITING.CLUBS_DESTROYCLUB
             successSysMsg = club_fmts.getDestroyClubSysMsg(self.clubsCtrl.getClub(self._clubDbID))
         elif self.__viewerDbID == memberDbID:
             ctx = LeaveClubCtx(self._clubDbID)
             waitingID = WAITING.CLUBS_LEAVECLUB
             successSysMsg = club_fmts.getLeaveClubSysMsg(self.clubsCtrl.getClub(self._clubDbID))
         else:
             ctx = KickMemberCtx(self._clubDbID, memberDbID)
             waitingID = WAITING.CLUBS_CLUBKICKMEMBER
             successSysMsg = club_fmts.getKickMemberSysMsg(self.getUserFullName(memberDbID))
         self.showWaiting(waitingID)
         result = yield self.clubsCtrl.sendRequest(ctx)
         if result.isSuccess():
             SystemMessages.pushMessage(successSysMsg)
         self.hideWaiting()
Ejemplo n.º 14
0
 def _showMessage(self, scope, msg, item, msgType = SystemMessages.SM_TYPE.Error, **kwargs):
     kwargs['userString'] = item.userName
     if item.itemTypeID == GUI_ITEM_TYPE.VEHICLE:
         key = scope('vehicle', msg)
     else:
         key = scope('item', msg)
         kwargs['typeString'] = item.userType
     SystemMessages.pushMessage(i18n.makeString(key, **kwargs), type=msgType)
Ejemplo n.º 15
0
 def _doExitAction(self, ctx, dialogMeta, waiting, sysMsg):
     isOk = yield DialogsInterface.showDialog(dialogMeta)
     if isOk:
         self.showWaiting(waiting)
         result = yield self.clubsCtrl.sendRequest(ctx)
         if result.isSuccess():
             SystemMessages.pushMessage(sysMsg)
         self.hideWaiting()
 def _onListItemsUpdated(self, paginator, items):
     currentPaginator = self._getCurrentPaginator()
     if currentPaginator == paginator:
         self.dataProvider.refreshItems(items)
     for item in items:
         status = item.getStatus()
         if status == CLAN_INVITE_STATES.EXPIRED_RESENT or status == CLAN_INVITE_STATES.DECLINED_RESENT:
             SystemMessages.pushMessage(clans_fmts.getInvitesSentSysMsg([item.getAccountName()]))
Ejemplo n.º 17
0
 def sendClanInvite(self):
     profile = g_clanCtrl.getAccountProfile()
     context = CreateInviteCtx(profile.getClanDbID(), [self.databaseID])
     result = yield g_clanCtrl.sendRequest(context, allowDelay=True)
     if result.isSuccess():
         SystemMessages.pushMessage(clans_fmts.getAppSentSysMsg(profile.getClanName(), profile.getClanAbbrev()))
     else:
         SystemMessages.pushMessage(clans_fmts.getInvitesNotSentSysMsg([self.userName or '']), type=SystemMessages.SM_TYPE.Error)
Ejemplo n.º 18
0
 def userAddToClan(self):
     self.as_showWaitingS(WAITING.CLANS_INVITES_SEND, {})
     profile = g_clanCtrl.getAccountProfile()
     context = CreateInviteCtx(profile.getClanDbID(), [self.__databaseID])
     result = yield g_clanCtrl.sendRequest(context, allowDelay=True)
     if result.isSuccess():
         SystemMessages.pushMessage(clans_fmts.getAppSentSysMsg(profile.getClanName(), profile.getClanAbbrev()))
     self.as_hideWaitingS()
Ejemplo n.º 19
0
 def appeal(self, uid, userName, topic):
     topicID = self.DENUNCIATIONS.get(topic)
     if topicID is not None:
         BigWorld.player().makeDenunciation(uid, topicID, constants.VIOLATOR_KIND.UNKNOWN)
         topicStr = i18n.makeString(MENU.denunciation(topicID))
         sysMsg = i18n.makeString(SYSTEM_MESSAGES.DENUNCIATION_SUCCESS) % {'name': userName,
          'topic': topicStr}
         SystemMessages.pushMessage(sysMsg, type=SystemMessages.SM_TYPE.Information)
Ejemplo n.º 20
0
 def assignPrivate(self, memberDbID, userName):
     isOk = yield DialogsInterface.showDialog(I18nConfirmDialogMeta('staticFormation/staffView/demoteConfirmation', messageCtx={'userName': userName}))
     if isOk:
         self.showWaiting(WAITING.CLUBS_ASSIGNPRIVATE)
         results = yield self.clubsCtrl.sendRequest(AssignPrivateCtx(self._clubDbID, int(memberDbID)))
         if results.isSuccess():
             SystemMessages.pushMessage(club_fmts.getAssignPrivateSysMsg(self.getUserFullName(int(memberDbID))))
         self.hideWaiting()
Ejemplo n.º 21
0
 def giveLeadership(self):
     clubDbID = self.__clubDbID
     databaseID = self.databaseID
     isOk = yield DialogsInterface.showDialog(I18nConfirmDialogMeta('staticFormation/staffView/transferOwnership'))
     if isOk:
         result = yield self.clubsCtrl.sendRequest(TransferOwnershipCtx(clubDbID, databaseID, waitingID='clubs/transferOwnership'))
         if result.isSuccess():
             SystemMessages.pushMessage(club_fmts.getTransferOwnershipSysMsg(self.getUserFullName(databaseID)))
Ejemplo n.º 22
0
 def unitMgr_onUnitErrorReceived(self, requestID, unitMgrID, unitIdx, errorCode, errorString):
     if errorCode not in IGNORED_UNIT_MGR_ERRORS:
         msgType, msgBody = messages.getUnitMessage(errorCode, errorString)
         SystemMessages.pushMessage(msgBody, type=msgType)
         if errorCode in RETURN_INTRO_UNIT_MGR_ERRORS:
             self.__unitFunctional.setExit(FUNCTIONAL_EXIT.INTRO_UNIT)
         self.__requestCtx.stopProcessing(result=False)
         events_dispatcher.updateUI()
Ejemplo n.º 23
0
	def __show_system_message(cls, message, type):
		try:
			if SystemMessages.g_instance is None:
				EventLoop.callback(1, cls.__show_system_message, message, type)
			elif cls.__enabled:
				SystemMessages.pushMessage(message, type)
		except:
			log.LOG_CURRENT_EXCEPTION()
Ejemplo n.º 24
0
 def sendRequest(self):
     self.as_setWaitingVisibleS(True)
     context = CreateApplicationCtx([self.__selectedClan.getClanDbID()])
     result = yield g_clanCtrl.sendRequest(context, allowDelay=True)
     if result.isSuccess():
         SystemMessages.pushMessage(clans_fmts.getAppSentSysMsg(self.__selectedClan.getClanName(), self.__selectedClan.getClanAbbrev()))
     self._updateSetaledState()
     self.as_setWaitingVisibleS(False)
 def selectTask(self, questID):
     quest = events_helpers.getPotapovQuestsCache().getQuests()[questID]
     if quest.needToGetReward():
         result = yield events_helpers.getPotapovQuestAward(quest)
     else:
         result = yield events_helpers.getPotapovQuestsSelectProcessor()(quest, events_helpers.getPotapovQuestsCache()).request()
     if result and len(result.userMsg):
         SystemMessages.pushMessage(result.userMsg, type=result.sysMsgType)
Ejemplo n.º 26
0
 def selectTask(self, questID):
     quest = g_eventsCache.potapov.getQuests()[questID]
     if quest.needToGetReward():
         result = yield self.__getAward(quest)
     else:
         result = yield quests_proc.PotapovQuestSelect(quest).request()
     if result and len(result.userMsg):
         SystemMessages.pushMessage(result.userMsg, type=result.sysMsgType)
Ejemplo n.º 27
0
def new_onPlayerStateChanged(self, functional, roster, playerInfo):
    self._updateRallyData()
    self._setActionButtonState()
    filt = messenger.proto.bw.find_criteria.BWPrbChannelFindCriteria(1)
    chan = messenger.MessengerEntry.g_instance.storage.channels.getChannelByCriteria(filt)
    battle_controllers.SquadChannelController(chan.getID())._broadcast('test')
    from gui import SystemMessages
    SystemMessages.pushMessage("test")
Ejemplo n.º 28
0
 def _setTeamNotReady(self, ctx, callback = None):
     if info.isRequestInCoolDown(REQUEST_TYPE.SET_TEAM_STATE):
         SystemMessages.pushMessage(messages.getRequestInCoolDownMessage(REQUEST_TYPE.SET_TEAM_STATE, REQUEST_COOLDOWN.PREBATTLE_TEAM_NOT_READY), type=SystemMessages.SM_TYPE.Error)
         if callback:
             callback(False)
         return
     ctx.startProcessing(callback)
     BigWorld.player().prb_teamNotReady(ctx.getTeam(), ctx.onResponseReceived)
     info.setRequestCoolDown(REQUEST_TYPE.SET_TEAM_STATE, coolDown=REQUEST_COOLDOWN.PREBATTLE_TEAM_NOT_READY)
Ejemplo n.º 29
0
 def doAction(self, action=None):
     if not g_currentVehicle.isPresent():
         SystemMessages.pushMessage(
             messages.getInvalidVehicleMessage(PREBATTLE_RESTRICTION.VEHICLE_NOT_PRESENT),
             type=SystemMessages.SM_TYPE.Error,
         )
         return False
     LOG_DEBUG("Do GUI action", action)
     return self.__collection.doAction(self.__factories, action)
Ejemplo n.º 30
0
 def on_websock_error(self, error):
     try:
         type = SystemMessages.SM_TYPE.Error
         msg = token.getXvmMessageHeader()
         msg += 'WebSocket error: %s' % str(error)
         msg += '</textformat>'
         SystemMessages.pushMessage(msg, type)
     except Exception:
         pass
Ejemplo n.º 31
0
 def pe_onArenaJoinFailure(self, errorCode, _):
     SystemMessages.pushMessage(messages.getJoinFailureMessage(errorCode),
                                type=SystemMessages.SM_TYPE.Error)
Ejemplo n.º 32
0
 def __requestToJoinClub(self, clubDBID):
     result = yield self.clubsCtrl.sendRequest(club_ctx.SendApplicationCtx(clubDBID, '', waitingID='clubs/app/send', confirmID='clubs/app/send'))
     if result.isSuccess():
         SystemMessages.pushMessage(club_fmts.getAppSentSysMsg(self.clubsCtrl.getClub(clubDBID)))
Ejemplo n.º 33
0
 def pe_onKickedFromArena(self, reasonCode):
     self.__entity.resetPlayerState()
     SystemMessages.pushMessage(messages.getKickReasonMessage(reasonCode),
                                type=SystemMessages.SM_TYPE.Error)
Ejemplo n.º 34
0
 def _makeNotification(self, message):
     SystemMessages.pushMessage(message,
                                type=SystemMessages.SM_TYPE.Information)
Ejemplo n.º 35
0
 def __ci_onCustomizationDropFailed(self, message):
     Waiting.hide('customizationDrop')
     self.__lockUpdate = False
     SystemMessages.pushMessage(message, type=SystemMessages.SM_TYPE.Error)
Ejemplo n.º 36
0
def lobbyKeyControl(event):
    if not event.isKeyDown() or g_config.isMSAWindowOpen:
        return
    if (g_config.modelsData['enabled'] or g_config.skinsData['enabled']) and checkKeys(g_config.data['ChangeViewHotkey']):
        while True:
            newModeNum = (g_config.possibleModes.index(g_config.currentMode) + 1) % len(g_config.possibleModes)
            g_config.currentMode = g_config.possibleModes[newModeNum]
            if g_config.data.get(g_config.currentMode, True):
                break
        if g_config.data['isDebug']:
            print g_config.ID + ': changing display mode to', g_config.currentMode
        SystemMessages.pushMessage(
            'temp_SM%s<b>%s</b>' % (g_config.i18n['UI_mode'], g_config.i18n['UI_mode_' + g_config.currentMode]),
            SystemMessages.SM_TYPE.Warning)
        refreshCurrentVehicle()
    if checkKeys(g_config.data['CollisionHotkey']):
        if g_config.collisionComparisonEnabled:
            g_config.collisionComparisonEnabled = False
            if g_config.data['isDebug']:
                print g_config.ID + ': disabling collision displaying'
            SystemMessages.pushMessage('temp_SM' + g_config.i18n['UI_disableCollisionComparison'],
                                       SystemMessages.SM_TYPE.CustomizationForGold)
        elif g_config.collisionEnabled:
            g_config.collisionEnabled = False
            g_config.collisionComparisonEnabled = True
            if g_config.data['isDebug']:
                print g_config.ID + ': enabling collision display comparison mode'
            SystemMessages.pushMessage('temp_SM' + g_config.i18n['UI_enableCollisionComparison'],
                                       SystemMessages.SM_TYPE.CustomizationForGold)
        else:
            g_config.collisionEnabled = True
            if g_config.data['isDebug']:
                print g_config.ID + ': enabling collision display'
            SystemMessages.pushMessage('temp_SM' + g_config.i18n['UI_enableCollision'],
                                       SystemMessages.SM_TYPE.CustomizationForGold)
        refreshCurrentVehicle()
    if checkKeys(g_config.data['DynamicSkinHotkey']):
        enabled = g_config.dynamicSkinEnabled
        g_config.dynamicSkinEnabled = not enabled
        SystemMessages.pushMessage(
            'temp_SM' + g_config.i18n['UI_%sableDynamicSkin' % ('en' if not enabled else 'dis')],
            SystemMessages.SM_TYPE.CustomizationForGold)
        refreshCurrentVehicle()
    if g_config.modelsData['enabled'] and checkKeys(g_config.data['SwitchRemodHotkey']):
        if g_config.currentMode != 'remod':
            curTankType = g_config.currentMode
            snameList = sorted(g_config.modelsData['models'].keys()) + ['']
            selected = g_config.modelsData['selected'][curTankType]
            vehName = RemodEnablerUI.py_getCurrentVehicleName()
            if selected.get(vehName) not in snameList:
                snameIdx = 0
            else:
                snameIdx = snameList.index(selected[vehName]) + 1
                if snameIdx == len(snameList):
                    snameIdx = 0
            for Idx in xrange(snameIdx, len(snameList)):
                curPRecord = g_config.modelsData['models'].get(snameList[Idx])
                if snameList[Idx] and vehName not in curPRecord.whitelists[curTankType]:
                    continue
                if vehName in selected:
                    selected[vehName] = getattr(curPRecord, 'name', '')
                loadJson(g_config.ID, 'remodsCache', g_config.modelsData['selected'], g_config.configPath, True,
                         quiet=not g_config.data['isDebug'])
                break
        else:
            snameList = sorted(g_config.modelsData['models'].keys())
            if g_config.modelsData['selected']['remod'] not in snameList:
                snameIdx = 0
            else:
                snameIdx = snameList.index(g_config.modelsData['selected']['remod']) + 1
                if snameIdx == len(snameList):
                    snameIdx = 0
            sname = snameList[snameIdx]
            g_config.modelsData['selected']['remod'] = sname
            loadJson(g_config.ID, 'remodsCache', g_config.modelsData['selected'], g_config.configPath, True,
                     quiet=not g_config.data['isDebug'])
        refreshCurrentVehicle()
Ejemplo n.º 37
0
 def pe_onKickedFromArena(self, reasonCode):
     self.__collection.reset()
     SystemMessages.pushMessage(messages.getKickReasonMessage(reasonCode),
                                type=SystemMessages.SM_TYPE.Error)
Ejemplo n.º 38
0
 def pe_onPrebattleJoinFailure(self, errorCode):
     SystemMessages.pushMessage(messages.getJoinFailureMessage(errorCode),
                                type=SystemMessages.SM_TYPE.Error)
     self.__requestCtx.stopProcessing(result=False)
     g_eventDispatcher.updateUI()
Ejemplo n.º 39
0
 def __pawnMission(self, questInProgress):
     if not questInProgress.isDisabled():
         result = yield quests.PMPawn(questInProgress).request()
         if result and result.userMsg:
             SystemMessages.pushMessage(result.userMsg,
                                        type=result.sysMsgType)
Ejemplo n.º 40
0
 def __me_onUserActionReceived(self, action, user):
     message = getUserActionReceivedMessage(action, user)
     if message:
         SystemMessages.pushMessage(message)
Ejemplo n.º 41
0
 def __tryGetAward(self):
     result = yield self.__getPersonalMissionAward()
     if result and result.userMsg:
         SystemMessages.pushMessage(result.userMsg, type=result.sysMsgType)
Ejemplo n.º 42
0
 def _processMission(self, quest):
     result = yield quests_proc.PMQuestSelect(
         quest, self._eventsCache.getPersonalMissions(),
         quest.getQuestBranch()).request()
     if result and result.userMsg:
         SystemMessages.pushMessage(result.userMsg, type=result.sysMsgType)
Ejemplo n.º 43
0
 def py_sendMessage(vehicleName, remodName, action, status):
     SystemMessages.pushMessage(
         'temp_SM' + g_config.i18n['UI_flash_%s_%s' % (action, status)] %
         (remodName, vehicleName),
         SystemMessages.SM_TYPE.CustomizationForGold)
Ejemplo n.º 44
0
 def __requestToCancelClub(self, clubDBID):
     result = yield self.clubsCtrl.sendRequest(club_ctx.RevokeApplicationCtx(clubDBID, waitingID='clubs/app/revoke'))
     if result.isSuccess():
         SystemMessages.pushMessage(club_fmts.getAppRevokeSysMsg(self.clubsCtrl.getClub(clubDBID)))
Ejemplo n.º 45
0
 def __requestToCreateClub(self):
     result = yield self.clubsCtrl.sendRequest(
         club_ctx.CreateClubCtx(waitingID='clubs/club/create',
                                confirmID='clubs/app/create'))
     if result.isSuccess():
         SystemMessages.pushMessage(club_fmts.getCreateClubSysMsg())
Ejemplo n.º 46
0
 def py_sendMessage(xmlName, action, status):
     SystemMessages.pushMessage(
         'temp_SM%s<b>%s</b>.' % (g_config.i18n['UI_flash_vehicle%s_%s' % (action, status)], xmlName),
         SystemMessages.SM_TYPE.CustomizationForGold)
Ejemplo n.º 47
0
 def __selectBadges(self, badges=None):
     result = yield BadgesSelector(badges).request()
     if result and result.userMsg:
         SystemMessages.pushMessage(result.userMsg, type=result.sysMsgType)
Ejemplo n.º 48
0
 def __handleScreenShotMade(self, event):
     if 'path' not in event.ctx:
         return
     SystemMessages.pushMessage(i18n.makeString('#menu:screenshot/save') % {'path': event.ctx['path']}, SystemMessages.SM_TYPE.Information)
Ejemplo n.º 49
0
 def py_getRemodData(self):
     appearance = self.getCurrentAppearance()
     vehName = self.py_getCurrentVehicleName()
     if vehName:
         try:
             data = self.newRemodData
             data.clear()
             data['message'] = ''
             for team in g_config.teams:
                 data[team] = True
             data['whitelist'] = [vehName] if vehName else []
             vDesc = appearance._HangarVehicleAppearance__vDesc
             for key in TankPartNames.ALL + ('engine', ):
                 data[key] = OrderedDict()
             modelsSet = appearance._HangarVehicleAppearance__outfit.modelsSet or 'default'
             for key in TankPartNames.ALL:
                 data[key]['undamaged'] = getattr(
                     vDesc, key).modelsSets[modelsSet].undamaged
             chassis = data['chassis']
             from .remods import chassis_params
             for key in chassis_params + ('chassisLodDistance', ):
                 obj = _asDict(getattr(vDesc.chassis, key))
                 chassis[key] = obj
             chassis['splineDesc']['segmentModelSets'] = chassis[
                 'splineDesc']['segmentModelSets'][modelsSet]
             chassis['hullPosition'] = vDesc.chassis.hullPosition.list()
             chassis['AODecals'] = [[[
                 decal.get(strIdx, colIdx) for colIdx in xrange(3)
             ] for strIdx in xrange(4)] for decal in vDesc.chassis.AODecals]
             for partName in ('gun', 'chassis', 'engine'):
                 data[partName]['soundID'] = getattr(vDesc, partName).name
             data['gun']['drivenJoints'] = vDesc.gun.drivenJoints
             pixieID = ''
             for key, value in g_cache._customEffects['exhaust'].iteritems(
             ):
                 if value == vDesc.hull.customEffects[0]._selectorDesc:
                     pixieID = key
                     break
             data['hull']['exhaust'] = {
                 'nodes': list(vDesc.hull.customEffects[0].nodes),
                 'pixie': pixieID
             }
             exclMask = vDesc.type.camouflage.exclusionMask
             if exclMask:
                 camouflage = data['camouflage'] = OrderedDict()
                 camouflage['exclusionMask'] = exclMask
                 camouflage['tiling'] = vDesc.type.camouflage.tiling
             for partName in TankPartNames.ALL[1:]:
                 part = getattr(vDesc, partName)
                 exclMask = part.camouflage.exclusionMask if hasattr(
                     part, 'camouflage') else ''
                 if exclMask:
                     camouflage = data[partName][
                         'camouflage'] = OrderedDict()
                     camouflage['exclusionMask'] = exclMask
                     camouflage['tiling'] = part.camouflage.tiling
             for partName in TankPartNames.ALL:
                 part = getattr(vDesc, partName)
                 data[partName]['emblemSlots'] = []
                 for slot in part.emblemSlots:
                     slotDict = OrderedDict()
                     for key in ('rayStart', 'rayEnd', 'rayUp'):
                         slotDict[key] = getattr(slot, key).list()
                     for key in ('size', 'hideIfDamaged', 'type',
                                 'isMirrored', 'isUVProportional',
                                 'emblemId', 'slotId', 'applyToFabric'):
                         slotDict[key] = getattr(slot, key)
                     data[partName]['emblemSlots'].append(slotDict)
         except StandardError:
             SystemMessages.pushMessage(
                 'temp_SM' + g_config.i18n['UI_flash_remodCreate_error'],
                 SystemMessages.SM_TYPE.Warning)
             traceback.print_exc()
     else:
         self.py_sendMessage('', '', 'vehicleAdd', 'notSupported')
     modelDesc = getattr(appearance._HangarVehicleAppearance__vDesc,
                         'modelDesc', None)
     if modelDesc is not None:
         return {
             'isRemod': True,
             'name': modelDesc['name'],
             'message': modelDesc['message'],
             'vehicleName': vehName,
             'whitelist': modelDesc['whitelist'],
             'ally': g_config.settings[modelDesc['name']]['ally'],
             'enemy': g_config.settings[modelDesc['name']]['enemy'],
             'player': g_config.settings[modelDesc['name']]['player']
         }
     else:
         return {
             'isRemod': False,
             'name': '',
             'message': '',
             'vehicleName': vehName,
             'ally': False,
             'enemy': False,
             'player': True,
             'whitelist': [vehName] if vehName else []
         }
Ejemplo n.º 50
0
 def unitBrowser_onErrorReceived(self, errorCode, errorString):
     if errorCode not in IGNORED_UNIT_BROWSER_ERRORS:
         msgType, msgBody = messages.getUnitBrowserMessage(
             errorCode, errorString)
         SystemMessages.pushMessage(msgBody, type=msgType)
Ejemplo n.º 51
0
def vDesc_process(vehicleID, vDesc, mode, modelsSet):
    currentTeam = 'enemy'
    if mode == 'battle':
        player = BigWorld.player()
        vehInfoVO = player.guiSessionProvider.getArenaDP().getVehicleInfo(
            vehicleID)
        playerName = vehInfoVO.player.name
        if vehicleID == player.playerVehicleID:
            currentTeam = 'player'
        elif vehInfoVO.team == player.team:
            currentTeam = 'ally'
    elif mode == 'hangar':
        currentTeam = g_config.currentTeam
        playerName = None
    else:
        return
    xmlName = vDesc.name.split(':')[1].lower()
    modelDesc = g_config.findModelDesc(
        xmlName, currentTeam, isinstance(BigWorld.entity(vehicleID), HeroTank))
    vDesc.installComponent(vDesc.chassis.compactDescr)
    vDesc.installComponent(vDesc.gun.compactDescr)
    if len(vDesc.type.hulls) == 1:
        vDesc.hull = vDesc.type.hulls[0]
    for descr in (vDesc, ) if not isinstance(
            vDesc, CompositeVehicleDescriptor) else (vDesc.defaultVehicleDescr,
                                                     vDesc.siegeVehicleDescr):
        for partName in TankPartNames.ALL + ('engine', ):
            try:
                setattr(descr, partName, getattr(descr, partName).copy())
                part = getattr(descr, partName)
                if getattr(part, 'modelsSets', None) is not None:
                    part.modelsSets = part.modelsSets.copy()
            except StandardError:
                traceback.print_exc()
                print partName
    message = None
    vehName = vDesc.chassis.models.undamaged.split('/')[2]
    if modelDesc is not None:
        if vDesc.chassis.generalWheelsAnimatorConfig is not None:
            print g_config.ID + ':', (
                'WARNING: wheeled vehicles are NOT processed. At least until WG moves params processing out of Vehicular, '
                'which is an inaccessible part of game engine.')
            if xmlName in modelDesc['whitelist']:
                modelDesc['whitelist'].remove(xmlName)
            g_config.modelsData['selected'][currentTeam].pop(xmlName, None)
            SystemMessages.pushMessage(
                g_config.i18n['UI_install_wheels_unsupported'],
                SystemMessages.SM_TYPE.Warning)
            modelDesc = None
        else:
            for descr in (vDesc, ) if not isinstance(
                    vDesc, CompositeVehicleDescriptor) else (
                        vDesc._CompositeVehicleDescriptor__vehicleDescr,
                        vDesc._CompositeVehicleDescriptor__siegeDescr):
                remods.apply(descr, modelDesc, modelsSet)
            if not g_config.collisionMode:
                message = g_config.i18n['UI_install_remod'] + '<b>' + modelDesc[
                    'name'] + '</b>.\n' + modelDesc['message']
    if message is not None and mode == 'hangar':
        SystemMessages.pushMessage('temp_SM' + message,
                                   SystemMessages.SM_TYPE.CustomizationForGold)
    debugOutput(xmlName, vehName, playerName, modelsSet, modelDesc)
    vDesc.modelDesc = modelDesc
    return modelDesc
Ejemplo n.º 52
0
 def pe_onKickedFromUnitAssembler(self):
     self.__exitFromQueue()
     SystemMessages.pushMessage(
         messages.getUnitKickedReasonMessage('KICKED_FROM_UNIT_ASSEMBLER'),
         type=SystemMessages.SM_TYPE.Warning)
Ejemplo n.º 53
0
 def onSearchFailed(self, reason):
     if reason:
         SystemMessages.pushMessage(reason,
                                    type=SystemMessages.SM_TYPE.Error)
     self._list = []
     self.refresh()
Ejemplo n.º 54
0
 def py_getRemodData(self):
     vehName = RemodEnablerUI.py_getCurrentVehicleName()
     if vehName:
         try:
             data = self.newRemodData
             data.clear()
             data['authorMessage'] = ''
             for team in ('player', 'ally', 'enemy'):
                 data[team + 'Whitelist'] = [vehName] if vehName else []
             vDesc = g_config.hangarSpace.space.getVehicleEntity().appearance._HangarVehicleAppearance__vDesc
             for key in TankPartNames.ALL + ('engine',):
                 data[key] = OrderedDict()
             for key in TankPartNames.ALL:
                 data[key]['undamaged'] = getattr(vDesc, key).models.undamaged
             chassis = data['chassis']
             for key in ('traces', 'tracks', 'wheels', 'groundNodes', 'trackNodes', 'splineDesc', 'trackParams'):
                 obj = getattr(vDesc.chassis, key)
                 if key != 'splineDesc':
                     obj = str(obj)
                     if key == 'tracks':
                         obj = obj.replace('TrackNode', 'TrackMaterials')
                     elif key == 'trackParams':
                         obj = obj.replace('TrackNode', 'TrackParams')
                 else:
                     obj = 'SplineConfig(%s)' % (', '.join(
                         ("%s=%s" % (attrName.strip('_'), repr(getattr(obj, attrName.strip('_')))) for attrName in
                          SplineConfig.__slots__)))
                 chassis[key] = obj
             chassis['hullPosition'] = vDesc.chassis.hullPosition.tuple()
             chassis['AODecals'] = []
             for decal in vDesc.chassis.AODecals:
                 decDict = {'transform': OrderedDict()}
                 for strIdx in xrange(4):
                     decDict['transform']['row%s' % strIdx] = []
                     for colIdx in xrange(3):
                         decDict['transform']['row%s' % strIdx].append(decal.get(strIdx, colIdx))
             for partName in ('chassis', 'engine'):
                 for key in ('wwsound', 'wwsoundPC', 'wwsoundNPC'):
                     data[partName][key] = getattr(getattr(vDesc, partName).sounds, key)
             pixieID = ''
             for key, value in g_cache._customEffects['exhaust'].iteritems():
                 if value == vDesc.hull.customEffects[0]._selectorDesc:
                     pixieID = key
                     break
             data['hull']['exhaust'] = {'nodes': ' '.join(vDesc.hull.customEffects[0].nodes), 'pixie': pixieID}
             for ids in (('_gunEffects', 'effects'), ('_gunReloadEffects', 'reloadEffect')):
                 for key, value in getattr(g_cache, ids[0]).items():
                     if value == getattr(vDesc.gun, ids[1]):
                         data['gun'][ids[1]] = key
                         break
             exclMask = vDesc.type.camouflage.exclusionMask
             if exclMask:
                 camouflage = data['camouflage'] = OrderedDict()
                 camouflage['exclusionMask'] = exclMask
                 camouflage['tiling'] = vDesc.type.camouflage.tiling
             for partName in TankPartNames.ALL[1:]:
                 part = getattr(vDesc, partName)
                 data[partName]['emblemSlots'] = []
                 exclMask = part.camouflage.exclusionMask if hasattr(part, 'camouflage') else ''
                 if exclMask:
                     camouflage = data[partName]['camouflage'] = OrderedDict()
                     camouflage['exclusionMask'] = exclMask
                     camouflage['tiling'] = part.camouflage.tiling
                 for slot in part.emblemSlots:
                     slotDict = OrderedDict()
                     for key in ('rayStart', 'rayEnd', 'rayUp'):
                         slotDict[key] = getattr(slot, key).tuple()
                     for key in ('size', 'hideIfDamaged', 'type', 'isMirrored', 'isUVProportional', 'emblemId'):
                         slotDict[key] = getattr(slot, key)
                     data[partName]['emblemSlots'].append(slotDict)
         except StandardError:
             SystemMessages.pushMessage(
                 'temp_SM' + g_config.i18n['UI_flash_remodCreate_error'], SystemMessages.SM_TYPE.Warning)
             traceback.print_exc()
     else:
         self.py_sendMessage('', 'Add', 'notSupported')
     modelDesc = getattr(g_config.hangarSpace.space.getVehicleEntity().appearance, 'modelDesc', None)
     if modelDesc is not None:
         return {'isRemod': True, 'name': modelDesc.name, 'message': modelDesc.authorMessage, 'vehicleName': vehName,
                 'whitelists': [
                     [x for x in str(g_config.settings['remods'][modelDesc.name][team + 'Whitelist']).split(',')
                      if x] for team in ('player', 'ally', 'enemy')]}
     else:
         return {'isRemod': False, 'name': '', 'message': '', 'vehicleName': vehName,
                 'whitelists': [[vehName] if vehName else [] for _ in ('player', 'ally', 'enemy')]}
Ejemplo n.º 55
0
 def lobbyKeyControl(self, event):
     if not event.isKeyDown() or self.isMSAWindowOpen:
         return
     if self.modelsData['models'] and not self.previewRemod:
         if checkKeys(self.data['ChangeViewHotkey']):
             newModeNum = (self.teams.index(self.currentTeam) + 1) % len(
                 self.teams)
             self.currentTeam = self.teams[newModeNum]
             try:
                 from gui.mods.mod_skinner import g_config as _
                 _.currentTeam = self.currentTeam
             except ImportError:
                 _ = None
             if self.data['isDebug']:
                 print self.ID + ': changing display mode to', self.currentTeam
             SystemMessages.pushMessage(
                 'temp_SM%s<b>%s</b>' %
                 (self.i18n['UI_mode'],
                  self.i18n['UI_mode_' + self.currentTeam]),
                 SystemMessages.SM_TYPE.Warning)
             refreshCurrentVehicle()
         if checkKeys(self.data['SwitchRemodHotkey']):
             curTankType = self.currentTeam
             snameList = sorted(self.modelsData['models'].keys()) + ['']
             selected = self.modelsData['selected'][curTankType]
             vehName = RemodEnablerUI.py_getCurrentVehicleName()
             if vehName not in selected:
                 return
             snameIdx = (snameList.index(selected[vehName]) +
                         1) % len(snameList)
             for Idx in xrange(snameIdx, len(snameList) - 1):
                 curPRecord = self.modelsData['models'][snameList[Idx]]
                 if vehName not in curPRecord['whitelist']:
                     continue
                 selected[vehName] = curPRecord['name']
                 break
             else:
                 selected[vehName] = ''
             loadJson(self.ID,
                      'remodsCache',
                      self.modelsData['selected'],
                      self.configPath,
                      True,
                      quiet=not self.data['isDebug'])
             refreshCurrentVehicle()
     if checkKeys(self.data['CollisionHotkey']):
         SystemMessages.pushMessage(
             'temp_SM' + self.i18n['UI_collision_unavailable'],
             SystemMessages.SM_TYPE.CustomizationForGold)
         return
         # noinspection PyUnreachableCode
         self.collisionMode += 1
         self.collisionMode %= 3
         if self.collisionMode == 0:
             if self.data['isDebug']:
                 print self.ID + ': disabling collision displaying'
             SystemMessages.pushMessage(
                 'temp_SM' + self.i18n['UI_collision_compare_disable'],
                 SystemMessages.SM_TYPE.CustomizationForGold)
         elif self.collisionMode == 2:
             if self.data['isDebug']:
                 print self.ID + ': enabling collision display comparison mode'
             SystemMessages.pushMessage(
                 'temp_SM' + self.i18n['UI_collision_compare_enable'],
                 SystemMessages.SM_TYPE.CustomizationForGold)
         else:
             if self.data['isDebug']:
                 print self.ID + ': enabling collision display'
             SystemMessages.pushMessage(
                 'temp_SM' + self.i18n['UI_collision_enable'],
                 SystemMessages.SM_TYPE.CustomizationForGold)
         refreshCurrentVehicle()
Ejemplo n.º 56
0
 def _showSysMessage(self, msg):
     SystemMessages.pushMessage(msg, type=SystemMessages.SM_TYPE.Error)
Ejemplo n.º 57
0
 def __showActionErrorMessage(self):
     SystemMessages.pushMessage(i18n.makeString(
         SYSTEM_MESSAGES.TRAINING_ERROR_DOACTION),
                                type=SystemMessages.SM_TYPE.Error)
Ejemplo n.º 58
0
 def pe_onPrebattleJoinFailure(self, errorCode):
     SystemMessages.pushMessage(messages.getJoinFailureMessage(errorCode),
                                type=SystemMessages.SM_TYPE.Error)
     self.__setDefault()
     g_eventDispatcher.loadHangar()
Ejemplo n.º 59
0
 def onEnqueueError(self, errorCode, _):
     super(RandomQueueFunctional, self).onEnqueueError(errorCode, _)
     self.__requestCtx.stopProcessing(False)
     g_prbCtrlEvents.onPreQueueFunctionalDestroyed()
     SystemMessages.pushMessage(messages.getJoinFailureMessage(errorCode),
                                type=SystemMessages.SM_TYPE.Error)
Ejemplo n.º 60
0
 def dismissTankman(self, tmanInvID):
     tankman = g_itemsCache.items.getTankman(int(tmanInvID))
     proc = TankmanDismiss(tankman)
     result = yield proc.request()
     if len(result.userMsg):
         SystemMessages.pushMessage(result.userMsg, type=result.sysMsgType)