| | |
| | | import CrossRealmPlayer
|
| | | import CrossPlayerData
|
| | | import ChNetSendPack
|
| | | import EquipZhuXian
|
| | | #import EquipZhuXian
|
| | | import PlayerCoat
|
| | | import PlayerState
|
| | | import QuestCommon
|
| | |
| | | playerID = curPlayer.GetPlayerID()
|
| | | PyGameData.g_zhuXianSkillAddPerDict.pop(playerID, None)
|
| | | PyGameData.g_zhuXianSkillReducePerDict.pop(playerID, None)
|
| | | PyGameData.g_playerFuncAttrDict.pop(playerID, None)
|
| | | PyGameData.g_playerEquipPartAttrDict.pop(playerID, None)
|
| | | return
|
| | |
|
| | | ##更新保存玩家在线时间
|
| | |
| | | PlayerGreatMaster.Sync_GreatMasterFreeSkillPoint(curPlayer)
|
| | | # 升级需要执行的游戏功能处理
|
| | | GameFuncComm.DoFuncOpenLogic(curPlayer)
|
| | | ChEquip.CalcEquips_OutOfPrint(curPlayer) # 缓存绝版属性
|
| | | #ChEquip.CalcEquips_OutOfPrint(curPlayer) # 缓存绝版属性
|
| | | if aftLV%10 == 0:
|
| | | # 控制下刷新次数
|
| | | PlayerPet.CalcPetItemAddPlayerAttr(curPlayer) # 宠物有随等级变化的技能
|
| | |
| | | PlayerFamilyTech.CalcFamilyTechAttr(curPlayer)
|
| | | PlayerEquipDecompose.RefreshEDAttr(curPlayer)
|
| | | PlayerDogz.RefreshDogzAttr(curPlayer)
|
| | | EquipZhuXian.CalcZhuXianAttr(curPlayer)
|
| | | #EquipZhuXian.CalcZhuXianAttr(curPlayer)
|
| | | PlayerGatherSoul.RefreshGatherSoulAttr(curPlayer)
|
| | | PlayerCoat.CalcClothesCoatSkinAttr(curPlayer)
|
| | | self.RefreshAllState(isForce=True)
|
| | |
| | | curPlayer.BeginRefreshState()
|
| | | self.ResetFightPowerObj()
|
| | | #self.PrintAttr(curPlayer, "重置后")
|
| | | notAttrList = [{} for _ in range(4)]
|
| | |
|
| | | # 1.初始化人物各项状态及属性
|
| | | self.InitPlayerState()
|
| | |
| | | funcAttrInfoList.append(roleBaseAttrInfo)
|
| | | continue
|
| | | attrInfo = GetCalcAttrListValue(curPlayer, funcIndex)
|
| | | GameWorld.DebugLog("功能点属性: %s, %s" % (funcIndex, attrInfo))
|
| | | if attrInfo != notAttrList:
|
| | | GameWorld.DebugLog("功能点属性: %s, %s" % (funcIndex, attrInfo))
|
| | | funcAttrInfoList.append(attrInfo)
|
| | | # 不同功能点间的数值累加,需使用支持衰减递增的计算方式
|
| | | AddAttrDictValue(baseAttrDict, attrInfo[ChConfig.CalcAttr_Base])
|
| | |
| | |
|
| | | # 3.计算战斗属性
|
| | | # 3.1 战斗属性层级交叉影响基值数值汇总
|
| | | # 装备基础
|
| | | equipBaseAttrList = AddAttrListValue([funcAttrInfoList[ChConfig.Def_CalcAttrFunc_EquipBaseWeapon],
|
| | | funcAttrInfoList[ChConfig.Def_CalcAttrFunc_EquipBaseArmor],
|
| | | funcAttrInfoList[ChConfig.Def_CalcAttrFunc_EquipBaseRelics],
|
| | | ])
|
| | | #GameWorld.DebugLog("装备基础: %s" % equipBaseAttrList)
|
| | | |
| | | # 基础层级(角色基础属性、装备基础属性、强化基础属性)
|
| | | # 基础层级(角色基础属性)
|
| | | baseAttrList = AddAttrListValue([funcAttrInfoList[ChConfig.Def_CalcAttrFunc_RoleBase],
|
| | | equipBaseAttrList,
|
| | | funcAttrInfoList[ChConfig.Def_CalcAttrFunc_PlusBase],
|
| | | ])
|
| | | #GameWorld.DebugLog("基础层级: %s" % baseAttrList)
|
| | |
|
| | |
| | | ChConfig.TYPE_Calc_BaseDefAddPer:baseAttrList,
|
| | | ChConfig.TYPE_Calc_BaseHitAddPer:baseAttrList,
|
| | | ChConfig.TYPE_Calc_BaseMissAddPer:baseAttrList,
|
| | | ChConfig.TYPE_Calc_EquipBaseAddPer:equipBaseAttrList,
|
| | | ChConfig.TYPE_Calc_WeaponAtkAddPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_EquipBaseWeapon],
|
| | | ChConfig.TYPE_Calc_RelicsAtkAddPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_EquipBaseRelics],
|
| | | ChConfig.TYPE_Calc_ArmorMaxHPAddPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_EquipBaseArmor],
|
| | | ChConfig.TYPE_Calc_ArmorDefAddPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_EquipBaseArmor],
|
| | | ChConfig.TYPE_Calc_GodWeaponMaxHPPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_GodWeapon],
|
| | | ChConfig.TYPE_Calc_GodWeaponAtkPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_GodWeapon],
|
| | | ChConfig.TYPE_Calc_StoneMaxHPPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_Stone],
|
| | |
| | | ChConfig.TYPE_Calc_StoneBasePer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_Stone],
|
| | | ChConfig.TYPE_Calc_RealmBasePer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_Prestige],
|
| | | ChConfig.TYPE_Calc_HorseAtkPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_Horse],
|
| | | ChConfig.TYPE_Calc_HorcruxBasePer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_Horcrux],
|
| | | ChConfig.TYPE_Calc_WingHPPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_Wing],
|
| | | ChConfig.TYPE_Calc_SuiteBasePer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_Suit],
|
| | | ChConfig.TYPE_Calc_PlusBaseAtkPer:funcAttrInfoList[ChConfig.Def_CalcAttrFunc_PlusBase],
|
| | | }
|
| | | # 3.2 统计各功能之间非线性属性交叉影响累加
|
| | | funcAddAttrPerInfoDict = {} # 百分比交叉影响所提升的属性值 {功能属性编号:{提升的属性类型:数值, ...}, ...}
|
| | |
| | | fpParam = IpyGameDataPY.GetIpyGameData("FightPowerParam", curLV)
|
| | | mfpDict = {} # 模块战斗力
|
| | | for mfpObj in mfpObjAttrDict.keys():
|
| | | mfpDict[mfpObj.mfpType] = 0 if not fpParam else mfpObj.GetModuleFightPower(fpParam)
|
| | | mfpDict[mfpObj.mfpType] = mfpDict[mfpObj.mfpType] + curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MFPSkill % mfpObj.mfpType)
|
| | | mfpDict[mfpObj.mfpType] = mfpDict[mfpObj.mfpType] + curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MFPEx % mfpObj.mfpType)
|
| | | mfp = 0 if not fpParam else mfpObj.GetModuleFightPower(fpParam)
|
| | | mfp += curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MFPSkill % mfpObj.mfpType)
|
| | | mfp += curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_MFPEx % mfpObj.mfpType)
|
| | | mfpDict[mfpObj.mfpType] = mfp
|
| | |
|
| | | # 最后在附加上特殊附加层级线性属性、永久技能层级固定值
|
| | | CalcLineEffect.ChangePlayerAttrInLineEffectList(curPlayer, allAttrExList[ChConfig.CalcAttr_Battle])
|
| | |
| | | curPlayer.SendPropertyRefresh(ShareDefine.CDBPlayerRefresh_ForbidenTalk, value, False)
|
| | | return
|
| | |
|
| | |
|
| | | ## 职业阶数
|
| | | def GetJobRank(curPlayer): return curPlayer.GetExAttr1()
|
| | | def SetJobRank(curPlayer, jobRank): |
| | | curPlayer.SendGameServerRefreshState(IPY_GameWorld.CDBPlayerRefresh_ExAttr1, jobRank)
|
| | | return curPlayer.SetExAttr1(jobRank)
|
| | |
|
| | | ## 队伍相关审核开关状态, joinReqCheck-入队申请是否需要审核; inviteCheck-组队邀请是否需要审核;
|
| | | def SetTeamCheckStateEx(curPlayer, joinReqCheck, inviteCheck): return SetTeamCheckState(curPlayer, joinReqCheck * 10 + inviteCheck)
|
| | | def SetTeamCheckState(curPlayer, checkState): return curPlayer.SetExAttr2(checkState, False, True)
|
| | |
| | | # 基础闪避百分比
|
| | | def GetBaseMissAddPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_BaseMissAddPer)
|
| | | def SetBaseMissAddPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_BaseMissAddPer, value)
|
| | | # 魂器基础百分比
|
| | | def GetHorcruxBasePer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_HorcruxBasePer)
|
| | | def SetHorcruxBasePer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_HorcruxBasePer, value)
|
| | | # 装备基础百分比
|
| | | def GetEquipBaseAddPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_EquipBaseAddPer)
|
| | | def SetEquipBaseAddPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_EquipBaseAddPer, value)
|
| | | # 武器基础攻击百分比
|
| | | def GetWeaponAtkAddPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_WeaponAtkAddPer)
|
| | | def SetWeaponAtkAddPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_WeaponAtkAddPer, value)
|
| | | # 圣器基础攻击百分比
|
| | | def GetRelicsAtkAddPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_RelicsAtkAddPer)
|
| | | def SetRelicsAtkAddPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_RelicsAtkAddPer, value)
|
| | | # 防具基础生命百分比
|
| | | def GetArmorMaxHPAddPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ArmorMaxHPAddPer)
|
| | | def SetArmorMaxHPAddPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_ArmorMaxHPAddPer, value)
|
| | | # 防具基础防御百分比
|
| | | def GetArmorDefAddPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_ArmorDefAddPer)
|
| | | def SetArmorDefAddPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_ArmorDefAddPer, value)
|
| | | # 神兵生命百分比
|
| | | def GetGodWeaponMaxHPPer(curPlayer): return curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_GodWeaponMaxHPPer)
|
| | | def SetGodWeaponMaxHPPer(curPlayer, value): curPlayer.SetDict(ChConfig.Def_PlayerKey_GodWeaponMaxHPPer, value)
|
| | |
| | | return
|
| | |
|
| | | #-------------------------------------------------------------------------------
|
| | | # 每个功能最多加几个属性
|
| | | # 即以这种方式优化刷属性效率,一个功能需要额外占用Def_MaxAddAttrTypeCnt*2个临时字典缓存(一个存类型,一个存值)
|
| | | Def_MaxAddAttrTypeCnt = 15
|
| | |
|
| | | # 通过SetCalcAttrListValue先缓存功能计算增加的属性值,仅在变更时重新计算设置
|
| | | # 通过AddCalcAttrListValue取出缓存中已经算好的属性值,在刷属性中进行累加,从而减少每次重新计算功能增加的属性
|
| | |
|
| | | ## 设置保存功能事先计算好的属性值
|
| | | def SetCalcAttrListValue(curPlayer, funcIndex, allAttrList):
|
| | |
| | | addMaxHP = curPlayer.GetLV() * battleAttrDict[ChConfig.TYPE_Calc_PerLVMaxHP]
|
| | | battleAttrDict[ChConfig.TYPE_Calc_AttrMaxHP] = battleAttrDict.get(ChConfig.TYPE_Calc_AttrMaxHP, 0) + addMaxHP
|
| | |
|
| | | for attrIndex, addAttrDict in enumerate(allAttrList):
|
| | | findIndex = -1
|
| | | for attrType, attrValue in addAttrDict.items():
|
| | | if not isinstance(attrValue, int):
|
| | | GameWorld.ErrLog("SetCalcAttrListValue funcIndex=%s,attrType=%s,Value=%s is not int!" |
| | | % (funcIndex, attrType, attrValue), curPlayer.GetPlayerID())
|
| | | continue
|
| | | for i in xrange(findIndex + 1, Def_MaxAddAttrTypeCnt):
|
| | | addAttrTypeKey = ChConfig.Def_PlayerKey_CalcAddAttrType % (funcIndex, attrIndex, i)
|
| | | addAttrValueKey = ChConfig.Def_PlayerKey_CalcAddAttrValue % (funcIndex, attrIndex, i)
|
| | | if curPlayer.GetDictByKey(addAttrTypeKey) == 0:
|
| | | findIndex = i
|
| | | curPlayer.SetDict(addAttrTypeKey, attrType)
|
| | | curPlayer.SetDict(addAttrValueKey, attrValue)
|
| | | break
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | if playerID not in PyGameData.g_playerFuncAttrDict:
|
| | | PyGameData.g_playerFuncAttrDict[playerID] = {}
|
| | | funcAttrDict = PyGameData.g_playerFuncAttrDict[playerID]
|
| | | funcAttrDict[funcIndex] = allAttrList
|
| | | #GameWorld.DebugLog("保存功能点属性: funcIndex=%s, %s" % (funcIndex, allAttrList))
|
| | | return
|
| | |
|
| | | def GetCalcAttrListValue(curPlayer, funcIndex):
|
| | |
| | | else:
|
| | | return attrList
|
| | |
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | if playerID not in PyGameData.g_playerFuncAttrDict:
|
| | | return attrList
|
| | | funcAttrDict = PyGameData.g_playerFuncAttrDict[playerID]
|
| | | for funcIndex in funcIndexList:
|
| | | for attrIndex, attrDict in enumerate(attrList):
|
| | | for i in xrange(Def_MaxAddAttrTypeCnt):
|
| | | attrType = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_CalcAddAttrType % (funcIndex, attrIndex, i))
|
| | | if attrType == 0:
|
| | | break
|
| | | attrValue = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_CalcAddAttrValue % (funcIndex, attrIndex, i))
|
| | | if attrType in attrDict:
|
| | | attrDict[attrType] = attrValue + attrDict[attrType]
|
| | | else:
|
| | | attrDict[attrType] = attrValue |
| | | if funcIndex not in funcAttrDict:
|
| | | continue
|
| | | funcAttrList = funcAttrDict[funcIndex]
|
| | | for i, attrDict in enumerate(attrList):
|
| | | curAttrDict = funcAttrList[i]
|
| | | AddAttrDictValue(attrDict, curAttrDict)
|
| | | return attrList
|
| | |
|
| | | ## 刷属性时累加功能事先计算好的属性值
|
| | | def AddCalcAttrListValue(curPlayer, funcIndex, allAttrList):
|
| | | for attrIndex in ChConfig.CalcAttrIndexList:
|
| | | for i in xrange(Def_MaxAddAttrTypeCnt):
|
| | | curAddAttrType = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_CalcAddAttrType % (funcIndex, attrIndex, i))
|
| | | if curAddAttrType == 0:
|
| | | break
|
| | | curAddAttrValue = curPlayer.GetDictByKey(ChConfig.Def_PlayerKey_CalcAddAttrValue % (funcIndex, attrIndex, i))
|
| | | addAttrDict = allAttrList[attrIndex]
|
| | | AddAttrDictValue(addAttrDict, {curAddAttrType:curAddAttrValue})
|
| | | |
| | | return allAttrList
|
| | |
|
| | | ## 重置缓存
|
| | | def ClearCalcAttrListValue(curPlayer, funcIndex):
|
| | | for attrIndex in ChConfig.CalcAttrIndexList:
|
| | | for i in xrange(Def_MaxAddAttrTypeCnt):
|
| | | addAttrTypeKey = ChConfig.Def_PlayerKey_CalcAddAttrType % (funcIndex, attrIndex, i)
|
| | | attrType = curPlayer.GetDictByKey(addAttrTypeKey)
|
| | | if not attrType:
|
| | | break
|
| | | curPlayer.SetDict(addAttrTypeKey, 0)
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_CalcAddAttrValue % (funcIndex, attrIndex, i), 0)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | if playerID not in PyGameData.g_playerFuncAttrDict:
|
| | | return
|
| | | funcAttrDict = PyGameData.g_playerFuncAttrDict[playerID]
|
| | | funcAttrDict.pop(funcIndex, None)
|
| | | return
|
| | |
|
| | | def AddAttrListValue(attrList):
|