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,7 +28,7 @@ cd - | ||
| 28 | rsync -aP --exclude=".git" ./src/ ${dist}/src/ | 28 | rsync -aP --exclude=".git" ./src/ ${dist}/src/ |
| 29 | rsync -aP ./publish/skynet ${dist}/ | 29 | rsync -aP ./publish/skynet ${dist}/ |
| 30 | rsync -aP --exclude={config/develop.lua,config/nodenames.lua} config ${dist}/ | 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 | # rsync -aP --exclude-from="./publish/exclude.list" ${origin}/ ./${dist}/ | 34 | # rsync -aP --exclude-from="./publish/exclude.list" ${origin}/ ./${dist}/ |
src/GlobalVar.lua
| 1 | XXTEA_KEY = "699D448D6D24f7F941E9F6E99F823E18" | 1 | XXTEA_KEY = "699D448D6D24f7F941E9F6E99F823E18" |
| 2 | -RESET_TIME = 4 | 2 | +RESET_TIME = 0 |
| 3 | 3 | ||
| 4 | START_RESET_TIME_BASE = 1584316800 -- 0时区 | 4 | START_RESET_TIME_BASE = 1584316800 -- 0时区 |
| 5 | TIME_ZONE = math.floor(os.difftime(START_RESET_TIME_BASE, os.time(os.date("!*t", START_RESET_TIME_BASE))) / 3600) -- 本地时区 | 5 | TIME_ZONE = math.floor(os.difftime(START_RESET_TIME_BASE, os.time(os.date("!*t", START_RESET_TIME_BASE))) / 3600) -- 本地时区 |
src/ProtocolCode.lua
| @@ -101,6 +101,7 @@ actionCodes = { | @@ -101,6 +101,7 @@ actionCodes = { | ||
| 101 | Hang_endBonusBattleRpc = 261, | 101 | Hang_endBonusBattleRpc = 261, |
| 102 | Hang_hangGiftRpc = 262, | 102 | Hang_hangGiftRpc = 262, |
| 103 | Hang_bagFieldRpc = 263, | 103 | Hang_bagFieldRpc = 263, |
| 104 | + Hang_chatLineRpc = 264, | ||
| 104 | 105 | ||
| 105 | Diner_updateProperty = 300, | 106 | Diner_updateProperty = 300, |
| 106 | Diner_addSellRpc = 301, | 107 | Diner_addSellRpc = 301, |
| @@ -192,6 +193,7 @@ actionCodes = { | @@ -192,6 +193,7 @@ actionCodes = { | ||
| 192 | Activity_sudokuRpc = 650, | 193 | Activity_sudokuRpc = 650, |
| 193 | Activity_signRpc = 651, | 194 | Activity_signRpc = 651, |
| 194 | Activity_sudokuRewardRpc = 652, | 195 | Activity_sudokuRewardRpc = 652, |
| 196 | + Activity_actSignRpc = 653, | ||
| 195 | } | 197 | } |
| 196 | 198 | ||
| 197 | rpcResponseBegin = 10000 | 199 | rpcResponseBegin = 10000 |
src/actions/ActivityAction.lua
| @@ -125,14 +125,41 @@ function _M.signRpc(agent, data) | @@ -125,14 +125,41 @@ function _M.signRpc(agent, data) | ||
| 125 | end | 125 | end |
| 126 | signs[curDay] = yearMonth | 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 | role:changeUpdates({{type = "sign", field = curDay, value = yearMonth}}) | 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 | return true | 132 | return true |
| 133 | end | 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 | return _M | 165 | return _M |
| 139 | \ No newline at end of file | 166 | \ No newline at end of file |
src/actions/AdvAction.lua
| @@ -89,6 +89,9 @@ function _M.startAdvRpc( agent, data ) | @@ -89,6 +89,9 @@ function _M.startAdvRpc( agent, data ) | ||
| 89 | 89 | ||
| 90 | --上一个关卡结束才可以开始新的关卡 | 90 | --上一个关卡结束才可以开始新的关卡 |
| 91 | if role:getAdvData():isRunning() then return 8 end | 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 | local chapterData = csvdb["adv_chapterCsv"][chapterId] | 96 | local chapterData = csvdb["adv_chapterCsv"][chapterId] |
| 94 | if not chapterData or layer < 1 then return 1 end | 97 | if not chapterData or layer < 1 then return 1 end |
| @@ -112,7 +115,7 @@ function _M.startAdvRpc( agent, data ) | @@ -112,7 +115,7 @@ function _M.startAdvRpc( agent, data ) | ||
| 112 | if advElM < relayData.unlockfloor then return 15 end --未解锁 | 115 | if advElM < relayData.unlockfloor then return 15 end --未解锁 |
| 113 | end | 116 | end |
| 114 | else -- 普通模式判断 | 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 | if layer >= chapterData.limitlevel then return 4 end | 119 | if layer >= chapterData.limitlevel then return 4 end |
| 117 | -- 关卡开放判断 | 120 | -- 关卡开放判断 |
| 118 | if not role:advChapterIsOpen(chapterId) then return 5 end | 121 | if not role:advChapterIsOpen(chapterId) then return 5 end |
| @@ -139,7 +142,7 @@ function _M.startAdvRpc( agent, data ) | @@ -139,7 +142,7 @@ function _M.startAdvRpc( agent, data ) | ||
| 139 | if AdvCommon.isEndless(chapterId) then | 142 | if AdvCommon.isEndless(chapterId) then |
| 140 | role.dailyData:updateProperty({field = "advElC", delta = 1}) | 143 | role.dailyData:updateProperty({field = "advElC", delta = 1}) |
| 141 | else | 144 | else |
| 142 | - role.dailyData:updateProperty({field = "advC", delta = 1}) | 145 | + role:changeAdvCount(chapterData.limitlevel) |
| 143 | end | 146 | end |
| 144 | 147 | ||
| 145 | local support = {} -- 支援效果 | 148 | local support = {} -- 支援效果 |
| @@ -177,7 +180,6 @@ function _M.startAdvRpc( agent, data ) | @@ -177,7 +180,6 @@ function _M.startAdvRpc( agent, data ) | ||
| 177 | return true | 180 | return true |
| 178 | end | 181 | end |
| 179 | 182 | ||
| 180 | - | ||
| 181 | function _M.startHangRpc(agent, data) | 183 | function _M.startHangRpc(agent, data) |
| 182 | local role = agent.role | 184 | local role = agent.role |
| 183 | local msg = MsgPack.unpack(data) | 185 | local msg = MsgPack.unpack(data) |
| @@ -186,24 +188,38 @@ function _M.startHangRpc(agent, data) | @@ -186,24 +188,38 @@ function _M.startHangRpc(agent, data) | ||
| 186 | 188 | ||
| 187 | local chapterData = csvdb["adv_chapterCsv"][chapterId] | 189 | local chapterData = csvdb["adv_chapterCsv"][chapterId] |
| 188 | if not chapterData then return end | 190 | if not chapterData then return end |
| 191 | + if chapterData.idleReward == "" then return end --没有奖励 没有挂机 | ||
| 189 | 192 | ||
| 190 | local advHang = role:getProperty("advHang") | 193 | local advHang = role:getProperty("advHang") |
| 191 | if advHang[chapterId] then return end --正在挂机 | 194 | if advHang[chapterId] then return end --正在挂机 |
| 192 | 195 | ||
| 193 | if role:getAdvData():isRunning() and role:getAdvData().chapterId == chapterId then return end | 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 | if not checkFormat(role, format, role:getAdvData():isRunning()) then return end --编队是否正确 | 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 | end | 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 | if battleV < chapterData.idleValue then return end -- 战斗力是否满足 | 223 | if battleV < chapterData.idleValue then return end -- 战斗力是否满足 |
| 208 | 224 | ||
| 209 | local info = {} | 225 | local info = {} |
| @@ -223,7 +239,7 @@ function _M.startHangRpc(agent, data) | @@ -223,7 +239,7 @@ function _M.startHangRpc(agent, data) | ||
| 223 | 239 | ||
| 224 | role:changeUpdates({{type = "advHang", field = chapterId, value = info}}) | 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 | role:checkTaskEnter("AdvStart", {id = chapterId}) | 243 | role:checkTaskEnter("AdvStart", {id = chapterId}) |
| 228 | role:log("adv_action", {desc = "startHang", int1 = chapterId}) | 244 | role:log("adv_action", {desc = "startHang", int1 = chapterId}) |
| 229 | 245 | ||
| @@ -276,14 +292,44 @@ function _M.endHangRpc(agent, data) | @@ -276,14 +292,44 @@ function _M.endHangRpc(agent, data) | ||
| 276 | 292 | ||
| 277 | local reward, isFull | 293 | local reward, isFull |
| 278 | if skynet.timex() >= info.time then | 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 | else | 313 | else |
| 285 | - role.dailyData:updateProperty({field = "advC", delta = -1}) | 314 | + break |
| 286 | end | 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 | else | 333 | else |
| 288 | return | 334 | return |
| 289 | end | 335 | end |
| @@ -319,7 +365,7 @@ function _M.buyAdvCountRpc(agent , data) | @@ -319,7 +365,7 @@ function _M.buyAdvCountRpc(agent , data) | ||
| 319 | role.dailyData:updateProperty({field = "advElC", delta = -count}) | 365 | role.dailyData:updateProperty({field = "advElC", delta = -count}) |
| 320 | role.dailyData:updateProperty({field = "advElBC", delta = count}) | 366 | role.dailyData:updateProperty({field = "advElBC", delta = count}) |
| 321 | else | 367 | else |
| 322 | - role.dailyData:updateProperty({field = "advC", delta = -count}) | 368 | + role:changeAdvCount(-count * globalCsv.adv_daily_buy_num) |
| 323 | role.dailyData:updateProperty({field = "advBC", delta = count}) | 369 | role.dailyData:updateProperty({field = "advBC", delta = count}) |
| 324 | end | 370 | end |
| 325 | role:log("adv_action", {desc = "buyAdvCount", short1 = isEl and 1 or 0, int1 = count}) | 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,8 +213,6 @@ function _M.fbc(role, pms) -- 直接通关 | ||
| 213 | role:updateProperty({field = "hangPass", value = {}}) | 213 | role:updateProperty({field = "hangPass", value = {}}) |
| 214 | addPre(carbonId) | 214 | addPre(carbonId) |
| 215 | 215 | ||
| 216 | - role:checkTaskEnter("HangPass", {id = carbonId}) | ||
| 217 | - | ||
| 218 | role:log("gm_action", {desc = "fbc", int1 = carbonId, key1 = pms.sender}) | 216 | role:log("gm_action", {desc = "fbc", int1 = carbonId, key1 = pms.sender}) |
| 219 | 217 | ||
| 220 | return "成功" | 218 | return "成功" |
| @@ -339,7 +337,7 @@ end | @@ -339,7 +337,7 @@ end | ||
| 339 | 337 | ||
| 340 | table.insert(helpDes, {"冒险次数恢复", "advf"}) | 338 | table.insert(helpDes, {"冒险次数恢复", "advf"}) |
| 341 | function _M.advf(role, pms) | 339 | function _M.advf(role, pms) |
| 342 | - role.dailyData:updateProperty({field = "advC", value = 0}) | 340 | + role:updateProperty({field = "advC", value = 0}) |
| 343 | role.dailyData:updateProperty({field = "advElC", value = 0}) | 341 | role.dailyData:updateProperty({field = "advElC", value = 0}) |
| 344 | 342 | ||
| 345 | role:log("gm_action", {desc = "advf", key1 = pms.sender}) | 343 | role:log("gm_action", {desc = "advf", key1 = pms.sender}) |
| @@ -363,7 +361,7 @@ function _M.adv(role, pms) | @@ -363,7 +361,7 @@ function _M.adv(role, pms) | ||
| 363 | advPass[chapterId] = layer | 361 | advPass[chapterId] = layer |
| 364 | role:updateProperty({field = "advPass", value = advPass}) | 362 | role:updateProperty({field = "advPass", value = advPass}) |
| 365 | end | 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 | return "成功" | 366 | return "成功" |
| 369 | end | 367 | end |
src/actions/HangAction.lua
| @@ -559,4 +559,28 @@ function _M.bagFieldRpc(agent, data) | @@ -559,4 +559,28 @@ function _M.bagFieldRpc(agent, data) | ||
| 559 | return true | 559 | return true |
| 560 | end | 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 | return _M | 586 | return _M |
| 563 | \ No newline at end of file | 587 | \ No newline at end of file |
src/actions/HeroAction.lua
| @@ -914,7 +914,7 @@ function _M.drawHeroRpc(agent, data) | @@ -914,7 +914,7 @@ function _M.drawHeroRpc(agent, data) | ||
| 914 | -- role:updateProperty({field = "repayHero", value = repayHero}) | 914 | -- role:updateProperty({field = "repayHero", value = repayHero}) |
| 915 | -- end | 915 | -- end |
| 916 | 916 | ||
| 917 | - role:checkTaskEnter("DrawHero", {pool = pool, count = drawCount[drawType]}) | 917 | + role:checkTaskEnter("DrawHero", {pool = btype, count = drawCount[drawType]}) |
| 918 | if ssrCount > 0 then | 918 | if ssrCount > 0 then |
| 919 | role:checkTaskEnter("DrawSSR", {count = ssrCount}) | 919 | role:checkTaskEnter("DrawSSR", {count = ssrCount}) |
| 920 | end | 920 | end |
src/actions/RoleAction.lua
| @@ -121,10 +121,14 @@ function _M.loginRpc( agent, data ) | @@ -121,10 +121,14 @@ function _M.loginRpc( agent, data ) | ||
| 121 | role:advEndlessSeasonCheck(true) -- 冒险赛季更新检查 | 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 | redisproxy:zadd(FRIEND_RECOMMEND, now, roleId) | 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 | response[name] = role[name]:data() | 132 | response[name] = role[name]:data() |
| 129 | end | 133 | end |
| 130 | 134 | ||
| @@ -577,10 +581,19 @@ function _M.storyBookRewardRpc(agent, data) | @@ -577,10 +581,19 @@ function _M.storyBookRewardRpc(agent, data) | ||
| 577 | local storyBookData = csvdb["story_bookCsv"][storyId] | 581 | local storyBookData = csvdb["story_bookCsv"][storyId] |
| 578 | if not storyBookData then return end | 582 | if not storyBookData then return end |
| 579 | local storyStatus = role:getProperty("storyB") | 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 | end | 594 | end |
| 583 | -- 获取奖励 | 595 | -- 获取奖励 |
| 596 | + storyStatus[storyId] = storyStatus[storyId] or {} | ||
| 584 | storyStatus[storyId].s = -1 | 597 | storyStatus[storyId].s = -1 |
| 585 | role:changeUpdates({{ type = "storyB", field = storyId, value = storyStatus[storyId] }}) | 598 | role:changeUpdates({{ type = "storyB", field = storyId, value = storyStatus[storyId] }}) |
| 586 | local reward = role:award(storyBookData.gift, {log = {desc = "storybookReward", int1 = storyId}}) | 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,6 +212,7 @@ function _M.dailyBuyRpc(agent , data) | ||
| 212 | gift[itemId] = count_ * count | 212 | gift[itemId] = count_ * count |
| 213 | end | 213 | end |
| 214 | local reward = role:award(gift, {log = {desc = "dailyShop", int1 = id, int2 = count}}) | 214 | local reward = role:award(gift, {log = {desc = "dailyShop", int1 = id, int2 = count}}) |
| 215 | + role:checkTaskEnter("ShopAll", {count = count}) | ||
| 215 | 216 | ||
| 216 | role:log("role_action", {desc = "dailyShop", int1 = id, int2 = count}) | 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,7 +113,7 @@ function _M.endBattleRpc(agent, data) | ||
| 113 | towerInfo.k = nil | 113 | towerInfo.k = nil |
| 114 | role:updateProperty({field = "towerInfo", value = towerInfo}) | 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 | SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({reward = reward})) | 118 | SendPacket(actionCodes.Tower_endBattleRpc, MsgPack.pack({reward = reward})) |
| 119 | return true | 119 | return true |
src/adv/Adv.lua
| @@ -300,12 +300,12 @@ function Adv:initSupport(supports) | @@ -300,12 +300,12 @@ function Adv:initSupport(supports) | ||
| 300 | end | 300 | end |
| 301 | 301 | ||
| 302 | -- 获得随机神器 6=数量 | 302 | -- 获得随机神器 6=数量 |
| 303 | - supportEffect[6] = function(num) | 303 | + supportEffect[6] = function(_, num) |
| 304 | self.support[6] = (self.support[6] or 0) + num | 304 | self.support[6] = (self.support[6] or 0) + num |
| 305 | end | 305 | end |
| 306 | 306 | ||
| 307 | -- 获得3选1神器 7=选择次数(连续选择,每次选择重新随机) | 307 | -- 获得3选1神器 7=选择次数(连续选择,每次选择重新随机) |
| 308 | - supportEffect[7] = function(num) | 308 | + supportEffect[7] = function(_, num) |
| 309 | self.support[7] = (self.support[7] or 0) + num | 309 | self.support[7] = (self.support[7] or 0) + num |
| 310 | end | 310 | end |
| 311 | 311 | ||
| @@ -776,6 +776,12 @@ function Adv:over(success, rewardRatio, overType) | @@ -776,6 +776,12 @@ function Adv:over(success, rewardRatio, overType) | ||
| 776 | end | 776 | end |
| 777 | reward = self.owner:award(reward, {log = {desc = "advOver", int1 = self.chapterId}}) | 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 | if success then | 785 | if success then |
| 780 | self.owner:checkTaskEnter("AdvPass", {id = self.chapterId, level = self.level, score = score}) | 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,7 +820,16 @@ function Adv:over(success, rewardRatio, overType) | ||
| 814 | advAFGet = {}, | 820 | advAFGet = {}, |
| 815 | advAFWear = {}, | 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 | end | 833 | end |
| 819 | 834 | ||
| 820 | function Adv:exit() | 835 | function Adv:exit() |
| @@ -1921,9 +1936,6 @@ function Adv:backNext() | @@ -1921,9 +1936,6 @@ function Adv:backNext() | ||
| 1921 | self:pushBackEvent(AdvBackEventType.Next, {}) | 1936 | self:pushBackEvent(AdvBackEventType.Next, {}) |
| 1922 | end | 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 | function Adv:backBlockChange(roomId, blockId, itemChangeType) | 1940 | function Adv:backBlockChange(roomId, blockId, itemChangeType) |
| 1929 | self:pushBackEvent(AdvBackEventType.BlockChange, {roomId = roomId, blockId = blockId, itemChangeType = itemChangeType}) | 1941 | self:pushBackEvent(AdvBackEventType.BlockChange, {roomId = roomId, blockId = blockId, itemChangeType = itemChangeType}) |
src/adv/AdvBattle.lua
| @@ -288,6 +288,15 @@ function Battle:afterRound() | @@ -288,6 +288,15 @@ function Battle:afterRound() | ||
| 288 | return e1.id < e2.id | 288 | return e1.id < e2.id |
| 289 | end) | 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 | self.player:afterRound("passive") | 300 | self.player:afterRound("passive") |
| 292 | for _, enemy in ipairs(self.enemys[mapIdx]) do | 301 | for _, enemy in ipairs(self.enemys[mapIdx]) do |
| 293 | enemy:afterRound("passive") | 302 | enemy:afterRound("passive") |
| @@ -296,12 +305,12 @@ function Battle:afterRound() | @@ -296,12 +305,12 @@ function Battle:afterRound() | ||
| 296 | build:afterRound("passive") | 305 | build:afterRound("passive") |
| 297 | end | 306 | end |
| 298 | 307 | ||
| 299 | - self.player:afterRound("buff") | 308 | + self.player:afterRound("buffAfter") |
| 300 | for _, enemy in ipairs(self.enemys[mapIdx]) do | 309 | for _, enemy in ipairs(self.enemys[mapIdx]) do |
| 301 | - enemy:afterRound("buff") | 310 | + enemy:afterRound("buffAfter") |
| 302 | end | 311 | end |
| 303 | for _, build in ipairs(self.builds[mapIdx]) do | 312 | for _, build in ipairs(self.builds[mapIdx]) do |
| 304 | - build:afterRound("buff") | 313 | + build:afterRound("buffAfter") |
| 305 | end | 314 | end |
| 306 | 315 | ||
| 307 | 316 | ||
| @@ -330,7 +339,7 @@ function Battle:afterRound() | @@ -330,7 +339,7 @@ function Battle:afterRound() | ||
| 330 | self.player:triggerPassive(Passive.AFTER_ROUND) | 339 | self.player:triggerPassive(Passive.AFTER_ROUND) |
| 331 | 340 | ||
| 332 | if self.player.isDead then | 341 | if self.player.isDead then |
| 333 | - self.adv:over(false) | 342 | + self.adv:over(false, nil, -2) |
| 334 | end | 343 | end |
| 335 | end | 344 | end |
| 336 | 345 |
src/adv/AdvPlayer.lua
| @@ -55,9 +55,17 @@ function BaseObject:afterRound(roundType) | @@ -55,9 +55,17 @@ function BaseObject:afterRound(roundType) | ||
| 55 | for _, passive in ipairs(self.passives) do | 55 | for _, passive in ipairs(self.passives) do |
| 56 | passive:afterRound(self) | 56 | passive:afterRound(self) |
| 57 | end | 57 | end |
| 58 | - elseif roundType == "buff" then | 58 | + elseif roundType == "buffBefore" then |
| 59 | for _, buff in ipairs(self.buffs) do | 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 | end | 69 | end |
| 62 | end | 70 | end |
| 63 | end | 71 | end |
| @@ -416,9 +424,13 @@ end | @@ -416,9 +424,13 @@ end | ||
| 416 | function BaseObject:recover(value, releaser, params) | 424 | function BaseObject:recover(value, releaser, params) |
| 417 | params = params or {} | 425 | params = params or {} |
| 418 | value = math.max(0, math.ceil(value)) | 426 | value = math.max(0, math.ceil(value)) |
| 427 | + local old = self.hp | ||
| 419 | self.hp = math.min(self.hpMax, self.hp + value) | 428 | self.hp = math.min(self.hpMax, self.hp + value) |
| 429 | + local change = self.hp - old | ||
| 420 | if self:is("Player") then | 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 | end | 434 | end |
| 423 | end | 435 | end |
| 424 | 436 | ||
| @@ -627,7 +639,9 @@ function Player:changeSp(value, cType) | @@ -627,7 +639,9 @@ function Player:changeSp(value, cType) | ||
| 627 | elseif cType == 1 then | 639 | elseif cType == 1 then |
| 628 | change = self.sp * value / 100 | 640 | change = self.sp * value / 100 |
| 629 | end | 641 | end |
| 642 | + local old = self.sp | ||
| 630 | self.sp = math.floor(math.min(self.spMax, math.max(0, self.sp + change))) | 643 | self.sp = math.floor(math.min(self.spMax, math.max(0, self.sp + change))) |
| 644 | + change = self.sp - old | ||
| 631 | if change ~= 0 then | 645 | if change ~= 0 then |
| 632 | self.battle.adv:pushBackEvent(AdvBackEventType.SpChange, {change = math.floor(change)}) | 646 | self.battle.adv:pushBackEvent(AdvBackEventType.SpChange, {change = math.floor(change)}) |
| 633 | end | 647 | end |
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 | - DoubleDrop = 1, -- 双倍掉落 | 5 | + Sign = 1, -- 签到 |
| 6 | } | 6 | } |
| 7 | 7 | ||
| 8 | 8 | ||
| @@ -10,7 +10,7 @@ local function checkActivityType(activityType) | @@ -10,7 +10,7 @@ local function checkActivityType(activityType) | ||
| 10 | if type(activityType) == "string" then | 10 | if type(activityType) == "string" then |
| 11 | activityType = Activity.ActivityType[activityType] | 11 | activityType = Activity.ActivityType[activityType] |
| 12 | end | 12 | end |
| 13 | - return activityType | 13 | + return activityType or 0 |
| 14 | end | 14 | end |
| 15 | 15 | ||
| 16 | 16 | ||
| @@ -22,13 +22,14 @@ end | @@ -22,13 +22,14 @@ end | ||
| 22 | 22 | ||
| 23 | 23 | ||
| 24 | Activity.schema = { | 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 | function Activity:data() | 29 | function Activity:data() |
| 30 | return { | 30 | return { |
| 31 | - _1 = self:getProperty("_1"), | 31 | + actime = self:getProperty("actime"), |
| 32 | + act1 = self:getProperty("act1"), | ||
| 32 | } | 33 | } |
| 33 | end | 34 | end |
| 34 | 35 | ||
| @@ -54,26 +55,141 @@ function Activity:updateProperty(params) | @@ -54,26 +55,141 @@ function Activity:updateProperty(params) | ||
| 54 | end | 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 | function Activity:isOpen(activityType) | 96 | function Activity:isOpen(activityType) |
| 58 | activityType = checkActivityType(activityType) | 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 | end | 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 | end | 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 | end | 186 | end |
| 72 | 187 | ||
| 73 | -function Activity:checkActivityEnter(notNotify, activityType, ...) | 188 | +function Activity:checkActivity(notNotify, activityType, ...) |
| 74 | if not activityType then return end | 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 | end | 193 | end |
| 78 | end | 194 | end |
| 79 | 195 |
src/models/Daily.lua
| @@ -10,7 +10,6 @@ Daily.schema = { | @@ -10,7 +10,6 @@ Daily.schema = { | ||
| 10 | commentHero = {"string", ""}, -- 单日评论食灵记录 type=1 | 10 | commentHero = {"string", ""}, -- 单日评论食灵记录 type=1 |
| 11 | hangQC = {"number", 0}, -- 挂机快速次数 | 11 | hangQC = {"number", 0}, -- 挂机快速次数 |
| 12 | dinerQC = {"number", 0}, -- 贩卖加速次数 | 12 | dinerQC = {"number", 0}, -- 贩卖加速次数 |
| 13 | - advC = {"number", 0}, -- 冒险次数(消耗体力) | ||
| 14 | advElC = {"number", 0}, -- 无尽次数(消耗体力) | 13 | advElC = {"number", 0}, -- 无尽次数(消耗体力) |
| 15 | advBC = {"number", 0}, -- 冒险次数购买次数(冒险体力购买次数) | 14 | advBC = {"number", 0}, -- 冒险次数购买次数(冒险体力购买次数) |
| 16 | advElBC = {"number", 0}, -- 无尽次数购买次数(冒险体力购买次数) | 15 | advElBC = {"number", 0}, -- 无尽次数购买次数(冒险体力购买次数) |
| @@ -52,7 +51,7 @@ function Daily:refreshDailyData(notify) | @@ -52,7 +51,7 @@ function Daily:refreshDailyData(notify) | ||
| 52 | redisproxy:del(FRIEND_POINT:format(self.owner:getProperty("id"))) | 51 | redisproxy:del(FRIEND_POINT:format(self.owner:getProperty("id"))) |
| 53 | local dataMap = {} | 52 | local dataMap = {} |
| 54 | for field, schema in pairs(self.schema) do | 53 | for field, schema in pairs(self.schema) do |
| 55 | - if field == "advC" or field == "advElC" then | 54 | + if field == "advElC" then |
| 56 | if self:getProperty(field) > 0 then | 55 | if self:getProperty(field) > 0 then |
| 57 | dataMap[field] = 0 | 56 | dataMap[field] = 0 |
| 58 | end | 57 | end |
| @@ -85,7 +84,6 @@ function Daily:data() | @@ -85,7 +84,6 @@ function Daily:data() | ||
| 85 | return { | 84 | return { |
| 86 | hangQC = self:getProperty("hangQC"), | 85 | hangQC = self:getProperty("hangQC"), |
| 87 | dinerQC = self:getProperty("dinerQC"), | 86 | dinerQC = self:getProperty("dinerQC"), |
| 88 | - advC = self:getProperty("advC"), | ||
| 89 | advBC = self:getProperty("advBC"), | 87 | advBC = self:getProperty("advBC"), |
| 90 | advElC = self:getProperty("advElC"), | 88 | advElC = self:getProperty("advElC"), |
| 91 | advElBC = self:getProperty("advElBC"), | 89 | advElBC = self:getProperty("advElBC"), |
src/models/Role.lua
| @@ -83,6 +83,8 @@ Role.schema = { | @@ -83,6 +83,8 @@ Role.schema = { | ||
| 83 | advRelay = {"table", {}}, -- 冒险中继点记录 {[chapter] = {[level] = 1}, [-1] = {[level] = 1}} -- -1 无尽 方便重置 | 83 | advRelay = {"table", {}}, -- 冒险中继点记录 {[chapter] = {[level] = 1}, [-1] = {[level] = 1}} -- -1 无尽 方便重置 |
| 84 | advSup = {"table", {}}, -- 冒险支援效果 待选项 | 84 | advSup = {"table", {}}, -- 冒险支援效果 待选项 |
| 85 | advLimit = {"table", {}}, -- 冒险事件每次的limit | 85 | advLimit = {"table", {}}, -- 冒险事件每次的limit |
| 86 | + advC = {"number", 0}, -- 冒险次数(消耗体力) | ||
| 87 | + advCT = {"number", 0}, -- 冒险次数 上次恢复时间 | ||
| 86 | 88 | ||
| 87 | --挂机相关 | 89 | --挂机相关 |
| 88 | hangPass = {"table", {}}, -- 挂机通过的最大关卡 | 90 | hangPass = {"table", {}}, -- 挂机通过的最大关卡 |
| @@ -152,6 +154,8 @@ Role.schema = { | @@ -152,6 +154,8 @@ Role.schema = { | ||
| 152 | sign = {"table", {}}, -- 签到记录 {[1] = 20181029} | 154 | sign = {"table", {}}, -- 签到记录 {[1] = 20181029} |
| 153 | 155 | ||
| 154 | redp = {"table", {}}, -- 待消除红点 -- 通常打开对应界面就消除的红点 红点消除的方法 在对应的协议中使用 {tag = pms } | 156 | redp = {"table", {}}, -- 待消除红点 -- 通常打开对应界面就消除的红点 红点消除的方法 在对应的协议中使用 {tag = pms } |
| 157 | + | ||
| 158 | + chatline = {"table", {}}, -- 奖励发放 id=时间 | ||
| 155 | } | 159 | } |
| 156 | 160 | ||
| 157 | 161 | ||
| @@ -322,6 +326,8 @@ function Role:data() | @@ -322,6 +326,8 @@ function Role:data() | ||
| 322 | advShop = self:getProperty("advShop"), | 326 | advShop = self:getProperty("advShop"), |
| 323 | advEAchiev = self:getProperty("advEAchiev"), | 327 | advEAchiev = self:getProperty("advEAchiev"), |
| 324 | advSup = self:getProperty("advSup"), | 328 | advSup = self:getProperty("advSup"), |
| 329 | + advC = self:getProperty("advC"), | ||
| 330 | + advCT = self:getProperty("advCT"), | ||
| 325 | 331 | ||
| 326 | hangPass = self:getProperty("hangPass"), | 332 | hangPass = self:getProperty("hangPass"), |
| 327 | hangGift = self:getProperty("hangGift"), | 333 | hangGift = self:getProperty("hangGift"), |
| @@ -364,6 +370,7 @@ function Role:data() | @@ -364,6 +370,7 @@ function Role:data() | ||
| 364 | sign = self:getProperty("sign"), | 370 | sign = self:getProperty("sign"), |
| 365 | 371 | ||
| 366 | redp = self:getProperty("redp"), | 372 | redp = self:getProperty("redp"), |
| 373 | + chatline = self:getProperty("chatline"), | ||
| 367 | } | 374 | } |
| 368 | end | 375 | end |
| 369 | 376 |
src/models/RolePlugin.lua
| @@ -398,22 +398,14 @@ function RolePlugin.bind(Role) | @@ -398,22 +398,14 @@ function RolePlugin.bind(Role) | ||
| 398 | if not unitData then return false end | 398 | if not unitData then return false end |
| 399 | 399 | ||
| 400 | local heroId = tonum(redisproxy:hincrby(string.format(R_INCR, roleId), "hero", 1)) | 400 | local heroId = tonum(redisproxy:hincrby(string.format(R_INCR, roleId), "hero", 1)) |
| 401 | - | ||
| 402 | 401 | ||
| 403 | redisproxy:sadd(string.format(R_HEROS, roleId), heroId) | 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 | local heroInfo = { | 404 | local heroInfo = { |
| 413 | key = string.format(R_HERO, roleId, heroId), | 405 | key = string.format(R_HERO, roleId, heroId), |
| 414 | id = heroId, | 406 | id = heroId, |
| 415 | type= heroType, | 407 | type= heroType, |
| 416 | - wakeL = wakeL, | 408 | + wakeL = globalCsv.unit_wake_initLevel[unitData.rare], |
| 417 | } | 409 | } |
| 418 | 410 | ||
| 419 | local newHero = require("models.Hero").new(heroInfo) | 411 | local newHero = require("models.Hero").new(heroInfo) |
| @@ -846,6 +838,38 @@ function RolePlugin.bind(Role) | @@ -846,6 +838,38 @@ function RolePlugin.bind(Role) | ||
| 846 | return globalCsv.adv_daily_cross_count + self:getFuncLv(FuncOpenType.AdvCount) | 838 | return globalCsv.adv_daily_cross_count + self:getFuncLv(FuncOpenType.AdvCount) |
| 847 | end | 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 | function Role:getAdvElLimit() | 873 | function Role:getAdvElLimit() |
| 850 | return globalCsv.adv_endless_daily_cross_count + self:getFuncLv(FuncOpenType.AdvCountEL) | 874 | return globalCsv.adv_endless_daily_cross_count + self:getFuncLv(FuncOpenType.AdvCountEL) |
| 851 | end | 875 | end |
src/models/RoleTask.lua
| @@ -132,7 +132,7 @@ local CommonListener = { | @@ -132,7 +132,7 @@ local CommonListener = { | ||
| 132 | [TaskType.GetFriendP] = {{22, f("count")}}, | 132 | [TaskType.GetFriendP] = {{22, f("count")}}, |
| 133 | [TaskType.BonusPass] = {{23}}, | 133 | [TaskType.BonusPass] = {{23}}, |
| 134 | [TaskType.AdvStartSelf] = {{24}}, | 134 | [TaskType.AdvStartSelf] = {{24}}, |
| 135 | - [TaskType.ShopAll] = {{25}}, | 135 | + [TaskType.ShopAll] = {{25, f("count")}}, |
| 136 | [TaskType.RuneUp] = {{26}}, | 136 | [TaskType.RuneUp] = {{26}}, |
| 137 | [TaskType.OpenBox] = {{27, 1, f("id")}}, | 137 | [TaskType.OpenBox] = {{27, 1, f("id")}}, |
| 138 | [TaskType.AdvDraw] = {{28, f("count"), f("ptype")}}, | 138 | [TaskType.AdvDraw] = {{28, f("count"), f("ptype")}}, |
| @@ -526,7 +526,7 @@ function RoleTask.bind(Role) | @@ -526,7 +526,7 @@ function RoleTask.bind(Role) | ||
| 526 | end | 526 | end |
| 527 | 527 | ||
| 528 | function Role:checkActivityTask(notNotify, activityType, ...) | 528 | function Role:checkActivityTask(notNotify, activityType, ...) |
| 529 | - self.activity:checkActivityEnter(notNotify, activityType, ...) | 529 | + self.activity:checkActivity(notNotify, activityType, ...) |
| 530 | end | 530 | end |
| 531 | 531 | ||
| 532 | end | 532 | end |
src/models/RoleTimeReset.lua
| @@ -4,9 +4,12 @@ RoleTimeReset.bind = function (Role) | @@ -4,9 +4,12 @@ RoleTimeReset.bind = function (Role) | ||
| 4 | 4 | ||
| 5 | -- 重置内容 对应 GlobalVar TimeReset | 5 | -- 重置内容 对应 GlobalVar TimeReset |
| 6 | local ResetFunc = {} | 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 | self.dailyData:refreshDailyData(notify) | 10 | self.dailyData:refreshDailyData(notify) |
| 9 | self.dinerData:refreshDailyData(notify) | 11 | self.dinerData:refreshDailyData(notify) |
| 12 | + self.activity:refreshDailyData(notify) | ||
| 10 | 13 | ||
| 11 | self:setProperty("dTask", {}) | 14 | self:setProperty("dTask", {}) |
| 12 | self:advRandomSupportEffect(not notify) | 15 | self:advRandomSupportEffect(not notify) |
| @@ -55,10 +58,13 @@ function Role:updateTimeReset(now, notify) | @@ -55,10 +58,13 @@ function Role:updateTimeReset(now, notify) | ||
| 55 | end | 58 | end |
| 56 | if not next(needResetId) then return end | 59 | if not next(needResetId) then return end |
| 57 | 60 | ||
| 61 | + local resetMode = {} | ||
| 62 | + | ||
| 58 | local response = {} | 63 | local response = {} |
| 59 | for funcName, resetId in pairs(TimeReset) do | 64 | for funcName, resetId in pairs(TimeReset) do |
| 60 | if needResetId[resetId] and ResetFunc[funcName] then | 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 | end | 68 | end |
| 63 | end | 69 | end |
| 64 | 70 | ||
| @@ -71,6 +77,7 @@ function Role:updateTimeReset(now, notify) | @@ -71,6 +77,7 @@ function Role:updateTimeReset(now, notify) | ||
| 71 | if notify then | 77 | if notify then |
| 72 | self:notifyUpdateProperties(response) | 78 | self:notifyUpdateProperties(response) |
| 73 | end | 79 | end |
| 80 | + return resetMode | ||
| 74 | end | 81 | end |
| 75 | 82 | ||
| 76 | -- 持续时间取 min(interval, duration) duration 填 0 默认使用 interval 作为持续时间 | 83 | -- 持续时间取 min(interval, duration) duration 填 0 默认使用 interval 作为持续时间 |
src/services/pvpd.lua
| @@ -103,31 +103,27 @@ end | @@ -103,31 +103,27 @@ end | ||
| 103 | local function hideMatchInfo() | 103 | local function hideMatchInfo() |
| 104 | local day, ctime = getDayAndTime() | 104 | local day, ctime = getDayAndTime() |
| 105 | local tempMatchCache = {} | 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 | end | 127 | end |
| 132 | end | 128 | end |
| 133 | end | 129 | end |