def game(): room_name = session.get('room_name') if request.method == "GET": if room_name: room = planisphere.load_room(room_name) return render_template("show_room.html", room=room) else: #why is there here? do you need it? return render_template("you_died.html") else: action = request.form.get('action') print(f"action={action}") if room_name and action: room = planisphere.load_room(room_name) next_room = room.go(action) print(f"next_room={next_room}") if not next_room: try: print(f"room.retryAttemptsLimit={room.retryAttemptsLimit}") print(f"room.retryAttempts={room.retryAttempts}") if int(room.retryAttemptsLimit) < room.retryAttempts: if room.deathOnFailure: return render_template("you_died.html") else: room.retryAttempts = int(room.retryAttempts) + 1 except: pass session['room_name'] = planisphere.name_room(room) else: session['room_name'] = planisphere.name_room(next_room) return redirect(url_for("game"))
def game(): room_name = session.get('room_name') if request.method == "GET": if room_name: room = planisphere.load_room(room_name) return render_template("show_room.html", room=room) else: return render_template("you_died.html") else: action = request.form.get('action') if room_name and action: room = planisphere.load_room(room_name) next_room = room.go(action) if not next_room: session['room_name'] = planisphere.name_room(room) else: session['room_name'] = planisphere.name_room(next_room) return redirect(url_for("game"))