| | |
| | | import IpyGameDataPY
|
| | | import GameWorld
|
| | | import DBDataMgr
|
| | | import ObjPool
|
| | |
|
| | | def OnDay(curPlayer):
|
| | | CheckResetWeekActivity(curPlayer)
|
| | |
| | | taskConds = ipyData.GetTaskConds()
|
| | | if conds or taskConds:
|
| | | # 可按任务类型扩展不同的条件验证方式
|
| | | if taskConds != conds:
|
| | | if taskConds != tuple(conds):
|
| | | #GameWorld.DebugLog("条件不同taskConds=%s,conds=%s" % (taskConds, conds))
|
| | | continue
|
| | | needValue = ipyData.GetNeedValue()
|
| | | maxValue = max(maxValue, needValue)
|
| | |
| | |
|
| | | def GetDailyTaskValue(curPlayer, taskType, conds=[]):
|
| | | ##获取完成度
|
| | | condition = "" if not conds else str(conds).replace(" ", "")[1:-1]
|
| | | condition = "" if not conds else str(list(conds)).replace(" ", "")[1:-1]
|
| | | return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyTaskValue % (taskType, condition))
|
| | | def SetDailyTaskValue(curPlayer, taskType, conds, value):
|
| | | ##设置完成度
|
| | | condition = "" if not conds else str(conds).replace(" ", "")[1:-1]
|
| | | condition = "" if not conds else str(list(conds)).replace(" ", "")[1:-1]
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DailyTaskValue % (taskType, condition), value)
|
| | | GameWorld.DebugLog("更新每日任务进度值: taskType=%s,conds=%s,value=%s" % (taskType, condition, value), curPlayer.GetPlayerID())
|
| | | return
|
| | |
| | | updState = taskState|pow(2, taskID)
|
| | | GameWorld.DebugLog("每日任务领奖! taskID=%s,updState=%s" % (taskID, updState), playerID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DailyTaskState, updState)
|
| | | DoAddActivity(curPlayer, ipyData.GetAwardLiveness())
|
| | | awardItemList = ipyData.GetAwardItemList()
|
| | | ItemControler.GivePlayerItemOrMail(curPlayer, awardItemList, event=["DailyTaskAward", False, {}])
|
| | | return
|
| | |
|
| | | def DoAddActivity(curPlayer, addValue):
|
| | |
| | | return
|
| | |
|
| | | def SyncDailyTaskInfo(curPlayer, taskType=0, conds=[], isAll=False):
|
| | | clientPack = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCDailyTaskInfo)
|
| | | clientPack = ChPyNetSendPack.tagSCDailyTaskInfo()
|
| | | clientPack.ActivityTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityTotal)
|
| | | clientPack.ActivityAward = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityAward)
|
| | | clientPack.DailyTaskState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyTaskState)
|
| | |
| | |
|
| | | clientPack.TaskList = []
|
| | | for taskType, conds in syncTaskCondList:
|
| | | task = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCDailyTask)
|
| | | task = ChPyNetSendPack.tagSCDailyTask()
|
| | | task.TaskType = taskType
|
| | | task.Conds = conds
|
| | | task.CLen = len(task.Conds)
|