mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 16:04:38 +01:00
fix mezfes data saving
This commit is contained in:
6
patch-schema/mezfes-save.sql
Normal file
6
patch-schema/mezfes-save.sql
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
BEGIN;
|
||||||
|
|
||||||
|
ALTER TABLE public.characters
|
||||||
|
ADD COLUMN mezfes BYTEA;
|
||||||
|
|
||||||
|
END;
|
||||||
@@ -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) {
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user