-
Notifications
You must be signed in to change notification settings - Fork 0
/
animationDepartment.py
121 lines (117 loc) · 6.88 KB
/
animationDepartment.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
from storyAdventure import *; import time; #import keyboard; import random
import sys
from colorama import init; from colorama import Fore, Back, Style
from keyboardListener import *
if inits == True: init()
if sys.stdin and sys.stdin.isatty():
# running interactively
hi = ""
# listener.start()
# else:
# with open('output','w') as f:
# f.write("running in the background!\n")
def storyList(type, talk, animationEyeBrow, animationEyes, animationChin, animation1, animation2, wait):
key_listener = MyKeyListener()
listener = keyboard.Listener(
on_press=key_listener.on_press,
on_release=key_listener.on_release)
listener.start()
storyletter = []; lineAnimation = animationEyes; nextAnimation = animationEyes; line = 0; count = 0; s = animationEyeBrow; t = animationEyeBrow; isOnCount = True; ani = animation1
for i in type:
if i == "$" or i == "#":
if talk and i == "$":
if count < 1:
storyletter.append(f"&\r \rt{nextAnimation} t")
else:
storyletter.append(f"&\r \r{nextAnimation} ")
elif talk and i == "#":
storyletter.append(f"\r{t} ")
line+= 1
elif talk and count % 5 == 0:
isOnCount = not isOnCount
if isOnCount and not wait == True: ani = animation1
else: ani = animation2
if line >= 0:
if line == 1:
lineAnimation = animationEyeBrow; nextAnimation = animationEyes
storyletter.append(f"*\r\n\n{ani} \r\033[A\r\033[A{lineAnimation} ")
if line == 2:
lineAnimation = animationEyes; nextAnimation = ani
storyletter.append(f"*\r\n{ani} \r\033[A{lineAnimation} ")
if line == 3:
lineAnimation = ani; nextAnimation = animationChin
storyletter.append(f"*\r{ani} ")
if line == 4:
lineAnimation = animationChin; nextAnimation = " "
storyletter.append(f"*\r\033[A{ani} \r\n{lineAnimation} ")
if line == 5:
lineAnimation = " "; nextAnimation = """"""
storyletter.append(f"*\r\033[A\033[A{ani} \r\n\n{lineAnimation} ")
storyletter.append(i)#Make math
else: storyletter.append(i)
count += 1
lastWritten = []
#time.sleep(0.3)
# keyboard.release("Enter")
keyboard.Controller().release(keyboard.Key.enter)
for i in storyletter:
if talk and not wait == True:
times = 0.0
if key_listener.is_s_pressed(): times = 0.005;key_listener.keys_pressed.discard(all);
elif key_listener.is_x_pressed(): times = 0.0;talk=False; key_listener.keys_pressed.discard(all)
else: times = 0.02
if talk: time.sleep(times)
if '*' in i and '$' not in i:
print(f"{i[1:]}", end = "", flush= True)
for lastLet in lastWritten:
if '*' not in lastLet and '&' not in lastLet: print(lastLet, end = "", flush= True)
else:
if '&' in i or '$' in i:
lastWritten = []
if talk: print(i[1:], end = "", flush= True)
else: print(i, end = "", flush= True)
lastWritten.append(i)
print('\n\r', flush= True)
keyboard.Controller().press(keyboard.Key.enter)
listener.stop()
del key_listener
# listener.stop()
# keyboard.press("Enter")
Jeffery_AnimationHair = """ \33[93m/////////\033[0m"""
Jeffery_AnimationBrow = """ \033[0m|-\033[30m\33[1m~~\033[0m-\033[30m\33[1m~~\033[0m-|"""
Jeffery_AnimationEye = """ \033[0m|-\33[36m[]\033[39m-\33[36m[]\033[39m-|"""
Jeffery_AnimationCloseMouth = """ \033[0m|--\033[31m( )\033[0m--|"""
Jeffery_AnimationMouthMove = """ \033[0m|--\033[31m< >\033[0m--|"""
Jeffery_AnimationChin = """ \033[0m\\_______/"""
questsJ = storyQuests["Jeffery"]
questsJ = questsJ[0]
def animation(part, bools: bool, waitTime, stringorNot):
parts = animations[part]
if stringorNot != False: print(parts[0], end = f"{stringorNot}\n")
else: print(parts[0], end = f" {part}'s Quest: ('x' to skip, 's' to fast forward)\n", flush= True)
print(parts[3], flush= True)
print(parts[4], flush= True)
print(parts[7], flush= True)
print(parts[5], end = '\r', flush= True)
print("\033[A\r\033[A\r\033[A\r\033[A", flush= True)
runAnimation(parts, bools, waitTime)
def runAnimation(type, TorF: bool, wait):
# if stringYorN == True: type1 = type; print("Geshmach"); time.sleep(2)
# else: type1 = type[1]
return storyList(type[1], TorF, type[3], type[4], type[5], type[6], type[7], wait)
try:
animations = {
"Beginning" : [Jeffery_AnimationHair, story["Beginning"], True, Jeffery_AnimationBrow, Jeffery_AnimationEye, Jeffery_AnimationChin, Jeffery_AnimationMouthMove, Jeffery_AnimationCloseMouth],
"A New Leaf": [Jeffery_AnimationHair, story["A New Leaf"], True, Jeffery_AnimationBrow, Jeffery_AnimationEye, Jeffery_AnimationChin, Jeffery_AnimationMouthMove, Jeffery_AnimationCloseMouth],
"The Might of the Novice" : [Jeffery_AnimationHair, story["The Might of the Novice"], True, Jeffery_AnimationBrow, Jeffery_AnimationEye, Jeffery_AnimationChin, Jeffery_AnimationMouthMove, Jeffery_AnimationCloseMouth],
"Jeffery" : [Jeffery_AnimationHair, storyQuests["Jeffery"], True, Jeffery_AnimationBrow, Jeffery_AnimationEye, Jeffery_AnimationChin, Jeffery_AnimationMouthMove, Jeffery_AnimationCloseMouth],
"Spokesman" : [Jeffery_AnimationHair, "#jkfshfjkafhsjkhfk hfkhskhfkjhs\n$ggdds\n$dgfgd\n$nk", True, Jeffery_AnimationBrow, Jeffery_AnimationEye, Jeffery_AnimationChin, Jeffery_AnimationMouthMove, Jeffery_AnimationCloseMouth]#
}
except:
animations = {
"Beginning" : [Jeffery_AnimationHair, story["Beginning"], True, Jeffery_AnimationBrow, Jeffery_AnimationEye, Jeffery_AnimationChin, Jeffery_AnimationMouthMove, Jeffery_AnimationCloseMouth],
"A New Leaf": [Jeffery_AnimationHair, story["A New Leaf"], True, Jeffery_AnimationBrow, Jeffery_AnimationEye, Jeffery_AnimationChin, Jeffery_AnimationMouthMove, Jeffery_AnimationCloseMouth],
"The Might of the Novice" : [Jeffery_AnimationHair, story["The Might of the Novice"], True, Jeffery_AnimationBrow, Jeffery_AnimationEye, Jeffery_AnimationChin, Jeffery_AnimationMouthMove, Jeffery_AnimationCloseMouth],
"Jeffery" : [Jeffery_AnimationHair, storyQuests["Jeffery"], True, Jeffery_AnimationBrow, Jeffery_AnimationEye, Jeffery_AnimationChin, Jeffery_AnimationMouthMove, Jeffery_AnimationCloseMouth],
}
#TO DO!!! ADD chat feautures