mirror of
https://github.com/PretendoNetwork/super-mario-maker.git
synced 2026-04-23 00:58:09 -05:00
Made all loops consistent
This commit is contained in:
parent
72621093d2
commit
e9adee15b0
30
database.go
30
database.go
|
|
@ -237,8 +237,8 @@ func getCourseMetadatasByLimit(limit uint32) []*CourseMetadata {
|
|||
|
||||
courseMetadatas := make([]*CourseMetadata, 0)
|
||||
|
||||
for i := 0; i < len(sliceMap); i++ {
|
||||
dataID := uint64(sliceMap[i]["data_id"].(int64))
|
||||
for _, course := range sliceMap {
|
||||
dataID := uint64(course["data_id"].(int64))
|
||||
|
||||
var stars uint32
|
||||
var attempts uint32
|
||||
|
|
@ -249,19 +249,19 @@ func getCourseMetadatasByLimit(limit uint32) []*CourseMetadata {
|
|||
|
||||
courseMetadata := &CourseMetadata{
|
||||
DataID: dataID,
|
||||
OwnerPID: uint32(sliceMap[i]["owner_pid"].(int)),
|
||||
Size: uint32(sliceMap[i]["size"].(int)),
|
||||
CreatedTime: nex.NewDateTime(uint64(sliceMap[i]["creation_date"].(int64))),
|
||||
UpdatedTime: nex.NewDateTime(uint64(sliceMap[i]["update_date"].(int64))),
|
||||
Name: sliceMap[i]["name"].(string),
|
||||
MetaBinary: sliceMap[i]["meta_binary"].([]byte),
|
||||
OwnerPID: uint32(course["owner_pid"].(int)),
|
||||
Size: uint32(course["size"].(int)),
|
||||
CreatedTime: nex.NewDateTime(uint64(course["creation_date"].(int64))),
|
||||
UpdatedTime: nex.NewDateTime(uint64(course["update_date"].(int64))),
|
||||
Name: course["name"].(string),
|
||||
MetaBinary: course["meta_binary"].([]byte),
|
||||
Stars: stars,
|
||||
Attempts: attempts,
|
||||
Failures: failures,
|
||||
Completions: completions,
|
||||
Flag: uint32(sliceMap[i]["flag"].(int)),
|
||||
DataType: uint16(sliceMap[i]["data_type"].(int16)),
|
||||
Period: uint16(sliceMap[i]["period"].(int16)),
|
||||
Flag: uint32(course["flag"].(int)),
|
||||
DataType: uint16(course["data_type"].(int16)),
|
||||
Period: uint16(course["period"].(int16)),
|
||||
}
|
||||
|
||||
courseMetadatas = append(courseMetadatas, courseMetadata)
|
||||
|
|
@ -322,8 +322,8 @@ func getCourseMetadataByDataIDs(dataIDs []uint64) []*CourseMetadata {
|
|||
// TODO: Do this in one query?
|
||||
courseMetadatas := make([]*CourseMetadata, 0)
|
||||
|
||||
for i := 0; i < len(dataIDs); i++ {
|
||||
courseMetadata := getCourseMetadataByDataID(dataIDs[i])
|
||||
for _, dataID := range dataIDs {
|
||||
courseMetadata := getCourseMetadataByDataID(dataID)
|
||||
|
||||
if courseMetadata != nil {
|
||||
courseMetadatas = append(courseMetadatas, courseMetadata)
|
||||
|
|
@ -368,8 +368,8 @@ func getBufferQueueDeathData(dataID uint64) [][]byte {
|
|||
log.Fatal(err)
|
||||
}
|
||||
|
||||
for i := 0; i < len(sliceMap); i++ {
|
||||
pBufferQueue = append(pBufferQueue, sliceMap[i]["buffer"].([]byte))
|
||||
for _, bufferQueue := range sliceMap {
|
||||
pBufferQueue = append(pBufferQueue, bufferQueue["buffer"].([]byte))
|
||||
}
|
||||
|
||||
return pBufferQueue
|
||||
|
|
|
|||
|
|
@ -66,12 +66,12 @@ func getCustomRankingByDataIdMiiData(param *nexproto.DataStoreGetCustomRankingBy
|
|||
pRankingResult := make([]*nexproto.DataStoreCustomRankingResult, 0)
|
||||
pResults := make([]uint32, 0)
|
||||
|
||||
for i := 0; i < len(param.DataIdList); i++ {
|
||||
ownerID := uint32(param.DataIdList[i]) // This isn't actually a PID when using the official servers! I set it as one to make this easier for me
|
||||
miiInfo := getUserMiiInfoByPID(ownerID)
|
||||
for _, pid := range param.DataIdList {
|
||||
pid := uint32(pid)
|
||||
miiInfo := getUserMiiInfoByPID(pid) // This isn't actually a PID when using the official servers! I set it as one to make this easier for me
|
||||
|
||||
if miiInfo != nil {
|
||||
pRankingResult = append(pRankingResult, userMiiDataToDataStoreCustomRankingResult(ownerID, miiInfo))
|
||||
pRankingResult = append(pRankingResult, userMiiDataToDataStoreCustomRankingResult(pid, miiInfo))
|
||||
pResults = append(pResults, 0x690001)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,9 +11,7 @@ func getMetasMultipleParam(err error, client *nex.Client, callID uint32, params
|
|||
pMetaInfo := make([]*nexproto.DataStoreMetaInfo, 0)
|
||||
pResults := make([]uint32, 0)
|
||||
|
||||
for i := 0; i < len(params); i++ {
|
||||
param := params[i]
|
||||
|
||||
for _, param := range params {
|
||||
if param.DataID == 0 {
|
||||
pMetaInfo = append(pMetaInfo, getMetasMultipleParamMiiData(param))
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -14,9 +14,7 @@ func getObjectInfos(err error, client *nex.Client, callID uint32, dataIDs []uint
|
|||
|
||||
courseMetadatas := getCourseMetadataByDataIDs(dataIDs)
|
||||
|
||||
for i := 0; i < len(courseMetadatas); i++ {
|
||||
courseMetadata := courseMetadatas[i]
|
||||
|
||||
for _, courseMetadata := range courseMetadatas {
|
||||
info := nexproto.NewDataStoreFileServerObjectInfo()
|
||||
info.DataID = courseMetadata.DataID
|
||||
info.GetInfo = nexproto.NewDataStoreReqGetInfo()
|
||||
|
|
|
|||
|
|
@ -1,8 +1,6 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
nex "github.com/PretendoNetwork/nex-go"
|
||||
nexproto "github.com/PretendoNetwork/nex-protocols-go"
|
||||
)
|
||||
|
|
@ -12,8 +10,6 @@ func suggestedCourseSearchObject(err error, client *nex.Client, callID uint32, p
|
|||
|
||||
pRankingResults := make([]*nexproto.DataStoreCustomRankingResult, 0)
|
||||
|
||||
fmt.Println(param.MinimalRatingFrequency)
|
||||
|
||||
courseMetadatas := getCourseMetadatasByLimit(4) // In PCAPs param.minimalRatingFrequency is 4 but is 0 here?
|
||||
|
||||
for _, courseMetadata := range courseMetadatas {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user