diff --git a/plugin/mcfish/fish.go b/plugin/mcfish/fish.go index a0c69285..837d9890 100644 --- a/plugin/mcfish/fish.go +++ b/plugin/mcfish/fish.go @@ -111,7 +111,7 @@ func init() { ctx.SendChain(message.Text("[ERROR at fish.go.5]:", err)) return } - if equipInfo.Durable < 10 || equipInfo.Durable > 0 { + if equipInfo.Durable < 10 && equipInfo.Durable > 0 { msg = "(你的鱼竿耐久仅剩" + strconv.Itoa(equipInfo.Durable) + ")" } else if equipInfo.Durable <= 0 { msg = "(你的鱼竿耐已销毁)" @@ -198,22 +198,22 @@ func init() { number := 1 dice := rand.Intn(100) switch { - case dice <= probabilities["waste"].Min && dice < probabilities["waste"].Max: // 垃圾 + case dice >= probabilities["waste"].Min && dice < probabilities["waste"].Max: // 垃圾 typeOfThing = "waste" thingName = wasteList[rand.Intn(len(wasteList))] picName = thingName - case dice <= probabilities["treasure"].Min && dice < probabilities["treasure"].Max: // 宝藏 + case dice >= probabilities["treasure"].Min && dice < probabilities["treasure"].Max: // 宝藏 dice = rand.Intn(100) switch { - case dice <= probabilities["美西螈"].Min && dice < probabilities["美西螈"].Max: + case dice >= probabilities["美西螈"].Min && dice < probabilities["美西螈"].Max: typeOfThing = "pole" picName = "美西螈" thingName = "美西螈" - case dice <= probabilities["唱片"].Min && dice < probabilities["唱片"].Max: + case dice >= probabilities["唱片"].Min && dice < probabilities["唱片"].Max: typeOfThing = "article" picName = "唱片" thingName = "唱片" - case dice <= probabilities["海之眷顾"].Min && dice < probabilities["海之眷顾"].Max: + case dice >= probabilities["海之眷顾"].Min && dice < probabilities["海之眷顾"].Max: typeOfThing = "article" picName = "book" thingName = "海之眷顾" @@ -222,35 +222,35 @@ func init() { picName = "book" thingName = "诱钓" } - case dice <= probabilities["pole"].Min && dice < probabilities["pole"].Max: // 宝藏 + case dice >= probabilities["pole"].Min && dice < probabilities["pole"].Max: // 宝藏 typeOfThing = "pole" dice := rand.Intn(100) switch { - case dice <= probabilities["铁竿"].Min && dice < probabilities["铁竿"].Max: + case dice >= probabilities["铁竿"].Min && dice < probabilities["铁竿"].Max: thingName = "铁竿" - case dice <= probabilities["金竿"].Min && dice < probabilities["金竿"].Max: + case dice >= probabilities["金竿"].Min && dice < probabilities["金竿"].Max: thingName = "金竿" - case dice <= probabilities["钻石竿"].Min && dice < probabilities["钻石竿"].Max: + case dice >= probabilities["钻石竿"].Min && dice < probabilities["钻石竿"].Max: thingName = "钻石竿" - case dice <= probabilities["下界合金竿竿竿"].Min && dice < probabilities["下界合金竿竿竿"].Max: + case dice >= probabilities["下界合金竿竿竿"].Min && dice < probabilities["下界合金竿竿竿"].Max: thingName = "下界合金竿竿竿" default: thingName = "木竿" } picName = thingName - case dice <= probabilities["fish"].Min && dice < probabilities["fish"].Max: + case dice >= probabilities["fish"].Min && dice < probabilities["fish"].Max: typeOfThing = "fish" dice = rand.Intn(100) switch { - case dice <= probabilities["墨鱼"].Min && dice < probabilities["墨鱼"].Max: + case dice >= probabilities["墨鱼"].Min && dice < probabilities["墨鱼"].Max: thingName = "墨鱼" - case dice <= probabilities["鳕鱼"].Min && dice < probabilities["鳕鱼"].Max: + case dice >= probabilities["鳕鱼"].Min && dice < probabilities["鳕鱼"].Max: thingName = "鳕鱼" - case dice <= probabilities["鲑鱼"].Min && dice < probabilities["鲑鱼"].Max: + case dice >= probabilities["鲑鱼"].Min && dice < probabilities["鲑鱼"].Max: thingName = "鲑鱼" - case dice <= probabilities["热带鱼"].Min && dice < probabilities["热带鱼"].Max: + case dice >= probabilities["热带鱼"].Min && dice < probabilities["热带鱼"].Max: thingName = "热带鱼" - case dice <= probabilities["河豚"].Min && dice < probabilities["河豚"].Max: + case dice >= probabilities["河豚"].Min && dice < probabilities["河豚"].Max: thingName = "河豚" default: thingName = "鹦鹉螺" @@ -262,7 +262,7 @@ func init() { if thingName != "" { newThing := article{} if strings.Contains(thingName, "竿") { - info := strconv.Itoa(rand.Intn(discountList[thingName])+1) + + info := strconv.Itoa(rand.Intn(durationList[thingName])+1) + "/" + strconv.Itoa(rand.Intn(10)) + "/" + strconv.Itoa(rand.Intn(3)) + "/" + strconv.Itoa(rand.Intn(2)) newThing = article{ @@ -302,20 +302,22 @@ func init() { } if len(thingNameList) == 1 { thingName := "" - for name := range thingNameList { + numberOfFish := 0 + for name, number := range thingNameList { thingName = name + numberOfFish = number } if picName != "" { pic, err := engine.GetLazyData(picName+".png", false) if err != nil { logrus.Warnln("[mcfish]error:", err) - ctx.SendChain(message.At(uid), message.Text("恭喜你钓到了", thingName, "\n", msg)) + ctx.SendChain(message.At(uid), message.Text("恭喜你钓到了", numberOfFish,thingName, "\n", msg)) return } - ctx.SendChain(message.At(uid), message.Text("恭喜你钓到了", thingName, "\n", msg), message.ImageBytes(pic)) + ctx.SendChain(message.At(uid), message.Text("恭喜你钓到了",numberOfFish, thingName, "\n", msg), message.ImageBytes(pic)) return } - ctx.SendChain(message.At(uid), message.Text("恭喜你钓到了", thingName, "\n", msg)) + ctx.SendChain(message.At(uid), message.Text("恭喜你钓到了",numberOfFish, thingName, "\n", msg)) return } msgInfo := make(message.Message, 0, 3+len(thingNameList)) diff --git a/plugin/mcfish/main.go b/plugin/mcfish/main.go index 849ad646..ed37939d 100644 --- a/plugin/mcfish/main.go +++ b/plugin/mcfish/main.go @@ -110,7 +110,7 @@ var ( Help: "一款钓鱼模拟器\n----------指令----------\n" + "- 钓鱼看板/钓鱼商店\n- 购买xxx\n- 购买xxx [数量]\n- 出售xxx\n- 出售xxx [数量]\n" + "- 钓鱼背包\n- 装备[xx竿|三叉戟|美西螈]\n- 附魔[诱钓|海之眷顾]\n- 修复鱼竿\n- 合成[xx竿|三叉戟]\n" + - "- 进行钓鱼\n- 进行n次钓鱼\n" + + "- 进行钓鱼\n- 进行n次钓鱼\n- 当前装备概率明细\n" + "规则:\n1.每日的商店价格是波动的!!如何最大化收益自己考虑一下喔\n" + "2.装备信息:\n-> 木竿 : 耐久上限:30 均价:100 上钩概率:0.7%\n-> 铁竿 : 耐久上限:50 均价:300 上钩概率:0.2%\n-> 金竿 : 耐久上限:70 均价700 上钩概率:0.06%\n" + "-> 钻石竿 : 耐久上限:100 均价1500 上钩概率:0.03%\n-> 下界合金竿 : 耐久上限:150 均价3100 上钩概率:0.01%\n-> 三叉戟 : 可使钓的鱼类物品数量变成3 耐久上限:300 均价4000 只能合成和交易\n" + @@ -182,7 +182,7 @@ func init() { min := make(map[string]int, 4) for _, info := range articlesInfo.ArticleInfo { switch { - case info.Type == "pole": + case info.Type == "pole" || info.Name == "美西螈": poleList = append(poleList, info.Name) case info.Type == "fish": fishList = append(fishList, info.Name) @@ -343,6 +343,10 @@ func (sql *fishdb) pickFishFor(uid int64, number int) (fishNames map[string]int, } for i := number; i > 0; i-- { randNumber := rand.Intn(len(fishTypes)) + if fishTypes[randNumber].Number <= 0 { + i++ + continue + } fishTypes[randNumber].Number-- err = sql.db.Insert(name, &fishTypes[randNumber]) if err != nil {