fix mezfes data saving

This commit is contained in:
wish
2023-02-28 23:15:21 +11:00
parent d061ac6b1a
commit 42ab117c7f
3 changed files with 22 additions and 13 deletions

View File

@@ -0,0 +1,6 @@
BEGIN;
ALTER TABLE public.characters
ADD COLUMN mezfes BYTEA;
END;

View File

@@ -12,22 +12,25 @@ import (
func handleMsgMhfSaveMezfesData(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfSaveMezfesData)
s.server.db.Exec(`UPDATE characters SET mezfes=$1 WHERE id=$2`, pkt.RawDataPayload, s.charID)
doAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
}
func handleMsgMhfLoadMezfesData(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfLoadMezfesData)
resp := byteframe.NewByteFrame()
resp.WriteUint32(0) // Unk
resp.WriteUint8(2) // Count of the next 2 uint32s
resp.WriteUint32(0)
resp.WriteUint32(0)
resp.WriteUint32(0) // Unk
doAckBufSucceed(s, pkt.AckHandle, resp.Data())
var data []byte
s.server.db.QueryRow(`SELECT mezfes FROM characters WHERE id=$1`, s.charID).Scan(&data)
bf := byteframe.NewByteFrame()
if len(data) > 0 {
bf.WriteBytes(data)
} else {
bf.WriteUint32(0)
bf.WriteUint8(2)
bf.WriteUint32(0)
bf.WriteUint32(0)
bf.WriteUint32(0)
}
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
}
func handleMsgMhfEnumerateRanking(s *Session, p mhfpacket.MHFPacket) {

View File

@@ -140,9 +140,9 @@ func (s *Session) makeSignInResp(uid int) []byte {
alt := s.server.erupeConfig.DevModeOptions.MezFesAlt
if mezfes {
// Start time
bf.WriteUint32(uint32(channelserver.Time_Current_Adjusted().Add(-5 * time.Minute).Unix()))
bf.WriteUint32(uint32(channelserver.TimeWeekStart().Unix()))
// End time
bf.WriteUint32(uint32(channelserver.Time_Current_Adjusted().Add(24 * time.Hour * 7).Unix()))
bf.WriteUint32(uint32(channelserver.TimeWeekNext().Unix()))
bf.WriteUint8(2) // Unk
bf.WriteUint32(20) // Single tickets
bf.WriteUint32(10) // Group tickets