/
send_friendship_completed.go
46 lines (36 loc) · 1.64 KB
/
send_friendship_completed.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
package notifications_3ds
import (
"github.com/PretendoNetwork/friends/globals"
nex "github.com/PretendoNetwork/nex-go"
nintendo_notifications "github.com/PretendoNetwork/nex-protocols-go/nintendo-notifications"
nintendo_notifications_types "github.com/PretendoNetwork/nex-protocols-go/nintendo-notifications/types"
)
func SendFriendshipCompleted(client *nex.Client, friendPID uint32, senderPID uint32) {
notificationEvent := nintendo_notifications_types.NewNintendoNotificationEventGeneral()
notificationEvent.U32Param = 0
notificationEvent.U64Param1 = 0
notificationEvent.U64Param2 = uint64(friendPID)
eventObject := nintendo_notifications_types.NewNintendoNotificationEvent()
eventObject.Type = 7
eventObject.SenderPID = senderPID
eventObject.DataHolder = nex.NewDataHolder()
eventObject.DataHolder.SetTypeName("NintendoNotificationEventGeneral")
eventObject.DataHolder.SetObjectData(notificationEvent)
stream := nex.NewStreamOut(globals.SecureServer)
eventObjectBytes := eventObject.Bytes(stream)
rmcRequest := nex.NewRMCRequest()
rmcRequest.SetProtocolID(nintendo_notifications.ProtocolID)
rmcRequest.SetCallID(3810693103)
rmcRequest.SetMethodID(nintendo_notifications.MethodProcessNintendoNotificationEvent1)
rmcRequest.SetParameters(eventObjectBytes)
rmcRequestBytes := rmcRequest.Bytes()
requestPacket, _ := nex.NewPacketV0(client, nil)
requestPacket.SetVersion(0)
requestPacket.SetSource(0xA1)
requestPacket.SetDestination(0xAF)
requestPacket.SetType(nex.DataPacket)
requestPacket.SetPayload(rmcRequestBytes)
requestPacket.AddFlag(nex.FlagNeedsAck)
requestPacket.AddFlag(nex.FlagReliable)
globals.SecureServer.Send(requestPacket)
}