def physical_desc(name): pc = Character(name) return render_template("create/physical_desc.html", name=name, race=pf_data['races'][pc.race], int_modifier=pc.get_modifier("intelligence"), alignments=pf_data['alignments'])
def show_pc(name): if request.method == "DELETE": Character(name).delete() return redirect(url_for('list')) return render_template("show/show.html", pc=Character(name), pf_data=pf_data)
def update_physical_desc(name): pc = Character(name) pc.update({ "weight": request.form.get('weight'), "height": "%s\" %s'" % divmod(int(request.form.get('height')), 12), "gender": request.form.get('gender'), "age": request.form.get('age'), "alignment": request.form.get('alignment'), "eyes": request.form.get('eyes'), "hair": request.form.get('hair'), "languages": request.form.getlist("languages") }) return redirect(url_for('show_pc', name=name))
def update_race(name): pc = Character(name) updates = { "race": request.form.get('race'), "traits": request.form.getlist("traits") } race_data = pf_data['races'][request.form.get('race')] if "choice" in race_data['modifiers']: mod = request.form.get("modifier") updates[mod] = int(pc.attributes[mod]) + 2 else: for modifier, value in race_data['modifiers'].iteritems(): updates[modifier] = int(pc.attributes[modifier]) + int(value) pc.update(updates) return redirect(url_for('physical_desc', name=name))
def list(): return render_template('show/list.html', pcs=Character.list_all())
def update_attributes(name): Character(name).update(request.form) return redirect(url_for('race', name=name))
def create(): character = Character.create(request.form['name']) return redirect(url_for('attributes', name=character.name))