Exemple #1
0
func readReplayTrackerEvents(mpqr *mpq.Reader) {
	r := mpqr.OpenFile("replay.tracker.events")

	for i := 0; i < 10000; i++ {
		te := &TrackerEvent{}
		var buf [3]byte
		_, err := r.Read(buf[:3])
		if err != nil {
			if err == io.EOF {
				return
			}
			panic(err)
		}
		if string(buf[:3]) != "\x03\x00\x09" &&
			string(buf[:3]) != "\x03\x02\x09" {
			panic(fmt.Errorf("unexpected event head %x", buf[:3]))
		}

		te.Frame = blizzval.ReadVarInt(r)

		_, err = r.Read(buf[:1])
		if err != nil {
			panic(err)
		}
		if string(buf[:1]) != "\x09" {
			panic("unexpected event trailer")
		}

		te.Type = TrackerEventType(blizzval.ReadVarInt(r))
		te.Val = blizzval.Read(r)
		log.Printf("%d %+v", i, te)
	}
}
Exemple #2
0
func readReplayDetails(r *mpq.Reader) {
	fr := r.OpenFile("replay.details")
	e := blizzval.Read(bufio.NewReader(fr))

	// printTrackerEvent(e, 0)
	// fmt.Printf("\n")

	d := readDetails(e)
	log.Printf("%#v", d)
	// for _, p := range d.Players {
	// 	log.Printf("%#v", p)
	// }
}