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