Esempio n. 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)
        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
Esempio n. 2
0
 def getState(self, invite):
     key = I18N_INVITES.invites_state(getPrbInviteStateName(invite.getState()))
     if not key:
         return ''
     state = i18n.makeString(key)
     if state:
         state = makeHtmlString('html_templates:lobby/prebattle', 'inviteState', {'state': state})
     return state
Esempio n. 3
0
def getAcceptNotAllowedText(prbType, peripheryID, isInviteActive = True, isAlreadyJoined = False):
    key, kwargs = None, {}
    isAnotherPeriphery = g_lobbyContext.isAnotherPeriphery(peripheryID)
    if isInviteActive:
        if isAlreadyJoined:
            key = I18N_INVITES.invites_prebattle_alreadyjoined(getPrbName(prbType))
        elif isAnotherPeriphery:
            host = g_lobbyContext.getPeripheryName(peripheryID)
            if host:
                key = I18N_INVITES.invites_prebattle_acceptnotallowed('otherPeriphery')
                kwargs = {'host': host}
            else:
                key = I18N_INVITES.invites_prebattle_acceptnotallowed('undefinedPeriphery')
    if key:
        text = i18n.makeString(key, **kwargs)
    else:
        text = ''
    return text
Esempio n. 4
0
def getAcceptNotAllowedText(prbType, peripheryID, isInviteActive = True, isAlreadyJoined = False, lobbyContext = None):
    key, kwargs = None, {}
    if lobbyContext is not None:
        isAnotherPeriphery = lobbyContext.isAnotherPeriphery(peripheryID)
    else:
        isAnotherPeriphery = False
    if isInviteActive:
        if isAlreadyJoined:
            key = I18N_INVITES.invites_prebattle_alreadyjoined(getPrbName(prbType))
        elif isAnotherPeriphery:
            host = lobbyContext.getPeripheryName(peripheryID)
            if host:
                key = I18N_INVITES.invites_prebattle_acceptnotallowed('otherPeriphery')
                kwargs = {'host': host}
            else:
                key = I18N_INVITES.invites_prebattle_acceptnotallowed('undefinedPeriphery')
    if key:
        text = i18n.makeString(key, **kwargs)
    else:
        text = ''
    return text