hxp
2023-10-08 a1f053eb420898b323a18b9e260aaec34af2992a
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHorse.py
@@ -220,6 +220,11 @@
    GameWorld.Log("坐骑激活成功!activateID=%s,activateState=%s,updActivateState=%s,updSkinEndTime=%s" 
                  % (activateID, activateState, updActivateState, updSkinEndTime), playerID)
    
    horseStar = 1 # 初始星级
    horseID = ipyData.GetHorseID()
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HorserStar % horseID, horseStar)
    SyncHorseStarInfo(curPlayer, horseID)
    # 刷属性,更新排行榜
    RefreshHorseAttr(curPlayer)
    PlayerControl.WorldNotify(0, "GetMount", [curPlayer.GetName(), ipyData.GetHorseSkinPlusID()])
@@ -403,6 +408,7 @@
    allAttrListHorseSoul = [{} for _ in range(4)]
    allAttrListSkin = [{} for _ in range(4)]
    allAttrListTrain = [{} for _ in range(4)]
    allAttrListStar = [{} for _ in range(4)]
    
    customAttrDictSkin = {}
    
@@ -481,6 +487,20 @@
            for i, attrID in enumerate(attrTypeList):
                attrValue = attrValueList[i]
                qualityAttrDict[attrID] = qualityAttrDict.get(attrID, 0) + attrValue
        #星级
        horseStar = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserStar % horseID)
        starIpyData = IpyGameDataPY.GetIpyGameData("HorseStarUp", horseID, horseStar)
        if starIpyData:
            starAttrType = starIpyData.GetStarAttrType()
            starAttrValue = starIpyData.GetStarAttrValue()
            for i, attrID in enumerate(starAttrType):
                attrValue = starAttrValue[i]
                if attrID == ShareDefine.Def_Effect_Speed:
                    horseSpeed += attrValue
                    continue
                PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrListStar)
    customAttrDictSkin["horseSkinQualityAttrInfo"] = horseSkinQualityAttrInfo
    
    # 新培养属性
@@ -533,6 +553,7 @@
    PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_HorseSoul, allAttrListHorseSoul)
    PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_HorseSkin, allAttrListSkin, customAttrDict=customAttrDictSkin)
    PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_HorseTarin, allAttrListTrain)
    PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_HorseStar, allAttrListStar)
    return
def GetHorseSkinActCount(curPlayer):
@@ -710,6 +731,44 @@
    RefreshHorseAttr(curPlayer)
    return
#// A5 35 坐骑升星 #tagCMHorseStarUp
#
#struct    tagCMHorseStarUp
#{
#    tagHead        Head;
#    DWORD        HorseID;        //坐骑ID,对应坐骑表ID
#};
def OnHorseStarUp(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    playerID = curPlayer.GetPlayerID()
    horseID = clientData.HorseID
    horseStar = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserStar % horseID)
    ipyData = IpyGameDataPY.GetIpyGameData("HorseStarUp", horseID, horseStar)
    if not ipyData:
        return
    nextStar = horseStar + 1
    nextIpyData = IpyGameDataPY.GetIpyGameData("HorseStarUp", horseID, nextStar)
    needItemList = ipyData.GetStarUpNeedItemList()
    if not needItemList or not nextIpyData:
        GameWorld.DebugLog("坐骑已满星,无法升星. horseID=%s,curStar=%s" % (horseID, horseStar), playerID)
        return
    itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
    lackItemDict, delInfoDict = ItemCommon.GetCostItemIndexList(needItemList, itemPack)
    if lackItemDict:
        GameWorld.DebugLog("坐骑升星所需物品不足! horseID=%s,curStar=%s,needItemList=%s,lackItemDict=%s"
                           % (horseID, horseStar, needItemList, lackItemDict), playerID)
        return
    ItemCommon.DelCostItem(curPlayer, itemPack, delInfoDict, "HorseStarUp")
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HorserStar % horseID, nextStar)
    GameWorld.DebugLog("坐骑升星. horseID=%s,curStar=%s,nextStar=%s" % (horseID, horseStar, nextStar), playerID)
    RefreshHorseAttr(curPlayer)
    SyncHorseStarInfo(curPlayer, horseID)
    return
def GetHorseTrainTypes():
    return len(IpyGameDataPY.GetFuncEvalCfg("HorseTrain", 1))
@@ -734,6 +793,7 @@
    Sync_HorseClassData(curPlayer)
    SyncHorsePetSkinData(curPlayer)
    SyncHorseSkinTimeInfo(curPlayer)
    SyncHorseStarInfo(curPlayer)
    return
def Sync_HorseClassData(curPlayer):
@@ -967,3 +1027,36 @@
    NetPackCommon.SendFakePack(curPlayer, packData)
    return
def SyncHorseStarInfo(curPlayer, horseID=None):
    if horseID > 0:
        syncIDList = [horseID]
    else:
        syncIDList = []
        ipyDataMgr = IpyGameDataPY.IPY_Data()
        for index in range(ipyDataMgr.GetHorseCount()):
            ipyData = ipyDataMgr.GetHorseByIndex(index)
            syncIDList.append(ipyData.GetHorseID())
    if not syncIDList:
        return
    horseStarList = []
    for horseID in syncIDList:
        horseStar = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserStar % horseID)
        if not horseStar:
            continue
        starInfo = ChPyNetSendPack.tagMCHorseStar()
        starInfo.Clear()
        starInfo.HorseID = horseID
        starInfo.Star = horseStar
        horseStarList.append(starInfo)
    if not horseStarList:
        return
    clientPack = ChPyNetSendPack.tagMCHorseStarInfo()
    clientPack.Clear()
    clientPack.HorseStarList = horseStarList
    clientPack.Count = len(clientPack.HorseStarList)
    NetPackCommon.SendFakePack(curPlayer, clientPack)
    return