diff --git a/src/actions/AdvAction.lua b/src/actions/AdvAction.lua index 00e9c48..2e3cc10 100644 --- a/src/actions/AdvAction.lua +++ b/src/actions/AdvAction.lua @@ -104,21 +104,24 @@ function _M.startAdvRpc( agent, data ) if not role:isFuncOpen(FuncOpenType.AdvEndless) then return 11 end -- 无尽模式 才可以玩儿无尽模式 local advElM = role:getProperty("advElM") --最高通关的层数 + if not role:advChapterIsOpen(chapterId) then return 13 end - if layer == 1 then - if not role:advChapterIsOpen(chapterId, layer) then return 13 end - else + if layer ~= 1 then local relayData = role:getAdvData():isHaveRelay(layer, chapterId) - if not relayData then return end -- 不是中继层 - if advElM < relayData.unlockfloor then return end --未解锁 + if not relayData then return 14 end -- 不是中继层 + if advElM < relayData.unlockfloor then return 15 end --未解锁 end else -- 普通模式判断 if role.dailyData:getProperty("advC") >= role:getAdvHangLimit() then return 2 end -- 是否有体力 - if layer > chapterData.limitlevel then return 4 end + if layer >= chapterData.limitlevel then return 4 end -- 关卡开放判断 - if not role:advChapterIsOpen(chapterId, layer) then return 5 end - -- 普通模式没有中继 只能从1 开始 中继开放判断 - if layer ~= 1 then return 6 end + if not role:advChapterIsOpen(chapterId) then return 5 end + + if layer ~= 1 then + local relayData = role:getAdvData():isHaveRelay(layer, chapterId) + if not relayData then return 6 end -- 不是中继层 + if (advPass[chapterId] or 0) < relayData.floor then return 21 end + end end if not checkFormat(role, format) then return 7 end diff --git a/src/adv/Adv.lua b/src/adv/Adv.lua index f187a26..b32c386 100644 --- a/src/adv/Adv.lua +++ b/src/adv/Adv.lua @@ -99,9 +99,9 @@ function Adv:initByChapter(chapterId, level, isToNext, notNotify, isRelay, isEnt end -- 随机出地图 - local mapId + local mapId, relayData if isRelay then - local relayData = self:isHaveRelay(level, chapterId) + relayData = self:isHaveRelay(level, chapterId) if relayData then mapId = relayData.map else @@ -112,10 +112,6 @@ function Adv:initByChapter(chapterId, level, isToNext, notNotify, isRelay, isEnt mapId = self:randomMapId(chapterId, level) end - if isEnter and not self.owner:checkOverGuide(GuideStep.AdvGuide) then - mapId = 101 - end - self.isRelay = isRelay local isNewRelay = false if self.isRelay then -- 中继层 @@ -141,9 +137,16 @@ function Adv:initByChapter(chapterId, level, isToNext, notNotify, isRelay, isEnt self:checkTask(Adv.TaskType.Arrive) self:checkAdvUnlock(1, self.level) + if isToNext then self.battle.player:afterLayer() -- 玩家的buff 清理一下 end + + -- 中继进入奖励 + if relayData then + self:awardRelay(relayData, notNotify) + end + if not notNotify then self:saveDB(notNotify) end @@ -201,6 +204,44 @@ function Adv:saveDB(notNotify) self.owner:updateProperties({advInfo = advInfo, advTeam = advTeam}, notNotify) end +function Adv:awardRelay(relayData, notNotify) + local gift = {} + + if relayData.artifact > 0 then + local pool = {} + for id, temp in pairs(csvdb["adv_artifactCsv"]) do + if not self:isHaveArtifact(id) and self.owner:isArtifactOpen(id, self:isEndless()) then + table.insert(pool, id) + end + end + for i = 1, math.min(relayData.artifact, #pool) do + local idx = math.randomInt(1, #pool) + gift[pool[idx]] = 1 + table.remove(pool, idx) + end + end + + if relayData.point > 0 then + gift[ItemId.AdvPoint] = relayData.point + end + + if relayData.otherAward ~= "" then + for dropId, count in pairs(relayData.otherAward:toNumMap()) do + for i = 1, count do + local dropData = csvdb["event_dropCsv"][dropId] + if dropData then + local item = dropData["range"]:randWeight(true) + gift[item[1]] = (gift[item[1]] or 0) + item[2] + else + skynet.error(string.format("[ERROR]: event_dropCsv no id %s, adv_chapter_campsite", dropId)) + end + end + end + end + + self:award(gift, {notNotify = notNotify, log = {desc = "relayEnter", int1 = self.chapterId, int2 = self.level}}) +end + function Adv:initSupport(supports) self.support = {} @@ -921,7 +962,7 @@ local function clickOut(self, room, block, params, isExit) self:scoreChange(AdvScoreType.Level, curFloorData.advScore) --增加层级加分 end - if not self:isEndless() and (self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel or not self.owner:advChapterIsOpen(self.chapterId, self.level + 1)) then --关卡结束 + if not self:isEndless() and (self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel) then --关卡结束 self:over(true) else self.battle.player:triggerPassive(Passive.DOWN_LAYER) diff --git a/src/adv/AdvMap.lua b/src/adv/AdvMap.lua index 6d99d08..eae9976 100644 --- a/src/adv/AdvMap.lua +++ b/src/adv/AdvMap.lua @@ -291,15 +291,12 @@ createMap = function(self, mapId, isEnter, isNewRelay) --入口 randomFunc[AdvEventType.In] = function()end --出口 - randomFunc[AdvEventType.Out] = function() - if not self.adv:isEndless() and self.adv.isRelay and not self.adv.owner:checkOverGuide(GuideStep.AdvRelay) then - return false - end - end - --中继点出口 - randomFunc[AdvEventType.Exit] = function() - if not self.adv.isRelay or self.adv.owner:checkOverGuide(GuideStep.AdvRelay) then return false end - end + randomFunc[AdvEventType.Out] = function()end + -- --中继点出口 + -- randomFunc[AdvEventType.Exit] = function() + -- -- if not self.adv.isRelay or self.adv.owner:checkOverGuide(GuideStep.AdvRelay) then return false end + -- return false + -- end --开放出口 randomFunc[AdvEventType.InOut] = function() end diff --git a/src/models/Role.lua b/src/models/Role.lua index 5873fe1..d2259f6 100644 --- a/src/models/Role.lua +++ b/src/models/Role.lua @@ -4,7 +4,6 @@ local RoleLog = import(".RoleLog") --日志相关 local RolePlugin = import(".RolePlugin") --基础功能 local RoleTimeReset = import(".RoleTimeReset") --时间重置相关 local RoleTask = import(".RoleTask") --角色任务 -local RoleActivity = import(".RoleActivity") --活动相关 local RoleChangeStruct = import(".RoleChangeStruct") --角色数据额结构更改 local RolePvp = import(".RolePvp") -- pvp local RoleCross = import(".RoleCross") -- 跨服务请求相关 @@ -13,7 +12,6 @@ RoleLog.bind(Role) RolePlugin.bind(Role) RoleTimeReset.bind(Role) RoleTask.bind(Role) -RoleActivity.bind(Role) RoleChangeStruct.bind(Role) RolePvp.bind(Role) RoleCross.bind(Role) diff --git a/src/models/RoleActivity.lua b/src/models/RoleActivity.lua index 36b520b..b70207f 100644 --- a/src/models/RoleActivity.lua +++ b/src/models/RoleActivity.lua @@ -1,12 +1,36 @@ +local Activity = class("Activity", require("shared.ModelBase")) -local RoleActivity = {} +Activity.ActivityType = { -function RoleActivity.bind(Role) +} +local function checkActivityType(activityType) + if type(activityType) == "string" then + activityType = Activity.ActivityType[activityType] + end + return activityType +end + + +function Activity:ctor(properties) + Activity.super.ctor(self, properties) + + self.open = {} + +end +Activity.schema = { + _1 = {"table", {}}, +} +function Activity:data() + return { + _1 = self:getProperty("_1"), + } end -return RoleActivity \ No newline at end of file + + +return Activity \ No newline at end of file diff --git a/src/models/RolePlugin.lua b/src/models/RolePlugin.lua index bcae830..24b575f 100644 --- a/src/models/RolePlugin.lua +++ b/src/models/RolePlugin.lua @@ -924,22 +924,11 @@ function RolePlugin.bind(Role) end end - function Role:advChapterIsOpen(chapterId, layer) - layer = layer or 1 - local exlayer = math.floor((layer - 1) / 10) * 10 + 1 - if exlayer == 1 then --第一层判断前置 - local hangPass = self:getProperty("hangPass") - local chapterData = csvdb["adv_chapterCsv"][chapterId] - if chapterData.prepose ~= 0 and not hangPass[chapterData.prepose] then return false end - return true - end - - local unlock = {} - for func , data in pairs(csvdb["unlockCsv"]) do - if data.type == 1 and chapterId == data.value1 and exlayer == data.value2 then - return self:isFuncOpen(func) - end - end + function Role:advChapterIsOpen(chapterId) + local hangPass = self:getProperty("hangPass") + local chapterData = csvdb["adv_chapterCsv"][chapterId] + if chapterData.prepose ~= 0 and not hangPass[chapterData.prepose] then return false end + return true end function Role:advEventOpenStatus() -- libgit2 0.21.2