From c9cc12b521d6542564cb2682fa19961850f02447 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期四, 30 八月 2018 15:38:28 +0800
Subject: [PATCH] Merge remote-tracking branch 'remotes/origin/master'

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py |   76 ++++++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearFirstGold.py       |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py                  |   56 ++++++++++++++
 ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py                                       |   56 ++++++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldGift.py            |    4 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                         |    1 
 6 files changed, 193 insertions(+), 2 deletions(-)

diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index d989dba..fabb438 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -20481,6 +20481,62 @@
 
 
 #------------------------------------------------------
+# AA 16 通知超值礼包信息 #tagMCSuperGiftInfo
+
+class  tagMCSuperGiftInfo(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ("GiftID", c_int),    #商品ID
+                  ("RemainDay", c_ubyte),    #剩余天数
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xAA
+        self.SubCmd = 0x16
+        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.Cmd = 0xAA
+        self.SubCmd = 0x16
+        self.GiftID = 0
+        self.RemainDay = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagMCSuperGiftInfo)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// AA 16 通知超值礼包信息 //tagMCSuperGiftInfo:
+                                Cmd:%s,
+                                SubCmd:%s,
+                                GiftID:%d,
+                                RemainDay:%d
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd,
+                                self.GiftID,
+                                self.RemainDay
+                                )
+        return DumpString
+
+
+m_NAtagMCSuperGiftInfo=tagMCSuperGiftInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCSuperGiftInfo.Cmd,m_NAtagMCSuperGiftInfo.SubCmd))] = m_NAtagMCSuperGiftInfo
+
+
+#------------------------------------------------------
 #AA 01 累计登陆天数信息 #tagMCTotalLoginDayCntInfo
 
 class  tagMCTotalLoginDayCntInfo(Structure):
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 211280b..64b85fb 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3384,6 +3384,7 @@
 Def_PDict_FirstGoldTry = "FirstGoldTry"     # 首充试用状态 0-不可试用 1-可试用 2-已试用
 Def_PDict_DailyGoldChargeState = "DailyGoldChargeState"  # 天天首充活动状态,0-未开启;1-已开启
 Def_PDict_DailyChargeState = "DailyChargeState"  # 当日是否已充值
+Def_PDict_SuperGiftData = "SuperGiftData"  # 超值礼包数据
 Def_PDict_DailyGoldChargePrizeRecord = "DailyGoldChargePrizeRecord"  # 天天首充领奖记录,0-不可领;1-可领;2-已领
 Def_PDict_DailyGoldChargeCnt = "DailyGoldChargeCnt"  # 当日已充值数
 Def_PDict_SingleGoldGiftIndex = "SingleGoldGiftIndex"  # 单日充值多选一礼包领取状态, 0-未领取,>0已领取索引
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index d989dba..fabb438 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -20481,6 +20481,62 @@
 
 
 #------------------------------------------------------
+# AA 16 通知超值礼包信息 #tagMCSuperGiftInfo
+
+class  tagMCSuperGiftInfo(Structure):
+    _pack_ = 1
+    _fields_ = [
+                  ("Cmd", c_ubyte),
+                  ("SubCmd", c_ubyte),
+                  ("GiftID", c_int),    #商品ID
+                  ("RemainDay", c_ubyte),    #剩余天数
+                  ]
+
+    def __init__(self):
+        self.Clear()
+        self.Cmd = 0xAA
+        self.SubCmd = 0x16
+        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.Cmd = 0xAA
+        self.SubCmd = 0x16
+        self.GiftID = 0
+        self.RemainDay = 0
+        return
+
+    def GetLength(self):
+        return sizeof(tagMCSuperGiftInfo)
+
+    def GetBuffer(self):
+        return string_at(addressof(self), self.GetLength())
+
+    def OutputString(self):
+        DumpString = '''// AA 16 通知超值礼包信息 //tagMCSuperGiftInfo:
+                                Cmd:%s,
+                                SubCmd:%s,
+                                GiftID:%d,
+                                RemainDay:%d
+                                '''\
+                                %(
+                                self.Cmd,
+                                self.SubCmd,
+                                self.GiftID,
+                                self.RemainDay
+                                )
+        return DumpString
+
+
+m_NAtagMCSuperGiftInfo=tagMCSuperGiftInfo()
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCSuperGiftInfo.Cmd,m_NAtagMCSuperGiftInfo.SubCmd))] = m_NAtagMCSuperGiftInfo
+
+
+#------------------------------------------------------
 #AA 01 累计登陆天数信息 #tagMCTotalLoginDayCntInfo
 
 class  tagMCTotalLoginDayCntInfo(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 a786ace..7a7355b 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
@@ -58,7 +58,7 @@
 import ItemCommon
 import ShareDefine
 import DataRecordPack
-import EventSrc
+#import EventSrc
 import ChItem
 import IpyGameDataPY
 import PlayerRune
@@ -191,6 +191,7 @@
 ## 登录
 def ShopItemOnLogin(curPlayer):
     SyncShopItemTodayBuyCount(curPlayer)
+    SyncSuperGiftInfo(curPlayer)
     return
 
 ##商店物品OnDay
@@ -198,6 +199,8 @@
 # @return 
 def ShopItemOnDay(curPlayer, onEventType):
     if onEventType == ShareDefine.Def_OnEventType:
+        UpdataSuperGiftTime(curPlayer, True)
+        SyncSuperGiftInfo(curPlayer)
         refreshType = [3]
     elif onEventType == ShareDefine.Def_OnEventTypeEx:
         refreshType = [4]
@@ -484,6 +487,8 @@
     SyncShoppingResult(curPlayer, itemIndex, clientBuyCount)
     if itemIndex in IpyGameDataPY.GetFuncEvalCfg('CeremonyFireParty', 1, {}).values():
         PlayerFairyCeremony.AddFCPartyActionCnt(curPlayer, ChConfig.Def_PPAct_Fireworks, clientBuyCount)
+    if itemIndex in dict(IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList')):
+        UpdataSuperGiftTime(curPlayer)
     return
 
 def __GetShopJobItem(job, itemID, jobItemList):
@@ -528,6 +533,9 @@
     #烟花狂欢
     if itemIndex in IpyGameDataPY.GetFuncEvalCfg('CeremonyFireParty', 1, {}).values():
         return not PlayerFairyCeremony.IsCanBuyFireworks(curPlayer, itemIndex)
+    
+    if itemIndex in dict(IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList')):
+        return not CheckSuperGiftBuy(curPlayer, itemIndex)
 #    
 #    limitPlusDict = {shopItem.GetLimitPlusType1():shopItem.GetLimitPlusValue1(),
 #                     shopItem.GetLimitPlusType2():shopItem.GetLimitPlusValue2(),
@@ -554,6 +562,72 @@
     # 默认不限制
     return False
 
+
+#超值礼包购买时间
+def UpdataSuperGiftTime(curPlayer, isOnday=False):
+    superGiftData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SuperGiftData)
+    giftIndex, startDay = superGiftData%10, superGiftData/10
+    superGiftTimeList = IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList')
+    if giftIndex >= len(superGiftTimeList):
+        return
+    if isOnday and not giftIndex:
+        return
+    openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay)+1
+    newIndex = giftIndex
+    if isOnday:
+        lastDays = 0
+        pastDay = openServerDay - startDay
+        for i in xrange(giftIndex-1, len(superGiftTimeList)):
+            lastDays += superGiftTimeList[i][1]
+            if pastDay < lastDays:
+                break
+            if pastDay >= lastDays:
+                newIndex = i+2
+        
+    else:
+        newIndex = min(len(superGiftTimeList), giftIndex+1)
+        
+    if newIndex == giftIndex:
+        return
+    
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SuperGiftData, openServerDay*10+newIndex)
+    #通知
+    if not isOnday:
+        SyncSuperGiftInfo(curPlayer)
+    if newIndex == 1:
+        addItemList = IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList', 2)
+        PlayerControl.SendMailByKey('SellMail2', [curPlayer.GetID()], addItemList)
+    return True
+
+def SyncSuperGiftInfo(curPlayer):
+    superGiftData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SuperGiftData)
+    giftIndex, startDay = superGiftData%10, superGiftData/10
+    superGiftTimeList = IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList')
+    if giftIndex == 0 or giftIndex > len(superGiftTimeList):
+        return
+    giftID, day = superGiftTimeList[giftIndex-1]
+    openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay)+1
+    
+    packData = ChPyNetSendPack.tagMCSuperGiftInfo()
+    packData.GiftID = giftID
+    packData.RemainDay = max(0, day - openServerDay+startDay)
+    NetPackCommon.SendFakePack(curPlayer, packData)
+    return
+def CheckSuperGiftBuy(curPlayer, giftID):
+    #超值礼包是否可购买
+    superGiftData = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SuperGiftData)
+    giftIndex, startDay = superGiftData%10, superGiftData/10
+    superGiftTimeList = IpyGameDataPY.GetFuncEvalCfg('SuperGiftTimeList')
+    if giftIndex == 0 or giftIndex > len(superGiftTimeList):
+        return
+    curGiftID, day = superGiftTimeList[giftIndex-1]
+    if giftID != curGiftID:
+        return
+    openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay)+1
+    if not max(0, day - openServerDay+startDay):
+        return
+    return True
+
 ## 商店npcid
 #  @param curPlayer 玩家实例
 #  @return 
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearFirstGold.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearFirstGold.py
index 7e7da4a..2fe7ef1 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearFirstGold.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearFirstGold.py
@@ -35,7 +35,7 @@
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldTry, 0)
     # 重置今日已充值数
     PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DailyGoldChargeCnt, 0)
-    
+    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SuperGiftData, 0)
     # 重置充值次数信息
     syncRecordIDList = []
     ipyDataMgr = IpyGameDataPY.IPY_Data()
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldGift.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldGift.py
index d4e615e..82156df 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldGift.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldGift.py
@@ -53,6 +53,7 @@
 import ChEquip
 
 import time
+import FunctionNPCCommon
 
 # 定义配表外围索引
 (
@@ -323,6 +324,9 @@
     
     # 通知客户端
     Sync_FirstGoldInfo(curPlayer)
+    
+    #超值礼包记录时间
+    FunctionNPCCommon.UpdataSuperGiftTime(curPlayer)
     return
 
 ###################################################################

--
Gitblit v1.8.0