| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SingleRechargeID % actNum, actID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SingleRechargeTemplateID % actNum, templateID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SingleRechargeWorldLV % actNum, actWorldLV)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SingleRechargeValue % actNum, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SingleRechargeAward % actNum, 0)
|
| | | if actID and templateID:
|
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataList("ActSingleRechargeAward", templateID)
|
| | | if ipyDataList:
|
| | | for ipyData in ipyDataList:
|
| | | awardIndex = ipyData.GetAwardIndex()
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SingleRechargeValue % (actNum, awardIndex), 0)
|
| | |
|
| | | Sync_SingleRechargeActionInfo(curPlayer, actNum)
|
| | | Sync_SingleRechargePlayerInfo(curPlayer, actNum)
|
| | | return True
|
| | |
|
| | | def GetAwardCountInfo(curPlayer, actNum, awardIndex):
|
| | | valueInfo = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SingleRechargeValue % (actNum, awardIndex))
|
| | | getCount = valueInfo / 1000
|
| | | canGetCount = valueInfo % 1000
|
| | | return getCount, canGetCount
|
| | | def SetAwardCountInfo(curPlayer, actNum, awardIndex, getCount, canGetCount):
|
| | | valueInfo = getCount * 1000 + canGetCount
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SingleRechargeValue % (actNum, awardIndex), valueInfo)
|
| | | return valueInfo
|
| | |
|
| | | def __SendSingleRechargeMail(curPlayer, playerTemplateID, playerWorldLV, actNum):
|
| | | # 未领取的奖励邮件发放
|
| | |
|
| | | if not playerTemplateID:
|
| | | return
|
| | | |
| | | canAwardValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SingleRechargeValue % actNum)
|
| | | if not canAwardValue:
|
| | | return
|
| | |
|
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataList("ActSingleRechargeAward", playerTemplateID)
|
| | |
| | |
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | batchPlayerIDList, batchAddItemList, batchParamList = [], [], []
|
| | | awardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SingleRechargeAward % actNum)
|
| | |
|
| | | for ipyData in ipyDataList:
|
| | | awardIndex = ipyData.GetAwardIndex()
|
| | | if awardRecord & pow(2, awardIndex):
|
| | | #GameWorld.DebugLog("单笔累充已发放过奖励!awardIndex=%s" % awardIndex)
|
| | | getCount, canGetCount = GetAwardCountInfo(curPlayer, actNum, awardIndex)
|
| | | if getCount >= canGetCount:
|
| | | #GameWorld.DebugLog("单笔累充已经全部领奖!awardIndex=%s" % awardIndex)
|
| | | continue
|
| | | SetAwardCountInfo(curPlayer, actNum, awardIndex, canGetCount, canGetCount)
|
| | |
|
| | | unGetCount = canGetCount - getCount
|
| | | singleValue = ipyData.GetSingleRechargeValue()
|
| | | if not canAwardValue & pow(2, awardIndex):
|
| | | #GameWorld.DebugLog("单笔累充不能领奖!awardIndex=%s" % awardIndex)
|
| | | continue
|
| | | awardRecord |= pow(2, awardIndex) |
| | | |
| | | awardItemList = GameWorld.GetDictValueByRangeKey(ipyData.GetAwardItem(), playerWorldLV, [])
|
| | | for _ in range(unGetCount):
|
| | | batchPlayerIDList.append([playerID])
|
| | | batchAddItemList.append(awardItemList)
|
| | | batchParamList.append([singleValue])
|
| | |
|
| | | if batchPlayerIDList:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SingleRechargeAward % actNum, awardRecord)
|
| | | PlayerControl.SendMailBatch("SingleRechargeMail%s" % actNum, batchPlayerIDList, batchAddItemList, batchParamList)
|
| | |
|
| | | return
|
| | |
| | | if not awardIpyDataList:
|
| | | continue
|
| | |
|
| | | canAwardChange = False
|
| | | canAwardValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SingleRechargeValue % actNum)
|
| | | awardIndexList = []
|
| | | awardRuleType = ipyData.GetAwardRuleType()
|
| | | GameWorld.DebugLog("单笔累充充值活动,actNum=%s,awardRuleType=%s,canAwardValue=%s,curRechargeValue=%s" |
| | | % (actNum, awardRuleType, canAwardValue, curRechargeValue))
|
| | | GameWorld.DebugLog("单笔累充充值活动,actNum=%s,awardRuleType=%s,curRechargeValue=%s" % (actNum, awardRuleType, curRechargeValue))
|
| | | # 向下兼容所有档次
|
| | | if awardRuleType == 0:
|
| | | for awardIpyData in awardIpyDataList:
|
| | | awardIndex = awardIpyData.GetAwardIndex()
|
| | | singleValue = CommFunc.RMBToCoin(awardIpyData.GetSingleRechargeValue())
|
| | | if canAwardValue & pow(2, awardIndex):
|
| | | #GameWorld.DebugLog(" 已经可领奖,不处理!awardRuleType=%s,awardIndex=%s" % (awardRuleType, awardIndex))
|
| | | continue
|
| | | if curRechargeValue < singleValue:
|
| | | #GameWorld.DebugLog(" 未达到档次额度,不处理!awardRuleType=%s,awardIndex=%s,singleValue=%s" |
| | | # % (awardRuleType, awardIndex, singleValue))
|
| | | continue
|
| | | |
| | | canAwardChange = True
|
| | | canAwardValue |= pow(2, awardIndex)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SingleRechargeValue % actNum, canAwardValue)
|
| | | GameWorld.DebugLog(" 设置档次可领取!awardRuleType=%s,awardIndex=%s,singleValue=%s,canAwardValue=%s" |
| | | % (awardRuleType, awardIndex, singleValue, canAwardValue))
|
| | | |
| | | pass
|
| | | # 匹配最高档次
|
| | | elif awardRuleType == 1:
|
| | | for awardIpyData in awardIpyDataList[::-1]:
|
| | | awardIndex = awardIpyData.GetAwardIndex()
|
| | | singleValue = CommFunc.RMBToCoin(awardIpyData.GetSingleRechargeValue())
|
| | | if canAwardValue & pow(2, awardIndex):
|
| | | #GameWorld.DebugLog(" 已经可领奖,不处理!awardRuleType=%s,awardIndex=%s" % (awardRuleType, awardIndex))
|
| | | continue
|
| | | if curRechargeValue < singleValue:
|
| | | #GameWorld.DebugLog(" 未达到档次额度,不处理!awardRuleType=%s,awardIndex=%s,singleValue=%s" |
| | | # % (awardRuleType, awardIndex, singleValue))
|
| | | continue
|
| | | |
| | | canAwardChange = True
|
| | | canAwardValue |= pow(2, awardIndex)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SingleRechargeValue % actNum, canAwardValue)
|
| | | GameWorld.DebugLog(" 设置最高档次可领取!awardRuleType=%s,awardIndex=%s,singleValue=%s,canAwardValue=%s" |
| | | % (awardRuleType, awardIndex, singleValue, canAwardValue))
|
| | | break
|
| | | |
| | | pass |
| | | # 精确匹配对应档次
|
| | | elif awardRuleType == 2:
|
| | | for awardIpyData in awardIpyDataList:
|
| | |
| | | #GameWorld.DebugLog(" 不等于档次额度,不处理!awardRuleType=%s,awardIndex=%s,singleValue=%s"
|
| | | # % (awardRuleType, awardIndex, singleValue))
|
| | | continue
|
| | | if canAwardValue & pow(2, awardIndex):
|
| | | #GameWorld.DebugLog(" 已经可领奖,不处理!awardRuleType=%s,awardIndex=%s" % (awardRuleType, awardIndex))
|
| | | awardCountMax = awardIpyData.GetAwardCountMax()
|
| | | getCount, canGetCount = GetAwardCountInfo(curPlayer, actNum, awardIndex)
|
| | | if canGetCount >= awardCountMax:
|
| | | GameWorld.DebugLog(" 已达最大可领奖次数,不处理!awardRuleType=%s,awardIndex=%s,awardCountMax=%s" % (awardRuleType, awardIndex, awardCountMax))
|
| | | break
|
| | |
|
| | | canAwardChange = True
|
| | | canAwardValue |= pow(2, awardIndex)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SingleRechargeValue % actNum, canAwardValue)
|
| | | GameWorld.DebugLog(" 设置精确档次可领取!awardRuleType=%s,awardIndex=%s,singleValue=%s,canAwardValue=%s" |
| | | % (awardRuleType, awardIndex, singleValue, canAwardValue))
|
| | | awardIndexList.append(awardIndex)
|
| | | canGetCount += 1
|
| | | SetAwardCountInfo(curPlayer, actNum, awardIndex, getCount, canGetCount)
|
| | | GameWorld.DebugLog(" 设置精确档次可领取!awardRuleType=%s,awardIndex=%s,singleValue=%s,canGetCount=%s" |
| | | % (awardRuleType, awardIndex, singleValue, canGetCount))
|
| | | break
|
| | |
|
| | | else:
|
| | | continue
|
| | |
|
| | | if not canAwardChange:
|
| | | if not awardIndexList:
|
| | | continue
|
| | |
|
| | | Sync_SingleRechargePlayerInfo(curPlayer, actNum)
|
| | | Sync_SingleRechargePlayerInfo(curPlayer, actNum, awardIndexList)
|
| | |
|
| | | # 线下活动,检查发放奖励
|
| | | if ipyData.GetIsOfflineAct():
|
| | |
| | | GameWorld.DebugLog("该单笔累充活动非活动中,无法领奖!actNum=%s,state=%s,templateID=%s" % (actNum, state, templateID), playerID)
|
| | | return
|
| | |
|
| | | awardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SingleRechargeAward % actNum)
|
| | | if awardRecord & pow(2, awardIndex):
|
| | | GameWorld.DebugLog("已经领取过该单笔累充活动奖励! actNum=%s,awardIndex=%s" % (actNum, awardIndex), playerID)
|
| | | return
|
| | | |
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataList("ActSingleRechargeAward", templateID)
|
| | | if not ipyDataList:
|
| | | return
|
| | |
| | | GameWorld.DebugLog("找不到该单笔累充活动档位索引奖励!actNum=%s,templateID=%s,awardIndex=%s" % (actNum, templateID, awardIndex), playerID)
|
| | | return
|
| | |
|
| | | singleValue = awardIpyData.GetSingleRechargeValue()
|
| | | canAwardValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SingleRechargeValue % actNum)
|
| | | |
| | | if not canAwardValue & pow(2, awardIndex):
|
| | | GameWorld.DebugLog("该档次奖励无法领取! templateID=%s,awardIndex=%s,singleValue=%s,canAwardValue%s" |
| | | % (templateID, awardIndex, singleValue, canAwardValue), playerID)
|
| | | getCount, canGetCount = GetAwardCountInfo(curPlayer, actNum, awardIndex)
|
| | | if getCount >= canGetCount:
|
| | | GameWorld.DebugLog("该单笔累充活动奖励已达最大可领奖次数! actNum=%s,awardIndex=%s,getCount(%s) >= canGetCount(%s)" % (actNum, awardIndex, getCount, canGetCount), playerID)
|
| | | return
|
| | | |
| | | singleValue = awardIpyData.GetSingleRechargeValue()
|
| | |
|
| | | actWorldLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SingleRechargeWorldLV % actNum)
|
| | | awardItemList = GameWorld.GetDictValueByRangeKey(ipyData.GetAwardItem(), actWorldLV, [])
|
| | |
| | | if not ItemControler.CheckPackSpaceEnough(curPlayer, awardItemList):
|
| | | return
|
| | |
|
| | | awardRecord |= pow(2, awardIndex)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SingleRechargeAward % actNum, awardRecord)
|
| | | Sync_SingleRechargePlayerInfo(curPlayer, actNum)
|
| | | getCount += 1
|
| | | SetAwardCountInfo(curPlayer, actNum, awardIndex, getCount, canGetCount)
|
| | | Sync_SingleRechargePlayerInfo(curPlayer, actNum, [awardIndex])
|
| | |
|
| | | GameWorld.DebugLog(" 领取成功! actNum=%s,templateID=%s,awardIndex=%s,singleValue=%s,awardRecord=%s" |
| | | % (actNum, templateID, awardIndex, singleValue, awardRecord))
|
| | | GameWorld.DebugLog(" 领取成功! actNum=%s,templateID=%s,awardIndex=%s,singleValue=%s,getCount=%s,canGetCount=%s" |
| | | % (actNum, templateID, awardIndex, singleValue, getCount, canGetCount))
|
| | |
|
| | | notifyKey = awardIpyData.GetNotifyKey()
|
| | | if notifyKey:
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def Sync_SingleRechargePlayerInfo(curPlayer, actNum):
|
| | | def Sync_SingleRechargePlayerInfo(curPlayer, actNum, awardIndexList=None):
|
| | | ## 通知玩家数据信息
|
| | |
|
| | | actInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_SingleRecharge, actNum)
|
| | |
| | | #线下活动不下发
|
| | | return
|
| | |
|
| | | if awardIndexList == None:
|
| | | awardIndexList = []
|
| | | templateID = GetTemplateID(actInfo.get(ShareDefine.ActKey_CfgID, 0), actInfo.get(ShareDefine.ActKey_DayIndex, 0))
|
| | | if not templateID:
|
| | | return
|
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataList("ActSingleRechargeAward", templateID)
|
| | | if not ipyDataList:
|
| | | return
|
| | | for awardIpyData in ipyDataList:
|
| | | awardIndexList.append(awardIpyData.GetAwardIndex())
|
| | | |
| | | if not awardIndexList:
|
| | | return
|
| | | |
| | | playerActInfo = ChPyNetSendPack.tagMCActSingleRechargePlayerInfo()
|
| | | playerActInfo.ActNum = actNum
|
| | | playerActInfo.CanAwardValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SingleRechargeValue % actNum)
|
| | | playerActInfo.AwardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SingleRechargeAward % actNum)
|
| | | playerActInfo.AwardRecordList = []
|
| | | for awardIndex in awardIndexList:
|
| | | getCount, canGetCount = GetAwardCountInfo(curPlayer, actNum, awardIndex)
|
| | | awardRecord = ChPyNetSendPack.tagMCActSingleRechargePlayerAward()
|
| | | awardRecord.Clear()
|
| | | awardRecord.AwardIndex = awardIndex
|
| | | awardRecord.CanGetCount = canGetCount
|
| | | awardRecord.GetCount = getCount
|
| | | playerActInfo.AwardRecordList.append(awardRecord)
|
| | | playerActInfo.RecordCount = len(playerActInfo.AwardRecordList)
|
| | | NetPackCommon.SendFakePack(curPlayer, playerActInfo)
|
| | | return
|
| | |
|
| | |
| | | for awardIpyData in ipyDataList:
|
| | | awardInfo = ChPyNetSendPack.tagMCActSingleRechargeAward()
|
| | | awardInfo.AwardIndex = awardIpyData.GetAwardIndex()
|
| | | awardInfo.AwardCountMax = awardIpyData.GetAwardCountMax()
|
| | | awardInfo.SingleRechargeValue = CommFunc.RMBToCoin(awardIpyData.GetSingleRechargeValue())
|
| | | awardInfo.AwardItem = []
|
| | | awardItemList = GameWorld.GetDictValueByRangeKey(awardIpyData.GetAwardItem(), actWorldLV, [])
|