From 7e1ba2e087d31b03a09865e43d31cae1ab774680 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 03 九月 2024 16:06:39 +0800
Subject: [PATCH] 10258 【越南】【砍树】新增古宝特殊效果(增加灵根点效果;增加提升坐骑基础属性X%;坐骑每升X级加X点属性)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGubao.py       |   93 ++++++++++++++++++++++++++++++++++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Gubao.py        |    6 +-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHorse.py       |   10 ++++-
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py     |    1 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py |    2 +
 5 files changed, 106 insertions(+), 6 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Gubao.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Gubao.py
index 364b8a4..a0a3b1d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Gubao.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/Gubao.py
@@ -56,7 +56,7 @@
                 if gubaoID not in gubaoIDList:
                     gubaoIDList.append(gubaoID)
                 PlayerGubao.SetGubaoLVInfo(curPlayer, gubaoID, 0, 0)
-                for effType in PlayerGubao.GubaoEffTtemIypeList:
+                for effType in PlayerGubao.NeedGubaoItemEffValueTypeList:
                     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GubaoItemEffValue % (gubaoID, effType), 0)
                     
             PlayerGubao.Sync_GubaoItemEffInfo(curPlayer, force=True)
@@ -95,8 +95,8 @@
         if len(msgList) != 4:
             return
         _, gubaoID, effType, effValue = msgList
-        if effType not in PlayerGubao.GubaoEffTtemIypeList:
-            GameWorld.DebugAnswer(curPlayer, "古宝物品效果类型仅包含:%s" % str(PlayerGubao.GubaoEffTtemIypeList))
+        if effType not in PlayerGubao.NeedGubaoItemEffValueTypeList:
+            GameWorld.DebugAnswer(curPlayer, "古宝效果值类型仅包含:%s" % str(PlayerGubao.NeedGubaoItemEffValueTypeList))
             return
         ipyData = IpyGameDataPY.GetIpyGameData("Gubao", gubaoID)
         if not ipyData:
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
index 9f9dc3f..ed28575 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -4374,6 +4374,7 @@
                 curPlayer.SetBasePHY(aftBasePHY)
             if aftBaseCON > befBaseCON:
                 curPlayer.SetBaseCON(aftBaseCON)
+            PlayerGubao.DoGubaoAddFreePoint(curPlayer)
             #===================================================================
             # if curPlayer.GetXP() != befXP:
             #    curPlayer.SetXP(curPlayer.GetXP())
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGubao.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGubao.py
index 0ecab99..0adab07 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGubao.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGubao.py
@@ -58,6 +58,12 @@
                         GubaoEffType_CrossRealmPK,
                         ]
 
+# 古宝灵根点特殊效果列表
+GubaoEffFreePointTypeList = [54, 55, 56]
+
+# 需要记录EffValue的EffType列表
+NeedGubaoItemEffValueTypeList = GubaoEffAttrIypeList + GubaoEffTtemIypeList + GubaoEffFreePointTypeList
+
 def GetGubaoLVInfo(curPlayer, gubaoID):
     lvInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GubaoLVInfo % gubaoID)
     lv = lvInfo / 100
@@ -68,6 +74,7 @@
     return
 
 def OnPlayerLogin(curPlayer):
+    DoGubaoAddFreePoint(curPlayer) # 上线检查一下,修改配置可生效
     Sync_GubaoInfo(curPlayer)
     Sync_GubaoItemEffInfo(curPlayer)
     Sync_GubaoPieceInfo(curPlayer)
@@ -156,6 +163,7 @@
     lv, star = 1, 1
     SetGubaoLVInfo(curPlayer, gubaoID, lv, star)
     GameWorld.Log("古宝激活成功! gubaoID=%s" % gubaoID, playerID)
+    DoGubaoAddFreePoint(curPlayer, gubaoID)
     
     RefreshGubaoAttr(curPlayer)
     Sync_GubaoInfo(curPlayer, [gubaoID])
@@ -253,11 +261,79 @@
     updStar = star + 1
     SetGubaoLVInfo(curPlayer, gubaoID, lv, updStar)
     GameWorld.Log("古宝升星: gubaoID=%s,updStar=%s" % (gubaoID, updStar), playerID)
+    DoGubaoAddFreePoint(curPlayer, gubaoID)
     RefreshGubaoAttr(curPlayer)
     Sync_GubaoInfo(curPlayer, [gubaoID])
     
     PlayerActGubao.OnGubaoCost(curPlayer, needPieceInfo, realNeedItemList)
     return
+
+def DoGubaoAddFreePoint(curPlayer, gubaoID=0):
+    playerID = curPlayer.GetPlayerID()
+    effPointDict = {}
+    if gubaoID:
+        __calcStarEffAddFreePoint(curPlayer, gubaoID, effPointDict)
+    else:
+        ipyDataMgr = IpyGameDataPY.IPY_Data()
+        for index in xrange(ipyDataMgr.GetGubaoCount()):
+            ipyData = ipyDataMgr.GetGubaoByIndex(index)
+            gubaoID = ipyData.GetGubaoID()
+            __calcStarEffAddFreePoint(curPlayer, gubaoID, effPointDict)
+            
+    if not effPointDict:
+        return
+    
+    unAddFreePointTotal = 0
+    for effKey, addFreePointTotal in effPointDict.items():
+        gubaoID, star, effType = effKey 
+        # 已增加的点数
+        addFreePointAlready = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GubaoItemEffValue % (gubaoID, effType))
+        unAddFreePoint = max(0, addFreePointTotal - addFreePointAlready)
+        unAddFreePointTotal += unAddFreePoint
+        GameWorld.DebugLog("古宝星级增加灵根点: gubaoID=%s,star=%s,addFreePointTotal=%s,addFreePointAlready=%s,unAddFreePoint=%s,total=%s" 
+                           % (gubaoID, star, addFreePointTotal, addFreePointAlready, unAddFreePoint, unAddFreePointTotal), playerID)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GubaoItemEffValue % (gubaoID, effType), addFreePointTotal)
+        if unAddFreePoint:
+            Sync_GubaoItemEffInfo(curPlayer, gubaoID, effType, True)
+            
+    if unAddFreePointTotal <= 0:
+        return
+    freePoint = curPlayer.GetFreePoint()
+    updFreePoint = freePoint + unAddFreePointTotal
+    curPlayer.SetFreePoint(updFreePoint)
+    return
+
+def __calcStarEffAddFreePoint(curPlayer, gubaoID, effPointDict):
+    _, star = GetGubaoLVInfo(curPlayer, gubaoID)
+    if not star:
+        return
+    starIpyData = IpyGameDataPY.GetIpyGameData("GubaoStar", gubaoID, star)
+    if not starIpyData:
+        return
+    starEffIDList = starIpyData.GetStarEffIDList()
+    for effID in starEffIDList:
+        effIpyData = IpyGameDataPY.GetIpyGameData("GubaoEffAttr", effID)
+        if not effIpyData:
+            continue
+        effType = effIpyData.GetGubaoEffType()
+        effCond = effIpyData.GetEffCond()
+        effAttrValue = effIpyData.GetEffAttrValue()
+        
+        effKey = (gubaoID, star, effType)
+        if effType == 54: # 增加x点灵根
+            addFreePointTotal = effIpyData.GetEffAttrValue()
+            effPointDict[effKey] = effPointDict.get(effKey, 0) + addFreePointTotal
+        elif effType == 55: # 境界每级增加X点灵根
+            realmLV = curPlayer.GetOfficialRank()
+            addFreePointTotal = int(realmLV / effCond * effAttrValue)
+            effPointDict[effKey] = effPointDict.get(effKey, 0) + addFreePointTotal
+        elif effType == 56: # 等级每级增加X点灵根
+            playerLV = curPlayer.GetLV()
+            addFreePointTotal = int(playerLV / effCond * effAttrValue)
+            effPointDict[effKey] = effPointDict.get(effKey, 0) + addFreePointTotal
+            
+    return
+
 
 #// B2 18 古宝升级 #tagCMGubaoLVUp
 #
@@ -762,6 +838,21 @@
         if attrID > 0 and addAttrValue > 0:
             effAttrInfo[attrID] = effAttrInfo.get(attrID, 0) + addAttrValue
             
+    #57    坐骑基础属性提升x%
+    elif effType == 57:
+        customAttrDict = PlayerControl.GetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Horse)[2]
+        horseBaseAttrInfo = customAttrDict.get("horseBaseAttrInfo", {})
+        #GameWorld.DebugLog("    effID=%s,effType=%s,horseBaseAttrInfo=%s,effAttrInfo=%s" % (effID, effType, horseBaseAttrInfo, effAttrInfo))
+        __addStarEffFuncAttr(ipyData, effAttrInfo, horseBaseAttrInfo, effAttrValue)
+       
+    #58    坐骑每x级+xx属性                   x级
+    elif effType == 58:
+        horseLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserLV)
+        addAttrValue = int(horseLV / effCond * effAttrValue)
+        #GameWorld.DebugLog("    effID=%s,effType=%s,effCond=%s,horseLV=%s,attrID=%s,addAttrValue=%s" % (effID, effType, effCond, horseLV, attrID, addAttrValue))
+        if attrID > 0 and addAttrValue > 0:
+            effAttrInfo[attrID] = effAttrInfo.get(attrID, 0) + addAttrValue
+            
     return
 
 def __addStarEffFuncAttr(ipyData, effAttrInfo, funcAttrInfo, effAttrValue):
@@ -901,7 +992,7 @@
     else:
         syncIDList = [gubaoID]
         
-    syncEffTypeList = [effType] if effType else GubaoEffTtemIypeList
+    syncEffTypeList = [effType] if effType else NeedGubaoItemEffValueTypeList
     
     itemEffInfoList = []
     for gubaoID in syncIDList:
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHorse.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHorse.py
index b0a472f..db0b806 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHorse.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHorse.py
@@ -407,12 +407,14 @@
     allAttrListTrain = [{} for _ in range(4)]
     allAttrListStar = [{} for _ in range(4)]
     
+    customAttrDictHorse = {}
     customAttrDictSkin = {}
     
     horseSpeed = 0 # 坐骑功能增加的速度值,骑乘时才有效果
     horseLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorserLV)
     # 等阶培养属性
     #totalItemCount = 0
+    horseBaseAttrInfo = {}
     ipyDataMgr = IpyGameDataPY.IPY_Data()
     for index in xrange(ipyDataMgr.GetHorseLVUpCount()):
         horseIpyData = ipyDataMgr.GetHorseLVUpByIndex(index)
@@ -433,6 +435,7 @@
                 horseSpeed += attrValue
                 continue
             PlayerControl.CalcAttrDict_Type(attrID, attrValue, allAttrList)
+            horseBaseAttrInfo[attrID] = horseBaseAttrInfo.get(attrID, 0) + attrValue
             
         # 培养丹增加属性
         upItemPerCount = horseIpyData.GetUpEatItemPerCount()
@@ -443,7 +446,10 @@
             for i, attrID in enumerate(upItemAttrTypeList):
                 attrValue = upItemAttrValueList[i]
                 PlayerControl.CalcAttrDict_Type(attrID, attrValue * attrMultiple, allAttrList)
-            
+                horseBaseAttrInfo[attrID] = horseBaseAttrInfo.get(attrID, 0) + attrValue * attrMultiple
+                
+    customAttrDictHorse["horseBaseAttrInfo"] = horseBaseAttrInfo
+    
 #    # 等阶培养丹累加个数属性
 #    eatItemAttrInfo = IpyGameDataPY.GetFuncCfg("HorseUpItem", 3)
 #    for attrID, attrValue in eatItemAttrInfo:
@@ -546,7 +552,7 @@
     curPlayer.SetDict(ChConfig.Def_PlayerKey_MFPEx % ShareDefine.Def_MFPType_HorseSoul, fightPowerEx)
     
     # 保存计算值
-    PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Horse, allAttrList)
+    PlayerControl.SetCalcAttrListValue(curPlayer, ChConfig.Def_CalcAttrFunc_Horse, allAttrList, customAttrDict=customAttrDictHorse)
     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)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py
index 70a2ba3..263fc29 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerPrestigeSys.py
@@ -30,6 +30,7 @@
 import PlayerBillboard
 import PlayerTongTianLing
 import PassiveBuffEffMng
+import PlayerGubao
 import EventShell
 import DataRecordPack
 import SkillCommon
@@ -259,6 +260,7 @@
     curPlayer.SetOfficialRank(nextRealmLv)
     # 提升1级境界加点
     __DoRealmLVUpAddPoint(curPlayer)
+    PlayerGubao.DoGubaoAddFreePoint(curPlayer)
     
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_RealmFBIsOpen, 0)
     if needSys:

--
Gitblit v1.8.0