Implement an updated load_options function

This commit is contained in:
TropiiDev 2025-02-27 12:45:36 -05:00
parent 838d34cc4d
commit 3df7efd33f
5 changed files with 14 additions and 11 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

View File

@ -2,5 +2,5 @@
## VER: Alpha #8 ## VER: Alpha #8
## What's new? ## What's new?
- Added an update to the UserBase model to add weapons, pickaxes, and upgrades to the users inventory - Updated the UserModel class to remove the ability to have weapons, upgrades, & pickaxes.
- Started work on the load_options functions that will allow the user to choose specific options for the game - Started work on the load_options functions that will allow the user to choose specific options for the game

View File

@ -1,6 +1,5 @@
# Imports # Imports
from typing import Annotated from typing import Annotated
from typing import List
from fastapi import Depends from fastapi import Depends
from sqlmodel import Field, Session, SQLModel, create_engine from sqlmodel import Field, Session, SQLModel, create_engine
from pydantic import BaseModel from pydantic import BaseModel
@ -10,9 +9,6 @@ class HeroBase(SQLModel):
name: str name: str
gold: int | None = Field(default=0) gold: int | None = Field(default=0)
health: int | None = Field(default=100) health: int | None = Field(default=100)
weapons: List[str] | None = Field(default=["basic_sword"])
pickaxe: List[str] | None = Field(default=["basic_pickaxe"])
upgrades: List[str] | None = Field(default=[])
# The main hero class. It inherits the name, gold, and health # The main hero class. It inherits the name, gold, and health
class Hero(HeroBase, table=True): class Hero(HeroBase, table=True):

View File

@ -18,7 +18,7 @@ def create_account(name: str, email: str, password: str) -> Any | None:
else: else:
return False return False
def login(email, password): def login(email: str, password: str):
data = { data = {
"email": email, "email": email,
"password": password "password": password
@ -35,9 +35,12 @@ def login(email, password):
def load_options() -> int: def load_options() -> int:
print(""" print("""
Here are the available options: Here are the available options:
* To select an option just enter its number * * To select an option, just enter its number *
1. Home - View the inventory 1. Home - View the inventory, Save Progress, or View gold and health, Quit
2. Cave - Mine for gold
3. Shop - Buy weapons, pickaxes, or upgrades
4. Arena - Fight monsters for more gold.
""") """)
option = int(input("")) option = int(input(""))
return option return option

View File

@ -1,8 +1,9 @@
# Imports
from functions import * from functions import *
import requests import requests
# The user object
user = None user = None
# Does the user have an active account? # Does the user have an active account?
@ -35,4 +36,7 @@ else:
while user is not None: while user is not None:
print(f"Welcome {user['name']}!") print(f"Welcome {user['name']}!")
break options = load_options()
print(options)
break