Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # staves = char.db.staves
- # d_skill = char.db.staves.get(skill)
- # # Check for stave skills.
- # if skillset == 'staves':
- # if not staves['total_sp'] >= sp_cost:
- # char.msg('You do not have enough skill points to learn this skill.')
- # return
- # if not d_skill:
- # staves[skill] = {'rank': 0, 'rb': 0}
- # rank = staves[skill]['rank']
- # rank += 1
- # staves[skill]['rank'] = rank
- # staves['total_sp'] -= sp_cost
- # staves[skill]['rb'] = rb[rank - 1]
- # staves['total_ranks'] += 1
- # char.msg(f"You have spent {sp_cost} to learn rank {rank} of {skillset} {skill}, earning the rank bonus of {staves[skill]['rb']}.")
- # d_skill = skillset.get(skill)
- # d_skillset = char.attributes.get(skillset)
- skillset = f"char.db.{skillset}" #This really didn't work!
- total_sp = skillset['total_sp']
- if not total_sp >= sp_cost:
- char.msg('You do not have enough skill points to learn this skill.')
- return
- # Mostly it's this if not statement checking for the skill that gives me trouble.
- # I've tried getting skillset as an object and a dictionary.
- # Such as: char.attributes.get(key=skillset, return_obj=True) and char.attributes.get(skillset)
- if not skillset.get(skill):
- skillset[skill] = {'rank': 0, 'rb': 0}
- rank = skillset[skill]['rank']
- rank += 1
- skillset[skill]['rank'] = rank
- skillset['total_sp'] -= sp_cost
- skillset[skill]['rb'] = rb[rank - 1]
- skillset['total_ranks'] += 1
- char.msg(f"You have spent {sp_cost} to learn rank {rank} of {skillset} {skill}, earning the rank bonus of {skillset[skill]['rb']}.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement