From 7640195d2b4703b2aece3fdb4582cf38bbe38186 Mon Sep 17 00:00:00 2001 From: wish Date: Sun, 25 Feb 2024 21:18:14 +1100 Subject: [PATCH] add min and max Feature Weapons --- config.json | 3 ++- config/config.go | 3 ++- server/channelserver/handlers_event.go | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/config.json b/config.json index 48e166824..0e081c4e5 100644 --- a/config.json +++ b/config.json @@ -46,7 +46,8 @@ } }, "GameplayOptions": { - "FeaturedWeapons": 1, + "MinFeatureWeapons": 0, + "MaxFeatureWeapons": 1, "MaximumNP": 100000, "MaximumRP": 50000, "MaximumFP": 120000, diff --git a/config/config.go b/config/config.go index b0094f628..713d7423a 100644 --- a/config/config.go +++ b/config/config.go @@ -132,7 +132,8 @@ type CapLinkOptions struct { // GameplayOptions has various gameplay modifiers type GameplayOptions struct { - FeaturedWeapons int // Number of Active Feature weapons to generate daily + MinFeatureWeapons int // Minimum number of Active Feature weapons to generate daily + MaxFeatureWeapons int // Maximum number of Active Feature weapons to generate daily MaximumNP int // Maximum number of NP held by a player MaximumRP uint16 // Maximum number of RP held by a player MaximumFP uint32 // Maximum number of FP held by a player diff --git a/server/channelserver/handlers_event.go b/server/channelserver/handlers_event.go index 7bc384226..69a2e0cc2 100644 --- a/server/channelserver/handlers_event.go +++ b/server/channelserver/handlers_event.go @@ -66,7 +66,8 @@ func handleMsgMhfGetWeeklySchedule(s *Session, p mhfpacket.MHFPacket) { var temp activeFeature err := s.server.db.QueryRowx(`SELECT start_time, featured FROM feature_weapon WHERE start_time=$1`, t).StructScan(&temp) if err != nil || temp.StartTime.IsZero() { - temp = generateFeatureWeapons(s.server.erupeConfig.GameplayOptions.FeaturedWeapons) + weapons := token.RNG.Intn(s.server.erupeConfig.GameplayOptions.MaxFeatureWeapons-s.server.erupeConfig.GameplayOptions.MinFeatureWeapons+1) + s.server.erupeConfig.GameplayOptions.MinFeatureWeapons + temp = generateFeatureWeapons(weapons) temp.StartTime = t s.server.db.Exec(`INSERT INTO feature_weapon VALUES ($1, $2)`, temp.StartTime, temp.ActiveFeatures) }