hxp
2022-01-14 f9d4f2df388e88767c36641b6f1a06af7b032053
9437 【越南】【后端】天帝礼包

# Conflicts:
# ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
# ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
# ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
11个文件已修改
1个文件已添加
1961 ■■■■■ 已修改文件
PySysDB/PySysDBG.h 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
PySysDB/PySysDBPY.h 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py 235 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py 411 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py 235 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py 411 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py 76 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActGodGift.py 478 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
PySysDB/PySysDBG.h
@@ -510,6 +510,22 @@
    BYTE        ResetType;    //重置类型,0-0点重置;1-5点重置
};
//天帝礼包活动时间表
struct tagActGodGift
{
    DWORD        _CfgID;    //配置ID
    list        PlatformList;    //活动平台列表["平台A", "平台A", ...],配[]代表所有
    list        ServerGroupIDList;    //服务器ID列表
    BYTE        ActNum;    //活动分组编号, 活动类型 * 10 + 不同界面编号
    char        StartDate;    //开启日期
    char        EndDate;    //结束日期
    dict        NotifyInfoStart;    //全服提示信息 - 相对开始时间
    dict        NotifyInfoEnd;    //全服提示信息 - 相对结束时间
    list        NotifyInfoLoop;    //全服提示信息 - 循环广播[间隔分钟, 广播key]
    BYTE        IsDayReset;    //是否每天重置
};
//骑宠盛宴活动
struct tagActHorsePetFeast
PySysDB/PySysDBPY.h
@@ -1626,6 +1626,34 @@
    dict        ItemAwardTimesTotalInfo;    //物品产出次数限制(所有层){物品ID:总产出次数, ...}
};
//天帝礼包活动时间表
struct tagActGodGift
{
    DWORD        _CfgID;    //配置ID
    char        StartDate;    //开启日期
    char        EndDate;    //结束日期
    BYTE        IsDayReset;    //是否每天重置
    WORD        LVLimit;    //限制等级
    list        UseGoldList;    //抽奖消耗仙玉列表
    list        PrizeMoneyList;    //奖励灵石列表
    BYTE        ResetLimitTimes;    //至少抽几次可重置
    BYTE        ResetCountMax;    //可重置次数
    dict        TemplateIDInfo;    //奖池模板信息 {(世界等级A,B):[模板编号列表, ...], ...}
};
//天帝礼包奖池表
struct tagActGodGiftAward
{
    DWORD        _TemplateID;    //奖池模板编号
    BYTE        AwardLibType;    //奖励库类型
    BYTE        UnlockAwardLimitTimes;    //抽X次后可产出本库
    BYTE        ChooseItemCount;    //选择个数
    dict        LibItemInfo;    //物品编号对应物品信息 {物品编号:[物品ID,个数,是否拍品,可选次数], ...}  0不限次数
    list        NotifyItemNumList;    //需要广播的编号列表
};
//骑宠盛宴活动
struct tagActHorsePetFeast
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetPack.py
@@ -14911,6 +14911,241 @@
#------------------------------------------------------
# AA 20 天帝礼包选择物品 #tagCMActGodGiftChooseItem
class  tagCMActGodGiftChooseItemInfo(Structure):
    ItemLibType = 0    #(BYTE ItemLibType)//物品库类型
    Count = 0    #(BYTE Count)//选择个数
    ItemNumList = list()    #(vector<BYTE> ItemNumList)//选择物品编号列表
    data = None
    def __init__(self):
        self.Clear()
        return
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        self.ItemLibType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.Count,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.Count):
            value,_pos=CommFunc.ReadBYTE(_lpData,_pos)
            self.ItemNumList.append(value)
        return _pos
    def Clear(self):
        self.ItemLibType = 0
        self.Count = 0
        self.ItemNumList = list()
        return
    def GetLength(self):
        length = 0
        length += 1
        length += 1
        length += 1 * self.Count
        return length
    def GetBuffer(self):
        data = ''
        data = CommFunc.WriteBYTE(data, self.ItemLibType)
        data = CommFunc.WriteBYTE(data, self.Count)
        for i in range(self.Count):
            data = CommFunc.WriteBYTE(data, self.ItemNumList[i])
        return data
    def OutputString(self):
        DumpString = '''
                                ItemLibType:%d,
                                Count:%d,
                                ItemNumList:%s
                                '''\
                                %(
                                self.ItemLibType,
                                self.Count,
                                "..."
                                )
        return DumpString
class  tagCMActGodGiftChooseItem(Structure):
    Head = tagHead()
    ActNum = 0    #(BYTE ActNum)//活动编号
    ChooseLibCount = 0    #(BYTE ChooseLibCount)//选择库个数
    ChooseItemList = list()    #(vector<tagCMActGodGiftChooseItemInfo> ChooseItemList)//选择库物品信息列表
    data = None
    def __init__(self):
        self.Clear()
        self.Head.Cmd = 0xAA
        self.Head.SubCmd = 0x20
        return
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        _pos = self.Head.ReadData(_lpData, _pos)
        self.ActNum,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.ChooseLibCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.ChooseLibCount):
            temChooseItemList = tagCMActGodGiftChooseItemInfo()
            _pos = temChooseItemList.ReadData(_lpData, _pos)
            self.ChooseItemList.append(temChooseItemList)
        return _pos
    def Clear(self):
        self.Head = tagHead()
        self.Head.Clear()
        self.Head.Cmd = 0xAA
        self.Head.SubCmd = 0x20
        self.ActNum = 0
        self.ChooseLibCount = 0
        self.ChooseItemList = list()
        return
    def GetLength(self):
        length = 0
        length += self.Head.GetLength()
        length += 1
        length += 1
        for i in range(self.ChooseLibCount):
            length += self.ChooseItemList[i].GetLength()
        return length
    def GetBuffer(self):
        data = ''
        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
        data = CommFunc.WriteBYTE(data, self.ActNum)
        data = CommFunc.WriteBYTE(data, self.ChooseLibCount)
        for i in range(self.ChooseLibCount):
            data = CommFunc.WriteString(data, self.ChooseItemList[i].GetLength(), self.ChooseItemList[i].GetBuffer())
        return data
    def OutputString(self):
        DumpString = '''
                                Head:%s,
                                ActNum:%d,
                                ChooseLibCount:%d,
                                ChooseItemList:%s
                                '''\
                                %(
                                self.Head.OutputString(),
                                self.ActNum,
                                self.ChooseLibCount,
                                "..."
                                )
        return DumpString
m_NAtagCMActGodGiftChooseItem=tagCMActGodGiftChooseItem()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMActGodGiftChooseItem.Head.Cmd,m_NAtagCMActGodGiftChooseItem.Head.SubCmd))] = m_NAtagCMActGodGiftChooseItem
#------------------------------------------------------
# AA 21 天帝礼包抽奖 #tagCMActGodGiftlottery
class  tagCMActGodGiftlottery(Structure):
    _pack_ = 1
    _fields_ = [
                  ("Cmd", c_ubyte),
                  ("SubCmd", c_ubyte),
                  ("ActNum", c_ubyte),    #活动编号
                  ]
    def __init__(self):
        self.Clear()
        self.Cmd = 0xAA
        self.SubCmd = 0x21
        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 = 0x21
        self.ActNum = 0
        return
    def GetLength(self):
        return sizeof(tagCMActGodGiftlottery)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// AA 21 天帝礼包抽奖 //tagCMActGodGiftlottery:
                                Cmd:%s,
                                SubCmd:%s,
                                ActNum:%d
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd,
                                self.ActNum
                                )
        return DumpString
m_NAtagCMActGodGiftlottery=tagCMActGodGiftlottery()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMActGodGiftlottery.Cmd,m_NAtagCMActGodGiftlottery.SubCmd))] = m_NAtagCMActGodGiftlottery
#------------------------------------------------------
# AA 22 天帝礼包重置 #tagCMActGodGiftReset
class  tagCMActGodGiftReset(Structure):
    _pack_ = 1
    _fields_ = [
                  ("Cmd", c_ubyte),
                  ("SubCmd", c_ubyte),
                  ("ActNum", c_ubyte),    #活动编号
                  ]
    def __init__(self):
        self.Clear()
        self.Cmd = 0xAA
        self.SubCmd = 0x22
        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 = 0x22
        self.ActNum = 0
        return
    def GetLength(self):
        return sizeof(tagCMActGodGiftReset)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// AA 22 天帝礼包重置 //tagCMActGodGiftReset:
                                Cmd:%s,
                                SubCmd:%s,
                                ActNum:%d
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd,
                                self.ActNum
                                )
        return DumpString
m_NAtagCMActGodGiftReset=tagCMActGodGiftReset()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMActGodGiftReset.Cmd,m_NAtagCMActGodGiftReset.SubCmd))] = m_NAtagCMActGodGiftReset
#------------------------------------------------------
# AA 12 选择转盘活动物品 #tagCMActTurntableChooseItem
class  tagCMActTurntableChooseItem(Structure):
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -29199,6 +29199,417 @@
#------------------------------------------------------
# AA 60 天帝礼包活动信息 #tagMCActGodGiftInfo
class  tagMCActGodGiftItem(Structure):
    _pack_ = 1
    _fields_ = [
                  ("ItemNum", c_ubyte),    # 物品在本库中的编号
                  ("ItemID", c_int),
                  ("ItemCount", c_ushort),
                  ("IsBind", c_ubyte),
                  ("CanChooseTimes", c_ubyte),    #可选择次数,0代表不限次数
                  ("ChooseTimes", c_ubyte),    #已选次数
                  ("IsChoose", 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.ItemNum = 0
        self.ItemID = 0
        self.ItemCount = 0
        self.IsBind = 0
        self.CanChooseTimes = 0
        self.ChooseTimes = 0
        self.IsChoose = 0
        return
    def GetLength(self):
        return sizeof(tagMCActGodGiftItem)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// AA 60 天帝礼包活动信息 //tagMCActGodGiftInfo:
                                ItemNum:%d,
                                ItemID:%d,
                                ItemCount:%d,
                                IsBind:%d,
                                CanChooseTimes:%d,
                                ChooseTimes:%d,
                                IsChoose:%d
                                '''\
                                %(
                                self.ItemNum,
                                self.ItemID,
                                self.ItemCount,
                                self.IsBind,
                                self.CanChooseTimes,
                                self.ChooseTimes,
                                self.IsChoose
                                )
        return DumpString
class  tagMCActGodGiftItemLib(Structure):
    ItemLibType = 0    #(BYTE ItemLibType)//物品库类型
    ChooseItemCount = 0    #(BYTE ChooseItemCount)//可选择物品个数
    ChooseItemList = list()    #(vector<tagMCActGodGiftItem> ChooseItemList)//可选物品列表
    data = None
    def __init__(self):
        self.Clear()
        return
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        self.ItemLibType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.ChooseItemCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.ChooseItemCount):
            temChooseItemList = tagMCActGodGiftItem()
            _pos = temChooseItemList.ReadData(_lpData, _pos)
            self.ChooseItemList.append(temChooseItemList)
        return _pos
    def Clear(self):
        self.ItemLibType = 0
        self.ChooseItemCount = 0
        self.ChooseItemList = list()
        return
    def GetLength(self):
        length = 0
        length += 1
        length += 1
        for i in range(self.ChooseItemCount):
            length += self.ChooseItemList[i].GetLength()
        return length
    def GetBuffer(self):
        data = ''
        data = CommFunc.WriteBYTE(data, self.ItemLibType)
        data = CommFunc.WriteBYTE(data, self.ChooseItemCount)
        for i in range(self.ChooseItemCount):
            data = CommFunc.WriteString(data, self.ChooseItemList[i].GetLength(), self.ChooseItemList[i].GetBuffer())
        return data
    def OutputString(self):
        DumpString = '''
                                ItemLibType:%d,
                                ChooseItemCount:%d,
                                ChooseItemList:%s
                                '''\
                                %(
                                self.ItemLibType,
                                self.ChooseItemCount,
                                "..."
                                )
        return DumpString
class  tagMCActGodGiftInfo(Structure):
    Head = tagHead()
    ActNum = 0    #(BYTE ActNum)// 活动编号
    StartDate = ""    #(char StartDate[10])// 开始日期 y-m-d
    EndtDate = ""    #(char EndtDate[10])// 结束日期 y-m-d
    IsDayReset = 0    #(BYTE IsDayReset)// 是否每日重置
    LimitLV = 0    #(WORD LimitLV)// 限制等级
    CostMoneyType = 0    #(BYTE CostMoneyType)//消耗货币类型
    CostMoneyValueCount = 0    #(BYTE CostMoneyValueCount)
    CostMoneyValueList = list()    #(vector<DWORD> CostMoneyValueList)//消耗货币值列表
    PrizeMoneyType = 0    #(BYTE PrizeMoneyType)//奖励货币类型
    PrizeMoneyValueCount = 0    #(BYTE PrizeMoneyValueCount)
    PrizeMoneyValueList = list()    #(vector<DWORD> PrizeMoneyValueList)//奖励货币值列表
    ResetLimitTimes = 0    #(BYTE ResetLimitTimes)//至少抽几次才可重置奖池
    ResetCountMax = 0    #(BYTE ResetCountMax)//最大可重置奖池次数
    IsAwardPoolOK = 0    #(BYTE IsAwardPoolOK)//奖池是否选择完毕,否的话需要先选择奖池才可抽奖
    ItemLibCount = 0    #(BYTE ItemLibCount)//奖池库个数
    ItemLibList = list()    #(vector<tagMCActGodGiftItemLib> ItemLibList)//奖池库信息列表
    data = None
    def __init__(self):
        self.Clear()
        self.Head.Cmd = 0xAA
        self.Head.SubCmd = 0x60
        return
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        _pos = self.Head.ReadData(_lpData, _pos)
        self.ActNum,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.StartDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
        self.EndtDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
        self.IsDayReset,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.LimitLV,_pos = CommFunc.ReadWORD(_lpData, _pos)
        self.CostMoneyType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.CostMoneyValueCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.CostMoneyValueCount):
            value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
            self.CostMoneyValueList.append(value)
        self.PrizeMoneyType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.PrizeMoneyValueCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.PrizeMoneyValueCount):
            value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
            self.PrizeMoneyValueList.append(value)
        self.ResetLimitTimes,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.ResetCountMax,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.IsAwardPoolOK,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.ItemLibCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.ItemLibCount):
            temItemLibList = tagMCActGodGiftItemLib()
            _pos = temItemLibList.ReadData(_lpData, _pos)
            self.ItemLibList.append(temItemLibList)
        return _pos
    def Clear(self):
        self.Head = tagHead()
        self.Head.Clear()
        self.Head.Cmd = 0xAA
        self.Head.SubCmd = 0x60
        self.ActNum = 0
        self.StartDate = ""
        self.EndtDate = ""
        self.IsDayReset = 0
        self.LimitLV = 0
        self.CostMoneyType = 0
        self.CostMoneyValueCount = 0
        self.CostMoneyValueList = list()
        self.PrizeMoneyType = 0
        self.PrizeMoneyValueCount = 0
        self.PrizeMoneyValueList = list()
        self.ResetLimitTimes = 0
        self.ResetCountMax = 0
        self.IsAwardPoolOK = 0
        self.ItemLibCount = 0
        self.ItemLibList = list()
        return
    def GetLength(self):
        length = 0
        length += self.Head.GetLength()
        length += 1
        length += 10
        length += 10
        length += 1
        length += 2
        length += 1
        length += 1
        length += 4 * self.CostMoneyValueCount
        length += 1
        length += 1
        length += 4 * self.PrizeMoneyValueCount
        length += 1
        length += 1
        length += 1
        length += 1
        for i in range(self.ItemLibCount):
            length += self.ItemLibList[i].GetLength()
        return length
    def GetBuffer(self):
        data = ''
        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
        data = CommFunc.WriteBYTE(data, self.ActNum)
        data = CommFunc.WriteString(data, 10, self.StartDate)
        data = CommFunc.WriteString(data, 10, self.EndtDate)
        data = CommFunc.WriteBYTE(data, self.IsDayReset)
        data = CommFunc.WriteWORD(data, self.LimitLV)
        data = CommFunc.WriteBYTE(data, self.CostMoneyType)
        data = CommFunc.WriteBYTE(data, self.CostMoneyValueCount)
        for i in range(self.CostMoneyValueCount):
            data = CommFunc.WriteDWORD(data, self.CostMoneyValueList[i])
        data = CommFunc.WriteBYTE(data, self.PrizeMoneyType)
        data = CommFunc.WriteBYTE(data, self.PrizeMoneyValueCount)
        for i in range(self.PrizeMoneyValueCount):
            data = CommFunc.WriteDWORD(data, self.PrizeMoneyValueList[i])
        data = CommFunc.WriteBYTE(data, self.ResetLimitTimes)
        data = CommFunc.WriteBYTE(data, self.ResetCountMax)
        data = CommFunc.WriteBYTE(data, self.IsAwardPoolOK)
        data = CommFunc.WriteBYTE(data, self.ItemLibCount)
        for i in range(self.ItemLibCount):
            data = CommFunc.WriteString(data, self.ItemLibList[i].GetLength(), self.ItemLibList[i].GetBuffer())
        return data
    def OutputString(self):
        DumpString = '''
                                Head:%s,
                                ActNum:%d,
                                StartDate:%s,
                                EndtDate:%s,
                                IsDayReset:%d,
                                LimitLV:%d,
                                CostMoneyType:%d,
                                CostMoneyValueCount:%d,
                                CostMoneyValueList:%s,
                                PrizeMoneyType:%d,
                                PrizeMoneyValueCount:%d,
                                PrizeMoneyValueList:%s,
                                ResetLimitTimes:%d,
                                ResetCountMax:%d,
                                IsAwardPoolOK:%d,
                                ItemLibCount:%d,
                                ItemLibList:%s
                                '''\
                                %(
                                self.Head.OutputString(),
                                self.ActNum,
                                self.StartDate,
                                self.EndtDate,
                                self.IsDayReset,
                                self.LimitLV,
                                self.CostMoneyType,
                                self.CostMoneyValueCount,
                                "...",
                                self.PrizeMoneyType,
                                self.PrizeMoneyValueCount,
                                "...",
                                self.ResetLimitTimes,
                                self.ResetCountMax,
                                self.IsAwardPoolOK,
                                self.ItemLibCount,
                                "..."
                                )
        return DumpString
m_NAtagMCActGodGiftInfo=tagMCActGodGiftInfo()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCActGodGiftInfo.Head.Cmd,m_NAtagMCActGodGiftInfo.Head.SubCmd))] = m_NAtagMCActGodGiftInfo
#------------------------------------------------------
# AA 61 天帝礼包活动玩家信息 #tagMCActGodGiftPlayerInfo
class  tagMCActGodGiftAwardItem(Structure):
    _pack_ = 1
    _fields_ = [
                  ("ItemLibType", c_ubyte),    #物品库类型
                  ("ItemNum", 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.ItemLibType = 0
        self.ItemNum = 0
        return
    def GetLength(self):
        return sizeof(tagMCActGodGiftAwardItem)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// AA 61 天帝礼包活动玩家信息 //tagMCActGodGiftPlayerInfo:
                                ItemLibType:%d,
                                ItemNum:%d
                                '''\
                                %(
                                self.ItemLibType,
                                self.ItemNum
                                )
        return DumpString
class  tagMCActGodGiftPlayerInfo(Structure):
    Head = tagHead()
    ActNum = 0    #(BYTE ActNum)// 活动编号
    ResetCount = 0    #(BYTE ResetCount)// 本次活动已重置次数
    AwardItemCount = 0    #(BYTE AwardItemCount)// 本次奖池已抽中奖品个数,也代表本次奖池已抽奖次数
    AwardItemList = list()    #(vector<tagMCActGodGiftAwardItem> AwardItemList)// 本次奖池已抽中物品列表
    data = None
    def __init__(self):
        self.Clear()
        self.Head.Cmd = 0xAA
        self.Head.SubCmd = 0x61
        return
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        _pos = self.Head.ReadData(_lpData, _pos)
        self.ActNum,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.ResetCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.AwardItemCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.AwardItemCount):
            temAwardItemList = tagMCActGodGiftAwardItem()
            _pos = temAwardItemList.ReadData(_lpData, _pos)
            self.AwardItemList.append(temAwardItemList)
        return _pos
    def Clear(self):
        self.Head = tagHead()
        self.Head.Clear()
        self.Head.Cmd = 0xAA
        self.Head.SubCmd = 0x61
        self.ActNum = 0
        self.ResetCount = 0
        self.AwardItemCount = 0
        self.AwardItemList = list()
        return
    def GetLength(self):
        length = 0
        length += self.Head.GetLength()
        length += 1
        length += 1
        length += 1
        for i in range(self.AwardItemCount):
            length += self.AwardItemList[i].GetLength()
        return length
    def GetBuffer(self):
        data = ''
        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
        data = CommFunc.WriteBYTE(data, self.ActNum)
        data = CommFunc.WriteBYTE(data, self.ResetCount)
        data = CommFunc.WriteBYTE(data, self.AwardItemCount)
        for i in range(self.AwardItemCount):
            data = CommFunc.WriteString(data, self.AwardItemList[i].GetLength(), self.AwardItemList[i].GetBuffer())
        return data
    def OutputString(self):
        DumpString = '''
                                Head:%s,
                                ActNum:%d,
                                ResetCount:%d,
                                AwardItemCount:%d,
                                AwardItemList:%s
                                '''\
                                %(
                                self.Head.OutputString(),
                                self.ActNum,
                                self.ResetCount,
                                self.AwardItemCount,
                                "..."
                                )
        return DumpString
m_NAtagMCActGodGiftPlayerInfo=tagMCActGodGiftPlayerInfo()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCActGodGiftPlayerInfo.Head.Cmd,m_NAtagMCActGodGiftPlayerInfo.Head.SubCmd))] = m_NAtagMCActGodGiftPlayerInfo
#------------------------------------------------------
# AA 31 成长必买活动信息 #tagMCActGrowupBuyInfo
class  tagMCActGrowupBuyCTGItem(Structure):
ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py
@@ -429,6 +429,19 @@
                        ("BYTE", "ResetType", 0),
                        ),
                "ActGodGift":(
                        ("DWORD", "CfgID", 1),
                        ("list", "PlatformList", 0),
                        ("list", "ServerGroupIDList", 0),
                        ("BYTE", "ActNum", 0),
                        ("char", "StartDate", 0),
                        ("char", "EndDate", 0),
                        ("dict", "NotifyInfoStart", 0),
                        ("dict", "NotifyInfoEnd", 0),
                        ("list", "NotifyInfoLoop", 0),
                        ("BYTE", "IsDayReset", 0),
                        ),
                "ActHorsePetFeast":(
                        ("DWORD", "CfgID", 1),
                        ("list", "PlatformList", 0),
@@ -1704,6 +1717,33 @@
    def GetNotifyInfoLoop(self): return self.NotifyInfoLoop # 全服提示信息 - 循环广播[间隔分钟, 广播key]
    def GetResetType(self): return self.ResetType # 重置类型,0-0点重置;1-5点重置
# 天帝礼包活动时间表
class IPY_ActGodGift():
    def __init__(self):
        self.CfgID = 0
        self.PlatformList = []
        self.ServerGroupIDList = []
        self.ActNum = 0
        self.StartDate = ""
        self.EndDate = ""
        self.NotifyInfoStart = {}
        self.NotifyInfoEnd = {}
        self.NotifyInfoLoop = []
        self.IsDayReset = 0
        return
    def GetCfgID(self): return self.CfgID # 配置ID
    def GetPlatformList(self): return self.PlatformList # 活动平台列表["平台A", "平台A", ...],配[]代表所有
    def GetServerGroupIDList(self): return self.ServerGroupIDList # 服务器ID列表
    def GetActNum(self): return self.ActNum # 活动分组编号, 活动类型 * 10 + 不同界面编号
    def GetStartDate(self): return self.StartDate # 开启日期
    def GetEndDate(self): return self.EndDate # 结束日期
    def GetNotifyInfoStart(self): return self.NotifyInfoStart # 全服提示信息 - 相对开始时间
    def GetNotifyInfoEnd(self): return self.NotifyInfoEnd # 全服提示信息 - 相对结束时间
    def GetNotifyInfoLoop(self): return self.NotifyInfoLoop # 全服提示信息 - 循环广播[间隔分钟, 广播key]
    def GetIsDayReset(self): return self.IsDayReset # 是否每天重置
# 骑宠盛宴活动
class IPY_ActHorsePetFeast():
    
@@ -2728,6 +2768,8 @@
        self.ipyActGarbageSortingLen = len(self.ipyActGarbageSortingCache)
        self.ipyActXianXiaMJCache = self.__LoadFileData("ActXianXiaMJ", IPY_ActXianXiaMJ)
        self.ipyActXianXiaMJLen = len(self.ipyActXianXiaMJCache)
        self.ipyActGodGiftCache = self.__LoadFileData("ActGodGift", IPY_ActGodGift)
        self.ipyActGodGiftLen = len(self.ipyActGodGiftCache)
        self.ipyActHorsePetFeastCache = self.__LoadFileData("ActHorsePetFeast", IPY_ActHorsePetFeast)
        self.ipyActHorsePetFeastLen = len(self.ipyActHorsePetFeastCache)
        self.ipyActBossRebornCache = self.__LoadFileData("ActBossReborn", IPY_ActBossReborn)
@@ -3054,6 +3096,8 @@
    def GetActGarbageSortingByIndex(self, index): return self.ipyActGarbageSortingCache[index]
    def GetActXianXiaMJCount(self): return self.ipyActXianXiaMJLen
    def GetActXianXiaMJByIndex(self, index): return self.ipyActXianXiaMJCache[index]
    def GetActGodGiftCount(self): return self.ipyActGodGiftLen
    def GetActGodGiftByIndex(self, index): return self.ipyActGodGiftCache[index]
    def GetActHorsePetFeastCount(self): return self.ipyActHorsePetFeastLen
    def GetActHorsePetFeastByIndex(self, index): return self.ipyActHorsePetFeastCache[index]
    def GetActBossRebornCount(self): return self.ipyActBossRebornLen
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
@@ -1541,6 +1541,26 @@
PacketSubCMD_3=0x18
PacketCallFunc_3=OnActXianXiaMJAwardPoolRefresh
;天帝礼包活动
[PlayerActGodGift]
ScriptName = Player\PlayerActGodGift.py
Writer = hxp
Releaser = hxp
RegType = 0
RegisterPackCount = 3
PacketCMD_1=0xAA
PacketSubCMD_1=0x20
PacketCallFunc_1=OnActGodGiftChooseItem
PacketCMD_2=0xAA
PacketSubCMD_2=0x21
PacketCallFunc_2=OnActGodGiftlottery
PacketCMD_3=0xAA
PacketSubCMD_3=0x22
PacketCallFunc_3=OnActGodGiftReset
;集字活动
[PlayerActCollectWords]
ScriptName = Player\PlayerActCollectWords.py
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -14911,6 +14911,241 @@
#------------------------------------------------------
# AA 20 天帝礼包选择物品 #tagCMActGodGiftChooseItem
class  tagCMActGodGiftChooseItemInfo(Structure):
    ItemLibType = 0    #(BYTE ItemLibType)//物品库类型
    Count = 0    #(BYTE Count)//选择个数
    ItemNumList = list()    #(vector<BYTE> ItemNumList)//选择物品编号列表
    data = None
    def __init__(self):
        self.Clear()
        return
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        self.ItemLibType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.Count,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.Count):
            value,_pos=CommFunc.ReadBYTE(_lpData,_pos)
            self.ItemNumList.append(value)
        return _pos
    def Clear(self):
        self.ItemLibType = 0
        self.Count = 0
        self.ItemNumList = list()
        return
    def GetLength(self):
        length = 0
        length += 1
        length += 1
        length += 1 * self.Count
        return length
    def GetBuffer(self):
        data = ''
        data = CommFunc.WriteBYTE(data, self.ItemLibType)
        data = CommFunc.WriteBYTE(data, self.Count)
        for i in range(self.Count):
            data = CommFunc.WriteBYTE(data, self.ItemNumList[i])
        return data
    def OutputString(self):
        DumpString = '''
                                ItemLibType:%d,
                                Count:%d,
                                ItemNumList:%s
                                '''\
                                %(
                                self.ItemLibType,
                                self.Count,
                                "..."
                                )
        return DumpString
class  tagCMActGodGiftChooseItem(Structure):
    Head = tagHead()
    ActNum = 0    #(BYTE ActNum)//活动编号
    ChooseLibCount = 0    #(BYTE ChooseLibCount)//选择库个数
    ChooseItemList = list()    #(vector<tagCMActGodGiftChooseItemInfo> ChooseItemList)//选择库物品信息列表
    data = None
    def __init__(self):
        self.Clear()
        self.Head.Cmd = 0xAA
        self.Head.SubCmd = 0x20
        return
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        _pos = self.Head.ReadData(_lpData, _pos)
        self.ActNum,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.ChooseLibCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.ChooseLibCount):
            temChooseItemList = tagCMActGodGiftChooseItemInfo()
            _pos = temChooseItemList.ReadData(_lpData, _pos)
            self.ChooseItemList.append(temChooseItemList)
        return _pos
    def Clear(self):
        self.Head = tagHead()
        self.Head.Clear()
        self.Head.Cmd = 0xAA
        self.Head.SubCmd = 0x20
        self.ActNum = 0
        self.ChooseLibCount = 0
        self.ChooseItemList = list()
        return
    def GetLength(self):
        length = 0
        length += self.Head.GetLength()
        length += 1
        length += 1
        for i in range(self.ChooseLibCount):
            length += self.ChooseItemList[i].GetLength()
        return length
    def GetBuffer(self):
        data = ''
        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
        data = CommFunc.WriteBYTE(data, self.ActNum)
        data = CommFunc.WriteBYTE(data, self.ChooseLibCount)
        for i in range(self.ChooseLibCount):
            data = CommFunc.WriteString(data, self.ChooseItemList[i].GetLength(), self.ChooseItemList[i].GetBuffer())
        return data
    def OutputString(self):
        DumpString = '''
                                Head:%s,
                                ActNum:%d,
                                ChooseLibCount:%d,
                                ChooseItemList:%s
                                '''\
                                %(
                                self.Head.OutputString(),
                                self.ActNum,
                                self.ChooseLibCount,
                                "..."
                                )
        return DumpString
m_NAtagCMActGodGiftChooseItem=tagCMActGodGiftChooseItem()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMActGodGiftChooseItem.Head.Cmd,m_NAtagCMActGodGiftChooseItem.Head.SubCmd))] = m_NAtagCMActGodGiftChooseItem
#------------------------------------------------------
# AA 21 天帝礼包抽奖 #tagCMActGodGiftlottery
class  tagCMActGodGiftlottery(Structure):
    _pack_ = 1
    _fields_ = [
                  ("Cmd", c_ubyte),
                  ("SubCmd", c_ubyte),
                  ("ActNum", c_ubyte),    #活动编号
                  ]
    def __init__(self):
        self.Clear()
        self.Cmd = 0xAA
        self.SubCmd = 0x21
        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 = 0x21
        self.ActNum = 0
        return
    def GetLength(self):
        return sizeof(tagCMActGodGiftlottery)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// AA 21 天帝礼包抽奖 //tagCMActGodGiftlottery:
                                Cmd:%s,
                                SubCmd:%s,
                                ActNum:%d
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd,
                                self.ActNum
                                )
        return DumpString
m_NAtagCMActGodGiftlottery=tagCMActGodGiftlottery()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMActGodGiftlottery.Cmd,m_NAtagCMActGodGiftlottery.SubCmd))] = m_NAtagCMActGodGiftlottery
#------------------------------------------------------
# AA 22 天帝礼包重置 #tagCMActGodGiftReset
class  tagCMActGodGiftReset(Structure):
    _pack_ = 1
    _fields_ = [
                  ("Cmd", c_ubyte),
                  ("SubCmd", c_ubyte),
                  ("ActNum", c_ubyte),    #活动编号
                  ]
    def __init__(self):
        self.Clear()
        self.Cmd = 0xAA
        self.SubCmd = 0x22
        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 = 0x22
        self.ActNum = 0
        return
    def GetLength(self):
        return sizeof(tagCMActGodGiftReset)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// AA 22 天帝礼包重置 //tagCMActGodGiftReset:
                                Cmd:%s,
                                SubCmd:%s,
                                ActNum:%d
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd,
                                self.ActNum
                                )
        return DumpString
m_NAtagCMActGodGiftReset=tagCMActGodGiftReset()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMActGodGiftReset.Cmd,m_NAtagCMActGodGiftReset.SubCmd))] = m_NAtagCMActGodGiftReset
#------------------------------------------------------
# AA 12 选择转盘活动物品 #tagCMActTurntableChooseItem
class  tagCMActTurntableChooseItem(Structure):
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -29199,6 +29199,417 @@
#------------------------------------------------------
# AA 60 天帝礼包活动信息 #tagMCActGodGiftInfo
class  tagMCActGodGiftItem(Structure):
    _pack_ = 1
    _fields_ = [
                  ("ItemNum", c_ubyte),    # 物品在本库中的编号
                  ("ItemID", c_int),
                  ("ItemCount", c_ushort),
                  ("IsBind", c_ubyte),
                  ("CanChooseTimes", c_ubyte),    #可选择次数,0代表不限次数
                  ("ChooseTimes", c_ubyte),    #已选次数
                  ("IsChoose", 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.ItemNum = 0
        self.ItemID = 0
        self.ItemCount = 0
        self.IsBind = 0
        self.CanChooseTimes = 0
        self.ChooseTimes = 0
        self.IsChoose = 0
        return
    def GetLength(self):
        return sizeof(tagMCActGodGiftItem)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// AA 60 天帝礼包活动信息 //tagMCActGodGiftInfo:
                                ItemNum:%d,
                                ItemID:%d,
                                ItemCount:%d,
                                IsBind:%d,
                                CanChooseTimes:%d,
                                ChooseTimes:%d,
                                IsChoose:%d
                                '''\
                                %(
                                self.ItemNum,
                                self.ItemID,
                                self.ItemCount,
                                self.IsBind,
                                self.CanChooseTimes,
                                self.ChooseTimes,
                                self.IsChoose
                                )
        return DumpString
class  tagMCActGodGiftItemLib(Structure):
    ItemLibType = 0    #(BYTE ItemLibType)//物品库类型
    ChooseItemCount = 0    #(BYTE ChooseItemCount)//可选择物品个数
    ChooseItemList = list()    #(vector<tagMCActGodGiftItem> ChooseItemList)//可选物品列表
    data = None
    def __init__(self):
        self.Clear()
        return
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        self.ItemLibType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.ChooseItemCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.ChooseItemCount):
            temChooseItemList = tagMCActGodGiftItem()
            _pos = temChooseItemList.ReadData(_lpData, _pos)
            self.ChooseItemList.append(temChooseItemList)
        return _pos
    def Clear(self):
        self.ItemLibType = 0
        self.ChooseItemCount = 0
        self.ChooseItemList = list()
        return
    def GetLength(self):
        length = 0
        length += 1
        length += 1
        for i in range(self.ChooseItemCount):
            length += self.ChooseItemList[i].GetLength()
        return length
    def GetBuffer(self):
        data = ''
        data = CommFunc.WriteBYTE(data, self.ItemLibType)
        data = CommFunc.WriteBYTE(data, self.ChooseItemCount)
        for i in range(self.ChooseItemCount):
            data = CommFunc.WriteString(data, self.ChooseItemList[i].GetLength(), self.ChooseItemList[i].GetBuffer())
        return data
    def OutputString(self):
        DumpString = '''
                                ItemLibType:%d,
                                ChooseItemCount:%d,
                                ChooseItemList:%s
                                '''\
                                %(
                                self.ItemLibType,
                                self.ChooseItemCount,
                                "..."
                                )
        return DumpString
class  tagMCActGodGiftInfo(Structure):
    Head = tagHead()
    ActNum = 0    #(BYTE ActNum)// 活动编号
    StartDate = ""    #(char StartDate[10])// 开始日期 y-m-d
    EndtDate = ""    #(char EndtDate[10])// 结束日期 y-m-d
    IsDayReset = 0    #(BYTE IsDayReset)// 是否每日重置
    LimitLV = 0    #(WORD LimitLV)// 限制等级
    CostMoneyType = 0    #(BYTE CostMoneyType)//消耗货币类型
    CostMoneyValueCount = 0    #(BYTE CostMoneyValueCount)
    CostMoneyValueList = list()    #(vector<DWORD> CostMoneyValueList)//消耗货币值列表
    PrizeMoneyType = 0    #(BYTE PrizeMoneyType)//奖励货币类型
    PrizeMoneyValueCount = 0    #(BYTE PrizeMoneyValueCount)
    PrizeMoneyValueList = list()    #(vector<DWORD> PrizeMoneyValueList)//奖励货币值列表
    ResetLimitTimes = 0    #(BYTE ResetLimitTimes)//至少抽几次才可重置奖池
    ResetCountMax = 0    #(BYTE ResetCountMax)//最大可重置奖池次数
    IsAwardPoolOK = 0    #(BYTE IsAwardPoolOK)//奖池是否选择完毕,否的话需要先选择奖池才可抽奖
    ItemLibCount = 0    #(BYTE ItemLibCount)//奖池库个数
    ItemLibList = list()    #(vector<tagMCActGodGiftItemLib> ItemLibList)//奖池库信息列表
    data = None
    def __init__(self):
        self.Clear()
        self.Head.Cmd = 0xAA
        self.Head.SubCmd = 0x60
        return
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        _pos = self.Head.ReadData(_lpData, _pos)
        self.ActNum,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.StartDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
        self.EndtDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
        self.IsDayReset,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.LimitLV,_pos = CommFunc.ReadWORD(_lpData, _pos)
        self.CostMoneyType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.CostMoneyValueCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.CostMoneyValueCount):
            value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
            self.CostMoneyValueList.append(value)
        self.PrizeMoneyType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.PrizeMoneyValueCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.PrizeMoneyValueCount):
            value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
            self.PrizeMoneyValueList.append(value)
        self.ResetLimitTimes,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.ResetCountMax,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.IsAwardPoolOK,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.ItemLibCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.ItemLibCount):
            temItemLibList = tagMCActGodGiftItemLib()
            _pos = temItemLibList.ReadData(_lpData, _pos)
            self.ItemLibList.append(temItemLibList)
        return _pos
    def Clear(self):
        self.Head = tagHead()
        self.Head.Clear()
        self.Head.Cmd = 0xAA
        self.Head.SubCmd = 0x60
        self.ActNum = 0
        self.StartDate = ""
        self.EndtDate = ""
        self.IsDayReset = 0
        self.LimitLV = 0
        self.CostMoneyType = 0
        self.CostMoneyValueCount = 0
        self.CostMoneyValueList = list()
        self.PrizeMoneyType = 0
        self.PrizeMoneyValueCount = 0
        self.PrizeMoneyValueList = list()
        self.ResetLimitTimes = 0
        self.ResetCountMax = 0
        self.IsAwardPoolOK = 0
        self.ItemLibCount = 0
        self.ItemLibList = list()
        return
    def GetLength(self):
        length = 0
        length += self.Head.GetLength()
        length += 1
        length += 10
        length += 10
        length += 1
        length += 2
        length += 1
        length += 1
        length += 4 * self.CostMoneyValueCount
        length += 1
        length += 1
        length += 4 * self.PrizeMoneyValueCount
        length += 1
        length += 1
        length += 1
        length += 1
        for i in range(self.ItemLibCount):
            length += self.ItemLibList[i].GetLength()
        return length
    def GetBuffer(self):
        data = ''
        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
        data = CommFunc.WriteBYTE(data, self.ActNum)
        data = CommFunc.WriteString(data, 10, self.StartDate)
        data = CommFunc.WriteString(data, 10, self.EndtDate)
        data = CommFunc.WriteBYTE(data, self.IsDayReset)
        data = CommFunc.WriteWORD(data, self.LimitLV)
        data = CommFunc.WriteBYTE(data, self.CostMoneyType)
        data = CommFunc.WriteBYTE(data, self.CostMoneyValueCount)
        for i in range(self.CostMoneyValueCount):
            data = CommFunc.WriteDWORD(data, self.CostMoneyValueList[i])
        data = CommFunc.WriteBYTE(data, self.PrizeMoneyType)
        data = CommFunc.WriteBYTE(data, self.PrizeMoneyValueCount)
        for i in range(self.PrizeMoneyValueCount):
            data = CommFunc.WriteDWORD(data, self.PrizeMoneyValueList[i])
        data = CommFunc.WriteBYTE(data, self.ResetLimitTimes)
        data = CommFunc.WriteBYTE(data, self.ResetCountMax)
        data = CommFunc.WriteBYTE(data, self.IsAwardPoolOK)
        data = CommFunc.WriteBYTE(data, self.ItemLibCount)
        for i in range(self.ItemLibCount):
            data = CommFunc.WriteString(data, self.ItemLibList[i].GetLength(), self.ItemLibList[i].GetBuffer())
        return data
    def OutputString(self):
        DumpString = '''
                                Head:%s,
                                ActNum:%d,
                                StartDate:%s,
                                EndtDate:%s,
                                IsDayReset:%d,
                                LimitLV:%d,
                                CostMoneyType:%d,
                                CostMoneyValueCount:%d,
                                CostMoneyValueList:%s,
                                PrizeMoneyType:%d,
                                PrizeMoneyValueCount:%d,
                                PrizeMoneyValueList:%s,
                                ResetLimitTimes:%d,
                                ResetCountMax:%d,
                                IsAwardPoolOK:%d,
                                ItemLibCount:%d,
                                ItemLibList:%s
                                '''\
                                %(
                                self.Head.OutputString(),
                                self.ActNum,
                                self.StartDate,
                                self.EndtDate,
                                self.IsDayReset,
                                self.LimitLV,
                                self.CostMoneyType,
                                self.CostMoneyValueCount,
                                "...",
                                self.PrizeMoneyType,
                                self.PrizeMoneyValueCount,
                                "...",
                                self.ResetLimitTimes,
                                self.ResetCountMax,
                                self.IsAwardPoolOK,
                                self.ItemLibCount,
                                "..."
                                )
        return DumpString
m_NAtagMCActGodGiftInfo=tagMCActGodGiftInfo()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCActGodGiftInfo.Head.Cmd,m_NAtagMCActGodGiftInfo.Head.SubCmd))] = m_NAtagMCActGodGiftInfo
#------------------------------------------------------
# AA 61 天帝礼包活动玩家信息 #tagMCActGodGiftPlayerInfo
class  tagMCActGodGiftAwardItem(Structure):
    _pack_ = 1
    _fields_ = [
                  ("ItemLibType", c_ubyte),    #物品库类型
                  ("ItemNum", 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.ItemLibType = 0
        self.ItemNum = 0
        return
    def GetLength(self):
        return sizeof(tagMCActGodGiftAwardItem)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// AA 61 天帝礼包活动玩家信息 //tagMCActGodGiftPlayerInfo:
                                ItemLibType:%d,
                                ItemNum:%d
                                '''\
                                %(
                                self.ItemLibType,
                                self.ItemNum
                                )
        return DumpString
class  tagMCActGodGiftPlayerInfo(Structure):
    Head = tagHead()
    ActNum = 0    #(BYTE ActNum)// 活动编号
    ResetCount = 0    #(BYTE ResetCount)// 本次活动已重置次数
    AwardItemCount = 0    #(BYTE AwardItemCount)// 本次奖池已抽中奖品个数,也代表本次奖池已抽奖次数
    AwardItemList = list()    #(vector<tagMCActGodGiftAwardItem> AwardItemList)// 本次奖池已抽中物品列表
    data = None
    def __init__(self):
        self.Clear()
        self.Head.Cmd = 0xAA
        self.Head.SubCmd = 0x61
        return
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        _pos = self.Head.ReadData(_lpData, _pos)
        self.ActNum,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.ResetCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        self.AwardItemCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.AwardItemCount):
            temAwardItemList = tagMCActGodGiftAwardItem()
            _pos = temAwardItemList.ReadData(_lpData, _pos)
            self.AwardItemList.append(temAwardItemList)
        return _pos
    def Clear(self):
        self.Head = tagHead()
        self.Head.Clear()
        self.Head.Cmd = 0xAA
        self.Head.SubCmd = 0x61
        self.ActNum = 0
        self.ResetCount = 0
        self.AwardItemCount = 0
        self.AwardItemList = list()
        return
    def GetLength(self):
        length = 0
        length += self.Head.GetLength()
        length += 1
        length += 1
        length += 1
        for i in range(self.AwardItemCount):
            length += self.AwardItemList[i].GetLength()
        return length
    def GetBuffer(self):
        data = ''
        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
        data = CommFunc.WriteBYTE(data, self.ActNum)
        data = CommFunc.WriteBYTE(data, self.ResetCount)
        data = CommFunc.WriteBYTE(data, self.AwardItemCount)
        for i in range(self.AwardItemCount):
            data = CommFunc.WriteString(data, self.AwardItemList[i].GetLength(), self.AwardItemList[i].GetBuffer())
        return data
    def OutputString(self):
        DumpString = '''
                                Head:%s,
                                ActNum:%d,
                                ResetCount:%d,
                                AwardItemCount:%d,
                                AwardItemList:%s
                                '''\
                                %(
                                self.Head.OutputString(),
                                self.ActNum,
                                self.ResetCount,
                                self.AwardItemCount,
                                "..."
                                )
        return DumpString
m_NAtagMCActGodGiftPlayerInfo=tagMCActGodGiftPlayerInfo()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCActGodGiftPlayerInfo.Head.Cmd,m_NAtagMCActGodGiftPlayerInfo.Head.SubCmd))] = m_NAtagMCActGodGiftPlayerInfo
#------------------------------------------------------
# AA 31 成长必买活动信息 #tagMCActGrowupBuyInfo
class  tagMCActGrowupBuyCTGItem(Structure):
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -1296,6 +1296,28 @@
                        ("dict", "ItemAwardTimesTotalInfo", 0),
                        ),
                "ActGodGift":(
                        ("DWORD", "CfgID", 1),
                        ("char", "StartDate", 0),
                        ("char", "EndDate", 0),
                        ("BYTE", "IsDayReset", 0),
                        ("WORD", "LVLimit", 0),
                        ("list", "UseGoldList", 0),
                        ("list", "PrizeMoneyList", 0),
                        ("BYTE", "ResetLimitTimes", 0),
                        ("BYTE", "ResetCountMax", 0),
                        ("dict", "TemplateIDInfo", 0),
                        ),
                "ActGodGiftAward":(
                        ("DWORD", "TemplateID", 1),
                        ("BYTE", "AwardLibType", 0),
                        ("BYTE", "UnlockAwardLimitTimes", 0),
                        ("BYTE", "ChooseItemCount", 0),
                        ("dict", "LibItemInfo", 0),
                        ("list", "NotifyItemNumList", 0),
                        ),
                "ActHorsePetFeast":(
                        ("DWORD", "CfgID", 1),
                        ("char", "StartDate", 0),
@@ -4658,6 +4680,52 @@
    def GetItemLayerLimitInfo(self): return self.ItemLayerLimitInfo # 物品产出奖池层限制 {物品ID:大于等于X层可产出, ...}
    def GetItemAwardTimesTotalInfo(self): return self.ItemAwardTimesTotalInfo # 物品产出次数限制(所有层){物品ID:总产出次数, ...}
# 天帝礼包活动时间表
class IPY_ActGodGift():
    def __init__(self):
        self.CfgID = 0
        self.StartDate = ""
        self.EndDate = ""
        self.IsDayReset = 0
        self.LVLimit = 0
        self.UseGoldList = []
        self.PrizeMoneyList = []
        self.ResetLimitTimes = 0
        self.ResetCountMax = 0
        self.TemplateIDInfo = {}
        return
    def GetCfgID(self): return self.CfgID # 配置ID
    def GetStartDate(self): return self.StartDate # 开启日期
    def GetEndDate(self): return self.EndDate # 结束日期
    def GetIsDayReset(self): return self.IsDayReset # 是否每天重置
    def GetLVLimit(self): return self.LVLimit # 限制等级
    def GetUseGoldList(self): return self.UseGoldList # 抽奖消耗仙玉列表
    def GetPrizeMoneyList(self): return self.PrizeMoneyList # 奖励灵石列表
    def GetResetLimitTimes(self): return self.ResetLimitTimes # 至少抽几次可重置
    def GetResetCountMax(self): return self.ResetCountMax # 可重置次数
    def GetTemplateIDInfo(self): return self.TemplateIDInfo # 奖池模板信息 {(世界等级A,B):[模板编号列表, ...], ...}
# 天帝礼包奖池表
class IPY_ActGodGiftAward():
    def __init__(self):
        self.TemplateID = 0
        self.AwardLibType = 0
        self.UnlockAwardLimitTimes = 0
        self.ChooseItemCount = 0
        self.LibItemInfo = {}
        self.NotifyItemNumList = []
        return
    def GetTemplateID(self): return self.TemplateID # 奖池模板编号
    def GetAwardLibType(self): return self.AwardLibType # 奖励库类型
    def GetUnlockAwardLimitTimes(self): return self.UnlockAwardLimitTimes # 抽X次后可产出本库
    def GetChooseItemCount(self): return self.ChooseItemCount # 选择个数
    def GetLibItemInfo(self): return self.LibItemInfo # 物品编号对应物品信息 {物品编号:[物品ID,个数,是否拍品,可选次数], ...}  0不限次数
    def GetNotifyItemNumList(self): return self.NotifyItemNumList # 需要广播的编号列表
# 骑宠盛宴活动
class IPY_ActHorsePetFeast():
    
@@ -6433,6 +6501,10 @@
        self.ipyActXianXiaMJLen = len(self.ipyActXianXiaMJCache)
        self.ipyActXianXiaMJAwardCache = self.__LoadFileData("ActXianXiaMJAward", IPY_ActXianXiaMJAward)
        self.ipyActXianXiaMJAwardLen = len(self.ipyActXianXiaMJAwardCache)
        self.ipyActGodGiftCache = self.__LoadFileData("ActGodGift", IPY_ActGodGift)
        self.ipyActGodGiftLen = len(self.ipyActGodGiftCache)
        self.ipyActGodGiftAwardCache = self.__LoadFileData("ActGodGiftAward", IPY_ActGodGiftAward)
        self.ipyActGodGiftAwardLen = len(self.ipyActGodGiftAwardCache)
        self.ipyActHorsePetFeastCache = self.__LoadFileData("ActHorsePetFeast", IPY_ActHorsePetFeast)
        self.ipyActHorsePetFeastLen = len(self.ipyActHorsePetFeastCache)
        self.ipyActBossRebornCache = self.__LoadFileData("ActBossReborn", IPY_ActBossReborn)
@@ -7007,6 +7079,10 @@
    def GetActXianXiaMJByIndex(self, index): return self.ipyActXianXiaMJCache[index]
    def GetActXianXiaMJAwardCount(self): return self.ipyActXianXiaMJAwardLen
    def GetActXianXiaMJAwardByIndex(self, index): return self.ipyActXianXiaMJAwardCache[index]
    def GetActGodGiftCount(self): return self.ipyActGodGiftLen
    def GetActGodGiftByIndex(self, index): return self.ipyActGodGiftCache[index]
    def GetActGodGiftAwardCount(self): return self.ipyActGodGiftAwardLen
    def GetActGodGiftAwardByIndex(self, index): return self.ipyActGodGiftAwardCache[index]
    def GetActHorsePetFeastCount(self): return self.ipyActHorsePetFeastLen
    def GetActHorsePetFeastByIndex(self, index): return self.ipyActHorsePetFeastCache[index]
    def GetActBossRebornCount(self): return self.ipyActBossRebornLen
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -110,6 +110,7 @@
import PlayerActRechargePrize
import PlayerActGarbageSorting
import PlayerActXianXiaMJ
import PlayerActGodGift
import PlayerActRechargeRebateGold
import PlayerActManyDayRecharge
import PlayerActSingleRecharge
@@ -826,6 +827,8 @@
    PlayerActGarbageSorting.OnPlayerLogin(curPlayer)
    # 仙匣秘境活动
    PlayerActXianXiaMJ.OnPlayerLogin(curPlayer)
    # 天帝礼包活动
    PlayerActGodGift.OnPlayerLogin(curPlayer)
    # 多日连充活动
    PlayerActManyDayRecharge.OnPlayerLogin(curPlayer)
    # 单笔累充活动
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActGodGift.py
New file
@@ -0,0 +1,478 @@
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package Player.PlayerActGodGift
#
# @todo:天帝礼包活动
# @author hxp
# @date 2022-01-14
# @version 1.0
#
# 详细描述: 天帝礼包活动
#
#-------------------------------------------------------------------------------
#"""Version = 2022-01-14 15:00"""
#-------------------------------------------------------------------------------
import PyGameData
import ShareDefine
import PlayerControl
import IpyGameDataPY
import ItemControler
import ChPyNetSendPack
import NetPackCommon
import IPY_GameWorld
import ItemCommon
import GameWorld
import ChConfig
CostMoneyType = IPY_GameWorld.TYPE_Price_Gold_Money
PrizeMoneyType = IPY_GameWorld.TYPE_Price_Gold_Paper
def OnPlayerLogin(curPlayer):
    for actInfo in PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_GodGift, {}).values():
        actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0)
        __CheckPlayerGodGiftAction(curPlayer, actNum)
    return
def RefreshGodGiftActionInfo(actNum):
    ## 收到GameServer同步的活动信息,刷新活动信息
    playerManager = GameWorld.GetPlayerManager()
    for index in xrange(playerManager.GetPlayerCount()):
        curPlayer = playerManager.GetPlayerByIndex(index)
        if curPlayer.GetID() == 0:
            continue
        __CheckPlayerGodGiftAction(curPlayer, actNum)
    return
def __CheckPlayerGodGiftAction(curPlayer, actNum):
    ## 检查玩家活动数据信息
    playerID = curPlayer.GetPlayerID()
    actInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_GodGift, actNum)
    actID = actInfo.get(ShareDefine.ActKey_ID, 0)
    state = actInfo.get(ShareDefine.ActKey_State, 0)
    cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
    playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodGiftID % actNum) # 玩家身上的活动ID
    # 活动ID 相同的话不处理
    if actID == playerActID:
        GameWorld.DebugLog("天帝礼包活动ID不变,不处理!actNum=%s,actID=%s" % (actNum, actID), playerID)
    else:
        actWorldLV = actInfo.get(ShareDefine.ActKey_WorldLV, 0)
        templateID = __GetActTemplateID(actInfo)
        GameWorld.DebugLog("天帝礼包重置! actNum=%s,actID=%s,playerActID=%s,state=%s,cfgID=%s,actWorldLV=%s,templateID=%s"
                           % (actNum, actID, playerActID, state, cfgID, actWorldLV, templateID), playerID)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodGiftID % actNum, actID)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodGiftWorldLV % actNum, actWorldLV)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodGiftResetCount % actNum, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodGiftAwardPool % actNum, 0)
        awardIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActGodGiftAward", templateID) if templateID else []
        if awardIpyDataList:
            for awardIpyData in awardIpyDataList:
                libType = awardIpyData.GetAwardLibType()
                libItemInfoDict = awardIpyData.GetLibItemInfo()
                for num in libItemInfoDict.keys():
                    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodGiftItemState % (actNum, libType, num), 0)
    if state:
        Sync_GodGifActionInfo(curPlayer, actNum)
        Sync_GodGiftPlayerInfo(curPlayer, actNum)
    return True
def __GetActTemplateID(actInfo):
    cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
    dayIndex = actInfo.get(ShareDefine.ActKey_DayIndex, 0)
    worldLV = actInfo.get(ShareDefine.ActKey_WorldLV, 0)
    if cfgID == None or dayIndex == None:
        return 0
    ipyData = IpyGameDataPY.GetIpyGameData("ActGodGift", cfgID)
    if not ipyData:
        return 0
    templateIDInfo = ipyData.GetTemplateIDInfo()
    templateIDList = GameWorld.GetDictValueByRangeKey(templateIDInfo, worldLV)
    if not templateIDList:
        return 0
    templateID = templateIDList[-1] if dayIndex >= len(templateIDList) else templateIDList[dayIndex]
    return templateID
def GetGodGiftItemState(curPlayer, actNum, libType, num):
    itemState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodGiftItemState % (actNum, libType, num))
    chooseTimes = itemState / 100
    isChoose = (itemState - chooseTimes * 100) / 10
    isGot = itemState % 10
    return chooseTimes, isChoose, isGot
def SetGodGiftItemState(curPlayer, actNum, libType, num, chooseTimes, isChoose, isGot):
    updItemState = chooseTimes * 100 + isChoose * 10 + isGot
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodGiftItemState % (actNum, libType, num), updItemState)
    return updItemState
#// AA 20 天帝礼包选择物品 #tagCMActGodGiftChooseItem
#
#struct    tagCMActGodGiftChooseItemInfo
#{
#    BYTE        ItemLibType;    //物品库类型
#    BYTE        Count;        //选择个数
#    BYTE        ItemNumList[Count];    //选择物品编号列表
#};
#
#struct    tagCMActGodGiftChooseItem
#{
#    tagHead        Head;
#    BYTE        ActNum;        //活动编号
#    BYTE        ChooseLibCount;    //选择库个数
#    tagCMActGodGiftChooseItemInfo    ChooseItemList[ChooseLibCount];    //选择库物品信息列表
#};
def OnActGodGiftChooseItem(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    playerID = curPlayer.GetPlayerID()
    actNum = clientData.ActNum
    chooseItemNumDict = {info.ItemLibType:info.ItemNumList for info in clientData.ChooseItemList}
    actInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_GodGift, actNum)
    state = actInfo.get(ShareDefine.ActKey_State, 0)
    cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
    templateID = __GetActTemplateID(actInfo)
    GameWorld.DebugLog("天帝礼包选择物品: actNum=%s,state=%s,cfgID=%s,templateID=%s,chooseItemNumDict=%s"
                       % (actNum, state, cfgID, templateID, chooseItemNumDict), playerID)
    if not state or not cfgID or not templateID:
        GameWorld.DebugLog("天帝礼包活动状态异常!", playerID)
        return
    if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodGiftAwardPool % actNum):
        GameWorld.DebugLog("天帝礼包奖池已经选择完毕,无法重复选择!", playerID)
        return
    awardIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActGodGiftAward", templateID) if templateID else []
    if not awardIpyDataList:
        return
    chooseOKLibList = []
    for awardIpyData in awardIpyDataList:
        libType = awardIpyData.GetAwardLibType()
        chooseItemNumList = chooseItemNumDict.get(libType, [])
        libItemInfoDict = awardIpyData.GetLibItemInfo()
        needChooseCount = awardIpyData.GetChooseItemCount()
        hadChooseNumList, canChooseNumList = [], []
        for num, itemInfo in libItemInfoDict.items():
            canChooseTimes = itemInfo[4]
            chooseTimes, isChoose, _ = GetGodGiftItemState(curPlayer, actNum, libType, num)
            if isChoose:
                hadChooseNumList.append(num)
            elif not canChooseTimes or chooseTimes < canChooseTimes:
                canChooseNumList.append(num)
        GameWorld.DebugLog("天帝礼包选择库奖品! libType=%s,chooseItemNumList=%s" % (libType, chooseItemNumList), playerID)
        GameWorld.DebugLog("    needChooseCount=%s,hadChooseNumList=%s,canChooseNumList=%s" % (needChooseCount, hadChooseNumList, str(canChooseNumList)), playerID)
        hadChooseCount = len(hadChooseNumList)
        if hadChooseCount >= needChooseCount:
            GameWorld.DebugLog("    该库已超过选择完毕! libType=%s" % libType, playerID)
            chooseOKLibList.append(libType)
            continue
        for num in chooseItemNumList:
            if num in hadChooseNumList:
                GameWorld.DebugLog("    已被选择! libType=%s,num=%s" % (libType, num), playerID)
                continue
            if num not in canChooseNumList:
                GameWorld.DebugLog("    不可选择! libType=%s,num=%s not in %s" % (libType, num, canChooseNumList), playerID)
                continue
            chooseTimes, isChoose, isGot = GetGodGiftItemState(curPlayer, actNum, libType, num)
            chooseTimes += 1
            isChoose = 1
            updItemState = SetGodGiftItemState(curPlayer, actNum, libType, num, chooseTimes, isChoose, isGot)
            GameWorld.DebugLog("    选择奖品! libType=%s,num=%s,chooseTimes=%s,isChoose=%s,isGot=%s,updItemState=%s"
                               % (libType, num, chooseTimes, isChoose, isGot, updItemState), playerID)
            canChooseNumList.remove(num)
            hadChooseCount += 1
            if hadChooseCount >= needChooseCount or not canChooseNumList:
                chooseOKLibList.append(libType)
                break
    if chooseOKLibList and len(chooseOKLibList) == len(awardIpyDataList):
        GameWorld.DebugLog("天帝礼包生成奖池OK!", playerID)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodGiftAwardPool % actNum, 1)
    else:
        GameWorld.DebugLog("天帝礼包奖池未选择完毕! chooseOKLibList=%s" % chooseOKLibList, playerID)
    Sync_GodGifActionInfo(curPlayer, actNum)
    return
#// AA 21 天帝礼包抽奖 #tagCMActGodGiftlottery
#
#struct    tagCMActGodGiftlottery
#{
#    tagHead        Head;
#    BYTE        ActNum;        //活动编号
#};
def OnActGodGiftlottery(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    playerID = curPlayer.GetPlayerID()
    actNum = clientData.ActNum
    actInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_GodGift, actNum)
    state = actInfo.get(ShareDefine.ActKey_State, 0)
    cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
    templateID = __GetActTemplateID(actInfo)
    GameWorld.DebugLog("天帝礼包活动抽奖: actNum=%s,state=%s,cfgID=%s,templateID=%s" % (actNum, state, cfgID, templateID), playerID)
    if not state or not cfgID or not templateID:
        GameWorld.DebugLog("天帝礼包活动状态异常!", playerID)
        return
    if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodGiftAwardPool % actNum):
        GameWorld.DebugLog("天帝礼包奖池未选择完毕,无法抽奖!", playerID)
        return
    ipyData = IpyGameDataPY.GetIpyGameData("ActGodGift", cfgID)
    if not ipyData:
        return
    costMoneyValueList = ipyData.GetUseGoldList()
    prizeMoneyValueList = ipyData.GetPrizeMoneyList()
    awardIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActGodGiftAward", templateID) if templateID else []
    if not awardIpyDataList:
        return
    gotAwardList = [] # 已抽奖品次数
    randItemWeightList = []
    for awardIpyData in awardIpyDataList:
        libType = awardIpyData.GetAwardLibType()
        libItemInfoDict = awardIpyData.GetLibItemInfo()
        notifyItemNumList = awardIpyData.GetNotifyItemNumList()
        for num, itemInfo in libItemInfoDict.items():
            weight, itemID, itemCount, isBind = itemInfo[:4]
            chooseTimes, isChoose, isGot = GetGodGiftItemState(curPlayer, actNum, libType, num)
            if isGot:
                gotAwardList.append([libType, num])
                continue
            if not isChoose:
                continue
            isNotify = num in notifyItemNumList
            randItemWeightList.append([weight, libType, num, itemID, itemCount, isBind, chooseTimes, isChoose, isGot, isNotify])
    if not randItemWeightList:
        GameWorld.DebugLog("本次奖池已抽完!", playerID)
        return
    awardCount = len(gotAwardList) # 已抽奖次数
    costMoneyValue = costMoneyValueList[awardCount] if awardCount < len(costMoneyValueList) else costMoneyValueList[-1]
    prizeMoneyValue = prizeMoneyValueList[awardCount] if awardCount < len(prizeMoneyValueList) else prizeMoneyValueList[-1]
    if not PlayerControl.HaveMoney(curPlayer, CostMoneyType, costMoneyValue):
        return
    if not ItemCommon.CheckPackHasSpace(curPlayer, IPY_GameWorld.rptItem, True):
        return
    GameWorld.DebugLog("    已抽库,编号列表: awardCount=%s, %s" % (awardCount, gotAwardList), playerID)
    GameWorld.DebugLog("    costMoneyValue=%s,prizeMoneyValue=%s" % (costMoneyValue, prizeMoneyValue), playerID)
    GameWorld.DebugLog("    randItemWeightList=%s" % randItemWeightList, playerID)
    randItemInfo = GameWorld.GetResultByWeightList(randItemWeightList)
    if not randItemInfo:
        return
    libType, num, itemID, itemCount, isBind, chooseTimes, isChoose, isGot, isNotify = randItemInfo
    GameWorld.DebugLog("    抽中: libType=%s,num=%s,itemID=%s,itemCount=%s,isBind=%s,chooseTimes=%s,isChoose=%s,isGot=%s"
                       % (libType, num, itemID, itemCount, isBind, chooseTimes, isChoose, isGot), playerID)
    infoDict = {"actNum":actNum, "awardCount":awardCount}
    if not PlayerControl.PayMoney(curPlayer, CostMoneyType, costMoneyValue, ChConfig.Def_Cost_ActGodGift, infoDict):
        return
    isGot = 1
    updItemState = SetGodGiftItemState(curPlayer, actNum, libType, num, chooseTimes, isChoose, isGot)
    GameWorld.DebugLog("    更新库编号物品状态: libType=%s,num=%s,updItemState=%s" % (libType, num, updItemState), playerID)
    Sync_GodGiftPlayerInfo(curPlayer, actNum)
    addDataDict = {"actNum":actNum, "awardCount":awardCount}
    PlayerControl.GiveMoney(curPlayer, PrizeMoneyType, prizeMoneyValue, ChConfig.Def_GiveMoney_ActGodGift, addDataDict)
    if ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isBind, [IPY_GameWorld.rptItem], event=["ActGodGift", False, {}]):
        if isNotify:
            PlayerControl.WorldNotify(0, "ActGodGiftNotify", [curPlayer.GetPlayerName(), itemID, itemCount])
    if len(randItemWeightList) == 1:
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodGiftAwardPool % actNum, 2)
        GameWorld.DebugLog("    奖池已被抽完!", playerID)
    return
#// AA 22 天帝礼包重置 #tagCMActGodGiftReset
#
#struct    tagCMActGodGiftReset
#{
#    tagHead        Head;
#    BYTE        ActNum;        //活动编号
#};
def OnActGodGiftReset(index, clientData, tick):
    curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
    playerID = curPlayer.GetPlayerID()
    actNum = clientData.ActNum
    actInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_GodGift, actNum)
    state = actInfo.get(ShareDefine.ActKey_State, 0)
    cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
    templateID = __GetActTemplateID(actInfo)
    GameWorld.DebugLog("天帝礼包重置奖池: actNum=%s,state=%s,cfgID=%s,templateID=%s" % (actNum, state, cfgID, templateID), playerID)
    if not state or not cfgID or not templateID:
        GameWorld.DebugLog("天帝礼包活动状态异常!", playerID)
        return
    ipyData = IpyGameDataPY.GetIpyGameData("ActGodGift", cfgID)
    if not ipyData:
        return
    resetLimitTimes = ipyData.GetResetLimitTimes()
    resetCountMax = ipyData.GetResetCountMax()
    resetCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodGiftResetCount % actNum)
    if resetCount >= resetCountMax:
        GameWorld.DebugLog("天帝礼包已超过最大重置奖池次数! cfgID=%s,resetCount=%s >= %s" % (cfgID, resetCount, resetCountMax), playerID)
        return
    awardIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActGodGiftAward", templateID) if templateID else []
    if not awardIpyDataList:
        return
    if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodGiftAwardPool % actNum) != 2:
        awardCount = 0
        for awardIpyData in awardIpyDataList:
            libType = awardIpyData.GetAwardLibType()
            libItemInfoDict = awardIpyData.GetLibItemInfo()
            for num in libItemInfoDict.keys():
                _, _, isGot = GetGodGiftItemState(curPlayer, actNum, libType, num)
                if isGot:
                    awardCount += 1
        if awardCount < resetLimitTimes:
            GameWorld.DebugLog("天帝礼包已抽奖次数不足,无法重置奖池! cfgID=%s,awardCount=%s < %s" % (cfgID, awardCount, resetLimitTimes), playerID)
            return
    else:
        GameWorld.DebugLog("奖池已抽完,重置时不需要判断次数!", playerID)
    # 重置奖池
    for awardIpyData in awardIpyDataList:
        libType = awardIpyData.GetAwardLibType()
        libItemInfoDict = awardIpyData.GetLibItemInfo()
        for num in libItemInfoDict.keys():
            chooseTimes, isChoose, isGot = GetGodGiftItemState(curPlayer, actNum, libType, num)
            if not isChoose and not isGot:
                continue
            isChoose, isGot = 0, 0
            updItemState = SetGodGiftItemState(curPlayer, actNum, libType, num, chooseTimes, isChoose, isGot)
            GameWorld.DebugLog("    重置库奖品状态: libType=%s,num=%s,chooseTimes=%s,updItemState=%s"
                               % (libType, num, chooseTimes, updItemState), playerID)
    updResetCount = resetCount + 1
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodGiftResetCount % actNum, updResetCount)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GodGiftAwardPool % actNum, 0)
    GameWorld.DebugLog("    重置奖池成功: updResetCount=%s" % updResetCount, playerID)
    Sync_GodGifActionInfo(curPlayer, actNum)
    Sync_GodGiftPlayerInfo(curPlayer, actNum)
    return
def Sync_GodGifActionInfo(curPlayer, actNum):
    actInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_GodGift, actNum)
    state = actInfo.get(ShareDefine.ActKey_State, 0)
    cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
    if not state or not cfgID:
        return
    templateID = __GetActTemplateID(actInfo)
    if not templateID:
        return
    ipyData = IpyGameDataPY.GetIpyGameData("ActGodGift", cfgID)
    if not ipyData:
        return 0
    startDateStr, endDateStr = GameWorld.GetOperationActionDateStr(ipyData)
    clientPack = ChPyNetSendPack.tagMCActGodGiftInfo()
    clientPack.ActNum = actNum
    clientPack.StartDate = startDateStr
    clientPack.EndtDate = endDateStr
    clientPack.IsDayReset = ipyData.GetIsDayReset()
    clientPack.LimitLV = ipyData.GetLVLimit()
    clientPack.CostMoneyType = CostMoneyType
    clientPack.CostMoneyValueList = ipyData.GetUseGoldList()
    clientPack.CostMoneyValueCount = len(clientPack.CostMoneyValueList)
    clientPack.PrizeMoneyType = PrizeMoneyType
    clientPack.PrizeMoneyValueList = ipyData.GetPrizeMoneyList()
    clientPack.PrizeMoneyValueCount = len(clientPack.PrizeMoneyValueList)
    clientPack.ResetLimitTimes = ipyData.GetResetLimitTimes()
    clientPack.ResetCountMax = ipyData.GetResetCountMax()
    clientPack.ItemLibList = []
    awardIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActGodGiftAward", templateID) if templateID else []
    if awardIpyDataList:
        for awardIpyData in awardIpyDataList:
            libType = awardIpyData.GetAwardLibType()
            libItemInfoDict = awardIpyData.GetLibItemInfo()
            itemLib = ChPyNetSendPack.tagMCActGodGiftItemLib()
            itemLib.ItemLibType = libType
            itemLib.ChooseItemList = []
            for num, itemInfo in libItemInfoDict.items():
                _, itemID, itemCount, isBind, canChooseTimes = itemInfo
                chooseTimes, isChoose, _ = GetGodGiftItemState(curPlayer, actNum, libType, num)
                item = ChPyNetSendPack.tagMCActGodGiftItem()
                item.ItemNum = num
                item.ItemID = itemID
                item.ItemCount = itemCount
                item.IsBind = isBind
                item.CanChooseTimes = canChooseTimes
                item.ChooseTimes = chooseTimes
                item.IsChoose = isChoose
                itemLib.ChooseItemList.append(item)
            itemLib.ChooseItemCount = len(itemLib.ChooseItemList)
            clientPack.ItemLibList.append(itemLib)
    clientPack.ItemLibCount = len(clientPack.ItemLibList)
    clientPack.IsAwardPoolOK = 1 if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodGiftAwardPool % actNum) == 1 else 0
    NetPackCommon.SendFakePack(curPlayer, clientPack)
    return
def Sync_GodGiftPlayerInfo(curPlayer, actNum):
    actInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_GodGift, actNum)
    state = actInfo.get(ShareDefine.ActKey_State, 0)
    if not state:
        return
    templateID = __GetActTemplateID(actInfo)
    if not templateID:
        return
    clientPack = ChPyNetSendPack.tagMCActGodGiftPlayerInfo()
    clientPack.ActNum = actNum
    clientPack.ResetCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GodGiftResetCount % actNum)
    clientPack.AwardItemList = []
    awardIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActGodGiftAward", templateID) if templateID else []
    if awardIpyDataList:
        for awardIpyData in awardIpyDataList:
            libType = awardIpyData.GetAwardLibType()
            libItemInfoDict = awardIpyData.GetLibItemInfo()
            for num in libItemInfoDict.keys():
                _, _, isGot = GetGodGiftItemState(curPlayer, actNum, libType, num)
                if not isGot:
                    continue
                awardItem = ChPyNetSendPack.tagMCActGodGiftAwardItem()
                awardItem.ItemLibType = libType
                awardItem.ItemNum = num
                clientPack.AwardItemList.append(awardItem)
    clientPack.AwardItemCount = len(clientPack.AwardItemList)
    NetPackCommon.SendFakePack(curPlayer, clientPack)
    return
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
@@ -82,6 +82,7 @@
import PlayerActTotalRecharge
import PlayerActGarbageSorting
import PlayerActXianXiaMJ
import PlayerActGodGift
import PlayerActRechargeRebateGold
import PlayerActManyDayRecharge
import PlayerActSingleRecharge
@@ -1400,6 +1401,9 @@
            elif actionName == ShareDefine.OperationActionName_XianXiaMJ:
                PlayerActXianXiaMJ.RefreshXianXiaMJActionInfo(actNum)
                
            elif actionName == ShareDefine.OperationActionName_GodGift:
                PlayerActGodGift.RefreshGodGiftActionInfo(actNum)
            elif actionName == ShareDefine.OperationActionName_ManyDayRecharge:
                PlayerActManyDayRecharge.RefreshManyDayRechargeActionInfo(actNum)