fix: adjust code style

This commit is contained in:
Maple Nebel
2026-08-04 16:04:46 +02:00
parent ec414108d5
commit 6e49071a09
8 changed files with 36 additions and 34 deletions

View File

@@ -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
}

View File

@@ -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

View File

@@ -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

View File

@@ -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")

View File

@@ -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](),
}
}

View File

@@ -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)

View File

@@ -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),

View File

@@ -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