|  |  |  | 
|---|
|  |  |  | import FBLogic | 
|---|
|  |  |  | import OperControlManager | 
|---|
|  |  |  | import Operate_EquipWash | 
|---|
|  |  |  | import Operate_EquipPlus | 
|---|
|  |  |  | import ShareDefine | 
|---|
|  |  |  | import ChPyNetSendPack | 
|---|
|  |  |  | import NetPackCommon | 
|---|
|  |  |  | 
|---|
|  |  |  | #NotifyEquipPartPlusLV(curPlayer) | 
|---|
|  |  |  | #NotifyEquipPartStar(curPlayer) | 
|---|
|  |  |  | #Operate_EquipWash.OnEquipWashLogin(curPlayer) | 
|---|
|  |  |  | #通知套装信息 | 
|---|
|  |  |  | #ChEquip.SyncAllEquipAttrActiveInfo(curPlayer) | 
|---|
|  |  |  | #装备位宝石镶嵌通知 | 
|---|
|  |  |  | #Operate_EquipStone.OnLogin(curPlayer) | 
|---|
|  |  |  | if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_VersionFix, ChConfig.Def_VerFix_LingGenShow): | 
|---|
|  |  |  | 
|---|
|  |  |  | if ePartStonePack.InfoList: | 
|---|
|  |  |  | ePartStonePack.EquipCount = len(ePartStonePack.InfoList) | 
|---|
|  |  |  | NetPackCommon.SendFakePack(curPlayer, ePartStonePack) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Operate_EquipPlus.SyncEquipMasterPlusLVInfo(curPlayer) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 更新统计汇总值 | 
|---|
|  |  |  | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PlayerKey_EquipOrangeCount, orangeEquipCount) | 
|---|
|  |  |  | 
|---|
|  |  |  | #legendAttrDict = {}  #所有传奇属性 | 
|---|
|  |  |  | equipScoreTotal = 0  #为解决装备评分、战力不一致的情况,装备战力改为由评分作为参数计算战力 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | basePlusLVMin = None # 基础装备最小强化等级,计算大师强化属性用 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 1. 循环遍历本阶装备 | 
|---|
|  |  |  | for equipPlace in equipPartStarIndexList: | 
|---|
|  |  |  | ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, equipPlace) | 
|---|
|  |  |  | 
|---|
|  |  |  | __CalcFuncAddEquipAttrPer(equipPlace, legendAttrID, legendAttrValue, equip_addEquipBaseAttrPerList) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #物品强化属性 | 
|---|
|  |  |  | __CalcAttr_ItemPlus(curPlayer, curEquip, packType, equipIndex, allAttrListPlus, plus_addEquipBaseAttrPerList) | 
|---|
|  |  |  | plusLV = __CalcAttr_ItemPlus(curPlayer, curEquip, packType, equipIndex, allAttrListPlus, plus_addEquipBaseAttrPerList) | 
|---|
|  |  |  | if isBaseEquip: | 
|---|
|  |  |  | basePlusLVMin = plusLV if basePlusLVMin == None else min(basePlusLVMin, plusLV) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #计算装备宝石加成 | 
|---|
|  |  |  | CalcEquipStone_Effect(curPlayer, equipIndex, allAttrListStone) | 
|---|
|  |  |  | 
|---|
|  |  |  | # 2. 计算遍历后的附加属性 | 
|---|
|  |  |  | #套装属性,暂归为星级套装属性 | 
|---|
|  |  |  | CalcEquipSuiteAttr(curPlayer, suitCntDict, allAttrListStar) | 
|---|
|  |  |  | #大师 | 
|---|
|  |  |  | __CalcMasterPlusLVAttr(curPlayer, classLV, basePlusLVMin, allAttrListPlus, plus_addEquipBaseAttrPerList) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #    GameWorld.DebugLog("    升星属性套装: %s" % (allAttrListEquip)) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | # 基础部位 | 
|---|
|  |  |  | if effPlace == -2 and equipPlace in ChConfig.EquipPlace_Base: | 
|---|
|  |  |  | if effPlace == -2: | 
|---|
|  |  |  | basePlaceAddPerDict = addPerInfoList[1] | 
|---|
|  |  |  | for calcAttrIndex in calcAttrList: | 
|---|
|  |  |  | basePlaceAddPerDict[calcAttrIndex] = basePlaceAddPerDict.get(calcAttrIndex, 0) + attrValue | 
|---|
|  |  |  | 
|---|
|  |  |  | equipPartPlusEvolveLV = GetEquipPartPlusEvolveLV(curPlayer, packType, equipIndex) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not equipPartPlusLV: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | return equipPartPlusLV | 
|---|
|  |  |  | plusType = GetEquipPlusType(curEquip) | 
|---|
|  |  |  | if plusType is None: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | return equipPartPlusLV | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #GameWorld.DebugLog("    强化属性: plusType=%s,equipPartPlusLV=%s,equipPartPlusEvolveLV=%s" % (plusType, equipPartPlusLV, equipPartPlusEvolveLV)) | 
|---|
|  |  |  | ipyData = IpyGameDataPY.GetIpyGameData("ItemPlus", plusType, equipPartPlusLV) | 
|---|
|  |  |  | if not ipyData: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | return equipPartPlusLV | 
|---|
|  |  |  | attrTypeList, attrValueList = ipyData.GetAttrType(), ipyData.GetAttrValue() | 
|---|
|  |  |  | for i, attrID in enumerate(attrTypeList): | 
|---|
|  |  |  | #GameWorld.DebugLog("    强化基础属性: ID=%s +%s" % (attrID, attrValueList[i])) | 
|---|
|  |  |  | PlayerControl.CalcAttrDict_Type(attrID, attrValueList[i], allAttrList) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | if not equipPartPlusEvolveLV: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | return equipPartPlusLV | 
|---|
|  |  |  | #进化属性 | 
|---|
|  |  |  | equipPlace = curEquip.GetEquipPlace() | 
|---|
|  |  |  | ipyData = IpyGameDataPY.GetIpyGameData('EquipPlusEvolve', equipPlace, equipPartPlusEvolveLV) | 
|---|
|  |  |  | if not ipyData: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | return equipPartPlusLV | 
|---|
|  |  |  | for attrID, attrValue in ipyData.GetAttr().items(): | 
|---|
|  |  |  | #GameWorld.DebugLog("    强化进阶属性: ID=%s +%s" % (attrID, attrValue)) | 
|---|
|  |  |  | PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrList) | 
|---|
|  |  |  | __CalcFuncAddEquipAttrPer(equipPlace, attrID, attrValue, plus_addEquipBaseAttrPerList) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return equipPartPlusLV | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def __CalcMasterPlusLVAttr(curPlayer, classLV, basePlusLVMin, allAttrListPlus, plus_addEquipBaseAttrPerList): | 
|---|
|  |  |  | ## 计算装备大师强化属性 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ipyDataList = IpyGameDataPY.GetIpyGameDataList("ItemPlusMaster", classLV) | 
|---|
|  |  |  | if not ipyDataList: | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | actMasterPlusLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipPartMasterPlusLV % classLV) # 已激活的最大大师等级 | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for ipyData in ipyDataList: | 
|---|
|  |  |  | needMasterPlusLV = ipyData.GetMasterPlusLV() | 
|---|
|  |  |  | if basePlusLVMin < needMasterPlusLV: | 
|---|
|  |  |  | #GameWorld.DebugLog("    未达到大师强化等级! classLV=%s,basePlusLVMin=%s < needMasterPlusLV=%s" % (classLV, basePlusLVMin, needMasterPlusLV)) | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | if actMasterPlusLV < needMasterPlusLV: | 
|---|
|  |  |  | #GameWorld.DebugLog("    未激活大师强化等级! classLV=%s,actMasterPlusLV=%s < needMasterPlusLV=%s" % (classLV, actMasterPlusLV, needMasterPlusLV)) | 
|---|
|  |  |  | continue | 
|---|
|  |  |  |  | 
|---|
|  |  |  | attrIDList = ipyData.GetMasterPlusAttrIDList() | 
|---|
|  |  |  | attrValueList = ipyData.GetMasterPlusAttrValueList() | 
|---|
|  |  |  | for i, attrID in enumerate(attrIDList): | 
|---|
|  |  |  | attrValue = attrValueList[i] | 
|---|
|  |  |  | PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrListPlus) | 
|---|
|  |  |  | __CalcFuncAddEquipAttrPer(None, attrID, attrValue, plus_addEquipBaseAttrPerList) | 
|---|
|  |  |  | #GameWorld.DebugLog("    强化大师属性! needMasterPlusLV=%s, attrID=%s + %s" % (needMasterPlusLV, attrID, attrValue)) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | NetPackCommon.SendFakePack(curPlayer, ePartStarLVPack) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #// A5 03 全身属性激活 #tagCMActiveAllEquipAttr | 
|---|
|  |  |  | # | 
|---|
|  |  |  | #struct    tagCMActiveAllEquipAttr | 
|---|
|  |  |  | # | 
|---|
|  |  |  | #{ | 
|---|
|  |  |  | #    tagHead        Head; | 
|---|
|  |  |  | #    BYTE        Type;        //0强化 1星数 | 
|---|
|  |  |  | #    DWORD        Cnt;        //激活数量 | 
|---|
|  |  |  | #}; | 
|---|
|  |  |  | def OnActiveAllEquipAttr(index, clientData, tick): | 
|---|
|  |  |  | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index) | 
|---|
|  |  |  | activeType = clientData.Type | 
|---|
|  |  |  | activeCnt = clientData.Cnt | 
|---|
|  |  |  | if activeType == 0: | 
|---|
|  |  |  | key = ChConfig.Def_PDict_EquipActiveStarLV | 
|---|
|  |  |  | #    elif activeType == 1: | 
|---|
|  |  |  | #        key = ChConfig.Def_PDict_EquipActiveStars | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | curCnt = curPlayer.NomalDictGetProperty(key) | 
|---|
|  |  |  | if activeCnt <= curCnt: | 
|---|
|  |  |  | GameWorld.Log('    全身属性激活 该数量已激活过! activeType=%s,activeCnt=%s,curCnt=%s' % (activeType, activeCnt, curCnt)) | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  | PlayerControl.NomalDictSetProperty(curPlayer, key, activeCnt) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | SyncAllEquipAttrActiveInfo(curPlayer, activeType) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #注意: 需要传装备阶触发刷属性,暂屏蔽,功能修改时再处理 | 
|---|
|  |  |  | #else: | 
|---|
|  |  |  | #    RefreshPlayerEquipAttribute(curPlayer) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | #刷新所有属性 | 
|---|
|  |  |  | playControl = PlayerControl.PlayerControl(curPlayer) | 
|---|
|  |  |  | playControl.RefreshPlayerAttrState() | 
|---|
|  |  |  | return | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | def SyncAllEquipAttrActiveInfo(curPlayer, activeType=-1): | 
|---|
|  |  |  | ## 通知全身属性激活数量 | 
|---|
|  |  |  | packData = ChPyNetSendPack.tagMCAllEquipAttrActiveInfo() | 
|---|
|  |  |  | packData.ActiveInfo = [] | 
|---|
|  |  |  | for aType in [0, 1]: | 
|---|
|  |  |  | if activeType != -1 and activeType != aType: | 
|---|
|  |  |  | continue | 
|---|
|  |  |  | if aType == 0: | 
|---|
|  |  |  | key = ChConfig.Def_PDict_EquipActiveStarLV | 
|---|
|  |  |  | #        elif aType == 1: | 
|---|
|  |  |  | #            key = ChConfig.Def_PDict_EquipActiveStars | 
|---|
|  |  |  | else: | 
|---|
|  |  |  | return | 
|---|
|  |  |  | curCnt = curPlayer.NomalDictGetProperty(key) | 
|---|
|  |  |  | activeInfo = ChPyNetSendPack.tagMCEquipActiveInfo() | 
|---|
|  |  |  | activeInfo.Type = aType | 
|---|
|  |  |  | activeInfo.Cnt = curCnt | 
|---|
|  |  |  | packData.ActiveInfo.append(activeInfo) | 
|---|
|  |  |  |  | 
|---|
|  |  |  | packData.Count = len(packData.ActiveInfo) | 
|---|
|  |  |  | NetPackCommon.SendFakePack(curPlayer, packData) | 
|---|
|  |  |  | return | 
|---|