#!/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 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  
 | 
      
 | 
    goldWashCostList = washData.GetGoldWashCostList()  
 | 
    if not goldWashCostList or len(goldWashCostList) != 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 if checkUseGoldCnt <= 0 else goldWashCostList[checkUseGoldCnt - 1]  
 | 
    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 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)  
 | 
            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)  
 | 
          
 | 
    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:  
 | 
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashValue % (equipPlace, attrNum), tempValue)  
 | 
            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  
 | 
  
 |