| | |
| | | import ChEquip
|
| | |
|
| | | import time
|
| | | import FunctionNPCCommon
|
| | |
|
| | | # 定义配表外围索引
|
| | | (
|
| | |
| | |
|
| | | # 重置今日已充值数, 领取礼包索引
|
| | | #PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_DailyGoldChargeCnt, 0)
|
| | | #PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SingleGoldGiftIndex, 0)
|
| | | #PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_UnlimitedGoldGiftCnt, 0)
|
| | | # 通知单日充值多选一礼包信息
|
| | | #Sync_SingleGoldGiftInfo(curPlayer, True)
|
| | | #Sync_UnlimitedGoldGiftRecord(curPlayer)
|
| | | return
|
| | |
|
| | | ## 充值豪礼OnLogin
|
| | |
| | |
|
| | | # 充值达到额定元宝获得奖励,邮件发送
|
| | | __GiveGoldGiftByMail(curPlayer)
|
| | | |
| | | # 通知单日充值多选一礼包信息
|
| | | Sync_SingleGoldGiftInfo(curPlayer, True)
|
| | | return
|
| | |
|
| | | ## 单日充值任选一奖励
|
| | | # @param curPlayer: 玩家
|
| | | # @param giftIndex: 礼包索引
|
| | | # @param giftLV: 礼包档次
|
| | | # @return: None
|
| | | def GetSingleGoldGift(curPlayer, giftIndex, giftLV, giftType):
|
| | | |
| | | findSingleGoldGift = GetTodaySingleGoldGiftInfo()
|
| | | |
| | | GameWorld.DebugLog("当日充值奖励领奖 (档%s - %s) giftType=%s,findSingleGoldGift=%s" |
| | | % (giftLV, giftIndex, giftType, str(findSingleGoldGift)))
|
| | | |
| | | if not findSingleGoldGift:
|
| | | GameWorld.DebugLog(" 今日未配置充值单选礼包!")
|
| | | return
|
| | |
|
| | | todayGiftType = findSingleGoldGift[2]
|
| | | if giftType != todayGiftType:
|
| | | GameWorld.DebugLog(" 非当日充值礼包类型!todayGiftType=%s" % todayGiftType)
|
| | | return
|
| | | |
| | | goldGiftInfoList = findSingleGoldGift[3]
|
| | | |
| | | # 无限领取礼包类型
|
| | | if giftType == 1:
|
| | | __GetUnlimitedGoldGift(curPlayer, goldGiftInfoList)
|
| | | return
|
| | | |
| | | if giftIndex <= 0:
|
| | | return
|
| | | |
| | | if giftLV >= len(goldGiftInfoList):
|
| | | GameWorld.ErrLog("单日充值单选礼包配置错误SingleGoldGift.txt 不存在该奖励档!giftLV=%s" % giftLV)
|
| | | return
|
| | | |
| | | curGoldGiftInfo = goldGiftInfoList[giftLV]
|
| | | needGold, chooseGiftList = curGoldGiftInfo
|
| | | |
| | | dailyGoldCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyGoldChargeCnt)
|
| | | |
| | | if dailyGoldCnt < needGold:
|
| | | GameWorld.DebugLog(" 今日充值额度未满足,无法领奖!needGold=%s,dailyGoldCnt=%s" |
| | | % (needGold, dailyGoldCnt))
|
| | | return
|
| | | |
| | | goldGiftAwardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SingleGoldGiftIndex)
|
| | | singleGoldGiftIndex = GameWorld.GetDataByDigitPlace(goldGiftAwardRecord, giftLV)
|
| | | if singleGoldGiftIndex > 0:
|
| | | GameWorld.DebugLog(" 今日已领取!singleGoldGiftIndex=%s" % (singleGoldGiftIndex))
|
| | | return
|
| | | |
| | | if giftIndex > len(chooseGiftList):
|
| | | GameWorld.ErrLog("单日充值单选礼包配置错误SingleGoldGift.txt giftIndex=%s 不在奖励列表里!" % giftIndex)
|
| | | return
|
| | | |
| | | hasSpace = ItemCommon.CheckPackHasSpace(curPlayer, IPY_GameWorld.rptItem)
|
| | | if not hasSpace:
|
| | | GameWorld.DebugLog(" 背包已满!")
|
| | | return
|
| | | |
| | | # 更新领奖索引
|
| | | updGoldGiftRecord = GameWorld.ChangeDataByDigitPlace(goldGiftAwardRecord, giftLV, giftIndex)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SingleGoldGiftIndex, updGoldGiftRecord)
|
| | | |
| | | itemID, itemCount, isBind = chooseGiftList[giftIndex - 1]
|
| | | isOK = ItemControler.GivePlayerItem(curPlayer, itemID, itemCount, isBind, [IPY_GameWorld.rptItem], True)
|
| | | if not isOK:
|
| | | return
|
| | |
|
| | | # 流向
|
| | | infoDict = {"SingleGiftIndex":giftIndex, "ItemID":itemID, "ItemCount":itemCount, "IsBind":isBind,
|
| | | "SingleGiftLV":giftLV, "GoldGiftAwardRecord":updGoldGiftRecord}
|
| | | DataRecordPack.DR_GoldGiftGiveItem(curPlayer, "SingleGoldGift", infoDict)
|
| | | |
| | | # 同步客户端状态
|
| | | Sync_SingleGoldGiftInfo(curPlayer)
|
| | | GameWorld.DebugLog(" awardRecord=%s,updRecord=%s,infoDict=%s" % (goldGiftAwardRecord, updGoldGiftRecord, infoDict))
|
| | | return
|
| | |
|
| | | def __GetUnlimitedGoldGift(curPlayer, goldGiftInfoList):
|
| | | |
| | | dailyGoldCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyGoldChargeCnt)
|
| | | |
| | | # 已领取次数
|
| | | hadGetCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnlimitedGoldGiftCnt)
|
| | | |
| | | maxGetCnt = goldGiftInfoList[0] # 最大重复领取次数
|
| | | perNeedGold = goldGiftInfoList[1] # 每次领取需要充值钻石数
|
| | | curCanGetCnt = dailyGoldCnt / perNeedGold # 当前可领取的最大次数
|
| | | if maxGetCnt > 0:
|
| | | curCanGetCnt = min(curCanGetCnt, maxGetCnt)
|
| | | |
| | | GameWorld.DebugLog("领取当日充值无限领取礼包:dailyGoldCnt=%s / per(%s) = canCnt(%s),hadGetCnt=%s,MaxCntCfg=%s" |
| | | % (dailyGoldCnt, perNeedGold, curCanGetCnt, hadGetCnt, maxGetCnt))
|
| | | |
| | | if curCanGetCnt <= 0:
|
| | | GameWorld.DebugLog(" 可领取次数=%s,不可领取!" % curCanGetCnt)
|
| | | return
|
| | | |
| | | if hadGetCnt >= curCanGetCnt:
|
| | | GameWorld.DebugLog(" 已达到最大领取次数!%s" % curCanGetCnt)
|
| | | return
|
| | | |
| | | getCnt = curCanGetCnt - hadGetCnt
|
| | | |
| | | # 检查背包
|
| | | packSpace = ItemCommon.GetItemPackSpace(curPlayer, IPY_GameWorld.rptItem)
|
| | | needSpace = goldGiftInfoList[2]
|
| | | if needSpace > packSpace:
|
| | | PlayerControl.NotifyCode(curPlayer, "GeRen_chenxin_998371")
|
| | | return
|
| | |
|
| | | # 给物品
|
| | | curGetCnt = getCnt
|
| | | awardItemList = goldGiftInfoList[3]
|
| | | for itemID, itemCnt, isBind in awardItemList:
|
| | | gameData = GameWorld.GetGameData()
|
| | | curItemData = gameData.GetItemByTypeID(itemID)
|
| | | if curItemData == None:
|
| | | GameWorld.ErrLog("领取当日充值无限领取礼包,物品ID数据错误!(%s)" % itemID, curPlayer.GetPlayerID())
|
| | | return
|
| | | |
| | | maxPackCount = curItemData.GetPackCount()
|
| | | perSpaceCanGetCnt = maxPackCount / itemCnt # 单个空位最大可领取次数
|
| | | curGetCnt = min(perSpaceCanGetCnt, curGetCnt)
|
| | | #GameWorld.DebugLog(" itemID=%s,maxPackCount=%s,giveCnt=%s,perSpaceCanGetCnt=%s,curGetCnt=%s" |
| | | # % (itemID, maxPackCount, itemCnt, perSpaceCanGetCnt, curGetCnt))
|
| | | |
| | | # 更新已领取成功标记
|
| | | updGetCnt = hadGetCnt + curGetCnt
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_UnlimitedGoldGiftCnt, updGetCnt)
|
| | |
|
| | | # 给物品
|
| | | awardItemList = goldGiftInfoList[3]
|
| | | isOKStr = ""
|
| | | for itemID, itemCnt, isBind in awardItemList:
|
| | | isOK = ItemControler.GivePlayerItem(curPlayer, itemID, itemCnt * curGetCnt, isBind, |
| | | [IPY_GameWorld.rptItem, IPY_GameWorld.rptAnyWhere], True)
|
| | | |
| | | isOKStr = "%s%s" % (str(int(isOK)), isOKStr)
|
| | | |
| | | # 记录领取事件
|
| | | addDataDict = {"isOKStr":isOKStr, "awardItemList":str(awardItemList), "DailyGoldCnt":dailyGoldCnt,
|
| | | "TodayGetCnt":updGetCnt, "CurGetCnt":curGetCnt}
|
| | | DataRecordPack.DR_FuncGiveItem(curPlayer, "UnlimitedGoldGift", addDataDict)
|
| | | |
| | | # 通知客户端
|
| | | Sync_UnlimitedGoldGiftRecord(curPlayer)
|
| | | GameWorld.DebugLog(" 领取充值无限领取礼包奖励OK!TodayGetCnt=%s,CurGetCnt=%s" % (updGetCnt, curGetCnt))
|
| | | return
|
| | |
|
| | |
|
| | | ## 通知无限领取礼包已领取次数
|
| | | # @param None
|
| | | # @return None
|
| | | def Sync_UnlimitedGoldGiftRecord(curPlayer):
|
| | | #record = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_UnlimitedGoldGiftCnt)
|
| | | #ChPlayer.Sync_RewardGetRecordInfo(curPlayer, ShareDefine.Def_RewardType_UnlimitedGoldGift, record)
|
| | | return
|
| | |
|
| | |
|
| | | ## 玩家累计充值元宝发送邮件奖励
|
| | | # @param curPlayer: 玩家
|
| | |
| | | NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | return
|
| | |
|
| | | ## 通知单日充值多选一礼包信息
|
| | | # @param curPlayer
|
| | | # @return None
|
| | | def Sync_SingleGoldGiftInfo(curPlayer, isCheckTime=False):
|
| | | #===============================================================================================
|
| | | # if isCheckTime:
|
| | | # todayGiftInfo = GetTodaySingleGoldGiftInfo()
|
| | | # if not todayGiftInfo:
|
| | | # return
|
| | | # |
| | | # sendPack = ChPyNetSendPack.tagMCSingleGoldGift()
|
| | | # sendPack.Clear()
|
| | | # sendPack.GoldCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_DailyGoldChargeCnt)
|
| | | # sendPack.GiftIndex = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SingleGoldGiftIndex)
|
| | | # NetPackCommon.SendFakePack(curPlayer, sendPack)
|
| | | #===============================================================================================
|
| | | return
|
| | |
|
| | | ## 获取单日充值多选一礼包信息
|
| | | # @param None
|
| | | # @return None代表今日无活动
|
| | | def GetTodaySingleGoldGiftInfo():
|
| | | # 开服前7天默认不开启
|
| | | openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay)
|
| | | |
| | | singleGoldGiftList = ReadChConfig.GetEvalChConfig("SingleGoldGift")
|
| | | |
| | | curDataTimeStr = GameWorld.GetCurrentDataTimeStr()
|
| | | |
| | | curTime = GameWorld.GetCurrentTime()
|
| | | weekday = curTime.weekday() + 1
|
| | | |
| | | findSingleGoldGift = None
|
| | | for giftInfo in singleGoldGiftList:
|
| | | |
| | | # 判断日期, 日期活动优先
|
| | | dateTimeInfo = giftInfo[0]
|
| | | if dateTimeInfo:
|
| | | startTime = dateTimeInfo[0]
|
| | | endTime = dateTimeInfo[1]
|
| | | if startTime <= curDataTimeStr <= endTime:
|
| | | findSingleGoldGift = giftInfo
|
| | | break
|
| | | |
| | | # 判断星期, 开服前7天默认不开启星期活动
|
| | | weekDayInfo = giftInfo[1]
|
| | | if weekday in weekDayInfo and openServerDay >= ShareDefine.Def_OSC_ValidDay:
|
| | | findSingleGoldGift = giftInfo
|
| | | break
|
| | | |
| | | return findSingleGoldGift
|
| | |
|
| | |
|
| | | #// A5 11 试用首充武器 #tagCMTryFirstGoldItem
|
| | | #
|
| | | #struct tagCMTryFirstGoldItem
|
| | |
| | | return
|
| | |
|
| | | tryItem = ItemControler.GetOutPutItemObj(tryItemID, 1, 1)
|
| | | if ChEquip.DoPlayerEquipItem(curPlayer, tryItem, equipPlace, tick):
|
| | | if ChEquip.DoPlayerEquipItem(curPlayer, tryItem, ItemCommon.GetEquipPackIndex(tryItem), tick):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_FirstGoldTry, 2)
|
| | | else:
|
| | | curItem.clear()
|