2012-10-26 12:31:47 +02:00
|
|
|
import DataUtil
|
|
|
|
import PacketSenderManager
|
2012-04-05 04:56:21 +02:00
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle00(FileObject, socket):
|
2012-10-26 12:31:47 +02:00
|
|
|
KAid = DataUtil.readInt(FileObject)
|
|
|
|
PacketSenderManager.send00(socket, KAid)
|
2012-04-11 22:22:58 +02:00
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle01(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
Eid = DataUtil.readInt(FileObject)
|
|
|
|
world = DataUtil.readString(FileObject)
|
|
|
|
mode = DataUtil.readByte(FileObject)
|
|
|
|
dimension = DataUtil.readByte(FileObject)
|
|
|
|
difficulty = DataUtil.readByte(FileObject)
|
2012-04-15 16:51:00 +02:00
|
|
|
FileObject.read(1)
|
2012-10-26 12:31:47 +02:00
|
|
|
maxplayers = DataUtil.readByte(FileObject)
|
|
|
|
return {'EntityID' : Eid,
|
2012-04-12 00:21:16 +02:00
|
|
|
'World' : world,
|
|
|
|
'Mode' : mode,
|
|
|
|
'Dimension' : dimension,
|
|
|
|
'Difficulty' : difficulty,
|
|
|
|
'MaxPlayers' : maxplayers
|
|
|
|
}
|
2012-04-11 22:22:58 +02:00
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle02(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
message = DataUtil.readString(FileObject)
|
2012-04-11 22:22:58 +02:00
|
|
|
return message
|
|
|
|
|
2012-09-05 21:28:55 +02:00
|
|
|
def handle03(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
message = DataUtil.readString(FileObject)
|
2012-10-26 15:09:16 +02:00
|
|
|
return {'Message' : message }
|
2012-09-05 21:28:55 +02:00
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle04(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
time = DataUtil.readLong(FileObject)
|
|
|
|
dayTime = DataUtil.readLong(FileObject)
|
2012-10-25 20:08:14 +02:00
|
|
|
return {'Time' : time,
|
|
|
|
'DayTime' : dayTime
|
|
|
|
}
|
2012-04-12 00:21:16 +02:00
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle05(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
|
|
|
Slot = DataUtil.readShort(FileObject)
|
|
|
|
Item = DataUtil.readSlotData(FileObject)
|
2012-04-12 00:21:16 +02:00
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'Slot' : Slot,
|
2012-09-02 19:54:16 +02:00
|
|
|
'Item' : Item
|
2012-04-12 00:21:16 +02:00
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle06(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
x = DataUtil.readInt(FileObject)
|
|
|
|
y = DataUtil.readInt(FileObject)
|
|
|
|
z = DataUtil.readInt(FileObject)
|
2012-04-12 00:21:16 +02:00
|
|
|
return {'x' : x,
|
|
|
|
'y' : y,
|
|
|
|
'z' : z
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle07(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
userID = DataUtil.readInt(FileObject)
|
|
|
|
targetID = DataUtil.readInt(FileObject)
|
|
|
|
mButton = DataUtil.readBoolean(FileObject)
|
2012-04-12 00:21:16 +02:00
|
|
|
return {'userID' : userID,
|
|
|
|
'targetID' : targetID,
|
|
|
|
'mButton' : mButton
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle08(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
health = DataUtil.readShort(FileObject)
|
|
|
|
food = DataUtil.readShort(FileObject)
|
|
|
|
saturation = DataUtil.readFloat(FileObject)
|
2012-04-12 00:21:16 +02:00
|
|
|
return {'health' : health,
|
|
|
|
'food' : food,
|
|
|
|
'saturation' : saturation
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle09(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
dimension = DataUtil.readInt(FileObject)
|
|
|
|
difficulty = DataUtil.readByte(FileObject)
|
|
|
|
mode = DataUtil.readByte(FileObject)
|
|
|
|
height = DataUtil.readShort(FileObject)
|
|
|
|
world = DataUtil.readString(FileObject)
|
2012-04-12 00:21:16 +02:00
|
|
|
return {'Dimension' : dimension,
|
|
|
|
'Difficulty' : difficulty,
|
|
|
|
'Mode' : mode,
|
|
|
|
'Height' : height,
|
|
|
|
'World' : world
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle0D(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
x = DataUtil.readDouble(FileObject)
|
|
|
|
stance = DataUtil.readDouble(FileObject)
|
|
|
|
y = DataUtil.readDouble(FileObject)
|
|
|
|
z = DataUtil.readDouble(FileObject)
|
|
|
|
yaw = DataUtil.readFloat(FileObject)
|
|
|
|
pitch = DataUtil.readFloat(FileObject)
|
|
|
|
onGround = DataUtil.readBoolean(FileObject)
|
2012-04-12 00:21:16 +02:00
|
|
|
return {'x' : x,
|
|
|
|
'stance' : stance,
|
|
|
|
'y' : y,
|
|
|
|
'z' : z,
|
|
|
|
'yaw' : yaw,
|
|
|
|
'pitch' : pitch,
|
|
|
|
'onGround' : onGround
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle11(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
2012-04-15 16:51:00 +02:00
|
|
|
FileObject.read(1) #Unused
|
2012-10-26 12:31:47 +02:00
|
|
|
x = DataUtil.readInt(FileObject)
|
|
|
|
y = DataUtil.readByte(FileObject)
|
|
|
|
z = DataUtil.readInt(FileObject)
|
2012-04-12 00:21:16 +02:00
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'x' : x,
|
|
|
|
'y' : y,
|
|
|
|
'z' : z
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle12(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
|
|
|
Animation = DataUtil.readByte(FileObject)
|
2012-04-12 00:21:16 +02:00
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'AnimationID' : Animation
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle14(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
|
|
|
PlayerName = DataUtil.readString(FileObject)
|
|
|
|
x = DataUtil.readInt(FileObject)
|
|
|
|
y = DataUtil.readInt(FileObject)
|
|
|
|
z = DataUtil.readInt(FileObject)
|
|
|
|
yaw = DataUtil.readFloat(FileObject)
|
|
|
|
pitch = DataUtil.readFloat(FileObject)
|
|
|
|
curItem = DataUtil.readShort(FileObject)
|
|
|
|
metadata = DataUtil.readEntityMetadata(FileObject)
|
2012-04-12 00:21:16 +02:00
|
|
|
toReturn = {'EntityID' : EntityID,
|
|
|
|
'Player Name' : PlayerName,
|
|
|
|
'x' : x,
|
|
|
|
'y' : y,
|
|
|
|
'z' : z,
|
|
|
|
'yaw' : yaw,
|
|
|
|
'pitch' : pitch,
|
2012-09-02 19:54:16 +02:00
|
|
|
'curItem' : curItem,
|
|
|
|
'Metadata' : metadata
|
2012-04-12 00:21:16 +02:00
|
|
|
}
|
|
|
|
return toReturn
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle15(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
|
|
|
ItemID = DataUtil.readShort(FileObject)
|
2012-10-25 20:08:14 +02:00
|
|
|
if (ItemID != -1):
|
2012-10-26 12:31:47 +02:00
|
|
|
Count = DataUtil.readByte(FileObject)
|
|
|
|
Damage = DataUtil.readShort(FileObject)
|
|
|
|
ArrayLength = DataUtil.readShort(FileObject)
|
2012-10-25 20:08:14 +02:00
|
|
|
if (ArrayLength != -1):
|
|
|
|
Array = FileObject.read(ArrayLength) #TODO: find out what this does and do stuff accrodingly
|
2012-10-26 12:31:47 +02:00
|
|
|
x = DataUtil.readInt(FileObject)
|
|
|
|
y = DataUtil.readInt(FileObject)
|
|
|
|
z = DataUtil.readInt(FileObject)
|
|
|
|
Rotation = DataUtil.readByte(FileObject)
|
|
|
|
Pitch = DataUtil.readByte(FileObject)
|
|
|
|
Roll = DataUtil.readByte(FileObject)
|
2012-10-25 20:08:14 +02:00
|
|
|
toReturn = {'EntityID' : EntityID,
|
|
|
|
'ItemID' : ItemID,
|
|
|
|
'x' : x,
|
|
|
|
'y' : y,
|
|
|
|
'z' : z,
|
|
|
|
'Rotation' : Rotation,
|
|
|
|
'Pitch' : Pitch,
|
|
|
|
'Roll' : Roll
|
|
|
|
}
|
|
|
|
if (ItemID != -1):
|
|
|
|
toReturn['Count'] = Count
|
|
|
|
toReturn['Damage'] = Damage
|
|
|
|
return toReturn
|
2012-04-12 12:07:25 +02:00
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle16(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
CollectedID = DataUtil.readInt(FileObject)
|
|
|
|
CollectorID = DataUtil.readInt(FileObject)
|
2012-04-12 12:07:25 +02:00
|
|
|
return {'CollectedID' : CollectedID,
|
|
|
|
'CollectorID' : CollectorID
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle17(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
|
|
|
Type = DataUtil.readByte(FileObject)
|
|
|
|
x = DataUtil.readInt(FileObject)
|
|
|
|
y = DataUtil.readInt(FileObject)
|
|
|
|
z = DataUtil.readInt(FileObject)
|
|
|
|
ThrowerEntityID = DataUtil.readInt(FileObject)
|
2012-04-12 12:07:25 +02:00
|
|
|
if(ThrowerEntityID > 0):
|
2012-10-26 12:31:47 +02:00
|
|
|
SpeedX = DataUtil.readShort(FileObject)
|
|
|
|
SpeedY = DataUtil.readShort(FileObject)
|
|
|
|
SpeedZ = DataUtil.readShort(FileObject)
|
2012-04-12 12:07:25 +02:00
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'Type' : Type,
|
|
|
|
'x' : x,
|
|
|
|
'y' : y,
|
|
|
|
'z' : z,
|
|
|
|
'ThrowerEntityID' : ThrowerEntityID,
|
|
|
|
'SpeedX' : SpeedX,
|
|
|
|
'SpeedY' : SpeedY,
|
|
|
|
'SpeedZ' : SpeedZ
|
|
|
|
}
|
|
|
|
else:
|
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'Type' : Type,
|
|
|
|
'x' : x,
|
|
|
|
'y' : y,
|
|
|
|
'z' : z,
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle18(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
|
|
|
Type = DataUtil.readByte(FileObject)
|
|
|
|
x = DataUtil.readInt(FileObject)
|
|
|
|
y = DataUtil.readInt(FileObject)
|
|
|
|
z = DataUtil.readInt(FileObject)
|
|
|
|
Yaw = DataUtil.readByte(FileObject)
|
|
|
|
Pitch = DataUtil.readByte(FileObject)
|
|
|
|
HeadYaw = DataUtil.readByte(FileObject)
|
|
|
|
VelocityX = DataUtil.readShort(FileObject)
|
|
|
|
VelocityY = DataUtil.readShort(FileObject)
|
|
|
|
VelocityZ = DataUtil.readShort(FileObject)
|
|
|
|
metadata = DataUtil.readEntityMetadata(FileObject)
|
2012-09-02 19:54:16 +02:00
|
|
|
|
2012-04-12 12:07:25 +02:00
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'Type' : Type,
|
|
|
|
'x' : x,
|
|
|
|
'y' : y,
|
|
|
|
'z' : z,
|
|
|
|
'Yaw' : Yaw,
|
|
|
|
'Pitch' : Pitch,
|
|
|
|
'HeadYaw' : HeadYaw,
|
2012-09-05 21:28:55 +02:00
|
|
|
'Metadata' : metadata,
|
|
|
|
'VelocityX' : VelocityX,
|
|
|
|
'VelocityY' : VelocityY,
|
|
|
|
'VelocityZ' : VelocityZ
|
2012-04-12 12:07:25 +02:00
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle19(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
|
|
|
Title = DataUtil.readString(FileObject)
|
|
|
|
x = DataUtil.readInt(FileObject)
|
|
|
|
y = DataUtil.readInt(FileObject)
|
|
|
|
z = DataUtil.readInt(FileObject)
|
|
|
|
Direction = DataUtil.readInt(FileObject)
|
2012-04-12 12:07:25 +02:00
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'Title' : Title,
|
|
|
|
'x' : x,
|
|
|
|
'y' : y,
|
|
|
|
'z' : z,
|
|
|
|
'Direction' : Direction
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle1A(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
|
|
|
x = DataUtil.readInt(FileObject)
|
|
|
|
y = DataUtil.readInt(FileObject)
|
|
|
|
z = DataUtil.readInt(FileObject)
|
|
|
|
Count = DataUtil.readShort(FileObject)
|
2012-04-12 12:07:25 +02:00
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'x' : x,
|
|
|
|
'y' : y,
|
|
|
|
'z' : z,
|
|
|
|
'Count' : Count
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle1C(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
|
|
|
VelocityX = DataUtil.readShort(FileObject)
|
|
|
|
VelocityY = DataUtil.readShort(FileObject)
|
|
|
|
VelocityZ = DataUtil.readShort(FileObject)
|
2012-04-12 12:07:25 +02:00
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'VelocityX' : VelocityX,
|
|
|
|
'VelocityY' : VelocityY,
|
|
|
|
'VelocityZ' : VelocityZ
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle1D(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityArrayLength = DataUtil.readByte(FileObject)
|
2012-09-05 21:28:55 +02:00
|
|
|
Entities = []
|
|
|
|
for i in range(EntityArrayLength):
|
2012-10-26 12:31:47 +02:00
|
|
|
Entities.append(DataUtil.readInt(FileObject))
|
2012-09-05 21:28:55 +02:00
|
|
|
return Entities
|
2012-04-12 12:07:25 +02:00
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle1E(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
2012-04-12 12:07:25 +02:00
|
|
|
return EntityID
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle1F(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
|
|
|
x = DataUtil.readByte(FileObject)
|
|
|
|
y = DataUtil.readByte(FileObject)
|
|
|
|
z = DataUtil.readByte(FileObject)
|
2012-04-12 12:07:25 +02:00
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'x' : x,
|
|
|
|
'y' : y,
|
|
|
|
'z' : z
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle20(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
|
|
|
Yaw = DataUtil.readByte(FileObject)
|
|
|
|
Pitch = DataUtil.readByte(FileObject)
|
2012-04-12 12:07:25 +02:00
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'Yaw' : Yaw,
|
|
|
|
'Pitch' : Pitch
|
|
|
|
}
|
2012-04-13 17:38:25 +02:00
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle21(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
|
|
|
x = DataUtil.readByte(FileObject)
|
|
|
|
y = DataUtil.readByte(FileObject)
|
|
|
|
z = DataUtil.readByte(FileObject)
|
|
|
|
Yaw = DataUtil.readByte(FileObject)
|
|
|
|
Pitch = DataUtil.readByte(FileObject)
|
2012-04-13 17:38:25 +02:00
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'x' : x,
|
|
|
|
'y' : y,
|
|
|
|
'z' : z,
|
|
|
|
'Yaw' : Yaw,
|
|
|
|
'Pitch' : Pitch
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle22(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
|
|
|
x = DataUtil.readInt(FileObject)
|
|
|
|
y = DataUtil.readInt(FileObject)
|
|
|
|
z = DataUtil.readInt(FileObject)
|
|
|
|
Yaw = DataUtil.readByte(FileObject)
|
|
|
|
Pitch = DataUtil.readByte(FileObject)
|
2012-04-13 17:38:25 +02:00
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'x' : x,
|
|
|
|
'y' : y,
|
|
|
|
'z' : z,
|
|
|
|
'Yaw' : Yaw,
|
|
|
|
'Pitch' : Pitch
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle23(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
|
|
|
HeadYaw = DataUtil.readByte(FileObject)
|
2012-04-13 17:38:25 +02:00
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'HeadYaw' : HeadYaw
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle26(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
|
|
|
Status = DataUtil.readByte(FileObject)
|
2012-04-13 17:38:25 +02:00
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'Status' : Status
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle27(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
|
|
|
VehicleID = DataUtil.readInt(FileObject)
|
2012-04-13 17:38:25 +02:00
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'VehicleID' : VehicleID
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle28(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
|
|
|
metadata = DataUtil.readEntityMetadata(FileObject)
|
2012-04-13 17:38:25 +02:00
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'MetaData' : metadata
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle29(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
|
|
|
EffectID = DataUtil.readByte(FileObject)
|
|
|
|
Amplifier = DataUtil.readByte(FileObject)
|
|
|
|
Duration = DataUtil.readShort(FileObject)
|
2012-04-13 17:38:25 +02:00
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'EffectID' : EffectID,
|
|
|
|
'Amplifier' : Amplifier,
|
|
|
|
'Duration' : Duration
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle2A(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
|
|
|
EffectID = DataUtil.readByte(FileObject)
|
2012-04-13 17:38:25 +02:00
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'EffectID' : EffectID
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle2B(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
ExperienceBar = DataUtil.readFloat(FileObject)
|
|
|
|
Level = DataUtil.readShort(FileObject)
|
|
|
|
TotalExp = DataUtil.readShort(FileObject)
|
2012-04-13 17:38:25 +02:00
|
|
|
return {'ExpBar' : ExperienceBar,
|
|
|
|
'Level' : Level,
|
|
|
|
'TotalExp' : TotalExp
|
|
|
|
}
|
2012-04-14 17:29:04 +02:00
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle33(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
X = DataUtil.readInt(FileObject)
|
|
|
|
Z = DataUtil.readInt(FileObject)
|
|
|
|
GroundUpContinous = DataUtil.readBoolean(FileObject)
|
|
|
|
PrimaryBitMap = DataUtil.readShort(FileObject)
|
|
|
|
AddBitMap = DataUtil.readShort(FileObject)
|
|
|
|
CompressedSize = DataUtil.readInt(FileObject)
|
|
|
|
FileObject.read(CompressedSize) #not going to be inflating and using this data until I know how to :3
|
2012-04-14 17:29:04 +02:00
|
|
|
return {'x' : X,
|
|
|
|
'z' : Z
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle34(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
ChunkX = DataUtil.readInt(FileObject)
|
|
|
|
ChunkZ = DataUtil.readInt(FileObject)
|
|
|
|
AffectedBlocks = DataUtil.readShort(FileObject)
|
|
|
|
DataSize = DataUtil.readInt(FileObject)
|
2012-04-15 16:51:00 +02:00
|
|
|
FileObject.read(DataSize) #not going to be using this until I know how to.
|
2012-04-14 17:29:04 +02:00
|
|
|
return {'ChunkX' : ChunkX,
|
|
|
|
'ChunkZ' : ChunkZ,
|
|
|
|
'AffectedBlocks' : AffectedBlocks
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle35(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
X = DataUtil.readInt(FileObject)
|
|
|
|
Y = DataUtil.readByte(FileObject)
|
|
|
|
Z = DataUtil.readInt(FileObject)
|
|
|
|
BlockType = DataUtil.readShort(FileObject)
|
|
|
|
BlockMetaData = DataUtil.readByte(FileObject)
|
2012-04-14 17:29:04 +02:00
|
|
|
return {'x' : X,
|
|
|
|
'y' : Y,
|
|
|
|
'z' : Z,
|
|
|
|
'BlockType' : BlockType,
|
|
|
|
'MetaData' : BlockMetaData
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle36(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
X = DataUtil.readInt(FileObject)
|
|
|
|
Y = DataUtil.readShort(FileObject)
|
|
|
|
Z = DataUtil.readInt(FileObject)
|
|
|
|
Byte1 = DataUtil.readByte(FileObject)
|
|
|
|
Byte2 = DataUtil.readByte(FileObject)
|
|
|
|
BlockID = DataUtil.readShort(FileObject)
|
2012-04-14 17:29:04 +02:00
|
|
|
return {'x' : X,
|
|
|
|
'y' : Y,
|
|
|
|
'z' : Z,
|
|
|
|
'Byte1' : Byte1,
|
2012-09-05 21:28:55 +02:00
|
|
|
'Byte2' : Byte2,
|
|
|
|
'BlockID' : BlockID
|
|
|
|
}
|
|
|
|
|
|
|
|
def handle37(FileObject):
|
|
|
|
#int - EntityID
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
2012-09-05 21:28:55 +02:00
|
|
|
|
|
|
|
#int - X cord
|
2012-10-26 12:31:47 +02:00
|
|
|
x = DataUtil.readInt(FileObject)
|
2012-09-05 21:28:55 +02:00
|
|
|
|
|
|
|
#int - Y cord
|
2012-10-26 12:31:47 +02:00
|
|
|
y = DataUtil.readInt(FileObject)
|
2012-09-05 21:28:55 +02:00
|
|
|
|
|
|
|
#int - Z cord
|
2012-10-26 12:31:47 +02:00
|
|
|
z = DataUtil.readInt(FileObject)
|
2012-09-05 21:28:55 +02:00
|
|
|
|
|
|
|
#byte - Stage
|
2012-10-26 12:31:47 +02:00
|
|
|
DestroyedStage = DataUtil.readByte(FileObject)
|
2012-09-05 21:28:55 +02:00
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'x' : x,
|
|
|
|
'y' : y,
|
|
|
|
'z' : z,
|
|
|
|
'DestroyedStage' : DestroyedStage
|
|
|
|
}
|
|
|
|
|
|
|
|
def handle38(FileObject):
|
|
|
|
#short - number of chunks
|
2012-10-26 12:31:47 +02:00
|
|
|
ChunkCount = DataUtil.readShort(FileObject)
|
2012-09-05 21:28:55 +02:00
|
|
|
|
|
|
|
#int - chunk data length
|
2012-10-26 12:31:47 +02:00
|
|
|
ChunkDataLength = DataUtil.readInt(FileObject)
|
2012-09-05 21:28:55 +02:00
|
|
|
FileObject.read(ChunkDataLength) #just gonna ignore this for now
|
|
|
|
|
|
|
|
#metadata - ignoring this
|
|
|
|
for i in range(ChunkCount):
|
|
|
|
FileObject.read(12)
|
|
|
|
|
|
|
|
return {'ChunkCount' : ChunkCount
|
2012-04-14 17:29:04 +02:00
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle3C(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
X = DataUtil.readDouble(FileObject)
|
|
|
|
Y = DataUtil.readDouble(FileObject)
|
|
|
|
Z = DataUtil.readDouble(FileObject)
|
|
|
|
Radius = DataUtil.readFloat(FileObject)
|
|
|
|
RecordCount = DataUtil.readInt(FileObject)
|
2012-04-14 17:29:04 +02:00
|
|
|
AffectedBlocks = []
|
2012-04-15 16:51:00 +02:00
|
|
|
for i in range((RecordCount * 3)):
|
2012-10-26 12:31:47 +02:00
|
|
|
x = DataUtil.readByte(FileObject)
|
|
|
|
y = DataUtil.readByte(FileObject)
|
|
|
|
z = DataUtil.readByte(FileObject)
|
2012-04-14 17:29:04 +02:00
|
|
|
AffectedBlocks.append({'x' : x, 'y' : y, 'z' : z})
|
2012-09-05 21:28:55 +02:00
|
|
|
#---Unknown what these floats do
|
|
|
|
FileObject.read(4)
|
|
|
|
FileObject.read(4)
|
|
|
|
FileObject.read(4)
|
|
|
|
#---
|
|
|
|
return {'x' : X,
|
|
|
|
'y' : Y,
|
|
|
|
'z' : Z,
|
|
|
|
'Raidus' : Radius,
|
2012-04-14 17:29:04 +02:00
|
|
|
'AffectedBlocks' : AffectedBlocks
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle3D(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EffectID = DataUtil.readInt(FileObject)
|
|
|
|
X = DataUtil.readInt(FileObject)
|
|
|
|
Y = DataUtil.readByte(FileObject)
|
|
|
|
Z = DataUtil.readInt(FileObject)
|
|
|
|
Data = DataUtil.readInt(FileObject)
|
|
|
|
NoVolDecrease = DataUtil.readBoolean(FileObject)
|
2012-04-14 17:29:04 +02:00
|
|
|
return {'EffectID' : EffectID,
|
|
|
|
'X' : X,
|
|
|
|
'Y' : Y,
|
|
|
|
'Z' : Z,
|
2012-10-25 20:08:14 +02:00
|
|
|
'Data' : Data,
|
|
|
|
'NoVolumeDecrease' : NoVolDecrease
|
2012-04-14 17:29:04 +02:00
|
|
|
}
|
|
|
|
|
2012-09-05 21:28:55 +02:00
|
|
|
def handle3E(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
Sound = DataUtil.readString(FileObject)
|
|
|
|
x = DataUtil.readInt(FileObject)
|
|
|
|
y = DataUtil.readInt(FileObject)
|
|
|
|
z = DataUtil.readInt(FileObject)
|
|
|
|
Volume = DataUtil.readFloat(FileObject)
|
|
|
|
Pitch = DataUtil.readByte(FileObject)
|
2012-09-05 21:28:55 +02:00
|
|
|
return {'Sound' : Sound,
|
|
|
|
'x' : x,
|
|
|
|
'y' : y,
|
|
|
|
'z' : z,
|
|
|
|
'Volume' : Volume,
|
|
|
|
'Pitch' : Pitch
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle46(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
Reason = DataUtil.readByte(FileObject)
|
|
|
|
GameMode = DataUtil.readByte(FileObject)
|
2012-04-14 17:29:04 +02:00
|
|
|
return {'Reason' : Reason,
|
|
|
|
'GameMode' : GameMode
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle47(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
EntityID = DataUtil.readInt(FileObject)
|
2012-04-15 16:51:00 +02:00
|
|
|
FileObject.read(1) #Boolean don't do nothing
|
2012-10-26 12:31:47 +02:00
|
|
|
x = DataUtil.readInt(FileObject)
|
|
|
|
y = DataUtil.readInt(FileObject)
|
|
|
|
z = DataUtil.readInt(FileObject)
|
2012-04-14 17:29:04 +02:00
|
|
|
return {'EntityID' : EntityID,
|
|
|
|
'x' : x,
|
|
|
|
'y' : y,
|
|
|
|
'z' : z
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle64(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
WindowID = DataUtil.readByte(FileObject)
|
|
|
|
InventoryType = DataUtil.readByte(FileObject)
|
|
|
|
WindowTitle = DataUtil.readString(FileObject)
|
|
|
|
NumberOfSlots = DataUtil.readByte(FileObject)
|
2012-04-14 17:29:04 +02:00
|
|
|
return {'WindowID' : WindowID,
|
|
|
|
'InventoryType' : InventoryType,
|
|
|
|
'WindowTitle' : WindowTitle,
|
|
|
|
'NumberOfSlots' : NumberOfSlots
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle65(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
WindowID = DataUtil.readByte(FileObject)
|
2012-04-14 17:29:04 +02:00
|
|
|
return WindowID
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle67(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
WindowID = DataUtil.readByte(FileObject)
|
|
|
|
Slot = DataUtil.readShort(FileObject)
|
|
|
|
SlotData = DataUtil.readSlotData(FileObject)
|
2012-04-14 17:29:04 +02:00
|
|
|
return {'WindowID' : WindowID,
|
|
|
|
'Slot' : Slot,
|
|
|
|
'SlotData' : SlotData
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle68(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
WindowID = DataUtil.readByte(FileObject)
|
|
|
|
Count = DataUtil.readShort(FileObject)
|
2012-04-15 16:51:00 +02:00
|
|
|
Slots = []
|
|
|
|
for i in range(Count):
|
2012-10-26 12:31:47 +02:00
|
|
|
SlotData = DataUtil.readSlotData(FileObject)
|
2012-04-15 16:51:00 +02:00
|
|
|
Slots.append(SlotData)
|
2012-04-14 17:29:04 +02:00
|
|
|
return {'WindowID' : WindowID,
|
|
|
|
'Count' : Count,
|
2012-04-15 16:51:00 +02:00
|
|
|
'Slots' : Slots
|
2012-04-14 17:29:04 +02:00
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle69(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
WindowID = DataUtil.readByte(FileObject)
|
|
|
|
Property = DataUtil.readShort(FileObject)
|
|
|
|
Value = DataUtil.readShort(FileObject)
|
2012-04-14 17:29:04 +02:00
|
|
|
return {'WindowID' : WindowID,
|
|
|
|
'Property' : Property,
|
|
|
|
'Value' : Value
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle6A(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
WindowID = DataUtil.readByte(FileObject)
|
|
|
|
ActionType = DataUtil.readShort(FileObject)
|
|
|
|
Accepted = DataUtil.readBoolean(FileObject)
|
2012-04-14 17:29:04 +02:00
|
|
|
return {'WindowID' : WindowID,
|
|
|
|
'ActionType' : ActionType,
|
|
|
|
'Accepted' : Accepted
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle6B(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
Slot = DataUtil.readShort(FileObject)
|
|
|
|
ClickedItem = DataUtil.readSlotData(FileObject)
|
2012-04-14 17:29:04 +02:00
|
|
|
return {'Slot' : Slot,
|
|
|
|
'ClickedItem' : ClickedItem
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle82(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
X = DataUtil.readInt(FileObject)
|
|
|
|
Y = DataUtil.readShort(FileObject)
|
|
|
|
Z = DataUtil.readInt(FileObject)
|
|
|
|
Line1 = DataUtil.readString(FileObject)
|
|
|
|
Line2 = DataUtil.readString(FileObject)
|
|
|
|
Line3 = DataUtil.readString(FileObject)
|
|
|
|
Line4 = DataUtil.readString(FileObject)
|
2012-04-14 17:29:04 +02:00
|
|
|
return {'x' : X,
|
|
|
|
'y' : Y,
|
|
|
|
'z' : Z,
|
|
|
|
'Line1' : Line1,
|
|
|
|
'Line2' : Line2,
|
|
|
|
'Line3' : Line3,
|
|
|
|
'Line4' : Line4
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle83(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
ItemType = DataUtil.readShort(FileObject)
|
|
|
|
ItemID = DataUtil.readShort(FileObject)
|
|
|
|
TextLength = DataUtil.readByte(FileObject)
|
|
|
|
Text = DataUtil.readByteArray(FileObject, TextLength)
|
2012-04-14 17:29:04 +02:00
|
|
|
return {'ItemType' : ItemType,
|
|
|
|
'ItemID' : ItemID,
|
|
|
|
'Text' : Text
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handle84(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
X = DataUtil.readInt(FileObject)
|
|
|
|
Y = DataUtil.readShort(FileObject)
|
|
|
|
Z = DataUtil.readInt(FileObject)
|
|
|
|
Action = DataUtil.readByte(FileObject)
|
|
|
|
DataLength = DataUtil.readShort(FileObject)
|
2012-09-05 21:28:55 +02:00
|
|
|
if (DataLength != -1):
|
2012-10-26 12:31:47 +02:00
|
|
|
NBTData = DataUtil.readByteArray(FileObject, DataLength)
|
2012-09-05 21:28:55 +02:00
|
|
|
return {'x' : X,
|
|
|
|
'y' : Y,
|
|
|
|
'z' : Z,
|
|
|
|
'Action' : Action,
|
|
|
|
'NBTData' : NBTData
|
|
|
|
}
|
2012-04-14 17:29:04 +02:00
|
|
|
return {'x' : X,
|
|
|
|
'y' : Y,
|
|
|
|
'z' : Z,
|
2012-09-05 21:28:55 +02:00
|
|
|
'Action' : Action
|
2012-04-14 17:29:04 +02:00
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handleC8(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
StatID = DataUtil.readInt(FileObject)
|
|
|
|
Amount = DataUtil.readByte(FileObject)
|
2012-04-14 17:29:04 +02:00
|
|
|
return {'StatID' : StatID,
|
|
|
|
'Amount' : Amount
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handleC9(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
PlayerName = DataUtil.readString(FileObject)
|
|
|
|
Online = DataUtil.readBoolean(FileObject)
|
|
|
|
Ping = DataUtil.readShort(FileObject)
|
2012-04-14 17:29:04 +02:00
|
|
|
return {'PlayerName' : PlayerName,
|
|
|
|
'Online' : Online,
|
|
|
|
'Ping' : Ping
|
|
|
|
}
|
2012-04-13 17:38:25 +02:00
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handleCA(FileObject):
|
2012-09-05 21:28:55 +02:00
|
|
|
#byte - flags
|
2012-10-26 12:31:47 +02:00
|
|
|
Flags = DataUtil.readByte(FileObject)
|
2012-09-05 21:28:55 +02:00
|
|
|
|
|
|
|
#byte - fly speed
|
2012-10-26 12:31:47 +02:00
|
|
|
FlySpeed = DataUtil.readByte(FileObject)
|
2012-09-05 21:28:55 +02:00
|
|
|
|
|
|
|
#byte - walk speed
|
2012-10-26 12:31:47 +02:00
|
|
|
WalkSpeed = DataUtil.readByte(FileObject)
|
2012-09-05 21:28:55 +02:00
|
|
|
return {'Flags' : Flags,
|
|
|
|
'Fly Speed' : FlySpeed,
|
|
|
|
'Walk Speed' : WalkSpeed
|
2012-04-13 17:38:25 +02:00
|
|
|
}
|
|
|
|
|
2012-09-05 21:28:55 +02:00
|
|
|
def handleCB(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
text = DataUtil.readString(FileObject)
|
2012-09-05 21:28:55 +02:00
|
|
|
return {'Text' : text}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handleFA(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
Channel = DataUtil.readString(FileObject)
|
|
|
|
length = DataUtil.readShort(FileObject)
|
|
|
|
message = DataUtil.readByteArray(FileObject, length)
|
2012-04-13 17:38:25 +02:00
|
|
|
return {'Channel' : Channel,
|
|
|
|
'message' : message
|
|
|
|
}
|
2012-09-02 19:54:16 +02:00
|
|
|
|
|
|
|
def handleFC(FileObject):
|
|
|
|
|
|
|
|
#short - shared secret length
|
2012-10-26 12:31:47 +02:00
|
|
|
secretLength = DataUtil.readShort(FileObject)
|
2012-09-02 19:54:16 +02:00
|
|
|
|
2012-10-26 12:31:47 +02:00
|
|
|
sharedSecret = DataUtil.readByteArray(FileObject, secretLength) #ignore this data, it doesn't matter
|
2012-09-02 19:54:16 +02:00
|
|
|
|
|
|
|
#short - token length
|
2012-10-26 12:31:47 +02:00
|
|
|
length = DataUtil.readShort(FileObject)
|
2012-09-02 19:54:16 +02:00
|
|
|
|
2012-10-26 12:31:47 +02:00
|
|
|
token = DataUtil.readByteArray(FileObject, length) #ignore this data, it doesn't matter
|
2012-09-02 19:54:16 +02:00
|
|
|
|
|
|
|
return {'Secret Length' : secretLength,
|
|
|
|
'Shared Secret' : sharedSecret,
|
|
|
|
'Token Length' : length,
|
|
|
|
'Token' : token
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
def handleFD(FileObject):
|
|
|
|
|
|
|
|
#string - server id
|
2012-10-26 12:31:47 +02:00
|
|
|
serverid = DataUtil.readString(FileObject)
|
2012-09-02 19:54:16 +02:00
|
|
|
|
|
|
|
#short - pub key length
|
2012-10-26 12:31:47 +02:00
|
|
|
length = DataUtil.readShort(FileObject)
|
2012-09-02 19:54:16 +02:00
|
|
|
|
|
|
|
#byte array - pub key
|
2012-10-26 12:31:47 +02:00
|
|
|
pubkey = DataUtil.readByteArray(FileObject, length)
|
2012-09-02 19:54:16 +02:00
|
|
|
|
|
|
|
#short - token length
|
2012-10-26 12:31:47 +02:00
|
|
|
length = DataUtil.readShort(FileObject)
|
2012-09-02 19:54:16 +02:00
|
|
|
|
|
|
|
#byte array - token
|
2012-10-26 12:31:47 +02:00
|
|
|
token = DataUtil.readByteArray(FileObject, length)
|
2012-09-02 19:54:16 +02:00
|
|
|
|
|
|
|
return {'ServerID' : serverid,
|
|
|
|
'Public Key' : pubkey,
|
|
|
|
'Token' : token
|
|
|
|
}
|
|
|
|
|
2012-04-15 16:51:00 +02:00
|
|
|
def handleFF(FileObject):
|
2012-10-26 12:31:47 +02:00
|
|
|
Reason = DataUtil.readString(FileObject)
|
2012-10-26 15:09:16 +02:00
|
|
|
return {'Reason' : Reason}
|