nonebot-plugin-l4d2-server 0.6.6__py3-none-any.whl → 1.0.0a1__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_l4d2_server/__init__.py +9 -92
- nonebot_plugin_l4d2_server/__main__.py +90 -0
- nonebot_plugin_l4d2_server/config.py +30 -0
- nonebot_plugin_l4d2_server/data/L4D2/image/head/head.png +0 -0
- nonebot_plugin_l4d2_server/data/L4D2/image/header/logo.png +0 -0
- nonebot_plugin_l4d2_server/data/L4D2/image/header/player1.jpg +0 -0
- nonebot_plugin_l4d2_server/data/L4D2/image/template/anne.html +50 -42
- nonebot_plugin_l4d2_server/data/L4D2/image/template/back.png +0 -0
- nonebot_plugin_l4d2_server/data/L4D2/image/template/group_ip.html +1 -2
- nonebot_plugin_l4d2_server/data/L4D2/image/template/help.html +1 -2
- nonebot_plugin_l4d2_server/data/L4D2/image/template/help_dack.html +259 -221
- nonebot_plugin_l4d2_server/data/L4D2/image/template/ip.html +1 -2
- nonebot_plugin_l4d2_server/data/font/loli.ttf +0 -0
- nonebot_plugin_l4d2_server/data/icon//344/273/213/347/273/215.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//344/273/273/345/212/241.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//344/277/241/346/201/257.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/205/254/345/221/212.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/210/200/345/211/221.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/210/207/346/215/242.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/210/240/351/231/244.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/210/267/346/226/260.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/215/241/347/273/204.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/223/252/351/207/214.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/234/260/345/233/276.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/257/274/345/205/245.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/257/274/345/207/272.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//345/275/261.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/213/274/345/233/276.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/216/242/347/264/242.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/216/250/351/200/201.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/224/266/351/233/206.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/224/273/347/225/245.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/233/264/346/226/260.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/235/220/346/226/231.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/237/245/350/257/242.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/240/241/351/252/214.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/257/217/346/234/210.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/267/261/346/270/212.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/267/273/345/212/240.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//346/270/205/351/231/244.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//347/212/266/346/200/201.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//347/255/276/345/210/260.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//347/273/221/345/256/232.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//350/241/250.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//350/241/250/346/203/205.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//350/247/222/350/211/262.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//350/256/260/345/275/225.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//351/205/215/347/275/256.png +0 -0
- nonebot_plugin_l4d2_server/data/icon//351/207/215/345/220/257.png +0 -0
- nonebot_plugin_l4d2_server/data/img/l4d2.png +0 -0
- nonebot_plugin_l4d2_server/data/img/linux.png +0 -0
- nonebot_plugin_l4d2_server/data/img/vac.png +0 -0
- nonebot_plugin_l4d2_server/data/img/white.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/Help.json +65 -0
- nonebot_plugin_l4d2_server/l4_help/__init__.py +57 -0
- nonebot_plugin_l4d2_server/l4_help/draw.py +206 -0
- nonebot_plugin_l4d2_server/l4_help/icon//344/273/213/347/273/215.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//344/273/273/345/212/241.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//344/277/241/346/201/257.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/205/254/345/221/212.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/210/200/345/211/221.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/210/207/346/215/242.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/210/240/351/231/244.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/210/267/346/226/260.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/215/241/347/273/204.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/223/252/351/207/214.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/234/260/345/233/276.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/257/274/345/205/245.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/257/274/345/207/272.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//345/275/261.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/213/274/345/233/276.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/216/242/347/264/242.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/216/250/351/200/201.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/224/266/351/233/206.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/224/273/347/225/245.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/233/264/346/226/260.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/235/220/346/226/231.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/237/245/350/257/242.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/240/241/351/252/214.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/257/217/346/234/210.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/267/261/346/270/212.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/267/273/345/212/240.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//346/270/205/351/231/244.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//347/212/266/346/200/201.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//347/255/276/345/210/260.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//347/273/221/345/256/232.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//350/241/250.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//350/241/250/346/203/205.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//350/247/222/350/211/262.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//350/256/260/345/275/225.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//351/205/215/347/275/256.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/icon//351/207/215/345/220/257.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/texture2d/badge.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/texture2d/banner.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/texture2d/bg.jpg +0 -0
- nonebot_plugin_l4d2_server/l4_help/texture2d/button.png +0 -0
- nonebot_plugin_l4d2_server/l4_help/texture2d/icon.png +0 -0
- nonebot_plugin_l4d2_server/l4_image/__init__.py +16 -0
- nonebot_plugin_l4d2_server/l4_image/convert.py +175 -0
- nonebot_plugin_l4d2_server/{l4d2_image → l4_image}/download.py +6 -30
- nonebot_plugin_l4d2_server/{l4d2_image/__init__.py → l4_image/html_img.py} +54 -45
- nonebot_plugin_l4d2_server/l4_image/image_tools.py +468 -0
- nonebot_plugin_l4d2_server/l4_image/img/anne/anne.html +60 -0
- nonebot_plugin_l4d2_server/l4_image/img/anne/back.png +0 -0
- nonebot_plugin_l4d2_server/l4_image/img/anne/group_ip.html +259 -0
- nonebot_plugin_l4d2_server/l4_image/img/anne/ip.html +55 -0
- nonebot_plugin_l4d2_server/l4_image/img/head/head.png +0 -0
- nonebot_plugin_l4d2_server/l4_image/img/header/logo.png +0 -0
- nonebot_plugin_l4d2_server/l4_image/img/header/player1.jpg +0 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/Bocchi_The_Rock.html +312 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/Bocchi_The_Rock.png +0 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/HYPixel11pxU-2.ttf +0 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/Pixel.html +350 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/Pixel.png +0 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/Rainbow.html +321 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/Rainbow.png +0 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/Tutumianhuatang-Bold-2.ttf +0 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/bilibili.svg +1 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/fingerprint.svg +15 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/github.svg +1 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/l.svg +9 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/m.svg +1 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/normal.html +257 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/vue.css +531 -0
- nonebot_plugin_l4d2_server/l4_image/img/template/w.svg +1 -0
- nonebot_plugin_l4d2_server/l4_image/img/template//345/276/256/350/275/257/351/233/205/351/273/221.ttf +0 -0
- nonebot_plugin_l4d2_server/l4_image/model.py +15 -0
- nonebot_plugin_l4d2_server/{l4d2_image → l4_image}/vtfs.py +2 -0
- nonebot_plugin_l4d2_server/l4_request/__init__.py +84 -0
- nonebot_plugin_l4d2_server/l4_request/draw_msg.py +88 -0
- nonebot_plugin_l4d2_server/utils/api/api.py +4 -0
- nonebot_plugin_l4d2_server/utils/api/models.py +29 -0
- nonebot_plugin_l4d2_server/utils/api/request.py +119 -0
- nonebot_plugin_l4d2_server/utils/database/models.py +29 -0
- nonebot_plugin_l4d2_server/{l4d2_utils → utils}/utils.py +52 -55
- {nonebot_plugin_l4d2_server-0.6.6.dist-info → nonebot_plugin_l4d2_server-1.0.0a1.dist-info}/METADATA +47 -64
- nonebot_plugin_l4d2_server-1.0.0a1.dist-info/RECORD +144 -0
- {nonebot_plugin_l4d2_server-0.6.6.dist-info → nonebot_plugin_l4d2_server-1.0.0a1.dist-info}/WHEEL +1 -1
- nonebot_plugin_l4d2_server/l4d2_anne/__init__.py +0 -95
- nonebot_plugin_l4d2_server/l4d2_anne/analysis.py +0 -54
- nonebot_plugin_l4d2_server/l4d2_anne/anne_telecom.py +0 -79
- nonebot_plugin_l4d2_server/l4d2_anne/server.py +0 -47
- nonebot_plugin_l4d2_server/l4d2_anne/startand.py +0 -17
- nonebot_plugin_l4d2_server/l4d2_anne/utils.py +0 -294
- nonebot_plugin_l4d2_server/l4d2_data/__init__.py +0 -105
- nonebot_plugin_l4d2_server/l4d2_data/config.py +0 -18
- nonebot_plugin_l4d2_server/l4d2_data/database.py +0 -0
- nonebot_plugin_l4d2_server/l4d2_data/players.py +0 -100
- nonebot_plugin_l4d2_server/l4d2_data/serverip.py +0 -40
- nonebot_plugin_l4d2_server/l4d2_file/__init__.py +0 -222
- nonebot_plugin_l4d2_server/l4d2_file/ayromote.py +0 -64
- nonebot_plugin_l4d2_server/l4d2_file/input_json.py +0 -77
- nonebot_plugin_l4d2_server/l4d2_file/remote.py +0 -86
- nonebot_plugin_l4d2_server/l4d2_file/utils.py +0 -104
- nonebot_plugin_l4d2_server/l4d2_image/htmlimg.py +0 -18
- nonebot_plugin_l4d2_server/l4d2_image/images.py +0 -92
- nonebot_plugin_l4d2_server/l4d2_image/one.py +0 -44
- nonebot_plugin_l4d2_server/l4d2_image/send_image_tool.py +0 -32
- nonebot_plugin_l4d2_server/l4d2_image/steam.py +0 -63
- nonebot_plugin_l4d2_server/l4d2_push/__init__.py +0 -225
- nonebot_plugin_l4d2_server/l4d2_queries/__init__.py +0 -326
- nonebot_plugin_l4d2_server/l4d2_queries/himi.py +0 -113
- nonebot_plugin_l4d2_server/l4d2_queries/local_ip.py +0 -41
- nonebot_plugin_l4d2_server/l4d2_queries/qqgroup.py +0 -370
- nonebot_plugin_l4d2_server/l4d2_queries/send_msg.py +0 -131
- nonebot_plugin_l4d2_server/l4d2_queries/utils.py +0 -212
- nonebot_plugin_l4d2_server/l4d2_server/__init__.py +0 -118
- nonebot_plugin_l4d2_server/l4d2_server/index.py +0 -0
- nonebot_plugin_l4d2_server/l4d2_server/rcon.py +0 -53
- nonebot_plugin_l4d2_server/l4d2_server/workshop.py +0 -82
- nonebot_plugin_l4d2_server/l4d2_update/__init__.py +0 -137
- nonebot_plugin_l4d2_server/l4d2_update/draw_update_log.py +0 -45
- nonebot_plugin_l4d2_server/l4d2_update/restart.py +0 -69
- nonebot_plugin_l4d2_server/l4d2_update/update.py +0 -53
- nonebot_plugin_l4d2_server/l4d2_utils/classcal.py +0 -53
- nonebot_plugin_l4d2_server/l4d2_utils/command.py +0 -23
- nonebot_plugin_l4d2_server/l4d2_utils/config.py +0 -201
- nonebot_plugin_l4d2_server/l4d2_utils/message.py +0 -59
- nonebot_plugin_l4d2_server/l4d2_utils/rule.py +0 -35
- nonebot_plugin_l4d2_server/l4d2_utils/seach.py +0 -43
- nonebot_plugin_l4d2_server/l4d2_utils/txt_to_img.py +0 -32
- nonebot_plugin_l4d2_server/l4d2_web/web.py +0 -277
- nonebot_plugin_l4d2_server/l4d2_web/webUI.py +0 -506
- nonebot_plugin_l4d2_server/l4d2_web/webUI_s.py +0 -94
- nonebot_plugin_l4d2_server-0.6.6.dist-info/RECORD +0 -70
- {nonebot_plugin_l4d2_server-0.6.6.dist-info → nonebot_plugin_l4d2_server-1.0.0a1.dist-info}/licenses/LICENSE +0 -0
@@ -1,95 +0,0 @@
|
|
1
|
-
from nonebot import on_command
|
2
|
-
from nonebot.adapters.onebot.v11 import Message, MessageEvent
|
3
|
-
from nonebot.matcher import Matcher
|
4
|
-
from nonebot.params import CommandArg
|
5
|
-
from nonebot_plugin_saa import Image, MessageFactory
|
6
|
-
|
7
|
-
# from .l4d2_file.input_json import *
|
8
|
-
from ..l4d2_utils.config import MASTER
|
9
|
-
from ..l4d2_utils.utils import at_to_usrid, get_message_at
|
10
|
-
from .server import updata_anne_server
|
11
|
-
from .utils import bind_steam, name_exist, search_anne
|
12
|
-
|
13
|
-
# anne
|
14
|
-
anne_player = on_command("Ranne", aliases={"求生anne"}, priority=25, block=True)
|
15
|
-
anne_bind = on_command(
|
16
|
-
"Rbind",
|
17
|
-
aliases={"steam绑定", "求生绑定", "anne绑定"},
|
18
|
-
priority=20,
|
19
|
-
block=True,
|
20
|
-
)
|
21
|
-
del_bind = on_command(
|
22
|
-
"del_bind",
|
23
|
-
aliases={"steam解绑", "求生解绑", "anne解绑"},
|
24
|
-
priority=20,
|
25
|
-
block=True,
|
26
|
-
)
|
27
|
-
updata = on_command(
|
28
|
-
"updata_anne",
|
29
|
-
aliases={"求生更新anne"},
|
30
|
-
priority=20,
|
31
|
-
block=True,
|
32
|
-
permission=MASTER,
|
33
|
-
)
|
34
|
-
|
35
|
-
|
36
|
-
@anne_player.handle()
|
37
|
-
async def _(matcher: Matcher, event: MessageEvent, args: Message = CommandArg()):
|
38
|
-
name = args.extract_plain_text()
|
39
|
-
name = name.strip()
|
40
|
-
at = await get_message_at(event.json())
|
41
|
-
usr_id = at_to_usrid(at)
|
42
|
-
if not usr_id:
|
43
|
-
usr_id = event.user_id
|
44
|
-
# 没有参数则从db里找数据
|
45
|
-
msg = await search_anne(name, str(usr_id))
|
46
|
-
if isinstance(msg, str):
|
47
|
-
await matcher.finish(msg)
|
48
|
-
elif isinstance(msg, bytes):
|
49
|
-
await MessageFactory([Image(msg)]).finish()
|
50
|
-
|
51
|
-
|
52
|
-
@anne_bind.handle()
|
53
|
-
async def _(matcher: Matcher, event: MessageEvent, args: Message = CommandArg()):
|
54
|
-
tag = args.extract_plain_text()
|
55
|
-
tag = tag.strip()
|
56
|
-
if tag == "" or tag.isspace():
|
57
|
-
await matcher.finish("虚空绑定?")
|
58
|
-
usr_id = str(event.user_id)
|
59
|
-
nickname = event.sender.card or event.sender.nickname
|
60
|
-
if not nickname:
|
61
|
-
nickname = "宁宁"
|
62
|
-
msg = await bind_steam(usr_id, tag, nickname)
|
63
|
-
await matcher.finish(msg)
|
64
|
-
|
65
|
-
|
66
|
-
@del_bind.handle()
|
67
|
-
async def _(matcher: Matcher, event: MessageEvent):
|
68
|
-
usr_id = event.user_id
|
69
|
-
msg = name_exist(str(usr_id))
|
70
|
-
if not msg:
|
71
|
-
return
|
72
|
-
await matcher.finish(msg)
|
73
|
-
|
74
|
-
|
75
|
-
@del_bind.handle()
|
76
|
-
async def _(matcher: Matcher, event: MessageEvent):
|
77
|
-
usr_id = event.user_id
|
78
|
-
msg = name_exist(str(usr_id))
|
79
|
-
if not msg:
|
80
|
-
return
|
81
|
-
await matcher.finish(msg)
|
82
|
-
|
83
|
-
|
84
|
-
@updata.handle()
|
85
|
-
async def _(matcher: Matcher, args: Message = CommandArg()):
|
86
|
-
"""更新"""
|
87
|
-
if args:
|
88
|
-
# 占位先,除了电信服还有再加
|
89
|
-
...
|
90
|
-
anne_ip_dict = await updata_anne_server()
|
91
|
-
if not anne_ip_dict:
|
92
|
-
await matcher.finish("网络开小差了捏")
|
93
|
-
return
|
94
|
-
server_number = len(anne_ip_dict["云"])
|
95
|
-
await matcher.finish(f"更新成功\n一共更新了{server_number}个电信anne服ip")
|
@@ -1,54 +0,0 @@
|
|
1
|
-
import pandas as pd
|
2
|
-
|
3
|
-
from .startand import NUMBER_MAP, SAVE_MAP
|
4
|
-
|
5
|
-
|
6
|
-
async def df_to_guoguanlv(df: pd.DataFrame):
|
7
|
-
"""分析救援关过图率"""
|
8
|
-
data = df[df["游戏模式"] == "AnneHappy药役"]
|
9
|
-
other = df[df["游戏模式"].isin(["牛牛冲刺", "单人装逼"])]
|
10
|
-
all_map = len(data["地图"])
|
11
|
-
other_map = len(other["地图"])
|
12
|
-
resen = 0
|
13
|
-
last_maps = {}
|
14
|
-
for m in SAVE_MAP:
|
15
|
-
prefix = m.split("m")[0]
|
16
|
-
if prefix in last_maps:
|
17
|
-
last_maps[prefix] = max(last_maps[prefix], m)
|
18
|
-
else:
|
19
|
-
last_maps[prefix] = m
|
20
|
-
|
21
|
-
map_counts = {}
|
22
|
-
|
23
|
-
n = 0
|
24
|
-
for key in last_maps:
|
25
|
-
count = len(data[data["地图"].str.startswith(key)])
|
26
|
-
if count == 0:
|
27
|
-
continue
|
28
|
-
last_map = last_maps[key]
|
29
|
-
map_count = len(data[data["地图"] == last_map])
|
30
|
-
map_counts[key] = map_count * NUMBER_MAP[n] / count
|
31
|
-
quan = count / all_map
|
32
|
-
resen += quan * map_counts[key]
|
33
|
-
n += 1
|
34
|
-
|
35
|
-
# result = []
|
36
|
-
# for i in range(1, 15):
|
37
|
-
# key = 'c{}'.format(i)
|
38
|
-
# if key in map_counts:
|
39
|
-
# result.append('{}:{}%'.format(key, round(map_counts[key] * 100)))
|
40
|
-
|
41
|
-
# print(result)
|
42
|
-
# result = '救援图过关率: {:.2%}'.format(resen)
|
43
|
-
|
44
|
-
# 加上特殊关卡
|
45
|
-
try:
|
46
|
-
resen += other_map / (all_map + other_map)
|
47
|
-
result = {"救援关": str("{:.2%}".format(resen))}
|
48
|
-
except (TypeError, KeyError):
|
49
|
-
result = {"救援关": "错误"}
|
50
|
-
except ZeroDivisionError:
|
51
|
-
result = {"救援关": "0.00%"}
|
52
|
-
except Exception:
|
53
|
-
result = {"救援关": "错误"}
|
54
|
-
return result
|
@@ -1,79 +0,0 @@
|
|
1
|
-
# from ..l4d2_image.steam import url_to_byte
|
2
|
-
# from bs4 import BeautifulSoup
|
3
|
-
# from typing import List
|
4
|
-
|
5
|
-
# 暂时废弃
|
6
|
-
# class ANNE_API:
|
7
|
-
|
8
|
-
# async def __init__(
|
9
|
-
# self,
|
10
|
-
# STEAMID:str,
|
11
|
-
# tag:str
|
12
|
-
# ):
|
13
|
-
# self.STEAMID = STEAMID
|
14
|
-
# if tag == '中':
|
15
|
-
# msg1 = await self.anne_msg()
|
16
|
-
# elif tag == '长':
|
17
|
-
# msg1 = await self.anne_msg()
|
18
|
-
# msg1.update(await self.anne_map())
|
19
|
-
|
20
|
-
|
21
|
-
# async def anne_msg(self):
|
22
|
-
# """个人资料表"""
|
23
|
-
# data_bytes = await url_to_byte('https://sb.trygek.com/l4d_stats/ranking/player.php?steamid={self.STEAMID}')
|
24
|
-
# data_bs = BeautifulSoup(data_bytes, 'html.parser')
|
25
|
-
# data_fom = data_bs.find_all('table')
|
26
|
-
# n = 0
|
27
|
-
# data_dict = {}
|
28
|
-
# while n < 2:
|
29
|
-
# data_list:List[dict] = []
|
30
|
-
# detail2 = data_fom[n]
|
31
|
-
# tr = detail2.find_all('tr')
|
32
|
-
# for i in tr:
|
33
|
-
# title = i.find('td', {'class': 'w-50'})
|
34
|
-
# value = title.find_next_sibling('td')
|
35
|
-
# new_dict = {title.text:value.text}
|
36
|
-
# data_dict.update(new_dict)
|
37
|
-
# data_list.append(data_dict)
|
38
|
-
# n += 1
|
39
|
-
# # 获取头像
|
40
|
-
# element:str = data_fom.find_all(attrs={"style": "cursor:pointer"})[0].
|
41
|
-
# get("onclick")
|
42
|
-
# player_url = element.split("'")[1]
|
43
|
-
# data_list[0].update({"个人资料":player_url})
|
44
|
-
# # 获取一言
|
45
|
-
# message = data_fom.select("html body div.content.text-center.text-md-left div.
|
46
|
-
# container.text-left div.col-md-12.h-100 div.card-body.worldmap.d-flex.flex-column.
|
47
|
-
# justify-content-center.text-center span")
|
48
|
-
# msg_list = []
|
49
|
-
# for i in message:
|
50
|
-
# msg_list.append(i.text)
|
51
|
-
# data_list[0].update({"一言":msg_list})
|
52
|
-
# return data_list
|
53
|
-
|
54
|
-
# async def anne_map(self):
|
55
|
-
# """个人地图表"""
|
56
|
-
# data_dict = {}
|
57
|
-
# data_bytes = await url_to_byte('https://sb.trygek.com/l4d_stats/ranking/timedmaps.php?steamid={self.STEAMID}')
|
58
|
-
# data_bs = BeautifulSoup(data_bytes, 'html.parser')
|
59
|
-
# tbody = data_bs.select('tbody')
|
60
|
-
# for tr in tbody:
|
61
|
-
# tds = tr.select('td')
|
62
|
-
# n = 0
|
63
|
-
# for td in tds:
|
64
|
-
# n += 1
|
65
|
-
# title:str = td['data-title'][:-1]
|
66
|
-
# data_text = td.text
|
67
|
-
# if title == '特感数量':
|
68
|
-
# special_amount = data_text
|
69
|
-
# elif title == '刷新间隔':
|
70
|
-
# refresh_interval = data_text
|
71
|
-
# else:
|
72
|
-
# if title in data_dict:
|
73
|
-
# data_dict[title].append(data_text)
|
74
|
-
# else:
|
75
|
-
# data_dict[title] = [data_text]
|
76
|
-
# if special_amount and refresh_interval:
|
77
|
-
# data_dict['刷特时间'] = special_amount + refresh_interval
|
78
|
-
|
79
|
-
# return data_dict
|
@@ -1,47 +0,0 @@
|
|
1
|
-
import json
|
2
|
-
from pathlib import Path
|
3
|
-
from typing import Dict, List
|
4
|
-
|
5
|
-
import httpx
|
6
|
-
from bs4 import BeautifulSoup
|
7
|
-
|
8
|
-
from ..l4d2_utils.config import ANNE_IP, CONFIG_PATH, anne_url, headers
|
9
|
-
|
10
|
-
|
11
|
-
async def updata_anne_server():
|
12
|
-
"""更新anne服务器列表"""
|
13
|
-
data = httpx.get(anne_url, headers=headers).content # noqa: ASYNC100
|
14
|
-
soup = BeautifulSoup(data, "html.parser")
|
15
|
-
tbody = soup.find("tbody")
|
16
|
-
if not tbody:
|
17
|
-
return None
|
18
|
-
n = 0
|
19
|
-
ip_list = []
|
20
|
-
while n < 50:
|
21
|
-
n += 1
|
22
|
-
tr = tbody.find(id=f"server_{n}") # type: ignore
|
23
|
-
if tr:
|
24
|
-
td: str = tr.select_one("td:nth-of-type(5)").get_text() # type: ignore
|
25
|
-
else:
|
26
|
-
continue
|
27
|
-
if td:
|
28
|
-
ip_list.append(td)
|
29
|
-
else:
|
30
|
-
continue
|
31
|
-
if not ip_list:
|
32
|
-
return None
|
33
|
-
ip_dict: Dict[str, List[Dict[str, str]]] = {"云": []}
|
34
|
-
n: int = 0
|
35
|
-
|
36
|
-
for i, ip in enumerate(ip_list, start=1):
|
37
|
-
ip_dict["云"].append({"id": str(i), "ip": ip})
|
38
|
-
|
39
|
-
# ANNE_IP.update(ip_dict)
|
40
|
-
with Path(CONFIG_PATH.parent / "l4d2/云.json").open(
|
41
|
-
mode="w",
|
42
|
-
encoding="utf-8",
|
43
|
-
) as f:
|
44
|
-
json.dump(ip_dict, f, indent=4, ensure_ascii=False)
|
45
|
-
# print(ANNE_IP)
|
46
|
-
ANNE_IP.update(ip_dict)
|
47
|
-
return ip_dict
|
@@ -1,17 +0,0 @@
|
|
1
|
-
NUMBER_MAP = [4, 5, 4, 5, 5, 3, 3, 5, 2, 5, 5, 5, 4, 2]
|
2
|
-
SAVE_MAP = [
|
3
|
-
"c1m4_atrium",
|
4
|
-
"c2m5_concert",
|
5
|
-
"c3m4_plantation",
|
6
|
-
"c4m5_milltown_escape",
|
7
|
-
"c5m5_bridge",
|
8
|
-
"c6m3_port",
|
9
|
-
"c7m3_port",
|
10
|
-
"c8m5_rooftop",
|
11
|
-
"c9m2_lots",
|
12
|
-
"c10m5_houseboat",
|
13
|
-
"c11m5_runway",
|
14
|
-
"c12m5_cornfield",
|
15
|
-
"c13m4_cutthroatcreek",
|
16
|
-
"c14m2_lighthouse",
|
17
|
-
]
|
@@ -1,294 +0,0 @@
|
|
1
|
-
from typing import List
|
2
|
-
|
3
|
-
import httpx
|
4
|
-
import pandas as pd
|
5
|
-
from bs4 import BeautifulSoup
|
6
|
-
from nonebot.log import logger
|
7
|
-
|
8
|
-
from ..l4d2_data.players import L4D2Player
|
9
|
-
from ..l4d2_image import out_png
|
10
|
-
from ..l4d2_utils.seach import anne_search
|
11
|
-
from .analysis import df_to_guoguanlv
|
12
|
-
|
13
|
-
# from .anne_telecom import ANNE_API
|
14
|
-
|
15
|
-
|
16
|
-
s = L4D2Player()
|
17
|
-
headers = {
|
18
|
-
"User-Agent": (
|
19
|
-
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:107.0) "
|
20
|
-
"Gecko/20100101 Firefox/107.0"
|
21
|
-
),
|
22
|
-
}
|
23
|
-
|
24
|
-
|
25
|
-
async def anne_html(name: str):
|
26
|
-
"""搜索里提取玩家信息,返回列表字典"""
|
27
|
-
data_title = anne_search(name)
|
28
|
-
if not data_title:
|
29
|
-
return None
|
30
|
-
data = data_title[0]
|
31
|
-
title = data_title[1]
|
32
|
-
if len(data) == 0 or data[0] == "No Player found.":
|
33
|
-
return []
|
34
|
-
data_list: list = []
|
35
|
-
logger.info(data)
|
36
|
-
for i in data:
|
37
|
-
i: BeautifulSoup
|
38
|
-
|
39
|
-
def find_text(soup, attr_en, attr_alt):
|
40
|
-
try:
|
41
|
-
element = soup.find("td", {"data-title": attr_en})
|
42
|
-
if element is None:
|
43
|
-
element = soup.find("td", {"data-title": attr_alt})
|
44
|
-
return element.text.strip() if element else ""
|
45
|
-
except AttributeError:
|
46
|
-
return ""
|
47
|
-
|
48
|
-
rank = find_text(i, "Rank:", "排名:")
|
49
|
-
player = find_text(i, "Player:", "玩家:")
|
50
|
-
points = find_text(i, "Points:", "分数:")
|
51
|
-
playtime = find_text(i, "Playtime:", "游玩时间:")
|
52
|
-
last_online = find_text(i, "Last Online:", "最后上线时间:")
|
53
|
-
onclick = i["onclick"]
|
54
|
-
steamid = onclick.split("=")[2].strip("'") # type: ignore
|
55
|
-
play_json = {
|
56
|
-
title[0]: rank,
|
57
|
-
title[1]: player,
|
58
|
-
title[2]: points,
|
59
|
-
# title[3]:country,
|
60
|
-
title[3]: playtime,
|
61
|
-
title[4]: last_online,
|
62
|
-
title[5]: steamid,
|
63
|
-
}
|
64
|
-
data_list.append(play_json)
|
65
|
-
logger.info("搜寻数据")
|
66
|
-
return data_list
|
67
|
-
|
68
|
-
|
69
|
-
def anne_html_msg(data_list: list):
|
70
|
-
"""从搜索结果的字典列表中,返回发送信息"""
|
71
|
-
mes = "搜索到以下玩家信息"
|
72
|
-
ns = 0
|
73
|
-
|
74
|
-
for one in data_list:
|
75
|
-
one: dict
|
76
|
-
ns += 1
|
77
|
-
x = 6
|
78
|
-
|
79
|
-
titles = list(one.keys())
|
80
|
-
for i in range(x):
|
81
|
-
mes += "\n" + titles[i] + ":" + str(one[titles[i]])
|
82
|
-
mes += "\n--------------------"
|
83
|
-
if ns > 4:
|
84
|
-
break
|
85
|
-
return mes
|
86
|
-
|
87
|
-
|
88
|
-
async def write_player(id_, msg: str, nickname: str):
|
89
|
-
"""绑定用户"""
|
90
|
-
# 判断是steam
|
91
|
-
if msg.startswith("STEAM"):
|
92
|
-
# try:
|
93
|
-
data_tuple = s.query_player_qq(id_)
|
94
|
-
if data_tuple is not None:
|
95
|
-
qq, nicknam, steamid = data_tuple
|
96
|
-
else:
|
97
|
-
nicknam = None
|
98
|
-
await s.add_player_all(id_, nicknam, msg)
|
99
|
-
# except TypeError:
|
100
|
-
# await s._add_player_steamid(id_ , msg)
|
101
|
-
return "绑定成功喵~\nQQ:" + nickname + "\n" + "steamid:" + msg
|
102
|
-
# try:
|
103
|
-
data_tuple = s.query_player_qq(id_)
|
104
|
-
if data_tuple is not None:
|
105
|
-
id_, nicknam, steamid = data_tuple
|
106
|
-
else:
|
107
|
-
steamid = None
|
108
|
-
await s.add_player_all(id_, msg, steamid)
|
109
|
-
# except TypeError:
|
110
|
-
# await s._add_player_nickname(id_ , msg )
|
111
|
-
return "绑定成功喵~\nQQ:" + nickname + "\n" + "steam昵称:" + msg
|
112
|
-
|
113
|
-
|
114
|
-
def del_player(id_: str):
|
115
|
-
"""删除绑定信息,返回消息"""
|
116
|
-
if not s.query_player_qq(id_):
|
117
|
-
return "你还没有绑定过,请使用[求生绑定+昵称/steamid]"
|
118
|
-
if s.delete_player:
|
119
|
-
return "删除成功喵~"
|
120
|
-
return None
|
121
|
-
|
122
|
-
|
123
|
-
async def id_to_mes(name: str):
|
124
|
-
"""根据name从数据库,返回steamid、或者空白"""
|
125
|
-
data_tuple = await s.search_data(None, name, None)
|
126
|
-
if data_tuple:
|
127
|
-
return data_tuple[2]
|
128
|
-
return None
|
129
|
-
|
130
|
-
|
131
|
-
def anne_rank_dict(name: str):
|
132
|
-
"""用steamid,查详情,输出字典"""
|
133
|
-
data_dict = {}
|
134
|
-
url = f"https://sb.trygek.com/l4d_stats/ranking/player.php?steamid={name}"
|
135
|
-
|
136
|
-
data = httpx.get(url=url, headers=headers, timeout=5)
|
137
|
-
if data.status_code != 200:
|
138
|
-
return [f"查询错误,状态码{data.status_code}"]
|
139
|
-
data = data.content.decode("utf-8")
|
140
|
-
data = BeautifulSoup(data, "html.parser")
|
141
|
-
detail = data.find_all("table")
|
142
|
-
n = 0
|
143
|
-
data_list: List[dict] = []
|
144
|
-
while n < 2:
|
145
|
-
detail2 = detail[n]
|
146
|
-
tr = detail2.find_all("tr")
|
147
|
-
for i in tr:
|
148
|
-
title = i.find("td", {"class": "w-50"})
|
149
|
-
value = title.find_next_sibling("td")
|
150
|
-
new_dict = {title.text: value.text}
|
151
|
-
data_dict.update(new_dict)
|
152
|
-
data_list.append(data_dict)
|
153
|
-
n += 1
|
154
|
-
# 获取头像
|
155
|
-
element: str = data.find_all(attrs={"style": "cursor:pointer"})[0].get("onclick")
|
156
|
-
player_url = element.split("'")[1]
|
157
|
-
data_list[0].update({"个人资料": player_url})
|
158
|
-
# 获取一言
|
159
|
-
message = data.select(
|
160
|
-
(
|
161
|
-
"html body div.content.text-center.text-md-left "
|
162
|
-
"div.container.text-left div.col-md-12.h-100 "
|
163
|
-
"div.card-body.worldmap.d-flex.flex-column.justify-content-center."
|
164
|
-
"text-center span"
|
165
|
-
),
|
166
|
-
)
|
167
|
-
msg_list = []
|
168
|
-
for i in message:
|
169
|
-
msg_list.append(i.text)
|
170
|
-
data_list[0].update({"一言": msg_list})
|
171
|
-
return data_list
|
172
|
-
|
173
|
-
|
174
|
-
def anne_rank_dict_msg(data_list):
|
175
|
-
"""字典转msg"""
|
176
|
-
msg = ""
|
177
|
-
for data_dict in data_list:
|
178
|
-
mes = ""
|
179
|
-
for i in data_dict:
|
180
|
-
mes += "\n" + i + data_dict[i]
|
181
|
-
mes += "\n--------------------"
|
182
|
-
msg += mes
|
183
|
-
return msg
|
184
|
-
|
185
|
-
|
186
|
-
async def anne_message(name: str, usr_id: str):
|
187
|
-
"""获取anne信息可输出信息"""
|
188
|
-
if name:
|
189
|
-
logger.info("关键词查询" + name)
|
190
|
-
if not name.startswith("STEAM"):
|
191
|
-
steamid = await id_to_mes(name)
|
192
|
-
if not steamid:
|
193
|
-
logger.info("没有找到qq,使用默认头像")
|
194
|
-
message = await anne_html(name)
|
195
|
-
if not message:
|
196
|
-
return None
|
197
|
-
usr_id = "1145149191810"
|
198
|
-
if len(message) == 0:
|
199
|
-
return "没有叫这个名字的...\n"
|
200
|
-
if len(message) > 1:
|
201
|
-
return anne_html_msg(message)
|
202
|
-
name = message[0]["steamid"]
|
203
|
-
else:
|
204
|
-
name = steamid
|
205
|
-
|
206
|
-
# steamid
|
207
|
-
msg = anne_rank_dict(name)[0]
|
208
|
-
if isinstance(msg, dict):
|
209
|
-
msg.update(await df_to_guoguanlv(await anne_map_msg(name)))
|
210
|
-
logger.info("使用图片")
|
211
|
-
msg = await out_png(usr_id, msg)
|
212
|
-
return msg
|
213
|
-
"""
|
214
|
-
1、qq>数据>没有数据,返回
|
215
|
-
2、qq>数据>steamid>查询
|
216
|
-
3、qq>数据>昵称>查询
|
217
|
-
"""
|
218
|
-
logger.info("qq信息查询")
|
219
|
-
data_tuple = s.query_player_qq(usr_id)
|
220
|
-
logger.info(data_tuple)
|
221
|
-
if not data_tuple:
|
222
|
-
return "没有绑定信息...请使用【求生绑定 xxx】\n"
|
223
|
-
# 只有名字,先查询数据在判断
|
224
|
-
if data_tuple[2]:
|
225
|
-
name = data_tuple[2]
|
226
|
-
elif data_tuple[1]:
|
227
|
-
name = await id_to_mes(data_tuple[1]) # type: ignore
|
228
|
-
logger.info(name)
|
229
|
-
if not name:
|
230
|
-
message = await anne_html(data_tuple[1])
|
231
|
-
if not message:
|
232
|
-
return None
|
233
|
-
usr_id = "1145149191810"
|
234
|
-
if len(message) == 0:
|
235
|
-
return "没有叫这个名字的...\n"
|
236
|
-
if len(message) > 1:
|
237
|
-
return anne_html_msg(message)
|
238
|
-
name = message[0]["steamid"]
|
239
|
-
|
240
|
-
# name是steamid
|
241
|
-
msg = anne_rank_dict(name)[0]
|
242
|
-
if isinstance(msg, dict):
|
243
|
-
msg.update(await df_to_guoguanlv(await anne_map_msg(name)))
|
244
|
-
logger.info("使用图片")
|
245
|
-
msg = await out_png(usr_id, msg)
|
246
|
-
return msg
|
247
|
-
|
248
|
-
|
249
|
-
async def anne_map_msg(steamid: str):
|
250
|
-
"""steamid->地图信息"""
|
251
|
-
url = f"https://sb.trygek.com/l4d_stats/ranking/timedmaps.php?steamid={steamid}"
|
252
|
-
|
253
|
-
data = httpx.get(url, headers=headers, timeout=5).content.decode( # noqa: ASYNC100
|
254
|
-
"utf-8",
|
255
|
-
)
|
256
|
-
soup = BeautifulSoup(data, "html.parser")
|
257
|
-
data_list = []
|
258
|
-
cards = soup.select("div.card.rounded-0")
|
259
|
-
for card in cards:
|
260
|
-
tbodies = card.select("tbody")
|
261
|
-
for tbody in tbodies:
|
262
|
-
rows = [td.text.strip() for td in tbody.find_all("td")]
|
263
|
-
for i in range(0, len(rows), 9):
|
264
|
-
row = rows[i : i + 9]
|
265
|
-
data_list.append(row)
|
266
|
-
return pd.DataFrame(
|
267
|
-
data_list,
|
268
|
-
columns=[
|
269
|
-
"游戏模式",
|
270
|
-
"地图",
|
271
|
-
"难度",
|
272
|
-
"完成时间",
|
273
|
-
"特感数量",
|
274
|
-
"刷新间隔",
|
275
|
-
"B数使用",
|
276
|
-
"刷特模式",
|
277
|
-
"Anne版本",
|
278
|
-
],
|
279
|
-
)
|
280
|
-
|
281
|
-
|
282
|
-
def name_exist(id_: str):
|
283
|
-
"""删除绑定信息"""
|
284
|
-
return del_player(id_)
|
285
|
-
|
286
|
-
|
287
|
-
async def search_anne(name: str, usr_id: str):
|
288
|
-
"""获取anne成绩"""
|
289
|
-
return await anne_message(name, usr_id)
|
290
|
-
|
291
|
-
|
292
|
-
async def bind_steam(id_: str, msg: str, nickname: str):
|
293
|
-
"""绑定qq-steam"""
|
294
|
-
return await write_player(id_, msg, nickname)
|
@@ -1,105 +0,0 @@
|
|
1
|
-
import sqlite3
|
2
|
-
|
3
|
-
from nonebot.log import logger
|
4
|
-
|
5
|
-
from ..l4d2_utils.config import (
|
6
|
-
DATASQLITE,
|
7
|
-
L4d2_BOOLEAN,
|
8
|
-
L4d2_INTEGER,
|
9
|
-
L4d2_players_tag,
|
10
|
-
L4d2_server_tag,
|
11
|
-
L4d2_TEXT,
|
12
|
-
table_data,
|
13
|
-
tables_columns,
|
14
|
-
)
|
15
|
-
|
16
|
-
|
17
|
-
class L4D2DataSqlite:
|
18
|
-
"""连接数据库和断开数据库,以及一些检查函数"""
|
19
|
-
|
20
|
-
def __init__(self):
|
21
|
-
"""连接数据库"""
|
22
|
-
self.datasqlite_path = DATASQLITE
|
23
|
-
self.datasqlite_path.mkdir(parents=True, exist_ok=True)
|
24
|
-
self.conn = sqlite3.connect(self.datasqlite_path / "L4D2.db")
|
25
|
-
self._check_tables_exist()
|
26
|
-
self._check_data_existence()
|
27
|
-
self._check_data_validity()
|
28
|
-
logger.info("已连接求生数据库")
|
29
|
-
|
30
|
-
def _base_conn(self):
|
31
|
-
return self.conn
|
32
|
-
|
33
|
-
def _check_tables_exist(self) -> None:
|
34
|
-
"""
|
35
|
-
检查表是否存在
|
36
|
-
"""
|
37
|
-
c = self.conn.cursor()
|
38
|
-
for table in table_data:
|
39
|
-
c.execute(
|
40
|
-
f"SELECT name FROM sqlite_master WHERE type='table' AND name='{table}'",
|
41
|
-
)
|
42
|
-
if c.fetchone() is None:
|
43
|
-
if table == "L4d2_players":
|
44
|
-
c.execute(f"CREATE TABLE {table} (qq INTEGER PRIMARY KEY)")
|
45
|
-
elif table == "L4D2_server":
|
46
|
-
c.execute(f"CREATE TABLE {table} (number INTEGER PRIMARY KEY)")
|
47
|
-
self.conn.commit()
|
48
|
-
|
49
|
-
def _check_data_existence(self) -> None:
|
50
|
-
"""
|
51
|
-
检查表头是否存在,如果不存在则新建并填充默认值
|
52
|
-
"""
|
53
|
-
c = self.conn.cursor()
|
54
|
-
for table, tag in tables_columns.items():
|
55
|
-
for column in tag:
|
56
|
-
c.execute(f"PRAGMA table_info({table})")
|
57
|
-
if not any(col[1] == column for col in c.fetchall()):
|
58
|
-
if column in L4d2_BOOLEAN:
|
59
|
-
c.execute(
|
60
|
-
f"ALTER TABLE {table} ADD COLUMN {column} BOOLEAN DEFAULT 0",
|
61
|
-
)
|
62
|
-
elif column in L4d2_INTEGER:
|
63
|
-
c.execute(
|
64
|
-
f"ALTER TABLE {table} ADD COLUMN {column} INTEGER DEFAULT NULL",
|
65
|
-
)
|
66
|
-
else:
|
67
|
-
c.execute(
|
68
|
-
f"ALTER TABLE {table} ADD COLUMN {column} TEXT DEFAULT NULL",
|
69
|
-
)
|
70
|
-
self.conn.commit()
|
71
|
-
|
72
|
-
def _check_data_validity(self) -> None:
|
73
|
-
"""
|
74
|
-
检查数据库数据的合法性
|
75
|
-
错误数据默认填充NULL或者False
|
76
|
-
"""
|
77
|
-
c = self.conn.cursor()
|
78
|
-
columns = None
|
79
|
-
table = None
|
80
|
-
for table in table_data:
|
81
|
-
columns = L4d2_players_tag if table == "L4d2_players" else L4d2_server_tag
|
82
|
-
if not columns:
|
83
|
-
return
|
84
|
-
for column in columns:
|
85
|
-
if column in L4d2_INTEGER:
|
86
|
-
c.execute(
|
87
|
-
f"UPDATE {table} SET {column} = NULL WHERE typeof({column}) != 'integer'",
|
88
|
-
)
|
89
|
-
elif column in L4d2_TEXT:
|
90
|
-
c.execute(
|
91
|
-
f"UPDATE {table} SET {column} = NULL WHERE typeof({column}) != 'text'",
|
92
|
-
)
|
93
|
-
elif column in L4d2_BOOLEAN:
|
94
|
-
c.execute(
|
95
|
-
f"UPDATE {table} SET {column} = 'False' WHERE typeof({column}) != 'boolean'",
|
96
|
-
)
|
97
|
-
self.conn.commit()
|
98
|
-
|
99
|
-
def _close(self):
|
100
|
-
"""断开连接到数据库"""
|
101
|
-
self.conn.close()
|
102
|
-
logger.info("已断开求生数据库")
|
103
|
-
|
104
|
-
|
105
|
-
sq_L4D2 = L4D2DataSqlite() # noqa: N816
|