mirror of
https://port.numenaute.org/aleajactaest/clientbot.git
synced 2024-11-21 14:46:16 +00:00
add option to downlaod all patch file, and quit client after 20 loop
This commit is contained in:
parent
37b2a6b85c
commit
7fce47e67c
1 changed files with 11 additions and 5 deletions
16
client.py
16
client.py
|
@ -1385,14 +1385,14 @@ class ClientNetworkConnection:
|
|||
msg = BitStream()
|
||||
self.buildSystemHeader(msg)
|
||||
msg.pushUint8(8) # SYSTEM_LOGIN_CODE
|
||||
msg.pushSint32(_QuitId) # _QuitId
|
||||
msg.pushSint32(self._QuitId) # _QuitId
|
||||
self._sock.sendto(msg.bytes(), self.frontend)
|
||||
self._ConnectionState = TConnectionState.Quit
|
||||
|
||||
def EmulateFirst(self):
|
||||
self.sendSystemLogin()
|
||||
|
||||
while True:
|
||||
for _ in range(1, 20): # while True:
|
||||
data, addr = self._sock.recvfrom(1024) # buffer size is 1024 bytes
|
||||
print( "received message:", data)
|
||||
self.sendSystemQuit()
|
||||
|
@ -1406,12 +1406,15 @@ class ClientKhanat:
|
|||
clientApp="Lirria",
|
||||
LanguageCode="fr",
|
||||
url="/login/r2_login.php",
|
||||
suffix = None):
|
||||
suffix = None,
|
||||
download_patch = False):
|
||||
self.log = logging.getLogger('myLogger')
|
||||
|
||||
if suffix is None:
|
||||
suffix = str(random.randrange(1, 9999))
|
||||
self.log.debug("suffix : %s" % suffix)
|
||||
|
||||
self.download_patch = download_patch
|
||||
self.khanaturl = khanaturl
|
||||
self.login = login + suffix
|
||||
self.password = password
|
||||
|
@ -1594,6 +1597,7 @@ class ClientKhanat:
|
|||
return dstName
|
||||
|
||||
def downloadAllPatch(self):
|
||||
# TODO - check where client search file to download
|
||||
for file in self.khanat_idx.CBNPFile:
|
||||
tmp = self.getServerFile("%05d/%s.lzma" % (int(self.r2serverversion), file.FileName), False, "")
|
||||
with lzma.open(tmp) as fin:
|
||||
|
@ -1615,7 +1619,8 @@ class ClientKhanat:
|
|||
self.khanat_idx.show()
|
||||
# Todo analyze patch and download if necessary or update if incremental - see category
|
||||
# Download all file in patch - login_patch.cpp:2578 # void CPatchThread::processFile (CPatchManager::SFileToPatch &rFTP)
|
||||
#self.downloadAllPatch()
|
||||
if self.download_patch:
|
||||
self.downloadAllPatch()
|
||||
self.clientNetworkConnection.EmulateFirst()
|
||||
|
||||
|
||||
|
@ -1628,6 +1633,7 @@ def main():
|
|||
parser.add_argument("--khanaturl", help="khanat URL to auhtenticate", default='localhost')
|
||||
parser.add_argument("--suffix", help="define suffix")
|
||||
parser.add_argument("-d", "--debug", help="show debug message", action='store_true')
|
||||
parser.add_argument("-p", "--download-patch", help="show debug message", action='store_true')
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.debug:
|
||||
|
@ -1636,7 +1642,7 @@ def main():
|
|||
level = logging.getLevelName('INFO')
|
||||
log.setLevel(level)
|
||||
|
||||
client = ClientKhanat(args.khanaturl, suffix=args.suffix)
|
||||
client = ClientKhanat(args.khanaturl, suffix=args.suffix, download_patch=args.download_patch)
|
||||
client.Emulate()
|
||||
log.info("End")
|
||||
|
||||
|
|
Loading…
Reference in a new issue