def getRecruitIDs(eventsCache=None):
    result = {}
    for tokenName in eventsCache.questsProgress.getTokenNames():
        info = tankmen.getRecruitInfoFromToken(tokenName)
        if info is not None:
            count = eventsCache.questsProgress.getTokenCount(tokenName)
            result[tokenName] = count

    for quest, _ in getTankmanRewardQuests():
        result[str(quest.getID())] = 1

    return result
Beispiel #2
0
def __readBonus_tokens(bonus, _name, section, eventType):
    id = section['id'].asString
    if id.startswith(tankmen.RECRUIT_TMAN_TOKEN_PREFIX
                     ) and tankmen.getRecruitInfoFromToken(id) is None:
        raise SoftException('Invalid tankman token format: {}'.format(id))
    token = bonus.setdefault('tokens', {})[id] = {}
    expires = token.setdefault('expires', {})
    __readBonus_expires(id, expires, section)
    if section.has_key('limit'):
        token['limit'] = section['limit'].asInt
    token['count'] = 1
    if section.has_key('count'):
        token['count'] = section['count'].asInt
    return
Beispiel #3
0
def __readBonus_tokens(bonus, _name, section, eventType, checkLimit):
    id = section['id'].asString
    if id.startswith(tankmen.RECRUIT_TMAN_TOKEN_PREFIX) and tankmen.getRecruitInfoFromToken(id) is None:
        raise SoftException('Invalid tankman token format: {}'.format(id))
    token = bonus.setdefault('tokens', {})[id] = {}
    expires = token.setdefault('expires', {})
    __readBonus_expires(id, expires, section)
    if section.has_key('limit'):
        token['limit'] = section['limit'].asInt
    token['count'] = 1
    if section.has_key('count'):
        token['count'] = section['count'].asInt
    if checkLimit and token['count'] > INVOICE_LIMITS.TOKENS_MAX:
        raise SoftException('Invalid count of tankman token with id %s with amount %d when limit is %d.' % (id, token['count'], INVOICE_LIMITS.TOKENS_MAX))
    return
def _getRecruitInfoFromToken(tokenName, eventsCache=None):
    tokenData = tankmen.getRecruitInfoFromToken(tokenName)
    expiryTime = eventsCache.questsProgress.getTokenExpiryTime(tokenName)
    return None if tokenData is None else _TokenRecruitInfo(tokenName, expiryTime, **tokenData)
Beispiel #5
0
def _getDefaultNyGirl():
    tokenData = tankmen.getRecruitInfoFromToken(DEFAULT_NY_GIRL)
    return None if tokenData is None else _DefaultNyGirlInfo(DEFAULT_NY_GIRL, ENDLESS_TOKEN_TIME, **tokenData)