| | |
| | | CrossPlayerData.ClearCrossSyncDataCache(curPlayer)
|
| | | PyGameData.g_fbBuyBuffTimeDict.pop(playerID, None)
|
| | | #清除地图玩家缓存
|
| | | PyGameData.g_playerFuncAttrDict.pop(playerID, None)
|
| | | PyGameData.g_playerEquipPartAttrDict.pop(playerID, None)
|
| | | PyGameData.g_playerReqEnterFBEx.pop(playerID, None)
|
| | | NPCCommon.ClearPriWoodPile(curPlayer)
|
| | | #移除地图缓存的境界难度玩家ID信息
|
| | |
| | | # @param allAttrList 属性列表
|
| | | # @return None
|
| | | def CalcAttrDict_Type(attrType, value, allAttrList):
|
| | | if value == 0:
|
| | | return
|
| | | |
| | | #[属性索引, 是否基础属性,(非)线性]
|
| | | attrInfo = ChConfig.ItemEffect_AttrDict.get(attrType, [])
|
| | | if attrInfo == []:
|
| | | return
|
| | | |
| | | index = ChConfig.Def_CalcAttrIndexDict[(attrInfo[1], attrInfo[2])]
|
| | | |
| | | attrDict = allAttrList[index]
|
| | | for i in attrInfo[0]:
|
| | | GameWorld.AddDictValue(attrDict, {i:value})
|
| | | return
|
| | |
|
| | | def CalcAttrDict_TypeEx(attrType, value, allAttrDict):
|
| | | ## 统计玩家属性,累加
|
| | | if value == 0:
|
| | | return
|
| | | |
| | | #[属性索引, 是否基础属性,(非)线性]
|
| | | attrInfo = ChConfig.ItemEffect_AttrDict.get(attrType, [])
|
| | | if attrInfo == []:
|
| | | return
|
| | | for i in attrInfo[0]:
|
| | | GameWorld.AddDictValue(allAttrDict, {i:value})
|
| | | return
|
| | |
|
| | | ## 培养境界等级
|
| | |
| | |
|
| | | ## 设置保存功能事先计算好的属性值
|
| | | def SetCalcAttrListValue(curPlayer, funcIndex, allAttrList, insidePerAttrDict=None, customAttrDict=None):
|
| | | # 设置值之前先清空重置
|
| | | # @param customAttrDict: 自定义的属性信息,必须是格式 {"自定义属性描述名key":属性信息, ...} 自定义属性描述名key - 建议不同功能点之间不要重复
|
| | | ClearCalcAttrListValue(curPlayer, funcIndex)
|
| | | if insidePerAttrDict == None:
|
| | | insidePerAttrDict = {}
|
| | | if customAttrDict == None:
|
| | | customAttrDict = {}
|
| | | |
| | | battleAttrDict = allAttrList[ChConfig.CalcAttr_Battle]
|
| | | if ChConfig.TYPE_Calc_PerLVAtk in battleAttrDict:
|
| | | # 每1级加的攻击力不一定满1点,所以这里按万分率来算,支持小数算法
|
| | | addAtk = int(curPlayer.GetLV() * battleAttrDict[ChConfig.TYPE_Calc_PerLVAtk] / float(ShareDefine.Def_MaxRateValue))
|
| | | battleAttrDict[ChConfig.TYPE_Calc_AttrATKMin] = battleAttrDict.get(ChConfig.TYPE_Calc_AttrATKMin, 0) + addAtk
|
| | | battleAttrDict[ChConfig.TYPE_Calc_AttrATKMax] = battleAttrDict.get(ChConfig.TYPE_Calc_AttrATKMax, 0) + addAtk
|
| | | |
| | | if ChConfig.TYPE_Calc_PerLVMaxHP in battleAttrDict:
|
| | | # 每1级加的生命值不会少于1点,所以直接乘
|
| | | addMaxHP = curPlayer.GetLV() * battleAttrDict[ChConfig.TYPE_Calc_PerLVMaxHP]
|
| | | battleAttrDict[ChConfig.TYPE_Calc_AttrMaxHP] = battleAttrDict.get(ChConfig.TYPE_Calc_AttrMaxHP, 0) + addMaxHP
|
| | | |
| | | playerID = curPlayer.GetPlayerID()
|
| | | if playerID not in PyGameData.g_playerFuncAttrDict:
|
| | | PyGameData.g_playerFuncAttrDict[playerID] = {}
|
| | | funcAttrDict = PyGameData.g_playerFuncAttrDict[playerID]
|
| | | funcAttrDict[funcIndex] = [allAttrList, insidePerAttrDict, customAttrDict]
|
| | | #GameWorld.DebugLog("保存功能点属性: funcIndex=%s, %s, %s" % (funcIndex, allAttrList, insidePerAttrDict))
|
| | | return
|
| | |
|
| | | def GetCalcAttrListValue(curPlayer, funcIndex):
|
| | |
| | | attrList = [{} for _ in range(4)]
|
| | | insidePerAttrDict = {}
|
| | | customAttrDict = {}
|
| | | if isinstance(funcIndex, int):
|
| | | funcIndexList = [funcIndex]
|
| | | elif isinstance(funcIndex, list):
|
| | | funcIndexList = funcIndex
|
| | | else:
|
| | | return attrList, insidePerAttrDict, customAttrDict
|
| | | |
| | | playerID = curPlayer.GetPlayerID()
|
| | | if playerID not in PyGameData.g_playerFuncAttrDict:
|
| | | return attrList, insidePerAttrDict, customAttrDict
|
| | | funcAttrDict = PyGameData.g_playerFuncAttrDict[playerID]
|
| | | for funcIndex in funcIndexList:
|
| | | if funcIndex not in funcAttrDict:
|
| | | continue
|
| | | funcAttrList, funcInsidePerAttrDict, funcCustomAttrDict = funcAttrDict[funcIndex]
|
| | | for i, attrDict in enumerate(attrList):
|
| | | curAttrDict = funcAttrList[i]
|
| | | AddAttrDictValue(attrDict, curAttrDict)
|
| | | customAttrDict.update(funcCustomAttrDict)
|
| | | AddAttrDictValue(insidePerAttrDict, funcInsidePerAttrDict)
|
| | | return attrList, insidePerAttrDict, customAttrDict
|
| | |
|
| | | ## 重置缓存
|
| | | def ClearCalcAttrListValue(curPlayer, funcIndex):
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | if playerID not in PyGameData.g_playerFuncAttrDict:
|
| | | return
|
| | | funcAttrDict = PyGameData.g_playerFuncAttrDict[playerID]
|
| | | funcAttrDict.pop(funcIndex, None)
|
| | | return
|
| | |
|
| | | def AddAttrListValue(attrList):
|
| | | addAttrList = [{} for _ in range(4)]
|
| | | for aList in attrList:
|
| | | for i in ChConfig.CalcAttrIndexList:
|
| | | AddAttrDictValue(addAttrList[i], aList[i])
|
| | | return addAttrList
|
| | |
|
| | | ## 属性值字典累加
|
| | | def AddAttrDictValue(dict1, dict2):
|
| | | for key, value in dict2.items():
|
| | | if key not in dict1:
|
| | | dict1[key] = value
|
| | | else:
|
| | | aValue = dict1[key]
|
| | | if key in ChConfig.TYPE_Calc_DeclineList:
|
| | | # 这种算法的属性一般是万分率的,最大不超过百分百,故暂默认万分率, 若有不是万分率的属性再做处理
|
| | | dict1[key] = 10000 - (10000 - aValue) * (10000 - value)
|
| | | else:
|
| | | dict1[key] = aValue + value
|
| | | return
|
| | |
|
| | | def GetLordAttr(curPlayer):
|
| | | ## 获取主公属性汇总
|