fix(handlers): honor DisableLoginBoost and DisableBoostTime fully (#187)

GetBoostTimeLimit and GetBoostRight now respect DisableBoostTime, and
UseKeepLoginBoost now respects DisableLoginBoost. Also fix a latent
zero-time.Time wraparound in GetBoostTimeLimit that caused the
"Boost Time" overlay to appear on fresh characters regardless of
config, since time.Time{}.Unix() cast to uint32 yields a large value
the client interprets as an active timestamp.
This commit is contained in:
Houmgaor
2026-04-06 16:16:05 +02:00
parent 9e41d59bd1
commit 84e72f7d35
3 changed files with 12 additions and 1 deletions

View File

@@ -219,7 +219,9 @@ func handleMsgMhfGetBoostTimeLimit(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfGetBoostTimeLimit)
bf := byteframe.NewByteFrame()
boostLimit, err := s.server.charRepo.ReadTime(s.charID, "boost_time", time.Time{})
if err != nil {
// Return 0 when disabled, on read error, or when boost_time is unset
// (zero time.Time.Unix() wraps to a large uint32 the client interprets as active).
if err != nil || s.server.erupeConfig.GameplayOptions.DisableBoostTime || boostLimit.IsZero() {
bf.WriteUint32(0)
} else {
bf.WriteUint32(uint32(boostLimit.Unix()))
@@ -230,6 +232,10 @@ func handleMsgMhfGetBoostTimeLimit(s *Session, p mhfpacket.MHFPacket) {
func handleMsgMhfGetBoostRight(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfGetBoostRight)
if s.server.erupeConfig.GameplayOptions.DisableBoostTime {
doAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})
return
}
boostLimit, err := s.server.charRepo.ReadTime(s.charID, "boost_time", time.Time{})
if err != nil {
doAckBufSucceed(s, pkt.AckHandle, []byte{0x00, 0x00, 0x00, 0x00})

View File

@@ -195,6 +195,10 @@ func handleMsgMhfGetKeepLoginBoostStatus(s *Session, p mhfpacket.MHFPacket) {
func handleMsgMhfUseKeepLoginBoost(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfUseKeepLoginBoost)
if s.server.erupeConfig.GameplayOptions.DisableLoginBoost {
doAckBufSucceed(s, pkt.AckHandle, make([]byte, 5))
return
}
var expiration time.Time
bf := byteframe.NewByteFrame()
bf.WriteUint8(0)