From 813c1d9244e9d20f00afd1f5ca9e5396a927975e Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期六, 07 十月 2023 00:51:30 +0800
Subject: [PATCH] 9905 【BT0.1】【主干】新增每周、每月限购 主干冲突

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py |   84 ++++++++++++++++++++++++++++++++++++++----
 1 files changed, 76 insertions(+), 8 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
index aa4e7f6..0a98b93 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
@@ -133,12 +133,17 @@
             continue
         totalBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % recordID)
         todayBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCount % recordID)
-        if not totalBuyCount and not todayBuyCount:
+        weekBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekCTGCount % recordID)
+        monthBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MonthCTGCount % recordID)
+        if not totalBuyCount and not todayBuyCount and not weekBuyCount and not monthBuyCount:
             continue
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGGoodsBuyCount % recordID, 0)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCount % recordID, 0)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WeekCTGCount % recordID, 0)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MonthCTGCount % recordID, 0)
         drDict = {"PlayerID":curPlayer.GetPlayerID(),"AccID":curPlayer.GetAccID(), "ResetEvent":resetEvent,
-                  "totalBuyCount":totalBuyCount, "todayBuyCount":todayBuyCount, "recordID":recordID}
+                  "totalBuyCount":totalBuyCount, "todayBuyCount":todayBuyCount, "recordID":recordID, 
+                  "weekBuyCount":weekBuyCount, "monthBuyCount":monthBuyCount}
         DataRecordPack.SendEventPack("ResetCTGCount", drDict, curPlayer)
         GameWorld.Log("重置充值次数: resetEvent=%s,recordID=%s,totalBuyCount=%s,todayBuyCount=%s" 
                       % (resetEvent, recordID, totalBuyCount, todayBuyCount), playerID)
@@ -153,12 +158,17 @@
     for recordID in resetCTGIDList:
         totalBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % recordID)
         todayBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCount % recordID)
-        if not totalBuyCount and not todayBuyCount:
+        weekBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekCTGCount % recordID)
+        monthBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MonthCTGCount % recordID)
+        if not totalBuyCount and not todayBuyCount and not weekBuyCount and not monthBuyCount:
             continue
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGGoodsBuyCount % recordID, 0)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCount % recordID, 0)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WeekCTGCount % recordID, 0)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MonthCTGCount % recordID, 0)
         drDict = {"PlayerID":curPlayer.GetPlayerID(),"AccID":curPlayer.GetAccID(), "ResetEvent":resetEvent,
-                  "totalBuyCount":totalBuyCount, "todayBuyCount":todayBuyCount, "recordID":recordID}
+                  "totalBuyCount":totalBuyCount, "todayBuyCount":todayBuyCount, "recordID":recordID, 
+                  "weekBuyCount":weekBuyCount, "monthBuyCount":monthBuyCount}
         DataRecordPack.SendEventPack("ResetCTGCount", drDict, curPlayer)
         GameWorld.Log("重置充值次数: resetEvent=%s,recordID=%s,totalBuyCount=%s,todayBuyCount=%s" 
                       % (resetEvent, recordID, totalBuyCount, todayBuyCount), playerID)
@@ -192,6 +202,35 @@
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DayFreeGoldGiftState, 0)
         Sync_DayFreeGoldGiftState(curPlayer)
     return
+
+def OnWeek(curPlayer):
+    syncRecordIDList = []
+    ipyDataMgr = IpyGameDataPY.IPY_Data()
+    for i in xrange(ipyDataMgr.GetCTGCount()):
+        ipyData = ipyDataMgr.GetCTGByIndex(i)
+        recordID = ipyData.GetRecordID()
+        if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekCTGCount % recordID):
+            continue
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WeekCTGCount % recordID, 0)
+        syncRecordIDList.append(recordID)
+    if syncRecordIDList:
+        Sync_CoinToGoldCountInfo(curPlayer, syncRecordIDList)
+    return
+
+def OnMonth(curPlayer):
+    syncRecordIDList = []
+    ipyDataMgr = IpyGameDataPY.IPY_Data()
+    for i in xrange(ipyDataMgr.GetCTGCount()):
+        ipyData = ipyDataMgr.GetCTGByIndex(i)
+        recordID = ipyData.GetRecordID()
+        if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MonthCTGCount % recordID):
+            continue
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MonthCTGCount % recordID, 0)
+        syncRecordIDList.append(recordID)
+    if syncRecordIDList:
+        Sync_CoinToGoldCountInfo(curPlayer, syncRecordIDList)
+    return
+
 
 #// A1 23 查询充值次数 #tagCMQueryCoinToGoldCount
 #
@@ -373,10 +412,37 @@
             DataRecordPack.DR_CTGError(curPlayer, "Pay count limit today!todayBuyCount=%s" % todayBuyCount, addDRDict)
             return
         
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGGoodsBuyCount % recordID, totalBuyCount + 1)
-    addDRDict.update({"totalBuyCountUpd":(totalBuyCount + 1)})
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCount % recordID, todayBuyCount + 1)
-    addDRDict.update({"todayBuyCountUpd":(todayBuyCount + 1)})
+    weekBuyCountLimit = ipyData.GetWeekBuyCount()
+    weekBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekCTGCount % recordID)
+    if weekBuyCountLimit:
+        addDRDict.update({"weekBuyCountLimit":weekBuyCountLimit, "weekBuyCount":weekBuyCount})
+        if weekBuyCount >= weekBuyCountLimit:
+            DataRecordPack.DR_CTGError(curPlayer, "Pay count limit week!weekBuyCount=%s" % weekBuyCount, addDRDict)
+            return
+        
+    monthBuyCountLimit = ipyData.GetMonthBuyCount()
+    monthBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MonthCTGCount % recordID)
+    if monthBuyCountLimit:
+        addDRDict.update({"monthBuyCountLimit":monthBuyCountLimit, "monthBuyCount":monthBuyCount})
+        if monthBuyCount >= monthBuyCountLimit:
+            DataRecordPack.DR_CTGError(curPlayer, "Pay count limit month!monthBuyCount=%s" % monthBuyCount, addDRDict)
+            return
+        
+    totalBuyCountUpd = min(totalBuyCount + 1, ChConfig.Def_UpperLimit_DWord)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGGoodsBuyCount % recordID, totalBuyCountUpd)
+    addDRDict.update({"totalBuyCountUpd":totalBuyCountUpd})
+    
+    todayBuyCountUpd = min(todayBuyCount + 1, ChConfig.Def_UpperLimit_DWord)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCount % recordID, todayBuyCountUpd)
+    addDRDict.update({"todayBuyCountUpd":todayBuyCountUpd})
+    
+    weekBuyCountUpd = min(weekBuyCount + 1, ChConfig.Def_UpperLimit_DWord)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_WeekCTGCount % recordID, weekBuyCountUpd)
+    addDRDict.update({"weekBuyCountUpd":weekBuyCountUpd})
+    
+    monthBuyCountUpd = min(monthBuyCount + 1, ChConfig.Def_UpperLimit_DWord)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_MonthCTGCount % recordID, monthBuyCountUpd)
+    addDRDict.update({"monthBuyCountUpd":monthBuyCountUpd})
     
     giveItemList = GetCTGGiveItemList(ipyData)
     addGold = ipyData.GetGainGold() # 获得仙玉数
@@ -599,6 +665,8 @@
         countInfo.RecordID = recordID
         countInfo.TodayPayCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCount % recordID)
         countInfo.TotalPayCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % recordID)
+        countInfo.WeekPayCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_WeekCTGCount % recordID)
+        countInfo.MonthPayCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_MonthCTGCount % recordID)
         countInfoPack.CTGCountInfoList.append(countInfo)
     countInfoPack.RecordCount = len(countInfoPack.CTGCountInfoList)
     NetPackCommon.SendFakePack(curPlayer, countInfoPack)

--
Gitblit v1.8.0