xdh
2018-10-13 bff1837b1f805a35dc99ca4439f27112a986747f
4075 【后端】限时抢购开发-预约通知修改
3个文件已修改
154 ■■■■ 已修改文件
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py 58 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashSale.py 38 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -20179,10 +20179,50 @@
#------------------------------------------------------
# AA 18 限时抢购活动玩家预约信息 #tagMCFlashSaleAppointmentInfo
class  tagMCFlashSaleAppointmentState(Structure):
    _pack_ = 1
    _fields_ = [
                  ("GoodsMark", c_int),    # 商品标识
                  ("State", c_ubyte),    # 是否预约
                  ]
    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.GoodsMark = 0
        self.State = 0
        return
    def GetLength(self):
        return sizeof(tagMCFlashSaleAppointmentState)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// AA 18 限时抢购活动玩家预约信息 //tagMCFlashSaleAppointmentInfo:
                                GoodsMark:%d,
                                State:%d
                                '''\
                                %(
                                self.GoodsMark,
                                self.State
                                )
        return DumpString
class  tagMCFlashSaleAppointmentInfo(Structure):
    Head = tagHead()
    IsAll = 0    #(BYTE IsAll)// 是否全部
    GoodsCount = 0    #(WORD GoodsCount)// 商品数
    GoodsList = list()    #(vector<DWORD> GoodsList)// 预约的商品
    GoodsList = list()    #(vector<tagMCFlashSaleAppointmentState> GoodsList)// 预约的商品
    data = None
    def __init__(self):
@@ -20194,10 +20234,12 @@
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        _pos = self.Head.ReadData(_lpData, _pos)
        self.IsAll,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.GoodsCount,_pos = CommFunc.ReadWORD(_lpData, _pos)
        for i in range(self.GoodsCount):
            value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
            self.GoodsList.append(value)
            temGoodsList = tagMCFlashSaleAppointmentState()
            _pos = temGoodsList.ReadData(_lpData, _pos)
            self.GoodsList.append(temGoodsList)
        return _pos
    def Clear(self):
@@ -20205,6 +20247,7 @@
        self.Head.Clear()
        self.Head.Cmd = 0xAA
        self.Head.SubCmd = 0x18
        self.IsAll = 0
        self.GoodsCount = 0
        self.GoodsList = list()
        return
@@ -20212,27 +20255,32 @@
    def GetLength(self):
        length = 0
        length += self.Head.GetLength()
        length += 1
        length += 2
        length += 4 * self.GoodsCount
        for i in range(self.GoodsCount):
            length += self.GoodsList[i].GetLength()
        return length
    def GetBuffer(self):
        data = ''
        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
        data = CommFunc.WriteBYTE(data, self.IsAll)
        data = CommFunc.WriteWORD(data, self.GoodsCount)
        for i in range(self.GoodsCount):
            data = CommFunc.WriteDWORD(data, self.GoodsList[i])
            data = CommFunc.WriteString(data, self.GoodsList[i].GetLength(), self.GoodsList[i].GetBuffer())
        return data
    def OutputString(self):
        DumpString = '''
                                Head:%s,
                                IsAll:%d,
                                GoodsCount:%d,
                                GoodsList:%s
                                '''\
                                %(
                                self.Head.OutputString(),
                                self.IsAll,
                                self.GoodsCount,
                                "..."
                                )
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -20179,10 +20179,50 @@
#------------------------------------------------------
# AA 18 限时抢购活动玩家预约信息 #tagMCFlashSaleAppointmentInfo
class  tagMCFlashSaleAppointmentState(Structure):
    _pack_ = 1
    _fields_ = [
                  ("GoodsMark", c_int),    # 商品标识
                  ("State", c_ubyte),    # 是否预约
                  ]
    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.GoodsMark = 0
        self.State = 0
        return
    def GetLength(self):
        return sizeof(tagMCFlashSaleAppointmentState)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// AA 18 限时抢购活动玩家预约信息 //tagMCFlashSaleAppointmentInfo:
                                GoodsMark:%d,
                                State:%d
                                '''\
                                %(
                                self.GoodsMark,
                                self.State
                                )
        return DumpString
class  tagMCFlashSaleAppointmentInfo(Structure):
    Head = tagHead()
    IsAll = 0    #(BYTE IsAll)// 是否全部
    GoodsCount = 0    #(WORD GoodsCount)// 商品数
    GoodsList = list()    #(vector<DWORD> GoodsList)// 预约的商品
    GoodsList = list()    #(vector<tagMCFlashSaleAppointmentState> GoodsList)// 预约的商品
    data = None
    def __init__(self):
@@ -20194,10 +20234,12 @@
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        _pos = self.Head.ReadData(_lpData, _pos)
        self.IsAll,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.GoodsCount,_pos = CommFunc.ReadWORD(_lpData, _pos)
        for i in range(self.GoodsCount):
            value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
            self.GoodsList.append(value)
            temGoodsList = tagMCFlashSaleAppointmentState()
            _pos = temGoodsList.ReadData(_lpData, _pos)
            self.GoodsList.append(temGoodsList)
        return _pos
    def Clear(self):
@@ -20205,6 +20247,7 @@
        self.Head.Clear()
        self.Head.Cmd = 0xAA
        self.Head.SubCmd = 0x18
        self.IsAll = 0
        self.GoodsCount = 0
        self.GoodsList = list()
        return
@@ -20212,27 +20255,32 @@
    def GetLength(self):
        length = 0
        length += self.Head.GetLength()
        length += 1
        length += 2
        length += 4 * self.GoodsCount
        for i in range(self.GoodsCount):
            length += self.GoodsList[i].GetLength()
        return length
    def GetBuffer(self):
        data = ''
        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
        data = CommFunc.WriteBYTE(data, self.IsAll)
        data = CommFunc.WriteWORD(data, self.GoodsCount)
        for i in range(self.GoodsCount):
            data = CommFunc.WriteDWORD(data, self.GoodsList[i])
            data = CommFunc.WriteString(data, self.GoodsList[i].GetLength(), self.GoodsList[i].GetBuffer())
        return data
    def OutputString(self):
        DumpString = '''
                                Head:%s,
                                IsAll:%d,
                                GoodsCount:%d,
                                GoodsList:%s
                                '''\
                                %(
                                self.Head.OutputString(),
                                self.IsAll,
                                self.GoodsCount,
                                "..."
                                )
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFlashSale.py
@@ -226,11 +226,11 @@
    if not cfgID:
        return
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FlashSaleYY % goodsID, packData.State, ChConfig.Def_PDictType_FlashSale)
    Sync_FlashSaleAppointmentInfo(curPlayer)
    Sync_FlashSaleAppointmentInfo(curPlayer, goodsID)
    return
def Sync_FlashSaleAppointmentInfo(curPlayer):
def Sync_FlashSaleAppointmentInfo(curPlayer, goodsID=0):
    ##通知限时抢购预约情况
    actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FlashSale, {})
    if not actInfo:
@@ -243,17 +243,29 @@
        return
    packInfo = ChPyNetSendPack.tagMCFlashSaleAppointmentInfo()
    packInfo.GoodsList = []
    shopTypeList = flashSaleIpyData.GetShopTypeList()
    for dayIndex, shopList in enumerate(shopTypeList):
        for timeIndex, shopType in enumerate(shopList):
            shopItemIpyDataList = IpyGameDataPY.GetIpyGameDataByCondition("Store", {"ShopType":shopType}, True, True)
            if not shopItemIpyDataList:
                continue
            for i in xrange(len(shopItemIpyDataList)):
                goodsMark = dayIndex * 10000 + timeIndex * 100 + i  #商品标识
                isAppointment = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleYY % goodsMark, 0, ChConfig.Def_PDictType_FlashSale)
                if isAppointment:
                    packInfo.GoodsList.append(goodsMark)
    if goodsID == 0:
        packInfo.IsAll = 1
        shopTypeList = flashSaleIpyData.GetShopTypeList()
        for dayIndex, shopList in enumerate(shopTypeList):
            for timeIndex, shopType in enumerate(shopList):
                shopItemIpyDataList = IpyGameDataPY.GetIpyGameDataByCondition("Store", {"ShopType":shopType}, True, True)
                if not shopItemIpyDataList:
                    continue
                for i in xrange(len(shopItemIpyDataList)):
                    goodsMark = dayIndex * 10000 + timeIndex * 100 + i  #商品标识
                    isAppointment = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleYY % goodsMark, 0, ChConfig.Def_PDictType_FlashSale)
                    if isAppointment:
                        appoinetmentPack = ChPyNetSendPack.tagMCFlashSaleAppointmentState()
                        appoinetmentPack.GoodsMark = goodsMark
                        appoinetmentPack.State = 1
                        packInfo.GoodsList.append(appoinetmentPack)
    else:
        packInfo.IsAll = 0
        isAppointment = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashSaleYY % goodsID, 0, ChConfig.Def_PDictType_FlashSale)
        appoinetmentPack = ChPyNetSendPack.tagMCFlashSaleAppointmentState()
        appoinetmentPack.GoodsMark = goodsID
        appoinetmentPack.State = isAppointment
        packInfo.GoodsList.append(appoinetmentPack)
    packInfo.GoodsCount = len(packInfo.GoodsList)
    NetPackCommon.SendFakePack(curPlayer, packInfo)
    return