Skip to content

WarTelemetry is a library to provide WarThunder telemetry data

License

Notifications You must be signed in to change notification settings

lucasvmx/WarTelemetry

Repository files navigation

CodeFactor

War Telemetry

drawing

A simple library to get WarThunder data provided by the localhost server

Usage

Installation

go get -u github.com/lucasvmx/WarTelemetry/telemetry

Example (Remote host)

package main

import (
	"log"
	"time"

	"github.com/lucasvmx/WarTelemetry/logger"
	wartelemetry "github.com/lucasvmx/WarTelemetry/telemetry"
)

func main() {
	// Use this to collect data from remote computer
	wartelemetry.InitializeRemote("192.168.1.35")

	// Enable internal debug logging (disabled by default)
	logger.EnableDebug()

	for {

		data, err := wartelemetry.GetTelemetryData()
		if err != nil {
			log.Printf("failed to collect data: %v", err)
			time.Sleep(time.Second * 3)
			continue
		} else {
			log.Printf("Aircraft Name: %v", data.Indicators.AircraftName)
		}
	}
}

Example (Localhost)

package main

import (
	"log"
	"time"

	"github.com/lucasvmx/WarTelemetry/logger"
	wartelemetry "github.com/lucasvmx/WarTelemetry/telemetry"
)

func main() {
	// Use this for localhost
	wartelemetry.InitializeLocalHost()

	// Enable internal debug logging (disabled by default)
	logger.EnableDebug()

	for {

		data, err := wartelemetry.GetTelemetryData()
		if err != nil {
			log.Printf("failed to collect data: %v", err)
			time.Sleep(time.Second * 3)
			continue
		} else {
			log.Printf("Aircraft Name: %v", data.Indicators.AircraftName)
		}
	}
}

Build program

go build

Thanks