def getOperationInCooldownMsg(operation, period): if operation in _battleChatShortcuts: command = CHAT_COMMANDS.lookup(operation) args = [] for index in range(command.argsCnt): key = '#%s:command/%s/arg%d' % (MESSENGER_I18N_FILE, operation, index) args.append(i18n.makeString(key)) operationName = i18n.makeString(command.msgText, *args) elif operation in _moderationChatCommands: operationName = operation else: operationKey = '#%s:command/%s' % (MESSENGER_I18N_FILE, operation) operationName = i18n.makeString(operationKey) if operationName.startswith('command'): operationName = operation if period > 0: message = i18n.makeString( '#%s:client/error/commandInCooldown/limited' % MESSENGER_I18N_FILE, operationName, period) else: message = i18n.makeString( '#%s:client/error/commandInCooldown/unlimited' % MESSENGER_I18N_FILE, operationName) return message
def createByNameTarget(self, name, targetID): if targetID is None: return command = CHAT_COMMANDS.lookup(name) if command is None: return return self.__addClientID(_SendCmdDecorator(command, first=targetID))
def getOperationCooldownPeriodEx(operationName): command = CHAT_COMMANDS.lookup(operationName) result = -1 if command is not None: result = getOperationCooldownPeriod(command) else: LOG_ERROR("Can't find operation = %s in chat_shared.CHAT_COMMANDS" % operationName) return result
def isOperationInCooldownEx(operationName): operation = CHAT_COMMANDS.lookup(operationName) result = False if operation is not None: result = isOperationInCooldown(chat_shared.g_chatCooldownData, operation, update=False) else: LOG_ERROR("Can't find operation = %s in chat_shared.CHAT_COMMANDS" % operationName) return result
def getOperationInCooldownMsg(operation, period, params = None): if operation in _battleChatShortcuts: command = CHAT_COMMANDS.lookup(operation) operationName = getBattleCommandExample(command.msgText) elif operation in _moderationChatCommands: operationName = operation elif operation in _reloadingChatCommandsWithParams: command = CHAT_COMMANDS.lookup(operation) operationName = getBattleCommandExample(command.msgText) else: operationKey = '#%s:command/%s' % (MESSENGER_I18N_FILE, operation) operationName = i18n.makeString(operationKey) if operationName.startswith('command'): operationName = operation if period > 0: message = i18n.makeString('#%s:client/error/commandInCooldown/limited' % MESSENGER_I18N_FILE, operationName, period) else: message = i18n.makeString('#%s:client/error/commandInCooldown/unlimited' % MESSENGER_I18N_FILE, operationName) return message
def getOperationInCooldownMsg(operation, period, params=None): if operation in _battleChatShortcuts: command = CHAT_COMMANDS.lookup(operation) operationName = getBattleCommandExample(command.msgText) elif operation in _moderationChatCommands: operationName = operation elif operation in _reloadingChatCommandsWithParams: command = CHAT_COMMANDS.lookup(operation) operationName = getBattleCommandExample(command.msgText) else: operationKey = '#%s:command/%s' % (MESSENGER_I18N_FILE, operation) operationName = i18n.makeString(operationKey) if operationName.startswith('command'): operationName = operation if period > 0: message = i18n.makeString('#%s:client/error/commandInCooldown/limited' % MESSENGER_I18N_FILE, operationName, period) else: message = i18n.makeString('#%s:client/error/commandInCooldown/unlimited' % MESSENGER_I18N_FILE, operationName) return message
def createByName(self, name): command = CHAT_COMMANDS.lookup(name) if command is None: return return self.__addClientID(_SendCmdDecorator(command))