super-mario-maker/complete_attach_file.go
2021-09-26 19:45:53 -04:00

46 lines
1.3 KiB
Go

package main
import (
"fmt"
nex "github.com/PretendoNetwork/nex-go"
nexproto "github.com/PretendoNetwork/nex-protocols-go"
)
func completeAttachFile(err error, client *nex.Client, callID uint32, dataStoreCompletePostParam *nexproto.DataStoreCompletePostParam) {
rmcResponseStream := nex.NewStreamOut(nexServer)
// TODO complete this
/*
fmt.Println(dataStoreCompletePostParam.IsSuccess)
fmt.Println(dataStoreCompletePostParam.DataID)
if dataStoreCompletePostParam.IsSuccess {
setCoursePlayable(dataStoreCompletePostParam.DataID)
}
*/
rmcResponseStream.WriteString(fmt.Sprintf("http://pds-amaj-d1.b-cdn.net/image/%d.jpg", dataStoreCompletePostParam.DataID))
rmcResponseBody := rmcResponseStream.Bytes()
rmcResponse := nex.NewRMCResponse(nexproto.DataStoreSMMProtocolID, callID)
rmcResponse.SetSuccess(nexproto.DataStoreSMMMethodCompleteAttachFile, 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)
}