feat: store battles and bombings
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
package report
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type BattleReport struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
Turn uint `json:"turn"`
|
||||
Planet uint `json:"planet"`
|
||||
PlanetName string `json:"planet_name"`
|
||||
Races map[int]uuid.UUID `json:"races"`
|
||||
Ships map[int]BattleReportGroup `json:"ships"`
|
||||
Protocol []BattleActionReport `json:"protocol"`
|
||||
}
|
||||
|
||||
type BattleReportGroup struct {
|
||||
OwnerID uuid.UUID `json:"ownerId"`
|
||||
InBattle bool `json:"inBattle"`
|
||||
Number uint `json:"num"`
|
||||
NumberLeft uint `json:"numLeft"`
|
||||
ClassName string `json:"className"`
|
||||
LoadType string `json:"loadType"`
|
||||
LoadQuantity float64 `json:"loadQuantity"`
|
||||
Drive float64 `json:"drive"`
|
||||
Weapons float64 `json:"wwapons"`
|
||||
Shields float64 `json:"shields"`
|
||||
Cargo float64 `json:"cargo"`
|
||||
}
|
||||
|
||||
type BattleActionReport struct {
|
||||
Attacker int `json:"a"`
|
||||
AttackerShipClass int `json:"sa"`
|
||||
Defender int `json:"d"`
|
||||
DefenderShipClass int `json:"sd"`
|
||||
Destroyed bool `json:"x"`
|
||||
}
|
||||
|
||||
func (b BattleReport) MarshalBinary() (data []byte, err error) {
|
||||
return json.Marshal(&b)
|
||||
}
|
||||
|
||||
func (b *BattleReport) UnmarshalBinary(data []byte) error {
|
||||
return json.Unmarshal(data, b)
|
||||
}
|
||||
Reference in New Issue
Block a user