| | |
| | | #------------------------------------------------------------------------------
|
| | | import GameWorld
|
| | | import IPY_GameWorld
|
| | | import ReadChConfig
|
| | | import ItemControler
|
| | | import ChConfig
|
| | | import ItemCommon
|
| | |
| | | import ChPyNetSendPack
|
| | | import PlayerFamilyRedPacket
|
| | | import NetPackCommon
|
| | | import PyMapTable
|
| | | import PlayerCoin
|
| | | import IpyGameDataPY
|
| | | import PlayerTJG
|
| | | import ChEquip
|
| | |
|
| | | import time
|
| | | import FunctionNPCCommon
|
| | |
|
| | | # 定义配表外围索引
|
| | | (
|
| | | Def_NotifyMark, # 系统提示mark
|
| | | Def_NeedSpace, # 所需格子数
|
| | | Def_GiftInfo, # 奖品信息
|
| | | ) = range(3)
|
| | |
|
| | | # 定义奖励物品信息索引
|
| | | (
|
| | | Def_InfoIndex_ItemType, # 物品类型 |
| | | Def_InfoIndex_ItemID, # 物品id或定制物品索引
|
| | | Def_InfoIndex_ItemCount, # 物品个数
|
| | | Def_InfoIndex_IsBind, # 是否绑定
|
| | | ) = range(4)
|
| | |
|
| | |
|
| | | # 定义物品类型
|
| | | (
|
| | | Def_ItemType_CommonItem, # 一般物品
|
| | | Def_ItemType_AppointItem, # 特殊定制物品
|
| | | ) = range(2)
|
| | |
|
| | | ## 领取玩家充值豪礼奖励
|
| | | # @param giftNum:豪礼编号,从0开始
|
| | | # @return None
|
| | | def GetPlayerGoldGift(curPlayer, giftNum):
|
| | | |
| | | # 检查可否领取
|
| | | if not __CheckCanGetGift(curPlayer, giftNum):
|
| | | GameWorld.DebugLog("return can not Get GoldGift!!!")
|
| | | return
|
| | | |
| | | goldGiftInfo = ReadChConfig.GetEvalChConfig("GoldGiftInfo_%s" % giftNum)
|
| | | |
| | | # 检查背包
|
| | | packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem)
|
| | | needSpace = goldGiftInfo[Def_NeedSpace]
|
| | | if needSpace > packSpace:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
|
| | | return
|
| | | |
| | | # 给物品
|
| | | if not __GiveGoldGift(curPlayer, goldGiftInfo[Def_GiftInfo]):
|
| | | return
|
| | | |
| | | # 全服提示
|
| | | notifyMark = goldGiftInfo[Def_NotifyMark]
|
| | | #如果有消息提示
|
| | | if notifyMark.strip() != "":
|
| | | PlayerControl.WorldNotify(0, notifyMark, [curPlayer.GetPlayerName()])
|
| | | vipLV = curPlayer.GetVIPLv()
|
| | | msgParamList = [vipLV, curPlayer.GetPlayerName(), giftNum + 1]
|
| | | PlayerControl.WorldNotify(0, "GeRen_liubo_927007", msgParamList)
|
| | | |
| | | # 更新已领取成功标记
|
| | | __UpdateLVAwardGetRecord(curPlayer, giftNum)
|
| | | |
| | | # 记录领取事件
|
| | | DataRecordPack.DR_GoldGiftGiveItem(curPlayer, giftNum)
|
| | | |
| | | # 通知客户端
|
| | | Sync_GoldGiftGetRecordInfo(curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | ## 通知充值豪礼领取记录信息
|
| | | # @param None
|
| | | # @return None
|
| | | def Sync_GoldGiftGetRecordInfo(curPlayer):
|
| | | #getRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldGiftGetRecord, 0,
|
| | | # ChConfig.Def_PDictType_GoldGift)
|
| | | #ChPlayer.Sync_RewardGetRecordInfo(curPlayer, ShareDefine.Def_RewardType_GoldGift, getRecord)
|
| | | return
|
| | |
|
| | |
|
| | | ## 给玩家充值豪礼奖励物品
|
| | | # @param curPlayer:玩家实例
|
| | | # @param goldGiftInfoDict:充值豪礼物品配置字典
|
| | | # @return None
|
| | | def __GiveGoldGift(curPlayer, goldGiftInfoDict):
|
| | |
|
| | | goldGiftInfoList = __GetGoldGiftInfoList(curPlayer, goldGiftInfoDict)
|
| | | |
| | | # 如果找不到对应的奖励信息,则返回False
|
| | | if not goldGiftInfoList:
|
| | | return False
|
| | | |
| | | # 给物品
|
| | | for giftInfo in goldGiftInfoList:
|
| | | itemType = giftInfo[Def_InfoIndex_ItemType]
|
| | | itemCount = giftInfo[Def_InfoIndex_ItemCount]
|
| | | itemID = giftInfo[Def_InfoIndex_ItemID]
|
| | | isBind = 0
|
| | | if len(giftInfo) > Def_InfoIndex_IsBind:
|
| | | isBind = giftInfo[Def_InfoIndex_IsBind]
|
| | |
|
| | | if itemCount <= 0:
|
| | | continue
|
| | | |
| | | # 一般物品
|
| | | if itemType == Def_ItemType_CommonItem:
|
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isBind, [IPY_GameWorld.rptItem], True, showSysInfo=True)
|
| | | |
| | | # 特殊定制物品
|
| | | elif itemType == Def_ItemType_AppointItem:
|
| | | itemData = PyMapTable.GetPyMapTable("AppointItemList").GetRecord("ItemIndex", str(itemID))
|
| | | GameWorld.DebugLog("__GiveGoldGift itemData=%s" % itemData)
|
| | | if not itemData:
|
| | | GameWorld.ErrLog("__GiveGoldGift()itemType=%s,ItemIndex=%s not data" % (itemType, itemID))
|
| | | continue
|
| | | |
| | | if len(itemData) != 1:
|
| | | GameWorld.ErrLog("__GiveGoldGift()itemType=%s,ItemIndex=%s,recordCount=%s !=1 error" % \
|
| | | (itemType, itemID, len(itemData)))
|
| | | continue
|
| | | |
| | | itemDictData = itemData[0]
|
| | | itemDictData['IsBind'] = str(isBind)
|
| | | ItemControler.GivePlayerEquip(curPlayer, itemDictData, True, showSysInfo=True)
|
| | |
|
| | | return True
|
| | |
|
| | |
|
| | | ## 给玩家充值豪礼奖励物品信息列表
|
| | | # @param curPlayer:玩家实例
|
| | | # @param awardItemInfoDict:奖励物品配置字典
|
| | | # @return None
|
| | | def __GetGoldGiftInfoList(curPlayer, goldGiftInfoDict):
|
| | | infoKey = () # 默认key
|
| | | job = curPlayer.GetJob()
|
| | | for key in goldGiftInfoDict.keys():
|
| | | # 如果玩家职业在配置的key里,则取指定的key信息
|
| | | if job in key:
|
| | | infoKey = key
|
| | | break
|
| | | |
| | | return goldGiftInfoDict[infoKey]
|
| | |
|
| | |
|
| | | ## 更新领取记录
|
| | | # @param giftNum:豪礼编号,从0开始
|
| | | # @return None
|
| | | def __UpdateLVAwardGetRecord(curPlayer, giftNum):
|
| | | |
| | | curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldGiftGetRecord, 0,
|
| | | ChConfig.Def_PDictType_GoldGift)
|
| | | |
| | | curValue = curValue|(1 << giftNum)
|
| | | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldGiftGetRecord, curValue,
|
| | | ChConfig.Def_PDictType_GoldGift)
|
| | | return
|
| | |
|
| | | ## 检查可否领取
|
| | | # @param giftNum:豪礼编号
|
| | | # @return True-可领取
|
| | | def __CheckCanGetGift(curPlayer, giftNum):
|
| | | |
| | | needGoldCntList = ReadChConfig.GetEvalChConfig("NeedGoldCntList")
|
| | | |
| | | # 非法索引
|
| | | if giftNum < 0 or giftNum >= len(needGoldCntList):
|
| | | GameWorld.ErrLog("__CheckCanGetGift() error:not giftNum=%s" % (giftNum))
|
| | | return False
|
| | | |
| | | # 判断已冲元宝数是否满足
|
| | | curChangeCoin = curPlayer.GetChangeCoinPointTotal()
|
| | | curChangeGold = PlayerCoin.GetCoinRate() * curChangeCoin
|
| | | if curChangeGold < needGoldCntList[giftNum]:
|
| | | GameWorld.DebugLog("__CheckCanGetGift() curChangeGold not enough " + \
|
| | | "giftNum=%s,needGold=%s,changeGold=%s" % \
|
| | | (giftNum, needGoldCntList[giftNum], curChangeGold))
|
| | | return False
|
| | | |
| | | # 判断是否已领取
|
| | | curValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldGiftGetRecord, 0,
|
| | | ChConfig.Def_PDictType_GoldGift)
|
| | | return not (curValue & pow(2, giftNum))
|
| | |
|
| | |
|
| | | ##------------------------------------------------------------------------------
|
| | | def DoFirstGoldOpen(curPlayer):
|
| | |
| | | return
|
| | |
|
| | |
|
| | | def GetPlayerGoldGiftFirst(curPlayer):
|
| | | def GetPlayerGoldGiftFirst(curPlayer, giftDay):
|
| | | '''领取玩家首充奖励
|
| | | @param dayIndex: 首充第几天奖励
|
| | | '''
|
| | |
|
| | | isGet = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldGiftFirstRecord)
|
| | | if isGet:
|
| | | GameWorld.DebugLog("已经领取过首充奖励!", curPlayer.GetPlayerID())
|
| | | if 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)
|
| | | return
|
| | | canGetMaxDay = openServerDay - firstGoldServerDay + 1
|
| | | if giftDay > canGetMaxDay:
|
| | | GameWorld.DebugLog("还未到可领取的首充天,无法领取!openServerDay=%s,firstGoldServerDay=%s,canGetMaxDay=%s < giftDay=%s" |
| | | % (openServerDay, firstGoldServerDay, canGetMaxDay, giftDay))
|
| | | return
|
| | | dayIndex = giftDay - 1
|
| | | getRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldGiftFirstRecord)
|
| | | if getRecord & pow(2, dayIndex):
|
| | | GameWorld.DebugLog("已经领取过首充奖励!giftDay=%s" % giftDay, curPlayer.GetPlayerID())
|
| | | return
|
| | |
|
| | | if not curPlayer.GetChangeCoinPointTotal():
|
| | | GameWorld.DebugLog("没有充值过,无法领取首充奖励!", curPlayer.GetPlayerID())
|
| | | return
|
| | |
|
| | | firstGoldRewardDict = IpyGameDataPY.GetFuncEvalCfg("FirstGold", 1)
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("FirstGold", giftDay)
|
| | | if not ipyData:
|
| | | return |
| | | jobItemInfoDict = ipyData.GetJobItemInfo()
|
| | | commItemList = ipyData.GetCommItemList()
|
| | | |
| | | rewardItemList = []
|
| | | jobStr = str(curPlayer.GetJob())
|
| | | if jobStr not in firstGoldRewardDict:
|
| | | GameWorld.ErrLog("没有配置该职业对应的首充奖励!job=%s" % jobStr, curPlayer.GetPlayerID())
|
| | | return
|
| | | rewardItemList = firstGoldRewardDict[jobStr]
|
| | | if jobStr in jobItemInfoDict:
|
| | | rewardItemList += jobItemInfoDict[jobStr]
|
| | | rewardItemList += commItemList
|
| | | |
| | | if not rewardItemList:
|
| | | return
|
| | | needSpace = len(rewardItemList)
|
| | |
| | | return
|
| | |
|
| | | # 更新已领取成功标记
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldGiftFirstRecord, 1)
|
| | | 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))
|
| | |
|
| | | # 给物品
|
| | | for itemID, itemCount, isBind in rewardItemList: |
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isBind, [IPY_GameWorld.rptItem])
|
| | | isAuctionItem = False
|
| | | for itemID, itemCount in rewardItemList: |
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isAuctionItem, [IPY_GameWorld.rptItem])
|
| | |
|
| | | # 全服提示
|
| | | if len(rewardItemList) >= 2:
|
| | | PlayerControl.WorldNotify(0, "FirstPayReward1", [curPlayer.GetPlayerName(), rewardItemList[0][0], rewardItemList[1][0]])
|
| | | PlayerControl.WorldNotify(0, "FirstPayReward1", [curPlayer.GetPlayerName(), rewardItemList[0][0], rewardItemList[1][0], giftDay])
|
| | | |
| | | # 记录领取事件
|
| | | DataRecordPack.DR_GoldGiftGiveItem(curPlayer, "FirstGoldGift")
|
| | | infoDict = {"GiftDay":giftDay, "ItemList":rewardItemList}
|
| | | DataRecordPack.DR_GoldGiftGiveItem(curPlayer, "FirstGoldGift", infoDict)
|
| | |
|
| | | # 通知客户端
|
| | | Sync_FirstGoldInfo(curPlayer)
|
| | |
| | | # @return: None
|
| | | def OnDay(curPlayer):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DailyChargeState, 0)
|
| | | |
| | | #===============================================================================================
|
| | | # curChangeCoin = curPlayer.GetChangeCoinPointTotal()
|
| | | # # 今天之前有充值过才需要处理天天首充
|
| | | # if curChangeCoin > 0:
|
| | | # # 天天首充状态开启
|
| | | # dailyGoldState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyGoldChargeState, 0)
|
| | | # if not dailyGoldState:
|
| | | # UpdateDailyGoldState(curPlayer, 1)
|
| | | # |
| | | # # 天天首充领奖状态 0-不可领;1-可领;2-已领
|
| | | # dailyGoldRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyGoldChargePrizeRecord, 0)
|
| | | # if dailyGoldRecord != 1:
|
| | | # UpdateDailyGoldRecord(curPlayer, 0)
|
| | | #===============================================================================================
|
| | | |
| | | # 重置今日已充值数, 领取礼包索引
|
| | | #PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DailyGoldChargeCnt, 0)
|
| | | return
|
| | |
|
| | | ## 充值豪礼OnLogin
|
| | |
| | | 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()))
|
| | |
| | | # @param addGold: 充元宝数
|
| | | # @return: None
|
| | | def OnPlayerChargeGold(curPlayer, addGold):
|
| | | DayChargeRedPackAward(curPlayer)
|
| | |
|
| | | # 更新今日已充值数
|
| | | dailyGoldCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyGoldChargeCnt)
|
| | | updDailyGoldCnt = dailyGoldCnt + addGold
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DailyGoldChargeCnt, updDailyGoldCnt)
|
| | | #PlayerControl.NotifyPlayerDictValue(curPlayer, ChConfig.Def_PDict_DailyGoldChargeCnt)
|
| | | |
| | | # 天天首充已开启才处理
|
| | | dailyGoldState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyGoldChargeState, 0)
|
| | | if dailyGoldState:
|
| | | # 天天首充领奖状态 0-不可领;1-可领;2-已领
|
| | | dailyGoldRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyGoldChargePrizeRecord, 0)
|
| | | # 不可领的时候才置为可领
|
| | | if dailyGoldRecord == 0:
|
| | | UpdateDailyGoldRecord(curPlayer, 1)
|
| | | |
| | | # 充值达到额定元宝获得奖励,邮件发送
|
| | | __GiveGoldGiftByMail(curPlayer)
|
| | | return
|
| | |
|
| | | ## 玩家累计充值元宝发送邮件奖励
|
| | | # @param curPlayer: 玩家
|
| | | # @return: None
|
| | | def __GiveGoldGiftByMail(curPlayer):
|
| | | coinPointTotal = curPlayer.GetChangeCoinPointTotal()
|
| | | goldTotal = PlayerCoin.GetCoinRate() * coinPointTotal
|
| | | GameWorld.DebugLog("邮件发送充值豪礼:goldTotal=%s" % (goldTotal))
|
| | | if goldTotal <= 0:
|
| | | return
|
| | | |
| | | goldGiftByMailList = ReadChConfig.GetEvalChConfig("GoldGiftByMail")
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | for i, giftInfo in enumerate(goldGiftByMailList):
|
| | | 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)
|
| | |
|
| | | needGold = giftInfo[0]
|
| | | giftItemList = giftInfo[1]
|
| | | mailTitle = giftInfo[2]
|
| | | mailContent = giftInfo[3]
|
| | | getDays = giftInfo[4]
|
| | | |
| | | curMailRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_GoldGiftMailRecord, 0, |
| | | ChConfig.Def_PDictType_GoldGift)
|
| | | |
| | | if curMailRecord&pow(2, i):
|
| | | GameWorld.DebugLog("邮件发送充值豪礼:已发送过!i=%s,needGold=%s" % (i, needGold))
|
| | | continue
|
| | | |
| | | if goldTotal < needGold:
|
| | | continue
|
| | | |
| | | if not PlayerControl.SendMail(mailTitle, mailContent, getDays, [playerID], giftItemList):
|
| | | continue
|
| | | |
| | | updMailRecord = curMailRecord|pow(2, i)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_GoldGiftMailRecord, updMailRecord,
|
| | | ChConfig.Def_PDictType_GoldGift)
|
| | | |
| | | GameWorld.DebugLog("邮件发送充值豪礼:i=%s,needGold=%s,giftItemList=%s,updMailRecord=%s" |
| | | % (i, needGold, str(giftItemList), updMailRecord))
|
| | | # 流向
|
| | | DataRecordPack.DR_GoldGiftGiveItem(curPlayer, "GoldGiftSendMail_%s_%s" % (i, needGold))
|
| | | return
|
| | |
|
| | | ## 领取玩家天天首充奖励
|
| | | # @param curPlayer
|
| | | # @return None
|
| | | def GetPlayerDailyGoldChargeGift(curPlayer):
|
| | | |
| | | dailyGoldRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyGoldChargePrizeRecord, 0)
|
| | | |
| | | if dailyGoldRecord != 1:
|
| | | GameWorld.DebugLog("天天首充不可领!当前状态=%s" % dailyGoldRecord)
|
| | | return
|
| | | |
| | | dailyFirstGoldPrizeInfo = ReadChConfig.GetEvalChConfig("GoldGiftInfoFirstDaily")
|
| | | |
| | | # 检查背包
|
| | | packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem)
|
| | | needSpace = dailyFirstGoldPrizeInfo[Def_NeedSpace]
|
| | | if needSpace > packSpace:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
|
| | | return
|
| | | |
| | | # 给物品
|
| | | if not __GiveGoldGift(curPlayer, dailyFirstGoldPrizeInfo[Def_GiftInfo]):
|
| | | return
|
| | |
|
| | | # 全服提示
|
| | | notifyMark = dailyFirstGoldPrizeInfo[Def_NotifyMark]
|
| | | if notifyMark:
|
| | | PlayerControl.WorldNotify(0, notifyMark, [curPlayer.GetPlayerName()])
|
| | |
|
| | | UpdateDailyGoldRecord(curPlayer, 2)
|
| | | |
| | | # 记录领取事件
|
| | | DataRecordPack.DR_GoldGiftGiveItem(curPlayer, "dailyFirstGoldPrize")
|
| | | return
|
| | |
|
| | |
|
| | | ## 更新天天首充奖励记录
|
| | | # @param curPlayer
|
| | | # @return None
|
| | | def UpdateDailyGoldRecord(curPlayer, record):
|
| | | #PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DailyGoldChargePrizeRecord, record)
|
| | | #Sync_DailyGoldRecordInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def Sync_FirstGoldInfo(curPlayer):
|
| | |
| | | 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
|
| | |
|
| | |
| | | if not result:
|
| | | GameWorld.Log(' 试用首充武器 卸下原装备失败!!', curPlayer.GetID())
|
| | | return
|
| | | |
| | | tryItem = ItemControler.GetOutPutItemObj(tryItemID, 1, 1)
|
| | | tryItem = ItemControler.GetOutPutItemObj(tryItemID)
|
| | | if ChEquip.DoPlayerEquipItem(curPlayer, tryItem, ItemCommon.GetEquipPackIndex(tryItem), tick):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldTry, 2)
|
| | | else:
|
| | |
| | | if not giveItemID:
|
| | | return
|
| | | GameWorld.DebugLog('首充试用物品过期了 背包仓库没武器则送一把giveItemID=%s'%giveItemID, curPlayer.GetID())
|
| | | if not ItemControler.GivePlayerItem(curPlayer, giveItemID, 1, True, [IPY_GameWorld.rptItem], True):
|
| | | if not ItemControler.GivePlayerItem(curPlayer, giveItemID, 1, 0, [IPY_GameWorld.rptItem]):
|
| | | GameWorld.DebugLog('首充试用物品过期了 背包仓库没武器则送一把 没给成功!!giveItemID=%s'%giveItemID, curPlayer.GetID())
|
| | |
|
| | | return
|
| | |
| | | return
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DailyChargeState, 1)
|
| | | PlayerFamilyRedPacket.CreatRedPacketByID(curPlayer, 2)
|
| | | return
|
| | |
|
| | |
|
| | | def OnGetHistoryRechargeAward(curPlayer, awardID):
|
| | | # 领取历史充值奖励
|
| | | |
| | | ipyData = IpyGameDataPY.GetIpyGameData('HistoryRechargeAward', awardID)
|
| | | if not ipyData:
|
| | | return
|
| | | |
| | | getRecharge = ipyData.GetRecharge()
|
| | | # 检查可否领取
|
| | | |
| | | # 玩家充值小于领取充值
|
| | | if curPlayer.GetChangeCoinPointTotal()/100 < getRecharge:
|
| | | GameWorld.ErrLog("OnGetHistoryRechargeAward error:getRecharge=%s greater than ChangeCoinPointTotal=%s" % (getRecharge, curPlayer.GetChangeCoinPointTotal()))
|
| | | return
|
| | | awardInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HistoryChargeAwardGetRecord, 0)
|
| | | awardMark = pow(2, awardID)
|
| | | if awardInfo & awardMark:
|
| | | #已领取
|
| | | GameWorld.DebugLog("已领取历史充值奖励!awardID=%s,getRecharge=%s" % (awardID, getRecharge))
|
| | | return
|
| | |
|
| | | job = curPlayer.GetJob()
|
| | | awardDict = ipyData.GetReward()
|
| | | if str(job) not in awardDict:
|
| | | return
|
| | | itemList = awardDict[str(job)]
|
| | | |
| | | if not itemList:
|
| | | return
|
| | | # 检查背包
|
| | | needSpace = len(itemList)
|
| | | packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem, needSpace)
|
| | | if needSpace > packSpace:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
|
| | | return
|
| | | |
| | | # 给物品
|
| | | for itemInfo in itemList:
|
| | | itemID, itemCount = itemInfo[:2]
|
| | | ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, 0, [IPY_GameWorld.rptItem])
|
| | | |
| | | # 更新已领取成功标记
|
| | | awardMark = pow(2, awardID)
|
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_HistoryChargeAwardGetRecord, awardInfo | awardMark)
|
| | | # 通知客户端
|
| | | Sync_HistoryChargeAwardGetRecordInfo(curPlayer)
|
| | | |
| | | # 记录领取事件
|
| | | DataRecordPack.SendEventPack("HistoryRechargeAward", {'awardID':awardID, 'getRecharge':getRecharge}, curPlayer)
|
| | | return
|
| | |
|
| | |
|
| | | ## 通知等级奖励领取记录信息
|
| | | # @param None
|
| | | # @return None
|
| | | def Sync_HistoryChargeAwardGetRecordInfo(curPlayer):
|
| | | sendPack = ChPyNetSendPack.tagMCHistoryReChargeAwardRecord()
|
| | | sendPack.Clear()
|
| | | sendPack.AwardGetRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_HistoryChargeAwardGetRecord, 0)
|
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return |