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')
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')
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')
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
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')