hxp
1 天以前 1b279c6a8db9e6ec8a56371c555140de1f8cb40b
219 【付费内容】首充-服务端
10个文件已修改
540 ■■■■■ 已修改文件
PySysDB/PySysDBPY.h 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py 114 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearFirstGold.py 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py 34 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldGift.py 283 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
PySysDB/PySysDBPY.h
@@ -1810,7 +1810,7 @@
//充值商品编号表
struct tagOrderInfo
struct OrderInfo
{
    char        _OrderInfo;    //商品编号
    char        _AppID;    //appID
@@ -1823,7 +1823,7 @@
//充值表
struct tagCTG
struct CTG
{
    BYTE        _RecordID;        //记录ID
    BYTE        CanResetBuyCount;    //是否允许重置次数
@@ -1844,7 +1844,7 @@
//充值自选物品表
struct tagCTGSelectItem
struct CTGSelectItem
{
    WORD        _SelectID;        //自选ID
    DWORD        ItemID;    //物品ID
@@ -1854,11 +1854,13 @@
//首充表
struct tagFirstGold
struct FirstCharge
{
    BYTE        _Day;        //首充第几天
    dict        JobItemInfo;    //职业物品奖励 {"职业":[[物品ID,个数], ...], ...}
    list        CommItemList;    //通用物品奖励 [[物品ID,个数], ...]
    BYTE        _FirstID;        //首充ID
    WORD        NeedCTGID;        //所需充值ID
    list        AwardListDay1;    //第1天奖励 [[物品ID,个数,装备定制ID], ...]
    list        AwardListDay2;    //第2天奖励 [[物品ID,个数,装备定制ID], ...]
    list        AwardListDay3;    //第3天奖励 [[物品ID,个数,装备定制ID], ...]
};
//等级奖励表
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/PyNetPack.ini
@@ -1138,18 +1138,6 @@
PacketSubCMD_3=0x26
PacketCallFunc_3=OnSelectCTGItem
;首充
[PlayerGoldGift]
ScriptName = Player\PlayerGoldGift.py
Writer = xdh
Releaser = xdh
RegType = 0
RegisterPackCount = 1
PacketCMD_1=0xA5
PacketSubCMD_1=0x11
PacketCallFunc_1=OnTryFirstGoldItem
;限时抢购
[PlayerFlashSale]
ScriptName = Player\PlayerFlashSale.py
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3521,12 +3521,8 @@
Def_PDict_CTGSelectItemValue = "CTGSelectItemValue_%s"  # 充值自选选择记录,参数(CTG对应的商品记录ID) 每两位存储每个自选索引对应选择的物品索引+1,存储位值为0代表未选择,最多支持选择4种物品
Def_PDict_OnlineRechargeTHAward = "OnlineRechargeTHAward"  # 在线特惠充值额外奖励 - 是否已领取奖励
Def_PDict_DayFreeGoldGiftState = "DayFreeGoldGiftState"  # 每日免费直购礼包领取记录
Def_PDict_GoldGiftFirstRecord = "GoldGiftFirstRecord"  # 首充领取记录,按位记录首充第x天是否已领取
Def_PDict_FirstGoldServerDay = "FirstGoldServerDay"  # 首充时的开服天
Def_PDict_FirstGoldRemainTime = "FirstGoldRemainTime"  # 首充提示剩余时间
Def_PDict_FirstGoldTipStartTime = "FirstGoldTipStartTime"     # 首充提示开始时间
Def_PDict_FirstGoldTry = "FirstGoldTry"     # 首充试用状态 0-不可试用 1-可试用 2-已试用
Def_PDict_SuperGiftStartTime = "SuperGiftStartTime"  # 超值礼包开始时间
Def_PDict_FirstChargeRecord = "FirstChargeRecord_%s"  # 首充领取记录,按位记录首充第x天是否已领取,参数(首充ID)
Def_PDict_FirstChargeTime = "FirstChargeTime_%s"  # 首充充值时间戳,参数(首充ID)
Def_PDict_IsReBorn = "Def_PDict_IsReBorn"  # 是否回城复活
Def_PDict_FamilyWarDailyReward = "FamilyWarDailyReward"  # 王者仙盟每日俸禄领取状态
Def_PDict_Family_Contribution = "FamilyContribution"  #战盟贡献度
@@ -5167,7 +5163,7 @@
Def_RewardType_LVAward,  # 玩家等级奖励5
Def_RewardType_XBXZ, # 仙宝寻主奖励6
Def_RewardType_DayRealmPoint, # 每日任务修行点奖励7
Def_RewardType_GoldGiftFirst, # 首充礼包奖励8
Def_RewardType_FirstCharge, # 首充礼包奖励8
Def_RewardType_MWSoulAward, # 法宝之魂奖励9 -废弃
Def_RewardType_FreeGoods, # 极品白拿10
Def_RewardType_CostRebate, # 消费返利11
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetPack.py
@@ -8856,54 +8856,6 @@
#------------------------------------------------------
# A5 11 试用首充武器 #tagCMTryFirstGoldItem
class  tagCMTryFirstGoldItem(Structure):
    _pack_ = 1
    _fields_ = [
                  ("Cmd", c_ubyte),
                  ("SubCmd", c_ubyte),
                  ]
    def __init__(self):
        self.Clear()
        self.Cmd = 0xA5
        self.SubCmd = 0x11
        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 = 0xA5
        self.SubCmd = 0x11
        return
    def GetLength(self):
        return sizeof(tagCMTryFirstGoldItem)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// A5 11 试用首充武器 //tagCMTryFirstGoldItem:
                                Cmd:%s,
                                SubCmd:%s
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd
                                )
        return DumpString
m_NAtagCMTryFirstGoldItem=tagCMTryFirstGoldItem()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMTryFirstGoldItem.Cmd,m_NAtagCMTryFirstGoldItem.SubCmd))] = m_NAtagCMTryFirstGoldItem
#------------------------------------------------------
# A5 73 解锁命格孔 #tagCMUnLockBirthChartHole
class  tagCMUnLockBirthChartHole(Structure):
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChPyNetSendPack.py
@@ -30983,22 +30983,17 @@
#------------------------------------------------------
# AA 02 首充信息 #tagMCFirstGoldInfo
# AA 02 首充信息 #tagSCFirstChargeInfo
class  tagMCFirstGoldInfo(Structure):
class  tagSCFirstCharge(Structure):
    _pack_ = 1
    _fields_ = [
                  ("Cmd", c_ubyte),
                  ("SubCmd", c_ubyte),
                  ("FirstGoldRewardState", c_ubyte),    #首充奖励领奖记录,按位记录首充第X天是否已领取,第1天为第0索引位
                  ("FirstGoldTry", c_ubyte),    #首充试用状态0-不可试用 1-可试用 2-已试用
                  ("FirstGoldServerDay", c_ushort),    #首充时是开服第几天,从1开始,0代表未记录充值
                  ("ChargeTime", c_int),    #充值该首充的时间戳
                  ("AwardRecord", c_ushort),    #首充奖励领奖记录,按二进制位记录首充第X天是否已领取
                  ]
    def __init__(self):
        self.Clear()
        self.Cmd = 0xAA
        self.SubCmd = 0x02
        return
    def ReadData(self, stringData, _pos=0, _len=0):
@@ -31007,91 +31002,92 @@
        return _pos + self.GetLength()
    def Clear(self):
        self.Cmd = 0xAA
        self.SubCmd = 0x02
        self.FirstGoldRewardState = 0
        self.FirstGoldTry = 0
        self.FirstGoldServerDay = 0
        self.ChargeTime = 0
        self.AwardRecord = 0
        return
    def GetLength(self):
        return sizeof(tagMCFirstGoldInfo)
        return sizeof(tagSCFirstCharge)
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
    def OutputString(self):
        DumpString = '''// AA 02 首充信息 //tagMCFirstGoldInfo:
                                Cmd:%s,
                                SubCmd:%s,
                                FirstGoldRewardState:%d,
                                FirstGoldTry:%d,
                                FirstGoldServerDay:%d
        DumpString = '''// AA 02 首充信息 //tagSCFirstChargeInfo:
                                ChargeTime:%d,
                                AwardRecord:%d
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd,
                                self.FirstGoldRewardState,
                                self.FirstGoldTry,
                                self.FirstGoldServerDay
                                self.ChargeTime,
                                self.AwardRecord
                                )
        return DumpString
m_NAtagMCFirstGoldInfo=tagMCFirstGoldInfo()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCFirstGoldInfo.Cmd,m_NAtagMCFirstGoldInfo.SubCmd))] = m_NAtagMCFirstGoldInfo
#------------------------------------------------------
# AA 08 首充提示剩余时间 #tagMCFirstGoldTime
class  tagMCFirstGoldTime(Structure):
    _pack_ = 1
    _fields_ = [
                  ("Cmd", c_ubyte),
                  ("SubCmd", c_ubyte),
                  ("FirstGoldRemainTime", c_int),    #首充提示剩余时间
                  ]
class  tagSCFirstChargeInfo(Structure):
    Head = tagHead()
    Count = 0    #(BYTE Count)
    FirstChargeList = list()    #(vector<tagSCFirstCharge> FirstChargeList)
    data = None
    def __init__(self):
        self.Clear()
        self.Cmd = 0xAA
        self.SubCmd = 0x08
        self.Head.Cmd = 0xAA
        self.Head.SubCmd = 0x02
        return
    def ReadData(self, stringData, _pos=0, _len=0):
    def ReadData(self, _lpData, _pos=0, _Len=0):
        self.Clear()
        memmove(addressof(self), stringData[_pos:], self.GetLength())
        return _pos + self.GetLength()
        _pos = self.Head.ReadData(_lpData, _pos)
        self.Count,_pos = CommFunc.ReadBYTE(_lpData, _pos)
        for i in range(self.Count):
            temFirstChargeList = tagSCFirstCharge()
            _pos = temFirstChargeList.ReadData(_lpData, _pos)
            self.FirstChargeList.append(temFirstChargeList)
        return _pos
    def Clear(self):
        self.Cmd = 0xAA
        self.SubCmd = 0x08
        self.FirstGoldRemainTime = 0
        self.Head = tagHead()
        self.Head.Clear()
        self.Head.Cmd = 0xAA
        self.Head.SubCmd = 0x02
        self.Count = 0
        self.FirstChargeList = list()
        return
    def GetLength(self):
        return sizeof(tagMCFirstGoldTime)
        length = 0
        length += self.Head.GetLength()
        length += 1
        for i in range(self.Count):
            length += self.FirstChargeList[i].GetLength()
        return length
    def GetBuffer(self):
        return string_at(addressof(self), self.GetLength())
        data = ''
        data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
        data = CommFunc.WriteBYTE(data, self.Count)
        for i in range(self.Count):
            data = CommFunc.WriteString(data, self.FirstChargeList[i].GetLength(), self.FirstChargeList[i].GetBuffer())
        return data
    def OutputString(self):
        DumpString = '''// AA 08 首充提示剩余时间 //tagMCFirstGoldTime:
                                Cmd:%s,
                                SubCmd:%s,
                                FirstGoldRemainTime:%d
        DumpString = '''
                                Head:%s,
                                Count:%d,
                                FirstChargeList:%s
                                '''\
                                %(
                                self.Cmd,
                                self.SubCmd,
                                self.FirstGoldRemainTime
                                self.Head.OutputString(),
                                self.Count,
                                "..."
                                )
        return DumpString
m_NAtagMCFirstGoldTime=tagMCFirstGoldTime()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCFirstGoldTime.Cmd,m_NAtagMCFirstGoldTime.SubCmd))] = m_NAtagMCFirstGoldTime
m_NAtagSCFirstChargeInfo=tagSCFirstChargeInfo()
ChNetPackDict[eval("0x%02x%02x"%(m_NAtagSCFirstChargeInfo.Head.Cmd,m_NAtagSCFirstChargeInfo.Head.SubCmd))] = m_NAtagSCFirstChargeInfo
#------------------------------------------------------
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/GM/Commands/ClearFirstGold.py
@@ -33,11 +33,6 @@
#  @remarks 函数详细说明.
def OnExec(curPlayer, msgList):
    curPlayer.SetChangeCoinPointTotal(0, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldGiftFirstRecord, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldServerDay, 0)
    PlayerGoldGift.Sync_FirstGoldInfo(curPlayer)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldTry, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SuperGiftStartTime, 0)
    # 重置充值次数信息
    syncRecordIDList = []
    ipyDataMgr = IpyGameDataPY.IPY_Data()
@@ -68,5 +63,6 @@
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGRealToday, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGRealTotal, 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CTGRealFirstTime, 0)
    PlayerGoldGift.ClearFirstCharge(curPlayer)
    return
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -1495,10 +1495,12 @@
                        ("BYTE", "IsAuctionItem", 0),
                        ),
                "FirstGold":(
                        ("BYTE", "Day", 1),
                        ("dict", "JobItemInfo", 0),
                        ("list", "CommItemList", 0),
                "FirstCharge":(
                        ("BYTE", "FirstID", 1),
                        ("WORD", "NeedCTGID", 0),
                        ("list", "AwardListDay1", 0),
                        ("list", "AwardListDay2", 0),
                        ("list", "AwardListDay3", 0),
                        ),
                "LVAward":(
@@ -4704,15 +4706,17 @@
    def GetIsAuctionItem(self): return self.attrTuple[3] # 是否拍品 BYTE
# 首充表
class IPY_FirstGold():
class IPY_FirstCharge():
    
    def __init__(self):
        self.attrTuple = None
        return
        
    def GetDay(self): return self.attrTuple[0] # 首充第几天 BYTE
    def GetJobItemInfo(self): return self.attrTuple[1] # 职业物品奖励 {"职业":[[物品ID,个数], ...], ...} dict
    def GetCommItemList(self): return self.attrTuple[2] # 通用物品奖励 [[物品ID,个数], ...] list
    def GetFirstID(self): return self.attrTuple[0] # 首充ID BYTE
    def GetNeedCTGID(self): return self.attrTuple[1] # 所需充值ID WORD
    def GetAwardListDay1(self): return self.attrTuple[2] # 第1天奖励 [[物品ID,个数,装备定制ID], ...] list
    def GetAwardListDay2(self): return self.attrTuple[3] # 第2天奖励 [[物品ID,个数,装备定制ID], ...] list
    def GetAwardListDay3(self): return self.attrTuple[4] # 第3天奖励 [[物品ID,个数,装备定制ID], ...] list
# 等级奖励表
class IPY_LVAward():
@@ -6593,7 +6597,7 @@
        self.__LoadFileData("OrderInfo", onlyCheck)
        self.__LoadFileData("CTG", onlyCheck)
        self.__LoadFileData("CTGSelectItem", onlyCheck)
        self.__LoadFileData("FirstGold", onlyCheck)
        self.__LoadFileData("FirstCharge", onlyCheck)
        self.__LoadFileData("LVAward", onlyCheck)
        self.__LoadFileData("Invest", onlyCheck)
        self.__LoadFileData("XBXZ", onlyCheck)
@@ -7874,12 +7878,12 @@
        self.CheckLoadData("CTGSelectItem")
        return self.ipyCTGSelectItemCache[index]
    def GetFirstGoldCount(self):
        self.CheckLoadData("FirstGold")
        return self.ipyFirstGoldLen
    def GetFirstGoldByIndex(self, index):
        self.CheckLoadData("FirstGold")
        return self.ipyFirstGoldCache[index]
    def GetFirstChargeCount(self):
        self.CheckLoadData("FirstCharge")
        return self.ipyFirstChargeLen
    def GetFirstChargeByIndex(self, index):
        self.CheckLoadData("FirstCharge")
        return self.ipyFirstChargeCache[index]
    def GetLVAwardCount(self):
        self.CheckLoadData("LVAward")
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/ChPlayer.py
@@ -26,7 +26,6 @@
import ChItem
import ItemCommon
import ItemControler
import ChEquip
import FunctionNPCCommon
import PlayerGMOper
import ReadChConfig
@@ -37,7 +36,6 @@
import ChPyNetSendPack
import DataRecordPack
import PlayerBillboard
import UpdatePlayerName
import PlayerOnlinePrize
import PlayerLVAward
import PlayerGoldGift
@@ -541,9 +539,6 @@
    #通知玩家死亡时间
    #PlayerControl.PlayerControl(curPlayer).NotifyPlayerDeadTime(curPlayer)
    
    #角色改名次数
    #UpdatePlayerName.Sync_UpdatePlayerNameCount(curPlayer)
    # 坐骑相关通知
    PlayerHorse.PlayerHorseLogin(curPlayer)
    
@@ -899,9 +894,6 @@
    
    # 同步排行榜
    PlayerBillboard.UpdatePlayerBillboardOnLeaveServer(curPlayer, isAll=True)
    # 重置玩家改名次数
    #UpdatePlayerName.ResetChangeNameCnt(curPlayer)
    return
#---------------------------------------------------------------------
        
@@ -2166,8 +2158,6 @@
    
    #在线时间
    PlayerOnlinePrize.CalcOnlineTime(curPlayer)
    #首充提示时间
    PlayerGoldGift.UpdateFirstGoldTime(curPlayer)
    #玩家未回图形验证码下线将会记录错误次数
    #===========================================================================
    # if curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_Captcha_WaitSign) \
@@ -3300,8 +3290,8 @@
    elif rewardType == ChConfig.Def_RewardType_LVAward:
        PlayerLVAward.GetPlayerLVAward(curPlayer, dataEx)
    # 首充礼包奖励
    elif rewardType == ChConfig.Def_RewardType_GoldGiftFirst:
        PlayerGoldGift.GetPlayerGoldGiftFirst(curPlayer, dataEx)
    elif rewardType == ChConfig.Def_RewardType_FirstCharge:
        PlayerGoldGift.GetPlayerFirstCharge(curPlayer, dataEx, dataExStr)
    # 领取极品白拿
    elif rewardType == ChConfig.Def_RewardType_FreeGoods:
        PlayerFreeGoods.OnGetFreeGoods(curPlayer, dataEx)
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerCoin.py
@@ -751,7 +751,6 @@
    
    changeCoinPointBefore = curPlayer.GetChangeCoinPointTotal()
    curPlayer.SetChangeCoinPointTotal(min(changeCoinPointBefore + orderCoin, ChConfig.Def_UpperLimit_DWord), 0)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldTry, 0)
    
    todayCTGCoinTotal = min(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TodayCTGCoinTotal) + orderCoin, ChConfig.Def_UpperLimit_DWord)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TodayCTGCoinTotal, todayCTGCoinTotal)
@@ -777,8 +776,6 @@
    if coinType == ChConfig.CoinType_Gold:
        PlayerActRechargeRebateGold.AddRechargeRebateGoldRMB(curPlayer, addGold)
        
    #仙界盛典-充值大礼
    PlayerGoldGift.OnPlayerChargeGold(curPlayer)
    #累积充值X元
    PlayerActTotalRecharge.AddTotalRechargeGold(curPlayer, orderCoin, coinType)
    PlayerActSingleRecharge.UpdSingleRechargeValue(curPlayer, orderCoin, coinType) # 单笔累充
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerGoldGift.py
@@ -2,168 +2,143 @@
# -*- coding: GBK -*-
#-------------------------------------------------------------------------------
#
#-------------------------------------------------------------------------------
##@package Player.PlayerGoldGift
#
##@package PlayerGoldGift
#
# @todo: 记录玩家的充值豪礼奖励信息,二进制位标示,目前用了一个字典
# @todo:充值礼包
# @author hxp
# @date 2013-10-16 17:00
# @date 2025-09-28
# @version 1.0
#
# @version 3.0
# 简要说明:
# 详细描述:
# @change: "2013-10-22 11:10" hxp 修改读取奖励物品表方式
# @change: "2013-11-12 17:00" hxp 增加首充奖励领取逻辑
# @change: "2013-12-09 18:00" hxp 增加领奖全服广播mark
# @change: "2014-05-11 14:35" xcc 增加mark如果为空,就不提示
# @change: "2014-06-06 20:30" hxp 领奖全服广播修改
# @change: "2014-06-12 21:00" hxp 增加天天首充
# @change: "2014-08-22 12:00" hxp 去除多余全服广播
# @change: "2014-10-09 14:00" hxp 首充/天天首充规则修改,天天首充一天只能领取一次
# @change: "2014-12-16 18:00" hxp 发送充值豪礼发送邮件
# @change: "2014-12-22 14:00" hxp 增加单日充值多选一礼包
# @change: "2015-02-06 10:30" hxp 单日充值多选一礼包支持配置星期几
# @change: "2015-02-11 18:30" hxp 单日充值多选一礼包开服前几天不开启的仅限制星期几的活动
# @change: "2015-04-23 12:00" hxp 当日充值多选一礼包支持多个钻石档奖励
# @change: "2015-04-28 16:00" hxp 增加每日充值元宝数通知
# @change: "2015-05-21 14:30" hxp 增加当日充值无限领取礼包
# @change: "2015-06-09 20:30" hxp 奖励名称改为客户端配置
# @change: "2016-01-26 15:00" hxp PY表支持重读
# @change: "2016-06-27 14:00" hxp 首充支持可配置额度
#------------------------------------------------------------------------------
#"""Version = 2017-05-12 18:00"""
#------------------------------------------------------------------------------
# 详细描述: 充值礼包,主要一些常用、通用的
#
#-------------------------------------------------------------------------------
#"""Version = 2025-09-28 14:30"""
#-------------------------------------------------------------------------------
import ChConfig
import GameWorld
import IPY_GameWorld
import ItemControler
import ChConfig
import ItemCommon
import PlayerControl
import ShareDefine
import DataRecordPack
import ChPyNetSendPack
import NetPackCommon
import IpyGameDataPY
import CommFunc
import ChEquip
import ObjPool
import time
def OnDay(curPlayer):
    DoDailyPackBuyGiftOnDay(curPlayer)
    return
def OnLogin(curPlayer):
    Sync_FirstChargeInfo(curPlayer)
    Sync_HistoryChargeAwardGetRecordInfo(curPlayer)
    Sync_DailyPackBuyGiftInfo(curPlayer)
    return
def OnGiftByCTGID(curPlayer, ctgID):
    OnActFirstCharge(curPlayer, ctgID)
    OnActiviteDailyPackBuyGift(curPlayer, ctgID)
    return
##------------------------------------------------------------------------------
def DoFirstGoldOpen(curPlayer):
    ## 首充开启  记录提示剩余时间
    if curPlayer.GetChangeCoinPointTotal():
        return
    showSysTime = IpyGameDataPY.GetFuncCfg("FirstGold", 3)
    if not showSysTime:
        return
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldRemainTime, showSysTime)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldTipStartTime, int(time.time()))
    
    Sync_FirstGoldTime(curPlayer)
def ClearFirstCharge(curPlayer):
    ## 重置首充 - 一般是GM用
    resetCTGIDList = []
    ipyDataMgr = IpyGameDataPY.IPY_Data()
    for index in range(ipyDataMgr.GetFirstChargeCount()):
        ipyData = ipyDataMgr.GetFirstChargeByIndex(index)
        firstID = ipyData.GetFirstID()
        ctgID = ipyData.GetNeedCTGID()
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstChargeTime % firstID, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstChargeRecord % firstID, 0)
        resetCTGIDList.append(ctgID)
    Sync_FirstChargeInfo(curPlayer)
    return
def UpdateFirstGoldTime(curPlayer):
    #更新首充提示剩余时间
    remainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FirstGoldRemainTime)
    if not remainTime:
        return
    if curPlayer.GetChangeCoinPointTotal():
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldRemainTime, 0)
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldTipStartTime, 0)
    else:
        curTime = int(time.time())
        startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FirstGoldTipStartTime)
        remainTime = max(0, remainTime - (curTime - startTime))
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldRemainTime, remainTime)
        if not remainTime:
            PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldTipStartTime, 0)
def OnActFirstCharge(curPlayer, ctgID):
    ## 激活首充档位
    firstIpyData = None
    ipyDataMgr = IpyGameDataPY.IPY_Data()
    for index in range(ipyDataMgr.GetFirstChargeCount()):
        ipyData = ipyDataMgr.GetFirstChargeByIndex(index)
        if ipyData.GetNeedCTGID() == ctgID:
            firstIpyData = ipyData
            break
    if not firstIpyData:
    return
def Sync_FirstGoldTime(curPlayer):
    ##通知首充提示剩余时间
    showSysTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FirstGoldRemainTime)
    if not showSysTime:
        return
    sendPack = ChPyNetSendPack.tagMCFirstGoldTime()
    sendPack.Clear()
    sendPack.FirstGoldRemainTime = showSysTime
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    firstID = firstIpyData.GetFirstID()
    chargeTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FirstChargeTime % firstID)
    if chargeTime:
        GameWorld.DebugLog("该首充档位已经激活过了,不重复激活: ctgID=%s,chargeTime=%s" % (ctgID, chargeTime))
    return
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstChargeTime % firstID, int(time.time()))
    GameWorld.DebugLog("记录首充档位充值时间戳: ctgID=%s" % ctgID)
    Sync_FirstChargeInfo(curPlayer)
    return
def GetPlayerGoldGiftFirst(curPlayer, giftDay):
def GetPlayerFirstCharge(curPlayer, giftDay, firstIDStr):
    '''领取玩家首充奖励
    @param dayIndex: 首充第几天奖励
    '''
    if not giftDay:
    firstID = GameWorld.ToIntDef(firstIDStr)
    if not firstID or not giftDay:
        return
    
    openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
    firstGoldServerDay = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FirstGoldServerDay)
    if not firstGoldServerDay:
        GameWorld.DebugLog("还未充值过!firstGoldServerDay=%s" % firstGoldServerDay)
    playerID = curPlayer.GetPlayerID()
    chargeTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FirstChargeTime % firstID)
    if not chargeTime:
        GameWorld.DebugLog("该档位未首充! firstID=%s" % firstID, playerID)
        return
    canGetMaxDay = openServerDay - firstGoldServerDay + 1
    canGetMaxDay = GameWorld.GetDiff_Day(int(time.time()), chargeTime) + 1
    if giftDay > canGetMaxDay:
        GameWorld.DebugLog("还未到可领取的首充天,无法领取!openServerDay=%s,firstGoldServerDay=%s,canGetMaxDay=%s < giftDay=%s"
                           % (openServerDay, firstGoldServerDay, canGetMaxDay, giftDay))
        GameWorld.DebugLog("还未到可领取的首充天,无法领取!chargeTime=%s,giftDay=%s > %s"
                           % (GameWorld.ChangeTimeNumToStr(chargeTime), giftDay, canGetMaxDay), playerID)
        return
    dayIndex = giftDay - 1
    getRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldGiftFirstRecord)
    if getRecord & pow(2, dayIndex):
        GameWorld.DebugLog("已经领取过首充奖励!giftDay=%s" % giftDay, curPlayer.GetPlayerID())
    getRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FirstChargeRecord % firstID)
    if getRecord & pow(2, giftDay):
        GameWorld.DebugLog("已经领取过首充奖励!firstID=%s,giftDay=%s,getRecord=%s" % (firstID, giftDay, getRecord), playerID)
        return
    
    if not curPlayer.GetChangeCoinPointTotal():
        GameWorld.DebugLog("没有充值过,无法领取首充奖励!", curPlayer.GetPlayerID())
        return
    ipyData = IpyGameDataPY.GetIpyGameData("FirstGold", giftDay)
    ipyData = IpyGameDataPY.GetIpyGameData("FirstCharge", firstID)
    if not ipyData:
        return    
    jobItemInfoDict = ipyData.GetJobItemInfo()
    commItemList = ipyData.GetCommItemList()
    rewardItemList = []
    jobStr = str(curPlayer.GetJob())
    if jobStr in jobItemInfoDict:
        rewardItemList += jobItemInfoDict[jobStr]
    rewardItemList += commItemList
    if not rewardItemList:
    if not hasattr(ipyData, "GetAwardListDay%s" % giftDay):
        return
    needSpace = len(rewardItemList)
    # 检查背包
    packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
    if needSpace > packSpace:
        PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
        return
    awardList = getattr(ipyData, "GetAwardListDay%s" % giftDay)()
    
    # 更新已领取成功标记
    updGetRecord = getRecord | pow(2, dayIndex)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldGiftFirstRecord, updGetRecord)
    GameWorld.DebugLog("领取首充奖励: giftDay=%s,getRecord=%s,updGetRecord=%s, %s" % (giftDay, getRecord, updGetRecord, rewardItemList))
    updGetRecord = getRecord | pow(2, giftDay)
    PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstChargeRecord % firstID, updGetRecord)
    GameWorld.DebugLog("领取首充奖励: firstID=%s,giftDay=%s,getRecord=%s,updGetRecord=%s, %s" % (firstID, giftDay, getRecord, updGetRecord, awardList))
    
    # 给物品
    isAuctionItem = False
    for itemID, itemCount in rewardItemList:
        ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, [IPY_GameWorld.rptItem])
    ItemControler.NotifyGiveAwardInfo(curPlayer, rewardItemList, "GoldGiftFirst")
    ItemControler.GivePlayerItemOrMail(curPlayer, awardList, event=["FirstCharge", False, {}])
    
    # 全服提示
    if len(rewardItemList) >= 2:
        PlayerControl.WorldNotify(0, "FirstPayReward1", [curPlayer.GetPlayerName(), rewardItemList[0][0], rewardItemList[1][0], giftDay])
    Sync_FirstChargeInfo(curPlayer)
    return
        
    # 记录领取事件
    infoDict = {"GiftDay":giftDay, "ItemList":rewardItemList}
    DataRecordPack.DR_GoldGiftGiveItem(curPlayer, "FirstGoldGift", infoDict)
    # 通知客户端
    Sync_FirstGoldInfo(curPlayer)
def Sync_FirstChargeInfo(curPlayer):
    ## 通知首充信息
    clientPack = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCFirstChargeInfo)
    clientPack.FirstChargeList = []
    ipyDataMgr = IpyGameDataPY.IPY_Data()
    for index in range(ipyDataMgr.GetFirstChargeCount()):
        ipyData = ipyDataMgr.GetFirstChargeByIndex(index)
        firstID = ipyData.GetFirstID()
        firstCharge = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCFirstCharge)
        firstCharge.ChargeTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FirstChargeTime % firstID)
        firstCharge.AwardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FirstChargeRecord % firstID)
        clientPack.FirstChargeList.append(firstCharge)
    clientPack.Count = len(clientPack.FirstChargeList)
    NetPackCommon.SendFakePack(curPlayer, clientPack)
    return
################################ 每日打包直购礼包 ###################################
@@ -341,73 +316,6 @@
###################################################################
## 充值豪礼OnDay
#  @param curPlayer: 玩家
#  @return: None
def OnDay(curPlayer):
    DoDailyPackBuyGiftOnDay(curPlayer)
    return
## 充值豪礼OnLogin
#  @param curPlayer: 玩家
#  @return: None
def OnLogin(curPlayer):
    Sync_FirstGoldInfo(curPlayer)
    Sync_FirstGoldTime(curPlayer)
    Sync_HistoryChargeAwardGetRecordInfo(curPlayer)
    #更新首充提示开始计时时间
    if curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FirstGoldRemainTime):
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldTipStartTime, int(time.time()))
    Sync_DailyPackBuyGiftInfo(curPlayer)
    return
## 玩家充值元宝
#  @param curPlayer: 玩家
#  @param addGold: 充元宝数
#  @return: None
def OnPlayerChargeGold(curPlayer):
    return
def OnGiftByCTGID(curPlayer, ctgID):
    firstGoldCTGIDList = IpyGameDataPY.GetFuncEvalCfg("FirstGold", 4)
    if ctgID in firstGoldCTGIDList:
        OnActiviteFirstGold(curPlayer)
    OnActiviteDailyPackBuyGift(curPlayer, ctgID)
    return
def OnActiviteFirstGold(curPlayer):
    firstGoldServerDay = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FirstGoldServerDay)
    if not firstGoldServerDay:
        recordServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
        PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldServerDay, recordServerDay)
        GameWorld.DebugLog("记录首充开服天: recordServerDay=%s" % recordServerDay)
        Sync_FirstGoldInfo(curPlayer)
    return
def Sync_FirstGoldInfo(curPlayer):
    ## 通知首充信息
    sendPack = ChPyNetSendPack.tagMCFirstGoldInfo()
    sendPack.Clear()
    sendPack.FirstGoldRewardState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldGiftFirstRecord)
    sendPack.FirstGoldTry = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FirstGoldTry)
    sendPack.FirstGoldServerDay = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FirstGoldServerDay)
    NetPackCommon.SendFakePack(curPlayer, sendPack)
    return
#// A5 11 试用首充武器 #tagCMTryFirstGoldItem
#
#struct    tagCMTryFirstGoldItem
#
#{
#    tagHead        Head;
#};
def OnTryFirstGoldItem(index, clientData, tick):
    return
def OnGetHistoryRechargeAward(curPlayer, awardID):
    # 领取历史充值奖励
    
@@ -459,7 +367,6 @@
    # 记录领取事件
    DataRecordPack.SendEventPack("HistoryRechargeAward", {'awardID':awardID, 'needCoin':needCoin}, curPlayer)
    return
## 通知等级奖励领取记录信息
#  @param None