Commit e51ff6d2433dff84bce0c2467168b27ce9be2e15

Authored by zhouhaihai
1 parent e31439db

冒险~

src/actions/AdvAction.lua
... ... @@ -104,21 +104,24 @@ function _M.startAdvRpc( agent, data )
104 104 if not role:isFuncOpen(FuncOpenType.AdvEndless) then return 11 end -- 无尽模式 才可以玩儿无尽模式
105 105  
106 106 local advElM = role:getProperty("advElM") --最高通关的层数
  107 + if not role:advChapterIsOpen(chapterId) then return 13 end
107 108  
108   - if layer == 1 then
109   - if not role:advChapterIsOpen(chapterId, layer) then return 13 end
110   - else
  109 + if layer ~= 1 then
111 110 local relayData = role:getAdvData():isHaveRelay(layer, chapterId)
112   - if not relayData then return end -- 不是中继层
113   - if advElM < relayData.unlockfloor then return end --未解锁
  111 + if not relayData then return 14 end -- 不是中继层
  112 + if advElM < relayData.unlockfloor then return 15 end --未解锁
114 113 end
115 114 else -- 普通模式判断
116 115 if role.dailyData:getProperty("advC") >= role:getAdvHangLimit() then return 2 end -- 是否有体力
117   - if layer > chapterData.limitlevel then return 4 end
  116 + if layer >= chapterData.limitlevel then return 4 end
118 117 -- 关卡开放判断
119   - if not role:advChapterIsOpen(chapterId, layer) then return 5 end
120   - -- 普通模式没有中继 只能从1 开始 中继开放判断
121   - if layer ~= 1 then return 6 end
  118 + if not role:advChapterIsOpen(chapterId) then return 5 end
  119 +
  120 + if layer ~= 1 then
  121 + local relayData = role:getAdvData():isHaveRelay(layer, chapterId)
  122 + if not relayData then return 6 end -- 不是中继层
  123 + if (advPass[chapterId] or 0) < relayData.floor then return 21 end
  124 + end
122 125 end
123 126  
124 127 if not checkFormat(role, format) then return 7 end
... ...
src/adv/Adv.lua
... ... @@ -99,9 +99,9 @@ function Adv:initByChapter(chapterId, level, isToNext, notNotify, isRelay, isEnt
99 99 end
100 100  
101 101 -- 随机出地图
102   - local mapId
  102 + local mapId, relayData
103 103 if isRelay then
104   - local relayData = self:isHaveRelay(level, chapterId)
  104 + relayData = self:isHaveRelay(level, chapterId)
105 105 if relayData then
106 106 mapId = relayData.map
107 107 else
... ... @@ -112,10 +112,6 @@ function Adv:initByChapter(chapterId, level, isToNext, notNotify, isRelay, isEnt
112 112 mapId = self:randomMapId(chapterId, level)
113 113 end
114 114  
115   - if isEnter and not self.owner:checkOverGuide(GuideStep.AdvGuide) then
116   - mapId = 101
117   - end
118   -
119 115 self.isRelay = isRelay
120 116 local isNewRelay = false
121 117 if self.isRelay then -- 中继层
... ... @@ -141,9 +137,16 @@ function Adv:initByChapter(chapterId, level, isToNext, notNotify, isRelay, isEnt
141 137  
142 138 self:checkTask(Adv.TaskType.Arrive)
143 139 self:checkAdvUnlock(1, self.level)
  140 +
144 141 if isToNext then
145 142 self.battle.player:afterLayer() -- 玩家的buff 清理一下
146 143 end
  144 +
  145 + -- 中继进入奖励
  146 + if relayData then
  147 + self:awardRelay(relayData, notNotify)
  148 + end
  149 +
147 150 if not notNotify then
148 151 self:saveDB(notNotify)
149 152 end
... ... @@ -201,6 +204,44 @@ function Adv:saveDB(notNotify)
201 204 self.owner:updateProperties({advInfo = advInfo, advTeam = advTeam}, notNotify)
202 205 end
203 206  
  207 +function Adv:awardRelay(relayData, notNotify)
  208 + local gift = {}
  209 +
  210 + if relayData.artifact > 0 then
  211 + local pool = {}
  212 + for id, temp in pairs(csvdb["adv_artifactCsv"]) do
  213 + if not self:isHaveArtifact(id) and self.owner:isArtifactOpen(id, self:isEndless()) then
  214 + table.insert(pool, id)
  215 + end
  216 + end
  217 + for i = 1, math.min(relayData.artifact, #pool) do
  218 + local idx = math.randomInt(1, #pool)
  219 + gift[pool[idx]] = 1
  220 + table.remove(pool, idx)
  221 + end
  222 + end
  223 +
  224 + if relayData.point > 0 then
  225 + gift[ItemId.AdvPoint] = relayData.point
  226 + end
  227 +
  228 + if relayData.otherAward ~= "" then
  229 + for dropId, count in pairs(relayData.otherAward:toNumMap()) do
  230 + for i = 1, count do
  231 + local dropData = csvdb["event_dropCsv"][dropId]
  232 + if dropData then
  233 + local item = dropData["range"]:randWeight(true)
  234 + gift[item[1]] = (gift[item[1]] or 0) + item[2]
  235 + else
  236 + skynet.error(string.format("[ERROR]: event_dropCsv no id %s, adv_chapter_campsite", dropId))
  237 + end
  238 + end
  239 + end
  240 + end
  241 +
  242 + self:award(gift, {notNotify = notNotify, log = {desc = "relayEnter", int1 = self.chapterId, int2 = self.level}})
  243 +end
  244 +
204 245 function Adv:initSupport(supports)
205 246 self.support = {}
206 247  
... ... @@ -921,7 +962,7 @@ local function clickOut(self, room, block, params, isExit)
921 962 self:scoreChange(AdvScoreType.Level, curFloorData.advScore) --增加层级加分
922 963 end
923 964  
924   - if not self:isEndless() and (self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel or not self.owner:advChapterIsOpen(self.chapterId, self.level + 1)) then --关卡结束
  965 + if not self:isEndless() and (self.level >= csvdb["adv_chapterCsv"][self.chapterId].limitlevel) then --关卡结束
925 966 self:over(true)
926 967 else
927 968 self.battle.player:triggerPassive(Passive.DOWN_LAYER)
... ...
src/adv/AdvMap.lua
... ... @@ -291,15 +291,12 @@ createMap = function(self, mapId, isEnter, isNewRelay)
291 291 --入口
292 292 randomFunc[AdvEventType.In] = function()end
293 293 --出口
294   - randomFunc[AdvEventType.Out] = function()
295   - if not self.adv:isEndless() and self.adv.isRelay and not self.adv.owner:checkOverGuide(GuideStep.AdvRelay) then
296   - return false
297   - end
298   - end
299   - --中继点出口
300   - randomFunc[AdvEventType.Exit] = function()
301   - if not self.adv.isRelay or self.adv.owner:checkOverGuide(GuideStep.AdvRelay) then return false end
302   - end
  294 + randomFunc[AdvEventType.Out] = function()end
  295 + -- --中继点出口
  296 + -- randomFunc[AdvEventType.Exit] = function()
  297 + -- -- if not self.adv.isRelay or self.adv.owner:checkOverGuide(GuideStep.AdvRelay) then return false end
  298 + -- return false
  299 + -- end
303 300 --开放出口
304 301 randomFunc[AdvEventType.InOut] = function() end
305 302  
... ...
src/models/Role.lua
... ... @@ -4,7 +4,6 @@ local RoleLog = import(&quot;.RoleLog&quot;) --日志相关
4 4 local RolePlugin = import(".RolePlugin") --基础功能
5 5 local RoleTimeReset = import(".RoleTimeReset") --时间重置相关
6 6 local RoleTask = import(".RoleTask") --角色任务
7   -local RoleActivity = import(".RoleActivity") --活动相关
8 7 local RoleChangeStruct = import(".RoleChangeStruct") --角色数据额结构更改
9 8 local RolePvp = import(".RolePvp") -- pvp
10 9 local RoleCross = import(".RoleCross") -- 跨服务请求相关
... ... @@ -13,7 +12,6 @@ RoleLog.bind(Role)
13 12 RolePlugin.bind(Role)
14 13 RoleTimeReset.bind(Role)
15 14 RoleTask.bind(Role)
16   -RoleActivity.bind(Role)
17 15 RoleChangeStruct.bind(Role)
18 16 RolePvp.bind(Role)
19 17 RoleCross.bind(Role)
... ...
src/models/RoleActivity.lua
  1 +local Activity = class("Activity", require("shared.ModelBase"))
1 2  
2 3  
3   -local RoleActivity = {}
  4 +Activity.ActivityType = {
4 5  
5   -function RoleActivity.bind(Role)
  6 +}
6 7  
  8 +local function checkActivityType(activityType)
  9 + if type(activityType) == "string" then
  10 + activityType = Activity.ActivityType[activityType]
  11 + end
  12 + return activityType
  13 +end
  14 +
  15 +
  16 +function Activity:ctor(properties)
  17 + Activity.super.ctor(self, properties)
  18 +
  19 + self.open = {}
  20 +
  21 +end
7 22  
8 23  
  24 +Activity.schema = {
  25 + _1 = {"table", {}},
  26 +}
9 27  
  28 +function Activity:data()
  29 + return {
  30 + _1 = self:getProperty("_1"),
  31 + }
10 32 end
11 33  
12   -return RoleActivity
13 34 \ No newline at end of file
  35 +
  36 +
  37 +return Activity
14 38 \ No newline at end of file
... ...
src/models/RolePlugin.lua
... ... @@ -924,22 +924,11 @@ function RolePlugin.bind(Role)
924 924 end
925 925 end
926 926  
927   - function Role:advChapterIsOpen(chapterId, layer)
928   - layer = layer or 1
929   - local exlayer = math.floor((layer - 1) / 10) * 10 + 1
930   - if exlayer == 1 then --第一层判断前置
931   - local hangPass = self:getProperty("hangPass")
932   - local chapterData = csvdb["adv_chapterCsv"][chapterId]
933   - if chapterData.prepose ~= 0 and not hangPass[chapterData.prepose] then return false end
934   - return true
935   - end
936   -
937   - local unlock = {}
938   - for func , data in pairs(csvdb["unlockCsv"]) do
939   - if data.type == 1 and chapterId == data.value1 and exlayer == data.value2 then
940   - return self:isFuncOpen(func)
941   - end
942   - end
  927 + function Role:advChapterIsOpen(chapterId)
  928 + local hangPass = self:getProperty("hangPass")
  929 + local chapterData = csvdb["adv_chapterCsv"][chapterId]
  930 + if chapterData.prepose ~= 0 and not hangPass[chapterData.prepose] then return false end
  931 + return true
943 932 end
944 933  
945 934 function Role:advEventOpenStatus()
... ...