Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Big #27

Open
wants to merge 32 commits into
base: main
Choose a base branch
from
Open

Big #27

Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
8e5e10c
Initial Commit, created player and world class and tables
tashigyatso45 Nov 6, 2023
8b8d943
Touched some db stuff
Case652 Nov 7, 2023
2dc8fcd
played with menu a bit
Case652 Nov 7, 2023
8437168
Merge pull request #1 from tashigyatso45/sql_stuff
tashigyatso45 Nov 7, 2023
615ce50
find by id method
tashigyatso45 Nov 7, 2023
c7d7463
Merge pull request #2 from tashigyatso45/sql_stuff
Nov 7, 2023
5b89373
added Players find_by_id
theProNicole Nov 7, 2023
e7fc1f9
Merge pull request #3 from tashigyatso45/Nicole
Case652 Nov 7, 2023
550f42c
Menu Stuff
Case652 Nov 7, 2023
430c1fb
Merge pull request #4 from tashigyatso45/Cli_menu
tashigyatso45 Nov 7, 2023
1abe6c4
some changes
tashigyatso45 Nov 8, 2023
f5e89ce
Menu Tweaks
Case652 Nov 8, 2023
c5c0a04
Some minor Visuals
Case652 Nov 8, 2023
1269fbf
Worked with tashi on join's
Case652 Nov 8, 2023
2b7733e
Merge pull request #5 from tashigyatso45/MenuStuff
tashigyatso45 Nov 8, 2023
a60c65a
Progress
Case652 Nov 8, 2023
8da1cd1
started adding errors
Case652 Nov 8, 2023
7858fae
Some touchups
Case652 Nov 8, 2023
1c65e2d
worked for login
tashigyatso45 Nov 8, 2023
487f4ea
just some smalls tuff
Case652 Nov 8, 2023
1230213
Merge pull request #6 from tashigyatso45/login
tashigyatso45 Nov 8, 2023
e531c64
Merge pull request #7 from tashigyatso45/version-1
Case652 Nov 8, 2023
ccbd269
allows player to know which world he/she went
tashigyatso45 Nov 9, 2023
12cceb6
One change
tashigyatso45 Nov 9, 2023
ff7cbf1
Merge pull request #8 from tashigyatso45/version-1
Case652 Nov 9, 2023
778c249
whops
Case652 Nov 9, 2023
d1cbab9
menue 2 => option 5-6 debuggers included, 1 test ascii art
tashigyatso45 Nov 9, 2023
d02bc0c
Merge pull request #9 from tashigyatso45/version-1
Case652 Nov 9, 2023
7985a93
clear_pushing stuff
Case652 Nov 9, 2023
a09655c
Login Sas
Case652 Nov 9, 2023
0859f3a
Login Stuff
Case652 Nov 9, 2023
bc0140d
seed stuff
Case652 Nov 9, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 29 additions & 3 deletions lib/cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# lib/cli.py
from models.world import World
from models.player import Player
from helpers import (
exit_program,
)
Expand All @@ -10,16 +11,41 @@ def main():
menu()
choice = input(">")
if choice == "0":
exit_program()
print("What Is Your World Called Traveler?")
World.create(input("->"))
elif choice == "1":
print(World.all())
elif choice == "2":
print("Select World Id to Delete")
id = input("->")
world = World.find_by_id(id)
world.shatter()
elif choice == "3":
print("What Is Your Name Traveler?")
Player.create(input("->"))
elif choice == "4":
print(Player.all())
elif choice == "5":
print("Select Player Id to Delete")
id = input("->")
player = Player.find_by_id(id)
player.deletes()
elif choice == "6":
exit_program()
else:
print("Invalid choice")


def menu():
print("Please select an option:")
print("0. Exit the program")
print("1. Select World")
print("0. Create World")
print("1. Display World's")
print("2. Delete World")
print("3. Create Player")
print("4. Display Player's")
print("5. Remove Player")
print("6. Exit the program")
if __name__ == "__main__":
main()

# someint=World("Input")
6 changes: 5 additions & 1 deletion lib/models/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,11 @@ def find_by_id(cls,id):
'''
row = CURSOR.execute(sql,(id,)).fetchone()
return cls.from_db(row) if row else None

@classmethod
def create(cls,name):
player = cls(name)
player.save()
return player



Expand Down
7 changes: 6 additions & 1 deletion lib/models/world.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,9 @@ def find_by_id(cls, id):
SELECT * FROM worlds WHERE id = ?
'''
row = CURSOR.execute(sql, (id,)).fetchone()
return cls.from_db(row) if row else None
return cls.from_db(row) if row else None
@classmethod
def create(cls,location):
world = cls(location)
world.save()
return world