Commit be4e8031d77ccd09b4d260a91761cfe65e55d9a9

Authored by zhouhaihai
1 parent ea40710f

活动 拾荒

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