| #!/usr/bin/python  | 
| # -*- coding: GBK -*-  | 
| #-------------------------------------------------------------------------------  | 
| #  | 
| ##@package GM.Commands.Task  | 
| #  | 
| # @todo:ÈÎÎñ  | 
| # @author hxp  | 
| # @date 2023-12-20  | 
| # @version 1.0  | 
| #  | 
| # ÏêϸÃèÊö: ÈÎÎñ  | 
| #  | 
| #-------------------------------------------------------------------------------  | 
| #"""Version = 2023-12-20 12:30"""  | 
| #-------------------------------------------------------------------------------  | 
|   | 
| import GameWorld  | 
| import IpyGameDataPY  | 
| import PlayerControl  | 
| import PlayerTask  | 
| import ChConfig  | 
|   | 
| ## GMÃüÁîÖ´ÐÐÈë¿Ú  | 
| #  @param curPlayer µ±Ç°Íæ¼Ò  | 
| #  @param playerList ²ÎÊýÁбí [ missionID]  | 
| #  @return None  | 
| #  @remarks º¯ÊýÏêϸ˵Ã÷.  | 
| def OnExec(curPlayer, paramList):  | 
|       | 
|     if len(paramList) == 0:  | 
|         GameWorld.DebugAnswer(curPlayer, "ÖØÖÃÖ÷Ïß: Task 0")  | 
|         GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÈÎÎñ: Task ÈÎÎñID ½ø¶È")  | 
|         __ShowTask(curPlayer)  | 
|         return  | 
|       | 
|     taskID = paramList[0]  | 
|     if not taskID:  | 
|         taskGroup = ChConfig.TaskGroup_Main  | 
|         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TaskIDLast % taskGroup, 0)  | 
|         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)  | 
|         PlayerTask.__giveNewTask(curPlayer, taskGroup)  | 
|         return  | 
|       | 
|     taskValue = paramList[1] if len(paramList) > 1 else 0  | 
|     ipyData = IpyGameDataPY.GetIpyGameData("Task", taskID)  | 
|     if not ipyData:  | 
|         GameWorld.DebugAnswer(curPlayer, "¸ÃÈÎÎñID²»´æÔÚ:%s" % taskID)  | 
|         return  | 
|     taskGroup = ipyData.GetTaskGroup()  | 
|     needValue = ipyData.GetNeedValue()  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TaskID % taskGroup, taskID)  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TaskValue % taskGroup, taskValue)  | 
|     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TaskState % taskGroup, ChConfig.TaskState_Doing)  | 
|     PlayerTask.SetTaskValue(curPlayer, ipyData, taskValue)  | 
|       | 
|     curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TaskValue % taskGroup)  | 
|     GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÈÎÎñID:%s  ½ø¶È:%s/%s" % (taskID, curValue, needValue))  | 
|     return  | 
|   | 
| def __ShowTask(curPlayer):  | 
|     taskCount = 0  | 
|     for taskGroup in ChConfig.TaskGroupList:  | 
|         taskID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TaskID % taskGroup)  | 
|         if not taskID:  | 
|             continue  | 
|         ipyData = IpyGameDataPY.GetIpyGameData("Task", taskID)  | 
|         if not ipyData:  | 
|             continue  | 
|         curState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TaskState % taskGroup)  | 
|         curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TaskValue % taskGroup)  | 
|         needValue = ipyData.GetNeedValue()  | 
|         GameWorld.DebugAnswer(curPlayer, "ÈÎÎñID:%s ½ø¶È:%s/%s ×´Ì¬:%s" % (taskID, curValue, needValue, curState))  | 
|         taskCount += 1  | 
|           | 
|     if not taskCount:  | 
|         GameWorld.DebugAnswer(curPlayer, "µ±Ç°Ã»ÓÐÈÎÎñ!")         | 
|           | 
|     return  | 
|   |