Commit d43246b01a511787e97c2133245a0394ccecba89
1 parent
4b903052
log 增加
Showing
1 changed file
with
20 additions
and
59 deletions
Show diff stats
src/actions/HangAction.lua
| @@ -329,6 +329,17 @@ function _M.getRewardRpc(agent , data) | @@ -329,6 +329,17 @@ function _M.getRewardRpc(agent , data) | ||
| 329 | if reward[ItemId.Gold] then | 329 | if reward[ItemId.Gold] then |
| 330 | role:checkTaskEnter("HangGetGold", {count = reward[ItemId.Gold]}) | 330 | role:checkTaskEnter("HangGetGold", {count = reward[ItemId.Gold]}) |
| 331 | end | 331 | end |
| 332 | + | ||
| 333 | + role:log("residence_reward", { | ||
| 334 | + mission_threadid = math.floor(hangInfo.carbonId / 10000), --大关卡ID | ||
| 335 | + mission_id = hangInfo.carbonId, --关卡ID | ||
| 336 | + mission_type = 100, --关卡类型,见关卡类型枚举表 | ||
| 337 | + residence_reward_type = 0, --领取奖励方式,快速(超前领取)记录为1,正常领取记录为0 | ||
| 338 | + residence_time = 0, --挂机或排名时长 | ||
| 339 | + residence_reward = reward, --获得奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} | ||
| 340 | + }) | ||
| 341 | + | ||
| 342 | + | ||
| 332 | SendPacket(actionCodes.Hang_getRewardRpc, MsgPack.pack({ | 343 | SendPacket(actionCodes.Hang_getRewardRpc, MsgPack.pack({ |
| 333 | reward = reward, | 344 | reward = reward, |
| 334 | change = change | 345 | change = change |
| @@ -336,65 +347,6 @@ function _M.getRewardRpc(agent , data) | @@ -336,65 +347,6 @@ function _M.getRewardRpc(agent , data) | ||
| 336 | return true | 347 | return true |
| 337 | end | 348 | end |
| 338 | 349 | ||
| 339 | --- function _M.getRewardItemRpc(agent , data) | ||
| 340 | --- local role = agent.role | ||
| 341 | --- checkReward(role) | ||
| 342 | --- local items = role:getProperty("hangBag") | ||
| 343 | --- if not next(items) then return end | ||
| 344 | - | ||
| 345 | --- local notNeed = {[ItemId.Gold] = 1, [ItemId.Exp] = 1, [ItemId.PlayerExp] = 1} | ||
| 346 | --- local reward = {} | ||
| 347 | --- for itemId , count in pairs(items) do | ||
| 348 | --- if not notNeed[itemId] then | ||
| 349 | --- reward[itemId] = count | ||
| 350 | --- items[itemId] = nil | ||
| 351 | --- end | ||
| 352 | --- end | ||
| 353 | --- if not next(reward) then return end | ||
| 354 | --- local reward = role:award(reward) | ||
| 355 | - | ||
| 356 | --- local hangInfo = role:getProperty("hangInfo") | ||
| 357 | --- local nowTime = skynet.timex() | ||
| 358 | --- hangInfo.endItemTime = nowTime + globalCsv.idle_producetime_max | ||
| 359 | --- hangInfo.itemTime = nowTime | ||
| 360 | --- role:updateProperty({field = "hangBag", value = items}) | ||
| 361 | --- role:updateProperty({field = "hangInfo", value = hangInfo}) | ||
| 362 | - | ||
| 363 | --- SendPacket(actionCodes.Hang_getRewardItemRpc, MsgPack.pack({ | ||
| 364 | --- reward = reward | ||
| 365 | --- })) | ||
| 366 | --- return true | ||
| 367 | --- end | ||
| 368 | - | ||
| 369 | --- function _M.getRewardCoinRpc(agent , data) | ||
| 370 | --- local role = agent.role | ||
| 371 | --- checkReward(role) | ||
| 372 | --- local items = role:getProperty("hangBag") | ||
| 373 | --- if not next(items) then return end | ||
| 374 | - | ||
| 375 | --- local need = {[ItemId.Gold] = 1, [ItemId.Exp] = 1, [ItemId.PlayerExp] = 1} | ||
| 376 | --- local reward = {} | ||
| 377 | --- for itemId , count in pairs(items) do | ||
| 378 | --- if need[itemId] then | ||
| 379 | --- reward[itemId] = count | ||
| 380 | --- items[itemId] = nil | ||
| 381 | --- end | ||
| 382 | --- end | ||
| 383 | --- local reward = role:award(reward) | ||
| 384 | - | ||
| 385 | --- local hangInfo = role:getProperty("hangInfo") | ||
| 386 | --- local nowTime = skynet.timex() | ||
| 387 | --- hangInfo.endCoinTime = nowTime + globalCsv.idle_producetime_max | ||
| 388 | --- hangInfo.coinTime = nowTime | ||
| 389 | --- role:updateProperty({field = "hangBag", value = items}) | ||
| 390 | --- role:updateProperty({field = "hangInfo", value = hangInfo}) | ||
| 391 | - | ||
| 392 | --- SendPacket(actionCodes.Hang_getRewardCoinRpc, MsgPack.pack({ | ||
| 393 | --- reward = reward | ||
| 394 | --- })) | ||
| 395 | --- return true | ||
| 396 | --- end | ||
| 397 | - | ||
| 398 | function _M.quickRpc(agent , data) | 350 | function _M.quickRpc(agent , data) |
| 399 | local role = agent.role | 351 | local role = agent.role |
| 400 | 352 | ||
| @@ -446,6 +398,15 @@ function _M.quickRpc(agent , data) | @@ -446,6 +398,15 @@ function _M.quickRpc(agent , data) | ||
| 446 | role:checkTaskEnter("HangGetGold", {count = reward[ItemId.Gold]}) | 398 | role:checkTaskEnter("HangGetGold", {count = reward[ItemId.Gold]}) |
| 447 | end | 399 | end |
| 448 | role:checkTaskEnter("HangQuick") | 400 | role:checkTaskEnter("HangQuick") |
| 401 | + | ||
| 402 | + role:log("residence_reward", { | ||
| 403 | + mission_threadid = math.floor(hangInfo.carbonId / 10000), --大关卡ID | ||
| 404 | + mission_id = hangInfo.carbonId, --关卡ID | ||
| 405 | + mission_type = 100, --关卡类型,见关卡类型枚举表 | ||
| 406 | + residence_reward_type = 1, --领取奖励方式,快速(超前领取)记录为1,正常领取记录为0 | ||
| 407 | + residence_time = time, --挂机或排名时长 | ||
| 408 | + residence_reward = reward, --获得奖励,建议使用json格式记录。示例:{ "XX": "1", "XXX": "3"} | ||
| 409 | + }) | ||
| 449 | SendPacket(actionCodes.Hang_quickRpc, MsgPack.pack({ | 410 | SendPacket(actionCodes.Hang_quickRpc, MsgPack.pack({ |
| 450 | reward = reward, | 411 | reward = reward, |
| 451 | change = change | 412 | change = change |