Skip to content

Commit

Permalink
暗抽牌
Browse files Browse the repository at this point in the history
  • Loading branch information
lunzhiPenxil committed Nov 16, 2021
1 parent 0618479 commit 147b1fe
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 5 deletions.
2 changes: 1 addition & 1 deletion OlivaDiceCore/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import platform
import os

OlivaDiceCore_ver = '3.0.0'
OlivaDiceCore_ver = '3.0.1'

exce_path = os.getcwd()

Expand Down
5 changes: 5 additions & 0 deletions OlivaDiceCore/helpDoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,11 @@ def getHelp(key_str, bot_hash):
dictStrCustom = OlivaDiceCore.msgCustom.dictStrCustomDict[bot_hash]
if bot_hash in OlivaDiceCore.helpDocData.dictHelpDoc:
if key_str in OlivaDiceCore.helpDocData.dictHelpDoc[bot_hash]:
tmp_tHelpDocResult = OlivaDiceCore.helpDocData.dictHelpDoc[bot_hash][key_str]
if len(tmp_tHelpDocResult) > 1:
if tmp_tHelpDocResult[0] == '&' and tmp_tHelpDocResult[1:] != key_str:
tmp_reply_str = getHelp(tmp_tHelpDocResult[1:], bot_hash)
return tmp_reply_str
dictTValue['tHelpDocResult'] = OlivaDiceCore.helpDocData.dictHelpDoc[bot_hash][key_str]
if key_str == 'default':
tmp_reply_str = '%s\n%s' % (OlivaDiceCore.data.bot_info, dictTValue['tHelpDocResult'])
Expand Down
47 changes: 44 additions & 3 deletions OlivaDiceCore/helpDocData.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,14 @@
(如群内有多个骰子,请在@后追加指令)
[.help指令] 查看指令列表
[.help链接] 查看源码文档
[.help更新] 查看更新日志
有问题请联系(请优先加群)
青果核心用户群:661366095''',

'更新': '''[OlivaDiceCore]
3.0.1: 审核模式
3.0.0: 基础版本实现''',

'指令': '''@后接指令可以指定单独响应,如@机器人.bot off
多数指令需要后接参数,请.help对应指令 获取详细信息,如.help bot
.bot exit 退群
Expand All @@ -44,7 +49,28 @@
.ra 检定
.sc 理智检定''',

'链接': '''查看源码: https://github.com/OlivOS-Team/OlivaDiceCore''',
'链接': '''查看源码: https://github.com/OlivOS-Team/OlivaDiceCore
OneDice标准: https://github.com/OlivOS-Team/onedice
OlivOS项目: https://github.com/OlivOS-Team/OlivOS''',

'dismiss': '''dismiss [dɪsˈmɪs]
vt. 不予考虑; 摒弃; 对…不屑一提; 去除,消除,摒除(思想、感情等); 解雇; 免职; 开除;
[例句]
He dismissed the dismiss as worthless.
他认为dismiss毫无用处。
[其他]
第三人称单数:dismisses
现在分词:dismissing
过去式:dismissed
过去分词:dismissed
若需要使本机器人退群,请使用[.bot exit]''',

'bot': '''@后接指令可以指定单独响应,如@机器人.bot off
.bot exit 退群
.bot 版本信息
.bot on 启用指令
.bot off 停用指令''',

'st': '''.st [人物卡名]-[技能名][技能值][技能名][技能值]…… 人物卡批量录入
.st list 显示人物卡列表
Expand All @@ -57,7 +83,9 @@

'r': '''通用掷骰指令
.r [掷骰表达式] [理由] 掷骰子
.rh [掷骰表达式] [理由] 掷暗骰''',
.rh [掷骰表达式] [理由] 掷暗骰
表达式支持OneDice标准:
https://github.com/OlivOS-Team/onedice''',

'ra': '''检定指令
.ra [技能名] [技能值] 技能检定
Expand All @@ -72,5 +100,18 @@
'coc': '''人物作成
.coc [数量] COC7人物作成''',

'draw': '''抽牌:.draw [牌堆名称]'''
'draw': '''抽牌:
.draw [牌堆名称] 抽牌堆
.drawh [牌堆名称] 暗抽牌堆''',



'help': '&default',
'帮助': '&default',
'掷骰': '&r',
'检定': '&ra',
'理智检定': '&sc',
'命名': '&nn',
'人物卡': '&st',
'车卡coc': '&coc'
}
3 changes: 3 additions & 0 deletions OlivaDiceCore/msgCustom.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
dictStrCustomDict = {}

dictStrCustom = {
'strHello': '欢迎使用本机器人! 请使用[.help]查看帮助',
'strBot': '欢迎使用本机器人! 请使用[.help]查看帮助',
'strBotExit': '即将退出本群',
'strBotExitRemote': '收到远程控制, 即将退出本群',
'strBotExitRemoteShow' : '即将远程退出群[{tGroupId}]',
Expand All @@ -38,6 +40,7 @@
'strHelpDocRecommend' : '已为你找到以下以下相似条目:\n{tHelpDocResult}',
'strHelpDocNotFound' : '未找到匹配条目',
'strDrawDeck' : '你抽到了:\n{tDrawDeckResult}',
'strDrawDeckHideShow' : '[{tName}]进行了暗抽牌',
'strDrawDeckNotFound' : '牌堆未找到',
'strRoll' : '[{tName}]掷骰: {tRollResult}',
'strRollWithReason' : '[{tName}]由于[{tRollReason}]掷骰: {tRollResult}',
Expand Down
25 changes: 24 additions & 1 deletion OlivaDiceCore/msgReply.py
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ def unity_reply(plugin_event, Proc):
tmp_reply_str += OlivaDiceCore.data.bot_summary
replyMsg(plugin_event, tmp_reply_str)
else:
replyMsg(plugin_event, OlivaDiceCore.data.bot_info)
tmp_reply_str = OlivaDiceCore.data.bot_info + '\n' + dictStrCustom['strBot'].format(**dictTValue)
replyMsg(plugin_event, tmp_reply_str)
return
#此群关闭时中断处理
if not flag_groupEnable and not flag_force_reply:
Expand All @@ -264,19 +265,33 @@ def unity_reply(plugin_event, Proc):
tmp_reply_str = OlivaDiceCore.helpDoc.getHelp('default', plugin_event.bot_info.hash)
if tmp_reply_str != None:
replyMsg(plugin_event, tmp_reply_str)
return
elif isMatchWordStart(tmp_reast_str, 'draw'):
flag_hide = False
tmp_reast_str = getMatchWordStartRight(tmp_reast_str, 'draw')
tmp_reast_str = skipSpaceStart(tmp_reast_str)
if isMatchWordStart(tmp_reast_str, 'h'):
tmp_reast_str = getMatchWordStartRight(tmp_reast_str, 'h')
tmp_reast_str = skipSpaceStart(tmp_reast_str)
flag_hide = True
tmp_reast_str = tmp_reast_str.rstrip(' ')
tmp_reast_str = tmp_reast_str.lstrip('_')
tmp_reast_str = skipSpaceStart(tmp_reast_str)
tmp_reply_str = None
if tmp_reast_str == '':
tmp_reast_str = None
if tmp_reast_str != None:
tmp_reply_str = OlivaDiceCore.drawCard.getDrawDeck(tmp_reast_str, plugin_event.bot_info.hash)
if flag_hide:
replyMsgPrivateByEvent(plugin_event, tmp_reply_str)
tmp_reply_str = dictStrCustom['strDrawDeckHideShow'].format(**dictTValue)
replyMsg(plugin_event, tmp_reply_str)
return
else:
tmp_reply_str = OlivaDiceCore.helpDoc.getHelp('draw', plugin_event.bot_info.hash)
if tmp_reply_str != None:
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)
Expand Down Expand Up @@ -308,6 +323,8 @@ def unity_reply(plugin_event, Proc):
dictTValue['tPcSelection'] = dictTValue['tName']
tmp_reply_str = dictStrCustom['strPcRename'].format(**dictTValue)
replyMsg(plugin_event, tmp_reply_str)
else:
replyMsgLazyHelpByEvent(plugin_event, 'nn')
return
elif isMatchWordStart(tmp_reast_str, 'st'):
tmp_pc_name = None
Expand Down Expand Up @@ -573,6 +590,8 @@ def unity_reply(plugin_event, Proc):
if tmp_skill_value != None:
tmp_skill_value = int(tmp_skill_value)
if tmp_skill_name != None:
if tmp_skill_name[-1] in ['=', ':']:
tmp_skill_name = tmp_skill_name[:-1]
tmp_skill_name = tmp_skill_name.upper()
if len(tmp_skill_pair_list) == 0:
if tmp_skill_value != None:
Expand Down Expand Up @@ -1115,6 +1134,10 @@ def sendMsgByEvent(plugin_event, message, target_id, target_type):
def replyMsgPrivateByEvent(plugin_event, message):
return plugin_event.send('private', plugin_event.data.user_id, message)

def replyMsgLazyHelpByEvent(plugin_event, help_key):
tmp_reply_str = OlivaDiceCore.helpDoc.getHelp(str(help_key), plugin_event.bot_info.hash)
return plugin_event.reply(str(tmp_reply_str))

def skipSpaceStart(data):
tmp_output_str = ''
if len(data) > 0:
Expand Down

0 comments on commit 147b1fe

Please sign in to comment.