| | |
| | | import ChPyNetSendPack |
| | | import NetPackCommon |
| | | import IPY_GameWorld |
| | | import PlayerHorse
|
| | | import PlayerDogz
|
| | | import PlayerPet
|
| | | import ChConfig |
| | | |
| | | def GetGubaoLVInfo(curPlayer, gubaoID): |
| | |
| | | return |
| | | |
| | | def RefreshGubaoAttr(curPlayer): |
| | | CalcGubaoAttr(curPlayer) |
| | | #CalcGubaoAttr(curPlayer)
|
| | | PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState() |
| | | return |
| | | |
| | |
| | | |
| | | starIpyData = IpyGameDataPY.GetIpyGameData("GubaoStar", gubaoID, star) |
| | | if starIpyData: |
| | | starAttrTypeList = starIpyData.GetStarAttrTypeList() |
| | | starAttrValueList = starIpyData.GetStarAttrValueList() |
| | | for i, attrID in enumerate(starAttrTypeList): |
| | | attrValue = starAttrValueList[i] |
| | | starEffIDList = starIpyData.GetStarEffIDList()
|
| | | effAttrInfo = {}
|
| | | #GameWorld.DebugLog("GubaoStar属性: gubaoID=%s,star=%s,starEffIDList=%s" % (gubaoID, star, starEffIDList))
|
| | | for effID in starEffIDList:
|
| | | __calcStarEffAttrByID(curPlayer, effID, effAttrInfo)
|
| | | #GameWorld.DebugLog(" effID=%s,effAttrInfo=%s" % (effID, effAttrInfo))
|
| | | for attrID, attrValue in effAttrInfo.items():
|
| | | PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrList) |
| | | |
| | | # 保存计算值 |
| | | #GameWorld.DebugLog("古宝属性: %s" % allAttrList)
|
| | | PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Gubao, allAttrList) |
| | | return |
| | | |
| | | def __calcStarEffAttrByID(curPlayer, effID, effAttrInfo):
|
| | | ''' 计算古宝特殊效果ID对应提升属性
|
| | | '''
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("GubaoEffAttr", effID)
|
| | | if not ipyData:
|
| | | return
|
| | | effType = ipyData.GetGubaoEffType()
|
| | | effCond = ipyData.GetEffCond()
|
| | | attrID = ipyData.GetEffAttrID()
|
| | | effAttrValue = ipyData.GetEffAttrValue()
|
| | | if effAttrValue <= 0:
|
| | | return
|
| | | #效果类型 类型说明 条件
|
| | | # 10 x品质灵宠攻击属性提升x% x品质
|
| | | if effType == 10:
|
| | | customAttrDictPet = PlayerControl.GetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Pet)[2]
|
| | | petQualityAttrInfo = customAttrDictPet.get("petQualityAttrInfo", {})
|
| | | quality = effCond
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,quality=%s,petQualityAttrInfo=%s" % (effID, effType, quality, petQualityAttrInfo))
|
| | | if quality not in petQualityAttrInfo:
|
| | | return
|
| | | __addStarEffFuncAttr(ipyData, effAttrInfo, petQualityAttrInfo[quality], effAttrValue)
|
| | | |
| | | # 11 灵宠总等级每x级+xx属性 x级
|
| | | elif effType == 11:
|
| | | totalPetLV = PlayerPet.GetTotalPetLV(curPlayer)
|
| | | addAttrValue = int(totalPetLV / effCond * effAttrValue)
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,effCond=%s,totalPetLV=%s,attrID=%s,addAttrValue=%s" % (effID, effType, effCond, totalPetLV, attrID, addAttrValue))
|
| | | if attrID > 0 and addAttrValue > 0:
|
| | | effAttrInfo[attrID] = effAttrInfo.get(attrID, 0) + addAttrValue
|
| | | |
| | | # 12 灵宠每激活x只+xx属性 x只
|
| | | elif effType == 12:
|
| | | totalPetCount = PlayerPet.GetTotalPetCount(curPlayer)
|
| | | addAttrValue = int(totalPetCount / effCond * effAttrValue)
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,effCond=%s,totalPetCount=%s,attrID=%s,addAttrValue=%s" % (effID, effType, effCond, totalPetCount, attrID, addAttrValue))
|
| | | if attrID > 0 and addAttrValue > 0:
|
| | | effAttrInfo[attrID] = effAttrInfo.get(attrID, 0) + addAttrValue
|
| | | |
| | | # 13 x品质坐骑幻化属性提升x% x品质
|
| | | elif effType == 13:
|
| | | customAttrDictSkin = PlayerControl.GetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_HorseSkin)[2]
|
| | | horseSkinQualityAttrInfo = customAttrDictSkin.get("horseSkinQualityAttrInfo", {})
|
| | | quality = effCond
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,quality=%s,horseSkinQualityAttrInfo=%s" % (effID, effType, quality, horseSkinQualityAttrInfo))
|
| | | if quality not in horseSkinQualityAttrInfo:
|
| | | return
|
| | | __addStarEffFuncAttr(ipyData, effAttrInfo, horseSkinQualityAttrInfo[quality], effAttrValue)
|
| | | |
| | | # 14 坐骑幻化激活x只+xx属性 x只
|
| | | elif effType == 14:
|
| | | horseSkinActCount = PlayerHorse.GetHorseSkinActCount(curPlayer)
|
| | | addAttrValue = int(horseSkinActCount / effCond * effAttrValue)
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,effCond=%s,horseSkinActCount=%s,attrID=%s,addAttrValue=%s" % (effID, effType, effCond, horseSkinActCount, attrID, addAttrValue))
|
| | | if attrID > 0 and addAttrValue > 0:
|
| | | effAttrInfo[attrID] = effAttrInfo.get(attrID, 0) + addAttrValue
|
| | | |
| | | # 15 每培养坐骑x次+xx属性 x次
|
| | | elif effType == 15:
|
| | | pass
|
| | | |
| | | #16 x阶装备强化属性提升x% x阶
|
| | | elif effType == 16:
|
| | | customAttrDictPlus = PlayerControl.GetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Plus)[2]
|
| | | classBaseAttrDictPlus = customAttrDictPlus.get("classBaseAttrDictPlus", {})
|
| | | classLV = effCond
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,classLV=%s,classBaseAttrDictPlus=%s" % (effID, effType, classLV, classBaseAttrDictPlus))
|
| | | if classLV not in classBaseAttrDictPlus:
|
| | | return
|
| | | __addStarEffFuncAttr(ipyData, effAttrInfo, classBaseAttrDictPlus[classLV], effAttrValue)
|
| | | |
| | | #17 x阶装备宝石属性提升x% x阶
|
| | | elif effType == 17:
|
| | | customAttrDictStone = PlayerControl.GetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Stone)[2]
|
| | | classBaseAttrDictStone = customAttrDictStone.get("classBaseAttrDictStone", {})
|
| | | classLV = effCond
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,classLV=%s,classBaseAttrDictStone=%s" % (effID, effType, classLV, classBaseAttrDictStone))
|
| | | if classLV not in classBaseAttrDictStone:
|
| | | return
|
| | | __addStarEffFuncAttr(ipyData, effAttrInfo, classBaseAttrDictStone[classLV], effAttrValue)
|
| | | |
| | | #18 x阶装备升星属性提升x% x阶
|
| | | elif effType == 18:
|
| | | customAttrDictStar = PlayerControl.GetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Star)[2]
|
| | | classBaseAttrDictStar = customAttrDictStar.get("classBaseAttrDictStar", {})
|
| | | classLV = effCond
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,classLV=%s,classBaseAttrDictStar=%s" % (effID, effType, classLV, classBaseAttrDictStar))
|
| | | if classLV not in classBaseAttrDictStar:
|
| | | return
|
| | | __addStarEffFuncAttr(ipyData, effAttrInfo, classBaseAttrDictStar[classLV], effAttrValue)
|
| | | |
| | | #19 x阶装备洗炼属性提升x% x阶
|
| | | elif effType == 19:
|
| | | customAttrDictWash = PlayerControl.GetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Wash)[2]
|
| | | classBaseAttrDictWash = customAttrDictWash.get("classBaseAttrDictWash", {})
|
| | | classLV = effCond
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,classLV=%s,classBaseAttrDictWash=%s" % (effID, effType, classLV, classBaseAttrDictWash))
|
| | | if classLV not in classBaseAttrDictWash:
|
| | | return
|
| | | __addStarEffFuncAttr(ipyData, effAttrInfo, classBaseAttrDictWash[classLV], effAttrValue)
|
| | | |
| | | #20 x阶装备附魔属性提升x% x阶
|
| | | elif effType == 20:
|
| | | customAttrDictEnchant = PlayerControl.GetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Enchant)[2]
|
| | | classBaseAttrDictEnchant = customAttrDictEnchant.get("classBaseAttrDictEnchant", {})
|
| | | classLV = effCond
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,classLV=%s,classBaseAttrDictEnchant=%s" % (effID, effType, classLV, classBaseAttrDictEnchant))
|
| | | if classLV not in classBaseAttrDictEnchant:
|
| | | return
|
| | | __addStarEffFuncAttr(ipyData, effAttrInfo, classBaseAttrDictEnchant[classLV], effAttrValue)
|
| | | |
| | | #21 出战神兽装备强化每x级+xx属性 x级
|
| | | elif effType == 21:
|
| | | fightDogzTotalPlusLv = PlayerDogz.GetFightDogzTotalPlusLv(curPlayer)
|
| | | addAttrValue = int(fightDogzTotalPlusLv / effCond * effAttrValue)
|
| | | #GameWorld.DebugLog(" effID=%s,effType=%s,effCond=%s,fightDogzTotalPlusLv=%s,attrID=%s,addAttrValue=%s" % (effID, effType, effCond, fightDogzTotalPlusLv, attrID, addAttrValue))
|
| | | if attrID > 0 and addAttrValue > 0:
|
| | | effAttrInfo[attrID] = effAttrInfo.get(attrID, 0) + addAttrValue
|
| | | |
| | | return
|
| | |
|
| | | def __addStarEffFuncAttr(ipyData, effAttrInfo, funcAttrInfo, effAttrValue):
|
| | | if not funcAttrInfo or effAttrValue <= 0:
|
| | | return
|
| | | isPer = ipyData.GetIsPer()
|
| | | effAttrIDList = ipyData.GetEffFuncAttrIDList() # 提升指定功能属性ID列表
|
| | | for attrID, attrValue in funcAttrInfo.items():
|
| | | if effAttrIDList and attrID not in effAttrIDList:
|
| | | continue
|
| | | if isPer:
|
| | | addAttrValue = int(attrValue * effAttrValue / 100.0)
|
| | | else:
|
| | | addAttrValue = effAttrValue
|
| | | if attrID > 0 and addAttrValue > 0:
|
| | | effAttrInfo[attrID] = effAttrInfo.get(attrID, 0) + addAttrValue
|
| | | return
|
| | |
|
| | | def Sync_GubaoInfo(curPlayer, gubaoIDList=None): |
| | | if gubaoIDList == None: |
| | | syncIDList = [] |