| | |
| | | GameWorld.DebugLog("登录更新装备相关值汇总: orangeEquipCount=%s,totalStar=%s,totalPlusLV=%s,totalEvolveLV=%s,totalWashLV=%s,totalStoneLV=%s"
|
| | | % (orangeEquipCount, totalStar, totalPlusLV, totalEvolveLV, totalWashLV, totalStoneLV))
|
| | | Sync_EquipPartSuiteActivateInfo(curPlayer)
|
| | | |
| | | for equipPlace in ChConfig.EquipPlace_LingQi:
|
| | | Sync_LingQiTrainData(curPlayer, equipPlace)
|
| | | |
| | | return
|
| | |
|
| | | ## 刷新所有装备对人物属性的改变
|
| | |
| | | PlayerControl.WorldNotify(0, 'SpiritOrgan', [curPlayer.GetName(), breakItemID, nextItemID])
|
| | | return
|
| | |
|
| | | #// A3 27 灵器培养 #tagCMLingQiTrain
|
| | | #
|
| | | #struct tagCMLingQiTrain
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE EquipPlace; //灵器装备位
|
| | | # BYTE TrainType; //培养类型: 1-基础培养,2-特殊培养,3-百分比培养
|
| | | # WORD UseItemCnt; //消耗材料个数
|
| | | #};
|
| | | def OnLingQiTrain(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | |
| | | equipPlace = clientData.EquipPlace # 灵器装备位
|
| | | trainType = clientData.TrainType # 培养类型
|
| | | costItemCount = clientData.UseItemCnt # 消耗材料个数
|
| | | |
| | | trainLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LingQiTrainLV % (equipPlace, trainType))
|
| | | curEatItemCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LingQiTrainItemCount % (equipPlace, trainType))
|
| | | GameWorld.DebugLog("灵器培养: equipPlace=%s,trainType=%s,trainLV=%s,costItemCount=%s,curEatItemCount=%s" |
| | | % (equipPlace, trainType, trainLV, costItemCount, curEatItemCount))
|
| | | |
| | | if equipPlace not in ChConfig.EquipPlace_LingQi:
|
| | | return
|
| | | |
| | | if trainType <= 0 or trainType > GetLingQiTrainTypes():
|
| | | return
|
| | | |
| | | if trainLV <= 0:
|
| | | GameWorld.DebugLog(" 培养未激活 trainType=%s" % trainType)
|
| | | return
|
| | | |
| | | trainIpyData = IpyGameDataPY.GetIpyGameData("LingQiTrain", equipPlace, trainType, trainLV)
|
| | | if not trainIpyData:
|
| | | return
|
| | | |
| | | needRealmLV = trainIpyData.GetNeedRealmLV()
|
| | | curRealmLV = curPlayer.GetOfficialRank()
|
| | | if curRealmLV < needRealmLV:
|
| | | GameWorld.DebugLog(" 境界不足,无法培养! curRealmLV(%s) < needRealmLV(%s)" % (curRealmLV, needRealmLV))
|
| | | return
|
| | | |
| | | needEatCountTotal = trainIpyData.GetEatCntTotal()
|
| | | if not needEatCountTotal:
|
| | | GameWorld.DebugLog(" 该培养已满级!")
|
| | | return
|
| | | |
| | | costItemIDList = IpyGameDataPY.GetFuncEvalCfg("LingQiTrain", 1)
|
| | | costItemID = costItemIDList[trainType - 1]
|
| | | if not costItemID or not costItemCount:
|
| | | return
|
| | | |
| | | costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, costItemID, costItemCount)
|
| | | lackCnt = costItemCount - bindCnt - unBindCnt
|
| | | if lackCnt > 0:
|
| | | GameWorld.DebugLog(" 消耗道具不足,无法培养!costItemID=%s,costItemCount=%s,bindCnt=%s,unBindCnt=%s,lackCnt=%s" |
| | | % (costItemID, costItemCount, bindCnt, unBindCnt, lackCnt))
|
| | | return
|
| | | |
| | | delCnt = costItemCount
|
| | | |
| | | # 扣除消耗
|
| | | if delCnt:
|
| | | ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, delCnt, "LingQiTrain")
|
| | | |
| | | updClassLV = trainLV
|
| | | updEatItemCount = curEatItemCount + costItemCount
|
| | | GameWorld.DebugLog(" updEatItemCount=%s,needEatCountTotal=%s" % (updEatItemCount, needEatCountTotal))
|
| | | |
| | | if updEatItemCount >= needEatCountTotal:
|
| | | updClassLV += 1
|
| | | updEatItemCount -= needEatCountTotal
|
| | | GameWorld.DebugLog(" 进阶: updClassLV=%s,updEatItemCount=%s" % (updClassLV, updEatItemCount))
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LingQiTrainLV % (equipPlace, trainType), updClassLV)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LingQiTrainItemCount % (equipPlace, trainType), updEatItemCount)
|
| | | |
| | | # 升阶
|
| | | if updClassLV > trainLV:
|
| | | pass
|
| | | |
| | | Sync_LingQiTrainData(curPlayer, equipPlace)
|
| | | # 刷属性
|
| | | RefreshPlayerLingQiEquipAttr(curPlayer)
|
| | | PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState()
|
| | | return
|
| | |
|
| | | def GetLingQiTrainTypes():
|
| | | return len(IpyGameDataPY.GetFuncEvalCfg("LingQiTrain", 1))
|
| | |
|
| | | def Sync_LingQiTrainData(curPlayer, equipPlace):
|
| | | clientPack = ChPyNetSendPack.tagMCLingQiTrainInfo()
|
| | | clientPack.EquipPlace = equipPlace
|
| | | clientPack.TrainLVList = []
|
| | | clientPack.TrainItemCountList = []
|
| | | for trainType in xrange(1, GetLingQiTrainTypes() + 1):
|
| | | trainLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LingQiTrainLV % (equipPlace, trainType))
|
| | | if trainLV == 0:
|
| | | trainLV = 1
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LingQiTrainLV % (equipPlace, trainType), trainLV)
|
| | | clientPack.TrainLVList.append(trainLV)
|
| | | clientPack.TrainItemCountList.append(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LingQiTrainItemCount % (equipPlace, trainType)))
|
| | | clientPack.TrainTypes = len(clientPack.TrainLVList)
|
| | | NetPackCommon.SendFakePack(curPlayer, clientPack)
|
| | | return
|
| | |
|
| | | def RefreshPlayerLingQiEquipAttr(curPlayer):
|
| | | ''' 刷新玩家灵器装备属性
|
| | | '''
|
| | |
| | | PlayerControl.CalcAttrDict_Type(lqAttrID, lqAttrValue, lingQiAttrList)
|
| | |
|
| | | #灵器各部位其他属性
|
| | | if equipPlace == ShareDefine.retWing:
|
| | | PlayerWing.CalcWingAttrEx(curPlayer, curEquip, allAttrList)
|
| | | #if equipPlace == ShareDefine.retWing:
|
| | | # PlayerWing.CalcWingAttrEx(curPlayer, curEquip, allAttrList)
|
| | | |
| | | # 新培养属性
|
| | | guardTrainAttrList = [{} for _ in range(4)]
|
| | | wingTrainAttrList = [{} for _ in range(4)]
|
| | | peerlessWeaponTrainAttrList = [{} for _ in range(4)]
|
| | | peerlessWeapon2TrainAttrList = [{} for _ in range(4)]
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for index in xrange(ipyDataMgr.GetLingQiTrainCount()):
|
| | | trainIpyData = ipyDataMgr.GetLingQiTrainByIndex(index)
|
| | | equipPlace = trainIpyData.GetEquipPlace()
|
| | | trainType = trainIpyData.GetTrainType()
|
| | | dataTrainLV = trainIpyData.GetTrainLV()
|
| | |
|
| | | if equipPlace == ShareDefine.retGuard1:
|
| | | lingQiTrainAttrList = guardTrainAttrList
|
| | | elif equipPlace == ShareDefine.retWing:
|
| | | lingQiTrainAttrList = wingTrainAttrList
|
| | | elif equipPlace == ShareDefine.retPeerlessWeapon:
|
| | | lingQiTrainAttrList = peerlessWeaponTrainAttrList
|
| | | elif equipPlace == ShareDefine.retPeerlessWeapon2:
|
| | | lingQiTrainAttrList = peerlessWeapon2TrainAttrList
|
| | | else:
|
| | | continue
|
| | | |
| | | trainLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LingQiTrainLV % (equipPlace, trainType))
|
| | | |
| | | if dataTrainLV > trainLV:
|
| | | continue
|
| | | elif dataTrainLV == trainLV:
|
| | | trainItemCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LingQiTrainItemCount % (equipPlace, trainType))
|
| | | else:
|
| | | trainItemCount = trainIpyData.GetEatCntTotal()
|
| | | |
| | | # 等阶额外属性
|
| | | lvAttrTypeList = trainIpyData.GetLVAttrTypeList()
|
| | | lvAttrValueList = trainIpyData.GetLVAttrValueList()
|
| | | for i, attrID in enumerate(lvAttrTypeList):
|
| | | attrValue = lvAttrValueList[i]
|
| | | PlayerControl.CalcAttrDict_Type(attrID, attrValue, lingQiTrainAttrList)
|
| | | |
| | | # 培养丹增加属性
|
| | | eatCntEverytime = trainIpyData.GetEatCntEverytime()
|
| | | if trainItemCount and eatCntEverytime:
|
| | | eatItemAttrTypeList = trainIpyData.GetEatItemAttrTypeList()
|
| | | eatItemAttrValueList = trainIpyData.GetEatItemAttrValueList()
|
| | | attrMultiple = trainItemCount / eatCntEverytime
|
| | | for i, attrID in enumerate(eatItemAttrTypeList):
|
| | | attrValue = eatItemAttrValueList[i]
|
| | | PlayerControl.CalcAttrDict_Type(attrID, attrValue * attrMultiple, lingQiTrainAttrList)
|
| | | |
| | | #GameWorld.DebugLog("守护培养属性: %s" % guardTrainAttrList)
|
| | | #GameWorld.DebugLog("翅膀培养属性: %s" % wingTrainAttrList)
|
| | | #GameWorld.DebugLog("灭世培养属性: %s" % peerlessWeaponTrainAttrList)
|
| | | #GameWorld.DebugLog("噬魂培养属性: %s" % peerlessWeapon2TrainAttrList)
|
| | | PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_GuardTarin, guardTrainAttrList)
|
| | | PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_WingTarin, wingTrainAttrList)
|
| | | PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_PeerlessWeaponTrain, peerlessWeaponTrainAttrList)
|
| | | PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_PeerlessWeapon2Train, peerlessWeapon2TrainAttrList)
|
| | | |
| | | lqFightPowerEx = eval(IpyGameDataPY.GetFuncCompileCfg("FightpowerFormula", 2))
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPEx % ShareDefine.Def_MFPType_LingQi, lqFightPowerEx)
|
| | |
|