5819 【后端】【1.6】运营活动支持对应不同的职业和世界等级(充值返利、消费返利)
| | |
| | | DWORD _TemplateID; //模板ID
|
| | | DWORD NeedCostGold; //需要消费仙玉数
|
| | | BYTE AwardIndex; //返利奖励索引0~31,同个模板中不重复
|
| | | list AwardItemList; //返利物品信息列表 [(物品ID,个数,是否绑定),...]
|
| | | dict AwardItemList; //返利物品信息列表 {世界等级范围:[({职业:物品ID,..},个数,是否绑定), ...]}
|
| | | char NotifyKey; //全服广播key,默认两个参数(玩家名, 档位额度)
|
| | | };
|
| | |
|
| | |
| | | BYTE _ID; //活动条目ID
|
| | | DWORD TotalTimes; //可完成的总次数,0表示不限次数
|
| | | WORD SingleTimes; //单次领奖需要的次数
|
| | | list Reward; //奖励物品ID1
|
| | | dict Reward; //奖励物品ID1
|
| | | };
|
| | |
|
| | | //多倍修行点活动时间表
|
| | |
| | | #需要记录开启活动时的世界等级的运营活动
|
| | | NeedWorldLVOperationActNameList = [OperationActionName_FairyCeremony, OperationActionName_WishingWell,
|
| | | OperationActionName_NewFairyCeremony, OperationActionName_FlashSale,
|
| | | OperationActionName_BossReborn, ]
|
| | | OperationActionName_BossReborn, OperationActionName_TotalRecharge,
|
| | | OperationActionName_CostRebate, ]
|
| | |
|
| | | #活动信息字典key定义
|
| | | ActKey_ID = "ID" # 活动ID,唯一标识的ID,一般是活动开启的time值
|
| | |
| | | Def_PDict_CostRebateTemplateID = "CostRebateTemplateID" # 玩家身上的消费返利模板ID
|
| | | Def_PDict_CostRebateGold = "CostRebateGold" # 消费返利总累计消费仙玉
|
| | | Def_PDict_CostRebateAwardRecord = "CostRebateAwardRecord" # 消费返利领奖记录
|
| | | Def_PDict_CostRebateWorldLV = "CostRebateWorldLV" #消费返利活动开启时世界等级
|
| | |
|
| | | #累计充值活动
|
| | | Def_PDict_TotalRechargeID = "TotalRechargeID" # 玩家身上的累计充值活动ID,唯一标识,取活动开始日期time值
|
| | | Def_PDict_TotalRechargeTemplateID = "TotalRechargeTemplateID" # 玩家身上的累计充值模板ID
|
| | | Def_PDict_TotalRechargeGold = "TotalRechargeGold" # 消费返利总累计充值X元
|
| | | Def_PDict_TotalRechargeAwardRecord = "TotalRechargeAwardRecord" # 累计充值领奖记录
|
| | | Def_PDict_TotalRechargeWorldLV = "TotalRechargeWorldLV" #累计充值活动开启时世界等级
|
| | |
|
| | | #限时特惠活动
|
| | | Def_PDict_SpringSaleID = "SpringSaleID" # 玩家身上的限时特惠活动ID,唯一标识,取活动开始日期time
|
| | |
| | | Def_PDict_BossRebornTemplateID = "BossRebornTemplateID" # 玩家身上的BOSS复活模板ID
|
| | | Def_PDict_BRActionCurTimes = "BRActionCurTimes_%s" #当前完成次数 参数BOSS复活活动ID
|
| | | Def_PDict_BRActionGotTimes = "BRActionGotTimes_%s" #当前已领次数 参数BOSS复活活动ID
|
| | | Def_PDict_BRActionWorldLV = "BRActionWorldLV_%s" #BOSS复活活动开启时世界等级
|
| | | Def_PDict_BRActionWorldLV = "BRActionWorldLV" #BOSS复活活动开启时世界等级
|
| | |
|
| | | #仙界盛典
|
| | | Def_PDict_FairyCeremonyID = "FairyCeremonyID" # 玩家身上的仙界盛典活动ID,唯一标识,取活动开始日期time值
|
| | |
| | | ("DWORD", "TemplateID", 1),
|
| | | ("DWORD", "NeedCostGold", 0),
|
| | | ("BYTE", "AwardIndex", 0),
|
| | | ("list", "AwardItemList", 0),
|
| | | ("dict", "AwardItemList", 0),
|
| | | ("char", "NotifyKey", 0),
|
| | | ),
|
| | |
|
| | |
| | | ("BYTE", "ID", 1),
|
| | | ("DWORD", "TotalTimes", 0),
|
| | | ("WORD", "SingleTimes", 0),
|
| | | ("list", "Reward", 0),
|
| | | ("dict", "Reward", 0),
|
| | | ),
|
| | |
|
| | | "ActRealmPoint":(
|
| | |
| | | self.TemplateID = 0
|
| | | self.NeedCostGold = 0
|
| | | self.AwardIndex = 0
|
| | | self.AwardItemList = []
|
| | | self.AwardItemList = {}
|
| | | self.NotifyKey = "" |
| | | return |
| | | |
| | | def GetTemplateID(self): return self.TemplateID # 模板ID
|
| | | def GetNeedCostGold(self): return self.NeedCostGold # 需要消费仙玉数
|
| | | def GetAwardIndex(self): return self.AwardIndex # 返利奖励索引0~31,同个模板中不重复
|
| | | def GetAwardItemList(self): return self.AwardItemList # 返利物品信息列表 [(物品ID,个数,是否绑定),...]
|
| | | def GetAwardItemList(self): return self.AwardItemList # 返利物品信息列表 {世界等级范围:[({职业:物品ID,..},个数,是否绑定), ...]}
|
| | | def GetNotifyKey(self): return self.NotifyKey # 全服广播key,默认两个参数(玩家名, 档位额度) |
| | | |
| | | # BOSS复活活动时间表 |
| | |
| | | self.ID = 0
|
| | | self.TotalTimes = 0
|
| | | self.SingleTimes = 0
|
| | | self.Reward = [] |
| | | self.Reward = {} |
| | | return |
| | | |
| | | def GetTemplateID(self): return self.TemplateID # 模板ID
|
| | |
| | | if TotalRechargeID == playerTotalRechargeID:
|
| | | #GameWorld.DebugLog("累计充值活动ID不变,不处理!", curPlayer.GetPlayerID())
|
| | | return
|
| | | |
| | | actWorldLV = actTotalRechargeInfo.get(ShareDefine.ActKey_WorldLV, 0)
|
| | | playerWorldLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TotalRechargeWorldLV)
|
| | | templateID = GetTemplateID(actTotalRechargeInfo.get(ShareDefine.ActKey_CfgID, 0), actTotalRechargeInfo.get(ShareDefine.ActKey_DayIndex, 0))
|
| | | playerTemplateID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TotalRechargeTemplateID)
|
| | |
|
| | |
| | | % (TotalRechargeID, playerTotalRechargeID, state, templateID, playerTemplateID), playerID)
|
| | |
|
| | | # 未领取的奖励邮件发放
|
| | | __SendTotalRechargeMail(curPlayer, playerTemplateID)
|
| | | __SendTotalRechargeMail(curPlayer, playerTemplateID, playerWorldLV)
|
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TotalRechargeID, TotalRechargeID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TotalRechargeTemplateID, templateID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TotalRechargeWorldLV, actWorldLV)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TotalRechargeGold, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_TotalRechargeAwardRecord, 0)
|
| | |
|
| | |
| | | Sync_TotalRechargeInfo(curPlayer)
|
| | | return True
|
| | |
|
| | | def __SendTotalRechargeMail(curPlayer, playerTemplateID):
|
| | | def __SendTotalRechargeMail(curPlayer, playerTemplateID, playerWorldLV):
|
| | | # 未领取的奖励邮件发放
|
| | |
|
| | | if not playerTemplateID:
|
| | |
| | | continue
|
| | | awardRecord |= pow(2, awardIndex)
|
| | |
|
| | | awardItemList = ipyData.GetAwardItem().get(str(job), [])
|
| | | awardItemList = __GetItemList(ipyData.GetAwardItem(), job, playerWorldLV)
|
| | | batchPlayerIDList.append([playerID])
|
| | | batchAddItemList.append(awardItemList)
|
| | | batchParamList.append([needGold])
|
| | |
| | | PlayerControl.SendMailBatch("TotalRechargeMail", batchPlayerIDList, batchAddItemList, batchParamList)
|
| | |
|
| | | return
|
| | |
|
| | | def __GetItemList(itemDict, job, worldLV):
|
| | | #{世界等级范围:[(物品ID,个数,是否绑定), ...]},若物品ID要区分职业则配{世界等级范围:[({职业:物品ID,..},个数,是否绑定), ...]}
|
| | | itemList = []
|
| | | itemInfoList = GameWorld.GetDictValueByRangeKey(itemDict, worldLV, [])
|
| | | for itemInfo in itemInfoList:
|
| | | if type(itemInfo[0]) == dict:
|
| | | itemID = itemInfo[0].get(job)
|
| | | if not itemID:
|
| | | GameWorld.ErrLog('累计充值奖励未配置该职业itemDict=%s,job=%s'%(itemDict, job))
|
| | | continue
|
| | | else:
|
| | | itemID = itemInfo[0]
|
| | | itemList.append([itemID, itemInfo[1], itemInfo[2]])
|
| | | return itemList
|
| | |
|
| | | def AddTotalRechargeGold(curPlayer, addGold):
|
| | | if addGold <= 0:
|
| | |
| | | return
|
| | |
|
| | | needGold = awardIpyData.GetNeedGold()
|
| | | awardItemList = awardIpyData.GetAwardItem().get(str(curPlayer.GetJob()), [])
|
| | | actWorldLV = actTotalRechargeInfo.get(ShareDefine.ActKey_WorldLV, 0)
|
| | | awardItemList = __GetItemList(ipyData.GetAwardItem(), curPlayer.GetJob(), actWorldLV)
|
| | |
|
| | | curRechargeGold = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_TotalRechargeGold)
|
| | | if curRechargeGold < needGold:
|
| | |
| | | if costRebateID == playerCostRebateID:
|
| | | #GameWorld.DebugLog("消费返利活动ID不变,不处理!", curPlayer.GetPlayerID())
|
| | | return
|
| | | |
| | | actWorldLV = actCostRebateInfo.get(ShareDefine.ActKey_WorldLV, 0)
|
| | | playerWorldLV = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateWorldLV)
|
| | | templateID = GetTemplateID(actCostRebateInfo.get(ShareDefine.ActKey_CfgID, 0), actCostRebateInfo.get(ShareDefine.ActKey_DayIndex, 0))
|
| | | playerTemplateID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateTemplateID)
|
| | |
|
| | |
| | | % (costRebateID, playerCostRebateID, state, templateID, playerTemplateID), playerID)
|
| | |
|
| | | # 未领取的奖励邮件发放
|
| | | __SendCostRebateMail(curPlayer, playerTemplateID)
|
| | | __SendCostRebateMail(curPlayer, playerTemplateID, playerWorldLV)
|
| | |
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateID, costRebateID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateTemplateID, templateID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateWorldLV, actWorldLV)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateGold, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_CostRebateAwardRecord, 0)
|
| | |
|
| | |
| | | Sync_CostRebateInfo(curPlayer)
|
| | | return True
|
| | |
|
| | | def __SendCostRebateMail(curPlayer, playerTemplateID):
|
| | | def __SendCostRebateMail(curPlayer, playerTemplateID, playerWorldLV):
|
| | | # 未领取的奖励邮件发放
|
| | |
|
| | | if not playerTemplateID:
|
| | |
| | | ipyDataList = IpyGameDataPY.GetIpyGameDataList("CostRebateTemplate", playerTemplateID)
|
| | | if not ipyDataList:
|
| | | return
|
| | | |
| | | job = curPlayer.GetJob()
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | batchPlayerIDList, batchAddItemList, batchParamList = [], [], []
|
| | | awardRecord = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateAwardRecord)
|
| | |
| | | continue
|
| | | awardRecord |= pow(2, awardIndex)
|
| | |
|
| | | awardItemList = ipyData.GetAwardItemList()
|
| | | awardItemList = __GetItemList(ipyData.GetAwardItemList(), job, playerWorldLV)
|
| | | batchPlayerIDList.append([playerID])
|
| | | batchAddItemList.append(awardItemList)
|
| | | batchParamList.append([needCostGold])
|
| | |
| | | PlayerControl.SendMailBatch("ConsumptionRebateMail", batchPlayerIDList, batchAddItemList, batchParamList)
|
| | |
|
| | | return
|
| | |
|
| | |
|
| | | def __GetItemList(itemDict, job, worldLV):
|
| | | #{世界等级范围:[(物品ID,个数,是否绑定), ...]},若物品ID要区分职业则配{世界等级范围:[({职业:物品ID,..},个数,是否绑定), ...]}
|
| | | itemList = []
|
| | | itemInfoList = GameWorld.GetDictValueByRangeKey(itemDict, worldLV, [])
|
| | | for itemInfo in itemInfoList:
|
| | | if type(itemInfo[0]) == dict:
|
| | | itemID = itemInfo[0].get(job)
|
| | | if not itemID:
|
| | | GameWorld.ErrLog('累计充值奖励未配置该职业itemDict=%s,job=%s'%(itemDict, job))
|
| | | continue
|
| | | else:
|
| | | itemID = itemInfo[0]
|
| | | itemList.append([itemID, itemInfo[1], itemInfo[2]])
|
| | | return itemList
|
| | |
|
| | |
|
| | | def AddCostRebateGold(curPlayer, costType, costGold, infoDict):
|
| | | if costGold <= 0:
|
| | |
| | | return
|
| | |
|
| | | needCostGold = awardIpyData.GetNeedCostGold()
|
| | | awardItemList = awardIpyData.GetAwardItemList()
|
| | | actWorldLV = actCostRebateInfo.get(ShareDefine.ActKey_WorldLV, 0)
|
| | | awardItemList = __GetItemList(awardIpyData.GetAwardItemList(), curPlayer.GetJob(), actWorldLV)
|
| | |
|
| | | curCostGold = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_CostRebateGold)
|
| | | if curCostGold < needCostGold:
|
| | |
| | | #需要记录开启活动时的世界等级的运营活动
|
| | | NeedWorldLVOperationActNameList = [OperationActionName_FairyCeremony, OperationActionName_WishingWell,
|
| | | OperationActionName_NewFairyCeremony, OperationActionName_FlashSale,
|
| | | OperationActionName_BossReborn, ]
|
| | | OperationActionName_BossReborn, OperationActionName_TotalRecharge,
|
| | | OperationActionName_CostRebate, ]
|
| | |
|
| | | #活动信息字典key定义
|
| | | ActKey_ID = "ID" # 活动ID,唯一标识的ID,一般是活动开启的time值
|