mise à jour 13.11.3

Commit a0640936 authored by aleajactaest's avatar aleajactaest
Browse files

update client

parent 7fce47e6
Pipeline #662 failed with stages
......@@ -127,7 +127,6 @@ class BitStream():
def pushString(self, valeur):
size=len(valeur)
print(size)
#self.internalSerial(size, 32)
self.pushUint32(len(valeur))
for x in valeur:
......@@ -235,9 +234,14 @@ class BitStream():
# return str(self._pos) + ':' + str(self._tampon)
return str(self._pos) + ':' + '.'.join([ format(x, "02x") for x in self._tampon])
def bytes(self):
def toBytes(self):
return bytes( self._tampon )
def fromBytes(self, data):
self._read = 0
self._tampon = [int(x) for x in data]
self._pos = len(self._tampon) * 8
def Test():
a = BitStream()
a.pushBool(True)
......@@ -256,7 +260,8 @@ def Test():
a.pushSint64(-1)
a.pushChar('a')
a.pushString("Test A Faire")
print("A6:", a)
print('raw:', a)
print("-" * 80)
print(a.readBool())
print(a.readBool())
print(a.readBool())
......@@ -273,7 +278,27 @@ def Test():
print(a.readSint64())
print(a.readChar())
print(a.readString())
print(a.bytes())
print(a.toBytes())
print("-" * 80)
b = BitStream()
b.fromBytes(a.toBytes())
print(b.readBool())
print(b.readBool())
print(b.readBool())
print(b.readBool())
print(b.readUint32())
print(b.readSint32())
print(b.readUint16())
print(b.readSint16())
print(b.readUint8())
print(b.readSint8())
print(b.readFloat())
print(b.readDouble())
print(b.readUint64())
print(b.readSint64())
print(b.readChar())
print(b.readString())
print(b.toBytes())
class TConnectionState(IntEnum):
......@@ -927,7 +952,6 @@ class CPersistentDataRecord:
tmp = int.from_bytes(buffer[offset:offset+4], byteorder='little', signed=False)
self.ArgTable.append(tmp)
offset += 4
print(self.ArgTable)
# READ the string table data
if self.stringsSize != 0:
......@@ -1372,7 +1396,7 @@ class ClientNetworkConnection:
msg.pushUint32(self.UserId)
msg.pushString(self.LanguageCode)
self._sock.sendto(msg.bytes(), self.frontend)
self._sock.sendto(msg.toBytes(), self.frontend)
self._CurrentSendNumber += 1
self._ConnectionState = TConnectionState.Login
......@@ -1386,15 +1410,34 @@ class ClientNetworkConnection:
self.buildSystemHeader(msg)
msg.pushUint8(8) # SYSTEM_LOGIN_CODE
msg.pushSint32(self._QuitId) # _QuitId
self._sock.sendto(msg.bytes(), self.frontend)
self._sock.sendto(msg.toBytes(), self.frontend)
self._ConnectionState = TConnectionState.Quit
def readDelta(self, msg):
propertyCount = msg.readUint16()
self.log.debug("propertyCount:%d" % propertyCount)
for _ in range(0, propertyCount):
pass
def impulseCallBack(self, data):
# code/ryzom/common/src/game_share/generic_xml_msg_mngr.h : CNode *select(NLMISC::CBitMemStream &strm)
msg = BitStream()
msg.fromBytes(data)
serverTick = msg.readUint32()
self.log.debug("serverTick:%d" % serverTick)
#self.readDelta(msg)
def EmulateFirst(self):
self.log.info("Client Login")
self.sendSystemLogin()
for _ in range(1, 20): # while True:
self.log.info("Receive Message")
for _ in range(0, 20): # while True:
data, addr = self._sock.recvfrom(1024) # buffer size is 1024 bytes
print( "received message:", data)
self.log.debug("received message: %s" % data)
self.impulseCallBack(data)
self.log.info("Client Logout")
self.sendSystemQuit()
......@@ -1407,7 +1450,8 @@ class ClientKhanat:
LanguageCode="fr",
url="/login/r2_login.php",
suffix = None,
download_patch = False):
download_patch = False,
show_patch_detail=False):
self.log = logging.getLogger('myLogger')
if suffix is None:
......@@ -1415,6 +1459,7 @@ class ClientKhanat:
self.log.debug("suffix : %s" % suffix)
self.download_patch = download_patch
self.show_patch_detail = show_patch_detail
self.khanaturl = khanaturl
self.login = login + suffix
self.password = password
......@@ -1615,8 +1660,9 @@ class ClientKhanat:
self.khanat_idx.readFromBinFile(self.ryzomidx)
self.khanat_idx.CProductDescriptionForClient_apply()
# Show detail patch
self.khanat_idx.decrypt_token()
self.khanat_idx.show()
if self.show_patch_detail:
self.khanat_idx.decrypt_token()
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)
if self.download_patch:
......@@ -1634,6 +1680,7 @@ def main():
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')
parser.add_argument("-s", "--show-patch-detail", help="show debug message", action='store_true')
args = parser.parse_args()
if args.debug:
......@@ -1642,10 +1689,10 @@ def main():
level = logging.getLevelName('INFO')
log.setLevel(level)
client = ClientKhanat(args.khanaturl, suffix=args.suffix, download_patch=args.download_patch)
client = ClientKhanat(args.khanaturl, suffix=args.suffix, download_patch=args.download_patch, show_patch_detail=args.show_patch_detail)
client.Emulate()
log.info("End")
if __name__ == "__main__":
main()
#Test()
main()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment