xdh
2019-02-13 5d0665e7f5b3bee843f58afa9a05ae9d7e1fc72f
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHorse.py
@@ -39,6 +39,8 @@
import SkillCommon
import PlayerMagicWeapon
import PassiveBuffEffMng
import CrossPlayerData
import PlayerWeekParty
#---------------------------------------------------------------------
#---------------------------------------------------------------------
@@ -98,6 +100,12 @@
    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,
@@ -130,6 +138,15 @@
    
    #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
#---------------------下马逻辑
@@ -280,8 +297,43 @@
    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, ShareDefine.retHorse, tick):
        if isRideHorse:
            PlayerRideHorseUp(curPlayer, False)
    return
def DoChangeHorse(curPlayer, horseIndex, tick):
    ipyData = IpyGameDataPY.GetIpyGameData("Horse", horseIndex)
@@ -476,8 +528,9 @@
    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)
    
    # 保存计算值
@@ -736,6 +789,52 @@
# @param curPlayer 玩家
# @return None
def PlayerHorseLogin(curPlayer):
    if not GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_VersionFix, ChConfig.Def_VerFix_Horse):
        GameWorld.SetDictValueByBit(curPlayer, ChConfig.Def_Player_Dict_VersionFix, ChConfig.Def_VerFix_Horse, 1)
        #等级不能超上限,技能删了重新学
        skillManager = curPlayer.GetSkillManager()
        delCnt = 0
        for i in xrange(skillManager.GetSkillCount()):
            dataIndex = i-delCnt
            skill = skillManager.GetSkillByIndex(dataIndex)
            if skill == None:
                continue
            if skill.GetFuncType() != ChConfig.Def_SkillFuncType_HorseSkill:
                continue
            skillTypeID = skill.GetSkillTypeID()
            skillManager.DeleteSkillBySkillTypeID(skillTypeID)
            delCnt += 1
        tick = GameWorld.GetGameWorld().GetTick()
        ipyDataMgr = IpyGameDataPY.IPY_Data()
        for i in xrange(ipyDataMgr.GetHorseCount()):
            ipyData = ipyDataMgr.GetHorseByIndex(i)
            horseID = ipyData.GetHorseID()
            curlv = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_Horser_LV % horseID, 0, ChConfig.Def_PDictType_Horse)
            if not curlv:
                continue
            maxLV = ipyData.GetMaxLV()
            if curlv > maxLV:
                PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Horser_LV % horseID, maxLV, ChConfig.Def_PDictType_Horse)
                PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_Horser_Exp % horseID, 0, ChConfig.Def_PDictType_Horse)
                GameWorld.Log('   老号坐骑等级超过上限,坐骑ID=%s,原LV=%s,重置为=%s'%(horseID, curlv, maxLV))
                curlv = maxLV
            for lv in xrange(1, curlv + 1):
                upIpyData = IpyGameDataPY.GetIpyGameData("HorseUp", horseID, lv)
                if not upIpyData:
                    break
                skillIDList = upIpyData.GetSkillID()
                if not skillIDList:
                    continue
                for skillID in skillIDList:
                    __GiveSkill(curPlayer, skillID, tick)
        # 重刷战力
        curControl = PlayerControl.PlayerControl(curPlayer)
        curControl.RefreshAllSkill()
        RefreshHorseAttr(curPlayer)
    Sync_HorseClassData(curPlayer)
    return
@@ -822,11 +921,14 @@
    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)
    #无指定道具