Commit bd06891be2e767c8cd37cfbe671175101b438af7
Merge branch 'taptap' into player
# Conflicts: # src/config
Showing
22 changed files
with
393 additions
and
99 deletions
Show diff stats
docs/日志说明.xlsx
No preview for this file type
publish/publish.sh
... | ... | @@ -28,7 +28,7 @@ cd - |
28 | 28 | rsync -aP --exclude=".git" ./src/ ${dist}/src/ |
29 | 29 | rsync -aP ./publish/skynet ${dist}/ |
30 | 30 | rsync -aP --exclude={config/develop.lua,config/nodenames.lua} config ${dist}/ |
31 | -cp kill.sh ${dist}/ | |
32 | -cp run.sh ${dist}/ | |
31 | +# cp kill.sh ${dist}/ | |
32 | +# cp run.sh ${dist}/ | |
33 | 33 | |
34 | 34 | # rsync -aP --exclude-from="./publish/exclude.list" ${origin}/ ./${dist}/ | ... | ... |
src/GlobalVar.lua
src/ProtocolCode.lua
... | ... | @@ -101,6 +101,7 @@ actionCodes = { |
101 | 101 | Hang_endBonusBattleRpc = 261, |
102 | 102 | Hang_hangGiftRpc = 262, |
103 | 103 | Hang_bagFieldRpc = 263, |
104 | + Hang_chatLineRpc = 264, | |
104 | 105 | |
105 | 106 | Diner_updateProperty = 300, |
106 | 107 | Diner_addSellRpc = 301, |
... | ... | @@ -192,6 +193,7 @@ actionCodes = { |
192 | 193 | Activity_sudokuRpc = 650, |
193 | 194 | Activity_signRpc = 651, |
194 | 195 | Activity_sudokuRewardRpc = 652, |
196 | + Activity_actSignRpc = 653, | |
195 | 197 | } |
196 | 198 | |
197 | 199 | rpcResponseBegin = 10000 | ... | ... |
src/actions/ActivityAction.lua
... | ... | @@ -125,14 +125,41 @@ function _M.signRpc(agent, data) |
125 | 125 | end |
126 | 126 | signs[curDay] = yearMonth |
127 | 127 | |
128 | - local raward = role:award(monthData[curDay].item, {log = {desc = "sign", int1 = yearMonth, int2 = curDay}}) | |
128 | + local reward = role:award(monthData[curDay].item, {log = {desc = "sign", int1 = yearMonth, int2 = curDay}}) | |
129 | 129 | role:changeUpdates({{type = "sign", field = curDay, value = yearMonth}}) |
130 | 130 | |
131 | - SendPacket(actionCodes.Activity_signRpc, MsgPack.pack(raward)) | |
131 | + SendPacket(actionCodes.Activity_signRpc, MsgPack.pack(reward)) | |
132 | 132 | return true |
133 | 133 | end |
134 | 134 | |
135 | 135 | |
136 | +function _M.actSignRpc(agent, data) | |
137 | + local role = agent.role | |
138 | + if not role.activity:isOpen("Sign") then return 1 end | |
139 | + | |
140 | + local curData = role.activity:getActData("Sign") | |
141 | + local reward = {} | |
142 | + for day, csvData in ipairs(csvdb["new_signInCsv"]) do | |
143 | + if day <= (curData[0] or 0) then | |
144 | + if not curData[day] then | |
145 | + curData[day] = -1 | |
146 | + -- 奖励 | |
147 | + for itemId, count in pairs(csvData.reward:toNumMap()) do | |
148 | + reward[itemId] = (reward[itemId] or 0) + count | |
149 | + end | |
150 | + end | |
151 | + else | |
152 | + break | |
153 | + end | |
154 | + end | |
155 | + if next(reward) then | |
156 | + role.activity:updateActData("Sign", curData) | |
157 | + reward = role:award(reward, {log = {desc = "actSign"}}) | |
158 | + end | |
159 | + SendPacket(actionCodes.Activity_actSignRpc, MsgPack.pack(reward)) | |
160 | + return true | |
161 | +end | |
162 | + | |
136 | 163 | |
137 | 164 | |
138 | 165 | return _M |
139 | 166 | \ No newline at end of file | ... | ... |
src/actions/AdvAction.lua
... | ... | @@ -89,6 +89,9 @@ function _M.startAdvRpc( agent, data ) |
89 | 89 | |
90 | 90 | --上一个关卡结束才可以开始新的关卡 |
91 | 91 | if role:getAdvData():isRunning() then return 8 end |
92 | + local advHang = role:getProperty("advHang") | |
93 | + if advHang[chapterId] then return 9 end --正在挂机 | |
94 | + | |
92 | 95 | |
93 | 96 | local chapterData = csvdb["adv_chapterCsv"][chapterId] |
94 | 97 | if not chapterData or layer < 1 then return 1 end |
... | ... | @@ -112,7 +115,7 @@ function _M.startAdvRpc( agent, data ) |
112 | 115 | if advElM < relayData.unlockfloor then return 15 end --未解锁 |
113 | 116 | end |
114 | 117 | else -- 普通模式判断 |
115 | - if role.dailyData:getProperty("advC") >= role:getAdvHangLimit() then return 2 end -- 是否有体力 | |
118 | + if not role:checkAdvCount(chapterData.limitlevel) then return 2 end -- 是否有体力 | |
116 | 119 | if layer >= chapterData.limitlevel then return 4 end |
117 | 120 | -- 关卡开放判断 |
118 | 121 | if not role:advChapterIsOpen(chapterId) then return 5 end |
... | ... | @@ -139,7 +142,7 @@ function _M.startAdvRpc( agent, data ) |
139 | 142 | if AdvCommon.isEndless(chapterId) then |
140 | 143 | role.dailyData:updateProperty({field = "advElC", delta = 1}) |
141 | 144 | else |
142 | - role.dailyData:updateProperty({field = "advC", delta = 1}) | |
145 | + role:changeAdvCount(chapterData.limitlevel) | |
143 | 146 | end |
144 | 147 | |
145 | 148 | local support = {} -- 支援效果 |
... | ... | @@ -177,7 +180,6 @@ function _M.startAdvRpc( agent, data ) |
177 | 180 | return true |
178 | 181 | end |
179 | 182 | |
180 | - | |
181 | 183 | function _M.startHangRpc(agent, data) |
182 | 184 | local role = agent.role |
183 | 185 | local msg = MsgPack.unpack(data) |
... | ... | @@ -186,24 +188,38 @@ function _M.startHangRpc(agent, data) |
186 | 188 | |
187 | 189 | local chapterData = csvdb["adv_chapterCsv"][chapterId] |
188 | 190 | if not chapterData then return end |
191 | + if chapterData.idleReward == "" then return end --没有奖励 没有挂机 | |
189 | 192 | |
190 | 193 | local advHang = role:getProperty("advHang") |
191 | 194 | if advHang[chapterId] then return end --正在挂机 |
192 | 195 | |
193 | 196 | if role:getAdvData():isRunning() and role:getAdvData().chapterId == chapterId then return end |
194 | 197 | |
195 | - local advPass = role:getProperty("advPass") | |
196 | - if AdvCommon.isEndless(chapterId) or advPass[chapterId] ~= chapterData.limitlevel then return end -- 没有全通关 | |
198 | + if AdvCommon.isEndless(chapterId) then return end -- 无尽没有代理 | |
199 | + | |
200 | + local advRelay = role:getProperty("advRelay") | |
201 | + if not next(advRelay[chapterId] or {}) then return end -- 没有开放 | |
197 | 202 | |
198 | - if role.dailyData:getProperty("advC") >= role:getAdvHangLimit() then return end -- 是否有体力 | |
203 | + | |
204 | + if not role:checkAdvCount(chapterData.limitlevel) then return end -- 是否有体力 | |
199 | 205 | |
200 | 206 | if not checkFormat(role, format, role:getAdvData():isRunning()) then return end --编队是否正确 |
201 | 207 | |
202 | - local battleV = 0 | |
203 | - for _, heroId in pairs(format.heros) do | |
204 | - local hero = role.heros[heroId] | |
205 | - battleV = battleV + hero:getProperty("battleV") | |
208 | + local player = {} | |
209 | + local attrs = role:getTeamBattleInfo(format).heros | |
210 | + for attrName, _ in pairs(AdvAttsEnum) do | |
211 | + for _, hero in pairs(attrs) do | |
212 | + player[attrName] = (player[attrName] or 0) + hero[attrName] | |
213 | + end | |
214 | + player[attrName] = player[attrName] * (globalCsv.adv_battle_attr_ratio[attrName] or 1) | |
206 | 215 | end |
216 | + | |
217 | + local battleV = 1 * player["hp"] | |
218 | + + 2 * player["atk"] | |
219 | + + 1.25 * player["def"] | |
220 | + + 0.226 * player["hit"] | |
221 | + + 0.26 * player["miss"] | |
222 | + | |
207 | 223 | if battleV < chapterData.idleValue then return end -- 战斗力是否满足 |
208 | 224 | |
209 | 225 | local info = {} |
... | ... | @@ -223,7 +239,7 @@ function _M.startHangRpc(agent, data) |
223 | 239 | |
224 | 240 | role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) |
225 | 241 | |
226 | - role.dailyData:updateProperty({field = "advC", delta = 1}) | |
242 | + role:changeAdvCount(chapterData.limitlevel) | |
227 | 243 | role:checkTaskEnter("AdvStart", {id = chapterId}) |
228 | 244 | role:log("adv_action", {desc = "startHang", int1 = chapterId}) |
229 | 245 | |
... | ... | @@ -276,14 +292,44 @@ function _M.endHangRpc(agent, data) |
276 | 292 | |
277 | 293 | local reward, isFull |
278 | 294 | if skynet.timex() >= info.time then |
279 | - reward = role:award(chapterData.idleReward, {log = {desc = "advHang", int1 = chapterId}}) | |
280 | - else | |
281 | - if cancel then | |
282 | - if role.dailyData:getProperty("advC") <= 0 then | |
283 | - isFull = true | |
295 | + -- 英雄加成 | |
296 | + local idleUnit = chapterData.idleUnit:toNumMap() | |
297 | + local upUnit = 0 | |
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 | |
304 | + end | |
305 | + end | |
306 | + -- 中继加成 | |
307 | + local advPass = role:getProperty("advPass") | |
308 | + local maxCampsite = nil | |
309 | + local campsiteCsv = csvdb["adv_chapter_campsiteCsv"][chapterId] | |
310 | + for _, campsite in ipairs(campsiteCsv) do | |
311 | + if campsite.floor <= advPass[chapterId] then | |
312 | + maxCampsite = campsite | |
284 | 313 | else |
285 | - role.dailyData:updateProperty({field = "advC", delta = -1}) | |
314 | + break | |
286 | 315 | end |
316 | + end | |
317 | + | |
318 | + if not maxCampsite then return end | |
319 | + | |
320 | + local idleReward = chapterData.idleReward:toNumMap() | |
321 | + for itemId, count in pairs(idleReward) do | |
322 | + idleReward[itemId] = math.floor(count * (maxCampsite.idleValue + upUnit) / 100) | |
323 | + end | |
324 | + reward = role:award(idleReward, {log = {desc = "advHang", int1 = chapterId}}) | |
325 | + else | |
326 | + if cancel then | |
327 | + role:changeAdvCount(-chapterData.limitlevel) | |
328 | + -- if role:getProperty("advC") <= 0 then | |
329 | + -- isFull = true | |
330 | + -- else | |
331 | + -- role:updateProperty({field = "advC", delta = -chapterData.limitlevel}) | |
332 | + -- end | |
287 | 333 | else |
288 | 334 | return |
289 | 335 | end |
... | ... | @@ -319,7 +365,7 @@ function _M.buyAdvCountRpc(agent , data) |
319 | 365 | role.dailyData:updateProperty({field = "advElC", delta = -count}) |
320 | 366 | role.dailyData:updateProperty({field = "advElBC", delta = count}) |
321 | 367 | else |
322 | - role.dailyData:updateProperty({field = "advC", delta = -count}) | |
368 | + role:changeAdvCount(-count * globalCsv.adv_daily_buy_num) | |
323 | 369 | role.dailyData:updateProperty({field = "advBC", delta = count}) |
324 | 370 | end |
325 | 371 | role:log("adv_action", {desc = "buyAdvCount", short1 = isEl and 1 or 0, int1 = count}) | ... | ... |
src/actions/GmAction.lua
... | ... | @@ -213,8 +213,6 @@ function _M.fbc(role, pms) -- 直接通关 |
213 | 213 | role:updateProperty({field = "hangPass", value = {}}) |
214 | 214 | addPre(carbonId) |
215 | 215 | |
216 | - role:checkTaskEnter("HangPass", {id = carbonId}) | |
217 | - | |
218 | 216 | role:log("gm_action", {desc = "fbc", int1 = carbonId, key1 = pms.sender}) |
219 | 217 | |
220 | 218 | return "成功" |
... | ... | @@ -339,7 +337,7 @@ end |
339 | 337 | |
340 | 338 | table.insert(helpDes, {"冒险次数恢复", "advf"}) |
341 | 339 | function _M.advf(role, pms) |
342 | - role.dailyData:updateProperty({field = "advC", value = 0}) | |
340 | + role:updateProperty({field = "advC", value = 0}) | |
343 | 341 | role.dailyData:updateProperty({field = "advElC", value = 0}) |
344 | 342 | |
345 | 343 | role:log("gm_action", {desc = "advf", key1 = pms.sender}) |
... | ... | @@ -363,7 +361,7 @@ function _M.adv(role, pms) |
363 | 361 | advPass[chapterId] = layer |
364 | 362 | role:updateProperty({field = "advPass", value = advPass}) |
365 | 363 | end |
366 | - role:log("gm_action", {desc = "advf", int1 = chapterId, int2 = layer, key1 = pms.sender}) | |
364 | + role:log("gm_action", {desc = "adv", int1 = chapterId, int2 = layer, key1 = pms.sender}) | |
367 | 365 | |
368 | 366 | return "成功" |
369 | 367 | end | ... | ... |
src/actions/HangAction.lua
... | ... | @@ -559,4 +559,28 @@ function _M.bagFieldRpc(agent, data) |
559 | 559 | return true |
560 | 560 | end |
561 | 561 | |
562 | +function _M.chatLineRpc(agent, data) | |
563 | + local role = agent.role | |
564 | + local msg = MsgPack.unpack(data) | |
565 | + local id = msg.id | |
566 | + | |
567 | + local idleData = csvdb["idle_battleCsv"][id] | |
568 | + if not idleData or idleData.chatline == 0 then | |
569 | + return | |
570 | + end | |
571 | + | |
572 | + local chatline = role:getProperty("chatline") | |
573 | + if chatline[id] then return end | |
574 | + | |
575 | + if not role:checkHangPass(id) then return end | |
576 | + | |
577 | + chatline[id] = skynet.timex() | |
578 | + role:updateProperty({field = "chatline", value = chatline}) | |
579 | + | |
580 | + local reward = role:award(idleData.chatline_reward, {log = {desc = "chatline", int1 = id}}) | |
581 | + | |
582 | + SendPacket(actionCodes.Hang_chatLineRpc, MsgPack.pack(reward)) | |
583 | + return true | |
584 | +end | |
585 | + | |
562 | 586 | return _M |
563 | 587 | \ No newline at end of file | ... | ... |
src/actions/HeroAction.lua
... | ... | @@ -914,7 +914,7 @@ function _M.drawHeroRpc(agent, data) |
914 | 914 | -- role:updateProperty({field = "repayHero", value = repayHero}) |
915 | 915 | -- end |
916 | 916 | |
917 | - role:checkTaskEnter("DrawHero", {pool = pool, count = drawCount[drawType]}) | |
917 | + role:checkTaskEnter("DrawHero", {pool = btype, count = drawCount[drawType]}) | |
918 | 918 | if ssrCount > 0 then |
919 | 919 | role:checkTaskEnter("DrawSSR", {count = ssrCount}) |
920 | 920 | end | ... | ... |
src/actions/RoleAction.lua
... | ... | @@ -121,10 +121,14 @@ function _M.loginRpc( agent, data ) |
121 | 121 | role:advEndlessSeasonCheck(true) -- 冒险赛季更新检查 |
122 | 122 | |
123 | 123 | -- 跨天登陆事件 |
124 | - role:updateTimeReset(now) | |
124 | + local resetMode = role:updateTimeReset(now) | |
125 | + if not resetMode or not resetMode["CrossDay"] then -- 没有跨天 | |
126 | + role.activity:checkActivityStatus(now, false, false) | |
127 | + end | |
128 | + | |
125 | 129 | redisproxy:zadd(FRIEND_RECOMMEND, now, roleId) |
126 | 130 | |
127 | - for _, name in ipairs({"dailyData", "dinerData"}) do | |
131 | + for _, name in ipairs({"dailyData", "dinerData", "activity"}) do | |
128 | 132 | response[name] = role[name]:data() |
129 | 133 | end |
130 | 134 | |
... | ... | @@ -577,10 +581,19 @@ function _M.storyBookRewardRpc(agent, data) |
577 | 581 | local storyBookData = csvdb["story_bookCsv"][storyId] |
578 | 582 | if not storyBookData then return end |
579 | 583 | local storyStatus = role:getProperty("storyB") |
580 | - if not storyStatus[storyId] or not storyStatus[storyId].s or storyStatus[storyId].s ~= 1 then | |
581 | - return | |
584 | + | |
585 | + local status = (storyStatus[storyId] or {}).s | |
586 | + | |
587 | + if status == -1 then return end | |
588 | + | |
589 | + if not status or status ~= 1 then | |
590 | + if storyBookData.unlockType == 1 and role:getProperty("hangInfo").carbonId == tonumber(storyBookData.unlockData) then -- 挂机剧情正在挂机也可以领奖 | |
591 | + else | |
592 | + return | |
593 | + end | |
582 | 594 | end |
583 | 595 | -- 获取奖励 |
596 | + storyStatus[storyId] = storyStatus[storyId] or {} | |
584 | 597 | storyStatus[storyId].s = -1 |
585 | 598 | role:changeUpdates({{ type = "storyB", field = storyId, value = storyStatus[storyId] }}) |
586 | 599 | local reward = role:award(storyBookData.gift, {log = {desc = "storybookReward", int1 = storyId}}) | ... | ... |
src/actions/StoreAction.lua
... | ... | @@ -212,6 +212,7 @@ function _M.dailyBuyRpc(agent , data) |
212 | 212 | gift[itemId] = count_ * count |
213 | 213 | end |
214 | 214 | local reward = role:award(gift, {log = {desc = "dailyShop", int1 = id, int2 = count}}) |
215 | + role:checkTaskEnter("ShopAll", {count = count}) | |
215 | 216 | |
216 | 217 | role:log("role_action", {desc = "dailyShop", int1 = id, int2 = count}) |
217 | 218 | ... | ... |
src/actions/TowerAction.lua
... | ... | @@ -113,7 +113,7 @@ function _M.endBattleRpc(agent, data) |
113 | 113 | towerInfo.k = nil |
114 | 114 | role:updateProperty({field = "towerInfo", value = towerInfo}) |
115 | 115 | |
116 | - role:log("tower_action", {desc = "startBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = id}) | |
116 | + role:log("tower_action", {desc = "endBattle", short1 = msg.starNum > 0 and 1 or 0, int1 = id}) | |
117 | 117 | |
118 | 118 | SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({reward = reward})) |
119 | 119 | return true | ... | ... |
src/adv/Adv.lua
... | ... | @@ -300,12 +300,12 @@ function Adv:initSupport(supports) |
300 | 300 | end |
301 | 301 | |
302 | 302 | -- 获得随机神器 6=数量 |
303 | - supportEffect[6] = function(num) | |
303 | + supportEffect[6] = function(_, num) | |
304 | 304 | self.support[6] = (self.support[6] or 0) + num |
305 | 305 | end |
306 | 306 | |
307 | 307 | -- 获得3选1神器 7=选择次数(连续选择,每次选择重新随机) |
308 | - supportEffect[7] = function(num) | |
308 | + supportEffect[7] = function(_, num) | |
309 | 309 | self.support[7] = (self.support[7] or 0) + num |
310 | 310 | end |
311 | 311 | |
... | ... | @@ -776,6 +776,12 @@ function Adv:over(success, rewardRatio, overType) |
776 | 776 | end |
777 | 777 | reward = self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}}) |
778 | 778 | |
779 | + local backAdvCount | |
780 | + if not self:isEndless() then | |
781 | + backAdvCount = chapterData.limitlevel - self.level | |
782 | + self.owner:changeAdvCount(-backAdvCount) | |
783 | + end | |
784 | + | |
779 | 785 | if success then |
780 | 786 | self.owner:checkTaskEnter("AdvPass", {id = self.chapterId, level = self.level, score = score}) |
781 | 787 | |
... | ... | @@ -814,7 +820,16 @@ function Adv:over(success, rewardRatio, overType) |
814 | 820 | advAFGet = {}, |
815 | 821 | advAFWear = {}, |
816 | 822 | }) |
817 | - self:backEnd(success, score, scoreInfo, reward, overType, scoreReward, chapterId) | |
823 | + self:pushBackEvent(AdvBackEventType.End, { | |
824 | + success = success, | |
825 | + score = score, | |
826 | + scoreInfo = scoreInfo, | |
827 | + reward = reward, | |
828 | + type = overType, | |
829 | + scoreAward = scoreReward, | |
830 | + chapterId = chapterId, | |
831 | + backAdvCount = backAdvCount, | |
832 | + }) | |
818 | 833 | end |
819 | 834 | |
820 | 835 | function Adv:exit() |
... | ... | @@ -1921,9 +1936,6 @@ function Adv:backNext() |
1921 | 1936 | self:pushBackEvent(AdvBackEventType.Next, {}) |
1922 | 1937 | end |
1923 | 1938 | |
1924 | -function Adv:backEnd(success, score, scoreInfo, reward, overType, scoreAward, chapterId) | |
1925 | - self:pushBackEvent(AdvBackEventType.End, {success = success, score = score, scoreInfo = scoreInfo, reward = reward, type = overType, scoreAward = scoreAward, chapterId = chapterId}) | |
1926 | -end | |
1927 | 1939 | |
1928 | 1940 | function Adv:backBlockChange(roomId, blockId, itemChangeType) |
1929 | 1941 | self:pushBackEvent(AdvBackEventType.BlockChange, {roomId = roomId, blockId = blockId, itemChangeType = itemChangeType}) | ... | ... |
src/adv/AdvBattle.lua
... | ... | @@ -288,6 +288,15 @@ function Battle:afterRound() |
288 | 288 | return e1.id < e2.id |
289 | 289 | end) |
290 | 290 | |
291 | + | |
292 | + self.player:afterRound("buffBefore") | |
293 | + for _, enemy in ipairs(self.enemys[mapIdx]) do | |
294 | + enemy:afterRound("buffBefore") | |
295 | + end | |
296 | + for _, build in ipairs(self.builds[mapIdx]) do | |
297 | + build:afterRound("buffBefore") | |
298 | + end | |
299 | + | |
291 | 300 | self.player:afterRound("passive") |
292 | 301 | for _, enemy in ipairs(self.enemys[mapIdx]) do |
293 | 302 | enemy:afterRound("passive") |
... | ... | @@ -296,12 +305,12 @@ function Battle:afterRound() |
296 | 305 | build:afterRound("passive") |
297 | 306 | end |
298 | 307 | |
299 | - self.player:afterRound("buff") | |
308 | + self.player:afterRound("buffAfter") | |
300 | 309 | for _, enemy in ipairs(self.enemys[mapIdx]) do |
301 | - enemy:afterRound("buff") | |
310 | + enemy:afterRound("buffAfter") | |
302 | 311 | end |
303 | 312 | for _, build in ipairs(self.builds[mapIdx]) do |
304 | - build:afterRound("buff") | |
313 | + build:afterRound("buffAfter") | |
305 | 314 | end |
306 | 315 | |
307 | 316 | |
... | ... | @@ -330,7 +339,7 @@ function Battle:afterRound() |
330 | 339 | self.player:triggerPassive(Passive.AFTER_ROUND) |
331 | 340 | |
332 | 341 | if self.player.isDead then |
333 | - self.adv:over(false) | |
342 | + self.adv:over(false, nil, -2) | |
334 | 343 | end |
335 | 344 | end |
336 | 345 | ... | ... |
src/adv/AdvPlayer.lua
... | ... | @@ -55,9 +55,17 @@ function BaseObject:afterRound(roundType) |
55 | 55 | for _, passive in ipairs(self.passives) do |
56 | 56 | passive:afterRound(self) |
57 | 57 | end |
58 | - elseif roundType == "buff" then | |
58 | + elseif roundType == "buffBefore" then | |
59 | 59 | for _, buff in ipairs(self.buffs) do |
60 | - buff:afterRound() | |
60 | + if buff.buffData.intoEffect == 1 then | |
61 | + buff:afterRound() | |
62 | + end | |
63 | + end | |
64 | + elseif roundType == "buffAfter" then | |
65 | + for _, buff in ipairs(self.buffs) do | |
66 | + if buff.buffData.intoEffect == 0 then | |
67 | + buff:afterRound() | |
68 | + end | |
61 | 69 | end |
62 | 70 | end |
63 | 71 | end |
... | ... | @@ -416,9 +424,13 @@ end |
416 | 424 | function BaseObject:recover(value, releaser, params) |
417 | 425 | params = params or {} |
418 | 426 | value = math.max(0, math.ceil(value)) |
427 | + local old = self.hp | |
419 | 428 | self.hp = math.min(self.hpMax, self.hp + value) |
429 | + local change = self.hp - old | |
420 | 430 | if self:is("Player") then |
421 | - self.battle.adv:pushBackEvent(AdvBackEventType.HpChange, {change = value}) | |
431 | + if change > 0 then | |
432 | + self.battle.adv:pushBackEvent(AdvBackEventType.HpChange, {change = value}) | |
433 | + end | |
422 | 434 | end |
423 | 435 | end |
424 | 436 | |
... | ... | @@ -627,7 +639,9 @@ function Player:changeSp(value, cType) |
627 | 639 | elseif cType == 1 then |
628 | 640 | change = self.sp * value / 100 |
629 | 641 | end |
642 | + local old = self.sp | |
630 | 643 | self.sp = math.floor(math.min(self.spMax, math.max(0, self.sp + change))) |
644 | + change = self.sp - old | |
631 | 645 | if change ~= 0 then |
632 | 646 | self.battle.adv:pushBackEvent(AdvBackEventType.SpChange, {change = math.floor(change)}) |
633 | 647 | end | ... | ... |
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 | - DoubleDrop = 1, -- 双倍掉落 | |
5 | + Sign = 1, -- 签到 | |
6 | 6 | } |
7 | 7 | |
8 | 8 | |
... | ... | @@ -10,7 +10,7 @@ local function checkActivityType(activityType) |
10 | 10 | if type(activityType) == "string" then |
11 | 11 | activityType = Activity.ActivityType[activityType] |
12 | 12 | end |
13 | - return activityType | |
13 | + return activityType or 0 | |
14 | 14 | end |
15 | 15 | |
16 | 16 | |
... | ... | @@ -22,13 +22,14 @@ end |
22 | 22 | |
23 | 23 | |
24 | 24 | Activity.schema = { |
25 | - ctime = {"table", {}}, -- 最近检查某项活动的开始时间 {id = time} | |
26 | - _1 = {"table", {}}, | |
25 | + actime = {"table", {}}, -- 最近检查某项活动的开始时间 {id = time} | |
26 | + act1 = {"table", {}}, -- {0 = day, 1= -1, 2 = -1} == 签到活动 | |
27 | 27 | } |
28 | 28 | |
29 | 29 | function Activity:data() |
30 | 30 | return { |
31 | - _1 = self:getProperty("_1"), | |
31 | + actime = self:getProperty("actime"), | |
32 | + act1 = self:getProperty("act1"), | |
32 | 33 | } |
33 | 34 | end |
34 | 35 | |
... | ... | @@ -54,26 +55,141 @@ function Activity:updateProperty(params) |
54 | 55 | end |
55 | 56 | |
56 | 57 | |
58 | +function Activity:isOpenRaw(activityType, now) | |
59 | + activityType = checkActivityType(activityType) | |
60 | + local actData = csvdb["activity_ctrlCsv"][activityType] | |
61 | + if not actData then return end | |
62 | + | |
63 | + if actData.time == "" then -- 关闭 | |
64 | + return false | |
65 | + end | |
66 | + | |
67 | + local st = 0 | |
68 | + local et = 0 | |
69 | + local now = skynet.timex() | |
70 | + | |
71 | + if actData.ttype == 0 then -- 时间开放 | |
72 | + local openTimes = actData.time:toArray(false, "=") | |
73 | + if openTimes[1] ~= "0" then | |
74 | + st = toUnixtime(openTimes[1]..string_format("%02x", RESET_TIME)) | |
75 | + end | |
76 | + if openTimes[2] ~= "0" then | |
77 | + et = toUnixtime(openTimes[2]..string_format("%02x", RESET_TIME)) | |
78 | + end | |
79 | + elseif actData.ttype == 1 then -- 周期开放 | |
80 | + local openTimes = actData.time:toArray(true, "=") | |
81 | + local resetTime = toUnixtime(tostring(openTimes[1]) .. string_format("%02x", RESET_TIME)) | |
82 | + local r = math.floor((now - resetTime) / (openTimes[3] * 86400)) | |
83 | + st = resetTime + r * (openTimes[3] * 86400) | |
84 | + et = st + openTimes[2] * 86400 | |
85 | + else | |
86 | + return | |
87 | + end | |
88 | + | |
89 | + if now >= st and (et == 0 or now < et) then | |
90 | + return true, st | |
91 | + end | |
92 | + return false | |
93 | +end | |
94 | + | |
95 | +-- 缓存开放 | |
57 | 96 | function Activity:isOpen(activityType) |
58 | 97 | activityType = checkActivityType(activityType) |
98 | + return self._isOpen[activityType] | |
99 | +end | |
100 | + | |
101 | +function Activity:getActData(actType) | |
102 | + actType = checkActivityType(actType) | |
103 | + return self:getProperty("act" .. actType) | |
104 | +end | |
59 | 105 | |
106 | +function Activity:updateActData(actType, data, notNotify) | |
107 | + actType = checkActivityType(actType) | |
108 | + self:updateProperty({field = "act" .. actType, value = data, notNotify = notNotify}) | |
60 | 109 | end |
61 | 110 | |
111 | + | |
62 | 112 | -- 跨天刷新 --登录刷新 |
63 | -function Activity:checkActivityStatus(ltime, now, notify) | |
64 | - | |
113 | +function Activity:checkActivityStatus(now, isCrossDay, notify) | |
114 | + self._isOpen = {} | |
115 | + local actime = self:getProperty("actime") | |
116 | + local change = false | |
117 | + for actType, actData in pairs(csvdb["activity_ctrlCsv"]) do | |
118 | + local isOpen, startTime = self:isOpenRaw(actType, now) | |
119 | + self._isOpen[actType] = isOpen | |
120 | + | |
121 | + if isOpen then | |
122 | + if actime[actType] and actime[actType] == startTime then -- 还是之前的状态 开放中 | |
123 | + else -- 重置 | |
124 | + actime[actType] = startTime | |
125 | + self:closeActivity(actType, notify, true) | |
126 | + self:initActivity(actType, isCrossDay, notify) | |
127 | + change = true | |
128 | + end | |
129 | + else | |
130 | + if actime[actType] then | |
131 | + self:closeActivity(actType, notify) | |
132 | + actime[actType] = nil | |
133 | + change = true | |
134 | + end | |
135 | + end | |
136 | + end | |
137 | + if change then | |
138 | + self:updateProperty({field = "actime", value = actime, notNotify = not notify}) | |
139 | + end | |
65 | 140 | end |
66 | 141 | |
67 | -local checkActivityFunc = {} | |
142 | +local activityFunc = {} | |
143 | + | |
144 | +activityFunc[Activity.ActivityType.Sign] = { | |
145 | + -- ["check"] = function(self, actType, notify) -- 检查 | |
146 | + -- end, | |
147 | + ["init"] = function(self, actType, isCrossDay, notify) | |
148 | + if not isCrossDay then | |
149 | + activityFunc[Activity.ActivityType.Sign]["crossDay"](self, actType, notify) | |
150 | + end | |
151 | + end, | |
152 | + -- ["close"] = function(self, actType, notify) | |
153 | + -- end, | |
154 | + ["crossDay"] = function(self, actType, notify) | |
155 | + local curData = self:getActData(actType) | |
156 | + curData[0] = (curData[0] or 0) + 1 | |
157 | + local actData = csvdb["new_signInCsv"] | |
158 | + if curData[0] > #actData then return end -- 满了就忽略了 | |
159 | + | |
160 | + -- 没满更新一下 | |
161 | + self:updateActData(actType, curData, not notify) | |
162 | + end, | |
163 | +} | |
164 | + | |
165 | +function Activity:initActivity(actType, isCrossDay, notify) | |
166 | + if activityFunc[actType] and activityFunc[actType]['close'] then | |
167 | + activityFunc[actType]["init"](self, actType, isCrossDay, notify) | |
168 | + end | |
169 | +end | |
68 | 170 | |
69 | -checkActivityFunc[Activity.ActivityType.DoubleDrop] = function(self, notNotify, activityType, ...) | |
171 | +function Activity:closeActivity(actType, notify, notUpdateAct) | |
172 | + if activityFunc[actType] and activityFunc[actType]['close'] then | |
173 | + activityFunc[actType]["close"](self, actType, notify) | |
174 | + end | |
175 | + self:updateActData(actType, Activity.schema["act" .. actType][2], not notify or notUpdateAct) | |
176 | +end | |
70 | 177 | |
178 | +function Activity:refreshDailyData(notify) | |
179 | + for actType, status in pairs(self._isOpen) do | |
180 | + if status then | |
181 | + if activityFunc[actType] and activityFunc[actType]['crossDay'] then | |
182 | + activityFunc[actType]["crossDay"](self, actType, notify) | |
183 | + end | |
184 | + end | |
185 | + end | |
71 | 186 | end |
72 | 187 | |
73 | -function Activity:checkActivityEnter(notNotify, activityType, ...) | |
188 | +function Activity:checkActivity(notNotify, activityType, ...) | |
74 | 189 | if not activityType then return end |
75 | - if checkActivityFunc[activityType] then | |
76 | - checkActivityFunc[activityType](self, notNotify, activityType, ...) | |
190 | + if not self:isOpen(activityType) then return end | |
191 | + if activityFunc[activityType] and activityFunc[activityType]['check'] then | |
192 | + activityFunc[activityType]["check"](self, activityType, not notNotify, ...) | |
77 | 193 | end |
78 | 194 | end |
79 | 195 | ... | ... |
src/models/Daily.lua
... | ... | @@ -10,7 +10,6 @@ Daily.schema = { |
10 | 10 | commentHero = {"string", ""}, -- 单日评论食灵记录 type=1 |
11 | 11 | hangQC = {"number", 0}, -- 挂机快速次数 |
12 | 12 | dinerQC = {"number", 0}, -- 贩卖加速次数 |
13 | - advC = {"number", 0}, -- 冒险次数(消耗体力) | |
14 | 13 | advElC = {"number", 0}, -- 无尽次数(消耗体力) |
15 | 14 | advBC = {"number", 0}, -- 冒险次数购买次数(冒险体力购买次数) |
16 | 15 | advElBC = {"number", 0}, -- 无尽次数购买次数(冒险体力购买次数) |
... | ... | @@ -52,7 +51,7 @@ function Daily:refreshDailyData(notify) |
52 | 51 | redisproxy:del(FRIEND_POINT:format(self.owner:getProperty("id"))) |
53 | 52 | local dataMap = {} |
54 | 53 | for field, schema in pairs(self.schema) do |
55 | - if field == "advC" or field == "advElC" then | |
54 | + if field == "advElC" then | |
56 | 55 | if self:getProperty(field) > 0 then |
57 | 56 | dataMap[field] = 0 |
58 | 57 | end |
... | ... | @@ -85,7 +84,6 @@ function Daily:data() |
85 | 84 | return { |
86 | 85 | hangQC = self:getProperty("hangQC"), |
87 | 86 | dinerQC = self:getProperty("dinerQC"), |
88 | - advC = self:getProperty("advC"), | |
89 | 87 | advBC = self:getProperty("advBC"), |
90 | 88 | advElC = self:getProperty("advElC"), |
91 | 89 | advElBC = self:getProperty("advElBC"), | ... | ... |
src/models/Role.lua
... | ... | @@ -83,6 +83,8 @@ Role.schema = { |
83 | 83 | advRelay = {"table", {}}, -- 冒险中继点记录 {[chapter] = {[level] = 1}, [-1] = {[level] = 1}} -- -1 无尽 方便重置 |
84 | 84 | advSup = {"table", {}}, -- 冒险支援效果 待选项 |
85 | 85 | advLimit = {"table", {}}, -- 冒险事件每次的limit |
86 | + advC = {"number", 0}, -- 冒险次数(消耗体力) | |
87 | + advCT = {"number", 0}, -- 冒险次数 上次恢复时间 | |
86 | 88 | |
87 | 89 | --挂机相关 |
88 | 90 | hangPass = {"table", {}}, -- 挂机通过的最大关卡 |
... | ... | @@ -152,6 +154,8 @@ Role.schema = { |
152 | 154 | sign = {"table", {}}, -- 签到记录 {[1] = 20181029} |
153 | 155 | |
154 | 156 | redp = {"table", {}}, -- 待消除红点 -- 通常打开对应界面就消除的红点 红点消除的方法 在对应的协议中使用 {tag = pms } |
157 | + | |
158 | + chatline = {"table", {}}, -- 奖励发放 id=时间 | |
155 | 159 | } |
156 | 160 | |
157 | 161 | |
... | ... | @@ -322,6 +326,8 @@ function Role:data() |
322 | 326 | advShop = self:getProperty("advShop"), |
323 | 327 | advEAchiev = self:getProperty("advEAchiev"), |
324 | 328 | advSup = self:getProperty("advSup"), |
329 | + advC = self:getProperty("advC"), | |
330 | + advCT = self:getProperty("advCT"), | |
325 | 331 | |
326 | 332 | hangPass = self:getProperty("hangPass"), |
327 | 333 | hangGift = self:getProperty("hangGift"), |
... | ... | @@ -364,6 +370,7 @@ function Role:data() |
364 | 370 | sign = self:getProperty("sign"), |
365 | 371 | |
366 | 372 | redp = self:getProperty("redp"), |
373 | + chatline = self:getProperty("chatline"), | |
367 | 374 | } |
368 | 375 | end |
369 | 376 | ... | ... |
src/models/RolePlugin.lua
... | ... | @@ -398,22 +398,14 @@ function RolePlugin.bind(Role) |
398 | 398 | if not unitData then return false end |
399 | 399 | |
400 | 400 | local heroId = tonum(redisproxy:hincrby(string.format(R_INCR, roleId), "hero", 1)) |
401 | - | |
402 | 401 | |
403 | 402 | redisproxy:sadd(string.format(R_HEROS, roleId), heroId) |
404 | 403 | |
405 | - local wakeL = 1 | |
406 | - if unitData.rare == 3 then | |
407 | - wakeL = 2 | |
408 | - elseif unitData.rare == 4 then | |
409 | - wakeL = 3 | |
410 | - end | |
411 | - | |
412 | 404 | local heroInfo = { |
413 | 405 | key = string.format(R_HERO, roleId, heroId), |
414 | 406 | id = heroId, |
415 | 407 | type= heroType, |
416 | - wakeL = wakeL, | |
408 | + wakeL = globalCsv.unit_wake_initLevel[unitData.rare], | |
417 | 409 | } |
418 | 410 | |
419 | 411 | local newHero = require("models.Hero").new(heroInfo) |
... | ... | @@ -846,6 +838,38 @@ function RolePlugin.bind(Role) |
846 | 838 | return globalCsv.adv_daily_cross_count + self:getFuncLv(FuncOpenType.AdvCount) |
847 | 839 | end |
848 | 840 | |
841 | + function Role:checkAdvCount(need) | |
842 | + local oldCount = self:getProperty("advC") | |
843 | + local oldTime = self:getProperty("advCT") | |
844 | + local newCount = oldCount | |
845 | + if oldCount > 0 then | |
846 | + local add = math.max(math.floor((skynet.timex() - oldTime) / (globalCsv.adv_daily_regain_min * 60)), 0) | |
847 | + newCount = math.max(oldCount - add, 0) | |
848 | + end | |
849 | + | |
850 | + return newCount + need <= self:getAdvHangLimit() | |
851 | + end | |
852 | + | |
853 | + --忽略上限 | |
854 | + function Role:changeAdvCount(change) | |
855 | + if change == 0 then return end | |
856 | + local count = self:getProperty("advC") | |
857 | + local ctime = self:getProperty("advCT") | |
858 | + if ctime == 0 then | |
859 | + ctime = skynet.timex() | |
860 | + end | |
861 | + local add = math.max(math.floor((skynet.timex() - ctime) / (globalCsv.adv_daily_regain_min * 60)), 0) | |
862 | + local nextTime = ctime + add * (globalCsv.adv_daily_regain_min * 60) | |
863 | + if count > 0 then | |
864 | + count = math.max(count - add, 0) | |
865 | + end | |
866 | + | |
867 | + self:updateProperties({ | |
868 | + advC = count + change, | |
869 | + advCT = ctime, | |
870 | + }) | |
871 | + end | |
872 | + | |
849 | 873 | function Role:getAdvElLimit() |
850 | 874 | return globalCsv.adv_endless_daily_cross_count + self:getFuncLv(FuncOpenType.AdvCountEL) |
851 | 875 | end | ... | ... |
src/models/RoleTask.lua
... | ... | @@ -132,7 +132,7 @@ local CommonListener = { |
132 | 132 | [TaskType.GetFriendP] = {{22, f("count")}}, |
133 | 133 | [TaskType.BonusPass] = {{23}}, |
134 | 134 | [TaskType.AdvStartSelf] = {{24}}, |
135 | - [TaskType.ShopAll] = {{25}}, | |
135 | + [TaskType.ShopAll] = {{25, f("count")}}, | |
136 | 136 | [TaskType.RuneUp] = {{26}}, |
137 | 137 | [TaskType.OpenBox] = {{27, 1, f("id")}}, |
138 | 138 | [TaskType.AdvDraw] = {{28, f("count"), f("ptype")}}, |
... | ... | @@ -526,7 +526,7 @@ function RoleTask.bind(Role) |
526 | 526 | end |
527 | 527 | |
528 | 528 | function Role:checkActivityTask(notNotify, activityType, ...) |
529 | - self.activity:checkActivityEnter(notNotify, activityType, ...) | |
529 | + self.activity:checkActivity(notNotify, activityType, ...) | |
530 | 530 | end |
531 | 531 | |
532 | 532 | end | ... | ... |
src/models/RoleTimeReset.lua
... | ... | @@ -4,9 +4,12 @@ RoleTimeReset.bind = function (Role) |
4 | 4 | |
5 | 5 | -- 重置内容 对应 GlobalVar TimeReset |
6 | 6 | local ResetFunc = {} |
7 | -ResetFunc["CrossDay"] = function(self, notify, response) | |
7 | +ResetFunc["CrossDay"] = function(self, notify, response, now) | |
8 | + self.activity:checkActivityStatus(now, true, notify) | |
9 | + | |
8 | 10 | self.dailyData:refreshDailyData(notify) |
9 | 11 | self.dinerData:refreshDailyData(notify) |
12 | + self.activity:refreshDailyData(notify) | |
10 | 13 | |
11 | 14 | self:setProperty("dTask", {}) |
12 | 15 | self:advRandomSupportEffect(not notify) |
... | ... | @@ -55,10 +58,13 @@ function Role:updateTimeReset(now, notify) |
55 | 58 | end |
56 | 59 | if not next(needResetId) then return end |
57 | 60 | |
61 | + local resetMode = {} | |
62 | + | |
58 | 63 | local response = {} |
59 | 64 | for funcName, resetId in pairs(TimeReset) do |
60 | 65 | if needResetId[resetId] and ResetFunc[funcName] then |
61 | - ResetFunc[funcName](self, notify, response) | |
66 | + ResetFunc[funcName](self, notify, response, now) | |
67 | + resetMode[funcName] = true | |
62 | 68 | end |
63 | 69 | end |
64 | 70 | |
... | ... | @@ -71,6 +77,7 @@ function Role:updateTimeReset(now, notify) |
71 | 77 | if notify then |
72 | 78 | self:notifyUpdateProperties(response) |
73 | 79 | end |
80 | + return resetMode | |
74 | 81 | end |
75 | 82 | |
76 | 83 | -- 持续时间取 min(interval, duration) duration 填 0 默认使用 interval 作为持续时间 | ... | ... |
src/services/pvpd.lua
... | ... | @@ -103,31 +103,27 @@ end |
103 | 103 | local function hideMatchInfo() |
104 | 104 | local day, ctime = getDayAndTime() |
105 | 105 | local tempMatchCache = {} |
106 | - if day > globalCsv.pvp_cross_server_day then | |
107 | - return MatchCache | |
108 | - else | |
109 | - for round, tempData in pairs(MatchCache) do | |
110 | - if round == day and ctime < globalCsv.pvp_cross_server_show_result - 1 then | |
111 | - tempMatchCache[round] = {} | |
112 | - for idx, match in pairs(tempData) do | |
113 | - tempMatchCache[round][idx] = { | |
114 | - [1] = match[1], | |
115 | - [2] = match[2], | |
116 | - } | |
117 | - end | |
118 | - elseif round <= day then | |
119 | - tempMatchCache[round] = {} | |
120 | - for idx, match in pairs(tempData) do | |
121 | - tempMatchCache[round][idx] = { | |
122 | - [1] = match[1], | |
123 | - [2] = match[2], | |
124 | - win = match.win, | |
125 | - battleV = { | |
126 | - [match[1]] = (match.teams[match[1]] or {}).battleV, | |
127 | - [match[2]] = (match.teams[match[2]] or {}).battleV, | |
128 | - } | |
106 | + for round, tempData in pairs(MatchCache) do | |
107 | + if round == day and ctime < globalCsv.pvp_cross_server_show_result - 1 then | |
108 | + tempMatchCache[round] = {} | |
109 | + for idx, match in pairs(tempData) do | |
110 | + tempMatchCache[round][idx] = { | |
111 | + [1] = match[1], | |
112 | + [2] = match[2], | |
113 | + } | |
114 | + end | |
115 | + elseif round <= day then | |
116 | + tempMatchCache[round] = {} | |
117 | + for idx, match in pairs(tempData) do | |
118 | + tempMatchCache[round][idx] = { | |
119 | + [1] = match[1], | |
120 | + [2] = match[2], | |
121 | + win = match.win, | |
122 | + battleV = { | |
123 | + [match[1]] = (match.teams[match[1]] or {}).battleV, | |
124 | + [match[2]] = (match.teams[match[2]] or {}).battleV, | |
129 | 125 | } |
130 | - end | |
126 | + } | |
131 | 127 | end |
132 | 128 | end |
133 | 129 | end | ... | ... |