diff --git a/OlivaDiceJoy/app.json b/OlivaDiceJoy/app.json index 94df0ea..d85fc0c 100644 --- a/OlivaDiceJoy/app.json +++ b/OlivaDiceJoy/app.json @@ -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" : [ diff --git a/OlivaDiceJoy/data.py b/OlivaDiceJoy/data.py index 787b763..97eab36 100644 --- a/OlivaDiceJoy/data.py +++ b/OlivaDiceJoy/data.py @@ -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 = [] diff --git a/OlivaDiceJoy/msgReply.py b/OlivaDiceJoy/msgReply.py index 0b4b7ea..92dd94d 100644 --- a/OlivaDiceJoy/msgReply.py +++ b/OlivaDiceJoy/msgReply.py @@ -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) @@ -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