diva scheduler and cleanup

This commit is contained in:
wish
2022-08-26 17:26:24 +10:00
parent f80a807fb1
commit 09b5de79d3
3 changed files with 90 additions and 45 deletions

View File

@@ -7,7 +7,6 @@ import (
"erupe-ce/common/byteframe"
"erupe-ce/network/mhfpacket"
timeServerFix "erupe-ce/server/channelserver/timeserver"
)
func handleMsgMhfRegisterEvent(s *Session, p mhfpacket.MHFPacket) {
@@ -234,49 +233,6 @@ func handleMsgMhfUseKeepLoginBoost(s *Session, p mhfpacket.MHFPacket) {
doAckBufSucceed(s, pkt.AckHandle, resp.Data())
}
func handleMsgMhfGetUdSchedule(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfGetUdSchedule)
var t = timeServerFix.Tstatic_midnight()
var event int = s.server.erupeConfig.DevModeOptions.DivaEvent
year, month, day := t.Date()
midnight := time.Date(year, month, day, 0, 0, 0, 0, t.Location())
// Events with time limits are Festival with Sign up, Soul Week and Winners Weeks
// Diva Defense with Prayer, Interception and Song weeks
// Mezeporta Festival with simply 'available' being a weekend thing
resp := byteframe.NewByteFrame()
resp.WriteUint32(0x1d5fda5c) // Unk (1d5fda5c, 0b5397df)
if event == 1 {
resp.WriteUint32(uint32(midnight.Add(24 * 21 * time.Hour).Unix())) // Week 1 Timestamp, Festi start?
} else {
resp.WriteUint32(uint32(midnight.Add(-24 * 21 * time.Hour).Unix())) // Week 1 Timestamp, Festi start?
}
if event == 2 {
resp.WriteUint32(uint32(midnight.Add(24 * 14 * time.Hour).Unix())) // Week 2 Timestamp
resp.WriteUint32(uint32(midnight.Add(24 * 14 * time.Hour).Unix())) // Week 2 Timestamp
} else {
resp.WriteUint32(uint32(midnight.Add(-24 * 14 * time.Hour).Unix())) // Week 2 Timestamp
resp.WriteUint32(uint32(midnight.Add(-24 * 14 * time.Hour).Unix())) // Week 2 Timestamp
}
if event == 3 {
resp.WriteUint32(uint32(midnight.Add((24) * 7 * time.Hour).Unix())) // Diva Defense Interception
resp.WriteUint32(uint32(midnight.Add((24) * 14 * time.Hour).Unix())) // Diva Defense Greeting Song
} else {
resp.WriteUint32(uint32(midnight.Add((-24) * 7 * time.Hour).Unix())) // Diva Defense Interception
resp.WriteUint32(uint32(midnight.Add((-24) * 14 * time.Hour).Unix())) // Diva Defense Greeting Song
}
resp.WriteUint16(0x19) // Unk 00011001
resp.WriteUint16(0x2d) // Unk 00101101
resp.WriteUint16(0x02) // Unk 00000010
resp.WriteUint16(0x02) // Unk 00000010
doAckBufSucceed(s, pkt.AckHandle, resp.Data())
}
func handleMsgMhfGetUdInfo(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfGetUdInfo)
// Message that appears on the Diva Defense NPC and triggers the green exclamation mark