| | |
| | | import IpyGameDataPY
|
| | | import PlayerControl
|
| | | import NetPackCommon
|
| | | import PlayerGoldRush
|
| | | import ChPyNetSendPack
|
| | | import DataRecordPack
|
| | | import ItemControler
|
| | | import IPY_GameWorld
|
| | | import GameFuncComm
|
| | | import ShareDefine
|
| | | import PlayerHero
|
| | | import ChConfig
|
| | | import FBCommon
|
| | |
|
| | |
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for index in xrange(ipyDataMgr.GetTaskCount()):
|
| | | ipyData = ipyDataMgr.GetTaskByIndex(index)
|
| | | taskGroup = ipyData.GetTaskGroup()
|
| | | tGroup = ipyData.GetTaskGroup()
|
| | | taskID = ipyData.GetTaskID()
|
| | | if taskGroup not in taskIDListDict:
|
| | | taskIDListDict[taskGroup] = []
|
| | | taskIDList = taskIDListDict[taskGroup]
|
| | | if tGroup not in taskIDListDict:
|
| | | taskIDListDict[tGroup] = []
|
| | | taskIDList = taskIDListDict[tGroup]
|
| | | if taskID not in taskIDList:
|
| | | taskIDList.append(taskID)
|
| | | IpyGameDataPY.SetConfigEx(key, taskIDListDict)
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def __giveNewTask(curPlayer, taskGroup=ChConfig.TaskGroup_Main):
|
| | | def __giveNewTask(curPlayer, taskGroup=ChConfig.TaskGroup_Main, preTaskID=0):
|
| | | ## 给新任务
|
| | | # @param preTaskID: 上一个任务ID
|
| | | taskIDList = GetTaskIDList(taskGroup)
|
| | | if not taskIDList:
|
| | | return
|
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TaskValue % taskGroup, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TaskState % taskGroup, ChConfig.TaskState_Doing)
|
| | | GameWorld.DebugLog("接到新任务: taskGroup=%s,newTaskID=%s" % (taskGroup, newTaskID), playerID)
|
| | | |
| | | # 额外记录接到任务
|
| | | if taskGroup == ChConfig.TaskGroup_Main:
|
| | | PlayerControl.SetMainTaskID(curPlayer, newTaskID)
|
| | | DataRecordPack.DR_Task(curPlayer, taskGroup, newTaskID, "new", {"preTaskID":preTaskID})
|
| | | |
| | | return SetTaskValue(curPlayer, ipyData, taskValue)
|
| | |
|
| | | def __GetTaskValue(curPlayer, ipyData):
|
| | |
| | | lineID = conds[0]
|
| | | taskValue = 1 if FBCommon.IsFBPass(curPlayer, mapID, lineID) else 0
|
| | |
|
| | | # 挑战主线关
|
| | | elif taskType == ChConfig.TaskType_MainLevelChallenge:
|
| | | if not conds:
|
| | | return 0
|
| | | mapID = ChConfig.Def_FBMapID_Main
|
| | | lvID = conds[0]
|
| | | taskValue = 1 if PlayerControl.IsMainLevelPass(curPlayer, lvID) else 0
|
| | | if not taskValue:
|
| | | challengeLVID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ChallengeLVID)
|
| | | taskValue = 1 if challengeLVID >= lvID else 0
|
| | | |
| | | elif taskType == ChConfig.TaskType_FBZhanchui:
|
| | | if not conds:
|
| | | return 0
|
| | | mapID = ChConfig.Def_FBMapID_Zhanchui
|
| | | lineID = conds[0]
|
| | | taskValue = 1 if FBCommon.IsFBPass(curPlayer, mapID, lineID) else 0
|
| | | |
| | | elif taskType == ChConfig.TaskType_GoldRushWorkers:
|
| | | taskValue = PlayerGoldRush.GetWorkerTotal(curPlayer)
|
| | | |
| | | elif taskType == ChConfig.TaskType_ReqOrJoinFamily:
|
| | | taskValue = 1 if curPlayer.GetFamilyID() else 0
|
| | | |
| | | elif taskType == ChConfig.TaskType_TreeLV:
|
| | | taskValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TreeLV)
|
| | |
|
| | | elif taskType == ChConfig.TaskType_RealmLV:
|
| | | taskValue = curPlayer.GetOfficialRank()
|
| | | |
| | | elif taskType == ChConfig.TaskType_HeroBook:
|
| | | taskValue = PlayerHero.GetHeroBookActCnt(curPlayer)
|
| | |
|
| | | elif taskType == ChConfig.TaskType_EquipColor:
|
| | | if not conds:
|
| | |
| | | if curState != ChConfig.TaskState_CanGet:
|
| | | GameWorld.DebugLog("任务未完成无法领奖: taskID=%s,curValue=%s/%s,curState=%s" % (taskID, curValue, needValue, curState), playerID)
|
| | | return
|
| | | #if not ItemControler.CheckPackSpaceEnough(curPlayer, awardItemList):
|
| | | # return
|
| | | if not ItemControler.CheckPackSpaceEnough(curPlayer, awardItemList):
|
| | | return
|
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TaskIDLast % taskGroup, taskID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TaskID % taskGroup, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TaskValue % taskGroup, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TaskState % taskGroup, 0)
|
| | |
|
| | | ItemControler.GivePlayerItemOrMail(curPlayer, awardItemList, event=["Task", False, {}])
|
| | | # 支持定制属性物品
|
| | | isAuctionItem = 0
|
| | | notifyAwardList = []
|
| | | appointInfo = {}
|
| | | for itemID, itemCount, appointID in awardItemList:
|
| | | setAttrDict = {ShareDefine.Def_CItemKey_AppointID:appointID} if appointID else {}
|
| | | if not ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, event=["Task", False, {}], setAttrDict=setAttrDict):
|
| | | continue
|
| | | notifyAwardList.append([itemID, itemCount, isAuctionItem])
|
| | | appointInfo[itemID] = appointID
|
| | | ItemControler.NotifyGiveAwardInfo(curPlayer, notifyAwardList, "Task", dataEx={"appointInfo":appointInfo})
|
| | |
|
| | | if not __giveNewTask(curPlayer, taskGroup):
|
| | | if not __giveNewTask(curPlayer, taskGroup, taskID):
|
| | | SyncTaskInfo(curPlayer, [taskGroup])
|
| | |
|
| | | GameFuncComm.DoFuncOpenLogic(curPlayer, [taskID])
|
| | | GameFuncComm.DoFuncOpenLogic(curPlayer)
|
| | | return
|
| | |
|
| | | def SyncTaskInfo(curPlayer, taskGroupList=None):
|