| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package Player.PlayerHorse
|
| | | #
|
| | | # @todo:坐骑
|
| | | # @author hxp
|
| | | # @date 2019-12-17
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 坐骑
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2019-12-17 18:30"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | ##@package PlayerHorse
|
| | | # 骑马事件逻辑处理
|
| | | #
|
| | | # @author eggxp
|
| | | # @date 2010-4-28
|
| | | # @version 6.4
|
| | | #
|
| | | # 模块详细说明
|
| | | # 修改时间 修改人 修改内容
|
| | | # @change: "2016-11-29 15:30" hxp 技能战力算在功能上
|
| | | # @change: "2017-08-11 21:30" xdh 手游版坐骑
|
| | | #---------------------------------------------------------------------
|
| | | #"""Version = 2017-08-11 21:30"""
|
| | | #---------------------------------------------------------------------
|
| | | import ChPyNetSendPack
|
| | | import IPY_GameWorld
|
| | | import GameWorld
|
| | |
| | | import GameFuncComm
|
| | | import EventShell
|
| | | import IpyGameDataPY
|
| | | import PlayerSuccess
|
| | | import SkillShell
|
| | | import SkillCommon
|
| | | import PlayerMagicWeapon
|
| | | import PassiveBuffEffMng
|
| | | import CrossPlayerData
|
| | | import PlayerWeekParty
|
| | | import PlayerPet
|
| | | #---------------------------------------------------------------------
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #===============================================================================
|
| | | # #玩家骑马, 要:
|
| | | # #1.设置玩家为骑乘状态, |
| | | # |
| | | # #玩家下马, 要:
|
| | | # #1.设置为空闲状态 |
| | | #===============================================================================
|
| | |
|
| | | ############################################
|
| | | #如果玩家要上马:
|
| | | #1. 如果玩家不在空闲状态, 返回
|
| | | #2. 如果玩家没有装备马匹, 返回
|
| | | #3. 设定玩家进入准备状态(类似于挖宝准备)
|
| | | #4. 准备状态结束后, 调用这个模块的DoPlayerRideHorse函数, 刷新所有状态
|
| | | ############################################
|
| | |
|
| | | ################################################
|
| | | #注意1:
|
| | | #玩家在刷新所有状态的时候:
|
| | | #如果玩家有装备马匹, 但是没有骑马, 不刷新马匹装备产生的buff
|
| | | #注意2:
|
| | | #玩家移动的时候, 如果玩家有马匹 , 则允许玩家移动
|
| | | ################################################
|
| | | Def_HorseEquipIndex = 5
|
| | |
|
| | | ## 玩家骑马脚本(封包参数)
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | |
|
| | | #//03 09 玩家骑马#tagCRideHorse
|
| | | #
|
| | | #struct tagCRideHorse
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE Ride; //1: 骑马 0: 下马
|
| | | #};
|
| | | def OnRideHorse(index, tick):
|
| | | GameWorld.GetPsycoFunc(__Func_OnRideHorse)(index, tick)
|
| | | return
|
| | |
|
| | | ## 玩家骑马脚本(封包参数)
|
| | | # @param index 玩家索引
|
| | | # @param tick 当前时间
|
| | | # @return None
|
| | | # @remarks 函数详细说明.
|
| | | def __Func_OnRideHorse(index, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | |
| | | # 判断玩家是否可以升级马匹
|
| | | if not CheckCanTrainHorse(curPlayer):
|
| | | return
|
| | | if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Horse):
|
| | | return False
|
| | |
|
| | | cdTime = ChConfig.TYPE_Player_Tick_Time[ChConfig.TYPE_Player_Tick_HorseChangState]
|
| | | # 判断时间是否超过间隔
|
| | | if tick - curPlayer.GetTickByType(ChConfig.TYPE_Player_Tick_HorseChangState) <= cdTime:
|
| | | #没有到刷新间隔
|
| | | return
|
| | | |
| | | curPlayer.SetTickByType(ChConfig.TYPE_Player_Tick_HorseChangState, tick)
|
| | |
|
| | | pack = IPY_GameWorld.IPY_CRideHorse()
|
| | |
| | |
|
| | | #下马
|
| | | if curPlayerRideType == 0 :
|
| | | #是否可以下马
|
| | | if CheckPlayerRideHorseDown(curPlayer) != True :
|
| | | return
|
| | | PlayerRideHorseDown(curPlayer, True)
|
| | |
|
| | | #骑马
|
| | | elif curPlayerRideType == 1:
|
| | | #是否可以骑马
|
| | | #if curPlayer.GetPlayerAction() not in [IPY_GameWorld.paNull, IPY_GameWorld.paAttack]:
|
| | | #CanNotRideHoreWrongState 对不起,您的当前状态,无法上马
|
| | | # PlayerControl.NotifyCode(curPlayer, "CanNotRideHoreWrongState")
|
| | | # return
|
| | | |
| | | #移动中不执行此操作
|
| | | |
| | | if not CheckPlayerRideHorseUp(curPlayer):
|
| | | return
|
| | | |
| | | PlayerRideHorseUp(curPlayer, True)
|
| | | #此处不加PlayerRideHorseUp, 等待PlayerState调用 PlayerRideHorseUp
|
| | | #PlayerControl.Sync_PrepareBegin(curPlayer, ChConfig.Def_RidehorseTime, IPY_GameWorld.pstHorse)
|
| | |
|
| | | #if curPlayer.IsMoving():
|
| | | # curPlayer.Move(curPlayer.GetDestPosX(), curPlayer.GetDestPosY()) |
| | | return
|
| | |
|
| | | def CrossServer_RideHorse(curPlayer, dataList):
|
| | |
| | |
|
| | | return
|
| | |
|
| | | #---------------------下马逻辑
|
| | |
|
| | | ## 是否可以下马 |
| | | # @param curPlayer 当前玩家
|
| | | # @return None or True
|
| | | # @remarks 函数详细说明.
|
| | | def CheckPlayerRideHorseDown(curPlayer) :
|
| | | def PlayerRideHorseDown(curPlayer, refreshState=True) :
|
| | | ## 玩家下马
|
| | | if curPlayer.GetPlayerVehicle() != IPY_GameWorld.pvHorse :
|
| | | #GameWorld.Log("不在骑马状态,无法下马")
|
| | | return
|
| | |
|
| | | #GameWorld.Log("玩家下马" , curPlayer.GetPlayerID())
|
| | | return True
|
| | |
|
| | | ## 玩家下马
|
| | | # @param curPlayer 当前玩家
|
| | | # @param refreshState: 是否需要刷新状态 |
| | | # @return None |
| | | # @remarks 函数详细说明.
|
| | | def PlayerRideHorseDown(curPlayer, refreshState=True) :
|
| | | #设置玩家无交通工具
|
| | | curPlayer.SetPlayerVehicle(IPY_GameWorld.pvNull)
|
| | | curPlayer.Sync_GetoffHorse()
|
| | |
|
| | |
| | | playerControl.RefreshPlayerAttrByBuff()
|
| | | return
|
| | |
|
| | | #----------------------上马逻辑
|
| | | def PlayerRideHorseUp(curPlayer, refreshState=True, isNotify=True) :
|
| | | ## 玩家上马 |
| | |
|
| | | ## 是否可以上马 |
| | | # @param curPlayer 当前玩家
|
| | | # @return None or True |
| | | # @remarks 函数详细说明.
|
| | | def CheckPlayerRideHorseUp(curPlayer):
|
| | | # 未加载成功骑乘会导致模型加载失败报错
|
| | | if not curPlayer.GetInitOK():
|
| | | return False
|
| | | return
|
| | |
|
| | | 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
|
| | | return
|
| | | else:
|
| | | #地图不允许骑马 RideLimit_lhs_0
|
| | | if not GameWorld.GetMap().GetMapCanRide():
|
| | | PlayerControl.NotifyCode(curPlayer, "RideLimit_lhs_0")
|
| | | return False
|
| | | return
|
| | |
|
| | | #检查玩家状态,只有在空闲状态才能上马
|
| | | if curPlayer.GetPlayerVehicle() != IPY_GameWorld.pvNull :
|
| | | #GameWorld.Log("已经有交通工具,无法上马")
|
| | | return False
|
| | | return
|
| | |
|
| | | #检查是否装备指定ID物品
|
| | | playerEquip = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
|
| | | itemRideHorse = playerEquip.GetAt(Def_HorseEquipIndex)
|
| | | #无指定道具
|
| | | if itemRideHorse.IsEmpty():
|
| | | #PlayerControl.NotifyCode(curPlayer, "NotPrepareSteed")
|
| | | return False
|
| | |
|
| | | |
| | | #无耐久也能上马
|
| | | #===============================================================================
|
| | | # #无耐久,无法激活
|
| | | # if itemRideHorse.GetCurDurg() <= 0 :
|
| | | # GameWorld.Log("装备的马匹耐久为0,无法上马")
|
| | | # return
|
| | | #===============================================================================
|
| | | |
| | | #GameWorld.Log("玩家上马" , curPlayer.GetPlayerID())
|
| | | return True |
| | |
|
| | | ## 玩家上马 |
| | | # @param curPlayer: 当前玩家
|
| | | # @param refreshState: 是否需要刷新状态 |
| | | # @return 上马是否成功
|
| | | # @remarks 函数详细说明.
|
| | | def PlayerRideHorseUp(curPlayer, refreshState=True, isNotify=True) :
|
| | |
|
| | | if not CheckPlayerRideHorseUp(curPlayer):
|
| | | GameWorld.Log("Can not Ride Horse")
|
| | | return False
|
| | | return
|
| | |
|
| | | if curPlayer.GetPlayerAction() == IPY_GameWorld.paGameEvent:
|
| | | tick = GameWorld.GetGameWorld().GetTick()
|
| | |
| | | playerControl.RefreshPlayerAttrByBuff()
|
| | | return True
|
| | |
|
| | | ## 判断玩家是否可以升级马匹
|
| | | # @param curPlayer 玩家
|
| | | # @return 无意义
|
| | | def CheckCanTrainHorse(curPlayer):
|
| | | #=====================================================================
|
| | |
|
| | | if curPlayer.GetHP() <= 0 or curPlayer.GetPlayerAction() == IPY_GameWorld.paDie:
|
| | | return False
|
| | | #//A5 01 坐骑激活 #tagPlayerActivateHorse
|
| | | #
|
| | | #struct tagPlayerActivateHorse
|
| | | #{
|
| | | # tagHead Head;
|
| | | # DWORD HorseID; //坐骑幻化ID
|
| | | #};
|
| | | def ActivateHorseSkinItem(index, curPackData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | activateID = curPackData.HorseID
|
| | |
|
| | | if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Horse):
|
| | | #对应的任务限制未完成
|
| | | return False
|
| | | |
| | | return True
|
| | | |
| | |
|
| | | ## 通知客户端,培养情况
|
| | | # @param curPlayer
|
| | | # @return 无意义
|
| | | def Sync_HorseTrainData(curPlayer):
|
| | | Sync_HorseClassData(curPlayer)
|
| | | return
|
| | |
|
| | | #=====================================================================
|
| | | activateState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserSkinPlusState)
|
| | | if activateState & pow(2, activateID):
|
| | | GameWorld.DebugLog("该坐骑已幻化!activateState=%s,activateID=%s" % (activateState, activateID))
|
| | | return
|
| | | |
| | | ipyData = IpyGameDataPY.GetIpyGameData("HorseSkinPlus", activateID)
|
| | | if not ipyData:
|
| | | return
|
| | | |
| | | needItemID = ipyData.GetUnlockItemID()
|
| | | needItemCnt = ipyData.GetUnlockItemCnt()
|
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | hasEnough, itemList = ItemCommon.GetItem_FromPack_ByID(needItemID, itemPack, needItemCnt)
|
| | | if not hasEnough:
|
| | | GameWorld.DebugLog("坐骑幻化道具不足! needItemID=%s,needItemCnt=%s" % (needItemID, needItemCnt))
|
| | | return
|
| | | ItemCommon.ReduceItem(curPlayer, itemPack, itemList, needItemCnt, False, ChConfig.ItemDel_Horse)
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HorserSkinPlusState, activateState|pow(2, activateID))
|
| | | |
| | | playerEquip = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
|
| | | itemRideHorse = playerEquip.GetAt(Def_HorseEquipIndex)
|
| | | #无指定道具
|
| | | if itemRideHorse.IsEmpty():
|
| | | DoChangeHorse(curPlayer, 2, activateID, tick)
|
| | | |
| | | Sync_HorseClassData(curPlayer)
|
| | | GameWorld.Log("坐骑激活成功!activateID=%s" % (activateID), playerID)
|
| | | |
| | | # 刷属性,更新排行榜
|
| | | RefreshHorseAttr(curPlayer)
|
| | | PlayerControl.WorldNotify(0, "GetMount", [curPlayer.GetName(), ipyData.GetHorseSkinPlusID()])
|
| | | return
|
| | |
|
| | |
|
| | | #//A5 02 坐骑选择 #tagPlayerChooseHorse
|
| | | #
|
| | | #struct tagPlayerChooseHorse
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE Index; //选择索引
|
| | | # BYTE ChooseType; // 1-按等阶,2-按幻化
|
| | | # BYTE LVID; // 阶等级或幻化ID
|
| | | #};
|
| | | #=====================================================================
|
| | | ## 玩家更换马匹
|
| | | # @param index 玩家索引
|
| | | # @param packData 封包数据
|
| | | # @param tick 时间戳
|
| | | # @return 无意义
|
| | | def OnPlayerChangeHorse(index, packData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | |
| | | if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Horse):
|
| | | return
|
| | |
|
| | | #检查换装间隔
|
| | | if tick - curPlayer.GetLastChangeEquipTick() <= ChConfig.Def_MinChangeEquipTime:
|
| | | return
|
| | | |
| | | curPlayer.SetLastChangeEquipTick(tick)
|
| | |
|
| | | # 判断玩家是否可以升级马匹
|
| | | if not CheckCanTrainHorse(curPlayer):
|
| | | chooseType = packData.ChooseType
|
| | | lvID = packData.LVID
|
| | | |
| | | if not DoChangeHorse(curPlayer, chooseType, lvID, tick):
|
| | | return
|
| | |
|
| | | horseIndex = packData.Index
|
| | | |
| | | DoChangeHorse(curPlayer, horseIndex, tick)
|
| | | |
| | | if not GameWorld.IsCrossServer():
|
| | | dataList = [horseIndex]
|
| | | dataList = [chooseType, lvID]
|
| | | 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)
|
| | | |
| | | #---执行玩家换装逻辑---
|
| | | chooseType, lvID = dataList
|
| | | tick = GameWorld.GetGameWorld().GetTick()
|
| | | if ChEquip.DoPlayerEquipItem(curPlayer, curHorse, ItemCommon.GetEquipPackIndex(curHorse), tick):
|
| | | if isRideHorse:
|
| | | PlayerRideHorseUp(curPlayer, False)
|
| | | |
| | | DoChangeHorse(curPlayer, chooseType, lvID, tick)
|
| | | return
|
| | |
|
| | | def DoChangeHorse(curPlayer, horseIndex, tick):
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("Horse", horseIndex)
|
| | | if not ipyData:
|
| | | def DoChangeHorse(curPlayer, chooseType, lvID, tick):
|
| | | ''' 坐骑选择
|
| | | @param chooseType: 1-按阶,2-按幻化
|
| | | @param lvID: 阶等级或幻化ID
|
| | | '''
|
| | | |
| | | # 按阶
|
| | | if chooseType == 1:
|
| | | horseLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserLV)
|
| | | if horseLV < lvID:
|
| | | GameWorld.DebugLog("坐骑等级不足,无法使用该坐骑皮肤! horseLV=%s,lvID=%s" % (horseLV, lvID))
|
| | | return
|
| | |
|
| | | horseItemID = ipyData.GetItemID()
|
| | | horseIpyData = IpyGameDataPY.GetIpyGameData("HorseLVUp", lvID)
|
| | | if not horseIpyData:
|
| | | return
|
| | | horseItemID = horseIpyData.GetHorseSkinID()
|
| | | |
| | | # 按幻化
|
| | | elif chooseType == 2:
|
| | | activateState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserSkinPlusState)
|
| | | if not activateState & pow(2, lvID):
|
| | | GameWorld.DebugLog("坐骑幻化未激活,无法使用该坐骑皮肤! activateState=%s,lvID=%s" % (activateState, lvID))
|
| | | return
|
| | | |
| | | skinPlusIpyData = IpyGameDataPY.GetIpyGameData("HorseSkinPlus", lvID)
|
| | | if not skinPlusIpyData:
|
| | | return
|
| | | horseItemID = skinPlusIpyData.GetHorseSkinPlusID()
|
| | | |
| | | else:
|
| | | return
|
| | |
|
| | | if not horseItemID:
|
| | | GameWorld.DebugLog("找不到选择的坐骑ID horseIndex=%s" % (horseIndex))
|
| | | return
|
| | | horseLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_LV % horseIndex, 0, ChConfig.Def_PDictType_Horse)
|
| | | if horseLV < ipyData.GetUseNeedRank():
|
| | | GameWorld.DebugLog("%s阶坐骑才能切换外观 curLv=%s, horseIndex=%s" % (ipyData.GetUseNeedRank(), horseLV, horseIndex))
|
| | | GameWorld.DebugLog("找不到选择的坐骑ID! chooseType=%s,lvID=%s" % (chooseType, lvID))
|
| | | return
|
| | |
|
| | | if ItemCommon.FindItemInPackByItemID(curPlayer, horseItemID, IPY_GameWorld.rptEquip):
|
| | | GameWorld.DebugLog("OnPlayerChangeHorse() had equipped horse(%s)" % horseItemID)
|
| | | GameWorld.DebugLog("已经选择了该坐骑,无需重新选择! horseItemID=%s" % horseItemID)
|
| | | return
|
| | |
|
| | | isOK = ItemControler.PutItemInTempSwap(curPlayer, horseItemID)
|
| | | if not isOK:
|
| | | GameWorld.DebugLog("OnPlayerChangeHorse() horse(%s) put in pack(%s) fail" \
|
| | | % (horseItemID, ShareDefine.rptTempSwap))
|
| | | return
|
| | |
|
| | | curHorse = ItemCommon.FindItemInPackByItemID(curPlayer, horseItemID, ShareDefine.rptTempSwap)
|
| | | if not curHorse:
|
| | | GameWorld.DebugLog("OnPlayerChangeHorse() pack(%s) no horse(%s) item" \
|
| | | % (ShareDefine.rptTempSwap, horseItemID))
|
| | | return
|
| | | curHorse.SetUserAttr(ShareDefine.Def_IudetHorsePetSkinIndex, GetHorsePetSkinIndex(curPlayer, 1, horseIndex))
|
| | | #检查玩家状态是否可以换装
|
| | | if not ChEquip.CheckPlayerCanEquipItem(curPlayer):
|
| | | return
|
| | | |
| | | isRideHorse = curPlayer.GetPlayerVehicle() == IPY_GameWorld.pvHorse
|
| | |
|
| | | # 如果骑乘状态,先下马,换装,再上马
|
| | |
| | | if ChEquip.DoPlayerEquipItem(curPlayer, curHorse, ItemCommon.GetEquipPackIndex(curHorse), tick):
|
| | | if isRideHorse:
|
| | | PlayerRideHorseUp(curPlayer, False)
|
| | | return
|
| | |
|
| | | return
|
| | |
|
| | | ## 马匹功能开启
|
| | | def DoHorseOpen(curPlayer): |
| | | # maxStarLV, maxClassLV, horsesList, npcList = ReadChConfig.GetEvalChConfig("HorseTrainUpgrade")
|
| | | # horseID = horsesList[0]
|
| | | # |
| | | # if ItemCommon.FindItemInPackByItemID(curPlayer, horseID, IPY_GameWorld.rptEquip):
|
| | | # return
|
| | | # |
| | | # isOK = ItemControler.PutItemInTempSwap(curPlayer, horseID)
|
| | | # if not isOK:
|
| | | # return
|
| | | # |
| | | # curHorse = ItemCommon.FindItemInPackByItemID(curPlayer, horseID, ShareDefine.rptTempSwap)
|
| | | # if not curHorse:
|
| | | # return
|
| | | # |
| | | # #---执行玩家换装逻辑---
|
| | | # tick = GameWorld.GetGameWorld().GetTick()
|
| | | # ChEquip.DoPlayerEquipItem(curPlayer, curHorse, Def_HorseEquipIndex, tick)
|
| | | # |
| | | # __HorseLearnSkill(curPlayer, 0)
|
| | | # # 计算属性 防止给第一只坐骑后,客户端坐骑战斗力为0
|
| | | # RefreshHorseAttr(curPlayer, False)
|
| | | # |
| | | # EventReport.WriteEvent_custom_mission_log(curPlayer, ChConfig.CME_Class_Horse, ChConfig.CME_Log_End, 1, cmeInfoEx="0")
|
| | | return True
|
| | |
|
| | | def RefreshHorseAttr(curPlayer, isCheckOpen=True, isUpdateBill=True):
|
| | | def DoHorseOpen(curPlayer):
|
| | | ## 马匹功能开启
|
| | | horseLV = 1
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("HorseLVUp", horseLV)
|
| | | if not ipyData:
|
| | | return
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HorserLV, horseLV)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HorserEatItemCount, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HorserSkinPlusState, 0)
|
| | | |
| | | horseID = ipyData.GetHorseSkinID()
|
| | | if not ItemCommon.FindItemInPackByItemID(curPlayer, horseID, IPY_GameWorld.rptEquip):
|
| | | isOK = ItemControler.PutItemInTempSwap(curPlayer, horseID)
|
| | | if not isOK:
|
| | | return
|
| | | |
| | | curHorse = ItemCommon.FindItemInPackByItemID(curPlayer, horseID, ShareDefine.rptTempSwap)
|
| | | if not curHorse:
|
| | | return
|
| | | #---执行玩家换装逻辑---
|
| | | tick = GameWorld.GetGameWorld().GetTick()
|
| | | ChEquip.DoPlayerEquipItem(curPlayer, curHorse, Def_HorseEquipIndex, tick)
|
| | | |
| | | GameWorld.DebugLog("坐骑功能开启! horseLV=%s,horseID=%s" % (horseLV, horseID))
|
| | | Sync_HorseClassData(curPlayer)
|
| | | RefreshHorseAttr(curPlayer)
|
| | | return True
|
| | |
|
| | | def RefreshHorseAttr(curPlayer, isUpdateBill=True):
|
| | | # 坐骑功能属性变更刷新
|
| | | CalcHorseAttrEx(curPlayer, isCheckOpen)
|
| | | CalcHorseAttrEx(curPlayer)
|
| | | # 需要更新坐骑榜、强制刷新属性
|
| | | PlayerControl.PlayerControl(curPlayer).RefreshPlayerAttrState(billboardFunc=PlayerBillboard.UpdateHorseBillboard if isUpdateBill else None)
|
| | | return
|
| | |
|
| | | ################################################################################
|
| | |
|
| | |
|
| | | ## 成就
|
| | | # @param curPlayer 玩家实例
|
| | | # @param srcBackpack 背包类型
|
| | | # @param packIndex 背包索引
|
| | | # @param skillPackIndex 技能书背包索引
|
| | | # @return 物品实例
|
| | | def __SetSuccess(curPlayer):
|
| | | #allLV = GetHorseSkillAllLV(curPlayer)
|
| | | |
| | | # 成就
|
| | | #PlayerSuccess.UptateSuccessProgress(curPlayer, ShareDefine.SuccType_HorseSkillBookLV, allLV)
|
| | | def CalcHorseAttrEx(curPlayer):
|
| | | ## 计算马匹属性
|
| | | if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Horse):
|
| | | return
|
| | |
|
| | | ## 获取坐骑技能等级列表
|
| | | # @param curPlayer 玩家实例
|
| | | # @return
|
| | | def GetHorseSkillInfo(curPlayer):
|
| | | horseSkillIDList = GetHorseSkillList()
|
| | | |
| | | skillManager = curPlayer.GetSkillManager()
|
| | | skilllvList = []
|
| | | for skillresid in horseSkillIDList:
|
| | | Skill = skillManager.FindSkillBySkillTypeID(skillresid)
|
| | | #δѧϰ
|
| | | if Skill == None :
|
| | | skilllv = 0
|
| | | else:
|
| | | skilllv = Skill.GetSkillLV()
|
| | | skilllvList.append(skilllv)
|
| | | |
| | | return skilllvList
|
| | |
|
| | | ## 获取坐骑技能ID
|
| | | def GetHorseSkillList():
|
| | | horseSkillIDList = []
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for i in xrange(ipyDataMgr.GetHorseUpCount()):
|
| | | ipyData = ipyDataMgr.GetHorseUpByIndex(i)
|
| | | skillIDList = ipyData.GetSkillID()
|
| | | if not skillIDList:
|
| | | continue
|
| | | for skillID in skillIDList:
|
| | | horseSkillIDList.append(skillID)
|
| | | return horseSkillIDList
|
| | |
|
| | | ## 检查是否可以学习坐骑技能
|
| | | def CheckLearnHorseSkill(curPlayer, curSkillTypeID):
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for i in xrange(ipyDataMgr.GetHorseUpCount()):
|
| | | ipyData = ipyDataMgr.GetHorseUpByIndex(i)
|
| | | skillIDList = ipyData.GetSkillID()
|
| | | if curSkillTypeID not in skillIDList:
|
| | | continue
|
| | | horseID = ipyData.GetHorseID()
|
| | | horseLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_LV % horseID, 0, ChConfig.Def_PDictType_Horse)
|
| | | if horseLV < ipyData.GetLV():
|
| | | GameWorld.DebugLog(' 该坐骑%s级才解锁此技能 curSkillTypeID=%s'%(ipyData.GetLV(), curSkillTypeID))
|
| | | return False
|
| | | return True
|
| | | #不是坐骑技能
|
| | | return True
|
| | | |
| | |
|
| | | ## 计算马匹属性
|
| | | # @param curPlayer 玩家
|
| | | # @param allAttrList 属性列表
|
| | | # @return None
|
| | | def CalcHorseAttrEx(curPlayer, isCheckOpen=True):
|
| | | allAttrList = [{} for _ in range(4)]
|
| | | allAttrListHorseSoul = [{} for _ in range(4)]
|
| | | skillAttrList = [{} for _ in range(4)]
|
| | | allAttrListSkin = [{} for _ in range(4)]
|
| | | # 判断玩家是否可以升级马匹
|
| | | if isCheckOpen and not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Horse):
|
| | | #对应的任务限制未完成
|
| | | return
|
| | | maxSpeed = 0 #坐骑最大移动速度
|
| | |
|
| | | # 坐骑技能添加属性百分比增加在buff中已转为固定属性,只对进阶属性有效不含 移动速度
|
| | | skillFPEx = __CalcHorseSkillAttr(curPlayer, skillAttrList)
|
| | | initFPAdd = 0 #初始战力
|
| | | horseSpeed = 0 # 坐骑功能增加的速度值,骑乘时才有效果
|
| | | horseLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserLV)
|
| | | # 等阶培养属性
|
| | | totalItemCount = 0
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for i in xrange(ipyDataMgr.GetHorseCount()):
|
| | | ipyData = ipyDataMgr.GetHorseByIndex(i)
|
| | | horseID = ipyData.GetHorseID()
|
| | | horseLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_LV % horseID, 0, ChConfig.Def_PDictType_Horse)
|
| | | if not horseLV:
|
| | | continue
|
| | | initFPAdd += ipyData.GetInitFightPower()
|
| | | horseUpData = IpyGameDataPY.GetIpyGameData("HorseUp", horseID, horseLV)
|
| | | if not horseUpData:
|
| | | continue
|
| | | attrTypeList = horseUpData.GetAttrType()
|
| | | attrValueList = horseUpData.GetAttrValue()
|
| | | for i, attrID in enumerate(attrTypeList):
|
| | | for index in xrange(ipyDataMgr.GetHorseLVUpCount()):
|
| | | horseIpyData = ipyDataMgr.GetHorseLVUpByIndex(index)
|
| | | if horseIpyData.GetHorseLV() >= horseLV:
|
| | | totalItemCount += curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserEatItemCount)
|
| | | break
|
| | | |
| | | # 等阶额外属性
|
| | | totalItemCount += horseIpyData.GetNeedEatCount()
|
| | | lvAttrTypeList = horseIpyData.GetLVAttrType()
|
| | | lvAttrValueList = horseIpyData.GetLVAttrValue()
|
| | | for i, attrID in enumerate(lvAttrTypeList):
|
| | | attrValue = lvAttrValueList[i]
|
| | | if attrID == ShareDefine.Def_Effect_Speed:
|
| | | maxSpeed = max(maxSpeed, attrValueList[i])
|
| | | horseSpeed += attrValue
|
| | | continue
|
| | | PlayerControl.CalcAttrDict_Type(attrID, attrValueList[i], allAttrList)
|
| | | skinData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorsePetSkinData % (1, horseID), 0)
|
| | | skinIpyData = IpyGameDataPY.GetIpyGameDataNotLog('HorsePetSkin', 1, horseID, skinData/100)
|
| | | if skinIpyData:
|
| | | for attrID, attrValue in skinIpyData.GetAttrInfo().items():
|
| | | PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrList)
|
| | | |
| | | # 等阶培养丹累加个数属性
|
| | | eatItemAttrInfo = IpyGameDataPY.GetFuncCfg("HorseUpItem", 3)
|
| | | for attrID, attrValue in eatItemAttrInfo:
|
| | | PlayerControl.CalcAttrDict_Type(attrID, attrValue * totalItemCount, allAttrList)
|
| | | |
| | | # 幻化属性
|
| | | initFPAdd = 0 #初始战力
|
| | | activateState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserSkinPlusState)
|
| | | for index in xrange(ipyDataMgr.GetHorseSkinPlusCount()):
|
| | | skinPlusIpyData = ipyDataMgr.GetHorseSkinPlusByIndex(index)
|
| | | skinPlusID = skinPlusIpyData.GetID()
|
| | | if not activateState & pow(2, skinPlusID):
|
| | | continue
|
| | | initFPAdd += skinPlusIpyData.GetInitFightPower()
|
| | | attrTypeList = skinPlusIpyData.GetAttrType()
|
| | | attrValueList = skinPlusIpyData.GetAttrValue()
|
| | | for i, attrID in enumerate(attrTypeList):
|
| | | attrValue = attrValueList[i]
|
| | | if attrID == ShareDefine.Def_Effect_Speed:
|
| | | horseSpeed += attrValue
|
| | | continue
|
| | | PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrListSkin)
|
| | |
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPEx % ShareDefine.Def_MFPType_Horse, skillFPEx+initFPAdd)
|
| | | PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_HorseSkill, skillAttrList)
|
| | | 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))
|
| | |
|
| | | # 先缓存值,骑乘状态时进行附加
|
| | | GameWorld.DebugLog('坐骑取最大移动速度,maxSpeed=%s' % maxSpeed)
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_SpeedHorse, maxSpeed)
|
| | | curPlayer.SetDict(ChConfig.Def_PlayerKey_SpeedHorse, horseSpeed)
|
| | |
|
| | | # 果实对坐骑的加成, 魂石果实算附加属性层,单独计算
|
| | | 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)
|
| | | |
| | | # 保存计算值
|
| | | PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Horse, allAttrList)
|
| | | PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_HorseSoul, allAttrListHorseSoul)
|
| | | PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_HorseSkin, allAttrListSkin)
|
| | | |
| | | return
|
| | |
|
| | | def __CalcHorseSkillAttr(curPlayer, allAttrList):
|
| | | # 计算技能属性
|
| | | skillFPEx = 0
|
| | | skillManager = curPlayer.GetSkillManager()
|
| | | #GameWorld.DebugLog("1刷坐骑技能属性: %s" % allAttrList)
|
| | | for i in range(0 , skillManager.GetSkillCount()):
|
| | | curSkill = skillManager.GetSkillByIndex(i)
|
| | | if not curSkill:
|
| | | continue
|
| | | |
| | | if curSkill.GetFuncType() != ChConfig.Def_SkillFuncType_HorseSkill:
|
| | | continue
|
| | | |
| | | if not SkillCommon.isPassiveAttr(curSkill):
|
| | | continue
|
| | | |
| | | |
| | | for effectIndex in xrange(curSkill.GetEffectCount()):
|
| | | curEffect = curSkill.GetEffect(effectIndex)
|
| | | SkillShell.CalcBuffEffAttr(curPlayer, curEffect, allAttrList)
|
| | | |
| | | |
| | | #GameWorld.DebugLog("2刷坐骑技能属性: skillFPEx=%s, %s" % ( skillFPEx, allAttrList))
|
| | | return skillFPEx
|
| | |
|
| | | ## // A5 27 坐骑提升 #tagCMHorseUp
|
| | | ## 坐骑升阶
|
| | | # @param curPlayer
|
| | | # @return None
|
| | | #// A5 27 坐骑提升 #tagCMHorseUp
|
| | | #
|
| | | #struct tagCMHorseUp
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE UseItemCnt; //消耗材料个数
|
| | | # BYTE IsAutoBuy; //是否自动购买
|
| | | #};
|
| | | def OnHorseClassLVUP(index, curPackData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | costItemCount = curPackData.UseItemCnt # 消耗材料个数
|
| | | isAutoBuy = curPackData.IsAutoBuy # 是否自动购买
|
| | | horseID = curPackData.HorseID
|
| | | |
| | | # 判断玩家是否可以升级马匹
|
| | | if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Horse):
|
| | | #对应的任务限制未完成
|
| | | GameWorld.DebugLog("HorseClassLVUP 坐骑未开启。。。")
|
| | | return
|
| | | horseLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_LV % horseID, 0, ChConfig.Def_PDictType_Horse)
|
| | | if horseLV <= 0:
|
| | | GameWorld.DebugLog("坐骑提升 该坐骑未激活 horseID=%s" % horseID)
|
| | | GameWorld.DebugLog("坐骑未开启!")
|
| | | return
|
| | |
|
| | | horseIpyData = IpyGameDataPY.GetIpyGameData("Horse", horseID)
|
| | | horseLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserLV)
|
| | | curEatItemCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserEatItemCount)
|
| | | if horseLV <= 0:
|
| | | GameWorld.DebugLog("坐骑提升 该坐骑未激活 horseLV=%s" % horseLV)
|
| | | return
|
| | | |
| | | horseIpyData = IpyGameDataPY.GetIpyGameData("HorseLVUp", horseLV)
|
| | | if not horseIpyData:
|
| | | return
|
| | |
|
| | | maxLV = horseIpyData.GetMaxLV()
|
| | | if horseLV >= maxLV:
|
| | | GameWorld.DebugLog("HorseClassLVUP 该坐骑已满级 horseID=%s" % horseID)
|
| | | needEatCount = horseIpyData.GetNeedEatCount()
|
| | | if not needEatCount:
|
| | | GameWorld.DebugLog("坐骑已满级!horseLV=%s" % horseLV)
|
| | | return
|
| | |
|
| | | horseUpIpyData = IpyGameDataPY.GetIpyGameData("HorseUp", horseID, horseLV)
|
| | | if not horseUpIpyData:
|
| | | return
|
| | | needExp = horseUpIpyData.GetNeedExp()
|
| | | if not needExp:
|
| | | return
|
| | | curExp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_Exp % horseID,
|
| | | 0,
|
| | | ChConfig.Def_PDictType_Horse)
|
| | | |
| | | curItemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | |
| | | itemIndexList = []
|
| | | costItemIDList = IpyGameDataPY.GetFuncEvalCfg('HorseUpItem')
|
| | | |
| | | #扣材料
|
| | | nowCnt = 0
|
| | | for itemID in costItemIDList:
|
| | | hasEnough, indexList, findItemIsBind, lackCnt = ItemCommon.GetItem_FromPack_ByID_ExEx(itemID, curItemPack, costItemCount - nowCnt)
|
| | | |
| | | itemIndexList.extend(indexList)
|
| | | if hasEnough:
|
| | | #足够退出
|
| | | break
|
| | | |
| | | if itemIndexList:
|
| | | nowCnt = 0
|
| | | for itemIndex in itemIndexList:
|
| | | curItem = curItemPack.GetAt(itemIndex)
|
| | | |
| | | #检查物品
|
| | | if not ItemCommon.CheckItemCanUse(curItem):
|
| | | continue
|
| | | |
| | | itemCnt = curItem.GetCount()
|
| | | nowCnt += itemCnt
|
| | | |
| | | if not hasEnough and not isAutoBuy:
|
| | | GameWorld.DebugLog("HorseClassLVUP 升阶道具不足。。。")
|
| | | costItemID = IpyGameDataPY.GetFuncCfg("HorseUpItem", 1)
|
| | | if not costItemID or not costItemCount:
|
| | | return
|
| | |
|
| | | autoBuyItemID = costItemIDList[0]
|
| | | if itemIndexList:
|
| | | curItem = curItemPack.GetAt(itemIndexList[0])
|
| | | else:
|
| | | curItem = GameWorld.GetGameData().GetItemByTypeID(autoBuyItemID)
|
| | | if not curItem:
|
| | | costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, costItemID, costItemCount)
|
| | | lackCnt = costItemCount - bindCnt - unBindCnt
|
| | | if lackCnt >= 0 and not isAutoBuy:
|
| | | GameWorld.DebugLog("消耗道具不足,无法升级坐骑!costItemID=%s,costItemCount=%s,bindCnt=%s,unBindCnt=%s,lackCnt=%s" |
| | | % (costItemID, costItemCount, bindCnt, unBindCnt, lackCnt))
|
| | | return
|
| | |
|
| | | if lackCnt > 0:
|
| | | if not isAutoBuy:
|
| | | lackCost = ItemCommon.GetAutoBuyItemNeedGold({costItemID:lackCnt})
|
| | | if lackCost <= 0:
|
| | | return
|
| | | itemGold = ItemCommon.GetShopItemPrice(curItem.GetItemTypeID(), IPY_GameWorld.TYPE_Price_Gold_Money)
|
| | | #lackCost = ItemCommon.GetAutoBuyItemNeedGold({autoBuyItemID:lackCnt})
|
| | | if itemGold <= 0:
|
| | | infoDict = {ChConfig.Def_Cost_Reason_SonKey:costItemID}
|
| | | if not PlayerControl.PayMoney(curPlayer, IPY_GameWorld.TYPE_Price_Gold_Money, lackCost, ChConfig.Def_Cost_BuyStoreItem, infoDict):
|
| | | return
|
| | | costMoneyList = PlayerControl.HaveMoneyEx(curPlayer, ShareDefine.TYPE_Price_Gold_Paper_Money, itemGold*lackCnt)
|
| | | if not costMoneyList:
|
| | | return
|
| | | infoDict = {ChConfig.Def_Cost_Reason_SonKey:autoBuyItemID}
|
| | | for moneyType, moneyCnt in costMoneyList:
|
| | | if not PlayerControl.PayMoney(curPlayer, moneyType, moneyCnt,
|
| | | ChConfig.Def_Cost_BuyStoreItem, infoDict, lackCnt):
|
| | | return
|
| | | lastMultiple = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_Multiple, 1, ChConfig.Def_PDictType_Horse)
|
| | | multiple = 1 if costItemCount == 1 else lastMultiple #本次倍数 (只用1个材料不能多倍)
|
| | |
|
| | | if multiple > 1:
|
| | | EventShell.EventRespons_HorseMultiple(curPlayer, multiple)
|
| | | playerName = curPlayer.GetName()
|
| | | # needSysHorseLVDict = IpyGameDataPY.GetFuncEvalCfg('NeedSysHorseLV')
|
| | | # needSysHorseLVList = needSysHorseLVDict.get(horseID, [])
|
| | | curEff = curItem.GetEffectByIndex(0)
|
| | | addExp = curEff.GetEffectValue(0) * costItemCount * multiple
|
| | | updExp = curExp + addExp
|
| | | # 扣除消耗
|
| | | delCnt = max(0, costItemCount - lackCnt) # 实际扣除的个数
|
| | | if delCnt:
|
| | | ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, delCnt, ChConfig.ItemDel_Horse)
|
| | | |
| | | updClassLV = horseLV
|
| | | for lv in range(horseLV, maxLV):
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("HorseUp", horseID, lv)
|
| | | if not ipyData:
|
| | | break
|
| | | upNeedExp = ipyData.GetNeedExp()
|
| | | if updExp < upNeedExp:
|
| | | break
|
| | | updEatItemCount = curEatItemCount + costItemCount
|
| | | GameWorld.DebugLog("坐骑培养: horseLV=%s,curEatItemCount=%s,costItemCount=%s,updEatItemCount=%s,needEatCount=%s" |
| | | % (horseLV, curEatItemCount, costItemCount, updEatItemCount, needEatCount))
|
| | | |
| | | if updEatItemCount >= needEatCount:
|
| | | updClassLV +=1
|
| | | upIpyData = IpyGameDataPY.GetIpyGameData("HorseUp", horseID, updClassLV)
|
| | | if not upIpyData:
|
| | | break
|
| | | updExp -= upNeedExp
|
| | | updEatItemCount -= needEatCount
|
| | | GameWorld.DebugLog(" 升阶: updClassLV=%s,updEatItemCount=%s" % (updClassLV, updEatItemCount))
|
| | |
|
| | | #解锁技能
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HorserLV, updClassLV)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HorserEatItemCount, updEatItemCount)
|
| | |
|
| | | skillIDList = upIpyData.GetSkillID()
|
| | | if skillIDList:
|
| | | sysMark = upIpyData.GetSysMark() or 'MountUpLv'
|
| | | for skillID in skillIDList:
|
| | | __GiveSkill(curPlayer, skillID, tick)
|
| | | PlayerControl.WorldNotify(0, sysMark, [playerName, horseID, updClassLV, skillID])
|
| | | if not skillIDList and updClassLV == maxLV:
|
| | | PlayerControl.WorldNotify(0, 'MountUpLvMax', [playerName, horseID])
|
| | | |
| | | #X坐骑X等级成就
|
| | | PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_HorseAllLV, 1, [horseID, updClassLV])
|
| | | |
| | | # 升阶
|
| | | if updClassLV > horseLV:
|
| | | EventShell.EventRespons_HorseLV(curPlayer, updClassLV)
|
| | | EventShell.EventRespons_HorseUp(curPlayer)
|
| | | # 玩家马匹进阶
|
| | | DataRecordPack.DR_NewHorseByClassUp(curPlayer, updClassLV, 0)
|
| | | # 记录开服活动马匹阶级
|
| | | OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_HorseLV, updClassLV)
|
| | |
|
| | | addLV = updClassLV - horseLV
|
| | | if addLV:
|
| | | __HorseClassLVUP(curPlayer, horseID, updClassLV)
|
| | | if updClassLV >= maxLV:
|
| | | updExp = 0
|
| | | |
| | |
|
| | | #扣除物品
|
| | | delCnt = max(0, costItemCount - lackCnt) # 实际扣除的个数
|
| | | if itemIndexList:
|
| | | ItemCommon.ReduceItem(curPlayer, curItemPack, itemIndexList, delCnt, True, ChConfig.ItemDel_Horse)
|
| | | # 更新经验值
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Horser_Exp % horseID, updExp, ChConfig.Def_PDictType_Horse)
|
| | | # 下次暴击倍数
|
| | | horseSuperRateDict = IpyGameDataPY.GetFuncEvalCfg('HorseSuperRate')
|
| | | keyNO = 0 #默认0
|
| | | rateDict = horseSuperRateDict.get(keyNO, {})
|
| | | rateList = rateDict.get(multiple, [])
|
| | | nextMultiple = GameWorld.GetResultByRandomList(rateList, 1)
|
| | | if costItemCount != 1 or nextMultiple > lastMultiple:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Horser_Multiple, nextMultiple, ChConfig.Def_PDictType_Horse)
|
| | | |
| | | Sync_HorseClassData(curPlayer, horseID)
|
| | | # 活跃度
|
| | | #PlayerActivity.AddActivityFinishCnt(curPlayer, ShareDefine.ActivityNum_HorseUP)
|
| | | #EventReport.WriteEvent_horse_class(curPlayer, horseLV, curExp, delCnt, updClassLV, updExp)
|
| | | return
|
| | |
|
| | | ## 坐骑阶级提升
|
| | | # @param curPlayer
|
| | | # @param horseID: 坐骑id
|
| | | # @param updateClassLV: 更新的阶级
|
| | | # @return None
|
| | | def __HorseClassLVUP(curPlayer, horseID, updateClassLV):
|
| | | 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)
|
| | |
|
| | | Sync_HorseClassData(curPlayer)
|
| | | # 刷属性,更新排行榜
|
| | | RefreshHorseAttr(curPlayer)
|
| | | # 玩家马匹进阶
|
| | | DataRecordPack.DR_NewHorseByClassUp(curPlayer, updateClassLV, horseID) |
| | | |
| | | # 记录开服活动马匹阶级
|
| | | OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_HorseLV, sumLV)
|
| | | return
|
| | |
|
| | |
|
| | | ## 给技能
|
| | | # @param curPlayer
|
| | | # @param skillResID 技能源ID
|
| | | # @param tick 时间戳
|
| | | # @return None
|
| | | def __GiveSkill(curPlayer, skillResID, tick):
|
| | | |
| | | skillData = GameWorld.GetGameData().FindSkillByType(skillResID, 1)
|
| | | if skillData == None:
|
| | | GameWorld.DebugLog("__GiveSkill() hasn't find skill(%s)" % skillResID)
|
| | | return
|
| | | if not SkillCommon.CheckSkillJob(curPlayer, skillData):
|
| | | return
|
| | | if not SkillShell.CheckLearnSkillCondition(curPlayer, skillData):
|
| | | GameWorld.DebugLog("__GiveSkill() learn skill(%s) condition isn't enough" % skillResID)
|
| | | return
|
| | | skillManager = curPlayer.GetSkillManager()
|
| | | if skillManager.FindSkillBySkillTypeID(skillResID):
|
| | | GameWorld.DebugLog("__GiveSkill() have learned skill(%s)" % skillResID)
|
| | | return
|
| | | GameWorld.DebugLog(' 激活坐骑技能 skillResID=%s' % (skillResID))
|
| | | skillManager.LVUpSkillBySkillTypeID(skillResID)
|
| | | #PlayerControl.NotifyCode(curPlayer, "GetSkillInfo", [skillResID])
|
| | | if not SkillCommon.isPassiveAttr(skillData):
|
| | | PassiveBuffEffMng.GetPassiveEffManager().RegistPassiveEff(curPlayer, skillData.GetSkillID())
|
| | | |
| | | DataRecordPack.DR_LearnORUPSkill(curPlayer, skillResID, 0)
|
| | | PlayerControl.PlayerControl(curPlayer).RefreshSkillFightPowerEx(skillResID, 0)
|
| | | return
|
| | |
|
| | |
|
| | | ##OnDay时处理
|
| | | # @param curPlayer 玩家
|
| | | # @return None
|
| | | def HorseOnDay(curPlayer):
|
| | | return
|
| | |
|
| | |
|
| | | ##坐骑登录处理
|
| | | # @param curPlayer 玩家
|
| | | # @return None
|
| | | def PlayerHorseLogin(curPlayer):
|
| | | ##坐骑登录处理
|
| | | if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Horse):
|
| | | return
|
| | | |
| | | Sync_HorseClassData(curPlayer)
|
| | | SyncHorsePetSkinData(curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | ## 通知客户端,培养情况
|
| | | # @param curPlayer
|
| | | # @return 无意义
|
| | | def Sync_HorseClassData(curPlayer, horseID= -1):
|
| | | def Sync_HorseClassData(curPlayer):
|
| | | horseData = ChPyNetSendPack.tagTrainHorseData()
|
| | | horseData.Clear()
|
| | | |
| | | horseData.InfoList = []
|
| | |
|
| | | if horseID == -1:
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for i in xrange(ipyDataMgr.GetHorseCount()):
|
| | | ipyData = ipyDataMgr.GetHorseByIndex(i)
|
| | | index = ipyData.GetHorseID()
|
| | | lv = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_LV % index,
|
| | | 0, ChConfig.Def_PDictType_Horse)
|
| | | if not lv:
|
| | | continue
|
| | | skinInfo = ChPyNetSendPack.tagMCHorseInfo()
|
| | | skinInfo.Clear()
|
| | | skinInfo.HorseID = index
|
| | | skinInfo.LV = lv
|
| | | skinInfo.Exp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_Exp % index,
|
| | | 0, ChConfig.Def_PDictType_Horse)
|
| | | horseData.InfoList.append(skinInfo)
|
| | | else:
|
| | | skinInfo = ChPyNetSendPack.tagMCHorseInfo()
|
| | | skinInfo.Clear()
|
| | | skinInfo.HorseID = horseID
|
| | | skinInfo.LV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_LV % horseID,
|
| | | 0, ChConfig.Def_PDictType_Horse)
|
| | | skinInfo.Exp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_Exp % horseID,
|
| | | 0, ChConfig.Def_PDictType_Horse)
|
| | | horseData.InfoList.append(skinInfo)
|
| | | |
| | | horseData.Num = len(horseData.InfoList)
|
| | | horseData.Multiple = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_Multiple, 1, ChConfig.Def_PDictType_Horse)
|
| | | horseData.LV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserLV)
|
| | | horseData.EatItemCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserEatItemCount)
|
| | | horseData.SkinPlusState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserSkinPlusState)
|
| | | NetPackCommon.SendFakePack(curPlayer, horseData)
|
| | | return
|
| | |
|
| | | #------------------------------------------------------------------------
|
| | |
|
| | | #//A5 01 坐骑激活 #tagPlayerActivateHorse
|
| | | #
|
| | | #struct tagPlayerActivateHorse
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE HorseID; //坐骑ID
|
| | | #};
|
| | |
|
| | | ## 激活坐骑
|
| | | # @param curPlayer
|
| | | # @return None
|
| | | def ActivateHorseSkinItem(index, curPackData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | if not GameFuncComm.GetFuncCanUse(curPlayer, ShareDefine.GameFuncID_Horse):
|
| | | GameWorld.Log("坐骑功能未开启,无法激活坐骑!", playerID)
|
| | | return False
|
| | | horseID = curPackData.HorseID
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('Horse', horseID)
|
| | | |
| | | if not ipyData:
|
| | | GameWorld.ErrLog("坐骑幻化物品异常,无该幻化物品信息!检查tagHorse.txt! horseID=%s" % horseID, playerID)
|
| | | return False
|
| | | |
| | | horseLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_LV % horseID,
|
| | | 0, ChConfig.Def_PDictType_Horse)
|
| | | if horseLV > 0:
|
| | | GameWorld.DebugLog('该坐骑已激活 horseID=%s' % horseID)
|
| | | return
|
| | |
|
| | | needItemID = ipyData.GetUnlockItemID()
|
| | | needItemCnt = ipyData.GetUnlockItemCnt()
|
| | | itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
|
| | | hasEnough, itemList = ItemCommon.GetItem_FromPack_ByID(needItemID, itemPack, needItemCnt)
|
| | | if not hasEnough:
|
| | | GameWorld.DebugLog("ActivateHorseSkinItem() item(%s[%s]) isn't enough" % (needItemID, needItemCnt))
|
| | | return
|
| | | 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)
|
| | | PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Horse, horseID, False)
|
| | | |
| | | playerEquip = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
|
| | | itemRideHorse = playerEquip.GetAt(Def_HorseEquipIndex)
|
| | | #无指定道具
|
| | | if itemRideHorse.IsEmpty():
|
| | | DoChangeHorse(curPlayer, horseID, tick)
|
| | | # curHorseSkin = None
|
| | | # horseItemID = ipyData.GetItemID()
|
| | | # isOK = ItemControler.PutItemInTempSwap(curPlayer, horseItemID)
|
| | | # if isOK:
|
| | | # curHorseSkin = ItemCommon.FindItemInPackByItemID(curPlayer, horseItemID, ShareDefine.rptTempSwap)
|
| | | # if curHorseSkin and not curHorseSkin.IsEmpty():
|
| | | # tick = GameWorld.GetGameWorld().GetTick()
|
| | | # PlayerRideHorseDown(curPlayer, False)
|
| | | # # 执行玩家换装逻辑
|
| | | # if ChEquip.DoPlayerEquipItem(curPlayer, curHorseSkin, Def_HorseEquipIndex, tick):
|
| | | # PlayerRideHorseUp(curPlayer, False)
|
| | | |
| | | |
| | | #GameWorld.DebugLog("给幻化坐骑物品giveOK=%s" % giveOK)
|
| | | |
| | | Sync_HorseClassData(curPlayer, horseID)
|
| | | GameWorld.Log("坐骑激活成功!horseID=%s" % (horseID), playerID)
|
| | |
|
| | | # 刷属性,更新排行榜
|
| | | RefreshHorseAttr(curPlayer)
|
| | | sysMark = ipyData.GetUnlockSys() or 'GetMount'
|
| | | PlayerControl.WorldNotify(0, sysMark, [curPlayer.GetName(), ipyData.GetItemID()])
|
| | | # |
| | | # HorseSkinNotifyDict = ReadChConfig.GetEvalChConfig("HorseSkinNotify")
|
| | | # if horseSkinID in HorseSkinNotifyDict:
|
| | | # notifyMark = HorseSkinNotifyDict[horseSkinID]
|
| | | # PlayerControl.WorldNotify(0, notifyMark, [curPlayer.GetPlayerName(), horseSkinID])
|
| | | |
| | | return True
|
| | |
|
| | | def DoHorseActivate(curPlayer, index, classLV, classExp=None):
|
| | | '''GM命令测试用
|
| | | @param index: 第几只坐骑或坐骑ID
|
| | | '''
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataNotLog('Horse', index)
|
| | | if not ipyData:
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | if index > ipyDataMgr.GetHorseCount() or index < 1:
|
| | | GameWorld.DebugAnswer(curPlayer, '不存在本只坐骑')
|
| | | return
|
| | | horseID = ipyDataMgr.GetHorseByIndex(index-1).GetHorseID()
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('Horse', horseID)
|
| | | if not ipyData:
|
| | | return
|
| | | else:
|
| | | horseID = index
|
| | | maxLV = ipyData.GetMaxLV()
|
| | | classLV = min(classLV, maxLV)
|
| | | befClassLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_LV % horseID, 0, ChConfig.Def_PDictType_Horse)
|
| | | |
| | | #设置初始等级
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Horser_LV % horseID, classLV, ChConfig.Def_PDictType_Horse)
|
| | | if classExp != None and type(classExp) == int:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Horser_Exp % horseID, classExp, ChConfig.Def_PDictType_Horse)
|
| | | |
| | | #处理技能
|
| | | tick = GameWorld.GetGameWorld().GetTick()
|
| | | playerSkillManager = curPlayer.GetSkillManager()
|
| | | for lv in xrange(1, maxLV + 1):
|
| | | upIpyData = IpyGameDataPY.GetIpyGameData("HorseUp", horseID, lv)
|
| | | if not upIpyData:
|
| | | break
|
| | | skillIDList = upIpyData.GetSkillID()
|
| | | if not skillIDList:
|
| | | continue
|
| | | |
| | | if befClassLV >= lv and classLV < lv:
|
| | | for skillID in skillIDList:
|
| | | playerSkillManager.DeleteSkillBySkillTypeID(skillID)
|
| | | elif befClassLV < lv and classLV >= lv:
|
| | | for skillID in skillIDList:
|
| | | __GiveSkill(curPlayer, skillID, tick)
|
| | | |
| | | pControl = PlayerControl.PlayerControl(curPlayer)
|
| | | pControl.RefreshAllSkill()
|
| | | |
| | | Sync_HorseClassData(curPlayer, horseID)
|
| | | GameWorld.Log("坐骑激活成功!horseID=%s,befClassLV=%s,classLV=%s,classExp=%s" |
| | | % (horseID, befClassLV, classLV, classExp), curPlayer.GetPlayerID())
|
| | | # 刷属性,更新排行榜
|
| | | RefreshHorseAttr(curPlayer)
|
| | | return
|
| | |
|
| | | # 坐骑总等级
|
| | | def GetHorseSumLV(curPlayer):
|
| | | sumLV = 0
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for i in xrange(ipyDataMgr.GetHorseCount()):
|
| | | ipyData = ipyDataMgr.GetHorseByIndex(i)
|
| | | horseID = ipyData.GetHorseID()
|
| | | horseLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_LV % horseID, 0, ChConfig.Def_PDictType_Horse)
|
| | | if not horseLV:
|
| | | continue
|
| | | sumLV += horseLV
|
| | | |
| | | return sumLV
|
| | |
|
| | | def GetHorseCurMaxLV(curPlayer):
|
| | | ##获取坐骑当前最大等级
|
| | | maxLV = 0
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | | for i in xrange(ipyDataMgr.GetHorseCount()):
|
| | | ipyData = ipyDataMgr.GetHorseByIndex(i)
|
| | | horseID = ipyData.GetHorseID()
|
| | | horseLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_LV % horseID, 0, ChConfig.Def_PDictType_Horse)
|
| | | if horseLV > maxLV:
|
| | | maxLV = horseLV
|
| | | return maxLV
|
| | |
|
| | |
|
| | | def IsHorseMaxLV(curPlayer, horseID):
|
| | | horseLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_LV % horseID, 0, ChConfig.Def_PDictType_Horse)
|
| | | if horseLV <= 0:
|
| | | return
|
| | | horseIpyData = IpyGameDataPY.GetIpyGameData("Horse", horseID)
|
| | | if not horseIpyData:
|
| | | return
|
| | | maxLV = horseIpyData.GetMaxLV()
|
| | | return horseLV >= maxLV
|
| | |
|
| | | ## 坐骑总等级
|
| | | return curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserLV)
|
| | |
|
| | | #============================骑宠觉醒=============================
|
| | | #// A5 29 骑宠觉醒 #tagCMHorsePetAwake
|
| | |
| | | if not IpyGameDataPY.GetIpyGameDataByCondition('HorsePetSkin', {'Type':skintype, 'ID':horsePetID}):
|
| | | return
|
| | | if skintype == 1:
|
| | | if not IsHorseMaxLV(curPlayer, horsePetID):
|
| | | GameWorld.DebugLog('骑宠觉醒 对应骑宠未满级 horsePetID=%s'%horsePetID)
|
| | | #坐骑玩法修改,暂关闭坐骑觉醒
|
| | | return
|
| | | # if not IsHorseMaxLV(curPlayer, horsePetID):
|
| | | # GameWorld.DebugLog('骑宠觉醒 对应骑宠未满级 horsePetID=%s' % horsePetID)
|
| | | # return
|
| | | else:
|
| | | if not PlayerPet.IsPetMaxLV(curPlayer, horsePetID):
|
| | | GameWorld.DebugLog('骑宠觉醒 对应骑宠未满级 horsePetID=%s'%horsePetID)
|
| | |
| | | ##骑宠觉醒外观更换
|
| | | ChEquip.ChangeEquipfacadeByHorsePetSkin(curPlayer, skinType, skinIndex)
|
| | | if skinType == 1:#坐骑
|
| | | # 坐骑功能修改,暂关闭觉醒
|
| | | return
|
| | | playerEquip = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptEquip)
|
| | | itemRideHorse = playerEquip.GetAt(Def_HorseEquipIndex)
|
| | | #无指定道具
|