8650 【主干】【BT2】活动规则优化(限时特惠支持多活动编号同时开启);
# Conflicts:
# ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerEventCounter.py
| | |
| | | struct tagActSpringSale
|
| | | {
|
| | | DWORD _CfgID; //配置ID
|
| | | char ActMark; //活动组标记
|
| | | list PlatformList; //活动平台列表["平台A", "平台A", ...],配[]代表所有
|
| | | list ServerGroupIDList; //服务器ID列表
|
| | | BYTE ActNum; //活动分组编号, 活动类型 * 10 + 不同界面编号
|
| | | char StartDate; //开启日期
|
| | | char EndDate; //结束日期
|
| | | list StartTimeList; //开启时间列表, 支持多个时段
|
| | |
| | |
|
| | | class tagMCSpringSaleInfo(Structure):
|
| | | Head = tagHead()
|
| | | ActNum = 0 #(BYTE ActNum)//活动编号
|
| | | StartDate = "" #(char StartDate[10])// 开始日期 y-m-d
|
| | | EndtDate = "" #(char EndtDate[10])// 结束日期 y-m-d
|
| | | AdvanceMinutes = 0 #(WORD AdvanceMinutes)// 提前显示分钟
|
| | |
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.ActNum,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.StartDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
|
| | | self.EndtDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
|
| | | self.AdvanceMinutes,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | |
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xAA
|
| | | self.Head.SubCmd = 0x11
|
| | | self.ActNum = 0
|
| | | self.StartDate = ""
|
| | | self.EndtDate = ""
|
| | | self.AdvanceMinutes = 0
|
| | |
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | length += 10
|
| | | length += 10
|
| | | length += 2
|
| | |
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.ActNum)
|
| | | data = CommFunc.WriteString(data, 10, self.StartDate)
|
| | | data = CommFunc.WriteString(data, 10, self.EndtDate)
|
| | | data = CommFunc.WriteWORD(data, self.AdvanceMinutes)
|
| | |
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | ActNum:%d,
|
| | | StartDate:%s,
|
| | | EndtDate:%s,
|
| | | AdvanceMinutes:%d,
|
| | |
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.ActNum,
|
| | | self.StartDate,
|
| | | self.EndtDate,
|
| | | self.AdvanceMinutes,
|
| | |
| | |
|
| | | "ActSpringSale":(
|
| | | ("DWORD", "CfgID", 1),
|
| | | ("char", "ActMark", 0),
|
| | | ("list", "PlatformList", 0),
|
| | | ("list", "ServerGroupIDList", 0),
|
| | | ("BYTE", "ActNum", 0),
|
| | | ("char", "StartDate", 0),
|
| | | ("char", "EndDate", 0),
|
| | | ("list", "StartTimeList", 0),
|
| | |
| | | |
| | | def __init__(self): |
| | | self.CfgID = 0
|
| | | self.ActMark = ""
|
| | | self.PlatformList = []
|
| | | self.ServerGroupIDList = []
|
| | | self.ActNum = 0
|
| | | self.StartDate = ""
|
| | | self.EndDate = ""
|
| | | self.StartTimeList = []
|
| | |
| | | return |
| | | |
| | | def GetCfgID(self): return self.CfgID # 配置ID
|
| | | def GetActMark(self): return self.ActMark # 活动组标记
|
| | | def GetPlatformList(self): return self.PlatformList # 活动平台列表["平台A", "平台A", ...],配[]代表所有
|
| | | def GetServerGroupIDList(self): return self.ServerGroupIDList # 服务器ID列表
|
| | | def GetActNum(self): return self.ActNum # 活动分组编号, 活动类型 * 10 + 不同界面编号
|
| | | def GetStartDate(self): return self.StartDate # 开启日期
|
| | | def GetEndDate(self): return self.EndDate # 结束日期
|
| | | def GetStartTimeList(self): return self.StartTimeList # 开启时间列表, 支持多个时段
|
| | |
| | | #支持多活动分组编号的活动名
|
| | | MultiActNumOperationActNameList = [OperationActionName_TotalRecharge, OperationActionName_CollectWords,
|
| | | OperationActionName_FlashGiftbag, OperationActionName_CostRebate,
|
| | | OperationActionName_SpringSale,
|
| | | ]
|
| | |
|
| | | #跨服运营活动表名定义
|
| | |
| | | Def_PDict_GrowupBuyState = "GrowupBuyState" # 当前可购买的活动充值ID索引状态,按组索引位存储对应组可购买的充值ID所对应的索引
|
| | |
|
| | | #限时特惠活动
|
| | | Def_PDict_SpringSaleID = "SpringSaleID" # 玩家身上的限时特惠活动ID,唯一标识,取活动开始日期time
|
| | | Def_PDict_SpringSaleMailState = "SpringSaleMailState" # 玩家身上的活动更新提醒邮件状态
|
| | | Def_PDict_SpringSaleID = "SpringSaleID_%s" # 玩家身上的限时特惠活动ID,唯一标识,取活动开始日期time,参数(活动编号)
|
| | | Def_PDict_SpringSaleMailState = "SpringSaleMailState_%s" # 玩家身上的活动更新提醒邮件状态,参数(活动编号)
|
| | |
|
| | | #限时礼包活动
|
| | | Def_PDict_FlashGiftbagID = "FlashGiftbagID_%s" # 玩家身上的限时礼包活动ID,唯一标识,取活动开始日期time,参数(活动编号)
|
| | |
| | |
|
| | | class tagMCSpringSaleInfo(Structure):
|
| | | Head = tagHead()
|
| | | ActNum = 0 #(BYTE ActNum)//活动编号
|
| | | StartDate = "" #(char StartDate[10])// 开始日期 y-m-d
|
| | | EndtDate = "" #(char EndtDate[10])// 结束日期 y-m-d
|
| | | AdvanceMinutes = 0 #(WORD AdvanceMinutes)// 提前显示分钟
|
| | |
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.ActNum,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.StartDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
|
| | | self.EndtDate,_pos = CommFunc.ReadString(_lpData, _pos,10)
|
| | | self.AdvanceMinutes,_pos = CommFunc.ReadWORD(_lpData, _pos)
|
| | |
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xAA
|
| | | self.Head.SubCmd = 0x11
|
| | | self.ActNum = 0
|
| | | self.StartDate = ""
|
| | | self.EndtDate = ""
|
| | | self.AdvanceMinutes = 0
|
| | |
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | length += 10
|
| | | length += 10
|
| | | length += 2
|
| | |
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.ActNum)
|
| | | data = CommFunc.WriteString(data, 10, self.StartDate)
|
| | | data = CommFunc.WriteString(data, 10, self.EndtDate)
|
| | | data = CommFunc.WriteWORD(data, self.AdvanceMinutes)
|
| | |
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | ActNum:%d,
|
| | | StartDate:%s,
|
| | | EndtDate:%s,
|
| | | AdvanceMinutes:%d,
|
| | |
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.ActNum,
|
| | | self.StartDate,
|
| | | self.EndtDate,
|
| | | self.AdvanceMinutes,
|
| | |
| | | shopType = ipyData.GetShopType()
|
| | | operationActionShopType = ipyData.GetOperationActionShop()
|
| | | if operationActionShopType == 1:
|
| | | actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_SpringSale, {})
|
| | | state = actInfo.get(ShareDefine.ActKey_State, 0)
|
| | | 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), actInfo.get(ShareDefine.ActKey_WorldLV, 0))
|
| | | if not shopTypeList:
|
| | | return
|
| | | actShopType = shopTypeList[-1] if state > len(shopTypeList) else shopTypeList[state - 1]
|
| | | if shopType != actShopType:
|
| | | GameWorld.DebugLog("限时特惠非活动中的商店类型!state=%s,shopType=%s,actShopType=%s,shopTypeList=%s" |
| | | % (state, shopType, actShopType, shopTypeList), curPlayer.GetPlayerID())
|
| | | if not PlayerSpringSale.IsSpringSaleShopType(shopType):
|
| | | return
|
| | | elif operationActionShopType == 2:
|
| | | actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_FlashSale, {})
|
| | |
| | | return todayShopType
|
| | |
|
| | | def OnPlayerLogin(curPlayer):
|
| | | __CheckPlayerSpringSaleAction(curPlayer)
|
| | | |
| | | for actInfo in PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_SpringSale, {}).values():
|
| | | actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0)
|
| | | __CheckPlayerSpringSaleAction(curPlayer, actNum)
|
| | | |
| | | return
|
| | |
|
| | | def RefreshSpringSaleActionInfo():
|
| | | def RefreshSpringSaleActionInfo(actNum):
|
| | | ## 收到GameServer同步的活动信息,刷新活动信息
|
| | | playerManager = GameWorld.GetPlayerManager()
|
| | | for index in xrange(playerManager.GetPlayerCount()):
|
| | | curPlayer = playerManager.GetPlayerByIndex(index)
|
| | | if curPlayer.GetID() == 0:
|
| | | continue
|
| | | __CheckPlayerSpringSaleAction(curPlayer)
|
| | | __CheckPlayerSpringSaleAction(curPlayer, actNum)
|
| | | return
|
| | |
|
| | | def __CheckPlayerSpringSaleAction(curPlayer):
|
| | | def __CheckPlayerSpringSaleAction(curPlayer, actNum):
|
| | | ## 检查玩家限时特惠活动数据信息
|
| | |
|
| | | playerID = curPlayer.GetPlayerID()
|
| | |
|
| | | actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_SpringSale, {})
|
| | | actInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_SpringSale, actNum)
|
| | | 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
|
| | | playerActID = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SpringSaleID % actNum) # 玩家身上的活动ID
|
| | | isReset = False
|
| | | if actID != playerActID:
|
| | | isReset = True
|
| | | 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)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SpringSaleID % actNum, actID)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SpringSaleMailState % actNum, 0)
|
| | | #Sync_SpringSaleActionInfo(curPlayer)
|
| | | GameWorld.DebugLog("限时特惠重置! actID=%s,playerActID=%s,state=%s,shopTypeList=%s" % (actID, playerActID, state, shopTypeList), playerID)
|
| | | GameWorld.DebugLog("限时特惠重置! actNum=%s,actID=%s,playerActID=%s,state=%s,shopTypeList=%s" % (actNum, actID, playerActID, state, shopTypeList), playerID)
|
| | | else:
|
| | | GameWorld.DebugLog("限时特惠活动ID不变,不处理!", playerID)
|
| | | GameWorld.DebugLog("限时特惠活动ID不变,不处理!actNum=%s,actID=%s" % (actNum, actID), playerID)
|
| | |
|
| | | playerMailState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SpringSaleMailState) # 玩家身上的活动提醒邮件状态
|
| | | playerMailState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_SpringSaleMailState % actNum) # 玩家身上的活动提醒邮件状态
|
| | | if actID and state and state != playerMailState:
|
| | | springSaleIpyData = IpyGameDataPY.GetIpyGameData("ActSpringSale", cfgID)
|
| | | if springSaleIpyData and springSaleIpyData.GetMailKey() and curPlayer.GetLV() >= springSaleIpyData.GetLVLimit():
|
| | | PlayerControl.SendMailByKey(springSaleIpyData.GetMailKey(), [playerID], springSaleIpyData.GetMailItemPrize())
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SpringSaleMailState, state)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_SpringSaleMailState % actNum, state)
|
| | | GameWorld.DebugLog(" 发送新限时特惠邮件提醒! state=%s,playerMailState=%s" % (state, playerMailState), playerID)
|
| | |
|
| | | if cfgID:
|
| | | Sync_SpringSaleActionInfo(curPlayer)
|
| | | Sync_SpringSaleActionInfo(curPlayer, actNum)
|
| | | return isReset
|
| | |
|
| | | def Sync_SpringSaleActionInfo(curPlayer):
|
| | | def IsSpringSaleShopType(shopType):
|
| | | ## 判断是否活动中的商店
|
| | | for actInfo in PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_SpringSale, {}).values():
|
| | | actNum = actInfo.get(ShareDefine.ActKey_ActNum, 0)
|
| | | |
| | | state = actInfo.get(ShareDefine.ActKey_State, 0)
|
| | | if not state:
|
| | | continue
|
| | | shopTypeList = GetShopTypeList(actInfo.get(ShareDefine.ActKey_CfgID, 0), actInfo.get(ShareDefine.ActKey_DayIndex, 0), actInfo.get(ShareDefine.ActKey_WorldLV, 0))
|
| | | if not shopTypeList:
|
| | | continue
|
| | | actShopType = shopTypeList[-1] if state > len(shopTypeList) else shopTypeList[state - 1]
|
| | | if shopType == actShopType:
|
| | | GameWorld.DebugLog("限时特惠活动中的商店类型: actNum=%s,shopType=%s" % (actNum, shopType))
|
| | | return True
|
| | | |
| | | GameWorld.DebugLog("限时特惠非活动中或非活动中的商店类型!shopType=%s" % (shopType))
|
| | | return False
|
| | |
|
| | | def Sync_SpringSaleActionInfo(curPlayer, actNum):
|
| | | ## 通知限时特惠活动信息
|
| | | actInfo = PyGameData.g_operationActionDict.get(ShareDefine.OperationActionName_SpringSale, {})
|
| | | actInfo = GameWorld.GetActInfo(ShareDefine.OperationActionName_SpringSale, actNum)
|
| | | if not actInfo:
|
| | | return
|
| | |
|
| | |
| | | job = curPlayer.GetJob()
|
| | | openServerDay = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_ServerDay) + 1
|
| | | packInfo = ChPyNetSendPack.tagMCSpringSaleInfo()
|
| | | packInfo.ActNum = actNum
|
| | | packInfo.StartDate = GameWorld.GetOperationActionDateStr(springSaleIpyData.GetStartDate(), openServerDay)
|
| | | packInfo.EndtDate = GameWorld.GetOperationActionDateStr(springSaleIpyData.GetEndDate(), openServerDay)
|
| | | packInfo.AdvanceMinutes = springSaleIpyData.GetAdvanceMinutes()
|
| | |
| | | #支持多活动分组编号的活动名
|
| | | MultiActNumOperationActNameList = [OperationActionName_TotalRecharge, OperationActionName_CollectWords,
|
| | | OperationActionName_FlashGiftbag, OperationActionName_CostRebate,
|
| | | OperationActionName_SpringSale,
|
| | | ]
|
| | |
|
| | | #跨服运营活动表名定义
|