initial course command

This commit is contained in:
wish
2022-10-30 15:03:12 +11:00
parent bac4e70be4
commit 31bac7bd68
6 changed files with 85 additions and 24 deletions

View File

@@ -36,9 +36,9 @@ type ClientRight struct {
}
type Course struct {
Name string
ID uint16
Value uint32
Aliases []string
ID uint16
Value uint32
}
// MsgSysUpdateRight represents the MSG_SYS_UPDATE_RIGHT
@@ -74,24 +74,28 @@ func (m *MsgSysUpdateRight) Build(bf *byteframe.ByteFrame, ctx *clientctx.Client
return nil
}
func Courses() []Course {
var courses = []Course{
{[]string{"Trial", "TL"}, 1, 0x00000002},
{[]string{"HunterLife", "HL"}, 2, 0x00000004},
{[]string{"ExtraA", "Extra", "EX"}, 3, 0x00000008},
{[]string{"ExtraB"}, 4, 0x00000010},
{[]string{"Mobile"}, 5, 0x00000020},
{[]string{"Premium"}, 6, 0x00000040},
{[]string{"Pallone"}, 7, 0x00000080},
{[]string{"Assist", "Legend", "Rasta"}, 8, 0x00000100}, // Legend
{[]string{"Netcafe", "N", "Cafe"}, 9, 0x00000200},
{[]string{"Hiden", "Secret"}, 10, 0x00000400}, // Secret
{[]string{"HunterSupport", "HunterAid", "Support", "Royal", "Aid"}, 11, 0x00000800}, // Royal
{[]string{"NetcafeBoost", "NBoost", "Boost"}, 12, 0x00001000},
}
return courses
}
// GetCourseStruct returns a slice of Course(s) from a rights integer
func GetCourseStruct(rights uint32) []Course {
var courses = []Course{
{"Trial", 1, 0x00000002},
{"HunterLife", 2, 0x00000004},
{"ExtraA", 3, 0x00000008},
{"ExtraB", 4, 0x00000010},
{"Mobile", 5, 0x00000020},
{"Premium", 6, 0x00000040},
{"Pallone", 7, 0x00000080},
{"Assist", 8, 0x00000100}, // Legend
{"Netcafe", 9, 0x00000200},
{"Hiden", 10, 0x00000400}, // Secret
{"HunterSupport", 11, 0x00000800}, // Royal
{"NetcafeBoost", 12, 0x00001000},
}
var resp []Course
for _, course := range courses {
for _, course := range Courses() {
if rights-course.Value < 0x80000000 {
resp = append(resp, course)
rights -= course.Value