From d9c3ea7e97feee98e9cf00ea68c3d8e47af43b47 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期五, 21 九月 2018 11:21:51 +0800
Subject: [PATCH] 3357 优化脱机战斗表现-- 190级以下脱机挂玩家,6个中随机5个隐身,前期太多玩家

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSpringSale.py |   58 +++++++++++++++++++++++++++++++++-------------------------
 1 files changed, 33 insertions(+), 25 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSpringSale.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSpringSale.py
index 3526621..d7bee14 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSpringSale.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSpringSale.py
@@ -36,12 +36,7 @@
     return todayShopType
 
 def OnPlayerLogin(curPlayer):
-    isReset = __CheckPlayerSpringSaleAction(curPlayer)
-    if not isReset:
-        actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_SpringSale, {})
-        # 活动中同步活动信息
-        if actInfo.get(ShareDefine.ActKey_State):
-            Sync_SpringSaleActionInfo(curPlayer)
+    __CheckPlayerSpringSaleAction(curPlayer)
     return
 
 def RefreshSpringSaleActionInfo():
@@ -62,22 +57,32 @@
     actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_SpringSale, {})
     actID = actInfo.get(ShareDefine.ActKey_ID, 0)
     state = actInfo.get(ShareDefine.ActKey_State, 0)
+    cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
     
     playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SpringSaleID) # 玩家身上的活动ID
-    
-    # 活动ID 相同的话不处理
-    if actID == playerActID:
-        GameWorld.DebugLog("限时特惠活动ID不变,不处理!", curPlayer.GetPlayerID())
-        return
-    
-    shopTypeList = GetShopTypeList(actInfo.get(ShareDefine.ActKey_CfgID, 0), actInfo.get(ShareDefine.ActKey_DayIndex, 0))
-    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SpringSaleID, actID)
-    FunctionNPCCommon.ResetShopItemBuyCountByShopType(curPlayer, shopTypeList)
-    
-    GameWorld.DebugLog("限时特惠重置! actID=%s,playerActID=%s,state=%s,shopTypeList=%s" % (actID, playerActID, state, shopTypeList), playerID)
-    
-    Sync_SpringSaleActionInfo(curPlayer)
-    return True
+    isReset = False
+    if actID != playerActID:
+        isReset = True
+        shopTypeList = GetShopTypeList(cfgID, actInfo.get(ShareDefine.ActKey_DayIndex, 0))
+        FunctionNPCCommon.ResetShopItemBuyCountByShopType(curPlayer, shopTypeList)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SpringSaleID, actID)
+        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SpringSaleMailState, 0)
+        #Sync_SpringSaleActionInfo(curPlayer)
+        GameWorld.DebugLog("限时特惠重置! actID=%s,playerActID=%s,state=%s,shopTypeList=%s" % (actID, playerActID, state, shopTypeList), playerID)
+    else:
+        GameWorld.DebugLog("限时特惠活动ID不变,不处理!", playerID)
+        
+    playerMailState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SpringSaleMailState) # 玩家身上的活动提醒邮件状态
+    if actID and state and state != playerMailState:
+        springSaleIpyData = IpyGameDataPY.GetIpyGameData("ActSpringSale", cfgID)
+        if springSaleIpyData and springSaleIpyData.GetMailKey() and curPlayer.GetLV() >= springSaleIpyData.GetLVLimit():
+            PlayerControl.SendMailByKey(springSaleIpyData.GetMailKey(), [playerID], springSaleIpyData.GetMailItemPrize())
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SpringSaleMailState, state)
+            GameWorld.DebugLog("    发送新限时特惠邮件提醒! state=%s,playerMailState=%s" % (state, playerMailState), playerID)
+            
+    if cfgID:
+        Sync_SpringSaleActionInfo(curPlayer)
+    return isReset
 
 def Sync_SpringSaleActionInfo(curPlayer):
     ## 通知限时特惠活动信息
@@ -85,13 +90,15 @@
     if not actInfo:
         return
     
-    if not actInfo.get(ShareDefine.ActKey_State):
-        return
+    #需要提前通知,所以去掉此限制
+    #if not actInfo.get(ShareDefine.ActKey_State):
+    #    return
     
     cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
-    shopTypeList = GetShopTypeList(actInfo.get(ShareDefine.ActKey_CfgID, 0), actInfo.get(ShareDefine.ActKey_DayIndex, 0))
-    
-    if not cfgID or not shopTypeList:
+    if not cfgID:
+        return
+    shopTypeList = GetShopTypeList(cfgID, actInfo.get(ShareDefine.ActKey_DayIndex, 0))
+    if not shopTypeList:
         return
     
     springSaleIpyData = IpyGameDataPY.GetIpyGameData("ActSpringSale", cfgID)
@@ -107,6 +114,7 @@
     packInfo = ChPyNetSendPack.tagMCSpringSaleInfo()
     packInfo.StartDate = springSaleIpyData.GetStartDate()
     packInfo.EndtDate = springSaleIpyData.GetEndDate()
+    packInfo.AdvanceMinutes = springSaleIpyData.GetAdvanceMinutes()
     packInfo.ActivityTime = []
     for i, startTime in enumerate(startTimeList):
         timeInfo = ChPyNetSendPack.tagMCSpringSaleTime()

--
Gitblit v1.8.0