def end_turn(caller): rand = random.randint(2) + 1 #rand = 1; if rand == 1: evmenu.EvMenu(caller, "world.scenarios", startnode="scenario_1") elif rand == 2: evmenu.EvMenu(caller, "world.scenarios", startnode="scenario_2")
def setUp(self): self.menu = None if self.menutree: self.caller = MagicMock() self.caller.key = "Test" self.caller2 = MagicMock() self.caller2.key = "Test" self.caller.msg = MagicMock() self.caller2.msg = MagicMock() self.session = MagicMock() self.session.protocol_flags = {} self.session2 = MagicMock() self.session2.protocol_flags = {} self.caller.session = self.session self.caller2.session = self.session2 self.menu = evmenu.EvMenu( self.caller, self.menutree, startnode=self.startnode, cmdset_mergetype=self.cmdset_mergetype, cmdset_priority=self.cmdset_priority, auto_quit=self.auto_quit, auto_look=self.auto_look, auto_help=self.auto_help, cmd_on_exit=self.cmd_on_exit, persistent=False, startnode_input=self.startnode_input, session=self.session, **self.kwargs, ) # persistent version self.pmenu = evmenu.EvMenu( self.caller2, self.menutree, startnode=self.startnode, cmdset_mergetype=self.cmdset_mergetype, cmdset_priority=self.cmdset_priority, auto_quit=self.auto_quit, auto_look=self.auto_look, auto_help=self.auto_help, cmd_on_exit=self.cmd_on_exit, persistent=True, startnode_input=self.startnode_input, session=self.session2, **self.kwargs, ) self.menu.close_menu = MagicMock() self.pmenu.close_menu = MagicMock()
def quit_bg(caller): caller.msg("Exiting Background Editor") if not caller.chargenfinished(): evmenu.EvMenu(caller, "wodsystem.menu", startnode="menu_chargen", cmd_on_exit=None)
def func(self): """ Start the process """ evmenu.EvMenu(self.caller, "wodsystem.menu", startnode="menu_chargen", cmd_on_exit=None)
def setUp(self): self.caller = Mock() self.caller.msg = Mock() self.menu = evmenu.EvMenu(self.caller, "evennia.utils.evmenu", startnode="test_start_node", persistent=True, cmdset_mergetype="Replace", testval="val", testval2="val2")
def at_read(self, caller): if not self.db.pages: self.init_content() evmenu.EvMenu(caller, {"book_node": book_node}, startnode="book_node", cmdset_mergetype="Union", node_formatter=photograph_node_formatter, options_formatter=photograph_options_formattter, book=self)
def return_appearance(self, looker): # Initialise photograph menu. evmenu.EvMenu(looker, "features.photography", startnode="photograph_node", persistent=True, cmdset_mergetype="Replace", node_formatter=photograph_node_formatter, options_formatter=photograph_options_formattter, photodesc=self.db.image, subjects=self.db.subjects, current_state="") return ""
def menu_accept_stats(caller, raw_string, **kwargs): mt = caller.ndb._menutree for item in list(mt.temp_data.keys()): if not mt.temp_data[item]: del mt.temp_data[item] caller.attributes.add(mt.current_data, mt.temp_data) segment = mt.current_data.split('_')[1].capitalize() caller.chargenfinished(segment=segment, value=True) if not caller.chargenfinished(): evmenu.EvMenu(caller, "wodsystem.menu", startnode="menu_chargen", cmd_on_exit=None) else: pass
def func(self): """Start menu instance.""" evmenu.EvMenu(self.caller, "typeclassess.chargen", startnode="menu_start")
def func(self): "Starts the shop EvMenu instance" evmenu.EvMenu(self.caller, "typeclasses.npcshop", startnode="menunode_shopfront")
def init_tree_selection(treestr, caller, callback, index=None, mark_category=True, go_back=True, cmd_on_exit="look", start_text="Make your selection:"): """ Prompts a player to select an option from a menu tree given as a multi-line string. Args: treestr (str): Multi-lne string representing menu options caller (obj): Player to initialize the menu for callback (callable): Function to run when a selection is made. Must take 4 args: caller (obj): Caller given above treestr (str): Menu tree string given above index (int): Index of final selection selection (str): Key of final selection Options: index (int or None): Index to start the menu at, or None for top level mark_category (bool): If True, marks categories with a [+] symbol in the menu go_back (bool): If True, present an option to go back to previous categories start_text (str): Text to display at the top level of the menu cmd_on_exit(str): Command to enter when the menu exits - 'look' by default Notes: This function will initialize an instance of EvMenu with options generated dynamically from the source string, and passes the menu user's selection to a function of your choosing. The EvMenu is made of a single, repeating node, which will call itself over and over at different levels of the menu tree as categories are selected. Once a non-category selection is made, the user's selection will be passed to the given callable, both as a string and as an index number. The index is given to ensure every selection has a unique identifier, so that selections with the same key in different categories can be distinguished between. The menus called by this function are not persistent and cannot perform complicated tasks like prompt for arbitrary input or jump multiple category levels at once - you'll have to use EvMenu itself if you want to take full advantage of its features. """ # Pass kwargs to store data needed in the menu kwargs = { "index": index, "mark_category": mark_category, "go_back": go_back, "treestr": treestr, "callback": callback, "start_text": start_text } # Initialize menu of selections evmenu.EvMenu(caller, "evennia.contrib.tree_select", startnode="menunode_treeselect", startnode_input=None, cmd_on_exit=cmd_on_exit, **kwargs)
def func(self): evmenu.EvMenu(self.caller, "typeclasses.npcshop", startnode="menunode_shopfront")
def func(self): "Starts your level up menu" evmenu.EvMenu(self.caller, "world.rules.levels", startnode="spend_points")
def func(self): "Starts the shop EvMenu instance" evmenu.EvMenu(self.caller, "world.charactercreation", startnode="menunode_racelist")