mirror of
https://github.com/ammaraskar/pyCraft.git
synced 2025-02-28 09:42:06 +01:00
Update to protocol version 73
This commit is contained in:
parent
eb67fd9339
commit
20401e6b35
@ -53,6 +53,8 @@ class ServerConnection(threading.Thread):
|
|||||||
#Receive the encryption packet id
|
#Receive the encryption packet id
|
||||||
packetid = self.socket.recv(1)
|
packetid = self.socket.recv(1)
|
||||||
|
|
||||||
|
if (packetid == "\xFF"):
|
||||||
|
print PacketListenerManager.handleFF(self.FileObject)
|
||||||
#Sanity check the packet id
|
#Sanity check the packet id
|
||||||
assert packetid == "\xFD", "Server didn't respond back to handshake with proper packet!"
|
assert packetid == "\xFD", "Server didn't respond back to handshake with proper packet!"
|
||||||
|
|
||||||
@ -263,6 +265,8 @@ class PacketListener(threading.Thread):
|
|||||||
packet = PacketListenerManager.handle2A(self.FileObject)
|
packet = PacketListenerManager.handle2A(self.FileObject)
|
||||||
elif (response == "\x2B"):
|
elif (response == "\x2B"):
|
||||||
packet = PacketListenerManager.handle2B(self.FileObject)
|
packet = PacketListenerManager.handle2B(self.FileObject)
|
||||||
|
elif (response == "\x2C"):
|
||||||
|
packet = PacketListenerManager.handle2C(self.FileObject)
|
||||||
elif (response == "\x33"):
|
elif (response == "\x33"):
|
||||||
packet = PacketListenerManager.handle33(self.FileObject)
|
packet = PacketListenerManager.handle33(self.FileObject)
|
||||||
elif (response == "\x34"):
|
elif (response == "\x34"):
|
||||||
|
@ -394,8 +394,10 @@ def handle26(FileObject):
|
|||||||
def handle27(FileObject):
|
def handle27(FileObject):
|
||||||
EntityID = DataUtil.readInt(FileObject)
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
VehicleID = DataUtil.readInt(FileObject)
|
VehicleID = DataUtil.readInt(FileObject)
|
||||||
|
Leash = DataUtil.readBoolean(FileObject)
|
||||||
return {'EntityID': EntityID,
|
return {'EntityID': EntityID,
|
||||||
'VehicleID': VehicleID
|
'VehicleID': VehicleID,
|
||||||
|
'Leash': Leash
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -437,6 +439,19 @@ def handle2B(FileObject):
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def handle2C(FileObject):
|
||||||
|
EntityID = DataUtil.readInt(FileObject)
|
||||||
|
PropertiesCount = DataUtil.readInt(FileObject)
|
||||||
|
Properties = {}
|
||||||
|
for i in range(PropertiesCount):
|
||||||
|
key = DataUtil.readString(FileObject)
|
||||||
|
value = DataUtil.readDouble(FileObject)
|
||||||
|
Properties[key] = value
|
||||||
|
return {'EntityID': EntityID,
|
||||||
|
'Properties': Properties
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
def handle33(FileObject):
|
def handle33(FileObject):
|
||||||
X = DataUtil.readInt(FileObject)
|
X = DataUtil.readInt(FileObject)
|
||||||
Z = DataUtil.readInt(FileObject)
|
Z = DataUtil.readInt(FileObject)
|
||||||
@ -651,10 +666,13 @@ def handle64(FileObject):
|
|||||||
InventoryType = DataUtil.readByte(FileObject)
|
InventoryType = DataUtil.readByte(FileObject)
|
||||||
WindowTitle = DataUtil.readString(FileObject)
|
WindowTitle = DataUtil.readString(FileObject)
|
||||||
NumberOfSlots = DataUtil.readByte(FileObject)
|
NumberOfSlots = DataUtil.readByte(FileObject)
|
||||||
|
UseName = DataUtil.readBoolean(FileObject)
|
||||||
|
DataUtil.readInt(FileObject)
|
||||||
return {'WindowID': WindowID,
|
return {'WindowID': WindowID,
|
||||||
'InventoryType': InventoryType,
|
'InventoryType': InventoryType,
|
||||||
'WindowTitle': WindowTitle,
|
'WindowTitle': WindowTitle,
|
||||||
'NumberOfSlots': NumberOfSlots
|
'NumberOfSlots': NumberOfSlots,
|
||||||
|
'UseName': UseName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -767,7 +785,7 @@ def handle84(FileObject):
|
|||||||
|
|
||||||
def handleC8(FileObject):
|
def handleC8(FileObject):
|
||||||
StatID = DataUtil.readInt(FileObject)
|
StatID = DataUtil.readInt(FileObject)
|
||||||
Amount = DataUtil.readByte(FileObject)
|
Amount = DataUtil.readInt(FileObject)
|
||||||
return {'StatID': StatID,
|
return {'StatID': StatID,
|
||||||
'Amount': Amount
|
'Amount': Amount
|
||||||
}
|
}
|
||||||
@ -788,10 +806,10 @@ def handleCA(FileObject):
|
|||||||
Flags = DataUtil.readByte(FileObject)
|
Flags = DataUtil.readByte(FileObject)
|
||||||
|
|
||||||
#byte - fly speed
|
#byte - fly speed
|
||||||
FlySpeed = DataUtil.readByte(FileObject)
|
FlySpeed = DataUtil.readFloat(FileObject)
|
||||||
|
|
||||||
#byte - walk speed
|
#byte - walk speed
|
||||||
WalkSpeed = DataUtil.readByte(FileObject)
|
WalkSpeed = DataUtil.readFloat(FileObject)
|
||||||
return {'Flags': Flags,
|
return {'Flags': Flags,
|
||||||
'Fly Speed': FlySpeed,
|
'Fly Speed': FlySpeed,
|
||||||
'Walk Speed': WalkSpeed
|
'Walk Speed': WalkSpeed
|
||||||
|
@ -13,7 +13,7 @@ def sendHandshake(socket, username, host, port):
|
|||||||
socket.send("\x02")
|
socket.send("\x02")
|
||||||
|
|
||||||
#byte - protocol version
|
#byte - protocol version
|
||||||
DataUtil.sendByte(socket, 61)
|
DataUtil.sendByte(socket, 73)
|
||||||
|
|
||||||
#string - username
|
#string - username
|
||||||
DataUtil.sendString(socket, username)
|
DataUtil.sendString(socket, username)
|
||||||
|
Loading…
Reference in New Issue
Block a user