From ec68dabc97521a7706344e7d038e9f08462f4fe8 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 16 十二月 2025 10:26:34 +0800
Subject: [PATCH] 16 卡牌服务端(删除多余备档报错防范;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHorse.py |   52 ++++++++++++++++++++++++++++++++--------------------
 1 files changed, 32 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 c7316af..93bec80 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHorse.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerHorse.py
@@ -20,13 +20,14 @@
 import ShareDefine
 import NetPackCommon
 import PlayerControl
+import PlayerSuccess
 import ChPyNetSendPack
 import IPY_GameWorld
 import IpyGameDataPY
 import GameFuncComm
 import PlayerOnline
+import PlayerTask
 import GameWorld
-import ObjPool
 
 import time
 
@@ -119,6 +120,9 @@
     # 有升级额外处理
     if updHorseLV > horseLV:
         RefreshHorseAttr(curPlayer)
+        
+    PlayerTask.AddTaskValue(curPlayer, ChConfig.TaskType_HorseLVUP, costItemCount)
+    PlayerSuccess.DoAddSuccessProgress(curPlayer, ShareDefine.SuccType_OSAHorseLVUP, costItemCount)
     return
 
 #// B2 02 坐骑进阶 #tagCSHorseClassUP
@@ -245,7 +249,7 @@
     return
 
 def SyncHorseClassInfo(curPlayer):
-    clientPack = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCHorseClassInfo)
+    clientPack = ChPyNetSendPack.tagSCHorseClassInfo()
     clientPack.ClassLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorseClassLV)
     clientPack.HorseLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorseLV)
     clientPack.Exp = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorseExp)
@@ -308,21 +312,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 +396,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 +417,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
 
@@ -480,7 +492,7 @@
         state = GameWorld.GetDictValueByBit(curPlayer, ChConfig.Def_PDict_HorseSkinState, horseSkinID)
         if not state and horseSkinIDList == None:
             continue
-        horseSkin = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCHorseSkin)
+        horseSkin = ChPyNetSendPack.tagSCHorseSkin()
         horseSkin.HorseSkinID = horseSkinID
         horseSkin.State = state
         horseSkin.EndTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HorseSkinEndTime % horseSkinID)
@@ -490,7 +502,7 @@
     if not horseSkinList:
         return
     
-    clientPack = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCHorseSkinInfo)
+    clientPack = ChPyNetSendPack.tagSCHorseSkinInfo()
     clientPack.HorseSkinList = horseSkinList
     clientPack.Count = len(clientPack.HorseSkinList)
     NetPackCommon.SendFakePack(curPlayer, clientPack)

--
Gitblit v1.8.0