From 787c076b2fdc73a11b9b76e2ea928f3da1f5873e Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 19 十二月 2019 16:35:02 +0800
Subject: [PATCH] 8359 【主干】活跃兑换

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyCeremony.py |   94 +++++++++++++++++++++++++++++++++++------------
 1 files changed, 70 insertions(+), 24 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyCeremony.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyCeremony.py
index d02802e..b6ba5d3 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyCeremony.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFairyCeremony.py
@@ -72,10 +72,11 @@
     if FairyCeremonyID == playerFairyCeremonyID:
         #GameWorld.DebugLog("仙界盛典活动ID不变,不处理!", curPlayer.GetPlayerID())
         return
+    ctgRMBTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCoinTotal) / 100
     actWorldLV = actFairyCeremonyInfo.get(ShareDefine.ActKey_WorldLV, 0)
     playerFCWorldLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCActionWorldLV)
-    GameWorld.DebugLog("仙界盛典重置! FairyCeremonyID=%s,playerCostRebateID=%s,state=%s,ActWorldLV=%s,playerFCWorldLV=%s" 
-                       % (FairyCeremonyID, playerFairyCeremonyID, state, actWorldLV, playerFCWorldLV), playerID)
+    GameWorld.DebugLog("仙界盛典重置! FairyCeremonyID=%s,playerCostRebateID=%s,state=%s,ActWorldLV=%s,playerFCWorldLV=%s,ctgRMBTotal=%s" 
+                       % (FairyCeremonyID, playerFairyCeremonyID, state, actWorldLV, playerFCWorldLV, ctgRMBTotal), playerID)
     
     # 未领取的奖励邮件发放
     __SendFairyCeremonyMail(curPlayer, playerFCWorldLV)
@@ -85,15 +86,17 @@
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCActionWorldLV, actWorldLV)
     #重置充值大礼记录
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCRechargeState, 0)
-    SyncFCRechargeInfo(curPlayer)
     #重置全民来嗨
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCPartyCurPoint, 0)
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCPartyAwardRecord, 0)
     for actid in ChConfig.PeoplePartyActIDList:
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCPartyCurCnt % actid, 0)
     SyncFCPartyInfo(curPlayer)
-    #重置消费
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCCostGold, 0)
+    #重置已充值RMB及烟花相关
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCCTGRMBTotal, ctgRMBTotal)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCFireworksBuyCount, 0)
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCFireworksScore, 0)
+    SyncFCRechargeInfo(curPlayer)
     return True
 
 def __SendFairyCeremonyMail(curPlayer, playerFCWorldLV):
@@ -201,6 +204,9 @@
     ## 通知充值大礼活动状态
     packData = ChPyNetSendPack.tagMCXJSDRecharge()
     packData.State = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCRechargeState)
+    packData.CTGTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCCTGRMBTotal)
+    packData.FireworksBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCFireworksBuyCount)
+    packData.FirewordsScore = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCFireworksScore)
     NetPackCommon.SendFakePack(curPlayer, packData)
     return
 
@@ -284,38 +290,78 @@
     return
 
 #################绝版降临##############################
-def AddFCCostGold(curPlayer, costType, costGold):
-    if costGold <= 0:
-        return
-    if costType in ChConfig.CostRebate_DisableType:
-        #GameWorld.DebugLog("不计入绝版降临消费的消费类型!costType=%s" % costType, curPlayer.GetPlayerID())
+
+def AddFCCTGRMB(curPlayer, ctgRMB):
+    ## 充值X元
+    if ctgRMB <= 0:
         return
     if not __IsAtFCAction():
         return
-    curCostGold = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCCostGold)
-    updCostGold = curCostGold + costGold
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCCostGold, updCostGold)
-    
-    if updCostGold < IpyGameDataPY.GetFuncCfg('CeremonyRankLimit'):
+    curRMBTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCCTGRMBTotal)
+    updRMBTotal = curRMBTotal + ctgRMB
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCCTGRMBTotal, updRMBTotal)
+    GameWorld.Log("更新仙界盛典充值RMB值: curRMBTotal=%s,ctgRMB=%s,updRMBTotal=%s" 
+                  % (curRMBTotal, ctgRMB, updRMBTotal), curPlayer.GetPlayerID())
+    SyncFCRechargeInfo(curPlayer)
+    return
+
+def OnBuyFireworks(curPlayer, itemIndex, clientBuyCount):
+    ## 购买烟花
+    if not __IsAtFCAction():
         return
     
-    #更新排行榜
-    PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_FCCostGold, updCostGold)
+    fireworksDict = IpyGameDataPY.GetFuncEvalCfg('CeremonyFireParty', 1, {})
+    worldLvNum = __GetFCWorldLVIndex(curPlayer, Def_FC_Fireworks)
+    canBuyIDList = fireworksDict.get(str(worldLvNum), []) #[普通烟花, 高级烟花]
+    if itemIndex not in canBuyIDList:
+        return
+    fireworksIndex = canBuyIDList.index(itemIndex)
+    AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_Fireworks, clientBuyCount)
+    if fireworksIndex == 1:
+        fireworksBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCFireworksBuyCount) + clientBuyCount
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCFireworksBuyCount, fireworksBuyCount)
+        GameWorld.DebugLog("更新玩家高级烟花已购买次数: clientBuyCount=%s,fireworksBuyCount=%s" 
+                           % (clientBuyCount, fireworksBuyCount), curPlayer.GetPlayerID())
+        
+    fireworksScoreList = IpyGameDataPY.GetFuncEvalCfg('CeremonyFireParty', 2) # [普通烟花积分, 高级烟花积分]
+    addScore = fireworksScoreList[fireworksIndex] * clientBuyCount
+    curFireworksScore = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCFireworksScore)
+    updFireworksScore = curFireworksScore + addScore
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FCFireworksScore, updFireworksScore)
     
-    GameWorld.DebugLog("玩家绝版降临消费活动: curCostGold=%s,costGold=%s,updCostGold=%s" 
-                       % (curCostGold, costGold, updCostGold), curPlayer.GetPlayerID())
+    billboardNeedScore = IpyGameDataPY.GetFuncCfg('CeremonyFireParty', 4)
+    if updFireworksScore >= billboardNeedScore:
+        #更新排行榜
+        GameWorld.DebugLog("玩家绝版降临积分排行更新: itemIndex=%s,clientBuyCount=%s,curFireworksScore=%s,addScore=%s,updFireworksScore=%s" 
+                           % (itemIndex, clientBuyCount, curFireworksScore, addScore, updFireworksScore), curPlayer.GetPlayerID())
+        PlayerBillboard.UpdatePlayerBillboard(curPlayer, ShareDefine.Def_BT_FCCostGold, updFireworksScore)
+    else:
+        GameWorld.DebugLog("玩家绝版降临烟花积分不足,无法上榜! updFireworksScore=%s < billboardNeedScore=%s" 
+                           % (updFireworksScore, billboardNeedScore), curPlayer.GetPlayerID())
+        
+    SyncFCRechargeInfo(curPlayer) 
     return
 
 #################烟花狂欢##############################
-def IsCanBuyFireworks(curPlayer, itemIndex):
+def IsCanBuyFireworks(curPlayer, itemIndex, clientBuyCount):
     ##当前是否可以买烟花
     if not __IsAtFCAction():
         GameWorld.Log('    烟花狂欢买烟花 活动未开启, 无法购买')
         return False
     fireworksDict = IpyGameDataPY.GetFuncEvalCfg('CeremonyFireParty', 1, {})
     worldLvNum = __GetFCWorldLVIndex(curPlayer, Def_FC_Fireworks)
-    canBuyID = fireworksDict.get(str(worldLvNum), 0)
-    if canBuyID != itemIndex:
-        GameWorld.Log('    烟花狂欢买烟花 当前可以买烟花为 %s, 无法购买 %s,worldLvNum=%s'%(canBuyID, itemIndex,worldLvNum), curPlayer.GetID())
+    canBuyIDList = fireworksDict.get(str(worldLvNum), []) #[普通烟花, 高级烟花]
+    if itemIndex not in canBuyIDList:
+        GameWorld.Log('    烟花狂欢买烟花 当前可以买烟花为 %s, 无法购买 %s,worldLvNum=%s'%(canBuyIDList, itemIndex,worldLvNum), curPlayer.GetID())
         return False
-    return True
\ No newline at end of file
+    #高级烟花需要判断充值的总额
+    buyOneNeedRMB = IpyGameDataPY.GetFuncCfg('CeremonyFireParty', 3) # 购买一个高级烟花所需充值RMB值,单位X元
+    if itemIndex == canBuyIDList[-1] and buyOneNeedRMB:
+        curRMBTotal = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCCTGRMBTotal)
+        fireworksBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FCFireworksBuyCount)
+        totalCanBuyCount = curRMBTotal / buyOneNeedRMB
+        if (fireworksBuyCount + clientBuyCount) > totalCanBuyCount:
+            GameWorld.Log('    烟花狂欢买烟花  高级烟花所需重置RMB不足, 无法购买! curRMBTotal=%s,totalCanBuyCount=%s < fireworksBuyCount=%s + clientBuyCount=%s' 
+                          % (curRMBTotal, totalCanBuyCount, fireworksBuyCount, clientBuyCount), curPlayer.GetID())
+            return False
+    return True

--
Gitblit v1.8.0