5819 【后端】【1.6】运营活动支持对应不同的职业和世界等级(限时礼包、限时特惠)
| | |
| | | WORD AdvanceMinutes; //前端提前X分钟展示活动
|
| | | WORD LVLimit; //限制等级
|
| | | BYTE IsDayReset; //是否每天重置
|
| | | list ShopTypeList; //商店类型列表
|
| | | dict ShopTypeList; //商店类型列表
|
| | | char MailKey; //活动更新时发送邮件key
|
| | | list MailItemPrize; //活动更新时发送邮件奖励物品
|
| | | };
|
| | |
| | | WORD AdvanceMinutes; //前端提前X分钟展示活动
|
| | | WORD LVLimit; //限制等级
|
| | | BYTE IsDayReset; //是否每天重置
|
| | | list GiftbagTypeList; //礼包类型列表
|
| | | dict GiftbagTypeList; //礼包类型列表
|
| | | char MailKey; //活动更新时发送邮件key
|
| | | list MailItemPrize; //活动更新时发送邮件奖励物品
|
| | | };
|
| | |
| | | NeedWorldLVOperationActNameList = [OperationActionName_FairyCeremony, OperationActionName_WishingWell,
|
| | | OperationActionName_NewFairyCeremony, OperationActionName_FlashSale,
|
| | | OperationActionName_BossReborn, OperationActionName_TotalRecharge,
|
| | | OperationActionName_CostRebate, ]
|
| | | OperationActionName_CostRebate, OperationActionName_FlashGiftbag,
|
| | | OperationActionName_SpringSale,]
|
| | |
|
| | | #活动信息字典key定义
|
| | | ActKey_ID = "ID" # 活动ID,唯一标识的ID,一般是活动开启的time值
|
| | |
| | | if not state:
|
| | | GameWorld.DebugLog("限时特惠非活动中!state=%s" % (state), curPlayer.GetPlayerID())
|
| | | return
|
| | | shopTypeList = PlayerSpringSale.GetShopTypeList(actInfo.get(ShareDefine.ActKey_CfgID, 0), actInfo.get(ShareDefine.ActKey_DayIndex, 0))
|
| | | shopTypeList = PlayerSpringSale.GetShopTypeList(actInfo.get(ShareDefine.ActKey_CfgID, 0), actInfo.get(ShareDefine.ActKey_DayIndex, 0), actInfo.get(ShareDefine.ActKey_WorldLV, 0))
|
| | | if not shopTypeList:
|
| | | return
|
| | | actShopType = shopTypeList[-1] if state > len(shopTypeList) else shopTypeList[state - 1]
|
| | |
| | | ("WORD", "AdvanceMinutes", 0),
|
| | | ("WORD", "LVLimit", 0),
|
| | | ("BYTE", "IsDayReset", 0),
|
| | | ("list", "ShopTypeList", 0),
|
| | | ("dict", "ShopTypeList", 0),
|
| | | ("char", "MailKey", 0),
|
| | | ("list", "MailItemPrize", 0),
|
| | | ),
|
| | |
| | | ("WORD", "AdvanceMinutes", 0),
|
| | | ("WORD", "LVLimit", 0),
|
| | | ("BYTE", "IsDayReset", 0),
|
| | | ("list", "GiftbagTypeList", 0),
|
| | | ("dict", "GiftbagTypeList", 0),
|
| | | ("char", "MailKey", 0),
|
| | | ("list", "MailItemPrize", 0),
|
| | | ),
|
| | |
| | | self.AdvanceMinutes = 0
|
| | | self.LVLimit = 0
|
| | | self.IsDayReset = 0
|
| | | self.ShopTypeList = []
|
| | | self.ShopTypeList = {}
|
| | | self.MailKey = ""
|
| | | self.MailItemPrize = [] |
| | | return |
| | |
| | | self.AdvanceMinutes = 0
|
| | | self.LVLimit = 0
|
| | | self.IsDayReset = 0
|
| | | self.GiftbagTypeList = []
|
| | | self.GiftbagTypeList = {}
|
| | | self.MailKey = ""
|
| | | self.MailItemPrize = [] |
| | | return |
| | |
| | | import ChConfig
|
| | |
|
| | |
|
| | | def GetGiftbagTypeList(cfgID, dayIndex):
|
| | | def GetGiftbagTypeList(cfgID, dayIndex, woldLV):
|
| | | if cfgID == None or dayIndex == None:
|
| | | return []
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("ActFlashGiftbag", cfgID)
|
| | | if not ipyData:
|
| | | return []
|
| | | giftbagTypeList = ipyData.GetGiftbagTypeList()
|
| | | giftbagTypeList = GameWorld.GetDictValueByRangeKey(ipyData.GetGiftbagTypeList(), woldLV, [])
|
| | | todayGiftbag = giftbagTypeList[-1] if dayIndex >= len(giftbagTypeList) else giftbagTypeList[dayIndex]
|
| | | return todayGiftbag
|
| | |
|
| | |
| | | cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
|
| | |
|
| | | playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashGiftbagID) # 玩家身上的活动ID
|
| | | giftbagTypeList = [] if not cfgID else GetGiftbagTypeList(cfgID, actInfo.get(ShareDefine.ActKey_DayIndex, 0))
|
| | | giftbagTypeList = [] if not cfgID else GetGiftbagTypeList(cfgID, actInfo.get(ShareDefine.ActKey_DayIndex, 0), actInfo.get(ShareDefine.ActKey_WorldLV, 0))
|
| | | isReset = False
|
| | | if actID != playerActID:
|
| | | isReset = True
|
| | |
| | | DataRecordPack.DR_CTGError(curPlayer, "FlashGiftbag state is 0!", addDRDict)
|
| | | return
|
| | |
|
| | | giftbagTypeList = GetGiftbagTypeList(actInfo.get(ShareDefine.ActKey_CfgID, 0), actInfo.get(ShareDefine.ActKey_DayIndex, 0))
|
| | | giftbagTypeList = GetGiftbagTypeList(actInfo.get(ShareDefine.ActKey_CfgID, 0), actInfo.get(ShareDefine.ActKey_DayIndex, 0), actInfo.get(ShareDefine.ActKey_WorldLV, 0))
|
| | | if not giftbagTypeList:
|
| | | DataRecordPack.DR_CTGError(curPlayer, "FlashGiftbag GiftbagTypeList is null!", addDRDict)
|
| | | return
|
| | |
| | | return
|
| | |
|
| | | giftbagID = giftbagIpyData.GetGiftbagID()
|
| | | giftItemList = giftbagIpyData.GetGiftItemList()
|
| | | giftItemList = __GetJobItemList(giftbagIpyData.GetGiftItemList(), curPlayer.GetJob()) |
| | | addDRDict.update({"giftbagID":giftbagID, "giftItemList":giftItemList})
|
| | | buyCountLimit = giftbagIpyData.GetBuyCountLimit()
|
| | | buyCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_FlashGiftbagBuyCount % giftbagID)
|
| | |
| | | SyncFlashGiftbagBuyCount(curPlayer, [giftbagID])
|
| | | PlayerWeekParty.AddWeekPartyActionCnt(curPlayer, ChConfig.Def_WPAct_GiftBag, actGiftbagType, False)
|
| | | return True
|
| | |
|
| | | def __GetJobItemList(itemList, job):
|
| | | jobItemList = []
|
| | | for itemID, itemCnt, isBind in itemList:
|
| | | if type(itemID) == int:
|
| | | jobItemList.append([itemID, itemCnt, isBind])
|
| | | elif job in itemID:
|
| | | jobItemList.append([itemID[job], itemCnt, isBind])
|
| | | return jobItemList
|
| | |
|
| | | def SyncFlashGiftbagBuyCount(curPlayer, syncIDList=[], giftbagTypeList=[]):
|
| | | ## 通知限时礼包玩家活动信息
|
| | |
| | | cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
|
| | | if not cfgID:
|
| | | return
|
| | | giftbagTypeList = GetGiftbagTypeList(cfgID, actInfo.get(ShareDefine.ActKey_DayIndex, 0))
|
| | | giftbagTypeList = GetGiftbagTypeList(cfgID, actInfo.get(ShareDefine.ActKey_DayIndex, 0), actInfo.get(ShareDefine.ActKey_WorldLV, 0))
|
| | |
|
| | | if not giftbagTypeList:
|
| | | return
|
| | |
| | | giftBag.RMB = 0 if not orderIpyData else int(orderIpyData.GetPayRMBNum())
|
| | | giftBag.RMBOriginal = giftIpyData.GetOriginalRMB()
|
| | | giftBag.ItemInfo = []
|
| | | for itemID, itemCount, isBind in giftIpyData.GetGiftItemList():
|
| | | for itemID, itemCount, isBind in __GetJobItemList(orderIpyData.GetGiftItemList(), curPlayer.GetJob()):
|
| | | item = ChPyNetSendPack.tagMCFlashGiftbagItem()
|
| | | item.ItemID = itemID
|
| | | item.ItemCount = itemCount
|
| | |
| | | import GameWorld
|
| | | import ChConfig
|
| | |
|
| | | def GetShopTypeList(cfgID, dayIndex):
|
| | | def GetShopTypeList(cfgID, dayIndex, woldLV):
|
| | | if cfgID == None or dayIndex == None:
|
| | | return []
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("ActSpringSale", cfgID)
|
| | | if not ipyData:
|
| | | return []
|
| | | shopTypeList = ipyData.GetShopTypeList()
|
| | | shopTypeList = GameWorld.GetDictValueByRangeKey(ipyData.GetShopTypeList(), woldLV, [])
|
| | | todayShopType = shopTypeList[-1] if dayIndex >= len(shopTypeList) else shopTypeList[dayIndex]
|
| | | return todayShopType
|
| | |
|
| | |
| | | actID = actInfo.get(ShareDefine.ActKey_ID, 0)
|
| | | state = actInfo.get(ShareDefine.ActKey_State, 0)
|
| | | cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
|
| | | |
| | | woldLV = actInfo.get(ShareDefine.ActKey_WorldLV, 0)
|
| | | playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SpringSaleID) # 玩家身上的活动ID
|
| | | isReset = False
|
| | | if actID != playerActID:
|
| | | isReset = True
|
| | | shopTypeList = GetShopTypeList(cfgID, actInfo.get(ShareDefine.ActKey_DayIndex, 0))
|
| | | shopTypeList = GetShopTypeList(cfgID, actInfo.get(ShareDefine.ActKey_DayIndex, 0), woldLV)
|
| | | FunctionNPCCommon.ResetShopItemBuyCountByShopType(curPlayer, shopTypeList)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SpringSaleID, actID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SpringSaleMailState, 0)
|
| | |
| | | cfgID = actInfo.get(ShareDefine.ActKey_CfgID, 0)
|
| | | if not cfgID:
|
| | | return
|
| | | shopTypeList = GetShopTypeList(cfgID, actInfo.get(ShareDefine.ActKey_DayIndex, 0))
|
| | | shopTypeList = GetShopTypeList(cfgID, actInfo.get(ShareDefine.ActKey_DayIndex, 0), actInfo.get(ShareDefine.ActKey_WorldLV, 0))
|
| | | if not shopTypeList:
|
| | | return
|
| | |
|
| | |
| | | if len(startTimeList) != len(endTimeList):
|
| | | GameWorld.ErrLog("限时特惠开关时间时分配置错误!cfgID=%s" % cfgID)
|
| | | return
|
| | | |
| | | job = curPlayer.GetJob()
|
| | | openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
|
| | | packInfo = ChPyNetSendPack.tagMCSpringSaleInfo()
|
| | | packInfo.StartDate = GameWorld.GetOperationActionDateStr(springSaleIpyData.GetStartDate(), openServerDay)
|
| | |
| | | giftBag.ItemInfo = []
|
| | | itemList = [[itemIpyData.GetItemID(), itemIpyData.GetItemCnt(), itemIpyData.GetIsBind()]]
|
| | | itemList += itemIpyData.GetItemListEx()
|
| | | jobItemList = itemIpyData.GetJobItem()
|
| | | for itemID, itemCount, isBind in itemList:
|
| | | item = ChPyNetSendPack.tagMCSpringSaleItem()
|
| | | item.ItemID = itemID
|
| | | jobItemID = FunctionNPCCommon.GetShopJobItem(job, itemID, jobItemList)
|
| | | item.ItemID = jobItemID
|
| | | item.ItemCount = itemCount
|
| | | item.IsBind = isBind
|
| | | item.IsMainItem = int(itemID == itemIpyData.GetMainItemID())
|
| | | item.IsMainItem = int(itemID == FunctionNPCCommon.GetShopJobItem(job, itemIpyData.GetMainItemID(), jobItemList))
|
| | | giftBag.ItemInfo.append(item)
|
| | | giftBag.GiftItemCount = len(giftBag.ItemInfo)
|
| | | shop.GiftbagInfo.append(giftBag)
|
| | |
| | | NeedWorldLVOperationActNameList = [OperationActionName_FairyCeremony, OperationActionName_WishingWell,
|
| | | OperationActionName_NewFairyCeremony, OperationActionName_FlashSale,
|
| | | OperationActionName_BossReborn, OperationActionName_TotalRecharge,
|
| | | OperationActionName_CostRebate, ]
|
| | | OperationActionName_CostRebate, OperationActionName_FlashGiftbag,
|
| | | OperationActionName_SpringSale,]
|
| | |
|
| | | #活动信息字典key定义
|
| | | ActKey_ID = "ID" # 活动ID,唯一标识的ID,一般是活动开启的time值
|