|  |  |  | 
|---|
|  |  |  | import PlayerControl | 
|---|
|  |  |  | import PlayerSuccess | 
|---|
|  |  |  | import IPY_GameWorld | 
|---|
|  |  |  | import DataRecordPack | 
|---|
|  |  |  | import PlayerActLogin | 
|---|
|  |  |  | import ShareDefine | 
|---|
|  |  |  | import ItemCommon | 
|---|
|  |  |  | import ChConfig | 
|---|
|  |  |  | 
|---|
|  |  |  | import random | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Def_EquipWashMaxType = 3 # 装备洗练最大归组类型 | 
|---|
|  |  |  | Def_EquipWashMaxType = 2 # 装备洗练最大归组类型 | 
|---|
|  |  |  | Def_EquipWashMaxAttrCount = 3 # 装备洗练最大洗练属性条数 | 
|---|
|  |  |  | g_allIndexList = [] #可洗炼的部位缓存 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def OnEquipWashLogin(curPlayer): | 
|---|
|  |  |  | Sycn_EquipWashInfo(curPlayer, isLogin=True) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def GetEquipWashMaxLV(curPlayer, equipPlace): | 
|---|
|  |  |  | def GetEquipWashMaxLV(curPlayer, equipPackindex, equipPlace): | 
|---|
|  |  |  | # @return: 0-未开放; >=1-该装备位最大可洗练等级 | 
|---|
|  |  |  | maxLVDict = IpyGameDataPY.GetFuncEvalCfg("EquipWashMaxLV", 1) | 
|---|
|  |  |  | if not maxLVDict: | 
|---|
|  |  |  | washType = GetEquipWashType(equipPlace) | 
|---|
|  |  |  | if not washType: | 
|---|
|  |  |  | return 0 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip) | 
|---|
|  |  |  | curEquip = equipPack.GetAt(equipPlace) | 
|---|
|  |  |  | curEquip = equipPack.GetAt(equipPackindex) | 
|---|
|  |  |  | if not curEquip or curEquip.IsEmpty(): | 
|---|
|  |  |  | GameWorld.DebugLog("该装备位没有装备,无法洗练!equipPlace=%s" % (equipPlace)) | 
|---|
|  |  |  | GameWorld.DebugLog("该装备位没有装备,无法洗练!equipPackindex=%s" % (equipPackindex)) | 
|---|
|  |  |  | return 0 | 
|---|
|  |  |  | equipClassLV = ItemCommon.GetItemClassLV(curEquip) | 
|---|
|  |  |  | minClassLVCfg = min(maxLVDict) | 
|---|
|  |  |  | if equipClassLV < minClassLVCfg: | 
|---|
|  |  |  | GameWorld.DebugLog("该装备位装备阶级=%s < minClassLVCfg(%s),无法洗练!equipPlace=%s" | 
|---|
|  |  |  | % (equipClassLV, minClassLVCfg, equipPlace)) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | equipStar = ChEquip.GetEquipPartStarByRank(curPlayer, equipPackindex, curEquip) | 
|---|
|  |  |  | ipyData = IpyGameDataPY.InterpolationSearch('ItemWashMax', 'Star', equipStar, {'Type':washType}) | 
|---|
|  |  |  | if not ipyData: | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | return ipyData.GetLevelMax() | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | return IpyGameDataPY.GetFuncEvalCfg('EquipWashGroup', 1, {}).get(equipPlace) | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | global g_allIndexList | 
|---|
|  |  |  | if not g_allIndexList: | 
|---|
|  |  |  | maxClasslv = IpyGameDataPY.GetFuncCfg('EquipMaxClasslv') | 
|---|
|  |  |  | for equipPlace in IpyGameDataPY.GetFuncEvalCfg('EquipWashGroup', 1, {}): | 
|---|
|  |  |  | for classLV in xrange(1, maxClasslv+1): | 
|---|
|  |  |  | ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, equipPlace) | 
|---|
|  |  |  | if not ipyData: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | g_allIndexList.append(ipyData.GetGridIndex()) | 
|---|
|  |  |  | return g_allIndexList | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #// A3 25 装备洗炼 #tagCMEquipXLAttrChange | 
|---|
|  |  |  | # | 
|---|
|  |  |  | 
|---|
|  |  |  | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) | 
|---|
|  |  |  | playerID = curPlayer.GetPlayerID() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | equipPlace = clientData.EquipPlace | 
|---|
|  |  |  | equipPackindex = clientData.EquipPlace | 
|---|
|  |  |  | checkUseGoldAttr = clientData.CheckUseGoldAttr | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ipyData = IpyGameDataPY.GetIpyGameDataByCondition('EquipPlaceIndexMap', {'GridIndex':equipPackindex}) | 
|---|
|  |  |  | if not ipyData: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | equipPlace = ipyData.GetEquipPlace() | 
|---|
|  |  |  | classLV = ipyData.GetClassLV() | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | maxWashLV = GetEquipWashMaxLV(curPlayer, equipPackindex, equipPlace) | 
|---|
|  |  |  | washLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % equipPackindex) + 1 | 
|---|
|  |  |  | GameWorld.DebugLog("装备洗练: classLV=%s,equipPlace=%s,checkUseGoldAttr=%s,washType=%s,washLV=%s,maxWashLV=%s" | 
|---|
|  |  |  | % (classLV, equipPlace, checkUseGoldAttr, washType, washLV, maxWashLV), playerID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if maxWashLV < 1: | 
|---|
|  |  |  | 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)) | 
|---|
|  |  |  | washValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (equipPackindex, attrNum)) | 
|---|
|  |  |  | washValueTemp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValueTemp % (equipPackindex, attrNum)) | 
|---|
|  |  |  | if washValueTemp != 0: | 
|---|
|  |  |  | GameWorld.Log("还有未选择是否保存的洗练属性,不可洗练!equipPlace=%s,attrNum=%s,washValueTemp=%s" | 
|---|
|  |  |  | % (equipPlace, attrNum, washValueTemp), playerID) | 
|---|
|  |  |  | GameWorld.Log("还有未选择是否保存的洗练属性,不可洗练!equipPackindex=%s,attrNum=%s,washValueTemp=%s" | 
|---|
|  |  |  | % (equipPackindex, attrNum, washValueTemp), playerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | if washValue >= maxValue: | 
|---|
|  |  |  | maxValueAttrNumList.append(attrNum) | 
|---|
|  |  |  | 
|---|
|  |  |  | % (costItemID, costItemCount, bindCnt, unBindCnt), playerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | goldWashCostList = washData.GetGoldWashCostList() | 
|---|
|  |  |  | if not goldWashCostList or len(goldWashCostList) != Def_EquipWashMaxAttrCount: | 
|---|
|  |  |  | goldWashCostItemCountList = washData.GetGoldWashCostList() # 洗练必增条数消耗必增道具个数 | 
|---|
|  |  |  | if not goldWashCostItemCountList or len(goldWashCostItemCountList) != Def_EquipWashMaxAttrCount: | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | randAttrDict = {} # 随机变更值字典 {属性编号:随机值, ...} | 
|---|
|  |  |  | 
|---|
|  |  |  | if attrNum in maxValueAttrNumList: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | washValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (equipPlace, attrNum)) | 
|---|
|  |  |  | washValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (equipPackindex, attrNum)) | 
|---|
|  |  |  | if checkUseGoldAttr & pow(2, attrNum - 1): | 
|---|
|  |  |  | useGoldAttrNumList.append(attrNum) | 
|---|
|  |  |  | randValueMin = getattr(washData, "GetAttrCostGoldMin%s" % attrNum)() | 
|---|
|  |  |  | 
|---|
|  |  |  | 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)) | 
|---|
|  |  |  | GameWorld.ErrLog("找不到该装备位当前洗练值范围随机值!equipPackindex=%s,washType=%s,washLV=%s,attrNum=%s,washValue=%s,randDict=%s" | 
|---|
|  |  |  | % (equipPackindex, washType, washLV, attrNum, washValue, randDict)) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | GameWorld.DebugLog("随机范围属性%s, washValue=%s, %s~%s" % (attrNum, washValue, randValueMin, randValueMax)) | 
|---|
|  |  |  | randValue = random.randint(randValueMin, randValueMax) | 
|---|
|  |  |  | 
|---|
|  |  |  | fixMaxValueDict[attrNum] = randValueMax | 
|---|
|  |  |  |  | 
|---|
|  |  |  | checkUseGoldCnt = len(useGoldAttrNumList) | 
|---|
|  |  |  | needGold = 0 if checkUseGoldCnt <= 0 else goldWashCostList[checkUseGoldCnt - 1] | 
|---|
|  |  |  | 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 | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 扣除消耗 | 
|---|
|  |  |  | 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} | 
|---|
|  |  |  | infoDict = {'classLV':classLV, "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) | 
|---|
|  |  |  | 
|---|
|  |  |  | minPer = 1 | 
|---|
|  |  |  | minPerAttrNum = 1 | 
|---|
|  |  |  | for attrNum in range(1, Def_EquipWashMaxAttrCount + 1): | 
|---|
|  |  |  | washValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (equipPlace, attrNum)) | 
|---|
|  |  |  | washValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (equipPackindex, attrNum)) | 
|---|
|  |  |  | preMaxValue = 0 if not preWashData else getattr(preWashData, "GetAttrMax%s" % attrNum)() | 
|---|
|  |  |  | curMaxValue = getattr(washData, "GetAttrMax%s" % attrNum)() | 
|---|
|  |  |  | curPer = (washValue - preMaxValue) / float(curMaxValue - preMaxValue) | 
|---|
|  |  |  | 
|---|
|  |  |  | # 最终洗练值确认 | 
|---|
|  |  |  | isRefreshAttr = False | 
|---|
|  |  |  | for attrNum, randValue in randAttrDict.items(): | 
|---|
|  |  |  | washValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (equipPlace, attrNum)) | 
|---|
|  |  |  | washValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (equipPackindex, attrNum)) | 
|---|
|  |  |  | tempValue = washValue + randValue | 
|---|
|  |  |  | preMaxValue = 0 if not preWashData else getattr(preWashData, "GetAttrMax%s" % attrNum)() | 
|---|
|  |  |  | maxValue = getattr(washData, "GetAttrMax%s" % attrNum)() | 
|---|
|  |  |  | 
|---|
|  |  |  | # 使用钻石洗练的直接更新,不用确认 | 
|---|
|  |  |  | if attrNum in useGoldAttrNumList: | 
|---|
|  |  |  | isRefreshAttr = True | 
|---|
|  |  |  | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashValue % (equipPlace, attrNum), tempValue) | 
|---|
|  |  |  | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashValue % (equipPackindex, attrNum), tempValue) | 
|---|
|  |  |  | dataDict = {'classLV':classLV, '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) | 
|---|
|  |  |  | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashValueTemp % (equipPackindex, attrNum), tempValue) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #屏蔽自动升级 | 
|---|
|  |  |  | #    if isRefreshAttr and washLV < maxWashLV: | 
|---|
|  |  |  | #        CheckEquipWashLVUp(curPlayer, equipPlace, washLV, washData) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Sycn_EquipWashInfo(curPlayer, equipPlace) | 
|---|
|  |  |  | Sycn_EquipWashInfo(curPlayer, equipPackindex) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if isRefreshAttr: | 
|---|
|  |  |  | RefreshEquipWashAttr(curPlayer) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | RefreshEquipWashAttr(curPlayer, classLV) | 
|---|
|  |  |  | PlayerActLogin.AddLoginAwardActionCnt(curPlayer, ChConfig.Def_LoginAct_EquipWash, 1) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) | 
|---|
|  |  |  | playerID = curPlayer.GetPlayerID() | 
|---|
|  |  |  |  | 
|---|
|  |  |  | equipPlace = clientData.EquipPlace | 
|---|
|  |  |  | equipPackindex = 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) | 
|---|
|  |  |  | ipyData = IpyGameDataPY.GetIpyGameDataByCondition('EquipPlaceIndexMap', {'GridIndex':equipPackindex}) | 
|---|
|  |  |  | if not ipyData: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | equipPlace = ipyData.GetEquipPlace() | 
|---|
|  |  |  | classLV = ipyData.GetClassLV() | 
|---|
|  |  |  | washLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % equipPackindex) + 1 | 
|---|
|  |  |  | maxWashLV = GetEquipWashMaxLV(curPlayer, equipPackindex, equipPlace) | 
|---|
|  |  |  | GameWorld.DebugLog("确认洗练结果: classLV=%s, equipPlace=%s,isSave=%s,washLV=%s,maxWashLV=%s" | 
|---|
|  |  |  | % (classLV, equipPlace, isSave, washLV, maxWashLV), playerID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | washType = GetEquipWashType(equipPlace) | 
|---|
|  |  |  | if washType is None: | 
|---|
|  |  |  | 
|---|
|  |  |  | if washLV >= maxWashLV: | 
|---|
|  |  |  | GameWorld.DebugLog("已达到最大洗练等级,不可升级!", playerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  | if CheckEquipWashLVUp(curPlayer, equipPlace, washLV, washData): | 
|---|
|  |  |  | RefreshEquipWashAttr(curPlayer) | 
|---|
|  |  |  | Sycn_EquipWashInfo(curPlayer, equipPlace) | 
|---|
|  |  |  | if CheckEquipWashLVUp(curPlayer, equipPackindex, classLV, equipPlace, washLV, washData): | 
|---|
|  |  |  | RefreshEquipWashAttr(curPlayer, classLV) | 
|---|
|  |  |  | Sycn_EquipWashInfo(curPlayer, equipPackindex) | 
|---|
|  |  |  | EquipWashSuccess(curPlayer) | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | GameWorld.DebugLog("升级失败,有属性未达到最大值,无法升级!", playerID) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for attrNum in range(1, Def_EquipWashMaxAttrCount + 1): | 
|---|
|  |  |  | tempValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValueTemp % (equipPlace, attrNum)) | 
|---|
|  |  |  | tempValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValueTemp % (equipPackindex, attrNum)) | 
|---|
|  |  |  | if not tempValue: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashValueTemp % (equipPlace, attrNum), 0) | 
|---|
|  |  |  | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashValueTemp % (equipPackindex, 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) | 
|---|
|  |  |  | oldValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (equipPackindex, attrNum)) | 
|---|
|  |  |  | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashValue % (equipPackindex, attrNum), tempValue) | 
|---|
|  |  |  | dataDict = {'classLV':classLV, 'equipPlace':equipPlace,'attrNum':attrNum,'oldValue':oldValue,'newValue':tempValue} | 
|---|
|  |  |  | DataRecordPack.Cache_FightPowerChangeInfo(curPlayer, ChConfig.PowerDownType_EquipWash, dataDict) | 
|---|
|  |  |  | GameWorld.DebugLog("保存洗练数据: classLV=%s, equipPlace=%s,attrNum=%s,tempValue=%s" % (classLV, equipPlace, attrNum, tempValue), playerID) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if isSave == 1: | 
|---|
|  |  |  | RefreshEquipWashAttr(curPlayer) | 
|---|
|  |  |  | RefreshEquipWashAttr(curPlayer, classLV) | 
|---|
|  |  |  | #屏蔽自动升级 | 
|---|
|  |  |  | #        if washLV < maxWashLV: | 
|---|
|  |  |  | #            CheckEquipWashLVUp(curPlayer, equipPlace, washLV, washData) | 
|---|
|  |  |  | Sycn_EquipWashInfo(curPlayer, equipPlace) | 
|---|
|  |  |  | Sycn_EquipWashInfo(curPlayer, equipPackindex) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def CheckEquipWashLVUp(curPlayer, equipPlace, washLV, washData): | 
|---|
|  |  |  | def CheckEquipWashLVUp(curPlayer, equipPackindex, classLV, equipPlace, washLV, washData): | 
|---|
|  |  |  | # 检查洗练类型升级 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for attrNum in range(1, Def_EquipWashMaxAttrCount + 1): | 
|---|
|  |  |  | tempValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (equipPlace, attrNum)) | 
|---|
|  |  |  | tempValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (equipPackindex, 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.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipWashLV % (equipPackindex), washLV - 1) | 
|---|
|  |  |  | GameWorld.DebugLog("装备洗练等级升级: equipPackindex=%s,washLV=%s" % (equipPackindex, 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 | 
|---|
|  |  |  | PlayerControl.WorldNotify(0, "WashCongratulation", [curPlayer.GetPlayerName(), curPlayer.GetPlayerID(), classLV, equipPlace, washLV]) | 
|---|
|  |  |  | return True | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def Sycn_EquipWashInfo(curPlayer, equipPlace=-1, isLogin=False): | 
|---|
|  |  |  | def Sycn_EquipWashInfo(curPlayer, equipPackindex=-1, isLogin=False): | 
|---|
|  |  |  | hasValue = False | 
|---|
|  |  |  |  | 
|---|
|  |  |  | pack = ChPyNetSendPack.tagMCEquipPartXLAttrInfo() | 
|---|
|  |  |  | pack.Clear() | 
|---|
|  |  |  | pack.InfoList = [] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if equipPlace == -1: | 
|---|
|  |  |  | if equipPackindex == -1: | 
|---|
|  |  |  | syncPlaceList = GetAllEquipWashPlace() | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | syncPlaceList = [equipPlace] | 
|---|
|  |  |  | syncPlaceList = [equipPackindex] | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for place in syncPlaceList: | 
|---|
|  |  |  | equipPart = ChPyNetSendPack.tagMCEquipPartXLAttr() | 
|---|
|  |  |  | 
|---|
|  |  |  | NetPackCommon.SendFakePack(curPlayer, pack) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def RefreshEquipWashAttr(curPlayer): | 
|---|
|  |  |  | ChEquip.RefreshPlayerEquipAttribute(curPlayer) | 
|---|
|  |  |  | def RefreshEquipWashAttr(curPlayer, classLV): | 
|---|
|  |  |  | ChEquip.RefreshPlayerEquipAttribute(curPlayer, classLV) | 
|---|
|  |  |  | #刷新所有属性 | 
|---|
|  |  |  | playControl = PlayerControl.PlayerControl(curPlayer) | 
|---|
|  |  |  | playControl.RefreshPlayerAttrState() | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def CalcAttr_EquipWash(curPlayer, equipPlace, allAttrList): | 
|---|
|  |  |  | def CalcAttr_EquipWash(curPlayer, equipIndex, equipPlace, allAttrList): | 
|---|
|  |  |  | ## 装备位洗练属性 | 
|---|
|  |  |  | washLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % equipPlace) + 1 | 
|---|
|  |  |  | washLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashLV % equipIndex) + 1 | 
|---|
|  |  |  | maxWashLV = GetEquipWashMaxLV(curPlayer, equipIndex, equipPlace) | 
|---|
|  |  |  | washLV = min(washLV, maxWashLV) | 
|---|
|  |  |  | washType = GetEquipWashType(equipPlace) | 
|---|
|  |  |  | if washType is None: | 
|---|
|  |  |  | 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)) | 
|---|
|  |  |  | maxValue = getattr(washData, "GetAttrMax%s" % attrNum)() | 
|---|
|  |  |  | attrValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipWashValue % (equipIndex, attrNum)) | 
|---|
|  |  |  | attrValue = min(attrValue, maxValue) | 
|---|
|  |  |  | #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]) | 
|---|
|  |  |  | #    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 | 
|---|
|  |  |  |  | 
|---|