generated from Labpro-21/kit-if1210-2024
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
130 lines (126 loc) · 4.29 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# TUBES DASPRO ----------------------------------------------------------------------------------
import os
import sys
import time
import math
import argparse
import datetime
from src.isInteger import *
from src.save import *
from src.load import *
from src.rng import *
from src.register import *
from src.login import *
from src.logout import *
from src.help import *
from src.monster import *
from src.potion import *
from src.inventories import *
from src.battle import *
from src.arena import *
from src.shopcurrency import *
from src.monster_management import *
from src.shopmanagement import *
from src.laboratory import *
from src.save import *
from src.load import *
userpas, mons, iInv, mInv, iShop, mShop, valid_load = start()
print()
login = False
while True:
pilihan = input(">>> ")
if pilihan.upper() == "REGISTER":
if login:
print("Register gagal!")
print(
f"Anda telah login dengan username {currentUser[1]}, silahkan lakukan “LOGOUT” sebelum melakukan register.")
print()
else:
REGISTER(userpas, mInv, is_integer)
print()
if pilihan.upper() == "LOGIN":
if login:
print("Login gagal!")
print(
f"Anda telah login dengan username {currentUser[1]}, silahkan lakukan “LOGOUT” sebelum melakukan login kembali.")
print()
else:
login, currentUser = LOGIN(userpas)
if pilihan.upper() == "LOGOUT":
login, currentUser = LOGOUT(currentUser, login)
if pilihan.upper() == "HELP":
HELP(currentUser)
if pilihan.upper() == "INVENTORY":
if login:
INVENTORY(currentUser, mInv, iInv, mons, is_integer)
else:
print("Anda belum login. Silahkan login terlebih dahulu..")
print()
if pilihan.upper() == "BATTLE":
if login:
if currentUser[3] == "agent":
userpas, mInv, iInv = BATTLE(
mons, mInv, iInv, rngEnemy, currentUser, rngLevel, userpas)
else:
print("Anda tidak bisa battle.")
print()
else:
print("Anda belum login. Silahkan login terlebih dahulu..")
print()
if pilihan.upper() == "ARENA":
if login:
if currentUser[3] == "agent":
ARENA(mons, mInv, rngEnemy, currentUser, iInv)
print()
else:
print("Anda tidak bisa memasuki Arena.")
print()
else:
print("Anda belum login. Silahkan login terlebih dahulu..")
print()
if pilihan.upper() == "SHOP":
if login:
if currentUser[3] == "admin":
SHOP_MANAGEMENT(currentUser, mShop, iShop, mons, potion)
print()
if currentUser[3] == "agent":
SHOP(currentUser, mShop, iShop, mons, mInv, iInv)
print()
else:
print("Anda belum login. Silahkan login terlebih dahulu..")
print()
if pilihan.upper() == "MONSTER":
if login:
if currentUser[3] == "admin":
MONSTER(currentUser, userpas, mons, mInv)
print()
else:
print("Anda bukanlah admin..")
print()
else:
print("Anda belum login. Silahkan login terlebih dahulu..")
print()
if pilihan.upper() == "LABORATORY":
if login:
LABORATORY(userpas, mInv, mons, currentUser, is_integer)
print()
else:
print("Anda belum login. Silahkan login terlebih dahulu..")
print()
if pilihan.upper() == "SAVE":
save_data(userpas, mons, mShop, mInv, iShop, iInv)
if pilihan.upper() == "LOAD":
load()
if pilihan.upper() == "EXIT":
while True:
response = input("Apakah Anda mau melakukan penyimpanan file yang sudah diubah? (y/n) ").lower()
if response == 'y':
save_data(userpas, mons, mShop, mInv, iShop, iInv)
print("Data telah disimpan. Selamat tinggal!")
break
elif response == 'n':
print("Selamat tinggal!")
break
else:
print("Input tidak valid. Silahkan coba lagi.")
break