示例#1
0
 def getCommandText(self):
     command = _ACTIONS.battleChatCommandFromActionID(self._commandID)
     if not command:
         LOG_ERROR('Command is not found', self._commandID)
         return u''
     else:
         i18nKey = I18N_INGAME_GUI.chat_shortcuts(command.msgText)
         i18nArguments = {}
         if i18nKey is not None:
             if self.isOnMinimap():
                 if self.isSPGAimCommand():
                     reloadTime = self._protoData['floatArg1']
                     if reloadTime > 0:
                         i18nArguments['reloadTime'] = reloadTime
                         i18nKey += '_reloading'
             elif self.hasTarget():
                 i18nArguments['target'] = self._getTarget()
                 if self.isSPGAimCommand():
                     reloadTime = self._protoData['floatArg1']
                     if reloadTime > 0:
                         i18nArguments['reloadTime'] = reloadTime
                         i18nKey += '_reloading'
             elif self.isBaseRelatedCommand():
                 strArg = self._protoData['strArg1']
                 if strArg != '':
                     i18nArguments['strArg1'] = strArg
                     i18nKey += '_numbered'
             else:
                 i18nArguments = self._protoData
             text = i18n.makeString(i18nKey, **i18nArguments)
         else:
             text = command.msgText
         return unicode(text, 'utf-8', errors='ignore')
示例#2
0
def getBattleCommandExample(msgText):
    i18nKey = I18N_INGAME_GUI.chat_example(msgText)
    if i18nKey is not None:
        i18nName = html.escape(i18n.makeString(i18nKey))
    else:
        i18nName = msgText
    return i18nName
示例#3
0
def getBattleCommandExample(msgText):
    i18nKey = I18N_INGAME_GUI.chat_example(msgText)
    if i18nKey is not None:
        i18nName = html.escape(i18n.makeString(i18nKey))
    else:
        i18nName = msgText
    return i18nName
示例#4
0
 def messageOnMarker(self):
     command = _ACTIONS.battleChatCommandFromActionID(self._commandID)
     i18nKey = I18N_INGAME_GUI.chat_shortcuts(command.msgOnMarker)
     if i18nKey is not None:
         text = i18n.makeString(i18nKey)
     else:
         text = command.msgOnMarker
     return unicode(text, 'utf-8', errors='ignore')
示例#5
0
 def __getHint(self):
     keyName = getReadableKey(CommandMapping.CMD_CM_VEHICLE_SWITCH_AUTOROTATION)
     if keyName:
         pressText = text_styles.tutorial(INGAME_GUI.SIEGEMODE_HINT_PRESS)
         hintText = text_styles.tutorial(INGAME_GUI.siegeModeHint(self._siegeState))
         keyText = makeHtmlString('html_templates:battle/siegeMode', 'toggle', ctx={'key': keyName})
         return (keyText, pressText, hintText)
     return ('', '', text_styles.tutorial(INGAME_GUI.SIEGEMODE_HINT_NOBINDING))
示例#6
0
 def _getHint(self):
     keyName = getReadableKey(CommandMapping.CMD_CM_VEHICLE_SWITCH_AUTOROTATION)
     pressText = ''
     if keyName:
         pressText = INGAME_GUI.SIEGEMODE_HINT_PRESS
         hintText = INGAME_GUI.siegeModeHint(self.__siegeState)
     else:
         hintText = INGAME_GUI.SIEGEMODE_HINT_NOBINDING
     return HintData(keyName, pressText, hintText, 0, 0, HintPriority.SIEGE)
示例#7
0
def getBattleCommandExample(msgText):
    result = msgText.split('/', 1)
    if len(result) > 1:
        i18nKey = I18N_INGAME_GUI.chat_example(result[1])
        if i18nKey is not None:
            i18nName = html.escape(i18n.makeString(i18nKey))
        else:
            i18nName = msgText
    else:
        i18nName = i18n.makeString(msgText)
    return i18nName
示例#8
0
def getBattleCommandExample(msgText):
    result = msgText.split('/', 1)
    if len(result) > 1:
        i18nKey = I18N_INGAME_GUI.chat_example(result[1])
        if i18nKey is not None:
            i18nName = html.escape(i18n.makeString(i18nKey))
        else:
            i18nName = msgText
    else:
        i18nName = i18n.makeString(msgText)
    return i18nName
 def getCommandText(self):
     command = _ACTIONS.battleChatCommandFromActionID(self._commandID)
     if not command:
         LOG_ERROR('Command is not found', self._commandID)
         return u''
     else:
         i18nKey = I18N_INGAME_GUI.chat_shortcuts(command.msgText)
         i18nArguments = {}
         if i18nKey is not None:
             if self.isOnMinimap():
                 if self.isSPGAimCommand():
                     reloadTime = self._protoData['floatArg1']
                     if reloadTime > 0:
                         i18nArguments['reloadTime'] = reloadTime
                         i18nKey += '_reloading'
             elif self.hasTarget():
                 i18nArguments['target'] = self._getTarget()
                 if self.isSPGAimCommand():
                     reloadTime = self._protoData['floatArg1']
                     if reloadTime > 0:
                         i18nArguments['reloadTime'] = reloadTime
                         i18nKey += '_reloading'
                     elif reloadTime < 0:
                         i18nKey += '_empty'
             elif self.isBaseRelatedCommand():
                 strArg = self._protoData['strArg1']
                 if strArg != '':
                     i18nArguments['strArg1'] = strArg
                     i18nKey += '_numbered'
             elif self.isLocationRelatedCommand():
                 if self.isSPGAimCommand():
                     reloadTime = self._protoData['floatArg1']
                     if reloadTime > 0:
                         i18nArguments['reloadTime'] = reloadTime
                         i18nKey += '_reloading'
                     elif reloadTime < 0:
                         i18nKey += '_empty'
                 mapsCtrl = self.sessionProvider.dynamic.maps
                 if mapsCtrl and mapsCtrl.hasMinimapGrid():
                     cellId = mapsCtrl.getMinimapCellIdByPosition(
                         self.getMarkedPosition())
                     if cellId is None:
                         cellId = self.getFirstTargetID()
                     i18nKey += '_gridInfo'
                     i18nArguments[
                         'gridId'] = mapsCtrl.getMinimapCellNameById(cellId)
             else:
                 i18nArguments = self._protoData
             text = i18n.makeString(i18nKey, **i18nArguments)
         else:
             text = command.msgText
         return unicode(text, 'utf-8', errors='ignore')
示例#10
0
 def getCommandText(self):
     command = _ACTIONS.battleChatCommandFromActionID(self._commandID)
     if not command:
         LOG_ERROR('Command is not found', self._commandID)
         return ''
     i18nKey = I18N_INGAME_GUI.chat_shortcuts(command.msgText)
     if i18nKey is not None:
         if self.isOnMinimap():
             text = i18n.makeString(i18nKey, cellName=self._getCellName())
         elif self.hasTarget():
             text = i18n.makeString(i18nKey, target=self._getTarget())
         else:
             text = i18n.makeString(i18nKey, **self._protoData)
     else:
         text = command.msgText
     return text
示例#11
0
 def __getHint(self):
     keyName = getReadableKey(
         CommandMapping.CMD_CM_VEHICLE_SWITCH_AUTOROTATION)
     hint = INGAME_GUI.siegeModeHint(self._siegeState)
     if keyName:
         return makeHtmlString('html_templates:battle/siegeMode',
                               'toggle',
                               ctx={
                                   'key': i18n.makeString(keyName),
                                   'text': i18n.makeString(hint)
                               })
     else:
         return makeHtmlString('html_templates:battle/siegeMode',
                               'noBinding',
                               ctx={
                                   'text':
                                   i18n.makeString(
                                       INGAME_GUI.SIEGEMODE_HINT_NOBINDING)
                               })
示例#12
0
    def getCommandText(self):
        command = _ACTIONS.battleChatCommandFromActionID(self._commandID)
        if not command:
            LOG_ERROR('Command is not found', self._commandID)
            return u''
        else:
            i18nKey = I18N_INGAME_GUI.chat_shortcuts(command.msgText)
            i18nArguments = {}
            if i18nKey is not None:
                if self.isOnMinimap():
                    cellIdx = None
                    if self.isSPGAimCommand():
                        try:
                            cellIdx, reloadTime = struct.unpack(
                                '<fffif', self._protoData['strArg1'])[3:]
                        except struct.error as e:
                            LOG_ERROR(
                                'The following command can not be unpacked: ',
                                e)
                            return

                        if reloadTime > 0:
                            i18nArguments['reloadTime'] = reloadTime
                            i18nKey += '_reloading'
                    i18nArguments['cellName'] = self._getCellName(cellIdx)
                elif self.hasTarget():
                    i18nArguments['target'] = self._getTarget()
                    if self.isSPGAimCommand():
                        reloadTime = self._protoData['floatArg1']
                        if reloadTime > 0:
                            i18nArguments['reloadTime'] = reloadTime
                            i18nKey += '_reloading'
                else:
                    i18nArguments = self._protoData
                text = i18n.makeString(i18nKey, **i18nArguments)
            else:
                text = command.msgText
            return unicode(text, 'utf-8', errors='ignore')
示例#13
0
 def __setupView(self):
     self.as_setupS([
         [
             _BET.ARMOR,
             i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.ARMOR))
         ],
         [
             _BET.DEFENCE,
             i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.DEFENCE))
         ],
         [
             _BET.DAMAGE,
             i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.DAMAGE))
         ],
         [
             _BET.ASSIST_SPOT,
             i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.ASSIST_SPOT))
         ],
         [
             _BET.ASSIST_TRACK,
             i18n.makeString(INGAME_GUI.efficiencyribbons(
                 _BET.ASSIST_TRACK))
         ],
         [
             _BET.BURN,
             i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.BURN))
         ],
         [
             _BET.CAPTURE,
             i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.CAPTURE))
         ],
         [
             _BET.DESTRUCTION,
             i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.DESTRUCTION))
         ],
         [
             _BET.DETECTION,
             i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.DETECTION))
         ],
         [
             _BET.RAM,
             i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.RAM))
         ],
         [
             _BET.CRITS,
             i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.CRITS))
         ]
     ], self.__isExtendedAnim, self.__enabled, self.__isWithRibbonName,
                    self.__isWithVehName)
示例#14
0
 def __setupView(self):
     self.as_setupS([[_BET.ARMOR, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.ARMOR))],
      [_BET.DEFENCE, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.DEFENCE))],
      [_BET.DAMAGE, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.DAMAGE))],
      [_BET.ASSIST_SPOT, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.ASSIST_SPOT))],
      [_BET.ASSIST_TRACK, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.ASSIST_TRACK))],
      [_BET.BURN, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.BURN))],
      [_BET.CAPTURE, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.CAPTURE))],
      [_BET.DESTRUCTION, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.DESTRUCTION))],
      [_BET.DETECTION, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.DETECTION))],
      [_BET.RAM, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.RAM))],
      [_BET.CRITS, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.CRITS))],
      [_BET.WORLD_COLLISION, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.WORLD_COLLISION))],
      [_BET.RECEIVED_CRITS, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.RECEIVED_CRITS))],
      [_BET.RECEIVED_DAMAGE, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.RECEIVED_DAMAGE))],
      [_BET.RECEIVED_BURN, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.RECEIVED_BURN))],
      [_BET.RECEIVED_RAM, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.RECEIVED_RAM))],
      [_BET.RECEIVED_WORLD_COLLISION, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.RECEIVED_WORLD_COLLISION))],
      [_BET.STUN, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.STUN))],
      [_BET.VEHICLE_RECOVERY, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.VEHICLE_RECOVERY))],
      [_BET.ENEMY_SECTOR_CAPTURED, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.ENEMY_SECTOR_CAPTURED))],
      [_BET.DESTRUCTIBLE_DAMAGED, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.DESTRUCTIBLE_DAMAGED))],
      [_BET.DESTRUCTIBLE_DESTROYED, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.DESTRUCTIBLE_DESTROYED))],
      [_BET.DESTRUCTIBLES_DEFENDED, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.DESTRUCTIBLES_DEFENDED))],
      [_BET.DEFENDER_BONUS, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.DEFENDER_BONUS))],
      [_BET.BASE_CAPTURE_BLOCKED, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.DEFENCE))],
      [_BET.ASSIST_BY_ABILITY, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.ASSIST_BY_ABILITY))]], self.__isExtendedAnim, self.__enabled, self.__isWithRibbonName, self.__isWithVehName)
示例#15
0
 def __setupView(self):
     self.as_setupS([[_BET.ARMOR, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.ARMOR))],
      [_BET.DEFENCE, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.DEFENCE))],
      [_BET.DAMAGE, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.DAMAGE))],
      [_BET.ASSIST_SPOT, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.ASSIST_SPOT))],
      [_BET.ASSIST_TRACK, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.ASSIST_TRACK))],
      [_BET.BURN, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.BURN))],
      [_BET.CAPTURE, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.CAPTURE))],
      [_BET.DESTRUCTION, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.DESTRUCTION))],
      [_BET.DETECTION, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.DETECTION))],
      [_BET.RAM, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.RAM))],
      [_BET.CRITS, i18n.makeString(INGAME_GUI.efficiencyribbons(_BET.CRITS))]], self.__isExtendedAnim, self.__enabled, self.__isWithRibbonName, self.__isWithVehName)