Skip to content

Commit

Permalink
[mcfish]数值调整,[score]调整逻辑 (#1074)
Browse files Browse the repository at this point in the history
* chore:[mcfish]数值调整,[score]调整逻辑

* chore:[score]修正错误的文本
  • Loading branch information
vatebur authored Dec 3, 2024
1 parent 2c8726d commit c35fc54
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
10 changes: 5 additions & 5 deletions plugin/mcfish/fish.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,12 @@ func init() {
fishNumber *= 3
}
} else {
fishNmaes, err := dbdata.pickFishFor(uid, fishNumber)
fishNames, err := dbdata.pickFishFor(uid, fishNumber*3)
if err != nil {
ctx.SendChain(message.Text("[ERROR at fish.go.5.1]:", err))
return
}
if len(fishNmaes) == 0 {
if len(fishNames) == 0 {
equipInfo.Durable = 0
err = dbdata.updateUserEquip(equipInfo)
if err != nil {
Expand All @@ -143,14 +143,14 @@ func init() {
ctx.SendChain(message.Text("美西螈因为没吃到鱼,钓鱼时一直没回来,你失去了美西螈"))
return
}
msg = "(美西螈吃掉了"
msg = "(美西螈掉落翻5倍,吃3倍鱼:\n吃掉了:"
fishNumber = 0
for name, number := range fishNmaes {
for name, number := range fishNames {
fishNumber += number
msg += strconv.Itoa(number) + name + " "
}
msg += ")"
fishNumber /= 2
fishNumber /= 3
}
waitTime := 120 / (equipInfo.Induce + 1)
ctx.SendChain(message.Reply(ctx.Event.MessageID), message.Text("你开始去钓鱼了,请耐心等待鱼上钩(预计要", time.Second*time.Duration(waitTime), ")"))
Expand Down
4 changes: 2 additions & 2 deletions plugin/mcfish/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ var (
"-> 钻石竿 : 耐久上限:100 均价1500 上钩概率:0.03%\n-> 下界合金竿 : 耐久上限:150 均价3100 上钩概率:0.01%\n-> 三叉戟 : 可使1次钓鱼视为3次钓鱼. 耐久上限:300 均价4000 只能合成、修复和交易\n" +
"3.附魔书信息:\n-> 诱钓 : 减少上钩时间. 均价:1000, 上钩概率:0.25%\n-> 海之眷顾 : 增加宝藏上钩概率. 均价:2500, 上钩概率:0.10%\n" +
"4.稀有物品:\n-> 唱片 : 出售物品时使用该物品使价格翻倍. 均价:3000, 上钩概率:0.01%\n" +
"-> 美西螈 : 可装备,获得隐形[钓鱼佬]buff,并让钓到除鱼竿和美西螈外的物品数量变成5,无耐久上限.不可修复/附魔,每次钓鱼消耗两任意鱼类物品. 均价:3000, 上钩概率:0.01%\n" +
"-> 美西螈 : 可装备,获得隐形[钓鱼佬]buff,并让钓到除鱼竿和美西螈外的物品数量变成5,无耐久上限.不可修复/附魔,每次钓鱼消耗3条鱼. 均价:3000, 上钩概率:0.01%\n" +
"-> 海豚 : 使空竿概率变成垃圾概率. 均价:1000, 上钩概率:0.19%\n" +
"-> 宝藏诅咒 : 无法交易,每一层就会增加购买时10%价格和减少出售时10%价格(超过10层会变为倒贴钱). 上钩概率:0.25%\n-> 净化书 : 用于消除宝藏诅咒. 均价:5000, 上钩概率:0.19%\n" +
"5.鱼类信息:\n-> 鳕鱼 : 均价:10 上钩概率:0.69%\n-> 鲑鱼 : 均价:50 上钩概率:0.2%\n-> 热带鱼 : 均价:100 上钩概率:0.06%\n-> 河豚 : 均价:300 上钩概率:0.03%\n-> 鹦鹉螺 : 均价:500 上钩概率:0.01%\n-> 墨鱼 : 均价:500 上钩概率:0.01%\n" +
Expand Down Expand Up @@ -404,7 +404,7 @@ func (sql *fishdb) pickFishFor(uid int64, number int) (fishNames map[string]int,
}
fishInfo := article{}
k := 0
for i := number * 2; i > 0 && k < len(fishList); {
for i := number; i > 0 && k < len(fishList); {
_ = sql.db.Find(name, &fishInfo, "WHERE Name = ?", fishList[k])
if fishInfo.Number <= 0 {
k++
Expand Down
18 changes: 10 additions & 8 deletions plugin/score/sign_in.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package score
import (
"encoding/base64"
"errors"
log "github.com/sirupsen/logrus"
"io"
"math"
"math/rand"
Expand Down Expand Up @@ -332,15 +333,16 @@ func initPic(picFile string, uid int64) (avatar []byte, err error) {
return
}
url, err := bilibili.GetRealURL(backgroundURL)
if err != nil {
// 使用本地已有的图片
return avatar, copyImage(picFile)
}
data, err := web.RequestDataWith(web.NewDefaultClient(), url, "", referer, "", nil)
if err != nil {
return
if err == nil {
data, err := web.RequestDataWith(web.NewDefaultClient(), url, "", referer, "", nil)
if err == nil {
return avatar, os.WriteFile(picFile, data, 0644)
}
}
return avatar, os.WriteFile(picFile, data, 0644)
// 获取网络图片失败,使用本地已有的图片
log.Error("[score:get online img error]:", err)
return avatar, copyImage(picFile)

}

// 使用"file:"发送图片失败后,改用base64发送
Expand Down

0 comments on commit c35fc54

Please sign in to comment.