1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package GM.Commands.Task
#
# @todo:ÈÎÎñ
# @author hxp
# @date 2025-05-28
# @version 1.0
#
# ÏêϸÃèÊö: ÈÎÎñ
#
#-------------------------------------------------------------------------------
#"""Version = 2025-05-28 16:00"""
#-------------------------------------------------------------------------------
 
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()
        stateStr = "¿ÉÁì" if curState == 2 else "½øÐÐÖÐ"
        GameWorld.DebugAnswer(curPlayer, "ÈÎÎñID:%s ½ø¶È:%s/%s ×´Ì¬:%s(%s)" % (taskID, curValue, needValue, curState, stateStr))
        taskCount += 1
        
    if not taskCount:
        GameWorld.DebugAnswer(curPlayer, "µ±Ç°Ã»ÓÐÈÎÎñ!")       
        
    return