forked from PretendoNetwork/super-mario-maker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rate_custom_ranking.go
109 lines (93 loc) · 3.04 KB
/
rate_custom_ranking.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package main
import (
nex "github.com/PretendoNetwork/nex-go"
nexproto "github.com/PretendoNetwork/nex-protocols-go"
)
func rateCustomRanking(err error, client *nex.Client, callID uint32, params []*nexproto.DataStoreRateCustomRankingParam) {
/*
This has to change. We need to figure out what DataStoreRateCustomRankingParam.applicationId means.
This method sends a set number of DataStoreRateCustomRankingParam's in the params list depending
on what action the user does.
- Course upload: 4 params
- DataStoreRateCustomRankingParam.dataId is always the course ID
- DataStoreRateCustomRankingParam.score is always 0
- DataStoreRateCustomRankingParam.period is always 36500
- DataStoreRateCustomRankingParam.applicationId is:
- 0 (seen in other requests relating to Mii data?)
- 2400
- 200000000
- 200002400
- Course clear: 2 params
- DataStoreRateCustomRankingParam.dataId is always the course ID
- DataStoreRateCustomRankingParam.score is always 1
- DataStoreRateCustomRankingParam.period is always 36500
- DataStoreRateCustomRankingParam.applicationId is:
- 200000000
- 200002400
- Course star: 12 params
- DataStoreRateCustomRankingParam.dataId is:
- course ID
- course ID
- course ID
- course ID
- course ID
- course ID
- uploader PID
- uploader PID
- uploader PID
- uploader PID
- uploader PID
- uploader PID
- DataStoreRateCustomRankingParam.score is always 1
- DataStoreRateCustomRankingParam.period is:
- 36500
- 36500
- 1
- 1
- 1
- 1
- 36500
- 36500
- 1
- 1
- 1
- 1
- DataStoreRateCustomRankingParam.applicationId is:
- 0 (seen in other requests relating to Mii data?)
- 2400
- 119700101
- 119702501
- 1497730516
- 1497732916
- 300000000 (seen in other requests relating to Mii data?)
- 300002400
- 419700101
- 419702501
- 1797730516
- 1797732916
It seems like many applicationId's are actually a different ID with 2400 added to it?
Since it always sends a set number of params per action, a quick and dirty way to tell them apart is
to check the param list length. However this should NOT be relied on forever and we NEED to learn more
about applicationId, as it IS used in many other requests
*/
if len(params) == 2 {
// assume "course clear" action
incrementCourseClearCount(params[0].DataID)
}
if len(params) == 12 {
// assume "star course" action
incrementCourseStarCount(params[0].DataID)
}
rmcResponse := nex.NewRMCResponse(nexproto.DataStoreSMMProtocolID, callID)
rmcResponse.SetSuccess(nexproto.DataStoreSMMMethodRateCustomRanking, nil)
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)
}