mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 16:04:38 +01:00
basic BeatLevel progress storage
This commit is contained in:
5
schemas/patch-schema/conquest-data.sql
Normal file
5
schemas/patch-schema/conquest-data.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
BEGIN;
|
||||
|
||||
ALTER TABLE public.characters ADD COLUMN IF NOT EXISTS conquest_data BYTEA;
|
||||
|
||||
END;
|
||||
@@ -1091,7 +1091,8 @@ func handleMsgMhfUnreserveSrg(s *Session, p mhfpacket.MHFPacket) {
|
||||
func handleMsgMhfKickExportForce(s *Session, p mhfpacket.MHFPacket) {}
|
||||
|
||||
func cleanupEarthStatus(s *Session) {
|
||||
s.server.db.Exec("DELETE FROM events WHERE event_type='earth'")
|
||||
s.server.db.Exec(`DELETE FROM events WHERE event_type='earth'`)
|
||||
s.server.db.Exec(`UPDATE characters SET conquest_data=NULL`)
|
||||
}
|
||||
|
||||
func generateEarthStatusTimestamps(s *Session, start uint32, debug bool) []uint32 {
|
||||
|
||||
@@ -697,12 +697,16 @@ func handleMsgMhfGetFixedSeibatuRankingTable(s *Session, p mhfpacket.MHFPacket)
|
||||
func handleMsgMhfReadBeatLevel(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfReadBeatLevel)
|
||||
|
||||
// This response is fixed and will never change on JP,
|
||||
// but I've left it dynamic for possible other client differences.
|
||||
var data []byte
|
||||
err := s.server.db.QueryRow(`SELECT conquest_data FROM characters WHERE id = $1`, s.charID).Scan(&data)
|
||||
if err != nil || len(data) == 0 {
|
||||
data = []byte{0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1}
|
||||
}
|
||||
bf := byteframe.NewByteFrameFromBytes(data)
|
||||
resp := byteframe.NewByteFrame()
|
||||
for i := 0; i < int(pkt.ValidIDCount); i++ {
|
||||
resp.WriteUint32(pkt.IDs[i])
|
||||
resp.WriteUint32(0)
|
||||
resp.WriteUint32(bf.ReadUint32())
|
||||
resp.WriteUint32(0)
|
||||
resp.WriteUint32(0)
|
||||
}
|
||||
@@ -724,6 +728,11 @@ func handleMsgMhfReadLastWeekBeatRanking(s *Session, p mhfpacket.MHFPacket) {
|
||||
|
||||
func handleMsgMhfUpdateBeatLevel(s *Session, p mhfpacket.MHFPacket) {
|
||||
pkt := p.(*mhfpacket.MsgMhfUpdateBeatLevel)
|
||||
bf := byteframe.NewByteFrame()
|
||||
for i := 0; i < 4; i++ {
|
||||
bf.WriteInt32(pkt.Data2[i])
|
||||
}
|
||||
s.server.db.Exec(`UPDATE characters SET conquest_data = $1 WHERE id = $2`, bf.Data(), s.charID)
|
||||
doAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user