Commit e32ecac8508b36008486b1b70cd9fff378003394

Authored by 熊润斐
2 parents 9d2a3cb2 28b0c285

Merge branch 'tr/bugfix-qa' into tr/publish/qa-out

src/actions/HangAction.lua
... ... @@ -846,7 +846,7 @@ function _M.startWorkBattleRpc(agent, data)
846 846 if needCount > 0 then
847 847 role:costItems({[ticketId] = needCount}, {log = {desc = "workBattle", int1 = id}})
848 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 850 local reward, change = workWinReward(role, bonusData, 3, count, true)
851 851 SendPacket(actionCodes.Hang_startWorkBattleRpc, MsgPack.pack({reward = reward, change = change}))
852 852 else
... ... @@ -970,14 +970,14 @@ function _M.endWorkBattleRpc(agent, data)
970 970 local workBattle = role:getProperty("workBattle")
971 971 workBattle[bonusData.type] = workBattle[bonusData.type] or 0
972 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 975 role:updateProperty({field = "workBattle", value = workBattle})
976 976 end
977 977 if needCount > 0 then
978 978 role:costItems({[ticketId] = needCount}, {log = {desc = "workBattle", int1 = id}})
979 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 981 reward, change = workWinReward(role, bonusData, rewardType)
982 982 end
983 983 else
... ...
src/services/globald.lua
... ... @@ -245,6 +245,23 @@ local function check_trade_seaport_donate()
245 245 skynet.timeout(interval * 100, check_trade_seaport_donate)
246 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 265 local CMD = {}
249 266  
250 267  
... ... @@ -266,10 +283,12 @@ end
266 283  
267 284  
268 285 function CMD.start()
  286 + math.randomInit(skynet.timex())
269 287 check_mail_queue()
270 288 --check_battle_act_close()
271 289 check_trade_seaport_status()
272 290 check_trade_seaport_donate()
  291 + check_work_battle()
273 292 end
274 293  
275 294 local function __init__()
... ...
src/utils/CommonFunc.lua
... ... @@ -235,8 +235,9 @@ function specMonday(now)
235 235 return time - (wday - 1) * 86400
236 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 241 if specday then
241 242 local day = (tm.wday+6)%7
242 243 if day == 0 then day = 7 end
... ...