update course calculations

This commit is contained in:
wish
2022-11-02 13:30:16 +11:00
parent 8326e22d9f
commit 5bf8c9d9a9
2 changed files with 5 additions and 4 deletions

View File

@@ -63,7 +63,7 @@
], ],
"Courses": [ "Courses": [
{"Name": "HunterLife", "Enabled": true}, {"Name": "HunterLife", "Enabled": true},
{"Name": "ExtraA", "Enabled": true}, {"Name": "Extra", "Enabled": true},
{"Name": "Premium", "Enabled": true}, {"Name": "Premium", "Enabled": true},
{"Name": "Assist", "Enabled": false}, {"Name": "Assist", "Enabled": false},
{"Name": "Netcafe", "Enabled": false}, {"Name": "Netcafe", "Enabled": false},

View File

@@ -79,16 +79,17 @@ func Courses() []Course {
var courses = []Course{ var courses = []Course{
{[]string{"Trial", "TL"}, 1, 0x00000002}, {[]string{"Trial", "TL"}, 1, 0x00000002},
{[]string{"HunterLife", "HL"}, 2, 0x00000004}, {[]string{"HunterLife", "HL"}, 2, 0x00000004},
{[]string{"ExtraA", "Extra", "EX"}, 3, 0x00000008}, {[]string{"Extra", "ExtraA", "EX"}, 3, 0x00000008},
{[]string{"ExtraB"}, 4, 0x00000010}, {[]string{"ExtraB"}, 4, 0x00000010},
{[]string{"Mobile"}, 5, 0x00000020}, {[]string{"Mobile"}, 5, 0x00000020},
{[]string{"Premium"}, 6, 0x00000040}, {[]string{"Premium"}, 6, 0x00000040},
{[]string{"Pallone"}, 7, 0x00000080}, {[]string{"Pallone"}, 7, 0x00000080},
{[]string{"Assist", "Legend", "Rasta"}, 8, 0x00000100}, // Legend {[]string{"Assist", "Legend", "Rasta"}, 8, 0x00000100}, // Legend
{[]string{"Netcafe", "N", "Cafe"}, 9, 0x00000200}, {[]string{"Netcafe", "N", "Cafe"}, 9, 0x40000200},
{[]string{"Hiden", "Secret"}, 10, 0x00000400}, // Secret {[]string{"Hiden", "Secret"}, 10, 0x00000400}, // Secret
{[]string{"HunterSupport", "HunterAid", "Support", "Royal", "Aid"}, 11, 0x00000800}, // Royal {[]string{"HunterSupport", "HunterAid", "Support", "Royal", "Aid"}, 11, 0x00000800}, // Royal
{[]string{"NetcafeBoost", "NBoost", "Boost"}, 12, 0x00001000}, {[]string{"NetcafeBoost", "NBoost", "Boost"}, 12, 0x00001000},
{[]string{"ExtraC"}, 13, 0x00002000},
} }
return courses return courses
} }
@@ -98,7 +99,7 @@ func GetCourseStruct(rights uint32) []Course {
var resp []Course var resp []Course
s := Courses() s := Courses()
slices.SortStableFunc(s, func(i, j Course) bool { slices.SortStableFunc(s, func(i, j Course) bool {
return i.ID > j.ID return i.Value > j.Value
}) })
for _, course := range s { for _, course := range s {
if rights-course.Value < 0x80000000 { if rights-course.Value < 0x80000000 {