nonebot-plugin-fishing2 0.0.2__py3-none-any.whl → 0.0.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- nonebot_plugin_fishing2/__init__.py +94 -32
- nonebot_plugin_fishing2/config.py +25 -6
- nonebot_plugin_fishing2/data_source.py +124 -10
- {nonebot_plugin_fishing2-0.0.2.dist-info → nonebot_plugin_fishing2-0.0.3.dist-info}/METADATA +2 -2
- {nonebot_plugin_fishing2-0.0.2.dist-info → nonebot_plugin_fishing2-0.0.3.dist-info}/RECORD +8 -8
- {nonebot_plugin_fishing2-0.0.2.dist-info → nonebot_plugin_fishing2-0.0.3.dist-info}/WHEEL +0 -0
- {nonebot_plugin_fishing2-0.0.2.dist-info → nonebot_plugin_fishing2-0.0.3.dist-info}/licenses/LICENSE +0 -0
- {nonebot_plugin_fishing2-0.0.2.dist-info → nonebot_plugin_fishing2-0.0.3.dist-info}/top_level.txt +0 -0
@@ -17,6 +17,8 @@ from typing import Union
|
|
17
17
|
|
18
18
|
from .config import Config, config
|
19
19
|
from .data_source import (
|
20
|
+
fish_list,
|
21
|
+
get_info,
|
20
22
|
can_fishing,
|
21
23
|
can_free_fish,
|
22
24
|
get_fish,
|
@@ -31,23 +33,26 @@ from .data_source import (
|
|
31
33
|
get_achievements,
|
32
34
|
get_board,
|
33
35
|
check_tools,
|
34
|
-
remove_tools
|
36
|
+
remove_tools,
|
37
|
+
get_shop,
|
38
|
+
buy_fish
|
35
39
|
)
|
36
40
|
|
37
41
|
fishing_coin_name = config.fishing_coin_name
|
38
42
|
|
39
43
|
__plugin_meta__ = PluginMetadata(
|
40
|
-
name="
|
41
|
-
description="
|
44
|
+
name="更好的电子钓鱼",
|
45
|
+
description="赛博钓鱼……但是加强版本",
|
42
46
|
usage=f'''钓鱼帮助
|
43
|
-
▶ 查询 [物品]
|
47
|
+
▶ 查询 [物品]:查询某个物品的信息
|
44
48
|
▶ 钓鱼 [鱼竿] [鱼饵]:
|
45
49
|
▷ 有 {config.fishing_limit}s 的冷却,时间随上一条鱼稀有度而增加
|
46
|
-
▷
|
50
|
+
▷ 加参数可以使用鱼饵或鱼竿,同类物品同时只能使用一种
|
47
51
|
▷ 频繁钓鱼会触怒河神
|
48
52
|
▶ 出售 <物品> <数量>:出售物品获得{fishing_coin_name}
|
49
|
-
▶ 购买
|
53
|
+
▶ 购买 <物品> <份数>:购买渔具店的物品
|
50
54
|
▶ 放生 <鱼名>:给一条鱼取名并放生
|
55
|
+
▶ 商店:看看渔具店都有些啥
|
51
56
|
▶ 祈愿:向神祈愿,随机获取/损失{fishing_coin_name}
|
52
57
|
▶ 背包:查看背包中的{fishing_coin_name}与物品
|
53
58
|
▶ 成就:查看拥有的成就
|
@@ -57,6 +62,11 @@ __plugin_meta__ = PluginMetadata(
|
|
57
62
|
homepage="https://github.com/FDCraft/nonebot-plugin-fishing2",
|
58
63
|
config=Config,
|
59
64
|
supported_adapters=None,
|
65
|
+
extra={
|
66
|
+
'author': 'Polaris_Light',
|
67
|
+
'version': '0.0.3',
|
68
|
+
'priority': 5
|
69
|
+
}
|
60
70
|
)
|
61
71
|
|
62
72
|
|
@@ -68,7 +78,8 @@ fishing_help = on_command("fishing_help", aliases={"钓鱼帮助"}, priority=3,b
|
|
68
78
|
fishing_lookup = on_command("fishing_lookup", aliases={"查看", "查询"}, priority=3,block=True)
|
69
79
|
fishing = on_command("fishing", aliases={"钓鱼"}, priority=5)
|
70
80
|
backpack = on_command("backpack", aliases={"背包", "钓鱼背包"}, priority=5)
|
71
|
-
|
81
|
+
shop = on_command("shop", aliases={"商店"}, priority=5)
|
82
|
+
buy = on_command("buy", aliases={"购买"}, priority=5)
|
72
83
|
sell = on_command("sell", aliases={"卖鱼", "出售", "售卖"}, priority=5)
|
73
84
|
free_fish_cmd = on_command("free_fish", aliases={"放生", "钓鱼放生"}, priority=5)
|
74
85
|
lottery_cmd = on_command("lottery", aliases={"祈愿"}, priority=5)
|
@@ -81,29 +92,19 @@ board_cmd = on_command("board", aliases={"排行榜", "钓鱼排行榜"}, priori
|
|
81
92
|
async def _():
|
82
93
|
await fishing_help.finish(__plugin_meta__.usage)
|
83
94
|
|
84
|
-
|
85
|
-
async def
|
86
|
-
|
95
|
+
@shop.handle()
|
96
|
+
async def _(bot: Bot, event: Union[GroupMessageEvent, PrivateMessageEvent]):
|
97
|
+
messages = get_shop()
|
98
|
+
await forward_send(bot, event, messages)
|
99
|
+
return None
|
87
100
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
await matcher.finish(MessageSegment.at(user_id) + " " + "河累了,休息一下吧")
|
96
|
-
elif punish_user_dict[user_id] == config.punish_limit - 1:
|
97
|
-
await matcher.finish(MessageSegment.at(user_id) + " " + "河神快要不耐烦了")
|
98
|
-
elif punish_user_dict[user_id] == config.punish_limit:
|
99
|
-
groud_id = event.group_id if isinstance(event, GroupMessageEvent) else None
|
100
|
-
try:
|
101
|
-
await bot.set_group_ban(group_id=groud_id, user_id=user_id, duration=1800)
|
102
|
-
except ActionFailed:
|
103
|
-
pass
|
104
|
-
await matcher.finish(MessageSegment.at(user_id) + " " + "河神生气了,降下了惩罚")
|
105
|
-
else:
|
106
|
-
await matcher.finish()
|
101
|
+
@fishing_lookup.handle()
|
102
|
+
async def _(bot: Bot, event: Union[GroupMessageEvent, PrivateMessageEvent], arg: Message = CommandArg()):
|
103
|
+
arg = arg.extract_plain_text()
|
104
|
+
if not arg or arg == "":
|
105
|
+
await fishing_lookup.finish("请输入要查询的物品\n可查询物品:" + "、".join(fish_list))
|
106
|
+
await forward_send(bot, event, get_info(arg))
|
107
|
+
return None
|
107
108
|
|
108
109
|
|
109
110
|
@fishing.handle()
|
@@ -153,12 +154,17 @@ async def _(event: Event, arg: Message = CommandArg()):
|
|
153
154
|
fish_info = arg.extract_plain_text()
|
154
155
|
user_id = event.get_user_id()
|
155
156
|
if fish_info == "":
|
156
|
-
await buy.finish(MessageSegment.at(user_id) + " " + "
|
157
|
+
await buy.finish(MessageSegment.at(user_id) + " " + "请输入要买入物品的名字和份数 (份数为1时可省略), 如 /购买 钛金鱼竿 1")
|
157
158
|
if len(fish_info.split()) == 1:
|
158
|
-
|
159
|
+
result = await buy_fish(user_id, fish_info)
|
159
160
|
else:
|
160
161
|
fish_name, fish_quantity = fish_info.split()
|
161
|
-
|
162
|
+
result = await buy_fish(user_id, fish_name, int(fish_quantity))
|
163
|
+
achievements = await check_achievement(user_id)
|
164
|
+
if achievements is not None:
|
165
|
+
for achievement in achievements:
|
166
|
+
await fishing.send(achievement)
|
167
|
+
await buy.finish(MessageSegment.at(user_id) + " " + result)
|
162
168
|
|
163
169
|
|
164
170
|
@sell.handle()
|
@@ -237,4 +243,60 @@ async def _(bot: Bot, event: GroupMessageEvent):
|
|
237
243
|
await board_cmd.finish(msg)
|
238
244
|
|
239
245
|
|
246
|
+
|
247
|
+
async def punish(bot: Bot, event: Event, matcher: Matcher, user_id: int):
|
248
|
+
global punish_user_dict
|
249
|
+
|
250
|
+
if not await can_fishing(user_id):
|
251
|
+
try:
|
252
|
+
punish_user_dict[user_id] += 1
|
253
|
+
except KeyError:
|
254
|
+
punish_user_dict[user_id] = 1
|
255
|
+
|
256
|
+
if punish_user_dict[user_id] < config.punish_limit - 1 :
|
257
|
+
await matcher.finish(MessageSegment.at(user_id) + " " + "河累了,休息一下吧")
|
258
|
+
elif punish_user_dict[user_id] == config.punish_limit - 1:
|
259
|
+
await matcher.finish(MessageSegment.at(user_id) + " " + "河神快要不耐烦了")
|
260
|
+
elif punish_user_dict[user_id] == config.punish_limit:
|
261
|
+
groud_id = event.group_id if isinstance(event, GroupMessageEvent) else None
|
262
|
+
try:
|
263
|
+
await bot.set_group_ban(group_id=groud_id, user_id=user_id, duration=1800)
|
264
|
+
except ActionFailed:
|
265
|
+
pass
|
266
|
+
await matcher.finish(MessageSegment.at(user_id) + " " + "河神生气了,降下了惩罚")
|
267
|
+
else:
|
268
|
+
await matcher.finish()
|
269
|
+
|
270
|
+
|
271
|
+
async def forward_send(bot: Bot, event: Union[GroupMessageEvent, PrivateMessageEvent], messages: list[MessageSegment]) -> None:
|
272
|
+
if isinstance(event, GroupMessageEvent):
|
273
|
+
await bot.send_group_forward_msg(
|
274
|
+
group_id=event.group_id,
|
275
|
+
messages=[
|
276
|
+
{
|
277
|
+
"type": "node",
|
278
|
+
"data": {
|
279
|
+
"name": "花花",
|
280
|
+
"uin": bot.self_id,
|
281
|
+
"content": msg,
|
282
|
+
},
|
283
|
+
}
|
284
|
+
for msg in messages
|
285
|
+
],
|
286
|
+
)
|
287
|
+
else:
|
288
|
+
await bot.send_private_forward_msg(
|
289
|
+
user_id=event.user_id,
|
290
|
+
messages=[
|
291
|
+
{
|
292
|
+
"type": "node",
|
293
|
+
"data": {
|
294
|
+
"name": "花花",
|
295
|
+
"uin": bot.self_id,
|
296
|
+
"content": msg,
|
297
|
+
},
|
298
|
+
}
|
299
|
+
for msg in messages
|
300
|
+
],
|
301
|
+
)
|
240
302
|
|
@@ -21,11 +21,12 @@ class Config(BaseModel):
|
|
21
21
|
"key": "小鱼"
|
22
22
|
}
|
23
23
|
],
|
24
|
-
"description": "
|
24
|
+
"description": "一条小鱼。把它当做鱼饵可以防止钓到小鱼。",
|
25
25
|
"can_catch": True,
|
26
26
|
"frequency": 2,
|
27
27
|
"weight": 1000,
|
28
|
-
"can_buy":
|
28
|
+
"can_buy": True,
|
29
|
+
"amount": 1,
|
29
30
|
"can_sell": True
|
30
31
|
},
|
31
32
|
{
|
@@ -84,7 +85,19 @@ class Config(BaseModel):
|
|
84
85
|
"description": "非常能吃大米。",
|
85
86
|
"can_catch": True,
|
86
87
|
"frequency": 30,
|
87
|
-
"weight":
|
88
|
+
"weight": 10,
|
89
|
+
"can_buy": False,
|
90
|
+
"can_sell": True
|
91
|
+
},
|
92
|
+
{
|
93
|
+
"type": "fish",
|
94
|
+
"name": "帕秋莉",
|
95
|
+
"price": 8000,
|
96
|
+
"props": [],
|
97
|
+
"description": "Neet姬,非常难在图书馆外见到她。",
|
98
|
+
"can_catch": True,
|
99
|
+
"frequency": 120,
|
100
|
+
"weight": 0,
|
88
101
|
"can_buy": False,
|
89
102
|
"can_sell": True
|
90
103
|
},
|
@@ -95,19 +108,19 @@ class Config(BaseModel):
|
|
95
108
|
"props": [
|
96
109
|
{
|
97
110
|
"type": "rare_fish",
|
98
|
-
"value":
|
111
|
+
"value": 10
|
99
112
|
}
|
100
113
|
],
|
101
114
|
"description": "更坚韧的鱼竿,显著提升钓上大鱼的概率。",
|
102
115
|
"can_catch": False,
|
103
116
|
"can_buy": True,
|
104
|
-
"
|
117
|
+
"amount": 30,
|
105
118
|
"can_sell": False
|
106
119
|
},
|
107
120
|
{
|
108
121
|
"type": "fish",
|
109
122
|
"name": "大米",
|
110
|
-
"price":
|
123
|
+
"price": 2000,
|
111
124
|
"props": [
|
112
125
|
{
|
113
126
|
"type": "fish",
|
@@ -171,6 +184,12 @@ class Config(BaseModel):
|
|
171
184
|
"data": "琪露诺",
|
172
185
|
"description": "发现了湖边的冰之精灵"
|
173
186
|
},
|
187
|
+
{
|
188
|
+
"type": "fish_type",
|
189
|
+
"name": "不动的大图书馆",
|
190
|
+
"data": "帕秋莉",
|
191
|
+
"description": "Neet 姬好不容易出门一次,就被你钓上来了?"
|
192
|
+
}
|
174
193
|
]
|
175
194
|
|
176
195
|
|
@@ -7,6 +7,7 @@ import json
|
|
7
7
|
from typing import Union
|
8
8
|
from sqlalchemy import select, update, delete
|
9
9
|
from sqlalchemy.sql.expression import func
|
10
|
+
from nonebot.adapters.onebot.v11 import MessageSegment
|
10
11
|
from nonebot_plugin_orm import get_session
|
11
12
|
|
12
13
|
from .config import config
|
@@ -15,9 +16,41 @@ from .model import FishingRecord, SpecialFishes
|
|
15
16
|
fishing_coin_name = config.fishing_coin_name
|
16
17
|
fish_list = [fish["name"] for fish in config.fishes]
|
17
18
|
can_catch_fishes = {fish["name"]: fish["weight"] for fish in config.fishes if fish["can_catch"]}
|
18
|
-
can_buy_fishes = [fish["name"] for fish in config.fishes if fish["
|
19
|
+
can_buy_fishes = [fish["name"] for fish in config.fishes if fish["can_buy"]]
|
19
20
|
can_sell_fishes = [fish["name"] for fish in config.fishes if fish["can_sell"]]
|
20
21
|
|
22
|
+
def get_info(fish_name: str) -> list[MessageSegment]:
|
23
|
+
message = []
|
24
|
+
for fish in config.fishes:
|
25
|
+
if fish.get("name") == fish_name:
|
26
|
+
message1 = ""
|
27
|
+
message1 += f'▶ 名称:{fish_name}\n'
|
28
|
+
message1 += f'▶ 基准价格:{fish["price"]} {fishing_coin_name}\n'
|
29
|
+
message1 += f'▶ 描述:{fish["description"]}\n'
|
30
|
+
message1 += f'▶ {"可钓鱼获取" if fish["can_catch"] else "不可钓鱼获取"},'
|
31
|
+
message1 += f'{"可购买" if fish["can_buy"] else "不可购买"},'
|
32
|
+
message1 += f'{"可出售" if fish["can_sell"] else "不可出售"}'
|
33
|
+
message.append(MessageSegment.text(message1))
|
34
|
+
if fish["can_catch"]:
|
35
|
+
message2 = ""
|
36
|
+
message2 += f'▶ 钓鱼信息:\n'
|
37
|
+
message2 += f' ▷ 基础权重:{fish["weight"]},'
|
38
|
+
message2 += f'上钩时间:{fish["frequency"]}s'
|
39
|
+
message.append(MessageSegment.text(message2))
|
40
|
+
if fish["can_buy"]:
|
41
|
+
message3 = ""
|
42
|
+
message3 += f'▶ 商店信息:\n'
|
43
|
+
message3 += f' ▷ 出售价格:{fish["price"] * 2},'
|
44
|
+
message3 += f'单份数量:{fish.get("amount") if fish.get("amount") else 1}'
|
45
|
+
message.append(MessageSegment.text(message3))
|
46
|
+
if fish.get("props") and fish["props"] != []:
|
47
|
+
message4 = ""
|
48
|
+
message4 += f'▶ 道具信息:\n'
|
49
|
+
message4 += f' ▷ 道具类型:{"鱼饵" if fish["type"] == "fish" else "道具"}\n'
|
50
|
+
message4 += print_props(fish["props"])
|
51
|
+
message.append(MessageSegment.text(message4))
|
52
|
+
return message
|
53
|
+
|
21
54
|
def adjusted_choice(adjusts: list[dict[str, Union[str, int]]] = None) -> str:
|
22
55
|
|
23
56
|
adjusted_fishes = copy.deepcopy(can_catch_fishes)
|
@@ -28,11 +61,11 @@ def adjusted_choice(adjusts: list[dict[str, Union[str, int]]] = None) -> str:
|
|
28
61
|
continue
|
29
62
|
match adjust["type"]:
|
30
63
|
case "normal_fish":
|
31
|
-
for key, weight in can_catch_fishes:
|
64
|
+
for key, weight in can_catch_fishes.items():
|
32
65
|
if weight >= 500 and key in adjusted_fishes:
|
33
66
|
adjusted_fishes[key] += adjust["value"]
|
34
67
|
case "rare_fish":
|
35
|
-
for key, weight in can_catch_fishes:
|
68
|
+
for key, weight in can_catch_fishes.items():
|
36
69
|
if weight < 500 and key in adjusted_fishes:
|
37
70
|
adjusted_fishes[key] += adjust["value"]
|
38
71
|
case "fish":
|
@@ -47,6 +80,10 @@ def adjusted_choice(adjusts: list[dict[str, Union[str, int]]] = None) -> str:
|
|
47
80
|
adjusted_fishes_list = list(adjusted_fishes.keys())
|
48
81
|
adjusted_weights = list(adjusted_fishes.values())
|
49
82
|
|
83
|
+
for i in range(len(adjusted_weights)):
|
84
|
+
if adjusted_weights[i] < 0:
|
85
|
+
adjusted_weights[i] = 0
|
86
|
+
|
50
87
|
choices = random.choices(
|
51
88
|
adjusted_fishes_list,
|
52
89
|
weights=adjusted_weights,
|
@@ -126,6 +163,25 @@ def get_frequency(fish_name: str) -> int:
|
|
126
163
|
60
|
127
164
|
)
|
128
165
|
|
166
|
+
def print_props(props: list) -> str:
|
167
|
+
"""打印鱼的属性"""
|
168
|
+
result = " ▷ 道具效果:\n"
|
169
|
+
for i in range(len(props)):
|
170
|
+
prop = props[i]
|
171
|
+
match prop["type"]:
|
172
|
+
case "normal_fish":
|
173
|
+
result += f" {i + 1}. 普通鱼权重{'增加' if prop['value'] > 0 else '减少'}{prop['value']}\n"
|
174
|
+
case "rare_fish":
|
175
|
+
result += f" {i + 1}. 稀有鱼权重{'增加' if prop['value'] > 0 else '减少'}{prop['value']}\n"
|
176
|
+
case "fish":
|
177
|
+
result += f" {i + 1}. {prop['key']}权重{'增加' if prop['value'] > 0 else '减少'}{prop['value']}\n"
|
178
|
+
case "rm_fish":
|
179
|
+
result += f" {i + 1}. 不会钓到{prop['key']}\n"
|
180
|
+
case "special_fish":
|
181
|
+
result += f" {i + 1}. 特殊鱼概率{'增加' if prop['value'] > 0 else '减少'}{prop['value']}\n"
|
182
|
+
case _:
|
183
|
+
pass
|
184
|
+
return result
|
129
185
|
|
130
186
|
async def random_get_a_special_fish() -> str:
|
131
187
|
"""随机返回一条别人放生的鱼"""
|
@@ -346,10 +402,12 @@ async def get_backpack(user_id: str) -> str:
|
|
346
402
|
fishes_record = await session.scalar(select_user)
|
347
403
|
if fishes_record:
|
348
404
|
load_fishes = json.loads(fishes_record.fishes)
|
405
|
+
sorted_fishes = {key: load_fishes[key] for key in fish_list if key in load_fishes}
|
349
406
|
load_special_fishes = json.loads(fishes_record.special_fishes)
|
350
407
|
if load_special_fishes:
|
351
|
-
|
352
|
-
|
408
|
+
sorted_special_fishes = {key: load_special_fishes[key] for key in sorted(load_special_fishes)}
|
409
|
+
return print_backpack(sorted_fishes, sorted_special_fishes)
|
410
|
+
return "🎒你的背包里空无一物" if sorted_fishes == {} else print_backpack(sorted_fishes)
|
353
411
|
return "🎒你的背包里空无一物"
|
354
412
|
|
355
413
|
|
@@ -367,6 +425,8 @@ async def sell_fish(user_id: str, fish_name: str, quantity: int = 1) -> str:
|
|
367
425
|
"""
|
368
426
|
if quantity <= 0:
|
369
427
|
return "你在卖什么 w(゚Д゚)w"
|
428
|
+
if fish_name not in can_sell_fishes:
|
429
|
+
return f"这个 {fish_name} 不可以卖哦~"
|
370
430
|
session = get_session()
|
371
431
|
async with session.begin():
|
372
432
|
select_user = select(FishingRecord).where(FishingRecord.user_id == user_id)
|
@@ -376,8 +436,6 @@ async def sell_fish(user_id: str, fish_name: str, quantity: int = 1) -> str:
|
|
376
436
|
spec_fishes = json.loads(fishes_record.special_fishes)
|
377
437
|
if fish_name in loads_fishes and loads_fishes[fish_name] > 0:
|
378
438
|
fish_price = get_price(fish_name)
|
379
|
-
if fish_name not in can_sell_fishes:
|
380
|
-
return f"这个 {fish_name} 不可以卖哦~"
|
381
439
|
if loads_fishes[fish_name] < quantity:
|
382
440
|
return f"你没有那么多 {fish_name}"
|
383
441
|
loads_fishes[fish_name] -= quantity
|
@@ -416,6 +474,48 @@ async def sell_fish(user_id: str, fish_name: str, quantity: int = 1) -> str:
|
|
416
474
|
return "查无此鱼"
|
417
475
|
else:
|
418
476
|
return "还没钓鱼就想卖鱼?"
|
477
|
+
|
478
|
+
|
479
|
+
async def buy_fish(user_id: str, fish_name: str, quantity: int = 1) -> str:
|
480
|
+
if quantity <= 0:
|
481
|
+
return "别在渔具店老板面前炫耀自己的鱼 (..-˘ ˘-.#)"
|
482
|
+
if fish_name not in can_buy_fishes:
|
483
|
+
return "商店不卖这个!"
|
484
|
+
|
485
|
+
for fish in config.fishes:
|
486
|
+
if fish["name"] == fish_name:
|
487
|
+
price = fish["price"] * 2
|
488
|
+
amount = fish["amount"] if fish.get("amount") else 1
|
489
|
+
total_price = price * amount * quantity
|
490
|
+
break
|
491
|
+
|
492
|
+
session = get_session()
|
493
|
+
async with session.begin():
|
494
|
+
select_user = select(FishingRecord).where(FishingRecord.user_id == user_id)
|
495
|
+
fishes_record = await session.scalar(select_user)
|
496
|
+
if fishes_record := fishes_record:
|
497
|
+
loads_fishes = json.loads(fishes_record.fishes)
|
498
|
+
user_coin = fishes_record.coin
|
499
|
+
if user_coin < total_price:
|
500
|
+
coin_less = str(total_price - fishes_record.coin)
|
501
|
+
return f"你没有足够的 {fishing_coin_name}, 还需 {coin_less} {fishing_coin_name}"
|
502
|
+
user_coin -= total_price
|
503
|
+
try:
|
504
|
+
loads_fishes[fish_name] += amount * quantity
|
505
|
+
except KeyError:
|
506
|
+
loads_fishes[fish_name] = amount * quantity
|
507
|
+
dump_fishes = json.dumps(loads_fishes)
|
508
|
+
user_update = update(FishingRecord).where(
|
509
|
+
FishingRecord.user_id == user_id
|
510
|
+
).values(
|
511
|
+
coin=user_coin,
|
512
|
+
fishes=dump_fishes
|
513
|
+
)
|
514
|
+
await session.execute(user_update)
|
515
|
+
await session.commit()
|
516
|
+
return (f"你用 {total_price} {fishing_coin_name} 买入了 {quantity * amount} {fish_name}")
|
517
|
+
else:
|
518
|
+
return "不想钓鱼的人就别在渔具店逛了~"
|
419
519
|
|
420
520
|
|
421
521
|
async def get_balance(user_id: str) -> str:
|
@@ -587,8 +687,22 @@ async def get_board() -> list:
|
|
587
687
|
return top_users_list
|
588
688
|
return []
|
589
689
|
|
590
|
-
|
591
|
-
|
690
|
+
def get_shop() -> list[MessageSegment]:
|
691
|
+
messages: list[MessageSegment] = []
|
692
|
+
|
693
|
+
messages.append(MessageSegment.text("===== 渔具店 ====="))
|
694
|
+
|
695
|
+
for fish in config.fishes:
|
696
|
+
if fish.get("can_buy"):
|
697
|
+
name = fish["name"]
|
698
|
+
price = fish["price"] * 2
|
699
|
+
amount = fish["amount"] if fish.get("amount") else 1
|
700
|
+
total_price = price * amount
|
701
|
+
desc = fish["description"] if fish.get("description") else ""
|
702
|
+
messages.append(MessageSegment.text(f"商品名:{name} \n单份数量:{amount}\n单价:{price} {fishing_coin_name}\n单份总价:{total_price} {fishing_coin_name}\n描述:{desc}"))
|
703
|
+
|
704
|
+
return messages
|
705
|
+
|
592
706
|
|
593
707
|
async def check_tools(user_id: str, tools: list) -> str | None:
|
594
708
|
# 这是工具吗?
|
@@ -599,7 +713,7 @@ async def check_tools(user_id: str, tools: list) -> str | None:
|
|
599
713
|
|
600
714
|
# 如果有两个工具,是一个工具一个鱼饵吗?
|
601
715
|
if len(tools) == 2:
|
602
|
-
if get_type(
|
716
|
+
if get_type(tools[0]) == get_type(tools[1]):
|
603
717
|
return "你为啥要用两个类型一样的东西?"
|
604
718
|
|
605
719
|
# 有吗?有吗?
|
{nonebot_plugin_fishing2-0.0.2.dist-info → nonebot_plugin_fishing2-0.0.3.dist-info}/METADATA
RENAMED
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: nonebot-plugin-fishing2
|
3
|
-
Version: 0.0.
|
3
|
+
Version: 0.0.3
|
4
4
|
Summary: 更好的电子钓鱼
|
5
5
|
Author-email: ALittleBot <160833462+C14H22O@users.noreply.github.com>, Polaris_Light <995905922@qq.com>
|
6
6
|
License-Expression: MIT
|
@@ -139,6 +139,6 @@ FISHES='
|
|
139
139
|
- [x] 增加系统商店,卖出钓到的鱼们
|
140
140
|
- [x] 赛博放生 [#4](https://github.com/C14H22O/nonebot-plugin-fishing/issues/4) (已基本完成)
|
141
141
|
- [ ] 使用 [nonebot_plugin_chikari_economy](https://github.com/mrqx0195/nonebot_plugin_chikari_economy) 经济系统
|
142
|
-
- [
|
142
|
+
- [x] 为鱼竿增加耐久度,耐久度为0时需重新购买鱼竿
|
143
143
|
- [ ] 为钓鱼背包添加排序
|
144
144
|
- [x] 添加成就系统
|
@@ -1,14 +1,14 @@
|
|
1
|
-
nonebot_plugin_fishing2/__init__.py,sha256=
|
2
|
-
nonebot_plugin_fishing2/config.py,sha256=
|
3
|
-
nonebot_plugin_fishing2/data_source.py,sha256=
|
1
|
+
nonebot_plugin_fishing2/__init__.py,sha256=i2tmiGGJ4XUOCwi01tyU092Us1Uw-Trp05hg3rXDMbQ,11607
|
2
|
+
nonebot_plugin_fishing2/config.py,sha256=0eTa7GUt9yUiSS2yLCeo8BEteVWh3Zj3d7utvSEPbFw,5698
|
3
|
+
nonebot_plugin_fishing2/data_source.py,sha256=UkcJzCYu1JMYneCYrL4ZqftuAlfPG7bdiXprl5Q_Le0,31357
|
4
4
|
nonebot_plugin_fishing2/model.py,sha256=_DtmxiQhJDiIvY1XOMQZ0HA-ruWY0bexWX9frdhnk0Q,752
|
5
5
|
nonebot_plugin_fishing2/migrations/68463f3e5f33_.py,sha256=WnaV5T1uCHvYWcnepHqV9kOurDYddFUvXXfA2Rtd5Ok,776
|
6
6
|
nonebot_plugin_fishing2/migrations/7609e6d106dd_init_db.py,sha256=tpuIfsS6yPsnGIeMPo16exsEfYZ_urgYAqlCyQ8aw-Y,1386
|
7
7
|
nonebot_plugin_fishing2/migrations/c5ab992c9af3_add_achievements.py,sha256=KVj9ADeP03zfW4ZBDmnghbWdxLor3u1yKeho0GaddCI,1119
|
8
8
|
nonebot_plugin_fishing2/migrations/e9015df43907_add_special_fishes_field.py,sha256=R4p9vPD5lgg4vmY2KUgF2qIlraxhPYkL93lM5l7wMZw,1094
|
9
9
|
nonebot_plugin_fishing2/migrations/f70bdeaec7a4_add_specialfishes_table.py,sha256=DUqv9MTaOSZCBj_9oT2eY3pmWeMnyH0cPj9GyYa5Sag,1194
|
10
|
-
nonebot_plugin_fishing2-0.0.
|
11
|
-
nonebot_plugin_fishing2-0.0.
|
12
|
-
nonebot_plugin_fishing2-0.0.
|
13
|
-
nonebot_plugin_fishing2-0.0.
|
14
|
-
nonebot_plugin_fishing2-0.0.
|
10
|
+
nonebot_plugin_fishing2-0.0.3.dist-info/licenses/LICENSE,sha256=yuLTg7OdKnH7rznCsJ31UJwI4B8_oEP4f_zE7bJS75w,1091
|
11
|
+
nonebot_plugin_fishing2-0.0.3.dist-info/METADATA,sha256=dYqboVGyAKQOhG9ZmVgaEVaG3Tf-ss9ezd6sqSPaQRU,4667
|
12
|
+
nonebot_plugin_fishing2-0.0.3.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
13
|
+
nonebot_plugin_fishing2-0.0.3.dist-info/top_level.txt,sha256=nSgqw96Nh44l966KEYkw0rbdyEJyzi2V7jCZ1kCZIps,24
|
14
|
+
nonebot_plugin_fishing2-0.0.3.dist-info/RECORD,,
|
File without changes
|
{nonebot_plugin_fishing2-0.0.2.dist-info → nonebot_plugin_fishing2-0.0.3.dist-info}/licenses/LICENSE
RENAMED
File without changes
|
{nonebot_plugin_fishing2-0.0.2.dist-info → nonebot_plugin_fishing2-0.0.3.dist-info}/top_level.txt
RENAMED
File without changes
|