Skip to content
This repository was archived by the owner on Nov 21, 2024. It is now read-only.

Commit 6bc49d4

Browse files
authored
update main.py
fix jpg auto close
1 parent 7a6a94a commit 6bc49d4

File tree

1 file changed

+48
-48
lines changed

1 file changed

+48
-48
lines changed

main.py

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
user_name = getpass.getuser()
1111

1212
file_path_output = "C:\\Users\\" + user_name + "\\AppData\\LocalLow\\Mediatonic\\FallGuys_client\\output.txt"
13-
my_file = "C:\\Users\\" + user_name + "\\AppData\\LocalLow\\Mediatonic\\FallGuys_client\\myfile.json"
13+
FGC_json = "C:\\Users\\" + user_name + "\\AppData\\LocalLow\\Mediatonic\\FallGuys_client\\Img2FGC.json"
1414

1515
# reading output.txt by mod
1616
try:
1717
with open(file_path_output, "r", encoding="utf-8") as f1:
1818
lines = f1.readlines()
1919
except FileNotFoundError:
20-
print(Fore.LIGHTRED_EX + "File doesnt found" + Style.RESET_ALL + ", try again\n")
20+
print(Fore.LIGHTRED_EX + "Unable to find file " + Style.RESET_ALL + ", try again\n")
2121
os.system("pause")
2222
exit()
2323

@@ -38,11 +38,11 @@
3838
elif key == 'isDigital':
3939
isDigital = value.lower() # I know there are better ways to do this, but I'm lazy
4040
except FileNotFoundError:
41-
print(Fore.LIGHTRED_EX + "File doesnt found" + Style.RESET_ALL + ", try again\n")
41+
print(Fore.LIGHTRED_EX + "Unable to find file" + Style.RESET_ALL + ", try again\n")
4242
os.system("pause")
4343
exit()
4444
except Exception as e:
45-
print(f"File " + Fore.LIGHTRED_EX + "corrupted" + Style.RESET_ALL + ", try again, if error doesnt continue tell " + Fore.LIGHTYELLOW_EX + "repinek, " + Style.RESET_ALL + "{e}, {e.__traceback__.tb_lineno}\n")
45+
print(f"Looks like file " + Fore.LIGHTRED_EX + " is corrupted" + Style.RESET_ALL + ", try again, if you can't fix this error by yourself tell " + Fore.LIGHTYELLOW_EX + "repinek about this, " + Style.RESET_ALL + "{e}, {e.__traceback__.tb_lineno}\n")
4646
os.system("pause")
4747
exit()
4848

@@ -51,15 +51,15 @@
5151
elif shouldDeleteWhitePixels == "true":
5252
white_yes_or_no = "yes"
5353
else:
54-
print("something went wrong, write" + Fore.LIGHTYELLOW_EX + " repinek" + Style.RESET_ALL + ", 49\n")
54+
print("Something went wrong, report about this to " + Fore.LIGHTYELLOW_EX + " repinek" + Style.RESET_ALL + ", 49\n")
5555
os.system("pause")
5656
exit()
5757
if shouldDeleteBlackPixels == "false":
5858
black_yes_or_no = "no"
5959
elif shouldDeleteBlackPixels == "true":
6060
black_yes_or_no = "yes"
6161
else:
62-
print("something went wrong, write" + Fore.LIGHTYELLOW_EX + " repinek" + Style.RESET_ALL + ", 57\n")
62+
print("Something went wrong, report about this to " + Fore.LIGHTYELLOW_EX + " repinek" + Style.RESET_ALL + ", 57\n")
6363
os.system("pause")
6464
exit()
6565

@@ -68,13 +68,13 @@
6868
elif isDigital == "true":
6969
theme = "digital"
7070
else:
71-
print("something went wrong, write" + Fore.LIGHTYELLOW_EX + " repinek" + Style.RESET_ALL + ", 66\n")
71+
print("Something went wrong, report about this to " + Fore.LIGHTYELLOW_EX + " repinek" + Style.RESET_ALL + ", 66\n")
7272
os.system("pause")
7373
exit()
7474

7575
print(Fore.LIGHTCYAN_EX + "NOTE: Although I don’t believe that you can get " + Fore.LIGHTRED_EX + "banned " + Fore.LIGHTCYAN_EX + "for this, but " + Fore.LIGHTGREEN_EX + "be careful!"+ Fore.LIGHTRED_EX + " Don't use this script if you want to import NSFW or if you are stupid\n\n" +
7676
Style.RESET_ALL + "You cannot save maps larger than " + Fore.LIGHTRED_EX + "2MB" + Fore.LIGHTGREEN_EX + " (around 700 pixels)\n" +
77-
Fore.LIGHTGREEN_EX + "1000 pixels" + Style.RESET_ALL + " are generated in approximately" + Fore.LIGHTGREEN_EX + " 1 second\n\n" +
77+
Fore.LIGHTGREEN_EX + "1000 pixels" + Style.RESET_ALL + " are generated in ~" + Fore.LIGHTGREEN_EX + " one second\n\n" +
7878
Style.RESET_ALL + "Script created by " + Fore.LIGHTYELLOW_EX + "repinek" + Style.RESET_ALL + " (" + Fore.LIGHTYELLOW_EX + "@repinek " + Style.RESET_ALL + "in " + Fore.LIGHTCYAN_EX + "tg/ds" + Style.RESET_ALL + ", " + Fore.LIGHTYELLOW_EX + "@repinek840" + Style.RESET_ALL + " in X), and thanks " + Fore.LIGHTGREEN_EX + "FloyzI " + Style.RESET_ALL + "for help\n") # добавить про кал с долгой герекой
7979
try:
8080
print(Fore.LIGHTGREEN_EX + "config:\n" + Style.RESET_ALL +
@@ -105,49 +105,49 @@
105105
try:
106106
width_input_int = int(width_input)
107107
except TypeError:
108-
print("width must be a number\n")
108+
print("Width should be as number\n")
109109
os.system("pause")
110110
exit()
111111
except Exception as e:
112-
print(f"send this to repinek. {e.__traceback__.tb_lineno}, {e}\n")
112+
print(f"Report about this to repinek. {e.__traceback__.tb_lineno}, {e}\n")
113113
os.system("pause")
114114
exit()
115115
try:
116116
height_input_int = int(height_input)
117117
except TypeError:
118-
print("height must be a number\n")
118+
print("Height should be as number\n")
119119
os.system("pause")
120120
exit()
121121
except Exception as e:
122-
print(f"send this to repinek. {e.__traceback__.tb_lineno}, {e}\n")
122+
print(f"Report about this to repinek. {e.__traceback__.tb_lineno}, {e}\n")
123123
os.system("pause")
124124
exit()
125125

126126
if width_input_int > width:
127-
print("width cant be more than original pic\n")
127+
print("Width can't be more than image width\n")
128128
os.system("pause")
129129
exit()
130130
elif height_input_int > height:
131-
print("height cant be more than original pic\n")
131+
print("Height can't be more than image height\n")
132132
os.system("pause")
133133
exit()
134134
try:
135135
image = image.resize((width_input_int, height_input_int))
136136
except Exception as e:
137-
print(f"send this to repinek. {e.__traceback__.tb_lineno}, {e}\n")
137+
print(f"Report about this to repinek. {e.__traceback__.tb_lineno}, {e}\n")
138138
os.system("pause")
139139
exit()
140140

141141
# white_yes_or_no = input("delete all white pixels? ('yes' or 'no'): ")
142142
# black_yes_or_no = input("delete all black pixels? ('yes' or 'no'): ")
143143
# ↑ old code
144144

145-
print("after" + Fore.LIGHTGREEN_EX + " 5 seconds " + Style.RESET_ALL + "script will start making the map and DEBUG prints will be shown, don't worry (BETA TEST)\n"
146-
"if suddenly you get an error, write repinek in dm, thank")
145+
print("After" + Fore.LIGHTGREEN_EX + " 5 seconds " + Style.RESET_ALL + "map should start generating, you will see some debug info (BETA)\n"
146+
"If you get some errors report about them to repinek, thanks")
147147
time.sleep(5)
148148

149149
a = "no alpha"
150-
width, height = image.size # again
150+
width, height = image.size # again (sigma)
151151
rgb_colors = []
152152
# default colors
153153
real_colors = {
@@ -198,14 +198,14 @@
198198
# colors check
199199
try:
200200
with open(full_path_tolko_u_menya, 'r', encoding='utf-8') as file_kek:
201-
data = json.load(file_kek)
201+
data = json.load(file_kek) # im a furry btw
202202
except FileNotFoundError:
203-
print(Fore.LIGHTRED_EX + f"colors.json file was not found" + Style.RESET_ALL + f", a new file will be created along the path {full_path_tolko_u_menya} with " + Fore.LIGHTGREEN_EX + f"recommended colors" + Style.RESET_ALL)
203+
print(Fore.LIGHTRED_EX + f"Unable to find colors.json " + Style.RESET_ALL + f", a new colors.json will be generated by this path {full_path_tolko_u_menya} with " + Fore.LIGHTGREEN_EX + f"recommended colors" + Style.RESET_ALL)
204204
with open(full_path_tolko_u_menya, 'w') as f2:
205205
json.dump(real_colors, f2)
206206
data = real_colors
207207
except Exception as e:
208-
print(f"send this to repinek. {e.__traceback__.tb_lineno}, {e}")
208+
print(f"Report about this to repinek. {e.__traceback__.tb_lineno}, {e}")
209209
os.system("pause")
210210
exit()
211211

@@ -313,39 +313,39 @@
313313
kek["SkyboxId"] = 'Retro_Skybox'
314314

315315
# its shitcode, but i dont care (im so lazy to found other solution)
316-
with open(my_file, 'w') as f:
316+
with open(FGC_json, 'w') as f:
317317
f.write(json.dumps(kek))
318-
with open(my_file, 'rb+') as fh:
318+
with open(FGC_json, 'rb+') as fh:
319319
fh.seek(-3, 2)
320320
fh.truncate()
321-
with open(my_file, 'a') as f:
321+
with open(FGC_json, 'a') as f:
322322
f.write("[")
323323

324324
# for global
325-
my_variable = "kek"
326-
my_variable2 = "obed"
325+
variant_guid = "kek"
326+
guids_sss = "obed"
327327

328328
#func for add pixels to json (experimental)
329329
def addpixeltojson():
330330
global id_number
331331
global data
332-
global my_file
333-
global my_variable
334-
global my_variable2
332+
global FGC_json
333+
global variant_guid
334+
global guids_sss
335335
id_number = id_number - 1
336336
data["ID"] = id_number
337337
data["Position"][0] = x * 4.075
338338
data["Position"][2] = y * 4.075
339339
data["ColourSwapIndex"] = closest_value
340340
random_key = uuid.uuid4()
341341
formatted_key = str(random_key).replace('-', '')
342-
my_variable = f"{formatted_key[:8]}-{formatted_key[8:12]}-{formatted_key[12:16]}-{formatted_key[16:20]}-{formatted_key[20:]}"
342+
variant_guid = f"{formatted_key[:8]}-{formatted_key[8:12]}-{formatted_key[12:16]}-{formatted_key[16:20]}-{formatted_key[20:]}"
343343
random_key2 = uuid.uuid4()
344344
formatted_key2 = str(random_key2).replace('-', '')
345-
my_variable2 = f"{formatted_key2[:8]}-{formatted_key2[8:12]}-{formatted_key2[12:16]}-{formatted_key2[16:20]}-{formatted_key2[20:]}"
346-
data["GUIDs"] = my_variable2
347-
data["VariantGuid"] = my_variable
348-
with open(my_file, "a") as f:
345+
guids_sss = f"{formatted_key2[:8]}-{formatted_key2[8:12]}-{formatted_key2[12:16]}-{formatted_key2[16:20]}-{formatted_key2[20:]}"
346+
data["GUIDs"] = guids_sss
347+
data["VariantGuid"] = variant_guid
348+
with open(FGC_json, "a") as f:
349349
f.write(json.dumps(data, ensure_ascii=False))
350350
f.write(",")
351351
# every pixel
@@ -356,7 +356,7 @@ def addpixeltojson():
356356
try:
357357
a = pixel[3]
358358
except IndexError:
359-
a = 0
359+
a = 1 # im stupid why 0 LOL
360360
#parsed random closest color from internet xd
361361
def closest_colour(requested_colour):
362362
min_colours = {}
@@ -395,13 +395,13 @@ def get_colour_name(requested_colour):
395395
# addpixeltojson()
396396
#dont needed anymore
397397
else:
398-
print("Alpha is 0, dont print pixel")
398+
print("Alpha is 0, unable to set pixel")
399399
continue
400400
except Exception as e:
401-
print(f"send this to repinek. {e.__traceback__.tb_lineno}, {e}")
401+
print(f"Report about this to repinek. {e.__traceback__.tb_lineno}, {e}")
402402
posx = x * 4.075
403403
posy = y * 4.075
404-
print(f"rgb: {pixel}, alpha: {a}, name color: {closest_name}, color index: {closest_value}, ID object: {id_number}, POS X: {posx}, POS Y: {posy}, VatirantGuid: {my_variable}, GUIDs: {my_variable2}")
404+
print(f"RGB: {pixel}, alpha: {a}, color name: {closest_name}, color index: {closest_value}, object ID: {id_number}, POS X: {posx}, POS Y: {posy}, VatirantGuid: {variant_guid}, GUIDs: {guids_sss}")
405405
# my old bad code below, fixed by a = 0, 359 line
406406
'''
407407
except TypeError:
@@ -412,25 +412,25 @@ def get_colour_name(requested_colour):
412412
data["ColourSwapIndex"] = closest_value
413413
random_key = uuid.uuid4()
414414
formatted_key = str(random_key).replace('-', '')
415-
my_variable = f"{formatted_key[:8]}-{formatted_key[8:12]}-{formatted_key[12:16]}-{formatted_key[16:20]}-{formatted_key[20:]}"
415+
variant_guid = f"{formatted_key[:8]}-{formatted_key[8:12]}-{formatted_key[12:16]}-{formatted_key[16:20]}-{formatted_key[20:]}"
416416
random_key2 = uuid.uuid4()
417417
formatted_key2 = str(random_key2).replace('-', '')
418-
my_variable2 = f"{formatted_key2[:8]}-{formatted_key2[8:12]}-{formatted_key2[12:16]}-{formatted_key2[16:20]}-{formatted_key2[20:]}"
419-
data["GUIDs"] = my_variable2
420-
data["VariantGuid"] = my_variable
418+
guids_sss = f"{formatted_key2[:8]}-{formatted_key2[8:12]}-{formatted_key2[12:16]}-{formatted_key2[16:20]}-{formatted_key2[20:]}"
419+
data["GUIDs"] = guids_sss
420+
data["VariantGuid"] = variant_guid
421421
422-
with open(my_file, "a") as f:
422+
with open(FGC_json, "a") as f:
423423
f.write(json.dumps(data, ensure_ascii=False))
424424
f.write(",")
425425
'''
426426

427427
# its shitcode x2, but i dont care (im so lazy to found other solution)
428-
with open(my_file, 'rb+') as fh:
428+
with open(FGC_json, 'rb+') as fh:
429429
fh.seek(-1, 2)
430430
fh.truncate()
431-
with open(my_file, 'a') as f:
431+
with open(FGC_json, 'a') as f:
432432
f.write("],")
433-
with open(my_file, 'a') as f:
433+
with open(FGC_json, 'a') as f:
434434
f.write('"FirstBuildSessionId": "38f4bbc0-3978-4194-b3e7-463f1a25e2ee",')
435435
f.write(' "LevelCreationTimestamp": 1703262048686,')
436436
f.write(' "LevelSavedAtTimestamp": 1703262185389,')
@@ -440,6 +440,6 @@ def get_colour_name(requested_colour):
440440
f.write(' "LevelDescriptionIsCustom": false,')
441441
f.write(' "Min Capacity": 1}')
442442

443-
print("generation is completed, press \"Replace existing maps with level\" in FallGuysTools to load your level\n") #yea, use FGTools guys
443+
print("Generation completed! Press \"Replace existing maps with level\" in FallGuysTools to load your level\n") #yea, use FGTools guys
444444
os.remove(file_path_output)
445-
os.system("pause")
445+
time.sleep(3)

0 commit comments

Comments
 (0)