Advertisement
hg0428

Untitled

Oct 24th, 2019
285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.14 KB | None | 0 0
  1. import os
  2. import sys
  3. from item import *
  4. from logs import *
  5. from termcolor import colored, cprint
  6. from PIL import Image
  7. from plays import play
  8. #shows the thing up top
  9. def game():
  10.     cprint("""
  11. =====================
  12.        Game
  13. =====================
  14.    """, "green")
  15. #clears the screen  
  16. def clear():
  17.     print("\x1b[2J\x1b[H",end="")
  18. def start():
  19.     global items
  20.     clear()
  21.     game()
  22.     cprint("""
  23.    1) Login
  24.    2) Signup
  25.    """, "red")
  26.     #gets user's choice
  27.     choice = input("> ")
  28.     if choice == "1":
  29.         clear()
  30.         User=input("User Name: ")
  31.         Password=input("Password: ")
  32.         a, b=login(User, Password)
  33.         if a == "User name or Password is incorrect!":
  34.             print("User name or Password is incorrect!")
  35.         else:
  36.             #Go to menue. From menue have option to play game.
  37.             menue(User, a, b, Pass=Password)
  38.     if choice == "2":
  39.         User=input("User Name: ")
  40.         Password=input("Password: ")
  41.         signup(User, Password, items)
  42. def menue(User, items, progress, Pass, gb=False):
  43.     while True:
  44.         clear()
  45.         cprint("""
  46. =====================
  47.        Menue
  48. =====================
  49.        """, "green")
  50.         cprint("1) Resume\n2) View items in inventory\n3) Save\n4) Exit")
  51.         try:
  52.             choice = input("> ")
  53.         except KeyboardInterrupt:
  54.             clear()
  55.             a=input("Are you sure you want to exit? (Y or N): ")
  56.             if a[0].lower() == "y":
  57.                 clear()
  58.                 sys.exit()
  59.         if choice == "1":
  60.             if gb == True:
  61.                 break
  62.             else:
  63.                 play(User, items, progress, Pass)
  64.         if choice == "2":
  65.             clear()
  66.             print("""
  67. Name | Quantity | Value |
  68.            """)
  69.             for i in items:
  70.                 for a in i:
  71.                     print(a)
  72.                 print()
  73.             cprint("Press enter to return to menue. ", "green", end="")
  74.             input()
  75.         if choice == "3":
  76.             save(User, Pass, items, progress)
  77.         if choice == "4":
  78.             clear()
  79.             sys.exit()
  80. start()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement