Exemplo n.º 1
0
    def cost(self, target, value=True, subentry=''):
        """
        cost


        Determines the cost for a character to purchase an arcanum.


        target: The character being checked
        value: The level being checked.
        subentry: Dummy for overloading


        """
        name = self.db.longname
        current = self.get(target)
        path = find(target.get('Path', statclass='Sphere'),
                    statclass='Path')[0]
        if name == path.db.inferior_arcana and value > 2:
            result = 5 * (value - current)
        elif name != path.db.inferior_arcana and value > 4:
            result = 5 * (value - current)
        else:
            result = 4 * (value - current)
        return result
Exemplo n.º 2
0
def _return_to_stat(caller, raw_string, **kwargs):
    set(caller, caller.db.cg['stat_boost']['stat'], statclass='Skill',
        value=caller.db.cg['stat_boost']['start'])
    caller.db.renown = {}
    return 'werewolf_stat',{'auspice': find(caller.get('Auspice',
                                                         statclass='Sphere'),
                                              statclass='Auspice')[0]}
Exemplo n.º 3
0
def _check_rite(caller, raw_string, **kwargs):
    rites = find(strip_control_sequences(raw_string), statclass='Werewolf Rite')
    if len(rites) < 1:
        caller.msg('|/I can\'t find ' + strip_control_sequences(raw_string))
        return 'werewolf_merits'
    elif len(rites) > 1:
        caller.msg('|/Too many matches found')
        return 'werewolf_merits'
    else:
        rite = rites[0]
        if rite.db.restricted == True:
            caller.msg('|/That rite is restricted')
            return 'werewolf_merits'
        else:
            value = rite.db.rank
            if (value + kwargs['total'] > kwargs['max'] or
                    value + kwargs['rites_points'] > 7):
                caller.msg('|/You don\'t have enough points')
                return 'werewolf_merits'
            elif rite.meets_prereqs(caller, value=True):
                rite.set(caller, value=True)
                return 'werewolf_merits'
            else:
                caller.msg('|/You don\'t meet the prerequisites for that rite')
                return 'werewolf_merits'
Exemplo n.º 4
0
def _xp_check_contract(caller, raw_string, **kwargs):
    contracts = find(strip_control_sequences(raw_string), statclass='Contract')
    if len(contracts) < 1:
        caller.msg('I can\'t find ' + strip_control_sequences(raw_string))
        return 'xp_spend'
    elif len(contracts) > 1:
        caller.msg('Too many matches found')
        return 'xp_spend'
    elif contracts[0].db.group.lower() == 'regalia':
        contract = contracts[0]
        return 'xp_get_contract_note', {'stat': contract}
    else:
        contract = contracts[0]
        current = caller.db.xp['earned'] - caller.db.xp['spent']
        cost = contract.cost(caller, subentry='', value=True)
        name = contract.db.longname
        if cost < 1:
            return 'xp_spend'
        elif cost > current:
            caller.msg('You don\'t have enough XP')
            return 'xp_spend'
        elif contract.meets_prereqs(caller, value=True, subentry=''):
            return 'xp_increase', {
                'type': 'contract',
                'stat': contract,
                'name': name,
                'value': True,
                'subentry': '',
                'cost': cost
            }
        else:
            caller.msg('You don\'t meet the prerequisites for that contract')
            return 'xp_spend'
Exemplo n.º 5
0
def editor(request, object_id):

    object_id = unquote(object_id)
    stats = data.find(object_id, statclass='Merit')
    if len(stats) == 0:
        return render(request, 'merits/error.html',
                      {'message': 'No matching merits'})
    if len(stats) > 1:
        return render(request, 'merits/error.html',
                      {'message': 'Too many matching merits'})
    merit = stats[0]
    if len(merit.db.noteRestrictions) == 0:
        noteRestrictions = '[]'
    else:
        noteRestrictions = merit.db.noteRestrictions
    starting_data = {
        'longname': merit.db.longname,
        'category': merit.db.category,
        'range': merit.db.range,
        'noteRestrictions': noteRestrictions,
        'prereq': merit.db.prereq,
        'reference': merit.db.reference,
        'info': merit.db.info,
        'cg_only': merit.db.cg_only,
        'restricted': merit.db.restricted,
        'link': object_id
    }
    form = EditForm(initial=starting_data)
    return render(request, 'merits/editor.html', {
        'form': form,
        'merit_id': object_id
    })
Exemplo n.º 6
0
def info_func(target, info_input):
    parsed = parser(info_input)
    temp_stats = data.find(parsed['entry'], statclass=parsed['statclass'])
    stats = []
    for entry in temp_stats:
        if entry.type() not in ['sphere', 'basic']:
            stats.append(entry)
    if len(stats) == 0:
        target.msg('Nothing found')
    elif len(stats) == 1:
        message = stats[0].db.longname + '\n\n'
        message = message + proper_caps(stats[0].type())
        if stats[0].db.info:
            if len(stats[0].db.info) > 0:
                info_string = stats[0].db.info.replace('\r\n', '\n')
                info_string = info_string.replace('’', '\'').replace('|/', '\n')
                message = message + '\n\n' + info_string
        if stats[0].db.reference:
            if len(stats[0].db.reference) > 0:
                message = message + '\n\n' + stats[0].db.reference
        if len(message) > 999:
            table = scroll(message, width=74, padding=0)
        elif len(message) > 499:
            table = scroll(message, width=64, padding=5)
        else:
            table = scroll(message, width=54, padding=10, top=0, bottom=0)
        target.msg(table)
    elif len(stats) < 5:
        message = short_list(stats)
        target.msg(message)
    else:
        target.msg('Too many found')
Exemplo n.º 7
0
def _check_merit(caller, raw_string, **kwargs):
    merits = find(strip_control_sequences(raw_string), statclass='Merit')
    if len(merits) < 1:
        caller.msg('|/I can\'t find ' + strip_control_sequences(raw_string))
        return 'vampire_merits'
    elif len(merits) > 1:
        caller.msg('|/Too many matches found')
        return 'vampire_merits'
    else:
        merit = merits[0]
        if merit.db.restricted == True:
            caller.msg('|/That merit is restricted')
            return 'vampire_merits'
        elif len(merit.db.noteRestrictions) == 0:
            return 'get_merit_value', {
                'total': kwargs['total'],
                'note': '',
                'merit': merit,
                'max': kwargs['max']
            }
        else:
            return 'get_merit_note', {
                'total': kwargs['total'],
                'merit': merit,
                'max': kwargs['max']
            }
Exemplo n.º 8
0
def sheet(request, object_id):

    object_id = unquote(object_id)
    stats = data.find(object_id, statclass='Merit')
    if len(stats) == 0:
        return render(request, 'merits/error.html',
                      {'message': 'No matching merits: ' + object_id})
    if len(stats) > 1:
        return render(request, 'merits/error.html',
                      {'message': 'Too many matching merits'})
    merit = merit_class()
    longname = stats[0].db.longname
    category = stats[0].db.category
    meritrange = stats[0].db.range
    noterestrictions = stats[0].db.noteRestrictions
    prereq = stats[0].db.prereq
    reference = stats[0].db.reference
    if stats[0].db.info:
        info = stats[0].db.info.replace('|/', '\n')
    else:
        info = chr(160)
    cg_only = stats[0].db.cg_only
    restricted = stats[0].db.restricted
    merit.update(longname, category, meritrange, noterestrictions, prereq,
                 reference, info, cg_only, restricted)
    if request.method == 'POST':
        return render(request, 'merits/error.html', {'message': 'POST'})
    return render(request, 'merits/sheet.html', {
        'merit': merit,
        'request': request,
        'id': quote(object_id)
    })
Exemplo n.º 9
0
def _xp_buy_power(caller, raw_string, **kwargs):
    if caller.db.xp['earned'] - caller.db.xp['spent'] < 5:
        caller.msg('Not enough XP')
        return 'xp_spend'
    else:
        stats = find(kwargs['power'], statclass='Power')
        stat = stats[0]
        value = stat.get(caller, subentry='') + 1
        send_kwargs = {
            'type': 'power',
            'stat': stat,
            'name': kwargs['power'],
            'value': value,
            'subentry': '',
            'cost': 5
        }
        if stat.db.longname == 'Wyrd' and value in [2, 4, 8]:
            send_kwargs['message'] = 'You must add a minor frailty'
            return 'xp_add_frailty', send_kwargs
        elif stat.db.longname == 'Wyrd' and value in [6, 10]:
            send_kwargs['message'] = 'You must add a major frailty'
            return 'xp_add_frailty', send_kwargs
        elif stat.db.longname == 'Gnosis':
            return 'xp_increase_gnosis', send_kwargs
        else:
            return 'xp_increase', send_kwargs
Exemplo n.º 10
0
def _check_discipline(caller, raw_string, **kwargs):
    stat = (find(strip_control_sequences(raw_string), statclass='Discipline') +
            find(strip_control_sequences(raw_string), statclass='Coil'))
    if len(stat) < 1:
        caller.msg('|/I can\'t find ' + strip_control_sequences(raw_string))
        return 'vampire_disciplines'
    elif len(stat) > 1:
        caller.msg('|/Too many matches found')
        return 'vampire_disciplines'
    else:
        stat = stat[0]
        if stat.db.restricted == True:
            caller.msg('|/That ' + stat.type() + ' is restricted')
            return 'vampire_disciplines'
        else:
            return 'get_discipline_value', {'stat': stat}
Exemplo n.º 11
0
def _starting_gifts(caller, raw_string, **kwargs):
    auspice = find(caller.get('Auspice',statclass='Sphere'),
                   statclass='Auspice')[0]
    moon = auspice.db.auspice_gifts[0].lower()
    set(caller, moon_list[moon][0], statclass='Gift', value=True)
    if caller.get(auspice.db.renown,statclass='Renown') == 2:
        set(caller, moon_list[moon][1], statclass='Gift', value=True)
    return 'werewolf_gifts'
Exemplo n.º 12
0
def _decrease_power(caller, raw_string, **kwargs):
    if caller.db.power['Wyrd'] > 1:
        caller.db.power['Wyrd'] = caller.db.power['Wyrd'] - 1
        if caller.db.power['Wyrd'] in [1, 3, 5, 7, 9]:
            f = find('Frailties', statclass='Sphere')[0]
            current_frailties = f.get(caller, subentry='')[:-1]
            f.set(caller, current_frailties)
    return 'changeling_merits'
Exemplo n.º 13
0
def _return_to_stat(caller, raw_string, **kwargs):
    set(caller,
        caller.db.cg['stat_boost']['stat'],
        statclass='Attribute',
        value=caller.db.cg['stat_boost']['start'])
    return 'vampire_stat', {
        'clan': find(caller.get('Clan', statclass='Sphere'),
                     statclass='Clan')[0]
    }
Exemplo n.º 14
0
def _changeling_new_frailty(caller, raw_string, **kwargs):
    f = find('Frailties', statclass='Sphere')[0]
    current_frailties = f.get(caller)
    if current_frailties == False:
        current_frailties = []
    current_frailties.append(strip_control_sequences(raw_string))
    caller.msg(current_frailties)
    f.set(caller, str(current_frailties))
    return 'changeling_merits'
Exemplo n.º 15
0
def _return_to_stat(caller, raw_string, **kwargs):
    set(caller,
        caller.db.cg['stat_boost']['stat'],
        statclass='Attribute',
        value=caller.db.cg['stat_boost']['start'])
    return "changeling_stat", {
        'seeming':
        find(caller.get('Seeming', statclass='Sphere'), statclass='Seeming')[0]
    }
Exemplo n.º 16
0
def _return_to_court(caller, raw_string, **kwargs):
    set(caller,
        'Mantle',
        statclass='Merit',
        value=0,
        subentry=caller.get('Court', statclass='Sphere'))
    return "changeling_court", {
        'kith': find(caller.get('Kith', statclass='Sphere'),
                     statclass='Kith')[0]
    }
Exemplo n.º 17
0
def werewolf_remove_gift(caller, raw_string, **kwargs):
    text = 'Select contract to remove:'
    option_list = []
    gifts = list(caller.db.gifts.keys())
    gifts.sort()
    for item in gifts:
        gift = find(item,statclass='Gift')[0]
        if gift.db.category.lower() != 'moon':
            option_list.append( { 'desc' : item,
                              'goto' : ( _remove_gift, {'gift' : item} ) } )
    options = tuple(option_list)
    return text,options
Exemplo n.º 18
0
def pool_func(target, inputdata):
    if inputdata:
        parsed = parser(inputdata)
    else:
        parsed = {'args': '',
                  'entry': '',
                  'subentry': '',
                  'statclass': '',
                  'value': 0}
    temp_pool = data.find(parsed['entry'])
    pool = []
    for item in temp_pool:
        if item.db.pool:
            pool.append(item)
    action = parsed['args'].lower()
    amount = parsed['statclass']
    reason = parsed['value']
    if len(pool) == 1:
        current = pool[0].get(target, subentry='temporary')
        pool_max = pool[0].get(target, subentry='permanent')
    if (action in ['spend', 'expend', 'lose', 'gain', 'regain', 'recover']
            and len(pool) == 1 and amount.isnumeric()):
        if action in ['spend', 'expend', 'lose'] and int(amount) > current:
            target.msg('You don\'t have that many points')
        else:
            if action in ['spend', 'expend', 'lose']:
                result = (target.name + ' spends ' + amount +
                          ' point')
                if int(amount) != 1:
                    result = result + 's'
                result = result + ' of ' + pool[0].db.longname
                if reason != '':
                    result = result + ' for ' + reason
                pool[0].set(target, current - int(amount))
            elif action in ['gain', 'regain', 'recover']:
                if current + int(amount) > pool_max:
                    amount = pool_max - current
                result = (target.name + ' gains ' + str(amount) +
                          ' point')
                if int(amount) != 1:
                    result = result + 's'
                result = result + ' of ' + pool[0].db.longname
                if reason != '':
                    result = result + ' for ' + reason
                pool[0].set(target, current + int(amount))
            send_message(target, result)
    elif action in ['check'] and len(pool) == 1:
        result = (pool[0].db.longname + ' Pool: ' + str(current) + '/' +
                  str(pool_max))
        target.msg(result)
    else:
        target.msg('I can\'t tell what you want to do')
Exemplo n.º 19
0
    def meets_prereqs(self, target, value=0, subentry=''):
        """
        meets_prereqs


        Determines if a character meets the prerequisites to purchase a
        contract. Should only return True or False.


        target: The character being checked
        value: The level being checked.
        subentry: Seeming benefits


        """
        if target.template().lower() == 'changeling':
            if self.db.group.lower() == 'court':
                stat = []
                mantle = target.get('Mantle',
                                    subentry=self.db.category,
                                    statclass='Merit')
                goodwill = target.get('Court Goodwill',
                                      subentry=self.db.category,
                                      statclass='Merit')
                courts = {"spring": 0, "summer": 0, "autumn": 0, "winter": 0}
                contracts = list(target.db.contracts.keys())
                for contract in contracts:
                    stat = find(contract, statclass='contract')
                if len(contracts) > 0:
                    if stat[0].db.group.lower() == 'court':
                        court = stat[0].db.category.lower()
                        courts[court] = courts[court] + 1
                current_count = courts[self.db.category.lower()]
                if self.db.subgroup.lower() == 'common':
                    if current_count == 0:
                        result = True
                    elif mantle >= 1 or goodwill >= 3:
                        result = True
                    else:
                        result = False
                else:
                    if current_count == 0 and (mantle >= 3 or goodwill >= 4):
                        result = True
                    elif current_count >= 1 and (mantle >= 3 or goodwill == 5):
                        result = True
                    else:
                        result = False
            else:
                result = True
        else:
            result = False
        return result
Exemplo n.º 20
0
def _check_gift(caller, raw_string, **kwargs):
    gifts = find(strip_control_sequences(raw_string), statclass='Gift')
    if len(gifts) < 1:
        caller.msg('|/I can\'t find ' + strip_control_sequences(raw_string))
    elif len(gifts) > 1:
        caller.msg('|/Too many matches found')
    else:
        gift = gifts[0]
        auspice_gifts = find(caller.get('Auspice',statclass='Sphere'),
                            statclass='Auspice')[0].db.auspice_gifts
        tribe_gifts = find(caller.get('Tribe', statclass='Sphere'),
                            statclass='Tribe')[0].db.tribe_gifts
        if gift.meets_prereqs(caller,value=True) and gift.db.type != 'moon':
            if (gift.db.group in auspice_gifts or
              gift.db.group in tribe_gifts or
              gift.db.category.lower() == 'wolf'):
                gift.set(caller,value=True)
            else:
                caller.msg('|/You cannot take that gift in character generation.')
        else:
            caller.msg('|/You cannot take that gift in character generation.')
    return 'werewolf_gifts'
Exemplo n.º 21
0
def _xp_check_free_praxis(caller, raw_string, **kwargs):
    spells = find(strip_control_sequences(raw_string), statclass='Spell')
    if len(spells) < 1:
        caller.msg('I can\'t find ' + strip_control_sequences(raw_string))
        return 'xp_spend'
    elif len(spells) > 1:
        caller.msg('Too many matches found')
        return 'xp_spend'
    elif spells[0].meets_prereqs(caller, value=True) == False:
        caller.msg('You don\'t meet the prerequisites for that praxis')
    else:
        kwargs['praxis'] = spells[0]
        if kwargs['value'] in [3, 6, 9]:
            return 'xp_add_obsession', kwargs
        else:
            return 'xp_use_arcane', kwargs
Exemplo n.º 22
0
def _check_contract(caller, raw_string, **kwargs):
    contracts = find(strip_control_sequences(raw_string), statclass='Contract')
    if len(contracts) < 1:
        caller.msg('|/I can\'t find ' + strip_control_sequences(raw_string))
        return 'changeling_contracts'
    elif len(contracts) > 1:
        caller.msg('|/Too many matches found')
        return 'changeling_contracts'
    else:
        contract = contracts[0]
        if contract.meets_prereqs(caller, value=True):
            contract.set(caller, value=True)
            return 'changeling_contracts'
        else:
            caller.msg('|/You don\'t meet the prerequisites for that contract')
            return 'changeling_contracts'
Exemplo n.º 23
0
def editted(request):
    user = request.user
    if user.is_staff:
        if request.method == 'POST':
            form = EditForm(request.POST)
            if form.is_valid():
                n = form.cleaned_data['link']
                stats = data.find(n, statclass='Merit')
                if len(stats) == 0:
                    return render(
                        request, 'merits/error.html',
                        {'message': len(data) + ' No matching merits: ' + n})
                if len(stats) > 1:
                    return render(request, 'merits/error.html',
                                  {'message': 'Too many matching merits'})
                merit = stats[0]
                range = []
                for item in form.cleaned_data['range'][1:-1].split(','):
                    range.append(int(item))
                noteRestrictions = []
                if form.cleaned_data['noteRestrictions'] != '[]':
                    for item in form.cleaned_data['noteRestrictions'][
                            1:-1].split(','):
                        noteRestrictions.append(item.strip()[1:-1])
                app = merit.update(longname=form.cleaned_data['longname'],
                                   category=form.cleaned_data['category'],
                                   range=range,
                                   noteRestrictions=noteRestrictions,
                                   prereq=form.cleaned_data['prereq'],
                                   reference=form.cleaned_data['reference'],
                                   info=form.cleaned_data['info'],
                                   cg_only=form.cleaned_data['cg_only'],
                                   restricted=form.cleaned_data['restricted'])
                return HttpResponseRedirect('/merits/view/' + quote(n))
            else:
                return render(request, 'merits/error.html',
                              {'message': 'Invalid form'})
        else:
            return render(request, 'merits/error.html',
                          {'message': 'Not POST'})
    else:
        return render(request, 'merits/error.html', {'message': 'Not staff'})
Exemplo n.º 24
0
def _xp_check_merit(caller, raw_string, **kwargs):
    merits = find(strip_control_sequences(raw_string), statclass='Merit')
    if len(merits) < 1:
        caller.msg('I can\'t find ' + strip_control_sequences(raw_string))
        return 'xp_spend'
    elif len(merits) > 1:
        caller.msg('Too many matches found')
        return 'xp_spend'
    else:
        merit = merits[0]
        if merit.db.cg_only:
            caller.msg(merit.db.longname + ' is only available in CG.')
            return 'xp_spend'
        elif merit.db.restricted:
            caller.msg(merit.db.longname + 'is restricted.')
            return 'xp_spend'
        else:
            if len(merit.db.noteRestrictions) == 0:
                return 'xp_get_merit_value', {'subentry': '', 'stat': merit}
            else:
                return 'xp_get_merit_note', {'stat': merit}
Exemplo n.º 25
0
def xp_check_skill(caller, raw_string, **kwargs):
    skills = find(strip_control_sequences(raw_string), statclass='Skill')
    if len(skills) < 1:
        caller.msg('I can\'t find ' + strip_control_sequences(raw_string))
        return 'xp_spend'
    elif len(skills) > 1:
        caller.msg('Too many matches found')
        return 'xp_spend'
    elif caller.get(skills[0].db.longname, statclass='Skill') == 0:
        caller.msg('You need at least 1 point in that skill')
        return 'xp_spend'
    else:
        skill = skills[0]
        text = 'Enter specialty:'
        options = ({
            'key': '_default',
            'goto': (_xp_check_specialties, {
                'stat': skill
            })
        })
        return text, options
Exemplo n.º 26
0
    def meets_prereqs(self, target, value=0, subentry=''):
        """
        meets_prereqs


        Determines if a character meets the prerequisites to purchase an
        arcanum. Should only return True or False.


        target: The character being checked
        value: The level being checked.
        subentry: Seeming benefits


        """
        result = False
        name = self.db.longname
        highest = 0
        for item in list(target.db.arcana.keys()):
            if target.db.arcana[item] > highest:
                highest = target.db.arcana[item]
        gnosis = target.get('Gnosis', statclass='Power') + 1
        highest_max = (sphere_limits[gnosis][0])
        other_max = sphere_limits[target.get('Gnosis', statclass='Power') +
                                  1][1]
        if target.template().lower() == 'mage':
            order = find(target.get('Order', statclass='Sphere'),
                         statclass='Order')[0]
            if name == order.db.inferior and value > 2 and restrict_level:
                result = False
            elif name != order.db.inferior and value > 4 and restrict_level:
                result = False
            elif value > highest_max:
                result = False
            elif value > other_max and highest == highest_max:
                result = False
            else:
                result = True
        return result
Exemplo n.º 27
0
def vampire_disciplines(caller, raw_string, **kwargs):
    caller.db.cg['start_node'] = 'vampire_disciplines'
    caller.db.cg['raw_string'] = strip_control_sequences(raw_string)
    caller.db.cg['kwargs'] = kwargs
    clan_msg = ['|/Clan Disciplines:']
    out_msg = ['|/Out of Clan Disciplines:']
    clan_list = []
    out_list = []
    clan_count = 0
    total_count = 0
    clan = find(caller.db.sphere['Clan'], statclass='Clan')[0]
    if caller.db.disciplines:
        disciplines = list(caller.db.disciplines.keys())
    else:
        disciplines = []
    for item in disciplines:
        value = caller.db.disciplines[item]
        entry = '|_|_|_|_' + item + ': ' + str(value)
        if item in clan.db.favored_disciplines:
            clan_count = clan_count + value
            clan_list.append(entry)
        else:
            out_list.append(entry)
        total_count = total_count + value

    if caller.db.coils:
        coils = list(caller.db.coils.keys())
    else:
        coils = []
    for item in coils:
        value = caller.db.coils[item]
        entry = '|_|_|_|_' + item + ': ' + str(value)
        out_list.append(entry)
        total_count = total_count + value

    clan_list.sort()
    out_list.sort()
    for item in clan_list:
        clan_msg.append(item)
    for item in out_list:
        out_msg.append(item)
    text = 'Disciplines: 3 Dots. (2 must be spent on clan disciplines)'
    for item in clan_msg:
        text = text + '|/|_|_|_|_' + item
    for item in out_msg:
        text = text + '|/|_|_|_|_' + item
    option_list = []
    if total_count < 3:
        option_list.append({
            'key': 'A',
            'desc': 'Add a discipline or coil',
            'goto': 'vampire_add_discipline'
        })
    if len(clan_msg) + len(out_msg) > 2:
        option_list.append({
            'key': 'R',
            'desc': 'Remove a discipline or coil',
            'goto': 'vampire_remove_discipline'
        })
    if clan_count >= 2 and total_count == 3:
        option_list.append({
            'key': 'F',
            'desc': 'Finish character generation',
            'goto': 'vampire_finish_cg'
        })
    option_list.append({'desc': 'Back', 'key': 'B', 'goto': _return_to_merits})
    option_list.append({
        'desc': 'Back',
        'key': 'back',
        'goto': _return_to_merits
    })
    option_list.append({'key': 'q', 'desc': 'Quit', 'goto': 'quit_menu'})
    option_list.append({'key': 'Quit', 'desc': 'Quit', 'goto': 'quit_menu'})
    options = tuple(option_list)
    footer = '|/(Additional options include |w\'help\'|n and |w\'quit\'|n)'
    help = ('|/' + '_' * 79 + '|/|/' +
            'Disciplines are extensions of the Blood. They are ways the ' +
            'Beast\'s tendrils creep out into the world to manipulate, to ' +
            'pervert, and to destroy. These unholy tricks can accomplish ' +
            'nefarious and terrifying things, from changing the vampire into '
            + 'an animal to forcing a victim into an artificial love.|/|/If ' +
            'the character starts with Status in the Circle of the Crone, ' +
            'Lancea et Sanctum, or Ordo Dracul, she may use one dot to ' +
            'begin play with Cruac, Theban Sorcery, or the Coils of the ' +
            'Dragon, respectively.' + '|/' + '_' * 79)
    options_format = {
        'hide_keys': ['q', 'Quit', 'back'],
        'move_keys': ['B', 'P'],
        'rows': 10
    }
    display = {
        'text': text,
        'help': help,
        'options_format': options_format,
        'footer': footer
    }
    return display, options
Exemplo n.º 28
0
def _xp_purchase(caller, raw_string, **kwargs):
    message = '|/Purchasing ' + kwargs['name']
    if kwargs['type'].lower() not in [
            'specialty', 'contract', 'rote', 'praxis'
    ]:
        message = message + ': ' + str(kwargs['value'])
    message = message + ' for ' + str(kwargs['cost']) + ' XP.'
    caller.msg(message)
    if kwargs['type'].lower() == 'rote':
        log = 'Rote: ' + kwargs['name']
    elif kwargs['type'].lower() == 'praxis':
        log = 'Praxis: ' + kwargs['name']
    else:
        log = kwargs['name']
    if not (kwargs['type'].lower()
            in ['specialty', 'contract', 'rote', 'praxis']):
        log = log + ': ' + str(kwargs['value'])
    if 'arcane' in kwargs and kwargs['arcane'] > 0:
        cost = (str(kwargs['cost']) + ' regular and ' + str(kwargs['arcane']) +
                ' arcane')
        caller.db.xp['arcane_spent'] = (caller.db.xp['arcane_spent'] +
                                        kwargs['arcane'])
    else:
        cost = str(kwargs['cost'])
    caller.db.xp['log'][time.time()] = [cost, log]
    caller.db.xp['spent'] = caller.db.xp['spent'] + kwargs['cost']
    if kwargs['type'] == 'specialty':
        caller.db.specialties.append(kwargs['name'])
    else:
        set(caller,
            kwargs['stat'].db.longname,
            subentry=kwargs['subentry'],
            statclass=kwargs['type'],
            value=kwargs['value'])

    if 'frailty' in kwargs:
        f = find('Frailties', statclass='Sphere')[0]
        current_frailties = f.get(caller, subentry='')
        if current_frailties == False:
            current_frailties = []
        current_frailties.append(kwargs['frailty'])
        f.set(caller, current_frailties)

    if kwargs['type'] == 'Renown':
        auspice = find(caller.get('Auspice'), statclass='Auspice')[0]
        if kwargs['stat'].db.longname == auspice.db.renown:
            moon_list = {
                'crescent moon': [
                    'Shadow Gaze', 'Spirit Whispers', 'Shadow Hunter',
                    'Shadow Masquerade', 'Panopticon'
                ],
                'full moon': [
                    'Killer Instinct', 'Warrior\'s Hide',
                    'Bloody-Handed Hunter', 'Butchery', 'Crimson Spasm'
                ],
                'gibbous moon': [
                    'War Howl', 'Voice of Glory', 'Dream Hunter',
                    'Thousand-Throat Howl', 'End of Story'
                ],
                'half moon': [
                    'Scent Beneath the Surface', 'Binding Oath', 'Sly Hunter',
                    'Ties of Word and Promise', 'Ties of Blood and Bone'
                ],
                'new moon': [
                    'Eviscerate', 'Slip Away', 'Relentless Hunter',
                    'Divide and Conquer', 'Breach'
                ]
            }
            index = kwargs['value'] - 1
            auspice_moon = auspice.db.auspice_gifts[0].lower()
            new_gift = moon_list[auspice_moon][index]
            gift = find(new_gift, statclass='Gift')[0]
            if gift.get(caller) == False:
                gift.set(caller, value=True)
                caller.db.xp['log'][time.time()] = [
                    0, gift.db.longname + ' free with renown gain'
                ]

    if 'praxis' in kwargs:
        set(caller,
            kwargs['praxis'].db.longname,
            value=True,
            statclass='Praxis')
        caller.db.xp['log'][time.time()] = [
            0, kwargs['praxis'].db.longname + ' free with gnosis gain'
        ]

    if 'obsession' in kwargs:
        o = find('Obsessions', statclass='Sphere')[0]
        current_obsessions = o.get(caller, subentry='')
        if current_obsessions == False:
            current_obsessions = []
        current_obsessions.append(kwargs['obsession'])
        o.set(caller, current_obsessions)

    return 'start'
Exemplo n.º 29
0
    def cost(self, target, value=True, subentry=''):
        """
        cost


        Determines the cost for a character to purchase a gift.


        target: The character being checked
        value: The level being checked.
        subentry: Seeming benefits


        """
        name = self.db.longname

        # Already have it
        if target.db.gifts and name in target.db.gifts:
            result = 0

        # Wolf Gift
        elif self.db.category.lower() == 'wolf':
            result = 1

        # Shadow Gift and target has gifts to check
        elif target.db.gifts:

            # Is it unlocked
            group = self.db.group
            possess_facet = False
            for item in list(target.db.gifts.keys()):
                if find(item, statclass="Gift")[0].db.group == group:
                    possess_facet = True

            # Not unlocked
            if possess_facet is False:

                # Is it favored
                tribe = find(target.get('Tribe', statclass='Sphere'))[0]
                auspice = find(target.get('Auspice', statclass='Sphere'))[0]

                # Favored
                if (group in tribe.db.tribe_gifts
                        or group in auspice.db.auspice_gifts):
                    result = 3

                # Not favored
                else:
                    result = 5

            # Unlocked
            else:
                result = 2

        else:
            group = self.db.group

            # Is it favored
            tribe = find(target.get('Tribe', statclass='Sphere'))[0]
            auspice = find(target.get('Auspice', statclass='Sphere'))[0]

            # Favored
            if (group in tribe.db.tribe_gifts
                    or group in auspice.db.auspice_gifts):
                result = 3

            # Not favored
            else:
                result = 5

        return result
Exemplo n.º 30
0
def prove_func(target, prove_input):
    if prove_input:
        parsed = parser(prove_input)
    else:
        parsed = {'args': '',
                  'entry': '',
                  'subentry': '',
                  'statclass': '',
                  'value': 0}
    if len(parsed['entry'].split(':')) == 2:
        value = data.get(target, parsed['entry'])
        if value == 1:
            message = (target.name + ' possesses the specialty ' +
                       parsed['entry'])
            send_message(target, message)
        else:
            target.msg('I can\'t do that')
    elif parsed['statclass'].lower() == 'rote':
        if target.get(parsed['entry'], statclass='Rote'):
            message = (target.name + ' possesses the rote ' +
                       data.find(parsed['entry'], statclass='Spell')[0].db.longname)
            send_message(target, message)
        else:
            target.msg('I can\'t do that.')
    elif parsed['statclass'].lower() == 'praxis':
        if target.get(parsed['entry'], statclass='Praxis'):
            message = (target.name + ' possesses the praxis ' +
                       data.find(parsed['entry'], statclass='Spell')[0].db.longname)
            send_message(target, message)
        else:
            target.msg('I can\'t do that.')
    elif parsed['entry'] != '':
        stats = data.find(parsed['entry'], statclass=parsed['statclass'])
        if len(stats) == 0:
            target.msg('Nothing found')
        elif 5 > len(stats) > 1:
            message = short_list(stats)
            target.msg(message)
        elif len(stats) > 4:
            target.msg('Too many found')
        else:
            stat = stats[0]
            value = stat.get(target, subentry=parsed['subentry'])
            name = stat.db.longname
            if parsed['subentry'] != '':
                name = name + '(' + parsed['subentry'] + ')'
            if str(value) == 'True':
                message = (target.name + ' possesses the ' + stat.type() +
                           ' of ' + name)
                send_message(target, message)
            elif (parsed['value'] != '' and value >= parsed['value'] and
                  value != 0):
                message = (target.name + ' possesses at least ' + name + ': ' +
                           str(parsed['value']))
                send_message(target, message)
            elif value != 0:
                message = target.name + ' possesses '
                if not isinstance(value, int):
                    message = message + 'the ' + name + ' of ' + str(value)
                else:
                    message = message + name + ': ' + str(value)
                send_message(target, message)
            else:
                target.msg('I can\'t do that.')
    else:
        target.msg('No entry')