2022-10-07 05:02:49 +00:00
|
|
|
from __future__ import annotations
|
|
|
|
|
2022-10-10 03:37:58 +00:00
|
|
|
import functools
|
2022-12-04 11:56:39 +00:00
|
|
|
from typing import List
|
2022-10-10 03:37:58 +00:00
|
|
|
|
2023-05-11 15:09:39 +00:00
|
|
|
__all__ = [
|
|
|
|
"roles",
|
|
|
|
"light_cones",
|
|
|
|
"roleToId",
|
|
|
|
"roleToName",
|
|
|
|
"idToRole",
|
|
|
|
"lightConeToName",
|
|
|
|
"lightConeToId",
|
|
|
|
"not_real_roles",
|
|
|
|
"roleToTag",
|
2023-05-22 14:32:37 +00:00
|
|
|
"lightConeToTag",
|
2023-05-11 15:09:39 +00:00
|
|
|
]
|
2022-09-17 16:28:51 +00:00
|
|
|
|
2022-08-28 14:37:31 +00:00
|
|
|
# noinspection SpellCheckingInspection
|
2022-07-26 10:07:31 +00:00
|
|
|
roles = {
|
2024-02-14 15:11:32 +00:00
|
|
|
8001: ["开拓者·毁灭", "物主"],
|
|
|
|
8002: ["开拓者·毁灭", "物主"],
|
|
|
|
8003: ["开拓者·存护", "火主"],
|
|
|
|
8004: ["开拓者·存护", "火主"],
|
2024-05-07 13:31:29 +00:00
|
|
|
8005: ["开拓者·同谐", "帽主"],
|
|
|
|
8006: ["开拓者·同谐", "帽主"],
|
2023-08-29 06:38:30 +00:00
|
|
|
1001: ["三月七", "mar7th", "三月", "小三月", "阿七", "冷面小粉龙", "纠缠之缘", "小仓唯", "xcw", "37"],
|
2023-05-19 15:15:15 +00:00
|
|
|
1002: ["丹恒", "danheng", "冷面小青龙", "闷葫芦"],
|
2024-02-14 15:11:32 +00:00
|
|
|
1003: ["姬子", "himeko", "姬子阿姐", "寄子", "姬子阿姨"],
|
|
|
|
1004: ["瓦尔特", "welt", "瓦尔特杨", "杨叔", "牧月忍冬", "约阿希姆诺基安维塔宁", "老杨", "瓦尔特·杨"],
|
|
|
|
1005: ["卡芙卡", "kafka", "卡夫卡", "妈", "妈妈", "卡妈"],
|
|
|
|
1006: ["银狼", "silverwolf", "ginrou", "小板鸭", "酷鸭", "超级骇客", "泡泡糖", "淫狼"],
|
2023-05-19 15:15:15 +00:00
|
|
|
1008: ["阿兰", "arlan"],
|
2024-02-14 15:11:32 +00:00
|
|
|
1009: ["艾丝妲", "asta", "艾斯坦", "艾斯妲", "富婆", "代理站长", "知名不具", "站长"],
|
2023-08-29 06:38:30 +00:00
|
|
|
1013: ["黑塔", "herta", "天才俱乐部#83", "天才俱乐部第83席", "天才俱乐部第八十三席", "黑塔女士", "转圈圈", "人偶"],
|
2024-03-16 10:43:20 +00:00
|
|
|
1101: [
|
|
|
|
"布洛妮娅",
|
|
|
|
"bronya",
|
|
|
|
"布洛妮亚",
|
|
|
|
"布洛尼亚",
|
|
|
|
"布洛妮娅兰德",
|
|
|
|
"兰德鸭",
|
|
|
|
"大板鸭",
|
|
|
|
"三涡轮增鸭",
|
|
|
|
"渡鸭",
|
|
|
|
"鸭鸭",
|
|
|
|
],
|
2023-05-19 15:15:15 +00:00
|
|
|
1102: ["希儿", "seele", "蝴蝶", "希尔"],
|
|
|
|
1103: ["希露瓦", "serval", "希露瓦朗道", "朗道家长女", "贝洛伯格机械师"],
|
2024-02-14 15:11:32 +00:00
|
|
|
1104: ["杰帕德", "gepard", "杰帕德朗道", "杰哥", "小杰杰", "盾哥"],
|
2023-05-19 15:15:15 +00:00
|
|
|
1105: ["娜塔莎", "natasha", "娜塔", "娜塔莎姐姐", "老巫婆"],
|
2023-08-29 06:38:30 +00:00
|
|
|
1106: ["佩拉", "pela", "佩拉格娅谢尔盖耶夫娜", "佩拉格娅", "谢尔盖耶夫娜", "冰砂糖"],
|
2024-02-14 15:11:32 +00:00
|
|
|
1107: ["克拉拉", "clara", "克啦啦", "猩红兔子", "天才侦探少女", "史瓦罗", "史瓦罗发射器"],
|
2023-05-19 15:15:15 +00:00
|
|
|
1108: ["桑博", "sampo", "桑博科斯基", "深蓝帅哥", "布鲁海尔波桑"],
|
2023-08-29 06:38:30 +00:00
|
|
|
1109: ["虎克", "hook", "胡克"],
|
2024-02-14 15:11:32 +00:00
|
|
|
1110: ["玲可", "lynx", "lingke", "林克"],
|
2024-02-07 15:55:46 +00:00
|
|
|
1111: ["卢卡", "luka", "铁臂卢卡", "熔锤镇的卢卡"],
|
2024-02-14 15:11:32 +00:00
|
|
|
1112: ["托帕&账账", "topaz", "托帕", "账账", "托帕女王", "托帕和账账", "账账启动器"],
|
|
|
|
1201: ["青雀", "qingque", "克莱茵", "雀", "我雀", "用牌玩命", "QQ"],
|
|
|
|
1202: ["停云", "tingyun", "屑狐狸", "骚狐狸", "停运", "停厶||"],
|
|
|
|
1203: ["罗刹", "luocha", "主教", "奥托"],
|
|
|
|
1204: ["景元", "jingyuan", "景元元", "云骑将军", "闭目将军", "将军"],
|
|
|
|
1205: ["刃", "blade", "阿刃", "点刀", "点刀哥", "刀哥", "笑面小黑龙"],
|
2023-05-19 15:15:15 +00:00
|
|
|
1206: ["素裳", "sushang", "李素裳", "李大枕头"],
|
2024-02-14 15:11:32 +00:00
|
|
|
1207: ["驭空", "yukong", "驭空大人", "星火之狐", "司舵"],
|
|
|
|
1208: ["符玄", "fuxuan", "typec", "太卜", "太卜大人"],
|
|
|
|
1209: ["彦卿", "yanqing", "马彦卿", "彦青", "老马", "燕青", "言情"],
|
|
|
|
1210: ["桂乃芬", "guinaifen", "主播"],
|
|
|
|
1211: ["白露", "bailu", "衔药龙女", "小龙女", "龙女", "我的饮月君", "白鹭"],
|
2023-10-10 11:37:53 +00:00
|
|
|
1212: ["镜流", "jingliu"],
|
2024-02-14 15:11:32 +00:00
|
|
|
1213: ["丹恒•饮月", "danhengil", "饮月君", "龙丹", "饮月", "丹恒·饮月"],
|
|
|
|
1214: ["雪衣", "xueyi", "下雪大衣"],
|
|
|
|
1215: ["寒鸦", "hanya", "寒冷乌鸦"],
|
|
|
|
1217: ["藿藿", "huohuo", "尾巴大爷", "霍霍", "尾巴小跟班"],
|
2024-07-30 08:48:43 +00:00
|
|
|
1218: ["椒丘", "jiaoqiu", "狐人", "军医"],
|
2024-09-09 15:32:15 +00:00
|
|
|
1220: ["飞霄", "feixiao", "天击将军", "三无将军"],
|
2024-07-30 08:48:43 +00:00
|
|
|
1221: ["云璃", "yunli"],
|
2024-09-09 15:32:15 +00:00
|
|
|
1222: ["灵砂", "lingsha"],
|
|
|
|
1223: ["貊泽", "moze", "影卫", "鸦羽怪人"],
|
2024-07-30 08:48:43 +00:00
|
|
|
1224: ["三月七", "mar7th", "新人剑士", "新三月七", "武侠少女"],
|
2024-03-27 02:45:20 +00:00
|
|
|
1301: ["加拉赫", "gallagher"],
|
2024-02-14 15:11:32 +00:00
|
|
|
1302: ["银枝", "argenti", "开捍", "开焊", "骑士"],
|
|
|
|
1303: ["阮•梅", "ruanmei", "阮·梅", "阮梅", "阮", "梅", "阮妈"],
|
2024-03-27 02:45:20 +00:00
|
|
|
1304: ["砂金", "aventurine"],
|
2024-02-14 15:11:32 +00:00
|
|
|
1305: ["真理医生", "drratio", "Dr.Ratio", "真理博士", "真理", "拉帝奥", "义父", "真理义父"],
|
|
|
|
1306: ["花火", "sparkle", "hanabi"],
|
|
|
|
1307: ["黑天鹅", "blackswan", "黑天", "天鹅"],
|
2024-03-27 02:45:20 +00:00
|
|
|
1308: ["黄泉", "acheron"],
|
2024-05-07 13:31:29 +00:00
|
|
|
1309: ["知更鸟", "robin"],
|
2024-06-18 05:28:19 +00:00
|
|
|
1310: ["流萤", "firefly"],
|
2024-02-05 05:13:40 +00:00
|
|
|
1312: ["米沙", "misha"],
|
2024-06-18 05:28:19 +00:00
|
|
|
1314: ["翡翠", "jade"],
|
2024-05-07 13:31:29 +00:00
|
|
|
1315: ["波提欧", "boothill"],
|
2022-07-26 10:07:31 +00:00
|
|
|
}
|
2024-10-02 14:49:59 +00:00
|
|
|
not_real_roles = []
|
2023-04-27 12:25:06 +00:00
|
|
|
light_cones = {
|
2023-05-11 15:09:39 +00:00
|
|
|
20000: ["锋镝"],
|
|
|
|
20001: ["物穰"],
|
|
|
|
20002: ["天倾"],
|
|
|
|
20003: ["琥珀"],
|
|
|
|
20004: ["幽邃"],
|
|
|
|
20005: ["齐颂"],
|
|
|
|
20006: ["智库"],
|
|
|
|
20007: ["离弦"],
|
|
|
|
20008: ["嘉果"],
|
|
|
|
20009: ["乐圮"],
|
|
|
|
20010: ["戍御"],
|
|
|
|
20011: ["渊环"],
|
|
|
|
20012: ["轮契"],
|
|
|
|
20013: ["灵钥"],
|
|
|
|
20014: ["相抗"],
|
|
|
|
20015: ["蕃息"],
|
|
|
|
20016: ["俱殁"],
|
|
|
|
20017: ["开疆"],
|
|
|
|
20018: ["匿影"],
|
|
|
|
20019: ["调和"],
|
|
|
|
20020: ["睿见"],
|
|
|
|
21000: ["一场术后对话"],
|
|
|
|
21001: ["晚安与睡颜"],
|
|
|
|
21002: ["余生的第一天"],
|
|
|
|
21003: ["唯有沉默"],
|
|
|
|
21004: ["记忆中的模样"],
|
|
|
|
21005: ["鼹鼠党欢迎你"],
|
|
|
|
21006: ["「我」的诞生"],
|
|
|
|
21007: ["同一种心情"],
|
|
|
|
21008: ["猎物的视线"],
|
|
|
|
21009: ["朗道的选择"],
|
|
|
|
21010: ["论剑"],
|
|
|
|
21011: ["与行星相会"],
|
|
|
|
21012: ["秘密誓心"],
|
|
|
|
21013: ["别让世界静下来"],
|
|
|
|
21014: ["此时恰好"],
|
|
|
|
21015: ["决心如汗珠般闪耀"],
|
|
|
|
21016: ["宇宙市场趋势"],
|
|
|
|
21017: ["点个关注吧!"],
|
|
|
|
21018: ["舞!舞!舞!"],
|
|
|
|
21019: ["在蓝天下"],
|
|
|
|
21020: ["天才们的休憩"],
|
|
|
|
21021: ["等价交换"],
|
|
|
|
21022: ["延长记号"],
|
|
|
|
21023: ["我们是地火"],
|
|
|
|
21024: ["春水初生"],
|
|
|
|
21025: ["过往未来"],
|
|
|
|
21026: ["汪!散步时间!"],
|
|
|
|
21027: ["早餐的仪式感"],
|
|
|
|
21028: ["暖夜不会漫长"],
|
|
|
|
21029: ["后会有期"],
|
|
|
|
21030: ["这就是我啦!"],
|
|
|
|
21031: ["重返幽冥"],
|
|
|
|
21032: ["镂月裁云之意"],
|
|
|
|
21033: ["无处可逃"],
|
|
|
|
21034: ["今日亦是和平的一日"],
|
2024-02-05 05:13:40 +00:00
|
|
|
21035: ["何物为真"],
|
|
|
|
21036: ["美梦小镇大冒险"],
|
|
|
|
21037: ["最后的赢家"],
|
|
|
|
21038: ["在火的远处"],
|
|
|
|
21039: ["织造命运之线"],
|
|
|
|
21040: ["银河沦陷日"],
|
|
|
|
21041: ["好戏开演"],
|
|
|
|
21042: ["铭记于心的约定"],
|
2024-03-27 02:45:20 +00:00
|
|
|
21043: ["两个人的演唱会"],
|
2024-05-07 13:31:29 +00:00
|
|
|
21044: ["无边曼舞"],
|
2024-06-18 05:28:19 +00:00
|
|
|
21045: ["谐乐静默之后"],
|
2024-07-30 08:48:43 +00:00
|
|
|
21046: ["芳华待灼"],
|
2024-09-09 15:32:15 +00:00
|
|
|
21047: ["黑夜如影随行"],
|
2023-06-28 02:58:53 +00:00
|
|
|
22000: ["新手任务开始前"],
|
2023-11-14 10:07:59 +00:00
|
|
|
22001: ["嘿,我在这儿"],
|
2024-05-07 13:31:29 +00:00
|
|
|
22002: ["为了明日的旅途"],
|
2023-05-11 15:09:39 +00:00
|
|
|
23000: ["银河铁道之夜"],
|
|
|
|
23001: ["于夜色中"],
|
|
|
|
23002: ["无可取代的东西"],
|
|
|
|
23003: ["但战斗还未结束"],
|
|
|
|
23004: ["以世界之名"],
|
|
|
|
23005: ["制胜的瞬间"],
|
2023-07-18 15:05:07 +00:00
|
|
|
23006: ["只需等待"],
|
2023-06-06 15:18:32 +00:00
|
|
|
23007: ["雨一直下"],
|
2023-06-28 02:58:53 +00:00
|
|
|
23008: ["棺的回响"],
|
2023-07-18 15:05:07 +00:00
|
|
|
23009: ["到不了的彼岸"],
|
2023-05-11 15:09:39 +00:00
|
|
|
23010: ["拂晓之前"],
|
2023-08-29 06:38:30 +00:00
|
|
|
23011: ["她已闭上双眼"],
|
2023-05-11 15:09:39 +00:00
|
|
|
23012: ["如泥酣眠"],
|
|
|
|
23013: ["时节不居"],
|
2023-10-10 11:37:53 +00:00
|
|
|
23014: ["此身为剑"],
|
2023-08-29 06:38:30 +00:00
|
|
|
23015: ["比阳光更明亮的"],
|
2023-10-10 11:37:53 +00:00
|
|
|
23016: ["烦恼着,幸福着"],
|
2023-11-14 10:07:59 +00:00
|
|
|
23017: ["惊魂夜"],
|
|
|
|
23018: ["片刻,留在眼底"],
|
2023-12-26 09:25:54 +00:00
|
|
|
23019: ["镜中故我"],
|
|
|
|
23020: ["纯粹思维的洗礼"],
|
2024-02-05 05:13:40 +00:00
|
|
|
23021: ["游戏尘寰"],
|
|
|
|
23022: ["重塑时光之忆"],
|
2024-03-27 02:45:20 +00:00
|
|
|
23023: ["命运从未公平"],
|
|
|
|
23024: ["行于流逝的岸"],
|
2024-06-18 05:28:19 +00:00
|
|
|
23025: ["梦应归于何处"],
|
2024-05-07 13:31:29 +00:00
|
|
|
23026: ["夜色流光溢彩"],
|
|
|
|
23027: ["驶向第二次生命"],
|
2024-06-18 05:28:19 +00:00
|
|
|
23028: ["偏偏希望无价"],
|
2024-07-30 08:48:43 +00:00
|
|
|
23029: ["那无数个春天"],
|
|
|
|
23030: ["落日时起舞"],
|
2024-09-09 15:32:15 +00:00
|
|
|
23031: ["我将,巡征追猎"],
|
|
|
|
23032: ["唯有香如故"],
|
2023-05-11 15:09:39 +00:00
|
|
|
24000: ["记一位星神的陨落"],
|
|
|
|
24001: ["星海巡航"],
|
|
|
|
24002: ["记忆的质料"],
|
2023-08-29 06:38:30 +00:00
|
|
|
24003: ["孤独的疗愈"],
|
2024-06-18 05:28:19 +00:00
|
|
|
24004: ["不息的演算"],
|
2022-07-26 10:07:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-09-17 16:28:51 +00:00
|
|
|
# noinspection PyPep8Naming
|
2022-10-10 03:37:58 +00:00
|
|
|
@functools.lru_cache()
|
2022-07-26 10:07:31 +00:00
|
|
|
def roleToName(shortname: str) -> str:
|
2022-10-10 06:16:14 +00:00
|
|
|
"""将角色昵称转为正式名"""
|
2022-12-24 04:49:51 +00:00
|
|
|
shortname = str.casefold(shortname) # 忽略大小写
|
2022-08-28 14:37:31 +00:00
|
|
|
return next((value[0] for value in roles.values() for name in value if name == shortname), shortname)
|
|
|
|
|
|
|
|
|
2022-09-17 16:28:51 +00:00
|
|
|
# noinspection PyPep8Naming
|
2022-10-10 03:37:58 +00:00
|
|
|
@functools.lru_cache()
|
2022-10-07 05:02:49 +00:00
|
|
|
def roleToId(name: str) -> int | None:
|
2022-08-28 14:37:31 +00:00
|
|
|
"""获取角色ID"""
|
2022-12-24 04:49:51 +00:00
|
|
|
name = str.casefold(name)
|
2022-08-28 14:37:31 +00:00
|
|
|
return next((key for key, value in roles.items() for n in value if n == name), None)
|
2022-07-26 10:07:31 +00:00
|
|
|
|
|
|
|
|
2023-05-11 15:09:39 +00:00
|
|
|
# noinspection PyPep8Naming
|
|
|
|
@functools.lru_cache()
|
|
|
|
def idToRole(aid: int) -> str | None:
|
|
|
|
"""获取角色名"""
|
|
|
|
return roles.get(aid, [None])[0]
|
|
|
|
|
|
|
|
|
2022-09-17 16:28:51 +00:00
|
|
|
# noinspection PyPep8Naming
|
2022-10-10 03:37:58 +00:00
|
|
|
@functools.lru_cache()
|
2023-04-27 12:25:06 +00:00
|
|
|
def lightConeToName(shortname: str) -> str:
|
|
|
|
"""将光锥昵称转为正式名"""
|
|
|
|
shortname = str.casefold(shortname) # 忽略大小写
|
|
|
|
return next((value[0] for value in light_cones.values() for name in value if name == shortname), shortname)
|
2022-10-07 05:02:49 +00:00
|
|
|
|
|
|
|
|
|
|
|
# noinspection PyPep8Naming
|
2022-10-10 03:37:58 +00:00
|
|
|
@functools.lru_cache()
|
2023-04-27 12:25:06 +00:00
|
|
|
def lightConeToId(name: str) -> int | None:
|
|
|
|
"""获取光锥ID"""
|
|
|
|
name = str.casefold(name)
|
|
|
|
return next((key for key, value in light_cones.items() for n in value if n == name), None)
|
2022-12-04 11:56:39 +00:00
|
|
|
|
|
|
|
|
|
|
|
# noinspection PyPep8Naming
|
|
|
|
@functools.lru_cache()
|
|
|
|
def roleToTag(role_name: str) -> List[str]:
|
|
|
|
"""通过角色名获取TAG"""
|
2022-12-24 04:49:51 +00:00
|
|
|
role_name = str.casefold(role_name)
|
2022-12-04 11:56:39 +00:00
|
|
|
return next((value for value in roles.values() if value[0] == role_name), [role_name])
|
2023-05-02 16:16:14 +00:00
|
|
|
|
|
|
|
|
|
|
|
@functools.lru_cache()
|
|
|
|
def lightConeToTag(name: str) -> List[str]:
|
|
|
|
"""通过光锥名获取TAG"""
|
|
|
|
name = str.casefold(name)
|
|
|
|
return next((value for value in light_cones.values() if value[0] == name), [name])
|