From d79ccd070582a1f297e4ea9f63a218fab675bcb6 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期二, 21 五月 2019 14:05:46 +0800
Subject: [PATCH] 6501 新增任务接口

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py |   80 ++++++++++++++++++++++++++++++++++++---
 1 files changed, 73 insertions(+), 7 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 33c2a86..83afe91 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
@@ -44,8 +44,14 @@
 import ShareDefine
 import PlayerFlashGiftbag
 import PlayerFairyCeremony
+import PlayerNewFairyCeremony
 import PlayerGoldGift
+import PlayerActTotalRecharge
+import OpenServerCampaign
+import PlayerWeekParty
 import ItemCommon
+
+import time
 
 #---------------------------------------------------------------------
 #注意: GetChangeCoinPointTotal 充值点和赠送点总和
@@ -55,8 +61,55 @@
 def GetCoinRate(): return IpyGameDataPY.GetFuncCfg("PayRMB")
 
 def OnLogin(curPlayer):
+    if not DoResetCTGCountByTime(curPlayer):
+        Sync_CoinToGoldCountInfo(curPlayer)
+    return
+
+def DoResetCTGCountByTime(curPlayer):
+    # 重置充值次数
+    ctgResetTimeYMD = IpyGameDataPY.GetFuncCfg("CTG", 1)
+    if not ctgResetTimeYMD:
+        return
+    if not isinstance(ctgResetTimeYMD, int):
+        GameWorld.ErrLog("充值重置时间配置必须是数值格式,不能包含符号!")
+        return
+    curTime = int(time.time())
+    #playerID = curPlayer.GetPlayerID()
+    resetTime = GameWorld.ChangeTimeStrToNum(str(ctgResetTimeYMD), "%Y%m%d")
+    if curTime < resetTime:
+        #GameWorld.DebugLog("还未到达充值充值次数时间!curTime=%s < resetTime=%s" % (curTime, resetTime), playerID)
+        return
+    playerResetTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGCountResetTime)
+    if playerResetTime == resetTime:
+        #GameWorld.DebugLog("已经重置过充值次数!resetTime=%s" % resetTime, playerID)
+        return
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGCountResetTime, resetTime)
+    
+    DoResetCTGCount(curPlayer, ctgResetTimeYMD)
+    return True
+
+def DoResetCTGCount(curPlayer, resetEvent):
+    # 重置充值次数
+    
+    playerID = curPlayer.GetPlayerID()
+    ipyDataMgr = IpyGameDataPY.IPY_Data()
+    for i in xrange(ipyDataMgr.GetCTGCount()):
+        ipyData = ipyDataMgr.GetCTGByIndex(i)
+        recordID = ipyData.GetRecordID()
+        totalBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % recordID)
+        todayBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCount % recordID)
+        if not totalBuyCount and not todayBuyCount:
+            continue
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGGoodsBuyCount % recordID, 0)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCount % recordID, 0)
+        drDict = {"PlayerID":curPlayer.GetPlayerID(),"AccID":curPlayer.GetAccID(), "ResetEvent":resetEvent,
+                  "totalBuyCount":totalBuyCount, "todayBuyCount":todayBuyCount, "recordID":recordID}
+        DataRecordPack.SendEventPack("ResetCTGCount", drDict, curPlayer)
+        GameWorld.Log("重置充值次数: resetEvent=%s,recordID=%s,totalBuyCount=%s,todayBuyCount=%s" 
+                      % (resetEvent, recordID, totalBuyCount, todayBuyCount), playerID)
     Sync_CoinToGoldCountInfo(curPlayer)
     return
+
 
 def OnDay(curPlayer):
     syncRecordIDList = []
@@ -122,6 +175,9 @@
     orderInfo = chargeInfo.GetOrderInfo() # 商品编号
     orderID = chargeInfo.GetOrderID() #订单号,兑换成功后清除
     isAddBourseMoney = chargeInfo.GetIsAddBourseMoney()
+    if orderID:
+        curPlayer.SendDBFinishRecharge(orderID)
+        
     appID = chargeInfo.GetAppID()
     if not appID:
         appID = GameWorld.GetPlayerPlatform(curPlayer)
@@ -142,13 +198,13 @@
         DataRecordPack.DR_CTGError(curPlayer, "The orderCoin is not equal to the ipyData's RMB(%s)!" % payRMBNum, addDRDict)
         return
     
-    addGold, prizeGold, giveItemList = 0, 0, []
+    addGold, prizeGold, giveItemList, notifyMark = 0, 0, [], ''
     
     if ipyData.GetCTGID():
         ctgResultInfo = __GetCTGInfoByID(curPlayer, chargeInfo, ipyData.GetCTGID(), eventName, addDRDict, isAddBourseMoney)
         if not ctgResultInfo:
             return
-        addGold, prizeGold, giveItemList = ctgResultInfo
+        addGold, prizeGold, giveItemList, notifyMark = ctgResultInfo
         
     elif ipyData.GetGiftbagID():
         if not PlayerFlashGiftbag.OnPlayerOrderGiftbag(curPlayer, [ipyData.GetGiftbagID()], addDRDict):
@@ -158,11 +214,11 @@
         DataRecordPack.DR_CTGError(curPlayer, "The orderInfo is useless!", addDRDict)
         return
     
-    DoCTGLogic(curPlayer, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict)
+    DoCTGLogic(curPlayer, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict, notifyMark)
     
     #充值成功主动查询一次,无充值数量就不会继续查询
     if orderID:
-        curPlayer.SendDBFinishRecharge(orderID)
+        #curPlayer.SendDBFinishRecharge(orderID)
         # 充值成功回报客户端,SDK等会用到
         Sync_CoinToGoldReport(curPlayer, orderID, orderCoin)
         
@@ -191,6 +247,7 @@
     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
@@ -198,9 +255,9 @@
     addDRDict.update({"totalBuyCount":(totalBuyCount + 1)})
     
     Sync_CoinToGoldCountInfo(curPlayer, [recordID])
-    return addGold, prizeGold, giveItemList
+    return addGold, prizeGold, giveItemList, notifyMark
 
-def DoCTGLogic(curPlayer, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict):
+def DoCTGLogic(curPlayer, orderCoin, addGold, prizeGold, giveItemList, isAddBourseMoney, eventName, addDRDict, notifyMark=''):
     goldBefore = curPlayer.GetGold()
     bourseMoneyBefore = PlayerControl.GetMoney(curPlayer, ShareDefine.TYPE_Price_BourseMoney)
     
@@ -217,8 +274,11 @@
             PlayerControl.SendMailByKey("", [curPlayer.GetPlayerID()], giveItemList)
         else:
             for itemID, itemCount, isBind in giveItemList:
-                ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isBind, [IPY_GameWorld.rptItem], 
+                ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, 0, [IPY_GameWorld.rptItem], 
                                              event=[ChConfig.ItemGive_CTG, True, addDRDict])
+        if notifyMark:
+            mainItemID = giveItemList[0][0]
+            PlayerControl.WorldNotify(0, notifyMark, [curPlayer.GetName(), mainItemID, ''])
                 
     addVIPExp = int(orderCoin / 100 * GetCoinRate())
     PlayerVip.AddVIPExp(curPlayer, addVIPExp)
@@ -238,7 +298,13 @@
     #---充值成功后逻辑---
     #仙界盛典-充值大礼
     PlayerFairyCeremony.OnFCRecharge(curPlayer)
+    PlayerNewFairyCeremony.OnFCRecharge(curPlayer)
     PlayerGoldGift.DayChargeRedPackAward(curPlayer)
+    #累积充值X元
+    PlayerActTotalRecharge.AddTotalRechargeGold(curPlayer, orderCoin/100)
+    #开服活动
+    OpenServerCampaign.AddOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_Recharge, orderCoin)
+    PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_Recharge, addVIPExp)
     GameWorld.Log("Billing: eventName=%s, %s" % (eventName, addDRDict), curPlayer.GetPlayerID())
     return
 

--
Gitblit v1.8.0