diff --git a/get_buffer_queue.go b/get_buffer_queue.go index 4b44747..d2ebada 100644 --- a/get_buffer_queue.go +++ b/get_buffer_queue.go @@ -19,7 +19,6 @@ func getBufferQueue(err error, client *nex.Client, callID uint32, param *nexprot pBufferQueue = make([][]byte, 0) case 3: // death data pBufferQueue = getBufferQueueDeathData(param.DataID) - incrementCourseAttemptCount(param.DataID) // We also know this is when a user attempts a course default: fmt.Printf("[Warning] DataStoreSMMProtocol::GetBufferQueue Unsupported slot: %v\n", param.Slot) } diff --git a/suggested_course_search_object.go b/suggested_course_search_object.go index 97e5543..8ef520f 100644 --- a/suggested_course_search_object.go +++ b/suggested_course_search_object.go @@ -1,6 +1,8 @@ package main import ( + "strconv" + nex "github.com/PretendoNetwork/nex-go" nexproto "github.com/PretendoNetwork/nex-protocols-go" ) @@ -8,6 +10,12 @@ import ( func suggestedCourseSearchObject(err error, client *nex.Client, callID uint32, param *nexproto.DataStoreSearchParam, extraData []string) { // TODO complete this + courseID, _ := strconv.ParseUint(extraData[0], 0, 64) + + if userNotOwnCourse(courseID, client.PID()) { + incrementCourseAttemptCount(courseID) // We also know this is when a user attempts a course + } + pRankingResults := make([]*nexproto.DataStoreCustomRankingResult, 0) courseMetadatas := getCourseMetadatasByLimit(4) // In PCAPs param.minimalRatingFrequency is 4 but is 0 here? diff --git a/utility.go b/utility.go index 43774f3..ca934c4 100644 --- a/utility.go +++ b/utility.go @@ -168,3 +168,9 @@ func userMiiDataToDataStoreMetaInfo(ownerID uint32, miiInfo primitive.M) *nexpro return metaInfo } + +func userNotOwnCourse(courseID uint64, pid uint32) bool { + courseMetadata := getCourseMetadataByDataID(courseID) + + return courseMetadata.OwnerPID != pid +}