Skip to content

Commit

Permalink
fix: two bugs in mcifsh
Browse files Browse the repository at this point in the history
1. 修复商品数量大于250时,商品价格浮动区间数值异常
2. 修复出售限制未生效的问题。(时间未更新)
  • Loading branch information
vatebur committed Oct 14, 2024
1 parent f133423 commit fcc031e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions plugin/mcfish/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -593,8 +593,8 @@ func (sql *fishdb) refreshStroeInfo() (ok bool, err error) {
thingInfo := store{}
_ = sql.db.Find("store", &thingInfo, "where Name = '"+name+"'")
if thingInfo.Number > 150 {
// 通货膨胀
thing.Discount = (1000 - 5*(thingInfo.Number-150)) / 10
// 商品贬值,价格区间 -50%到0%
thing.Discount = 50 + rand.Intn(50)
}
err = sql.db.Insert("stroeDiscount", &thing)
if err != nil {
Expand Down Expand Up @@ -826,6 +826,10 @@ func (sql *fishdb) selectCanSalesFishFor(uid int64, sales int) int {
if time.Now().Day() != time.Unix(userInfo.Duration, 0).Day() {
userInfo.Duration = time.Now().Unix()
userInfo.SalesFish = 0
err := sql.db.Insert("buff", &userInfo)
if err != nil {
return residue
}
}
maxSales := 100 - userInfo.SalesFish
if maxSales < 0 {
Expand Down

0 comments on commit fcc031e

Please sign in to comment.