From ea6dff19b5877d55473d445788e1a2ff5789f6b9 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 17 三月 2026 10:01:57 +0800
Subject: [PATCH] 526 【挑战】PVP群英榜-后端(战斗日志Value1增加存储ServerID;群英榜单10的UserData增加Json格式存储FightPower;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBeauty.py |  136 +++++++++++++++++++++++++++------------------
 1 files changed, 82 insertions(+), 54 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBeauty.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBeauty.py
index 3fe8f91..d1a3b4f 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBeauty.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerBeauty.py
@@ -22,13 +22,14 @@
 import PlayerControl
 import IpyGameDataPY
 import ChPyNetSendPack
+import OpenServerActivity
+import GameLogic_Dingjunge
 import PlayerGoldRush
 import NetPackCommon
 import ItemControler
 import PyGameData
 import PlayerTask
 import FBCommon
-import ObjPool
 
 # 红颜解锁方式
 (
@@ -39,7 +40,8 @@
 UnlockWay_FBZhanchui, # 白骨盈野过关 5
 UnlockWay_OfficialRank, # 官职达到 6
 UnlockWay_TravelCnt, # 游历次数 7
-) = range(1, 1 + 7)
+UnlockWay_FBDingjunge, # 定军阁通关层 8
+) = range(1, 1 + 8)
 
 # 皮肤解锁方式
 UnlockWaySkin_Default = 1 # 默认解锁 1
@@ -51,7 +53,8 @@
 EffType_ArenaItemEx, # 2. 演武场挑战胜利,概率额外获得1个物品的概率    TypeValue:物品ID  Value:概率
 EffType_TravelEnergy, # 3.游历体力上限增加     Value:增加上限
 EffType_FBZhanchuiItemEx, # 4.白骨盈野扫荡额外物品奖励      TypeValue:物品ID  Value:数量
-) = range(1, 1 + 4)
+EffType_HeroItemExPer, # 5.遣散/吞噬武将额外返还      Value:百分比
+) = range(1, 1 + 5)
 
 def OnPlayerLogin(curPlayer):
     SyncBeautyInfo(curPlayer)
@@ -146,11 +149,13 @@
     if unlockWay == UnlockWay_Item:
         needItemID = unlockValue
         needItemCnt = unlockNeedCnt
-        itemCount = ItemControler.GetItemCountByID(curPlayer, needItemID)
-        if itemCount < needItemCnt:
-            GameWorld.DebugLog("激活红颜物品不足! beautyID=%s,needItemID=%s,itemCount=%s < %s" % (beautyID, needItemID, itemCount, needItemCnt), playerID)
+        
+        costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, needItemID, needItemCnt)
+        lackCnt = needItemCnt - bindCnt - unBindCnt
+        if lackCnt > 0:
+            GameWorld.DebugLog("激活红颜物品不足! beautyID=%s,needItemID=%s,needItemCnt=%s,lackCnt=%s" % (beautyID, needItemID, needItemCnt, lackCnt), playerID)
             return
-        ItemControler.DelItemCountByID(curPlayer, needItemID, needItemCnt)
+        ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, needItemCnt, "Beauty")
         
     elif unlockWay == UnlockWay_TaskID:
         taskID = unlockValue
@@ -178,6 +183,13 @@
         isPass = FBCommon.IsFBPass(curPlayer, mapID, funcLineID)
         if not isPass:
             GameWorld.DebugLog("激活红颜所需副本未过关! beautyID=%s,mapID=%s,funcLineID=%s" % (beautyID, mapID, funcLineID), playerID)
+            return
+        
+    elif unlockWay == UnlockWay_FBDingjunge:
+        passLayer = GameLogic_Dingjunge.GetPassLayerMax(curPlayer)
+        needLayer = unlockValue
+        if passLayer < needLayer:
+            GameWorld.DebugLog("激活红颜所需定军阁通关层不足! beautyID=%s,passLayer=%s < %s" % (beautyID, passLayer, needLayer), playerID)
             return
         
     elif unlockWay == UnlockWay_OfficialRank:
@@ -213,6 +225,31 @@
     SyncBeautyInfo(curPlayer, [beautyID])
     return
 
+def GetBeautyActCnt(curPlayer):
+    ## 红颜已激活总数
+    actCnt = 0
+    ipyDataMgr = IpyGameDataPY.IPY_Data()
+    for index in range(ipyDataMgr.GetBeautyCount()):
+        ipyData = ipyDataMgr.GetBeautyByIndex(index)
+        beautyID = ipyData.GetBeautyID()
+        if not GetBeautyState(curPlayer, beautyID):
+            continue
+        actCnt += 1
+    return actCnt
+
+def GetBeautyLVTotal(curPlayer):
+    ## 红颜总等级
+    lvTotal = 0
+    ipyDataMgr = IpyGameDataPY.IPY_Data()
+    for index in range(ipyDataMgr.GetBeautyCount()):
+        ipyData = ipyDataMgr.GetBeautyByIndex(index)
+        beautyID = ipyData.GetBeautyID()
+        if not GetBeautyState(curPlayer, beautyID):
+            continue
+        curLV = GetBeautyLVInfo(curPlayer, beautyID)[0]
+        lvTotal += curLV
+    return lvTotal
+
 #// B2 20 红颜好感度升级 #tagCSBeautyLVUP
 #
 #struct    tagCSBeautyLVUP
@@ -239,21 +276,15 @@
     quality = ipyData.GetBeautyQuality()
     curLV, curExp = GetBeautyLVInfo(curPlayer, beautyID)
     
-    isCommItem = True # 是否使用的常规通用物品
     commItemIDList = IpyGameDataPY.GetFuncEvalCfg("BeautyLVUP", 1)
     commExpList = IpyGameDataPY.GetFuncEvalCfg("BeautyLVUP", 2)
     if itemID in commItemIDList:
         index = commItemIDList.index(itemID)
         perExp = commExpList[index] if len(commExpList) > index else 0
     else:
-        isCommItem = False
-        unlockWay = ipyData.GetUnlockWay()
-        unlockValue = ipyData.GetUnlockValue()
-        if unlockWay != UnlockWay_Item:
-            GameWorld.DebugLog("非道具激活的不支持专属信物ID升级! beautyID=%s,unlockWay=%s" % (beautyID, unlockWay), playerID)
-            return
-        if itemID != unlockValue:
-            GameWorld.DebugLog("非该红颜专属信物ID! beautyID=%s,itemID=%s != %s" % (beautyID, itemID, unlockValue), playerID)
+        exclusiveItemID = ipyData.GetExclusiveItemID()
+        if itemID != exclusiveItemID:
+            GameWorld.DebugLog("非该红颜专属信物ID! beautyID=%s,itemID=%s != %s" % (beautyID, itemID, exclusiveItemID), playerID)
             return
         perExp = IpyGameDataPY.GetFuncCfg("BeautyLVUP", 3)
         
@@ -280,24 +311,16 @@
         if costItemCount < 1:
             return
         
-        if isCommItem:
-            costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, itemID, costItemCount)
-            lackCnt = costItemCount - bindCnt - unBindCnt
-            if lackCnt > 0:
-                costItemCount -= lackCnt
-                GameWorld.DebugLog("消耗道具不足,有多少消耗多少! itemID=%s,costItemCount=%s,bindCnt=%s,unBindCnt=%s,lackCnt=%s" 
-                                   % (itemID, costItemCount, bindCnt, unBindCnt, lackCnt))
-            # 扣除消耗
-            if costItemCount > 0:
-                ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, costItemCount, "Beauty")
-        else:
-            itemCount = ItemControler.GetItemCountByID(curPlayer, itemID)
-            if itemCount < costItemCount:
-                costItemCount = itemCount
-                
-            if costItemCount > 0:
-                ItemControler.SetItemCountByID(curPlayer, itemID, itemCount - costItemCount)
-                
+        costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, itemID, costItemCount)
+        lackCnt = costItemCount - bindCnt - unBindCnt
+        if lackCnt > 0:
+            costItemCount -= lackCnt
+            GameWorld.DebugLog("消耗道具不足,有多少消耗多少! itemID=%s,costItemCount=%s,bindCnt=%s,unBindCnt=%s,lackCnt=%s" 
+                               % (itemID, costItemCount, bindCnt, unBindCnt, lackCnt))
+        # 扣除消耗
+        if costItemCount > 0:
+            ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, costItemCount, "Beauty")
+            
     addExp = costItemCount * perExp
     updExp = curExp + addExp
     GameWorld.DebugLog("红颜加经验: beautyID=%s,quality=%s,curLV=%s,curExp=%s,addExp=%s,updExp=%s/%s,itemID=%s,costItemCount=%s,perExp=%s" 
@@ -314,8 +337,9 @@
     SyncBeautyInfo(curPlayer, [beautyID])
     
     # 有升级额外处理
-    if updLV > updLV:
+    if updLV > curLV:
         RefreshBeautyAttr(curPlayer)
+        OpenServerActivity.UpdOSA_BeautyTrainBillboard(curPlayer)
         
     return
 
@@ -413,11 +437,12 @@
     if unlockWay == UnlockWaySkin_Item:
         needItemID = unlockValue
         needItemCnt = unlockNeedCnt
-        itemCount = ItemControler.GetItemCountByID(curPlayer, needItemID)
-        if itemCount < needItemCnt:
-            GameWorld.DebugLog("激活红颜时装物品不足! beautyID=%s,needItemID=%s,itemCount=%s < %s" % (beautyID, needItemID, itemCount, needItemCnt))
+        costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, needItemID, needItemCnt)
+        lackCnt = needItemCnt - bindCnt - unBindCnt
+        if lackCnt > 0:
+            GameWorld.DebugLog("激活红颜时装物品不足! beautyID=%s,needItemID=%s,needItemCnt=%s,lackCnt=%s" % (beautyID, needItemID, needItemCnt, lackCnt))
             return
-        ItemControler.DelItemCountByID(curPlayer, needItemID, needItemCnt)
+        ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, needItemCnt, "Beauty")
         
     else:
         GameWorld.DebugLog("红颜皮肤不需要激活! beautyID=%s,skinID=%s" % (beautyID, skinID))
@@ -470,11 +495,13 @@
     needItemCnt = ipyData.GetUpNeedCnt()
     if not needItemID or not needItemCnt:
         return
-    itemCount = ItemControler.GetItemCountByID(curPlayer, needItemID)
-    if itemCount < needItemCnt:
-        GameWorld.DebugLog("红颜时装升星物品不足! skinID=%s,needItemID=%s,itemCount=%s < %s" % (skinID, needItemID, itemCount, needItemCnt))
+    
+    costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, needItemID, needItemCnt)
+    lackCnt = needItemCnt - bindCnt - unBindCnt
+    if lackCnt > 0:
+        GameWorld.DebugLog("红颜时装升星物品不足! skinID=%s,needItemID=%s,needItemCnt=%s,lackCnt=%s" % (skinID, needItemID, needItemCnt, lackCnt))
         return
-    ItemControler.DelItemCountByID(curPlayer, needItemID, needItemCnt)
+    ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, needItemCnt, "Beauty")
     
     nextStar = curStar + 1
     GameWorld.DebugLog("红颜时装升星! skinID=%s,nextStar=%s" % (skinID, nextStar), playerID)
@@ -535,7 +562,9 @@
         effPerLVAdd = ipyData.GetEffPerLVAdd()
         if effType:
             effValue = effValue + effPerLVAdd * talentLV
-            effTypeDict[effType] = [effValue, effTypeValue]
+            if effType not in effTypeDict:
+                effTypeDict[effType] = [0, effTypeValue]
+            effTypeDict[effType][0] = effTypeDict[effType][0] + effValue
             #GameWorld.DebugLog("红颜特殊效果: beautyID=%s,effType=%s,talentLV=%s,%s" % (beautyID, effType, talentLV, effTypeDict), playerID)
             
         # 时装
@@ -561,14 +590,13 @@
     # 保存计算值
     GameWorld.DebugLog("红颜属性: %s" % attrDict, playerID)
     GameWorld.DebugLog("红颜效果: %s" % effTypeDict, playerID)
-    PyGameData.g_beautyEffTypeDict[playerID] = effTypeDict
-    PlayerOnline.GetOnlinePlayer(curPlayer).SetCalcAttr(ChConfig.Def_CalcAttr_Beauty, attrDict)
+    PlayerOnline.GetOnlinePlayer(curPlayer).SetCalcAttr(ChConfig.Def_CalcAttr_Beauty, attrDict, effTypeDict)
     return
 
 def GetBeautyEffInfo(curPlayer, effType):
     ## 获取红颜特殊效果信息
     # @return: effValue, effTypeValue
-    effTypeDict = PyGameData.g_beautyEffTypeDict.get(curPlayer.GetPlayerID(), {})
+    effTypeDict = PlayerOnline.GetOnlinePlayer(curPlayer).GetCalcSpecInfo(ChConfig.Def_CalcAttr_Beauty)
     return effTypeDict.get(effType, [0, 0])
 
 def SyncBeautyInfo(curPlayer, beautyIDList=None, skinIDList=None):
@@ -587,7 +615,7 @@
         if not state and beautyIDList == None:
             continue
         lv, exp = GetBeautyLVInfo(curPlayer, beautyID)
-        beauty = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCBeauty)
+        beauty = ChPyNetSendPack.tagSCBeauty()
         beauty.BeautyID = beautyID
         beauty.State = state
         beauty.LV = lv
@@ -599,14 +627,14 @@
         if ipyDataList:
             for ipyData in ipyDataList:
                 skinID = ipyData.GetSkinID()
-                skinInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BeautySkinInfo % skinID)
+                #skinInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_BeautySkinInfo % skinID)
                 if skinIDList != None:
                     if skinID not in skinIDList:
                         continue
-                else:
-                    if not skinInfo:
-                        continue
-                beautySkin = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCBeautySkin)
+                #else:
+                #    if not skinInfo:
+                #        continue
+                beautySkin = ChPyNetSendPack.tagSCBeautySkin()
                 beautySkin.SkinID = skinID
                 beautySkin.State = 1 if IsBeautySkinCanUse(curPlayer, beautyID, skinID, ipyData) else 0
                 beautySkin.Used = GetBeautySkinUsed(curPlayer, skinID)
@@ -619,7 +647,7 @@
     if not beautyList:
         return
     
-    clientPack = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCBeautyInfo)
+    clientPack = ChPyNetSendPack.tagSCBeautyInfo()
     clientPack.BeautyList = beautyList
     clientPack.Count = len(clientPack.BeautyList)
     NetPackCommon.SendFakePack(curPlayer, clientPack)

--
Gitblit v1.8.0