-
Notifications
You must be signed in to change notification settings - Fork 33
/
daemon.py
190 lines (176 loc) · 7.98 KB
/
daemon.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
class BB():
def __init__(self):
self.script = ["from core.Automata import Automata"]
self.battle = 1
def init_sc(self): # checkpoint, support, shifts
def sw(file, old, new):
file_data = ""
with open(file, "r") as f:
for line in f:
if old in line:
line = line.replace(old, new)
file_data += line
with open(file, "w") as f:
f.write(file_data)
print("------------------------------------------------------------")
print("Select Game Version")
print("If you select JPclient, you must use device with 1920x1080")
print("1 = JPclient")
print("2 = CNclient")
ver = input("Select a number: ")
if ver == "1":
cli = "jp/"
sw("core/crds.py", "cn", "jp")
if ver == "2":
cli = "cn/"
sw("core/crds.py", "jp", "cn")
print("------------------------------------------------------------")
print("Select the Checkpoint or Customize it")
print("1 = Ember 2 = Training 3 = Qp 4 = Customization")
selckp = input("Select a number: ")
if selckp == "1" or selckp == "2" or selckp == "3":
print("------------------------------------------------------------")
print("Select the Level")
print("1 = Novice 2 = Intermediate 3 = Advanced 4 = Expert")
sellv = input("Select a number: ")
if selckp == "1":
ckp = "Ember" + sellv
if selckp == "2":
ckp = "Training" + sellv
if selckp == "3":
ckp = "Qp" + sellv
if selckp == "4":
print("------------------------------------------------------------")
print(
"Enter the name of the Checkpoint image (PNG in /assets) (WITHOUT extension name)")
cli = ""
ckp = input("Checkpoint: ")
print("------------------------------------------------------------")
print(
"Enter the name of the Support image (PNG in /assets) (WITHOUT extension name)")
spt = input("Suppport: ")
print("------------------------------------------------------------")
print("Enter shifts of X coordinate (Enter 0 if your res is 1920x1080)")
sft_x = input("X shift: ")
print("Enter shifts of Y coordinate (Enter 0 if your res is 1920x1080)")
sft_y = input("Y shift: ")
# class name: bb
sc = f"bb = Automata(\"assets/{cli}{ckp}.png\", \"assets/{spt}.png\", ({sft_x}, {sft_y}))"
self.script.append(sc)
print("------------------------------------------------------------")
print("Auto Recovery AP")
print(
"1 = No 2 = Gold Apple 3 = Silver Apple 4 = Santa Quartz 5 = Bronze Apple")
ap = input("Select a number: ")
if ap == "2" or ap == "3" or ap == "4" or ap == "5":
print("------------------------------------------------------------")
apamt = input("Enter the amount: ")
if ap == "2":
self.script.append(f"bb.set_apples({apamt}, \"gold\")")
elif ap == "3":
self.script.append(f"bb.set_apples({apamt}, \"silver\")")
elif ap == "4":
self.script.append(f"bb.set_apples({apamt}, \"quartz\")")
elif ap == "5":
self.script.append(f"bb.set_apples({apamt}, \"bronze\")")
self.script.append("bb.quick_start()")
def menu(self) -> bool:
# menu
print("------------------------------------------------------------")
print("BATTLE", self.battle)
print("------------------------------------------------------------")
print("1 = select Servant skill(optional)")
print("2 = select Master skill(optional)")
print("3 = select Card order and finish current battle setting")
print("------------------------------------------------------------")
# select
n = input("Select a number: ")
if n == "1":
self.sv_skill()
return False
elif n == "2":
self.ms_skill()
return False
elif n == "3":
self.crd_order()
return True
return False
def sv_skill(self):
print("------------------------------------------------------------")
print("Servant skill types:")
print("1 = skill w/o target servant")
print("2 = skill w/ target servant")
print("------------------------------------------------------------")
n = input("Select the type of the Servant skill: ")
if n == "1":
x = input("Enter skill id (1~9 count from left): ")
self.script.append(f"bb.select_servant_skill({x})")
if n == "2":
x = input("Enter skill id (1~9 count from left): ")
y = input("Enter target id (1~3 count from left): ")
self.script.append(f"bb.select_servant_skill({x}, {y})")
def ms_skill(self):
print("------------------------------------------------------------")
print("Master skill types:")
print("1 = skill w/o target servant")
print("2 = skill w/ target servant")
print("3 = Order Change")
print("------------------------------------------------------------")
n = input("Select the type of the Master skill: ")
if n == "1":
x = input("Enter skill id (1~3 count from left): ")
self.script.append(f"bb.select_master_skill({x})")
if n == "2":
x = input("Enter skill id (1~3 count from left): ")
y = input("Enter target id (1~3 count from left): ")
self.script.append(f"bb.select_master_skill({x}, {y})")
if n == "3":
x = input("ID of Servant on the Left (1~3 count from left): ")
y = input("ID of Servant on the Right (1~3 count from left): ")
self.script.append(f"bb.select_master_skill(3, {x}, {y})")
def crd_order(self):
print("------------------------------------------------------------")
print("Card Order:")
print("Card id: 1~5 -> normal card, 6,7,8 -> NP card")
print("if you only want to select 1 card, enter ONE number")
print("for multiple cards, separate each digits like: 1,2,3")
print("------------------------------------------------------------")
n = input("Enter Card order: ")
self.script.append(f"bb.select_cards([{n}])")
def start(self) -> str:
print("***********************")
print("* FGO-Automata Daemon *")
print("***********************")
print("------------------------------------------------------------")
print("This script will help you create your FGO-Automat Script")
print("------------------------------------------------------------")
input("Press any key to continue: ")
print("------------------------------------------------------------")
name = input("Enter script name (WITHOUT extension name): ")
print("------------------------------------------------------------")
return name
def setup_battle(self):
btl = [False, False, False]
# init
self.init_sc()
# battles
for i in range(3):
self.script.append("# BATTLE " + str(self.battle))
while not btl[i]:
btl[i] = self.menu()
self.battle += 1
# end'
self.script.append("# FINISH")
self.script.append("bb.finish_battle()")
def main(self):
name = self.start()
self.setup_battle()
print("------------------------------------------------------------")
print("Setup finished!")
print(f"Run {name}.py to start the script")
file = open(name + ".py", "w+")
content = '\n'.join(self.script)
file.write(content)
if __name__ == "__main__":
demon = BB()
demon.main()