Example #1
0
 def getDateTimeFormat(cls, value):
     return cls._makeLocalTimeString(
         value,
         lambda localTime: "{0:>s} {1:>s}".format(
             BigWorld.wg_getShortDateFormat(value), BigWorld.wg_getLongTimeFormat(value)
         ),
     )
Example #2
0
    def handleLoginRejectedBan(self, status, message):
        try:
            LOG_DEBUG('handleLoginRejectedBan', message)
            msg_dict = json.loads(message)
            if not isinstance(msg_dict, dict):
                self.handleLoginCustomDefinedError(status, message)
                return
            self.__loginDataLoader.token2 = msg_dict.get('token2', '')
            self.__loginDataLoader.saveUserToken(self.__loginDataLoader.passLength, self.__loginDataLoader.token2)
            json_dict = msg_dict.get('bans')
            msg_dict = json.loads(json_dict)
        except Exception:
            LOG_CURRENT_EXCEPTION()
            self.handleLoginCustomDefinedError(status, message)
            return

        expiryTime = 0
        reason = ''
        if isinstance(msg_dict, dict):
            expiryTime = int(msg_dict.get('expiryTime', 0))
            reason = i18n.encodeUtf8(msg_dict.get('reason', ''))
        if reason == BAN_REASON.CHINA_MIGRATION:
            self.__handleMigrationNeeded()
        if reason.startswith('#'):
            reason = i18n.makeString(reason)
        if expiryTime > 0:
            expiryTime = makeLocalServerTime(expiryTime)
            expiryTime = BigWorld.wg_getLongDateFormat(expiryTime) + ' ' + BigWorld.wg_getLongTimeFormat(expiryTime)
            errorMessage = i18n.makeString(MENU.LOGIN_STATUS_LOGIN_REJECTED_BAN, time=expiryTime, reason=reason)
        else:
            errorMessage = i18n.makeString(MENU.LOGIN_STATUS_LOGIN_REJECTED_BAN_UNLIMITED, reason=reason)
        self.onSetStatus(errorMessage, self.ALL_VALID)
Example #3
0
 def getMessage(self):
     formatArgs = {"reason": "", "expiryTime": ""}
     if self.reason:
         formatArgs["reason"] = i18n.makeString(DIALOGS.DISCONNECTED_REASON, i18n.makeString(self.reason))
     if self.expiryTime:
         expiryTime = time_utils.makeLocalServerTime(int(self.expiryTime))
         formatArgs["expiryTime"] = "%s %s" % (
             BigWorld.wg_getLongDateFormat(expiryTime),
             BigWorld.wg_getLongTimeFormat(expiryTime),
         )
     key = DIALOGS.DISCONNECTED_MESSAGEKICK
     if self.isBan:
         key = DIALOGS.DISCONNECTED_MESSAGEBANPERIOD if self.expiryTime else DIALOGS.DISCONNECTED_MESSAGEBAN
     return i18n.makeString(key, **formatArgs)
Example #4
0
 def getMessage(self):
     formatArgs = {'reason': '', 'expiryTime': ''}
     if self.reason:
         formatArgs['reason'] = i18n.makeString(
             DIALOGS.DISCONNECTED_REASON, i18n.makeString(self.reason))
     if self.expiryTime:
         expiryTime = time_utils.makeLocalServerTime(int(self.expiryTime))
         formatArgs['expiryTime'] = '%s %s' % (
             BigWorld.wg_getLongDateFormat(expiryTime),
             BigWorld.wg_getLongTimeFormat(expiryTime))
     key = DIALOGS.DISCONNECTED_MESSAGEKICK
     if self.isBan:
         key = DIALOGS.DISCONNECTED_MESSAGEBANPERIOD if self.expiryTime else DIALOGS.DISCONNECTED_MESSAGEBAN
     return i18n.makeString(key, **formatArgs)
Example #5
0
 def show(self, reason = None, isBan = None, expiryTime = None):
     Waiting.close()
     g_cursorDelegator.syncMousePosition(self, None, None)
     params = {'reason': '',
      'expiryTime': ''}
     if reason:
         params['reason'] = makeString('#dialogs:disconnected/reason', makeString(reason))
     if expiryTime:
         from helpers.time_utils import makeLocalServerTime
         expiryTime = makeLocalServerTime(int(expiryTime))
         params['expiryTime'] = BigWorld.wg_getLongDateFormat(expiryTime) + ' ' + BigWorld.wg_getLongTimeFormat(expiryTime)
     message = 'messageKick' if not isBan else 'messageBanPeriod' if expiryTime else 'messageBan'
     message = makeString('#dialogs:disconnected/' + message) % params
     self.setMovieVariable('_root._level0.setMessage', [message])
 def __loginRejectedBan(self, responseData):
     bansJSON = responseData.get('bans')
     bans = json.loads(bansJSON)
     expiryTime = int(bans.get('expiryTime', '0'))
     reason = bans.get('reason', '')
     if reason == BAN_REASON.CHINA_MIGRATION:
         g_eventBus.handleEvent(OpenLinkEvent(OpenLinkEvent.MIGRATION))
     if reason.startswith('#'):
         reason = _ms(reason)
     if expiryTime > 0:
         expiryTime = makeLocalServerTime(expiryTime)
         expiryTime = BigWorld.wg_getLongDateFormat(expiryTime) + ' ' + BigWorld.wg_getLongTimeFormat(expiryTime)
         self.as_setErrorMessageS(_ms(MENU.LOGIN_STATUS_LOGIN_REJECTED_BAN, time=expiryTime, reason=reason), INVALID_FIELDS.ALL_VALID)
     else:
         self.as_setErrorMessageS(_ms(MENU.LOGIN_STATUS_LOGIN_REJECTED_BAN_UNLIMITED, reason=reason), INVALID_FIELDS.ALL_VALID)
Example #7
0
 def show(self, reason = None, isBan = None, expiryTime = None):
     Waiting.close()
     g_cursorDelegator.syncMousePosition(self, None, None)
     params = {'reason': '',
      'expiryTime': ''}
     if reason:
         params['reason'] = makeString('#dialogs:disconnected/reason', makeString(reason))
     if expiryTime:
         from helpers.time_utils import makeLocalServerTime
         expiryTime = makeLocalServerTime(int(expiryTime))
         params['expiryTime'] = BigWorld.wg_getLongDateFormat(expiryTime) + ' ' + BigWorld.wg_getLongTimeFormat(expiryTime)
     message = 'messageKick' if not isBan else ('messageBanPeriod' if expiryTime else 'messageBan')
     message = makeString('#dialogs:disconnected/' + message) % params
     self.setMovieVariable('_root._level0.setMessage', [message])
     return
Example #8
0
 def __loginRejectedBan(self, responseData):
     bansJSON = responseData.get('bans')
     bans = json.loads(bansJSON)
     expiryTime = int(bans.get('expiryTime', '0'))
     reason = bans.get('reason', '')
     if reason == BAN_REASON.CHINA_MIGRATION:
         g_eventBus.handleEvent(OpenLinkEvent(OpenLinkEvent.MIGRATION))
     if reason.startswith('#'):
         reason = _ms(reason)
     if expiryTime > 0:
         expiryTime = makeLocalServerTime(expiryTime)
         expiryTime = BigWorld.wg_getLongDateFormat(expiryTime) + ' ' + BigWorld.wg_getLongTimeFormat(expiryTime)
         self.as_setErrorMessageS(_ms(MENU.LOGIN_STATUS_LOGIN_REJECTED_BAN, time=expiryTime, reason=reason), INVALID_FIELDS.ALL_VALID)
     else:
         self.as_setErrorMessageS(_ms(MENU.LOGIN_STATUS_LOGIN_REJECTED_BAN_UNLIMITED, reason=reason), INVALID_FIELDS.ALL_VALID)
Example #9
0
    def handleLoginRejectedBan(self, status, message):
        try:
            LOG_DEBUG('handleLoginRejectedBan', message)
            msg_dict = json.loads(message)
            if not isinstance(msg_dict, dict):
                self.handleLoginCustomDefinedError(status, message)
                return
            self.__loginDataLoader.token2 = msg_dict.get('token2', '')
            self.__loginDataLoader.saveUserToken(
                self.__loginDataLoader.passLength,
                self.__loginDataLoader.token2)
            json_dict = msg_dict.get('bans')
            msg_dict = json.loads(json_dict)
        except Exception:
            LOG_CURRENT_EXCEPTION()
            self.handleLoginCustomDefinedError(status, message)
            return

        expiryTime = 0
        reason = ''
        if isinstance(msg_dict, dict):
            expiryTime = int(msg_dict.get('expiryTime', 0))
            reason = msg_dict.get('reason', '').encode('utf-8')
        if reason == BAN_REASON.CHINA_MIGRATION:
            self.__handleMigrationNeeded()
        if reason.startswith('#'):
            reason = i18n.makeString(reason)
        if expiryTime > 0:
            expiryTime = makeLocalServerTime(expiryTime)
            expiryTime = BigWorld.wg_getLongDateFormat(
                expiryTime) + ' ' + BigWorld.wg_getLongTimeFormat(expiryTime)
            errorMessage = i18n.makeString(
                MENU.LOGIN_STATUS_LOGIN_REJECTED_BAN,
                time=expiryTime,
                reason=reason)
        else:
            errorMessage = i18n.makeString(
                MENU.LOGIN_STATUS_LOGIN_REJECTED_BAN_UNLIMITED, reason=reason)
        self.onSetStatus(errorMessage, self.ALL_VALID)
Example #10
0
 def getLongTimeFormat(cls, value):
     return BigWorld.wg_getLongTimeFormat(time_utils.makeLocalServerTime(value))
Example #11
0
def getLongDatetimeFormat(time):
    return BigWorld.wg_getLongDateFormat(
        time) + ' ' + BigWorld.wg_getLongTimeFormat(time)
Example #12
0
 def _getValue(self, value):
     return BigWorld.wg_getLongTimeFormat(self._getLocalTime(value))
Example #13
0
 def getLongDatetimeFormat(cls, time):
     return '{0:>s} {1:>s}'.format(BigWorld.wg_getShortDateFormat(time), BigWorld.wg_getLongTimeFormat(time))
Example #14
0
 def getMessageLongDatetimeFormat(cls, time):
     return '({0:>s} {1:>s}) '.format(
         BigWorld.wg_getShortDateFormat(time),
         BigWorld.wg_getLongTimeFormat(time)).decode('utf-8', 'ignore')
Example #15
0
 def getLongDatetimeFormat(cls, time):
     return '{0:>s} {1:>s}'.format(BigWorld.wg_getShortDateFormat(time),
                                   BigWorld.wg_getLongTimeFormat(time))
Example #16
0
 def getLongTimeFormat(cls, time):
     return '{0:>s}'.format(BigWorld.wg_getLongTimeFormat(time))
Example #17
0
 def getDateTimeFormat(cls, value):
     return cls._makeLocalTimeString(
         value, lambda localTime: '{0:>s} {1:>s}'.format(
             BigWorld.wg_getShortDateFormat(value),
             BigWorld.wg_getLongTimeFormat(value)))
Example #18
0
def getLongDatetimeFormat(time):
    return BigWorld.wg_getLongDateFormat(time) + ' ' + BigWorld.wg_getLongTimeFormat(time)
Example #19
0
 def getDateTimeFormat(cls, value):
     value = time_utils.makeLocalServerTime(value)
     return '{0:>s} {1:>s}'.format(BigWorld.wg_getShortDateFormat(value), BigWorld.wg_getLongTimeFormat(value))
Example #20
0
 def getLongTimeFormat(cls, time):
     return '{0:>s}'.format(BigWorld.wg_getLongTimeFormat(time))
Example #21
0
def getPrebattleStartTimeString(startTime):
    startTimeString = BigWorld.wg_getLongTimeFormat(startTime)
    if startTime - time.time() > 8640:
        startTimeString = '{0:>s} {1:>s}'.format(BigWorld.wg_getLongDateFormat(startTime), startTimeString)
    return startTimeString
Example #22
0
 def getMessageLongDatetimeFormat(cls, time):
     return '({0:>s} {1:>s}) '.format(BigWorld.wg_getShortDateFormat(time), BigWorld.wg_getLongTimeFormat(time)).decode('utf-8', 'ignore')
Example #23
0
def getPrebattleStartTimeString(startTime):
    startTimeString = BigWorld.wg_getLongTimeFormat(startTime)
    if startTime - time.time() > 8640:
        startTimeString = '{0:>s} {1:>s}'.format(BigWorld.wg_getLongDateFormat(startTime), startTimeString)
    return startTimeString
Example #24
0
 def _getValue(self, value):
     value = self._getLocalTime(value)
     return '{0:>s} {1:>s}'.format(BigWorld.wg_getShortDateFormat(value),
                                   BigWorld.wg_getLongTimeFormat(value))
Example #25
0
 def _getValue(self, value):
     return BigWorld.wg_getLongTimeFormat(self._getLocalTime(value))
Example #26
0
 def _getValue(self, value):
     value = self._getLocalTime(value)
     return '{0:>s} {1:>s}'.format(BigWorld.wg_getShortDateFormat(value), BigWorld.wg_getLongTimeFormat(value))
Example #27
0
 def getMessageLongDatetimeFormat(cls, time):
     return "({0:>s} {1:>s}) ".format(
         BigWorld.wg_getShortDateFormat(time), BigWorld.wg_getLongTimeFormat(time)
     ).decode("utf-8", "ignore")