Пример #1
0
class EnemyShootPacket:
    def __init__(self):
        self.type = "ENEMYSHOOT"
        self.bulletId = 0
        self.ownerId = 0
        self.bulletType = 0
        self.startingPos = WorldPosData()
        self.angle = 0
        self.damage = 0
        self.numShots = 0
        self.angleInc = 0

    def read(self, reader):
        self.bulletId = reader.readUnsignedByte()
        self.ownerId = reader.readInt32()
        self.bulletType = reader.readUnsignedByte()
        self.startingPos.read(reader)
        self.angle = reader.readFloat()
        self.damage = reader.readShort()
        if (reader.bytesAvailable() > 0):
            self.numShots = reader.readUnsignedByte()
            self.angleInc = reader.readFloat()
        else:
            self.numShots = 1
            self.angleInc = 0
Пример #2
0
class PlayerShootPacket:
    def __init__(self):
        self.type = "PLAYERSHOOT"
        self.time = 0
        self.bulletId = 0
        self.containerType = 0
        self.pos = WorldPosData()
        self.angle = 0
        self.speedMult = 0
        self.lifeMult = 0
        self.isBurst = False

    def write(self, writer):
        writer.writeInt32(self.time)
        writer.writeByte(self.bulletId)
        writer.writeShort(self.containerType)
        self.pos.write(writer)
        writer.writeFloat(self.angle)
        writer.writeShort(int(self.speedMult * 1000))
        writer.writeShort(int(self.lifeMult * 1000))
        writer.writeBool(self.isBurst)

    def read(self, reader):
        self.time = reader.readInt32()
        self.bulletId = reader.readByte()
        self.containerType = reader.readShort()
        self.pos.read(reader)
        self.angle = reader.readFloat()
        self.speedMult = int(reader.readShort() / 1000)
        self.lifeMult = int(reader.readShort() / 1000)
        self.isBurst = reader.readBool()
Пример #3
0
class MovePacket:
    def __init__(self):
        self.type = "MOVE"
        self.tickId = 0
        self.time = 0
        self.serverRealTimeMS = 0
        self.newPos = WorldPosData()
        self.records = []

    def write(self, writer):
        writer.writeInt32(self.tickId)
        writer.writeInt32(self.time)
        writer.writeUInt32(self.serverRealTimeMS)
        self.newPos.write(writer)
        writer.writeShort(len(self.records))
        for record in self.records:
            record.write(writer)

    def read(self, reader):
        self.tickId = reader.readInt32()
        self.time = reader.readInt32()
        self.serverRealTimeMS = reader.readUInt32()
        self.newPos.read(reader)
        recordLen = reader.readShort()
        for i in range(recordLen):
            record = MoveRecord()
            record.read(reader)
            self.records.append(record)
Пример #4
0
class GotoPacket:
    def __init__(self):
        self.type = "GOTO"
        self.objectId = 0
        self.position = WorldPosData()

    def read(self, reader):
        self.objectId = reader.readInt32()
        self.position.read(reader)
Пример #5
0
class AoeAckPacket:
    def __init__(self):
        self.type = "AOEACK"
        self.time = 0
        self.pos = WorldPosData()

    def write(self, writer):
        writer.writeInt32(self.time)
        self.pos.writeTo(writer)

    def read(self, reader):
        self.time = reader.readInt32()
        self.pos.read(reader)
Пример #6
0
class GroundDamagePacket:
    def __init__(self):
        self.type = "GROUNDDAMAGE"
        self.time = 0
        self.pos = WorldPosData()

    def write(self, writer):
        writer.writeInt32(self.time)
        self.pos.write(writer)

    def read(self, reader):
        self.time = reader.readInt32()
        self.pos.read(reader)
Пример #7
0
class ServerPlayerShootPacket:
    def __init__(self):
        self.type = "SERVERPLAYERSHOOT"
        self.bulletId = 0
        self.ownerId = 0
        self.containerType = 0
        self.startingPos = WorldPosData()
        self.angle = 0
        self.damage = 0

    def read(self, reader):
        self.bulletId = reader.readUnsignedByte()
        self.ownerId = reader.readInt32()
        self.containerType = reader.readInt32()
        self.startingPos.read(reader)
        self.angle = reader.readFloat()
        self.damage = reader.readShort()
Пример #8
0
class InvSwapPacket:
    def __init__(self):
        self.type = "INVSWAP"
        self.time = 0
        self.pos = WorldPosData()
        self.slotObject1 = SlotObjectData()
        self.slotObject2 = SlotObjectData()

    def write(self, writer):
        writer.writeInt32(self.time)
        self.pos.write(writer)
        self.slotObject1.write(writer)
        self.slotObject2.write(writer)

    def read(self, reader):
        self.time = reader.readInt32()
        self.pos.read(reader)
        self.slotObject1.read(reader)
        self.slotObject2.read(reader)
Пример #9
0
class UseItemPacket:
    def __init__(self):
        self.type = "USEITEM"
        self.time = 0
        self.slotObject = SlotObjectData()
        self.pos = WorldPosData()
        self.useType = 0

    def write(self, writer):
        writer.writeInt32(self.time)
        self.slotObject.write(writer)
        self.pos.write(writer)
        writer.writeByte(self.useType)

    def read(self, reader):
        self.time = reader.readInt32()
        self.slotObject.read(reader)
        self.pos.read(reader)
        self.useType = reader.readByte()
Пример #10
0
class AoePacket:
    def __init__(self):
        self.type = "AOE"
        self.pos = WorldPosData()
        self.radius = 0
        self.damage = 0
        self.effect = 0
        self.duration = 0
        self.origType = 0
        self.color = 0
        self.armorPierce = False

    def read(self, reader):
        self.pos.read(reader)
        self.radius = reader.readFloat()
        self.damage = reader.readUnsignedShort()
        self.effect = reader.readUnsignedByte()
        self.duration = reader.readFloat()
        self.origType = reader.readreadUnsignedShort()
        self.color = reader.readInt32()
        self.armorPierce = reader.readBool()