Commit e38b9c49925f19e0d2e16d9a407bc8245177cbc4

Authored by zhouhaihai
1 parent f4c65591

无尽次数

Showing 2 changed files with 34 additions and 14 deletions   Show diff stats
src/actions/AdvAction.lua
@@ -64,17 +64,12 @@ function _M.startAdvRpc( agent, data ) @@ -64,17 +64,12 @@ function _M.startAdvRpc( agent, data )
64 local chapterData = csvdb["adv_chapterCsv"][chapterId] 64 local chapterData = csvdb["adv_chapterCsv"][chapterId]
65 if not chapterData or layer < 1 then return 1 end 65 if not chapterData or layer < 1 then return 1 end
66 66
67 - if role.dailyData:getProperty("advC") >= role:getAdvHangLimit() then return 2 end -- 是否有体力  
68 - 67 + --是否是中继层
69 if (layer - 1) % globalCsv.adv_can_out_layer_pre ~= 0 then return 3 end 68 if (layer - 1) % globalCsv.adv_can_out_layer_pre ~= 0 then return 3 end
70 69
71 local advPass = role:getProperty("advPass") 70 local advPass = role:getProperty("advPass")
72 if AdvCommon.isEndless(chapterId) then 71 if AdvCommon.isEndless(chapterId) then
73 - for _k, _v in pairs(csvdb["adv_chapterCsv"]) do --解锁全部关卡  
74 - if not AdvCommon.isEndless(_k) then  
75 - if (advPass[_k] or 0) ~= _v.limitlevel then return 12 end  
76 - end  
77 - end 72 + if role.dailyData:getProperty("advElC") >= role:getAdvElLimit() then return 2 end -- 是否有体力
78 if not role:isFuncOpen(FuncOpenType.AdvEndless) or not role:isFuncOpen(FuncOpenType.AdvRelay) then return 11 end -- 开放了中继模式 和 无尽模式 才可以玩儿无尽模式 73 if not role:isFuncOpen(FuncOpenType.AdvEndless) or not role:isFuncOpen(FuncOpenType.AdvRelay) then return 11 end -- 开放了中继模式 和 无尽模式 才可以玩儿无尽模式
79 local maxl = math.floor(role:getProperty("advElM") / 10) * 10 74 local maxl = math.floor(role:getProperty("advElM") / 10) * 10
80 local openLayer = {} 75 local openLayer = {}
@@ -86,7 +81,12 @@ function _M.startAdvRpc( agent, data ) @@ -86,7 +81,12 @@ function _M.startAdvRpc( agent, data )
86 openLayer[l] = 1 81 openLayer[l] = 1
87 end 82 end
88 if not openLayer[layer - 1] then return 10 end 83 if not openLayer[layer - 1] then return 10 end
  84 +
  85 + if layer == 1 then
  86 + if not role:advChapterIsOpen(chapterId, layer) then return 13 end
  87 + end
89 else 88 else
  89 + if role.dailyData:getProperty("advC") >= role:getAdvHangLimit() then return 2 end -- 是否有体力
90 if layer > chapterData.limitlevel then return 4 end 90 if layer > chapterData.limitlevel then return 4 end
91 -- 关卡开放判断 91 -- 关卡开放判断
92 if not role:advChapterIsOpen(chapterId, layer) then return 5 end 92 if not role:advChapterIsOpen(chapterId, layer) then return 5 end
@@ -105,7 +105,11 @@ function _M.startAdvRpc( agent, data ) @@ -105,7 +105,11 @@ function _M.startAdvRpc( agent, data )
105 end 105 end
106 advTeam.leader = format.leader 106 advTeam.leader = format.leader
107 role:updateProperty({field = "advTeam", value = advTeam}) 107 role:updateProperty({field = "advTeam", value = advTeam})
108 - role.dailyData:updateProperty({field = "advC", delta = 1}) 108 + if AdvCommon.isEndless(chapterId) then
  109 + role.dailyData:updateProperty({field = "advElC", delta = 1})
  110 + else
  111 + role.dailyData:updateProperty({field = "advC", delta = 1})
  112 + end
109 113
110 role:getAdvData():initByChapter(chapterId, layer) 114 role:getAdvData():initByChapter(chapterId, layer)
111 115
@@ -202,13 +206,26 @@ function _M.buyAdvCountRpc(agent , data) @@ -202,13 +206,26 @@ function _M.buyAdvCountRpc(agent , data)
202 local msg = MsgPack.unpack(data) 206 local msg = MsgPack.unpack(data)
203 207
204 local count = msg.count --购买次数 208 local count = msg.count --购买次数
205 - if math.illegalNum(count, 1, math.min(globalCsv.adv_daily_buy_count - role.dailyData:getProperty("advBC"), role.dailyData:getProperty("advC"))) then return end  
206 -  
207 - local cost = {[ItemId.Diamond] = count * globalCsv.adv_daily_buy_cost} 209 + local isEl = msg.isEl -- 是否是无尽模式
  210 + local cost
  211 + if isEl then
  212 + if math.illegalNum(count, 1, math.min(globalCsv.adv_endless_daily_buy_count - role.dailyData:getProperty("advElBC"), role.dailyData:getProperty("advElC"))) then return end
  213 + cost = {[ItemId.Diamond] = count * globalCsv.adv_endless_daily_buy_cost}
  214 + else
  215 + if math.illegalNum(count, 1, math.min(globalCsv.adv_daily_buy_count - role.dailyData:getProperty("advBC"), role.dailyData:getProperty("advC"))) then return end
  216 + cost = {[ItemId.Diamond] = count * globalCsv.adv_daily_buy_cost}
  217 + end
  218 +
  219 +
208 if not role:checkItemEnough(cost) then return end 220 if not role:checkItemEnough(cost) then return end
209 role:costItems(cost) 221 role:costItems(cost)
210 - role.dailyData:updateProperty({field = "advC", delta = -count})  
211 - role.dailyData:updateProperty({field = "advBC", delta = count}) 222 + if isEl then
  223 + role.dailyData:updateProperty({field = "advElC", delta = -count})
  224 + role.dailyData:updateProperty({field = "advElBC", delta = count})
  225 + else
  226 + role.dailyData:updateProperty({field = "advC", delta = -count})
  227 + role.dailyData:updateProperty({field = "advBC", delta = count})
  228 + end
212 229
213 SendPacket(actionCodes.Adv_buyAdvCountRpc, '') 230 SendPacket(actionCodes.Adv_buyAdvCountRpc, '')
214 return true 231 return true
@@ -364,7 +381,6 @@ end @@ -364,7 +381,6 @@ end
364 381
365 function _M.wheelSurfRpc(agent, data) 382 function _M.wheelSurfRpc(agent, data)
366 local role = agent.role 383 local role = agent.role
367 - local msg = MsgPack.unpack(data)  
368 if not role:isFuncOpen(FuncOpenType.AdvWheelSurf) then return end 384 if not role:isFuncOpen(FuncOpenType.AdvWheelSurf) then return end
369 if not role._advWheelSurfCount then return end 385 if not role._advWheelSurfCount then return end
370 386
src/models/Daily.lua
@@ -11,7 +11,9 @@ Daily.schema = { @@ -11,7 +11,9 @@ Daily.schema = {
11 hangQC = {"number", 0}, -- 挂机快速次数 11 hangQC = {"number", 0}, -- 挂机快速次数
12 dinerQC = {"number", 0}, -- 贩卖加速次数 12 dinerQC = {"number", 0}, -- 贩卖加速次数
13 advC = {"number", 0}, -- 冒险次数(消耗体力) 13 advC = {"number", 0}, -- 冒险次数(消耗体力)
  14 + advElC = {"number", 0}, -- 无尽次数(消耗体力)
14 advBC = {"number", 0}, -- 冒险次数购买次数(冒险体力购买次数) 15 advBC = {"number", 0}, -- 冒险次数购买次数(冒险体力购买次数)
  16 + advElBC = {"number", 0}, -- 无尽次数购买次数(冒险体力购买次数)
15 advWs = {"table", {}}, -- 冒险队工坊 17 advWs = {"table", {}}, -- 冒险队工坊
16 } 18 }
17 19
@@ -49,6 +51,8 @@ function Daily:data() @@ -49,6 +51,8 @@ function Daily:data()
49 dinerQC = self:getProperty("dinerQC"), 51 dinerQC = self:getProperty("dinerQC"),
50 advC = self:getProperty("advC"), 52 advC = self:getProperty("advC"),
51 advBC = self:getProperty("advBC"), 53 advBC = self:getProperty("advBC"),
  54 + advElC = self:getProperty("advElC"),
  55 + advElBC = self:getProperty("advElBC"),
52 advWs = self:getProperty("advWs"), 56 advWs = self:getProperty("advWs"),
53 } 57 }
54 end 58 end