From 26534f375db82568cf5e29e74fd5a58cf71ce20f Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 07 一月 2020 15:49:41 +0800
Subject: [PATCH] 8360 【主干】仙界秘境修改(改为同步总经验,含评级附加经验)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py |   99 ++++++++++++++++++++++++++++++++++++++++++-------
 1 files changed, 84 insertions(+), 15 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 83afe91..6a42394 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
@@ -49,6 +49,7 @@
 import PlayerActTotalRecharge
 import OpenServerCampaign
 import PlayerWeekParty
+import PlayerGoldInvest
 import ItemCommon
 
 import time
@@ -63,6 +64,8 @@
 def OnLogin(curPlayer):
     if not DoResetCTGCountByTime(curPlayer):
         Sync_CoinToGoldCountInfo(curPlayer)
+    if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DayFreeGoldGiftState):
+        Sync_DayFreeGoldGiftState(curPlayer)
     return
 
 def DoResetCTGCountByTime(curPlayer):
@@ -96,6 +99,8 @@
     for i in xrange(ipyDataMgr.GetCTGCount()):
         ipyData = ipyDataMgr.GetCTGByIndex(i)
         recordID = ipyData.GetRecordID()
+        if not ipyData.GetCanResetBuyCount():
+            continue
         totalBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % recordID)
         todayBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCount % recordID)
         if not totalBuyCount and not todayBuyCount:
@@ -112,6 +117,8 @@
 
 
 def OnDay(curPlayer):
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCoinTotal, 0)
+    
     syncRecordIDList = []
     ipyDataMgr = IpyGameDataPY.IPY_Data()
     for i in xrange(ipyDataMgr.GetCTGCount()):
@@ -125,6 +132,10 @@
         syncRecordIDList.append(recordID)
     if syncRecordIDList:
         Sync_CoinToGoldCountInfo(curPlayer, syncRecordIDList)
+        
+    if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DayFreeGoldGiftState):
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DayFreeGoldGiftState, 0)
+        Sync_DayFreeGoldGiftState(curPlayer)
     return
 
 ## 创角赠送
@@ -214,7 +225,7 @@
         DataRecordPack.DR_CTGError(curPlayer, "The orderInfo is useless!", addDRDict)
         return
     
-    DoCTGLogic(curPlayer, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict, notifyMark)
+    DoCTGLogic(curPlayer, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict, notifyMark, ipyData)
     
     #充值成功主动查询一次,无充值数量就不会继续查询
     if orderID:
@@ -233,31 +244,42 @@
         DataRecordPack.DR_CTGError(curPlayer, "Can not find CTG ipyData!", addDRDict)
         return
     
-    dailyBuyCount = ipyData.GetDailyBuyCount()
     addDRDict.update({"recordID":recordID})
+    
+    totalBuyCountLimit = ipyData.GetTotalBuyCount()
+    totalBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % recordID)
+    if totalBuyCountLimit:
+        addDRDict.update({"totalBuyCountLimit":totalBuyCountLimit, "totalBuyCount":totalBuyCount})
+        if totalBuyCount >= totalBuyCountLimit:
+            DataRecordPack.DR_CTGError(curPlayer, "Pay count limit total!totalBuyCount=%s" % totalBuyCount, addDRDict)
+            return        
+    
+    dailyBuyCountLimit = ipyData.GetDailyBuyCount()
     todayBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCount % recordID)
-    if dailyBuyCount:
-        addDRDict.update({"dailyCanBuyCount":dailyBuyCount, "todayBuyCount":todayBuyCount})
-        if todayBuyCount >= dailyBuyCount:
+    if dailyBuyCountLimit:
+        addDRDict.update({"dailyBuyCountLimit":dailyBuyCountLimit, "todayBuyCount":todayBuyCount})
+        if todayBuyCount >= dailyBuyCountLimit:
             DataRecordPack.DR_CTGError(curPlayer, "Pay count limit today!todayBuyCount=%s" % todayBuyCount, addDRDict)
             return
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCount % recordID, todayBuyCount + 1)
-    
+        
+    if totalBuyCountLimit:
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGGoodsBuyCount % recordID, totalBuyCount + 1)
+        addDRDict.update({"totalBuyCountUpd":(totalBuyCount + 1)})
+    if dailyBuyCountLimit:
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCount % recordID, todayBuyCount + 1)
+        addDRDict.update({"todayBuyCountUpd":(todayBuyCount + 1)})
+        
     giveItemList = ipyData.GetGainItemList()
     addGold = ipyData.GetGainGold() # 获得仙玉数
     gainGoldPrize = ipyData.GetGainGoldPrize() # 赠送仙玉数,首次充值赠送仙玉时,此仙玉不给
     firstGoldPrize = ipyData.GetFirstGoldPrize() # 首次充值赠送的仙玉
     notifyMark = ipyData.GetNotifyMark()
-    totalBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % recordID)
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGGoodsBuyCount % recordID, totalBuyCount + 1)
     prizeGold = firstGoldPrize if (not totalBuyCount and firstGoldPrize) else gainGoldPrize
-    
-    addDRDict.update({"totalBuyCount":(totalBuyCount + 1)})
     
     Sync_CoinToGoldCountInfo(curPlayer, [recordID])
     return addGold, prizeGold, giveItemList, notifyMark
 
-def DoCTGLogic(curPlayer, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict, notifyMark=''):
+def DoCTGLogic(curPlayer, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict, notifyMark='', ipyData=None):
     goldBefore = curPlayer.GetGold()
     bourseMoneyBefore = PlayerControl.GetMoney(curPlayer, ShareDefine.TYPE_Price_BourseMoney)
     
@@ -287,10 +309,13 @@
     curPlayer.SetChangeCoinPointTotal(changeCoinPointBefore + orderCoin, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldTry, 0)
     
+    todayCTGCoinTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCoinTotal) + orderCoin
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCoinTotal, todayCTGCoinTotal)
+    
     goldAfter = curPlayer.GetGold()
     changeCoinPointAfter = curPlayer.GetChangeCoinPointTotal()
     bourseMoneyAfter = PlayerControl.GetMoney(curPlayer, ShareDefine.TYPE_Price_BourseMoney)
-    addDRDict.update({"gold":[goldBefore, goldAfter], "changeCoinPoint":[changeCoinPointBefore, changeCoinPointAfter], 
+    addDRDict.update({"gold":[goldBefore, goldAfter], "changeCoinPoint":[changeCoinPointBefore, changeCoinPointAfter], "todayCTGCoinTotal":todayCTGCoinTotal,
                       "bourseMoney":[bourseMoneyBefore, bourseMoneyAfter], "addGold":addGold, "prizeGold":prizeGold, "giveItemList":giveItemList})
     
     DataRecordPack.DR_CTGOK(curPlayer, addDRDict)
@@ -299,12 +324,17 @@
     #仙界盛典-充值大礼
     PlayerFairyCeremony.OnFCRecharge(curPlayer)
     PlayerNewFairyCeremony.OnFCRecharge(curPlayer)
-    PlayerGoldGift.DayChargeRedPackAward(curPlayer)
+    PlayerGoldGift.OnPlayerChargeGold(curPlayer, addGold)
     #累积充值X元
     PlayerActTotalRecharge.AddTotalRechargeGold(curPlayer, orderCoin/100)
+    PlayerFairyCeremony.AddFCCTGRMB(curPlayer, orderCoin/100)
+    PlayerNewFairyCeremony.AddFCCostGold(curPlayer, orderCoin/100)
     #开服活动
-    OpenServerCampaign.AddOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_Recharge, orderCoin)
+    #OpenServerCampaign.AddOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_Recharge, orderCoin)
     PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Recharge, addVIPExp)
+    #投资
+    if ipyData:
+        PlayerGoldInvest.InvestByCTG(curPlayer, ipyData.GetCTGID()) 
     GameWorld.Log("Billing: eventName=%s, %s" % (eventName, addDRDict), curPlayer.GetPlayerID())
     return
 
@@ -398,3 +428,42 @@
     NetPackCommon.SendFakePack(curPlayer, countInfoPack)
     return
 
+## ---------- 每日免费直购礼包 ----------------
+
+def OnGetDayFreeGoldGift(curPlayer):
+    ''' 领取每日免费直购礼包
+    '''
+    
+    isGet = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DayFreeGoldGiftState)
+    if isGet:
+        #GameWorld.DebugLog("已经领取过每日免费直购礼包!")
+        return
+    
+    rewardItemList = IpyGameDataPY.GetFuncEvalCfg("DayFreeGoldGift", 1)
+    if not rewardItemList:
+        return
+    
+    needSpace = len(rewardItemList)
+    packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
+    if needSpace > packSpace:
+        PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
+        return
+    
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DayFreeGoldGiftState, 1)
+    
+    # 给物品
+    isAuctionItem = False
+    for itemID, itemCount in rewardItemList:        
+        ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, [IPY_GameWorld.rptItem])
+        
+    # 通知客户端
+    Sync_DayFreeGoldGiftState(curPlayer)
+    return
+
+def Sync_DayFreeGoldGiftState(curPlayer):
+    clientPack = ChPyNetSendPack.tagMCDayFreeGoldGiftState()
+    clientPack.DayFreeGoldGiftState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DayFreeGoldGiftState)
+    NetPackCommon.SendFakePack(curPlayer, clientPack)
+    return
+
+## ------------------------------------------

--
Gitblit v1.8.0