mirror of
https://github.com/Mezeporta/Erupe.git
synced 2025-12-14 07:55:33 +01:00
rewrite into SeasonOverride
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user