-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuncs.py
69 lines (52 loc) · 1.49 KB
/
funcs.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
import random, time
import DivItems, styles
from rich.console import Console
console = Console()
result_string = ''
primary_color = []
secondary_color = []
def color_picker(item):
color = ''
if item == 'DHIH':
color = 'magenta'
if item == 'RA':
color = 'red'
if item == 'PA':
color = 'white'
if item == 'TSA':
color = 'green'
if item == 'NA':
color = 'yellow'
if item == 'AH':
color = 'cyan'
return color
def roll():
bija = {
'1': 'DHIH',
'2': 'RA',
'3': 'PA',
'4': 'TSA',
'5': 'NA',
'6': 'AH'
}
lot = (random.randint(1, 6), random.randint(1, 6))
result = [bija[str(item)] for item in lot]
primary_color.append(color_picker(result[0]))
secondary_color.append(color_picker(result[1]))
# Calculate and print the padding for centering
total_line_length = sum(len(f'{item} ') for item in result) - 1
padding = (console.width - total_line_length) // 2
console.print(' ' * padding, end='')
for item in result:
console.print(f'[bold {color_picker(item)}]{item}[/]', end=' ')
time.sleep(1)
result_string = "_".join(result)
item_function = getattr(DivItems, result_string)
time.sleep(1)
item_function.submenu()
def check():
check = input("Enter the syllables of the divination: ")
if '_' not in check:
check = check.replace(" ", "_")
item_check = getattr(DivItems, check)
item_check.submenu()