From d7e71730d8bd7a82c7952abad45ac3d46b7471ad Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期四, 22 十一月 2018 10:34:22 +0800
Subject: [PATCH] 4743 【1.3】【后端】神秘限购开发

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py           |   50 +++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py                            |  108 +++++++++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_IceLode.py |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py                       |    4 
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py                                                 |  108 +++++++++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                                   |    1 
 6 files changed, 270 insertions(+), 3 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index d3fadfd..f35346d 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -18663,6 +18663,114 @@
 
 
 #------------------------------------------------------
+# A8 06 通知神秘限购商品时间 #tagMCMysticalShopTimeInfo
+
+class  tagMCMysticalShopTime(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("GoodsID", c_int),    # 商品ID
+                  ("StartTime", c_int),    # 开卖时间
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        return
+
+    def ReadData(self, stringData, _pos=0, _len=0):
+        self.Clear()
+        memmove(addressof(self), stringData[_pos:], self.GetLength())
+        return _pos + self.GetLength()
+
+    def Clear(self):
+        self.GoodsID = 0
+        self.StartTime = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagMCMysticalShopTime)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A8 06 通知神秘限购商品时间 //tagMCMysticalShopTimeInfo:
+                                GoodsID:%d,
+                                StartTime:%d
+                                '''\
+                                %(
+                                self.GoodsID,
+                                self.StartTime
+                                )
+        return DumpString
+
+
+class  tagMCMysticalShopTimeInfo(Structure):
+    Head = tagHead()
+    Count = 0    #(WORD Count)// 商品数
+    ShopTimeList = list()    #(vector<tagMCMysticalShopTime> ShopTimeList)// 商品开卖信息
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xA8
+        self.Head.SubCmd = 0x06
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.Count,_pos = CommFunc.ReadWORD(_lpData, _pos)
+        for i in range(self.Count):
+            temShopTimeList = tagMCMysticalShopTime()
+            _pos = temShopTimeList.ReadData(_lpData, _pos)
+            self.ShopTimeList.append(temShopTimeList)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xA8
+        self.Head.SubCmd = 0x06
+        self.Count = 0
+        self.ShopTimeList = list()
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 2
+        for i in range(self.Count):
+            length += self.ShopTimeList[i].GetLength()
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteWORD(data, self.Count)
+        for i in range(self.Count):
+            data = CommFunc.WriteString(data, self.ShopTimeList[i].GetLength(), self.ShopTimeList[i].GetBuffer())
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                Count:%d,
+                                ShopTimeList:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.Count,
+                                "..."
+                                )
+        return DumpString
+
+
+m_NAtagMCMysticalShopTimeInfo=tagMCMysticalShopTimeInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCMysticalShopTimeInfo.Head.Cmd,m_NAtagMCMysticalShopTimeInfo.Head.SubCmd))] = m_NAtagMCMysticalShopTimeInfo
+
+
+#------------------------------------------------------
 # A8 10 通知获得物品 #tagMCNotifyUseItemGetItem
 
 class  tagMCNotifyUseItemGetItem(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index a09d95a..c1710c2 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3432,6 +3432,7 @@
 Def_PDict_CollNpcBuyTime = "CollNpcBuyTime_%s"   # 采集NPC功能号对应每日购买采集次数,%sNPC功能号
 Def_PDict_CollNpcIDCollTime = "CollNpcIDCollTime_%s"   # 采集NPCID对应每日对应采集次数,%sNPCID
 Def_PDict_ShopItemDayBuyCnt = "ShopItemDayBuyCnt_%s"   # 商店NPC商品已购买次数,itemIndex
+Def_PDict_ShopItemStartTime = "ShopItemStartTime_%s"   # 神秘限购商品开卖时间,itemIndex
 Def_PDict_ShopItemBuyCnt = "ShopItemBuyCnt_%s_%s"   # 自定义商品已购买次数,(shopID, itemIndex)
 Def_PDict_ShopItemOpenState = "ShopItemOpenState_%s_%s"   # 自定义神秘商店物品开启状态,(shopID, keyNum)
 Def_PDict_TimeShopRefreshCnt = "TimeShopRefreshCnt_%s"   # 自定义神秘商店已手动刷新次数,(shopID)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index d3fadfd..f35346d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -18663,6 +18663,114 @@
 
 
 #------------------------------------------------------
+# A8 06 通知神秘限购商品时间 #tagMCMysticalShopTimeInfo
+
+class  tagMCMysticalShopTime(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("GoodsID", c_int),    # 商品ID
+                  ("StartTime", c_int),    # 开卖时间
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        return
+
+    def ReadData(self, stringData, _pos=0, _len=0):
+        self.Clear()
+        memmove(addressof(self), stringData[_pos:], self.GetLength())
+        return _pos + self.GetLength()
+
+    def Clear(self):
+        self.GoodsID = 0
+        self.StartTime = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagMCMysticalShopTime)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// A8 06 通知神秘限购商品时间 //tagMCMysticalShopTimeInfo:
+                                GoodsID:%d,
+                                StartTime:%d
+                                '''\
+                                %(
+                                self.GoodsID,
+                                self.StartTime
+                                )
+        return DumpString
+
+
+class  tagMCMysticalShopTimeInfo(Structure):
+    Head = tagHead()
+    Count = 0    #(WORD Count)// 商品数
+    ShopTimeList = list()    #(vector<tagMCMysticalShopTime> ShopTimeList)// 商品开卖信息
+    data = None
+
+    def __init__(self):
+        self.Clear()
+        self.Head.Cmd = 0xA8
+        self.Head.SubCmd = 0x06
+        return
+
+    def ReadData(self, _lpData, _pos=0, _Len=0):
+        self.Clear()
+        _pos = self.Head.ReadData(_lpData, _pos)
+        self.Count,_pos = CommFunc.ReadWORD(_lpData, _pos)
+        for i in range(self.Count):
+            temShopTimeList = tagMCMysticalShopTime()
+            _pos = temShopTimeList.ReadData(_lpData, _pos)
+            self.ShopTimeList.append(temShopTimeList)
+        return _pos
+
+    def Clear(self):
+        self.Head = tagHead()
+        self.Head.Clear()
+        self.Head.Cmd = 0xA8
+        self.Head.SubCmd = 0x06
+        self.Count = 0
+        self.ShopTimeList = list()
+        return
+
+    def GetLength(self):
+        length = 0
+        length += self.Head.GetLength()
+        length += 2
+        for i in range(self.Count):
+            length += self.ShopTimeList[i].GetLength()
+
+        return length
+
+    def GetBuffer(self):
+        data = ''
+        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+        data = CommFunc.WriteWORD(data, self.Count)
+        for i in range(self.Count):
+            data = CommFunc.WriteString(data, self.ShopTimeList[i].GetLength(), self.ShopTimeList[i].GetBuffer())
+        return data
+
+    def OutputString(self):
+        DumpString = '''
+                                Head:%s,
+                                Count:%d,
+                                ShopTimeList:%s
+                                '''\
+                                %(
+                                self.Head.OutputString(),
+                                self.Count,
+                                "..."
+                                )
+        return DumpString
+
+
+m_NAtagMCMysticalShopTimeInfo=tagMCMysticalShopTimeInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCMysticalShopTimeInfo.Head.Cmd,m_NAtagMCMysticalShopTimeInfo.Head.SubCmd))] = m_NAtagMCMysticalShopTimeInfo
+
+
+#------------------------------------------------------
 # A8 10 通知获得物品 #tagMCNotifyUseItemGetItem
 
 class  tagMCNotifyUseItemGetItem(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
index 7476410..90fbf67 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py
@@ -199,7 +199,7 @@
             PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SuperGiftHasOpen, 1)
             
     
-    
+    SyncMysticalShopInfo(curPlayer)
     SyncShopItemTodayBuyCount(curPlayer)
     SyncSuperGiftInfo(curPlayer)
     return
@@ -280,6 +280,49 @@
         syncIndexList.append(shopItem.GetID())
     if syncIndexList:
         SyncShopItemTodayBuyCount(curPlayer, syncIndexList, True)
+    return
+
+def MysticalShopOpen(curPlayer, befLV, aftLV):
+    ##神秘限购开启
+    ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('Store', {'ShopType':16}, True)
+    if not ipyDataList:
+        return
+    curTime = int(time.time())
+    syncGoodsList = []
+    for ipyData in ipyDataList:
+        limitLV = ipyData.GetLimitLV()
+        if befLV < limitLV and aftLV >= limitLV:
+            goodsID = ipyData.GetID()
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ShopItemStartTime % goodsID, curTime)
+            syncGoodsList.append(goodsID)
+            GameWorld.DebugLog('神秘限购商品%s 开卖'%goodsID, curPlayer.GetID())
+    if syncGoodsList:
+        SyncMysticalShopInfo(curPlayer)
+    return
+
+def SyncMysticalShopInfo(curPlayer):
+    ##神秘限购通知
+    packData = ChPyNetSendPack.tagMCMysticalShopTimeInfo()
+    packData.ShopTimeList = []
+    ipyDataList = IpyGameDataPY.GetIpyGameDataByCondition('Store', {'ShopType':16}, True)
+    curTime = int(time.time())
+    for ipyData in ipyDataList:
+        goodsID = ipyData.GetID()
+        startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ShopItemStartTime % goodsID)
+        if not startTime:
+            continue
+        if curTime - startTime >= ipyData.GetLimitValue():
+            #超时的重置
+            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ShopItemStartTime % goodsID, 0)
+        else:
+            goodsTime = ChPyNetSendPack.tagMCMysticalShopTime()
+            goodsTime.GoodsID = goodsID
+            goodsTime.StartTime = startTime
+            packData.ShopTimeList.append(goodsTime)
+    if not packData.ShopTimeList:
+        return
+    packData.Count = len(packData.ShopTimeList)
+    NetPackCommon.SendFakePack(curPlayer, packData)
     return
 
 ## 回购物品
@@ -596,6 +639,11 @@
     
     if itemIndex in dict(IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList')):
         return not CheckSuperGiftBuy(curPlayer, itemIndex)
+    if shopNPCID == 16:#神秘限购
+        startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ShopItemStartTime % itemIndex)
+        curTime = int(time.time())
+        return not startTime or curTime - startTime >= limitValue
+        
 #    
 #    limitPlusDict = {shopItem.GetLimitPlusType1():shopItem.GetLimitPlusValue1(),
 #                     shopItem.GetLimitPlusType2():shopItem.GetLimitPlusValue2(),
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_IceLode.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_IceLode.py
index 50db3f4..f6dfd0d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_IceLode.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GameWorldLogic/FBProcess/GameLogic_IceLode.py
@@ -358,7 +358,7 @@
         maxCnt = npcInfo[DL_ScreenMaxNPC]
         totalMaxCnt = npcInfo[DL_TotalNPCCnt]
         NPCCustomRefresh.SetNPCRefresh(npcInfo[Def_RefreshMark], [npcid], maxCnt, totalMaxCnt)
-        npcCnt += maxCnt
+        npcCnt += totalMaxCnt
     NPCCustomRefresh.ProcessAllNPCRefresh(tick) # 立即出发一次标识点刷新
     gameFB.SetGameFBDict(FBPlayerDict_RemainNPCCnt, npcCnt)
     
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
index 2b811f9..68bacc8 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerControl.py
@@ -83,6 +83,7 @@
 import PlayerFamilyTech
 import PlayerCostRebate
 import PlayerFairyCeremony
+import FunctionNPCCommon
 import ChNetSendPack
 import PlayerState
 import QuestCommon
@@ -3925,7 +3926,8 @@
             FBLogic.OnPlayerLVUp(curPlayer)
             # 记录开服活动冲级数据
             OpenServerCampaign.UpdOpenServerCampaignRecordData(curPlayer, ShareDefine.Def_Campaign_Type_LV, curPlayer.GetLV())
-            
+            #神秘限购
+            FunctionNPCCommon.MysticalShopOpen(curPlayer, befLV, aftLV)
         #不需要做升级任务, 设置玩家经验
         SetPlayerTotalExp(curPlayer, curTotalExp) 
         return

--
Gitblit v1.8.0