Example #1
0
def select_char_quickspells(previousModeIn):
    universal.clear_screen()
    global previousMode
    previousMode = previousModeIn
    if len(universal.state.party) == 1:
        modify_quick_spells(universal.state.party[0])
    else:
        universal.say_title(format_line([chosenPerson.name + "'s", "Quick Spells"]))
        universal.say(universal.numbered_list(universal.state.party.members))
        set_commands(['(#) Select a character.', '<==Back'])
        set_command_interpreter(select_char_quickspells_interpreter)
Example #2
0
def select_weapon():
    """
    Asks the user to select a weapon, one of a dagger, sword, or spear.
    """
    global weaponList
    weaponList = [itemspotionwars.familyDagger, itemspotionwars.familySword,
            itemspotionwars.familySpear]
    universal.say_title('Request Weapon')
    universal.say('\n'.join(universal.numbered_list([weapon.name for weapon in
            weaponList])), justification=0)
    set_commands(SELECT_NUMBER_BACK_COMMAND)
    set_command_interpreter(select_weapon_interpreter)
Example #3
0
def select_underwear():
    """
    Asks the user which set of underwear the player character should wear.
    """
    global underwearList
    underwearList = [item for item in STARTING_INVENTORY if items.is_underwear(item)]
    if universal.state.player.lower_clothing() == items.emptyLowerArmor:
        underwearList.remove(items.emptyUnderwear)
    universal.say_title('Select Underwear')        
    universal.say('\n'.join(universal.numbered_list([underwear.name for underwear in underwearList])), justification=0)
    set_commands(SELECT_NUMBER_BACK_COMMAND)
    set_command_interpreter(select_underwear_interpreter)
Example #4
0
def request_musculature():
    universal.say_title('Select Musculature')
    musculature = '\n'.join([m + ':' for m in universal.numbered_list(person.MUSCULATURE)])
    musculatureDescr = [
            ' '.join(['', universal.state.player.name, '''has a soft, jiggly body.''']), 
            ' '.join(['', universal.state.player.name, '''has a firm, smooth body.''']), 
            ' '.join(['', universal.state.player.name, '''has a hard, muscled body.'''])
            ]
    musculatureDescr = '\n'.join(musculatureDescr)    
    universal.say(musculature + '\t' + musculatureDescr, justification=0, columnNum=3)
    set_command_interpreter(request_musculature_interpreter)
    set_commands(universal.SELECT_NUMBER_BACK_COMMAND)
Example #5
0
def select_equipment():
    universal.say_title("Select Equipment to Enchant:")
    global equipmentList
    global partialNum
    equipmentList = []
    partialNum = ''
    for person in universal.state.party:
        equipmentList.extend([(person, equipment) for equipment in person.equipmentList
             if not items.is_empty_item(equipment) and 
            not items.is_pajamas(equipment)])
    personEquipmentStrings = [''.join([person.printedName, ": ", equipment.name]) for
            person, equipment in equipmentList]
    universal.say('\n'.join(universal.numbered_list(personEquipmentStrings)))
    universal.set_commands(["(#) Select Equipment: " + str(partialNum) + '_', "<==Back"])
    universal.set_command_interpreter(select_equipment_interpreter)
Example #6
0
def request_height():
    NUM_INCHES_IN_FOOT = 12
    NUM_METERS_IN_INCH = .0254
    def inches_to_meters(inches):
        return round(inches * NUM_METERS_IN_INCH, 2)
    universal.say_title('Select Height')
    height = universal.numbered_list([h + ':' for h in person.HEIGHTS])
    heightNums = [''.join(['''5' - 5'4" (''', str(inches_to_meters(60)), 'm - ', str(inches_to_meters(64)), '''m) ''']),
            ''.join(['''5'4" - 5'8" (''', str(inches_to_meters(64)), 'm - ', str(inches_to_meters(68)), '''m) ''']),
            ''.join(['''5'8" - 6'" (''', str(inches_to_meters(68)), 'm - ', str(inches_to_meters(72)), '''m) ''']),
            ''.join(['''over 6' (''', str(inches_to_meters(72)), '''m)'''])]
    heightNums = '\n'.join(heightNums)
    height = '\n'.join(height)
    universal.say(height + '\t' + heightNums, columnNum=4, justification=0)
    set_commands(universal.SELECT_NUMBER_BACK_COMMAND)
    set_command_interpreter(request_height_interpreter)
Example #7
0
def select_lower_clothing():
    """
    Asks the user for lower clothing to wear.
    """
    global pantsList
    if universal.state.player.lower_clothing() is \
            universal.state.player.shirt():
        select_underwear()
    else:
        universal.say_title('Select Lower Clothing')
        pantsList = [item for item in STARTING_INVENTORY if
                items.is_outer_lower_clothing(item) and
                     not items.is_full_clothing(item)]
        universal.say('\n'.join(universal.numbered_list([pants.name for pants
                in pantsList])), justification=0)
        set_commands(universal.SELECT_NUMBER_BACK_COMMAND)
        set_command_interpreter(select_lower_clothing_interpreter)
Example #8
0
def select_shirt():
    """
    Asks the player to select a shirt for the player character.
    """
    global shirtList, user_input
    user_input = ''
    universal.say_title('Select Shirt')
    shirtList = [item for item in STARTING_INVENTORY if
                 items.is_upper_clothing(item)]
    universal.say(
        '\n'.join(
            universal.numbered_list([shirt.name for shirt in shirtList])
        ),
        justification=0
    )
    if user_input:
        set_commands(universal.add_number_to_select_number_command(user_input))
    set_command_interpreter(select_shirt_interpreter)
Example #9
0
def load(returnMode=None):
    global returnTo, loadName, saveFiles
    if returnMode is not None:
        returnTo = returnMode
    else:
        returnTo = town_mode
    saveFiles = sorted([fileName for fileName in os.listdir('save') if fileName[0] != '.'])
    try:
        saveFiles.insert(0, saveFiles.pop(saveFiles.index('quick.sav')))
    except ValueError: 
        pass
    universal.clear_world_view()
    universal.say_title('Load')
    universal.say('\n'.join(universal.numbered_list([sf for sf in saveFiles if sf[0] != '.'])))
    if len(saveFiles) < 10:
        universal.set_commands(['(#) Select a file to load:', '<==Back'])
    else:
        universal.set_commands(['(#) Select a file to load:_', '<==Back'])
    universal.set_command_interpreter(load_interpreter)
Example #10
0
def select_gem(shopkeeperIn=None, doneShoppingLitany=None):
    global partialNum
    if sum(person.coins for person in universal.state.party) < 30 and (
            universal.state.enchantmentFreebies == 0):
        universal.say("You don't have enough money to enchant anything!")
        universal.acknowledge(done_shopping, ())
        return
    universal.say_title("Select Enhancement Gem")
    global gemList, litany, shopkeeper
    shopkeeper = shopkeeperIn
    litany = doneShoppingLitany
    gemList = []
    for person in universal.state.party:
        gemList.extend([(person, item) for item in person.get_inventory() if 
            hasattr(item, "enchantmentType")])
        gemStrings = [''.join([person.name, ": ", item.name]) for person, item in gemList]
    universal.say(universal.numbered_list(gemStrings))
    universal.set_commands(["(#) Select Gem: " + str(partialNum) + '_', "<==Back"])
    universal.set_command_interpreter(select_gem_interpreter)
    partialNum = ''
Example #11
0
def style_character_interpreter(keyEvent):
    bedroom = universal.state.bedroom
    try:
        num = int(universal.key_name(keyEvent)) - 1
    except ValueError:
        if keyEvent.key == K_BACKSPACE:
            rest_mode(bedroom)
    else:
        global chosenPerson
        try:
            chosenPerson = universal.state.party[num]
        except IndexError:
            return
        else:
            say_title(format_line(['How should', chosenPerson.name + "'s", '''hair be styled?''']))
            if chosenPerson.hairLength == 'short':
                hairStyles = person.SHORT_HAIR_STYLE
            universal.say('\n'.join(universal.numbered_list(chosenPerson.hair_styles())), justification=0)
            set_command_interpreter(style_hair_interpreter)
            set_commands(universal.SELECT_NUMBER_BACK_COMMAND)
Example #12
0
def save(previousModeIn):
    global saveFiles, previousMode
    previousMode = previousModeIn
    try:
        saveFiles = sorted([file for file in os.listdir('save') if file[0] != '.'])
    except OSError:
        os.mkdir('save')
        saveFiles = sorted([file for file in os.listdir('save') if file[0] != '.'])
    universal.clear_world_view()
    universal.say_title('Save')
    try:
        saveFiles.insert(0, saveFiles.pop(saveFiles.index('quick.sav')))
    except ValueError:
        pass
    universal.say('\n'.join(universal.numbered_list(saveFiles)))
    if len(saveFiles) < 10:
        universal.set_commands(['Provide a save name:_', '(#) Select a save file.', '<==Back'])
    else:
        universal.set_commands([' '.join(['Provide a save name:_']), '(#) Select a save file:_', '<==Back'])
    universal.set_command_interpreter(save_interpreter)
Example #13
0
def request_body_type():
    universal.say_title('Select Body Type')
    bodyTypes = ["hunky" if universal.state.player.is_male() and bodyType == "voluptuous" else bodyType for bodyType in person.BODY_TYPES]
    universal.say('\n'.join(universal.numbered_list(bodyTypes)), justification=0)
    set_command_interpreter(request_body_type_interpreter)
    set_commands(universal.SELECT_NUMBER_BACK_COMMAND)
Example #14
0
def style_character():
        universal.say_title('Whose hair should be styled?')
        universal.say(universal.numbered_list([member.printedName for member in universal.state.party.members]), justification=0)
        set_commands(universal.SELECT_NUMBER_BACK_COMMAND)
        set_command_interpreter(style_character_interpreter)
Example #15
0
 def store_items(self):
     universal.say_title('Stored Items')
     universal.say(', '.join(universal.numbered_list(self.items)))
     set_commands(['(#)View Item', '(Enter) View Inventory', '<==Back'])
     set_command_interpreter(store_items_interpreter)