8359 【主干】活跃兑换(改为后端计算倒计时;优化次数启动及结算模式)
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 28 活跃放置快速完成 #tagCMActivityPlaceQuickFinish
|
| | |
|
| | | class tagCMActivityPlaceQuickFinish(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x28
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | self.Clear()
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x28
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCMActivityPlaceQuickFinish)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B0 28 活跃放置快速完成 //tagCMActivityPlaceQuickFinish:
|
| | | Cmd:%s,
|
| | | SubCmd:%s
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMActivityPlaceQuickFinish=tagCMActivityPlaceQuickFinish()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMActivityPlaceQuickFinish.Cmd,m_NAtagCMActivityPlaceQuickFinish.SubCmd))] = m_NAtagCMActivityPlaceQuickFinish
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 27 活跃放置启动 #tagCMActivityPlaceStart
|
| | |
|
| | | class tagCMActivityPlaceStart(Structure):
|
| | |
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("RewardEndType", c_ubyte), #是否结算探索,后端处理奖励后自动启动下一次放置探索;0-无结算启动,1-倒计时结束结算,2-快速结算;
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | |
| | | def Clear(self):
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x27
|
| | | self.RewardEndType = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | def OutputString(self):
|
| | | DumpString = '''// B0 27 活跃放置启动 //tagCMActivityPlaceStart:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | RewardEndType:%d
|
| | | SubCmd:%s
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.RewardEndType
|
| | | self.SubCmd
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | |
|
| | | class tagMCActivityPlaceInfo(Structure):
|
| | | Head = tagHead()
|
| | | PlaceState = 0 #(BYTE PlaceState)// 是否启动状态
|
| | | StartTime = 0 #(DWORD StartTime)// 开始探索time时间戳,完成一次探索会自动下一次探索并更新该时间
|
| | | PlaceCount = 0 #(BYTE PlaceCount)// 剩余未完成探索次数
|
| | | RewardCount = 0 #(BYTE RewardCount)// 累计未领取探索奖励次数
|
| | | RewardLen = 0 #(BYTE RewardLen)
|
| | | RewardInfo = "" #(String RewardInfo)//累计未领取探索奖励 [[itemID, count], ...]
|
| | |
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.PlaceState,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.StartTime,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.PlaceCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.RewardCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.RewardLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.RewardInfo,_pos = CommFunc.ReadString(_lpData, _pos,self.RewardLen)
|
| | |
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xB0
|
| | | self.Head.SubCmd = 0x27
|
| | | self.PlaceState = 0
|
| | | self.StartTime = 0
|
| | | self.PlaceCount = 0
|
| | | self.RewardCount = 0
|
| | | self.RewardLen = 0
|
| | | self.RewardInfo = ""
|
| | |
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | length += 4
|
| | | length += 1
|
| | | length += 1
|
| | | length += 1
|
| | | length += len(self.RewardInfo)
|
| | |
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.PlaceState)
|
| | | data = CommFunc.WriteDWORD(data, self.StartTime)
|
| | | data = CommFunc.WriteBYTE(data, self.PlaceCount)
|
| | | data = CommFunc.WriteBYTE(data, self.RewardCount)
|
| | | data = CommFunc.WriteBYTE(data, self.RewardLen)
|
| | | data = CommFunc.WriteString(data, self.RewardLen, self.RewardInfo)
|
| | |
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | PlaceState:%d,
|
| | | StartTime:%d,
|
| | | PlaceCount:%d,
|
| | | RewardCount:%d,
|
| | | RewardLen:%d,
|
| | | RewardInfo:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.PlaceState,
|
| | | self.StartTime,
|
| | | self.PlaceCount,
|
| | | self.RewardCount,
|
| | | self.RewardLen,
|
| | | self.RewardInfo
|
| | |
| | | Writer = xdh
|
| | | Releaser = xdh
|
| | | RegType = 0
|
| | | RegisterPackCount = 2
|
| | | RegisterPackCount = 3
|
| | |
|
| | | PacketCMD_1=0xA5
|
| | | PacketSubCMD_1=0x25
|
| | |
| | | PacketSubCMD_2=0x27
|
| | | PacketCallFunc_2=OnActivityPlaceStart
|
| | |
|
| | | PacketCMD_3=0xB0
|
| | | PacketSubCMD_3=0x28
|
| | | PacketCallFunc_3=OnActivityPlaceQuickFinish
|
| | |
|
| | | ;协助
|
| | | [PlayerAssist]
|
| | | ScriptName = Player\PlayerAssist.py
|
| | |
| | |
|
| | | # 活跃放置
|
| | | Def_PDict_ActivityCanCostTotalPoint = "ActivityCanCostTotalPoint" # 当前总活跃值(可消耗)
|
| | | Def_PDict_ActivityPlaceState = "ActivityPlaceState" # 活跃放置是否探索中
|
| | | Def_PDict_ActivityPlaceStartTime = "ActivityPlaceStartTime" # 活跃放置开始time值
|
| | | Def_PDict_ActivityPlaceRewardTotalCount = "ActivityPlaceRewardTotalCount" # 活跃放置总共累计奖励次数
|
| | | Def_PDict_ActivityPlaceRewardCount = "ActivityPlaceRewardCount" # 活跃放置累计奖励次数
|
| | | Def_PDict_ActivityPlaceRemainCount = "ActivityPlaceRemainCount" # 活跃放置剩余进行次数
|
| | | Def_PDict_ActivityPlaceRewardCount = "ActivityPlaceRewardCount" # 活跃放置本次启动已累计奖励次数
|
| | | Def_PDict_ActivityPlaceRewardTotalCount = "ActivityPlaceRewardTotalCount" # 活跃放置历史总共累计奖励次数
|
| | | Def_PDict_ActivityPlaceRewardItem = "ActivityPlaceItem" # 奖励物品个数
|
| | | Def_PDict_ActivityPlaceRewardItemID = "ActivityPlaceItemID_%s" # 奖励物品ID,参数(index)
|
| | | Def_PDict_ActivityPlaceRewardItemCount = "ActivityPlaceItemCount_%s" # 奖励物品个数,参数(index)
|
| | |
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 28 活跃放置快速完成 #tagCMActivityPlaceQuickFinish
|
| | |
|
| | | class tagCMActivityPlaceQuickFinish(Structure):
|
| | | _pack_ = 1
|
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | | self.Clear()
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x28
|
| | | return
|
| | |
|
| | | def ReadData(self, stringData, _pos=0, _len=0):
|
| | | self.Clear()
|
| | | memmove(addressof(self), stringData[_pos:], self.GetLength())
|
| | | return _pos + self.GetLength()
|
| | |
|
| | | def Clear(self):
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x28
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | | return sizeof(tagCMActivityPlaceQuickFinish)
|
| | |
|
| | | def GetBuffer(self):
|
| | | return string_at(addressof(self), self.GetLength())
|
| | |
|
| | | def OutputString(self):
|
| | | DumpString = '''// B0 28 活跃放置快速完成 //tagCMActivityPlaceQuickFinish:
|
| | | Cmd:%s,
|
| | | SubCmd:%s
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
|
| | | m_NAtagCMActivityPlaceQuickFinish=tagCMActivityPlaceQuickFinish()
|
| | | ChNetPackDict[eval("0x%02x%02x"%(m_NAtagCMActivityPlaceQuickFinish.Cmd,m_NAtagCMActivityPlaceQuickFinish.SubCmd))] = m_NAtagCMActivityPlaceQuickFinish
|
| | |
|
| | |
|
| | | #------------------------------------------------------
|
| | | # B0 27 活跃放置启动 #tagCMActivityPlaceStart
|
| | |
|
| | | class tagCMActivityPlaceStart(Structure):
|
| | |
| | | _fields_ = [
|
| | | ("Cmd", c_ubyte),
|
| | | ("SubCmd", c_ubyte),
|
| | | ("RewardEndType", c_ubyte), #是否结算探索,后端处理奖励后自动启动下一次放置探索;0-无结算启动,1-倒计时结束结算,2-快速结算;
|
| | | ]
|
| | |
|
| | | def __init__(self):
|
| | |
| | | def Clear(self):
|
| | | self.Cmd = 0xB0
|
| | | self.SubCmd = 0x27
|
| | | self.RewardEndType = 0
|
| | | return
|
| | |
|
| | | def GetLength(self):
|
| | |
| | | def OutputString(self):
|
| | | DumpString = '''// B0 27 活跃放置启动 //tagCMActivityPlaceStart:
|
| | | Cmd:%s,
|
| | | SubCmd:%s,
|
| | | RewardEndType:%d
|
| | | SubCmd:%s
|
| | | '''\
|
| | | %(
|
| | | self.Cmd,
|
| | | self.SubCmd,
|
| | | self.RewardEndType
|
| | | self.SubCmd
|
| | | )
|
| | | return DumpString
|
| | |
|
| | |
| | |
|
| | | class tagMCActivityPlaceInfo(Structure):
|
| | | Head = tagHead()
|
| | | PlaceState = 0 #(BYTE PlaceState)// 是否启动状态
|
| | | StartTime = 0 #(DWORD StartTime)// 开始探索time时间戳,完成一次探索会自动下一次探索并更新该时间
|
| | | PlaceCount = 0 #(BYTE PlaceCount)// 剩余未完成探索次数
|
| | | RewardCount = 0 #(BYTE RewardCount)// 累计未领取探索奖励次数
|
| | | RewardLen = 0 #(BYTE RewardLen)
|
| | | RewardInfo = "" #(String RewardInfo)//累计未领取探索奖励 [[itemID, count], ...]
|
| | |
| | | def ReadData(self, _lpData, _pos=0, _Len=0):
|
| | | self.Clear()
|
| | | _pos = self.Head.ReadData(_lpData, _pos)
|
| | | self.PlaceState,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.StartTime,_pos = CommFunc.ReadDWORD(_lpData, _pos)
|
| | | self.PlaceCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.RewardCount,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.RewardLen,_pos = CommFunc.ReadBYTE(_lpData, _pos)
|
| | | self.RewardInfo,_pos = CommFunc.ReadString(_lpData, _pos,self.RewardLen)
|
| | |
| | | self.Head.Clear()
|
| | | self.Head.Cmd = 0xB0
|
| | | self.Head.SubCmd = 0x27
|
| | | self.PlaceState = 0
|
| | | self.StartTime = 0
|
| | | self.PlaceCount = 0
|
| | | self.RewardCount = 0
|
| | | self.RewardLen = 0
|
| | | self.RewardInfo = ""
|
| | |
| | | def GetLength(self):
|
| | | length = 0
|
| | | length += self.Head.GetLength()
|
| | | length += 1
|
| | | length += 4
|
| | | length += 1
|
| | | length += 1
|
| | | length += 1
|
| | | length += len(self.RewardInfo)
|
| | |
| | | def GetBuffer(self):
|
| | | data = ''
|
| | | data = CommFunc.WriteString(data, self.Head.GetLength(), self.Head.GetBuffer())
|
| | | data = CommFunc.WriteBYTE(data, self.PlaceState)
|
| | | data = CommFunc.WriteDWORD(data, self.StartTime)
|
| | | data = CommFunc.WriteBYTE(data, self.PlaceCount)
|
| | | data = CommFunc.WriteBYTE(data, self.RewardCount)
|
| | | data = CommFunc.WriteBYTE(data, self.RewardLen)
|
| | | data = CommFunc.WriteString(data, self.RewardLen, self.RewardInfo)
|
| | |
| | | def OutputString(self):
|
| | | DumpString = '''
|
| | | Head:%s,
|
| | | PlaceState:%d,
|
| | | StartTime:%d,
|
| | | PlaceCount:%d,
|
| | | RewardCount:%d,
|
| | | RewardLen:%d,
|
| | | RewardInfo:%s
|
| | | '''\
|
| | | %(
|
| | | self.Head.OutputString(),
|
| | | self.PlaceState,
|
| | | self.StartTime,
|
| | | self.PlaceCount,
|
| | | self.RewardCount,
|
| | | self.RewardLen,
|
| | | self.RewardInfo
|
| | |
| | | return
|
| | |
|
| | | if len(msgList) == 1 and not msgList[0]:
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceState, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceStartTime, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceRewardTotalCount, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceRemainCount, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceRewardCount, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceRewardTotalCount, 0)
|
| | |
|
| | | rewardItemCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceRewardItem)
|
| | | for i in xrange(rewardItemCount):
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceRewardItemID % i, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceRewardItemCount % i, 0)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceRewardItem, 0)
|
| | |
|
| | | GameWorld.DebugAnswer(curPlayer, "重置活跃放置成功!")
|
| | | PlayerActivity.Sync_ActivityPlaceInfo(curPlayer)
|
| | |
| | | import PyGameData
|
| | | import GameFuncComm
|
| | | import EventShell
|
| | | import PlayerTJG
|
| | | import PlayerPet
|
| | | import datetime
|
| | | import time
|
| | |
| | | #struct tagCMActivityPlaceStart
|
| | | #{
|
| | | # tagHead Head;
|
| | | # BYTE RewardEndType; //是否结算探索,后端处理奖励后自动启动下一次放置探索;0-无结算启动,1-倒计时结束结算,2-快速结算;
|
| | | #};
|
| | | def OnActivityPlaceStart(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | rewardEndType = clientData.RewardEndType
|
| | |
|
| | | rewardCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceRewardCount)
|
| | | maxRewardCount = IpyGameDataPY.GetFuncCfg("ActivityPlace", 4) # 最大累计放置奖励次数
|
| | | if rewardCount >= maxRewardCount:
|
| | | GameWorld.ErrLog("活跃放置奖励累计次数已达上限,无法启动")
|
| | | remainCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceRemainCount)
|
| | | rewardCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceRewardCount)
|
| | | |
| | | maxCanStartCount = maxRewardCount - remainCount - rewardCount
|
| | | if maxCanStartCount <= 0:
|
| | | GameWorld.DebugLog("活跃放置奖励累计次数已达上限,无法启动!remainCount=%s + rewardCount=%s >= maxRewardCount=%s" |
| | | % (remainCount, rewardCount, maxRewardCount))
|
| | | return
|
| | |
|
| | | placeState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceState)
|
| | | |
| | | endCount, nextStartReduceSeconds = 1, 0
|
| | | |
| | | # 无结算启动
|
| | | if rewardEndType == 0:
|
| | | if placeState:
|
| | | GameWorld.DebugLog("已在放置探索中!")
|
| | | costPoint = IpyGameDataPY.GetFuncCfg("ActivityPlace", 2) # 单次放置消耗的活跃点数
|
| | | canUseActivityPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityCanCostTotalPoint)
|
| | | pointCanUseCount = canUseActivityPoint / costPoint
|
| | | startCount = min(maxCanStartCount, pointCanUseCount)
|
| | | if startCount <= 0:
|
| | | GameWorld.DebugLog("可用活跃不足,无法添加次数启动!canUseActivityPoint=%s,costPoint=%s" % (canUseActivityPoint, costPoint))
|
| | | return
|
| | | __DoActivityPlaceStart(curPlayer)
|
| | |
|
| | | # 倒计时结束结算
|
| | | elif rewardEndType == 1:
|
| | | if not placeState:
|
| | | GameWorld.DebugLog("非放置探索中,无法结算!")
|
| | | return
|
| | | startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceStartTime)
|
| | | if not startTime:
|
| | | return
|
| | | needSeconds = IpyGameDataPY.GetFuncCfg("ActivityPlace", 3) # 单次放置奖励持续时间,秒
|
| | | updRemainCount = remainCount + startCount
|
| | | GameWorld.DebugLog("添加活跃放置次数: startCount=%s,rewardCount=%s,remainCount=%s,updRemainCount=%s" |
| | | % (startCount, rewardCount, remainCount, updRemainCount))
|
| | | |
| | | costPointTotal = costPoint * startCount
|
| | | CostActivityPoint(curPlayer, costPointTotal)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceRemainCount, updRemainCount)
|
| | | |
| | | if not remainCount:
|
| | | curTime = int(time.time())
|
| | | passTime = curTime - startTime
|
| | | if passTime < needSeconds:
|
| | | GameWorld.DebugLog("探索时间未到,无法结算! curTime=%s,startTime=%s,passTime=%s < %s" % (curTime, startTime, passTime, needSeconds))
|
| | | return
|
| | | endCount = passTime / needSeconds
|
| | | nextStartReduceSeconds = passTime % needSeconds
|
| | | __DoActivityPlaceRewardEnd(curPlayer, endCount, nextStartReduceSeconds)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceStartTime, curTime)
|
| | | GameWorld.DebugLog(" 没有剩余次数,更新启动时间: %s" % curTime)
|
| | |
|
| | | # 快速结算
|
| | | elif rewardEndType == 2:
|
| | | if not placeState:
|
| | | GameWorld.DebugLog("非放置探索中,无法快速结算!")
|
| | | Sync_ActivityPlaceInfo(curPlayer)
|
| | | return
|
| | |
|
| | | #// B0 28 活跃放置快速完成 #tagCMActivityPlaceQuickFinish
|
| | | #
|
| | | #struct tagCMActivityPlaceQuickFinish
|
| | | #{
|
| | | # tagHead Head;
|
| | | #};
|
| | | def OnActivityPlaceQuickFinish(index, clientData, tick):
|
| | | curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | |
| | | remainCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceRemainCount)
|
| | | if not remainCount:
|
| | | GameWorld.DebugLog("没有剩余活跃放置次数,无法快速完成!")
|
| | | return
|
| | |
|
| | | costItemID, costGoldParper = IpyGameDataPY.GetFuncEvalCfg("ActivityPlace", 5)
|
| | | costItemCount = 1
|
| | | costItemCount = 1 # 默认扣一个
|
| | | endCount = 1 # 只快速结算一次
|
| | |
|
| | | costItemIndexList, bindCnt, unBindCnt = ItemCommon.GetPackItemBindStateIndexInfo(curPlayer, costItemID, costItemCount)
|
| | | lackCnt = costItemCount - bindCnt - unBindCnt
|
| | |
| | | else:
|
| | | ItemCommon.DelCostItemByBind(curPlayer, costItemIndexList, bindCnt, unBindCnt, costItemCount, ChConfig.ItemDel_ActivityPlace)
|
| | |
|
| | | __DoActivityPlaceRewardEnd(curPlayer, endCount, nextStartReduceSeconds)
|
| | | |
| | | Sync_ActivityPlaceInfo(curPlayer)
|
| | | __DoActivityPlaceRewardEnd(curPlayer, endCount)
|
| | | return
|
| | |
|
| | | def __DoActivityPlaceRewardEnd(curPlayer, endCount, nextStartReduceSeconds):
|
| | | def ProcessActivityPlace(curPlayer):
|
| | | ## 活跃放置定时处理
|
| | | |
| | | remainCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceRemainCount)
|
| | | if remainCount <= 0:
|
| | | #GameWorld.DebugLog("没有剩余放置次数不处理!")
|
| | | return
|
| | | |
| | | curTime = int(time.time())
|
| | | startTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceStartTime)
|
| | | if not startTime:
|
| | | startTime = curTime
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceStartTime, curTime)
|
| | | |
| | | needSeconds = IpyGameDataPY.GetFuncCfg("ActivityPlace", 3) # 单次放置奖励持续时间,秒
|
| | | passTime = curTime - startTime
|
| | | if passTime < needSeconds:
|
| | | #GameWorld.DebugLog("探索时间未到,不结算! curTime=%s,startTime=%s,passTime=%s < %s" % (curTime, startTime, passTime, needSeconds))
|
| | | return
|
| | | endCount = passTime / needSeconds
|
| | | nextStartReduceSeconds = passTime % needSeconds
|
| | | __DoActivityPlaceRewardEnd(curPlayer, endCount, nextStartReduceSeconds)
|
| | | return
|
| | |
|
| | | def __DoActivityPlaceRewardEnd(curPlayer, endCount, nextStartReduceSeconds=0):
|
| | | ## 放置活跃奖励结算
|
| | |
|
| | | if not endCount:
|
| | | remainCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceRemainCount)
|
| | | endCount = min(endCount, remainCount)
|
| | | if endCount <= 0:
|
| | | return
|
| | | |
| | | if PlayerTJG.GetIsTJG(curPlayer):
|
| | | return
|
| | | |
| | | countDataDict = {}
|
| | | lvDataDict = {}
|
| | | ipyDataMgr = IpyGameDataPY.IPY_Data()
|
| | |
| | | if not lvRewardIpyData:
|
| | | lvRewardIpyData = lvDataDict[lvList[-1]]
|
| | |
|
| | | costPoint = IpyGameDataPY.GetFuncCfg("ActivityPlace", 2) # 单次放置消耗的活跃点数
|
| | | maxRewardCount = IpyGameDataPY.GetFuncCfg("ActivityPlace", 4) # 最大累计放置奖励次数
|
| | | maxAppointCount = max(countDataDict) # 最大定制奖励次数
|
| | | rewardCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceRewardCount)
|
| | | |
| | | isStop = False
|
| | | rewardItemDict = {}
|
| | | GameWorld.DebugLog("结算放置活跃奖励: rewardCount=%s,endCount=%s,maxRewardCount=%s,maxAppointCount=%s" % (rewardCount, endCount, maxRewardCount, maxAppointCount))
|
| | | for endIndex in xrange(endCount):
|
| | | #GameWorld.DebugLog("endIndex=%s" % endIndex)
|
| | | |
| | | # 超过1次的需要补扣活跃消耗
|
| | | if endCount > 1 and endIndex != 0:
|
| | | if not CostActivityPoint(curPlayer, costPoint):
|
| | | isStop = True
|
| | | GameWorld.DebugLog(" 可消耗的活跃不足,无法继续结算奖励!")
|
| | | break
|
| | | |
| | | rewardIpyData = None
|
| | | rewardTotalCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceRewardTotalCount)
|
| | |
|
| | | rewardItemDict = {}
|
| | | GameWorld.DebugLog("结算放置活跃奖励: remainCount=%s,rewardCount=%s,endCount=%s,maxAppointCount=%s" % (remainCount, rewardCount, endCount, maxAppointCount))
|
| | | for _ in xrange(endCount):
|
| | | |
| | | rewardIpyData = None
|
| | | |
| | | # 加奖励次数
|
| | | remainCount -= 1
|
| | | rewardCount += 1
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceRewardCount, rewardCount)
|
| | | if rewardTotalCount < maxAppointCount:
|
| | | rewardTotalCount += 1
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceRewardTotalCount, rewardTotalCount)
|
| | | if rewardTotalCount in countDataDict:
|
| | | rewardIpyData = countDataDict[rewardTotalCount]
|
| | | #GameWorld.DebugLog(" 取定制次数奖励")
|
| | | #GameWorld.DebugLog(" 取定制次数奖励: rewardTotalCount=%s" % rewardTotalCount)
|
| | |
|
| | | if not rewardIpyData:
|
| | | rewardIpyData = lvRewardIpyData
|
| | |
| | | if itemID:
|
| | | rewardItemDict[itemID] = rewardItemDict.get(itemID, 0) + 1
|
| | |
|
| | | GameWorld.DebugLog(" rewardCount=%s,rewardTotalCount=%s, %s" % (rewardCount, rewardTotalCount, rewardItemDict))
|
| | | GameWorld.DebugLog(" remainCount=%s,rewardCount=%s,rewardTotalCount=%s, %s" % (remainCount, rewardCount, rewardTotalCount, rewardItemDict))
|
| | |
|
| | | if rewardCount >= maxRewardCount:
|
| | | isStop = True
|
| | | GameWorld.DebugLog(" 放置活跃奖励次数已达上限!rewardCount=%s" % rewardCount)
|
| | | break
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceRemainCount, remainCount)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceRewardCount, rewardCount)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceRewardTotalCount, rewardTotalCount)
|
| | | |
| | | if remainCount > 0:
|
| | | nextStartTime = int(time.time()) - nextStartReduceSeconds
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceStartTime, nextStartTime)
|
| | | GameWorld.DebugLog(" 还有剩余次数,更新启动时间: %s, nextStartReduceSeconds=%s" % (nextStartTime, nextStartReduceSeconds))
|
| | |
|
| | | # 存储奖励
|
| | | rewardItemCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceRewardItem)
|
| | |
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceRewardItem, rewardItemCount)
|
| | | #GameWorld.DebugLog(" 新增探索奖励: itemID=%s,itemCount=%s,rewardItemCount=%s" % (itemID, itemCount, rewardItemCount))
|
| | |
|
| | | if isStop:
|
| | | GameWorld.DebugLog(" 停止探索!")
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceState, 0)
|
| | | else:
|
| | | __DoActivityPlaceStart(curPlayer, nextStartReduceSeconds)
|
| | | |
| | | Sync_ActivityPlaceInfo(curPlayer)
|
| | | return
|
| | |
|
| | | def __DoActivityPlaceStart(curPlayer, reduceSeconds=0):
|
| | | |
| | | costPoint = IpyGameDataPY.GetFuncCfg("ActivityPlace", 2) # 单次放置消耗的活跃点数
|
| | | canUseActivityPoint = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityCanCostTotalPoint)
|
| | | if canUseActivityPoint < costPoint:
|
| | | GameWorld.DebugLog("活跃度不足,无法启动放置探索!canUseActivityPoint=%s" % canUseActivityPoint)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceState, 0)
|
| | | return
|
| | | startTime = int(time.time()) - reduceSeconds
|
| | | GameWorld.DebugLog(" 启动新一轮放置探索!reduceSeconds=%s" % reduceSeconds)
|
| | | CostActivityPoint(curPlayer, costPoint)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceState, 1)
|
| | | PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_PDict_ActivityPlaceStartTime, startTime)
|
| | | return True
|
| | |
|
| | | def GetActivityPlaceReward(curPlayer):
|
| | | ## 领取活跃放置奖励
|
| | |
| | | itemCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceRewardItemCount % i)
|
| | | rewardItemInfo.append([itemID, itemCount])
|
| | | placeInfo = ChPyNetSendPack.tagMCActivityPlaceInfo()
|
| | | placeInfo.PlaceState = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceState)
|
| | | placeInfo.StartTime = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceStartTime)
|
| | | placeInfo.PlaceCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceRemainCount)
|
| | | placeInfo.RewardCount = curPlayer.NomalDictGetProperty(ChConfig.Def_PDict_ActivityPlaceRewardCount)
|
| | | placeInfo.RewardInfo = str(rewardItemInfo)
|
| | | placeInfo.RewardLen = len(placeInfo.RewardInfo)
|
| | |
| | | import PlayerWing
|
| | | import ChEquip
|
| | | import PlayerYinji
|
| | | import PlayerActivity
|
| | |
|
| | | #---------------------------------------------------------------------
|
| | | #---------------------------------------------------------------------
|
| | |
| | | ProcessAreaExp(curPlayer, tick)
|
| | | #神秘商店刷新
|
| | | FunctionNPCCommon.CheckMysticalShopRefresh(curPlayer, tick)
|
| | | #活跃放置
|
| | | PlayerActivity.ProcessActivityPlace(curPlayer)
|
| | | #跨服数据同步,放最后
|
| | | CrossPlayerData.ProcessCrossPlayer(curPlayer, tick)
|
| | | return
|