forked from PretendoNetwork/super-mario-maker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrate_objects.go
35 lines (24 loc) · 1.11 KB
/
rate_objects.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package main
import (
nex "github.com/PretendoNetwork/nex-go"
nexproto "github.com/PretendoNetwork/nex-protocols-go"
)
func rateObjects(err error, client *nex.Client, callID uint32, targets []*nexproto.DataStoreRatingTarget, params []*nexproto.DataStoreRateObjectParam, transactional bool, fetchRatings bool) {
rmcResponseStream := nex.NewStreamOut(nexServer)
// TODO complete this
rmcResponseStream.WriteUInt32LE(0x00000000) // pRatings List length 0
rmcResponseStream.WriteUInt32LE(0x00000000) // pResults List length 0
rmcResponseBody := rmcResponseStream.Bytes()
rmcResponse := nex.NewRMCResponse(nexproto.DataStoreSMMProtocolID, callID)
rmcResponse.SetSuccess(nexproto.DataStoreMethodRateObjects, 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)
}