import bt.game.action as action from bt.game.handler import MultiScreenHandler, Screen class TavernHandler(MultiScreenHandler): pass tavern = TavernHandler("inside/pub.png", location="Tavern") pub = tavern tavern_greeting_screen = Screen() tavern_greeting_screen.add_message("Hail, travelers! Step to the bar and I'll draw you a tankard.") tavern_greeting_screen.add_message("\nYou can:\n") tavern_greeting_screen.add_option('Order a drink', 'oO', action.change_screen("order")) tavern_greeting_screen.add_option('Talk to barkeep', 'tT', action.change_screen("talk")) tavern_greeting_screen.add_message("\n\n\n") tavern_greeting_screen.add_option('(EXIT)', 'eE', action.exit_building(), pos= -1, center=True) tavern_order_screen = Screen() tavern_order_screen.add_message("Seat thyself, %(charname)s. We've got...\n") tavern_order_screen.add_option("Ale", "aA", action.message("Not bad!!")) tavern_order_screen.add_option("Beer", "bB", action.message("Not bad!!")) tavern_order_screen.add_option("Mead", "mM", action.message("Not bad!!")) tavern_order_screen.add_option("Foul spirits", "fF", action.message("You don't feel too well.")) tavern_order_screen.add_option("Ginger Ale", "gG", action.message("The girls in the tavern are not impressed.")) tavern_order_screen.add_option("Wine", "wW", action.message("The barkeep says, \"Go down to the cellar and pick out a bottle.\"")) tavern_order_screen.add_message("\n\nWhat'll it be?") tavern_order_screen.add_option('(CANCEL)', 'cC', action.change_screen("greeting"), pos= -1, center=True) tavern_talk_screen = Screen() tavern_talk_screen.add_message("\"Talk ain't cheap,\" the barkeep says.") tavern_talk_screen.add_message("\nHow much will you tip him?\n\n\n")
def __init__(self, filename, message, exit_action=action.exit_building(), location=""): ImageDisplayHandler.__init__(self, filename, location=location) self.set_cancel_action(exit_action) self.add_key_event("eE", exit_action) self.message = message
def key_event(self, state, key): if EventHandler.key_event(self, state, key): return True action.exit_building()(state) return True