Skip to content

Commit

Permalink
版本推进至3.0.9
Browse files Browse the repository at this point in the history
+ 在注入点实现以前缀元数据的格式指定本条牌堆以程心自定义的格式解析
  • Loading branch information
lunzhiPenxil committed Sep 27, 2022
1 parent 066697f commit 393982e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
4 changes: 2 additions & 2 deletions OlivaDiceJoy/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"namespace" : "OlivaDiceJoy",
"message_mode" : "old_string",
"info" : "本模块为OlivaDice的娱乐模块,提供了一些无关紧要的娱乐功能,它们或许是与跑团关系不大、或许只是一些历史原因遗留下来的传统,总之,这些在野蛮生长时期被或是由于开发者无知、或是作为恶性竞争手段、或是用户呼声较大但对于跑团而言意义不明的,被添加进来的小功能,都会被放入这个模块。",
"version" : "3.0.8",
"svn" : 16,
"version" : "3.0.9",
"svn" : 17,
"compatible_svn" : 101,
"priority" : 20010,
"support" : [
Expand Down
4 changes: 2 additions & 2 deletions OlivaDiceJoy/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
'''


OlivaDiceJoy_ver = '3.0.8'
OlivaDiceJoy_svn = 16
OlivaDiceJoy_ver = '3.0.9'
OlivaDiceJoy_svn = 17
OlivaDiceJoy_ver_short = '%s(%s)' % (str(OlivaDiceJoy_ver), str(OlivaDiceJoy_svn))

listPlugin = []
Expand Down
21 changes: 19 additions & 2 deletions OlivaDiceJoy/msgReply.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def data_init(plugin_event, Proc):
OlivaDiceJoy.msgCustomManager.initMsgCustom(Proc.Proc_data['bot_info_dict'])
OlivaDiceCore.crossHook.dictHookFunc['pokeHook'] = add_poke_rd_func(OlivaDiceCore.crossHook.dictHookFunc['pokeHook'])
OlivaDiceCore.crossHook.dictHookFunc['msgFormatHook'] = add_chance_custom_msg_func(OlivaDiceCore.crossHook.dictHookFunc['msgFormatHook'])
OlivaDiceCore.crossHook.dictHookFunc['drawFormatHook'] = add_chance_custom_to_deck_func(OlivaDiceCore.crossHook.dictHookFunc['drawFormatHook'])

def add_poke_rd_func(target_func):
@wraps(target_func)
Expand Down Expand Up @@ -335,13 +336,29 @@ def msg_func(data:str, valDict:dict):
bot_hash
)
if flag_need == 1 and plugin_event != None:
res = chance_custom_msg(plugin_event, data, valDict)
res = chance_custom_msg(plugin_event, data)
else:
res = target_func(data, valDict)
return res
return msg_func

def chance_custom_msg(plugin_event:OlivOS.API.Event, data:str, valDict:dict):
def add_chance_custom_to_deck_func(target_func):
@wraps(target_func)
def msg_func(data:str, plugin_event:OlivOS.API.Event):
bot_hash = plugin_event.bot_info.hash
res = data
for key_this in ['【程心】', '【铃心】', '【EPK】', '【CCPK】']:
if res.startswith('%s::' % key_this) or res.startswith('::%s::' % key_this):
if res.startswith('::'):
res = res[len('::'):]
if res.startswith('%s::' % key_this):
res = res[len('%s::' % key_this):]
res = chance_custom_msg(plugin_event, res)
break
return res
return msg_func

def chance_custom_msg(plugin_event:OlivOS.API.Event, data:str):
msg = data
if 'ChanceCustom' in OlivaDiceJoy.data.listPlugin:
import ChanceCustom
Expand Down

0 comments on commit 393982e

Please sign in to comment.