| | |
| | | # -*- 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():
|
| | |
|
| | | 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 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
|
| | | 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)
|
| | | return
|
| | |
|
| | | def UpdateFirstGoldTime(curPlayer):
|
| | | #更新首充提示剩余时间
|
| | | remainTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FirstGoldRemainTime)
|
| | | if not remainTime:
|
| | | firstID = firstIpyData.GetFirstID()
|
| | | chargeTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FirstChargeTime % firstID)
|
| | | if chargeTime:
|
| | | GameWorld.DebugLog("该首充档位已经激活过了,不重复激活: ctgID=%s,chargeTime=%s" % (ctgID, chargeTime))
|
| | | 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)
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstChargeTime % firstID, int(time.time()))
|
| | | GameWorld.DebugLog("记录首充档位充值时间戳: ctgID=%s" % ctgID)
|
| | | Sync_FirstChargeInfo(curPlayer)
|
| | | 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)
|
| | | 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:
|
| | | return
|
| | | needSpace = len(rewardItemList)
|
| | | |
| | | # 检查背包
|
| | | packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
|
| | | if needSpace > packSpace:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
|
| | | if not hasattr(ipyData, "GetAwardListDay%s" % giftDay):
|
| | | 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])
|
| | | |
| | | # 记录领取事件
|
| | | infoDict = {"GiftDay":giftDay, "ItemList":rewardItemList}
|
| | | DataRecordPack.DR_GoldGiftGiveItem(curPlayer, "FirstGoldGift", infoDict)
|
| | | |
| | | # 通知客户端
|
| | | Sync_FirstGoldInfo(curPlayer)
|
| | | Sync_FirstChargeInfo(curPlayer)
|
| | | return
|
| | |
|
| | | 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
|
| | |
|
| | | ################################ 每日打包直购礼包 ###################################
|
| | |
| | |
|
| | | ###################################################################
|
| | |
|
| | | ## 充值豪礼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):
|
| | | # 领取历史充值奖励
|
| | |
|
| | |
| | | DataRecordPack.SendEventPack("HistoryRechargeAward", {'awardID':awardID, 'needCoin':needCoin}, curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | ## 通知等级奖励领取记录信息
|
| | | # @param None
|
| | | # @return None
|
| | |
| | | sendPack.Clear()
|
| | | sendPack.AwardGetRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HistoryChargeAwardGetRecord, 0)
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return |
| | | return
|