Пример #1
0
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
Пример #2
0
 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))
Пример #3
0
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
Пример #4
0
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
Пример #5
0
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
Пример #6
0
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
Пример #7
0
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
Пример #8
0
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
Пример #9
0
 def createByName(self, name):
     command = CHAT_COMMANDS.lookup(name)
     if command is None:
         return 
     return self.__addClientID(_SendCmdDecorator(command))