-
Notifications
You must be signed in to change notification settings - Fork 0
/
launcher.py
69 lines (52 loc) · 2.43 KB
/
launcher.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
import subprocess
import os
import shutil
class Launcher():
def __init__(self):
self.defaultServer = "localhost"
self.defualtPort = 53640
self.appDataPath = os.getenv('LOCALAPPDATA')
self.version = self.getVersions()[0]
self.username = ""
self.header = f"{self.appDataPath}\\Hexine\\Versions\\{self.version}\\HexineLauncher.exe"
self.content = f"{self.appDataPath}\\Hexine\\Versions\\{self.version}\\content\\"
self.tempPlace = f"{self.appDataPath}\\Hexine\\Versions\\{self.version}\\content\\temp.rbxl"
def getVersions(self):
vers = []
for ver in os.listdir(f"{self.appDataPath}\\Hexine\\Versions"):
if ver.startswith("version"):
vers.append(ver)
return vers
def setVersion(self, ver):
self.version = ver
self.header = f"{self.appDataPath}\\Hexine\\Versions\\{self.version}\\HexineLauncher.exe"
self.content = f"{self.appDataPath}\\Hexine\\Versions\\{self.version}\\content\\"
self.tempPlace = f"{self.appDataPath}\\Hexine\\Versions\\{self.version}\\content\\temp.rbxl"
def setPort(self, port):
self.defualtPort = port
def setPlace(self, placePath):
newPath = shutil.copy(placePath, self.tempPlace)
def setUsername(self, username):
self.username = username
def play(self, ip, port):
if self.version == None:
return
url = f'"http://hexine.tk/game/join.ashx?UserName={self.username}&server={ip}&serverPort={port}"'
auth = '"http://hexine.tk/Login/Negotiate.ashx"'
unknown = "0"
print(subprocess.list2cmdline([self.header, "-play", url, auth, unknown]))
subprocess.call([self.header, "-play", url, auth, unknown], shell=True)
def host(self, rblx, placeName, port, public):
if self.version == None:
return
placeType = 0
if public == True:
placeType = 1
else:
placeType = 0
placeName = placeName.replace(" ", "_")
url = f'"http://hexine.tk/game/gameserver.ashx?placeId=0&serverPort={port}&publicPlace={placeType}&UserName={self.username}&placeName={placeName}&PS=0"'
auth = '"http://hexine.tk/Login/Negotiate.ashx"'
unknown = "0"
print(subprocess.list2cmdline([self.header, "-play", url, auth, unknown]))
subprocess.call([self.header, "-play", url, auth, unknown], shell=True)