Commit 33be31113312a27570350d43307d1e81f3ffaba8

Authored by zhouhaihai
1 parent 5deaf049

修改hangPass 结构

src/actions/AdvAction.lua
@@ -245,11 +245,11 @@ function _M.quickHangRpc(agent, data) @@ -245,11 +245,11 @@ function _M.quickHangRpc(agent, data)
245 local cost = math.ceil((info.time - skynet.timex()) / chapterData.idleTime * chapterData.accelerate) 245 local cost = math.ceil((info.time - skynet.timex()) / chapterData.idleTime * chapterData.accelerate)
246 246
247 if not role:checkItemEnough({[ItemId.Diamond] = cost}) then return end 247 if not role:checkItemEnough({[ItemId.Diamond] = cost}) then return end
248 - role:costItems({[ItemId.Diamond] = cost}, {log = {desc = "quickHang", int1 = chapterId}}) 248 + role:costItems({[ItemId.Diamond] = cost}, {log = {desc = "advQuickHang", int1 = chapterId}})
249 info.time = 0 249 info.time = 0
250 role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) 250 role:changeUpdates({{type = "advHang", field = chapterId, value = info}})
251 251
252 - role:log("adv_action", {desc = "quickHang", int1 = chapterId}) 252 + role:log("adv_action", {desc = "advQuickHang", int1 = chapterId})
253 253
254 SendPacket(actionCodes.Adv_quickHangRpc, '') 254 SendPacket(actionCodes.Adv_quickHangRpc, '')
255 return true 255 return true
src/actions/DinerAction.lua
@@ -364,8 +364,7 @@ function _M.talentUpRpc( agent, data ) @@ -364,8 +364,7 @@ function _M.talentUpRpc( agent, data )
364 end 364 end
365 365
366 if talentData.levelFront ~= "" then 366 if talentData.levelFront ~= "" then
367 - local hangPass = role:getProperty("hangPass")  
368 - if not hangPass[tonumber(talentData.levelFront)] then 367 + if not role:checkHangPass(tonumber(talentData.levelFront)) then
369 return 9 368 return 9
370 end 369 end
371 end 370 end
@@ -635,8 +634,7 @@ function _M.addWantFoodRpc(agent , data) @@ -635,8 +634,7 @@ function _M.addWantFoodRpc(agent , data)
635 local foodData = csvdb["diner_materialCsv"][itemId] 634 local foodData = csvdb["diner_materialCsv"][itemId]
636 if not foodData then return 3 end 635 if not foodData then return 3 end
637 if foodData.unlock ~= 0 then 636 if foodData.unlock ~= 0 then
638 - local hangPass = role:getProperty("hangPass")  
639 - if not hangPass[foodData.unlock] then 637 + if not role:checkHangPass(foodData.unlock) then
640 return 4 638 return 4
641 end 639 end
642 end 640 end
src/actions/GmAction.lua
@@ -178,19 +178,17 @@ table.insert(helpDes, {"通关挂机副本", "fb", "挂卡id"}) @@ -178,19 +178,17 @@ table.insert(helpDes, {"通关挂机副本", "fb", "挂卡id"})
178 function _M.fb(role, pms) -- 直接通关 178 function _M.fb(role, pms) -- 直接通关
179 local carbonId = tonum(pms.pm1) 179 local carbonId = tonum(pms.pm1)
180 if not csvdb["idle_battleCsv"][carbonId] then return "不存在的carbon" end 180 if not csvdb["idle_battleCsv"][carbonId] then return "不存在的carbon" end
181 - local passCarbon = role:getProperty("hangPass")  
182 local addPre 181 local addPre
183 addPre = function(carbonId) 182 addPre = function(carbonId)
184 local carbonData = csvdb["idle_battleCsv"][carbonId] 183 local carbonData = csvdb["idle_battleCsv"][carbonId]
185 for _, pre in ipairs(carbonData.prepose:toArray(true, "=")) do 184 for _, pre in ipairs(carbonData.prepose:toArray(true, "=")) do
186 - passCarbon[pre] = 1 185 + role:hangFinish(pre)
187 role:checkTaskEnter("HangPass", {id = pre}) 186 role:checkTaskEnter("HangPass", {id = pre})
188 addPre(pre) 187 addPre(pre)
189 end 188 end
190 end 189 end
191 - passCarbon[carbonId] = 1 190 + role:hangFinish(carbonId)
192 addPre(carbonId) 191 addPre(carbonId)
193 - role:updateProperty({field = "hangPass", value = passCarbon})  
194 192
195 role:log("gm_action", {desc = "fb", int1 = carbonId, key1 = pms.sender}) 193 role:log("gm_action", {desc = "fb", int1 = carbonId, key1 = pms.sender})
196 194
@@ -207,13 +205,14 @@ function _M.fbc(role, pms) -- 直接通关 @@ -207,13 +205,14 @@ function _M.fbc(role, pms) -- 直接通关
207 addPre = function(carbonId) 205 addPre = function(carbonId)
208 local carbonData = csvdb["idle_battleCsv"][carbonId] 206 local carbonData = csvdb["idle_battleCsv"][carbonId]
209 for _, pre in ipairs(carbonData.prepose:toArray(true, "=")) do 207 for _, pre in ipairs(carbonData.prepose:toArray(true, "=")) do
210 - passCarbon[pre] = 1 208 + role:hangFinish(pre)
211 role:checkTaskEnter("HangPass", {id = pre}) 209 role:checkTaskEnter("HangPass", {id = pre})
212 addPre(pre) 210 addPre(pre)
213 end 211 end
214 end 212 end
  213 + role:hangFinish(carbonId)
215 addPre(carbonId) 214 addPre(carbonId)
216 - role:updateProperty({field = "hangPass", value = passCarbon}) 215 +
217 role:checkTaskEnter("HangPass", {id = carbonId}) 216 role:checkTaskEnter("HangPass", {id = carbonId})
218 217
219 role:log("gm_action", {desc = "fbc", int1 = carbonId, key1 = pms.sender}) 218 role:log("gm_action", {desc = "fbc", int1 = carbonId, key1 = pms.sender})
@@ -359,19 +358,9 @@ function _M.adv(role, pms) @@ -359,19 +358,9 @@ function _M.adv(role, pms)
359 layer = math.min(layer, advCsv.limitlevel) 358 layer = math.min(layer, advCsv.limitlevel)
360 end 359 end
361 local advPass = role:getProperty("advPass") 360 local advPass = role:getProperty("advPass")
362 - local addPre  
363 - addPre = function(chapterId)  
364 - local advCsv = csvdb["adv_chapterCsv"][chapterId]  
365 - for pre, l in ipairs(advCsv.prepose:toNumMap()) do  
366 - if (advPass[pre] or 0) < l then  
367 - advPass[pre] = l  
368 - addPre(pre)  
369 - end  
370 - end  
371 - end 361 +
372 if (advPass[chapterId] or 0) < layer then 362 if (advPass[chapterId] or 0) < layer then
373 advPass[chapterId] = layer 363 advPass[chapterId] = layer
374 - addPre(chapterId)  
375 role:updateProperty({field = "advPass", value = advPass}) 364 role:updateProperty({field = "advPass", value = advPass})
376 end 365 end
377 role:log("gm_action", {desc = "advf", int1 = chapterId, int2 = layer, key1 = pms.sender}) 366 role:log("gm_action", {desc = "advf", int1 = chapterId, int2 = layer, key1 = pms.sender})
src/actions/HangAction.lua
@@ -75,10 +75,9 @@ function _M.startRpc( agent, data ) @@ -75,10 +75,9 @@ function _M.startRpc( agent, data )
75 if not role:isFuncUnlock(FuncUnlock.DifficultHang) then return end 75 if not role:isFuncUnlock(FuncUnlock.DifficultHang) then return end
76 end 76 end
77 77
78 - local hangPass = role:getProperty("hangPass")  
79 78
80 for _, preCarbonId in ipairs(carbonData.prepose:toArray(true, "=")) do 79 for _, preCarbonId in ipairs(carbonData.prepose:toArray(true, "=")) do
81 - if not hangPass[preCarbonId] then return 2 end 80 + if not role:checkHangPass(preCarbonId) then return 2 end
82 end 81 end
83 82
84 if checkReward(role) then 83 if checkReward(role) then
@@ -98,7 +97,7 @@ function _M.startRpc( agent, data ) @@ -98,7 +97,7 @@ function _M.startRpc( agent, data )
98 hangInfo.coinTime = math.min(nowTime, hangInfo.endCoinTime) 97 hangInfo.coinTime = math.min(nowTime, hangInfo.endCoinTime)
99 hangInfo.itemTime = math.min(nowTime, hangInfo.endItemTime) 98 hangInfo.itemTime = math.min(nowTime, hangInfo.endItemTime)
100 end 99 end
101 - if not hangPass[carbonId] then 100 + if not role:checkHangPass(carbonId) then
102 hangInfo.bossTime = nowTime + carbonData.idle_time 101 hangInfo.bossTime = nowTime + carbonData.idle_time
103 else 102 else
104 hangInfo.bossTime = nil 103 hangInfo.bossTime = nil
@@ -140,8 +139,7 @@ function _M.startBattleRpc(agent, data) @@ -140,8 +139,7 @@ function _M.startBattleRpc(agent, data)
140 end 139 end
141 end 140 end
142 141
143 - local hangPass = role:getProperty("hangPass")  
144 - if hangPass[carbonId] then 142 + if role:checkHangPass(carbonId) then
145 return 3 143 return 3
146 end 144 end
147 145
@@ -169,14 +167,13 @@ function _M.endBattleRpc(agent, data) @@ -169,14 +167,13 @@ function _M.endBattleRpc(agent, data)
169 return 3 167 return 3
170 end 168 end
171 end 169 end
172 - local hangPass = role:getProperty("hangPass")  
173 - if hangPass[carbonId] then 170 +
  171 + if role:checkHangPass(carbonId) then
174 return 4 172 return 4
175 end 173 end
176 local reward 174 local reward
177 if msg.starNum and msg.starNum > 0 then --win 175 if msg.starNum and msg.starNum > 0 then --win
178 - hangPass[carbonId] = 1  
179 - role:updateProperty({field = "hangPass", value = hangPass}) 176 + role:hangFinish(carbonId)
180 if carbonData.main ~= 1 then 177 if carbonData.main ~= 1 then
181 hangInfo.bossTime = nil 178 hangInfo.bossTime = nil
182 end 179 end
@@ -193,8 +190,9 @@ function _M.endBattleRpc(agent, data) @@ -193,8 +190,9 @@ function _M.endBattleRpc(agent, data)
193 role:checkTaskEnter("HangPass", {id = carbonId}) 190 role:checkTaskEnter("HangPass", {id = carbonId})
194 end 191 end
195 role:updateProperty({field = "hangInfo", value = hangInfo}) 192 role:updateProperty({field = "hangInfo", value = hangInfo})
196 -  
197 - role:log("hang_action", {desc = "hangBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = carbonId}) 193 +
  194 + local team = role:getProperty("pvpTC")
  195 + role:log("hang_action", {desc = "hangBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = carbonId, int2 = role:getProperty("hangTBV"), cint1 = role:getHerosCamp(team.heros)})
198 196
199 SendPacket(actionCodes.Hang_endBattleRpc, MsgPack.pack({ 197 SendPacket(actionCodes.Hang_endBattleRpc, MsgPack.pack({
200 starNum = msg.starNum, 198 starNum = msg.starNum,
@@ -439,8 +437,7 @@ function _M.startBonusBattleRpc(agent, data) @@ -439,8 +437,7 @@ function _M.startBonusBattleRpc(agent, data)
439 if not role:isTimeResetOpen(TimeReset["DailyBattle" .. bonusData.type]) then return end 437 if not role:isTimeResetOpen(TimeReset["DailyBattle" .. bonusData.type]) then return end
440 438
441 if not bonusData then return 1 end 439 if not bonusData then return 1 end
442 - local hangPass = role:getProperty("hangPass")  
443 - if not hangPass[bonusData.unlock] then return 2 end 440 + if not role:checkHangPass(bonusData.unlock) then return 2 end
444 441
445 if not next(role:getProperty("bTeam")) then return 3 end 442 if not next(role:getProperty("bTeam")) then return 3 end
446 443
src/actions/RoleAction.lua
@@ -245,8 +245,10 @@ function _M.loginRpc( agent, data ) @@ -245,8 +245,10 @@ function _M.loginRpc( agent, data )
245 -- 玩家登陆做的一些操作 245 -- 玩家登陆做的一些操作
246 role:saveHangTeam() 246 role:saveHangTeam()
247 role:savePvpCTeam() 247 role:savePvpCTeam()
  248 + role:savePvpHTeam()
248 249
249 - role:log("login", {key1 = agent.ip:toArray(false, ":")[1]}) 250 + local hangPass = role:getProperty("hangPass")
  251 + role:log("login", {key1 = agent.ip:toArray(false, ":")[1], int1 = hangPass[1] or 0})
250 252
251 return true 253 return true
252 end 254 end
@@ -784,6 +784,7 @@ function Adv:over(success, rewardRatio, overType) @@ -784,6 +784,7 @@ function Adv:over(success, rewardRatio, overType)
784 784
785 self:log({desc = "over", short1 = success and 1 or 0, int1 = overType}) 785 self:log({desc = "over", short1 = success and 1 or 0, int1 = overType})
786 786
  787 + local chapterId = self.chapterId
787 self:clear() 788 self:clear()
788 self.owner:checkTaskEnter("AdvScore", {score = score}) 789 self.owner:checkTaskEnter("AdvScore", {score = score})
789 790
@@ -792,7 +793,7 @@ function Adv:over(success, rewardRatio, overType) @@ -792,7 +793,7 @@ function Adv:over(success, rewardRatio, overType)
792 advAFGet = {}, 793 advAFGet = {},
793 advAFWear = {}, 794 advAFWear = {},
794 }) 795 })
795 - self:backEnd(success, score, scoreInfo, reward, overType, scoreReward) 796 + self:backEnd(success, score, scoreInfo, reward, overType, scoreReward, chapterId)
796 end 797 end
797 798
798 function Adv:exit() 799 function Adv:exit()
@@ -1785,8 +1786,8 @@ function Adv:backNext() @@ -1785,8 +1786,8 @@ function Adv:backNext()
1785 self:pushBackEvent(AdvBackEventType.Next, {}) 1786 self:pushBackEvent(AdvBackEventType.Next, {})
1786 end 1787 end
1787 1788
1788 -function Adv:backEnd(success, score, scoreInfo, reward, overType, scoreAward)  
1789 - self:pushBackEvent(AdvBackEventType.End, {success = success, score = score, scoreInfo = scoreInfo, reward = reward, type = overType, scoreAward = scoreAward}) 1789 +function Adv:backEnd(success, score, scoreInfo, reward, overType, scoreAward, chapterId)
  1790 + self:pushBackEvent(AdvBackEventType.End, {success = success, score = score, scoreInfo = scoreInfo, reward = reward, type = overType, scoreAward = scoreAward, chapterId = chapterId})
1790 end 1791 end
1791 1792
1792 function Adv:backBlockChange(roomId, blockId, itemChangeType) 1793 function Adv:backBlockChange(roomId, blockId, itemChangeType)
src/models/Diner.lua
@@ -28,7 +28,6 @@ function Diner:refreshDailyData(notify) @@ -28,7 +28,6 @@ function Diner:refreshDailyData(notify)
28 28
29 -- 委托 29 -- 委托
30 local entrust = self:getProperty("entrust") 30 local entrust = self:getProperty("entrust")
31 - local hangPass = self.owner:getProperty("hangPass")  
32 local entrustB = self:getProperty("entrustB") 31 local entrustB = self:getProperty("entrustB")
33 local had = {} 32 local had = {}
34 local pool = {} 33 local pool = {}
@@ -42,7 +41,7 @@ function Diner:refreshDailyData(notify) @@ -42,7 +41,7 @@ function Diner:refreshDailyData(notify)
42 -- 不填=默认刷出,1=达成前置任务,2=通关关卡 41 -- 不填=默认刷出,1=达成前置任务,2=通关关卡
43 local showC = data.show:toArray(true, "=") 42 local showC = data.show:toArray(true, "=")
44 if showC[1] == 2 then 43 if showC[1] == 2 then
45 - if not hangPass[showC[2]] then 44 + if not role:checkHangPass(showC[2]) then
46 show = false 45 show = false
47 end 46 end
48 elseif showC[1] == 1 then 47 elseif showC[1] == 1 then
@@ -301,9 +300,8 @@ end @@ -301,9 +300,8 @@ end
301 function Diner:getMaxSlots() 300 function Diner:getMaxSlots()
302 local slotCount = globalCsv.diner_sell_slots_init 301 local slotCount = globalCsv.diner_sell_slots_init
303 302
304 - local hangPass = self.owner:getProperty("hangPass")  
305 for _, carbonId in ipairs(globalCsv.diner_sell_slots_unlock) do 303 for _, carbonId in ipairs(globalCsv.diner_sell_slots_unlock) do
306 - if hangPass[carbonId] then 304 + if role:checkHangPass(carbonId) then
307 slotCount = slotCount + 1 305 slotCount = slotCount + 1
308 end 306 end
309 end 307 end
src/models/RoleCross.lua
@@ -144,19 +144,17 @@ RoleCross.bind = function (Role) @@ -144,19 +144,17 @@ RoleCross.bind = function (Role)
144 144
145 -- fb 145 -- fb
146 local carbonId = initData.fb 146 local carbonId = initData.fb
147 - local passCarbon = self:getProperty("hangPass")  
148 local addPre 147 local addPre
149 addPre = function(carbonId) 148 addPre = function(carbonId)
150 local carbonData = csvdb["idle_battleCsv"][carbonId] 149 local carbonData = csvdb["idle_battleCsv"][carbonId]
151 for _, pre in ipairs(carbonData.prepose:toArray(true, "=")) do 150 for _, pre in ipairs(carbonData.prepose:toArray(true, "=")) do
152 - passCarbon[pre] = 1 151 + self:checkHangPass(pre)
153 self:checkTaskEnter("HangPass", {id = pre}) 152 self:checkTaskEnter("HangPass", {id = pre})
154 addPre(pre) 153 addPre(pre)
155 end 154 end
156 end 155 end
157 - passCarbon[carbonId] = 1 156 + self:checkHangPass(carbonId)
158 addPre(carbonId) 157 addPre(carbonId)
159 - self:updateProperty({field = "hangPass", value = passCarbon})  
160 self:checkTaskEnter("HangPass", {id = carbonId}) 158 self:checkTaskEnter("HangPass", {id = carbonId})
161 159
162 -- talent 160 -- talent
src/models/RolePlugin.lua
@@ -845,8 +845,7 @@ function RolePlugin.bind(Role) @@ -845,8 +845,7 @@ function RolePlugin.bind(Role)
845 local data = csvdb["guide_unlockCsv"][func] 845 local data = csvdb["guide_unlockCsv"][func]
846 if not data then return true end -- 没有就是解锁了 846 if not data then return true end -- 没有就是解锁了
847 847
848 - local hangPass = self:getProperty("hangPass")  
849 - if hangPass[data.carbonId] then 848 + if self:checkHangPass(data.carbonId) then
850 return true 849 return true
851 else 850 else
852 return false 851 return false
@@ -925,9 +924,8 @@ function RolePlugin.bind(Role) @@ -925,9 +924,8 @@ function RolePlugin.bind(Role)
925 end 924 end
926 925
927 function Role:advChapterIsOpen(chapterId) 926 function Role:advChapterIsOpen(chapterId)
928 - local hangPass = self:getProperty("hangPass")  
929 local chapterData = csvdb["adv_chapterCsv"][chapterId] 927 local chapterData = csvdb["adv_chapterCsv"][chapterId]
930 - if chapterData.prepose ~= 0 and not hangPass[chapterData.prepose] then return false end 928 + if chapterData.prepose ~= 0 and not self:checkHangPass(chapterData.prepose) then return false end
931 return true 929 return true
932 end 930 end
933 931
@@ -1357,6 +1355,21 @@ function RolePlugin.bind(Role) @@ -1357,6 +1355,21 @@ function RolePlugin.bind(Role)
1357 end 1355 end
1358 end 1356 end
1359 1357
  1358 + function Role:checkHangPass(carbonId)
  1359 + local hangPass = self:getProperty("hangPass")
  1360 + local diff = math.floor(carbonId / 10000)
  1361 + return (hangPass[diff] or 0) >= carbonId
  1362 + end
  1363 +
  1364 + function Role:hangFinish(carbonId)
  1365 + local hangPass = self:getProperty("hangPass")
  1366 + local diff = math.floor(carbonId / 10000)
  1367 + if (hangPass[diff] or 0) < carbonId then
  1368 + hangPass[diff] = carbonId
  1369 + self:updateProperty({field = "hangPass", value = hangPass})
  1370 + end
  1371 + end
  1372 +
1360 function Role:getAdvRankKey() 1373 function Role:getAdvRankKey()
1361 local round = self:getProperty("advElS") 1374 local round = self:getProperty("advElS")
1362 local idx = 1 1375 local idx = 1
src/models/RoleTask.lua
@@ -486,14 +486,13 @@ function RoleTask.bind(Role) @@ -486,14 +486,13 @@ function RoleTask.bind(Role)
486 } 486 }
487 487
488 sudoku.task = sudoku.task or {} 488 sudoku.task = sudoku.task or {}
489 - local hangPass = self:getProperty("hangPass")  
490 for pause, guide_sudokuData in pairs(csvdb["guide_sudokuCsv"]) do 489 for pause, guide_sudokuData in pairs(csvdb["guide_sudokuCsv"]) do
491 if pause >= curPhase then 490 if pause >= curPhase then
492 sudoku.task[pause] = sudoku.task[pause] or {} 491 sudoku.task[pause] = sudoku.task[pause] or {}
493 for id , sudikuData in pairs(guide_sudokuData) do 492 for id , sudikuData in pairs(guide_sudokuData) do
494 local curStatus = sudoku.task[pause][id] or 0 493 local curStatus = sudoku.task[pause][id] or 0
495 494
496 - if curStatus ~= -1 and sudikuData.type == stype and (sudikuData.unlock == 0 or hangPass[sudikuData.unlock]) then 495 + if curStatus ~= -1 and sudikuData.type == stype and (sudikuData.unlock == 0 or self:checkHangPass(sudikuData.unlock)) then
497 if IsFindMax[sudikuData.type] then -- 最大值 496 if IsFindMax[sudikuData.type] then -- 最大值
498 if sudikuData.con2 == 0 or sudikuData.con2 == cond then 497 if sudikuData.con2 == 0 or sudikuData.con2 == cond then
499 if (count or 0) > curStatus then 498 if (count or 0) > curStatus then
src/services/httpweb.lua
@@ -56,6 +56,10 @@ local function start() @@ -56,6 +56,10 @@ local function start()
56 redisd = skynet.localname(".redis") 56 redisd = skynet.localname(".redis")
57 globalCsv = csvdb["GlobalDefineCsv"] 57 globalCsv = csvdb["GlobalDefineCsv"]
58 58
  59 + if tonumber(skynet.getenv "logd") == 1 then
  60 + logd = skynet.localname(".log")
  61 + end
  62 +
59 local listen_socket = socket.listen("0.0.0.0", port) 63 local listen_socket = socket.listen("0.0.0.0", port)
60 print("Listen web port " .. port) 64 print("Listen web port " .. port)
61 socket.start(listen_socket , function(id, addr) 65 socket.start(listen_socket , function(id, addr)