initial rights v4 concept

This commit is contained in:
wish
2023-03-11 23:17:14 +11:00
parent 29cf7add11
commit bcb71536ec
7 changed files with 135 additions and 129 deletions

View File

@@ -3,6 +3,7 @@ package channelserver
import (
"encoding/binary"
"encoding/hex"
"erupe-ce/common/mhfcourse"
ps "erupe-ce/common/pascalstring"
"erupe-ce/common/stringsupport"
"fmt"
@@ -74,28 +75,13 @@ func doAckSimpleFail(s *Session, ackHandle uint32, data []byte) {
}
func updateRights(s *Session) {
rightsInt := uint32(0x0E)
rightsInt := uint32(2)
s.server.db.QueryRow("SELECT rights FROM users u INNER JOIN characters c ON u.id = c.user_id WHERE c.id = $1", s.charID).Scan(&rightsInt)
s.courses = mhfpacket.GetCourseStruct(rightsInt)
rights := []mhfpacket.ClientRight{{1, 0, 0}}
var normalCafeBitSet, netcafeBitSet bool
for _, course := range s.courses {
if (course.ID == 9 || course.ID == 26) && !netcafeBitSet {
netcafeBitSet = true
rightsInt += 0x40000000
rights = append(rights, mhfpacket.ClientRight{ID: 30})
}
if (course.ID == 26) && !normalCafeBitSet {
normalCafeBitSet = true
rightsInt += 0x2000000
rights = append(rights, mhfpacket.ClientRight{ID: 25})
}
rights = append(rights, mhfpacket.ClientRight{ID: course.ID, Timestamp: 0x70DB59F0})
}
s.courses, rightsInt = mhfcourse.GetCourseStruct(rightsInt)
update := &mhfpacket.MsgSysUpdateRight{
ClientRespAckHandle: 0,
Bitfield: rightsInt,
Rights: rights,
Rights: s.courses,
UnkSize: 0,
}
s.QueueSendMHF(update)
@@ -226,7 +212,7 @@ func logoutPlayer(s *Session) {
timePlayed += sessionTime
var rpGained int
if s.FindCourse("NetCafe").ID != 0 || s.FindCourse("N").ID != 0 {
if mhfcourse.CourseExists(30, s.courses) {
rpGained = timePlayed / 900
timePlayed = timePlayed % 900
s.server.db.Exec("UPDATE characters SET cafe_time=cafe_time+$1 WHERE id=$2", sessionTime, s.charID)