Merge branch 'main' into feature/diva

# Conflicts:
#	bundled-schema/DivaShops.sql
#	bundled-schema/OtherShops.sql
#	patch-schema/shop-db.sql
#	server/channelserver/handlers_guild.go
#	server/channelserver/handlers_tactics.go
This commit is contained in:
wish
2023-04-15 13:57:33 +10:00
43 changed files with 471 additions and 685 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"
@@ -11,11 +12,11 @@ import (
"strings"
"time"
"crypto/rand"
"erupe-ce/common/byteframe"
"erupe-ce/network/mhfpacket"
"go.uber.org/zap"
"math/bits"
"math/rand"
)
// Temporary function to just return no results for a MSG_MHF_ENUMERATE* packet
@@ -74,23 +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 netcafeBitSet bool
for _, course := range s.courses {
if (course.ID == 9 || course.ID == 25 || course.ID == 26) && !netcafeBitSet {
netcafeBitSet = true
rightsInt += 0x40000000 // set netcafe bit
rights = append(rights, mhfpacket.ClientRight{ID: 30})
}
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)
@@ -221,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)