From 1c34f0edac641d381c0fe45839bbfb9e4b0ce4b6 Mon Sep 17 00:00:00 2001
From: xdh <xiefantasy@qq.com>
Date: 星期一, 03 九月 2018 10:53:12 +0800
Subject: [PATCH] fix:超值礼包时间通知修改
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Event/EventSrc/FunctionNPCCommon.py | 3 +
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py | 58 ++++++++++++++++------------
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py | 58 ++++++++++++++++------------
3 files changed, 68 insertions(+), 51 deletions(-)
diff --git a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
index fabb438..908d399 100644
--- a/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
+++ b/ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -20484,56 +20484,64 @@
# AA 16 通知超值礼包信息 #tagMCSuperGiftInfo
class tagMCSuperGiftInfo(Structure):
- _pack_ = 1
- _fields_ = [
- ("Cmd", c_ubyte),
- ("SubCmd", c_ubyte),
- ("GiftID", c_int), #商品ID
- ("RemainDay", c_ubyte), #剩余天数
- ]
+ Head = tagHead()
+ GiftID = 0 #(DWORD GiftID)//商品ID
+ EndtDate = "" #(char EndtDate[10])// 结束日期 y-m-d
+ data = None
def __init__(self):
self.Clear()
- self.Cmd = 0xAA
- self.SubCmd = 0x16
+ self.Head.Cmd = 0xAA
+ self.Head.SubCmd = 0x16
return
- def ReadData(self, stringData, _pos=0, _len=0):
+ def ReadData(self, _lpData, _pos=0, _Len=0):
self.Clear()
- memmove(addressof(self), stringData[_pos:], self.GetLength())
- return _pos + self.GetLength()
+ _pos = self.Head.ReadData(_lpData, _pos)
+ self.GiftID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+ self.EndtDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
+ return _pos
def Clear(self):
- self.Cmd = 0xAA
- self.SubCmd = 0x16
+ self.Head = tagHead()
+ self.Head.Clear()
+ self.Head.Cmd = 0xAA
+ self.Head.SubCmd = 0x16
self.GiftID = 0
- self.RemainDay = 0
+ self.EndtDate = ""
return
def GetLength(self):
- return sizeof(tagMCSuperGiftInfo)
+ length = 0
+ length += self.Head.GetLength()
+ length += 4
+ length += 10
+
+ return length
def GetBuffer(self):
- return string_at(addressof(self), self.GetLength())
+ data = ''
+ data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+ data = CommFunc.WriteDWORD(data, self.GiftID)
+ data = CommFunc.WriteString(data, 10, self.EndtDate)
+ return data
def OutputString(self):
- DumpString = '''// AA 16 通知超值礼包信息 //tagMCSuperGiftInfo:
- Cmd:%s,
- SubCmd:%s,
+ DumpString = '''
+ Head:%s,
GiftID:%d,
- RemainDay:%d
+ EndtDate:%s
'''\
%(
- self.Cmd,
- self.SubCmd,
+ self.Head.OutputString(),
self.GiftID,
- self.RemainDay
+ self.EndtDate
)
return DumpString
m_NAtagMCSuperGiftInfo=tagMCSuperGiftInfo()
-ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCSuperGiftInfo.Cmd,m_NAtagMCSuperGiftInfo.SubCmd))] = m_NAtagMCSuperGiftInfo
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCSuperGiftInfo.Head.Cmd,m_NAtagMCSuperGiftInfo.Head.SubCmd))] = m_NAtagMCSuperGiftInfo
#------------------------------------------------------
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
index fabb438..908d399 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -20484,56 +20484,64 @@
# AA 16 通知超值礼包信息 #tagMCSuperGiftInfo
class tagMCSuperGiftInfo(Structure):
- _pack_ = 1
- _fields_ = [
- ("Cmd", c_ubyte),
- ("SubCmd", c_ubyte),
- ("GiftID", c_int), #商品ID
- ("RemainDay", c_ubyte), #剩余天数
- ]
+ Head = tagHead()
+ GiftID = 0 #(DWORD GiftID)//商品ID
+ EndtDate = "" #(char EndtDate[10])// 结束日期 y-m-d
+ data = None
def __init__(self):
self.Clear()
- self.Cmd = 0xAA
- self.SubCmd = 0x16
+ self.Head.Cmd = 0xAA
+ self.Head.SubCmd = 0x16
return
- def ReadData(self, stringData, _pos=0, _len=0):
+ def ReadData(self, _lpData, _pos=0, _Len=0):
self.Clear()
- memmove(addressof(self), stringData[_pos:], self.GetLength())
- return _pos + self.GetLength()
+ _pos = self.Head.ReadData(_lpData, _pos)
+ self.GiftID,_pos = CommFunc.ReadDWORD(_lpData, _pos)
+ self.EndtDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
+ return _pos
def Clear(self):
- self.Cmd = 0xAA
- self.SubCmd = 0x16
+ self.Head = tagHead()
+ self.Head.Clear()
+ self.Head.Cmd = 0xAA
+ self.Head.SubCmd = 0x16
self.GiftID = 0
- self.RemainDay = 0
+ self.EndtDate = ""
return
def GetLength(self):
- return sizeof(tagMCSuperGiftInfo)
+ length = 0
+ length += self.Head.GetLength()
+ length += 4
+ length += 10
+
+ return length
def GetBuffer(self):
- return string_at(addressof(self), self.GetLength())
+ data = ''
+ data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
+ data = CommFunc.WriteDWORD(data, self.GiftID)
+ data = CommFunc.WriteString(data, 10, self.EndtDate)
+ return data
def OutputString(self):
- DumpString = '''// AA 16 通知超值礼包信息 //tagMCSuperGiftInfo:
- Cmd:%s,
- SubCmd:%s,
+ DumpString = '''
+ Head:%s,
GiftID:%d,
- RemainDay:%d
+ EndtDate:%s
'''\
%(
- self.Cmd,
- self.SubCmd,
+ self.Head.OutputString(),
self.GiftID,
- self.RemainDay
+ self.EndtDate
)
return DumpString
m_NAtagMCSuperGiftInfo=tagMCSuperGiftInfo()
-ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCSuperGiftInfo.Cmd,m_NAtagMCSuperGiftInfo.SubCmd))] = m_NAtagMCSuperGiftInfo
+ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCSuperGiftInfo.Head.Cmd,m_NAtagMCSuperGiftInfo.Head.SubCmd))] = m_NAtagMCSuperGiftInfo
#------------------------------------------------------
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 7a7355b..d4802cb 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
@@ -607,10 +607,11 @@
return
giftID, day = superGiftTimeList[giftIndex-1]
openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay)+1
+ remainDay = max(0, day - openServerDay+startDay)-1
packData = ChPyNetSendPack.tagMCSuperGiftInfo()
packData.GiftID = giftID
- packData.RemainDay = max(0, day - openServerDay+startDay)
+ packData.EndtDate = str(GameWorld.GetDatetimeByDiffDays(remainDay))[:10]
NetPackCommon.SendFakePack(curPlayer, packData)
return
def CheckSuperGiftBuy(curPlayer, giftID):
--
Gitblit v1.8.0