-
Notifications
You must be signed in to change notification settings - Fork 2
/
mainold.py
447 lines (363 loc) · 14.9 KB
/
mainold.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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
import subprocess
import customtkinter
from nicegui import ui
import os
from threading import Timer
from os import path
import pyngrok
import json
import requests
import shutil
import schedule
import errno
from subprocess import Popen
from PIL import Image
from tkinter import messagebox
# Themes
customtkinter.set_appearance_mode("dark") # Modes: "System" (standard), "Dark", "Light"
customtkinter.set_default_color_theme("krimson.json") # Themes: "blue" (standard), "green", "dark-blue"
ui.query('body').style('background-color: #630000')
ui.colors(primary='#bf3a3a')
# check if portablemc module is installed, if not install it
try:
import portablemc
except ModuleNotFoundError as e:
def dlmodule():
def checkmodule():
try:
import portablemc
print("works!")
messagebox.showinfo("Module Installed", "The 'portablemc' Module has successfully been installed!!!\nzdkrimson will now launch.\nIf Minecraft doesn't launch try 'pip freeze' in your terminal and look for 'portablemc' in the list of installed Python modules, if it isn't then try 'pip install portablemc' in your terminal.\nzdkrimson will now close so you may reopen it if you'd like.")
nomod.destroy()
except ModuleNotFoundError as e:
print("Retrying in 3 seconds...")
Timer(3, checkmodule).start()
subprocess.Popen("pip install portablemc")
nmtitle.configure(text="\n\nInstalling...")
nmmsg.configure(text="\n\n'portablemc' Module is being installed...\nPlease Wait")
nmbtn.pack_forget()
checkmodule()
print("Missing Module! 'portablemc' Module is missing!")
nomod = customtkinter.CTk()
nomod.geometry("700x600")
nomod.title("zdkrimson : Minecraft Launcher - Required Module not Installed!")
nomod.iconbitmap("zdicon.ico")
mainframen = customtkinter.CTkFrame(master=nomod, fg_color="#3D0A11")
mainframen.pack(pady=0, padx=0, fill="both", expand=True)
nmtitle = customtkinter.CTkLabel(master=mainframen, text="\n\nOh No!")
nmtitle.pack(pady=0, padx=0)
nmframe = customtkinter.CTkFrame(master=mainframen, fg_color="#630000")
nmframe.pack(pady=20, padx=40, fill="both", expand=True)
nmmsg = customtkinter.CTkLabel(master=nmframe, text="\n\nThe 'portablemc' Module has not been found\non your system!")
nmmsg.pack(pady=0, padx=0)
nmbtn = customtkinter.CTkButton(master=nmframe, text="Install Module (Requires Python Installed!)", command=dlmodule)
nmbtn.pack(padx=20, pady=10)
nomod.mainloop()
print(r"""
_ _ _
| || | (_)
____ __| || | __ _ __ _ _ __ ___ ___ ___ _ __
|_ / / _` || |/ /| '__|| || '_ ` _ \ / __| / _ \ | '_ \
/ / | (_| || < | | | || | | | | |\__ \| (_) || | | |
/___| \__,_||_|\_\|_| |_||_| |_| |_||___/ \___/ |_| |_|
Written by ItsIceCreeperPE Dev & Artsign
""")
appdata=path.expandvars(r'%APPDATA%')
print("{}\\.minecraft".format(appdata))
authtype=0
CDDIR=os.getcwd()
global lastcrack
global firstime
global __version__
lastcrack=""
firstime=0
__version__="alpha5"
instances=[]
print(CDDIR)
global zdusername
global zdemail
global zduuid
zdusername=""
zdemail=""
zduuid=""
# File/Folder Checking
if os.path.exists(".zdkrimson")==False:
print(".zdkrimson folder doesn't exist, created one just now.")
os.mkdir(".zdkrimson")
if os.path.exists(".zdkrimson\\crackedusers")==False:
print("crackedusers folder doesn't exist, created one just now.")
os.mkdir("{}\\.zdkrimson\\crackedusers".format(CDDIR))
if os.path.exists(".zdkrimson\\settings.json")==False:
print("settings file(settings.json) doesn't exist, created one just now.")
config = {
"lastcrack": "",
"firsttime": 1,
"lastinstance": ""
}
configjson = json.dumps(config, indent=2)
with open(".zdkrimson\\settings.json", "w") as outfile:
outfile.write(configjson)
lastcrack=""
firstime=1
lastinstance=""
if os.path.exists(".zdkrimson\\instances")==False:
print("instances folder doesn't exist, created one just now.")
os.mkdir(".zdkrimson\\instances")
# loading json files
with open('.zdkrimson\\settings.json', 'r') as openfile:
configjson = json.load(openfile)
try:
print(configjson['lastcrack'])
print(configjson['firsttime'])
print(configjson['lastinstance'])
lastcrack=configjson['lastcrack']
firsttime=configjson['firsttime']
lastinstance=configjson['lastinstance']
print("imported settings json")
print(lastcrack)
except KeyError:
print("Settings file isn't up-to-date")
config = {
"lastcrack": "",
"firsttime": 1,
"lastinstance": ""
}
configjson = json.dumps(config, indent=2)
with open(".zdkrimson\\settings.json", "w") as outfile:
outfile.write(configjson)
lastcrack=""
firstime=1
lastinstance=""
splash = customtkinter.CTk()
splash.title("zdkrimson : Minecraft Launcher - Starting")
splash.geometry("350x262")
splash.overrideredirect(True)
splash.eval('tk::PlaceWindow . center')
splashScreen = customtkinter.CTkImage(dark_image=Image.open("assets/splashScreen.png"), size=(350, 262))
splashimg = customtkinter.CTkLabel(master=splash, text="", image=splashScreen, justify=customtkinter.LEFT)
splashimg.pack(side=customtkinter.LEFT, pady=0, padx=0)
@ui.page('/home')
def main_win():
splash.destroy()
# image loading
crim1 = "assets/bg/blur/crim1.png"
whitelogoshaded = "assets/logo/image/shaded/white.png"
whitetextshaded = "assets/logo/full/white.png"
amlshaded = "assets/logo/sub/shaded/white.png"
def move_app(e):
app.geometry(f'+{e.x_root}+{e.y_root}')
def quit():
app.quit()
def download():
minecraft_directory = str(path.get())
print(str(path.get()))
minecraft_launcher_lib.install.install_minecraft_version(version.get(), minecraft_directory)
def play():
print("text")
@ui.page('/login')
def loginscrn():
def selectedauth(value):
if value=="Microsoft":
usermaills.configure(placeholder_text="E-Mail")
authtype="Microsoft"
print(authtype)
uuidls.pack_forget()
else:
usermaills.configure(placeholder_text="Username")
uuidls.pack_forget()
if value=="Cracked/Offline Mode":
authtype="Cracked/Offline Mode"
print(authtype)
logls.pack_forget()
uuidls.pack(pady=10, padx=10)
logls.pack(padx=20, pady=0)
def login():
zdusername=userls
zdemail=maills
zduuid=uuidls
zdoption=authtypeop
print(zdusername)
print(zdemail)
print(zduuid)
print(zdoption)
# print(authtype)
# print(authtypeop)
if zdoption=="Microsoft":
with ui.dialog() as dialog, ui.card():
ui.markdown('**Notice!**')
ui.label("The Application will stop responding until the authentication as been completed.\nThe Authentication page should open in your default browser.\nClick 'OK' to continue the authentication process.\nClick 'Escape' on your keyboard to cancel.")
ui.button('OK', on_click=dialog.close)
dialog.open()
loginprocms=subprocess.call("{}\\portablemc login -m {}".format(CDDIR, zdemail))
print(loginprocms)
if loginprocms==14:
ui.notify("Your Microsoft account doesn't have a legitmate copy of Minecraft.", closeBtn="OK")
else:
ui.notify("You own Minecraft, you are logged in!", closeBtn="OK")
user = {
"name": "{}".format(zdemail),
"uuid": "microsoft"
}
jsonfilezd = json.dumps(user, indent=2)
with open(".zdkrimson\\crackedusers\\{}.json".format(zdemail), "w") as outfile:
outfile.write(jsonfilezd)
cadb = open(".zdkrimson\\crackedusers\\crackaccount.txt", "a")
print(cadb)
cadb.write("{}\n".format(zdemail))
cadb.close()
elif zdoption=="Cracked/Offline Mode":
# loginprocco=subprocess.call("{}\\portablemc -u {} -u {}".format(CDDIR, zdemail, zduuid))
lastcrack=zdusername
user = {
"name": "{}".format(zdusername),
"uuid": "{}".format(zduuid)
}
jsonfilezd = json.dumps(user, indent=2)
with open(".zdkrimson\\crackedusers\\{}.json".format(zdusername), "w") as outfile:
outfile.write(jsonfilezd)
ui.notify("You are logged in as {} as a Cracked/Offline Mode Player.".format(zdusername), closeBtn="OK")
cadb = open(".zdkrimson\\crackedusers\\crackaccount.txt", "a")
print(cadb)
cadb.write("{}\n".format(zdusername))
cadb.close()
ui.query('body').style('background-color: #630000')
ui.colors(primary='#bf3a3a')
# logscrnwin = customtkinter.CTk()
# logscrnwin.geometry("400x500")
# logscrnwin.title("zdkrimson : Minecraft Launcher - Login")
ui.markdown('\n\n**Login**\n')
# authtypeop = customtkinter.CTkOptionMenu(logframls, values=["Microsoft", "Cracked/Offline Mode"], command=selectedauth)
# authtypeop.pack(pady=10, padx=10)
# authtypeop.set("None Selected :|")
authtypeop = ui.select({1: 'Microsoft', 2: 'Cracked/Offline Mode'})
userls = ui.input(label='Username', placeholder='Enter in a Username',
validation={'Username Longer than Minecraft Supports, May cause problems!': lambda value: len(value) < 16})
maills = ui.input(label='E-Mail', placeholder='Enter your E-Mail, it must own a legitmate copy of Minecraft')
uuidls = ui.input(label='UUID (Optional)', placeholder='Player UUID')
ui.button('Login', on_click=login)
@ui.page('/settings')
def settings():
def userchange(value):
print(value)
lastcrack=(value)
print(lastcrack)
config = {
"lastcrack": "{}".format(value),
"firsttime": "{}".format(firsttime),
"lastinstance": "{}".format(firsttime)
}
configjson = json.dumps(config, indent=2)
with open(".zdkrimson\\settings.json", "w") as outfile:
outfile.write(configjson)
if os.path.exists(".zdkrimson\\crackedusers\\crackaccount.txt")==True:
cadb = open(".zdkrimson\\crackedusers\\crackaccount.txt", "r")
rcadb = cadb.readlines()
print(rcadb)
with open('.zdkrimson\\settings.json', 'r') as openfile:
configjson = json.load(openfile)
print(configjson['lastcrack'])
lastcrack=configjson['lastcrack']
# settingswin = customtkinter.CTk()
# settingswin.geometry("400x500")
# settingswin.title("zdkrimson : Minecraft Launcher - Settings")
ui.markdown('\n\nSettings\n')
ui.label('\nUsers\n')
ui.select(options=rcadb, with_input=True,
on_change=lambda e: ui.notify("You Selected '{}'".format(e))).classes('w-40')
def openinstances():
def installinstances():
def dlv():
dlver=verent.get()
print(dlver)
print(lastcrack)
launchinfo.configure(text="Minecraft Version {}".format(dlver))
if not lastcrack=="":
print("starting...")
lastcrackn=lastcrack.strip()
print("portablemc start -u {} {}".format(lastcrackn, dlver))
os.mkdir(".zdkrimson\\instances\\{}".format(dlver))
os.mkdir(".zdkrimson\\instances\\{}\\saves".format(dlver))
# if dlver=="1.6.1":
# os.mkdir(".zdkrimson\\instances\\resourcepacks")
os.mkdir(".zdkrimson\\instances\\{}\\resourcepacks")
mclogss = subprocess.Popen("portablemc start -u {} {}".format(lastcrackn, dlver), shell=True)
else:
print("oh no microsoft no work yet :(")
lastcrackn=lastcrack.strip()
print("portablemc start -u {} {}".format(lastcrackn, dlver))
os.mkdir(".zdkrimson\\instances\\{}".format(dlver))
os.mkdir(".zdkrimson\\instances\\{}\\saves".format(dlver))
os.mkdir(".zdkrimson\\instances\\{}\\resourcepacks")
mclogss = subprocess.Popen("portablemc start -u {} {}".format(lastcrackn, dlver), shell=True)
installwin = customtkinter.CTk()
installwin.geometry("300x200")
installwin.title("zdkrimson : Minecraft Launcher - Install Minecraft")
maininsl = customtkinter.CTkFrame(master=installwin, fg_color="#3D0A11")
maininsl.pack(pady=0, padx=0, fill="both", expand=True)
homeinsl = customtkinter.CTkFrame(master=maininsl, fg_color="#630000")
homeinsl.pack(pady=20, padx=20, fill="both", expand=True)
innaent = customtkinter.CTkEntry(master=homeinsl, placeholder_text="Instance Name")
innaent.pack(pady=10, padx=10)
verent = customtkinter.CTkEntry(master=homeinsl, placeholder_text="Minecraft Version")
verent.pack(pady=10, padx=10)
setbtn = customtkinter.CTkButton(master=homeinsl, text="Download & Play", command=dlv)
setbtn.pack(padx=20, pady=10)
installwin.mainloop()
def lmc():
lmcver=verins.get()
lastcrackn=lastcrack.strip()
print(lmcver)
print(lastcrack)
print(lastcrackn)
if lmcver=="Select Version":
statusins.configure(text="Pick a Minecraft Version!!!")
else:
print("starting...")
# os.rmdir("{}\\.minecraft\\resourcepacks".format(appdata))
# os.rmdir("{}\\.minecraft\\saves".format(appdata))
# shutil.copytree(".zdkrimson\\instances\\{}\\resourcepacks".format(lmcver), "{}\\.minecraft".format(appdata))
# shutil.copytree(".zdkrimson\\instances\\{}\\saves".format(lmcver), "{}\\.minecraft".format(appdata))
print("portablemc start -u {} {}".format(lastcrackn, lmcver))
mclogss = subprocess.Popen("portablemc start -u {} {}".format(lastcrackn, lmcver), shell=True)
mcversions=os.listdir("{}\\.minecraft\\versions".format(appdata))
instancewin = customtkinter.CTk()
instancewin.geometry("400x500")
instancewin.title("zdkrimson : Minecraft Launcher - Instances")
mainins = customtkinter.CTkFrame(master=instancewin, fg_color="#3D0A11")
mainins.pack(pady=0, padx=0, fill="both", expand=True)
homeins = customtkinter.CTkFrame(master=mainins, fg_color="#630000")
homeins.pack(pady=40, padx=40, fill="both", expand=True)
if os.path.exists("{}\\.minecraft".format(appdata))==False or mcversions==[]:
statusins = customtkinter.CTkLabel(master=homeins, text="No Instances Found, Work in Progress")
statusins.pack(pady=30, padx=0)
getmc = customtkinter.CTkButton(master=homeins, text="Get Minecraft", command=installinstances)
getmc.pack(padx=20, pady=10)
else:
print(mcversions)
verins = customtkinter.CTkOptionMenu(homeins, values=mcversions)
verins.pack(pady=10, padx=10)
verins.set("Select Version")
launchbtn = customtkinter.CTkButton(master=homeins, text="Launch", command=lmc)
launchbtn.pack(padx=20, pady=10)
getmc = customtkinter.CTkButton(master=mainins, text="Get Minecraft", command=installinstances)
getmc.pack(padx=20, pady=10)
instancewin.mainloop()
# REQUEST FOR MINECRAFT VERSIONS
#verget = requests.get("https://launchermeta.mojang.com/mc/game/version_manifest.json")
#print(verget)
#print(verget.content)
#- vergetstr=verget.content
# ui.avatar(whitelogoshaded)
# ui.avatar(whitetextshaded)
# ui.avatar(amlshaded)
# ui.query('body').style('background-image: url(file://{}/assets/bg/blur/crim1.png)'.format(CDDIR))
ui.image(whitelogoshaded)
ui.button('Accounts', on_click=loginscrn)
ui.link('temp account btn', '/login')
ui.button('Settings', on_click=settings)
ui.link('temp settings btn', '/settings')
ui.button('Instances', on_click=openinstances)
ui.label('Launcher Version: {}'.format(__version__))
ui.run(native=True, reload=False, title="zdkrimson : Minecraft Launcher", window_size=(700, 600), dark=True)
splash.after(3000, main_win)
splash.mainloop()