From 6e49071a09ca9603d141fb0f1189cfe04ae2c325 Mon Sep 17 00:00:00 2001 From: Maple Nebel Date: Tue, 4 Aug 2026 16:04:46 +0200 Subject: [PATCH] fix: adjust code style --- nex/ranking/database/get_vote_and_win_count.go | 14 +++++++------- .../database/store_user_match_result.go | 2 +- nex/ranking/database/store_user_score.go | 2 +- nex/ranking/get_competition_ranking_score.go | 10 +++++----- .../types/competition_ranking_get_param.go | 16 ++++++++-------- .../types/competition_ranking_score_info.go | 4 ++-- .../competition_ranking_upload_score_param.go | 18 +++++++++--------- .../upload_competition_ranking_score.go | 4 +++- 8 files changed, 36 insertions(+), 34 deletions(-) diff --git a/nex/ranking/database/get_vote_and_win_count.go b/nex/ranking/database/get_vote_and_win_count.go index 6be9118..27c6c67 100644 --- a/nex/ranking/database/get_vote_and_win_count.go +++ b/nex/ranking/database/get_vote_and_win_count.go @@ -31,16 +31,16 @@ func GetVoteAndWinCount(splatfestID uint32) (types.List[types.UInt32], types.Lis if row.Err() != nil { return types.NewList[types.UInt32](), types.NewList[types.UInt32](), row.Err() } - var alpha_team_votes uint32 - var bravo_team_votes uint32 - var alpha_team_wins uint32 - var bravo_team_wins uint32 + var alphaTeamVotes uint32 + var bravoTeamVotes uint32 + var alphaTeamWins uint32 + var bravoTeamWins uint32 - err := row.Scan(&alpha_team_votes, &bravo_team_votes, &alpha_team_wins, &bravo_team_wins) + err := row.Scan(&alphaTeamVotes, &bravoTeamVotes, &alphaTeamWins, &bravoTeamWins) if err != nil { return types.NewList[types.UInt32](), types.NewList[types.UInt32](), err } - return types.List[types.UInt32]{types.NewUInt32(alpha_team_votes), types.NewUInt32(bravo_team_votes)}, - types.List[types.UInt32]{types.NewUInt32(alpha_team_wins), types.NewUInt32(bravo_team_wins)}, nil + return types.List[types.UInt32]{types.NewUInt32(alphaTeamVotes), types.NewUInt32(bravoTeamVotes)}, + types.List[types.UInt32]{types.NewUInt32(alphaTeamWins), types.NewUInt32(bravoTeamWins)}, nil } diff --git a/nex/ranking/database/store_user_match_result.go b/nex/ranking/database/store_user_match_result.go index 5cf1f3d..bc800d3 100644 --- a/nex/ranking/database/store_user_match_result.go +++ b/nex/ranking/database/store_user_match_result.go @@ -16,7 +16,7 @@ func StoreUserMatchResult(userPID types.PID, data ranking_splatoon_types.Competi team_id, team_score ) VALUES ($1, $2, $3, $4, $5) - `, int64(userPID), int64(data.SplatfestId), int64(data.Score), int16(data.TeamID), int64(data.TeamScore)) + `, int64(userPID), int64(data.SplatfestID), int64(data.Score), int16(data.TeamID), int64(data.TeamScore)) if err != nil { return err diff --git a/nex/ranking/database/store_user_score.go b/nex/ranking/database/store_user_score.go index c9c215a..4b4ed23 100644 --- a/nex/ranking/database/store_user_score.go +++ b/nex/ranking/database/store_user_score.go @@ -24,7 +24,7 @@ func StoreUserScore(userPID types.PID, data ranking_splatoon_types.CompetitionRa last_updated = EXCLUDED.last_updated team_id = EXCLUDED.team_id app_data = EXCLUDED.app_data - `, int64(userPID), int64(data.SplatfestId), int64(data.Score), int16(data.TeamId), int64(time), ([]byte)(data.AppData)) + `, int64(userPID), int64(data.SplatfestID), int64(data.Score), int16(data.TeamID), int64(time), ([]byte)(data.AppData)) if err != nil { return err diff --git a/nex/ranking/get_competition_ranking_score.go b/nex/ranking/get_competition_ranking_score.go index 49893dd..021050b 100644 --- a/nex/ranking/get_competition_ranking_score.go +++ b/nex/ranking/get_competition_ranking_score.go @@ -16,14 +16,14 @@ func GetSingleCompetitionRankingScore(splatfestID uint32) (ranking_splatoon_type info.FestID = types.UInt32(splatfestID) - team_wins, team_votes, err := database.GetVoteAndWinCount(splatfestID) + teamWins, teamVotes, err := database.GetVoteAndWinCount(splatfestID) if err != nil { return info, err } - info.TeamWins = types.List[types.UInt32](team_wins) - info.TeamVotes = types.List[types.UInt32](team_votes) + info.TeamWins = types.List[types.UInt32](teamWins) + info.TeamVotes = types.List[types.UInt32](teamVotes) var scoreDataEntries []ranking_splatoon_types.CompetitionRankingScoreData scoreDataEntries, err = database.GetScoreDataEntries(splatfestID) @@ -52,11 +52,11 @@ func GetCompetitionRankingScore(err error, packet nex.PacketInterface, callID ui retVal := types.NewList[ranking_splatoon_types.CompetitionRankingScoreInfo]() - if uint32(params.ResultRange.Offset) >= uint32(len(params.FestivalIds)) { + if uint32(params.ResultRange.Offset) >= uint32(len(params.FestivalIDs)) { return nil, nex.NewError(nex.ResultCodes.Core.InvalidArgument, "out of resultrange is out of bounds") } - festId := params.FestivalIds[uint32(params.ResultRange.Offset)] + festId := params.FestivalIDs[uint32(params.ResultRange.Offset)] info, err := GetSingleCompetitionRankingScore(uint32(festId)) if err != nil { return nil, nex.NewError(nex.ResultCodes.Core.Exception, "error retrieving ranking scores") diff --git a/nex/ranking/types/competition_ranking_get_param.go b/nex/ranking/types/competition_ranking_get_param.go index a462532..0369308 100644 --- a/nex/ranking/types/competition_ranking_get_param.go +++ b/nex/ranking/types/competition_ranking_get_param.go @@ -13,7 +13,7 @@ type CompetitionRankingGetParam struct { types.Structure Unknown types.UInt32 ResultRange types.ResultRange - FestivalIds types.List[types.UInt32] + FestivalIDs types.List[types.UInt32] } // WriteTo writes the CompetitionRankingGetParam to the given writable @@ -22,7 +22,7 @@ func (crgp CompetitionRankingGetParam) WriteTo(writable types.Writable) { crgp.Unknown.WriteTo(contentWritable) crgp.ResultRange.WriteTo(contentWritable) - crgp.FestivalIds.WriteTo(contentWritable) + crgp.FestivalIDs.WriteTo(contentWritable) content := contentWritable.Bytes() @@ -45,8 +45,8 @@ func (crgp CompetitionRankingGetParam) ExtractFrom(readable types.Readable) erro return fmt.Errorf("failed to extract CompetitionRankingGetParam.ResultRange. %s", err.Error()) } - if err := crgp.FestivalIds.ExtractFrom(readable); err != nil { - return fmt.Errorf("failed to extract CompetitionRankingGetParam.FestivalIds. %s", err.Error()) + if err := crgp.FestivalIDs.ExtractFrom(readable); err != nil { + return fmt.Errorf("failed to extract CompetitionRankingGetParam.FestivalIDs. %s", err.Error()) } return nil @@ -59,7 +59,7 @@ func (crgp CompetitionRankingGetParam) Copy() types.RVType { copied.StructureVersion = crgp.StructureVersion copied.Unknown = crgp.Unknown.Copy().(types.UInt32) copied.ResultRange = crgp.Copy().(types.ResultRange) - copied.FestivalIds = crgp.FestivalIds.Copy().(types.List[types.UInt32]) + copied.FestivalIDs = crgp.FestivalIDs.Copy().(types.List[types.UInt32]) return copied } @@ -84,7 +84,7 @@ func (crgp CompetitionRankingGetParam) Equals(o types.RVType) bool { return false } - return crgp.FestivalIds.Equals(other.FestivalIds) + return crgp.FestivalIDs.Equals(other.FestivalIDs) } // CopyRef copies the current value of the CompetitionRankingGetParam @@ -116,7 +116,7 @@ func (crgp CompetitionRankingGetParam) FormatToString(indentationLevel int) stri b.WriteString("CompetitionRankingGetParam{\n") fmt.Fprintf(&b, "%sUnknown: %s,\n", indentationValues, crgp.Unknown) fmt.Fprintf(&b, "%sResultRange: %s,\n", indentationValues, crgp.ResultRange) - fmt.Fprintf(&b, "%sFestivalIds: %s,\n", indentationValues, crgp.FestivalIds) + fmt.Fprintf(&b, "%sFestivalIDs: %s,\n", indentationValues, crgp.FestivalIDs) fmt.Fprintf(&b, "%s}", indentationEnd) return b.String() @@ -128,7 +128,7 @@ func NewCompetitionRankingGetParam() CompetitionRankingGetParam { Structure: types.Structure{StructureVersion: 1}, Unknown: types.NewUInt32(0), ResultRange: types.NewResultRange(), - FestivalIds: types.NewList[types.UInt32](), + FestivalIDs: types.NewList[types.UInt32](), } } diff --git a/nex/ranking/types/competition_ranking_score_info.go b/nex/ranking/types/competition_ranking_score_info.go index 64c86dc..8cebc21 100644 --- a/nex/ranking/types/competition_ranking_score_info.go +++ b/nex/ranking/types/competition_ranking_score_info.go @@ -42,7 +42,7 @@ func (crsi CompetitionRankingScoreInfo) ExtractFrom(readable types.Readable) err } if err := crsi.FestID.ExtractFrom(readable); err != nil { - return fmt.Errorf("failed to extract CompetitionRankingScoreInfo.FestId. %s", err.Error()) + return fmt.Errorf("failed to extract CompetitionRankingScoreInfo.FestID. %s", err.Error()) } if err := crsi.ScoreData.ExtractFrom(readable); err != nil { @@ -140,7 +140,7 @@ func (crsi CompetitionRankingScoreInfo) FormatToString(indentationLevel int) str var b strings.Builder b.WriteString("CompetitionRankingScoreInfo{\n") - fmt.Fprintf(&b, "%sFestId: %s,\n", indentationValues, crsi.FestID) + fmt.Fprintf(&b, "%sFestID: %s,\n", indentationValues, crsi.FestID) fmt.Fprintf(&b, "%sScoreData: %s,\n", indentationValues, crsi.ScoreData) fmt.Fprintf(&b, "%sUnknown: %s,\n", indentationValues, crsi.Unknown) fmt.Fprintf(&b, "%sTeamWins: %s,\n", indentationValues, crsi.TeamWins) diff --git a/nex/ranking/types/competition_ranking_upload_score_param.go b/nex/ranking/types/competition_ranking_upload_score_param.go index 60dfa98..1542e28 100644 --- a/nex/ranking/types/competition_ranking_upload_score_param.go +++ b/nex/ranking/types/competition_ranking_upload_score_param.go @@ -12,7 +12,7 @@ import ( type CompetitionRankingUploadScoreParam struct { types.Structure Unknown1 types.UInt32 - SplatfestId types.UInt32 + SplatfestID types.UInt32 Unknown2 types.UInt32 Score types.UInt32 TeamID types.UInt8 @@ -26,7 +26,7 @@ func (crusp CompetitionRankingUploadScoreParam) WriteTo(writable types.Writable) contentWritable := writable.CopyNew() crusp.Unknown1.WriteTo(contentWritable) - crusp.SplatfestId.WriteTo(contentWritable) + crusp.SplatfestID.WriteTo(contentWritable) crusp.Unknown2.WriteTo(contentWritable) crusp.Score.WriteTo(contentWritable) crusp.TeamID.WriteTo(contentWritable) @@ -50,7 +50,7 @@ func (crusp CompetitionRankingUploadScoreParam) ExtractFrom(readable types.Reada if err := crusp.Unknown1.ExtractFrom(readable); err != nil { return fmt.Errorf("failed to extract CompetitionRankingUploadScoreParam.Unknown1. %s", err.Error()) } - if err := crusp.SplatfestId.ExtractFrom(readable); err != nil { + if err := crusp.SplatfestID.ExtractFrom(readable); err != nil { return fmt.Errorf("failed to extract CompetitionRankingUploadScoreParam.SplatfestId. %s", err.Error()) } if err := crusp.Unknown2.ExtractFrom(readable); err != nil { @@ -60,7 +60,7 @@ func (crusp CompetitionRankingUploadScoreParam) ExtractFrom(readable types.Reada return fmt.Errorf("failed to extract CompetitionRankingUploadScoreParam.Score. %s", err.Error()) } if err := crusp.TeamID.ExtractFrom(readable); err != nil { - return fmt.Errorf("failed to extract CompetitionRankingUploadScoreParam.TeamId. %s", err.Error()) + return fmt.Errorf("failed to extract CompetitionRankingUploadScoreParam.TeamID. %s", err.Error()) } if err := crusp.TeamScore.ExtractFrom(readable); err != nil { return fmt.Errorf("failed to extract CompetitionRankingUploadScoreParam.TeamWin. %s", err.Error()) @@ -81,7 +81,7 @@ func (crusp CompetitionRankingUploadScoreParam) Copy() types.RVType { copied.StructureVersion = crusp.StructureVersion copied.Unknown1 = crusp.Unknown1.Copy().(types.UInt32) - copied.SplatfestId = crusp.SplatfestId.Copy().(types.UInt32) + copied.SplatfestID = crusp.SplatfestID.Copy().(types.UInt32) copied.Unknown2 = crusp.Unknown2.Copy().(types.UInt32) copied.Score = crusp.Score.Copy().(types.UInt32) copied.TeamID = crusp.TeamID.Copy().(types.UInt8) @@ -107,7 +107,7 @@ func (crusp CompetitionRankingUploadScoreParam) Equals(o types.RVType) bool { if !crusp.Unknown1.Equals(other.Unknown1) { return false } - if !crusp.SplatfestId.Equals(other.SplatfestId) { + if !crusp.SplatfestID.Equals(other.SplatfestID) { return false } if !crusp.Unknown2.Equals(other.Unknown2) { @@ -157,10 +157,10 @@ func (crusp CompetitionRankingUploadScoreParam) FormatToString(indentationLevel b.WriteString("CompetitionRankingUploadScoreParam{\n") fmt.Fprintf(&b, "%sUnknown1: %s,\n", indentationValues, crusp.Unknown1) - fmt.Fprintf(&b, "%sSplatfestId: %s,\n", indentationValues, crusp.SplatfestId) + fmt.Fprintf(&b, "%sSplatfestID: %s,\n", indentationValues, crusp.SplatfestID) fmt.Fprintf(&b, "%sUnknown2: %s,\n", indentationValues, crusp.Unknown2) fmt.Fprintf(&b, "%sScore: %s,\n", indentationValues, crusp.Score) - fmt.Fprintf(&b, "%sTeamId: %s,\n", indentationValues, crusp.TeamID) + fmt.Fprintf(&b, "%sTeamID: %s,\n", indentationValues, crusp.TeamID) fmt.Fprintf(&b, "%TeamScore: %s,\n", indentationValues, crusp.TeamScore) fmt.Fprintf(&b, "%sIsFirstUpload: %s,\n", indentationValues, crusp.IsFirstUpload) fmt.Fprintf(&b, "%sAppData: %s,\n", indentationValues, crusp.AppData) @@ -173,7 +173,7 @@ func (crusp CompetitionRankingUploadScoreParam) FormatToString(indentationLevel func NewCompetitionRankingUploadScoreParam() CompetitionRankingUploadScoreParam { return CompetitionRankingUploadScoreParam{ Unknown1: types.NewUInt32(0), - SplatfestId: types.NewUInt32(0), + SplatfestID: types.NewUInt32(0), Unknown2: types.NewUInt32(0), Score: types.NewUInt32(0), TeamID: types.NewUInt8(0), diff --git a/nex/ranking/upload_competition_ranking_score.go b/nex/ranking/upload_competition_ranking_score.go index 885707f..461c414 100644 --- a/nex/ranking/upload_competition_ranking_score.go +++ b/nex/ranking/upload_competition_ranking_score.go @@ -28,7 +28,9 @@ func UploadCompetitionRankingScore(err error, packet nex.PacketInterface, callID database.StoreUserMatchResult(packet.Sender().PID(), params) database.StoreUserScore(packet.Sender().PID(), params) - types.NewBool(true).WriteTo(rmcResponseStream) + success := types.NewBool(true) + + success.WriteTo(rmcResponseStream) rmcResponse := nex.NewRMCSuccess(globals.SecureEndpoint, rmcResponseStream.Bytes()) rmcResponse.ProtocolID = ranking.ProtocolID