hxp
2023-09-22 1e03fac0bcbd9c57ae5da827cb1ea3294c606781
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
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package GM.Commands.CustomAward
#
# @todo:×Ô¶¨Òå½±Àø
# @author hxp
# @date 2023-09-22
# @version 1.0
#
# ÏêϸÃèÊö: ×Ô¶¨Òå½±Àø
#
#-------------------------------------------------------------------------------
#"""Version = 2023-09-22 13:30"""
#-------------------------------------------------------------------------------
 
import GameWorld
import PlayerCustomAward
import IpyGameDataPY
import PlayerControl
import ChConfig
 
## GMÃüÁîÖ´ÐÐÈë¿Ú
#  @param curPlayer µ±Ç°Íæ¼Ò
#  @param msgList ²ÎÊýÁбí []
#  @return None
#  @remarks º¯ÊýÏêϸ˵Ã÷.
def OnExec(curPlayer, msgList):
    if not msgList:
        GameWorld.DebugAnswer(curPlayer, "ÖØÖÃËùÓÐ: CustomAward 0")
        GameWorld.DebugAnswer(curPlayer, "ÉèÖý±Àø: CustomAward ID ÊÇ·ñ¿ÉÁì  ÊÇ·ñÒÑÁì")
        return
    
    cmdType = msgList[0]
    if cmdType == 0:
        awardIDMax = 0
        ipyDataMgr = IpyGameDataPY.IPY_Data()
        for index in range(ipyDataMgr.GetCustomAwardCount()):
            ipyData = ipyDataMgr.GetCustomAwardByIndex(index)
            if awardIDMax < ipyData.GetAwardID():
                awardIDMax = ipyData.GetAwardID()
                
        keyNumMax = GameWorld.GetDictKeyNumByBit(awardIDMax)
        for keyNum in range(keyNumMax + 1):
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CustomAwardCanGet % keyNum, 0)
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CustomAwardGetState % keyNum, 0)
            
        PlayerCustomAward.Sync_CustomAwardInfo(curPlayer, None, True)
        GameWorld.DebugAnswer(curPlayer, "ÖØÖÃOK")
    else:
        awardID = cmdType
        canGet = msgList[1] if len(msgList) > 1 else 0
        getState = msgList[2] if len(msgList) > 2 else 0
        ipyData = IpyGameDataPY.GetIpyGameData("CustomAward", awardID)
        if not ipyData:
            GameWorld.DebugAnswer(curPlayer, "²»´æÔڸý±ÀøID:%s" % awardID)
            return
        GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_CustomAwardCanGet, awardID, canGet)
        GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_CustomAwardGetState, awardID, getState)
        PlayerCustomAward.Sync_CustomAwardInfo(curPlayer, awardID, True)
        GameWorld.DebugAnswer(curPlayer, "½±ÀøID:%s,¿ÉÁì:%s,ÒÑÁì:%s" % (awardID, canGet, getState))
        
    return