CheckRateCustomRankingCounter

This commit is contained in:
Jonathan Barrow
2021-10-01 22:08:21 -04:00
parent e79ccad8c4
commit 7062297bb5
2 changed files with 45 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
package main
import (
"fmt"
nex "github.com/PretendoNetwork/nex-go"
nexproto "github.com/PretendoNetwork/nex-protocols-go"
)
func checkRateCustomRankingCounter(err error, client *nex.Client, callID uint32, applicationID uint32) {
var isBelowThreshold uint8
switch applicationID {
case 0: // Unknown?
isBelowThreshold = 1
default:
fmt.Printf("[Warning] DataStoreSMMProtocol::CheckRateCustomRankingCounter Unsupported applicationID: %v\n", applicationID)
}
rmcResponseStream := nex.NewStreamOut(nexServer)
rmcResponseStream.WriteUInt8(isBelowThreshold)
rmcResponseBody := rmcResponseStream.Bytes()
rmcResponse := nex.NewRMCResponse(nexproto.DataStoreSMMProtocolID, callID)
rmcResponse.SetSuccess(nexproto.DataStoreSMMMethodCheckRateCustomRankingCounter, rmcResponseBody)
rmcResponseBytes := rmcResponse.Bytes()
responsePacket, _ := nex.NewPacketV1(client, nil)
responsePacket.SetVersion(1)
responsePacket.SetSource(0xA1)
responsePacket.SetDestination(0xAF)
responsePacket.SetType(nex.DataPacket)
responsePacket.SetPayload(rmcResponseBytes)
responsePacket.AddFlag(nex.FlagNeedsAck)
responsePacket.AddFlag(nex.FlagReliable)
nexServer.Send(responsePacket)
}

View File

@@ -82,6 +82,7 @@ func main() {
dataStoreSmmServer.GetCourseRecord(getCourseRecord)
dataStoreSmmServer.GetApplicationConfigString(getApplicationConfigString)
dataStoreSmmServer.GetMetasWithCourseRecord(getMetasWithCourseRecord)
dataStoreSmmServer.CheckRateCustomRankingCounter(checkRateCustomRankingCounter)
dataStoreSmmServer.CTRPickUpCourseSearchObject(ctrPickUpCourseSearchObject)
messageDeliveryServer.DeliverMessage(deliverMessage)