diff --git a/src/actions/AdvAction.lua b/src/actions/AdvAction.lua index 73583e6..a5428a8 100644 --- a/src/actions/AdvAction.lua +++ b/src/actions/AdvAction.lua @@ -59,20 +59,9 @@ function _M.startAdvRpc( agent, data ) if not chapterData then return 1 end if role.dailyData:getProperty("advC") >= role:getAdvHangLimit() then return 2 end -- 是否有体力 - - local oklayer = false --层是否合法 - if layer ~= 1 then - for _, exLayer in ipairs(globalCsv.adv_can_out_layer) do - if exLayer + 1 == layer then - oklayer = true - break - end - end - else - oklayer = true - end - - if not oklayer then return 3 end + + if (layer - 1) % globalCsv.adv_can_out_layer_pre ~= 0 then return 3 end + if layer > chapterData.limitlevel then return 4 end -- 关卡开放判断 diff --git a/src/actions/GmAction.lua b/src/actions/GmAction.lua index 5df66fb..8aba657 100644 --- a/src/actions/GmAction.lua +++ b/src/actions/GmAction.lua @@ -202,6 +202,29 @@ function _M.adv(role, pms) return "成功" end +function _M.advt(role, pms) + local chapterId = tonum(pms.pm1) + local layer = tonum(pms.pm2) + local advData = csvdb["adv_chapterCsv"][chapterId] + if not advData then return "不存在的章节" end + layer = math.min(layer, advData.limitlevel) + local advData = role:getAdvData() + + if not advData.chapterId then + return "先随便开启一关" + end + + _M.adv(role, {pm1 = chapterId, pm2 = layer - 1}) + + + advData.chapterId = chapterId + advData.level = layer + + advData:saveDB() + + return "成功" +end + function _M.idlec(role, pms) role:updateProperty({field = "hangTeam", value = {}}) role:updateProperty({field = "hangInfo", value = {}}) diff --git a/src/adv/Adv.lua b/src/adv/Adv.lua index fcb9ef6..6845d53 100644 --- a/src/adv/Adv.lua +++ b/src/adv/Adv.lua @@ -269,18 +269,12 @@ local function clickOut(self, room, block, params) else --处于底层 local advPass = self.owner:getProperty("advPass") + if self.level > (advPass[self.chapterId] or 0) then self.owner:changeUpdates({{type = "advPass", field = self.chapterId, value = self.level}}) end if params.relay then - local ok = false - for _, exLayer in ipairs(globalCsv.adv_can_out_layer) do - if exLayer == self.level then - ok = true - break - end - end - if not ok then return end + if self.level % globalCsv.adv_can_out_layer_pre ~= 0 or not self.owner:isFuncOpen(FuncOpenType.AdvRelay) then return end end if params.relay or self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel or not self.owner:advChapterIsOpen(self.chapterId, self.level + 1) then --关卡结束 self:over(true) diff --git a/src/adv/AdvBattle.lua b/src/adv/AdvBattle.lua index 045ff34..a9ea0bd 100644 --- a/src/adv/AdvBattle.lua +++ b/src/adv/AdvBattle.lua @@ -57,7 +57,7 @@ function Battle:initPlayer() player.exp = 0 player.sp = 100 local activeRelation = self.adv.owner:getHeroActiveRelation() - local baseAttr = csvdb["adv_unitCsv"][math.floor(self.adv.chapterId / 100)] + local baseAttr = csvdb["adv_unitCsv"][self.adv.chapterId] for _, attr in pairs(AttsEnumEx) do if baseAttr[attr] then player[attr] = baseAttr[attr] + baseAttr[attr] * player.growth * (player.level - 1) diff --git a/src/adv/AdvMap.lua b/src/adv/AdvMap.lua index 51c123b..e8c65a9 100644 --- a/src/adv/AdvMap.lua +++ b/src/adv/AdvMap.lua @@ -334,7 +334,6 @@ end --关卡事件库 getEventLib = function(self, needEventType) -- needEventType 需要的事件 local chapterId, level = self.adv.chapterId, self.adv.level - local chapter = math.floor(chapterId / 100) % 100 local libsToType = { ["event_monsterCsv"] = {AdvEventType.Monster, AdvEventType.BOSS, AdvEventType.Monster}, @@ -365,7 +364,7 @@ getEventLib = function(self, needEventType) -- needEventType 需要的事件 for id, data in pairs(csvdb[lib]) do local etype = type(eventType) == "table" and eventType[data.type] or eventType - if data.levelchapter == chapter and (data.unlockType == 0 or (advEventOpenStatus[etype] or {})[data.unlockType]) then + if data.levelchapter == chapterId and (data.unlockType == 0 or (advEventOpenStatus[etype] or {})[data.unlockType]) then if AdvCommon.checkIsIn(level, data.leveltype, data.levellimit) then eventLib[etype][data.BlockEventType] = eventLib[etype][data.BlockEventType] or {} eventLib[etype][data.BlockEventType][id] = {showup = data.showup, limit = data.limit} diff --git a/src/adv/AdvTask.lua b/src/adv/AdvTask.lua index 0329e3d..e2309c9 100644 --- a/src/adv/AdvTask.lua +++ b/src/adv/AdvTask.lua @@ -71,7 +71,7 @@ function AdvTask.bind(Adv) self.advMTask.id = self.advMTask.id or 1 local mainTaskData = csvdb["adv_questCsv"][self.advMTask.id] if mainTaskData and self.advMTask.lock then - if math.floor(self.chapterId / 100) % 100 == mainTaskData.chapter and self.level >= mainTaskData.level then --到达指定关卡解锁当前任务 + if self.chapterId == mainTaskData.chapter and self.level >= mainTaskData.level then --到达指定关卡解锁当前任务 self.advMTask.lock = nil self.advMTask.status = 0 local ts = checkTaskStatus(self, mainTaskData, self.advMTask.status, 0) @@ -84,7 +84,7 @@ function AdvTask.bind(Adv) end function Adv:checkTask(taskType, count, cond) - local chapter = math.floor(self.chapterId / 100) % 100 + local chapter = self.chapterId for taskId, status in pairs(self.advTask) do local taskData = csvdb["event_questCsv"][taskId] if taskData and taskData.levelchapter == chapter and taskType == taskData.condition then @@ -149,7 +149,7 @@ function AdvTask.bind(Adv) self.advMTask.id = self.advMTask.id + 1 self.advMTask.status = 0 local nextTaskData = csvdb["adv_questCsv"][self.advMTask.id] - if not nextTaskData or math.floor(self.chapterId / 100) % 100 ~= nextTaskData.chapter or self.level < nextTaskData.level then + if not nextTaskData or self.chapterId ~= nextTaskData.chapter or self.level < nextTaskData.level then self.advMTask.lock = true else local ts = checkTaskStatus(self, nextTaskData, self.advMTask.status, 0) diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index 052c7fe..dc07423 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -606,7 +606,6 @@ function RolePlugin.bind(Role) end function Role:advChapterIsOpen(chapterId, layer) - local chapter = math.floor(chapterId / 100) % 100 local exlayer = math.floor((layer - 1) / 10) * 10 + 1 if exlayer == 1 then --第一层判断前置 @@ -620,7 +619,7 @@ function RolePlugin.bind(Role) local unlock = {} for func , data in pairs(csvdb["unlockCsv"]) do - if data.type == 1 and chapter == data.value1 and exlayer == data.value2 then + if data.type == 1 and chapterId == data.value1 and exlayer == data.value2 then return self:isFuncOpen(func) end end -- libgit2 0.21.2