Example #1
0
    def apply(self, peek):
        self.tick = peek.tick
        st, cb, rt = self.string_tables, self.class_bits, self.recv_tables
        st_ib = st['instancebaseline']

        packet = di.read(self.io, peek)
        p_io = io.BufferedReader(io.BytesIO(packet.data))
        index = pi.index(p_io)

        csvc_update_string_table_peeks = \
          index.find_all(pb_n.CSVCMsg_UpdateStringTable)
        all_csvc_update_string_table = \
          [pi.read(p_io, p) for p in csvc_update_string_table_peeks]

        for pbmsg in all_csvc_update_string_table:
            key = self.string_tables.keys()[pbmsg.table_id]
            _st = self.string_tables[key]

            bitstream = bs.construct(pbmsg.string_data)
            ne = pbmsg.num_changed_entries
            eb, sf, sb = _st.entry_bits, _st.size_fixed, _st.size_bits

            for entry in ust.unpack(bitstream, ne, eb, sf, sb):
                _st.update(entry)

        csvc_packet_entities = \
          pi.read(p_io, index.find(pb_n.CSVCMsg_PacketEntities))

        bitstream = bs.construct(csvc_packet_entities.entity_data)
        ct = csvc_packet_entities.updated_entries

        unpacker = uent.unpack(bitstream, -1, ct, False, cb, self.world)

        for index, mode, context in unpacker:
            if mode & PVS.Entering:
                cls, serial, diff = context

                if cls not in self._baseline_cache:
                    bitstream = bs.construct(
                        st['instancebaseline'].get(cls)[1])
                    unpacker = uent.unpack(bitstream, -1, 1, False, cb,
                                           self.world)

                    self._baseline_cache[cls] = unpacker.unpack_baseline(
                        rt[cls])

                state = dict(self._baseline_cache[cls])
                state.update(diff)

                self.world.create(cls, index, serial, state)
            elif mode & PVS.Deleting:
                self.world.delete(index)
            elif mode ^ PVS.Leaving:
                state = dict(self.world.find_index(index))
                state.update(context)

                self.world.update(index, state)

        return peek.tick, self.string_tables, self.world
Example #2
0
  def apply(self, peek):
    self.tick = peek.tick
    st, cb, rt = self.string_tables, self.class_bits, self.recv_tables
    st_ib = st['instancebaseline']

    packet = di.read(self.io, peek)
    p_io = io.BufferedReader(io.BytesIO(packet.data))
    index = pi.index(p_io)

    csvc_update_string_table_peeks = \
      index.find_all(pb_n.CSVCMsg_UpdateStringTable)
    all_csvc_update_string_table = \
      [pi.read(p_io, p) for p in csvc_update_string_table_peeks]

    for pbmsg in all_csvc_update_string_table:
      key = self.string_tables.keys()[pbmsg.table_id]
      _st = self.string_tables[key]

      bitstream = bs.construct(pbmsg.string_data)
      ne = pbmsg.num_changed_entries
      eb, sf, sb = _st.entry_bits, _st.size_fixed, _st.size_bits

      for entry in ust.unpack(bitstream, ne, eb, sf, sb):
        _st.update(entry)

    csvc_packet_entities = \
      pi.read(p_io, index.find(pb_n.CSVCMsg_PacketEntities))

    bitstream = bs.construct(csvc_packet_entities.entity_data)
    ct = csvc_packet_entities.updated_entries

    unpacker = uent.unpack(bitstream, -1, ct, False, cb, self.world)

    for index, mode, context in unpacker:
      if mode & PVS.Entering:
        cls, serial, diff = context

        if cls not in self._baseline_cache:
          bitstream = bs.construct(st['instancebaseline'].get(cls)[1])
          unpacker = uent.unpack(bitstream, -1, 1, False, cb, self.world)

          self._baseline_cache[cls] = unpacker.unpack_baseline(rt[cls])

        state = dict(self._baseline_cache[cls])
        state.update(diff)

        self.world.create(cls, index, serial, state)
      elif mode & PVS.Deleting:
        self.world.delete(index)
      elif mode ^ PVS.Leaving:
        state = dict(self.world.find_index(index))
        state.update(context)

        self.world.update(index, state)

    return peek.tick, self.string_tables, self.world
Example #3
0
def parse_cdemo_send_tables(pbmsg):
    send_tables = collections.OrderedDict()
    p_io = io.BufferedReader(io.BytesIO(pbmsg.data))

    for peek in pi.index(p_io):
        csvc_create_send_table = pi.read(p_io, peek)

        if csvc_create_send_table.is_end:
            break

        send_table = dt_send.parse(csvc_create_send_table)
        send_tables[send_table.dt] = send_table

    return send_tables
Example #4
0
def parse_cdemo_send_tables(pbmsg):
  send_tables = collections.OrderedDict()
  p_io = io.BufferedReader(io.BytesIO(pbmsg.data))

  for peek in pi.index(p_io):
    csvc_create_send_table = pi.read(p_io, peek)

    if csvc_create_send_table.is_end:
      break

    send_table = dt_send.parse(csvc_create_send_table)
    send_tables[send_table.dt] = send_table

  return send_tables