course enumeration concept

This commit is contained in:
wish
2022-10-30 11:44:22 +11:00
parent da1a48ee2c
commit bac4e70be4
3 changed files with 53 additions and 22 deletions

View File

@@ -6,6 +6,7 @@ import (
"fmt"
"io"
"net"
"strings"
"sync"
"time"
@@ -43,7 +44,7 @@ type Session struct {
charID uint32
logKey []byte
sessionStart int64
rights uint32
courses []mhfpacket.Course
token string
kqf []byte
kqfOverride bool
@@ -268,3 +269,12 @@ func (s *Session) logMessage(opcode uint16, data []byte, sender string, recipien
fmt.Printf("Data [%d bytes]:\n(Too long!)\n\n", len(data))
}
}
func (s *Session) CourseExists(name string) bool {
for _, course := range s.courses {
if strings.ToLower(name) == strings.ToLower(course.Name) {
return true
}
}
return false
}