From b3af01b8037e0c014f503b25fdb66850b3767293 Mon Sep 17 00:00:00 2001 From: wish Date: Sun, 26 Nov 2023 18:54:04 +1100 Subject: [PATCH] use seconds for arbitrary durations in config --- config.json | 4 ++-- config/config.go | 4 ++-- server/channelserver/handlers_cafe.go | 2 +- server/channelserver/handlers_guild.go | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/config.json b/config.json index 9fcb4ef68..2a9b06e6f 100644 --- a/config.json +++ b/config.json @@ -45,8 +45,8 @@ "TreasureHuntExpiry": 604800, "DisableLoginBoost": false, "DisableBoostTime": false, - "BoostTimeDuration": 120, - "GuildMealDuration": 60, + "BoostTimeDuration": 7200, + "GuildMealDuration": 3600, "BonusQuestAllowance": 3, "DailyQuestAllowance": 1, "MezfesSoloTickets": 10, diff --git a/config/config.go b/config/config.go index e992d6594..09991c84f 100644 --- a/config/config.go +++ b/config/config.go @@ -131,8 +131,8 @@ type GameplayOptions struct { TreasureHuntPartnyaCooldown uint32 // Seconds until a Partnya can be assigned to another Clan Treasure Hunt DisableLoginBoost bool // Disables the Login Boost system DisableBoostTime bool // Disables the daily NetCafe Boost Time - BoostTimeDuration int // The number of minutes NetCafe Boost Time lasts for - GuildMealDuration int // The number of minutes a Guild Meal can be activated for after cooking + BoostTimeDuration int // Second that the NetCafe Boost Time lasts + GuildMealDuration int // Second that a Guild Meal can be activated for after cooking BonusQuestAllowance uint32 // Number of Bonus Point Quests to allow daily DailyQuestAllowance uint32 // Number of Daily Quests to allow daily MezfesSoloTickets uint32 // Number of solo tickets given weekly diff --git a/server/channelserver/handlers_cafe.go b/server/channelserver/handlers_cafe.go index 67b7c3807..9c4b0b732 100644 --- a/server/channelserver/handlers_cafe.go +++ b/server/channelserver/handlers_cafe.go @@ -220,7 +220,7 @@ func addPointNetcafe(s *Session, p int) error { func handleMsgMhfStartBoostTime(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgMhfStartBoostTime) bf := byteframe.NewByteFrame() - boostLimit := TimeAdjusted().Add(time.Duration(s.server.erupeConfig.GameplayOptions.BoostTimeDuration) * time.Minute) + boostLimit := TimeAdjusted().Add(time.Duration(s.server.erupeConfig.GameplayOptions.BoostTimeDuration) * time.Second) if s.server.erupeConfig.GameplayOptions.DisableBoostTime { bf.WriteUint32(0) doAckBufSucceed(s, pkt.AckHandle, bf.Data()) diff --git a/server/channelserver/handlers_guild.go b/server/channelserver/handlers_guild.go index 7a726832f..30a150eef 100644 --- a/server/channelserver/handlers_guild.go +++ b/server/channelserver/handlers_guild.go @@ -1831,18 +1831,18 @@ func handleMsgMhfLoadGuildCooking(s *Session, p mhfpacket.MHFPacket) { func handleMsgMhfRegistGuildCooking(s *Session, p mhfpacket.MHFPacket) { pkt := p.(*mhfpacket.MsgMhfRegistGuildCooking) guild, _ := GetGuildInfoByCharacterId(s, s.charID) - currentTime := TimeAdjusted().Add(time.Duration(s.server.erupeConfig.GameplayOptions.GuildMealDuration-60) * time.Minute) + startTime := TimeAdjusted().Add(time.Duration(s.server.erupeConfig.GameplayOptions.GuildMealDuration-3600) * time.Second) if pkt.OverwriteID != 0 { - s.server.db.Exec("UPDATE guild_meals SET meal_id = $1, level = $2, created_at = $3 WHERE id = $4", pkt.MealID, pkt.Success, currentTime, pkt.OverwriteID) + s.server.db.Exec("UPDATE guild_meals SET meal_id = $1, level = $2, created_at = $3 WHERE id = $4", pkt.MealID, pkt.Success, startTime, pkt.OverwriteID) } else { - s.server.db.QueryRow("INSERT INTO guild_meals (guild_id, meal_id, level, created_at) VALUES ($1, $2, $3, $4) RETURNING id", guild.ID, pkt.MealID, pkt.Success, currentTime).Scan(&pkt.OverwriteID) + s.server.db.QueryRow("INSERT INTO guild_meals (guild_id, meal_id, level, created_at) VALUES ($1, $2, $3, $4) RETURNING id", guild.ID, pkt.MealID, pkt.Success, startTime).Scan(&pkt.OverwriteID) } bf := byteframe.NewByteFrame() bf.WriteUint16(1) bf.WriteUint32(pkt.OverwriteID) bf.WriteUint32(uint32(pkt.MealID)) bf.WriteUint32(uint32(pkt.Success)) - bf.WriteUint32(uint32(currentTime.Unix())) + bf.WriteUint32(uint32(startTime.Unix())) doAckBufSucceed(s, pkt.AckHandle, bf.Data()) }