Commit 46fff3ffe6e4e0d89ad6cc1042891a95ae046b01
1 parent
27cc6f23
冒险手册
Showing
3 changed files
with
11 additions
and
6 deletions
Show diff stats
src/adv/AdvTask.lua
@@ -226,11 +226,13 @@ function AdvTask.bind(Adv) | @@ -226,11 +226,13 @@ function AdvTask.bind(Adv) | ||
226 | local advAchievChange = {} | 226 | local advAchievChange = {} |
227 | 227 | ||
228 | local function insertChange(chapterId, taskId, value) | 228 | local function insertChange(chapterId, taskId, value) |
229 | - table.insert(advAchievChange, {type = "advAchiev", field = {chapterId, taskId}, value = value}) | 229 | + local achievField = AdvCommon.isEndless(chapterId) and "advEAchiev" or "advAchiev" |
230 | + table.insert(advAchievChange, {type = achievField, field = {chapterId, taskId}, value = value}) | ||
230 | end | 231 | end |
231 | 232 | ||
232 | function Adv:checkAchievement(taskType, count, cond, cond2) | 233 | function Adv:checkAchievement(taskType, count, cond, cond2) |
233 | - local advAchiev = self.owner:getProperty("advAchiev")[self.chapterId] or {} | 234 | + local achievField = self:isEndless() and "advEAchiev" or "advAchiev" |
235 | + local advAchiev = self.owner:getProperty(achievField)[self.chapterId] or {} | ||
234 | for taskId , data in pairs(csvdb["adv_achievementCsv"][self.chapterId] or {}) do | 236 | for taskId , data in pairs(csvdb["adv_achievementCsv"][self.chapterId] or {}) do |
235 | local oldStatus = advAchiev[taskId] or 0 | 237 | local oldStatus = advAchiev[taskId] or 0 |
236 | if oldStatus ~= -1 and data.type == taskType then | 238 | if oldStatus ~= -1 and data.type == taskType then |
@@ -306,7 +308,7 @@ function AdvTask.bind(Adv) | @@ -306,7 +308,7 @@ function AdvTask.bind(Adv) | ||
306 | if status and status ~= oldStatus then | 308 | if status and status ~= oldStatus then |
307 | insertChange(self.chapterId, taskId, status) | 309 | insertChange(self.chapterId, taskId, status) |
308 | if status == -1 then | 310 | if status == -1 then |
309 | - local ptcount = (self.owner:getProperty("advAchiev")[self.chapterId] or {})[-1] or 0 | 311 | + local ptcount = (self.owner:getProperty(achievField)[self.chapterId] or {})[-1] or 0 |
310 | ptcount = ptcount + data.pt | 312 | ptcount = ptcount + data.pt |
311 | insertChange(self.chapterId, -1, ptcount) | 313 | insertChange(self.chapterId, -1, ptcount) |
312 | end | 314 | end |
@@ -331,9 +333,10 @@ function AdvTask.bind(Adv) | @@ -331,9 +333,10 @@ function AdvTask.bind(Adv) | ||
331 | -- end | 333 | -- end |
332 | 334 | ||
333 | function Adv:getAchievementReward(chapterId, taskId) | 335 | function Adv:getAchievementReward(chapterId, taskId) |
334 | - local count = (self.owner:getProperty("advAchiev")[chapterId] or {})[-1] or 0 | 336 | + local achievField = AdvCommon.isEndless(chapterId) and "advEAchiev" or "advAchiev" |
337 | + local count = (self.owner:getProperty(achievField)[chapterId] or {})[-1] or 0 | ||
335 | local achievData = (csvdb["adv_achievement_rewardCsv"][chapterId] or {})[taskId] | 338 | local achievData = (csvdb["adv_achievement_rewardCsv"][chapterId] or {})[taskId] |
336 | - local status = ((self.owner:getProperty("advAchiev")[chapterId] or {})["pts"] or {})[taskId] or 0 | 339 | + local status = ((self.owner:getProperty(achievField)[chapterId] or {})["pts"] or {})[taskId] or 0 |
337 | if status == -1 or count < achievData.pt then return end | 340 | if status == -1 or count < achievData.pt then return end |
338 | 341 | ||
339 | local reward = self.owner:award(achievData.reward) | 342 | local reward = self.owner:award(achievData.reward) |
src/models/Role.lua
@@ -71,6 +71,7 @@ Role.schema = { | @@ -71,6 +71,7 @@ Role.schema = { | ||
71 | advDrawB = {"table", {}}, -- 冒险抽奖回馈 {[1] = 0, [2] = 100} -- 池子类型 = 点数 | 71 | advDrawB = {"table", {}}, -- 冒险抽奖回馈 {[1] = 0, [2] = 100} -- 池子类型 = 点数 |
72 | advStoryB = {"table", {}}, -- 冒险故事完成记录 (连锁事件绑定的故事) -- {storyId = 1} | 72 | advStoryB = {"table", {}}, -- 冒险故事完成记录 (连锁事件绑定的故事) -- {storyId = 1} |
73 | advShop = {"table", {}}, -- 冒险內的商店限制购买次数记录 {goodId = count} | 73 | advShop = {"table", {}}, -- 冒险內的商店限制购买次数记录 {goodId = count} |
74 | + advEAchiev = {"table", {}}, -- 冒险无尽冒险手册 | ||
74 | 75 | ||
75 | --挂机相关 | 76 | --挂机相关 |
76 | hangPass = {"table", {}}, -- 挂机通过的最大关卡 | 77 | hangPass = {"table", {}}, -- 挂机通过的最大关卡 |
@@ -253,6 +254,7 @@ function Role:data() | @@ -253,6 +254,7 @@ function Role:data() | ||
253 | advAFWear = self:getProperty("advAFWear"), | 254 | advAFWear = self:getProperty("advAFWear"), |
254 | advDrawB = self:getProperty("advDrawB"), | 255 | advDrawB = self:getProperty("advDrawB"), |
255 | advShop = self:getProperty("advShop"), | 256 | advShop = self:getProperty("advShop"), |
257 | + advEAchiev = self:getProperty("advEAchiev"), | ||
256 | 258 | ||
257 | hangPass = self:getProperty("hangPass"), | 259 | hangPass = self:getProperty("hangPass"), |
258 | hangTeam = self:getProperty("hangTeam"), | 260 | hangTeam = self:getProperty("hangTeam"), |