From d3ebd3fcf64cd6cc9881d7a0d7bdf4549f49e3d1 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 01 十二月 2025 18:10:59 +0800
Subject: [PATCH] 358 【内政】红颜系统-服务端(增加专属信物ID字段,与解锁物品ID区分;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHorse.py |   51 +++++++++++++++++++++++++++++++--------------------
 1 files changed, 31 insertions(+), 20 deletions(-)

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 62b1c67..729cf68 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHorse.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHorse.py
@@ -25,6 +25,7 @@
 import IpyGameDataPY
 import GameFuncComm
 import PlayerOnline
+import PlayerTask
 import GameWorld
 import ObjPool
 
@@ -94,10 +95,10 @@
         costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, costItemID, costItemCount)
         lackCnt = costItemCount - bindCnt - unBindCnt
         if lackCnt > 0:
-            GameWorld.DebugLog("消耗道具不足,无法升级坐骑! costItemID=%s,costItemCount=%s,bindCnt=%s,unBindCnt=%s,lackCnt=%s" 
+            costItemCount -= lackCnt
+            GameWorld.DebugLog("消耗道具不足,有多少消耗多少! costItemID=%s,costItemCount=%s,bindCnt=%s,unBindCnt=%s,lackCnt=%s" 
                                % (costItemID, costItemCount, bindCnt, unBindCnt, lackCnt))
-            return
-        
+            
         # 扣除消耗
         ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, costItemCount, ChConfig.ItemDel_Horse)
         
@@ -119,6 +120,8 @@
     # 有升级额外处理
     if updHorseLV > horseLV:
         RefreshHorseAttr(curPlayer)
+        
+    PlayerTask.AddTaskValue(curPlayer, ChConfig.TaskType_HorseLVUP, costItemCount)
     return
 
 #// B2 02 坐骑进阶 #tagCSHorseClassUP
@@ -308,21 +311,25 @@
     ipyData = IpyGameDataPY.GetIpyGameData("HorseSkin", horseSkinID)
     if not ipyData:
         return
-    if ipyData.GetUnlockWay() != 2:
-        GameWorld.DebugLog("非道具激活的不用添加: horseSkinID=%s" % (horseSkinID), playerID)
-        return
     if not isFree:
-        itemID = ipyData.GetUnlockValue()
-        itemCount = ipyData.GetUnlockNeedCnt()
-        if not itemID or not itemCount:
-            return
-        needItemList = [[itemID, itemCount]]
-        itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
-        lackItemDict, delInfoDict = ItemCommon.GetCostItemIndexList(needItemList, itemPack)
-        if lackItemDict:
-            GameWorld.DebugLog("激活所需物品不足! horseSkinID=%s,lackItemDict=%s" % (horseSkinID, lackItemDict), playerID)
-            return
-        ItemCommon.DelCostItem(curPlayer, itemPack, delInfoDict, "AddHorseSkin")
+        unlockWay = ipyData.GetUnlockWay()
+        if unlockWay == 1:
+            classLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorseClassLV)
+            if classLV < ipyData.GetUnlockValue():
+                GameWorld.DebugLog("坐骑阶级不足无法解锁! classLV=%s < %s" % (classLV, ipyData.GetUnlockValue()), playerID)
+                return
+        elif unlockWay == 2:
+            itemID = ipyData.GetUnlockValue()
+            itemCount = ipyData.GetUnlockNeedCnt()
+            if not itemID or not itemCount:
+                return
+            needItemList = [[itemID, itemCount]]
+            itemPack = curPlayer.GetItemManager().GetPack(IPY_GameWorld.rptItem)
+            lackItemDict, delInfoDict = ItemCommon.GetCostItemIndexList(needItemList, itemPack)
+            if lackItemDict:
+                GameWorld.DebugLog("激活所需物品不足! horseSkinID=%s,lackItemDict=%s" % (horseSkinID, lackItemDict), playerID)
+                return
+            ItemCommon.DelCostItem(curPlayer, itemPack, delInfoDict, "AddHorseSkin")
         
     ipyExpireSeconds = ipyData.GetExpireMinutes() * 60
     
@@ -388,6 +395,8 @@
     for index in range(ipyDataMgr.GetHorseSkinCount()):
         ipyData = ipyDataMgr.GetHorseSkinByIndex(index)
         horseSkinID = ipyData.GetSkinID()
+        if horseSkinID <= 0:
+            continue
         if ipyData.GetUnlockWay() != 1:
             continue
         if ipyData.GetUnlockValue() > 0:
@@ -407,9 +416,11 @@
     if ipyData:
         unlockWay = ipyData.GetUnlockWay()
         if unlockWay == 1:
-            classLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorseClassLV)
-            if classLV >= ipyData.GetUnlockValue():
+            if not ipyData.GetUnlockValue():
                 return True
+            #classLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorseClassLV)
+            #if classLV >= ipyData.GetUnlockValue():
+            #    return True
             
     return False
 
@@ -437,7 +448,7 @@
     if ipyData.GetUnlockWay() != 2:
         return
     itemID = ipyData.GetUnlockValue()
-    itemCount = ipyData.GetUnlockNeedCnt()
+    itemCount = ipyData.GetUpNeedCnt()
     if not itemID or not itemCount:
         return
     needItemList = [[itemID, itemCount]]

--
Gitblit v1.8.0