nonebot-plugin-fishing2 0.0.4__py3-none-any.whl → 0.1.0__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 +29 -36
- nonebot_plugin_fishing2/config.py +12 -17
- nonebot_plugin_fishing2/data_source.py +51 -18
- {nonebot_plugin_fishing2-0.0.4.dist-info → nonebot_plugin_fishing2-0.1.0.dist-info}/METADATA +176 -168
- {nonebot_plugin_fishing2-0.0.4.dist-info → nonebot_plugin_fishing2-0.1.0.dist-info}/RECORD +8 -9
- {nonebot_plugin_fishing2-0.0.4.dist-info → nonebot_plugin_fishing2-0.1.0.dist-info}/WHEEL +1 -2
- nonebot_plugin_fishing2-0.0.4.dist-info/top_level.txt +0 -1
- {nonebot_plugin_fishing2-0.0.4.dist-info/licenses → nonebot_plugin_fishing2-0.1.0.dist-info}/LICENSE +0 -0
@@ -39,21 +39,25 @@ from .data_source import (
|
|
39
39
|
get_shop,
|
40
40
|
buy_fish,
|
41
41
|
predict,
|
42
|
-
|
42
|
+
get_pool,
|
43
43
|
)
|
44
44
|
from .fish_helper import fish_list, get_fish_by_name
|
45
45
|
|
46
46
|
fishing_coin_name = config.fishing_coin_name
|
47
|
+
cool_down = (
|
48
|
+
f"{config.fishing_cooldown_time_min}s~{config.fishing_cooldown_time_max}s"
|
49
|
+
if config.fishing_cooldown_time_min != config.fishing_cooldown_time_max
|
50
|
+
else f"{config.fishing_cooldown_time_min}s"
|
51
|
+
) # 浮动 CD 法力无边,有效遏制频繁钓鱼
|
47
52
|
|
48
53
|
__plugin_meta__ = PluginMetadata(
|
49
54
|
name="更好的电子钓鱼",
|
50
55
|
description="赛博钓鱼……但是加强版本",
|
51
56
|
usage=f"""▶ 查询 [物品]:查询某个物品的信息
|
52
57
|
▶ 钓鱼 [鱼竿] [鱼饵]:
|
53
|
-
▷
|
54
|
-
▷ {config.no_fish_probability} 概率空军,{config.special_fish_probability}
|
58
|
+
▷ 钓鱼后有 {cool_down} 的冷却,频繁钓鱼会触怒河神
|
59
|
+
▷ {config.no_fish_probability} 概率空军,{config.special_fish_probability} 概率钓到特殊鱼
|
55
60
|
▷ 加参数可以使用鱼饵或鱼竿,同类物品同时只能使用一种
|
56
|
-
▷ 频繁钓鱼会触怒河神
|
57
61
|
▶ 出售 <物品> <数量>:出售物品获得{fishing_coin_name}
|
58
62
|
▷ 如果卖不出去,尝试用英文双引号框住鱼名
|
59
63
|
▶ 购买 <物品> <份数>:购买渔具店的物品
|
@@ -69,7 +73,7 @@ __plugin_meta__ = PluginMetadata(
|
|
69
73
|
homepage="https://github.com/FDCraft/nonebot-plugin-fishing2",
|
70
74
|
config=Config,
|
71
75
|
supported_adapters={"~onebot.v11"},
|
72
|
-
extra={"author": "Polaris_Light", "version": "0.0
|
76
|
+
extra={"author": "Polaris_Light", "version": "0.1.0", "priority": 5},
|
73
77
|
)
|
74
78
|
|
75
79
|
|
@@ -127,7 +131,9 @@ async def _(
|
|
127
131
|
)
|
128
132
|
elif arg not in fish_list:
|
129
133
|
await fishing_lookup.finish(MessageSegment.at(user_id) + " 查无此鱼。")
|
130
|
-
|
134
|
+
|
135
|
+
messages = get_fish_by_name(arg).print_info()
|
136
|
+
await forward_send(bot, event, messages)
|
131
137
|
return None
|
132
138
|
|
133
139
|
|
@@ -160,6 +166,7 @@ async def _(bot: Bot, event: Event, matcher: Matcher, arg: Message = CommandArg(
|
|
160
166
|
for achievement in achievements:
|
161
167
|
await fishing.send(achievement)
|
162
168
|
except Exception as e:
|
169
|
+
result = "河神睡着了……"
|
163
170
|
logger.error(e)
|
164
171
|
finally:
|
165
172
|
block_user_list.remove(user_id)
|
@@ -199,29 +206,9 @@ async def _(bot: Bot, event: Union[GroupMessageEvent, PrivateMessageEvent]):
|
|
199
206
|
if not is_superuser and not is_self:
|
200
207
|
return None
|
201
208
|
|
202
|
-
|
203
|
-
pool = await get_all_special_fish()
|
204
|
-
message.append(MessageSegment.text(f"现在鱼池里面有 {len(pool)} 条鱼。"))
|
205
|
-
|
206
|
-
result = dict()
|
207
|
-
for fish in pool:
|
208
|
-
try:
|
209
|
-
result[fish] += 1
|
210
|
-
except KeyError:
|
211
|
-
result[fish] = 1
|
212
|
-
|
213
|
-
msg = "鱼池列表:\n"
|
214
|
-
for fish, num in result.items():
|
215
|
-
if len(msg) > 300:
|
216
|
-
msg += f"{fish} x {num}"
|
217
|
-
message.append(MessageSegment.text(msg))
|
218
|
-
msg = ""
|
219
|
-
else:
|
220
|
-
msg += f"{fish} x {num}\n"
|
221
|
-
else:
|
222
|
-
message.append(MessageSegment.text(msg))
|
209
|
+
messages: list[MessageSegment] = await get_pool()
|
223
210
|
|
224
|
-
await forward_send(bot, event,
|
211
|
+
await forward_send(bot, event, messages)
|
225
212
|
return None
|
226
213
|
|
227
214
|
|
@@ -239,13 +226,13 @@ async def _(bot: Bot, event: Union[GroupMessageEvent, PrivateMessageEvent]):
|
|
239
226
|
+ "\n\n".join(await get_backpack(user_id))
|
240
227
|
)
|
241
228
|
else:
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
229
|
+
messages: list[MessageSegment] = []
|
230
|
+
messages.append(MessageSegment.at(user_id))
|
231
|
+
messages.append(await get_stats(user_id))
|
232
|
+
messages.append(await get_balance(user_id))
|
246
233
|
backpacks = await get_backpack(user_id)
|
247
|
-
|
248
|
-
await forward_send(bot, event,
|
234
|
+
messages += [MessageSegment.text(msg) for msg in backpacks]
|
235
|
+
await forward_send(bot, event, messages)
|
249
236
|
|
250
237
|
|
251
238
|
@buy.handle()
|
@@ -303,7 +290,13 @@ async def _(bot: Bot, event: Event, arg: Message = CommandArg()):
|
|
303
290
|
fish_name = arg.extract_plain_text()
|
304
291
|
user_id = event.get_user_id()
|
305
292
|
|
306
|
-
if
|
293
|
+
if (
|
294
|
+
"\u200b" in fish_name
|
295
|
+
or "\u200c" in fish_name
|
296
|
+
or "\u200d" in fish_name
|
297
|
+
or "\u2060" in fish_name
|
298
|
+
or "\ufeff" in fish_name
|
299
|
+
):
|
307
300
|
if isinstance(event, GroupMessageEvent):
|
308
301
|
group_id = event.group_id
|
309
302
|
await bot.set_group_ban(group_id=group_id, user_id=user_id, duration=1800)
|
@@ -327,7 +320,7 @@ async def _(bot: Bot, event: Event, matcher: Matcher):
|
|
327
320
|
await punish(bot, event, matcher, user_id)
|
328
321
|
result = await lottery(user_id)
|
329
322
|
except:
|
330
|
-
|
323
|
+
result = "河神睡着了……"
|
331
324
|
finally:
|
332
325
|
punish_user_dict.pop(user_id, None)
|
333
326
|
await lottery_cmd.finish(MessageSegment.at(user_id) + " " + result)
|
@@ -1,12 +1,8 @@
|
|
1
1
|
from pydantic import BaseModel
|
2
2
|
from typing import List, Dict
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
from nonebot import get_plugin_config
|
7
|
-
except ImportError:
|
8
|
-
# pydantic v1
|
9
|
-
from nonebot import get_driver
|
4
|
+
from nonebot import get_plugin_config
|
5
|
+
|
10
6
|
|
11
7
|
# fmt:off
|
12
8
|
class Config(BaseModel):
|
@@ -126,7 +122,7 @@ class Config(BaseModel):
|
|
126
122
|
{
|
127
123
|
"type": "item",
|
128
124
|
"name": "钛金鱼竿",
|
129
|
-
"price":
|
125
|
+
"price": 40,
|
130
126
|
"amount": 20,
|
131
127
|
"props": [
|
132
128
|
{
|
@@ -141,12 +137,13 @@ class Config(BaseModel):
|
|
141
137
|
"description": "更坚韧的鱼竿,显著提升钓上大鱼的概率。",
|
142
138
|
"can_catch": False,
|
143
139
|
"can_buy": True,
|
140
|
+
"buy_price": 40,
|
144
141
|
"can_sell": False
|
145
142
|
},
|
146
143
|
{
|
147
144
|
"type": "item",
|
148
145
|
"name": "附魔鱼竿",
|
149
|
-
"price":
|
146
|
+
"price": 20,
|
150
147
|
"amount": 20,
|
151
148
|
"props": [
|
152
149
|
{
|
@@ -157,7 +154,7 @@ class Config(BaseModel):
|
|
157
154
|
"description": "附魔的鱼竿,大幅减少钓上垃圾的概率。",
|
158
155
|
"can_catch": True,
|
159
156
|
"sleep_time": 30,
|
160
|
-
"weight":
|
157
|
+
"weight": 40,
|
161
158
|
"can_buy": False,
|
162
159
|
"can_sell": False
|
163
160
|
},
|
@@ -211,7 +208,7 @@ class Config(BaseModel):
|
|
211
208
|
"value": -1
|
212
209
|
}
|
213
210
|
],
|
214
|
-
"description": "
|
211
|
+
"description": "必定钓到特殊鱼。",
|
215
212
|
"can_catch": False,
|
216
213
|
"can_buy": False,
|
217
214
|
"can_sell": False
|
@@ -277,7 +274,9 @@ class Config(BaseModel):
|
|
277
274
|
|
278
275
|
fishing_coin_name: str = "绿宝石" # 货币名称
|
279
276
|
|
280
|
-
|
277
|
+
fishing_cooldown_time_min: int = 60 # 钓鱼冷却下限,单位为秒
|
278
|
+
|
279
|
+
fishing_cooldown_time_max: int = 90 # 钓鱼冷却上限
|
281
280
|
|
282
281
|
punish_limit: int = 3 # 短时间多次钓鱼后,禁言所需次数,防止刷屏
|
283
282
|
|
@@ -298,9 +297,5 @@ class Config(BaseModel):
|
|
298
297
|
backpack_forward: bool = True # 背包是否使用聊天记录
|
299
298
|
# fmt:on
|
300
299
|
|
301
|
-
|
302
|
-
|
303
|
-
config = get_plugin_config(Config)
|
304
|
-
except:
|
305
|
-
# pydantic v1
|
306
|
-
config = Config.parse_obj(get_driver().config)
|
300
|
+
config = get_plugin_config(Config)
|
301
|
+
|
@@ -227,15 +227,6 @@ async def random_get_a_special_fish() -> str:
|
|
227
227
|
return data.fish
|
228
228
|
|
229
229
|
|
230
|
-
async def get_all_special_fish() -> list[str]:
|
231
|
-
session = get_session()
|
232
|
-
async with session.begin():
|
233
|
-
random_select = select(SpecialFishes.fish).order_by(SpecialFishes.fish.asc())
|
234
|
-
data = await session.scalars(random_select)
|
235
|
-
result = data.all()
|
236
|
-
return result
|
237
|
-
|
238
|
-
|
239
230
|
async def check_achievement(user_id: str) -> str | None:
|
240
231
|
session = get_session()
|
241
232
|
async with session.begin():
|
@@ -309,7 +300,9 @@ async def save_achievement(user_id: str, achievement_name: str):
|
|
309
300
|
|
310
301
|
async def save_fish(user_id: str, fish_name: str) -> None:
|
311
302
|
time_now = int(time.time())
|
312
|
-
|
303
|
+
fishing_cooldown = random.randint(
|
304
|
+
config.fishing_cooldown_time_min, config.fishing_cooldown_time_max
|
305
|
+
)
|
313
306
|
amount = get_fish_by_name(fish_name).amount
|
314
307
|
session = get_session()
|
315
308
|
async with session.begin():
|
@@ -327,7 +320,7 @@ async def save_fish(user_id: str, fish_name: str) -> None:
|
|
327
320
|
update(FishingRecord)
|
328
321
|
.where(FishingRecord.user_id == user_id)
|
329
322
|
.values(
|
330
|
-
time=time_now +
|
323
|
+
time=time_now + fishing_cooldown,
|
331
324
|
frequency=new_frequency,
|
332
325
|
fishes=dump_fishes,
|
333
326
|
)
|
@@ -339,7 +332,7 @@ async def save_fish(user_id: str, fish_name: str) -> None:
|
|
339
332
|
dump_fishes = json.dumps(data)
|
340
333
|
new_record = FishingRecord(
|
341
334
|
user_id=user_id,
|
342
|
-
time=time_now +
|
335
|
+
time=time_now + fishing_cooldown,
|
343
336
|
frequency=1,
|
344
337
|
fishes=dump_fishes,
|
345
338
|
special_fishes="{}",
|
@@ -352,7 +345,9 @@ async def save_fish(user_id: str, fish_name: str) -> None:
|
|
352
345
|
|
353
346
|
async def save_special_fish(user_id: str, fish_name: str) -> None:
|
354
347
|
time_now = int(time.time())
|
355
|
-
|
348
|
+
fishing_cooldown = random.randint(
|
349
|
+
config.fishing_cooldown_time_min, config.fishing_cooldown_time_max
|
350
|
+
)
|
356
351
|
session = get_session()
|
357
352
|
async with session.begin():
|
358
353
|
select_user = select(FishingRecord).where(FishingRecord.user_id == user_id)
|
@@ -368,7 +363,7 @@ async def save_special_fish(user_id: str, fish_name: str) -> None:
|
|
368
363
|
update(FishingRecord)
|
369
364
|
.where(FishingRecord.user_id == user_id)
|
370
365
|
.values(
|
371
|
-
time=time_now +
|
366
|
+
time=time_now + fishing_cooldown,
|
372
367
|
frequency=record.frequency + 1,
|
373
368
|
special_fishes=dump_fishes,
|
374
369
|
)
|
@@ -379,7 +374,7 @@ async def save_special_fish(user_id: str, fish_name: str) -> None:
|
|
379
374
|
dump_fishes = json.dumps(data)
|
380
375
|
new_record = FishingRecord(
|
381
376
|
user_id=user_id,
|
382
|
-
time=time_now +
|
377
|
+
time=time_now + fishing_cooldown,
|
383
378
|
frequency=1,
|
384
379
|
fishes="{}",
|
385
380
|
special_fishes=dump_fishes,
|
@@ -549,7 +544,9 @@ async def lottery(user_id: str) -> str:
|
|
549
544
|
"""算法来自于 https://github.com/fossifer/minesweeperbot/blob/master/cards.py"""
|
550
545
|
session = get_session()
|
551
546
|
time_now = int(time.time())
|
552
|
-
|
547
|
+
fishing_cooldown = random.randint(
|
548
|
+
config.fishing_cooldown_time_min, config.fishing_cooldown_time_max
|
549
|
+
)
|
553
550
|
async with session.begin():
|
554
551
|
select_user = select(FishingRecord).where(FishingRecord.user_id == user_id)
|
555
552
|
fishes_record = await session.scalar(select_user)
|
@@ -561,7 +558,7 @@ async def lottery(user_id: str) -> str:
|
|
561
558
|
update(FishingRecord)
|
562
559
|
.where(FishingRecord.user_id == user_id)
|
563
560
|
.values(
|
564
|
-
time=time_now +
|
561
|
+
time=time_now + fishing_cooldown,
|
565
562
|
coin=fishes_record.coin + new_coin,
|
566
563
|
)
|
567
564
|
)
|
@@ -576,7 +573,7 @@ async def lottery(user_id: str) -> str:
|
|
576
573
|
update(FishingRecord)
|
577
574
|
.where(FishingRecord.user_id == user_id)
|
578
575
|
.values(
|
579
|
-
time=time_now +
|
576
|
+
time=time_now + fishing_cooldown,
|
580
577
|
coin=fishes_record.coin + new_coin,
|
581
578
|
)
|
582
579
|
)
|
@@ -638,6 +635,42 @@ async def give(user_id: str, fish_name: str, quantity: int = 1) -> str:
|
|
638
635
|
return "未查找到用户信息, 无法执行滥权操作 w(゚Д゚)w"
|
639
636
|
|
640
637
|
|
638
|
+
async def get_all_special_fish() -> list[str]:
|
639
|
+
session = get_session()
|
640
|
+
async with session.begin():
|
641
|
+
random_select = select(SpecialFishes.fish).order_by(SpecialFishes.fish.asc())
|
642
|
+
data = await session.scalars(random_select)
|
643
|
+
result = data.all()
|
644
|
+
return result
|
645
|
+
|
646
|
+
|
647
|
+
async def get_pool() -> list[MessageSegment]:
|
648
|
+
|
649
|
+
messages: list[MessageSegment] = []
|
650
|
+
pool = await get_all_special_fish()
|
651
|
+
messages.append(MessageSegment.text(f"现在鱼池里面有 {len(pool)} 条鱼。"))
|
652
|
+
|
653
|
+
result = dict()
|
654
|
+
for fish in pool:
|
655
|
+
try:
|
656
|
+
result[fish] += 1
|
657
|
+
except KeyError:
|
658
|
+
result[fish] = 1
|
659
|
+
|
660
|
+
msg = "鱼池列表:\n"
|
661
|
+
for fish, num in result.items():
|
662
|
+
if len(msg) > 300:
|
663
|
+
msg += f"{fish} x {num}"
|
664
|
+
messages.append(MessageSegment.text(msg))
|
665
|
+
msg = ""
|
666
|
+
else:
|
667
|
+
msg += f"{fish} x {num}\n"
|
668
|
+
else:
|
669
|
+
messages.append(MessageSegment.text(msg))
|
670
|
+
|
671
|
+
return messages
|
672
|
+
|
673
|
+
|
641
674
|
async def get_stats(user_id: str) -> str:
|
642
675
|
session = get_session()
|
643
676
|
async with session.begin():
|
{nonebot_plugin_fishing2-0.0.4.dist-info → nonebot_plugin_fishing2-0.1.0.dist-info}/METADATA
RENAMED
@@ -1,168 +1,176 @@
|
|
1
|
-
Metadata-Version: 2.
|
2
|
-
Name: nonebot-plugin-fishing2
|
3
|
-
Version: 0.0
|
4
|
-
Summary: 更好的电子钓鱼
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
Requires-Python: >=3.8
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
Requires-Dist: nonebot-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
<div align="center">
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
<
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
<
|
40
|
-
|
41
|
-
</
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
<
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
<
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
<
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
<
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
</details>
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
|
97
|
-
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
"
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
###
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
- [x]
|
166
|
-
- [
|
167
|
-
- [ ]
|
168
|
-
- [ ]
|
1
|
+
Metadata-Version: 2.3
|
2
|
+
Name: nonebot-plugin-fishing2
|
3
|
+
Version: 0.1.0
|
4
|
+
Summary: 更好的电子钓鱼
|
5
|
+
License: MIT
|
6
|
+
Keywords: fishing
|
7
|
+
Author: ALittleBot
|
8
|
+
Author-email: 160833462+C14H22O@users.noreply.github.com
|
9
|
+
Requires-Python: >=3.8
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
12
|
+
Classifier: Programming Language :: Python :: 3.8
|
13
|
+
Classifier: Programming Language :: Python :: 3.9
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
18
|
+
Requires-Dist: nonebot-adapter-onebot (>=2.0.0-beta.1)
|
19
|
+
Requires-Dist: nonebot-plugin-localstore (>=0.6.0)
|
20
|
+
Requires-Dist: nonebot-plugin-orm (>=0.7.1)
|
21
|
+
Requires-Dist: nonebot2 (>=2.2.1)
|
22
|
+
Requires-Dist: pydantic (>=1.10)
|
23
|
+
Requires-Dist: sqlalchemy (>=2.0.27)
|
24
|
+
Project-URL: Homepage, https://github.com/FDCraft/nonebot-plugin-fishing2
|
25
|
+
Description-Content-Type: text/markdown
|
26
|
+
|
27
|
+
<div align="center">
|
28
|
+
<a href="https://v2.nonebot.dev/store"><img src="https://github.com/A-kirami/nonebot-plugin-template/blob/resources/nbp_logo.png" width="180" height="180" alt="NoneBotPluginLogo"></a>
|
29
|
+
<br>
|
30
|
+
<p><img src="https://github.com/A-kirami/nonebot-plugin-template/blob/resources/NoneBotPlugin.svg" width="240" alt="NoneBotPluginText"></p>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
<div align="center">
|
34
|
+
|
35
|
+
# nonebot-plugin-fishing2
|
36
|
+
|
37
|
+
_✨ 更好的电子钓鱼 ✨_
|
38
|
+
|
39
|
+
<a href="./LICENSE">
|
40
|
+
<img src="https://img.shields.io/github/license/FDCraft/nonebot-plugin-fishing2.svg" alt="license">
|
41
|
+
</a>
|
42
|
+
<a href="https://pypi.python.org/pypi/nonebot-plugin-fishing2">
|
43
|
+
<img src="https://img.shields.io/pypi/v/nonebot-plugin-fishing2.svg" alt="pypi">
|
44
|
+
</a>
|
45
|
+
<img src="https://img.shields.io/badge/python-3.8+-blue.svg" alt="python">
|
46
|
+
|
47
|
+
</div>
|
48
|
+
|
49
|
+
## 💿 安装
|
50
|
+
|
51
|
+
<details open>
|
52
|
+
<summary>使用 nb-cli 安装</summary>
|
53
|
+
在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装
|
54
|
+
|
55
|
+
nb plugin install nonebot-plugin-fishing2
|
56
|
+
|
57
|
+
</details>
|
58
|
+
|
59
|
+
<details>
|
60
|
+
<summary>使用包管理器安装</summary>
|
61
|
+
在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令
|
62
|
+
|
63
|
+
<details>
|
64
|
+
<summary>pip</summary>
|
65
|
+
|
66
|
+
pip install nonebot-plugin-fishing2
|
67
|
+
</details>
|
68
|
+
<details>
|
69
|
+
<summary>pdm</summary>
|
70
|
+
|
71
|
+
pdm add nonebot-plugin-fishing2
|
72
|
+
</details>
|
73
|
+
<details>
|
74
|
+
<summary>poetry</summary>
|
75
|
+
|
76
|
+
poetry add nonebot-plugin-fishing2
|
77
|
+
</details>
|
78
|
+
<details>
|
79
|
+
<summary>conda</summary>
|
80
|
+
|
81
|
+
conda install nonebot-plugin-fishing2
|
82
|
+
</details>
|
83
|
+
|
84
|
+
打开 nonebot2 项目根目录下的 `pyproject.toml` 文件, 在 `[tool.nonebot]` 部分追加写入
|
85
|
+
|
86
|
+
plugins = ["nonebot_plugin_fishing2"]
|
87
|
+
|
88
|
+
</details>
|
89
|
+
|
90
|
+
注意:安装过后,需在控制台输入 `nb orm upgrade` 指令以初始化数据库。本插件数据库与 [Nonebot-plugin-fishing](https://github.com/ALittleBot/nonebot-plugin-fishing) 通用,可以互换。
|
91
|
+
|
92
|
+
## ⚙️ 配置
|
93
|
+
|
94
|
+
在 nonebot2 项目的`.env`文件中添加下表中的配置
|
95
|
+
|
96
|
+
| 配置项 | 必填 | 说明 |
|
97
|
+
|:-------------------------:|:----:|:--------------------------------------------------------------:|
|
98
|
+
| fishes | 否 | 鱼塘内的普通鱼(大概是鱼……) |
|
99
|
+
| fishing_achievement | 否 | 钓鱼成就 |
|
100
|
+
| fishing_coin_name | 否 | 卖鱼获取的货币名称 |
|
101
|
+
| fishing_cooldown_time_min | 否 | 钓鱼冷却下限,单位为秒 |
|
102
|
+
| fishing_cooldown_time_max | 否 | 钓鱼冷却上限 |
|
103
|
+
| punish_limit | 否 | 短时间多次钓鱼后,禁言所需次数,防止刷屏 |
|
104
|
+
| special_fish_enabled | 否 | 是否启用赛博放生 & 特殊鱼(默认为否) |
|
105
|
+
| special_fish_price | 否 | 特殊鱼出售的价格 |
|
106
|
+
| special_fish_free_price | 否 | 特殊鱼放生的价格 |
|
107
|
+
| special_fish_probability | 否 | 钓上特殊鱼的概率,注意这个判定在空军判定之后 |
|
108
|
+
| no_fish_probability | 否 | 空军的概率 |
|
109
|
+
| rare_fish_weight | 否 | 稀有鱼权重分界线,影响 rare_fish 属性与 normal_fish 属性的区分 |
|
110
|
+
| buy_rate | 否 | 在不指定 buy_price 时,购买价格/基准价格比,应大于 1 |
|
111
|
+
| backpack_forward | 否 | 背包是否使用聊天记录 |
|
112
|
+
|
113
|
+
其中 `fishes` 配置项说明如下。预设配置经过了计算以平衡,如果需要自行填表,请使用“钓鱼预测”命令进行预测。
|
114
|
+
|
115
|
+
```dotenv
|
116
|
+
FISHES='
|
117
|
+
[
|
118
|
+
{
|
119
|
+
"type": "fish", # 类型,必填,可用值:fish, item,同类型物品不能同时作为鱼饵
|
120
|
+
"name": "小鱼", # 名称,必填
|
121
|
+
"price": 15, # 基准价格,必填
|
122
|
+
"amount": 1, # 单份数量,模拟耐久
|
123
|
+
"props": [ # 属性,选填,作为鱼饵时改变
|
124
|
+
{
|
125
|
+
"type": "rm_fish", # 可用值: rare_fish, normal_fish, fish, rm_fish, special_fish, no_fish
|
126
|
+
"key": "小鱼", # 如果为 fish 或 rm_fish,需要填写鱼名
|
127
|
+
"value": 0 # 如果为 rare_fish, normal_fish, fish,填写权重;如果为 special_fish, no_fish,填写概率
|
128
|
+
}
|
129
|
+
],
|
130
|
+
"description": "一条小鱼。把它当做鱼饵可以防止钓到小鱼。", # 描述,必填
|
131
|
+
"can_catch": True, # 是否可以抓取,必填
|
132
|
+
"sleep_time": 2, # 钓上来需要的时间,默认 60
|
133
|
+
"weight": 1000, # 权重
|
134
|
+
"can_buy": True, # 是否可以购买,必填
|
135
|
+
"buy_price": 50, # 购买价格
|
136
|
+
"can_sell": True # 是否可以出售,必填
|
137
|
+
},
|
138
|
+
]
|
139
|
+
'
|
140
|
+
```
|
141
|
+
|
142
|
+
## 🔨 更新
|
143
|
+
|
144
|
+
每一次更新后,需执行 `nb orm upgrade`。
|
145
|
+
|
146
|
+
## 🎉 使用
|
147
|
+
|
148
|
+
### 指令表
|
149
|
+
|
150
|
+
在群聊或私聊发送“钓鱼帮助”查看本插件的帮助,或者使用[NoneBot-Plugin-PicMenu-Next](https://github.com/lgc-NB2Dev/nonebot-plugin-picmenu-next)等帮助插件查看。
|
151
|
+
|
152
|
+
### 管理员指令表
|
153
|
+
|
154
|
+
| 指令 | 范围 | 说明 |
|
155
|
+
|:--------:|:----:|:----------------------------------------------:|
|
156
|
+
| 钓鱼预测 | 所有 | 对钓鱼进行模拟,查看各鱼的概率与期望,便于填表 |
|
157
|
+
| 鱼池 | 所有 | 查看数据库里面的所有特殊鱼 |
|
158
|
+
|
159
|
+
### 赛博放生
|
160
|
+
|
161
|
+
当用户使用货币放生由自己取名的一条鱼后,每个用户在钓鱼时都有机会钓到那一条鱼。但此功能开关 `special_fish_enabled` 默认关闭,原因是用户生成内容如果不符合规范,可能导致出现不可预料的情况,请谨慎开启。
|
162
|
+
|
163
|
+
## 📝 Todo
|
164
|
+
|
165
|
+
- [x] 重写数据库逻辑(改为使用 [nonebot/plugin-orm](https://github.com/nonebot/plugin-orm))
|
166
|
+
- [x] 增加系统商店,卖出钓到的鱼
|
167
|
+
- [x] 赛博放生 [#4](https://github.com/C14H22O/nonebot-plugin-fishing/issues/4) (已基本完成)
|
168
|
+
- [ ] ~~使用 [nonebot_plugin_chikari_economy](https://github.com/mrqx0195/nonebot_plugin_chikari_economy) 经济系统~~
|
169
|
+
- [x] 为鱼竿增加耐久度,耐久度为0时需重新购买鱼竿
|
170
|
+
- [x] 为钓鱼背包添加排序
|
171
|
+
- [x] 添加成就系统
|
172
|
+
- [x] 买装备!
|
173
|
+
- [ ] 支持卖与普通鱼同名的特殊鱼
|
174
|
+
- [ ] 管理员命令:捞鱼
|
175
|
+
- [ ] 屏蔽词库
|
176
|
+
|
@@ -1,15 +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=F-CFOiu-FwvAxofCbeGLqPjI81_gfQNQhsoWu59sH5s,16436
|
2
|
+
nonebot_plugin_fishing2/config.py,sha256=xYDdq9Rwce8vfg-M91lUd2TfZDQnToHlI77GdpLFp-U,9751
|
3
|
+
nonebot_plugin_fishing2/data_source.py,sha256=-8fttiui-tCr3r9-c3U7_PLdxbryW-f_uJFXhhHl1Sc,30778
|
4
4
|
nonebot_plugin_fishing2/fish_helper.py,sha256=Rf3SX4UcM0-E6apLUbHB40I4onK-8qPZmZrsVBMnZ3I,6054
|
5
|
-
nonebot_plugin_fishing2/model.py,sha256=_DtmxiQhJDiIvY1XOMQZ0HA-ruWY0bexWX9frdhnk0Q,752
|
6
5
|
nonebot_plugin_fishing2/migrations/68463f3e5f33_.py,sha256=WnaV5T1uCHvYWcnepHqV9kOurDYddFUvXXfA2Rtd5Ok,776
|
7
6
|
nonebot_plugin_fishing2/migrations/7609e6d106dd_init_db.py,sha256=tpuIfsS6yPsnGIeMPo16exsEfYZ_urgYAqlCyQ8aw-Y,1386
|
8
7
|
nonebot_plugin_fishing2/migrations/c5ab992c9af3_add_achievements.py,sha256=KVj9ADeP03zfW4ZBDmnghbWdxLor3u1yKeho0GaddCI,1119
|
9
8
|
nonebot_plugin_fishing2/migrations/e9015df43907_add_special_fishes_field.py,sha256=R4p9vPD5lgg4vmY2KUgF2qIlraxhPYkL93lM5l7wMZw,1094
|
10
9
|
nonebot_plugin_fishing2/migrations/f70bdeaec7a4_add_specialfishes_table.py,sha256=DUqv9MTaOSZCBj_9oT2eY3pmWeMnyH0cPj9GyYa5Sag,1194
|
11
|
-
nonebot_plugin_fishing2
|
12
|
-
nonebot_plugin_fishing2-0.0.
|
13
|
-
nonebot_plugin_fishing2-0.0.
|
14
|
-
nonebot_plugin_fishing2-0.0.
|
15
|
-
nonebot_plugin_fishing2-0.0.
|
10
|
+
nonebot_plugin_fishing2/model.py,sha256=_DtmxiQhJDiIvY1XOMQZ0HA-ruWY0bexWX9frdhnk0Q,752
|
11
|
+
nonebot_plugin_fishing2-0.1.0.dist-info/LICENSE,sha256=n-2xoOXX434-tBisMKX2-_FycV2VrmIiTP1rZvuW_fY,1091
|
12
|
+
nonebot_plugin_fishing2-0.1.0.dist-info/METADATA,sha256=g5XWZCLnZ9nGAwW5GUXaEF8g_2yHLe7XEGH0mFxY6Ag,7793
|
13
|
+
nonebot_plugin_fishing2-0.1.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
|
14
|
+
nonebot_plugin_fishing2-0.1.0.dist-info/RECORD,,
|
@@ -1 +0,0 @@
|
|
1
|
-
nonebot_plugin_fishing2
|
{nonebot_plugin_fishing2-0.0.4.dist-info/licenses → nonebot_plugin_fishing2-0.1.0.dist-info}/LICENSE
RENAMED
File without changes
|