add min and max Feature Weapons

This commit is contained in:
wish
2024-02-25 21:18:14 +11:00
parent d217ae1a85
commit 7640195d2b
3 changed files with 6 additions and 3 deletions

View File

@@ -46,7 +46,8 @@
} }
}, },
"GameplayOptions": { "GameplayOptions": {
"FeaturedWeapons": 1, "MinFeatureWeapons": 0,
"MaxFeatureWeapons": 1,
"MaximumNP": 100000, "MaximumNP": 100000,
"MaximumRP": 50000, "MaximumRP": 50000,
"MaximumFP": 120000, "MaximumFP": 120000,

View File

@@ -132,7 +132,8 @@ type CapLinkOptions struct {
// GameplayOptions has various gameplay modifiers // GameplayOptions has various gameplay modifiers
type GameplayOptions struct { 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 MaximumNP int // Maximum number of NP held by a player
MaximumRP uint16 // Maximum number of RP held by a player MaximumRP uint16 // Maximum number of RP held by a player
MaximumFP uint32 // Maximum number of FP held by a player MaximumFP uint32 // Maximum number of FP held by a player

View File

@@ -66,7 +66,8 @@ func handleMsgMhfGetWeeklySchedule(s *Session, p mhfpacket.MHFPacket) {
var temp activeFeature var temp activeFeature
err := s.server.db.QueryRowx(`SELECT start_time, featured FROM feature_weapon WHERE start_time=$1`, t).StructScan(&temp) 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() { 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 temp.StartTime = t
s.server.db.Exec(`INSERT INTO feature_weapon VALUES ($1, $2)`, temp.StartTime, temp.ActiveFeatures) s.server.db.Exec(`INSERT INTO feature_weapon VALUES ($1, $2)`, temp.StartTime, temp.ActiveFeatures)
} }