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
#!/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, playerList):
    
    if len(playerList) == 0:
        GameWorld.DebugAnswer(curPlayer, "ÖØÖÃÖ÷Ïß: Task 0")
        GameWorld.DebugAnswer(curPlayer, "ÉèÖÃÈÎÎñ: Task ÈÎÎñID ½ø¶È")
        return
    
    taskID = playerList[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 = playerList[1] if len(playerList) > 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