Skip to content

Commit

Permalink
版本推进至3.0.3
Browse files Browse the repository at this point in the history
+ 戳一戳掷骰开关
  • Loading branch information
lunzhiPenxil committed May 13, 2022
1 parent 348ba7a commit 48557e9
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 4 deletions.
4 changes: 2 additions & 2 deletions OlivaDiceJoy/app.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"author" : "lunzhiPenxil",
"namespace" : "OlivaDiceJoy",
"message_mode" : "old_string",
"version" : "3.0.2",
"svn" : 10,
"version" : "3.0.3",
"svn" : 11,
"compatible_svn" : 95,
"priority" : 30010,
"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,6 +15,6 @@
'''


OlivaDiceJoy_ver = '3.0.2'
OlivaDiceJoy_svn = 10
OlivaDiceJoy_ver = '3.0.3'
OlivaDiceJoy_svn = 11
OlivaDiceJoy_ver_short = '%s(%s)' % (str(OlivaDiceJoy_ver), str(OlivaDiceJoy_svn))
6 changes: 6 additions & 0 deletions OlivaDiceJoy/msgCustom.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@
import OlivaDiceCore
import OlivaDiceJoy

dictConsoleSwitchTemplate = {
'default' : {
'joyPokeMode': 0
}
}

dictStrCustomDict = {}

dictStrCustom = {
Expand Down
8 changes: 8 additions & 0 deletions OlivaDiceJoy/msgCustomManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,11 @@ def initMsgCustom(bot_info_dict):
OlivaDiceCore.msgCustom.dictStrConst.update(OlivaDiceJoy.msgCustom.dictStrConst)
OlivaDiceCore.msgCustom.dictGValue.update(OlivaDiceJoy.msgCustom.dictGValue)
OlivaDiceCore.msgCustom.dictTValue.update(OlivaDiceJoy.msgCustom.dictTValue)
for dictConsoleSwitchTemplate_this in OlivaDiceJoy.msgCustom.dictConsoleSwitchTemplate:
if dictConsoleSwitchTemplate_this in OlivaDiceCore.console.dictConsoleSwitchTemplate:
OlivaDiceCore.console.dictConsoleSwitchTemplate[dictConsoleSwitchTemplate_this].update(
OlivaDiceJoy.msgCustom.dictConsoleSwitchTemplate[dictConsoleSwitchTemplate_this]
)
OlivaDiceCore.console.initConsoleSwitchByBotDict(bot_info_dict)
OlivaDiceCore.console.readConsoleSwitch()
OlivaDiceCore.console.saveConsoleSwitch()
33 changes: 33 additions & 0 deletions OlivaDiceJoy/msgReply.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,45 @@

import hashlib
import time
from functools import wraps

def unity_init(plugin_event, Proc):
pass

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'])

def add_poke_rd_func(target_func):
@wraps(target_func)
def poke_rd_func(plugin_event, type):
flag_need = False
if OlivaDiceCore.console.getConsoleSwitchByHash(
'joyPokeMode',
plugin_event.bot_info.hash
) == 1:
flag_need = True
if flag_need:
res = poke_rd(plugin_event, type)
else:
res = target_func(plugin_event, type)
return res
return poke_rd_func

def poke_rd(plugin_event, type):
dictTValue = OlivaDiceCore.msgCustom.dictTValue.copy()
dictTValue['tName'] = '你'
dictStrCustom = OlivaDiceCore.msgCustom.dictStrCustomDict[plugin_event.bot_info.hash]
dictGValue = OlivaDiceCore.msgCustom.dictGValue
dictTValue.update(dictGValue)
rd = OlivaDiceCore.onedice.RD('1D100')
rd.roll()
res = plugin_event.get_stranger_info(user_id = plugin_event.data.user_id)
if res != None:
dictTValue['tName'] = res['data']['name']
dictTValue['tRollResult'] = '1D100=%s' % str(rd.resInt)
tmp_reply_str = dictStrCustom['strRoll'].format(**dictTValue)
return tmp_reply_str

def unity_reply(plugin_event, Proc):
OlivaDiceCore.userConfig.setMsgCount()
Expand Down

0 comments on commit 48557e9

Please sign in to comment.