| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HorserLV, horseLV)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HorserEatItemCount, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HorserSkinPlusState, 0)
|
| | | for trainType in xrange(1, GetHorseTrainTypes() + 1):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HorserTrainLV % trainType, 1)
|
| | |
|
| | | horseID = ipyData.GetHorseSkinID()
|
| | | if not ItemCommon.FindItemInPackByItemID(curPlayer, horseID, IPY_GameWorld.rptEquip):
|
| | |
| | | allAttrList = [{} for _ in range(4)]
|
| | | allAttrListHorseSoul = [{} for _ in range(4)]
|
| | | allAttrListSkin = [{} for _ in range(4)]
|
| | | allAttrListTrain = [{} for _ in range(4)]
|
| | |
|
| | | horseSpeed = 0 # 坐骑功能增加的速度值,骑乘时才有效果
|
| | | horseLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserLV)
|
| | |
| | | continue
|
| | | PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrListSkin)
|
| | |
|
| | | # 新培养属性
|
| | | for index in xrange(ipyDataMgr.GetHorseTrainCount()):
|
| | | trainIpyData = ipyDataMgr.GetHorseTrainByIndex(index)
|
| | | trainType = trainIpyData.GetTrainType()
|
| | | dataTrainLV = trainIpyData.GetTrainLV()
|
| | | trainLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserTrainLV % trainType)
|
| | | |
| | | if dataTrainLV > trainLV:
|
| | | continue
|
| | | elif dataTrainLV == trainLV:
|
| | | trainItemCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserTrainItemCount % trainType)
|
| | | else:
|
| | | trainItemCount = trainIpyData.GetEatCntTotal()
|
| | | |
| | | # 等阶额外属性
|
| | | lvAttrTypeList = trainIpyData.GetLVAttrTypeList()
|
| | | lvAttrValueList = trainIpyData.GetLVAttrValueList()
|
| | | for i, attrID in enumerate(lvAttrTypeList):
|
| | | attrValue = lvAttrValueList[i]
|
| | | if attrID == ShareDefine.Def_Effect_Speed:
|
| | | horseSpeed += attrValue
|
| | | continue
|
| | | PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrListTrain)
|
| | | |
| | | # 培养丹增加属性
|
| | | 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, allAttrListTrain)
|
| | | |
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPEx % ShareDefine.Def_MFPType_Horse, initFPAdd)
|
| | |
|
| | | #GameWorld.DebugLog("坐骑功能属性: horseLV=%s,horseSpeed=%s,totalItemCount=%s,initFPAdd=%s" % (horseLV, horseSpeed, totalItemCount, initFPAdd))
|
| | |
| | | PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Horse, allAttrList)
|
| | | PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_HorseSoul, allAttrListHorseSoul)
|
| | | PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_HorseSkin, allAttrListSkin)
|
| | | PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_HorseTarin, allAttrListTrain)
|
| | | return
|
| | |
|
| | | #// A5 27 坐骑提升 #tagCMHorseUp
|
| | |
| | | RefreshHorseAttr(curPlayer)
|
| | | return
|
| | |
|
| | | #// A5 31 坐骑培养 #tagCMHorseTrain
|
| | | #
|
| | | #struct tagCMHorseTrain
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE TrainType; //培养类型: 1-基础培养,2-特殊培养,3-百分比培养
|
| | | # WORD UseItemCnt; //消耗材料个数
|
| | | #};
|
| | | def OnHorseTrain(index, curPackData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | trainType = curPackData.TrainType # 培养类型
|
| | | costItemCount = curPackData.UseItemCnt # 消耗材料个数
|
| | | |
| | | trainLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserTrainLV % trainType)
|
| | | curEatItemCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserTrainItemCount % trainType)
|
| | | GameWorld.DebugLog("坐骑培养: trainType=%s,trainLV=%s,costItemCount=%s,curEatItemCount=%s" |
| | | % (trainType, trainLV, costItemCount, curEatItemCount))
|
| | | |
| | | if trainType <= 0 or trainType > GetHorseTrainTypes():
|
| | | return
|
| | | |
| | | if trainLV <= 0:
|
| | | GameWorld.DebugLog(" 坐骑培养未激活 trainType=%s" % trainType)
|
| | | return
|
| | | |
| | | trainIpyData = IpyGameDataPY.GetIpyGameData("HorseTrain", 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("HorseTrain", 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, ChConfig.ItemDel_Horse)
|
| | | |
| | | 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_HorserTrainLV % trainType, updClassLV)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HorserTrainItemCount % trainType, updEatItemCount)
|
| | | |
| | | # 升阶
|
| | | if updClassLV > trainLV:
|
| | | pass
|
| | | |
| | | Sync_HorseClassData(curPlayer)
|
| | | # 刷属性,更新排行榜
|
| | | RefreshHorseAttr(curPlayer)
|
| | | return
|
| | |
|
| | | def GetHorseTrainTypes():
|
| | | return len(IpyGameDataPY.GetFuncEvalCfg("HorseTrain", 1))
|
| | |
|
| | | def PlayerHorseLogin(curPlayer):
|
| | | ##坐骑登录处理
|
| | | if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Horse):
|
| | | return
|
| | | |
| | | # 培养是后面加的功能,每次登录补检查一下功能开始时设置为培养1级
|
| | | for trainType in xrange(1, GetHorseTrainTypes() + 1):
|
| | | if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserTrainLV % trainType) == 0:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HorserTrainLV % trainType, 1)
|
| | |
|
| | | Sync_HorseClassData(curPlayer)
|
| | | SyncHorsePetSkinData(curPlayer)
|
| | |
| | | horseData.LV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserLV)
|
| | | horseData.EatItemCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserEatItemCount)
|
| | | horseData.SkinPlusState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserSkinPlusState)
|
| | | horseData.TrainLVList = []
|
| | | horseData.TrainItemCountList = []
|
| | | for trainType in xrange(1, GetHorseTrainTypes() + 1):
|
| | | horseData.TrainLVList.append(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserTrainLV % trainType))
|
| | | horseData.TrainItemCountList.append(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserTrainItemCount % trainType))
|
| | | horseData.TrainTypes = len(horseData.TrainLVList)
|
| | | NetPackCommon.SendFakePack(curPlayer, horseData)
|
| | | return
|
| | |
|