rewrite into SeasonOverride

This commit is contained in:
wish
2023-07-16 21:57:29 +10:00
parent 568fa5e116
commit a98ebf5d52
4 changed files with 10 additions and 9 deletions

View File

@@ -29,7 +29,6 @@
"QuestDebugTools": false, "QuestDebugTools": false,
"EarthStatusOverride": 0, "EarthStatusOverride": 0,
"EarthIDOverride": 0, "EarthIDOverride": 0,
"DynamicSeasons": true,
"EarthMonsterOverride": 0, "EarthMonsterOverride": 0,
"SaveDumps": { "SaveDumps": {
"Enabled": true, "Enabled": true,
@@ -58,7 +57,8 @@
"DisableHunterNavi": false, "DisableHunterNavi": false,
"EnableHiganjimaEvent": false, "EnableHiganjimaEvent": false,
"EnableNierEvent": false, "EnableNierEvent": false,
"DisableRoad": false "DisableRoad": false,
"SeasonOverride": false
}, },
"Discord": { "Discord": {
"Enabled": false, "Enabled": false,

View File

@@ -110,7 +110,6 @@ type DevModeOptions struct {
QuestDebugTools bool // Enable various quest debug logs QuestDebugTools bool // Enable various quest debug logs
EarthStatusOverride int32 EarthStatusOverride int32
EarthIDOverride int32 EarthIDOverride int32
DynamicSeasons bool // Enables dynamic seasons
EarthMonsterOverride int32 EarthMonsterOverride int32
SaveDumps SaveDumpOptions SaveDumps SaveDumpOptions
} }
@@ -144,6 +143,7 @@ type GameplayOptions struct {
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
DisableRoad bool // Disables the Hunting Road DisableRoad bool // Disables the Hunting Road
SeasonOverride bool // Overrides the Quest Season with the current Mezeporta Season
} }
// Discord holds the discord integration config. // Discord holds the discord integration config.

View File

@@ -45,7 +45,7 @@ func handleMsgSysGetFile(s *Session, p mhfpacket.MHFPacket) {
) )
} }
if s.server.erupeConfig.DevModeOptions.DynamicSeasons && s.server.erupeConfig.DevMode { if s.server.erupeConfig.GameplayOptions.SeasonOverride {
pkt.Filename = seasonConversion(s, pkt.Filename) pkt.Filename = seasonConversion(s, pkt.Filename)
} }
@@ -69,11 +69,7 @@ func seasonConversion(s *Session, questFile string) string {
timeSet = "n" timeSet = "n"
} }
// Determine the current season based on a modulus of the current time filename := fmt.Sprintf("%s%s%d", questFile[:5], timeSet, s.server.Season())
sid := int64(((s.server.ID & 0xFF00) - 4096) / 256)
season := ((TimeAdjusted().Unix() / 86400) + sid) % 3
filename := fmt.Sprintf("%s%s%d", questFile[:5], timeSet, season)
// Return original file if file doesn't exist // Return original file if file doesn't exist
if _, err := os.Stat(filename); err == nil { if _, err := os.Stat(filename); err == nil {

View File

@@ -405,3 +405,8 @@ func (s *Server) NextSemaphoreID() uint32 {
} }
return s.semaphoreIndex return s.semaphoreIndex
} }
func (s *Server) Season() uint8 {
sid := int64(((s.ID & 0xFF00) - 4096) / 256)
return uint8(((TimeAdjusted().Unix() / 86400) + sid) % 3)
}