From ce65bfb2d495a54509cc823e2b09f74f5ee1c889 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 23 一月 2025 17:17:29 +0800
Subject: [PATCH] 10389 【越南】【英语】【BT】【砍树】魅力值来源是别人的有每日额度限制

---
 ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCharm.py |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCharm.py b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCharm.py
index dd31438..def7d09 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCharm.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/Player/PlayerCharm.py
@@ -17,6 +17,7 @@
 
 import CommFunc
 import ShareDefine
+import IpyGameDataPY
 import PlayerControl
 import ChPyNetSendPack
 import PyGameDataStruct
@@ -175,6 +176,29 @@
         charmValueRecMgr.charmValueRecDict[playerID] = {}
     recTypeDataDict = charmValueRecMgr.charmValueRecDict[playerID]
     
+    dayCharmMax = IpyGameDataPY.GetFuncCfg("CharmCfg", 1)
+    couple = PyDataManager.GetDBPyCoupleManager().GetCouple(playerID)
+    coupleID = couple.GetCoupleID(playerID) if couple else 0
+    if dayCharmMax and offerPlayerID not in [playerID, coupleID]:
+        if CharmValueRecType_Day not in recTypeDataDict:
+            recTypeDataDict[CharmValueRecType_Day] = {}
+        dayOfferPlayerDict = recTypeDataDict[CharmValueRecType_Day]
+        dayFromOtherTotal = 0 # 今日非伴侣来源魅力
+        dayFromOtherList = []
+        for oID, recData in dayOfferPlayerDict.items():
+            if oID not in [playerID, coupleID]:
+                dayFromOtherTotal += recData.CharmValue
+                dayFromOtherList.append([oID, recData.CharmValue, dayFromOtherTotal])
+        if dayFromOtherTotal >= dayCharmMax:
+            GameWorld.Log("今日非自己或伴侣赠送获得魅力值已达上限! dayFromOtherTotal=%s >= %s, %s" 
+                          % (dayFromOtherTotal, dayCharmMax, dayFromOtherList), playerID)
+            return
+        canAddToday = dayCharmMax - dayFromOtherTotal
+        GameWorld.DebugLog("addValue=%s,canAddToday=%s,dayCharmMax=%s,dayFromOtherTotal=%s,%s" 
+                           % (addValue, canAddToday, dayCharmMax, dayFromOtherTotal, dayFromOtherList), playerID)
+        addValue = min(canAddToday, addValue)
+        GameWorld.DebugLog("实际增加: addValue=%s" % (addValue), playerID)
+        
     if playerID not in charmValueRecMgr.charmTotalDict:
         charmValueRecMgr.charmTotalDict[playerID] = {}
     recTypeValueDict = charmValueRecMgr.charmTotalDict[playerID]

--
Gitblit v1.8.0