From 8c1ca0f0fc214bf9b04c7cf50a50718e60f7180d Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 10 十一月 2023 17:24:47 +0800
Subject: [PATCH] 9756 【BT8】【后端】结婚无限吃喜糖修改(增加可配置每日吃喜糖次数上限)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerLove.py |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerLove.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerLove.py
index 0feb3be..e86bf90 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerLove.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerLove.py
@@ -29,10 +29,14 @@
 import BuffSkill
 import PyGameData
 
-def DoPlayerOnDay(curPlayer):   
+def DoPlayerOnDay(curPlayer):
+    if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveEatCandyToday):
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveEatCandyToday, 0)
+        Sync_LoveInfo(curPlayer)
     return
 
 def DoPlayerLogin(curPlayer):
+    Sync_LoveInfo(curPlayer)
     Sync_LoveRingInfo(curPlayer)
     return
 
@@ -133,6 +137,13 @@
     
     playerID = curPlayer.GetPlayerID()
     
+    EatCandyMax = IpyGameDataPY.GetFuncCfg("LoveCandy", 4)
+    if EatCandyMax:
+        eatCandyToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveEatCandyToday)
+        if eatCandyToday >= EatCandyMax:
+            GameWorld.DebugLog("已达今日吃喜糖次数上限. eatCandyToday=%s >= %s" % (eatCandyToday, EatCandyMax), playerID)
+            return
+        
     if not GameWorld.SetPlayerTickTime(curPlayer, ChConfig.TYPE_Player_Tick_Love, tick):
         PlayerControl.NotifyCode(curPlayer, "RequestLater")
         return
@@ -302,7 +313,11 @@
     if not canBuy:
         return
     
-    GameWorld.Log("吃喜糖结果: isFree=%s" % (isFree), curPlayer.GetPlayerID())
+    updEatCandyToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveEatCandyToday) + 1
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_LoveEatCandyToday, updEatCandyToday)
+    Sync_LoveInfo(curPlayer)
+    
+    GameWorld.Log("吃喜糖结果: isFree=%s,updEatCandyToday=%s" % (isFree, updEatCandyToday), curPlayer.GetPlayerID())
     
     if not isFree:
         infoDict = {ChConfig.Def_Cost_Reason_SonKey:"EatCandy"}
@@ -557,6 +572,13 @@
     NetPackCommon.SendFakePack(curPlayer, clientPack)
     return
 
+def Sync_LoveInfo(curPlayer):
+    ## 同步情缘相关信息
+    clientPack = ChPyNetSendPack.tagMCLoveInfo()
+    clientPack.EatCandyToday = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_LoveEatCandyToday)
+    NetPackCommon.SendFakePack(curPlayer, clientPack)
+    return
+
 def SyncMapServerIntimacy(curPlayer, dataMsg):
     tagID, intimacyValue = dataMsg
     coupleID = PlayerControl.GetCoupleID(curPlayer)

--
Gitblit v1.8.0