| | |
| | | import PlayerWing
|
| | | import Operate_EquipStone
|
| | | import Operate_EquipSuitCompose
|
| | | import PassiveBuffEffMng
|
| | | import SkillCommon
|
| | | import PlayerMagicWeapon
|
| | | import time
|
| | | import json
|
| | |
| | | if curEquip.GetUserAttr(ShareDefine.Def_IudetCreateTime) == 0:
|
| | | curEquip.SetUserAttr(ShareDefine.Def_IudetCreateTime, int(time.time()))
|
| | | #---换装成功---
|
| | | if equipPackIndex in PlayerControl.GetFaceEquipIndexList(curPlayer):
|
| | | if equipPackIndex in PlayerControl.GetFaceEquipIndexList(curPlayer) or equipPlace in ChConfig.Def_SyncEquipStateByIndex:
|
| | | #通知客户端交换物品
|
| | | curPlayer.ChangeEquip(changeItemID, equipPackIndex, changeItemStarLV, changeItemHoleCnt, changeItemStoneCnt, changeItemUseData)
|
| | |
|
| | |
| | | playControl = PlayerControl.PlayerControl(curPlayer)
|
| | | playControl.RefreshPlayerAttrState()
|
| | |
|
| | | if equipPlace in ChConfig.Def_SyncEquipStateByIndex:
|
| | | if equipPackIndex in PlayerControl.GetFaceEquipIndexList(curPlayer) or equipPlace in ChConfig.Def_SyncEquipStateByIndex:
|
| | | curPlayer.Sync_UnEquipItem(equipID, equipPackIndex)
|
| | | return
|
| | |
|
| | |
| | |
|
| | | allAttrListStar = [{} for _ in range(4)] # 星数属性
|
| | | #allAttrListEquip = [{} for _ in range(4)] # 装备其他
|
| | | #allAttrListPlusBase = [{} for _ in range(4)] # 基础强化属性
|
| | | allAttrListPlusBase = [{} for _ in range(4)] # 基础强化属性
|
| | | allAttrListStone = [{} for _ in range(4)] # 宝石属性
|
| | | #allAttrListSuit = [{} for _ in range(4)] # 套装属性
|
| | | #allAttrListWash = [{} for _ in range(4)] # 洗练属性
|
| | | allAttrListSuit = [{} for _ in range(4)] # 套装属性
|
| | | allAttrListWash = [{} for _ in range(4)] # 洗练属性
|
| | | #allAttrListOutOfPrintEquip = [{} for _ in range(4)] # 绝版装备属性 需在等级变化独立计算
|
| | |
|
| | | packType = IPY_GameWorld.rptEquip
|
| | |
| | | equipPartStarIndexList = ChConfig.Pack_EquipPart_CanPlusStar.get(packType, [])
|
| | | #maxSuiteType = IpyGameDataPY.GetFuncCfg('EquipSuitColorStar', 2) #最大套装类型
|
| | | #equipPlaceList = [] # 有穿戴装备的装备位列表
|
| | | #suitCntDict = {} #套装数量字典
|
| | | suitCntDict = {} #套装数量字典
|
| | | #legendAttrDict = {} #所有传奇属性
|
| | | equipScoreTotal = 0 #为解决装备评分、战力不一致的情况,装备战力改为由评分作为参数计算战力
|
| | |
|
| | |
| | | continue
|
| | | equipIndex = ipyData.GetGridIndex()
|
| | | curEquip = playerEquip.GetAt(equipIndex)
|
| | | if curEquip.IsEmpty():
|
| | | if not curEquip or curEquip.IsEmpty():
|
| | | continue
|
| | |
|
| | | if not ItemCommon.CheckItemCanUseByExpireTime(curEquip):
|
| | |
| | | # PlayerControl.CalcAttrDict_Type(effectID, effectValue, allAttrListEquip)
|
| | | # baseEquipAttrDict[effectID] = baseEquipAttrDict.get(effectID, 0) + effectValue
|
| | |
|
| | | # groupType = GetEquipPartSuiteGroupType(curPlayer, equipIndex)
|
| | | # for suiteType in range(1, maxSuiteType + 1):
|
| | | # suitelv = GetEquipPartSuiteLV(curPlayer, equipIndex, suiteType)
|
| | | # if suitelv:
|
| | | # maxSuiteLV = Operate_EquipSuitCompose.GetEquipCanDoMaxSuiteLV(curPlayer, curEquip, suiteType, groupType)
|
| | | # suiteLV = min(suitelv, maxSuiteLV)
|
| | | # if suiteLV:
|
| | | # suiteKey = '%s_%s_%s' % (groupType, suiteType, suitelv)
|
| | | # suitCntDict[suiteKey] = suitCntDict.get(suiteKey, 0) + 1
|
| | |
|
| | | #星数属性
|
| | | equipPartStar = GetEquipPartStarByRank(curPlayer, equipIndex, curEquip) #生效的星数
|
| | | CalcEquipStarAttr(curPlayer, classlv, equipPlace, equipPartStar, allAttrListStar)
|
| | | #计算装备宝石加成
|
| | | CalcEquipStone_Effect(curPlayer, equipIndex, allAttrListStone)
|
| | | #套装计数
|
| | | suiteID = curEquip.GetSuiteID()
|
| | | if suiteID:
|
| | | if suiteID not in suitCntDict:
|
| | | suitCntDict[suiteID] = []
|
| | | suitCntDict[suiteID].append(equipPartStar)
|
| | |
|
| | | #物品强化属性,佩饰强化不同要区分
|
| | | # if equipIndex in equipPartStarIndexList:
|
| | | # equipPartStarLV = GetEquipPartPlusLVByRank(curPlayer, packType, equipIndex, curEquip)
|
| | | # CalcAttr_ItemPlus(curPlayer, curEquip, allAttrListPlusBase, equipPartStarLV)
|
| | | #物品强化属性
|
| | | equipPartPlusLV = GetEquipPartPlusLVByRank(curPlayer, packType, equipIndex, curEquip)
|
| | | equipPartPlusEvolveLV = GetEquipPartPlusEvolveLVByEquip(curPlayer, packType, equipIndex, curEquip)
|
| | | CalcAttr_ItemPlus(curPlayer, curEquip, allAttrListPlusBase, equipPartPlusLV, equipPartPlusEvolveLV)
|
| | |
|
| | | #传奇属性
|
| | | #CalcAttr_LegendAttr(curPlayer, curEquip, allAttrListEquip, legendAttrDict)
|
| | | #绝世属性
|
| | | #CalcAttr_OutOfPrintAttr(curPlayer, curEquip, allAttrListOutOfPrintEquip)
|
| | | #洗练属性
|
| | | #Operate_EquipWash.CalcAttr_EquipWash(curPlayer, equipIndex, allAttrListWash)
|
| | | Operate_EquipWash.CalcAttr_EquipWash(curPlayer, equipIndex, equipPlace, allAttrListWash)
|
| | |
|
| | | #洗练套装属性
|
| | | #Operate_EquipWash.CalcAttr_EquipWashSpec(curPlayer, equipPlaceList, allAttrListWash)
|
| | |
|
| | | #套装属性
|
| | | #CalcEquipSuiteAttr(curPlayer, suitCntDict, allAttrListSuit)
|
| | | CalcEquipSuiteAttr(curPlayer, suitCntDict, allAttrListSuit)
|
| | | #GameWorld.DebugLog("所有传奇属性: %s" % legendAttrDict)
|
| | | #保存计算值
|
| | | #PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Stone, allAttrListStone)
|
| | |
| | | # @param curPlayer 当前玩家
|
| | | # @param curPlayer allAttrList 属性缓存
|
| | | # @return None
|
| | | def CalcAttr_ItemPlus(curPlayer, curEquip, allAttrList, equipPartStarLV=None):
|
| | | def CalcAttr_ItemPlus(curPlayer, curEquip, allAttrList, equipPartStarLV, equipPartPlusEvolveLV):
|
| | | if not equipPartStarLV:
|
| | | return
|
| | | plusType = GetEquipPlusType(curEquip)
|
| | |
| | | attrTypeList, attrValueList = ipyData.GetAttrType(), ipyData.GetAttrValue()
|
| | | for i, attrID in enumerate(attrTypeList):
|
| | | PlayerControl.CalcAttrDict_Type(attrID, attrValueList[i], allAttrList)
|
| | | |
| | | #进化属性
|
| | | equipPlace = curEquip.GetEquipPlace()
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('EquipPlusEvolve', equipPlace, equipPartPlusEvolveLV)
|
| | | if not ipyData:
|
| | | return
|
| | | for attrID, attrValue in ipyData.GetAttr().items():
|
| | | PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrList)
|
| | | return
|
| | |
|
| | |
|
| | |
| | | ## 装备套装属性计算
|
| | | # @param curPlayer 当前玩家
|
| | | # @return None
|
| | | def CalcEquipSuiteAttr(curPlayer, suitCntDict, allAttrListEquip):
|
| | | Def_EquipSuitMaxCount = 3 #套装最大阶段
|
| | | myjob = curPlayer.GetJob()
|
| | | name = curPlayer.GetName()
|
| | | |
| | | for suiteKey, cnt in suitCntDict.items():
|
| | | groupType, suiteType, suiteLV = suiteKey.split('_')
|
| | | suiteLV = int(suiteLV)
|
| | | job = 0 if groupType == ChConfig.EquipGroupType_Relics else myjob #仙器组合默认职业0
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('EquipSuitAttr', int(groupType), int(suiteType), int(suiteLV), job)
|
| | | if not ipyData:
|
| | | def CalcEquipSuiteAttr(curPlayer, suitCntDict, allAttrListSuit):
|
| | | if not suitCntDict:
|
| | | return
|
| | | GameWorld.DebugLog(' suitCntDict=%s'%suitCntDict)
|
| | | learnSkillList = []
|
| | | delSkillID = []
|
| | | skillManager = curPlayer.GetSkillManager()
|
| | | playerName = curPlayer.GetName()
|
| | | for suiteID, starList in suitCntDict.items():
|
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataList('EquipSuitAttr', suiteID)
|
| | | if not ipyDataList:
|
| | | continue
|
| | | |
| | | for i in range(1, Def_EquipSuitMaxCount + 1):
|
| | | countKeyName = 'GetCount%d' % i
|
| | | attrTypeKeyName = 'GetAttrType%d' % i
|
| | | attrValueKeyName = 'GetAttrValue%d' % i
|
| | | needCnt = getattr(ipyData, countKeyName)()
|
| | | if cnt >= needCnt:
|
| | | attrTypeList = getattr(ipyData, attrTypeKeyName)()
|
| | | attrValueList = getattr(ipyData, attrValueKeyName)()
|
| | | for j, attrID in enumerate(attrTypeList):
|
| | | value = attrValueList[j]
|
| | | PlayerControl.CalcAttrDict_Type(attrID, value, allAttrListEquip)
|
| | | |
| | | #套装激活提示(只提示1次)
|
| | | paramList = [name, cnt, suiteLV, groupType, suiteType]
|
| | | notifyRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipPartSuiteNotify % (groupType, suiteType, cnt))
|
| | | if not notifyRecord & pow(2, suiteLV):
|
| | | if groupType == ChConfig.EquipGroupType_Armor:
|
| | | if cnt >= 5:
|
| | | PlayerControl.WorldNotify(0, 'EquipSuit5', paramList)
|
| | | notifyRecord |= pow(2, suiteLV)
|
| | | for ipyData in ipyDataList:
|
| | | suiteCnt = ipyData.GetSuiteCnt()
|
| | | needStar = ipyData.GetStar()
|
| | | skillID = ipyData.GetSkillID()
|
| | | if [1 if star >= needStar else 0 for star in starList].count(1) >= suiteCnt:
|
| | | for attrID, attrValue in ipyData.GetAttrInfo().items():
|
| | | PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrListSuit)
|
| | | #技能
|
| | | if skillID and not skillManager.FindSkillBySkillTypeID(skillID):
|
| | | learnSkillList.append(skillID)
|
| | | #广播
|
| | | notifyMark = ipyData.GetIsNotify()
|
| | | if notifyMark and not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_EquipPartSuiteNotify, notifyMark):
|
| | | PlayerControl.WorldNotify(0, 'AllStarLevelUp', [playerName, suiteID, suiteCnt, needStar])
|
| | | GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_PDict_EquipPartSuiteNotify, notifyMark, 1)
|
| | |
|
| | | else:
|
| | | PlayerControl.WorldNotify(0, 'EquipSuit5', paramList)
|
| | | notifyRecord |= pow(2, suiteLV)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipPartSuiteNotify % (groupType, suiteType, cnt), notifyRecord)
|
| | | |
| | | if skillID and skillManager.FindSkillBySkillTypeID(skillID):
|
| | | delSkillID.append(skillID)
|
| | | skillManager.DeleteSkillBySkillTypeID(skillID)
|
| | | |
| | | |
| | | for skillID in learnSkillList:
|
| | | GameWorld.DebugLog(' 激活套装技能 skillResID=%s' % (skillID))
|
| | | skillData = GameWorld.GetGameData().FindSkillByType(skillID, 1)
|
| | | if not skillData:
|
| | | continue
|
| | | skillManager.LVUpSkillBySkillTypeID(skillID) |
| | | PlayerControl.PlayerControl(curPlayer).RefreshSkillFightPowerEx(skillID, 0)
|
| | | if learnSkillList or delSkillID:
|
| | | # 重刷被动技能
|
| | | PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPlayer) |
| | | return
|
| | |
|
| | |
|
| | |
| | |
|
| | | def CalcEquipStarAttr(curPlayer, classlv, equipPlace, equipPartStar, allAttrListStar):
|
| | | ## 计算装备星数属性
|
| | | if not equipPartStar:
|
| | | return
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('EquipStarUp', classlv, equipPlace, equipPartStar)
|
| | | if not ipyData:
|
| | | return
|
| | |
| | | oldEquipShowSwitch = curPlayer.GetEquipShowSwitch()
|
| | | if updEquipShowSwitch == oldEquipShowSwitch:
|
| | | return
|
| | | classLV, isSuite = updEquipShowSwitch/10, updEquipShowSwitch%10
|
| | | equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
|
| | | #验证套装
|
| | | realSuit=True
|
| | | for place in ChConfig.Def_SuitEquipPlaceList:
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, place)
|
| | | if not ipyData:
|
| | | realSuit = False
|
| | | break
|
| | | gridIndex = ipyData.GetGridIndex()
|
| | | curEquip = equipPack.GetAt(gridIndex)
|
| | | if not ItemCommon.CheckItemCanUse(curEquip):
|
| | | realSuit = False
|
| | | break
|
| | | if not curEquip.GetSuiteID():
|
| | | realSuit = False
|
| | | break
|
| | | if realSuit != isSuite:
|
| | | GameWorld.DebugLog('SetEquipShowSwitch 前端发的isSuite 和实际不一致!')
|
| | | return
|
| | |
|
| | | #通知外观装备
|
| | | updFaceEquipIndex = 0
|
| | | equipIndexList = []
|
| | | |
| | | for equipPlace in [ShareDefine.retWeapon, ShareDefine.retWeapon2, ShareDefine.retClothes]:
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', 1, equipPlace)
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classLV, equipPlace)
|
| | | if not ipyData:
|
| | | continue
|
| | | gridIndex = ipyData.GetGridIndex()
|
| | | updFaceEquipIndex = updFaceEquipIndex * 1000 + gridIndex
|
| | | equipIndexList.append(gridIndex)
|
| | | PlayerControl.SetFaceEquipIndex(curPlayer, updFaceEquipIndex)
|
| | | equipPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
|
| | | |
| | | for equipPackIndex in equipIndexList:
|
| | | curEquip = equipPack.GetAt(equipPackIndex)
|
| | | if not ItemCommon.CheckItemCanUse(curEquip):
|
| | |
| | |
|
| | | ## 获取公共部位强化星级, 因装备的最高可强化星级影响,用于算当前装备属性使用, 不影响全身星级
|
| | | def GetEquipPartPlusLVByRank(curPlayer, packType, index, curEquip):
|
| | | maxStarLV = ItemCommon.GetItemMaxPlusLV(curEquip)
|
| | | maxStarLV = ItemCommon.GetItemMaxPlusLV(curPlayer, index, curEquip)
|
| | | return min(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipPartPlusLV % (packType, index)), maxStarLV)
|
| | |
|
| | |
|
| | |
| | | return
|
| | |
|
| | |
|
| | | ## 获取公共部位强化进化等级, 用于算当前装备属性使用, 不影响全身星级
|
| | | def GetEquipPartPlusEvolveLVByEquip(curPlayer, packType, index, curEquip):
|
| | | maxEvolveLV = ItemCommon.GetItemMaxPlusEvolveLV(curPlayer, index, curEquip)
|
| | | return min(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipPartPlusEvolveLV % (packType, index)), maxEvolveLV)
|
| | |
|
| | |
|
| | | ## 获取公共部位强化进化等级
|
| | | def GetEquipPartPlusEvolveLV(curPlayer, packType, index):
|
| | | return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_EquipPartPlusEvolveLV % (packType, index))
|
| | |
|
| | |
|
| | | ## 设置公共部位强化进化等级
|
| | | def SetEquipPartPlusEvolveLV(curPlayer, packType, index, evolveLV):
|
| | | if GetEquipPartPlusEvolveLV(curPlayer, packType, index) == evolveLV:
|
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_EquipPartPlusEvolveLV % (packType, index), evolveLV)
|
| | | return
|
| | |
|
| | | ## 通知公共部位强化等级
|
| | | def NotifyEquipPartPlusLV(curPlayer, packType=None, index=None):
|
| | | ePartStarLVPack = ChPyNetSendPack.tagMCEquipPartStarLVInfo()
|
| | | ePartStarLVPack = ChPyNetSendPack.tagMCEquipPartPlusInfo()
|
| | | ePartStarLVPack.Clear()
|
| | | ePartStarLVPack.InfoList = []
|
| | |
|
| | |
| | | if index != None and index != i:
|
| | | continue
|
| | |
|
| | | ePartStarLV = ChPyNetSendPack.tagMCEquipPartStarLV()
|
| | | ePartStarLV = ChPyNetSendPack.tagMCEquipPartPlusLV()
|
| | | ePartStarLV.Clear()
|
| | | ePartStarLV.PackType = pType
|
| | | ePartStarLV.EquipIndex = i
|
| | | ePartStarLV.EquipPartStarLV = GetEquipPartPlusLV(curPlayer, pType, i)
|
| | | ePartStarLV.Proficiency = GetEquipPartProficiency(curPlayer, pType, i)
|
| | | ePartStarLV.EvolveLV = GetEquipPartPlusEvolveLV(curPlayer, pType, i)
|
| | | ePartStarLVPack.InfoList.append(ePartStarLV)
|
| | |
|
| | | ePartStarLVPack.Count = len(ePartStarLVPack.InfoList)
|
| | |
| | | if index == None:
|
| | | equipMaxClasslv = IpyGameDataPY.GetFuncCfg('EquipMaxClasslv')
|
| | | for equipPlace in ChConfig.Pack_EquipPart_CanPlusStar.get(IPY_GameWorld.rptEquip, []):
|
| | | for classlv in xrange(equipMaxClasslv):
|
| | | for classlv in xrange(1, equipMaxClasslv+1):
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('EquipPlaceIndexMap', classlv, equipPlace)
|
| | | if not ipyData:
|
| | | continue
|
| | |
| | | activeCnt = clientData.Cnt
|
| | | if activeType == 0:
|
| | | key = ChConfig.Def_PDict_EquipActiveStarLV
|
| | | elif activeType == 1:
|
| | | key = ChConfig.Def_PDict_EquipActiveStars
|
| | | # elif activeType == 1:
|
| | | # key = ChConfig.Def_PDict_EquipActiveStars
|
| | | else:
|
| | | return
|
| | | curCnt = curPlayer.NomalDictGetProperty(key)
|
| | |
| | | continue
|
| | | if aType == 0:
|
| | | key = ChConfig.Def_PDict_EquipActiveStarLV
|
| | | elif aType == 1:
|
| | | key = ChConfig.Def_PDict_EquipActiveStars
|
| | | # elif aType == 1:
|
| | | # key = ChConfig.Def_PDict_EquipActiveStars
|
| | | else:
|
| | | return
|
| | | curCnt = curPlayer.NomalDictGetProperty(key)
|