mirror of
https://github.com/ammaraskar/pyCraft.git
synced 2024-11-16 07:15:24 +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
|
||||
packetid = self.socket.recv(1)
|
||||
|
||||
if (packetid == "\xFF"):
|
||||
print PacketListenerManager.handleFF(self.FileObject)
|
||||
#Sanity check the packet id
|
||||
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)
|
||||
elif (response == "\x2B"):
|
||||
packet = PacketListenerManager.handle2B(self.FileObject)
|
||||
elif (response == "\x2C"):
|
||||
packet = PacketListenerManager.handle2C(self.FileObject)
|
||||
elif (response == "\x33"):
|
||||
packet = PacketListenerManager.handle33(self.FileObject)
|
||||
elif (response == "\x34"):
|
||||
|
@ -394,8 +394,10 @@ def handle26(FileObject):
|
||||
def handle27(FileObject):
|
||||
EntityID = DataUtil.readInt(FileObject)
|
||||
VehicleID = DataUtil.readInt(FileObject)
|
||||
Leash = DataUtil.readBoolean(FileObject)
|
||||
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):
|
||||
X = DataUtil.readInt(FileObject)
|
||||
Z = DataUtil.readInt(FileObject)
|
||||
@ -651,10 +666,13 @@ def handle64(FileObject):
|
||||
InventoryType = DataUtil.readByte(FileObject)
|
||||
WindowTitle = DataUtil.readString(FileObject)
|
||||
NumberOfSlots = DataUtil.readByte(FileObject)
|
||||
UseName = DataUtil.readBoolean(FileObject)
|
||||
DataUtil.readInt(FileObject)
|
||||
return {'WindowID': WindowID,
|
||||
'InventoryType': InventoryType,
|
||||
'WindowTitle': WindowTitle,
|
||||
'NumberOfSlots': NumberOfSlots
|
||||
'NumberOfSlots': NumberOfSlots,
|
||||
'UseName': UseName
|
||||
}
|
||||
|
||||
|
||||
@ -767,7 +785,7 @@ def handle84(FileObject):
|
||||
|
||||
def handleC8(FileObject):
|
||||
StatID = DataUtil.readInt(FileObject)
|
||||
Amount = DataUtil.readByte(FileObject)
|
||||
Amount = DataUtil.readInt(FileObject)
|
||||
return {'StatID': StatID,
|
||||
'Amount': Amount
|
||||
}
|
||||
@ -788,10 +806,10 @@ def handleCA(FileObject):
|
||||
Flags = DataUtil.readByte(FileObject)
|
||||
|
||||
#byte - fly speed
|
||||
FlySpeed = DataUtil.readByte(FileObject)
|
||||
FlySpeed = DataUtil.readFloat(FileObject)
|
||||
|
||||
#byte - walk speed
|
||||
WalkSpeed = DataUtil.readByte(FileObject)
|
||||
WalkSpeed = DataUtil.readFloat(FileObject)
|
||||
return {'Flags': Flags,
|
||||
'Fly Speed': FlySpeed,
|
||||
'Walk Speed': WalkSpeed
|
||||
|
@ -13,7 +13,7 @@ def sendHandshake(socket, username, host, port):
|
||||
socket.send("\x02")
|
||||
|
||||
#byte - protocol version
|
||||
DataUtil.sendByte(socket, 61)
|
||||
DataUtil.sendByte(socket, 73)
|
||||
|
||||
#string - username
|
||||
DataUtil.sendString(socket, username)
|
||||
|
Loading…
Reference in New Issue
Block a user