hxp
2020-12-22 bf78ded072f95e416e9f272813ec5c5cc7040a50
8665 【主干】【后端】移植-成长特惠; (BT单: 8611 【BT】成长必买;)
12个文件已修改
1个文件已添加
577 ■■■■■ 已修改文件
PySysDB/PySysDBG.h 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
PySysDB/PySysDBPY.h 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py 138 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py 138 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py 26 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActGrowupBuy.py 173 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
PySysDB/PySysDBG.h
@@ -561,6 +561,21 @@
    BYTE        IsDayReset;    //是否每天重置
};
//成长必买活动表
struct tagActGrowupBuy
{
    DWORD        _CfgID;    //配置ID
    char        ActMark;    //活动组标记
    list        PlatformList;    //活动平台列表["平台A", "平台A", ...],配[]代表所有
    list        ServerGroupIDList;    //服务器ID列表
    char        StartDate;    //开启日期
    char        EndDate;    //结束日期
    dict        NotifyInfoStart;    //全服提示信息 - 相对开始时间
    dict        NotifyInfoEnd;    //全服提示信息 - 相对结束时间
    list        NotifyInfoLoop;    //全服提示信息 - 循环广播[间隔分钟, 广播key]
};
//累计充值活动表
struct tagActTotalRecharge
PySysDB/PySysDBPY.h
@@ -1632,6 +1632,16 @@
    char        NotifyKey;        //全服广播key,默认两个参数(玩家名, 档位额度)
};
//成长必买活动表
struct tagActGrowupBuy
{
    DWORD        _CfgID;    //配置ID
    char        StartDate;    //开启日期
    char        EndDate;    //结束日期
    list        CTGIDGroupList;    //充值编号组列表 [[ctgID, ...], ...]
};
//法宝副本表
struct tagMagicWeaponFB
ServerPython/CoreServerGroup/GameServer/Script/ChPyNetSendPack.py
@@ -24231,6 +24231,144 @@
#------------------------------------------------------
# AA 31 成长必买活动信息 #tagMCActGrowupBuyInfo
class  tagMCActGrowupBuyGroup(Structure):
    BuyCount = 0    #(BYTE BuyCount)// 循环购买礼包数
    BuyCTGIDList = list()    #(vector<DWORD> BuyCTGIDList)// 循环购买礼包充值ID列表
    PlayerBuyIndex = 0    #(BYTE PlayerBuyIndex)// 玩家当前可购买的礼包充值ID在列表中索引
    data = None
    def __init__(self):
        self.Clear()
        return
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        self.BuyCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.BuyCount):
            value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
            self.BuyCTGIDList.append(value)
        self.PlayerBuyIndex,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        return _pos
    def Clear(self):
        self.BuyCount = 0
        self.BuyCTGIDList = list()
        self.PlayerBuyIndex = 0
        return
    def GetLength(self):
        length = 0
        length += 1
        length += 4 * self.BuyCount
        length += 1
        return length
    def GetBuffer(self):
        data = ''
        data = CommFunc.WriteBYTE(data, self.BuyCount)
        for i in range(self.BuyCount):
            data = CommFunc.WriteDWORD(data, self.BuyCTGIDList[i])
        data = CommFunc.WriteBYTE(data, self.PlayerBuyIndex)
        return data
    def OutputString(self):
        DumpString = '''
                                BuyCount:%d,
                                BuyCTGIDList:%s,
                                PlayerBuyIndex:%d
                                '''\
                                %(
                                self.BuyCount,
                                "...",
                                self.PlayerBuyIndex
                                )
        return DumpString
class  tagMCActGrowupBuyInfo(Structure):
    Head = tagHead()
    StartDate = ""    #(char StartDate[10])// 开始日期 y-m-d
    EndtDate = ""    #(char EndtDate[10])// 结束日期 y-m-d
    GroupCount = 0    #(BYTE GroupCount)// 循环购买礼包组数
    GroupList = list()    #(vector<tagMCActGrowupBuyGroup> GroupList)//循环购买礼包组列表
    data = None
    def __init__(self):
        self.Clear()
        self.Head.Cmd = 0xAA
        self.Head.SubCmd = 0x31
        return
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        _pos = self.Head.ReadData(_lpData, _pos)
        self.StartDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
        self.EndtDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
        self.GroupCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.GroupCount):
            temGroupList = tagMCActGrowupBuyGroup()
            _pos = temGroupList.ReadData(_lpData, _pos)
            self.GroupList.append(temGroupList)
        return _pos
    def Clear(self):
        self.Head = tagHead()
        self.Head.Clear()
        self.Head.Cmd = 0xAA
        self.Head.SubCmd = 0x31
        self.StartDate = ""
        self.EndtDate = ""
        self.GroupCount = 0
        self.GroupList = list()
        return
    def GetLength(self):
        length = 0
        length += self.Head.GetLength()
        length += 10
        length += 10
        length += 1
        for i in range(self.GroupCount):
            length += self.GroupList[i].GetLength()
        return length
    def GetBuffer(self):
        data = ''
        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
        data = CommFunc.WriteString(data, 10, self.StartDate)
        data = CommFunc.WriteString(data, 10, self.EndtDate)
        data = CommFunc.WriteBYTE(data, self.GroupCount)
        for i in range(self.GroupCount):
            data = CommFunc.WriteString(data, self.GroupList[i].GetLength(), self.GroupList[i].GetBuffer())
        return data
    def OutputString(self):
        DumpString = '''
                                Head:%s,
                                StartDate:%s,
                                EndtDate:%s,
                                GroupCount:%d,
                                GroupList:%s
                                '''\
                                %(
                                self.Head.OutputString(),
                                self.StartDate,
                                self.EndtDate,
                                self.GroupCount,
                                "..."
                                )
        return DumpString
m_NAtagMCActGrowupBuyInfo=tagMCActGrowupBuyInfo()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCActGrowupBuyInfo.Head.Cmd,m_NAtagMCActGrowupBuyInfo.Head.SubCmd))] = m_NAtagMCActGrowupBuyInfo
#------------------------------------------------------
# AA 0C 登录奖励活动信息 #tagMCActLoginAwardInfo
class  tagMCActLoginAwardAction(Structure):
ServerPython/CoreServerGroup/GameServer/Script/IpyGameDataPY.py
@@ -470,6 +470,18 @@
                        ("BYTE", "IsDayReset", 0),
                        ),
                "ActGrowupBuy":(
                        ("DWORD", "CfgID", 1),
                        ("char", "ActMark", 0),
                        ("list", "PlatformList", 0),
                        ("list", "ServerGroupIDList", 0),
                        ("char", "StartDate", 0),
                        ("char", "EndDate", 0),
                        ("dict", "NotifyInfoStart", 0),
                        ("dict", "NotifyInfoEnd", 0),
                        ("list", "NotifyInfoLoop", 0),
                        ),
                "ActTotalRecharge":(
                        ("DWORD", "CfgID", 1),
                        ("char", "ActMark", 0),
@@ -1545,6 +1557,31 @@
    def GetNotifyInfoLoop(self): return self.NotifyInfoLoop # 全服提示信息 - 循环广播[间隔分钟, 广播key]
    def GetIsDayReset(self): return self.IsDayReset # 是否每天重置
# 成长必买活动表
class IPY_ActGrowupBuy():
    def __init__(self):
        self.CfgID = 0
        self.ActMark = ""
        self.PlatformList = []
        self.ServerGroupIDList = []
        self.StartDate = ""
        self.EndDate = ""
        self.NotifyInfoStart = {}
        self.NotifyInfoEnd = {}
        self.NotifyInfoLoop = []
        return
    def GetCfgID(self): return self.CfgID # 配置ID
    def GetActMark(self): return self.ActMark # 活动组标记
    def GetPlatformList(self): return self.PlatformList # 活动平台列表["平台A", "平台A", ...],配[]代表所有
    def GetServerGroupIDList(self): return self.ServerGroupIDList # 服务器ID列表
    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]
# 累计充值活动表
class IPY_ActTotalRecharge():
    
@@ -1979,6 +2016,8 @@
        self.ipyActWishingWellLen = len(self.ipyActWishingWellCache)
        self.ipyActRechargePrizeCache = self.__LoadFileData("ActRechargePrize", IPY_ActRechargePrize)
        self.ipyActRechargePrizeLen = len(self.ipyActRechargePrizeCache)
        self.ipyActGrowupBuyCache = self.__LoadFileData("ActGrowupBuy", IPY_ActGrowupBuy)
        self.ipyActGrowupBuyLen = len(self.ipyActGrowupBuyCache)
        self.ipyActTotalRechargeCache = self.__LoadFileData("ActTotalRecharge", IPY_ActTotalRecharge)
        self.ipyActTotalRechargeLen = len(self.ipyActTotalRechargeCache)
        self.ipyCrossZoneCommCache = self.__LoadFileData("CrossZoneComm", IPY_CrossZoneComm)
@@ -2259,6 +2298,8 @@
    def GetActWishingWellByIndex(self, index): return self.ipyActWishingWellCache[index]
    def GetActRechargePrizeCount(self): return self.ipyActRechargePrizeLen
    def GetActRechargePrizeByIndex(self, index): return self.ipyActRechargePrizeCache[index]
    def GetActGrowupBuyCount(self): return self.ipyActGrowupBuyLen
    def GetActGrowupBuyByIndex(self, index): return self.ipyActGrowupBuyCache[index]
    def GetActTotalRechargeCount(self): return self.ipyActTotalRechargeLen
    def GetActTotalRechargeByIndex(self, index): return self.ipyActTotalRechargeCache[index]
    def GetCrossZoneCommCount(self): return self.ipyCrossZoneCommLen
ServerPython/CoreServerGroup/GameServer/Script/ShareDefine.py
@@ -220,6 +220,7 @@
OperationActionName_CollectWords2 = "ActCollectWords2" # 集字活动2
OperationActionName_LuckyTreasure = "ActLuckyTreasure" # 幸运鉴宝活动
OperationActionName_RechargePrize = "ActRechargePrize" # 充值返利活动
OperationActionName_GrowupBuy = "ActGrowupBuy" # 成长必买活动
#节日活动类型列表 - 该类型无视开服天,日期到了就开启
FeastOperationActionNameList = [OperationActionName_FeastWeekParty, OperationActionName_FeastRedPacket]
#所有的运营活动列表,含节日活动
@@ -231,8 +232,9 @@
                           OperationActionName_WeekParty, OperationActionName_LoginAward, 
                           OperationActionName_NewFairyCeremony, OperationActionName_LuckyTreasure,
                           OperationActionName_DailyGiftbag, OperationActionName_RechargePrize, 
                           OperationActionName_CollectWords, OperationActionName_CollectWords2] \
                           + FeastOperationActionNameList
                           OperationActionName_CollectWords, OperationActionName_CollectWords2,
                           OperationActionName_GrowupBuy
                           ] + FeastOperationActionNameList
#需要记录开启活动时的世界等级的运营活动
NeedWorldLVOperationActNameList = [OperationActionName_FairyCeremony, OperationActionName_WishingWell, 
                                   OperationActionName_NewFairyCeremony, OperationActionName_FlashSale,
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3705,6 +3705,10 @@
Def_PDict_RechargePrizeID = "RechargePrizeID"  # 玩家身上的重置返利活动ID,唯一标识,取活动开始日期time值
Def_PDict_RechargePrizeCount = "RechargePrizeCount_%s"  # 返利奖励次数,参数(充值表充值ID)
#成长必买活动
Def_PDict_GrowupBuyID = "GrowupBuyID"  # 玩家身上的重置成长必买活动ID,唯一标识,取活动开始日期time值
Def_PDict_GrowupBuyState = "GrowupBuyState"  # 当前可购买的活动充值ID索引状态,按组索引位存储对应组可购买的充值ID所对应的索引
#限时特惠活动
Def_PDict_SpringSaleID = "SpringSaleID"  # 玩家身上的限时特惠活动ID,唯一标识,取活动开始日期time
Def_PDict_SpringSaleMailState = "SpringSaleMailState"  # 玩家身上的活动更新提醒邮件状态
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -24231,6 +24231,144 @@
#------------------------------------------------------
# AA 31 成长必买活动信息 #tagMCActGrowupBuyInfo
class  tagMCActGrowupBuyGroup(Structure):
    BuyCount = 0    #(BYTE BuyCount)// 循环购买礼包数
    BuyCTGIDList = list()    #(vector<DWORD> BuyCTGIDList)// 循环购买礼包充值ID列表
    PlayerBuyIndex = 0    #(BYTE PlayerBuyIndex)// 玩家当前可购买的礼包充值ID在列表中索引
    data = None
    def __init__(self):
        self.Clear()
        return
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        self.BuyCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.BuyCount):
            value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
            self.BuyCTGIDList.append(value)
        self.PlayerBuyIndex,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        return _pos
    def Clear(self):
        self.BuyCount = 0
        self.BuyCTGIDList = list()
        self.PlayerBuyIndex = 0
        return
    def GetLength(self):
        length = 0
        length += 1
        length += 4 * self.BuyCount
        length += 1
        return length
    def GetBuffer(self):
        data = ''
        data = CommFunc.WriteBYTE(data, self.BuyCount)
        for i in range(self.BuyCount):
            data = CommFunc.WriteDWORD(data, self.BuyCTGIDList[i])
        data = CommFunc.WriteBYTE(data, self.PlayerBuyIndex)
        return data
    def OutputString(self):
        DumpString = '''
                                BuyCount:%d,
                                BuyCTGIDList:%s,
                                PlayerBuyIndex:%d
                                '''\
                                %(
                                self.BuyCount,
                                "...",
                                self.PlayerBuyIndex
                                )
        return DumpString
class  tagMCActGrowupBuyInfo(Structure):
    Head = tagHead()
    StartDate = ""    #(char StartDate[10])// 开始日期 y-m-d
    EndtDate = ""    #(char EndtDate[10])// 结束日期 y-m-d
    GroupCount = 0    #(BYTE GroupCount)// 循环购买礼包组数
    GroupList = list()    #(vector<tagMCActGrowupBuyGroup> GroupList)//循环购买礼包组列表
    data = None
    def __init__(self):
        self.Clear()
        self.Head.Cmd = 0xAA
        self.Head.SubCmd = 0x31
        return
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        _pos = self.Head.ReadData(_lpData, _pos)
        self.StartDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
        self.EndtDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
        self.GroupCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.GroupCount):
            temGroupList = tagMCActGrowupBuyGroup()
            _pos = temGroupList.ReadData(_lpData, _pos)
            self.GroupList.append(temGroupList)
        return _pos
    def Clear(self):
        self.Head = tagHead()
        self.Head.Clear()
        self.Head.Cmd = 0xAA
        self.Head.SubCmd = 0x31
        self.StartDate = ""
        self.EndtDate = ""
        self.GroupCount = 0
        self.GroupList = list()
        return
    def GetLength(self):
        length = 0
        length += self.Head.GetLength()
        length += 10
        length += 10
        length += 1
        for i in range(self.GroupCount):
            length += self.GroupList[i].GetLength()
        return length
    def GetBuffer(self):
        data = ''
        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
        data = CommFunc.WriteString(data, 10, self.StartDate)
        data = CommFunc.WriteString(data, 10, self.EndtDate)
        data = CommFunc.WriteBYTE(data, self.GroupCount)
        for i in range(self.GroupCount):
            data = CommFunc.WriteString(data, self.GroupList[i].GetLength(), self.GroupList[i].GetBuffer())
        return data
    def OutputString(self):
        DumpString = '''
                                Head:%s,
                                StartDate:%s,
                                EndtDate:%s,
                                GroupCount:%d,
                                GroupList:%s
                                '''\
                                %(
                                self.Head.OutputString(),
                                self.StartDate,
                                self.EndtDate,
                                self.GroupCount,
                                "..."
                                )
        return DumpString
m_NAtagMCActGrowupBuyInfo=tagMCActGrowupBuyInfo()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCActGrowupBuyInfo.Head.Cmd,m_NAtagMCActGrowupBuyInfo.Head.SubCmd))] = m_NAtagMCActGrowupBuyInfo
#------------------------------------------------------
# AA 0C 登录奖励活动信息 #tagMCActLoginAwardInfo
class  tagMCActLoginAwardAction(Structure):
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -1289,6 +1289,13 @@
                        ("char", "NotifyKey", 0),
                        ),
                "ActGrowupBuy":(
                        ("DWORD", "CfgID", 1),
                        ("char", "StartDate", 0),
                        ("char", "EndDate", 0),
                        ("list", "CTGIDGroupList", 0),
                        ),
                "MagicWeaponFB":(
                        ("DWORD", "MWID", 1),
                        ("BYTE", "LineID", 0),
@@ -4288,6 +4295,21 @@
    def GetAwardItem(self): return self.AwardItem # 返利物品信息列表 {职业:[(物品ID,个数,是否绑定),...]}
    def GetNotifyKey(self): return self.NotifyKey # 全服广播key,默认两个参数(玩家名, 档位额度)
# 成长必买活动表
class IPY_ActGrowupBuy():
    def __init__(self):
        self.CfgID = 0
        self.StartDate = ""
        self.EndDate = ""
        self.CTGIDGroupList = []
        return
    def GetCfgID(self): return self.CfgID # 配置ID
    def GetStartDate(self): return self.StartDate # 开启日期
    def GetEndDate(self): return self.EndDate # 结束日期
    def GetCTGIDGroupList(self): return self.CTGIDGroupList # 充值编号组列表 [[ctgID, ...], ...]
# 法宝副本表
class IPY_MagicWeaponFB():
    
@@ -5323,6 +5345,8 @@
        self.ipyActTotalRechargeLen = len(self.ipyActTotalRechargeCache)
        self.ipyTotalRechargeTemplateCache = self.__LoadFileData("TotalRechargeTemplate", IPY_TotalRechargeTemplate)
        self.ipyTotalRechargeTemplateLen = len(self.ipyTotalRechargeTemplateCache)
        self.ipyActGrowupBuyCache = self.__LoadFileData("ActGrowupBuy", IPY_ActGrowupBuy)
        self.ipyActGrowupBuyLen = len(self.ipyActGrowupBuyCache)
        self.ipyMagicWeaponFBCache = self.__LoadFileData("MagicWeaponFB", IPY_MagicWeaponFB)
        self.ipyMagicWeaponFBLen = len(self.ipyMagicWeaponFBCache)
        self.ipyIceLodeStarAwardCache = self.__LoadFileData("IceLodeStarAward", IPY_IceLodeStarAward)
@@ -5821,6 +5845,8 @@
    def GetActTotalRechargeByIndex(self, index): return self.ipyActTotalRechargeCache[index]
    def GetTotalRechargeTemplateCount(self): return self.ipyTotalRechargeTemplateLen
    def GetTotalRechargeTemplateByIndex(self, index): return self.ipyTotalRechargeTemplateCache[index]
    def GetActGrowupBuyCount(self): return self.ipyActGrowupBuyLen
    def GetActGrowupBuyByIndex(self, index): return self.ipyActGrowupBuyCache[index]
    def GetMagicWeaponFBCount(self): return self.ipyMagicWeaponFBLen
    def GetMagicWeaponFBByIndex(self, index): return self.ipyMagicWeaponFBCache[index]
    def GetIceLodeStarAwardCount(self): return self.ipyIceLodeStarAwardLen
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -99,6 +99,7 @@
import PlayerFlashGiftbag
import PlayerDailyGiftbag
import PlayerCostRebate
import PlayerActGrowupBuy
import PlayerActCollectWords
import PlayerActTotalRecharge
import PlayerActRechargePrize
@@ -643,6 +644,8 @@
    PlayerActTotalRecharge.OnPlayerLogin(curPlayer)
    #充值返利
    PlayerActRechargePrize.OnPlayerLogin(curPlayer)
    #成长必买
    PlayerActGrowupBuy.OnPlayerLogin(curPlayer)
    #限时特惠
    PlayerSpringSale.OnPlayerLogin(curPlayer)
    #限时礼包
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActGrowupBuy.py
New file
@@ -0,0 +1,173 @@
#!/usr/bin/python
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
##@package Player.PlayerActGrowupBuy
#
# @todo:运营活动 - 成长必买
# @author hxp
# @date 2020-11-23
# @version 1.0
#
# 详细描述: 运营活动 - 成长必买
#
#-------------------------------------------------------------------------------
#"""Version = 2020-11-23 21:00"""
#-------------------------------------------------------------------------------
import PyGameData
import ShareDefine
import PlayerControl
import IpyGameDataPY
import ChPyNetSendPack
import NetPackCommon
import GameWorld
import ChConfig
def OnPlayerLogin(curPlayer):
    isReset = __CheckPlayerGrowupBuyAction(curPlayer)
    if not isReset:
        actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_GrowupBuy, {})
        # 活动中同步活动信息
        if actInfo.get(ShareDefine.ActKey_State):
            Sync_GrowupActionInfo(curPlayer)
    return
def RefreshGrowupBuyActionInfo():
    ## 收到GameServer同步的活动信息,刷新活动信息
    playerManager = GameWorld.GetPlayerManager()
    for index in xrange(playerManager.GetPlayerCount()):
        curPlayer = playerManager.GetPlayerByIndex(index)
        if curPlayer.GetID() == 0:
            continue
        __CheckPlayerGrowupBuyAction(curPlayer)
    return
def __CheckPlayerGrowupBuyAction(curPlayer):
    ## 检查玩家充值返利活动数据信息
    playerID = curPlayer.GetPlayerID()
    actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_GrowupBuy, {})
    actID = actInfo.get(ShareDefine.ActKey_ID, 0)
    state = actInfo.get(ShareDefine.ActKey_State, 0)
    playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrowupBuyID) # 玩家身上的活动ID
    # 活动ID 相同的话不处理
    if actID == playerActID:
        GameWorld.DebugLog("成长必买活动ID不变,不处理!", curPlayer.GetPlayerID())
        return
    GameWorld.DebugLog("成长必买重置! actID=%s,playerActID=%s,state=%s" % (actID, playerActID, state), playerID)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GrowupBuyID, actID)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GrowupBuyState, 0)
    Sync_GrowupActionInfo(curPlayer)
    return True
def DoUpdateGrowupBuyStateOnDay(curPlayer):
    ## 成长必买过天更新购买状态
    actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_GrowupBuy, {})
    if not actInfo:
        return
    if not actInfo.get(ShareDefine.ActKey_State):
        return
    cfgID = actInfo.get(ShareDefine.ActKey_CfgID)
    ipyData = IpyGameDataPY.GetIpyGameData("ActGrowupBuy", cfgID)
    if not ipyData:
        return
    ctgIDGroupList = ipyData.GetCTGIDGroupList()
    buyState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrowupBuyState)
    GameWorld.DebugLog("更新成长必买今日可购买礼包索引! buyState=%s,ctgIDGroupList=%s" % (buyState, ctgIDGroupList))
    for i, ctgIDList in enumerate(ctgIDGroupList):
        buyIndex = GameWorld.GetDataByDigitPlace(buyState, i)
        updBuyIndex = 0
        # 最后一个礼包了,不管有没有买都重置
        if buyIndex >= len(ctgIDList) - 1:
            updBuyIndex = 0
            GameWorld.DebugLog("    最后一个礼包,重置!")
        else:
            yestodayCtgID = ctgIDList[buyIndex]
            if not curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCount % yestodayCtgID):
                updBuyIndex = 0
                GameWorld.DebugLog("    前置礼包没买,重置!yestodayCtgID=%s" % yestodayCtgID)
            else:
                updBuyIndex = buyIndex + 1
                GameWorld.DebugLog("    前置礼包已买,更新后续礼包索引! yestodayCtgID=%s,updBuyIndex=%s" % (yestodayCtgID, updBuyIndex))
        buyState = GameWorld.ChangeDataByDigitPlace(buyState, i, updBuyIndex)
        GameWorld.DebugLog("    updState=%s" % buyState)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GrowupBuyState, buyState)
    Sync_GrowupActionInfo(curPlayer)
    return
def CheckGrowupBuyState(curPlayer, ctgID):
    ## 检查是否可购买成长必买礼包ID
    # @return: 是否可买, 不可买原因说明
    actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_GrowupBuy, {})
    if not actInfo:
        return False, "not grow up buy action info!"
    if not actInfo.get(ShareDefine.ActKey_State):
        return False, "grow up buy action state is 0!"
    cfgID = actInfo.get(ShareDefine.ActKey_CfgID)
    ipyData = IpyGameDataPY.GetIpyGameData("ActGrowupBuy", cfgID)
    if not ipyData:
        return False, "not grow up buy action ipyData cfgID(%s)!" % cfgID
    ctgIDGroupList = ipyData.GetCTGIDGroupList()
    buyState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrowupBuyState)
    curCTGIDList = []
    playerBuyIndex = -1
    for i, ctgIDList in enumerate(ctgIDGroupList):
        if ctgID in ctgIDList:
            curCTGIDList = ctgIDList
            playerBuyIndex = GameWorld.GetDataByDigitPlace(buyState, i)
            break
    if not curCTGIDList:
        return False, "ctgID(%s) is not in this grow up buy action ctgIDGroupList(%s)!" % (ctgID, ctgIDGroupList)
    ctgIDIndex = curCTGIDList.index(ctgID)
    if playerBuyIndex != ctgIDIndex:
        return False, "ctgIDIndex(%s) is not equal to playerBuyIndex(%s) !" % (ctgIDIndex, playerBuyIndex)
    return True, ""
def Sync_GrowupActionInfo(curPlayer):
    ## 通知活动信息  - 成长必买
    actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_GrowupBuy, {})
    if not actInfo:
        return
    if not actInfo.get(ShareDefine.ActKey_State):
        return
    cfgID = actInfo.get(ShareDefine.ActKey_CfgID)
    ipyData = IpyGameDataPY.GetIpyGameData("ActGrowupBuy", cfgID)
    if not ipyData:
        return
    ctgIDGroupList = ipyData.GetCTGIDGroupList()
    if not ctgIDGroupList:
        return
    buyState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GrowupBuyState)
    openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
    actInfo = ChPyNetSendPack.tagMCActGrowupBuyInfo()
    actInfo.StartDate = GameWorld.GetOperationActionDateStr(ipyData.GetStartDate(), openServerDay)
    actInfo.EndtDate = GameWorld.GetOperationActionDateStr(ipyData.GetEndDate(), openServerDay)
    actInfo.GroupList = []
    for i, ctgIDList in enumerate(ctgIDGroupList):
        groupInfo = ChPyNetSendPack.tagMCActGrowupBuyGroup()
        groupInfo.BuyCTGIDList = ctgIDList
        groupInfo.BuyCount = len(groupInfo.BuyCTGIDList)
        groupInfo.PlayerBuyIndex = GameWorld.GetDataByDigitPlace(buyState, i)
        actInfo.GroupList.append(groupInfo)
    actInfo.GroupCount = len(actInfo.GroupList)
    NetPackCommon.SendFakePack(curPlayer, actInfo)
    return
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
@@ -49,6 +49,7 @@
import PlayerGoldGift
import PlayerActTotalRecharge
import PlayerActRechargePrize
import PlayerActGrowupBuy
import OpenServerCampaign
import PlayerWeekParty
import PlayerGoldInvest
@@ -119,6 +120,11 @@
def OnDay(curPlayer):
    ## 充值相关过天
    #在重置之前需要处理的
    PlayerActGrowupBuy.DoUpdateGrowupBuyStateOnDay(curPlayer) # 成长必买
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCoinTotal, 0)
    
    syncRecordIDList = []
@@ -252,6 +258,13 @@
    
    addDRDict.update({"recordID":recordID})
    
    # 成长必买类型
    if ipyData.GetPayType() == 16:
        canBuy, errInfo = PlayerActGrowupBuy.CheckGrowupBuyState(curPlayer, recordID)
        if not canBuy:
            DataRecordPack.DR_CTGError(curPlayer, errInfo, addDRDict)
            return
    totalBuyCountLimit = ipyData.GetTotalBuyCount()
    totalBuyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CTGGoodsBuyCount % recordID)
    if totalBuyCountLimit:
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
@@ -77,6 +77,7 @@
import PlayerActCollectWords
import PlayerActTotalRecharge
import PlayerActRechargePrize
import PlayerActGrowupBuy
import PlayerSpringSale
import PlayerBossReborn
import PlayerWeekParty
@@ -1390,6 +1391,9 @@
            elif actionName == ShareDefine.OperationActionName_RechargePrize:
                PlayerActRechargePrize.RefreshRechargePrizeActionInfo()
                
            elif actionName == ShareDefine.OperationActionName_GrowupBuy:
                PlayerActGrowupBuy.RefreshGrowupBuyActionInfo()
            return
        
        if key == ShareDefine.Def_Notify_WorldKey_CrossZoneName:
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ShareDefine.py
@@ -220,6 +220,7 @@
OperationActionName_CollectWords2 = "ActCollectWords2" # 集字活动2
OperationActionName_LuckyTreasure = "ActLuckyTreasure" # 幸运鉴宝活动
OperationActionName_RechargePrize = "ActRechargePrize" # 充值返利活动
OperationActionName_GrowupBuy = "ActGrowupBuy" # 成长必买活动
#节日活动类型列表 - 该类型无视开服天,日期到了就开启
FeastOperationActionNameList = [OperationActionName_FeastWeekParty, OperationActionName_FeastRedPacket]
#所有的运营活动列表,含节日活动
@@ -231,8 +232,9 @@
                           OperationActionName_WeekParty, OperationActionName_LoginAward, 
                           OperationActionName_NewFairyCeremony, OperationActionName_LuckyTreasure,
                           OperationActionName_DailyGiftbag, OperationActionName_RechargePrize, 
                           OperationActionName_CollectWords, OperationActionName_CollectWords2] \
                           + FeastOperationActionNameList
                           OperationActionName_CollectWords, OperationActionName_CollectWords2,
                           OperationActionName_GrowupBuy
                           ] + FeastOperationActionNameList
#需要记录开启活动时的世界等级的运营活动
NeedWorldLVOperationActNameList = [OperationActionName_FairyCeremony, OperationActionName_WishingWell, 
                                   OperationActionName_NewFairyCeremony, OperationActionName_FlashSale,