From e80c7791aaccb10fc70c9e40abe61dccc75fa305 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 07 五月 2019 20:57:39 +0800
Subject: [PATCH] 6459 【后端】【2.0】缥缈仙域开发单(优化跨服掉线重上后目标线路已关闭时跨服标记重置逻辑)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSpringSale.py |   50 +++++++++++++++++++++++++++-----------------------
 1 files changed, 27 insertions(+), 23 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 68735b3..811a4f3 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSpringSale.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerSpringSale.py
@@ -25,23 +25,18 @@
 import GameWorld
 import ChConfig
 
-def GetShopTypeList(cfgID, dayIndex):
+def GetShopTypeList(cfgID, dayIndex, woldLV):
     if cfgID == None or dayIndex == None:
         return []
     ipyData = IpyGameDataPY.GetIpyGameData("ActSpringSale", cfgID)
     if not ipyData:
         return []
-    shopTypeList = ipyData.GetShopTypeList()
+    shopTypeList = GameWorld.GetDictValueByRangeKey(ipyData.GetShopTypeList(), woldLV, [])
     todayShopType = shopTypeList[-1] if dayIndex >= len(shopTypeList) else shopTypeList[dayIndex]
     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():
@@ -63,15 +58,16 @@
     actID = actInfo.get(ShareDefine.ActKey_ID, 0)
     state = actInfo.get(ShareDefine.ActKey_State, 0)
     cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
-    
+    woldLV = actInfo.get(ShareDefine.ActKey_WorldLV, 0)
     playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SpringSaleID) # 玩家身上的活动ID
-    
+    isReset = False
     if actID != playerActID:
-        shopTypeList = GetShopTypeList(cfgID, actInfo.get(ShareDefine.ActKey_DayIndex, 0))
+        isReset = True
+        shopTypeList = GetShopTypeList(cfgID, actInfo.get(ShareDefine.ActKey_DayIndex, 0), woldLV)
         FunctionNPCCommon.ResetShopItemBuyCountByShopType(curPlayer, shopTypeList)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SpringSaleID, actID)
         PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SpringSaleMailState, 0)
-        Sync_SpringSaleActionInfo(curPlayer)
+        #Sync_SpringSaleActionInfo(curPlayer)
         GameWorld.DebugLog("限时特惠重置! actID=%s,playerActID=%s,state=%s,shopTypeList=%s" % (actID, playerActID, state, shopTypeList), playerID)
     else:
         GameWorld.DebugLog("限时特惠活动ID不变,不处理!", playerID)
@@ -83,7 +79,10 @@
             PlayerControl.SendMailByKey(springSaleIpyData.GetMailKey(), [playerID], springSaleIpyData.GetMailItemPrize())
             PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SpringSaleMailState, state)
             GameWorld.DebugLog("    发送新限时特惠邮件提醒! state=%s,playerMailState=%s" % (state, playerMailState), playerID)
-    return True
+            
+    if cfgID:
+        Sync_SpringSaleActionInfo(curPlayer)
+    return isReset
 
 def Sync_SpringSaleActionInfo(curPlayer):
     ## 通知限时特惠活动信息
@@ -91,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), actInfo.get(ShareDefine.ActKey_WorldLV, 0))
+    if not shopTypeList:
         return
     
     springSaleIpyData = IpyGameDataPY.GetIpyGameData("ActSpringSale", cfgID)
@@ -109,10 +110,11 @@
     if len(startTimeList) != len(endTimeList):
         GameWorld.ErrLog("限时特惠开关时间时分配置错误!cfgID=%s" % cfgID)
         return
-    
+    job = curPlayer.GetJob()
+    openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
     packInfo = ChPyNetSendPack.tagMCSpringSaleInfo()
-    packInfo.StartDate = springSaleIpyData.GetStartDate()
-    packInfo.EndtDate = springSaleIpyData.GetEndDate()
+    packInfo.StartDate = GameWorld.GetOperationActionDateStr(springSaleIpyData.GetStartDate(), openServerDay)
+    packInfo.EndtDate = GameWorld.GetOperationActionDateStr(springSaleIpyData.GetEndDate(), openServerDay)
     packInfo.AdvanceMinutes = springSaleIpyData.GetAdvanceMinutes()
     packInfo.ActivityTime = []
     for i, startTime in enumerate(startTimeList):
@@ -143,12 +145,14 @@
             giftBag.ItemInfo = []
             itemList = [[itemIpyData.GetItemID(), itemIpyData.GetItemCnt(), itemIpyData.GetIsBind()]]
             itemList += itemIpyData.GetItemListEx()
+            jobItemList = itemIpyData.GetJobItem()
             for itemID, itemCount, isBind in itemList:
                 item = ChPyNetSendPack.tagMCSpringSaleItem()
-                item.ItemID = itemID
+                jobItemID = FunctionNPCCommon.GetShopJobItem(job, itemID, jobItemList)
+                item.ItemID = jobItemID
                 item.ItemCount = itemCount
                 item.IsBind = isBind
-                item.IsMainItem = int(itemID == itemIpyData.GetMainItemID())
+                item.IsMainItem = int(itemID == FunctionNPCCommon.GetShopJobItem(job, itemIpyData.GetMainItemID(), jobItemList))
                 giftBag.ItemInfo.append(item)
             giftBag.GiftItemCount = len(giftBag.ItemInfo)
             shop.GiftbagInfo.append(giftBag)

--
Gitblit v1.8.0