diff --git a/OlivaDiceCore/data.py b/OlivaDiceCore/data.py index 7cae71f..396590e 100644 --- a/OlivaDiceCore/data.py +++ b/OlivaDiceCore/data.py @@ -18,7 +18,7 @@ import platform import os -OlivaDiceCore_ver = '3.0.1' +OlivaDiceCore_ver = '3.0.5' exce_path = os.getcwd() diff --git a/OlivaDiceCore/drawCardData.py b/OlivaDiceCore/drawCardData.py index 5099f3e..3b6213c 100644 --- a/OlivaDiceCore/drawCardData.py +++ b/OlivaDiceCore/drawCardData.py @@ -650,28 +650,28 @@ ], '即时症状': [ - '1) 失忆 :调查员会发现自己只记得最后身处的安全地点,却没有任何来到这里的记忆。例如,调查员前一刻还在家中吃着早饭,下一刻就已经直面着不知名的怪物。这将会持续[1d10]轮。', - '2) 假性残疾 :调查员陷入了心理性的失明、失聪或躯体缺失感中,持续[1d10]轮。', '3) 暴力倾向 :调查员陷入了六亲不认的暴力行为中,对周围的敌人与友方进行着无差别的攻击,持续[1d10]轮。', - '4) 偏执:调查员陷入了严重的偏执妄想之中,持续[1d10]轮。有人在暗中窥视着他们,同伴中有人背叛了他们,没有人可以信任,万事皆虚。', - '5) 人际依赖:守秘人适当参考调查员的背景中重要之人的条目,调查员因为一些原因而将他人误认为了他重要的人并且努力的会与那个人保持那种关系,持续[1d10]轮', - '6) 昏厥:调查员当场昏倒,并需要[1d10]轮才能苏醒。.', - '7) 逃避行为:调查员会用任何的手段试图逃离现在所处的位置,即使这意味着开走唯一一辆交通工具并将其它人抛诸脑后,调查员会试图逃离[1d10]轮。', - '8) 竭嘶底里:调查员表现出大笑,哭泣,嘶吼,害怕等的极端情绪表现,持续[1d10]轮。', - '9) 恐惧:由守秘人选择一个或:\n{恐惧症状}\n就算这一恐惧的事物是并不存在的,调查员的症状会持续[1d10]轮。', - '10) 狂躁 :由守秘人选择一个或:\n{狂躁症状}\n这个症状将会持续[1d10]轮。' + '1) 失忆 :调查员会发现自己只记得最后身处的安全地点,却没有任何来到这里的记忆。例如,调查员前一刻还在家中吃着早饭,下一刻就已经直面着不知名的怪物。这将会持续1D10=[1d10]轮。', + '2) 假性残疾 :调查员陷入了心理性的失明、失聪或躯体缺失感中,持续1D10=[1d10]轮。', '3) 暴力倾向 :调查员陷入了六亲不认的暴力行为中,对周围的敌人与友方进行着无差别的攻击,持续1D10=[1d10]轮。', + '4) 偏执:调查员陷入了严重的偏执妄想之中,持续1D10=[1d10]轮。有人在暗中窥视着他们,同伴中有人背叛了他们,没有人可以信任,万事皆虚。', + '5) 人际依赖:守秘人适当参考调查员的背景中重要之人的条目,调查员因为一些原因而将他人误认为了他重要的人并且努力的会与那个人保持那种关系,持续1D10=[1d10]轮', + '6) 昏厥:调查员当场昏倒,并需要1D10=[1d10]轮才能苏醒。.', + '7) 逃避行为:调查员会用任何的手段试图逃离现在所处的位置,即使这意味着开走唯一一辆交通工具并将其它人抛诸脑后,调查员会试图逃离1D10=[1d10]轮。', + '8) 竭嘶底里:调查员表现出大笑,哭泣,嘶吼,害怕等的极端情绪表现,持续1D10=[1d10]轮。', + '9) 恐惧:由守秘人选择一个或:\n{恐惧症状}\n就算这一恐惧的事物是并不存在的,调查员的症状会持续1D10=[1d10]轮。', + '10) 狂躁 :由守秘人选择一个或:\n{狂躁症状}\n这个症状将会持续1D10=[1d10]轮。' ], '总结症状': [ '1) 失忆(Amnesia):回过神来,调查员们发现自己身处一个陌生的地方,并忘记了自己是谁。记忆会随时间恢复。', - '2) 被窃(Robbed):调查员在[1d10]小时后恢复清醒,发觉自己被盗,身体毫发无损。如果调查员携带着宝贵之物(见调查员背景),做幸运检定来决定其是否被盗。所有有价值的东西无需检定自动消失。', - '3) 遍体鳞伤(Battered):调查员在[1d10]小时后恢复清醒,发现自己身上满是拳痕和瘀伤。生命值减少到疯狂前的一半,但这不会造成重伤。调查员没有被窃。这种伤害如何持续到现在由守秘人决定。', + '2) 被窃(Robbed):调查员在1D10=[1d10]小时后恢复清醒,发觉自己被盗,身体毫发无损。如果调查员携带着宝贵之物(见调查员背景),做幸运检定来决定其是否被盗。所有有价值的东西无需检定自动消失。', + '3) 遍体鳞伤(Battered):调查员在1D10=[1d10]小时后恢复清醒,发现自己身上满是拳痕和瘀伤。生命值减少到疯狂前的一半,但这不会造成重伤。调查员没有被窃。这种伤害如何持续到现在由守秘人决定。', '4) 暴力倾向(Violence):调查员陷入强烈的暴力与破坏欲之中。调查员回过神来可能会理解自己做了什么也可能毫无印象。调查员对谁或何物施以暴力,他们是杀人还是仅仅造成了伤害,由守秘人决定。', '5) 极端信念(Ideology/Beliefs):查看调查员背景中的思想信念,调查员会采取极端和疯狂的表现手段展示他们的思想信念之一。比如一个信教者会在地铁上高声布道。', - '6) 重要之人(Significant People):考虑调查员背景中的重要之人,及其重要的原因。在[1d10]小时或更久的时间中,调查员将不顾一切地接近那个人,并为他们之间的关系做出行动。', + '6) 重要之人(Significant People):考虑调查员背景中的重要之人,及其重要的原因。在1D10=[1d10]小时或更久的时间中,调查员将不顾一切地接近那个人,并为他们之间的关系做出行动。', '7) 被收容(Institutionalized):调查员在精神病院病房或警察局牢房中回过神来,他们可能会慢慢回想起导致自己被关在这里的事情。', '8) 逃避行为(Flee in panic):调查员恢复清醒时发现自己在很远的地方,也许迷失在荒郊野岭,或是在驶向远方的列车或长途汽车上。', - '9) 恐惧(Phobia):调查员患上一个新的恐惧症。由守秘人选择一个或:\n{恐惧症状}\n调查员在[1d10]小时后回过神来,并开始为避开恐惧源而采取任何措施。', - '10) 狂躁(Mania):调查员患上一个新的狂躁症。由守秘人选择一个或:\n{狂躁症状}\n调查员会在[1d10]小时后恢复理智。在这次疯狂发作中,调查员将完全沉浸于其新的狂躁症状。这症状是否会表现给旁人则取决于守秘人和此调查员。' + '9) 恐惧(Phobia):调查员患上一个新的恐惧症。由守秘人选择一个或:\n{恐惧症状}\n调查员在1D10=[1d10]小时后回过神来,并开始为避开恐惧源而采取任何措施。', + '10) 狂躁(Mania):调查员患上一个新的狂躁症。由守秘人选择一个或:\n{狂躁症状}\n调查员会在1D10=[1d10]小时后恢复理智。在这次疯狂发作中,调查员将完全沉浸于其新的狂躁症状。这症状是否会表现给旁人则取决于守秘人和此调查员。' ], '恐惧症状': [ '1) 洗澡恐惧症(Ablutophobia):对于洗涤或洗澡的恐惧。', '2) 恐高症(Acrophobia):对于身处高处的恐惧。', '3) 飞行恐惧症(Aerophobia):对飞行的恐惧。', diff --git a/OlivaDiceCore/helpDocData.py b/OlivaDiceCore/helpDocData.py index cac2fb1..727fedf 100644 --- a/OlivaDiceCore/helpDocData.py +++ b/OlivaDiceCore/helpDocData.py @@ -33,6 +33,10 @@ 青果核心用户群:661366095''', '更新': '''[OlivaDiceCore] +3.0.5: 固化版本 +3.0.4: 细化指令 +3.0.3: 优化控制流 +3.0.2: 对接频道 3.0.1: 审核模式 3.0.0: 基础版本实现''', @@ -47,7 +51,9 @@ .nn 设置人物卡名称 .r 掷骰 .ra 检定 -.sc 理智检定''', +.sc 理智检定 +.ti/li 临时/总结症状 +.name 随机名称''', '链接': '''查看源码: https://github.com/OlivOS-Team/OlivaDiceCore OneDice标准: https://github.com/OlivOS-Team/onedice @@ -79,23 +85,33 @@ .st temp [人物卡模版名] 切换人物卡模版 默认可选:COC7,DND,FATE .st rule [人物卡模版规则名] 切换人物卡规则 -.st del [人物卡模版名] 删除人物卡''', +更多请使用[.help 人物卡模板]进行查看 +.st del [人物卡名] 删除人物卡''', 'r': '''通用掷骰指令 .r [掷骰表达式] [理由] 掷骰子 .rh [掷骰表达式] [理由] 掷暗骰 +.r[次数]#[掷骰表达式] [理由] 多轮掷骰 表达式支持OneDice标准: https://github.com/OlivOS-Team/onedice''', 'ra': '''检定指令 .ra [技能名] [技能值] 技能检定 -.rah [技能名] [技能值] 暗技能检定''', +.rah [技能名] [技能值] 暗技能检定 +.ra[次数]#[技能名] [技能值] 多轮检定 +.ra(b/p)[技能名] [技能值] 奖惩检定''', + 'sc': '''理智检定 .sc [成功表达式]/[失败表达式] [san值] 理智检定''', + '疯狂症状': '''疯狂症状: +.ti 临时疯狂症状 +.li 总结疯狂症状''', + 'nn': '''命名 -.nn [新人物卡名] 重命名人物卡''', +.nn [新人物卡名] 重命名人物卡 +当与已有其它人物卡重名时,将覆盖旧卡''', 'coc': '''人物作成 .coc [数量] COC7人物作成''', @@ -104,8 +120,44 @@ .draw [牌堆名称] 抽牌堆 .drawh [牌堆名称] 暗抽牌堆''', - - + '人物卡模板': '''1、为自己的人物卡指定COC模版(目前可选为COC7,DND5E,FATE) +指令: [.st temp COC7] +2、为自己的人物卡指定COC模版下的规则 +指令: [.st rule C2] + +其中[COC7]可选参数如下: +[default] +等同C3 +[C0] +出1大成功 +不满50出96 - 100大失败,满50出100大失败 +[C1] +不满50出1大成功,满50出1 - 5大成功 +不满50出96 - 100大失败,满50出100大失败 +[C2] +出1 - 5且 <= 成功率大成功 +出100或出96 - 99且 > 成功率大失败 +[C3] +出1 - 5大成功 +出96 - 100大失败 +[C4] +出1 - 5且 <= 十分之一大成功 +不满50出 >= 96 + 十分之一大失败,满50出100大失败 +[C5] +出1 - 2且 < 五分之一大成功 +不满50出96 - 100大失败,满50出99 - 100大失败 +[DeltaGreen] +绿色三角洲规则书''', + + + 'name': '''随机姓名: +.name (cn/jp/en/enzh) + 后接cn/jp/en/enzh则限定生成中文/日文/英文/英文中译名''', + + + 'rc': '&ra', + 'ti': '&疯狂症状', + 'li': '&疯狂症状', 'help': '&default', '帮助': '&default', '掷骰': '&r', diff --git a/OlivaDiceCore/msgCustom.py b/OlivaDiceCore/msgCustom.py index d170cec..b7fb2bb 100644 --- a/OlivaDiceCore/msgCustom.py +++ b/OlivaDiceCore/msgCustom.py @@ -20,6 +20,7 @@ dictStrCustomDict = {} dictStrCustom = { + 'strNeedMaster': '需要Master权限', 'strHello': '欢迎使用本机器人! 请使用[.help]查看帮助', 'strBot': '欢迎使用本机器人! 请使用[.help]查看帮助', 'strBotExit': '即将退出本群', @@ -36,9 +37,17 @@ 'strBotAlreadyOn' : '已经处于开启状态', 'strBotOff' : '关闭成功', 'strBotAlreadyOff' : '已经处于关闭状态', + 'strBotNotUnderHost' : '无所属主频道', + 'strBotHostOn' : '本主频道进入默认开启模式', + 'strBotAlreadyHostOn' : '本主频道已经处于默认开启模式', + 'strBotHostOff' : '本主频道进入默认关闭模式', + 'strBotAlreadyHostOff' : '本主频道已经处于默认关闭模式', 'strHelpDoc' : '已为你找到以下以下条目:\n{tHelpDocResult}', 'strHelpDocRecommend' : '已为你找到以下以下相似条目:\n{tHelpDocResult}', 'strHelpDocNotFound' : '未找到匹配条目', + 'strDrawTi' : '[{tName}]疯狂发作-临时症状:\n{tResult}', + 'strDrawLi' : '[{tName}]疯狂发作-总结症状:\n{tResult}', + 'strDrawName' : '[{tName}]的随机名称:\n{tResult}', 'strDrawDeck' : '你抽到了:\n{tDrawDeckResult}', 'strDrawDeckHideShow' : '[{tName}]进行了暗抽牌', 'strDrawDeckNotFound' : '牌堆未找到', diff --git a/OlivaDiceCore/msgReply.py b/OlivaDiceCore/msgReply.py index 4abc3f0..1e75430 100644 --- a/OlivaDiceCore/msgReply.py +++ b/OlivaDiceCore/msgReply.py @@ -88,12 +88,17 @@ def unity_reply(plugin_event, Proc): dictTValue.update(dictGValue) tmp_at_str = OlivOS.messageAPI.PARA.at(plugin_event.base_info['self_id']).CQ() + tmp_at_str_sub = None + if 'sub_self_id' in plugin_event.data.extend: + if plugin_event.data.extend['sub_self_id'] != None: + tmp_at_str_sub = OlivOS.messageAPI.PARA.at(plugin_event.data.extend['sub_self_id']).CQ() tmp_command_str_1 = '.' tmp_command_str_2 = '。' tmp_command_str_3 = '/' tmp_reast_str = plugin_event.data.message flag_force_reply = False flag_is_command = False + flag_is_from_host = False flag_is_from_group = False flag_is_from_group_admin = False flag_is_from_group_have_admin = False @@ -109,6 +114,11 @@ def unity_reply(plugin_event, Proc): tmp_reast_str = getMatchWordStartRight(tmp_reast_str, tmp_at_str) tmp_reast_str = skipSpaceStart(tmp_reast_str) flag_force_reply = True + if tmp_at_str_sub != None: + if isMatchWordStart(tmp_reast_str, tmp_at_str_sub): + tmp_reast_str = getMatchWordStartRight(tmp_reast_str, tmp_at_str_sub) + tmp_reast_str = skipSpaceStart(tmp_reast_str) + flag_force_reply = True if isMatchWordStart(tmp_reast_str, tmp_command_str_1): tmp_reast_str = getMatchWordStartRight(tmp_reast_str, tmp_command_str_1) flag_is_command = True @@ -129,10 +139,18 @@ def unity_reply(plugin_event, Proc): ) ) if plugin_event.plugin_info['func_type'] == 'group_message': - tmp_list_hit = [ - [plugin_event.data.group_id, 'group', plugin_event.platform['platform']], - [plugin_event.data.user_id, 'user', plugin_event.platform['platform']] - ] + if plugin_event.data.host_id != None: + tmp_list_hit = [ + [plugin_event.data.host_id, 'host', plugin_event.platform['platform']], + [plugin_event.data.group_id, 'group', plugin_event.platform['platform']], + [plugin_event.data.user_id, 'user', plugin_event.platform['platform']] + ] + flag_is_from_host = True + else: + tmp_list_hit = [ + [plugin_event.data.group_id, 'group', plugin_event.platform['platform']], + [plugin_event.data.user_id, 'user', plugin_event.platform['platform']] + ] flag_is_from_group = True elif plugin_event.plugin_info['func_type'] == 'private_message': tmp_list_hit = [ @@ -145,15 +163,42 @@ def unity_reply(plugin_event, Proc): if plugin_event.data.sender['role'] in ['owner', 'admin']: flag_is_from_group_admin = True OlivaDiceCore.userConfig.releaseUnityMsgCount(tmp_list_hit, plugin_event.bot_info.hash) - flag_groupEnable = True - if flag_is_from_group: - flag_groupEnable = OlivaDiceCore.userConfig.getUserConfigByKey( - userId = plugin_event.data.group_id, - userType = 'group', + flag_hostEnable = True + if flag_is_from_host: + flag_hostEnable = OlivaDiceCore.userConfig.getUserConfigByKey( + userId = plugin_event.data.host_id, + userType = 'host', platform = plugin_event.platform['platform'], - userConfigKey = 'groupEnable', + userConfigKey = 'hostEnable', botHash = plugin_event.bot_info.hash ) + flag_groupEnable = True + if flag_is_from_group: + if flag_is_from_host: + if flag_hostEnable: + flag_groupEnable = OlivaDiceCore.userConfig.getUserConfigByKey( + userId = plugin_event.data.group_id, + userType = 'group', + platform = plugin_event.platform['platform'], + userConfigKey = 'groupEnable', + botHash = plugin_event.bot_info.hash + ) + else: + flag_groupEnable = OlivaDiceCore.userConfig.getUserConfigByKey( + userId = plugin_event.data.group_id, + userType = 'group', + platform = plugin_event.platform['platform'], + userConfigKey = 'groupWithHostEnable', + botHash = plugin_event.bot_info.hash + ) + else: + flag_groupEnable = OlivaDiceCore.userConfig.getUserConfigByKey( + userId = plugin_event.data.group_id, + userType = 'group', + platform = plugin_event.platform['platform'], + userConfigKey = 'groupEnable', + botHash = plugin_event.bot_info.hash + ) if flag_is_from_master: if isMatchWordStart(tmp_reast_str, 'master'): tmp_reast_str = getMatchWordStartRight(tmp_reast_str, 'master') @@ -182,6 +227,65 @@ def unity_reply(plugin_event, Proc): replyMsg(plugin_event, tmp_reply_str) time.sleep(1) plugin_event.set_group_add_request(tmp_flag, 'invite', True, '') + elif isMatchWordStart(tmp_reast_str, 'host'): + tmp_reast_str = getMatchWordStartRight(tmp_reast_str, 'host') + tmp_reast_str = skipSpaceStart(tmp_reast_str) + if isMatchWordStart(tmp_reast_str, 'on'): + tmp_reast_str = getMatchWordStartRight(tmp_reast_str, 'on') + tmp_reast_str = skipSpaceStart(tmp_reast_str) + if flag_is_from_host: + if flag_hostEnable != True: + OlivaDiceCore.userConfig.setUserConfigByKey( + userConfigKey = 'hostEnable', + userConfigValue = True, + botHash = plugin_event.bot_info.hash, + userId = plugin_event.data.host_id, + userType = 'host', + platform = plugin_event.platform['platform'] + ) + OlivaDiceCore.userConfig.writeUserConfigByUserHash( + userHash = OlivaDiceCore.userConfig.getUserHash( + userId = plugin_event.data.group_id, + userType = 'group', + platform = plugin_event.platform['platform'] + ) + ) + tmp_reply_str = dictStrCustom['strBotHostOn'].format(**dictTValue) + else: + tmp_reply_str = dictStrCustom['strBotAlreadyHostOn'].format(**dictTValue) + replyMsg(plugin_event, tmp_reply_str) + else: + tmp_reply_str = dictStrCustom['strBotNotUnderHost'].format(**dictTValue) + replyMsg(plugin_event, tmp_reply_str) + return + elif isMatchWordStart(tmp_reast_str, 'off'): + tmp_reast_str = getMatchWordStartRight(tmp_reast_str, 'off') + tmp_reast_str = skipSpaceStart(tmp_reast_str) + if flag_is_from_host: + if flag_hostEnable != False: + OlivaDiceCore.userConfig.setUserConfigByKey( + userConfigKey = 'hostEnable', + userConfigValue = False, + botHash = plugin_event.bot_info.hash, + userId = plugin_event.data.host_id, + userType = 'host', + platform = plugin_event.platform['platform'] + ) + OlivaDiceCore.userConfig.writeUserConfigByUserHash( + userHash = OlivaDiceCore.userConfig.getUserHash( + userId = plugin_event.data.group_id, + userType = 'group', + platform = plugin_event.platform['platform'] + ) + ) + tmp_reply_str = dictStrCustom['strBotHostOff'].format(**dictTValue) + else: + tmp_reply_str = dictStrCustom['strBotAlreadyHostOff'].format(**dictTValue) + replyMsg(plugin_event, tmp_reply_str) + else: + tmp_reply_str = dictStrCustom['strBotNotUnderHost'].format(**dictTValue) + replyMsg(plugin_event, tmp_reply_str) + return return if isMatchWordStart(tmp_reast_str, 'bot'): tmp_reast_str = getMatchWordStartRight(tmp_reast_str, 'bot') @@ -190,14 +294,39 @@ def unity_reply(plugin_event, Proc): if flag_is_from_group: if flag_is_from_group_have_admin and flag_is_from_group_admin or not flag_is_from_group_have_admin: if flag_groupEnable != True: - OlivaDiceCore.userConfig.setUserConfigByKey( - userConfigKey = 'groupEnable', - userConfigValue = True, - botHash = plugin_event.bot_info.hash, - userId = plugin_event.data.group_id, - userType = 'group', - platform = plugin_event.platform['platform'] - ) + if flag_is_from_host: + if flag_hostEnable: + OlivaDiceCore.userConfig.setUserConfigByKey( + userConfigKey = 'groupEnable', + userConfigValue = True, + botHash = plugin_event.bot_info.hash, + userId = plugin_event.data.group_id, + userType = 'group', + platform = plugin_event.platform['platform'] + ) + else: + if flag_is_from_master: + OlivaDiceCore.userConfig.setUserConfigByKey( + userConfigKey = 'groupWithHostEnable', + userConfigValue = True, + botHash = plugin_event.bot_info.hash, + userId = plugin_event.data.group_id, + userType = 'group', + platform = plugin_event.platform['platform'] + ) + else: + tmp_reply_str = dictStrCustom['strNeedMaster'].format(**dictTValue) + replyMsg(plugin_event, tmp_reply_str) + return + else: + OlivaDiceCore.userConfig.setUserConfigByKey( + userConfigKey = 'groupEnable', + userConfigValue = True, + botHash = plugin_event.bot_info.hash, + userId = plugin_event.data.group_id, + userType = 'group', + platform = plugin_event.platform['platform'] + ) OlivaDiceCore.userConfig.writeUserConfigByUserHash( userHash = OlivaDiceCore.userConfig.getUserHash( userId = plugin_event.data.group_id, @@ -214,14 +343,39 @@ def unity_reply(plugin_event, Proc): if flag_is_from_group: if flag_is_from_group_have_admin and flag_is_from_group_admin or not flag_is_from_group_have_admin: if flag_groupEnable != False: - OlivaDiceCore.userConfig.setUserConfigByKey( - userConfigKey = 'groupEnable', - userConfigValue = False, - botHash = plugin_event.bot_info.hash, - userId = plugin_event.data.group_id, - userType = 'group', - platform = plugin_event.platform['platform'] - ) + if flag_is_from_host: + if flag_hostEnable: + OlivaDiceCore.userConfig.setUserConfigByKey( + userConfigKey = 'groupEnable', + userConfigValue = False, + botHash = plugin_event.bot_info.hash, + userId = plugin_event.data.group_id, + userType = 'group', + platform = plugin_event.platform['platform'] + ) + else: + if flag_is_from_master: + OlivaDiceCore.userConfig.setUserConfigByKey( + userConfigKey = 'groupWithHostEnable', + userConfigValue = False, + botHash = plugin_event.bot_info.hash, + userId = plugin_event.data.group_id, + userType = 'group', + platform = plugin_event.platform['platform'] + ) + else: + tmp_reply_str = dictStrCustom['strNeedMaster'].format(**dictTValue) + replyMsg(plugin_event, tmp_reply_str) + return + else: + OlivaDiceCore.userConfig.setUserConfigByKey( + userConfigKey = 'groupEnable', + userConfigValue = False, + botHash = plugin_event.bot_info.hash, + userId = plugin_event.data.group_id, + userType = 'group', + platform = plugin_event.platform['platform'] + ) OlivaDiceCore.userConfig.writeUserConfigByUserHash( userHash = OlivaDiceCore.userConfig.getUserHash( userId = plugin_event.data.group_id, @@ -292,6 +446,27 @@ def unity_reply(plugin_event, Proc): if tmp_reply_str != None: replyMsg(plugin_event, tmp_reply_str) return + elif isMatchWordStart(tmp_reast_str, 'ti'): + dictTValue['tResult'] = OlivaDiceCore.drawCard.getDrawDeck('即时症状', plugin_event.bot_info.hash) + tmp_reply_str = dictStrCustom['strDrawTi'].format(**dictTValue) + replyMsg(plugin_event, tmp_reply_str) + return + elif isMatchWordStart(tmp_reast_str, 'li'): + dictTValue['tResult'] = OlivaDiceCore.drawCard.getDrawDeck('总结症状', plugin_event.bot_info.hash) + tmp_reply_str = dictStrCustom['strDrawLi'].format(**dictTValue) + replyMsg(plugin_event, tmp_reply_str) + return + elif isMatchWordStart(tmp_reast_str, 'name'): + tmp_reast_str = getMatchWordStartRight(tmp_reast_str, 'name') + tmp_reast_str = skipSpaceStart(tmp_reast_str) + tmp_reast_str = tmp_reast_str.rstrip(' ') + if tmp_reast_str in ['cn', 'jp', 'en', 'enzh']: + dictTValue['tResult'] = OlivaDiceCore.drawCard.getDrawDeck('随机姓名_%s' % tmp_reast_str, plugin_event.bot_info.hash) + else: + dictTValue['tResult'] = OlivaDiceCore.drawCard.getDrawDeck('随机姓名', plugin_event.bot_info.hash) + tmp_reply_str = dictStrCustom['strDrawName'].format(**dictTValue) + replyMsg(plugin_event, tmp_reply_str) + return elif isMatchWordStart(tmp_reast_str, 'nn'): tmp_reast_str = getMatchWordStartRight(tmp_reast_str, 'nn') tmp_reast_str = skipSpaceStart(tmp_reast_str) @@ -850,6 +1025,7 @@ def unity_reply(plugin_event, Proc): tmp_pc_platform = plugin_event.platform['platform'] tmp_reply_str = '' tmp_reply_str_show = '' + roll_times_count = 1 if isMatchWordStart(tmp_reast_str, 'ra'): tmp_reast_str = getMatchWordStartRight(tmp_reast_str, 'ra') elif isMatchWordStart(tmp_reast_str, 'rc'): @@ -864,6 +1040,36 @@ def unity_reply(plugin_event, Proc): flag_hide_roll = True tmp_reast_str = getMatchWordStartRight(tmp_reast_str, 'h') tmp_reast_str = skipSpaceStart(tmp_reast_str) + if len(tmp_reast_str) > 2: + tmp_reast_str_list_1 = tmp_reast_str.split('#') + if len(tmp_reast_str_list_1) > 1: + if tmp_reast_str_list_1[0].isdigit(): + roll_times_count = int(tmp_reast_str_list_1[0]) + if roll_times_count > 10: + roll_times_count = 10 + tmp_reast_str = tmp_reast_str_list_1[1] + # 0 + # 1 b + # 2 p + flag_bp_type = 0 + flag_bp_count = None + if len(tmp_reast_str) > 0: + if isMatchWordStart(tmp_reast_str, 'b'): + flag_bp_type = 1 + tmp_reast_str = getMatchWordStartRight(tmp_reast_str, 'b') + elif isMatchWordStart(tmp_reast_str, 'B'): + flag_bp_type = 1 + tmp_reast_str = getMatchWordStartRight(tmp_reast_str, 'B') + elif isMatchWordStart(tmp_reast_str, 'p'): + flag_bp_type = 2 + tmp_reast_str = getMatchWordStartRight(tmp_reast_str, 'p') + elif isMatchWordStart(tmp_reast_str, 'P'): + flag_bp_type = 2 + tmp_reast_str = getMatchWordStartRight(tmp_reast_str, 'P') + if flag_bp_type != 0 and len(tmp_reast_str) > 1: + if tmp_reast_str[0].isdigit(): + flag_bp_count = tmp_reast_str[0] + tmp_reast_str = tmp_reast_str[1:] if len(tmp_reast_str) > 0: [tmp_skill_name, tmp_reast_str] = getToNumberPara(tmp_reast_str) tmp_reast_str = skipSpaceStart(tmp_reast_str) @@ -922,61 +1128,137 @@ def unity_reply(plugin_event, Proc): if tmp_Template != None: if 'mainDice' in tmp_Template: rd_para_str = tmp_Template['mainDice'] - rd_para = OlivaDiceCore.onedice.RD(rd_para_str) - rd_para.roll() - if rd_para.resError == None: - if rd_para.resDetail == None or rd_para.resDetail == '': - dictTValue['tRollResult'] = '%s=%d' % (rd_para_str, rd_para.resInt) - else: - dictTValue['tRollResult'] = '%s=%s=%d' % (rd_para_str, rd_para.resDetail, rd_para.resInt) - dictTValue['tSkillValue'] = str(tmp_skill_value) - dictRuleTempData = { - 'roll': rd_para.resInt, - 'skill': tmp_skill_value - } - tmpSkillCheckType = OlivaDiceCore.skillCheck.getSkillCheckByTemplate( - dictRuleTempData, - tmp_Template, - tmp_TemplateRuleName - ) - if tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_SUCCESS: - dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckSucceed'] - elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_HARD_SUCCESS: - dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckHardSucceed'] - elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_EXTREME_HARD_SUCCESS: - dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckExtremeHardSucceed'] - elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_GREAT_SUCCESS: - dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckGreatSucceed'] - elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FAIL: - dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFailed'] - elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_GREAT_FAIL: - dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckGreatFailed'] - elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_01: - dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate01'] - elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_02: - dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate02'] - elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_03: - dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate03'] - elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_04: - dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate04'] - elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_05: - dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate05'] - elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_06: - dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate06'] - elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_07: - dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate07'] - elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_08: - dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate08'] - elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_09: - dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate09'] - elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_10: - dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate10'] - elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_11: - dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate11'] - elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_NOPE: - dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckNope'] - else: - dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckError'] + if flag_bp_type == 1: + rd_para_str = 'B' + elif flag_bp_type == 2: + rd_para_str = 'P' + if flag_bp_count != None: + rd_para_str += flag_bp_count + flag_need_reply = False + if roll_times_count == 1: + rd_para = OlivaDiceCore.onedice.RD(rd_para_str) + rd_para.roll() + if rd_para.resError == None: + if rd_para.resDetail == None or rd_para.resDetail == '': + dictTValue['tRollResult'] = '%s=%d' % (rd_para_str, rd_para.resInt) + else: + dictTValue['tRollResult'] = '%s=%s=%d' % (rd_para_str, rd_para.resDetail, rd_para.resInt) + dictTValue['tSkillValue'] = str(tmp_skill_value) + dictRuleTempData = { + 'roll': rd_para.resInt, + 'skill': tmp_skill_value + } + tmpSkillCheckType = OlivaDiceCore.skillCheck.getSkillCheckByTemplate( + dictRuleTempData, + tmp_Template, + tmp_TemplateRuleName + ) + if tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_SUCCESS: + dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckSucceed'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_HARD_SUCCESS: + dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckHardSucceed'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_EXTREME_HARD_SUCCESS: + dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckExtremeHardSucceed'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_GREAT_SUCCESS: + dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckGreatSucceed'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FAIL: + dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFailed'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_GREAT_FAIL: + dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckGreatFailed'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_01: + dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate01'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_02: + dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate02'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_03: + dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate03'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_04: + dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate04'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_05: + dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate05'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_06: + dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate06'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_07: + dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate07'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_08: + dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate08'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_09: + dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate09'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_10: + dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate10'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_11: + dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckFate11'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_NOPE: + dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckNope'] + else: + dictTValue['tSkillCheckReasult'] = dictStrCustom['strPcSkillCheckError'] + flag_need_reply = True + else: + flag_begin = True + tmp_tSkillCheckReasult = '' + for i in range(roll_times_count): + rd_para = OlivaDiceCore.onedice.RD(rd_para_str) + rd_para.roll() + if rd_para.resError == None: + tmp_tSkillCheckReasult += '\n' + if flag_bp_type == 0: + tmp_tSkillCheckReasult += '%s=%d ' % (rd_para_str, rd_para.resInt) + else: + tmp_tSkillCheckReasult += '%s=%s=%d ' % (rd_para_str, rd_para.resDetail, rd_para.resInt) + dictTValue['tSkillValue'] = str(tmp_skill_value) + dictRuleTempData = { + 'roll': rd_para.resInt, + 'skill': tmp_skill_value + } + tmpSkillCheckType = OlivaDiceCore.skillCheck.getSkillCheckByTemplate( + dictRuleTempData, + tmp_Template, + tmp_TemplateRuleName + ) + if tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_SUCCESS: + tmp_tSkillCheckReasult += dictStrCustom['strPcSkillCheckSucceed'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_HARD_SUCCESS: + tmp_tSkillCheckReasult += dictStrCustom['strPcSkillCheckHardSucceed'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_EXTREME_HARD_SUCCESS: + tmp_tSkillCheckReasult += dictStrCustom['strPcSkillCheckExtremeHardSucceed'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_GREAT_SUCCESS: + tmp_tSkillCheckReasult += dictStrCustom['strPcSkillCheckGreatSucceed'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FAIL: + tmp_tSkillCheckReasult += dictStrCustom['strPcSkillCheckFailed'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_GREAT_FAIL: + tmp_tSkillCheckReasult += dictStrCustom['strPcSkillCheckGreatFailed'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_01: + tmp_tSkillCheckReasult += dictStrCustom['strPcSkillCheckFate01'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_02: + tmp_tSkillCheckReasult += dictStrCustom['strPcSkillCheckFate02'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_03: + tmp_tSkillCheckReasult += dictStrCustom['strPcSkillCheckFate03'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_04: + tmp_tSkillCheckReasult += dictStrCustom['strPcSkillCheckFate04'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_05: + tmp_tSkillCheckReasult += dictStrCustom['strPcSkillCheckFate05'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_06: + tmp_tSkillCheckReasult += dictStrCustom['strPcSkillCheckFate06'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_07: + tmp_tSkillCheckReasult += dictStrCustom['strPcSkillCheckFate07'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_08: + tmp_tSkillCheckReasult += dictStrCustom['strPcSkillCheckFate08'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_09: + tmp_tSkillCheckReasult += dictStrCustom['strPcSkillCheckFate09'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_10: + tmp_tSkillCheckReasult += dictStrCustom['strPcSkillCheckFate10'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_FATE_11: + tmp_tSkillCheckReasult += dictStrCustom['strPcSkillCheckFate11'] + elif tmpSkillCheckType == OlivaDiceCore.skillCheck.resultType.SKILLCHECK_NOPE: + tmp_tSkillCheckReasult += dictStrCustom['strPcSkillCheckNope'] + else: + tmp_tSkillCheckReasult += dictStrCustom['strPcSkillCheckError'] + flag_need_reply = True + else: + flag_need_reply = False + break + dictTValue['tRollResult'] = '' + dictTValue['tSkillCheckReasult'] = tmp_tSkillCheckReasult + if flag_need_reply: if tmp_skill_name != None: dictTValue['tSkillName'] = tmp_skill_name tmp_reply_str = dictStrCustom['strPcSkillCheckWithSkillName'].format(**dictTValue) @@ -1048,6 +1330,7 @@ def unity_reply(plugin_event, Proc): tmp_reast_str = getMatchWordStartRight(tmp_reast_str, 'r') rd_para_str = '1D100' rd_reason_str = None + roll_times_count = 1 flag_hide_roll = False flag_have_para = False if len(tmp_reast_str) > 0: @@ -1055,6 +1338,14 @@ def unity_reply(plugin_event, Proc): flag_hide_roll = True tmp_reast_str = getMatchWordStartRight(tmp_reast_str, 'h') tmp_reast_str = skipSpaceStart(tmp_reast_str) + if len(tmp_reast_str) > 2: + tmp_reast_str_list_1 = tmp_reast_str.split('#') + if len(tmp_reast_str_list_1) > 1: + if tmp_reast_str_list_1[0].isdigit(): + roll_times_count = int(tmp_reast_str_list_1[0]) + if roll_times_count > 10: + roll_times_count = 10 + tmp_reast_str = tmp_reast_str_list_1[1] if len(tmp_reast_str) > 0: tmp_rd_para_str = None [tmp_rd_para_str, tmp_reast_str] = getExpression(tmp_reast_str) @@ -1089,23 +1380,43 @@ def unity_reply(plugin_event, Proc): tmp_template_customDefault = tmp_template['customDefault'] if 'mainDice' in tmp_template and not flag_have_para: rd_para_str = tmp_template['mainDice'] - rd_para = OlivaDiceCore.onedice.RD(rd_para_str, tmp_template_customDefault) - rd_para.roll() - tmp_reply_str_1 = '' - if rd_para.resError == None: - if len(rd_para.resDetail) == 0 or len(rd_para.resDetail) > 150: - if len(str(rd_para.resInt)) > 100: - tmp_reply_str_1 = rd_para_str + '=' + str(rd_para.resInt)[:50] + '...的天文数字' + if roll_times_count == 1: + rd_para = OlivaDiceCore.onedice.RD(rd_para_str, tmp_template_customDefault) + rd_para.roll() + tmp_reply_str_1 = '' + if rd_para.resError == None: + if len(rd_para.resDetail) == 0 or len(rd_para.resDetail) > 150: + if len(str(rd_para.resInt)) > 100: + tmp_reply_str_1 = rd_para_str + '=' + str(rd_para.resInt)[:50] + '...的天文数字' + else: + tmp_reply_str_1 = rd_para_str + '=' + str(rd_para.resInt) else: - tmp_reply_str_1 = rd_para_str + '=' + str(rd_para.resInt) + if len(str(rd_para.resInt)) > 50: + tmp_reply_str_1 = rd_para_str + '=' + str(rd_para.resDetail) + '=' + str(rd_para.resInt)[:50] + '...的天文数字' + else: + tmp_reply_str_1 = rd_para_str + '=' + str(rd_para.resDetail) + '=' + str(rd_para.resInt) else: - if len(str(rd_para.resInt)) > 50: - tmp_reply_str_1 = rd_para_str + '=' + str(rd_para.resDetail) + '=' + str(rd_para.resInt)[:50] + '...的天文数字' - else: - tmp_reply_str_1 = rd_para_str + '=' + str(rd_para.resDetail) + '=' + str(rd_para.resInt) + tmp_reply_str_1 = str(rd_para.resError) + dictTValue['tRollResult'] = tmp_reply_str_1 else: - tmp_reply_str_1 = str(rd_para.resError) - dictTValue['tRollResult'] = tmp_reply_str_1 + flag_begin = True + tmp_reply_str_1 = '' + for i in range(roll_times_count): + rd_para = OlivaDiceCore.onedice.RD(rd_para_str, tmp_template_customDefault) + rd_para.roll() + if rd_para.resError == None: + if not flag_begin: + tmp_reply_str_1 += ', ' + else: + flag_begin = False + if len(str(rd_para.resInt)) > 10: + tmp_reply_str_1 += str(rd_para.resInt)[:10] + '...' + else: + tmp_reply_str_1 += str(rd_para.resInt) + else: + tmp_reply_str_1 = str(rd_para.resError) + break + dictTValue['tRollResult'] = rd_para_str + '=' + tmp_reply_str_1 if rd_reason_str != None: dictTValue['tRollReason'] = rd_reason_str tmp_reply_str = dictStrCustom['strRollWithReason'].format(**dictTValue) @@ -1128,11 +1439,15 @@ def unity_reply(plugin_event, Proc): def replyMsg(plugin_event, message): return plugin_event.reply(str(message)) -def sendMsgByEvent(plugin_event, message, target_id, target_type): - return plugin_event.send(target_type, target_id, message) +def sendMsgByEvent(plugin_event, message, target_id, target_type, host_id = None): + return plugin_event.send(target_type, target_id, message, host_id = host_id) def replyMsgPrivateByEvent(plugin_event, message): - return plugin_event.send('private', plugin_event.data.user_id, message) + if 'host_id' in plugin_event.data.__dict__: + plugin_event.send('private', plugin_event.data.user_id, message, host_id = plugin_event.data.host_id) + else: + plugin_event.send('private', plugin_event.data.user_id, message) + return def replyMsgLazyHelpByEvent(plugin_event, help_key): tmp_reply_str = OlivaDiceCore.helpDoc.getHelp(str(help_key), plugin_event.bot_info.hash) diff --git a/OlivaDiceCore/userConfig.py b/OlivaDiceCore/userConfig.py index af9eb21..be9bb09 100644 --- a/OlivaDiceCore/userConfig.py +++ b/OlivaDiceCore/userConfig.py @@ -32,7 +32,9 @@ gUserConfigLock = threading.Lock() dictUserConfigNoteDefault = { - 'groupEnable' : True + 'groupEnable' : True, + 'hostEnable' : True, + 'groupWithHostEnable' : False } def setUserConfigByKey(userId, userType, platform, userConfigKey, userConfigValue, botHash): @@ -148,7 +150,7 @@ def writeUserConfigByUserHash(userHash): releaseDir(OlivaDiceCore.data.dataDirRoot + '/' + botHash + '/user') userConfigDataPath = OlivaDiceCore.data.dataDirRoot + '/' + botHash + '/user/' + userHash with open(userConfigDataPath, 'w', encoding = 'utf-8') as userConfigDataPath_f: - userConfigDataPath_f.write(json.dumps(tmp_dictUserConfigData_this[botHash], ensure_ascii = False, indent = 4)) + userConfigDataPath_f.write(json.dumps(tmp_dictUserConfigData_this, ensure_ascii = False, indent = 4)) def readUserConfig(): global dictUserConfigData @@ -180,11 +182,13 @@ def dataUserConfigTotalCount(): total_count += 1 return total_count -def getUserHash(userId, userType, platform): +def getUserHash(userId, userType, platform, subId = None): hash_tmp = hashlib.new('md5') hash_tmp.update(str(userId).encode(encoding='UTF-8')) hash_tmp.update(str(userType).encode(encoding='UTF-8')) hash_tmp.update(str(platform).encode(encoding='UTF-8')) + if subId != None: + hash_tmp.update(str(subId).encode(encoding='UTF-8')) return hash_tmp.hexdigest() def releaseDir(dir_path):