Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(secure): Mark Splatfest sessions as OpenParticipation #4

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions nex/register_common_secure_server_protocols.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package nex
import (
"github.com/PretendoNetwork/nex-go/v2"
"github.com/PretendoNetwork/nex-go/v2/types"
common_globals "github.com/PretendoNetwork/nex-protocols-common-go/v2/globals"
commonnattraversal "github.com/PretendoNetwork/nex-protocols-common-go/v2/nat-traversal"
commonsecure "github.com/PretendoNetwork/nex-protocols-common-go/v2/secure-connection"
nattraversal "github.com/PretendoNetwork/nex-protocols-go/v2/nat-traversal"
Expand All @@ -14,10 +15,12 @@ import (
commonmatchmaking "github.com/PretendoNetwork/nex-protocols-common-go/v2/match-making"
commonmatchmakingext "github.com/PretendoNetwork/nex-protocols-common-go/v2/match-making-ext"
commonmatchmakeextension "github.com/PretendoNetwork/nex-protocols-common-go/v2/matchmake-extension"
commonranking "github.com/PretendoNetwork/nex-protocols-common-go/v2/ranking"
matchmaking "github.com/PretendoNetwork/nex-protocols-go/v2/match-making"
matchmakingext "github.com/PretendoNetwork/nex-protocols-go/v2/match-making-ext"
matchmakingtypes "github.com/PretendoNetwork/nex-protocols-go/v2/match-making/types"
matchmakeextension "github.com/PretendoNetwork/nex-protocols-go/v2/matchmake-extension"
ranking "github.com/PretendoNetwork/nex-protocols-go/v2/ranking/splatoon"
)

func CreateReportDBRecord(_ *types.PID, _ *types.PrimitiveU32, _ *types.QBuffer) error {
Expand Down Expand Up @@ -106,6 +109,16 @@ func gameSpecificMatchmakeSessionSearchCriteriaChecksHandler(searchCriteria *mat
return true
}

func onAfterAutoMatchmakeWithParamPostpone(_ nex.PacketInterface, _ *matchmakingtypes.AutoMatchmakeParam) {
// * This is ugly but I can't work out a better way to do this
// * Set Splatfest rooms to open participation
for _, session := range common_globals.Sessions {
if session.GameMatchmakeSession != nil && session.GameMatchmakeSession.GameMode.Value == 12 {
session.GameMatchmakeSession.OpenParticipation.Value = true
}
}
}

func registerCommonSecureServerProtocols() {
secureProtocol := secure.NewProtocol()
globals.SecureEndpoint.RegisterServiceProtocol(secureProtocol)
Expand All @@ -130,4 +143,9 @@ func registerCommonSecureServerProtocols() {
commonMatchmakeExtensionProtocol := commonmatchmakeextension.NewCommonProtocol(matchmakeExtensionProtocol)
matchmakeExtensionProtocol.SetHandlerGetPlayingSession(stubGetPlayingSession)
commonMatchmakeExtensionProtocol.GameSpecificMatchmakeSessionSearchCriteriaChecks = gameSpecificMatchmakeSessionSearchCriteriaChecksHandler
commonMatchmakeExtensionProtocol.OnAfterAutoMatchmakeWithParamPostpone = onAfterAutoMatchmakeWithParamPostpone

rankingProtocol := ranking.NewProtocol(globals.SecureEndpoint)
globals.SecureEndpoint.RegisterServiceProtocol(rankingProtocol)
commonranking.NewCommonProtocol(rankingProtocol)
}