| | |
| | | __ResetTaskValueByTemplateID(curPlayer, actNum, lastTempID)
|
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActTaskID % actNum, actID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActTaskRound % actNum, 0)
|
| | |
|
| | | if state:
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("ActTask", cfgID)
|
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActTaskAward % (actNum, keyNum), 0)
|
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActTaskTempID % actNum, templateID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActTaskRound % actNum, 1)
|
| | | return
|
| | |
|
| | | def __GetTaskAwardRecordKeyNumMax(templateID, defKeyNum=2):
|
| | |
| | | ipyData = IpyGameDataPY.GetIpyGameData("ActTask", cfgID)
|
| | | if not ipyData:
|
| | | continue
|
| | | roundMax = ipyData.GetRoundMax()
|
| | | templateID = ipyData.GetTemplateID()
|
| | |
|
| | | taskIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActTaskTemp", templateID)
|
| | |
| | | needValueMax = needValue
|
| | |
|
| | | curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActTaskValue % (actNum, taskType))
|
| | | if roundMax > 1:
|
| | | needValueMax *= roundMax
|
| | | if curValue >= needValueMax:
|
| | | continue
|
| | |
|
| | |
| | | ipyData = IpyGameDataPY.GetIpyGameData("ActTask", cfgID)
|
| | | if not ipyData:
|
| | | return
|
| | | roundMax = ipyData.GetRoundMax()
|
| | | templateID = ipyData.GetTemplateID()
|
| | |
|
| | | taskIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActTaskTemp", templateID)
|
| | |
| | |
|
| | | GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_ActTaskAward, awardIndex, 1, True, [actNum])
|
| | |
|
| | | Sync_ActTaskPlayerInfo(curPlayer, actNum)
|
| | | |
| | | GameWorld.DebugLog("领取任务活动奖励! actNum=%s,cfgID=%s,taskID=%s,awardItemList=%s" % (actNum, cfgID, taskID, awardItemList))
|
| | | roundNum = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActTaskRound % actNum)
|
| | | GameWorld.DebugLog("领取任务活动奖励! actNum=%s,cfgID=%s,roundNum=%s,taskID=%s,awardItemList=%s" % (actNum, cfgID, roundNum, taskID, awardItemList))
|
| | |
|
| | | for itemID, itemCount, isAuctionItem in awardItemList:
|
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, [IPY_GameWorld.rptItem], event=["ActTask", False, {}])
|
| | |
|
| | | # 检查进入下一轮
|
| | | if roundMax > 1 and roundNum < roundMax:
|
| | | roundFinish = True
|
| | | taskMaxValueInfo = {}
|
| | | for taskIpyData in taskIpyDataList:
|
| | | rTaskID = taskIpyData.GetTaskID()
|
| | | rTaskType = taskIpyData.GetTaskType()
|
| | | rNeedValue = taskIpyData.GetNeedValue()
|
| | | if rNeedValue > taskMaxValueInfo.get(rTaskType, 0):
|
| | | taskMaxValueInfo[rTaskType] = rNeedValue
|
| | | rAwardIndex = rTaskID
|
| | | if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_ActTaskAward, rAwardIndex, True, [actNum]):
|
| | | roundFinish = False
|
| | | GameWorld.DebugLog("还有任务未领取,不进入下一轮次! actNum=%s,cfgID=%s,roundNum=%s,rTaskID=%s" % (actNum, cfgID, roundNum, rTaskID))
|
| | | break
|
| | | |
| | | if roundFinish:
|
| | | nextRound = roundNum + 1
|
| | | GameWorld.DebugLog("本轮任务领取完毕,进入下一轮! nextRound=%s" % (nextRound))
|
| | | for rTaskType, rMaxValue in taskMaxValueInfo.items():
|
| | | curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActTaskValue % (actNum, taskType))
|
| | | updValue = max(0, curValue - rMaxValue)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActTaskValue % (actNum, taskType), updValue)
|
| | | GameWorld.DebugLog(" 更新新一轮任务值! rTaskType=%s,rMaxValue=%s,curValue=%s,updValue=%s" |
| | | % (rTaskType, rMaxValue, curValue, updValue))
|
| | | Sync_ActTaskPlayerValueInfo(curPlayer, actNum, taskMaxValueInfo.keys())
|
| | | |
| | | # 任务领奖记录
|
| | | taskAwardKeyNum = __GetTaskAwardRecordKeyNumMax(templateID, 10)
|
| | | for keyNum in range(taskAwardKeyNum + 1):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActTaskAward % (actNum, keyNum), 0)
|
| | | GameWorld.DebugLog(" 重置新一轮领奖记录! taskAwardKeyNum=%s" % (taskAwardKeyNum))
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActTaskRound % actNum, nextRound)
|
| | | |
| | | Sync_ActTaskPlayerInfo(curPlayer, actNum)
|
| | | return
|
| | |
|
| | | def Sync_ActTaskPlayerInfo(curPlayer, actNum):
|
| | |
| | |
|
| | | clientPack = ChPyNetSendPack.tagMCActTaskPlayerInfo()
|
| | | clientPack.ActNum = actNum
|
| | | clientPack.RoundNum = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActTaskRound % actNum)
|
| | | clientPack.AwardRecordList = []
|
| | | for keyNum in range(keyNumMax + 1):
|
| | | clientPack.AwardRecordList.append(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActTaskAward % (actNum, keyNum)))
|
| | |
| | | actPack.IsDayReset = ipyData.GetIsDayReset()
|
| | | actPack.ResetType = ipyData.GetResetType()
|
| | | actPack.LimitLV = ipyData.GetLVLimit()
|
| | | actPack.RoundMax = ipyData.GetRoundMax()
|
| | |
|
| | | actPack.TaskList = []
|
| | | for taskIpyData in taskIpyDataList:
|