8796 【主干】【gt_1.101.1】【后端】Part1 2、每日在线送符印寻宝20次(创角7日在线改为使用新表及新封包B113通知);
| | |
| | | dict Reward; //奖励 {"职业":[[物品ID,个数],...], ...}
|
| | | };
|
| | |
|
| | | //七天在线奖励表
|
| | | //七天在线奖励表新
|
| | |
|
| | | struct tagOnlineAward
|
| | | struct tagOnlineAwardNew
|
| | | {
|
| | | BYTE _DayID; //天数
|
| | | list StageTime; //阶段所需时间(分钟)
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B1 13 在线奖励信息新 #tagMCOnlinePrizeNew
|
| | |
|
| | | class tagMCOnlinePrizeNew(Structure):
|
| | | Head = tagHead()
|
| | | OnlineTime = 0 #(DWORD OnlineTime)//在线时间毫秒
|
| | | Len = 0 #(BYTE Len)
|
| | | PrizeInfo = list() #(vector<DWORD> PrizeInfo)//领奖记录
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xB1
|
| | | self.Head.SubCmd = 0x13
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.OnlineTime,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.Len,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.Len):
|
| | | value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
|
| | | self.PrizeInfo.append(value)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xB1
|
| | | self.Head.SubCmd = 0x13
|
| | | self.OnlineTime = 0
|
| | | self.Len = 0
|
| | | self.PrizeInfo = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 4
|
| | | length += 1
|
| | | length += 4 * self.Len
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteDWORD(data, self.OnlineTime)
|
| | | data = CommFunc.WriteBYTE(data, self.Len)
|
| | | for i in range(self.Len):
|
| | | data = CommFunc.WriteDWORD(data, self.PrizeInfo[i])
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | OnlineTime:%d,
|
| | | Len:%d,
|
| | | PrizeInfo:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.OnlineTime,
|
| | | self.Len,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCOnlinePrizeNew=tagMCOnlinePrizeNew()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCOnlinePrizeNew.Head.Cmd,m_NAtagMCOnlinePrizeNew.Head.SubCmd))] = m_NAtagMCOnlinePrizeNew
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B1 03 通知玩家死亡时间 #tagMCPlayerDeadTime
|
| | |
|
| | | class tagMCPlayerDeadTime(Structure):
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B1 13 在线奖励信息新 #tagMCOnlinePrizeNew
|
| | |
|
| | | class tagMCOnlinePrizeNew(Structure):
|
| | | Head = tagHead()
|
| | | OnlineTime = 0 #(DWORD OnlineTime)//在线时间毫秒
|
| | | Len = 0 #(BYTE Len)
|
| | | PrizeInfo = list() #(vector<DWORD> PrizeInfo)//领奖记录
|
| | | data = None
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Head.Cmd = 0xB1
|
| | | self.Head.SubCmd = 0x13
|
| | | return
|
| | |
|
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.OnlineTime,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.Len,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | for i in range(self.Len):
|
| | | value,_pos=CommFunc.ReadDWORD(_lpData,_pos)
|
| | | self.PrizeInfo.append(value)
|
| | | return _pos
|
| | |
|
| | | def Clear(self):
|
| | | self.Head = tagHead()
|
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xB1
|
| | | self.Head.SubCmd = 0x13
|
| | | self.OnlineTime = 0
|
| | | self.Len = 0
|
| | | self.PrizeInfo = list()
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 4
|
| | | length += 1
|
| | | length += 4 * self.Len
|
| | |
|
| | | return length
|
| | |
|
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteDWORD(data, self.OnlineTime)
|
| | | data = CommFunc.WriteBYTE(data, self.Len)
|
| | | for i in range(self.Len):
|
| | | data = CommFunc.WriteDWORD(data, self.PrizeInfo[i])
|
| | | return data
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | OnlineTime:%d,
|
| | | Len:%d,
|
| | | PrizeInfo:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.OnlineTime,
|
| | | self.Len,
|
| | | "..."
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagMCOnlinePrizeNew=tagMCOnlinePrizeNew()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagMCOnlinePrizeNew.Head.Cmd,m_NAtagMCOnlinePrizeNew.Head.SubCmd))] = m_NAtagMCOnlinePrizeNew
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B1 03 通知玩家死亡时间 #tagMCPlayerDeadTime
|
| | |
|
| | | class tagMCPlayerDeadTime(Structure):
|
| | |
| | | ("dict", "Reward", 0),
|
| | | ),
|
| | |
|
| | | "OnlineAward":(
|
| | | "OnlineAwardNew":(
|
| | | ("BYTE", "DayID", 1),
|
| | | ("list", "StageTime", 0),
|
| | | ("dict", "Reward", 0),
|
| | |
| | | def GetDayID(self): return self.DayID # 天数
|
| | | def GetReward(self): return self.Reward # 奖励 {"职业":[[物品ID,个数],...], ...} |
| | | |
| | | # 七天在线奖励表 |
| | | class IPY_OnlineAward(): |
| | | # 七天在线奖励表新 |
| | | class IPY_OnlineAwardNew(): |
| | | |
| | | def __init__(self): |
| | | self.DayID = 0
|
| | |
| | | self.ipyOSCBillTagAwardLen = len(self.ipyOSCBillTagAwardCache)
|
| | | self.ipyLoginDayAwardCache = self.__LoadFileData("LoginDayAward", IPY_LoginDayAward)
|
| | | self.ipyLoginDayAwardLen = len(self.ipyLoginDayAwardCache)
|
| | | self.ipyOnlineAwardCache = self.__LoadFileData("OnlineAward", IPY_OnlineAward)
|
| | | self.ipyOnlineAwardLen = len(self.ipyOnlineAwardCache)
|
| | | self.ipyOnlineAwardNewCache = self.__LoadFileData("OnlineAwardNew", IPY_OnlineAwardNew)
|
| | | self.ipyOnlineAwardNewLen = len(self.ipyOnlineAwardNewCache)
|
| | | self.ipySpringSaleCache = self.__LoadFileData("SpringSale", IPY_SpringSale)
|
| | | self.ipySpringSaleLen = len(self.ipySpringSaleCache)
|
| | | self.ipyOrderInfoCache = self.__LoadFileData("OrderInfo", IPY_OrderInfo)
|
| | |
| | | def GetOSCBillTagAwardByIndex(self, index): return self.ipyOSCBillTagAwardCache[index]
|
| | | def GetLoginDayAwardCount(self): return self.ipyLoginDayAwardLen
|
| | | def GetLoginDayAwardByIndex(self, index): return self.ipyLoginDayAwardCache[index]
|
| | | def GetOnlineAwardCount(self): return self.ipyOnlineAwardLen
|
| | | def GetOnlineAwardByIndex(self, index): return self.ipyOnlineAwardCache[index]
|
| | | def GetOnlineAwardNewCount(self): return self.ipyOnlineAwardNewLen
|
| | | def GetOnlineAwardNewByIndex(self, index): return self.ipyOnlineAwardNewCache[index]
|
| | | def GetSpringSaleCount(self): return self.ipySpringSaleLen
|
| | | def GetSpringSaleByIndex(self, index): return self.ipySpringSaleCache[index]
|
| | | def GetOrderInfoCount(self): return self.ipyOrderInfoLen
|
| | |
| | |
|
| | | import time
|
| | |
|
| | | '''
|
| | | 特殊说明:
|
| | | 港台主干要修改为创角七日奖励,但是因为前端热更问题,前端无法使用旧表跟旧封包 A3 08 在线奖励信息 #tagMCOnlinePrize
|
| | | 为了保持前后端逻辑统一,后端不再动旧表跟旧封包A308,防止修改后前端报错
|
| | | 使用新表及新封包 B1 13 在线奖励信息新 #tagMCOnlinePrizeNew
|
| | | '''
|
| | |
|
| | | #//A5 06 玩家领取在线奖励 #tagCMGetOnlinePrize
|
| | | #
|
| | | #struct tagCMGetOnlinePrize
|
| | |
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | creatRoleDay = GameWorld.GetCreateRoleDays(curPlayer)
|
| | | prizeIndex = clientPack.Index
|
| | | isDaily = 0 # 主干固定为0,非每日
|
| | | GameWorld.DebugLog("领取每日在线奖励: isDaily=%s,prizeIndex=%s" % (isDaily, prizeIndex))
|
| | | GameWorld.DebugLog("领取在线奖励: creatRoleDay=%s,prizeIndex=%s" % (creatRoleDay, prizeIndex))
|
| | | if prizeIndex <= 0:
|
| | | GameWorld.DebugLog("prizeIndex需要从1开始,我也不想,保留原逻辑吧!!!")
|
| | | return
|
| | | if isDaily:
|
| | | dayID = 0 # 0代表每日的
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataNotLog('OnlineAward', creatRoleDay)
|
| | | if ipyData:
|
| | | GameWorld.DebugLog("当天有创角天定制在线奖励,不能领取日常在线奖励!creatRoleDay=%s" % creatRoleDay)
|
| | | return
|
| | | else:
|
| | | dayID = creatRoleDay
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('OnlineAward', dayID)
|
| | | dayID = creatRoleDay
|
| | | ipyData = IpyGameDataPY.GetIpyGameData('OnlineAwardNew', dayID)
|
| | | if not ipyData:
|
| | | return
|
| | | #先纠正一次时间
|
| | |
| | | # @param None
|
| | | # @return None
|
| | | def SendOnlinePrizeInfo(curPlayer):
|
| | | onlineAwardCount = IpyGameDataPY.IPY_Data().GetOnlineAwardCount()
|
| | | if not onlineAwardCount:
|
| | | dataCount = IpyGameDataPY.IPY_Data().GetOnlineAwardNewCount()
|
| | | if not dataCount:
|
| | | return
|
| | | creatRoleDay = GameWorld.GetCreateRoleDays(curPlayer)
|
| | | sendPack = ChPyNetSendPack.tagMCOnlinePrize()
|
| | | sendPack = ChPyNetSendPack.tagMCOnlinePrizeNew()
|
| | | sendPack.Clear()
|
| | | sendPack.OnlineTime = GetOnlineTime(curPlayer) * 1000
|
| | | sendPack.PrizeInfo = [curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OnlinePrizeNote % creatRoleDay)] # 创角7日的与前端约定固定只发当天的
|
| | | # for i in xrange(onlineAwardCount):
|
| | | # for i in xrange(dataCount):
|
| | | # dayID = i + 1#i+1,增加了每日支持,从0开始,代表每日
|
| | | # sendPack.PrizeInfo.append(curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_OnlinePrizeNote % dayID))
|
| | | sendPack.Len = len(sendPack.PrizeInfo)
|
| | |
| | | if creatRoleDay <= 1:
|
| | | return
|
| | | mailAwardDay = creatRoleDay - 1
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataNotLog('OnlineAward', mailAwardDay)
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataNotLog('OnlineAwardNew', mailAwardDay)
|
| | | if not ipyData:
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataNotLog('OnlineAward', 0)
|
| | | ipyData = IpyGameDataPY.GetIpyGameDataNotLog('OnlineAwardNew', 0)
|
| | | if not ipyData:
|
| | | return
|
| | | mailAwardDay = 0 # 昨日非定制的,且有配置0常规的,则补发0的
|