Commit be4e8031d77ccd09b4d260a91761cfe65e55d9a9
1 parent
ea40710f
活动 拾荒
Showing
5 changed files
with
28 additions
and
24 deletions
Show diff stats
src/actions/ActivityAction.lua
... | ... | @@ -135,11 +135,11 @@ end |
135 | 135 | |
136 | 136 | function _M.actSignRpc(agent, data) |
137 | 137 | local role = agent.role |
138 | - if not role.activity:isOpen("Sign") then return end | |
138 | + if not role.activity:isOpen("Sign") then return 1 end | |
139 | 139 | |
140 | 140 | local curData = role.activity:getActData("Sign") |
141 | 141 | local reward = {} |
142 | - for day, csvData in ipairs(csvdb["new_signlnCsv"]) do | |
142 | + for day, csvData in ipairs(csvdb["new_signInCsv"]) do | |
143 | 143 | if day <= (curData[0] or 0) then |
144 | 144 | if not curData[day] then |
145 | 145 | curData[day] = -1 |
... | ... | @@ -153,8 +153,8 @@ function _M.actSignRpc(agent, data) |
153 | 153 | end |
154 | 154 | end |
155 | 155 | if next(reward) then |
156 | - self.activity:updateActData("Sign", curData) | |
157 | - reward = role:award(reward, {log = "actSign"}) | |
156 | + role.activity:updateActData("Sign", curData) | |
157 | + reward = role:award(reward, {log = {desc = "actSign"}}) | |
158 | 158 | end |
159 | 159 | SendPacket(actionCodes.Activity_actSignRpc, MsgPack.pack(reward)) |
160 | 160 | return true | ... | ... |
src/actions/AdvAction.lua
... | ... | @@ -197,7 +197,7 @@ function _M.startHangRpc(agent, data) |
197 | 197 | |
198 | 198 | if AdvCommon.isEndless(chapterId) then return end -- 无尽没有代理 |
199 | 199 | |
200 | - local advRelay = self.owner:getProperty("advRelay") | |
200 | + local advRelay = role:getProperty("advRelay") | |
201 | 201 | if not next(advRelay[chapterId] or {}) then return end -- 没有开放 |
202 | 202 | |
203 | 203 | |
... | ... | @@ -212,7 +212,6 @@ function _M.startHangRpc(agent, data) |
212 | 212 | player[attrName] = (player[attrName] or 0) + hero[attrName] |
213 | 213 | end |
214 | 214 | player[attrName] = player[attrName] * (globalCsv.adv_battle_attr_ratio[attrName] or 1) |
215 | - player.growth[attrName] = player[attrName] * (globalCsv.adv_battle_attr_growth_ratio[attrName] or 1) | |
216 | 215 | end |
217 | 216 | |
218 | 217 | local battleV = 1 * player["hp"] |
... | ... | @@ -296,9 +295,12 @@ function _M.endHangRpc(agent, data) |
296 | 295 | -- 英雄加成 |
297 | 296 | local idleUnit = chapterData.idleUnit:toNumMap() |
298 | 297 | local upUnit = 0 |
299 | - for slot, heroId in pairs(info.format or {}) do | |
300 | - if idleUnit[heroId] then | |
301 | - upUnit = upUnit + idleUnit[heroId] | |
298 | + for slot, heroId in pairs((info.format or {}).heros or {}) do | |
299 | + local hero = role.heros[heroId] | |
300 | + if hero then | |
301 | + if idleUnit[hero:getProperty("type")] then | |
302 | + upUnit = upUnit + idleUnit[hero:getProperty("type")] | |
303 | + end | |
302 | 304 | end |
303 | 305 | end |
304 | 306 | -- 中继加成 |
... | ... | @@ -308,6 +310,8 @@ function _M.endHangRpc(agent, data) |
308 | 310 | for _, campsite in ipairs(campsiteCsv) do |
309 | 311 | if campsite.floor <= advPass[chapterId] then |
310 | 312 | maxCampsite = campsite |
313 | + else | |
314 | + break | |
311 | 315 | end |
312 | 316 | end |
313 | 317 | |
... | ... | @@ -315,7 +319,7 @@ function _M.endHangRpc(agent, data) |
315 | 319 | |
316 | 320 | local idleReward = chapterData.idleReward:toNumMap() |
317 | 321 | for itemId, count in pairs(idleReward) do |
318 | - idleReward[itemId] = count * (maxCampsite.idleValue + upUnit) / 100 | |
322 | + idleReward[itemId] = math.floor(count * (maxCampsite.idleValue + upUnit) / 100) | |
319 | 323 | end |
320 | 324 | reward = role:award(idleReward, {log = {desc = "advHang", int1 = chapterId}}) |
321 | 325 | else | ... | ... |
src/actions/RoleAction.lua
... | ... | @@ -122,8 +122,8 @@ function _M.loginRpc( agent, data ) |
122 | 122 | |
123 | 123 | -- 跨天登陆事件 |
124 | 124 | local resetMode = role:updateTimeReset(now) |
125 | - if not resetMode["CrossDay"] then -- 没有跨天 | |
126 | - self.activity:checkActivityStatus(now, false, false) | |
125 | + if not resetMode or not resetMode["CrossDay"] then -- 没有跨天 | |
126 | + role.activity:checkActivityStatus(now, false, false) | |
127 | 127 | end |
128 | 128 | |
129 | 129 | redisproxy:zadd(FRIEND_RECOMMEND, now, roleId) | ... | ... |
src/adv/Adv.lua
... | ... | @@ -820,14 +820,13 @@ function Adv:over(success, rewardRatio, overType) |
820 | 820 | advAFGet = {}, |
821 | 821 | advAFWear = {}, |
822 | 822 | }) |
823 | - self:backEnd(success, score, scoreInfo, reward, overType, scoreReward, chapterId) | |
824 | 823 | self:pushBackEvent(AdvBackEventType.End, { |
825 | 824 | success = success, |
826 | 825 | score = score, |
827 | 826 | scoreInfo = scoreInfo, |
828 | 827 | reward = reward, |
829 | 828 | type = overType, |
830 | - scoreAward = scoreAward, | |
829 | + scoreAward = scoreReward, | |
831 | 830 | chapterId = chapterId, |
832 | 831 | backAdvCount = backAdvCount, |
833 | 832 | }) | ... | ... |
src/models/Activity.lua
1 | 1 | local Activity = class("Activity", require("shared.ModelBase")) |
2 | - | |
2 | +local string_format = string.format | |
3 | 3 | |
4 | 4 | Activity.ActivityType = { |
5 | 5 | Sign = 1, -- 签到 |
... | ... | @@ -22,12 +22,13 @@ end |
22 | 22 | |
23 | 23 | |
24 | 24 | Activity.schema = { |
25 | - ctime = {"table", {}}, -- 最近检查某项活动的开始时间 {id = time} | |
25 | + actime = {"table", {}}, -- 最近检查某项活动的开始时间 {id = time} | |
26 | 26 | act1 = {"table", {}}, -- {0 = day, 1= -1, 2 = -1} == 签到活动 |
27 | 27 | } |
28 | 28 | |
29 | 29 | function Activity:data() |
30 | 30 | return { |
31 | + actime = self:getProperty("actime"), | |
31 | 32 | act1 = self:getProperty("act1"), |
32 | 33 | } |
33 | 34 | end |
... | ... | @@ -111,30 +112,30 @@ end |
111 | 112 | -- 跨天刷新 --登录刷新 |
112 | 113 | function Activity:checkActivityStatus(now, isCrossDay, notify) |
113 | 114 | self._isOpen = {} |
114 | - local ctime = self:getProperty("ctime") | |
115 | + local actime = self:getProperty("actime") | |
115 | 116 | local change = false |
116 | - for actType, actData in paris(csvdb["activity_ctrlCsv"]) do | |
117 | + for actType, actData in pairs(csvdb["activity_ctrlCsv"]) do | |
117 | 118 | local isOpen, startTime = self:isOpenRaw(actType, now) |
118 | 119 | self._isOpen[actType] = isOpen |
119 | 120 | |
120 | 121 | if isOpen then |
121 | - if ctime[actType] and ctime[actType] == startTime then -- 还是之前的状态 开放中 | |
122 | + if actime[actType] and actime[actType] == startTime then -- 还是之前的状态 开放中 | |
122 | 123 | else -- 重置 |
123 | - ctime[actType] = startTime | |
124 | + actime[actType] = startTime | |
124 | 125 | self:closeActivity(actType, notify, true) |
125 | 126 | self:initActivity(actType, isCrossDay, notify) |
126 | 127 | change = true |
127 | 128 | end |
128 | 129 | else |
129 | - if ctime[actType] then | |
130 | + if actime[actType] then | |
130 | 131 | self:closeActivity(actType, notify) |
131 | - ctime[actType] = nil | |
132 | + actime[actType] = nil | |
132 | 133 | change = true |
133 | 134 | end |
134 | 135 | end |
135 | 136 | end |
136 | 137 | if change then |
137 | - self:setProperty("ctime", ctime) | |
138 | + self:updateProperty({field = "actime", value = actime, notNotify = not notify}) | |
138 | 139 | end |
139 | 140 | end |
140 | 141 | |
... | ... | @@ -153,7 +154,7 @@ activityFunc[Activity.ActivityType.Sign] = { |
153 | 154 | ["crossDay"] = function(self, actType, notify) |
154 | 155 | local curData = self:getActData(actType) |
155 | 156 | curData[0] = (curData[0] or 0) + 1 |
156 | - local actData = csvdb["new_signlnCsv"] | |
157 | + local actData = csvdb["new_signInCsv"] | |
157 | 158 | if curData[0] > #actData then return end -- 满了就忽略了 |
158 | 159 | |
159 | 160 | -- 没满更新一下 | ... | ... |