本文整理汇总了Python中cuwo.bytes.ByteReader.get_left方法的典型用法代码示例。如果您正苦于以下问题:Python ByteReader.get_left方法的具体用法?Python ByteReader.get_left怎么用?Python ByteReader.get_left使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cuwo.bytes.ByteReader
的用法示例。
在下文中一共展示了ByteReader.get_left方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_static_entities
# 需要导入模块: from cuwo.bytes import ByteReader [as 别名]
# 或者: from cuwo.bytes.ByteReader import get_left [as 别名]
def test_static_entities(self):
with open('./tests/tgen_static.dat', 'rb') as fp:
data = zlib.decompress(fp.read())
reader = ByteReader(data)
source = []
while reader.get_left() > 0:
entity = StaticEntityHeader()
entity.read(reader)
source.append(entity)
chunk = tgen.generate(32803, 32803)
self.assertEqual(len(chunk.static_entities), len(source))
for index, entity in enumerate(chunk.static_entities):
header1 = entity.header
header2 = source[index]
self.assertEqual(header1.entity_type, header2.entity_type)
self.assertEqual(header1.pos, header2.pos)
self.assertEqual(header1.orientation, header2.orientation)
self.assertEqual(header1.size, header2.size)
self.assertEqual(header1.closed, header2.closed)
self.assertEqual(header1.time_offset, header2.time_offset)
self.assertEqual(header1.something8, header2.something8)
self.assertEqual(header1.user_id, header2.user_id)
示例2: test_static_entities
# 需要导入模块: from cuwo.bytes import ByteReader [as 别名]
# 或者: from cuwo.bytes.ByteReader import get_left [as 别名]
def test_static_entities(self):
with open('./tests/tgen_static.dat', 'rb') as fp:
data = zlib.decompress(fp.read())
reader = ByteReader(data)
source = []
while reader.get_left() > 0:
entity = StaticEntityHeader()
entity.read(reader)
source.append(entity)
chunk = tgen.generate(32803, 32803)
self.assertEqual(len(chunk.static_entities), len(source))
for index, entity in enumerate(chunk.static_entities):
header1 = entity.header
header2 = source[index]
self.assertEqual(header1.entity_type, header2.entity_type)
self.assertEqual(header1.pos, header2.pos)
self.assertEqual(header1.orientation, header2.orientation)
self.assertEqual(header1.size, header2.size)
self.assertEqual(header1.closed, header2.closed)
self.assertEqual(header1.time_offset, header2.time_offset)
self.assertEqual(header1.something8, header2.something8)
self.assertEqual(header1.user_id, header2.user_id)
events = [
('generate', (1007, 4974)),
('generate', (1007, 4973)),
('generate', (1007, 4972)),
('generate', (1007, 4971)),
('destroy', (1007, 4973)),
('generate', (1007, 4970)),
('destroy', (1007, 4972)),
('generate', (1007, 4969))
]
chunks = {}
for (event, chunk) in events:
if event == 'generate':
chunks[chunk] = tgen.generate(*chunk)
elif event == 'destroy':
chunks[chunk].destroy()