Commit e32ecac8508b36008486b1b70cd9fff378003394
Merge branch 'tr/bugfix-qa' into tr/publish/qa-out
Showing
3 changed files
with
26 additions
and
6 deletions
Show diff stats
src/actions/HangAction.lua
@@ -846,7 +846,7 @@ function _M.startWorkBattleRpc(agent, data) | @@ -846,7 +846,7 @@ function _M.startWorkBattleRpc(agent, data) | ||
846 | if needCount > 0 then | 846 | if needCount > 0 then |
847 | role:costItems({[ticketId] = needCount}, {log = {desc = "workBattle", int1 = id}}) | 847 | role:costItems({[ticketId] = needCount}, {log = {desc = "workBattle", int1 = id}}) |
848 | end | 848 | end |
849 | - redisproxy:hincrby(WORK_BATTLE_COUNT, role:getTimeResetRound(TimeReset["WorkBattle" .. bonusData.type]) * 10 + bonusData.type, count) | 849 | + redisproxy:hincrby(WORK_BATTLE_COUNT, role:getTimeResetRound(TimeReset["WorkBattle" .. bonusData.type]) * 10 + bonusData.type, count * bonusData.target_add) |
850 | local reward, change = workWinReward(role, bonusData, 3, count, true) | 850 | local reward, change = workWinReward(role, bonusData, 3, count, true) |
851 | SendPacket(actionCodes.Hang_startWorkBattleRpc, MsgPack.pack({reward = reward, change = change})) | 851 | SendPacket(actionCodes.Hang_startWorkBattleRpc, MsgPack.pack({reward = reward, change = change})) |
852 | else | 852 | else |
@@ -970,14 +970,14 @@ function _M.endWorkBattleRpc(agent, data) | @@ -970,14 +970,14 @@ function _M.endWorkBattleRpc(agent, data) | ||
970 | local workBattle = role:getProperty("workBattle") | 970 | local workBattle = role:getProperty("workBattle") |
971 | workBattle[bonusData.type] = workBattle[bonusData.type] or 0 | 971 | workBattle[bonusData.type] = workBattle[bonusData.type] or 0 |
972 | local needCount = 1 - (workBattle[bonusData.type] == 0 and 1 or 0) | 972 | local needCount = 1 - (workBattle[bonusData.type] == 0 and 1 or 0) |
973 | - if workBattle[1] == 0 then | ||
974 | - workBattle[1] = 1 | 973 | + if workBattle[bonusData.type] == 0 then |
974 | + workBattle[bonusData.type] = 1 | ||
975 | role:updateProperty({field = "workBattle", value = workBattle}) | 975 | role:updateProperty({field = "workBattle", value = workBattle}) |
976 | end | 976 | end |
977 | if needCount > 0 then | 977 | if needCount > 0 then |
978 | role:costItems({[ticketId] = needCount}, {log = {desc = "workBattle", int1 = id}}) | 978 | role:costItems({[ticketId] = needCount}, {log = {desc = "workBattle", int1 = id}}) |
979 | end | 979 | end |
980 | - redisproxy:hincrby(WORK_BATTLE_COUNT, role:getTimeResetRound(TimeReset["WorkBattle" .. bonusData.type]) * 10 + bonusData.type, 1) | 980 | + redisproxy:hincrby(WORK_BATTLE_COUNT, role:getTimeResetRound(TimeReset["WorkBattle" .. bonusData.type]) * 10 + bonusData.type, bonusData.target_add) |
981 | reward, change = workWinReward(role, bonusData, rewardType) | 981 | reward, change = workWinReward(role, bonusData, rewardType) |
982 | end | 982 | end |
983 | else | 983 | else |
src/services/globald.lua
@@ -245,6 +245,23 @@ local function check_trade_seaport_donate() | @@ -245,6 +245,23 @@ local function check_trade_seaport_donate() | ||
245 | skynet.timeout(interval * 100, check_trade_seaport_donate) | 245 | skynet.timeout(interval * 100, check_trade_seaport_donate) |
246 | end | 246 | end |
247 | 247 | ||
248 | +local function check_work_battle() | ||
249 | + local csvdb = require "shared.csvdata" | ||
250 | + local now = skynet.timex() | ||
251 | + local day = weekday(now) | ||
252 | + local workMainCsv = csvdb["work_mainCsv"][day] | ||
253 | + if workMainCsv and isSpecTime(now - RESET_TIME * 3600, csvdb["time_resetCsv"][TimeReset["WorkBattle1"]].start / 3600, 24) then | ||
254 | + local round = math.floor((now - START_RESET_TIME) / 604800) | ||
255 | + local field = round * 10 + day | ||
256 | + local count = tonum(redisproxy:hget(WORK_BATTLE_COUNT, field)) | ||
257 | + if count < workMainCsv.target_num then | ||
258 | + local add = math.floor(workMainCsv.target_num * math.randomInt(3125, 5000) / 100000) | ||
259 | + redisproxy:hincrby(WORK_BATTLE_COUNT, field, add) | ||
260 | + end | ||
261 | + end | ||
262 | + skynet.timeout(math.randomInt(10 * 60, 15 * 60) * 100, check_work_battle) | ||
263 | +end | ||
264 | + | ||
248 | local CMD = {} | 265 | local CMD = {} |
249 | 266 | ||
250 | 267 | ||
@@ -266,10 +283,12 @@ end | @@ -266,10 +283,12 @@ end | ||
266 | 283 | ||
267 | 284 | ||
268 | function CMD.start() | 285 | function CMD.start() |
286 | + math.randomInit(skynet.timex()) | ||
269 | check_mail_queue() | 287 | check_mail_queue() |
270 | --check_battle_act_close() | 288 | --check_battle_act_close() |
271 | check_trade_seaport_status() | 289 | check_trade_seaport_status() |
272 | check_trade_seaport_donate() | 290 | check_trade_seaport_donate() |
291 | + check_work_battle() | ||
273 | end | 292 | end |
274 | 293 | ||
275 | local function __init__() | 294 | local function __init__() |
src/utils/CommonFunc.lua
@@ -235,8 +235,9 @@ function specMonday(now) | @@ -235,8 +235,9 @@ function specMonday(now) | ||
235 | return time - (wday - 1) * 86400 | 235 | return time - (wday - 1) * 86400 |
236 | end | 236 | end |
237 | 237 | ||
238 | -function isSpecTime(startHour, endHour, specday) | ||
239 | - local tm = os.date("*t", skynet.timex()) | 238 | +function isSpecTime(ctime, startHour, endHour, specday) |
239 | + ctime = ctime or skynet.timex() | ||
240 | + local tm = os.date("*t", ctime) | ||
240 | if specday then | 241 | if specday then |
241 | local day = (tm.wday+6)%7 | 242 | local day = (tm.wday+6)%7 |
242 | if day == 0 then day = 7 end | 243 | if day == 0 then day = 7 end |