hxp
2025-10-22 5925409bdea13d819e4e4356a51043de5f3f9bd8
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package GM.Commands.Success
#
# @todo:³É¾Í
# @author hxp
# @date 2020-03-31
# @version 1.0
#
# ÏêϸÃèÊö: ³É¾Í
#
#-------------------------------------------------------------------------------
#"""Version = 2020-03-31 18:00"""
#-------------------------------------------------------------------------------
 
import ShareDefine
import PlayerSuccess
import IpyGameDataPY
import GameWorld
 
def OnExec(curPlayer, msgList):
    if not msgList:
        GameWorld.DebugAnswer(curPlayer, "ÖØÖóɾÍ: Success 0 [ÀàÐÍ ...]")
        GameWorld.DebugAnswer(curPlayer, "Êä³ö³É¾Í: Success p ÀàÐÍ")
        GameWorld.DebugAnswer(curPlayer, "Ôö¼Ó½ø¶È: Success a ÀàÐÍ ½ø¶È [Ìõ¼þ ...]")
        GameWorld.DebugAnswer(curPlayer, "¸üнø¶È: Success u ÀàÐÍ ½ø¶È [Ìõ¼þ ...]")
        return
    
    cmdType = msgList[0]
    # ÖØÖÃÊý¾Ý
    if cmdType == 0:
        __DoResetSuccess(curPlayer, msgList)
    # Êä³öÊý¾Ý
    elif cmdType == "p":
        __DoPrintSuccess(curPlayer, msgList)
    # Ôö¼Ó½ø¶È
    elif cmdType == "a":
        succType = msgList[1] if len(msgList) > 1 else 0
        addValue = msgList[2] if len(msgList) > 2 else 1
        conds = msgList[3:]
        GameWorld.DebugAnswer(curPlayer, "Ôö¼Ó³É¾Í½ø¶È: T:%s,V:%s,C:%s" % (succType, addValue, conds))
        PlayerSuccess.DoAddSuccessProgress(curPlayer, succType, addValue, conds)
    # ¸üнø¶È
    elif cmdType == "u":
        succType = msgList[1] if len(msgList) > 1 else 0
        newCnt = msgList[2] if len(msgList) > 2 else 1
        conds = msgList[3:]
        GameWorld.DebugAnswer(curPlayer, "¸üгɾͽø¶È: T:%s,V:%s,C:%s" % (succType, addValue, conds))
        PlayerSuccess.UptateSuccessProgress(curPlayer, succType, newCnt, conds)
    return
 
def __DoResetSuccess(curPlayer, msgList, resetValue=True):
    ## ÖØÖóɾÍÊý¾Ý
    if len(msgList) > 1:
        typeList = msgList[1:]
    else:
        typeList = ShareDefine.SuccessTypeList
        
    succIDList = []
    syncTypeCondList = []
    for succType in typeList:
        ipyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("Success", succType)
        if not ipyDataList:
            continue
        for ipyData in ipyDataList:
            succID = ipyData.GetSuccID()
            conds = ipyData.GetCondition()
            
            if PlayerSuccess.GetSuccHasGot(curPlayer, succID):
                succIDList.append(succID)
                PlayerSuccess.SetSuccHasGot(curPlayer, succID, False)
                
            if [succType, conds] not in syncTypeCondList:
                syncTypeCondList.append([succType, conds])
                PlayerSuccess.SetSuccValue(curPlayer, succType, conds, 0)
                
    PlayerSuccess.SyncSuccessInfo(curPlayer, syncTypeCondList, True)
    PlayerSuccess.SyncSuccessAwardRecord(curPlayer, succIDList, True)
    GameWorld.DebugAnswer(curPlayer, "ÖØÖóɾÍÀàÐÍ:%s" % typeList)
    return
 
def __DoPrintSuccess(curPlayer, msgList):
    ## Êä³ö³É¾ÍÊý¾Ý
    if len(msgList) > 1:
        typeList = msgList[1:]
    else:
        typeList = ShareDefine.SuccessTypeList
    GameWorld.DebugAnswer(curPlayer, "--- Êä³öÓнø¶ÈµÄ³É¾ÍÊý¾Ý ---")
    for succType in typeList:
        ipyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("Success", succType)
        if not ipyDataList:
            continue
        printType = False
        for ipyData in ipyDataList:
            succID = ipyData.GetSuccID()
            conds = ipyData.GetCondition()
            needCnt = ipyData.GetNeedCnt()
            value = PlayerSuccess.GetSuccValue(curPlayer, succType, conds)
            if not value:
                continue
            if not printType:
                printType = True
                GameWorld.DebugAnswer(curPlayer, "----- ³É¾ÍÀàÐÍ: %s" % succType)
            hasGot = PlayerSuccess.GetSuccHasGot(curPlayer, succID)
            GameWorld.DebugAnswer(curPlayer, "ID:%s,C:%s,V:%s/%s,½±:%s" % (succID, conds, value, needCnt, hasGot))
            
    return