optimize(mcfish): 更改插件规则 (#1122)

每日商店会固定刷新1初始木竿。该木竿价格也会随木竿的价格浮动。
This commit is contained in:
方柳煜 2025-02-20 00:46:35 +08:00 committed by GitHub
parent 659f4e07c2
commit 085e95cd48
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 25 additions and 12 deletions

View File

@ -29,7 +29,7 @@ type fishdb struct {
const FishLimit = 50
// version 规则版本号
const version = "5.6.1"
const version = "5.6.2"
// 各物品信息
type jsonInfo struct {
@ -625,15 +625,19 @@ func (sql *fishdb) refreshStroeInfo() (ok bool, err error) {
thingInfo.Number = 100
}
_ = sql.db.Insert("store", &thingInfo)
// 每天上架20本净化书
// 每天上架1木竿
thingInfo = store{
Duration: time.Now().Unix(),
Name: "净化书",
Type: "article",
Price: priceList["净化书"] * discountList["净化书"] / 100,
Name: "初始木竿",
Type: "pole",
Price: priceList["木竿"]+priceList["木竿"] * discountList["木竿"]/100,
Other: "30/0/0/0",
}
_ = sql.db.Find("store", &thingInfo, "WHERE Name = '初始木竿'")
thingInfo.Number ++
if thingInfo.Number > 5{
thingInfo.Number = 1
}
_ = sql.db.Find("store", &thingInfo, "WHERE Name = '净化书'")
thingInfo.Number = 20
_ = sql.db.Insert("store", &thingInfo)
}
return true, nil

View File

@ -42,9 +42,9 @@ func init() {
}
ctx.SendChain(message.ImageBytes(pic))
})
engine.OnRegex(`^消除绑定诅咒(\d*)$`, getdb).SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
engine.OnRegex(`^消除(绑定|宝藏)诅咒(\d*)$`, getdb).SetBlock(true).Limit(ctxext.LimitByUser).Handle(func(ctx *zero.Ctx) {
uid := ctx.Event.UserID
number, _ := strconv.Atoi(ctx.State["regex_matched"].([]string)[1])
number, _ := strconv.Atoi(ctx.State["regex_matched"].([]string)[2])
if number == 0 {
number = 1
}
@ -190,7 +190,7 @@ func init() {
"6.垃圾:\n-> 均价:10 上钩概率:30%\n" +
"7.物品BUFF:\n-> 钓鱼佬 : 当背包名字含有'鱼'的物品数量超过100时激活,钓到物品概率提高至90%\n-> 修复大师 : 当背包鱼竿数量超过10时激活,修复物品时耐久百分百继承\n" +
"8.合成:\n-> 铁竿 : 3x木竿\n-> 金竿 : 3x铁竿\n-> 钻石竿 : 3x金竿\n-> 下界合金竿 : 3x钻石竿\n-> 三叉戟 : 3x下界合金竿\n注:合成成功率90%(包括梭哈),合成鱼竿的附魔等级=(附魔等级合/合成鱼竿数量)\n" +
"9.杂项:\n-> 无装备的情况下,每人最多可以购买3次100块钱的鱼竿\n-> 默认状态钓鱼上钩概率为60%(理论值!!!)\n-> 附魔的鱼竿会因附魔变得昂贵,每个附魔最高3级\n-> 三叉戟不算鱼竿,修复时可直接满耐久\n" +
"9.杂项:\n-> 无装备的情况下,每人最多可以购买3次100块钱的鱼竿,商店每日会上架1木竿\n-> 默认状态钓鱼上钩概率为60%(理论值!!!)\n-> 附魔的鱼竿会因附魔变得昂贵,每个附魔最高3级\n-> 三叉戟不算鱼竿,修复时可直接满耐久\n" +
"-> 鱼竿数量大于50的不能买东西;\n 鱼竿数量大于30的不能钓鱼;\n 每购/售10次鱼竿获得1层宝藏诅咒;\n 每购买20次物品将获得3次价格减半福利;\n 每钓鱼75次获得1本净化书;\n" +
" 每天可交易鱼竿10个购买物品30件垃圾除外."

View File

@ -393,7 +393,7 @@ func init() {
}
ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.Text("出售成功,你赚到了", pice, msg)))
})
engine.OnRegex(`^购买(`+strings.Join(thingList, "|")+`)\s*(\d*)$`, getdb, refreshFish).SetBlock(true).Limit(limitSet).Handle(func(ctx *zero.Ctx) {
engine.OnRegex(`^购买(`+strings.Join(thingList, "|")+`|初始木竿)\s*(\d*)$`, getdb, refreshFish).SetBlock(true).Limit(limitSet).Handle(func(ctx *zero.Ctx) {
uid := ctx.Event.UserID
thingName := ctx.State["regex_matched"].([]string)[1]
number, _ := strconv.Atoi(ctx.State["regex_matched"].([]string)[2])
@ -472,6 +472,9 @@ func init() {
thingPice := (priceList[info.Name] - (durationList[info.Name] - durable) - maintenance*2 +
induceLevel*600*discountList["诱钓"]/100 +
favorLevel*1800*discountList["海之眷顾"]/100) * discountList[info.Name] / 100
if strings.Contains(thingName, "初始木竿"){
thingPice = priceList["木竿"]+priceList["木竿"] * discountList["木竿"]/100
}
pice = append(pice, thingPice)
} else {
thingPice := priceList[info.Name] * discountList[info.Name] / 100
@ -618,6 +621,9 @@ func init() {
Number: 1,
Other: thing.Other,
}
if thingName == "初始木竿"{
newCommodity.Name = "木竿"
}
} else {
things, err1 := dbdata.getUserThingInfo(uid, thingName)
if err1 != nil {
@ -794,6 +800,9 @@ func drawStroeInfoImage(stroeInfo []store) (picImage image.Image, err error) {
induceLevel, _ := strconv.Atoi(poleInfo[2])
favorLevel, _ := strconv.Atoi(poleInfo[3])
pice = (priceList[info.Name] - (durationList[info.Name] - durable) - maintenance*2 + induceLevel*600 + favorLevel*1800) * discountList[info.Name] / 100
if strings.Contains(name, "初始木竿"){
pice = priceList["木竿"]+priceList["木竿"] * discountList["木竿"]/100
}
} else {
pice = priceList[info.Name] * discountList[info.Name] / 100
}