├── alisabot ├── utils │ ├── __init__.py │ ├── request.py │ ├── rule.py │ └── translate.py ├── data │ └── temp │ │ └── 我是占位置的.txt └── plugins │ ├── test │ ├── data_source.py │ ├── config.py │ └── __init__.py │ ├── deletemsg │ ├── data_source.py │ └── __init__.py │ ├── fun │ ├── data │ │ ├── hand-1.png │ │ ├── hand-2.png │ │ ├── hand-3.png │ │ ├── hand-4.png │ │ ├── hand-5.png │ │ └── haarcascade_dragon.xml │ ├── config.py │ ├── data_source.py │ └── __init__.py │ ├── setu │ ├── config.py │ ├── data_source.py │ └── __init__.py │ ├── administration │ ├── __init__.py │ └── plugins │ │ └── plugin_control │ │ └── __init__.py │ ├── dicer │ ├── madness.py │ ├── san_check.py │ ├── draw.py │ ├── deck.py │ ├── __init__.py │ ├── investigator.py │ ├── cards.py │ ├── dices.py │ └── messages.py │ └── coderunner.py ├── .env ├── pyproject.toml ├── bot.py ├── requirements.txt ├── README.md ├── .gitignore └── LICENSE /alisabot/utils/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /alisabot/data/temp/我是占位置的.txt: -------------------------------------------------------------------------------- 1 | 2333 -------------------------------------------------------------------------------- /alisabot/plugins/test/data_source.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /alisabot/plugins/deletemsg/data_source.py: -------------------------------------------------------------------------------- 1 | forbidden_word = ["腾讯云", "特惠", "阿里云"] 2 | -------------------------------------------------------------------------------- /alisabot/plugins/fun/data/hand-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shudorcl/AlisaBot/HEAD/alisabot/plugins/fun/data/hand-1.png -------------------------------------------------------------------------------- /alisabot/plugins/fun/data/hand-2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shudorcl/AlisaBot/HEAD/alisabot/plugins/fun/data/hand-2.png -------------------------------------------------------------------------------- /alisabot/plugins/fun/data/hand-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shudorcl/AlisaBot/HEAD/alisabot/plugins/fun/data/hand-3.png -------------------------------------------------------------------------------- /alisabot/plugins/fun/data/hand-4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shudorcl/AlisaBot/HEAD/alisabot/plugins/fun/data/hand-4.png -------------------------------------------------------------------------------- /alisabot/plugins/fun/data/hand-5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/shudorcl/AlisaBot/HEAD/alisabot/plugins/fun/data/hand-5.png -------------------------------------------------------------------------------- /alisabot/plugins/fun/config.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseSettings 2 | 3 | 4 | class Config(BaseSettings): 5 | # Your Config Here 6 | 7 | class Config: 8 | extra = "ignore" 9 | -------------------------------------------------------------------------------- /alisabot/plugins/setu/config.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseSettings 2 | 3 | 4 | class Config(BaseSettings): 5 | # Your Config Here 6 | 7 | class Config: 8 | extra = "ignore" 9 | -------------------------------------------------------------------------------- /alisabot/plugins/test/config.py: -------------------------------------------------------------------------------- 1 | from pydantic import BaseSettings 2 | 3 | 4 | class Config(BaseSettings): 5 | # Your Config Here 6 | 7 | class Config: 8 | extra = "ignore" 9 | -------------------------------------------------------------------------------- /.env: -------------------------------------------------------------------------------- 1 | HOST=127.0.0.1 2 | PORT=8080 3 | DEBUG=false # 是否在debug模式下运行 4 | SUPERUSERS=[""] # 配置 NoneBot 超级用户 5 | NICKNAME=["Alisa", "alisa"] # 配置机器人的昵称 6 | COMMAND_START=["/", ""] # 配置命令起始字符 7 | COMMAND_SEP=["."] # 配置命令分割字符 8 | LOLICON_KEY="" # https://api.lolicon.app/#/setu -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "AlisaBot" 3 | version = "0.1.0" 4 | description = "AlisaBot" 5 | authors = [] 6 | readme = "README.md" 7 | 8 | [tool.poetry.dependencies] 9 | python = "^3.7" 10 | nonebot2 = "^2.0.0.a1" 11 | nb-cli = "^0.1.0" 12 | 13 | [tool.poetry.dev-dependencies] 14 | nonebot-test = "^0.1.0" 15 | 16 | [nonebot.plugins] 17 | plugins = [] 18 | plugin_dirs = ["alisabot/plugins"] 19 | 20 | [build-system] 21 | requires = ["poetry>=0.12"] 22 | build-backend = "poetry.masonry.api" 23 | -------------------------------------------------------------------------------- /bot.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | 4 | import nonebot 5 | from nonebot.adapters.cqhttp import Bot 6 | nonebot.init() 7 | # nonebot.init(_env_file=".env.dev") 8 | app = nonebot.get_asgi() 9 | 10 | driver = nonebot.get_driver() 11 | driver.register_adapter("cqhttp", Bot) 12 | nonebot.load_from_toml("pyproject.toml") 13 | config = driver.config 14 | if __name__ == "__main__": 15 | nonebot.logger.warning("Always use `nb run` to start the bot instead of manually running!") 16 | nonebot.run(app="__mp_main__:app") 17 | -------------------------------------------------------------------------------- /alisabot/plugins/administration/__init__.py: -------------------------------------------------------------------------------- 1 | from pathlib import Path 2 | 3 | import nonebot 4 | from nonebot import get_driver 5 | 6 | from .config import Config 7 | 8 | global_config = get_driver().config 9 | config = Config(**global_config.dict()) 10 | 11 | # Export something for other plugin 12 | # export = nonebot.export() 13 | # export.foo = "bar" 14 | 15 | # @export.xxx 16 | # def some_function(): 17 | # pass 18 | 19 | _sub_plugins = set() 20 | _sub_plugins |= nonebot.load_plugins( 21 | str((Path(__file__).parent / "plugins"). 22 | resolve())) 23 | -------------------------------------------------------------------------------- /alisabot/plugins/setu/data_source.py: -------------------------------------------------------------------------------- 1 | from typing import Dict 2 | 3 | from nonebot.adapters.cqhttp import MessageSegment, Message 4 | 5 | 6 | def setu_msg(data: Dict, type: int, user: int) -> Message: 7 | msg = "" 8 | pid = data["pid"] 9 | title = data["title"] 10 | img_url = data["urls"]["original"] 11 | img = MessageSegment.image(img_url, proxy=False) 12 | setu = Message(f"Pid: {pid}\n" f"Title: {title}\n" f"{img}") 13 | at_msg = Message(f">{MessageSegment.at(user)}\n") 14 | if type == 3: 15 | msg = f"[CQ:cardimage,file={img_url}]" 16 | elif type == 1: 17 | msg = at_msg + setu 18 | return Message(msg) 19 | -------------------------------------------------------------------------------- /alisabot/plugins/deletemsg/__init__.py: -------------------------------------------------------------------------------- 1 | # import nonebot 2 | from nonebot import get_driver, on_message 3 | from nonebot.adapters.cqhttp import Bot, GroupMessageEvent 4 | 5 | from .config import Config 6 | from .data_source import forbidden_word 7 | 8 | global_config = get_driver().config 9 | config = Config(**global_config.dict()) 10 | 11 | delete_msg = on_message(priority=5) 12 | 13 | 14 | @delete_msg.handle() 15 | async def delete_msg_handle(bot: Bot, event: GroupMessageEvent): 16 | ''' 17 | 撤回违规消息,在data_source中修改违禁词列表 18 | ''' 19 | msg_id = event.message_id 20 | msg = event.get_plaintext() 21 | for i in forbidden_word: 22 | if i in msg: 23 | await bot.call_api("delete_msg", **{'message_id': msg_id}) 24 | await bot.send(event, f"在消息{msg_id}发现违禁词,已排除") 25 | break 26 | -------------------------------------------------------------------------------- /alisabot/plugins/dicer/madness.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | from .messages import temporary_madness, madness_end, phobias, manias 4 | 5 | 6 | def ti(): 7 | i = random.randint(1, 10) 8 | r = "临时疯狂判定1D10=%d\n" % i 9 | r += temporary_madness[i - 1] 10 | if i == 9: 11 | j = random.randint(1, 100) 12 | r += "\n恐惧症状为:\n" 13 | r += phobias[j - 1] 14 | elif i == 10: 15 | j = random.randint(1, 100) 16 | r += "\n狂躁症状为:\n" 17 | r += manias[j - 1] 18 | r += "\n该症状将会持续1D10=%d" % random.randint(1, 10) 19 | return r 20 | 21 | 22 | def li(): 23 | i = random.randint(1, 10) 24 | r = "总结疯狂判定1D10=%d\n" % i 25 | r += madness_end[i - 1] 26 | if i in [2, 3, 6, 9, 10]: 27 | r += "\n调查员将在1D10=%d小时后醒来" % random.randint(1, 10) 28 | if i == 9: 29 | j = random.randint(1, 100) 30 | r += "\n恐惧症状为:\n" 31 | r += phobias[j - 1] 32 | elif i == 10: 33 | j = random.randint(1, 100) 34 | r += "\n狂躁症状为:\n" 35 | r += manias[j - 1] 36 | return r 37 | -------------------------------------------------------------------------------- /alisabot/utils/request.py: -------------------------------------------------------------------------------- 1 | from typing import Optional 2 | 3 | from aiohttp import ClientSession 4 | 5 | 6 | async def get_text(url: str, headers: Optional[dict] = None) -> str: 7 | async with ClientSession() as session: 8 | async with session.get(url, headers=headers) as r: 9 | result = await r.text() 10 | return result 11 | 12 | 13 | async def get_bytes(url: str, headers: Optional[dict] = None) -> bytes: 14 | async with ClientSession() as session: 15 | async with session.get(url, headers=headers) as r: 16 | result = await r.read() 17 | return result 18 | 19 | 20 | async def get_content(url: str, headers: Optional[dict] = None): 21 | async with ClientSession() as session: 22 | async with session.get(url, headers=headers) as r: 23 | result = await r.content.read() 24 | return result 25 | 26 | 27 | async def post_bytes( 28 | url: str, params: Optional[dict] = None, json: Optional[dict] = None 29 | ) -> bytes: 30 | async with ClientSession() as session: 31 | async with session.post(url, params=params, json=json) as r: 32 | result = await r.read() 33 | return result 34 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | aiohttp==3.7.4.post0 2 | arrow==1.1.0 3 | async-timeout==3.0.1 4 | attrs==21.2.0 5 | binaryornot==0.4.4 6 | certifi==2020.12.5 7 | chardet==4.0.0 8 | click==7.1.2 9 | colorama==0.4.4 10 | cookiecutter==1.7.2 11 | fastapi==0.63.0 12 | h11==0.12.0 13 | httpcore==0.12.3 14 | httpx==0.17.1 15 | idna==2.10 16 | Jinja2==2.11.3 17 | jinja2-time==0.2.0 18 | loguru==0.5.3 19 | MarkupSafe==1.1.1 20 | multidict==5.1.0 21 | nb-cli==0.4.2 22 | nonebot-adapter-cqhttp==2.0.0a13 23 | nonebot2==2.0.0a13.post1 24 | pathlib==1.0.1 25 | Pillow==8.2.0 26 | poyo==0.5.0 27 | prompt-toolkit==1.0.14 28 | pydantic==1.8.2 29 | pyfiglet==0.8.post1 30 | Pygments==2.9.0 31 | pygtrie==2.4.2 32 | PyInquirer==1.0.3 33 | python-dateutil==2.8.1 34 | python-dotenv==0.17.1 35 | python-slugify==5.0.2 36 | PyYAML==5.4.1 37 | regex==2021.4.4 38 | requests==2.25.1 39 | rfc3986==1.5.0 40 | six==1.16.0 41 | sniffio==1.2.0 42 | starlette==0.13.6 43 | text-unidecode==1.3 44 | tomlkit==0.7.0 45 | typing-extensions==3.10.0.0 46 | urllib3==1.26.4 47 | uvicorn==0.13.4 48 | watchgod==0.7 49 | wcwidth==0.2.5 50 | websockets==8.1 51 | win32-setctime==1.0.3 52 | yarl==1.6.3 53 | 54 | opencv-python~=4.5.2.52 55 | numpy~=1.20.3 56 | varname~=0.6.4 57 | ujson~=4.0.2 -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![AlisaBot](https://socialify.git.ci/shudorcl/AlisaBot/image?description=1&descriptionEditable=Nonebot2%20QQbot&language=1&owner=1&stargazers=1&theme=Light) 2 |

3 | 4 | 5 | 6 | 7 |

8 | 9 | 大家好啊,我是莫思潋。 10 | 11 | 我决定认真remake一下我缝合的QQbot! 12 | 13 | # 怎么运行呢? 14 | 15 | 呃,虽然不会有人来玩,但我还是要说! 16 | 17 | 1. `git clone`本仓库,然后在虚拟环境中`pip install -r requirements.txt` 18 | 19 | 2. [按照这里的的说明](https://v2.nonebot.dev/next/guide/cqhttp-guide.html) 20 | 配置cqhttp协议端,推荐使用[go-cqhttp](https://github.com/Mrs4s/go-cqhttp) 21 | 22 | 3. 配置.env文件 23 | 24 | 4. 启动协议端,并在`bot.py`所在目录下运行`nb run` 25 | 26 | # 现在能做什么? 27 | 28 | - 今天吃什么!←偷的 29 | 30 | - 发涩图!←大部分也是偷的 31 | 32 | - 识别龙图并大喊“卧槽,龙!” 33 | 34 | - 根据违禁词列表撤回消息(需要管理员权限) 35 | 36 | - 进行coc跑团 37 | 38 | # 将来会做什么? 39 | 40 | 把我缝过的东西缝回来! 41 | 42 | - [x] 发涩图 43 | - [x] 插件控制 44 | - [ ] 冷却时间 45 | - [ ] ban人 46 | - [ ] 趣味功能 47 | - [ ] 搜电子书 48 | 49 | # 关于协议 50 | 51 | 因为[ATRI](https://github.com/Kyomotoi/ATRI) 使用的是GPL-3.0,所以我也用了,就酱~ 52 | 53 | # 感谢 54 | 55 | [Kyomotoi](https://github.com/Kyomotoi): [ATRI](https://github.com/Kyomotoi/ATRI) 成功让我走上了缝合之路! 56 | 57 | [Mrs4s](https://github.com/Mrs4s): [go-cqhttp](https://github.com/Mrs4s/go-cqhttp) 58 | 59 | [NoneBot](https://github.com/nonebot): [NoneBot2](https://github.com/nonebot/nonebot2) 60 | 61 | [Abrahum](https://github.com/abrahum): [NoneBot Plugin COC-Dicer](https://github.com/abrahum/nonebot_plugin_cocdicer) 62 | 骰娘就是从这里魔改哒! -------------------------------------------------------------------------------- /alisabot/plugins/test/__init__.py: -------------------------------------------------------------------------------- 1 | # import nonebot 2 | from nonebot import get_driver 3 | from nonebot import on_command 4 | from nonebot.adapters import Bot, Event 5 | from nonebot.adapters.cqhttp import MessageSegment, GroupMessageEvent 6 | from nonebot.permission import SUPERUSER 7 | from nonebot.typing import T_State 8 | 9 | from .config import Config 10 | 11 | global_config = get_driver().config 12 | config = Config(**global_config.dict()) 13 | 14 | test1 = on_command("testAlisa", permission=SUPERUSER) 15 | 16 | 17 | @test1.handle() 18 | async def test1_handle(bot: Bot, event: Event, state: T_State): 19 | name = global_config.nickname 20 | if "Alisa" in name: 21 | name = "Alisa" 22 | await test1.finish(f"收到,我是{name}") 23 | 24 | 25 | testzhuanfa = on_command("转发测试", permission=SUPERUSER) 26 | 27 | 28 | @testzhuanfa.handle() 29 | async def handle(bot: Bot, event: GroupMessageEvent): 30 | user = event.user_id 31 | group = event.group_id 32 | msg = "欧内的手,好汉!" 33 | node = MessageSegment.node_custom(user, "test", msg) 34 | node2 = [ 35 | { 36 | "type": "node", 37 | "data": { 38 | "name": "消息发送者A", 39 | "uin": "10086", 40 | "content": [ 41 | { 42 | "type": "text", 43 | "data": {"text": "测试消息1"} 44 | } 45 | ] 46 | } 47 | }, 48 | { 49 | "type": "node", 50 | "data": { 51 | "name": "消息发送者B", 52 | "uin": "10087", 53 | "content": "[CQ:image,file=xxxxx]测试消息2" 54 | } 55 | } 56 | ] 57 | await bot.send(event, str(node)) 58 | await bot.send(event, str(node2)) 59 | await bot.send_group_forward_msg(group_id=group, messages=node2) 60 | -------------------------------------------------------------------------------- /alisabot/plugins/administration/plugins/plugin_control/__init__.py: -------------------------------------------------------------------------------- 1 | import json 2 | import re 3 | from pathlib import Path 4 | 5 | from nonebot import get_driver 6 | from nonebot.adapters.cqhttp import GROUP_ADMIN, GROUP_OWNER, Bot, GroupMessageEvent 7 | from nonebot.permission import SUPERUSER 8 | from nonebot.plugin import on_command 9 | 10 | from alisabot.utils.rule import plugin_control 11 | 12 | global_config = get_driver().config 13 | superusers = global_config.superusers 14 | switch = on_command('/switch', 15 | permission=(SUPERUSER | GROUP_OWNER | GROUP_ADMIN)) 16 | 17 | 18 | @switch.handle() 19 | async def _(bot: Bot, event: GroupMessageEvent) -> None: 20 | user = str(event.user_id) 21 | group = str(event.group_id) 22 | func = str(event.message).strip() 23 | 24 | switch_path = Path('.') / 'alisabot' / 'data' / 'switch.json' 25 | with open(switch_path, 'r') as f: 26 | data = json.load(f) 27 | funclist = [] 28 | for i in data: 29 | funclist.append(i) 30 | if not func: 31 | msg = "现在注册控制的功能有:" 32 | for i in funclist: 33 | msg += i 34 | msg += " " 35 | msg.strip() 36 | await switch.finish(msg) 37 | 38 | funct = re.findall(r"[on|off]-(.*)", func) 39 | 40 | if "all-on" in func: 41 | if int(user) in superusers: 42 | await switch.finish(plugin_control(funct[0], True)) 43 | 44 | else: 45 | await switch.finish("Permission Denied") 46 | 47 | elif "all-off" in func: 48 | if int(user) in superusers: 49 | await switch.finish(plugin_control(funct[0], False)) 50 | 51 | else: 52 | await switch.finish("Permission Denied") 53 | 54 | elif "on" in func: 55 | await switch.finish(plugin_control(funct[0], True, group)) 56 | 57 | elif "off" in func: 58 | await switch.finish(plugin_control(funct[0], False, group)) 59 | 60 | else: 61 | await switch.finish("请检查输入") 62 | -------------------------------------------------------------------------------- /alisabot/plugins/dicer/san_check.py: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | from nonebot.adapters.cqhttp import Event 4 | 5 | from .cards import cards 6 | from .dices import Dices 7 | from .messages import help_messages 8 | 9 | 10 | def number_or_dice(arg: str): 11 | if "d" in arg: 12 | d = Dices() 13 | dices = re.search(r"\d+d", arg) 14 | if dices: 15 | d.dices = int(dices.group()[:-1]) 16 | faces = re.search(r"d\d+", arg) 17 | if faces: 18 | d.faces = int(faces.group()[1:]) 19 | d.roll() 20 | return d 21 | else: 22 | return int(arg) 23 | 24 | 25 | def sc(arg: str, event: Event) -> str: 26 | args = arg.split(" ") 27 | a_num = success = failure = None 28 | using_card = False 29 | for arg in args: 30 | if not arg: 31 | continue 32 | elif re.search(r"\/", arg): 33 | success = re.search(r"\d*d\d+|\d+", arg) 34 | failure = re.search(r"[\/]+(\d*d\d+|\d+)", arg) 35 | elif re.search(r"\d+", arg): 36 | a_num = re.search(r"\d+", arg) 37 | if (not success) or (not failure): 38 | return help_messages.sc 39 | if (not a_num) and cards.get(event): 40 | card_data = cards.get(event) 41 | a_num = card_data["san"] 42 | using_card = True 43 | elif a_num: 44 | card_data = {"san": int(a_num.group()), "name": "该调查员"} 45 | elif not a_num: 46 | return help_messages.sc 47 | check_dice = Dices() 48 | check_dice.a = True 49 | check_dice.anum = card_data["san"] 50 | success = number_or_dice(success.group()) 51 | failure = number_or_dice(failure.group()[1:]) 52 | r = "San Check" + check_dice.roll()[4:] 53 | result = success if check_dice.result <= check_dice.anum else failure 54 | r += "\n理智降低了" 55 | if type(result) is int: 56 | r += "%d点" % result 57 | else: 58 | r = r + result._head + str(result.result) 59 | result = result.result 60 | if result >= card_data["san"]: 61 | r += "\n%s陷入了永久性疯狂" % card_data["name"] 62 | elif result >= (card_data["san"] // 5): 63 | r += "\n%s陷入了不定性疯狂" % card_data["name"] 64 | elif result >= 5: 65 | r += "\n%s陷入了临时性疯狂" % card_data["name"] 66 | if using_card: 67 | card_data["san"] -= result 68 | cards.update(event, card_data) 69 | return r 70 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.toptal.com/developers/gitignore/api/python 3 | # Edit at https://www.toptal.com/developers/gitignore?templates=python 4 | 5 | ### Python ### 6 | # Byte-compiled / optimized / DLL files 7 | __pycache__/ 8 | *.py[cod] 9 | *$py.class 10 | 11 | # C extensions 12 | *.so 13 | 14 | # Distribution / packaging 15 | .Python 16 | build/ 17 | develop-eggs/ 18 | dist/ 19 | downloads/ 20 | eggs/ 21 | .eggs/ 22 | lib/ 23 | lib64/ 24 | parts/ 25 | sdist/ 26 | var/ 27 | wheels/ 28 | pip-wheel-metadata/ 29 | share/python-wheels/ 30 | *.egg-info/ 31 | .installed.cfg 32 | *.egg 33 | MANIFEST 34 | 35 | # PyInstaller 36 | # Usually these files are written by a python script from a template 37 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 38 | *.manifest 39 | *.spec 40 | 41 | # Installer logs 42 | pip-log.txt 43 | pip-delete-this-directory.txt 44 | 45 | # Unit test / coverage reports 46 | htmlcov/ 47 | .tox/ 48 | .nox/ 49 | .coverage 50 | .coverage.* 51 | .cache 52 | nosetests.xml 53 | coverage.xml 54 | *.cover 55 | *.py,cover 56 | .hypothesis/ 57 | .pytest_cache/ 58 | pytestdebug.log 59 | 60 | # Translations 61 | *.mo 62 | *.pot 63 | 64 | # Django stuff: 65 | *.log 66 | local_settings.py 67 | db.sqlite3 68 | db.sqlite3-journal 69 | 70 | # Flask stuff: 71 | instance/ 72 | .webassets-cache 73 | 74 | # Scrapy stuff: 75 | .scrapy 76 | 77 | # Sphinx documentation 78 | docs/_build/ 79 | doc/_build/ 80 | 81 | # PyBuilder 82 | target/ 83 | 84 | # Jupyter Notebook 85 | .ipynb_checkpoints 86 | 87 | # IPython 88 | profile_default/ 89 | ipython_config.py 90 | 91 | # pyenv 92 | .python-version 93 | 94 | # pipenv 95 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 96 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 97 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 98 | # install all needed dependencies. 99 | #Pipfile.lock 100 | 101 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 102 | __pypackages__/ 103 | 104 | # Celery stuff 105 | celerybeat-schedule 106 | celerybeat.pid 107 | 108 | # SageMath parsed files 109 | *.sage.py 110 | 111 | # Environments 112 | .env 113 | .venv 114 | env/ 115 | venv/ 116 | ENV/ 117 | env.bak/ 118 | venv.bak/ 119 | 120 | # Spyder project settings 121 | .spyderproject 122 | .spyproject 123 | 124 | # Rope project settings 125 | .ropeproject 126 | 127 | # mkdocs documentation 128 | /site 129 | 130 | # mypy 131 | .mypy_cache/ 132 | .dmypy.json 133 | dmypy.json 134 | 135 | # Pyre type checker 136 | .pyre/ 137 | 138 | # pytype static type analyzer 139 | .pytype/ 140 | 141 | # End of https://www.toptal.com/developers/gitignore/api/python 142 | /alisabot/plugins/test/ 143 | -------------------------------------------------------------------------------- /alisabot/plugins/fun/data_source.py: -------------------------------------------------------------------------------- 1 | import io 2 | from os import path 3 | from pathlib import Path 4 | 5 | import cv2 6 | import numpy as np 7 | import requests 8 | from PIL import Image, ImageDraw 9 | 10 | temp_dir = Path('.') / 'alisabot' / 'data' / 'temp' 11 | temp_dir = path.abspath(temp_dir) 12 | 13 | 14 | def get_circle_avatar(avatar, size): 15 | # avatar.thumbnail((size, size)) 16 | avatar = avatar.resize((size, size)) 17 | scale = 5 18 | mask = Image.new('L', (size * scale, size * scale), 0) 19 | draw = ImageDraw.Draw(mask) 20 | draw.ellipse((0, 0, size * scale, size * scale), fill=255) 21 | mask = mask.resize((size, size), Image.ANTIALIAS) 22 | ret_img = avatar.copy() 23 | ret_img.putalpha(mask) 24 | return ret_img 25 | 26 | 27 | def generate_gif(frame_dir: str, avatar: Image.Image, user_id, output_dir=temp_dir): 28 | avatar_size = [(350, 350), (372, 305), (395, 283), (380, 305), (350, 372)] 29 | avatar_pos = [(50, 150), (28, 195), (5, 217), (5, 195), (50, 128)] 30 | imgs = [] 31 | for i in range(5): 32 | im = Image.new(mode='RGBA', size=(600, 600), color='white') 33 | hand = Image.open(path.join(frame_dir, f'hand-{i + 1}.png')) 34 | hand = hand.convert('RGBA') 35 | avatar = get_circle_avatar(avatar, 350) 36 | avatar = avatar.resize(avatar_size[i]) 37 | try: 38 | im.paste(avatar, avatar_pos[i], mask=avatar.split()[3]) 39 | except Exception: 40 | im.paste(avatar, avatar_pos[i], mask=avatar.split()[1]) 41 | im.paste(hand, mask=hand.split()[3]) 42 | imgs.append(im) 43 | out_path = path.join(output_dir, f'{user_id}output.gif') 44 | imgs[0].save(fp=out_path, save_all=True, append_images=imgs, duration=25, loop=0, quality=80) 45 | return out_path 46 | 47 | 48 | # xml_path = Path('.') / 'alisabot' / 'plugins' / 'fun' / 'data' / 'haarcascade_dragon.xml' 49 | # xml_path = path.abspath(xml_path) 50 | # 非常诡异的事情就在这里,用pathlib生成的绝对路径不管用,得你像下面这样自己输一下绝对路径 51 | xml_path = "C:/Code/Python/BotDev/AlisaBot/alisabot/plugins/fun/data/haarcascade_dragon.xml" 52 | 53 | 54 | def dragon_reco(raw_img) -> bool: 55 | if not xml_path: 56 | return False 57 | dragon_cascade = cv2.CascadeClassifier(xml_path) 58 | img_stream = io.BytesIO(raw_img) 59 | img = cv2.imdecode(np.frombuffer(img_stream.read(), np.uint8), 1) 60 | gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 61 | dragons = dragon_cascade.detectMultiScale(gray, 1.01, 8) 62 | if not len(dragons): 63 | return False 64 | else: 65 | return True 66 | 67 | 68 | if __name__ == '__main__': 69 | # data_dir = "./data" 70 | # test_path = "./data/test.jpg" 71 | # test_avatar = Image.open(test_path) 72 | # generate_gif(data_dir, test_avatar, 114514, "./") 73 | url = "https://wx1.sinaimg.cn/mw690/007cxfnugy1gq6qtbqecvj305u05eweh.jpg" 74 | if dragon_reco(requests.get(url).content): 75 | print("识别成功") 76 | else: 77 | print("识别失败") 78 | -------------------------------------------------------------------------------- /alisabot/plugins/dicer/draw.py: -------------------------------------------------------------------------------- 1 | import random 2 | import re 3 | 4 | from nonebot.adapters.cqhttp import Message, MessageSegment 5 | 6 | from .deck import DeckDict 7 | 8 | 9 | def draw_handler(args: str) -> list: 10 | ReturnList = [] 11 | DrawList = [] 12 | if "张" not in args: 13 | if args not in DeckDict.keys(): 14 | ReturnList.append("没有这个牌堆可怎么抽?难道让我闪光印卡吗~") 15 | ReturnList.append("现在的牌堆有:\n" + "\n".join(DeckDict.keys())) 16 | return ReturnList 17 | if args == "塔罗牌": 18 | tarot = random.sample(DeckDict[args], k=3)[0] 19 | position = random.sample(['positive', 'negative'], k=1)[0] 20 | if position == 'positive': 21 | position_text = '正位' 22 | else: 23 | position_text = '逆位' 24 | ReturnList.append(f"【{position_text}】/{tarot['name']}\n{tarot[position]}") 25 | else: 26 | ReturnList.append(random.sample(DeckDict[args], k=3)[0]) 27 | return ReturnList 28 | num = re.search(r"(.*)张", args).group(1) 29 | deck = re.search(r"张(.*)", args).group(1) 30 | try: 31 | num = int(num) 32 | except ValueError: 33 | ReturnList.append("张数输入错误~目前只支持阿拉伯数字喔~") 34 | return ReturnList 35 | if deck not in DeckDict.keys(): 36 | ReturnList.append("没有这个牌堆可怎么抽?难道让我闪光印卡吗~") 37 | ReturnList.append("现在的牌堆有:\n" + "\n".join(DeckDict.keys())) 38 | return ReturnList 39 | elif num > len(DeckDict[deck]): 40 | ReturnList.append(f"{num}张也太多了,整个牌堆抽完都不够用的") 41 | return ReturnList 42 | msg = f"锵锵锵,我们就来看看在{deck}中会抽到什么!\n" 43 | if deck == "塔罗牌": 44 | TarotList = random.sample(DeckDict[deck], k=num) 45 | for card in TarotList: 46 | position = random.choice(['正位', '逆位']) 47 | DrawList.append(f"【{position}】/{card['name']}") 48 | else: 49 | DrawList = random.sample(DeckDict[deck], k=num) 50 | msg += "\n".join(DrawList) 51 | ReturnList.append(msg) 52 | return ReturnList 53 | 54 | 55 | def jrrp_handler(uid: str) -> list: 56 | ReturnList = [] 57 | at_msg = Message(f">{MessageSegment.at(uid)}\n") 58 | rp_msg = at_msg + random.choice(["要我测测您今天的人品嘛?今天的人品指数是", "根据占星学和量子力学,对您今天人品观测的结果是", "根据我们大型量子计算机的预测,您今天的人品指数为"]) 59 | rp = random.randint(1, 100) 60 | if rp > 90: 61 | rp_msg += f"——{rp}!!!\n" 62 | rp_msg += random.choice(["看来今天是个买彩票的好日子呢~", "快去抽卡吧少年!"]) 63 | rp_msg += "不过,还是得小心点喔" 64 | elif rp > 60: 65 | rp_msg += f"——{rp}\n" 66 | rp_msg += random.choice(["出去走走吧,没准可以遇到好事", "或许喝饮料能够中奖?"]) 67 | elif rp > 30: 68 | rp_msg += f"{rp}\n" 69 | rp_msg += random.choice(["又是平凡的一天,不过这也不错嘛", "今天也是好天气呢~"]) 70 | else: 71 | rp_msg += f"——呃,{rp}\n" 72 | rp_msg += random.choice(["今天恐怕得小心行事了。。。", "总而言之谨慎一点也不坏是吧~"]) 73 | ReturnList.append(Message(rp_msg)) 74 | if rp < 30: 75 | ReturnList.append(Message("不过话又说回来我也不一定准,别放在心上啦")) 76 | return ReturnList 77 | -------------------------------------------------------------------------------- /alisabot/plugins/setu/__init__.py: -------------------------------------------------------------------------------- 1 | # import nonebot 2 | import json 3 | from random import choice, randint 4 | 5 | from nonebot import get_driver, on_command, on_keyword 6 | from nonebot.adapters.cqhttp import MessageEvent, Bot, ActionFailed, Message, GroupMessageEvent, Event 7 | from nonebot.permission import SUPERUSER 8 | from nonebot.typing import T_State 9 | from varname import nameof 10 | 11 | from alisabot.utils.request import post_bytes 12 | from alisabot.utils.rule import check_control_function 13 | from .config import Config 14 | from .data_source import setu_msg 15 | 16 | global_config = get_driver().config 17 | config = Config(**global_config.dict()) 18 | 19 | lolicon_url = "https://api.lolicon.app/setu/" 20 | lolicon_url_v2 = "https://api.lolicon.app/setu/v2" 21 | lolicon_key = global_config.lolicon_key 22 | setu = on_command("来点涩图", aliases={"涩图gkd", "来点色图", 23 | "色图gkd", "涩图来", "色图来"}, priority=5) 24 | setu_type = 1 # 1为普通发图,2为构造转发,3为大涩图 25 | setu_name = nameof(setu) 26 | 27 | 28 | @setu.handle() 29 | async def setu_handle(bot: Bot, event: GroupMessageEvent): 30 | global setu_type, setu_name 31 | keyword = str(event.get_message()).strip() 32 | user = event.user_id 33 | group = event.group_id 34 | if not check_control_function(setu_name, group): 35 | await setu.finish(f"{setu_name}是不允许的!") 36 | if keyword: 37 | msgwait = choice([f"正在依据关键词{keyword}发起setu委托", 38 | f"{keyword}涩图搜索请求已发出,正等待回复"]) 39 | params = {"r18": "0", "tag": [keyword], "size": ["regular"]} 40 | await bot.send(event, Message(msgwait)) 41 | else: 42 | params = {"r18": "0", "size": ["original", "regular"]} 43 | data = {"msg": ""} 44 | try: 45 | data = json.loads(await post_bytes(lolicon_url_v2, params))["data"][0] 46 | except: 47 | await setu.finish("请求数据失败") 48 | try: 49 | if setu_type != 2: 50 | try: 51 | await setu.finish(setu_msg(data, setu_type, user)) 52 | except ActionFailed: 53 | await bot.send(event, "那就正常发吧,虽然可能还会有问题就是了~") 54 | await setu.finish(setu_msg(data, 1, user)) 55 | elif setu_type == 2: 56 | node = [{ 57 | "type": "node", 58 | "data": { 59 | "name": "某老涩批", 60 | "uin": f"{user}", 61 | "content": setu_msg 62 | } 63 | }] 64 | try: 65 | await bot.send_group_forward_msg(group_id=group, messages=node) 66 | except ActionFailed: 67 | await bot.send(event, "果然迫害人是不好的,那就正常发吧,虽然可能还会有问题就是了~") 68 | await setu.finish(setu_msg(data, 1, user)) 69 | except ActionFailed: 70 | await setu.finish(f"消息传输失败,通道似乎受到了管制") 71 | 72 | 73 | set_setu_type = on_command("setu-type", permission=SUPERUSER, priority=5) 74 | 75 | 76 | @set_setu_type.handle() 77 | async def handle(bot: Bot, event: Event, state: T_State): 78 | arg = str(event.get_message()).strip() 79 | global setu_type 80 | typelist = {1: "普通图", 2: "构造转发", 3: "大涩图"} 81 | former_setu_type = setu_type 82 | if arg not in ["1", "2", "3"]: 83 | await set_setu_type.finish("请检查输入") 84 | setu_type = int(arg) 85 | msg = f"原先的setu类型为{typelist[former_setu_type]}\n" 86 | msg += "现在的setu类型为" + typelist[int(arg)] 87 | await set_setu_type.finish(msg) 88 | 89 | 90 | bugouse = on_keyword({"不够涩", "不够色"}, priority=5) 91 | 92 | 93 | @bugouse.handle() 94 | async def bugouse_handle(bot: Bot, event: MessageEvent): 95 | await bugouse.finish(Message("那你来发" + "❤" if (randint(1, 15) < 5) else "")) 96 | -------------------------------------------------------------------------------- /alisabot/plugins/coderunner.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from nonebot import get_driver 4 | from nonebot.adapters import Bot, Event 5 | from nonebot.adapters.cqhttp.utils import escape as message_escape 6 | from nonebot.plugin import on_command 7 | from nonebot.typing import T_State 8 | 9 | from alisabot.utils.request import post_bytes 10 | 11 | global_config = get_driver().config 12 | RUN_API_URL_FORMAT = "https://run.glot.io/languages/{}/latest" 13 | SUPPORTED_LANGUAGES = { 14 | "assembly": {"ext": "asm"}, 15 | "bash": {"ext": "sh"}, 16 | "c": {"ext": "c"}, 17 | "clojure": {"ext": "clj"}, 18 | "coffeescript": {"ext": "coffe"}, 19 | "cpp": {"ext": "cpp"}, 20 | "csharp": {"ext": "cs"}, 21 | "erlang": {"ext": "erl"}, 22 | "fsharp": {"ext": "fs"}, 23 | "go": {"ext": "go"}, 24 | "groovy": {"ext": "groovy"}, 25 | "haskell": {"ext": "hs"}, 26 | "java": {"ext": "java", "name": "Main"}, 27 | "javascript": {"ext": "js"}, 28 | "julia": {"ext": "jl"}, 29 | "kotlin": {"ext": "kt"}, 30 | "lua": {"ext": "lua"}, 31 | "perl": {"ext": "pl"}, 32 | "php": {"ext": "php"}, 33 | "python": {"ext": "py"}, 34 | "ruby": {"ext": "rb"}, 35 | "rust": {"ext": "rs"}, 36 | "scala": {"ext": "scala"}, 37 | "swift": {"ext": "swift"}, 38 | "typescript": {"ext": "ts"}, 39 | } 40 | api_token = global_config.glot_key 41 | 42 | coderunner = on_command("code_runner", aliases={"run", "运行代码", "运行", "执行代码"}, priority=5) 43 | 44 | 45 | @coderunner.handle() 46 | async def _(bot: Bot, event: Event, state: T_State): 47 | args = str(event.get_message()).strip() 48 | 49 | if args: 50 | state['args'] = args 51 | language, *remains = state['args'].split("\n", maxsplit=1) 52 | language = language.strip() 53 | if language not in SUPPORTED_LANGUAGES: 54 | await coderunner.finish("暂时不支持运行你输入的编程语言") 55 | state["language"] = language 56 | 57 | if remains: 58 | code = remains[0].strip() # type: ignore 59 | if code: 60 | state["code"] = code 61 | 62 | 63 | supported_languages = ", ".join(sorted(SUPPORTED_LANGUAGES)) 64 | 65 | 66 | @coderunner.got("language", prompt=f"你想运行的代码是什么语言?\n目前支持 {supported_languages}") 67 | @coderunner.got("code", prompt='请输入你要运行的代码') 68 | async def _(bot: Bot, event: Event, state: dict) -> None: 69 | code = state['code'] 70 | language = state["language"] 71 | if language not in SUPPORTED_LANGUAGES: 72 | await coderunner.finish("暂时不支持运行你输入的编程语言") 73 | await bot.send(event, "正在运行,请稍等……") 74 | url = RUN_API_URL_FORMAT.format(language) 75 | data = { 76 | "files": [ 77 | { 78 | "name": (SUPPORTED_LANGUAGES[language].get("name", "main")) 79 | + f'.{SUPPORTED_LANGUAGES[language]["ext"]}', 80 | "content": code, 81 | } 82 | ], 83 | } 84 | headers = {"Authorization": f"Token {api_token}"} 85 | resp = await post_bytes(url, data, headers) 86 | if not resp: 87 | await coderunner.finish("运行失败,服务可能暂时不可用,请稍后再试。") 88 | sent = False 89 | resp = json.loads(resp) 90 | for output_name in ["stdout", "stderr", "error"]: 91 | output_text = resp.get(output_name) 92 | lines = output_text.splitlines() 93 | lines, remained_lines = lines[:10], lines[10:] 94 | out = "\n".join(lines) 95 | out, remained_out = out[: 60 * 10], out[60 * 10:] 96 | 97 | if remained_lines or remained_out: 98 | out += f"\n太长力,不打了" 99 | out = message_escape(out) 100 | if out: 101 | await bot.send(event, f"{output_name}:\n{out}") 102 | sent = True 103 | if not sent: 104 | await coderunner.finish("运行成功,没有任何输出") 105 | -------------------------------------------------------------------------------- /alisabot/utils/rule.py: -------------------------------------------------------------------------------- 1 | import json 2 | import os 3 | from pathlib import Path 4 | from typing import Optional 5 | 6 | from nonebot.adapters.cqhttp import Bot, GroupMessageEvent 7 | from nonebot.rule import Rule 8 | 9 | 10 | def check_control_function(function_name: str, group: int) -> bool: 11 | switch_all_path = Path('.') / 'alisabot' / 'data' / 'switch.json' 12 | switch_alone_dir = Path( 13 | '.') / 'alisabot' / 'data' / 'Group' / f"{group}" 14 | switch_alone_path = Path( 15 | '.') / 'alisabot' / 'data' / 'Group' / f"{group}" / 'switch.json' 16 | if not os.path.exists(switch_alone_dir): 17 | os.makedirs(switch_alone_dir) 18 | # 检查文件是否存在,如不存在,自动创建并写入默认值 19 | if not switch_all_path.is_file(): 20 | with open(switch_all_path, 'w+') as f: 21 | f.write(json.dumps({})) 22 | f.close() 23 | if not switch_alone_path.is_file(): 24 | try: 25 | os.mkdir( 26 | Path('.') / 'ATRI' / 'data' / 'data_Group' / f'{group}') 27 | except: 28 | pass 29 | 30 | with open(switch_alone_path, 'w') as f: 31 | f.write(json.dumps({})) 32 | f.close() 33 | with open(switch_all_path, 'r') as f: 34 | data_all = json.load(f) 35 | f.close() 36 | 37 | with open(switch_alone_path, 'r') as f: 38 | data_alone = json.load(f) 39 | f.close() 40 | if function_name not in data_all: 41 | data_all[function_name] = "True" 42 | with open(switch_all_path, 'w') as f: 43 | f.write(json.dumps(data_all)) 44 | f.close() 45 | 46 | if function_name not in data_alone: 47 | data_alone[function_name] = "True" 48 | with open(switch_alone_path, 'w') as f: 49 | f.write(json.dumps(data_alone)) 50 | f.close() 51 | # 判断目标 52 | if data_all[function_name] == "True" and data_alone[function_name] == "True": 53 | return True 54 | else: 55 | return False 56 | 57 | 58 | def check_switch(func_name: str, notice: bool) -> Rule: 59 | async def _check_switch(bot: Bot, event: GroupMessageEvent, state: dict) -> bool: 60 | # 获取目标信息 61 | group = event.group_id 62 | return check_control_function(func_name, group) 63 | 64 | return Rule(_check_switch) 65 | 66 | 67 | def plugin_control(func_name: str, 68 | control: bool, 69 | group: Optional[str] = None) -> str: 70 | file_switch_all = Path('.') / 'alisabot' / 'data' / 'switch.json' 71 | 72 | if group: 73 | file_switch_group = Path( 74 | '.') / 'alisabot' / 'data' / 'Group' / f"{group}" / 'switch.json' 75 | try: 76 | with open(file_switch_group, 'r') as f: 77 | data_switch_group = json.load(f) 78 | except FileNotFoundError: 79 | data_switch_group = {} 80 | 81 | if data_switch_group[f"{func_name}"]: 82 | pass 83 | else: 84 | return f"Can't find func({func_name})" 85 | 86 | data_switch_group[f"{func_name}"] = f"{control}" 87 | 88 | with open(file_switch_group, 'w') as f: 89 | f.write(json.dumps(data_switch_group)) 90 | f.close() 91 | 92 | else: 93 | with open(file_switch_all, 'r') as f: 94 | try: 95 | data_switch_all = json.load(f) 96 | except: 97 | data_switch_all = {} 98 | 99 | if not data_switch_all[f"{func_name}"]: 100 | return f"Can't find func({func_name})" 101 | 102 | data_switch_all[f"{func_name}"] = f"{control}" 103 | 104 | with open(file_switch_all, 'w') as f: 105 | f.write(json.dumps(data_switch_all)) 106 | f.close() 107 | 108 | if control: 109 | if group: 110 | msg = f"({func_name}) has been opened for group ({group})!" 111 | else: 112 | msg = f"({func_name}) has been opened for all group" 113 | 114 | else: 115 | if group: 116 | msg = f"({func_name}) has been closed for group ({group})!" 117 | else: 118 | msg = f"({func_name}) has been closed for all group!" 119 | 120 | return msg 121 | -------------------------------------------------------------------------------- /alisabot/plugins/fun/__init__.py: -------------------------------------------------------------------------------- 1 | # import nonebot 2 | 3 | import json 4 | import os 5 | import re 6 | from io import BytesIO 7 | from pathlib import Path 8 | from random import randint, choice 9 | 10 | from PIL import Image 11 | from nonebot import get_driver, on_regex, on_message 12 | from nonebot import on_command 13 | from nonebot.adapters import Bot 14 | from nonebot.adapters.cqhttp import Message, MessageEvent, ActionFailed 15 | 16 | from alisabot.utils.request import post_bytes, get_bytes, get_content 17 | from alisabot.utils.translate import to_simple_string 18 | from .config import Config 19 | from .data_source import generate_gif, dragon_reco 20 | 21 | global_config = get_driver().config 22 | config = Config(**global_config.dict()) 23 | 24 | TestUrl = "https://wtf.hiigara.net/api/run/{}" 25 | 26 | eat_wat = on_regex(r"[今|明|后|大后]天(.*?)吃什么", priority=5) 27 | 28 | 29 | @eat_wat.handle() 30 | async def _eat(bot: Bot, event: MessageEvent) -> None: 31 | msg = str(event.message).strip() 32 | user = event.user_id 33 | user_n = event.sender.nickname 34 | arg = re.findall(r"大?[今|明|后]天(.*?)吃什么", msg)[0] 35 | nd = re.findall(r"大?[今|明|后]天", msg)[0] 36 | 37 | if arg == "中午": 38 | a = f"LdS4K6/{randint(0, 999999)}" 39 | url = TestUrl.format(a) 40 | params = {"event": "ManualRun"} 41 | data = json.loads(await post_bytes(url, params)) 42 | 43 | text = to_simple_string(data['text']).replace('今天', nd) 44 | get_a = re.search(r"非常(.*?)的", text)[0] 45 | result = f"> [CQ:at,qq={user}]\n" + text.replace(get_a, '') 46 | 47 | elif arg == "晚上": 48 | a = f"KaTMS/{randint(0, 999999)}" 49 | url = TestUrl.format(a) 50 | params = {"event": "ManualRun"} 51 | data = json.loads(await post_bytes(url, params)) 52 | 53 | text = to_simple_string(data['text']).replace('今天', '') 54 | result = f"> [CQ:at,qq={user}]\n" + text 55 | 56 | else: 57 | rd = randint(1, 10) 58 | if rd == 5: 59 | result = "吃我吧 ❤" 60 | else: 61 | a = f"JJr1hJ/{randint(0, 999999)}" 62 | url = TestUrl.format(a) 63 | params = {"event": "ManualRun"} 64 | data = json.loads(await post_bytes(url, params)) 65 | 66 | text = to_simple_string(data['text']).replace('今天', nd) 67 | get_a = re.match(r"(.*?)的智商", text)[0] 68 | result = f"> [CQ:at,qq={user}]\n" + text.replace(get_a, f'{user_n}的智商') 69 | 70 | await eat_wat.finish(Message(result)) 71 | 72 | 73 | girl_test = on_command("girltest", priority=5) 74 | 75 | 76 | @girl_test.handle() 77 | async def girltesthandle(bot: Bot, event: MessageEvent): 78 | keyword = str(event.message).strip() 79 | user = event.user_id 80 | name = event.sender.nickname 81 | if keyword: 82 | name = keyword 83 | a = f"MtnVv9/{name}" 84 | url = TestUrl.format(a) 85 | params = {"event": "ManualRun"} 86 | data = json.loads(await post_bytes(url, params)) 87 | text = to_simple_string(data['text']) 88 | result = f"> [CQ:at,qq={user}]\n" + text 89 | await girl_test.finish(Message(result)) 90 | 91 | 92 | rua = on_command("rua", priority=5) 93 | 94 | data_dir = Path('.') / 'alisabot' / 'plugins' / 'fun' / 'data' 95 | data_dir = os.path.abspath(data_dir) 96 | 97 | 98 | @rua.handle() 99 | async def creep(bot: Bot, event: MessageEvent): 100 | raw_msg = str(event.raw_message) 101 | creep_id = re.findall(r"\[CQ:at,qq=(.*?)\]", raw_msg) 102 | if len(creep_id): 103 | creep_id = creep_id[0] 104 | else: 105 | await rua.finish(f"没找到rua谁呢") 106 | return 107 | url = f'http://q1.qlogo.cn/g?b=qq&nk={creep_id}&s=160' 108 | resp = await get_bytes(url) 109 | avatar = Image.open(BytesIO(resp)) 110 | try: 111 | output = generate_gif(data_dir, avatar, creep_id) 112 | except Exception as e: 113 | await rua.finish(f"rua不出来,按理说应该没问题的。。。\n揭示是{e}") 114 | return 115 | msg = f'[CQ:image,file=file:///{output}]' 116 | # msg = MessageSegment.image("///"+output) 117 | try: 118 | await bot.send(event, Message(msg)) 119 | except ActionFailed: 120 | await bot.send(event, "rua不出来,被管住叻...") 121 | 122 | 123 | dragon_recongnize = on_message(priority=5) 124 | 125 | 126 | @dragon_recongnize.handle() 127 | async def handler(bot: Bot, event: MessageEvent): 128 | msg = str(event.message) 129 | dragon_url = re.findall(r"url=(.*?)]", msg) 130 | if len(dragon_url): 131 | dragon_url = dragon_url[0] 132 | else: 133 | return 134 | dragon = await get_content(dragon_url) 135 | if dragon_reco(dragon): 136 | if randint(1, 15) < 6: 137 | await dragon_recongnize.finish(choice(["我看到龙了", "卧槽,龙!", "我发现了龙!"])) 138 | -------------------------------------------------------------------------------- /alisabot/plugins/dicer/deck.py: -------------------------------------------------------------------------------- 1 | major_arcana = [ 2 | {'name': '【0】愚者(The Fool,0)', 3 | 'positive': '盲目的、有勇气的、超越世俗的、展开新的阶段、有新的机会、追求自我的理想、展开一段旅行、超乎常人的勇气、漠视道德舆论的', 4 | 'negative': '过于盲目、不顾现实的、横冲直撞的、拒绝负担责任的、违背常理的、逃避的心态、一段危险的旅程、想法如孩童般天真幼稚的'}, 5 | {'name': '【1】魔术师(The Magician,I)', 6 | 'positive': '成功的、有实力的、聪明能干的、擅长沟通的、机智过人的、唯我独尊的、企划能力强的、透过更好的沟通而获得智慧、运用智慧影响他人、学习能力强的、有教育和学术上的能力、表达技巧良好的', 7 | 'negative': '变魔术耍花招的、瞒骗的、失败的、狡猾的、善于谎言的、能力不足的、丧失信心的、以不正当手段获取认同的'}, 8 | {'name': '【2】女祭司(The High Priestess,II)', 9 | 'positive': '纯真无邪的、拥有直觉判断能力的、揭发真相的、运用潜意识的力量、掌握知识的、正确的判断、理性的思考、单恋的、精神上的恋爱、对爱情严苛的、回避爱情的、对学业有助益的', 10 | 'negative': '冷酷无情的、无法正确思考的、错误的方向、迷信的、无理取闹的、情绪不安的、缺乏前瞻性的、严厉拒绝爱情的'}, 11 | {'name': '【3】女皇(The Empress,III)', 12 | 'positive': '温柔顺从的、高贵美丽的、享受生活的、丰收的、生产的、温柔多情的、维护爱情的、充满女性魅力的、具有母爱的、有创造力的女性、沈浸爱情的、财运充裕的、快乐愉悦的', 13 | 'negative': '骄傲放纵的、过度享乐的、浪费的、充满嫉妒心的、母性的独裁、占有欲、败家的女人、挥霍无度的、骄纵的、纵欲的、为爱颓废的、不正当的爱情、不伦之恋、美丽的诱惑'}, 14 | {'name': '【4】皇帝(The Emperor,IV)', 15 | 'positive': '事业成功、物质丰厚、掌控爱情运的、有手段的、有方法的、阳刚的、独立自主的、有男性魅力的、大男人主义的、有处理事情的能力、有点独断的、想要实现野心与梦想的', 16 | 'negative': '失败的、过于刚硬的、不利爱情运的、自以为是的、权威过度的、力量减弱的、丧失理智的、错误的判断、没有能力的、过于在乎世俗的、权力欲望过重的、权力使人腐败的、徒劳无功的'}, 17 | {'name': '【5】教皇(The Hierophant,or the Pope,V)', 18 | 'positive': '有智慧的、擅沟通的、适时的帮助、找到真理、有精神上的援助、得到贵人帮助、一个有影响力的导师、找到正确的方向、学业出现援助、爱情上出现长辈的干涉、媒人的帮助', 19 | 'negative': '过于依赖的、错误的指导、盲目的安慰、无效的帮助、独裁的、疲劳轰炸的、精神洗脑的、以不正当手段取得认同的、毫无能力的、爱情遭破坏、第三者的介入'}, 20 | {'name': '【6】恋人(The Lovers,VI)', 21 | 'positive': '爱情甜蜜的、被祝福的关系、刚萌芽的爱情、顺利交往的、美满的结合、面临工作学业的选择、面对爱情的抉择、下决定的时刻、合作顺利的', 22 | 'negative': '遭遇分离、有第三者介入、感情不合、外力干涉、面临分手状况、爱情已远去、无法结合的、遭受破坏的关系、爱错了人、不被祝福的恋情、因一时的寂寞而结合'}, 23 | {'name': '【7】战车(The Chariot,VII)', 24 | 'positive': '胜利的、凯旋而归的、不断的征服、有收获的、快速的解决、交通顺利的、充满信心的、不顾危险的、方向确定的、坚持向前的、冲劲十足的', 25 | 'negative': '不易驾驭的、严重失败、交通意外、遭遇挫折的、遇到障碍的、挣扎的、意外冲击的、失去方向的、丧失理智的、鲁莽冲撞的'}, 26 | {'name': '【8】力量(Strength,VIII)', 27 | 'positive': '内在的力量使成功的、正确的信心、坦然的态度、以柔克刚的力量、有魅力的、精神力旺盛、有领导能力的、理性的处理态度、头脑清晰的', 28 | 'negative': '丧失信心的、失去生命力的、沮丧的、失败的、失去魅力的、无助的、情绪化的、任性而为的、退缩的、没有能力处理问题的、充满负面情绪的'}, 29 | {'name': '【9】隐者(The Hermit,IX)', 30 | 'positive': '有骨气的、清高的、有智慧的、有法力的、自我修养的,生命的智慧情境、用智慧排除困难的、给予正确的指导方向、有鉴赏力的、三思而后行的、谨慎行动的', 31 | 'negative': '假清高的、假道德的、没骨气、没有能力的、内心孤独寂寞的、缺乏支持的、错误的判断、被排挤的、没有足够智慧的、退缩的、自以为是的、与环境不合的'}, 32 | {'name': '【10】命运之轮(The Wheel of Fortune,X)', 33 | 'positive': '忽然而来的幸运、即将转变的局势、顺应局势带来成功、把握命运给予的机会、意外的发展、不可预测的未来、突如其来的爱情运变动', 34 | 'negative': '突如其来的厄运、无法抵抗局势的变化、事情的发展失去了掌控、错失良机、无法掌握命运的关键时刻而导致失败、不利的突发状况、没有答案、被人摆布、有人暗中操作'}, 35 | {'name': '【11】正义(Justice,XI)', 36 | 'positive': '明智的决定、看清了真相、正确的判断与选择、得到公平的待遇、走向正确的道路、理智与正义战胜一切、维持平衡的、诉讼得到正义与公平、重新调整使之平衡、不留情面的', 37 | 'negative': '错误的决定、不公平的待遇、没有原则的、缺乏理想的、失去方向的、不合理的、存有偏见的、冥顽不灵的、小心眼、过于冷漠的、不懂感情的'}, 38 | {'name': '【12】倒吊人(The Hanged Man,XII)', 39 | 'positive': '心甘情愿的牺牲奉献、以修练的方式来求道、不按常理的、反其道而行的、金钱上的损失、正专注于某个理想的、有坚定信仰的、长时间沈思的、需要沈淀的、成功之前的必经之道', 40 | 'negative': '精神上的虐待、心不甘情不愿的牺牲、损失惨重的、受到亏待的、严重漏财的、不满足的、冷淡的、自私自利的、要求回报的付出、逃离綑绑和束缚、以错误的方式看世界'}, 41 | {'name': '【13】死神(Death,XIII)', 42 | 'positive': '必须结束旧有的现状、面临重新开始的时刻到了、将不好的过去清除掉、专注于心的开始、挥别过去的历史、展开心的旅程、在心里做个了结、激烈的变化', 43 | 'negative': '已经历经了重生阶段了、革命已经完成、挥别了过去、失去了、结束了、失败了、病了、走出阴霾的时刻到了、没有转圜余地了'}, 44 | {'name': '【14】节制(Temperance,XIV)', 45 | 'positive': '良好的疏导、希望与承诺、得到调和、有节制的、平衡的、沟通良好的、健康的、成熟与均衡的个性、以机智处理问题、从过去的错误中学习、避免重蹈覆辙、净化的、有技巧的、有艺术才能的', 46 | 'negative': '缺乏能力的、技术不佳的、不懂事的、需反省的、失去平衡状态、沟通不良的、缺乏自我控制力、不确定的、重复犯错的、挫败的、受阻碍的、暂时的分离、希望与承诺遥遥无期'}, 47 | {'name': '【15】恶魔(The Devil ,XV)', 48 | 'positive': '不伦之恋、不正当的欲望、受诱惑的、违反世俗约定的、不道德的、有特殊的艺术才能、沉浸在消极里、沉溺在恐惧之中的、充满愤怒和怨恨、因恐惧而阻碍了自己、错误的方向、不忠诚的、秘密恋情', 49 | 'negative': '解脱了不伦之恋、挣脱了世俗的枷锁、不顾道德的、逃避的、伤害自己的、欲望的化解、被诅咒的、欲望强大的、不利的环境、盲目做判断、被唾弃的'}, 50 | {'name': '【16】塔(The Tower,XVI)', 51 | 'positive': '双方关系破裂、难以挽救的局面、组织瓦解了、损失惨重的、惨烈的破坏、毁灭性的事件、混乱的影响力、意外的发展、震惊扰人的问题、悲伤的、离别的、失望的、需要协助的、生活需要重建的', 52 | 'negative': '全盘覆没、一切都已破坏殆尽、毫无转圜余地的、失去了、不安的、暴力的、已经遭逢厄运了、急需重建的'}, 53 | {'name': '【17】星星(The Star,XVII)', 54 | 'positive': '未来充满希望的、新的诞生、无限的希望、情感面精神面的希望、达成目标的、健康纯洁的、美好的未来、好运即将到来、美丽的身心、光明的时机、平静的生活、和平的处境', 55 | 'negative': '希望遥遥无期的、失去信心的、没有寄托的未来、失去目标的、感伤的、放弃希望的、好运远离的、毫无进展的、过于虚幻、假想的爱情运、偏执于理想、希望破灭的'}, 56 | {'name': '【18】月亮(The Moon,XVIII)', 57 | 'positive': '负面的情绪、不安和恐惧、充满恐惧感、阴森恐怖的感觉、黑暗的环境、景气低落、白日梦、忽略现实的、未知的危险、无法预料的威胁、胡思乱想的、不脚踏实地的、沉溺的、固执的', 58 | 'negative': '度过低潮阶段、心情平复、黑暗即将过去、曙光乍现、景气复甦、挥别恐惧、从忧伤中甦醒、恢复理智的、看清现实的、摆脱欲望的、脚踏实地的、走出谎言欺骗'}, 59 | {'name': '【19】太阳(The Sun,XIX)', 60 | 'positive': '前景看好的、运势如日中天的、成功的未来、光明正大的恋情、热恋的、美满的婚姻、丰收的、事件进行顺畅的、物质上的快乐、有成就的、满足的生活、旺盛', 61 | 'negative': '热情消退的、逐渐黯淡的、遭遇失败的、分离的、傲慢的、失去目标的、没有远景的、失去活力的、没有未来的、物质的贫乏、不快乐的人生阶段'}, 62 | {'name': '【20】审判(Judgement,XX)', 63 | 'positive': '死而复生、调整心态重新来过、内心的觉醒、观念的翻新、超脱了束缚的、满意的结果、苦难的结束、重新检视过去而得到新的启发、一个新的开始、一段新的关系', 64 | 'negative': '不公平的审判、无法度过考验的、旧事重演的、固执不改变的、自以为是的、对生命的看法狭隘的、后悔莫及的、自责的、不满意的结果、被击垮的'}, 65 | {'name': '【21】世界(The World,XXI)', 66 | 'positive': '完美的结局、重新开始的、生活上的完美境界、获得成功的、心理上的自由、完成成功的旅程、心灵的融合、自信十足带来成功、生活将有重大改变、获得完满的结果', 67 | 'negative': '无法完美的、一段过往的结束、缺乏自尊的、感觉难受的、态度悲观的、丑恶的感情、无法挽回的局势、不完美的结局、无法再继续的、残缺的'} 68 | ] 69 | 70 | DeckDict = {"塔罗牌": major_arcana} 71 | -------------------------------------------------------------------------------- /alisabot/plugins/dicer/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | from nonebot import get_driver 4 | from nonebot.adapters.cqhttp import Bot, Event, GroupMessageEvent 5 | from nonebot.plugin import on_startswith 6 | from nonebot.rule import Rule 7 | 8 | from .cards import _cachepath, cards, cache_cards, set_handler, show_handler, sa_handler, del_handler 9 | from .dices import rd, help_message, st, en 10 | from .draw import draw_handler, jrrp_handler 11 | from .investigator import Investigator 12 | from .madness import ti, li 13 | from .san_check import sc 14 | 15 | driver = get_driver() 16 | 17 | 18 | @driver.on_startup 19 | async def _on_startup(): # 角色卡暂存目录初始化 20 | if not os.path.exists("data"): 21 | os.makedirs("data") 22 | if not os.path.exists(_cachepath): 23 | with open(_cachepath, "w", encoding="utf-8") as f: 24 | f.write("{}") 25 | cards.load() 26 | 27 | 28 | def is_group_message() -> Rule: 29 | async def _is_group_message(bot: "Bot", event: "Event") -> bool: 30 | return True if type(event) is GroupMessageEvent else False 31 | 32 | return Rule(_is_group_message) 33 | 34 | 35 | rdhelp = on_startswith(".dhelp", priority=2, block=True) 36 | stcommand = on_startswith(".st", priority=2, block=True) 37 | encommand = on_startswith(".en", priority=2, block=True) 38 | ticommand = on_startswith(".ti", priority=2, block=True) 39 | licommand = on_startswith(".li", priority=2, block=True) 40 | coccommand = on_startswith(".coc", priority=2, block=True) 41 | sccommand = on_startswith(".sc", priority=2, block=True) 42 | rdcommand = on_startswith(".r", priority=4, block=True) 43 | setcommand = on_startswith(".set", priority=5, block=True) 44 | showcommand = on_startswith(".show", priority=5, block=True) 45 | sacommand = on_startswith(".sa", priority=5, block=True) 46 | delcommand = on_startswith(".del", priority=5, block=True) 47 | drawcommand = on_startswith(".draw", priority=5, block=True) 48 | jrrpcommand = on_startswith(".jrrp", priority=5, block=True) 49 | 50 | 51 | @rdhelp.handle() 52 | async def rdhelphandler(bot: Bot, event: Event): 53 | args = str(event.get_message())[6:].strip() 54 | await rdhelp.finish(help_message(args)) 55 | 56 | 57 | @stcommand.handle() 58 | async def stcommandhandler(bot: Bot): 59 | await rdhelp.finish(st()) 60 | 61 | 62 | @encommand.handle() 63 | async def enhandler(bot: Bot, event: Event): 64 | args = str(event.get_message())[3:].strip() 65 | await encommand.finish(en(args)) 66 | 67 | 68 | @rdcommand.handle() 69 | async def rdcommandhandler(bot: Bot, event: Event): 70 | args = str(event.get_message())[2:].strip() 71 | uid = int(event.get_user_id()) 72 | if args and not ("." in args): 73 | rrd = rd(args) 74 | if type(rrd) == str: 75 | await rdcommand.finish(rrd) 76 | elif type(rrd) == list: 77 | await bot.send_private_msg(user_id=uid, message=rrd[0]) 78 | 79 | 80 | @coccommand.handle() 81 | async def cochandler(bot: Bot, event: Event): 82 | args = str(event.get_message())[4:].strip() 83 | try: 84 | args = int(args) 85 | except ValueError: 86 | args = 20 87 | inv = Investigator() 88 | await coccommand.send(inv.age_change(args)) 89 | if 15 <= args < 90: 90 | cache_cards.update(event, inv.__dict__, save=False) 91 | await coccommand.finish(inv.output()) 92 | 93 | 94 | @ticommand.handle() 95 | async def ticommandhandler(bot: Bot): 96 | await ticommand.finish(ti()) 97 | 98 | 99 | @licommand.handle() 100 | async def licommandhandler(bot: Bot): 101 | await licommand.finish(li()) 102 | 103 | 104 | @sccommand.handle() 105 | async def schandler(bot: Bot, event: Event): 106 | args = str(event.get_message())[3:].strip().lower() 107 | await sccommand.finish(sc(args, event=event)) 108 | 109 | 110 | @setcommand.handle() 111 | async def sethandler(bot: Bot, event: Event): 112 | args = str(event.get_message())[4:].strip().lower() 113 | await setcommand.finish(set_handler(event, args)) 114 | 115 | 116 | @showcommand.handle() 117 | async def showhandler(bot: Bot, event: Event): 118 | args = str(event.get_message())[5:].strip().lower() 119 | for msg in show_handler(event, args): 120 | await showcommand.send(msg) 121 | 122 | 123 | @sacommand.handle() 124 | async def sahandler(bot: Bot, event: Event): 125 | args = str(event.get_message())[3:].strip().lower() 126 | await sacommand.finish(sa_handler(event, args)) 127 | 128 | 129 | @delcommand.handle() 130 | async def delhandler(bot: Bot, event: Event): 131 | args = str(event.get_message())[4:].strip().lower() 132 | for msg in del_handler(event, args): 133 | await delcommand.send(msg) 134 | 135 | 136 | @drawcommand.handle() 137 | async def drawhandler(bot: Bot, event: Event): 138 | args = str(event.get_message())[5:].strip().lower() 139 | for msg in draw_handler(args): 140 | await drawcommand.send(msg) 141 | 142 | 143 | @jrrpcommand.handle() 144 | async def jrrphandler(bot: Bot, event: Event): 145 | uid = event.get_user_id() 146 | for msg in jrrp_handler(uid): 147 | await jrrpcommand.send(msg) 148 | -------------------------------------------------------------------------------- /alisabot/utils/translate.py: -------------------------------------------------------------------------------- 1 | SIMPLE = "万与丑专业丛东丝丢两严丧个丬丰临为丽举么义乌乐乔习乡书买乱争于亏云亘亚产亩亲亵亸亿仅从仑仓仪们价众优伙会伛伞伟传伤伥伦伧伪伫体余佣佥侠侣侥侦侧侨侩侪侬俣俦俨俩俪俭债倾偬偻偾偿傥傧储傩儿兑兖党兰关兴兹养兽冁内冈册写军农冢冯冲决况冻净凄凉凌减凑凛几凤凫凭凯击凼凿刍划刘则刚创删别刬刭刽刿剀剂剐剑剥剧劝办务劢动励劲劳势勋勐勚匀匦匮区医华协单卖卢卤卧卫却卺厂厅历厉压厌厍厕厢厣厦厨厩厮县参叆叇双发变叙叠叶号叹叽吁后吓吕吗吣吨听启吴呒呓呕呖呗员呙呛呜咏咔咙咛咝咤咴咸哌响哑哒哓哔哕哗哙哜哝哟唛唝唠唡唢唣唤唿啧啬啭啮啰啴啸喷喽喾嗫呵嗳嘘嘤嘱噜噼嚣嚯团园囱围囵国图圆圣圹场坂坏块坚坛坜坝坞坟坠垄垅垆垒垦垧垩垫垭垯垱垲垴埘埙埚埝埯堑堕塆墙壮声壳壶壸处备复够头夸夹夺奁奂奋奖奥妆妇妈妩妪妫姗姜娄娅娆娇娈娱娲娴婳婴婵婶媪嫒嫔嫱嬷孙学孪宁宝实宠审宪宫宽宾寝对寻导寿将尔尘尧尴尸尽层屃屉届属屡屦屿岁岂岖岗岘岙岚岛岭岳岽岿峃峄峡峣峤峥峦崂崃崄崭嵘嵚嵛嵝嵴巅巩巯币帅师帏帐帘帜带帧帮帱帻帼幂幞干并广庄庆庐庑库应庙庞废庼廪开异弃张弥弪弯弹强归当录彟彦彻径徕御忆忏忧忾怀态怂怃怄怅怆怜总怼怿恋恳恶恸恹恺恻恼恽悦悫悬悭悯惊惧惨惩惫惬惭惮惯愍愠愤愦愿慑慭憷懑懒懔戆戋戏戗战戬户扎扑扦执扩扪扫扬扰抚抛抟抠抡抢护报担拟拢拣拥拦拧拨择挂挚挛挜挝挞挟挠挡挢挣挤挥挦捞损捡换捣据捻掳掴掷掸掺掼揸揽揿搀搁搂搅携摄摅摆摇摈摊撄撑撵撷撸撺擞攒敌敛数斋斓斗斩断无旧时旷旸昙昼昽显晋晒晓晔晕晖暂暧札术朴机杀杂权条来杨杩杰极构枞枢枣枥枧枨枪枫枭柜柠柽栀栅标栈栉栊栋栌栎栏树栖样栾桊桠桡桢档桤桥桦桧桨桩梦梼梾检棂椁椟椠椤椭楼榄榇榈榉槚槛槟槠横樯樱橥橱橹橼檐檩欢欤欧歼殁殇残殒殓殚殡殴毁毂毕毙毡毵氇气氢氩氲汇汉污汤汹沓沟没沣沤沥沦沧沨沩沪沵泞泪泶泷泸泺泻泼泽泾洁洒洼浃浅浆浇浈浉浊测浍济浏浐浑浒浓浔浕涂涌涛涝涞涟涠涡涢涣涤润涧涨涩淀渊渌渍渎渐渑渔渖渗温游湾湿溃溅溆溇滗滚滞滟滠满滢滤滥滦滨滩滪漤潆潇潋潍潜潴澜濑濒灏灭灯灵灾灿炀炉炖炜炝点炼炽烁烂烃烛烟烦烧烨烩烫烬热焕焖焘煅煳熘爱爷牍牦牵牺犊犟状犷犸犹狈狍狝狞独狭狮狯狰狱狲猃猎猕猡猪猫猬献獭玑玙玚玛玮环现玱玺珉珏珐珑珰珲琎琏琐琼瑶瑷璇璎瓒瓮瓯电画畅畲畴疖疗疟疠疡疬疮疯疱疴痈痉痒痖痨痪痫痴瘅瘆瘗瘘瘪瘫瘾瘿癞癣癫癯皑皱皲盏盐监盖盗盘眍眦眬着睁睐睑瞒瞩矫矶矾矿砀码砖砗砚砜砺砻砾础硁硅硕硖硗硙硚确硷碍碛碜碱碹磙礼祎祢祯祷祸禀禄禅离秃秆种积称秽秾稆税稣稳穑穷窃窍窑窜窝窥窦窭竖竞笃笋笔笕笺笼笾筑筚筛筜筝筹签简箓箦箧箨箩箪箫篑篓篮篱簖籁籴类籼粜粝粤粪粮糁糇紧絷纟纠纡红纣纤纥约级纨纩纪纫纬纭纮纯纰纱纲纳纴纵纶纷纸纹纺纻纼纽纾线绀绁绂练组绅细织终绉绊绋绌绍绎经绐绑绒结绔绕绖绗绘给绚绛络绝绞统绠绡绢绣绤绥绦继绨绩绪绫绬续绮绯绰绱绲绳维绵绶绷绸绹绺绻综绽绾绿缀缁缂缃缄缅缆缇缈缉缊缋缌缍缎缏缐缑缒缓缔缕编缗缘缙缚缛缜缝缞缟缠缡缢缣缤缥缦缧缨缩缪缫缬缭缮缯缰缱缲缳缴缵罂网罗罚罢罴羁羟羡翘翙翚耢耧耸耻聂聋职聍联聩聪肃肠肤肷肾肿胀胁胆胜胧胨胪胫胶脉脍脏脐脑脓脔脚脱脶脸腊腌腘腭腻腼腽腾膑臜舆舣舰舱舻艰艳艹艺节芈芗芜芦苁苇苈苋苌苍苎苏苘苹茎茏茑茔茕茧荆荐荙荚荛荜荞荟荠荡荣荤荥荦荧荨荩荪荫荬荭荮药莅莜莱莲莳莴莶获莸莹莺莼萚萝萤营萦萧萨葱蒇蒉蒋蒌蓝蓟蓠蓣蓥蓦蔷蔹蔺蔼蕲蕴薮藁藓虏虑虚虫虬虮虽虾虿蚀蚁蚂蚕蚝蚬蛊蛎蛏蛮蛰蛱蛲蛳蛴蜕蜗蜡蝇蝈蝉蝎蝼蝾螀螨蟏衅衔补衬衮袄袅袆袜袭袯装裆裈裢裣裤裥褛褴襁襕见观觃规觅视觇览觉觊觋觌觍觎觏觐觑觞触觯詟誉誊讠计订讣认讥讦讧讨让讪讫训议讯记讱讲讳讴讵讶讷许讹论讻讼讽设访诀证诂诃评诅识诇诈诉诊诋诌词诎诏诐译诒诓诔试诖诗诘诙诚诛诜话诞诟诠诡询诣诤该详诧诨诩诪诫诬语诮误诰诱诲诳说诵诶请诸诹诺读诼诽课诿谀谁谂调谄谅谆谇谈谊谋谌谍谎谏谐谑谒谓谔谕谖谗谘谙谚谛谜谝谞谟谠谡谢谣谤谥谦谧谨谩谪谫谬谭谮谯谰谱谲谳谴谵谶谷豮贝贞负贠贡财责贤败账货质贩贪贫贬购贮贯贰贱贲贳贴贵贶贷贸费贺贻贼贽贾贿赀赁赂赃资赅赆赇赈赉赊赋赌赍赎赏赐赑赒赓赔赕赖赗赘赙赚赛赜赝赞赟赠赡赢赣赪赵赶趋趱趸跃跄跖跞践跶跷跸跹跻踊踌踪踬踯蹑蹒蹰蹿躏躜躯车轧轨轩轪轫转轭轮软轰轱轲轳轴轵轶轷轸轹轺轻轼载轾轿辀辁辂较辄辅辆辇辈辉辊辋辌辍辎辏辐辑辒输辔辕辖辗辘辙辚辞辩辫边辽达迁过迈运还这进远违连迟迩迳迹适选逊递逦逻遗遥邓邝邬邮邹邺邻郁郄郏郐郑郓郦郧郸酝酦酱酽酾酿释里鉅鉴銮錾钆钇针钉钊钋钌钍钎钏钐钑钒钓钔钕钖钗钘钙钚钛钝钞钟钠钡钢钣钤钥钦钧钨钩钪钫钬钭钮钯钰钱钲钳钴钵钶钷钸钹钺钻钼钽钾钿铀铁铂铃铄铅铆铈铉铊铋铍铎铏铐铑铒铕铗铘铙铚铛铜铝铞铟铠铡铢铣铤铥铦铧铨铪铫铬铭铮铯铰铱铲铳铴铵银铷铸铹铺铻铼铽链铿销锁锂锃锄锅锆锇锈锉锊锋锌锍锎锏锐锑锒锓锔锕锖锗错锚锜锞锟锠锡锢锣锤锥锦锨锩锫锬锭键锯锰锱锲锳锴锵锶锷锸锹锺锻锼锽锾锿镀镁镂镃镆镇镈镉镊镌镍镎镏镐镑镒镕镖镗镙镚镛镜镝镞镟镠镡镢镣镤镥镦镧镨镩镪镫镬镭镮镯镰镱镲镳镴镶长门闩闪闫闬闭问闯闰闱闲闳间闵闶闷闸闹闺闻闼闽闾闿阀阁阂阃阄阅阆阇阈阉阊阋阌阍阎阏阐阑阒阓阔阕阖阗阘阙阚阛队阳阴阵阶际陆陇陈陉陕陧陨险随隐隶隽难雏雠雳雾霁霉霭靓静靥鞑鞒鞯鞴韦韧韨韩韪韫韬韵页顶顷顸项顺须顼顽顾顿颀颁颂颃预颅领颇颈颉颊颋颌颍颎颏颐频颒颓颔颕颖颗题颙颚颛颜额颞颟颠颡颢颣颤颥颦颧风飏飐飑飒飓飔飕飖飗飘飙飚飞飨餍饤饥饦饧饨饩饪饫饬饭饮饯饰饱饲饳饴饵饶饷饸饹饺饻饼饽饾饿馀馁馂馃馄馅馆馇馈馉馊馋馌馍馎馏馐馑馒馓馔馕马驭驮驯驰驱驲驳驴驵驶驷驸驹驺驻驼驽驾驿骀骁骂骃骄骅骆骇骈骉骊骋验骍骎骏骐骑骒骓骔骕骖骗骘骙骚骛骜骝骞骟骠骡骢骣骤骥骦骧髅髋髌鬓魇魉鱼鱽鱾鱿鲀鲁鲂鲄鲅鲆鲇鲈鲉鲊鲋鲌鲍鲎鲏鲐鲑鲒鲓鲔鲕鲖鲗鲘鲙鲚鲛鲜鲝鲞鲟鲠鲡鲢鲣鲤鲥鲦鲧鲨鲩鲪鲫鲬鲭鲮鲯鲰鲱鲲鲳鲴鲵鲶鲷鲸鲹鲺鲻鲼鲽鲾鲿鳀鳁鳂鳃鳄鳅鳆鳇鳈鳉鳊鳋鳌鳍鳎鳏鳐鳑鳒鳓鳔鳕鳖鳗鳘鳙鳛鳜鳝鳞鳟鳠鳡鳢鳣鸟鸠鸡鸢鸣鸤鸥鸦鸧鸨鸩鸪鸫鸬鸭鸮鸯鸰鸱鸲鸳鸴鸵鸶鸷鸸鸹鸺鸻鸼鸽鸾鸿鹀鹁鹂鹃鹄鹅鹆鹇鹈鹉鹊鹋鹌鹍鹎鹏鹐鹑鹒鹓鹔鹕鹖鹗鹘鹚鹛鹜鹝鹞鹟鹠鹡鹢鹣鹤鹥鹦鹧鹨鹩鹪鹫鹬鹭鹯鹰鹱鹲鹳鹴鹾麦麸黄黉黡黩黪黾鼋鼌鼍鼗鼹齄齐齑齿龀龁龂龃龄龅龆龇龈龉龊龋龌龙龚龛龟志制咨只里系范松没尝尝闹面准钟别闲干尽脏拼" 2 | TRADITION = "萬與醜專業叢東絲丟兩嚴喪個爿豐臨為麗舉麼義烏樂喬習鄉書買亂爭於虧雲亙亞產畝親褻嚲億僅從侖倉儀們價眾優夥會傴傘偉傳傷倀倫傖偽佇體餘傭僉俠侶僥偵側僑儈儕儂俁儔儼倆儷儉債傾傯僂僨償儻儐儲儺兒兌兗黨蘭關興茲養獸囅內岡冊寫軍農塚馮衝決況凍淨淒涼淩減湊凜幾鳳鳧憑凱擊氹鑿芻劃劉則剛創刪別剗剄劊劌剴劑剮劍剝劇勸辦務勱動勵勁勞勢勳猛勩勻匭匱區醫華協單賣盧鹵臥衛卻巹廠廳曆厲壓厭厙廁廂厴廈廚廄廝縣參靉靆雙發變敘疊葉號歎嘰籲後嚇呂嗎唚噸聽啟吳嘸囈嘔嚦唄員咼嗆嗚詠哢嚨嚀噝吒噅鹹呱響啞噠嘵嗶噦嘩噲嚌噥喲嘜嗊嘮啢嗩唕喚呼嘖嗇囀齧囉嘽嘯噴嘍嚳囁嗬噯噓嚶囑嚕劈囂謔團園囪圍圇國圖圓聖壙場阪壞塊堅壇壢壩塢墳墜壟壟壚壘墾坰堊墊埡墶壋塏堖塒塤堝墊垵塹墮壪牆壯聲殼壺壼處備復夠頭誇夾奪奩奐奮獎奧妝婦媽嫵嫗媯姍薑婁婭嬈嬌孌娛媧嫻嫿嬰嬋嬸媼嬡嬪嬙嬤孫學孿寧寶實寵審憲宮寬賓寢對尋導壽將爾塵堯尷屍盡層屭屜屆屬屢屨嶼歲豈嶇崗峴嶴嵐島嶺嶽崠巋嶨嶧峽嶢嶠崢巒嶗崍嶮嶄嶸嶔崳嶁脊巔鞏巰幣帥師幃帳簾幟帶幀幫幬幘幗冪襆幹並廣莊慶廬廡庫應廟龐廢廎廩開異棄張彌弳彎彈強歸當錄彠彥徹徑徠禦憶懺憂愾懷態慫憮慪悵愴憐總懟懌戀懇惡慟懨愷惻惱惲悅愨懸慳憫驚懼慘懲憊愜慚憚慣湣慍憤憒願懾憖怵懣懶懍戇戔戲戧戰戩戶紮撲扡執擴捫掃揚擾撫拋摶摳掄搶護報擔擬攏揀擁攔擰撥擇掛摯攣掗撾撻挾撓擋撟掙擠揮撏撈損撿換搗據撚擄摑擲撣摻摜摣攬撳攙擱摟攪攜攝攄擺搖擯攤攖撐攆擷擼攛擻攢敵斂數齋斕鬥斬斷無舊時曠暘曇晝曨顯晉曬曉曄暈暉暫曖劄術樸機殺雜權條來楊榪傑極構樅樞棗櫪梘棖槍楓梟櫃檸檉梔柵標棧櫛櫳棟櫨櫟欄樹棲樣欒棬椏橈楨檔榿橋樺檜槳樁夢檮棶檢欞槨櫝槧欏橢樓欖櫬櫚櫸檟檻檳櫧橫檣櫻櫫櫥櫓櫞簷檁歡歟歐殲歿殤殘殞殮殫殯毆毀轂畢斃氈毿氌氣氫氬氳彙漢汙湯洶遝溝沒灃漚瀝淪滄渢溈滬濔濘淚澩瀧瀘濼瀉潑澤涇潔灑窪浹淺漿澆湞溮濁測澮濟瀏滻渾滸濃潯濜塗湧濤澇淶漣潿渦溳渙滌潤澗漲澀澱淵淥漬瀆漸澠漁瀋滲溫遊灣濕潰濺漵漊潷滾滯灩灄滿瀅濾濫灤濱灘澦濫瀠瀟瀲濰潛瀦瀾瀨瀕灝滅燈靈災燦煬爐燉煒熗點煉熾爍爛烴燭煙煩燒燁燴燙燼熱煥燜燾煆糊溜愛爺牘犛牽犧犢強狀獷獁猶狽麅獮獰獨狹獅獪猙獄猻獫獵獼玀豬貓蝟獻獺璣璵瑒瑪瑋環現瑲璽瑉玨琺瓏璫琿璡璉瑣瓊瑤璦璿瓔瓚甕甌電畫暢佘疇癤療瘧癘瘍鬁瘡瘋皰屙癰痙癢瘂癆瘓癇癡癉瘮瘞瘺癟癱癮癭癩癬癲臒皚皺皸盞鹽監蓋盜盤瞘眥矓著睜睞瞼瞞矚矯磯礬礦碭碼磚硨硯碸礪礱礫礎硜矽碩硤磽磑礄確鹼礙磧磣堿镟滾禮禕禰禎禱禍稟祿禪離禿稈種積稱穢穠穭稅穌穩穡窮竊竅窯竄窩窺竇窶豎競篤筍筆筧箋籠籩築篳篩簹箏籌簽簡籙簀篋籜籮簞簫簣簍籃籬籪籟糴類秈糶糲粵糞糧糝餱緊縶糸糾紆紅紂纖紇約級紈纊紀紉緯紜紘純紕紗綱納紝縱綸紛紙紋紡紵紖紐紓線紺絏紱練組紳細織終縐絆紼絀紹繹經紿綁絨結絝繞絰絎繪給絢絳絡絕絞統綆綃絹繡綌綏絛繼綈績緒綾緓續綺緋綽緔緄繩維綿綬繃綢綯綹綣綜綻綰綠綴緇緙緗緘緬纜緹緲緝縕繢緦綞緞緶線緱縋緩締縷編緡緣縉縛縟縝縫縗縞纏縭縊縑繽縹縵縲纓縮繆繅纈繚繕繒韁繾繰繯繳纘罌網羅罰罷羆羈羥羨翹翽翬耮耬聳恥聶聾職聹聯聵聰肅腸膚膁腎腫脹脅膽勝朧腖臚脛膠脈膾髒臍腦膿臠腳脫腡臉臘醃膕齶膩靦膃騰臏臢輿艤艦艙艫艱豔艸藝節羋薌蕪蘆蓯葦藶莧萇蒼苧蘇檾蘋莖蘢蔦塋煢繭荊薦薘莢蕘蓽蕎薈薺蕩榮葷滎犖熒蕁藎蓀蔭蕒葒葤藥蒞蓧萊蓮蒔萵薟獲蕕瑩鶯蓴蘀蘿螢營縈蕭薩蔥蕆蕢蔣蔞藍薊蘺蕷鎣驀薔蘞藺藹蘄蘊藪槁蘚虜慮虛蟲虯蟣雖蝦蠆蝕蟻螞蠶蠔蜆蠱蠣蟶蠻蟄蛺蟯螄蠐蛻蝸蠟蠅蟈蟬蠍螻蠑螿蟎蠨釁銜補襯袞襖嫋褘襪襲襏裝襠褌褳襝褲襇褸襤繈襴見觀覎規覓視覘覽覺覬覡覿覥覦覯覲覷觴觸觶讋譽謄訁計訂訃認譏訐訌討讓訕訖訓議訊記訒講諱謳詎訝訥許訛論訩訟諷設訪訣證詁訶評詛識詗詐訴診詆謅詞詘詔詖譯詒誆誄試詿詩詰詼誠誅詵話誕詬詮詭詢詣諍該詳詫諢詡譸誡誣語誚誤誥誘誨誑說誦誒請諸諏諾讀諑誹課諉諛誰諗調諂諒諄誶談誼謀諶諜謊諫諧謔謁謂諤諭諼讒諮諳諺諦謎諞諝謨讜謖謝謠謗諡謙謐謹謾謫譾謬譚譖譙讕譜譎讞譴譫讖穀豶貝貞負貟貢財責賢敗賬貨質販貪貧貶購貯貫貳賤賁貰貼貴貺貸貿費賀貽賊贄賈賄貲賃賂贓資賅贐賕賑賚賒賦賭齎贖賞賜贔賙賡賠賧賴賵贅賻賺賽賾贗讚贇贈贍贏贛赬趙趕趨趲躉躍蹌蹠躒踐躂蹺蹕躚躋踴躊蹤躓躑躡蹣躕躥躪躦軀車軋軌軒軑軔轉軛輪軟轟軲軻轤軸軹軼軤軫轢軺輕軾載輊轎輈輇輅較輒輔輛輦輩輝輥輞輬輟輜輳輻輯轀輸轡轅轄輾轆轍轔辭辯辮邊遼達遷過邁運還這進遠違連遲邇逕跡適選遜遞邐邏遺遙鄧鄺鄔郵鄒鄴鄰鬱郤郟鄶鄭鄆酈鄖鄲醞醱醬釅釃釀釋裏钜鑒鑾鏨釓釔針釘釗釙釕釷釺釧釤鈒釩釣鍆釹鍚釵鈃鈣鈈鈦鈍鈔鍾鈉鋇鋼鈑鈐鑰欽鈞鎢鉤鈧鈁鈥鈄鈕鈀鈺錢鉦鉗鈷缽鈳鉕鈽鈸鉞鑽鉬鉭鉀鈿鈾鐵鉑鈴鑠鉛鉚鈰鉉鉈鉍鈹鐸鉶銬銠鉺銪鋏鋣鐃銍鐺銅鋁銱銦鎧鍘銖銑鋌銩銛鏵銓鉿銚鉻銘錚銫鉸銥鏟銃鐋銨銀銣鑄鐒鋪鋙錸鋱鏈鏗銷鎖鋰鋥鋤鍋鋯鋨鏽銼鋝鋒鋅鋶鐦鐧銳銻鋃鋟鋦錒錆鍺錯錨錡錁錕錩錫錮鑼錘錐錦鍁錈錇錟錠鍵鋸錳錙鍥鍈鍇鏘鍶鍔鍤鍬鍾鍛鎪鍠鍰鎄鍍鎂鏤鎡鏌鎮鎛鎘鑷鐫鎳鎿鎦鎬鎊鎰鎔鏢鏜鏍鏰鏞鏡鏑鏃鏇鏐鐔钁鐐鏷鑥鐓鑭鐠鑹鏹鐙鑊鐳鐶鐲鐮鐿鑔鑣鑞鑲長門閂閃閆閈閉問闖閏闈閑閎間閔閌悶閘鬧閨聞闥閩閭闓閥閣閡閫鬮閱閬闍閾閹閶鬩閿閽閻閼闡闌闃闠闊闋闔闐闒闕闞闤隊陽陰陣階際陸隴陳陘陝隉隕險隨隱隸雋難雛讎靂霧霽黴靄靚靜靨韃鞽韉韝韋韌韍韓韙韞韜韻頁頂頃頇項順須頊頑顧頓頎頒頌頏預顱領頗頸頡頰頲頜潁熲頦頤頻頮頹頷頴穎顆題顒顎顓顏額顳顢顛顙顥纇顫顬顰顴風颺颭颮颯颶颸颼颻飀飄飆飆飛饗饜飣饑飥餳飩餼飪飫飭飯飲餞飾飽飼飿飴餌饒餉餄餎餃餏餅餑餖餓餘餒餕餜餛餡館餷饋餶餿饞饁饃餺餾饈饉饅饊饌饢馬馭馱馴馳驅馹駁驢駔駛駟駙駒騶駐駝駑駕驛駘驍罵駰驕驊駱駭駢驫驪騁驗騂駸駿騏騎騍騅騌驌驂騙騭騤騷騖驁騮騫騸驃騾驄驏驟驥驦驤髏髖髕鬢魘魎魚魛魢魷魨魯魴魺鮁鮃鯰鱸鮋鮓鮒鮊鮑鱟鮍鮐鮭鮚鮳鮪鮞鮦鰂鮜鱠鱭鮫鮮鮺鯗鱘鯁鱺鰱鰹鯉鰣鰷鯀鯊鯇鮶鯽鯒鯖鯪鯕鯫鯡鯤鯧鯝鯢鯰鯛鯨鯵鯴鯔鱝鰈鰏鱨鯷鰮鰃鰓鱷鰍鰒鰉鰁鱂鯿鰠鼇鰭鰨鰥鰩鰟鰜鰳鰾鱈鱉鰻鰵鱅鰼鱖鱔鱗鱒鱯鱤鱧鱣鳥鳩雞鳶鳴鳲鷗鴉鶬鴇鴆鴣鶇鸕鴨鴞鴦鴒鴟鴝鴛鴬鴕鷥鷙鴯鴰鵂鴴鵃鴿鸞鴻鵐鵓鸝鵑鵠鵝鵒鷳鵜鵡鵲鶓鵪鶤鵯鵬鵮鶉鶊鵷鷫鶘鶡鶚鶻鶿鶥鶩鷊鷂鶲鶹鶺鷁鶼鶴鷖鸚鷓鷚鷯鷦鷲鷸鷺鸇鷹鸌鸏鸛鸘鹺麥麩黃黌黶黷黲黽黿鼂鼉鞀鼴齇齊齏齒齔齕齗齟齡齙齠齜齦齬齪齲齷龍龔龕龜誌製谘隻裡係範鬆冇嚐嘗鬨麵準鐘彆閒乾儘臟拚" 3 | 4 | 5 | def to_tradition_string(s: str): 6 | output_str_list = [] 7 | str_len = len(s) 8 | 9 | for i in range(str_len): 10 | found_index = SIMPLE.find(s[i]) 11 | 12 | if not (found_index == -1): 13 | output_str_list.append(TRADITION[found_index]) 14 | else: 15 | output_str_list.append(s[i]) 16 | 17 | return "".join(output_str_list) 18 | 19 | 20 | def to_simple_string(s: str): 21 | output_str_list = [] 22 | str_len = len(s) 23 | 24 | for i in range(str_len): 25 | found_index = TRADITION.find(s[i]) 26 | 27 | if not (found_index == -1): 28 | output_str_list.append(SIMPLE[found_index]) 29 | else: 30 | output_str_list.append(s[i]) 31 | 32 | return "".join(output_str_list) 33 | -------------------------------------------------------------------------------- /alisabot/plugins/dicer/investigator.py: -------------------------------------------------------------------------------- 1 | import random 2 | 3 | build_dict = {64: -2, 84: -1, 124: 0, 164: 1, 4 | 204: 2, 284: 3, 364: 4, 444: 5, 524: 6} 5 | db_dict = {-2: "-2", -1: "-1", 0: "0", 1: "1d4", 6 | 2: "1d6", 3: "2d6", 4: "3d6", 5: "4d6", 6: "5d6"} 7 | 8 | 9 | def randattr(time: int = 3, ex: int = 0): 10 | r = 0 11 | for _ in range(time): 12 | r += random.randint(1, 6) 13 | return (r + ex) * 5 14 | 15 | 16 | class Investigator(object): 17 | def __init__(self) -> None: 18 | self.name = "佚名调查员" 19 | self.age = 20 20 | self.str = randattr() 21 | self.con = randattr() 22 | self.siz = randattr(2, 6) 23 | self.dex = randattr() 24 | self.app = randattr() 25 | self.int = randattr(2, 6) 26 | self.pow = randattr() 27 | self.edu = randattr(2, 6) 28 | self.luc = randattr() 29 | self.san = self.pow 30 | self.skills = {} 31 | 32 | def body_build(self) -> int: 33 | build = self.str + self.con 34 | for i, j in build_dict.items(): 35 | if build <= i: 36 | return j 37 | return 38 | 39 | def db(self) -> str: 40 | return db_dict[self.body_build()] 41 | 42 | def lp_max(self) -> int: 43 | return (self.con + self.siz) // 10 44 | 45 | def mov(self) -> int: 46 | r = 8 47 | if self.age >= 80: 48 | r -= 5 49 | elif self.age >= 70: 50 | r -= 4 51 | elif self.age >= 60: 52 | r -= 3 53 | elif self.age >= 50: 54 | r -= 2 55 | elif self.age >= 40: 56 | r -= 1 57 | if self.str < self.siz and self.dex < self.siz: 58 | return r - 1 59 | elif self.str > self.siz and self.dex > self.siz: 60 | return r + 1 61 | else: 62 | return r 63 | 64 | def edu_up(self) -> str: 65 | edu_check = random.randint(1, 100) 66 | if edu_check > self.edu: 67 | edu_en = random.randint(1, 10) 68 | self.edu += edu_en 69 | else: 70 | return "教育成长检定D100=%d,小于%d,无增长。" % (edu_check, self.edu) 71 | if self.edu > 99: 72 | self.edu = 99 73 | return "教育成长检定D100=%d,成长1D10=%d,成长到了最高值99!" % (edu_check, edu_en) 74 | else: 75 | return "教育成长检定D100=%d,成长1D10=%d,成长到了%d" % (edu_check, edu_en, self.edu) 76 | 77 | def edu_ups(self, times) -> str: 78 | r = "" 79 | for _ in range(times): 80 | r += self.edu_up() 81 | return r 82 | 83 | def sum_down(self, sum) -> str: 84 | if self.str + self.con + self.dex - 45 < sum: 85 | self.str = 15 86 | self.con = 15 87 | self.dex = 15 88 | else: 89 | str_lost = random.randint(0, min(sum, self.str - 15)) 90 | while sum - str_lost > self.con + self.dex - 30: 91 | str_lost = random.randint(0, min(sum, self.str - 15)) 92 | self.str -= str_lost 93 | sum -= str_lost 94 | con_lost = random.randint(0, min(sum, self.con - 15)) 95 | while sum - con_lost > self.dex - 15: 96 | con_lost = random.randint(0, min(sum, self.con - 15)) 97 | self.con -= con_lost 98 | sum -= con_lost 99 | self.dex -= sum 100 | return 101 | 102 | def age_change(self, age: int = 20) -> str: 103 | if self.age != 20: 104 | return # 防止多次年龄增强判定 105 | if age < 15: 106 | return "年龄过小,无法担当调查员" 107 | elif age >= 90: 108 | return "该调查员已经作古。" 109 | self.age = age 110 | if 15 <= age < 20: 111 | self.str -= 5 112 | self.siz -= 5 113 | self.edu -= 5 114 | luc = randattr() 115 | self.luc = luc if luc > self.luc else self.luc 116 | return "力量、体型、教育值-5,幸运增强判定一次" 117 | elif age < 40: 118 | self.edu_up() 119 | return "教育增强判定一次" 120 | elif age < 50: 121 | self.app -= 5 122 | self.sum_down(5) 123 | self.edu_ups(2) 124 | return "外貌-5,力量、体型、敏捷合计降低5,教育增强判定两次" 125 | elif age < 60: 126 | self.app -= 10 127 | self.sum_down(10) 128 | self.edu_ups(3) 129 | return "外貌-10,力量、体型、敏捷合计降低10,教育增强判定三次" 130 | elif age < 70: 131 | self.app -= 15 132 | self.sum_down(20) 133 | self.edu_ups(4) 134 | return "外貌-15,力量、体型、敏捷合计降低20,教育增强判定四次" 135 | elif age < 80: 136 | self.app -= 20 137 | self.sum_down(40) 138 | self.edu_ups(4) 139 | return "外貌-20,力量、体型、敏捷合计降低40,教育增强判定四次" 140 | elif age < 90: 141 | self.app -= 25 142 | self.sum_down(80) 143 | self.edu_ups(4) 144 | return "外貌-25,力量、体型、敏捷合计降低80,教育增强判定四次" 145 | 146 | def __repr__(self) -> str: 147 | return "%s 年龄:%d\n力量:%d 体质:%d 体型:%d\n敏捷:%d 外貌:%d 智力:%d\n意志:%d 教育:%d 幸运:%d\nDB:%s 生命值:%d 移动速度:%d SAN:%d" % ( 148 | self.name, self.age, self.str, self.con, self.siz, self.dex, self.app, self.int, self.pow, self.edu, 149 | self.luc, self.db(), self.lp_max(), self.mov(), self.san) 150 | 151 | def skills_output(self) -> str: 152 | if not self.skills: 153 | return "%s当前无任何技能数据。" % self.name 154 | r = "%s技能数据:" % self.name 155 | for k, v in self.skills.items(): 156 | r += "\n%s:%d" % (k, v) 157 | return r 158 | 159 | def output(self) -> str: 160 | return self.__repr__() 161 | 162 | def load(self, data: dict): 163 | self.__dict__.update(data) 164 | return self 165 | -------------------------------------------------------------------------------- /alisabot/plugins/dicer/cards.py: -------------------------------------------------------------------------------- 1 | import os 2 | import re 3 | 4 | import ujson as json 5 | from nonebot.adapters.cqhttp import Event 6 | from nonebot.adapters.cqhttp.event import GroupMessageEvent 7 | 8 | from .dices import Dices 9 | from .investigator import Investigator 10 | from .messages import help_messages 11 | 12 | _cachepath = os.path.join("data", "coc_cards.json") 13 | 14 | 15 | def get_group_id(event: Event): 16 | if type(event) is GroupMessageEvent: 17 | return str(event.group_id) 18 | else: 19 | return "0" 20 | 21 | 22 | class Cards: 23 | def __init__(self) -> None: 24 | self.data: dict = {} 25 | 26 | def save(self) -> None: 27 | with open(_cachepath, "w", encoding="utf-8") as f: 28 | json.dump(self.data, f, ensure_ascii=False) 29 | 30 | def load(self) -> None: 31 | with open(_cachepath, "r", encoding="utf-8") as f: 32 | self.data = json.load(f) 33 | 34 | def update(self, event: Event, inv_dict: dict, qid: str = "", save: bool = True): 35 | group_id = get_group_id(event) 36 | if not self.data.get(group_id): 37 | self.data[group_id] = {} 38 | self.data[group_id].update( 39 | {qid if qid else str(event.sender.user_id): inv_dict}) 40 | if save: 41 | self.save() 42 | 43 | def get(self, event: Event, qid: str = "") -> dict: 44 | group_id = get_group_id(event) 45 | if self.data.get(group_id): 46 | if self.data[group_id].get(qid if qid else str(event.sender.user_id)): 47 | return self.data[group_id].get(qid if qid else str(event.sender.user_id)) 48 | else: 49 | return None 50 | 51 | def delete(self, event: Event, qid: str = "", save: bool = True) -> bool: 52 | if self.get(event, qid=qid): 53 | if self.data[get_group_id(event)].get(qid if qid else str(event.sender.user_id)): 54 | self.data[get_group_id(event)].pop( 55 | qid if qid else str(event.sender.user_id)) 56 | if save: 57 | self.save() 58 | return True 59 | return False 60 | 61 | def delete_skill(self, event: Event, skill_name: str, qid: str = "", save: bool = True) -> bool: 62 | if self.get(event, qid=qid): 63 | data = self.get(event, qid=qid) 64 | if data["skills"].get(skill_name): 65 | data["skills"].pop(skill_name) 66 | self.update(event, data, qid=qid, save=save) 67 | return True 68 | return False 69 | 70 | 71 | cards = Cards() 72 | cache_cards = Cards() 73 | attrs_dict: dict = { 74 | "名字": ["name", "名字", "名称"], 75 | "年龄": ["age", "年龄"], 76 | "力量": ["str", "力量"], 77 | "体质": ["con", "体质"], 78 | "体型": ["siz", "体型"], 79 | "敏捷": ["dex", "敏捷"], 80 | "外貌": ["app", "外貌"], 81 | "智力": ["int", "智力", "灵感"], 82 | "意志": ["pow", "意志"], 83 | "教育": ["edu", "教育"], 84 | "幸运": ["luc", "幸运"], 85 | "理智": ["san", "理智"], 86 | } 87 | 88 | 89 | def set_handler(event: Event, args: str): 90 | if not args: 91 | if cache_cards.get(event): 92 | card_data = cache_cards.get(event) 93 | cards.update(event, inv_dict=card_data) 94 | inv = Investigator().load(card_data) 95 | return "成功从缓存保存人物卡属性:\n" + inv.output() 96 | else: 97 | return "未找到缓存数据,请先使用coc指令生成角色" 98 | else: 99 | args = args.split(" ") 100 | if cards.get(event): 101 | card_data = cards.get(event) 102 | inv = Investigator().load(card_data) 103 | else: 104 | return "未找到已保存数据,请先使用空白set指令保存角色数据" 105 | if len(args) >= 2: 106 | for attr, alias in attrs_dict.items(): 107 | if args[0] in alias: 108 | if attr == "名字": 109 | inv.__dict__[alias[0]] = args[1] 110 | else: 111 | try: 112 | inv.__dict__[alias[0]] = int(args[1]) 113 | except ValueError: 114 | return "请输入正整数属性数据" 115 | cards.update(event, inv.__dict__) 116 | return "设置调查员%s为:%s" % (attr, args[1]) 117 | try: 118 | inv.skills[args[0]] = int(args[1]) 119 | cards.update(event, inv.__dict__) 120 | return "设置调查员%s技能为:%s" % (args[0], args[1]) 121 | except ValueError: 122 | return "请输入正整数技能数据" 123 | 124 | 125 | def show_handler(event: Event, args: str): 126 | r = [] 127 | if not args: 128 | if cards.get(event): 129 | card_data = cards.get(event) 130 | inv = Investigator().load(card_data) 131 | r.append("使用中人物卡:\n" + inv.output()) 132 | if cache_cards.get(event): 133 | card_data = cache_cards.get(event) 134 | inv = Investigator().load(card_data) 135 | r.append("已暂存人物卡:\n" + inv.output()) 136 | elif args == "s": 137 | if cards.get(event): 138 | card_data = cards.get(event) 139 | inv = Investigator().load(card_data) 140 | r.append(inv.skills_output()) 141 | elif re.search(r"\[cq:at,qq=\d+\]", args): 142 | qid = re.search(r"\[cq:at,qq=\d+\]", args).group()[10:-1] 143 | if cards.get(event, qid=qid): 144 | card_data = cards.get(event, qid=qid) 145 | inv = Investigator().load(card_data) 146 | r.append("查询到人物卡:\n" + inv.output()) 147 | if args[0] == "s": 148 | r.append(inv.skills_output()) 149 | if not r: 150 | r.append("无保存/暂存信息") 151 | return r 152 | 153 | 154 | def del_handler(event: Event, args: str): 155 | r = [] 156 | args = args.split(" ") 157 | for arg in args: 158 | if not arg: 159 | pass 160 | elif arg == "c" and cache_cards.get(event): 161 | if cache_cards.delete(event, save=False): 162 | r.append("已清空暂存人物卡数据") 163 | elif arg == "card" and cards.get(event): 164 | if cards.delete(event): 165 | r.append("已删除使用中的人物卡!") 166 | else: 167 | if cards.delete_skill(event, arg): 168 | r.append("已删除技能" + arg) 169 | if not r: 170 | r.append(help_messages.del_) 171 | return r 172 | 173 | 174 | def sa_handler(event: Event, args: str): 175 | if not args: 176 | return help_messages.sa 177 | elif not cards.get(event): 178 | return "请先使用set指令保存人物卡后再使用快速检定功能。" 179 | for attr, alias in attrs_dict.items(): 180 | if args in alias: 181 | arg = alias[0] 182 | break 183 | card_data = cards.get(event) 184 | dices = Dices() 185 | dices.a = True 186 | dices.anum = card_data[arg] 187 | return dices.roll() 188 | -------------------------------------------------------------------------------- /alisabot/plugins/dicer/dices.py: -------------------------------------------------------------------------------- 1 | # 参考[OlivaDiceDocs](https://oliva.dicer.wiki/userdoc)实现的nonebot2骰娘插件 2 | import random 3 | import re 4 | 5 | from .messages import help_messages 6 | 7 | 8 | class Mylist(list): 9 | def next(self, index: int): 10 | if index < self.__len__() - 1: 11 | return self[index + 1] 12 | else: 13 | return "" 14 | 15 | 16 | def help_message(args: str): 17 | if args in help_messages.__dict__.keys(): 18 | return help_messages.__dict__[args] 19 | else: 20 | return help_messages.main 21 | 22 | 23 | def dhr(t, o): 24 | if t == 0 and o == 0: 25 | return 100 26 | else: 27 | return t * 10 + o 28 | 29 | 30 | def st(): 31 | result = random.randint(1, 20) 32 | if result < 4: 33 | rstr = "右腿" 34 | elif result < 7: 35 | rstr = "左腿" 36 | elif result < 11: 37 | rstr = "腹部" 38 | elif result < 16: 39 | rstr = "胸部" 40 | elif result < 18: 41 | rstr = "右臂" 42 | elif result < 20: 43 | rstr = "左臂" 44 | elif result < 21: 45 | rstr = "头部" 46 | return "D20=%d:命中了%s" % (result, rstr) 47 | 48 | 49 | def en(arg: str) -> str: 50 | try: 51 | arg = int(arg) 52 | except ValueError: 53 | return help_messages.en 54 | check = random.randint(1, 100) 55 | if check > arg or check > 95: 56 | plus = random.randint(1, 10) 57 | r = "判定值%d,判定成功,技能成长%d+%d=%d" % (check, arg, plus, arg + plus) 58 | return r + "\n温馨提示:如果技能提高到90%或更高,增加2D6理智点数。" 59 | else: 60 | return "判定值%d,判定失败,技能无成长。" % check 61 | 62 | 63 | class Dices(object): 64 | def __init__(self): 65 | self.dices = 1 66 | self.faces = 100 67 | self.a = False 68 | self.anum = 0 69 | self.h = False 70 | self.times = 1 71 | self.bp = 0 72 | self._bp_result = "" 73 | self._tens_place = None 74 | self._ones_place = None 75 | self._head = "" 76 | self._mid = "" 77 | self._end = "" 78 | self.result = 0 79 | self.a_check_mode = self.a_check 80 | self._a_check_result = "" 81 | self.ex_dice = None 82 | self.ex_dice_type = 1 83 | self._ex_result = "" 84 | 85 | def real_dice(self): 86 | if self.faces == 100: 87 | self._tens_place = random.randint(0, 9) 88 | self._ones_place = random.randint(0, 9) 89 | self.result += dhr(self._tens_place, self._ones_place) 90 | return dhr(self._tens_place, self._ones_place) 91 | else: 92 | rint = random.randint(1, self.faces) 93 | self.result += rint 94 | return rint 95 | 96 | def bp_dice(self): 97 | if not self.bp or self.faces != 100 or self.dices != 1: 98 | self._bp_result = "" 99 | return self._bp_result 100 | self._bp_result = " -> 十位:%d,个位:%d" % ( 101 | self._tens_place, self._ones_place) 102 | bp = self.bp 103 | while bp > 0: 104 | bd = random.randint(0, 9) 105 | self._bp_result += ",奖励:%d" % bd 106 | if dhr(bd, self._ones_place) < dhr(self._tens_place, self._ones_place): 107 | self._tens_place = bd 108 | self.result = dhr(self._tens_place, self._ones_place) 109 | bp -= 1 110 | while bp < 0: 111 | bd = random.randint(0, 9) 112 | self._bp_result += ",惩罚:%d" % bd 113 | if dhr(bd, self._ones_place) > dhr(self._tens_place, self._ones_place): 114 | self._tens_place = bd 115 | self.set_result() 116 | bp += 1 117 | return self._bp_result 118 | 119 | def a_check(self): 120 | if not (self.a and self.anum and self.faces == 100 and self.dices == 1): 121 | self._a_check_result = "" 122 | return self._a_check_result 123 | if self.result == 100: 124 | self._a_check_result = " 大失败!" 125 | elif self.anum < 50 and self.result > 95: 126 | self._a_check_result = "\n检定值%d %d>95 大失败!" % ( 127 | self.anum, self.result) 128 | elif self.result == 1: 129 | self._a_check_result = " 大成功!" 130 | elif self.result <= self.anum // 5: 131 | self._a_check_result = "\n检定值%d %d≤%d 极难成功" % ( 132 | self.anum, self.result, self.anum // 5) 133 | elif self.result <= self.anum // 2: 134 | self._a_check_result = "\n检定值%d %d≤%d 困难成功" % ( 135 | self.anum, self.result, self.anum // 2) 136 | elif self.result <= self.anum: 137 | self._a_check_result = "\n检定值%d %d≤%d 成功" % ( 138 | self.anum, self.result, self.anum) 139 | else: 140 | self._a_check_result = "\n检定值%d %d>%d 失败" % ( 141 | self.anum, self.result, self.anum) 142 | return self._a_check_result 143 | 144 | def xdy(self): 145 | self.result = 0 146 | if self.dices == 1: 147 | self.real_dice() 148 | self.bp_dice() 149 | self.a_check() 150 | return "" 151 | else: 152 | dice_results = [] 153 | for _ in range(self.dices): 154 | dice_result = self.real_dice() 155 | dice_results.append(str(dice_result)) 156 | return "(%s)" % "+".join(dice_results) 157 | 158 | def _ex_handle(self): 159 | if not self.ex_dice: 160 | self._ex_result = "" 161 | elif type(self.ex_dice) == int: 162 | ex_result = self.ex_dice_type * self.ex_dice 163 | self._ex_result = "%s%s%d" % (str( 164 | self.result) if self.dices == 1 else "", "+" if self.ex_dice_type == 1 else "-", self.ex_dice) 165 | self.result += ex_result 166 | elif type(self.ex_dice) == Dices: 167 | self.ex_dice.roll() 168 | ex_result = self.ex_dice_type * self.ex_dice.result 169 | self._ex_result = "%s%s%d" % (str( 170 | self.result) if self.dices == 1 else "", "+" if self.ex_dice_type == 1 else "-", self.ex_dice) 171 | self.result += ex_result 172 | return self._ex_result 173 | 174 | def roll(self): 175 | r = "%d次投掷:" % self.times 176 | if self.times != 1: 177 | r += "\n" 178 | for _ in range(self.times): 179 | xdyr = self.xdy() 180 | self._ex_handle() 181 | self._head = "%sD%d%s=" % ( 182 | "" if self.dices == 1 else str(self.dices), 183 | self.faces, 184 | "" if not self.ex_dice else ( 185 | ("+" if self.ex_dice_type == 1 else "-") + str(self.ex_dice) if type(self.ex_dice) == int else ( 186 | str(self.ex_dice.dices) + "D" + self.ex_dice.faces)) 187 | ) 188 | self._mid = "%s%s=" % (xdyr, self._ex_result) 189 | self._end = "%d%s%s" % ( 190 | self.result, self._bp_result, self._a_check_result) 191 | r += "%s%s%s" % (self._head, self._mid if self.dices != 192 | 1 or self.ex_dice else "", self._end) 193 | self.times -= 1 194 | if self.times: 195 | r += "\n" 196 | return r 197 | 198 | 199 | def prework(args: list, start=0): 200 | for i in range(start, len(args), 1): 201 | if not re.search("\\d+", args[i]) and len(args[i]) > 1: 202 | p = args.pop(i) 203 | for j in list(p): 204 | args.insert(i, j) 205 | i += 1 206 | if prework(args, i): 207 | break 208 | return True 209 | 210 | 211 | def rd(arg: str): 212 | try: 213 | h = False 214 | dices = Dices() 215 | args = re.split("(\\d+)", arg.lower()) 216 | prework(args) 217 | args = Mylist(args) 218 | for i in range(len(args)): 219 | if args[i] == "a": 220 | dices.a = True 221 | elif args[i] == "#" and re.search("\\d+", args.next(i)): 222 | dices.times = int(args[i + 1]) 223 | elif args[i] == "b": 224 | dices.bp += 1 225 | elif args[i] == "p": 226 | dices.bp -= 1 227 | elif args[i] == "d" and re.search("\\d+", args.next(i)): 228 | dices.faces = int(args[i + 1]) 229 | elif args[i] == " " and re.search("\\d+", args.next(i)) and dices.a: 230 | dices.anum = int(args[i + 1]) 231 | elif args[i] == "h": 232 | h = True 233 | elif re.search("\\d+", args[i]): 234 | if args.next(i) == "d": 235 | dices.dices = int(args[i]) 236 | elif args[i - 1] == " " and dices.a: 237 | dices.anum = int(args[i]) 238 | elif args[i] in ["-", "+"]: 239 | dices.ex_dice_type = (-1 if args[i] == "-" else 1) 240 | if args.next(i + 1) == "d": 241 | dices.ex_dice = Dices() 242 | dices.ex_dice.dices = int(args.next(i)) 243 | dices.ex_dice.faces = int(args.next(i + 2)) 244 | elif args.next(i): 245 | dices.ex_dice = int(args.next(i)) 246 | if h: 247 | return [dices.roll()] 248 | return dices.roll() 249 | except: 250 | return help_messages.r 251 | 252 | 253 | if __name__ == "__main__": 254 | rd("2d100") 255 | -------------------------------------------------------------------------------- /alisabot/plugins/dicer/messages.py: -------------------------------------------------------------------------------- 1 | from .deck import DeckDict 2 | 3 | 4 | class HelpMessages: 5 | def __init__(self): 6 | self.main = "本骰娘由nonebot2强力驱动\n" \ 7 | ".r 投掷指令 todo\n" \ 8 | " d 制定骰子面数\n" \ 9 | " a 检定\n" \ 10 | " h 暗骰\n" \ 11 | " # 多轮检定\n" \ 12 | " bp 奖励骰&惩罚骰\n" \ 13 | " +/- 附加计算 todo\n" \ 14 | ".sc 疯狂检定\n" \ 15 | ".st 射击命中判定\n" \ 16 | ".ti 临时疯狂症状\n" \ 17 | ".li 总结疯狂症状\n" \ 18 | ".coc coc角色作成\n" \ 19 | ".help 帮助信息\n" \ 20 | ".en 技能成长\n" \ 21 | ".set 角色卡设定\n" \ 22 | ".show 角色卡查询\n" \ 23 | ".sa 快速检定\n" \ 24 | ".del 删除数据\n" \ 25 | ".jrrp 每日人品\n" \ 26 | ".draw 抽卡!\n" \ 27 | "输入.dhelp+指令名获取详细信息" 28 | self.r = ".r[dah#bp] a_number [+/-]ex_number\n" \ 29 | "d:骰子设定指令,标准格式为xdy,x为骰子数量y为骰子面数;\n" \ 30 | "a:检定指令,根据后续a_number设定数值检定;\n" \ 31 | "h:暗骰指令,骰子结构将会私聊发送给该指令者;\n" \ 32 | "#:多轮投掷指令,#后接数字即可设定多轮投掷;\n" \ 33 | "bp:奖励骰与惩罚骰;\n" \ 34 | "+/-:附加计算指令,目前仅支持数字" 35 | self.sc = ".sc success/failure san_number\n" \ 36 | "success:判定成功降低san值,支持x或xdy语法(x与y为数字);\n" \ 37 | "failure:判定失败降低san值,支持语法如上;\n" \ 38 | "san_number:当前san值,缺省san_number将会自动使用保存的人物卡数据。" 39 | self.set = ".set [attr_name] [attr_num]\n" \ 40 | "attr_name:属性名称,例 name、名字、str、力量\n" \ 41 | "attr_num:属性值\n" \ 42 | "可以单独输入.set指令,骰娘将自动读取最近一次coc指令结果进行保存" 43 | self.show = ".show[s] [@xxx]\n" \ 44 | "查看指定调查员保存的人物卡,缺省at则查询自身人物卡\n" \ 45 | ".shows 为查看技能指令" 46 | self.sa = ".sa [attr_name]\n" \ 47 | "attr_name:属性名称,例:name、名字、str、力量" 48 | self.en = ".en skill_level\n" \ 49 | "skill_level:需要成长的技能当前等级。" 50 | self.del_ = ".del [c|card|xxx]\n" \ 51 | "删除数据,args可以有以下值\n" \ 52 | "c:清空暂存数据\n" \ 53 | "card:删除使用中的人物卡(慎用)\n" \ 54 | "xxx:其他任意技能名\n" \ 55 | "该命令支持多个参数混合使用,可以一次指定多个技能名,使用空格隔开" 56 | self.jrrp = ".jrrp 简简单单的每日人品而已" 57 | self.draw = ".draw x张deck 没有则视为单张卡\n" \ 58 | "x:卡数 deck:牌堆\n" \ 59 | "输入./dhelp deck查看牌堆" 60 | self.deck = "现在的牌堆有:\n" + "\n".join(DeckDict.keys()) 61 | 62 | 63 | help_messages = HelpMessages() 64 | 65 | temporary_madness = [ 66 | "1) 失忆: 调查员会发现自己身处于一个安全的地点却没有任何来到这里的记忆。例如,调查员前一刻还在家中吃着早饭,下一刻就已经直面着不知名的怪物。这将会持续1D10轮。", 67 | "2) 假性残疾:调查员陷入了心理性的失明,失聪以及躯体缺失感中,持续1D10轮。", 68 | "3) 暴力倾向: 调查员陷入了六亲不认的暴力行为中,对周围的敌人与友方进行着无差别的攻击,持续1D10轮。", 69 | "4) 偏执: 调查员陷入了严重的偏执妄想之中,持续1D10轮。有人在暗中窥视着他们,同伴中有人背叛了他们,没有人可以信任,万事皆虚。", 70 | "5) 人际依赖: 守密人适当参考调查员的背景中重要之人的条目,调查员因为一些原因而降他人误认为了他重要的人并且努力的会与那个人保持那种关系,持续1D10轮。", 71 | "6) 昏厥: 调查员当场昏倒,并需要1D10轮才能苏醒。", 72 | "7) 逃避行为: 调查员会用任何的手段试图逃离现在所处的位置,即使这意味着开走唯一一辆交通工具并将其它人抛诸脑后,调查员会试图逃离1D10轮。", 73 | "8) 竭嘶底里:调查员表现出大笑,哭泣,嘶吼,害怕等的极端情绪表现,持续1D10轮。", 74 | "9) 恐惧: 调查员通过一次D100或者由守密人选择,来从恐惧症状表中选择一个恐惧源,就算这一恐惧的事物是并不存在的,调查员的症状会持续1D10轮。", 75 | "10) 躁狂: 调查员通过一次D100或者由守密人选择,来从躁狂症状表中选择一个躁狂的诱因,这个症状将会持续1D10轮。" 76 | ] 77 | madness_end = [ 78 | "1) 失忆(Amnesia):回过神来,调查员们发现自己身处一个陌生的地方,并忘记了自己是谁。记忆会随时间恢复。", 79 | "2) 被窃(Robbed):调查员在1D10小时后恢复清醒,发觉自己被盗,身体毫发无损。如果调查员携带着宝贵之物(见调查员背景),做幸运检定来决定其是否被盗。所有有价值的东西无需检定自动消失。", 80 | "3) 遍体鳞伤(Battered):调查员在1D10小时后恢复清醒,发现自己身上满是拳痕和瘀伤。生命值减少到疯狂前的一半,但这不会造成重伤。调查员没有被窃。这种伤害如何持续到现在由守秘人决定。", 81 | "4) 暴力倾向(Violence):调查员陷入强烈的暴力与破坏欲之中。调查员回过神来可能会理解自己做了什么也可能毫无印象。调查员对谁或何物施以暴力,他们是杀人还是仅仅造成了伤害,由守秘人决定。", 82 | "5) 极端信念(Ideology/Beliefs):查看调查员背景中的思想信念,调查员会采取极端和疯狂的表现手段展示他们的思想信念之一。比如一个信教者会在地铁上高声布道。", 83 | "6) 重要之人(Significant People):考虑调查员背景中的重要之人,及其重要的原因。在1D10小时或更久的时间中,调查员将不顾一切地接近那个人,并为他们之间的关系做出行动。", 84 | "7) 被收容(Institutionalized):调查员在精神病院病房或警察局牢房中回过神来,他们可能会慢慢回想起导致自己被关在这里的事情。", 85 | "8) 逃避行为(Flee in panic):调查员恢复清醒时发现自己在很远的地方,也许迷失在荒郊野岭,或是在驶向远方的列车或长途汽车上。", 86 | "9) 恐惧(Phobia):调查员患上一个新的恐惧症状。在表Ⅸ:恐惧症状表上骰1个D100来决定症状,或由守秘人选择一个。调查员在1D10小时后回过神来,并开始为避开恐惧源而采取任何措施。", 87 | "10) 狂躁(Mania):调查员患上一个新的狂躁症状。在表Ⅹ:狂躁症状表上骰1个D100来决定症状,或由守秘人选择一个。调查员会在1D10" 88 | "小时后恢复理智。在这次疯狂发作中,调查员将完全沉浸于其新的狂躁症状。这症状是否会表现给旁人则取决于守秘人和此调查员。 " 89 | ] 90 | phobias = [ 91 | "1) 洗澡恐惧症(Ablutophobia):对于洗涤或洗澡的恐惧。", 92 | "2) 恐高症(Acrophobia):对于身处高处的恐惧。", 93 | "3) 飞行恐惧症(Aerophobia):对飞行的恐惧。", 94 | "4) 广场恐惧症(Agoraphobia):对于开放的(拥挤)公共场所的恐惧。", 95 | "5) 恐鸡症(Alektorophobia):对鸡的恐惧。", 96 | "6) 大蒜恐惧症(Alliumphobia):对大蒜的恐惧。", 97 | "7) 乘车恐惧症(Amaxophobia):对于乘坐地面载具的恐惧。", 98 | "8) 恐风症(Ancraophobia):对风的恐惧。", 99 | "9) 男性恐惧症(Androphobia):对于成年男性的恐惧。", 100 | "10) 恐英症(Anglophobia):对英格兰或英格兰文化的恐惧。", 101 | "11) 恐花症(Anthophobia):对花的恐惧。", 102 | "12) 截肢者恐惧症(Apotemnophobia):对截肢者的恐惧。", 103 | "13) 蜘蛛恐惧症(Arachnophobia):对蜘蛛的恐惧。", 104 | "14) 闪电恐惧症(Astraphobia):对闪电的恐惧。", 105 | "15) 废墟恐惧症(Atephobia):对遗迹或残址的恐惧。", 106 | "16) 长笛恐惧症(Aulophobia):对长笛的恐惧。", 107 | "17) 细菌恐惧症(Bacteriophobia):对细菌的恐惧。", 108 | "18) 导弹/子弹恐惧症(Ballistophobia):对导弹或子弹的恐惧。", 109 | "19) 跌落恐惧症(Basophobia):对于跌倒或摔落的恐惧。", 110 | "20) 书籍恐惧症(Bibliophobia):对书籍的恐惧。", 111 | "21) 植物恐惧症(Botanophobia):对植物的恐惧。", 112 | "22) 美女恐惧症(Caligynephobia):对美貌女性的恐惧。", 113 | "23) 寒冷恐惧症(Cheimaphobia):对寒冷的恐惧。", 114 | "24) 恐钟表症(Chronomentrophobia):对于钟表的恐惧。", 115 | "25) 幽闭恐惧症(Claustrophobia):对于处在封闭的空间中的恐惧。", 116 | "26) 小丑恐惧症(Coulrophobia):对小丑的恐惧。", 117 | "27) 恐犬症(Cynophobia):对狗的恐惧。", 118 | "28) 恶魔恐惧症(Demonophobia):对邪灵或恶魔的恐惧。", 119 | "29) 人群恐惧症(Demophobia):对人群的恐惧。", 120 | "30) 牙科恐惧症①(Dentophobia):对牙医的恐惧。", 121 | "31) 丢弃恐惧症(Disposophobia):对于丢弃物件的恐惧(贮藏癖)。", 122 | "32) 皮毛恐惧症(Doraphobia):对动物皮毛的恐惧。", 123 | "33) 过马路恐惧症(Dromophobia):对于过马路的恐惧。", 124 | "34) 教堂恐惧症(Ecclesiophobia):对教堂的恐惧。", 125 | "35) 镜子恐惧症(Eisoptrophobia):对镜子的恐惧。", 126 | "36) 针尖恐惧症(Enetophobia):对针或大头针的恐惧。", 127 | "37) 昆虫恐惧症(Entomophobia):对昆虫的恐惧。", 128 | "38) 恐猫症(Felinophobia):对猫的恐惧。", 129 | "39) 过桥恐惧症(Gephyrophobia):对于过桥的恐惧。", 130 | "40) 恐老症(Gerontophobia):对于老年人或变老的恐惧。", 131 | "41) 恐女症(Gynophobia):对女性的恐惧。", 132 | "42) 恐血症(Haemaphobia):对血的恐惧。", 133 | "43) 宗教罪行恐惧症(Hamartophobia):对宗教罪行的恐惧。", 134 | "44) 触摸恐惧症(Haphophobia):对于被触摸的恐惧。", 135 | "45) 爬虫恐惧症(Herpetophobia):对爬行动物的恐惧。", 136 | "46) 迷雾恐惧症(Homichlophobia):对雾的恐惧。", 137 | "47) 火器恐惧症(Hoplophobia):对火器的恐惧。", 138 | "48) 恐水症(Hydrophobia):对水的恐惧。", 139 | "49) 催眠恐惧症(Hypnophobia):对于睡眠或被催眠的恐惧。", 140 | "50) 白袍恐惧症(Iatrophobia):对医生的恐惧。", 141 | "51) 鱼类恐惧症(Ichthyophobia):对鱼的恐惧。", 142 | "52) 蟑螂恐惧症(Katsaridaphobia):对蟑螂的恐惧。", 143 | "53) 雷鸣恐惧症(Keraunophobia):对雷声的恐惧。", 144 | "54) 蔬菜恐惧症(Lachanophobia):对蔬菜的恐惧。", 145 | "55) 噪音恐惧症(Ligyrophobia):对刺耳噪音的恐惧。", 146 | "56) 恐湖症(Limnophobia):对湖泊的恐惧。", 147 | "57) 机械恐惧症(Mechanophobia):对机器或机械的恐惧。", 148 | "58) 巨物恐惧症(Megalophobia):对于庞大物件的恐惧。", 149 | "59) 捆绑恐惧症(Merinthophobia):对于被捆绑或紧缚的恐惧。", 150 | "60) 流星恐惧症(Meteorophobia):对流星或陨石的恐惧。", 151 | "61) 孤独恐惧症(Monophobia):对于一人独处的恐惧。", 152 | "62) 不洁恐惧症(Mysophobia):对污垢或污染的恐惧。", 153 | "63) 黏液恐惧症(Myxophobia):对黏液(史莱姆)的恐惧。", 154 | "64) 尸体恐惧症(Necrophobia):对尸体的恐惧。", 155 | "65) 数字8恐惧症(Octophobia):对数字8的恐惧。", 156 | "66) 恐牙症(Odontophobia):对牙齿的恐惧。", 157 | "67) 恐梦症(Oneirophobia):对梦境的恐惧。", 158 | "68) 称呼恐惧症(Onomatophobia):对于特定词语的恐惧。", 159 | "69) 恐蛇症(Ophidiophobia):对蛇的恐惧。", 160 | "70) 恐鸟症(Ornithophobia):对鸟的恐惧。", 161 | "71) 寄生虫恐惧症(Parasitophobia):对寄生虫的恐惧。", 162 | "72) 人偶恐惧症(Pediophobia):对人偶的恐惧。", 163 | "73) 吞咽恐惧症(Phagophobia):对于吞咽或被吞咽的恐惧。", 164 | "74) 药物恐惧症(Pharmacophobia):对药物的恐惧。", 165 | "75) 幽灵恐惧症(Phasmophobia):对鬼魂的恐惧。", 166 | "76) 日光恐惧症(Phenogophobia):对日光的恐惧。", 167 | "77) 胡须恐惧症(Pogonophobia):对胡须的恐惧。", 168 | "78) 河流恐惧症(Potamophobia):对河流的恐惧。", 169 | "79) 酒精恐惧症(Potophobia):对酒或酒精的恐惧。", 170 | "80) 恐火症(Pyrophobia):对火的恐惧。", 171 | "81) 魔法恐惧症(Rhabdophobia):对魔法的恐惧。", 172 | "82) 黑暗恐惧症(Scotophobia):对黑暗或夜晚的恐惧。", 173 | "83) 恐月症(Selenophobia):对月亮的恐惧。", 174 | "84) 火车恐惧症(Siderodromophobia):对于乘坐火车出行的恐惧。", 175 | "85) 恐星症(Siderophobia):对星星的恐惧。", 176 | "86) 狭室恐惧症(Stenophobia):对狭小物件或地点的恐惧。", 177 | "87) 对称恐惧症(Symmetrophobia):对对称的恐惧。", 178 | "88) 活埋恐惧症(Taphephobia):对于被活埋或墓地的恐惧。", 179 | "89) 公牛恐惧症(Taurophobia):对公牛的恐惧。", 180 | "90) 电话恐惧症(Telephonophobia):对电话的恐惧。", 181 | "91) 怪物恐惧症①(Teratophobia):对怪物的恐惧。", 182 | "92) 深海恐惧症(Thalassophobia):对海洋的恐惧。", 183 | "93) 手术恐惧症(Tomophobia):对外科手术的恐惧。", 184 | "94) 十三恐惧症(Triskadekaphobia):对数字13的恐惧症。", 185 | "95) 衣物恐惧症(Vestiphobia):对衣物的恐惧。", 186 | "96) 女巫恐惧症(Wiccaphobia):对女巫与巫术的恐惧。", 187 | "97) 黄色恐惧症(Xanthophobia):对黄色或“黄”字的恐惧。", 188 | "98) 外语恐惧症(Xenoglossophobia):对外语的恐惧。", 189 | "99) 异域恐惧症(Xenophobia):对陌生人或外国人的恐惧。", 190 | "100) 动物恐惧症(Zoophobia):对动物的恐惧。" 191 | ] 192 | manias = [ 193 | "1) 沐浴癖(Ablutomania):执着于清洗自己。", 194 | "2) 犹豫癖(Aboulomania):病态地犹豫不定。", 195 | "3) 喜暗狂(Achluomania):对黑暗的过度热爱。", 196 | "4) 喜高狂(Acromaniaheights):狂热迷恋高处。", 197 | "5) 亲切癖(Agathomania):病态地对他人友好。", 198 | "6) 喜旷症(Agromania):强烈地倾向于待在开阔空间中。", 199 | "7) 喜尖狂(Aichmomania):痴迷于尖锐或锋利的物体。", 200 | "8) 恋猫狂(Ailuromania):近乎病态地对猫友善。", 201 | "9) 疼痛癖(Algomania):痴迷于疼痛。", 202 | "10) 喜蒜狂(Alliomania):痴迷于大蒜。", 203 | "11) 乘车癖(Amaxomania):痴迷于乘坐车辆。", 204 | "12) 欣快癖(Amenomania):不正常地感到喜悦。", 205 | "13) 喜花狂(Anthomania):痴迷于花朵。", 206 | "14) 计算癖(Arithmomania):狂热地痴迷于数字。", 207 | "15) 消费癖(Asoticamania):鲁莽冲动地消费。", 208 | "16) 隐居癖(Automania):过度地热爱独自隐居(原文如此,存疑,Automania实际上是恋车癖)。", 209 | "17) 芭蕾癖(Balletmania):痴迷于芭蕾舞。", 210 | "18) 窃书癖(Biliokleptomania):无法克制偷窃书籍的冲动。", 211 | "19) 恋书狂(Bibliomania):痴迷于书籍和/或阅读。", 212 | "20) 磨牙癖(Bruxomania):无法克制磨牙的冲动。", 213 | "21) 灵臆症(Cacodemomania):病态地坚信自己已被一个邪恶的灵体占据。", 214 | "22) 美貌狂(Callomania):痴迷于自身的美貌。", 215 | "23) 地图狂(Cartacoethes):在何时何处都无法控制查阅地图的冲动。", 216 | "24) 跳跃狂(Catapedamania):痴迷于从高处跳下。", 217 | "25) 喜冷症(Cheimatomania):对寒冷或寒冷的物体的反常喜爱。", 218 | "26) 舞蹈狂(Choreomania):无法控制地起舞或发颤。", 219 | "27) 恋床癖(Clinomania):过度地热爱待在床上。", 220 | "28) 恋墓狂(Coimetormania):痴迷于墓地。", 221 | "29) 色彩狂(Coloromania):痴迷于某种颜色。", 222 | "30) 小丑狂(Coulromania):痴迷于小丑。", 223 | "31) 恐惧狂(Countermania):执着于经历恐怖的场面。", 224 | "32) 杀戮癖(Dacnomania):痴迷于杀戮。", 225 | "33) 魔臆症(Demonomania):病态地坚信自己已被恶魔附身。", 226 | "34) 抓挠癖(Dermatillomania):执着于抓挠自己的皮肤。", 227 | "35) 正义狂(Dikemania):痴迷于目睹正义被伸张。", 228 | "36) 嗜酒狂(Dipsomania):反常地渴求酒精。", 229 | "37) 毛皮狂(Doramania):痴迷于拥有毛皮。(存疑)", 230 | "38) 赠物癖(Doromania):痴迷于赠送礼物。", 231 | "39) 漂泊症(Drapetomania):执着于逃离。", 232 | "40) 漫游癖(Ecdemiomania):执着于四处漫游。", 233 | "41) 自恋狂(Egomania):近乎病态地以自我为中心或自我崇拜。", 234 | "42) 职业狂(Empleomania):对于工作的无尽病态渴求。", 235 | "43) 臆罪症(Enosimania):病态地坚信自己带有罪孽。", 236 | "44) 学识狂(Epistemomania):痴迷于获取学识。", 237 | "45) 静止癖(Eremiomania):执着于保持安静。", 238 | "46) 乙醚上瘾(Etheromania):渴求乙醚。", 239 | "47) 求婚狂(Gamomania):痴迷于进行奇特的求婚。", 240 | "48) 狂笑癖(Geliomania):无法自制地,强迫性的大笑。", 241 | "49) 巫术狂(Goetomania):痴迷于女巫与巫术。", 242 | "50) 写作癖(Graphomania):痴迷于将每一件事写下来。", 243 | "51) 裸体狂(Gymnomania):执着于裸露身体。", 244 | "52) 妄想狂(Habromania):近乎病态地充满愉快的妄想(而不顾现实状况如何)。", 245 | "53) 蠕虫狂(Helminthomania):过度地喜爱蠕虫。", 246 | "54) 枪械狂(Hoplomania):痴迷于火器。", 247 | "55) 饮水狂(Hydromania):反常地渴求水分。", 248 | "56) 喜鱼癖(Ichthyomania):痴迷于鱼类。", 249 | "57) 图标狂(Iconomania):痴迷于图标与肖像。", 250 | "58) 偶像狂(Idolomania):痴迷于甚至愿献身于某个偶像。", 251 | "59) 信息狂(Infomania):痴迷于积累各种信息与资讯。", 252 | "60) 射击狂(Klazomania):反常地执着于射击。", 253 | "61) 偷窃癖(Kleptomania):反常地执着于偷窃。", 254 | "62) 噪音癖(Ligyromania):无法自制地执着于制造响亮或刺耳的噪音。", 255 | "63) 喜线癖(Linonomania):痴迷于线绳。", 256 | "64) 彩票狂(Lotterymania):极端地执着于购买彩票。", 257 | "65) 抑郁症(Lypemania):近乎病态的重度抑郁倾向。", 258 | "66) 巨石狂(Megalithomania):当站在石环中或立起的巨石旁时,就会近乎病态地写出各种奇怪的创意。", 259 | "67) 旋律狂(Melomania):痴迷于音乐或一段特定的旋律。", 260 | "68) 作诗癖(Metromania):无法抑制地想要不停作诗。", 261 | "69) 憎恨癖(Misomania):憎恨一切事物,痴迷于憎恨某个事物或团体。", 262 | "70) 偏执狂(Monomania):近乎病态地痴迷与专注某个特定的想法或创意。", 263 | "71) 夸大癖(Mythomania):以一种近乎病态的程度说谎或夸大事物。", 264 | "72) 臆想症(Nosomania):妄想自己正在被某种臆想出的疾病折磨。", 265 | "73) 记录癖(Notomania):执着于记录一切事物(例如摄影)。", 266 | "74) 恋名狂(Onomamania):痴迷于名字(人物的、地点的、事物的)。", 267 | "75) 称名癖(Onomatomania):无法抑制地不断重复某个词语的冲动。", 268 | "76) 剔指癖(Onychotillomania):执着于剔指甲。", 269 | "77) 恋食癖(Opsomania):对某种食物的病态热爱。", 270 | "78) 抱怨癖(Paramania):一种在抱怨时产生的近乎病态的愉悦感。", 271 | "79) 面具狂(Personamania):执着于佩戴面具。", 272 | "80) 幽灵狂(Phasmomania):痴迷于幽灵。", 273 | "81) 谋杀癖(Phonomania):病态的谋杀倾向。", 274 | "82) 渴光癖(Photomania):对光的病态渴求。", 275 | "83) 背德癖(Planomania):病态地渴求违背社会道德(原文如此,存疑,Planomania实际上是漂泊症)。", 276 | "84) 求财癖(Plutomania):对财富的强迫性的渴望。", 277 | "85) 欺骗狂(Pseudomania):无法抑制的执着于撒谎。", 278 | "86) 纵火狂(Pyromania):执着于纵火。", 279 | "87) 提问狂(Questiong-Asking Mania):执着于提问。", 280 | "88) 挖鼻癖(Rhinotillexomania):执着于挖鼻子。", 281 | "89) 涂鸦癖(Scribbleomania):沉迷于涂鸦。", 282 | "90) 列车狂(Siderodromomania):认为火车或类似的依靠轨道交通的旅行方式充满魅力。", 283 | "91) 臆智症(Sophomania):臆想自己拥有难以置信的智慧。", 284 | "92) 科技狂(Technomania):痴迷于新的科技。", 285 | "93) 臆咒狂(Thanatomania):坚信自己已被某种死亡魔法所诅咒。", 286 | "94) 臆神狂(Theomania):坚信自己是一位神灵。", 287 | "95) 抓挠癖(Titillomaniac):抓挠自己的强迫倾向。", 288 | "96) 手术狂(Tomomania):对进行手术的不正常爱好。", 289 | "97) 拔毛癖(Trichotillomania):执着于拔下自己的头发。", 290 | "98) 臆盲症(Typhlomania):病理性的失明。", 291 | "99) 嗜外狂(Xenomania):痴迷于异国的事物。", 292 | "100) 喜兽癖(Zoomania):对待动物的态度近乎疯狂地友好。" 293 | ] 294 | -------------------------------------------------------------------------------- /alisabot/plugins/fun/data/haarcascade_dragon.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | BOOST 5 | HAAR 6 | 16 7 | 16 8 | 9 | GAB 10 | 9.9500000476837158e-01 11 | 5.0000000000000000e-01 12 | 9.4999998807907104e-01 13 | 1 14 | 100 15 | 16 | 17 | 0 18 | 1 19 | BASIC 20 | 21 | 17 22 | 23 | 24 | <_> 25 | 1 26 | 9.8059648275375366e-01 27 | 28 | <_> 29 | 30 | 0 -1 15 2.8765210881829262e-02 31 | 32 | 33 | -1. 9.8059648275375366e-01 34 | 35 | 36 | 37 | 38 | 39 | <_> 40 | 1 41 | 9.8738056421279907e-01 42 | 43 | <_> 44 | 45 | 0 -1 29 -5.7731266133487225e-03 46 | 47 | 48 | 9.8738056421279907e-01 -1. 49 | 50 | 51 | 52 | 53 | 54 | <_> 55 | 1 56 | 9.8130840063095093e-01 57 | 58 | <_> 59 | 60 | 0 -1 2 2.5053281337022781e-02 61 | 62 | 63 | -1. 9.8130840063095093e-01 64 | 65 | 66 | 67 | 68 | 69 | <_> 70 | 1 71 | 9.6786862611770630e-01 72 | 73 | <_> 74 | 75 | 0 -1 8 1.5922059537842870e-03 76 | 77 | 78 | 9.6786862611770630e-01 -1. 79 | 80 | 81 | 82 | 83 | 84 | <_> 85 | 2 86 | 1.8672691583633423e+00 87 | 88 | <_> 89 | 90 | 0 -1 11 6.6081471741199493e-03 91 | 92 | 93 | 9.6471214294433594e-01 -1. 94 | 95 | 96 | <_> 97 | 98 | 0 -1 16 3.3336086198687553e-03 99 | 100 | 101 | 9.0255701541900635e-01 -1. 102 | 103 | 104 | 105 | 106 | 107 | <_> 108 | 1 109 | 9.7279888391494751e-01 110 | 111 | <_> 112 | 113 | 0 -1 24 2.4953609332442284e-02 114 | 115 | 116 | 9.7279888391494751e-01 -1. 117 | 118 | 119 | 120 | 121 | 122 | <_> 123 | 1 124 | 9.7174030542373657e-01 125 | 126 | <_> 127 | 128 | 0 -1 7 6.4350590109825134e-02 129 | 130 | 131 | 9.7174030542373657e-01 -1. 132 | 133 | 134 | 135 | 136 | 137 | <_> 138 | 1 139 | 9.7173523902893066e-01 140 | 141 | <_> 142 | 143 | 0 -1 12 -1.8964086193591356e-03 144 | 145 | 146 | 9.7173523902893066e-01 -9.8245614767074585e-01 147 | 148 | 149 | 150 | 151 | 152 | <_> 153 | 1 154 | 9.6646451950073242e-01 155 | 156 | <_> 157 | 158 | 0 -1 23 -4.1662108153104782e-02 159 | 160 | 161 | -1. 9.6646451950073242e-01 162 | 163 | 164 | 165 | 166 | 167 | <_> 168 | 1 169 | 9.6716630458831787e-01 170 | 171 | <_> 172 | 173 | 0 -1 3 1.5876971185207367e-01 174 | 175 | 176 | 9.6716630458831787e-01 -1. 177 | 178 | 179 | 180 | 181 | 182 | <_> 183 | 4 184 | 7.1109580993652344e-01 185 | 186 | <_> 187 | 188 | 0 -1 10 2.4508815258741379e-02 189 | 190 | 191 | -1. 9.6366226673126221e-01 192 | 193 | 194 | <_> 195 | 196 | 0 -1 9 6.6883913241326809e-03 197 | 198 | 199 | -5.8801287412643433e-01 9.1924619674682617e-01 200 | 201 | 202 | <_> 203 | 204 | 0 -1 25 8.5378307849168777e-03 205 | 206 | 207 | -4.2562738060951233e-01 9.2150104045867920e-01 208 | 209 | 210 | <_> 211 | 212 | 0 -1 5 8.2432299677748233e-05 213 | 214 | 215 | -6.3444650173187256e-01 7.6107382774353027e-01 216 | 217 | 218 | 219 | 220 | 221 | <_> 222 | 4 223 | 7.6061439514160156e-01 224 | 225 | <_> 226 | 227 | 0 -1 18 3.1445205677300692e-03 228 | 229 | 230 | 9.6017068624496460e-01 -1. 231 | 232 | 233 | <_> 234 | 235 | 0 -1 17 5.1886606961488724e-03 236 | 237 | 238 | -2.3628856241703033e-01 9.5060902833938599e-01 239 | 240 | 241 | <_> 242 | 243 | 0 -1 27 -9.0209003537893295e-03 244 | 245 | 246 | 7.6707917451858521e-01 -6.8092685937881470e-01 247 | 248 | 249 | <_> 250 | 251 | 0 -1 1 -8.7821567431092262e-03 252 | 253 | 254 | 7.1765917539596558e-01 -6.8928116559982300e-01 255 | 256 | 257 | 258 | 259 | 260 | <_> 261 | 3 262 | 1.1390671730041504e+00 263 | 264 | <_> 265 | 266 | 0 -1 21 1.6175225377082825e-02 267 | 268 | 269 | 9.6121686697006226e-01 -1. 270 | 271 | 272 | <_> 273 | 274 | 0 -1 14 -1.0026903823018074e-02 275 | 276 | 277 | 8.7776505947113037e-01 -7.7259391546249390e-01 278 | 279 | 280 | <_> 281 | 282 | 0 -1 13 -6.2874875962734222e-02 283 | 284 | 285 | 9.5044428110122681e-01 -4.4516676664352417e-01 286 | 287 | 288 | 289 | 290 | 291 | <_> 292 | 3 293 | 1.0169106721878052e+00 294 | 295 | <_> 296 | 297 | 0 -1 20 -2.0533164497464895e-03 298 | 299 | 300 | 9.6121686697006226e-01 -1. 301 | 302 | 303 | <_> 304 | 305 | 0 -1 6 -2.4184910580515862e-03 306 | 307 | 308 | -7.4928301572799683e-01 8.6246556043624878e-01 309 | 310 | 311 | <_> 312 | 313 | 0 -1 22 1.0114641860127449e-02 314 | 315 | 316 | -6.4904433488845825e-01 8.0497682094573975e-01 317 | 318 | 319 | 320 | 321 | 322 | <_> 323 | 2 324 | 1.8080297708511353e+00 325 | 326 | <_> 327 | 328 | 0 -1 0 2.0443461835384369e-02 329 | 330 | 331 | -1. 9.5877754688262939e-01 332 | 333 | 334 | <_> 335 | 336 | 0 -1 4 5.7107303291559219e-03 337 | 338 | 339 | 8.4925222396850586e-01 -9.8251825571060181e-01 340 | 341 | 342 | 343 | 344 | 345 | <_> 346 | 2 347 | 1.7881004810333252e+00 348 | 349 | <_> 350 | 351 | 0 -1 31 -8.8826738297939301e-02 352 | 353 | 354 | -1. 9.5703887939453125e-01 355 | 356 | 357 | <_> 358 | 359 | 0 -1 30 -5.9270905330777168e-04 360 | 361 | 362 | -1. 8.3106160163879395e-01 363 | 364 | 365 | 366 | 367 | 368 | <_> 369 | 3 370 | 1.0223529338836670e+00 371 | 372 | <_> 373 | 374 | 0 -1 26 3.1004585325717926e-03 375 | 376 | 377 | -1. 9.5391702651977539e-01 378 | 379 | 380 | <_> 381 | 382 | 0 -1 28 1.6305379103869200e-03 383 | 384 | 385 | -2.9743129014968872e-01 9.1034597158432007e-01 386 | 387 | 388 | <_> 389 | 390 | 0 -1 19 -6.1201356584206223e-04 391 | 392 | 393 | 7.3351943492889404e-01 -8.4191006422042847e-01 394 | 395 | 396 | 397 | 398 | 399 | 400 | <_> 401 | 402 | <_> 403 | 0 0 10 16 -1. 404 | 405 | <_> 406 | 0 8 10 8 2. 407 | 408 | 409 | 0 410 | 411 | <_> 412 | 413 | <_> 414 | 0 1 6 4 -1. 415 | 416 | <_> 417 | 0 1 3 2 2. 418 | 419 | <_> 420 | 3 3 3 2 2. 421 | 422 | 423 | 0 424 | 425 | <_> 426 | 427 | <_> 428 | 0 1 12 5 -1. 429 | 430 | <_> 431 | 6 1 6 5 2. 432 | 433 | 434 | 0 435 | 436 | <_> 437 | 438 | <_> 439 | 0 1 11 6 -1. 440 | 441 | <_> 442 | 0 4 11 3 2. 443 | 444 | 445 | 0 446 | 447 | <_> 448 | 449 | <_> 450 | 0 5 1 6 -1. 451 | 452 | <_> 453 | 0 7 1 2 3. 454 | 455 | 456 | 0 457 | 458 | <_> 459 | 460 | <_> 461 | 0 7 3 2 -1. 462 | 463 | <_> 464 | 1 7 1 2 3. 465 | 466 | 467 | 0 468 | 469 | <_> 470 | 471 | <_> 472 | 0 15 6 1 -1. 473 | 474 | <_> 475 | 3 15 3 1 2. 476 | 477 | 478 | 0 479 | 480 | <_> 481 | 482 | <_> 483 | 1 2 14 11 -1. 484 | 485 | <_> 486 | 8 2 7 11 2. 487 | 488 | 489 | 0 490 | 491 | <_> 492 | 493 | <_> 494 | 1 9 10 2 -1. 495 | 496 | <_> 497 | 1 10 10 1 2. 498 | 499 | 500 | 0 501 | 502 | <_> 503 | 504 | <_> 505 | 3 0 8 3 -1. 506 | 507 | <_> 508 | 3 1 8 1 3. 509 | 510 | 511 | 0 512 | 513 | <_> 514 | 515 | <_> 516 | 3 2 9 12 -1. 517 | 518 | <_> 519 | 3 8 9 6 2. 520 | 521 | 522 | 0 523 | 524 | <_> 525 | 526 | <_> 527 | 3 8 4 3 -1. 528 | 529 | <_> 530 | 3 9 4 1 3. 531 | 532 | 533 | 0 534 | 535 | <_> 536 | 537 | <_> 538 | 3 8 8 4 -1. 539 | 540 | <_> 541 | 3 10 8 2 2. 542 | 543 | 544 | 0 545 | 546 | <_> 547 | 548 | <_> 549 | 3 14 9 2 -1. 550 | 551 | <_> 552 | 3 15 9 1 2. 553 | 554 | 555 | 0 556 | 557 | <_> 558 | 559 | <_> 560 | 4 3 6 8 -1. 561 | 562 | <_> 563 | 4 3 3 4 2. 564 | 565 | <_> 566 | 7 7 3 4 2. 567 | 568 | 569 | 0 570 | 571 | <_> 572 | 573 | <_> 574 | 4 3 8 6 -1. 575 | 576 | <_> 577 | 4 6 8 3 2. 578 | 579 | 580 | 0 581 | 582 | <_> 583 | 584 | <_> 585 | 4 7 2 3 -1. 586 | 587 | <_> 588 | 4 8 2 1 3. 589 | 590 | 591 | 0 592 | 593 | <_> 594 | 595 | <_> 596 | 4 13 7 3 -1. 597 | 598 | <_> 599 | 4 14 7 1 3. 600 | 601 | 602 | 0 603 | 604 | <_> 605 | 606 | <_> 607 | 5 0 6 1 -1. 608 | 609 | <_> 610 | 7 0 2 1 3. 611 | 612 | 613 | 0 614 | 615 | <_> 616 | 617 | <_> 618 | 5 2 4 2 -1. 619 | 620 | <_> 621 | 5 3 4 1 2. 622 | 623 | 624 | 0 625 | 626 | <_> 627 | 628 | <_> 629 | 5 6 2 10 -1. 630 | 631 | <_> 632 | 5 11 2 5 2. 633 | 634 | 635 | 0 636 | 637 | <_> 638 | 639 | <_> 640 | 5 7 6 6 -1. 641 | 642 | <_> 643 | 5 9 6 2 3. 644 | 645 | 646 | 0 647 | 648 | <_> 649 | 650 | <_> 651 | 5 13 7 3 -1. 652 | 653 | <_> 654 | 5 14 7 1 3. 655 | 656 | 657 | 0 658 | 659 | <_> 660 | 661 | <_> 662 | 6 5 6 9 -1. 663 | 664 | <_> 665 | 9 5 3 9 2. 666 | 667 | 668 | 0 669 | 670 | <_> 671 | 672 | <_> 673 | 6 5 5 6 -1. 674 | 675 | <_> 676 | 6 7 5 2 3. 677 | 678 | 679 | 0 680 | 681 | <_> 682 | 683 | <_> 684 | 6 13 3 3 -1. 685 | 686 | <_> 687 | 6 14 3 1 3. 688 | 689 | 690 | 0 691 | 692 | <_> 693 | 694 | <_> 695 | 7 4 3 9 -1. 696 | 697 | <_> 698 | 7 7 3 3 3. 699 | 700 | 701 | 0 702 | 703 | <_> 704 | 705 | <_> 706 | 7 4 3 12 -1. 707 | 708 | <_> 709 | 7 10 3 6 2. 710 | 711 | 712 | 0 713 | 714 | <_> 715 | 716 | <_> 717 | 7 8 9 2 -1. 718 | 719 | <_> 720 | 10 8 3 2 3. 721 | 722 | 723 | 0 724 | 725 | <_> 726 | 727 | <_> 728 | 8 1 8 4 -1. 729 | 730 | <_> 731 | 12 1 4 4 2. 732 | 733 | 734 | 0 735 | 736 | <_> 737 | 738 | <_> 739 | 8 5 3 2 -1. 740 | 741 | <_> 742 | 9 5 1 2 3. 743 | 744 | 745 | 0 746 | 747 | <_> 748 | 749 | <_> 750 | 11 1 4 10 -1. 751 | 752 | <_> 753 | 13 1 2 10 2. 754 | 755 | 756 | 0 757 | 758 | 759 | 760 | 761 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------