xdh
2019-03-02 0f297a5b66b91751d8342624db871efeca7ed94e
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package Event.EventSrc.Operate_EquipWash
#
# @todo:×°±¸Ï´Á·
# @author hxp
# @date 2017-08-09
# @version 1.0
#
# ÏêϸÃèÊö: ×°±¸Ï´Á·
#
#-------------------------------------------------------------------------------
#"""Version = 2017-08-09 15:00"""
#-------------------------------------------------------------------------------
 
import GameWorld
import IpyGameDataPY
import NetPackCommon
import ChPyNetSendPack
import PlayerControl
import PlayerSuccess
import IPY_GameWorld
import DataRecordPack
import PlayerActLogin
import ShareDefine
import ItemCommon
import ChConfig
import ChEquip
import EventShell
 
import random
 
 
Def_EquipWashMaxType = 3 # ×°±¸Ï´Á·×î´ó¹é×éÀàÐÍ
Def_EquipWashMaxAttrCount = 3 # ×°±¸Ï´Á·×î´óÏ´Á·ÊôÐÔÌõÊý
 
def OnEquipWashLogin(curPlayer):
    Sycn_EquipWashInfo(curPlayer, isLogin=True)
    return
 
def GetEquipWashMaxLV(curPlayer, equipPlace):
    # @return: 0-먦·Å; >=1-¸Ã×°±¸Î»×î´ó¿ÉÏ´Á·µÈ¼¶
    washType = GetEquipWashType(equipPlace)
    if not washType:
        return 0
    maxLVDict = IpyGameDataPY.GetFuncEvalCfg("EquipWashGroup%s" % washType, 2)
    if not maxLVDict:
        return 0
    equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
    curEquip = equipPack.GetAt(equipPlace)
    if not curEquip or curEquip.IsEmpty():
        GameWorld.DebugLog("¸Ã×°±¸Î»Ã»ÓÐ×°±¸,ÎÞ·¨Ï´Á·£¡equipPlace=%s" % (equipPlace))
        return 0
    equipClassLV = ItemCommon.GetItemClassLV(curEquip)
    minClassLVCfg = min(maxLVDict)
    if equipClassLV < minClassLVCfg:
        GameWorld.DebugLog("¸Ã×°±¸Î»×°±¸½×¼¶=%s < minClassLVCfg(%s),ÎÞ·¨Ï´Á·£¡equipPlace=%s" 
                           % (equipClassLV, minClassLVCfg, equipPlace))
        return 0
    if equipClassLV in maxLVDict:
        maxWashLV = maxLVDict[equipClassLV]
        if not maxWashLV:
            GameWorld.DebugLog("¸Ã×°±¸Î»×°±¸½×¼¶=%s,maxWashLV=%s,ÎÞ·¨Ï´Á·£¡equipPlace=%s" 
                               % (equipClassLV, maxWashLV, equipPlace))
            return 0
        return maxWashLV
    maxClassLVCfg = max(maxLVDict)
    if equipClassLV > maxClassLVCfg:
        return maxLVDict[maxClassLVCfg]
    # Ä¬ÈÏ·µ»Øµ±Ç°²¿Î»Ï´Á·µÈ¼¶
    return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % equipPlace) + 1
 
def GetEquipWashPlaceList(washType):
    ## »ñȡϴÁ·ÀàÐͶÔÓ¦µÄËùÓÐ×°±¸Î»
    placeList = IpyGameDataPY.GetFuncEvalCfg("EquipWashGroup%s" % washType, 1)
    if placeList:
        return placeList
    return []
 
def GetEquipWashType(equipPlace):
    ## »ñȡװ±¸Î»¶ÔÓ¦µÄÏ´Á·ÀàÐÍ
    for washType in range(1, Def_EquipWashMaxType + 1):
        placeList = GetEquipWashPlaceList(washType)
        if equipPlace in placeList:
            return washType
    return
 
def GetEquipWashData(washType, washLV):
    return IpyGameDataPY.GetIpyGameData("EquipWash", washType, washLV)
 
def GetAllEquipWashPlace():
    # »ñÈ¡ËùÓпÉÏ´Á·µÄ×°±¸Î»
    allPlaceList = []
    for washType in range(1, Def_EquipWashMaxType + 1):
        allPlaceList += GetEquipWashPlaceList(washType)
    return allPlaceList
 
#// A3 25 ×°±¸Ï´Á¶ #tagCMEquipXLAttrChange
#
#struct    tagCMEquipXLAttrChange
#{
#    tagHead        Head;
#    BYTE        EquipPlace;    // ×°±¸Î»
#    BYTE        CheckUseGoldAttr;    // ¹´Ñ¡Ê¹ÓÃ×êʯϴÁ·ÊôÐÔ±àºÅÐÅÏ¢; °´ÊôÐÔ±àºÅλ¶þ½øÖÆ´ú±íÊÇ·ñ¹´Ñ¡
#                                        Èç¹´Ñ¡ÊôÐÔ1´ú±í0λ, Ôò·¢1, ¹´Ñ¡ÊôÐÔ1¡¢2Ôò·¢3£¬,¹´Ñ¡ÊôÐÔ1¡¢2¡¢3Ôò·¢7
#};
def OnEquipWashAttr(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    playerID = curPlayer.GetPlayerID()
    
    equipPlace = clientData.EquipPlace
    checkUseGoldAttr = clientData.CheckUseGoldAttr
    
    washType = GetEquipWashType(equipPlace)
    maxWashLV = GetEquipWashMaxLV(curPlayer, equipPlace)
    washLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % equipPlace) + 1
    GameWorld.DebugLog("×°±¸Ï´Á·: equipPlace=%s,checkUseGoldAttr=%s,washType=%s,washLV=%s,maxWashLV=%s" 
                       % (equipPlace, checkUseGoldAttr, washType, washLV, maxWashLV), playerID)
    
    if washType is None:
        GameWorld.Log("¸Ã×°±¸Î»ÎÞ·¨Ï´Á·! equipPlace=%s" % (equipPlace), playerID)
        return
    
    if maxWashLV < 1:
        return
        
    washData = GetEquipWashData(washType, washLV)
    if not washData:
        GameWorld.ErrLog("ÕÒ²»µ½¸Ã×°±¸Ï´Á·Êý¾Ý: washType=%s,washLV=%s" % (washType, washLV))
        return
    
    maxValueAttrNumList = [] # ÒÑ´ïµ½µ±Ç°µÈ¼¶×î´óÖµµÄÊôÐÔ±àºÅÁбí
    for attrNum in range(1, Def_EquipWashMaxAttrCount + 1):
        maxValue = getattr(washData, "GetAttrMax%s" % attrNum)()
        washValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (equipPlace, attrNum))
        washValueTemp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValueTemp % (equipPlace, attrNum))
        if washValueTemp != 0:
            GameWorld.Log("»¹ÓÐδѡÔñÊÇ·ñ±£´æµÄÏ´Á·ÊôÐÔ£¬²»¿ÉÏ´Á·£¡equipPlace=%s,attrNum=%s,washValueTemp=%s" 
                          % (equipPlace, attrNum, washValueTemp), playerID)
            return
        if washValue >= maxValue:
            maxValueAttrNumList.append(attrNum)
            
    if washLV >= maxWashLV and len(maxValueAttrNumList) == Def_EquipWashMaxAttrCount:
        GameWorld.DebugLog("ËùÓÐÏ´Á·ÊôÐÔÒѾ­´ïµ½×î´óÏ´Á·µÈ¼¶Öµ£¬ÎÞ·¨Ï´Á·£¡maxWashLV=%s" % maxWashLV, playerID)
        return
    
    if len(maxValueAttrNumList) == Def_EquipWashMaxAttrCount:
        GameWorld.DebugLog("ËùÓÐÏ´Á·ÊôÐÔÒѾ­´ïµ½±¾µÈ¼¶×î´óÖµ£¬ÇëÏÈÉý¼¶ºóÔÙÏ´Á·£¡maxWashLV=%s" % maxWashLV, playerID)
        return
    
    costItemID = washData.GetCostItemID()
    costItemCount = washData.GetCostItemCount()
    costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, costItemID)
    if bindCnt + unBindCnt < costItemCount:
        GameWorld.DebugLog("×°±¸Ï´Á·ËùÐèÏûºÄµÀ¾ß²»×㣬ÎÞ·¨Ï´Á·!costItemID=%s,costItemCount=%s,bindCnt=%s,unBindCnt=%s" 
                           % (costItemID, costItemCount, bindCnt, unBindCnt), playerID)
        return
    
    goldWashCostItemCountList = washData.GetGoldWashCostList() # Ï´Á·±ØÔöÌõÊýÏûºÄ±ØÔöµÀ¾ß¸öÊý
    if not goldWashCostItemCountList or len(goldWashCostItemCountList) != Def_EquipWashMaxAttrCount:
        return
    
    randAttrDict = {} # Ëæ»ú±ä¸üÖµ×Öµä {ÊôÐÔ±àºÅ:Ëæ»úÖµ, ...}
    useGoldAttrNumList = [] # Ê¹ÓÃ×êʯϴÁ·µÄÊôÐÔ±àºÅÁбí
    negativeValueCnt = 0 # ¸ºÖµÊý, É趨º¬0°É£¬¼´·ÇÕýÊý
    fixMaxValueDict = {} # È«·þÐÞÕýÖµ×î´óÖµ×Öµä {ÊôÐÔ±àºÅ:×î´óÖµ, ...}
    for attrNum in range(1, Def_EquipWashMaxAttrCount + 1):
        if attrNum in maxValueAttrNumList:
            continue
        
        washValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (equipPlace, attrNum))
        if checkUseGoldAttr & pow(2, attrNum - 1):
            useGoldAttrNumList.append(attrNum)
            randValueMin = getattr(washData, "GetAttrCostGoldMin%s" % attrNum)()
            randValueMax = getattr(washData, "GetAttrCostGoldMax%s" % attrNum)()
        else:
            randValueMin, randValueMax = 0, 0
            randDict = getattr(washData, "GetAttrRandDict%s" % attrNum)()
            for randKey, randRange in randDict.items():
                if randKey[0] <= washValue <= randKey[1]:
                    randValueMin, randValueMax = randRange
                    break
            if not randValueMin and not randValueMax:
                GameWorld.ErrLog("ÕÒ²»µ½¸Ã×°±¸Î»µ±Ç°Ï´Á·Öµ·¶Î§Ëæ»úÖµ!equipPlace=%s,washType=%s,washLV=%s,attrNum=%s,washValue=%s,randDict=%s" 
                                 % (equipPlace, washType, washLV, attrNum, washValue, randDict))
                return
        GameWorld.DebugLog("Ëæ»ú·¶Î§ÊôÐÔ%s, washValue=%s, %s~%s" % (attrNum, washValue, randValueMin, randValueMax))
        randValue = random.randint(randValueMin, randValueMax)
        randAttrDict[attrNum] = randValue
        if randValue <= 0:
            negativeValueCnt += 1
        fixMaxValueDict[attrNum] = randValueMax
        
    checkUseGoldCnt = len(useGoldAttrNumList)
    needGold = 0
    needMustID = IpyGameDataPY.GetFuncCfg("EquipWashMustID", 1)
    needMustIDCount = 0 if checkUseGoldCnt <= 0 else goldWashCostItemCountList[checkUseGoldCnt - 1]
    delMustIDCount = needMustIDCount
    mustItemIndexList, mustBindCnt, mustUnBindCnt = [], 0, 0
    if needMustIDCount:
        mustItemIndexList, mustBindCnt, mustUnBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, needMustID, needMustIDCount)
        mustItemLackCount = max(0, needMustIDCount - (mustBindCnt + mustUnBindCnt))
        if mustItemLackCount > 0:
            needGold = ItemCommon.GetAutoBuyItemNeedGold({needMustID:mustItemLackCount})
            if needGold <= 0:
                GameWorld.ErrLog("×Ô¶¯¹ºÂò±ØÔöµÀ¾ßËùÐèÏÉÓñÒì³££¡needMustID=%s,mustItemLackCount=%s,needGold=%s" 
                                 % (needMustID, mustItemLackCount, needGold), playerID)
                return
            delMustIDCount = needMustIDCount - mustItemLackCount
            
    if needGold and not PlayerControl.HaveMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, needGold):
        GameWorld.DebugLog("ÏÉÓñ²»×㣬ÎÞ·¨Ï´Á·£¡checkUseGoldCnt=%s,needGold=%s" % (checkUseGoldCnt, needGold), playerID)
        return
    
    preWashData = None # ÉÏһϴÁ·µÈ¼¶Êý¾Ý
    if washLV > 1:
        preWashData = GetEquipWashData(washType, washLV - 1)
        if not preWashData:
            GameWorld.ErrLog("ÕÒ²»µ½ÉÏÒ»¼¶Ï´Á·Êý¾Ý£¬ÎÞ·¨Ï´Á·!preWashLV=%s" % (washLV - 1))
            return
        
    # ¿Û³ýÏûºÄ
    ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, costItemCount, "EquipWash")
    if delMustIDCount:
        ItemCommon.DelCostItemByBind(curPlayer, mustItemIndexList, mustBindCnt, mustUnBindCnt, delMustIDCount, "EquipWash")
        
    if needGold:
        infoDict = {"EquipPlace":equipPlace, "WashType":washType, "WashLV":washLV, "CheckUseGoldCnt":checkUseGoldCnt}
        PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, needGold, ChConfig.Def_Cost_EquipWash, infoDict)
        
    GameWorld.DebugLog("Ëæ»úÏ´Á·: randAttrDict=%s,fixMaxValueDict=%s" % (randAttrDict, fixMaxValueDict), playerID)
    # È«¸ºÐÞÕý
    if negativeValueCnt == Def_EquipWashMaxAttrCount:
        minPer = 1
        minPerAttrNum = 1
        for attrNum in range(1, Def_EquipWashMaxAttrCount + 1):
            washValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (equipPlace, attrNum))
            preMaxValue = 0 if not preWashData else getattr(preWashData, "GetAttrMax%s" % attrNum)()
            curMaxValue = getattr(washData, "GetAttrMax%s" % attrNum)()
            curPer = (washValue - preMaxValue) / float(curMaxValue - preMaxValue)
            GameWorld.DebugLog("È«¸ºÐÞÕý±ÈÀý: attrNum=%s,curPer=%s" % (attrNum, curPer))
            if curPer < minPer:
                minPer = curPer
                minPerAttrNum = attrNum
                
        # µ±Ç°Ï´Á·±ÈÀýÖµ×îµÍµÄÐÞÕýΪÕýÊý
        fixValue = random.randint(1, fixMaxValueDict[minPerAttrNum])
        randAttrDict[minPerAttrNum] = fixValue
        GameWorld.DebugLog("È«¸ºÏ´Á·ÐÞÕý: minPerAttrNum=%s,minPer=%s,fixValue=%s,randAttrDict=%s" 
                           % (minPerAttrNum, minPer, fixValue, randAttrDict), playerID)
        
    # ×îÖÕÏ´Á·ÖµÈ·ÈÏ
    isRefreshAttr = False
    for attrNum, randValue in randAttrDict.items():
        washValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (equipPlace, attrNum))
        tempValue = washValue + randValue
        preMaxValue = 0 if not preWashData else getattr(preWashData, "GetAttrMax%s" % attrNum)()
        maxValue = getattr(washData, "GetAttrMax%s" % attrNum)()
        GameWorld.DebugLog("×îÖÕÏ´Á·ÖµÈ·ÈÏ: attrNum=%s,washValue=%s,randValue=%s,tempValue=%s,preMaxValue=%s,maxValue=%s" 
                           % (attrNum, washValue, randValue, tempValue, preMaxValue, maxValue), playerID)
        
        # ÏÂÏÞֵΪÉÏÒ»´ÎµÄÉÏÏÞÖµ
        if tempValue < preMaxValue:
            tempValue = preMaxValue
            GameWorld.DebugLog("    ÏÂÏÞÖµÐÞÕý: tempValue=%s" % tempValue, playerID)
            
        # ×îºóÒ»¼¶µÄ»°¿É²»³¬¹ý×î´óÖµ£¬²»ÊÇ×îºóÒ»¼¶¿ÉÒç³ö
        if washLV == maxWashLV and tempValue > maxValue:
            tempValue = maxValue
            GameWorld.DebugLog("    ÉÏÏÞÖµÐÞÕý: maxValue=%s,tempValue=%s" % (maxValue, tempValue), playerID)
            
        # Ê¹ÓÃ×êʯϴÁ·µÄÖ±½Ó¸üУ¬²»ÓÃÈ·ÈÏ
        if attrNum in useGoldAttrNumList:
            isRefreshAttr = True
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashValue % (equipPlace, attrNum), tempValue)
            dataDict = {'equipPlace':equipPlace,'attrNum':attrNum,'oldValue':washValue,'newValue':tempValue}
            DataRecordPack.Cache_FightPowerChangeInfo(curPlayer, ChConfig.PowerDownType_EquipWash, dataDict)
            GameWorld.DebugLog("    ¹´Ñ¡Ï´Á·£¬Ö±½Ó¸üÐÂÊýÖµ: %s" % tempValue, playerID)
        else:
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashValueTemp % (equipPlace, attrNum), tempValue)
            
    #ÆÁ±Î×Ô¶¯Éý¼¶
#    if isRefreshAttr and washLV < maxWashLV:
#        CheckEquipWashLVUp(curPlayer, equipPlace, washLV, washData)
        
    Sycn_EquipWashInfo(curPlayer, equipPlace)
    
    if isRefreshAttr:
        RefreshEquipWashAttr(curPlayer)
    PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_EquipWash, 1)
    return
 
 
#// A3 26 ×°±¸Ï´Á¶½á¹ûÈ·ÈÏ #tagCMEquipXLAttrChangeOK
#
#struct    tagCMEquipXLAttrChangeOK
#{
#    tagHead        Head;
#    BYTE        EquipPlace;    // ×°±¸Î»
#    BYTE        IsSave;        // ÊÇ·ñ±£´æ 0-·ñ; 1-ÊÇ; 2-ÊÖ¶¯Éý¼¶
#};
def OnEquipWashAttrChangeOK(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    playerID = curPlayer.GetPlayerID()
    
    equipPlace = clientData.EquipPlace
    isSave = clientData.IsSave
    
    washLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % equipPlace) + 1
    maxWashLV = GetEquipWashMaxLV(curPlayer, equipPlace)
    GameWorld.DebugLog("È·ÈÏÏ´Á·½á¹û: equipPlace=%s,isSave=%s,washLV=%s,maxWashLV=%s" 
                       % (equipPlace, isSave, washLV, maxWashLV), playerID)
    
    washType = GetEquipWashType(equipPlace)
    if washType is None:
        return
    if maxWashLV < 1:
        return
    washData = GetEquipWashData(washType, washLV)
    if not washData:
        return
    
    # ÊÖ¶¯Éý¼¶
    if isSave == 2:
        if washLV >= maxWashLV:
            GameWorld.DebugLog("ÒÑ´ïµ½×î´óÏ´Á·µÈ¼¶£¬²»¿ÉÉý¼¶£¡", playerID)
            return
        if CheckEquipWashLVUp(curPlayer, equipPlace, washLV, washData):
            RefreshEquipWashAttr(curPlayer)
            Sycn_EquipWashInfo(curPlayer, equipPlace)
            EquipWashSuccess(curPlayer)
        else:
            GameWorld.DebugLog("Éý¼¶Ê§°Ü£¬ÓÐÊôÐÔδ´ïµ½×î´óÖµ£¬ÎÞ·¨Éý¼¶!", playerID)
        return
    
    for attrNum in range(1, Def_EquipWashMaxAttrCount + 1):
        tempValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValueTemp % (equipPlace, attrNum))
        if not tempValue:
            continue
        
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashValueTemp % (equipPlace, attrNum), 0)
        if isSave == 1:
            oldValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (equipPlace, attrNum))
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashValue % (equipPlace, attrNum), tempValue)
            dataDict = {'equipPlace':equipPlace,'attrNum':attrNum,'oldValue':oldValue,'newValue':tempValue}
            DataRecordPack.Cache_FightPowerChangeInfo(curPlayer, ChConfig.PowerDownType_EquipWash, dataDict)
            GameWorld.DebugLog("±£´æÏ´Á·Êý¾Ý: equipPlace=%s,attrNum=%s,tempValue=%s" % (equipPlace, attrNum, tempValue), playerID)
            
    if isSave == 1:
        RefreshEquipWashAttr(curPlayer)
    #ÆÁ±Î×Ô¶¯Éý¼¶
#        if washLV < maxWashLV:
#            CheckEquipWashLVUp(curPlayer, equipPlace, washLV, washData)
    Sycn_EquipWashInfo(curPlayer, equipPlace)
    return
 
def CheckEquipWashLVUp(curPlayer, equipPlace, washLV, washData):
    # ¼ì²éÏ´Á·ÀàÐÍÉý¼¶
    
    for attrNum in range(1, Def_EquipWashMaxAttrCount + 1):
        tempValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (equipPlace, attrNum))
        # Ö»ÒªÓÐδ´ïµ½±¾¼¶×î´óÖµµÄ£¬Ôò²»ÄÜÉý¼¶
        if tempValue < getattr(washData, "GetAttrMax%s" % attrNum)():
            return
    washLV += 1
    # ×ֵ䴿´¢µÄ´Ó0¿ªÊ¼£¬0´ú±í1¼¶£¬ËùÒÔʵ¼Ê´æ½øÈ¥µÄÖµÐè¼õ1
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashLV % (equipPlace), washLV - 1)
    GameWorld.DebugLog("×°±¸Ï´Á·µÈ¼¶Éý¼¶: equipPlace=%s,washLV=%s" % (equipPlace, washLV), curPlayer.GetPlayerID())
    
    # Ï´Á·¹ã²¥
    PlayerControl.WorldNotify(0, "WashCongratulation", [curPlayer.GetPlayerName(), curPlayer.GetPlayerID(), equipPlace, washLV])
    for washType in range(1, Def_EquipWashMaxType + 1):
        placeList = GetEquipWashPlaceList(washType)
        if equipPlace not in placeList:
            continue
        
        minWashLV = 999
        for equipPlace in placeList:
            minWashLV = min(minWashLV, curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % equipPlace) + 1)
        
        if minWashLV == washLV:
            # Óо«È·ÃüÖÐÊý¾ÝµÈ¼¶£¬´ú±í¸ÕºÃ´ï³É¸ÃÏ´Á·Ì××°
            washSpecLVIpyData = IpyGameDataPY.GetIpyGameDataNotLog("EquipWashSpec", washType, washLV)
            if washSpecLVIpyData:
                PlayerControl.WorldNotify(0, "WashMasterCongratulation", [curPlayer.GetPlayerName(), curPlayer.GetPlayerID(), washType, washLV])
        EventShell.EventRespons_EquipWash(curPlayer, washType, washLV)
        break
    return True
 
 
def Sycn_EquipWashInfo(curPlayer, equipPlace=-1, isLogin=False):
    hasValue = False
    
    pack = ChPyNetSendPack.tagMCEquipPartXLAttrInfo()
    pack.Clear()
    pack.InfoList = []
    
    if equipPlace == -1:
        syncPlaceList = GetAllEquipWashPlace()
    else:
        syncPlaceList = [equipPlace]
        
    for place in syncPlaceList:
        equipPart = ChPyNetSendPack.tagMCEquipPartXLAttr()
        equipPart.EquipPlace = place
        equipPart.XLAttrLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % place) + 1
        equipPart.XLAttrList = []
        for attrNum in range(1, Def_EquipWashMaxAttrCount + 1):
            washValue = ChPyNetSendPack.tagMCEquipPartXLAttrValue()
            washValue.XLAttrValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (place, attrNum))
            washValue.XLAttrChange = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValueTemp % (place, attrNum))
            equipPart.XLAttrList.append(washValue)
            if washValue.XLAttrValue or washValue.XLAttrChange:
                hasValue = True
                
        equipPart.XLAttrCnt = len(equipPart.XLAttrList)
        pack.InfoList.append(equipPart)
        
    pack.Count = len(pack.InfoList)
    
    # µÇ¼ͬ²½Ê±Èç¹ûûÓÐÏ´Á·ÊôÐÔÔò²»Í¬²½
    if isLogin and not hasValue:
        return
    
    NetPackCommon.SendFakePack(curPlayer, pack)
    return
 
def RefreshEquipWashAttr(curPlayer):
    ChEquip.RefreshPlayerEquipAttribute(curPlayer)
    #Ë¢ÐÂËùÓÐÊôÐÔ
    playControl = PlayerControl.PlayerControl(curPlayer)
    playControl.RefreshPlayerAttrState()
    return
 
def CalcAttr_EquipWash(curPlayer, equipPlace, allAttrList):
    ## ×°±¸Î»Ï´Á·ÊôÐÔ
    washLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % equipPlace) + 1
    washType = GetEquipWashType(equipPlace)
    if washType is None:
        return
    washData = GetEquipWashData(washType, washLV)
    if not washData:
        return
    #GameWorld.DebugLog("×°±¸Î»ÊôÐÔ: equipPlace=%s,washLV=%s" % (equipPlace, washLV))
    for attrNum in range(1, Def_EquipWashMaxAttrCount + 1):
        attrID = getattr(washData, "GetAttrType%s" % attrNum)()
        attrValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (equipPlace, attrNum))
        #GameWorld.DebugLog("    attrNum=%s,attrID=%s, attrValue=%s" % (attrNum, attrID, attrValue))
        if attrValue:
            PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrList)
    return
 
def CalcAttr_EquipWashSpec(curPlayer, equipPlaceList, allAttrList):
    ## ×°±¸Ï´Á·ÀàÐ͵ȼ¶¶ÔÓ¦ÌØÊâÌ×ÊôÐÔ
    for washType in range(1, Def_EquipWashMaxType + 1):
        washTypeLV = 999
        placeList = GetEquipWashPlaceList(washType)
        for equipPlace in placeList:
            if equipPlace not in equipPlaceList:
                washTypeLV = 0 # Ðè´©´÷×°±¸²ÅÓÐЧ
                break
            washLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % equipPlace) + 1
            washTypeLV = min(washTypeLV, washLV)
        #GameWorld.DebugLog("Ï´Á·Ì××°ÊôÐÔ: washType=%s,washTypeLV=%s" % (washType, washTypeLV))
        if not washTypeLV:
            continue
        washSpecData = IpyGameDataPY.InterpolationSearch("EquipWashSpec", "WashLVNeed", washTypeLV, {"WashTypeNeed":washType})
        if not washSpecData:
            continue
        
        attrTypeList = washSpecData.GetAddAttrType()
        attrValueList = washSpecData.GetAddAttrValue()
        for i, attrID in enumerate(attrTypeList):
            PlayerControl.CalcAttrDict_Type(attrID, attrValueList[i], allAttrList)
            #GameWorld.DebugLog("    EquipWashSpec attrID=%s, attrValue=%s" % (attrID, attrValueList[i]))
            
    return
 
def EquipWashSuccess(curPlayer):
    succList = [ShareDefine.SuccType_EquipWashLV1,ShareDefine.SuccType_EquipWashLV2,ShareDefine.SuccType_EquipWashLV3]
    for washType in range(1, Def_EquipWashMaxType + 1):
        washTypeLV = 999
        placeList = GetEquipWashPlaceList(washType)
        for equipPlace in placeList:
            washLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % equipPlace) + 1
            washTypeLV = min(washTypeLV, washLV)
        
        if not washTypeLV:
            continue
        PlayerSuccess.DoAddSuccessProgress(curPlayer, succList[washType-1], 1, [washTypeLV])
    return