wotreplay

package module
v0.0.0-...-fca91f4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2023 License: MIT Imports: 13 Imported by: 0

README

WoTReplay

Build Status Go Report Card GoDoc

World of Tanks Replay Parser (written in Go)

This package is work in progress

Usage

command-line
$ wotreplay-parse [-out FILE] *.wotreplay

$ wotreplay-parse FILE.wotreplay | jq .
{
    "Date": "08.06.2017 04:52:35",
    "Map": "聖なる谷",
    "Gamemode": "1:Random",
    "Reason": "1:Extermination",
    "Tank": "ussr-R41_T-50",
    "Player": "kosh04",
    "Version": "World of Tanks v.0.9.19.0.1 #450"
}
Go code
import (
	"fmt"
	"github.com/kosh04/wotreplay"
)

r, err := wotreplay.ParseFile("FILE.wotreplay")
if err != nil {
	// ParseError
}
fmt.Println(r)

TODO

  • Define JSON data type of Matchstart, ButtleResult, etc
  • Analyze packet
  • Friendly command-line
  • wotrp2j.py compatible JSON
  • Enable parse of old replays

Similar Projects

License

MIT License

Documentation

Overview

Package wotreplay provides World_of_Tanks Replay Parser.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsReplayFile

func IsReplayFile(path string) bool

IsReplayFile ask PATH has ".wotreplay" extension

Types

type BattleResults

type BattleResults struct {
	Results  battleResults
	Vehicles map[vehicleID]vehicle
	Data     map[vehicleID]struct {
		Flags int `json:"flags"`
	}
}

BattleResults is block data about "Battle Result"

type MatchEnd

type MatchEnd struct{}

MatchEnd is block data aboud "Match End" (For version older than 0.8.1)

type MatchStart

type MatchStart struct {
	ClientVersionFromXML string                `json:"clientVersionFromXml"`
	ClientVersionFromExe string                `json:"clientVersionFromExe"`
	DateTime             string                `json:"dateTime"`
	MapDisplayName       string                `json:"mapDisplayName"`
	MapName              string                `json:"mapName"`
	GameplayID           string                `json:"gameplayID"` // assault,assault2,bootcamp,ctf,ctf30x30,domination(encounter),epic,fallout3,football,leviathan,sandbox
	HasMods              bool                  `json:"hasMods"`
	RegionCode           string                `json:"regionCode"`
	PlayerID             int                   `json:"playerID"`
	PlayerName           string                `json:"playerName"`
	PlayerVehicle        string                `json:"playerVehicle"`
	BattleType           battleType            `json:"battleType"`
	Vehicles             map[vehicleID]vehicle `json:"vehicles"`
	ServerName           string                `json:"serverName"`
	ServerSettings       struct {
		Roaming             []interface{} `json:"roaming"`
		SpgRedesignFeatures struct {
			StunEnabled           bool `json:"stunEnabled"`
			MarkTargetAreaEnabled bool `json:"markTargetAreaEnabled"`
		} `json:"spgRedesignFeatures"`
		IsPotapovQuestEnabled bool `json:"isPotapovQuestEnabled"`
	} `json:"serverSettings"`
}

MatchStart is block data about "Match Start"

type PacketReader

type PacketReader struct {
	Buffer  string
	Version string
	Title   string
	Pos     int
}

PacketReader is wotreplay packet reader https://github.com/evido/wotreplay-parser/blob/master/src/packet_reader_80.cpp

type Replay

type Replay struct {
	File struct {
		//Path   string
		Header struct {
			Magic      uint32
			BlockCount uint32
		}
		Blocks    []dataBlock // len(Blocks) == Header.BlockCount
		ReplayLen uint32
		XXX       [4]byte
		Replay    []byte // binary replay data. len(Replay) == ReplayLen
	}
	MatchStart    MatchStart
	MatchEnd      MatchEnd
	BattleResults BattleResults
	*log.Logger
}

Replay stores an entire battle in a replay file

func ParseFile

func ParseFile(filename string) (*Replay, error)

ParseFile decode wotreplay file from FILENAME

func (Replay) String

func (r Replay) String() string

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL