Exemplo n.º 1
0
def inventory_pc(pc):
    world=Rogue.world()
##    assert world.has_component(pc, cmp.Inventory), "PC missing inventory"
    pcInv = world.component_for_entity(pc, cmp.Inventory)
    pcn = world.component_for_entity(pc, cmp.Name)
    x=0
    y=rog.view_port_y()
#   items menu
    item=rog.menu("{}{}'s Inventory".format(
        pcn.title,pcn.name), x,y, pcInv.items)
    
#   viewing an item
    if not item == -1:
        itemn = world.component_for_entity(item, cmp.Name)
##        itemn = world.component_for_entity(item, cmp.Name)
        keysItems={}
        
    #   get available actions for this item...
        if world.has_component(item, cmp.Edible):
            keysItems.update({"E":"Eat"})
        if world.has_component(item, cmp.Quaffable):
            keysItems.update({"q":"quaff"})
        if world.has_component(item, cmp.Equipable):
            keysItems.update({"e":"equip"})
            # throwables - subset of equipables
            if world.component_for_entity(item, cmp.Equipable).equipType == EQ_MAINHAND:
                keysItems.update({"t":"throw"})
        if world.has_component(item, cmp.Usable):
            keysItems.update({"u":"use"})
        if world.has_component(item, cmp.Openable):
            keysItems.update({"o":"open"})
        keysItems.update({"x":"examine"})
        keysItems.update({"d":"drop"})
        #
        
        opt=rog.menu(
            "{}".format(itemn.name), x,y,
            keysItems, autoItemize=False
        )
        #print(opt)
        if opt == -1: return
        opt=opt.lower()
        
        rmg=False
        if   opt == "drop":     rmg=True; drop_pc(pc, item)
        elif opt == "equip":    rmg=True; equip_pc(pc, item)
        elif opt == "throw":    rmg=True; throw_pc(pc, item)
        elif opt == "eat":      rmg=True; eat_pc(pc, item)
        elif opt == "quaff":    rmg=True; quaff_pc(pc, item)
        elif opt == "use":      rmg=True; use_pc(pc, item)
        elif opt == "examine":  rmg=True; examine_pc(pc, item)
        
        if rmg: rog.drain(pc, 'nrg', NRG_RUMMAGE)
Exemplo n.º 2
0
def inventory_pc(pc,pcInv):
    if not pc.inv:
        rog.alert(ALERT_EMPTYCONTAINER)
        return
    x=0
    y=rog.view_port_y()
#   items menu
    item=rog.menu("{}'s Inventory".format(pc.name), x,y, pcInv.items)
    
#   viewing an item
    if not item == -1:
        keysItems={}
        
    #   get available actions for this item...
        if rog.on(item,CANEAT):
            keysItems.update({"E":"Eat"})
        if rog.on(item,CANQUAFF):
            keysItems.update({"q":"quaff"})
        if rog.on(item,CANEQUIP):
            keysItems.update({"e":"equip"})
        if rog.on(item,CANUSE):
            keysItems.update({"u":"use"})
        if rog.on(item,CANOPEN):
            keysItems.update({"o":"open"})
        keysItems.update({"x":"examine"})
        keysItems.update({"d":"drop"})
        keysItems.update({"t":"throw"})
        #
        
        opt=rog.menu(
            "{}".format(item.name), x,y,
            keysItems, autoItemize=False
        )
        #print(opt)
        if opt == -1: return
        opt=opt.lower()
        
        rmg=False
        if   opt == "drop":     rmg=True; drop_pc(pc,item)
        elif opt == "equip":    rmg=True; equip_pc(pc,item)
        elif opt == "eat":      rmg=True; eat_pc(pc, item)
        elif opt == "quaff":    rmg=True; quaff_pc(pc, item)
        elif opt == "use":      rmg=True; use_pc(pc, item)
        elif opt == "examine":  rmg=True; examine_pc(pc, item)
        
        if rmg: rog.drain(pc, 'nrg', NRG_RUMMAGE)
Exemplo n.º 3
0
def pickup_pc(pc):
    rog.alert("Pick up what?{d}".format(d=dirStr))
    args=rog.get_direction()
    if not args:
        rog.alert()
        return
    dx,dy,dz=args
    xx,yy=pc.x + dx, pc.y + dy
    
    things=rog.thingsat(xx,yy)
    if pc in things:
        things.remove(pc)

    choice=None
    if len(things) > 1:
        rog.alert("There are multiple things here. Pick up which item?")
        choices = [] #["all",] #should player be able to pickup multiple things at once? Maybe could be a delayed action?
        for thing in things:
            choices.append(thing)
        choice=rog.menu(
            "pick up", rog.view_port_x()+2, rog.view_port_y()+2, choices
            )
    else:
        if things:
            choice=things[0]

    if (choice and not choice == "all"):

        if choice == K_ESCAPE:
            return
        
        #thing is creature! You can't pick up creatures :(
        if choice.isCreature:
            rog.alert("You can't pick that up!")
            return
        #thing is on fire! What are you doing trying to pick it up??
        if rog.on(choice,FIRE):
            answer=""
            while True:
                answer=rog.prompt(0,0,rog.window_w(),1,maxw=1,
                    q="That thing is on fire! Are you sure? y/n",
                    mode='wait',border=None)
                answer=answer.lower()
                if answer == "y" or answer == " " or answer == K_ENTER:
                    rog.alert("You burn your hands!")
                    rog.burn(pc, FIRE_BURN)
                    rog.hurt(pc, FIRE_HURT)
                    break
                elif answer == "n" or answer == K_ESCAPE:
                    return
        # put in inventory
        pocketThing(pc, choice)
    #elif choice == "all":
    #    
    else:
        rog.alert("There is nothing there to pick up.")
Exemplo n.º 4
0
def _barter(ent:int, personality:int, disposition:int, style=0):
    netvalue = 0   # TRUE value of transaction from perspective of the NPC
    delta_money = 0     # PC's offer for money (pos.: give to NPC, neg: take money from NPC)
    pc_offer = []       # PC items offered
    npc_offer = []      # NPC items requested
    def offer(item):
        netvalue += rog.get_value(item)
        pc_offer.append(offer)
    def request(item):
        netvalue -= rog.get_value(item)
        npc_offer.append(offer)
    while True:
        '''
            idea: format: center of screen has two side-by-side
            lists that show what items are being offered/requested
            and below or above shows the money offered/requested.
            When you choose offer or request menu the respective
            inventory pops up and you can choose an item from it.
            
        '''

        # Value in BarterOffer is true value of offer
        # In _get_reaction the perceived value is accounted for.
        # This means that we can use the _get_reaction function
        # for the perceived value of bartering, gift giving and
        # asking favors (asking for gifts).
        
        # update the transaction display #
        
        
        # user input #
        menu={
            '*' : "cancel",
            'o' : "offer item",
            'r' : "request item",
            'h' : "haggle",
            }
        opt=rog.menu("barter",0,0,menu, autoItemize=False)
        if opt==-1:
            break
        selected = menu[opt]
        if selected=="cancel":
            delta = -50 if rog.world().has_component(ent, cmp.Rich) else -10
            _change_disposition(ent, delta)
            return
        elif selected=="offer item":
            item = _offer_menu(ent, personality, disposition, pc_offer, style=style)
            if item:
                offer(item)
        elif selected=="request item":
            item = _request_menu(ent, personality, disposition, npc_offer, style=style)
            if item:
                request(item)
        elif selected=="haggle":
            delta_money = _haggle_menu(ent, personality, disposition, pc_offer, npc_offer, style=style)
Exemplo n.º 5
0
def _selectFromBigMenu():
    ''' run the big menu, return whether any char data has changed
    '''
    libtcod.console_clear(0)
    libtcod.console_clear(rog.con_final())
    _printChargenData()
    rog.refresh()
    _drawskills(0)
    _drawtraits(0)
    _choice = rog.menu( "character specs", Chargen.xx,10, Chargen.menu.keys() )
    if _choice == -1: # Esc
        Chargen.confirm = True
        return False
    selected=Chargen.menu.get(_choice, None)
    if not selected:
        print("Failure in _selectFromBigMenu()... information:")
        print("    selected: ", selected)
        print("    _choice: ", _choice)
        return False
    
    # selection successful.
    # figure out what type of option was selected
    if selected=="confirm":
        Chargen.confirm = True
    elif selected=="open-skills":
        Chargen.open_skills = True
    elif selected=="close-skills":
        Chargen.open_skills = False
    elif selected=="open-stats":
        Chargen.open_stats = True
    elif selected=="close-stats":
        Chargen.open_stats = False
    elif selected=="open-attributes":
        Chargen.open_attributes = True
    elif selected=="close-attributes":
        Chargen.open_attributes = False
    elif selected=="open-traits":
        Chargen.open_traits = True
    elif selected=="close-traits":
        Chargen.open_traits = False
    elif selected in Chargen.skilldict.values():
        return _select_skill(selected)
    elif selected in Chargen.statdict.values():
        return _select_stat(selected)
    elif selected in Chargen.attdict.values():
        return _select_attribute(selected)
    elif selected in Chargen.traitdict.values():
        return _select_trait(selected)
    
    return False
Exemplo n.º 6
0
def _select_talent():
    menu={}
    for k,v in sorted(SKILLS.items(), key=lambda x: x[1][1].lower()):
        menu[v[1]] = k
    menu["<cancel>"] = -1
    choice=rog.menu(
        "In which skill are you talented?",
        0,0, menu.keys(), autoItemize=True
        )
    if choice!=-1:
        selected = menu[choice]
        rog.world().add_component(Chargen.pc, cmp.Talented(
            {selected: TALENTED_EXPMOD} ))
        return True
    return False
Exemplo n.º 7
0
def _get_gift_for(ent:int) -> tuple:
    opt = rog.prompt(
        0,0,rog.window_w(),4,q='Offer money or possessions? $/i',
        mode='wait',default='$'
        )
    if opt=='$':
        value = rog.prompt(
            0,0,rog.window_w(),4,q='Offer how much money?',
            mode='wait',default=0
            )
    elif opt=='i':
        options = {
            "cancel" : 0,
            "item from inventory" : -100,
            }
        body = world.component_for_entity(rog.pc(), cmp.Body)
        i=-1
        for arm in body.parts[cmp.BPC_Arms].arms:
            i+=1
            if (arm and arm.hand.held.item):
                options.update({"{}".format(item) : item})
        opt = rog.menu("Offer what item?",0,0,menu)
        if opt==-1: return ("money",0,)
        item = options[opt]
        if item==0: return ("money",0,)
        if item==-100:
            # temporary
            # TODO: get from inventory
            return ("money",0,)
        itemn = world.component_for_entity(item, cmp.Name)
        entn = world.component_for_entity(ent, cmp.Name)
        ans = rog.prompt(
            "Offer {ti}{i} to {tn}{n}?".format(
            i=itemn.name,n=entn.name,
            it=TITLES[itemn.title],
            tn=TITLES[entn.title]
            ),
            0,0, mode='wait'
            )
        if ans=='y':
            return ("item",item,)
    return ("money",0,) # if we made it this far
Exemplo n.º 8
0
def _select_gender():
    Chargen.ww=rog.window_w()
    rog.dbox(Chargen.x1,Chargen.y1+Chargen.iy,Chargen.ww,3,text="what is your gender?",
        wrap=True,border=None,con=rog.con_final(),disp='mono')
    rog.refresh()
    
    _gender=''
    while (_gender == ''):
        _menuList={'m':'male','f':'female','n':'nonbinary','*':'random',}
        
        _gender=rog.menu("gender select",Chargen.xx,Chargen.yy,_menuList,autoItemize=False)
        if _gender == -1:
            _gender = 'random'
        if _gender == 'nonbinary':
            _genderName = "nonbinary" # temporary...
            _genderID = GENDER_OTHER
        else: #random, male and female
            if _gender == 'random':
                _gender = random.choice(("male","female",))
            if _gender == 'male':
                _genderName = "male"
                _genderID = GENDER_MALE
            elif _gender == 'female':
                _genderName = "female"
                _genderID = GENDER_FEMALE
    # end while
    
    # save selected data
    Chargen._pronouns = rog._get_pronouns(_genderID)
    Chargen._gender = _genderID
    Chargen._genderName = _genderName
    Chargen.female=(Chargen._genderName=="female")
    # print char data so far
    libtcod.console_clear(rog.con_final())
    _printElement("name: {}".format(Chargen._name), Chargen.iy-1)
    Chargen.iy=_printElement("gender: {}".format(Chargen._genderName), Chargen.iy)
    print("gender chosen: ", Chargen._genderName)
Exemplo n.º 9
0
def towel_pc(pc, item):
    options={}
    options.update({"W" : "wrap around"})
    options.update({"l" : "lie"})
    options.update({"s" : "sail"})
    options.update({"w" : "wield"})
    options.update({"h" : "wear on head"})
    options.update({"x" : "wave"})
    options.update({"d" : "dry"})
    choice=rog.menu("use towel",0,0,options,autoItemize=False)
    if choice == "wear on head":
        pass
    elif choice == "wrap around":
        dirTo=rog.get_direction()
        if not args: return
        dx,dy,dz=args
        xto = pc.x + dx; yto = pc.y + dy;

        if (dx==0 and dy==0 and dz==0):
            pass #wrap around self
        
    elif choice == "wield":
        if rog.on(item, WET):
            pass #equip it
        else:
            rog.alert("You can't wield a towel that isn't wet!")
            
    elif choice == "dry":
        #itSeemsCleanEnough=...
        if ( itSeemsCleanEnough and not rog.on(item, WET) ):
            pass #dry self
        else:
            if not itSeemsCleanEnough:
                rog.alert("It doesn't seem clean enough.")
            elif rog.on(item, WET):
                rog.alert("It's too wet.")
Exemplo n.º 10
0
def dialogue(ent:int, style=0):
    ''' wrapper dialogue function
        Greet, introduce self if first time meeting,
        Then choose a dialogue type and execute the dialogue.
    '''
    world=rog.world()
    if not world.has_component(ent,cmp.Speaks):
        return False
    dispcompo=world.component_for_entity(ent,cmp.Disposition)
    personality=world.component_for_entity(ent,cmp.Personality).personality
    entn = world.component_for_entity(ent,cmp.Name)

    # greetings / rejections
    reaction = greet(ent, style=style)
    dispcompo.disposition += reaction
    if reaction < 0: # refuse to chat
        rejection(ent, personality, dispcompo.disposition, style=style)
        return False
    
        # introductions
    if not world.has_component(ent,cmp.Introduced):
        response,success = talk_introduce(
            ent,personality,dispcompo.disposition,style=style)
    else:
        # greet (haven't seen you in a bit)
        # TODO: once they've greeted you, add Greeted component
        #   then they no longer say anything when you press the
        #   chat key on them. Greeted component could be a status
        #   that wears off in an hour or so.
        response,success = talk_greeting(
            ent,personality,dispcompo.disposition,style=style)
    say(ent, response)
    
    # dialogue menu
    menu={"*" : "goodbye"}
    _menu={}
    for k,v in PERSUASION.items():
        if k==TALK_GREETING: continue
        menu[v[0]] = v[1]
        _menu[v[1]] = k
    opt = rog.menu(
        "{}{}".format(TITLES[entn.title],entn.name),
        rog.view_port_x(),rog.view_port_y(),
        menu,
        autoItemize=False
        )
    if opt==-1:
        return False
    if opt=="goodbye":
        return False
    result = _menu[opt]
    
    # perceived value for use by _talk function
    value = 0
    if result==TALK_ASKFAVOR:
        # TODO: implement favor dialogue menu
        value,npc_offer = _ask_favor(ent)
    elif result==TALK_BARTER:
        # TODO: implement trading dialogue menu
        value,pc_offer,npc_offer = _get_trade(ent)
    elif result==TALK_BRIBERY:
        type_gift,val = _get_gift_for(ent)
        if type_gift=="money": # val is a quantity of $
            value = val//MULT_VALUE
        elif type_gift=="item": # val is an item
            value = rog.get_value(val)
    
    # execute the dialogue
    response,success = _FUNCS[result](
        ent, personality, dispcompo.disposition,
        value=value, style=style
        )
    say(ent,response,result,success)
    return True
Exemplo n.º 11
0
def chargen(sx, sy):
    world = rog.world()
    # init
    x1 = 0
    y1 = 0
    xx = 0
    yy = 4
    iy = 0
    ww = rog.window_w()
    hh = 5

    # _printElement - local function
    # draw the string to con_game at (x1,y1) then move y vars down
    def _printElement(elemStr):
        #global yy,y1,x1
        rog.dbox(x1,
                 y1 + iy,
                 ROOMW,
                 3,
                 text=elemStr,
                 wrap=False,
                 border=None,
                 con=rog.con_game(),
                 disp='mono')
        rog.blit_to_final(rog.con_game(), 0, 0)
        rog.refresh()

    # get char data from player

    # name
    _name = rog.prompt(x1,
                       y1,
                       ww,
                       hh,
                       maxw=20,
                       q="What is your name?",
                       mode="text")
    _title = ""
    print("Name chosen: ", _name)
    _printElement("Name: {}".format(_name))
    iy += 1

    # load saved game
    loadedGame = False
    savedir = os.listdir(os.path.join(os.path.curdir, "save"))
    for filedir in savedir:
        if ".save" != filedir[-5:]:
            continue  #wrong filetype
        try:
            with open(filedir, "r") as save:
                line = save.readline()
                if ("name:{}\n".format(_name) == line):
                    #found a match. Begin reading data
                    pc = loadFromSaveFile(save)
                    return pc
        except FileNotFoundError:
            pass
        except:
            print("ERROR: Corrupted save file detected.")
            print("Continuing chargen...")
            break

    if not loadedGame:
        #continue chargen...

        # gender
        rog.dbox(x1,
                 y1 + iy,
                 ROOMW,
                 3,
                 text="What is your gender?",
                 wrap=True,
                 border=None,
                 con=rog.con_final(),
                 disp='mono')
        rog.refresh()
        #get added genders
        _genderList = {}
        genderFileDir = os.path.join(os.path.curdir, "settings", "genders.txt")
        try:
            with open(genderFileDir, "r") as file:
                for line in file:
                    if "//" in line: continue
                    data = line.split(':')
                    if len(data) < 2: continue
                    gname = data[0]
                    data = data[1].split(',')
                    gpronouns = data
                    _genderList.update({gname: gpronouns})
        except FileNotFoundError:
            print("ALERT: file '{}' not found. Creating new file...")
            with open(genderFileDir, "w+") as file:
                file.write("\n")

        #gender selection
        _gender = ''
        while (_gender == ''):
            _menuList = {
                'm': 'male',
                'f': 'female',
                'n': 'nonbinary',
                '*': 'random',
            }
            #read genders from genders.txt

            _gender = rog.menu("Gender Select",
                               xx,
                               yy,
                               _menuList,
                               autoItemize=False)
            if _gender == 'nonbinary':
                #select gender from list of added genders
                _menuNonbin = []
                for jj in _genderList.keys():
                    _menuNonbin.append(jj)
                _menuNonbin.append('add new gender')
                choice = rog.menu("Nonbinary Genders", xx, yy, _menuNonbin)
                #add gender
                if choice == 'add new gender':
                    _genderName, _pronouns = _add_gender()
                else:
                    _genderName = choice
                    _pronouns = _genderList[_genderName]
                if _genderName == '':  #failed to select or add new gender
                    _gender = ''  #prompt user again for gender
            else:  #random, male and female
                if _gender == 'random':
                    _gender = random.choice((
                        "male",
                        "female",
                    ))
                if _gender == 'male':
                    _genderName = "male"
                    _pronouns = (
                        'he',
                        'him',
                        'his',
                    )
                elif _gender == 'female':
                    _genderName = "female"
                    _pronouns = (
                        'she',
                        'her',
                        'hers',
                    )
        print("Gender chosen: ", _genderName)
        _printElement("Gender: {}".format(_genderName))
        iy += 1

        # class
        rog.dbox(x1,
                 y1 + iy,
                 ROOMW,
                 3,
                 text="What is your profession?",
                 wrap=True,
                 border=None,
                 con=rog.con_final(),
                 disp='mono')
        rog.refresh()
        _classList = {
        }  #stores {className : (classChar, classID,)} #all classes
        #create menu options
        _menuList = {}  #stores {classChar : className} #all playable classes
        _randList = []  #for random selection.
        for k, v in jobs.getJobs().items():  # k=ID v=charType
            if v not in rog.playableJobs():
                continue  #can't play as this class yet
            ID = k  # get ID of the class
            typ = v  # get chartype of the class
            name = jobs.getName(ID)
            _classList.update({name: (
                typ,
                ID,
            )})
            _menuList.update({typ: name})
            _randList.append(ID)
        _menuList.update({'*': 'random'})
        #user selects a class
        _className = rog.menu("Class Select",
                              xx,
                              yy,
                              _menuList,
                              autoItemize=False)
        #random
        if _className == 'random':
            _classID = random.choice(_randList)
            _className = jobs.getName(_classID)
        #get the relevant data
        _type = _classList[_className][0]  # get the class Char value
        _mask = _type
        _classID = _classList[_className][1]

        #grant stats / abilities of your chosen class

        print("Class chosen: ", _className)
        _printElement("Class: {}".format(_className))
        iy += 1

        # skill
        rog.dbox(x1,
                 y1 + iy,
                 ROOMW,
                 3,
                 text="In which skill are you learned?",
                 wrap=True,
                 border=None,
                 con=rog.con_final(),
                 disp='mono')
        #rog.refresh()
        #get list of all skills
        _skillName = rog.menu("Skill Select", xx, yy, SKILLS.values())
        #get the skill ID
        for skid, name in SKILLS.items():
            if name == _skillName:
                _skillID = name
                break
        print("Skill chosen: ", _skillName)
        #should show ALL skills you're skilled in, not just the one you pick
        #for skill in jobs.getSkills(_skillID):
        _printElement("Skills: {}".format(_skillName))
        iy += 1

        #stats?
        _stats = {}
        #gift?
        _gift = 0

        #create pc object from the data given in chargen

##        pc = world.create_entity( # USE create_monster function!!!!
##            cmp.Position(sx,sy),
##            cmp.Name(_name, title=_title,pronouns=_pronouns),
##            cmp.Draw('@', COL['white']),
##            cmp.Form(
##            )

##        pc = rog.create_monster('@',0,0,COL['white'],mutate=0)
##        pc.name = _name
##        pc.title = _title
##        pc.mask = '@'
##        pc.job = _className
##        pc.gender = _genderName
##        pc.pronouns = _pronouns
##        pc.faction = FACT_ROGUE
##        #add additional skill
##        rog.train(pc,_skillID)
##        #add specific class stats

    return pc
Exemplo n.º 12
0
def pickup_pc(pc):
    world = rog.world()
    pos = world.component_for_entity(pc, cmp.Position)
    pcx = pos.x
    pcy = pos.y
    rog.alert("Pick up what?{d}".format(d=dirStr))
    args=rog.get_direction()
    if not args:
        rog.alert()
        return
    dx,dy,dz=args
    xx,yy = pcx + dx, pcy + dy
    
    things=rog.thingsat(xx,yy)
    if pc in things: #can't pick yourself up.
        things.remove(pc)

    choice=None
    if len(things) > 1:
        rog.alert("There are multiple things here. Pick up which item?")
        choices = [] #["all",] #should player be able to pickup multiple things at once? Maybe could be a delayed action?
        for thing in things:
            choices.append(thing)
        choice=rog.menu(
            "pick up", rog.view_port_x()+2, rog.view_port_y()+2, choices
            )
    else:
        if things:
            choice=things[0]

    if (choice and not choice == "all"):

        if choice == K_ESCAPE:
            return
        
        #thing is creature! You can't pick up creatures :( or can you...?
        if world.has_component(choice, cmp.Creature):
            rog.alert("You can't pick that up!")
            return
        #thing is on fire, prompt user & burn persistent rogues
        if rog.on(choice,FIRE):
            answer=""
            while True:
                answer=rog.prompt(0,0,rog.window_w(),1,maxw=1,
                    q="That thing is on fire! Are you sure? y/n",
                    mode='wait',border=None)
                answer=answer.lower()
                if answer == "y" or answer == " " or answer == K_ENTER:
                    rog.alert("You burn your hands!")
                    rog.burn(pc, FIRE_BURN)
                    rog.hurt(pc, FIRE_HURT)
                    break
                elif answer == "n" or answer == K_ESCAPE:
                    return
        # put in inventory
        pocketThing(pc, choice)
##    elif choice == "all":
##        for tt in things:
##            pocketThing(pc, tt)
    else:
        rog.alert("There is nothing there to pick up.")
Exemplo n.º 13
0
def _select_class():
    _classList={} #stores {className : (classChar, classID,)} #all classes
    #create menu options
    _menuList={} #stores {classChar : className} #all playable classes
    _randList=[] #for random selection.
    for k,v in entities.getJobs().items(): # k=ID v=charType
##        if v not in rog.playableJobs(): continue #can't play as this class yet
        ID=k        # get ID of the class
        typ=v       # get chartype of the class
        name=entities.getJobName(ID)
        _classList.update({name:(typ,ID,)})
        _menuList.update({typ:name})
        _randList.append(ID)
    _menuList.update({'*':'random'})

    classSelected = False
    while not classSelected:
        _printChargenData(showclass=False)
        rog.dbox(
            Chargen.x1,Chargen.y1+Chargen.iy,Chargen.ww,3,
            text="what is your profession?",
            wrap=True,border=None,con=rog.con_final(),disp='mono'
            )
        rog.refresh()
        #user selects a class
        _className = rog.menu(
            "class select",Chargen.xx,Chargen.yy+Chargen.iy,_menuList,
            autoItemize=False
            )
        #random
        if (_className == 'random' or _className == -1):
            _classID = random.choice(_randList)
            _className = entities.JOBS[_classID][1]
        #get the relevant data
        _type = _classList[_className][0] # get the class Char value
        _mask = _type
        _classID = _classList[_className][1]
        _mass = entities.getJobMass(_classID)
        _jobstats = entities.getJobStats(_classID).items()
        _jobskills = entities.getJobSkills(_classID)
        _jobmoney = entities.getJobMoney(_classID)
        _jobitems = entities.getJobItems(_classID)
        _jobkeys = entities.getJobClearance(_classID)
        
        # for display by confirmation prompt
        _classDescription = entities.getJobDescription(_classID)
        # create class stats info
        _classStats=""
        if _jobstats:
            for k,v in _jobstats:
                _classStats += "{}: {}, ".format(STATS[k],v)
            _classStats=_classStats[:-2]
        # create class items info
        _classItems = ""
        if _jobitems:
            for tupl in _jobitems:
                name,table,quantity,slot,mat,script = tupl
                matname = "{} ".format(rog.getMatName(mat)) if mat else ""
                _classItems += "{}{}, x{}; ".format(matname, name, quantity)
            _classItems=_classItems[:-2]
        
        # info about class && confirmation
        while True:
            ph=4
            text = '''Class: {name}.
{desc}
Mass: {kg} KG.
Starts with (${money}, {items}).
[ {stats} ]'''.format(
                name=_className,
                kg=_mass,
                money=_jobmoney,
                items=_classItems,
                desc=_classDescription,
                stats=_classStats
                )
            rog.dbox(
                0,0,rog.msgs_w(),12,text,
                wrap=True,border=1,con=rog.con_final()
                )
            ans=rog.prompt(
                0,rog.window_h()-ph,rog.window_w(),ph,
                q='''Choose this class? y/n''',
                mode="wait",default='n',wrap=False
                )
            if ans=='y':
                classSelected=True
                break
            elif ans=='n':
                libtcod.console_clear(rog.con_final())
                rog.refresh()
                break
            else:
                continue
        # end while
    # end while
    
    # confirmed class selection
    Chargen._type = _type
    Chargen._classID = _classID
    Chargen._className = _className
    Chargen._jobstats = _jobstats
    Chargen._jobskills = _jobskills
    Chargen._jobmoney = _jobmoney
    Chargen._jobitems = _jobitems
    Chargen._jobkeys = _jobkeys
    Chargen._jobmass = _mass
    
    #add specific class skills
    for sk_id,sk_lv in Chargen._jobskills.items():
        rog.setskill(Chargen.pc, sk_id, sk_lv)
    
    # print char data so far
    _printChargenData()
    rog.refresh()
    print("class chosen: ", _className)