Пример #1
0
def getLeaveOrChangeText(funcState, invitePrbType, peripheryID):
    key, kwargs = None, {}
    isAnotherPeriphery = g_lobbyContext.isAnotherPeriphery(peripheryID)
    if funcState.doLeaveToAcceptInvite(invitePrbType):
        if funcState.isInPrebattle() or funcState.isInUnit():
            entityName = getPrbName(funcState.entityTypeID)
        elif funcState.isInPreQueue():
            entityName = getPreQueueName(funcState.entityTypeID)
        else:
            LOG_ERROR('Can not resolve name of entity', funcState)
            return ''
        if isAnotherPeriphery:
            key = I18N_INVITES.invites_note_change_and_leave(entityName)
            kwargs = {
                'host': g_lobbyContext.getPeripheryName(peripheryID) or ''
            }
        else:
            key = I18N_INVITES.invites_note_leave(entityName)
    elif isAnotherPeriphery:
        key = I18N_INVITES.INVITES_NOTE_SERVER_CHANGE
        kwargs = {'host': g_lobbyContext.getPeripheryName(peripheryID) or ''}
    if key:
        text = i18n.makeString(key, **kwargs)
    else:
        text = ''
    return text
Пример #2
0
def getLeaveOrChangeText(funcState, invitePrbType, peripheryID):
    key, kwargs = None, {}
    isAnotherPeriphery = g_lobbyContext.isAnotherPeriphery(peripheryID)
    if funcState.doLeaveToAcceptInvite(invitePrbType):
        if funcState.isInPrebattle() or funcState.isInUnit():
            entityName = getPrbName(funcState.entityTypeID)
        else:
            if funcState.isInFallout():
                return ''
            if funcState.isInPreQueue():
                entityName = getPreQueueName(funcState.entityTypeID)
            else:
                LOG_ERROR('Can not resolve name of entity', funcState)
                return ''
        if isAnotherPeriphery:
            key = I18N_INVITES.invites_note_change_and_leave(entityName)
            kwargs = {'host': g_lobbyContext.getPeripheryName(peripheryID) or ''}
        else:
            key = I18N_INVITES.invites_note_leave(entityName)
    elif isAnotherPeriphery:
        key = I18N_INVITES.INVITES_NOTE_SERVER_CHANGE
        kwargs = {'host': g_lobbyContext.getPeripheryName(peripheryID) or ''}
    if key:
        text = i18n.makeString(key, **kwargs)
    else:
        text = ''
    return text