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) { func handleMsgMhfSaveMezfesData(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfSaveMezfesData) 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}) doAckSimpleSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
} }
func handleMsgMhfLoadMezfesData(s *Session, p mhfpacket.MHFPacket) { func handleMsgMhfLoadMezfesData(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfLoadMezfesData) pkt := p.(*mhfpacket.MsgMhfLoadMezfesData)
var data []byte
resp := byteframe.NewByteFrame() s.server.db.QueryRow(`SELECT mezfes FROM characters WHERE id=$1`, s.charID).Scan(&data)
resp.WriteUint32(0) // Unk bf := byteframe.NewByteFrame()
if len(data) > 0 {
resp.WriteUint8(2) // Count of the next 2 uint32s bf.WriteBytes(data)
resp.WriteUint32(0) } else {
resp.WriteUint32(0) bf.WriteUint32(0)
bf.WriteUint8(2)
resp.WriteUint32(0) // Unk bf.WriteUint32(0)
bf.WriteUint32(0)
doAckBufSucceed(s, pkt.AckHandle, resp.Data()) bf.WriteUint32(0)
}
doAckBufSucceed(s, pkt.AckHandle, bf.Data())
} }
func handleMsgMhfEnumerateRanking(s *Session, p mhfpacket.MHFPacket) { 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 alt := s.server.erupeConfig.DevModeOptions.MezFesAlt
if mezfes { if mezfes {
// Start time // Start time
bf.WriteUint32(uint32(channelserver.Time_Current_Adjusted().Add(-5 * time.Minute).Unix())) bf.WriteUint32(uint32(channelserver.TimeWeekStart().Unix()))
// End time // 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.WriteUint8(2) // Unk
bf.WriteUint32(20) // Single tickets bf.WriteUint32(20) // Single tickets
bf.WriteUint32(10) // Group tickets bf.WriteUint32(10) // Group tickets