Beispiel #1
0
def create_entity_data():
    data = EntityData()
    data.appearance = AppearanceData()
    data.consumable = ItemData()
    data.equipment = []
    for _ in xrange(13):
        data.equipment.append(ItemData())
    return data
Beispiel #2
0
class PickupAction(Loader):
    def read(self, reader):
        self.entity_id = reader.read_uint64()  # player who picked up
        self.item_data = ItemData()
        self.item_data.read(reader)

    def write(self, writer):
        writer.write_uint64(self.entity_id)
        self.item_data.write(writer)
Beispiel #3
0
class PickupAction(Loader):
    def read(self, reader):
        self.entity_id = reader.read_uint64()
        self.item = ItemData()
        self.item.read(reader)

    def write(self, writer):
        writer.write_uint64(self.entity_id)
        self.item.write(writer)
Beispiel #4
0
class PickupAction(Loader):
    def read(self, reader):
        self.entity_id = reader.read_uint64() # player who picked up
        self.item_data = ItemData()
        self.item_data.read(reader)

    def write(self, writer):
        writer.write_uint64(self.entity_id)
        self.item_data.write(writer)
Beispiel #5
0
 def read(self, reader):
     self.item_data = ItemData()
     self.item_data.read(reader)
     self.pos = reader.read_qvec3()
     self.rotation = reader.read_float()  # angle something
     self.scale = reader.read_float()
     self.something3 = reader.read_uint8()
     reader.skip(3)
     self.drop_time = reader.read_uint32()  # drop time
     self.something5 = reader.read_uint32()  # 320
     self.something6 = reader.read_int32()  # 324
Beispiel #6
0
 def read(self, reader):
     self.item_data = ItemData()
     self.item_data.read(reader)
     self.chunk_x = reader.read_int32()
     self.chunk_y = reader.read_int32()
     # index of item in ChunkItems
     self.item_index = reader.read_int32()
     self.something4 = reader.read_uint32()
     self.interact_type = reader.read_uint8()
     self.something6 = reader.read_uint8()
     self.something7 = reader.read_uint16()
Beispiel #7
0
 def read(self, reader):
     self.item_data = ItemData()
     self.item_data.read(reader)
     self.pos = reader.read_qvec3()
     self.rotation = reader.read_float() # angle something
     self.scale = reader.read_float()
     self.something3 = reader.read_uint8()
     reader.skip(3)
     self.drop_time = reader.read_uint32() # drop time
     self.something5 = reader.read_uint32() # 320
     self.something6 = reader.read_int32() # 324
Beispiel #8
0
 def read(self, reader):
     self.equipment = ItemData()
     self.equipment.read(reader)
     self.chunk_x = reader.read_int32()
     self.chunk_y = reader.read_int32()
     self.something3 = reader.read_int32()
     #
     self.something4 = reader.read_uint32()
     self.interact_type = reader.read_uint8()
     self.something6 = reader.read_uint8()
     self.something7 = reader.read_uint16()
Beispiel #9
0
 def read(self, reader):
     self.item_data = ItemData()
     self.item_data.read(reader)
     self.vec = reader.read_qvec3()
     self.something = reader.read_float() # angle something
     self.something2 = reader.read_float()
     self.something3 = reader.read_uint8()
     reader.skip(3)
     self.something4 = reader.read_uint32() # 316
     self.something5 = reader.read_uint32() # 320
     self.something6 = reader.read_int32() # 324
Beispiel #10
0
class InteractPacket(Packet):
    def read(self, reader):
        self.item_data = ItemData()
        self.item_data.read(reader)
        self.chunk_x = reader.read_int32()
        self.chunk_y = reader.read_int32()
        # index of item in ChunkItems
        self.item_index = reader.read_int32()
        self.something4 = reader.read_uint32()
        self.interact_type = reader.read_uint8()
        self.something6 = reader.read_uint8()
        self.something7 = reader.read_uint16()

    def write(self, writer):
        self.item_data.write(writer)
        writer.write_int32(self.chunk_x)
        writer.write_int32(self.chunk_y)
        writer.write_int32(self.item_index)
        writer.write_uint32(self.something4)
        writer.write_uint8(self.interact_type)
        writer.write_uint8(self.something6)
        writer.write_uint16(self.something7)
Beispiel #11
0
class ChunkItemData(Loader):
    def read(self, reader):
        self.item_data = ItemData()
        self.item_data.read(reader)
        self.pos = reader.read_qvec3()
        self.rotation = reader.read_float() # angle something
        self.scale = reader.read_float()
        self.something3 = reader.read_uint8()
        reader.skip(3)
        self.drop_time = reader.read_uint32() # drop time
        self.something5 = reader.read_uint32() # 320
        self.something6 = reader.read_int32() # 324

    def write(self, writer):
        self.item_data.write(writer)
        writer.write_qvec3(self.pos)
        writer.write_float(self.rotation)
        writer.write_float(self.scale)
        writer.write_uint8(self.something3)
        writer.pad(3)
        writer.write_uint32(self.drop_time)
        writer.write_uint32(self.something5)
        writer.write_int32(self.something6)
Beispiel #12
0
class ChunkItemData(Loader):
    def read(self, reader):
        self.item_data = ItemData()
        self.item_data.read(reader)
        self.pos = reader.read_qvec3()
        self.rotation = reader.read_float()  # angle something
        self.scale = reader.read_float()
        self.something3 = reader.read_uint8()
        reader.skip(3)
        self.drop_time = reader.read_uint32()  # drop time
        self.something5 = reader.read_uint32()  # 320
        self.something6 = reader.read_int32()  # 324

    def write(self, writer):
        self.item_data.write(writer)
        writer.write_qvec3(self.pos)
        writer.write_float(self.rotation)
        writer.write_float(self.scale)
        writer.write_uint8(self.something3)
        writer.pad(3)
        writer.write_uint32(self.drop_time)
        writer.write_uint32(self.something5)
        writer.write_int32(self.something6)
Beispiel #13
0
class InteractPacket(Packet):
    def read(self, reader):
        self.equipment = ItemData()
        self.equipment.read(reader)
        self.chunk_x = reader.read_int32()
        self.chunk_y = reader.read_int32()
        self.something3 = reader.read_int32()
        #
        self.something4 = reader.read_uint32()
        self.interact_type = reader.read_uint8()
        self.something6 = reader.read_uint8()
        self.something7 = reader.read_uint16()
        # print vars(self)

    def write(self, writer):
        self.equipment.write(writer)
        writer.write_int32(self.chunk_x)
        writer.write_int32(self.chunk_y)
        writer.write_int32(self.something3)
        writer.write_uint32(self.something4)
        writer.write_uint8(self.interact_type)
        writer.write_uint8(self.something6)
        writer.write_uint16(self.something7)
Beispiel #14
0
class EntitySubAction(Loader):
    def read(self, reader):
        self.item_data = ItemData()
        self.item_data.read(reader)
        self.vec = reader.read_qvec3()
        self.something = reader.read_float() # angle something
        self.something2 = reader.read_float()
        self.something3 = reader.read_uint8()
        reader.skip(3)
        self.something4 = reader.read_uint32() # 316
        self.something5 = reader.read_uint32() # 320
        self.something6 = reader.read_int32() # 324
        # print vars(self)

    def write(self, writer):
        self.item_data.write(writer)
        writer.write_qvec3(self.vec)
        writer.write_float(self.something)
        writer.write_float(self.something2)
        writer.write_uint8(self.something3)
        writer.pad(3)
        writer.write_uint32(self.something4)
        writer.write_uint32(self.something5)
        writer.write_int32(self.something6)
Beispiel #15
0
 def read(self, reader):
     self.entity_id = reader.read_uint64() # player who picked up
     self.item_data = ItemData()
     self.item_data.read(reader)
Beispiel #16
0
def create_item_data():
    item_data = ItemData()
    item_data.type = 0
    item_data.sub_type = 0
    item_data.modifier = 0
    item_data.minus_modifier = 0
    item_data.rarity = 0
    item_data.material = 0
    item_data.flags = 0
    item_data.level = 0
    item_data.items = []
    for _ in range(32):
        new_item = ItemUpgrade()
        new_item.x = 0
        new_item.y = 0
        new_item.z = 0
        new_item.material = 0
        new_item.level = 0
        item_data.items.append(new_item)
    item_data.upgrade_count = 0
    return item_data
Beispiel #17
0
 def read(self, reader):
     self.entity_id = reader.read_uint64()  # player who picked up
     self.item_data = ItemData()
     self.item_data.read(reader)
Beispiel #18
0
 def read(self, reader):
     self.entity_id = reader.read_uint64()
     self.item = ItemData()
     self.item.read(reader)
Beispiel #19
0
 def __get_loot_item(self, player):
     """Gets a loot item for a specified player.
     
     Keyword arguments:
     player -- The player to get a loot item for.
     
     Return value:
     An ItemData instance describing the item.
     
     """
     l = self.__loot
     item = ItemData()
     item.minus_modifier = 0
     item.flags = 0
     item.items = []
     for _ in range(32):
         item.items.append(ItemUpgrade())
     item.upgrade_count = 0
     if l >= LOOT_COMMON and l <= LOOT_LEGENDARY:
         item.type = random.randint(ITEM_TYPE_WEAPON,
             ITEM_TYPE_RING)
         item.sub_type = self.__get_sub_type(item.type, player)
         item.modifier = random.randint(1, 10)
         item.rarity = l
         item.material = self.__get_material(item.type,
             item.sub_type, player)
         item.level = player.entity.level
     elif l >= LOOT_SPIRIT_FIRE and l <= LOOT_SPIRIT_WIND:
         item.type = ITEM_TYPE_SPIRIT
         item.sub_type = ITEM_SUB_TYPE_SPIRIT
         item.modifier = 0
         item.rarity = ITEM_RARITY_RARE
         # 128: Fire, 129: Unholy, 130: Ice, 131: Wind
         item.material = 123 + l
         item.level = player.entity.level
     else: # Mana Cube
         item.type = 25
         item.sub_type = 0
         item.modifier = 0
         item.rarity = 0
         item.material = 0
         item.level = 0
     return item