def _xp_check_merit_value(caller, raw_string, **kwargs): if not strip_control_sequences(raw_string).isnumeric(): caller.msg('Invalid value') return 'xp_spend' else: current = caller.db.xp['earned'] - caller.db.xp['spent'] value = int(strip_control_sequences(raw_string)) cost = kwargs['stat'].cost(caller, subentry=kwargs['subentry'], value=value) name = kwargs['stat'].db.longname if kwargs['subentry'] != '': name = name + ' (' + kwargs['subentry'] + ')' if cost < 1: caller.msg('Invalid value') return 'xp_spend' elif cost > current: caller.msg('You don\'t have enough XP') return 'xp_spend' elif kwargs['stat'].meets_prereqs(caller, value=value, subentry=kwargs['subentry']): return 'xp_increase', { 'type': 'Merit', 'stat': kwargs['stat'], 'name': name, 'value': value, 'subentry': kwargs['subentry'], 'cost': cost } else: caller.msg('You don\'t meet the prerequisites for that merit') return 'xp_spend'
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'
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'
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'] }
def _check_merit_note(caller, raw_string, **kwargs): merit = kwargs['merit'] if merit.db.noteRestrictions[0] == '*': return 'get_merit_value', { 'total' : kwargs['total'], 'note' : strip_control_sequences(raw_string), 'merit' : merit, 'max' : kwargs['max']} elif strip_control_sequences(raw_string) in merit.db.noteRestrictions: return 'get_merit_value', { 'total' : kwargs['total'], 'note' : strip_control_sequences(raw_string), 'merit' : merit, 'max' : kwargs['max']} else: caller.msg('|/Invalid note for that merit') return 'werewolf_merits'
def _xp_check_merit_note(caller, raw_string, **kwargs): merit = kwargs['stat'] if merit.db.noteRestrictions[0] == '*': return 'xp_get_merit_value', { 'subentry': strip_control_sequences(raw_string), 'stat': merit } elif strip_control_sequences(raw_string) in merit.db.noteRestrictions: return 'xp_get_merit_value', { 'subentry': strip_control_sequences(raw_string), 'stat': merit } else: caller.msg('Invalid note for that merit') return 'xp_spend'
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
def data_in(self, sessid, text="", **kwargs): """ Data Portal -> Server. We also intercept OOB communication here. Args: sessid (int): Session id. Kwargs: text (str): Text from protocol. kwargs (any): Other data from protocol. """ session = self.sessions.get(sessid, None) if session: text = text and to_unicode(strip_control_sequences(text), encoding=session.encoding) if "oob" in kwargs: # incoming data is always on the form (cmdname, args, kwargs) global _OOB_HANDLER if not _OOB_HANDLER: from evennia.server.oobhandler import OOB_HANDLER as _OOB_HANDLER funcname, args, kwargs = kwargs.pop("oob") #print "OOB session.data_in:", funcname, args, kwargs if funcname: _OOB_HANDLER.execute_cmd(session, funcname, *args, **kwargs) # pass the rest off to the session session.data_in(text=text, **kwargs)
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'
def _xp_check_known_stat(caller, raw_string, **kwargs): stat = kwargs['stat'] value = stat.get(caller, subentry=kwargs['subentry']) + 1 cost = stat.cost(caller, subentry=kwargs['subentry'], value=value) current = caller.db.xp['earned'] - caller.db.xp['spent'] if cost > current: caller.msg('You do not have enough XP') return 'xp_spend' else: if stat.meets_prereqs(caller, subentry=kwargs['subentry'], value=value): name = stat.db.longname if kwargs['subentry'] != '': name = name + ' (' + kwargs['subentry'] + ')' send_kwargs = kwargs send_kwargs['stat'] = stat send_kwargs['name'] = name send_kwargs['value'] = value send_kwargs['cost'] = cost if kwargs['special'] == 'frailty': kwargs['frailty'] = strip_control_sequences(raw_string) return 'xp_increase', send_kwargs else: message = 'You do not meet the ' message = message + 'prerequisites to purchase that.|/' caller.msg(message) return 'xp_spend'
def _check_stat_value(caller, raw_string, **kwargs): if not strip_control_sequences(raw_string).isnumeric(): caller.msg('|/Invalid value') return 'vampire_disciplines' else: value = int(strip_control_sequences(raw_string)) if value < 1: caller.msg('|/Invalid value') return 'vampire_disciplines' elif kwargs['stat'].meets_prereqs(caller, value=value): kwargs['stat'].set(caller, value=value) return 'vampire_disciplines' else: caller.msg('|/You don\'t meet the prerequisites for that ' + kwargs['stat'].type()) return 'vampire_disciplines'
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}
def data_in(self, sessid, text="", **kwargs): """ Data Portal -> Server. We also intercept OOB communication here. Args: sessid (int): Session id. Kwargs: text (str): Text from protocol. kwargs (any): Other data from protocol. """ #from evennia.server.profiling.timetrace import timetrace #text = timetrace(text, "ServerSessionHandler.data_in") session = self.sessions.get(sessid, None) if session: text = text and to_unicode(strip_control_sequences(text), encoding=session.encoding) if "oob" in kwargs: # incoming data is always on the form (cmdname, args, kwargs) global _OOB_HANDLER if not _OOB_HANDLER: from evennia.server.oobhandler import OOB_HANDLER as _OOB_HANDLER funcname, args, kwargs = kwargs.pop("oob") #print "OOB session.data_in:", funcname, args, kwargs if funcname: _OOB_HANDLER.execute_cmd(session, funcname, *args, **kwargs) # pass the rest off to the session session.data_in(text=text, **kwargs)
def vampire_template(caller, raw_string, **kwargs): caller.db.cg['start_menu'] = 'cg_vampire' caller.db.cg['start_node'] = 'vampire_template' caller.db.cg['raw_string'] = strip_control_sequences(raw_string) caller.db.cg['kwargs'] = kwargs caller.db.basics = {'Sphere': 'Vampire'} caller.db.sphere = {'Banes': []} caller.db.power = {'Blood Potency': 1} text = 'Select Clan:' option_list = [] clans_list = search_script_tag('clan_stat') clans = [] for item in clans_list: if item.db.restricted == False: clans.append([item.db.longname, item]) clans = sorted(clans, key=itemgetter(0)) for item in clans: option_list.append({ 'desc': item[0], 'goto': (_vampire_set_clan, { 'clan': item[1] }) }) option_list.append({ 'desc': 'Back', 'key': 'B', 'goto': 'return_to_main_cg' }) option_list.append({ 'desc': 'Back', 'key': 'back', 'goto': 'return_to_main_cg' }) 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 + '|/|/' + 'Clan is more archetype than personality. While the Disciplines ' + 'and banes of the various clans may influence behavior, any ' + 'person could be Embraced into any clan. There\'s something to ' + 'be said for playing into stereotypes, but challenging ' + 'established norms can be very fulfilling.|/|/Your choice of ' + 'clan determines the Disciplines with which your character has ' + 'an affinity. As well, every clan has two favored Attributes. ' + 'Take an additional dot in one of these. This can only take an ' + 'Attribute to five dots.' + '|/' + '_' * 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
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'
def werewolf_anchors(caller, raw_string, **kwargs): caller.db.cg['start_node'] = 'werewolf_anchors' caller.db.cg['raw_string'] = strip_control_sequences(raw_string) caller.db.cg['kwargs'] = kwargs blood = get(caller,'Blood',statclass='Sphere') bone = get(caller,'Bone',statclass='Sphere') text = 'Blood: ' if blood: text = text + blood + '|/' else: text = text + 'Unset|/' text = text + 'Bone: ' if bone: text = text + bone + '|/' else: text = text + 'Unset|/' text = text + '|/Chose what to work on' option_list = [ { 'desc' : 'Blood', 'goto' : ('choose_anchor', { 'type' : 'blood' } ) }, { 'desc' : 'Bone', 'goto' : ('choose_anchor', { 'type' : 'bone' } ) } ] if blood and bone: option_list.append ( { 'key' : 'P', 'desc' : 'Proceed', 'goto' : _starting_gifts } ) option_list.append({'desc': 'Back', 'key': 'B', 'goto': _return_to_renown}) option_list.append({'desc': 'Back', 'key': 'back', 'goto': _return_to_renown}) 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 + '|/|/' + 'Your character possesses traits called Blood and Bone. They ' + 'reflect a core dichotomy of the Uratha condition. A Blood ' + 'archetype reflects your character\'s behavior and identity on ' + 'the hunt, when claws are out, and lives are on the line. A Bone ' + 'archetype reflects your character\'s sense of self-identity. ' + 'It\'s who she is behind the instincts, fur, and fury.' + '|/' + '_' * 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
def werewolf_template(caller, raw_string, **kwargs): caller.db.cg['start_menu'] = 'cg_werewolf' caller.db.cg['start_node'] = 'werewolf_template' caller.db.cg['raw_string'] = strip_control_sequences(raw_string) caller.db.cg['kwargs'] = kwargs caller.db.basics = { 'Sphere' : 'Werewolf' } caller.db.renown = {'Cunning': 0, 'Glory': 0, 'Honor': 0, 'Purity': 0, 'Wisdom': 0} caller.db.power = { 'Primal Urge' : 1 } caller.db.gifts = {} caller.db.werewolfRites = {} text = 'Select Auspice:' option_list = [] auspices_list = search_script_tag('auspice_stat') auspices=[] for item in auspices_list: if item.db.restricted == False: auspices.append([item.db.longname,item]) auspices = sorted(auspices,key=itemgetter(0)) for item in auspices: option_list.append( {'desc' : item[0], 'goto' : ( _werewolf_set_auspice, { 'auspice' : item[1] } ) } ) option_list.append({'desc': 'Back', 'key': 'B', 'goto': 'return_to_main_cg'}) option_list.append({'desc': 'Back', 'key': 'back', 'goto': 'return_to_main_cg'}) 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 + '|/|/' + 'Auspice, the moon under which a werewolf changes, is her first ' + 'defining trait as one of the Forsaken. Auspice helps guide her ' + 'in her expected role among the Uratha. A character\'s auspice ' + 'offers certain advantages in fulfilling that role, and Uratha ' + 'often look down upon those who deviate too far from their ' + 'expected roles.|/|/From a character creation standpoint, ' + 'auspice offers you a free dot of one of three Skills, and one ' + 'of your starting Renown dots. You can choose any of the three ' + 'auspice Skills, but this free dot cannot take the Skill beyond ' + 'five dots.' + '|/' + '_' * 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
def changeling_court(caller, raw_string, **kwargs): caller.db.cg['start_node'] = 'changeling_court' caller.db.cg['raw_string'] = strip_control_sequences(raw_string) caller.db.cg['kwargs'] = kwargs kith = kwargs['kith'] caller.db.sphere['Kith'] = kith.db.longname text = 'Select Court:' option_list = [] for item in courts: option_list.append({ 'desc': item, 'goto': (_changeling_set_court, { 'court': item }) }) option_list.append({'desc': 'Back', 'key': 'B', 'goto': 'changeling_kith'}) option_list.append({ 'desc': 'Back', 'key': 'back', 'goto': 'changeling_kith' }) 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)' helptext = ('Courts are the changelings\' way of coping with the Fae. ' 'Courts represent strong emotions and the stages of grief ' 'that come after abuse, but also represent a practical way ' 'for changelings to defend themselves. Your character ' 'ultimately chooses her own court based on a variety of ' 'personal decisions, and it may change during play. You may ' 'choose to start play without a court.|/' '|/' 'If you decide to start play as a courtier, your character ' 'receives a free dot in the appropriate Mantle Merit for her ' 'court.') display = { 'text': { 'contents': text }, 'help': { 'contents': helptext, 'formatter': 'bars' }, 'options': { 'contents': options, 'hidekeys': ['q', 'Quit', 'back'], 'movekeys': ['B', 'P'], 'rows': 10 }, 'footer': { 'contents': footer } } return display
def _check_merit_value(caller, raw_string, **kwargs): if not strip_control_sequences(raw_string).isnumeric(): caller.msg('|/Invalid value') return 'werewolf_merits' else: value=int(strip_control_sequences(raw_string)) if value < 1: caller.msg('|/Invalid value') return 'werewolf_merits' elif value + kwargs['total'] - kwargs['merit'].get(caller, subentry=kwargs['note']) > kwargs['max']: caller.msg('|/You don\'t have enough points') return 'werewolf_merits' elif kwargs['merit'].meets_prereqs(caller,value=value, subentry=kwargs['note']): kwargs['merit'].set(caller,value=value,subentry=kwargs['note']) return 'werewolf_merits' else: caller.msg('|/You don\'t meet the prerequisites for that merit') return 'werewolf_merits'
def changeling_regalia(caller, raw_string, **kwargs): caller.db.cg['start_node'] = 'changeling_regalia' caller.db.cg['raw_string'] = strip_control_sequences(raw_string) caller.db.cg['kwargs'] = kwargs text = 'Select second Regalia:' option_list = [] for item in regalia: if item != caller.db.sphere['Regalia'][0]: option_list.append({ 'desc': item, 'goto': (_changeling_set_regalia, { 'regalia': item }) }) option_list.append({ 'desc': 'Back', 'key': 'B', 'goto': 'changeling_anchors' }) option_list.append({ 'desc': 'Back', 'key': 'back', 'goto': 'changeling_anchors' }) 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)' helptext = ('Contracts have a variety of effects grouped into common ' 'themes called Regalia, such as Crown for leadership, or ' 'Mirror for perception. Most Contracts are freely accessible ' 'to all changelings, but each seeming has a particular ' 'affinity for one Regalia, and you choose a second favored ' 'Regalia for your character as well.') display = { 'text': { 'contents': text }, 'help': { 'contents': helptext, 'formatter': 'bars' }, 'options': { 'contents': options, 'hidekeys': ['q', 'Quit', 'back'], 'movekeys': ['B', 'P'], 'rows': 5 }, 'footer': { 'contents': footer } } return display
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
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}
def changeling_stat(caller, raw_string, **kwargs): caller.db.cg['start_node'] = 'changeling_stat' caller.db.cg['raw_string'] = strip_control_sequences(raw_string) caller.db.cg['kwargs'] = kwargs seeming = kwargs['seeming'] text = 'Select one attribute to boost:' option_list = [] caller.db.sphere['Seeming'] = seeming.db.longname caller.db.sphere['Regalia'] = [seeming.db.regalia] for attribute in seeming.db.favored_attributes: option_list.append({ 'desc': attribute.capitalize(), 'goto': (_raise_stat, { 'stat': attribute.lower() }) }) option_list.append({ 'desc': 'Back', 'key': 'B', 'goto': 'changeling_template' }) option_list.append({ 'desc': 'Back', 'key': 'back', 'goto': 'changeling_template' }) 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)' helptext = ('Every seeming has three favored Attributes from either ' 'Power, Finesse, or Resistance traits. Take an additional dot ' 'in one of these. This can only take an Attribute to five ' 'dots.') display = { 'text': { 'contents': text }, 'help': { 'contents': helptext, 'formatter': 'bars' }, 'options': { 'contents': options, 'hidekeys': ['q', 'Quit', 'back'], 'movekeys': ['B', 'P'], 'rows': 10 }, 'footer': { 'contents': footer } } return display
def werewolf_renown(caller, raw_string, **kwargs): caller.db.cg['start_node'] = 'werewolf_renown' caller.db.cg['raw_string'] = strip_control_sequences(raw_string) caller.db.cg['kwargs'] = kwargs text = ('Select one renown to boost:' + '|/|_|_|_|_Cunning: ' + str(caller.get('Cunning', statclass='Renown')) + '|/|_|_|_|_Glory: ' + str(caller.get('Glory', statclass='Renown')) + '|/|_|_|_|_Honor: ' + str(caller.get('Honor', statclass='Renown')) + '|/|_|_|_|_Purity: ' + str(caller.get('Purity', statclass='Renown')) + '|/|_|_|_|_Wisdom: ' + str(caller.get('Wisdom', statclass='Renown'))) renown_list = search_script_tag('renown_stat') renown = [] for item in renown_list: renown.append([item.db.longname, item]) renown = sorted(renown, key=itemgetter(0)) option_list = [] for item in renown: option_list.append({'desc': item[0], 'goto': (_raise_renown, {'renown': item[1]})}) option_list.append({'desc': 'Back', 'key': 'B', 'goto': _return_to_tribe}) option_list.append({'desc': 'Back', 'key': 'back', 'goto': _return_to_tribe}) 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 + '|/|/' + 'Choose another dot in a Renown of your choice, but note that ' + 'you cannot take a third dot in a single Renown at this point. ' + 'Ghost Wolves receive this dot of Renown, for a total of two.' + '|/' + '_' * 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
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'
def vampire_covenant(caller, raw_string, **kwargs): caller.db.cg['start_node'] = 'vampire_covenant' caller.db.cg['raw_string'] = strip_control_sequences(raw_string) caller.db.cg['kwargs'] = kwargs text = 'Select Covenant:' covenants_list = search_script_tag('covenant_stat') covenants = [] for item in covenants_list: if item.db.restricted == False: covenants.append([item.db.longname, item]) covenants = sorted(covenants, key=itemgetter(0)) option_list = [] for item in covenants: option_list.append({ 'desc': item[0], 'goto': (_set_covenant, { 'covenant': item[1] }) }) option_list.append({'desc': 'Unaligned', 'goto': _no_covenant}) option_list.append({'desc': 'Back', 'key': 'B', 'goto': _return_to_stat}) option_list.append({ 'desc': 'Back', 'key': 'back', 'goto': _return_to_stat }) 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 + '|/|/' + 'Covenants are Kindred social orders. While your character\'s ' + 'sire may influence her covenant choice, ultimately the choice ' + 'is hers. Also, it may change with time. You may choose to start ' + 'play without a covenant. Kindred without covenants are often ' + 'seen as untrustworthy, but they have more freedom to negotiate ' + 'their own alliances.' + '|/' + '_' * 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
def _xp_check_arcane(caller, raw_string, **kwargs): input = strip_control_sequences(raw_string) if not input.isnumeric(): caller.msg('Not a numeric value') return 'xp_use_arcane', kwargs elif int(input) < 0: caller.msg('You cannot use a negative value') return 'xp_use_arcane', kwargs elif int(input) > kwargs['max']: caller.msg('Value cannot be more than ' + str(kwargs['max'])) return 'xp_use_arcane', kwargs else: kwargs['arcane'] = int(input) kwargs['cost'] = kwargs['cost'] - int(input) return 'xp_increase', kwargs
def vampire_stat(caller, raw_string, **kwargs): caller.db.cg['start_node'] = 'vampire_stat' caller.db.cg['raw_string'] = strip_control_sequences(raw_string) caller.db.cg['kwargs'] = kwargs clan = kwargs['clan'] text = 'Select one attribute to boost:' option_list = [] for attribute in clan.db.favored_attributes: option_list.append({ 'desc': attribute.capitalize(), 'goto': (_raise_stat, { 'stat': attribute.lower(), 'clan': kwargs['clan'] }) }) option_list.append({ 'desc': 'Back', 'key': 'B', 'goto': 'vampire_template' }) option_list.append({ 'desc': 'Back', 'key': 'back', 'goto': 'vampire_template' }) 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 + '|/|/' + 'Every clan has two favored Attributes. ' + 'Take an additional dot in one of these. This can only take an ' + 'Attribute to five dots.' + '|/' + '_' * 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
def werewolf_tribe(caller, raw_string, **kwargs): caller.db.cg['start_node'] = 'werewolf_tribe' caller.db.cg['raw_string'] = strip_control_sequences(raw_string) caller.db.cg['kwargs'] = kwargs text = 'Select Tribe:' tribes_list = search_script_tag('tribe_stat') tribes = [] for item in tribes_list: if item.db.restricted == False: tribes.append([item.db.longname, item]) tribes = sorted(tribes, key=itemgetter(0)) option_list = [] for item in tribes: option_list.append( {'desc' : item[0], 'goto' : ( _set_tribe, { 'tribe' : item[1] } ) } ) option_list.append({'desc': 'Back', 'key': 'B', 'goto': _return_to_stat}) option_list.append({'desc': 'Back', 'key': 'back', 'goto': _return_to_stat}) 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 + '|/|/' + 'Characters belong to one of five tribes - or your character may ' + 'be a Ghost Wolf, without a tribe. Remember, unlike auspice, ' + 'your character chooses her tribe. Generally, characters align ' + 'relatively closely to their tribe expectations.|/|/Each tribe ' + 'has an associated Renown.' + '|/' + '_' * 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
def _xp_check_specialties(caller, raw_string, **kwargs): name = (kwargs['stat'].db.longname + ': ' + strip_control_sequences(raw_string)) current = caller.db.xp['earned'] - caller.db.xp['spent'] if name in caller.db.specialties: caller.msg('You already possess that specialty') return "xp_spend" elif current < 1: caller.msg('You don\'t have enough XP') return "xp_spend" else: return 'xp_increase', { 'type': 'specialty', 'stat': kwargs['stat'], 'name': name, 'value': True, 'subentry': '', 'cost': 1 }
def data_in(self, sessid, text="", **kwargs): """ Data Portal -> Server. We also intercept OOB communication here. """ session = self.sessions.get(sessid, None) if session: text = text and to_unicode(strip_control_sequences(text), encoding=session.encoding) if "oob" in kwargs: # incoming data is always on the form (cmdname, args, kwargs) global _OOB_HANDLER if not _OOB_HANDLER: from evennia.server.oobhandler import OOB_HANDLER as _OOB_HANDLER funcname, args, kwargs = kwargs.pop("oob") #print "OOB session.data_in:", funcname, args, kwargs if funcname: _OOB_HANDLER.execute_cmd(session, funcname, *args, **kwargs) # pass the rest off to the session session.data_in(text=text, **kwargs)
def werewolf_stat(caller, raw_string, **kwargs): caller.db.cg['start_node'] = 'werewolf_stat' caller.db.cg['raw_string'] = strip_control_sequences(raw_string) caller.db.cg['kwargs'] = kwargs auspice = kwargs['auspice'] text = 'Select one skill to boost:' option_list=[] for attribute in auspice.db.auspice_skills: option_list.append( { 'desc' : attribute.capitalize(), 'goto' : (_raise_stat, {'stat' : attribute.lower(), 'auspice' : kwargs['auspice'] } ) } ) option_list.append({'desc': 'Back', 'key': 'B', 'goto': 'werewolf_template'}) option_list.append({'desc': 'Back', 'key': 'back', 'goto': 'werewolf_template'}) 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 + '|/|/' + 'From a character creation standpoint, auspice offers you a free ' + 'dot of one of three Skills. You can choose any of the three ' + 'auspice Skills, but this free dot cannot take the Skill beyond ' + 'five dots.' + '|/' + '_' * 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