| | |
| | | import SkillCommon
|
| | | import PlayerMagicWeapon
|
| | | import PassiveBuffEffMng
|
| | | import CrossPlayerData
|
| | | import PlayerWeekParty
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | |
| | | #注意2:
|
| | | #玩家移动的时候, 如果玩家有马匹 , 则允许玩家移动
|
| | | ################################################
|
| | | Def_HorseEquipIndex = 5
|
| | |
|
| | | ## 玩家骑马脚本(封包参数)
|
| | | # @param index 玩家索引
|
| | |
| | | pack = IPY_GameWorld.IPY_CRideHorse()
|
| | | #//1: 骑马 0: 下马
|
| | | curPlayerRideType = pack.GetRide()
|
| | | if PlayerControl.GetCrossMapID(curPlayer):
|
| | | # 暂只处理上马
|
| | | if curPlayerRideType:
|
| | | dataList = [curPlayerRideType]
|
| | | CrossPlayerData.SendDataToCrossServer(curPlayer, CrossPlayerData.CrossData_RideHorse, dataList)
|
| | | return
|
| | | #骑马行为状态, 客户端限制
|
| | | if not OperControlManager.IsObjCanDoAction(curPlayer,
|
| | | ChConfig.Def_Obj_ActState_ClientAct,
|
| | |
| | |
|
| | | #if curPlayer.IsMoving():
|
| | | # curPlayer.Move(curPlayer.GetDestPosX(), curPlayer.GetDestPosY())
|
| | | return
|
| | |
|
| | | def CrossServer_RideHorse(curPlayer, dataList):
|
| | | curPlayerRideType = dataList[0]
|
| | | |
| | | #骑马
|
| | | if curPlayerRideType == 1:
|
| | | PlayerRideHorseUp(curPlayer, True)
|
| | | |
| | | return
|
| | |
|
| | | #---------------------下马逻辑
|
| | |
| | | # 未加载成功骑乘会导致模型加载失败报错
|
| | | if not curPlayer.GetInitOK():
|
| | | return False
|
| | | |
| | | #地图不允许骑马 RideLimit_lhs_0
|
| | | if not GameWorld.GetMap().GetMapCanRide():
|
| | | PlayerControl.NotifyCode(curPlayer, "RideLimit_lhs_0")
|
| | | return False
|
| | | |
| | | customMapID = PlayerControl.GetCustomMapID(curPlayer)
|
| | | if customMapID:
|
| | | ipyMapData = IpyGameDataPY.GetIpyGameData("ChinMap", customMapID)
|
| | | if not ipyMapData or not ipyMapData.GetCanRide():
|
| | | PlayerControl.NotifyCode(curPlayer, "RideLimit_lhs_0")
|
| | | return False
|
| | | else:
|
| | | #地图不允许骑马 RideLimit_lhs_0
|
| | | if not GameWorld.GetMap().GetMapCanRide():
|
| | | PlayerControl.NotifyCode(curPlayer, "RideLimit_lhs_0")
|
| | | return False
|
| | |
|
| | | #检查玩家状态,只有在空闲状态才能上马
|
| | | if curPlayer.GetPlayerVehicle() != IPY_GameWorld.pvNull :
|
| | |
| | |
|
| | | #检查是否装备指定ID物品
|
| | | playerEquip = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
|
| | | itemRideHorse = playerEquip.GetAt(ShareDefine.retHorse)
|
| | | itemRideHorse = playerEquip.GetAt(Def_HorseEquipIndex)
|
| | | #无指定道具
|
| | | if itemRideHorse.IsEmpty():
|
| | | #PlayerControl.NotifyCode(curPlayer, "NotPrepareSteed")
|
| | |
| | | horseIndex = packData.Index
|
| | |
|
| | | DoChangeHorse(curPlayer, horseIndex, tick)
|
| | | |
| | | if not GameWorld.IsCrossServer():
|
| | | dataList = [horseIndex]
|
| | | CrossPlayerData.SendDataToCrossServer(curPlayer, CrossPlayerData.CrossData_HorseChange, dataList)
|
| | | return
|
| | |
|
| | | def CrossServer_ChangeHorse(curPlayer, dataList):
|
| | | ## 跨服处理 坐骑变更
|
| | | horseIndex = dataList[0]
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("Horse", horseIndex)
|
| | | if not ipyData:
|
| | | return
|
| | | |
| | | horseItemID = ipyData.GetItemID()
|
| | | |
| | | if ItemCommon.FindItemInPackByItemID(curPlayer, horseItemID, IPY_GameWorld.rptEquip):
|
| | | return
|
| | | |
| | | isOK = ItemControler.PutItemInTempSwap(curPlayer, horseItemID)
|
| | | if not isOK:
|
| | | return
|
| | | |
| | | curHorse = ItemCommon.FindItemInPackByItemID(curPlayer, horseItemID, ShareDefine.rptTempSwap)
|
| | | if not curHorse:
|
| | | return
|
| | | |
| | | isRideHorse = curPlayer.GetPlayerVehicle() == IPY_GameWorld.pvHorse
|
| | | if isRideHorse:
|
| | | PlayerRideHorseDown(curPlayer, False)
|
| | | |
| | | #---执行玩家换装逻辑---
|
| | | tick = GameWorld.GetGameWorld().GetTick()
|
| | | if ChEquip.DoPlayerEquipItem(curPlayer, curHorse, ItemCommon.GetEquipPackIndex(curHorse), tick):
|
| | | if isRideHorse:
|
| | | PlayerRideHorseUp(curPlayer, False)
|
| | | |
| | | return
|
| | |
|
| | | def DoChangeHorse(curPlayer, horseIndex, tick):
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("Horse", horseIndex)
|
| | |
| | | PlayerRideHorseDown(curPlayer, False)
|
| | |
|
| | | #---执行玩家换装逻辑---
|
| | | if ChEquip.DoPlayerEquipItem(curPlayer, curHorse, ShareDefine.retHorse, tick):
|
| | | if ChEquip.DoPlayerEquipItem(curPlayer, curHorse, ItemCommon.GetEquipPackIndex(curHorse), tick):
|
| | | if isRideHorse:
|
| | | PlayerRideHorseUp(curPlayer, False)
|
| | | return
|
| | |
| | | #
|
| | | # #---执行玩家换装逻辑---
|
| | | # tick = GameWorld.GetGameWorld().GetTick()
|
| | | # ChEquip.DoPlayerEquipItem(curPlayer, curHorse, ShareDefine.retHorse, tick)
|
| | | # ChEquip.DoPlayerEquipItem(curPlayer, curHorse, Def_HorseEquipIndex, tick)
|
| | | #
|
| | | # __HorseLearnSkill(curPlayer, 0)
|
| | | # # 计算属性 防止给第一只坐骑后,客户端坐骑战斗力为0
|
| | |
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_SpeedHorse, maxSpeed)
|
| | |
|
| | | # 果实对坐骑的加成, 魂石果实算附加属性层,单独计算
|
| | | PlayerAttrFruit.CalcAttrFruitAddAtrr(curPlayer, allAttrListHorseSoul, ShareDefine.Def_AttrFruitFunc_Horse)
|
| | |
|
| | | fightPowerEx = PlayerAttrFruit.CalcAttrFruitAddAtrr(curPlayer, allAttrListHorseSoul, ShareDefine.Def_AttrFruitFunc_Horse)
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPEx % ShareDefine.Def_MFPType_HorseSoul, fightPowerEx)
|
| | | |
| | | #PlayerControl.CalcFuncPackItem(curPlayer, ShareDefine.Def_Pack_Type_HorseSkill, allAttrList)
|
| | |
|
| | | # 保存计算值
|
| | |
| | | curItem = curItemPack.GetAt(itemIndex)
|
| | |
|
| | | #检查物品
|
| | | if not ItemCommon.CheckItemCanUse(curItem):
|
| | | if not ItemCommon.CheckItemCanUse(curItem) or ItemControler.GetIsAuctionItem(curItem):
|
| | | continue
|
| | |
|
| | | itemCnt = curItem.GetCount()
|
| | |
| | |
|
| | | skillIDList = upIpyData.GetSkillID()
|
| | | if skillIDList:
|
| | | sysMark = upIpyData.GetSysMark() or 'MountUpLv'
|
| | | for skillID in skillIDList:
|
| | | __GiveSkill(curPlayer, skillID, tick)
|
| | | PlayerControl.WorldNotify(0, 'MountUpLv', [playerName, horseID, updClassLV, skillID])
|
| | | PlayerControl.WorldNotify(0, sysMark, [playerName, horseID, updClassLV, skillID])
|
| | | if not skillIDList and updClassLV == maxLV:
|
| | | PlayerControl.WorldNotify(0, 'MountUpLvMax', [playerName, horseID])
|
| | |
|
| | |
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_HorseAllLV, 1, [horseID, updClassLV])
|
| | |
|
| | | EventShell.EventRespons_HorseLV(curPlayer, updClassLV)
|
| | | |
| | | EventShell.EventRespons_HorseUp(curPlayer)
|
| | |
|
| | | addLV = updClassLV - horseLV
|
| | | if addLV:
|
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Horser_LV%horseID, updateClassLV, ChConfig.Def_PDictType_Horse)
|
| | | #EventReport.WriteEvent_custom_mission_log(curPlayer, ChConfig.CME_Class_Horse, ChConfig.CME_Log_End, 1, cmeInfoEx=str(updateClassLV))
|
| | | sumLV = GetHorseSumLV(curPlayer)
|
| | | PlayerMagicWeapon.SetMWPrivilegeData(curPlayer, ChConfig.MWPrivilege_Horse, sumLV)
|
| | |
|
| | | # 刷属性,更新排行榜
|
| | | RefreshHorseAttr(curPlayer)
|
| | | # 玩家马匹进阶
|
| | |
| | | ItemCommon.ReduceItem(curPlayer, itemPack, itemList, needItemCnt, False, ChConfig.ItemDel_Horse)
|
| | | #设置初始等级
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Horser_LV % horseID, ipyData.GetInitLV(), ChConfig.Def_PDictType_Horse)
|
| | | |
| | | for _ in xrange(ipyData.GetInitLV()):
|
| | | EventShell.EventRespons_HorseUp(curPlayer)
|
| | | # 记录开服活动马匹阶级
|
| | | sumLV = GetHorseSumLV(curPlayer)
|
| | | OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_HorseLV, sumLV)
|
| | | PlayerMagicWeapon.SetMWPrivilegeData(curPlayer, ChConfig.MWPrivilege_Horse, sumLV)
|
| | | PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Horse, horseID, False)
|
| | | |
| | | playerEquip = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
|
| | | itemRideHorse = playerEquip.GetAt(ShareDefine.retHorse)
|
| | | itemRideHorse = playerEquip.GetAt(Def_HorseEquipIndex)
|
| | | #无指定道具
|
| | | if itemRideHorse.IsEmpty():
|
| | | DoChangeHorse(curPlayer, horseID, tick)
|
| | |
| | | # tick = GameWorld.GetGameWorld().GetTick()
|
| | | # PlayerRideHorseDown(curPlayer, False)
|
| | | # # 执行玩家换装逻辑
|
| | | # if ChEquip.DoPlayerEquipItem(curPlayer, curHorseSkin, ShareDefine.retHorse, tick):
|
| | | # if ChEquip.DoPlayerEquipItem(curPlayer, curHorseSkin, Def_HorseEquipIndex, tick):
|
| | | # PlayerRideHorseUp(curPlayer, False)
|
| | |
|
| | |
|
| | |
| | |
|
| | | # 刷属性,更新排行榜
|
| | | RefreshHorseAttr(curPlayer)
|
| | | PlayerControl.WorldNotify(0, 'GetMount', [curPlayer.GetName(), ipyData.GetItemID()])
|
| | | sysMark = ipyData.GetUnlockSys() or 'GetMount'
|
| | | PlayerControl.WorldNotify(0, sysMark, [curPlayer.GetName(), ipyData.GetItemID()])
|
| | | #
|
| | | # HorseSkinNotifyDict = ReadChConfig.GetEvalChConfig("HorseSkinNotify")
|
| | | # if horseSkinID in HorseSkinNotifyDict:
|