Skip to content

Commit 085e95c

Browse files
authored
optimize(mcfish): 更改插件规则 (#1122)
每日商店会固定刷新1初始木竿。该木竿价格也会随木竿的价格浮动。
1 parent 659f4e0 commit 085e95c

File tree

3 files changed

+25
-12
lines changed

3 files changed

+25
-12
lines changed

plugin/mcfish/main.go

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ type fishdb struct {
2929
const FishLimit = 50
3030

3131
// version 规则版本号
32-
const version = "5.6.1"
32+
const version = "5.6.2"
3333

3434
// 各物品信息
3535
type jsonInfo struct {
@@ -102,7 +102,7 @@ type buffInfo struct {
102102
Coupon int `db:"Buff1"` // 优惠卷
103103
SalesPole int `db:"Buff2"` // 卖鱼竿上限
104104
BuyTing int `db:"Buff3"` // 购买上限
105-
Buff4 int `db:"Buff4"` // 暂定
105+
Buff4 int `db:"Buff4"` // 暂定
106106
Buff5 int `db:"Buff5"` // 暂定
107107
Buff6 int `db:"Buff6"` // 暂定
108108
Buff7 int `db:"Buff7"` // 暂定
@@ -625,15 +625,19 @@ func (sql *fishdb) refreshStroeInfo() (ok bool, err error) {
625625
thingInfo.Number = 100
626626
}
627627
_ = sql.db.Insert("store", &thingInfo)
628-
// 每天上架20本净化书
628+
// 每天上架1木竿
629629
thingInfo = store{
630630
Duration: time.Now().Unix(),
631-
Name: "净化书",
632-
Type: "article",
633-
Price: priceList["净化书"] * discountList["净化书"] / 100,
631+
Name: "初始木竿",
632+
Type: "pole",
633+
Price: priceList["木竿"]+priceList["木竿"] * discountList["木竿"]/100,
634+
Other: "30/0/0/0",
635+
}
636+
_ = sql.db.Find("store", &thingInfo, "WHERE Name = '初始木竿'")
637+
thingInfo.Number ++
638+
if thingInfo.Number > 5{
639+
thingInfo.Number = 1
634640
}
635-
_ = sql.db.Find("store", &thingInfo, "WHERE Name = '净化书'")
636-
thingInfo.Number = 20
637641
_ = sql.db.Insert("store", &thingInfo)
638642
}
639643
return true, nil

plugin/mcfish/pack.go

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

plugin/mcfish/store.go

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ func init() {
393393
}
394394
ctx.Send(message.ReplyWithMessage(ctx.Event.MessageID, message.Text("出售成功,你赚到了", pice, msg)))
395395
})
396-
engine.OnRegex(`^购买(`+strings.Join(thingList, "|")+`)\s*(\d*)$`, getdb, refreshFish).SetBlock(true).Limit(limitSet).Handle(func(ctx *zero.Ctx) {
396+
engine.OnRegex(`^购买(`+strings.Join(thingList, "|")+`|初始木竿)\s*(\d*)$`, getdb, refreshFish).SetBlock(true).Limit(limitSet).Handle(func(ctx *zero.Ctx) {
397397
uid := ctx.Event.UserID
398398
thingName := ctx.State["regex_matched"].([]string)[1]
399399
number, _ := strconv.Atoi(ctx.State["regex_matched"].([]string)[2])
@@ -472,6 +472,9 @@ func init() {
472472
thingPice := (priceList[info.Name] - (durationList[info.Name] - durable) - maintenance*2 +
473473
induceLevel*600*discountList["诱钓"]/100 +
474474
favorLevel*1800*discountList["海之眷顾"]/100) * discountList[info.Name] / 100
475+
if strings.Contains(thingName, "初始木竿"){
476+
thingPice = priceList["木竿"]+priceList["木竿"] * discountList["木竿"]/100
477+
}
475478
pice = append(pice, thingPice)
476479
} else {
477480
thingPice := priceList[info.Name] * discountList[info.Name] / 100
@@ -618,6 +621,9 @@ func init() {
618621
Number: 1,
619622
Other: thing.Other,
620623
}
624+
if thingName == "初始木竿"{
625+
newCommodity.Name = "木竿"
626+
}
621627
} else {
622628
things, err1 := dbdata.getUserThingInfo(uid, thingName)
623629
if err1 != nil {
@@ -794,6 +800,9 @@ func drawStroeInfoImage(stroeInfo []store) (picImage image.Image, err error) {
794800
induceLevel, _ := strconv.Atoi(poleInfo[2])
795801
favorLevel, _ := strconv.Atoi(poleInfo[3])
796802
pice = (priceList[info.Name] - (durationList[info.Name] - durable) - maintenance*2 + induceLevel*600 + favorLevel*1800) * discountList[info.Name] / 100
803+
if strings.Contains(name, "初始木竿"){
804+
pice = priceList["木竿"]+priceList["木竿"] * discountList["木竿"]/100
805+
}
797806
} else {
798807
pice = priceList[info.Name] * discountList[info.Name] / 100
799808
}

0 commit comments

Comments
 (0)