rplpa

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2024 License: MIT Imports: 11 Imported by: 4

README

rplpa

rplpa is an osu! replay parser/writer for golang.

Examples:

Reading the replay

package main

import (
  "ioutil"

  "github.com/wieku/rplpa"
)

func main() {
  b, err := ioutil.ReadFile("path/to/replay.osr")
  if err != nil {
    panic(err)
  }
  replay, err := ParseReplay(b)
  if err != nil {
    panic(err)
  }
}

Reading compressed input data

package main

import (
  "ioutil"

  "github.com/wieku/rplpa"
)

func main() {
  RawData := []byte{} // Compressed LZMA stream of input events in delta1|x1|y1|keys1,delta2|x2|y2|keys2 format
  replaydata, err := ParseCompressed(RawData)
  if err != nil {
    panic(err)
  }
}

Documentation

Index

Constants

View Source
const (
	OSU = iota
	TAIKO
	CTB
	MANIA
)

All osu playmodes

View Source
const (
	LEFTCLICK = 1 << iota
	RIGHTCLICK
	KEY1
	KEY2
	SMOKE
)

ClickState

Variables

This section is empty.

Functions

func SerializeFrames

func SerializeFrames(data []*ReplayData) ([]byte, error)

func WriteReplay

func WriteReplay(r *Replay) ([]byte, error)

Types

type KeyPressed

type KeyPressed struct {
	LeftClick  bool
	RightClick bool
	Key1       bool
	Key2       bool
	Smoke      bool
}

KeyPressed is the Parsed Compressed KeyPressed.

type LazerHitResult added in v1.0.1

type LazerHitResult string
const (
	LazerNone                LazerHitResult = "none"
	LazerMiss                LazerHitResult = "miss"
	LazerMeh                 LazerHitResult = "meh"
	LazerOk                  LazerHitResult = "ok"
	LazerGood                LazerHitResult = "good"
	LazerGreat               LazerHitResult = "great"
	LazerPerfect             LazerHitResult = "perfect"
	LazerSmallTickMiss       LazerHitResult = "small_tick_miss"
	LazerSmallTickHit        LazerHitResult = "small_tick_hit"
	LazerLargeTickMiss       LazerHitResult = "large_tick_miss"
	LazerLargeTickHit        LazerHitResult = "large_tick_hit"
	LazerSmallBonus          LazerHitResult = "small_bonus"
	LazerLargeBonus          LazerHitResult = "large_bonus"
	LazerIgnoreMiss          LazerHitResult = "ignore_miss"
	LazerIgnoreHit           LazerHitResult = "ignore_hit"
	LazerComboBreak          LazerHitResult = "combo_break"
	LazerSliderTailHit       LazerHitResult = "slider_tail_hit"
	LazerLegacyComboIncrease LazerHitResult = "legacy_combo_increase"
)

type LifeBarGraph

type LifeBarGraph struct {
	Time int32
	HP   float32
}

LifeBarGraph is the Bar under the Score stuff.

type ModInfo added in v1.0.1

type ModInfo struct {
	Acronym  string                 `json:"acronym"`
	Settings map[string]interface{} `json:"settings,omitempty"`
}

type Replay

type Replay struct {
	PlayMode     int8
	OsuVersion   int32
	BeatmapMD5   string
	Username     string
	ReplayMD5    string
	Count300     uint16
	Count100     uint16
	Count50      uint16
	CountGeki    uint16
	CountKatu    uint16
	CountMiss    uint16
	Score        int32
	MaxCombo     uint16
	Fullcombo    bool
	Mods         uint32
	LifebarGraph []LifeBarGraph
	Timestamp    time.Time
	ReplayData   []*ReplayData
	ScoreID      int64
	ScoreInfo    *ScoreInfo
}

Replay is the Parsed replay.

func NewReplay

func NewReplay() *Replay

NewReplay returns an Empty Replay

func ParseReplay

func ParseReplay(file []byte) (r *Replay, err error)

ParseReplay parses a Replay and returns a *Replay

type ReplayData

type ReplayData struct {
	Time       float64 // Lazer is converting timestamps to int, but preparing just in case
	MouseX     float64
	MouseY     float64
	KeyPressed *KeyPressed
}

ReplayData is the Parsed Compressed Replay data.

func ParseCompressed

func ParseCompressed(file []byte) (d []*ReplayData, err error)

ParseCompressed parses a compressed replay, (ReplayData)

type ScoreInfo added in v1.0.1

type ScoreInfo struct {
	ScoreId           int64                    `json:"online_id"`
	Mods              []*ModInfo               `json:"mods"`
	Statistics        map[LazerHitResult]int64 `json:"statistics"`
	MaximumStatistics map[LazerHitResult]int64 `json:"maximum_statistics"`
}

func ParseCompressedScoreInfo added in v1.0.1

func ParseCompressedScoreInfo(file []byte) (ScoreInfo, error)

ParseCompressedScoreInfo parses compressed ScoreInfo, (ScoreInfo)

Jump to

Keyboard shortcuts

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