matches

package
v0.0.0-...-6fa8ed0 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRoutes

func RegisterRoutes(
	r *gin.RouterGroup,
	service *MatchesService,
	memoryStore *persist.MemoryStore,
)

Types

type AggregatedPlayerStats

type AggregatedPlayerStats struct {
	UserId int `json:"user_id"`

	// in seconds
	PlayTime int `json:"play_time"`

	ShotsFired int `json:"shots_fired"`
	ShotsHit   int `json:"shots_hit"`
	ShotsHS    int `json:"shots_hs"`

	DoshEarned int `json:"dosh_earned"`

	HealsGiven    int `json:"heals_given"`
	HealsReceived int `json:"heals_recv"`

	DamageDealt int `json:"damage_dealt"`
	DamageTaken int `json:"damage_taken"`

	ZedTimeCount  int     `json:"zedtime_count"`
	ZedTimeLength float32 `json:"zedtime_length"`

	Kills      int `json:"kills"`
	LargeKills int `json:"large_kills"`
	HuskRages  int `json:"husk_r"`
}

type FilterMatchesRequest

type FilterMatchesRequest struct {
	ServerId []int               `json:"server_id"`
	MapId    []int               `json:"map_id"`
	Status   []models.GameStatus `json:"status"`

	Mode       *models.GameMode       `json:"mode"`
	Length     *models.GameLength     `json:"length"`
	Difficulty *models.GameDifficulty `json:"diff"`

	IncludeServer   *bool `json:"include_server"`
	IncludeMap      *bool `json:"include_map"`
	IncludeGameData *bool `json:"include_game_data"`
	IncludeCDData   *bool `json:"include_cd_data"`
	IncludePlayers  *bool `json:"include_players"`

	ReverseOrder *bool                    `json:"reverse_order"`
	Pager        models.PaginationRequest `json:"pager"`
}

type FilterMatchesResponse

type FilterMatchesResponse struct {
	Items    []*Match                  `json:"items"`
	Metadata models.PaginationResponse `json:"metadata"`
}

type GetLiveMatchesResponse

type GetLiveMatchesResponse struct {
	Items []Match `json:"items"`
}

type GetMatchAggregatedStatsResponse

type GetMatchAggregatedStatsResponse struct {
	Players []AggregatedPlayerStats `json:"players"`
}

type GetMatchLiveDataResponse

type GetMatchLiveDataResponse struct {
	Status models.GameStatus `json:"status"`

	GameData models.GameData    `json:"game_data"`
	CDData   *models.CDGameData `json:"cd_data"`

	Players    []*GetMatchLiveDataResponsePlayer `json:"players"`
	Spectators []*GetMatchLiveDataResponsePlayer `json:"spectators"`
}

type GetMatchLiveDataResponsePlayer

type GetMatchLiveDataResponsePlayer struct {
	Id   int    `json:"id"`
	Name string `json:"name"`

	ProfileUrl *string `json:"profile_url"`
	Avatar     *string `json:"avatar"`

	Perk     models.Perk `json:"perk"`
	Level    int         `json:"level"`
	Prestige int         `json:"prestige"`

	Health int `json:"health"`
	Armor  int `json:"armor"`

	AuthId      string          `json:"-"`
	AuthType    models.AuthType `json:"-"`
	IsSpectator bool            `json:"-"`
}

type GetMatchPlayerStatsResponse

type GetMatchPlayerStatsResponse struct {
	Waves []PlayerWaveStats `json:"waves"`
}

type GetMatchWaveStatsResponse

type GetMatchWaveStatsResponse struct {
	Players []PlayerWaveStats `json:"players"`
}

type GetMatchWavesResponse

type GetMatchWavesResponse struct {
	Waves []*MatchWave          `json:"waves"`
	Users []*models.UserProfile `json:"users"`
}

type Match

type Match struct {
	Session MatchSession `json:"session"`

	Map    *MatchMap    `json:"map"`
	Server *MatchServer `json:"server"`

	GameData *models.GameData   `json:"game_data"`
	CDData   *models.CDGameData `json:"cd_data"`

	Players    []*MatchPlayer `json:"players"`
	Spectators []*MatchPlayer `json:"spectators"`
}

type MatchMap

type MatchMap struct {
	Name    *string `json:"name"`
	Preview *string `json:"preview"`
}

type MatchPlayer

type MatchPlayer struct {
	Profile *models.UserProfile `json:"profile"`

	Perk     models.Perk `json:"perk"`
	Level    int         `json:"level"`
	Prestige int         `json:"prestige"`

	Health int `json:"health"`
	Armor  int `json:"armor"`
}

type MatchServer

type MatchServer struct {
	Name    *string `json:"name"`
	Address *string `json:"address"`
}

type MatchSession

type MatchSession struct {
	SessionId int `json:"session_id"`
	ServerId  int `json:"server_id"`
	MapId     int `json:"map_id"`

	Mode       models.GameMode       `json:"mode"`
	Length     int                   `json:"length"`
	Difficulty models.GameDifficulty `json:"diff"`

	Status models.GameStatus `json:"status"`

	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`

	StartedAt   *time.Time `json:"started_at"`
	CompletedAt *time.Time `json:"completed_at"`
}

type MatchWave

type MatchWave struct {
	WaveId int `json:"wave_id"`

	Wave    int `json:"wave"`
	Attempt int `json:"attempt"`

	Players []*MatchWavePlayer `json:"players"`

	StartedAt   *time.Time `json:"started_at"`
	CompletedAt *time.Time `json:"completed_at"`
}

type MatchWavePlayer

type MatchWavePlayer struct {
	UserId        int `json:"user_id"`
	PlayerStatsId int `json:"player_stats_id"`

	Perk     models.Perk `json:"perk"`
	Level    int         `json:"level"`
	Prestige int         `json:"prestige"`

	IsDead bool `json:"is_dead"`

	Stats *MatchWavePlayerStats `json:"stats"`
}

type MatchWavePlayerStats

type MatchWavePlayerStats struct {
	ShotsFired int `json:"shots_fired"`
	ShotsHit   int `json:"shots_hit"`
	ShotsHS    int `json:"shots_hs"`

	DoshEarned int `json:"dosh_earned"`

	HealsGiven    int `json:"heals_given"`
	HealsReceived int `json:"heals_recv"`

	DamageDealt int `json:"damage_dealt"`
	DamageTaken int `json:"damage_taken"`

	ZedTimeCount  int     `json:"zedtime_count"`
	ZedTimeLength float32 `json:"zedtime_length"`

	Kills stats.ZedCounter `json:"kills"`

	HuskBackpackKills int `json:"husk_b"`
	HuskRages         int `json:"husk_r"`
}

type MatchesService

type MatchesService struct {
	// contains filtered or unexported fields
}

func NewMatchesService

func NewMatchesService(db *sql.DB) *MatchesService

func (*MatchesService) Filter

func (*MatchesService) GetById

func (s *MatchesService) GetById(id int) (*Match, error)

func (*MatchesService) GetLastServerMatch

func (s *MatchesService) GetLastServerMatch(id int) (*Match, error)

func (*MatchesService) GetMatchAggregatedStats

func (s *MatchesService) GetMatchAggregatedStats(sessionId int) (*GetMatchAggregatedStatsResponse, error)

func (*MatchesService) GetMatchLiveData

func (s *MatchesService) GetMatchLiveData(sessionId int) (*GetMatchLiveDataResponse, error)

Deprecated, needs rework

func (*MatchesService) GetMatchPlayerStats

func (s *MatchesService) GetMatchPlayerStats(sessionId, userId int) (*GetMatchPlayerStatsResponse, error)

func (*MatchesService) GetMatchWaves

func (s *MatchesService) GetMatchWaves(sessionId int) (*GetMatchWavesResponse, error)

func (*MatchesService) Inject

func (s *MatchesService) Inject(
	userService *users.UserService,
	sessionService *session.SessionService,
	mapsService *maps.MapsService,
	serverService *server.ServerService,
	steamApiService *steamapi.SteamApiUserService,
)

type PlayerWaveStats

type PlayerWaveStats struct {
	PlayerStatsId int `json:"player_stats_id"`

	ShotsFired int `json:"shots_fired"`
	ShotsHit   int `json:"shots_hit"`
	ShotsHS    int `json:"shots_hs"`

	DoshEarned int `json:"dosh_earned"`

	HealsGiven    int `json:"heals_given"`
	HealsReceived int `json:"heals_recv"`

	DamageDealt int `json:"damage_dealt"`
	DamageTaken int `json:"damage_taken"`

	ZedTimeCount  int     `json:"zedtime_count"`
	ZedTimeLength float32 `json:"zedtime_length"`

	Kills stats.ZedCounter `json:"kills"`

	HuskBackpackKills int `json:"husk_b"`
	HuskRages         int `json:"husk_r"`
}

Jump to

Keyboard shortcuts

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