diff --git a/check_rate_custom_ranking_counter.go b/check_rate_custom_ranking_counter.go new file mode 100644 index 0000000..eec8d15 --- /dev/null +++ b/check_rate_custom_ranking_counter.go @@ -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) +} diff --git a/main.go b/main.go index d1e8776..1dcc749 100644 --- a/main.go +++ b/main.go @@ -82,6 +82,7 @@ func main() { dataStoreSmmServer.GetCourseRecord(getCourseRecord) dataStoreSmmServer.GetApplicationConfigString(getApplicationConfigString) dataStoreSmmServer.GetMetasWithCourseRecord(getMetasWithCourseRecord) + dataStoreSmmServer.CheckRateCustomRankingCounter(checkRateCustomRankingCounter) dataStoreSmmServer.CTRPickUpCourseSearchObject(ctrPickUpCourseSearchObject) messageDeliveryServer.DeliverMessage(deliverMessage)