8906 【主干】【BT2】【后端】线下单笔充值活动逻辑调整(支持三种领奖模式设定;0-向下兼容,1-匹配最高档,2-精确匹配档次)
# Conflicts:
# ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerActSingleRecharge.py
| | |
| | | BYTE IsDayReset; //是否每天重置
|
| | | BYTE CTGTypeEffValue; //充值有效类型值
|
| | | BYTE IsOfflineAct; //是否线下活动
|
| | | BYTE AwardRuleType; //领奖规则类型 0-向下兼容;1-匹配最高档;2-精确匹配对应档次
|
| | | list TemplateIDList; //模板ID列表
|
| | | };
|
| | |
|
| | |
| | | EndtDate = "" #(char EndtDate[10])// 结束日期 y-m-d
|
| | | IsDayReset = 0 #(BYTE IsDayReset)//是否每天重置
|
| | | LimitLV = 0 #(WORD LimitLV)// 限制等级
|
| | | AwardRuleType = 0 #(BYTE AwardRuleType)// 领奖规则类型 0-向下兼容;1-匹配最高档;2-精确匹配对应档次
|
| | | AwardCount = 0 #(BYTE AwardCount)// 奖励档数
|
| | | AwardInfo = list() #(vector<tagMCActSingleRechargeAward> AwardInfo)// 奖励档信息
|
| | | data = None
|
| | |
| | | self.EndtDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
|
| | | self.IsDayReset,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.LimitLV,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.AwardRuleType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.AwardCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.AwardCount):
|
| | | temAwardInfo = tagMCActSingleRechargeAward()
|
| | |
| | | self.EndtDate = ""
|
| | | self.IsDayReset = 0
|
| | | self.LimitLV = 0
|
| | | self.AwardRuleType = 0
|
| | | self.AwardCount = 0
|
| | | self.AwardInfo = list()
|
| | | return
|
| | |
| | | length += 10
|
| | | length += 1
|
| | | length += 2
|
| | | length += 1
|
| | | length += 1
|
| | | for i in range(self.AwardCount):
|
| | | length += self.AwardInfo[i].GetLength()
|
| | |
| | | data = CommFunc.WriteString(data, 10, self.EndtDate)
|
| | | data = CommFunc.WriteBYTE(data, self.IsDayReset)
|
| | | data = CommFunc.WriteWORD(data, self.LimitLV)
|
| | | data = CommFunc.WriteBYTE(data, self.AwardRuleType)
|
| | | data = CommFunc.WriteBYTE(data, self.AwardCount)
|
| | | for i in range(self.AwardCount):
|
| | | data = CommFunc.WriteString(data, self.AwardInfo[i].GetLength(), self.AwardInfo[i].GetBuffer())
|
| | |
| | | EndtDate:%s,
|
| | | IsDayReset:%d,
|
| | | LimitLV:%d,
|
| | | AwardRuleType:%d,
|
| | | AwardCount:%d,
|
| | | AwardInfo:%s
|
| | | '''\
|
| | |
| | | self.EndtDate,
|
| | | self.IsDayReset,
|
| | | self.LimitLV,
|
| | | self.AwardRuleType,
|
| | | self.AwardCount,
|
| | | "..."
|
| | | )
|
| | |
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("ActNum", c_ubyte), #活动编号从1开始,目前支持两个累充活动同时存在且相互独立 1或2
|
| | | ("HightestSingleRecharge", c_int), # 最高单笔充值额度
|
| | | ("CanAwardValue", c_int), #可否领奖记录,按奖励索引二进制位存储是否可领取
|
| | | ("AwardRecord", c_int), #奖励领奖记录,按奖励索引二进制位存储是否已领取
|
| | | ]
|
| | |
|
| | |
| | | self.Cmd = 0xAA
|
| | | self.SubCmd = 0x51
|
| | | self.ActNum = 0
|
| | | self.HightestSingleRecharge = 0
|
| | | self.CanAwardValue = 0
|
| | | self.AwardRecord = 0
|
| | | return
|
| | |
|
| | |
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | ActNum:%d,
|
| | | HightestSingleRecharge:%d,
|
| | | CanAwardValue:%d,
|
| | | AwardRecord:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.ActNum,
|
| | | self.HightestSingleRecharge,
|
| | | self.CanAwardValue,
|
| | | self.AwardRecord
|
| | | )
|
| | | return DumpString
|
| | |
| | | Def_PDict_SingleRechargeID = "SingleRechargeID_%s" # 玩家身上的活动ID,唯一标识,取活动开始日期time值,参数:(活动编号)
|
| | | Def_PDict_SingleRechargeTemplateID = "SingleRechargeTempID_%s" # 玩家身上的活动模板ID,参数:(活动编号)
|
| | | Def_PDict_SingleRechargeWorldLV = "SingleRechargeWorldLV_%s" #玩家身上的活动世界等级,参数:(活动编号)
|
| | | Def_PDict_SingleRechargeValue = "SingleRechargeValue_%s" # 单笔最高累充,参数:(活动编号)
|
| | | Def_PDict_SingleRechargeAward = "SingleRechargeAward_%s" # 领奖记录,参数:(活动编号)
|
| | | Def_PDict_SingleRechargeValue = "SingleRechargeValue_%s" # 领奖奖励值,按奖励索引二进制位代表是否可领奖,参数:(活动编号)
|
| | | Def_PDict_SingleRechargeAward = "SingleRechargeAward_%s" # 领奖记录值,按奖励索引二进制位代表是否已领奖,参数:(活动编号)
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | #开服活动,Def_PDictType_OpenServerCampaign
|
| | |
| | | EndtDate = "" #(char EndtDate[10])// 结束日期 y-m-d
|
| | | IsDayReset = 0 #(BYTE IsDayReset)//是否每天重置
|
| | | LimitLV = 0 #(WORD LimitLV)// 限制等级
|
| | | AwardRuleType = 0 #(BYTE AwardRuleType)// 领奖规则类型 0-向下兼容;1-匹配最高档;2-精确匹配对应档次
|
| | | AwardCount = 0 #(BYTE AwardCount)// 奖励档数
|
| | | AwardInfo = list() #(vector<tagMCActSingleRechargeAward> AwardInfo)// 奖励档信息
|
| | | data = None
|
| | |
| | | self.EndtDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
|
| | | self.IsDayReset,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.LimitLV,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | | self.AwardRuleType,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.AwardCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.AwardCount):
|
| | | temAwardInfo = tagMCActSingleRechargeAward()
|
| | |
| | | self.EndtDate = ""
|
| | | self.IsDayReset = 0
|
| | | self.LimitLV = 0
|
| | | self.AwardRuleType = 0
|
| | | self.AwardCount = 0
|
| | | self.AwardInfo = list()
|
| | | return
|
| | |
| | | length += 10
|
| | | length += 1
|
| | | length += 2
|
| | | length += 1
|
| | | length += 1
|
| | | for i in range(self.AwardCount):
|
| | | length += self.AwardInfo[i].GetLength()
|
| | |
| | | data = CommFunc.WriteString(data, 10, self.EndtDate)
|
| | | data = CommFunc.WriteBYTE(data, self.IsDayReset)
|
| | | data = CommFunc.WriteWORD(data, self.LimitLV)
|
| | | data = CommFunc.WriteBYTE(data, self.AwardRuleType)
|
| | | data = CommFunc.WriteBYTE(data, self.AwardCount)
|
| | | for i in range(self.AwardCount):
|
| | | data = CommFunc.WriteString(data, self.AwardInfo[i].GetLength(), self.AwardInfo[i].GetBuffer())
|
| | |
| | | EndtDate:%s,
|
| | | IsDayReset:%d,
|
| | | LimitLV:%d,
|
| | | AwardRuleType:%d,
|
| | | AwardCount:%d,
|
| | | AwardInfo:%s
|
| | | '''\
|
| | |
| | | self.EndtDate,
|
| | | self.IsDayReset,
|
| | | self.LimitLV,
|
| | | self.AwardRuleType,
|
| | | self.AwardCount,
|
| | | "..."
|
| | | )
|
| | |
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("ActNum", c_ubyte), #活动编号从1开始,目前支持两个累充活动同时存在且相互独立 1或2
|
| | | ("HightestSingleRecharge", c_int), # 最高单笔充值额度
|
| | | ("CanAwardValue", c_int), #可否领奖记录,按奖励索引二进制位存储是否可领取
|
| | | ("AwardRecord", c_int), #奖励领奖记录,按奖励索引二进制位存储是否已领取
|
| | | ]
|
| | |
|
| | |
| | | self.Cmd = 0xAA
|
| | | self.SubCmd = 0x51
|
| | | self.ActNum = 0
|
| | | self.HightestSingleRecharge = 0
|
| | | self.CanAwardValue = 0
|
| | | self.AwardRecord = 0
|
| | | return
|
| | |
|
| | |
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | ActNum:%d,
|
| | | HightestSingleRecharge:%d,
|
| | | CanAwardValue:%d,
|
| | | AwardRecord:%d
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.ActNum,
|
| | | self.HightestSingleRecharge,
|
| | | self.CanAwardValue,
|
| | | self.AwardRecord
|
| | | )
|
| | | return DumpString
|
| | |
| | | ("BYTE", "IsDayReset", 0),
|
| | | ("BYTE", "CTGTypeEffValue", 0),
|
| | | ("BYTE", "IsOfflineAct", 0),
|
| | | ("BYTE", "AwardRuleType", 0),
|
| | | ("list", "TemplateIDList", 0),
|
| | | ),
|
| | |
|
| | |
| | | self.IsDayReset = 0
|
| | | self.CTGTypeEffValue = 0
|
| | | self.IsOfflineAct = 0
|
| | | self.AwardRuleType = 0
|
| | | self.TemplateIDList = [] |
| | | return |
| | | |
| | |
| | | def GetIsDayReset(self): return self.IsDayReset # 是否每天重置
|
| | | def GetCTGTypeEffValue(self): return self.CTGTypeEffValue # 充值有效类型值
|
| | | def GetIsOfflineAct(self): return self.IsOfflineAct # 是否线下活动
|
| | | def GetAwardRuleType(self): return self.AwardRuleType # 领奖规则类型 0-向下兼容;1-匹配最高档;2-精确匹配对应档次
|
| | | def GetTemplateIDList(self): return self.TemplateIDList # 模板ID列表 |
| | | |
| | | # 单笔累充模板表 |
| | |
| | | if not playerTemplateID:
|
| | | return
|
| | |
|
| | | curRechargeValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SingleRechargeValue % actNum)
|
| | | if not curRechargeValue:
|
| | | canAwardValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SingleRechargeValue % actNum)
|
| | | if not canAwardValue:
|
| | | return
|
| | |
|
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataList("ActSingleRechargeAward", playerTemplateID)
|
| | |
| | | for ipyData in ipyDataList:
|
| | | awardIndex = ipyData.GetAwardIndex()
|
| | | if awardRecord & pow(2, awardIndex):
|
| | | #GameWorld.DebugLog("单笔累充已发放过奖励!awardIndex=%s" % awardIndex)
|
| | | continue
|
| | |
|
| | | singleValue = ipyData.GetSingleRechargeValue()
|
| | | if curRechargeValue < CommFunc.RMBToCoin(singleValue):
|
| | | if not canAwardValue & pow(2, awardIndex):
|
| | | #GameWorld.DebugLog("单笔累充不能领奖!awardIndex=%s" % awardIndex)
|
| | | continue
|
| | | awardRecord |= pow(2, awardIndex)
|
| | |
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def UpdSingleRechargeValue(curPlayer, updRechargeValue, coinType):
|
| | | if updRechargeValue <= 0:
|
| | | def UpdSingleRechargeValue(curPlayer, curRechargeValue, coinType):
|
| | | if curRechargeValue <= 0:
|
| | | return
|
| | |
|
| | | for actInfo in PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_SingleRecharge, {}).values():
|
| | |
| | | GameWorld.ErrLog("单笔累充充值活动数据异常!cfgID=%s,templateID=%s" % (cfgID, templateID), curPlayer.GetPlayerID())
|
| | | continue
|
| | |
|
| | | curRechargeValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SingleRechargeValue % actNum)
|
| | | if curRechargeValue >= updRechargeValue:
|
| | | GameWorld.DebugLog("单笔累充充值活动,未超过当前单笔累充额度,不更新! actNum=%s,curRechargeValue=%s >= updRechargeValue=%s" |
| | | % (actNum, curRechargeValue, updRechargeValue), curPlayer.GetPlayerID())
|
| | | awardIpyDataList = IpyGameDataPY.GetIpyGameDataList("ActSingleRechargeAward", templateID)
|
| | | if not awardIpyDataList:
|
| | | continue
|
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SingleRechargeValue % actNum, updRechargeValue)
|
| | | canAwardChange = False
|
| | | canAwardValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SingleRechargeValue % actNum)
|
| | | awardRuleType = ipyData.GetAwardRuleType()
|
| | | GameWorld.DebugLog("单笔累充充值活动,actNum=%s,awardRuleType=%s,canAwardValue=%s,curRechargeValue=%s" |
| | | % (actNum, awardRuleType, canAwardValue, 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))
|
| | | |
| | | # 匹配最高档次
|
| | | 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
|
| | | |
| | | # 精确匹配对应档次
|
| | | elif awardRuleType == 2:
|
| | | for awardIpyData in awardIpyDataList:
|
| | | awardIndex = awardIpyData.GetAwardIndex()
|
| | | singleValue = CommFunc.RMBToCoin(awardIpyData.GetSingleRechargeValue())
|
| | | if curRechargeValue != singleValue:
|
| | | #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))
|
| | | 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))
|
| | | break
|
| | | |
| | | else:
|
| | | continue
|
| | | |
| | | if not canAwardChange:
|
| | | continue
|
| | | |
| | | Sync_SingleRechargePlayerInfo(curPlayer, actNum)
|
| | | GameWorld.DebugLog("单笔累充充值活动更新单笔充值额度: actNum=%s,curRechargeValue=%s,updRechargeValue=%s" |
| | | % (actNum, curRechargeValue, updRechargeValue), curPlayer.GetPlayerID())
|
| | |
|
| | | # 线下活动,检查发放奖励
|
| | | if ipyData.GetIsOfflineAct():
|
| | |
| | | GameWorld.DebugLog("找不到该单笔累充活动档位索引奖励!actNum=%s,templateID=%s,awardIndex=%s" % (actNum, templateID, awardIndex), playerID)
|
| | | return
|
| | |
|
| | | singleValue = CommFunc.RMBToCoin(awardIpyData.GetSingleRechargeValue())
|
| | | curRechargeValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SingleRechargeValue % actNum)
|
| | | singleValue = awardIpyData.GetSingleRechargeValue()
|
| | | canAwardValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SingleRechargeValue % actNum)
|
| | |
|
| | | if curRechargeValue < singleValue:
|
| | | GameWorld.DebugLog("所需单笔充值额度不足,无法领取! templateID=%s,awardIndex=%s,singleValue=(%s) > curRechargeValue(%s)" |
| | | % (templateID, awardIndex, singleValue, curRechargeValue), playerID)
|
| | | if not canAwardValue & pow(2, awardIndex):
|
| | | GameWorld.DebugLog("该档次奖励无法领取! templateID=%s,awardIndex=%s,singleValue=%s,canAwardValue%s" |
| | | % (templateID, awardIndex, singleValue, canAwardValue), playerID)
|
| | | return
|
| | |
|
| | | actWorldLV = actInfo.get(ShareDefine.ActKey_WorldLV, 0)
|
| | |
| | |
|
| | | playerActInfo = ChPyNetSendPack.tagMCActSingleRechargePlayerInfo()
|
| | | playerActInfo.ActNum = actNum
|
| | | playerActInfo.HightestSingleRecharge = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SingleRechargeValue % actNum)
|
| | | playerActInfo.CanAwardValue = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SingleRechargeValue % actNum)
|
| | | playerActInfo.AwardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SingleRechargeAward % actNum)
|
| | | NetPackCommon.SendFakePack(curPlayer, playerActInfo)
|
| | | return
|
| | |
| | | clientPack.EndtDate = GameWorld.GetOperationActionDateStr(ipyData.GetEndDate(), openServerDay)
|
| | | clientPack.IsDayReset = ipyData.GetIsDayReset()
|
| | | clientPack.LimitLV = ipyData.GetLVLimit()
|
| | | clientPack.AwardRuleType = ipyData.GetAwardRuleType()
|
| | | clientPack.AwardInfo = []
|
| | |
|
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataList("ActSingleRechargeAward", templateID)
|