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,
"EarthStatusOverride": 0,
"EarthIDOverride": 0,
"DynamicSeasons": true,
"EarthMonsterOverride": 0,
"SaveDumps": {
"Enabled": true,
@@ -58,7 +57,8 @@
"DisableHunterNavi": false,
"EnableHiganjimaEvent": false,
"EnableNierEvent": false,
"DisableRoad": false
"DisableRoad": false,
"SeasonOverride": false
},
"Discord": {
"Enabled": false,

View File

@@ -110,7 +110,6 @@ type DevModeOptions struct {
QuestDebugTools bool // Enable various quest debug logs
EarthStatusOverride int32
EarthIDOverride int32
DynamicSeasons bool // Enables dynamic seasons
EarthMonsterOverride int32
SaveDumps SaveDumpOptions
}
@@ -144,6 +143,7 @@ type GameplayOptions struct {
EnableHiganjimaEvent bool // Enables the Higanjima event in the Rasta Bar
EnableNierEvent bool // Enables the Nier event in the Rasta Bar
DisableRoad bool // Disables the Hunting Road
SeasonOverride bool // Overrides the Quest Season with the current Mezeporta Season
}
// 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)
}
@@ -69,11 +69,7 @@ func seasonConversion(s *Session, questFile string) string {
timeSet = "n"
}
// Determine the current season based on a modulus of the current time
sid := int64(((s.server.ID & 0xFF00) - 4096) / 256)
season := ((TimeAdjusted().Unix() / 86400) + sid) % 3
filename := fmt.Sprintf("%s%s%d", questFile[:5], timeSet, season)
filename := fmt.Sprintf("%s%s%d", questFile[:5], timeSet, s.server.Season())
// Return original file if file doesn't exist
if _, err := os.Stat(filename); err == nil {

View File

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