Skip to main content

nonebot-plugin-mahjong-utils

安装

nb plugin install nonebot-plugin-mahjong-utils

如果需要麻将牌截图识别功能,需要额外安装:

pip install nonebot-plugin-mahjong-utils[detect]

功能

手牌分析

/牌理 <手牌代码> [...附加选项]

  • 输入手牌代码,根据输入手牌输出向听数(未摸牌状态)、牌理(已摸牌、未和牌状态)、副露分析(未摸牌状态+他家打出的牌)或和牌分析(已摸牌、已和牌状态)。

  • 开启嗅探模式时(默认开启),可直接输入手牌代码:<手牌代码> [...附加选项]

  • 支持图像识别模式,从截图中识别手牌进行计算。 只保证对雀魂截图的识别率 因为训练模型只喂了雀魂截图 。效果如下图所示:

shanten_img_detect.png

向听数分析(未摸牌状态)

输入的手牌为3k+1张时。

计算向听数与进张。一向听的手牌还会计算好型与愚型进张数。

shanten_1233334679m_input.png

shanten_1233334679m.jpg

牌理(已摸牌状态)

输入的手牌为3k+2张,且未和牌(向听数大于-1)时。

对每种打法(包括打出与暗杠)计算向听数与进张。一向听的手牌还会计算好型与愚型进张数。

shanten_34567778m123457p_input.png

shanten_34567778m123457p.png

副露分析(未摸牌状态+他家打出的牌)

格式:手牌代码<上家打出的牌、手牌代码^对家打出的牌或手牌代码>下家打出的牌,其中输入的手牌为3k+1张。

实际上对家打出和下家打出是一样的(不能吃),这里区分是为了命令的工整性

对每种打法(包括吃、碰、大明杠与PASS)计算向听数与进张。一向听的手牌还会计算好型与愚型进张数。

furo_335678m3457p_7m_input.png

furo_335678m3457p_7m.jpg

和牌分析

输入的手牌为3k+2张,且已和牌(向听数等于-1)时。

手牌代码的最后一张牌作为所和的牌,手牌代码后可通过空格分割输入副露、自风、场风、dora、额外役。暗杠通过0990m的格式输入。

hora_11123456789999p_input.png

hora_11123456789999p.jpg

番符点数查询

/番符 <x>番<y>符

  • 输入x番y符,输出亲家/子家的自摸/荣和得点

  • 开启嗅探模式时(默认开启),可直接输入番符数目:<x>番<y>符

3han40hu.png

配置项

mahjong_utils_send_image

将结果以图片形式发送,设置为False可节省图片渲染和发送时间,提高响应速度

默认值:True

mahjong_utils_sniff_mode

开启嗅探模式,支持直接输入手牌代码触发指令

默认值:True

mahjong_utils_command_mode

开启指令模式,支持通过指令方式触发指令

默认值:True

优化计算用时

参考:[https://github.com/ssttkkl/mahjong-utils/blob/main/python-lib/README.md#%E6%8C%87%E5%AE%9A%E7%BB%91%E5%AE%9A%E6%96%B9%E5%BC%8F]

Special Thanks

在线乞讨

点击请我打两把maimai

LICENSE

MIT License

Copyright (c) 2022 ssttkkl

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Metadata

Release files for nonebot-plugin-mahjong-utils 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nonebot-plugin-mahjong-utils 0.5.0
File Size Uploaded Provenance Actions
nonebot_plugin_mahjong_utils-0.5.0.tar.gz 429.8 kB With provenance Details for nonebot_plugin_mahjong_utils-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for nonebot-plugin-mahjong-utils 0.5.0
File Interpreter ABI Platform Actions
nonebot_plugin_mahjong_utils-0.5.0-py3-none-any.whl Python 3 none any Details for nonebot_plugin_mahjong_utils-0.5.0-py3-none-any.whl

Total release size: 877.7 kB

Release files / nonebot_plugin_mahjong_utils-0.5.0.tar.gz

Download URL nonebot_plugin_mahjong_utils-0.5.0.tar.gz
Size 429.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c372be9927dfe0bcb3891646cb39a89b7de145070e68d3651041efca8613713a
BLAKE2b-256 checksum
How to use checksums
4de49a3758105b28daba1ea40a6065d2760ce63bd731b12491b66889b57ff11c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 14, 2025.

Transparency log

Release files / nonebot_plugin_mahjong_utils-0.5.0-py3-none-any.whl

Download URL nonebot_plugin_mahjong_utils-0.5.0-py3-none-any.whl
Size 447.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e5c66bc9d1e4b01aac2a136a3b2d0b3fde67571cc20710c13186da811fa08690
BLAKE2b-256 checksum
How to use checksums
eaf50d79ed0a596834b3f2d8eab8d81cbf0c66a056b8f979f002a495e3c7165f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.12.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 14, 2025.

Transparency log

Security for nonebot-plugin-mahjong-utils 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for nonebot_plugin_mahjong_utils-0.5.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 14, 2025.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page