fix TimeWeekX inconsistencies & limit MezFes duration

This commit is contained in:
wish
2023-11-26 19:21:31 +11:00
parent b3af01b803
commit a0fbfc248b
5 changed files with 11 additions and 5 deletions

View File

@@ -65,6 +65,7 @@
"MaterialMultiplier": 1.00, "MaterialMultiplier": 1.00,
"ExtraCarves": 0, "ExtraCarves": 0,
"DisableHunterNavi": false, "DisableHunterNavi": false,
"MezFesDuration": 172800,
"EnableKaijiEvent": false, "EnableKaijiEvent": false,
"EnableHiganjimaEvent": false, "EnableHiganjimaEvent": false,
"EnableNierEvent": false, "EnableNierEvent": false,

View File

@@ -151,6 +151,7 @@ type GameplayOptions struct {
MaterialMultiplier float32 // Adjusts the multiplier of Monster Materials rewarded for quest completion MaterialMultiplier float32 // Adjusts the multiplier of Monster Materials rewarded for quest completion
ExtraCarves uint16 // Grant n extra chances to carve ALL carcasses ExtraCarves uint16 // Grant n extra chances to carve ALL carcasses
DisableHunterNavi bool // Disables the Hunter Navi DisableHunterNavi bool // Disables the Hunter Navi
MezFesDuration int // Seconds that MezFes will last for weekly (from 12AM Mon backwards)
EnableKaijiEvent bool // Enables the Kaiji event in the Rasta Bar EnableKaijiEvent bool // Enables the Kaiji event in the Rasta Bar
EnableHiganjimaEvent bool // Enables the Higanjima event in the Rasta Bar EnableHiganjimaEvent bool // Enables the Higanjima event in the Rasta Bar
EnableNierEvent bool // Enables the Nier event in the Rasta Bar EnableNierEvent bool // Enables the Nier event in the Rasta Bar

View File

@@ -988,8 +988,8 @@ func handleMsgMhfKickExportForce(s *Session, p mhfpacket.MHFPacket) {}
func handleMsgMhfGetEarthStatus(s *Session, p mhfpacket.MHFPacket) { func handleMsgMhfGetEarthStatus(s *Session, p mhfpacket.MHFPacket) {
pkt := p.(*mhfpacket.MsgMhfGetEarthStatus) pkt := p.(*mhfpacket.MsgMhfGetEarthStatus)
bf := byteframe.NewByteFrame() bf := byteframe.NewByteFrame()
bf.WriteUint32(uint32(TimeWeekStart().Add(time.Hour * -24).Unix())) // Start bf.WriteUint32(uint32(TimeWeekStart().Unix())) // Start
bf.WriteUint32(uint32(TimeWeekNext().Add(time.Hour * 24).Unix())) // End bf.WriteUint32(uint32(TimeWeekNext().Unix())) // End
bf.WriteInt32(s.server.erupeConfig.DevModeOptions.EarthStatusOverride) bf.WriteInt32(s.server.erupeConfig.DevModeOptions.EarthStatusOverride)
bf.WriteInt32(s.server.erupeConfig.DevModeOptions.EarthIDOverride) bf.WriteInt32(s.server.erupeConfig.DevModeOptions.EarthIDOverride)
bf.WriteInt32(s.server.erupeConfig.DevModeOptions.EarthMonsterOverride) bf.WriteInt32(s.server.erupeConfig.DevModeOptions.EarthMonsterOverride)

View File

@@ -16,8 +16,11 @@ func TimeMidnight() time.Time {
func TimeWeekStart() time.Time { func TimeWeekStart() time.Time {
midnight := TimeMidnight() midnight := TimeMidnight()
offset := (int(midnight.Weekday()) - 1) * -24 offset := int(midnight.Weekday()) - int(time.Monday)
return midnight.Add(time.Hour * time.Duration(offset)) if offset < 0 {
offset += 7
}
return midnight.Add(-time.Duration(offset) * 24 * time.Hour)
} }
func TimeWeekNext() time.Time { func TimeWeekNext() time.Time {

View File

@@ -9,6 +9,7 @@ import (
"fmt" "fmt"
"go.uber.org/zap" "go.uber.org/zap"
"strings" "strings"
"time"
) )
func (s *Session) makeSignResponse(uid uint32) []byte { func (s *Session) makeSignResponse(uid uint32) []byte {
@@ -160,7 +161,7 @@ func (s *Session) makeSignResponse(uid uint32) []byte {
// We can just use the start timestamp as the event ID // We can just use the start timestamp as the event ID
bf.WriteUint32(uint32(channelserver.TimeWeekStart().Unix())) bf.WriteUint32(uint32(channelserver.TimeWeekStart().Unix()))
// Start time // Start time
bf.WriteUint32(uint32(channelserver.TimeWeekStart().Unix())) bf.WriteUint32(uint32(channelserver.TimeWeekNext().Add(-time.Duration(s.server.erupeConfig.GameplayOptions.MezFesDuration) * time.Second).Unix()))
// End time // End time
bf.WriteUint32(uint32(channelserver.TimeWeekNext().Unix())) bf.WriteUint32(uint32(channelserver.TimeWeekNext().Unix()))
bf.WriteUint8(2) // Unk bf.WriteUint8(2) // Unk